File: configure.in

package info (click to toggle)
scilab 2.4-1
  • links: PTS
  • area: non-free
  • in suites: potato, slink
  • size: 55,196 kB
  • ctags: 38,019
  • sloc: ansic: 231,970; fortran: 148,976; tcl: 7,099; makefile: 4,585; sh: 2,978; csh: 154; cpp: 101; asm: 39; sed: 5
file content (909 lines) | stat: -rw-r--r-- 21,882 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
dnl Process this file with autoconf to produce a configure script.
## Copyright INRIA


AC_REVISION($Revision: 0.00 $)dnl
AC_INIT(notice.tex)
SCIDIR=`pwd`
AC_CONFIG_AUX_DIR($SCIDIR/config)
AC_CONFIG_HEADER(routines/machine.h)

dnl Get system type
AC_CANONICAL_HOST

#################################
## check this is a source version
#################################

if test -f .binary; then
  echo "Humm... this is a binary version";
  echo "  you'd better read the README file first."
  exit
fi

###############################
## creating Path.incl if needed
###############################

if test -f Path.incl; then
  PATH_INCL=`cat Path.incl`
fi
if test "$PATH_INCL" != "SCIDIR=$SCIDIR"; then
  echo "creating Path.incl"
  cat << EOF > Path.incl
SCIDIR=$SCIDIR
EOF
fi

########################
## removing and cleaning
########################

RM='rm -f'
FILES_TO_CLEAN='*.CKP *.ln *.BAK *.bak core errs ,* *~ *.a .emacs_* tags TAGS make.log MakeOut .*~ *.trace so_locations *.orig *.cos'

##################
## making archives
##################

AR='ar cq'

######################
## use GNU compilers ?
######################

if test "$with_gnu" = yes; then
  AC_CHECK_PROG(GCC,gcc,yes,no)
  if test "$GCC" = no; then
    AC_MSG_ERROR("Unable to configure: gcc compiler not found")
  fi
  AC_CHECK_PROG(G77,g77,yes,no)
  if test "$G77" = no; then
    AC_MSG_ERROR("Unable to configure: g77 compiler not found")
  fi
else
  if test "$with_gcc" = yes; then
    AC_CHECK_PROG(GCC,gcc,yes,no)
    if test "$GCC" = no; then
      AC_MSG_ERROR("Unable to configure: gcc compiler not found")
    fi
  fi
  if test "$with_g77" = yes; then
    AC_CHECK_PROG(G77,g77,yes,no)
    if test "$G77" = no; then
      AC_MSG_ERROR("Unable to configure: g77 compiler not found")
    fi
  fi
fi

#############################################
## Compilers and options according to machine
#############################################

# use for making scripts in script directory
#   different for MIPS Ultrix
SCILAB_GS=sh
# scilab script file in script directory: default is "scilab.g" for UNIX
#   for gcwin32 use "scilab-gcwin32.g"
SCILABSCRIPT=scilab.g
# Fortran program in routines/sun: default is "fgetarg.f" 
#   for HPUX use "fgetarg-hpux.f"
FGETARG=fgetarg
# For old Hp computer (9.x), used in routines/sun/Makefile.in 
#   for choosing the good file between link_std.c and link_SYSV.c
HPPA_OLD=
# Scilab main file: default is mainsci.o for UNIX
MAIN='mainsci.o'
# for graphics: default is X11
#   different for Win32
PERIFILE=periX11.o
# specific scilab dirs for graphics: default is xsci for X11
#   different for Win32
GUILIB=xsci 
# specific scilab dirs for xdr :  default is void for X11
#   xdr for Win32
XDRLIB=
XDRLIBNAME=
# communication module: default is geci for UNIX
#   does not exist on Win32
COMM=geci
# man viewer: default is xless for UNIX
#   does not exist on Win32
MANVIEWER=xless
# graphics Metanet program: default is xmetanet for UNIX
#   does not exist on Win32
XMETANET=xmetanet
# objects files in routines/menusX: default is XOBJS for UNIX
#   for Win32 use WOBJS
MENUSOBJS=XOBJS

case "$host" in
  alpha-dec-osf4.*)
    # standard compilers
    CC=cc
    CC_OPTIONS='-O -ieee_with_inexact'
    CC_LDFLAGS='-ieee_with_inexact'
    if test "$G77" != yes; then    
      AC_CHECK_PROG(F77,f77,yes,no)
      if test "$F77" = no; then
        AC_MSG_ERROR("Unable to configure: Fortran f77 compiler not found")
      fi
    fi
    FC='DECFORT_DEBUG=T;export DECFORT_DEBUG;f77'
    FC_OPTIONS='-O -fpe3'
    FC_LDFLAGS=
    LD=ld
    LD_LDFLAGS=
    if test "$enable_debug" = yes; then 
      CC_OPTIONS='-g -ieee_with_inexact'
      FC_OPTIONS='-g -fpe3'
    fi
    # GNU compilers
    if test "$GCC" = yes; then
      CC=gcc
      CC_OPTIONS=-O
      if test "$enable_debug" = yes; then 
        CC_OPTIONS=-g
      fi
    fi
    if test "$G77" = yes; then
      FC=g77
      FC_OPTIONS=-O
      if test "$enable_debug" = yes; then 
        FC_OPTIONS=-g
      fi
    fi
    MAKEFILE_TARGET=Makefile.alpha
    ;;
  alpha-dec-osf*)
    # standard compilers
    CC=cc
    CC_OPTIONS='-O -ieee_with_inexact'
    CC_LDFLAGS='-ieee_with_inexact'
    if test "$G77" != yes; then    
      AC_CHECK_PROG(F77,f77,yes,no)
      if test "$F77" = no; then
        AC_MSG_ERROR("Unable to configure: Fortran f77 compiler not found")
      fi
    fi
    FC='DECFORT_DEBUG=T;export DECFORT_DEBUG;f77'
    FC_OPTIONS='-O -fpe3 -switch nosqrt_recip'
    FC_LDFLAGS=
    LD=ld
    LD_LDFLAGS=
    if test "$enable_debug" = yes; then 
      CC_OPTIONS='-g -ieee_with_inexact'
      FC_OPTIONS='-g -fpe3 -switch nosqrt_recip'
    fi
    # GNU compilers
    if test "$GCC" = yes; then
      CC=gcc
      CC_OPTIONS=-O
      if test "$enable_debug" = yes; then 
        CC_OPTIONS=-g
      fi
    fi
    if test "$G77" = yes; then
      FC=g77
      FC_OPTIONS=-O
      if test "$enable_debug" = yes; then 
        FC_OPTIONS=-g
      fi
    fi
    MAKEFILE_TARGET=Makefile.alpha
    ;;
  rs6000-*-*)
    # standard compilers
    CC=cc
    CC_OPTIONS='-Daix -DSYSV'
    CC_LDFLAGS=
    if test "$G77" != yes; then    
      AC_CHECK_PROG(F77,f77,yes,no)
      if test "$F77" = no; then
        AC_MSG_ERROR("Unable to configure: Fortran f77 compiler not found")
      fi
    fi
    FC=f77
    FC_OPTIONS='-qcharlen=4096'
    FC_LDFLAGS=
    LD=ld
    LD_LDFLAGS=
    if test "$enable_debug" = yes; then 
      CC_OPTIONS='-g -Daix -DSYSV'
      FC_OPTIONS='-g -qcharlen=4096'
    fi
    # GNU compilers
    if test "$GCC" = yes; then
      CC=gcc
      CC_OPTIONS=-O
      if test "$enable_debug" = yes; then 
        CC_OPTIONS=-g
      fi
    fi
    if test "$G77" = yes; then
      FC=g77
      FC_OPTIONS=-O
      if test "$enable_debug" = yes; then 
        FC_OPTIONS=-g
      fi
    fi
    MAKEFILE_TARGET=Makefile.aix
    ;;
  sparc-*-sunos*)
    # standard compilers
    CC=cc
    CC_OPTIONS=-O
    CC_LDFLAGS=
    CC_PICFLAGS=-PIC
    if test "$G77" != yes; then    
      AC_CHECK_PROG(F77,f77,yes,no)
      if test "$F77" = no; then
        AC_MSG_ERROR("Unable to configure: Fortran f77 compiler not found")
      fi
    fi
    FC=f77
    FC_OPTIONS=-O
    FC_LDFLAGS=
    FC_PICFLAGS=-PIC
    LD=ld
    LD_LDFLAGS=
    if test "$enable_debug" = yes; then 
      CC_OPTIONS=-g
      FC_OPTIONS=-g
    fi
    # GNU compilers
    if test "$GCC" = yes; then
      CC=gcc
      CC_OPTIONS=-O
      CC_PICFLAGS=
      if test "$enable_debug" = yes; then 
        CC_OPTIONS=-g
      fi
    fi
    if test "$G77" = yes; then
      FC=g77
      FC_OPTIONS=-O
      FC_PICFLAGS=
      if test "$enable_debug" = yes; then 
        FC_OPTIONS=-g
      fi
      FC_LDFLAGS='-Xlinker'
    fi
    MAKEFILE_TARGET=Makefile.sunos
    ;;
  sparc-*-solaris*)
    # standard compilers
    CC=cc
    CC_OPTIONS='-O -DSVR4 -DSYSV'
    CC_LDFLAGS=
    if test "$G77" != yes; then    
      AC_CHECK_PROG(F77,f77,yes,no)
      if test "$F77" = no; then
        AC_MSG_ERROR("Unable to configure: Fortran f77 compiler not found")
      fi
    fi
    FC=f77
    FC_OPTIONS=-O
    FC_LDFLAGS=
    LD=ld
    LD_LDFLAGS=
    if test "$enable_debug" = yes; then 
      CC_OPTIONS='-g -DSVR4 -DSYSV'
      FC_OPTIONS=-g
    fi
    # GNU compilers
    if test "$GCC" = yes; then
      CC=gcc
      CC_OPTIONS='-O -DSVR4 -DSYSV'
      if test "$enable_debug" = yes; then 
        CC_OPTIONS='-g -DSVR4 -DSYSV'
      fi
    fi
    if test "$G77" = yes; then
      FC=g77
      FC_OPTIONS=-O
      FC_LDFLAGS=-t
      if test "$enable_debug" = yes; then 
        FC_OPTIONS=-g
      fi
    fi
    MAKEFILE_TARGET=Makefile.solaris
    ;;
# Linux a.out
  *-pc-linux-gnuaout)
    LIEEELIB=
    AC_CHECK_LIB(ieee,main,
      [LIEEELIB=-lieee])
    CC=cc
    CC_OPTIONS='-O -Dlinux -fwritable-strings'
    CC_LDFLAGS=$LIEEELIB
    # find Fortran compiler
    # g77 already asked and found: good
    if test "$G77" = yes; then
      FC=g77
    # option with-f2c
    elif test "$with_f2c" = yes; then
      AC_CHECK_PROG(F2C,f2c,yes,no)
      if test "$F2C" = no; then
        AC_MSG_ERROR("Unable to configure: f2c compiler not found")
      fi
      # script shell f77 have bugs, get ours
      FC='${SCIDIR}/bin/f77-linux'
    else
      # first find g77
      AC_CHECK_PROG(G77,g77,yes,no)
      if test "$G77" = yes; then
        FC=g77
      else
      # otherwise find f2c
        AC_CHECK_PROG(F2C,f2c,yes,no)
        if test "$F2C" = yes; then
          # script shell f77 have bugs, get ours
          FC='${SCIDIR}/bin/f77-linux'
        else
          AC_MSG_ERROR("Unable to configure: no Fortran compiler found")    
        fi
      fi
    fi
    FC_OPTIONS=-O
    FC_LDFLAGS=$LIEEELIB
    LD=ld
    LD_LDFLAGS=$LIEEELIB
    if test "$enable_debug" = yes; then 
      CC_OPTIONS='-g -Dlinux -fwritable-strings'
      FC_OPTIONS=-g
    fi
    DLDLIB='${SCIDIR}/libs/libdld.a'
    DLD_SUBDIR=dld
    MAKEFILE_TARGET=Makefile.linux
   ;;
# Linux ELF
  *-pc-linux-gnu)
    LIEEELIB=
    AC_CHECK_LIB(ieee,main,
      [LIEEELIB=-lieee])
    CC=cc
    CC_OPTIONS='-O -Dlinux -fwritable-strings'
    CC_LDFLAGS=$LIEEELIB
    # find Fortran compiler
    # g77 already asked and found: good
    if test "$G77" = yes; then
      FC=g77
    # option with-f2c
    elif test "$with_f2c" = yes; then
      AC_CHECK_PROG(F2C,f2c,yes,no)
      if test "$F2C" = no; then
        AC_MSG_ERROR("Unable to configure: f2c compiler not found")
      fi
      # script shell f77 have bugs, get ours
      FC='${SCIDIR}/bin/f77-linux'
    else
      # first find g77
      AC_CHECK_PROG(G77,g77,yes,no)
      if test "$G77" = yes; then
        FC=g77
      else
      # otherwise find f2c
        AC_CHECK_PROG(F2C,f2c,yes,no)
        if test "$F2C" = yes; then
          # script shell f77 have bugs, get ours
          FC='${SCIDIR}/bin/f77-linux'
        else
          AC_MSG_ERROR("Unable to configure: no Fortran compiler found")    
        fi
      fi
    fi
    FC_OPTIONS='-O -funix-intrinsics-delete'
    FC_LDFLAGS="$LIEEELIB -ldl -rdynamic"
    LD=ld
    LD_LDFLAGS=$LIEEELIB
    if test "$enable_debug" = yes; then 
      CC_OPTIONS='-g -Dlinux -fwritable-strings'
      FC_OPTIONS=-g
    fi
    MAKEFILE_TARGET=Makefile.linux
   ;;
  # MIPS ULTRIX NO LONGER SUPPORTED
  mips-*-ultrix*)
    # standard compilers
    CC=cc
    CC_OPTIONS=-O0
    CC_LDFLAGS=
    if test "$G77" != yes; then    
      AC_CHECK_PROG(F77,f77,yes,no)
      if test "$F77" = no; then
        AC_MSG_ERROR("Unable to configure: Fortran f77 compiler not found")
      fi
    fi
    FC=f77
    FC_OPTIONS='-O0 -fpe1'
    FC_LDFLAGS=
    LD=ld
    LD_LDFLAGS=
    if test "$enable_debug" = yes; then 
      CC_OPTIONS=-g
      FC_OPTIONS='-g -fpe1'
    fi
    SCILAB_GS=sh5
    # GNU compilers
    if test "$GCC" = yes; then
      CC=gcc
      CC_OPTIONS=-O
      if test "$enable_debug" = yes; then 
        CC_OPTIONS=-g
      fi
    fi
    if test "$G77" = yes; then
      FC=g77
      FC_OPTIONS=-O
      if test "$enable_debug" = yes; then 
        FC_OPTIONS=-g
      fi
    fi
    MAKEFILE_TARGET=Makefile.ultrix
    ;;
  mips-sgi-irix*)
    # standard compilers
    CC=cc
    CC_OPTIONS='-O -cckr -DSYSV -DSVR4'
    CC_LDFLAGS=
    if test "$G77" != yes; then    
      AC_CHECK_PROG(F77,f77,yes,no)
      if test "$F77" = no; then
        AC_MSG_ERROR("Unable to configure: Fortran f77 compiler not found")
      fi
    fi
    FC=f77
    FC_OPTIONS='-O -Nl999 -Nn15000'
    FC_LDFLAGS=
    LD=ld
    LD_LDFLAGS=
    if test "$enable_debug" = yes; then 
      CC_OPTIONS='-g -cckr -DSYSV -DSVR4'
      FC_OPTIONS='-g -Nl999 -Nn15000'
    fi
    # GNU compilers
    if test "$GCC" = yes; then
      CC=gcc
      CC_OPTIONS=-O
      if test "$enable_debug" = yes; then 
        CC_OPTIONS=-g
      fi
    fi
    if test "$G77" = yes; then
      FC=g77
      FC_OPTIONS=-O
      if test "$enable_debug" = yes; then 
        FC_OPTIONS=-g
      fi
    fi
    MAKEFILE_TARGET=Makefile.sgi
    ;;
  # OLD HP
  *-*-hpux9.*)
    # standard compilers
    HPPA_OLD=-Dhppa_old
    CC=cc
    CC_OPTIONS='-O -DSYSV -Dhpux'
    CC_LDFLAGS='-Wl,-a,archive'
    if test "$G77" != yes; then    
      AC_CHECK_PROG(F77,fort77,yes,no)
      if test "$F77" = no; then
        AC_MSG_ERROR("Unable to configure: Fortran fort77 compiler not found")
      fi
    fi
    FC=fort77
    FC_OPTIONS='-O +Obb1200 +E4'
    FC_LDFLAGS='-Wl,-a,archive'
    LD=ld
    LD_LDFLAGS='-a archive'
    if test "$enable_debug" = yes; then 
      CC_OPTIONS='-g -DSYSV -Dhpux'
      FC_OPTIONS='-g +E4'
    fi
    # GNU compilers
    if test "$GCC" = yes; then
      CC=gcc
      CC_OPTIONS=-O
      if test "$enable_debug" = yes; then 
        CC_OPTIONS=-g
      fi
    fi
    if test "$G77" = yes; then
      FC=g77
      FC_OPTIONS=-O
      if test "$enable_debug" = yes; then 
        FC_OPTIONS=-g
      fi
    fi
    MAKEFILE_TARGET=Makefile.hpux9
    FGETARG=fgetarg-hpux
    ;;
  *-*-hpux*)
    # standard compilers
    CC=cc
    CC_OPTIONS='-O -DSYSV -Dhpux +Z +DAportable'
    CC_LDFLAGS='-Wl,+vnocompatwarnings,-E /usr/lib/libdld.sl'
    if test "$G77" != yes; then    
      AC_CHECK_PROG(F77,fort77,yes,no)
      if test "$F77" = no; then
        AC_MSG_ERROR("Unable to configure: Fortran fort77 compiler not found")
      fi
    fi
    FC=fort77
    FC_OPTIONS='+O0 +E4 +Z +DAportable'
    FC_LDFLAGS='-Wl,+vnocompatwarnings,-E /usr/lib/libdld.sl'
    LD=ld
    LD_LDFLAGS=
    if test "$enable_debug" = yes; then 
      CC_OPTIONS='-g -DSYSV -Dhpux'
      FC_OPTIONS='-g +E4'
    fi
    # GNU compilers
    if test "$GCC" = yes; then
      CC=gcc
      CC_OPTIONS=-O
      if test "$enable_debug" = yes; then 
        CC_OPTIONS=-g
      fi
    fi
    if test "$G77" = yes; then
      FC=g77
      FC_OPTIONS=-O
      if test "$enable_debug" = yes; then 
        FC_OPTIONS=-g
      fi
    fi
    MAKEFILE_TARGET=Makefile.hpux
    FGETARG=fgetarg-hpux
    ;;
  *-*-cygwin32)
    SCILABSCRIPT=scilab-gcwin32.g
    PERIFILE=periWin.o
    MAIN='mainwin95.o'
    GUILIB='wsci'
    XDRLIB='xdr'
    XDRLIBNAME='libs/xdr.a'
    MENUSOBJS=WOBJS
    COMM=
    MANVIEWER=wless
    XMETANET=
    CC=gcc 
    CC_OPTIONS='-O -DWIN32 -fwritable-strings  -Wall'
      if test "$enable_debug" = yes; then 
	CC_OPTIONS='-g -DWIN32 -fwritable-strings  -Wall'
      fi
    CC_LDFLAGS=
    FC=f77
    if test "$G77" = yes; then
      FC=g77
    fi 
    FC_OPTIONS='-O'
      if test "$enable_debug" = yes; then 
        FC_OPTIONS=-g
      fi
    FC_LDFLAGS=
    LD=gcc
    LD_LDFLAGS=
    WINXFLAGS='-I../xdr'
    MAKEFILE_TARGET=Makefile.gcwin32
    ;;
  *)
    AC_MSG_ERROR("Unable to configure for host $host")
    ;;
esac

# flag for possible compilations in configure
CFLAGS=$CC_OPTIONS

############################
## test for various programs
############################

AC_PROG_RANLIB

####################
## test for X Window
####################
if test "$PERIFILE" = periX11.o; then 
AC_PATH_XTRA

# fixing a bug for SunOs
if test "$X_LIBS" = ' -L/usr/lib'; then
  X_LIBS=
fi

if test "$no_x" = yes; then
  AC_MSG_ERROR("X Window not found")
fi
fi 

###################
## find X11 release
###################

if test "$PERIFILE" = periX11.o; then 
AC_CACHE_CHECK("for X11 release",ac_cv_X11_release,
[
cat << EOF > testX11.c
#include <X11/Xlib.h>
main()
{
#ifdef XlibSpecificationRelease
  if (XlibSpecificationRelease == 5)
    printf("R5\n");
  else if (XlibSpecificationRelease == 6)
    printf("R6\n");
  else
    printf("R?\n");
#else
  printf("R4\n");
#endif
}
EOF
eval "$CC $X_CFLAGS -o testX11 testX11.c > /dev/null 2>&1"
ac_cv_X11_release=`./testX11`
$RM testX11.c testX11
])
fi 
######################################
## test for Xaw and Xmu Athena widgets
######################################
if test "$PERIFILE" = periX11.o; then 
if test "$with_local_Xaw" = yes; then
  if test "$ac_cv_X11_release" = R4; then
    AC_MSG_ERROR("Local Xaw and Xmu Libraries cannot be used with X11R4")
  else
    XAWLIB='$(SCIDIR)/libs/libXaw.a'
    XMULIB='$(SCIDIR)/libs/libXmu.a'
    XAW_LOCAL_LIB='$(SCIDIR)/libs/libXaw.a $(SCIDIR)/libs/libXmu.a'
    XAW_LOCAL_INCLUDES='-I$(SCIDIR)/routines'
    XAW_LOCAL_SUBDIR=X11
  fi
else
  ac_save_LDFLAGS="$LDFLAGS"
  if test -n "$x_libraries"; then
    LDFLAGS="$LDFLAGS -L$x_libraries"
  fi
  AC_CHECK_LIB(Xmu,main,[XAthena=yes],[XAthena=no],-lXt -lXext $X_PRE_LIBS -lX11 $X_EXTRA_LIBS)
  AC_CHECK_LIB(Xaw,main,[XAthena=yes],[XAthena=no],-lXmu -lXt -lXext $X_PRE_LIBS -lX11 $X_EXTRA_LIBS)
  LDFLAGS="$ac_save_LDFLAGS"
  if test "$XAthena" = no; then
    AC_MSG_WARN("Xaw and/or Xmu Library missing")
    if test "$ac_cv_X11_release" = R4; then
      AC_MSG_ERROR("Local Xaw and Xmu Libraries cannot be used with X11R4")
    else
      AC_MSG_WARN("Using Local Xaw and Xmu Libraries")
      XAWLIB='$(SCIDIR)/libs/libXaw.a'
      XMULIB='$(SCIDIR)/libs/libXmu.a'
      XAW_LOCAL_LIB='$(SCIDIR)/libs/libXaw.a $(SCIDIR)/libs/libXmu.a'
      XAW_LOCAL_INCLUDES='-I$(SCIDIR)/routines'
      XAW_LOCAL_SUBDIR=X11
    fi
  else
    XAWLIB=-lXaw
    XMULIB=-lXmu
  fi
fi
fi
#######################
## test for underscores
#######################

AC_MSG_CHECKING("for leading and/or trailing underscores")
cat << EOF > pipof.f
       subroutine pipof
       end
EOF

dnl expand possible $SCIDIR in $FC (wizard command...)
eval "FC1=\"$FC\""
eval "$FC1 -c pipof.f > /dev/null 2>&1"

FC_LEADING_UNDERSCORE=no
FC_TRAILING_UNDERSCORE=no

output=`nm pipof.o|grep _pipof 2>&1`
if test ! -z "$output"; then
  FC_LEADING_UNDERSCORE=yes
  FC_TRAILING_UNDERSCORE=no
fi

output=`nm pipof.o|grep pipof_ 2>&1`
if test ! -z "$output"; then
  FC_LEADING_UNDERSCORE=no
  FC_TRAILING_UNDERSCORE=yes
fi

output=`nm pipof.o|grep _pipof_ 2>&1`
if test ! -z "$output"; then
  FC_LEADING_UNDERSCORE=yes
  FC_TRAILING_UNDERSCORE=yes
fi

if test "$FC_LEADING_UNDERSCORE" = yes; then
  AC_DEFINE(WLU)
fi
if test "$FC_TRAILING_UNDERSCORE" = yes; then
  AC_DEFINE(WTU)
fi

$RM pipof.f pipof.o

AC_MSG_RESULT("$FC_LEADING_UNDERSCORE $FC_TRAILING_UNDERSCORE")

#####################
## test for sharpsign
#####################

AC_MSG_CHECKING("for use of sharpsign in CPP")
AC_TRY_COMPILE([#define C2F(name) name##_],
  [C2F(toto)()],  
  AC_MSG_RESULT(yes)
  AC_DEFINE(USE_SHARP_SIGN),
  AC_MSG_RESULT(no))

##############################################################
## test for functions in standard C library and C math library
##############################################################
AC_CHECK_LIB(m,main)
AC_CHECK_FUNCS(exp10)
AC_CHECK_FUNCS(getwd)
AC_CHECK_FUNCS(sleep)
AC_CHECK_FUNCS(strerror)
AC_CHECK_FUNCS(usleep)

##################
## termcap library
##################
TERMCAPLIB=no
AC_CHECK_LIB(termcap,main,
  [TERMCAPLIB=-ltermcap])
if test "$TERMCAPLIB" = no; then
  AC_CHECK_LIB(termlib,main,
  [TERMCAPLIB=-ltermlib])
fi
if test "$TERMCAPLIB" = no; then
  AC_CHECK_LIB(curses,main,
  [TERMCAPLIB=-lcurses])
fi

if test "$TERMCAPLIB" != no; then
  AC_DEFINE(HAVE_TERMCAP)
else
  TERMCAPLIB=
fi

#################
## PVM
#################

PVMARCH=
PVMLIB=
PVMGLIB=
PVMSCIDIR= 
AC_CACHE_CHECK("for PVM architecture",ac_cv_PVM_arch,
[
ac_cv_PVM_arch=`./pvm3/lib/pvmgetarch`
])
if test "$ac_cv_PVM_arch" = UNKNOWN; then
  AC_MSG_WARN("PVM unable to find architecture: I will not use PVM")
  PVMARCH="$ac_cv_PVM_arch"
else
  AC_DEFINE(WITH_PVM)
  PVMARCH="$ac_cv_PVM_arch"
  PVMGLIB="\$(SCIDIR)/pvm3/lib/$ac_cv_PVM_arch/libgpvm3.a"
  PVMLIB="\$(SCIDIR)/pvm3/lib/$ac_cv_PVM_arch/libpvm3.a"
  PVMSCIDIR="pvm"
fi 

#################
## Tcl/Tk library
#################

# check user arguments

TK_INC_PATH=
TK_LIB_PATH=
TCLTK_LIBS=
TKSCILIB=
TKSCIDIR=

if test "$with_tk" = yes; then

# check user arguments

USER_TCL_LIB_PATH=
USER_TCL_INC_PATH=
AC_ARG_WITH(tcl-library,
    [  --with-tcl-library=TCL_LIB_DIR  Tcl library is in TCL_LIB_DIR.],
    [  USER_TCL_LIB_PATH=$withval
    ])
AC_ARG_WITH(tcl-include,
    [  --with-tcl-include=TCL_INC_DIR  Tcl include is in TCL_INC_DIR.],
    [  USER_TCL_INC_PATH=$withval
    ])

USER_TK_LIB_PATH=$USER_TCL_LIB_PATH
USER_TK_INC_PATH=$USER_TCL_INC_PATH
AC_ARG_WITH(tk-library,
    [  --with-tk-library=TK_LIB_DIR    Tk library is in TK_LIB_DIR
                          [TK_LIB_DIR=TCL_LIB_DIR].],
    [  USER_TK_LIB_PATH=$withval
    ])
AC_ARG_WITH(tk-include,
    [  --with-tk-include=TK_INC_DIR    Tk include is in TK_INC_DIR 
                          [TK_INC_DIR=TCL_INC_DIR].],
    [  USER_TK_INC_PATH=$withval
    ])


saved_cflags="$CFLAGS"
saved_ldflags="$LDFLAGS"
saved_cppflags="$CPPFLAGS"

AC_CHECK_LIB(dl, main,TCLTK_LIBS=" -ldl")
AC_CHECK_TCLTK()

# set variables
if test $WITH_TKSCI = 1; then
  AC_DEFINE(WITH_TK)
  TKSCILIB=libs/tksci.a
  TKSCIDIR=tksci
else
 AC_MSG_ERROR("TCL/TK not found") 
fi

fi

#########################
## substituting variables
#########################

AC_SUBST(RM)
AC_SUBST(AR)
AC_SUBST(FILES_TO_CLEAN)
AC_SUBST(CC)
AC_SUBST(CC_OPTIONS)
AC_SUBST(CC_LDFLAGS)
AC_SUBST(CC_PICFLAGS)
AC_SUBST(FC)
AC_SUBST(FC_OPTIONS)
AC_SUBST(FC_LDFLAGS)
AC_SUBST(FC_PICFLAGS)
AC_SUBST(LD)
AC_SUBST(LD_LDFLAGS)
AC_SUBST(SCILAB_GS)
AC_SUBST(SCILABSCRIPT)
AC_SUBST(FGETARG)
AC_SUBST(HPPA_OLD)
AC_SUBST(DLDLIB)
AC_SUBST(DLD_SUBDIR)
AC_SUBST(XAWLIB)
AC_SUBST(XMULIB)
AC_SUBST(XAW_LOCAL_SUBDIR)
AC_SUBST(XAW_LOCAL_INCLUDES)
AC_SUBST(XAW_LOCAL_LIB)
AC_SUBST(TERMCAPLIB)
AC_SUBST(MAIN)
AC_SUBST(MAKEFILE_TARGET)
AC_SUBST(PERIFILE)
AC_SUBST(GUILIB)
AC_SUBST(XDRLIB)
AC_SUBST(XDRLIBNAME)
AC_SUBST(WINXFLAGS)
AC_SUBST(COMM)
AC_SUBST(MANVIEWER)
AC_SUBST(XMETANET)
AC_SUBST(MENUSOBJS)
AC_SUBST(PVMARCH)
AC_SUBST(PVMLIB)
AC_SUBST(PVMSCIDIR)
AC_SUBST(PVMGLIB)
AC_SUBST(TK_INC_PATH)
AC_SUBST(TCL_INC_PATH)
AC_SUBST(TCLTK_LIBS)
AC_SUBST(TKSCILIB)
AC_SUBST(TKSCIDIR)

AC_OUTPUT(Makefile.incl Makefile scripts/Makefile routines/Makefile routines/default/Makefile routines/sun/Makefile routines/graphics/Makefile routines/menusX/Makefile routines/xsci/Makefile)