File: configure.in

package info (click to toggle)
scilab 4.1.2-6
  • links: PTS, VCS
  • area: non-free
  • in suites: lenny
  • size: 113,992 kB
  • ctags: 65,732
  • sloc: ansic: 406,468; fortran: 242,412; xml: 223,812; tcl: 46,703; sh: 10,945; ml: 9,441; makefile: 4,697; cpp: 1,354; java: 926; csh: 260; yacc: 247; perl: 130; lex: 126; asm: 72; lisp: 30
file content (2361 lines) | stat: -rw-r--r-- 61,944 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
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
dnl Process this file with autoconf to produce a configure script.
## Copyright INRIA/Enpc

AC_REVISION($Revision: 1.132.2.6 $)dnl
AC_INIT(license.txt)
SCIDIR=`pwd`
AC_CONFIG_AUX_DIR(config)
AC_CONFIG_HEADER(routines/machine.h)

dnl Get system type
dnl use "config.guess" and "config.sub" from directory "config"
AC_CANONICAL_HOST

# default prefix
ac_default_prefix=/usr

#################################

AC_ARG_ENABLE(debug,
   [  --enable-debug          compile with "-g" option and do not optimize ])

AC_ARG_WITH(gcc,
    [  --with-gcc              use gcc C compiler ])
    
AC_ARG_WITH(g77,
    [  --with-g77              use g77, GNU Fortran 77 compiler ])

AC_ARG_WITH(gfortran,
    [  --with-gfortran         use gfortran, GNU Fortran 95 compiler ])

AC_ARG_WITH(gnu,
    [  --with-gnu              use gcc C compiler and gnu Fortran compiler (g77 or gfortran) ])

AC_ARG_WITH(intelcompilers,
    [  --with-intelcompilers   use intel icc and ifort Fortran compiler ])

AC_ARG_WITH(f2c,
    [  --with-f2c              use f2c C compiler on Linux systems ])
    
AC_ARG_WITH(local-xaw,
    [  --with-local-xaw        use Xaw3d widgets given with Scilab  ])

AC_ARG_WITH(pvm,
    [  --without-pvm           do not compile with PVM library ])

AC_ARG_WITH(tk,
    [  --without-tk            do not compile with TCL/TK ])

AC_ARG_WITH(gtk,
    [  --with-gtk              use Gtk widgets ])

AC_ARG_WITH(gtk2,
    [  --with-gtk2             use Gtk widgets ])

AC_ARG_WITH(addedf2c,
    [  --with-addedf2c         build a local f2c (routines/f2c)])

AC_ARG_WITH(ocam,
    [  --without-ocaml         do not compile with ocaml ])

AC_ARG_WITH(java,
    [  --without-java          do not compile  Java interface ])

#################################
## 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
###############################
# 
# change scidir for mingw 
#   *-*-cygwin* |   *-*-mingw32*)

case "$host" in
   *-*-mingw32*)
    SCIDIR=`echo $SCIDIR | sed -e 's+/cygdrive/\([[a-zA-Z]]*\)/+\1:/+g' `
    ;;
esac

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

###############################
## get the version 
###############################

SCIVERSION=`cat Version.incl | sed -e "s/SCIVERSION=//" `

########################
## 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 *.obj' 

#####################################################
## if specific compilers required check if they exist
#####################################################

if test "$with_gnu" = yes; then
	# GNU C and Fortran compilers required
	AC_CHECK_PROG(WITH_GCC,gcc,yes,no)
	if test "$WITH_GCC" = no; then
		AC_MSG_ERROR([Unable to configure: gcc compiler not found])
	fi
	AC_CHECK_PROG(WITH_G77,g77,yes,no)
	if test "$WITH_G77" = no; then
		AC_CHECK_PROG(WITH_GFORTRAN,gfortran,yes,no)
		if test "$WITH_GFORTRAN" = no; then
			AC_MSG_ERROR([Unable to configure: g77 or gfortran compiler not found])
		fi
	fi
elif test "$with_intelcompilers" = yes; then
	# intel C and Fortran compilers required
	AC_CHECK_PROGS(ICC,icc ecc,no)
	if test "$ICC" = no; then
		AC_MSG_ERROR([Unable to configure: icc nor ecc  compiler found])
	fi
	AC_CHECK_PROGS(IFC,ifort ifc efc,no)
	if test "$IFC" = no; then
		AC_MSG_ERROR([Unable to configure: ifc nor efc compiler  found])
	fi
	AC_MSG_WARN([Scilab incremental link may be buggy with Intel Compiler(s). 
See bug 1925])
	sleep 5
elif test "$with_gcc" = yes; then
	# GNU gcc required
	AC_CHECK_PROG(WITH_GCC,gcc,yes,no)
	if test "$WITH_GCC" = no; then
		AC_MSG_ERROR([Unable to configure: gcc compiler not found])
	fi
elif test "$with_g77" = yes; then
	# GNU g77 required
	AC_CHECK_PROG(WITH_G77,g77,yes,no)
	if test "$WITH_G77" = no; then
		AC_MSG_ERROR([Unable to configure: g77 compiler not found])
	fi
elif test "$with_gfortran" = yes; then
	# GNU g95 (gfortran) required
	AC_CHECK_PROG(WITH_GFORTRAN,gfortran,yes,no)
	if test "$WITH_GFORTRAN" = no; then
		AC_MSG_ERROR([Unable to configure: gfortran compiler not found])
	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/os_specific: default is "fgetarg.f" 
#   for HPUX use "fgetarg-hpux.f"
FGETARG=fgetarg
GETARG=getarg
# Fortran program in routines/calelm: default is "scidcopy.f" 
#   for HPUX use "scidcopy-hpux.f"
SCIDCOPY=scidcopy
# Fortran program in routines/calelm: default is "unsfdcopy.f" 
#   for HPUX use "unsfdcopy-hpux.f"
UNSFDCOPY=unsfdcopy
# For old Hp computer (9.x), used in "routines/os_specific/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 for gnome/gtk version 
GZVT=
# specific scilab dirs for xdr:  default is void for X11
#   xdr for Win32
XDRLIB=
XDRLIBNAME=
# objects files in routines/menusX: default is XOBJS for UNIX
#   for Win32 use WOBJS
MENUSOBJS=XOBJS
# use other malloc (in "routines/os_specific" directory) for some 64 bits machines
MALLOC=
# USE_CDEC directives for Dec Alpha
FC_USE_CDEC=DEC
# want to build Scilab f2c too 
if test "$with_addedf2c" = yes; then
  F2C_SUBDIR=f2c/src
else
  F2C_SUBDIR=
fi
# on windows target generating scripts for 
# printing is useless 
BLPR_SCRIPTS='$(BPROGRAMS)'
# on windows target when generating script 
# cygdrive/xxx must be replaced by xxx:/ 
# for mingw32 
SED_CYGDRIVE=
# subset of examples which are supposed to work 
EXAMPLES_TESTS='$(SUBDIRS1) $(SUBDIRS2)'
# special stuff for cygwin in impdir 
IMPPREF=S
IMPENV= 
# strip executable (not to be done on darwin) 
STRIP=strip
# periX11.c must be compiled without optimization on Darwin
PERIX11NOPT=periX11darwin
NMOPT=

#########################
## libtool 
#########################

echo "configuration of libtool"

AC_PROG_LIBTOOL

echo "end of configuration of libtool"
#########################
# setting parameters according to system types
#########################
# suffix of dynamic libraries
SONAME=so

GCCFIX=

case "$host" in
# Dec Alpha OSF 4
  alpha*-dec-osf4.*)
    # C compilers
    if test "$WITH_GCC" = yes; then
      CC=gcc
      CC_OPTIONS=-O -DNDEBUG
      if test "$enable_debug" = yes; then 
        CC_OPTIONS=-g
      fi
    else
      CC=cc
      CC_OPTIONS='-std -O -DNDEBUG -ieee_with_inexact'
      CC_LDFLAGS='-ieee_with_inexact'
    fi
    #fortran compiler
    if test "$WITH_G77" = yes; then    
      FC=g77
      FC_OPTIONS=-O
      FC_OPTIONS_O0=
      if test "$enable_debug" = yes; then 
        FC_OPTIONS=-g
      fi
    else
      AC_CHECK_PROGS(F77,f77 f90 f2c-f77,no)
      if test "$F77" = no; then
        AC_MSG_ERROR([Unable to configure: Fortran f77 compiler not found])
      fi
      FC="$F77"
      FC_OPTIONS='-O -fpe3'
      FC_OPTIONS_O0='-fpe3'
      FC_LDFLAGS=
      FC_USE_CDEC='   '
      if test "$enable_debug" = yes; then 
        CC_OPTIONS='-std -g -ieee_with_inexact'
        FC_OPTIONS='-g -fpe3'
      fi
    fi
    LD=ld
    LD_LDFLAGS=

    MAKEFILE_TARGET=Makefile.alpha
    ;;
# Dec Alpha not OSF 4 (NO LONGER SUPPORTED)
  alpha*-dec-osf*)
    # standard compilers
    CC=cc
    CC_OPTIONS='-O -DNDEBUG -ieee_with_inexact'
    CC_LDFLAGS='-ieee_with_inexact'
    if test "$WITH_G77" != yes; then    
      #AC_CHECK_PROG(F77,f77,yes,no)
      AC_CHECK_PROGS(F77,f77 f90 f2c-f77,no)
      if test "$F77" = no; then
        AC_MSG_ERROR([Unable to configure: Fortran f77 compiler not found])
      fi
      FC="$F77"
    fi
    #FC="$F77"
    FC_OPTIONS='-O -fpe3 -switch nosqrt_recip'
    FC_OPTIONS_O0='-fpe3 -switch nosqrt_recip'
    FC_LDFLAGS=
    FC_USE_CDEC='   '
    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 "$WITH_GCC" = yes; then
      CC=gcc
      CC_OPTIONS=-O -DNDEBUG
      if test "$enable_debug" = yes; then 
        CC_OPTIONS=-g
      fi
    fi
    if test "$WITH_G77" = yes; then
      FC=g77
      FC_OPTIONS=-O
      FC_OPTIONS_O0=
      if test "$enable_debug" = yes; then 
        FC_OPTIONS=-g
      fi
    fi
    MAKEFILE_TARGET=Makefile.alpha
    ;;
# IBM AIX RS 6000 (NO LONGER SUPPORTED)
  rs6000-*-*)
    # standard compilers
    CC=cc
    CC_OPTIONS='-Daix -DSYSV'
    CC_LDFLAGS=
    if test "$WITH_G77" != yes; then    
      #AC_CHECK_PROG(F77,f77,yes,no)
      AC_CHECK_PROGS(F77,f77 f90 f2c-f77,no)
      if test "$F77" = no; then
        AC_MSG_ERROR([Unable to configure: Fortran f77 compiler not found])
      fi
      FC="$F77"
    fi
    #FC="$F77"
    FC_OPTIONS='-qcharlen=4096'
    FC_OPTIONS_O0='-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 "$WITH_GCC" = yes; then
      CC=gcc
      CC_OPTIONS=-O -DNDEBUG
      if test "$enable_debug" = yes; then 
        CC_OPTIONS=-g
      fi
    fi
    if test "$WITH_G77" = yes; then
      FC=g77
      FC_OPTIONS=-O
      FC_OPTIONS_O0=
      if test "$enable_debug" = yes; then 
        FC_OPTIONS=-g
      fi
    fi
    MAKEFILE_TARGET=Makefile.aix
    ;;
# SUN OS (NO LONGER SUPPORTED)
  sparc-*-sunos*)
    # standard compilers
    CC=cc
    CC_OPTIONS=-O -DNDEBUG
    CC_LDFLAGS=
    CC_PICFLAGS=-PIC
    if test "$WITH_G77" != yes; then    
      #AC_CHECK_PROG(F77,f77,yes,no)
      AC_CHECK_PROGS(F77,f77 f90 f2c-f77,no)
      if test "$F77" = no; then
        AC_MSG_ERROR([Unable to configure: Fortran f77 compiler not found])
      fi
      FC="$F77"
    fi
    #FC="$F77"
    FC_OPTIONS=-O
    FC_OPTIONS_O0=
    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 "$WITH_GCC" = yes; then
      CC=gcc
      CC_OPTIONS=-O -DNDEBUG
      CC_PICFLAGS=
      if test "$enable_debug" = yes; then 
        CC_OPTIONS=-g
      fi
    fi
    if test "$WITH_G77" = yes; then
      FC=g77
      FC_OPTIONS=-O
      FC_OPTIONS_O0=
      FC_PICFLAGS=
      if test "$enable_debug" = yes; then 
        FC_OPTIONS=-g
      fi
      FC_LDFLAGS='-Xlinker'
    fi
    MAKEFILE_TARGET=Makefile.sunos
    ;;
# SUN SOLARIS
  *-*-solaris*)
    # standard compilers
    CC=cc
    CC_OPTIONS='-O -DNDEBUG -DSVR4 -DSYSV -Dsolaris'
    CC_LDFLAGS=
    if test "$WITH_G77" != yes; then    
      #AC_CHECK_PROG(F77,f77,yes,no)
      AC_CHECK_PROGS(F77,f77 f90 f2c-f77,no)
      if test "$F77" = no; then
        AC_MSG_ERROR([Unable to configure: Fortran f77 compiler not found])
      fi
      FC="$F77"
    fi
    #FC="$F77"
    FC_OPTIONS=-O
    FC_OPTIONS_O0=
    FC_LDFLAGS=
    LD=ld
    LD_LDFLAGS=
    if test "$enable_debug" = yes; then 
      CC_OPTIONS='-g -DSVR4 -DSYSV -Dsolaris'
      FC_OPTIONS=-g
    fi
    # GNU compilers
    if test "$WITH_GCC" = yes; then
      CC=gcc
      CC_OPTIONS='-O2 -DNDEBUG -DSVR4 -DSYSV -Dsolaris'
      if test "$enable_debug" = yes; then 
        CC_OPTIONS='-g -DSVR4 -DSYSV -Dsolaris'
      fi
    fi
    if test "$WITH_G77" = yes; then
      FC=g77
      FC_OPTIONS=-O2
      FC_OPTIONS_O0=
      FC_LDFLAGS='-t' 
#     for solaris 2.7 with gcc/g77 2.95.2, binutils 2.9 
#     the correct value should be 
#     FC_LDFLAGS='-t -Wl,-export-dynamic'
#     but we need to check this case 
      if test "$enable_debug" = yes; then 
        FC_OPTIONS=-g
      fi
    fi
    AC_F77_LIBRARY_LDFLAGS
    MAKEFILE_TARGET=Makefile.solaris
    ;;
# Linux, old binary format a.out (NO LONGER SUPPORTED)
  *-pc-linux-gnuaout)
    LIEEELIB=
    AC_CHECK_LIB(ieee,main,
      [LIEEELIB=-lieee])
    GCC=yes
    CC=gcc
    CC_OPTIONS='-O -DNDEBUG -Dlinux -fwritable-strings'
    CC_LDFLAGS=$LIEEELIB
    # find Fortran compiler
    # g77 already asked and found: good
    if test "$WITH_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(WITH_G77,g77,yes,no)
      if test "$WITH_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_OPTIONS_O0=
    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 gnu: x86_64 distributions added by cdh 2004-09-29 ( modified 2006-06-01 to find gfortran if needed )
x86_64-*-linux-gnu)
	LIEEELIB=
	AC_CHECK_LIB(ieee,main,
	[LIEEELIB=-lieee])

	MALLOC=malloc.o

	if test "$with_intelcompilers" = yes; then
		GCC=no
		CC=$ICC
		FC=$IFC
		CC_OPTIONS='-O -DNDEBUG -Dlinux -DNARROWPROTO -mp'
		CC_PICFLAGS="-fPIC"
		# -cm remove comments displays, -w90  -w95 remove warnings abort f90 f95 non standard
		FC_OPTIONS="-O -cm -w90 -w95 -mp "
		FC_OPTIONS_O0="-cm  -w90 -w95 -mp "
		if test "$enable_debug" = yes; then
			CC_OPTIONS='-g -Wall -Dlinux  -DNARROWPROTO  -mp '
			FC_OPTIONS="-g -cm  -w90 -w95 -mp "
		fi
		CC_LDFLAGS="$LIEEELIB  -Wl,-relax"
		FC_LDFLAGS="$LIEEELIB -ldl  -lPEPCF90 -Wl,-relax "
		LD=xild
		LD_LDFLAGS="$LIEEELIB -lPEPCF90 -Wl,-relax "
	else
		GCC=yes
		CC=gcc
		# CC_PLAT_OPTIONS is optional, and is used to add CPU specific code generation tuning for Athlon64 presumably Opteron could benefit too but these are not optimized for the Opteron
		CC_PLAT_OPTIONS='-march=athlon64 -mfpmath=sse -msse2 -m3dnow -m64'
		
		CC_PICFLAGS='-fPIC'
		FC_PICFLAGS='-fPIC'
		
		CC_OPTIONS="-O2 -DNDEBUG -Dlinux  -DNARROWPROTO $CC_PLAT_OPTIONS $CC_PICFLAGS "
		CC_LDFLAGS=$LIEEELIB

		if test "$enable_debug" = yes; then
			CC_OPTIONS="-g -Wall -Dlinux -DNARROWPROTO $CC_PLAT_OPTIONS $CC_PICFLAGS "
		fi
		# find Fortran compiler
		# g77 already asked and found: good
		if test "$WITH_G77" = yes; then
			FC=g77
			FC_PICFLAGS=-fPIC
			if test "$enable_debug" = yes; then
				FC_OPTIONS="-g $CC_PLAT_OPTIONS $FC_PICFLAGS"
				FC_OPTIONS_O0="$CC_PLAT_OPTIONS $FC_PICFLAGS"
			else
				FC_OPTIONS="-O $CC_PLAT_OPTIONS $FC_PICFLAGS"
				FC_OPTIONS_O0="$CC_PLAT_OPTIONS $FC_PICFLAGS"
			fi
		elif test "$WITH_GFORTRAN" = yes; then
			FC=gfortran
			if test "$enable_debug" = yes; then
				FC_OPTIONS="-g -ff2c $CC_PLAT_OPTIONS $FC_PICFLAGS"
				FC_OPTIONS_O0="-ff2c $CC_PLAT_OPTIONS $FC_PICFLAGS"
			else
				FC_OPTIONS="-O -ff2c $CC_PLAT_OPTIONS $FC_PICFLAGS"
				FC_OPTIONS_O0="-ff2c $CC_PLAT_OPTIONS $FC_PICFLAGS"
			fi
			AC_DEFINE(G95_FORTRAN)
		# 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'
			if test "$enable_debug" = yes; then
				FC_OPTIONS="-g $CC_PLAT_OPTIONS $FC_PICFLAGS"
				FC_OPTIONS_O0="$CC_PLAT_OPTIONS $FC_PICFLAGS"
			else
				FC_OPTIONS="-O $CC_PLAT_OPTIONS $FC_PICFLAGS"
				FC_OPTIONS_O0="$CC_PLAT_OPTIONS $FC_PICFLAGS"
			fi
		else
			# first find g77
			AC_CHECK_PROG(WITH_G77,g77,yes,no)
			if test "$WITH_G77" = yes; then
				FC=g77
				FC_PICFLAGS=-fPIC
				if test "$enable_debug" = yes; then
					FC_OPTIONS="-g $CC_PLAT_OPTIONS"
					FC_OPTIONS_O0="$CC_PLAT_OPTIONS $FC_PICFLAGS"
				else
					FC_OPTIONS="-O $CC_PLAT_OPTIONS"
					FC_OPTIONS_O0="$CC_PLAT_OPTIONS $FC_PICFLAGS"
				fi
			else
				AC_CHECK_PROG(WITH_GFORTRAN,gfortran,yes,no)
				if test "$WITH_GFORTRAN" = yes; then
					FC=gfortran
					FC_PICFLAGS=-fPIC
					AC_DEFINE(G95_FORTRAN)
					if test "$enable_debug" = yes; then
						FC_OPTIONS="-g -ff2c $CC_PLAT_OPTIONS $FC_PICFLAGS"
						FC_OPTIONS_O0="-ff2c $CC_PLAT_OPTIONS $FC_PICFLAGS"
					else
						FC_OPTIONS="-O -ff2c $CC_PLAT_OPTIONS $FC_PICFLAGS"
						FC_OPTIONS_O0="-ff2c $CC_PLAT_OPTIONS $FC_PICFLAGS"
					fi
				else
					AC_CHECK_PROG(WITH_F95,f95,yes,no)
					if test "$WITH_F95" = yes; then
						FC=f95
						FC_PICFLAGS=-fPIC
						AC_DEFINE(F95_FORTRAN)
						if test "$enable_debug" = yes; then
							FC_OPTIONS="-g $CC_PLAT_OPTIONS $FC_PICFLAGS"
							FC_OPTIONS_O0="$CC_PLAT_OPTIONS $FC_PICFLAGS"
						else
							FC_OPTIONS="-O $CC_PLAT_OPTIONS $FC_PICFLAGS"
							FC_OPTIONS_O0="$CC_PLAT_OPTIONS $FC_PICFLAGS "
						fi
					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'
							if test "$enable_debug" = yes; then
								FC_OPTIONS="-g $CC_PLAT_OPTIONS $FC_PICFLAGS"
								FC_OPTIONS_O0="$CC_PLAT_OPTIONS $FC_PICFLAGS"
							else
								FC_OPTIONS="-O $CC_PLAT_OPTIONS $FC_PICFLAGS"
								FC_OPTIONS_O0="$CC_PLAT_OPTIONS $FC_PICFLAGS"
							fi
						else
							AC_MSG_ERROR([Unable to configure: no Fortran compiler found])    
						fi
					fi
				fi
			fi
		fi
		FC_LDFLAGS="$LIEEELIB -ldl -rdynamic -Wl,-relax "
		LD=ld
		LD_LDFLAGS="$LIEEELIB -Wl,-relax "
	fi
	MAKEFILE_TARGET=Makefile.linux64
	;;
# Linux gnu: ia64 distributions
  ia64-*-linux-gnu)
    LIEEELIB=
    AC_CHECK_LIB(ieee,main,
      [LIEEELIB=-lieee])
    MALLOC=malloc.o
    if test "$with_intelcompilers" = yes; then
       GCC=no
       CC=$ICC
       FC=$IFC
       CC_OPTIONS='-O -DNDEBUG -Dlinux -DNARROWPROTO -mp'
       CC_PICFLAGS="-fPIC"
# -cm remove comments displays, -w90  -w95 remove warnings abort f90 f95 non standard
       FC_OPTIONS="-O -cm -w90 -w95 -mp "
       FC_OPTIONS_O0="-cm  -w90 -w95 -mp "
       if test "$enable_debug" = yes; then 
         CC_OPTIONS='-g -Wall -Dlinux  -DNARROWPROTO  -mp '
         FC_OPTIONS="-g -cm  -w90 -w95 -mp "
       fi
       CC_LDFLAGS="$LIEEELIB  -Wl,-relax"
       FC_LDFLAGS="$LIEEELIB -ldl -Wl,-relax "
       LD=xild
       LD_LDFLAGS="$LIEEELIB  -Wl,-relax "
    else
       GCC=yes
       CC=gcc
       CC_OPTIONS='-O -DNDEBUG -Dlinux  -DNARROWPROTO'
       CC_LDFLAGS=$LIEEELIB
       CC_PICFLAGS=-fPIC
       # find Fortran compiler
       # g77 already asked and found: good
       if test "$WITH_G77" = yes; then
         FC=g77
         FC_PICFLAGS=-fPIC
       # 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(WITH_G77,g77,yes,no)
         if test "$WITH_G77" = yes; then
           FC=g77
           FC_PICFLAGS=-fPIC
         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_OPTIONS_O0=
       FC_LDFLAGS="$LIEEELIB -ldl -rdynamic -Wl,-relax"
       LD=ld
       LD_LDFLAGS=$LIEEELIB  -Wl,-relax
       if test "$enable_debug" = yes; then 
         CC_OPTIONS='-g -Wall -Dlinux -DNARROWPROTO'
         FC_OPTIONS=-g
       fi
    fi
    MAKEFILE_TARGET=Makefile.linux
   ;;
# Alpha Linux
  alpha-*-linux-gnu)
    MALLOC=malloc.o
    GCC=yes
    CC=gcc
    CC_OPTIONS='-O -DNDEBUG -mieee-with-inexact -Dlinux -fwritable-strings'
    CC_LDFLAGS='-ldl -rdynamic -mieee-with-inexact'
    CC_PICFLAGS=-fPIC
    # find Fortran compiler
    # g77 already asked and found: good
    if test "$WITH_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(WITH_G77,g77,yes,no)
      if test "$WITH_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 -mieee-with-inexact'
    FC_OPTIONS_O0='-mieee-with-inexact'
    FC_LDFLAGS='-ldl -rdynamic -mieee-with-inexact'
    LD=ld
    LD_LDFLAGS=
    if test "$enable_debug" = yes; then 
      CC_OPTIONS='-g -mieee-with-inexact -Dlinux -fwritable-strings'
      FC_OPTIONS='-g -mieee-with-inexact'
    fi
    MAKEFILE_TARGET=Makefile.linux
   ;;
# Mklinux PowerPC (Macintosh)
  powerpc-*-linux-gnu)
    LIEEELIB=
    AC_CHECK_LIB(ieee,main,
      [LIEEELIB=-lieee])
    GCC=yes
    CC=gcc
    CC_OPTIONS='-O -DNDEBUG -D_GNU_SOURCE -Dlinux'
    CC_LDFLAGS=$LIEEELIB
    CC_PICFLAGS=-fPIC
    # find Fortran compiler
    # g77 already asked and found: good
    if test "$WITH_G77" = yes; then
      FC=g77
    elif test "$WITH_GFORTRAN" = yes;then
      FC=gfortran
      FC_OPTIONS="-O -ff2c"
      FC_OPTIONS_O0="-ff2c"
      FC_PICFLAGS=-fPIC
      AC_DEFINE(G95_FORTRAN)
    # 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(WITH_G77,g77,yes,no)
      if test "$WITH_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_OPTIONS_O0=
    FC_LDFLAGS="$LIEEELIB -ldl -rdynamic"
    FC_PICFLAGS=-fPIC
    LD=ld
    LD_LDFLAGS=$LIEEELIB
    if test "$enable_debug" = yes; then 
      CC_OPTIONS='-g -Dlinux -D_GNU_SOURCE'
      FC_OPTIONS=-g
    fi
    MAKEFILE_TARGET=Makefile.linux
   ;;

# Linux ELF: all standard distributions (catch all other)
i*86-*-linux-gnu | *-linux-gnu )
	LIEEELIB=
	AC_CHECK_LIB(ieee,main,[LIEEELIB=-lieee])

	if test "$with_intelcompilers" = yes; then
		GCC=no
		CC=$ICC
		FC=$IFC
		CC_OPTIONS='-O -DNDEBUG -Dlinux -DNARROWPROTO -mp -pc64 -ffnalias -falias '
		CC_PICFLAGS="-fPIC"
		# -cm remove comments displays, -w90  -w95 remove warnings abort f90 f95 non standard
		FC_OPTIONS="-O -cm -w90 -w95 -mp -pc64 -ffnalias -falias"
		FC_OPTIONS_O0="-cm  -w90 -w95 -mp -pc64 -ffnalias -falias"
		if test "$enable_debug" = yes; then 
			CC_OPTIONS='-g -Wall -Dlinux  -DNARROWPROTO  -mp -pc64 -ffnalias -falias'
			FC_OPTIONS="-g -cm  -w90 -w95 -mp -pc64 -ffnalias -falias"
		fi
		CC_LDFLAGS=$LIEEELIB
		FC_LDFLAGS="$LIEEELIB -ldl"
		LD=xild
		LD_LDFLAGS="$LIEEELIB"
	else
		GCC=yes
		GCCFIX=fix.o
		CC=gcc
		if test "$enable_debug" = yes; then
			CC_OPTIONS='-g -Wall -Dlinux  -DNARROWPROTO'
		else
			CC_OPTIONS='-O -DNDEBUG -Dlinux  -DNARROWPROTO'
		fi
		CC_LDFLAGS=$LIEEELIB
		CC_PICFLAGS=-fPIC
		# find Fortran compiler
		# g77 already asked and found: good
		if test "$WITH_G77" = yes; then
			FC=g77
			FC_PICFLAGS=-fPIC
			if test "$enable_debug" = yes; then
				FC_OPTIONS="-g"
				FC_OPTIONS_O0=""
			else
				FC_OPTIONS="-O"
				FC_OPTIONS_O0=""
			fi
		elif test "$WITH_GFORTRAN" = yes;then
			FC=gfortran
			if test "$enable_debug" = yes; then
				FC_OPTIONS="-g -ff2c"
				FC_OPTIONS_O0="-ff2c"
			else
				FC_OPTIONS="-O -ff2c"
				FC_OPTIONS_O0="-ff2c"
			fi
			FC_PICFLAGS=-fPIC
			AC_DEFINE(G95_FORTRAN)
		# 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'
			if test "$enable_debug" = yes; then
				FC_OPTIONS="-g"
				FC_OPTIONS_O0=""
			else
				FC_OPTIONS="-O"
				FC_OPTIONS_O0=""
			fi
		else
			# first find g77
			AC_CHECK_PROG(WITH_G77,g77,yes,no)
			if test "$WITH_G77" = yes; then
				FC=g77
				FC_PICFLAGS=-fPIC
				if test "$enable_debug" = yes; then
					FC_OPTIONS="-g"
					FC_OPTIONS_O0=""
				else
					FC_OPTIONS="-O"
					FC_OPTIONS_O0=""
				fi
			else
				AC_CHECK_PROG(WITH_GFORTRAN,gfortran,yes,no)
				if test "$WITH_GFORTRAN" = yes; then
					FC=gfortran
					FC_PICFLAGS=-fPIC
					AC_DEFINE(G95_FORTRAN)
					if test "$enable_debug" = yes; then
						FC_OPTIONS="-g -ff2c"
						FC_OPTIONS_O0="-ff2c"
					else
						FC_OPTIONS="-O -ff2c"
						FC_OPTIONS_O0="-ff2c"
					fi
				else
					AC_CHECK_PROG(WITH_F95,f95,yes,no)
					if test "$WITH_F95" = yes; then
						FC=f95
						FC_PICFLAGS=-fPIC
						AC_DEFINE(F95_FORTRAN)
						if test "$enable_debug" = yes; then
							FC_OPTIONS="-g"
							FC_OPTIONS_O0=""
						else
							FC_OPTIONS="-O"
							FC_OPTIONS_O0=""
						fi
					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'
							if test "$enable_debug" = yes; then
								FC_OPTIONS="-g"
								FC_OPTIONS_O0=""
							else
								FC_OPTIONS="-O"
								FC_OPTIONS_O0=""
							fi
						else
							AC_MSG_ERROR([Unable to configure: no Fortran compiler found])    
						fi
					fi
				fi
			fi
		fi
		FC_LDFLAGS="$LIEEELIB -ldl -rdynamic"
		LD=ld
		LD_LDFLAGS=$LIEEELIB
	fi
	MAKEFILE_TARGET=Makefile.linux
	;;
# SGI MIPS ULTRIX (NO LONGER SUPPORTED)
  mips-*-ultrix*)
    # standard compilers
    CC=cc
    CC_OPTIONS=-O0 -DNDEBUG
    CC_LDFLAGS=
    if test "$WITH_G77" != yes; then    
      #AC_CHECK_PROG(F77,f77,yes,no)
      AC_CHECK_PROGS(F77,f77 f90 f2c-f77,no)
      if test "$F77" = no; then
        AC_MSG_ERROR([Unable to configure: Fortran f77 compiler not found])
      fi
      FC="$F77"
    fi
    #FC="$F77"
    FC_OPTIONS='-O0 -fpe1'
    FC_OPTIONS_O0='-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 "$WITH_GCC" = yes; then
      CC=gcc
      CC_OPTIONS=-O -DNDEBUG
      if test "$enable_debug" = yes; then 
        CC_OPTIONS=-g
      fi
    fi
    if test "$WITH_G77" = yes; then
      FC=g77
      FC_OPTIONS=-O
      FC_OPTIONS_O0=
      if test "$enable_debug" = yes; then 
        FC_OPTIONS=-g
      fi
    fi
    MAKEFILE_TARGET=Makefile.ultrix
    ;;
# SGI
  mips-sgi-irix*)
    # standard compilers
    CC=cc
    CC_OPTIONS='-O -DNDEBUG -DSYSV -DSVR4'
    CC_LDFLAGS=
    if test "$WITH_G77" != yes; then    
      #AC_CHECK_PROG(F77,f77,yes,no)
      AC_CHECK_PROGS(F77,f77 f90 f2c-f77,no)
      if test "$F77" = no; then
        AC_MSG_ERROR([Unable to configure: Fortran f77 compiler not found])
      fi
      FC="$F77"
    fi
    #FC="$F77"
    FC_OPTIONS='-O '
    FC_OPTIONS_O0=

    FC_LDFLAGS=
    LD=ld
    LD_LDFLAGS=
    if test "$enable_debug" = yes; then 
      CC_OPTIONS='-g -c -DSYSV -DSVR4'
      FC_OPTIONS='-g '
    fi
    # GNU compilers
    if test "$WITH_GCC" = yes; then
      CC=gcc
      CC_OPTIONS=-O -DNDEBUG
      if test "$enable_debug" = yes; then 
        CC_OPTIONS=-g
      fi
    fi
    if test "$WITH_G77" = yes; then
      FC=g77
      FC_OPTIONS=-O
      FC_OPTIONS_O0=
      if test "$enable_debug" = yes; then 
        FC_OPTIONS=-g
      fi
    fi

    MAKEFILE_TARGET=Makefile.sgi
    ;;
# OLD HP (NO LONGER SUPPORTED)
  *-*-hpux9.*)
    # standard compilers
    HPPA_OLD=-Dhppa_old
    CC=cc
    CC_OPTIONS='-O -DNDEBUG -DSYSV -Dhpux'
    CC_LDFLAGS='-Wl,-a,archive'
    if test "$WITH_G77" != yes; then    
      #AC_CHECK_PROG(F77,fort77,yes,no)
      AC_CHECK_PROGS(F77,fort77 f77 f90 f2c-f77,no)
      if test "$F77" = no; then
        AC_MSG_ERROR([Unable to configure: Fortran fort77 compiler not found])
      fi
      FC="$F77"
    fi
    #FC="$F77"
    FC_OPTIONS='-O +Obb1200 +E4'
    FC_OPTIONS_O0='+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 "$WITH_GCC" = yes; then
      CC=gcc
      CC_OPTIONS=-O -DNDEBUG
      if test "$enable_debug" = yes; then 
        CC_OPTIONS=-g
      fi
    fi
    if test "$WITH_G77" = yes; then
      FC=g77
      FC_OPTIONS=-O
      FC_OPTIONS_O0=
      if test "$enable_debug" = yes; then 
        FC_OPTIONS=-g
      fi
    fi
    MAKEFILE_TARGET=Makefile.hpux9
    FGETARG=fgetarg-hpux
    SCIDCOPY=scidcopy-hpux
    UNSFDCOPY=unsfdcopy-hpux
    ;;
# HP 10
  *-*-hpux10.*)
    # standard compilers
    CC=cc
    CC_OPTIONS='-O -DNDEBUG -DSYSV -Dhpux +Z +DAportable'
    CC_LDFLAGS='-Wl,+vnocompatwarnings,-E /usr/lib/libdld.sl'
    if test "$WITH_G77" != yes; then    
      #AC_CHECK_PROG(F77,fort77,yes,no)
      AC_CHECK_PROGS(F77,fort77 f77 f90 f2c-f77,no)
      if test "$F77" = no; then
        AC_MSG_ERROR([Unable to configure: Fortran fort77 compiler not found])
      fi
      FC="$F77"
    fi
    #FC="$F77"
    AC_F77_LIBRARY_LDFLAGS
    FC_OPTIONS='+O2 +E4 +Z +DAportable'
    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 "$WITH_GCC" = yes; then
      CC=gcc
      CC_OPTIONS=-O -DNDEBUG
      if test "$enable_debug" = yes; then 
        CC_OPTIONS=-g
      fi
    fi
    if test "$WITH_G77" = yes; then
      FC=g77
      FC_OPTIONS=-O
      FC_OPTIONS_O0=
      if test "$enable_debug" = yes; then 
        FC_OPTIONS=-g
      fi
    fi
    MAKEFILE_TARGET=Makefile.hpux
    FGETARG=fgetarg-hpux
    SCIDCOPY=scidcopy-hpux
    UNSFDCOPY=unsfdcopy-hpux
    ;;
# HP 11
  *-*-hpux11.*)
    SONAME=sl
    # standard compilers
    CC=cc
    CC_OPTIONS='-O -DNDEBUG -DSYSV -Dhpux -Dhppa +Z +DAportable'
    CC_LDFLAGS='-Wl,+vnocompatwarnings,-E /usr/lib/libdld.sl'
    if test "$WITH_G77" != yes; then    
      AC_CHECK_PROGS(F77,fort77 f77 f90 f2c-f77,no)
      if test "$F77" = no; then
        AC_MSG_ERROR([Unable to configure: Fortran fort77 compiler not found])
      fi
      FC="$F77"
    fi
    FC_OPTIONS='+O2 +Z +DAportable'
    FC_OPTIONS_O0=' +Z +DAportable'
    #do not call AC_F77_LIBRARY_LDFLAGS because if assumes PA2.0 while Scilab is built with 
    #DAportable=PA1.1
    #AC_F77_LIBRARY_LDFLAGS
    FLIBS='-ldld -lnsl -lU77 -lm'

    FC_LDFLAGS='-Wl,+vnocompatwarnings,-E /usr/lib/libdld.sl'
    LD=ld
    LD_LDFLAGS=
    if test "$enable_debug" = yes; then 
      CC_OPTIONS='-g -DSYSV -Dhpuxx -Dhppa +Z +DAportable'
      FC_OPTIONS='-g  +Z +DAportable'
      FC_OPTIONS_O0='-g +Z +DAportable'
    fi
    # GNU compilers
    if test "$WITH_GCC" = yes; then
      CC=gcc
      CC_OPTIONS=-O -DNDEBUG
      if test "$enable_debug" = yes; then 
        CC_OPTIONS=-g
      fi
    fi
    if test "$WITH_G77" = yes; then
      FC=g77
      FC_OPTIONS=-O
      FC_OPTIONS_O0=
      if test "$enable_debug" = yes; then 
        FC_OPTIONS=-g
      fi
    fi
    MAKEFILE_TARGET=Makefile.hpux11
    GETARG=getarg-hpux
    FGETARG=fgetarg-hpux
    SCIDCOPY=scidcopy-hpux
    UNSFDCOPY=unsfdcopy-hpux
    cp -f $SCIDIR/pvm3/conf/HPPA.def $SCIDIR/pvm3/conf/HPPA.def.orig
    cp -f $SCIDIR/pvm3/conf/HPPA11.def $SCIDIR/pvm3/conf/HPPA.def
    ;;

# CYGWIN32 for Windows 9X/NT/XP 
  *-*-cygwin* )
    SCILABSCRIPT=scilab-gcwin32.g
    PERIFILE=periWin.o
    MAIN='mainsci.o'
    GUILIB='wsci'
    XDRLIB='xdr'
    XDRLIBNAME='libs/xdr.a'
    MENUSOBJS=WOBJS
    BLPR_SCRIPTS=
    # with cygwin we keep /cygdrive/ SED_CYGDRIVE='$(CYGDRIVE)'
    IMPPREF=B
    IMPENV=env.o
    # want to build f2c comand 
    # which is required for building fortran dlls 
    # which can be loaded into scilab 
    F2C_SUBDIR=f2c/src
    # just *-so tests 
    EXAMPLES_TESTS='$(SUBDIRS1)'
    GCC=yes
    CC=gcc 
    CC_OPTIONS=' -mieee-fp -O2 -DNDEBUG  -Wall'
      if test "$enable_debug" = yes; then 
	CC_OPTIONS=' -g   -Wall'
      fi
    CC_LDFLAGS=
    WITH_G77='yes'
    FC=g77
    if test "$WITH_G77" = yes; then
      FC=g77
    fi 
    FC_OPTIONS="-O2 "
    FC_OPTIONS_O0=
      if test "$enable_debug" = yes; then 
        FC_OPTIONS="-g "
      fi
    FC_LDFLAGS=
    if test "$with_f2c" = yes; then
      # ignore with_f2c here       
      FC=g77
    fi    
    LD=gcc
    #LD_LDFLAGS="-mconsole --enable-stdcall-fixup"
    WINXFLAGS='-I../xdr'
    MAKEFILE_TARGET=Makefile.gcwin32
    ;;
# CYGWIN32 for Windows 9X/NT/XP 
# mingw32 is detected 
   *-*-mingw32*)
    SCILABSCRIPT=scilab-gcwin32.g
    PERIFILE=periWin.o
    MAIN='mainwin95.o'
    GUILIB='wsci'
    XDRLIB='xdr'
    XDRLIBNAME='libs/xdr.a'
    MENUSOBJS=WOBJS
    BLPR_SCRIPTS=
    SED_CYGDRIVE='$(CYGDRIVE)'
    IMPPREF=B
    IMPENV=env.o
    # want to build f2c comand 
    # which is required for building fortran dlls 
    # which can be loaded into scilab 
    F2C_SUBDIR=f2c/src
    # just *-so tests 
    EXAMPLES_TESTS='$(SUBDIRS1)'
    GCC=yes
    CC=gcc 
    CC_OPTIONS='-mno-cygwin -mieee-fp -O -DNDEBUG -fwritable-strings  -Wall'
      if test "$enable_debug" = yes; then 
	CC_OPTIONS='-mno-cygwin -g -fwritable-strings  -Wall'
      fi
    CC_LDFLAGS=
    FC=g77
    if test "$WITH_G77" = yes; then
      FC=g77
    fi 
    FC_OPTIONS="-O -mno-cygwin"
    FC_OPTIONS_O0="-mno-cygwin"
      if test "$enable_debug" = yes; then 
        FC_OPTIONS="-g -mno-cygwin"
      fi
    FC_LDFLAGS=
    if test "$with_f2c" = yes; then
      # ignore with_f2c here       
      FC=g77
    fi    
    LD=gcc
    LD_LDFLAGS="-mconsole --enable-stdcall-fixup"
    WINXFLAGS='-I../xdr'
    MAKEFILE_TARGET=Makefile.mingwin32
    ;;
# FreeBSD  systems (not supported by INRIA)
  *-*-freebsd*)
     GCC=yes
     CC=$CC
     CC_OPTIONS="${CFLAGS} -Dfreebsd"
     CC_LDFLAGS=-lm
     CC_PICFLAGS='-fPIC'
     # script shell f77 have bugs, get ours
     FC=$F77
     FC_OPTIONS="${CFLAGS} -Dfreebsd"	
     FC_OPTIONS_O0='-Dfreebsd'
     FC_LDFLAGS='-lm -Wl,--export-dynamic'
     FC_PICFLAGS='-fPIC'
     LD=ld
     LD_LDFLAGS=-lm

     if test "$enable_debug" = yes; then 
       CC_OPTIONS='-g -Dfreebsd'
       FC_OPTIONS=-g
     fi
     if test "$WITH_G77" = yes; then
       # On FreeBSD the gnu fortran compiler is named f77
       FC=f77
     fi
    DLDLIB='${SCIDIR}/libs/libdld.a'
    DLD_SUBDIR=dld
    MAKEFILE_TARGET=Makefile.freebsd
    ;;

# NetBSD  systems (not supported by INRIA)
  *-*-netbsd*)
    #
    # C Compiler
    #
    AC_PROG_CC
    CC_OPTIONS="${CFLAGS} -Dnetbsd"
    CC_LDFLAGS="${LDFLAGS} -Wl,-R${X11BASE}/lib"
    CC_PICFLAGS='-fPIC'
    # check for --export-dynamic
    ac_save_LDFLAGS="$LDFLAGS"
    LDFLAGS='-Wl,--export-dynamic'
    AC_MSG_CHECKING([if the linker accepts --export-dynamic])
    AC_TRY_LINK(,,
      AC_MSG_RESULT(yes)
      CC_LDFLAGS=["$CC_LDFLAGS  -Wl,--export-dynamic"],
      AC_MSG_RESULT(no))
    LDFLAGS="$ac_save_LDFLAGS"
   #
   # Fortran Compiler
   #

   AC_PROG_F77
   AC_F77_LIBRARY_LDFLAGS
   FC="$F77"
   FC_OPTIONS="${FFLAGS}"
   FC_OPTIONS_O0=`echo $FC_OPTIONS | sed 's/-O[0-9]*//g'`
   FC_LDFLAGS="${LDLAGS} -Wl,-R${X11BASE}/lib"
   FC_PICFLAGS='-fPIC'
   # check for --export-dynamic
   ac_save_LDFLAGS="$LDFLAGS"
   LDFLAGS='-Wl,--export-dynamic'
   AC_MSG_CHECKING([if the linker accepts --export-dynamic])
   AC_TRY_LINK(,,
     AC_MSG_RESULT(yes)
     FC_LDFLAGS=["$FC_LDFLAGS  -Wl,--export-dynamic"],
     AC_MSG_RESULT(no))
   LDFLAGS="$ac_save_LDFLAGS"
   #
   # Linker
   #
   LD=ld
   LD_LDFLAGS="-R${X11BASE}/lib"
   # check for --export-dynamic
   ac_save_LDFLAGS="$LDFLAGS"
   LDFLAGS='-Wl,--export-dynamic'
   AC_MSG_CHECKING([if the linker accepts --export-dynamic])
   AC_TRY_LINK(,,
     AC_MSG_RESULT(yes)
     LD_LDFLAGS=["$LD_LDFLAGS  --export-dynamic"],
     AC_MSG_RESULT(no))
   LDFLAGS="$ac_save_LDFLAGS" 

   MAKEFILE_TARGET=Makefile.netbsd
   ;;
# Darwin/MacOSX (Not supported by INRIA)
  *-*-darwin*)
     STRIP=echo 
     PERIX11NOPT=periX11
     GCC=yes
     CC=gcc
     CC_OPTIONS='-no-cpp-precomp -O2 -DNDEBUG -I/sw/include -L/sw/lib'
     CC_LDFLAGS='-L/sw/lib'
     CC_PICFLAGS='-fPIC'
     # script shell f77 have bugs, get ours
     FC=g77
     FC_OPTIONS='-O2'
     FC_OPTIONS_O0=
     FC_LDFLAGS='-L/sw/lib -ldl -lcc_dynamic'
     FC_PICFLAGS='-fPIC'
     LD=ld
     LD_LDFLAGS=
     if test "$enable_debug" = yes; then
       CC_OPTIONS='-g -I/sw/include '
       FC_OPTIONS=-g
     fi
     if test "$WITH_G77" = yes; then
       FC=g77
     fi
    # just *-so tests 
    EXAMPLES_TESTS='$(SUBDIRS1)'
    # FLIBS generated by libtool config should not be used 
    FLIBS= 
   # Dyn. loading - ????
   # DLDLIB=
   # DLD_SUBDIR=
   # DLDLIB=
   # DLD_SUBDIR=
   MAKEFILE_TARGET=Makefile.darwin
   # we need to patch libtool 		
   cp  libtool libtool-cp
   sed -e 's:\\\\"x\\\$module\\\\" = xyes:\\$module = .yes:' libtool-cp > libtool
   rm -f libtool-cp
    ;;
  *)
    AC_MSG_ERROR([Unable to configure for host $host])
    ;;
esac


# due to g77 Fortran compiler bugs, a few files must not be compiled
# with optimizer:
# in "routines/control": hqror2.f comqr3.f tql2.f imtql3.f dsvdc.f wsvdc.f 
#                        pade.f
# in "routines/sparse": intreadmps.f
# in "routines/calelm": unsfdcopy.f icopy.f

FC_OPTIONS1=$FC_OPTIONS
if test "$WITH_G77" = yes; then
  if test "$enable_debug" = yes; then   
    FC_OPTIONS1=$FC_OPTIONS
  else
    FC_OPTIONS1=$FC_OPTIONS_O0
  fi
fi

if test "$with_f2c" = yes; then
  if test "$enable_debug" = yes; then   
    FC_OPTIONS1=$FC_OPTIONS
  else
    FC_OPTIONS1=$FC_OPTIONS_O0
  fi
fi

if test "$WITH_GFORTRAN" = yes; then
  if test "$enable_debug" = yes; then   
    FC_OPTIONS1=$FC_OPTIONS
  else
    FC_OPTIONS1=$FC_OPTIONS_O0
  fi
fi

# due overlapping arguments a few files must not be compiled
# with optimizer on some computers (Sun sparc solaris with at least
# Sun C 5.5 getsym.f)

FC_OPTIONS2=$FC_OPTIONS

case "$host" in
# Sun solaris
  *solaris*)
    if test "$enable_debug" = yes; then
      FC_OPTIONS2=$FC_OPTIONS
    else
      FC_OPTIONS2=$FC_OPTIONS_O0
    fi
    ;;
esac


# due to a gcc bug, a few C functions must not be inlined when compiled
# with optimizer: the "floor" function in "routines/graphics/Format.c"

NOINLINE=
if test "$WITH_GCC" = yes; then
  NOINLINE='-D__NO_MATH_INLINES'
fi

# flag for possible compilations in configure
CFLAGS=$CC_OPTIONS
LDFLAGS=$CC_LDFLAGS

############################
## test for various programs
############################
# Using `AC_PROG_RANLIB' is rendered obsolete by `AC_PROG_LIBTOOL'
#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
])
if test "$ac_cv_X11_release" = R4; then
    AC_MSG_ERROR([Scilab cannot be installed with X11R4.])
fi

fi

##########################################
## test for X11 and Xaw3d  Athena widgets
##########################################

# do not want to check for X11 when using gtk or gtk2
if test "$with_gtk" = yes; then	
   PERIFILE=periGtk.o  
fi 

if test "$with_gtk2" = yes; then	
   PERIFILE=periGtk.o  
fi 

if test "$PERIFILE" = periX11.o; then 
  ac_save_LDFLAGS="$LDFLAGS"
  if test -n "$x_libraries"; then
    LDFLAGS="$LDFLAGS -L$x_libraries"
  fi

##test Xaw3d (can be build locally)
  if test "$with_local_xaw" = yes; then
    XAWLIB='$(SCIDIR)/libs/libXaw3d.a'
    XMULIB='$(SCIDIR)/libs/libXmu.a'
    XAW_LOCAL_LIB='$(SCIDIR)/libs/libXaw3d.a $(SCIDIR)/libs/libXmu.a'
    XAW_LOCAL_INCLUDES='-I$(SCIDIR)/routines'
    XAW_LOCAL_SUBDIR=X11
    XAW=Xaw3d
  else
##test Xmu (Required)
    AC_CHECK_LIB(Xmu,main,[XMu=yes],[XMu=no],-lXt -lXext $X_PRE_LIBS -lX11 $X_EXTRA_LIBS)
    if test "$XMu" = no; then
      XAWLIB='$(SCIDIR)/libs/libXaw3d.a'
      XMULIB='$(SCIDIR)/libs/libXmu.a'
      XAW_LOCAL_LIB='$(SCIDIR)/libs/libXaw3d.a $(SCIDIR)/libs/libXmu.a'
      XAW_LOCAL_INCLUDES='-I$(SCIDIR)/routines'
      XAW_LOCAL_SUBDIR=X11
      XAW=Xaw3d
    else
      XMULIB=-lXmu
      AC_CHECK_LIB(Xaw3d,main,[XAthena3d=yes],[XAthena3d=no],-lXmu -lXt -lXext $X_PRE_LIBS -lX11 $X_EXTRA_LIBS)
      if test "$XAthena3d" = no; then
        XAWLIB='$(SCIDIR)/libs/libXaw3d.a'
        XMULIB='$(SCIDIR)/libs/libXmu.a'
        XAW_LOCAL_LIB='$(SCIDIR)/libs/libXaw3d.a $(SCIDIR)/libs/libXmu.a'
        XAW_LOCAL_INCLUDES='-I$(SCIDIR)/routines'
        XAW_LOCAL_SUBDIR=X11
        XAW=Xaw3d
      else
        XAWLIB=-lXaw3d
        XAW=Xaw3d
        LDFLAGS="$ac_save_LDFLAGS"
        save_cflags=$CFLAGS
        CFLAGS="$X_CFLAGS $CC_OPTIONS"
        AC_TRY_COMPILE([#include <X11/IntrinsicP.h> #include <X11/Xaw3d/ViewportP.h>],,,
        AC_MSG_ERROR([Include file "ViewportP.h" for Xaw3d not found. 
			       Get and put it in <X11/Xaw3d/> .]))
	CFLAGS=$save_cflags

      fi
    fi
  fi 
fi

#######################
## Xt 
#######################

# Pb of automatic insertion of -lXt -lXext -lX11 in Makefile.incl.in
# which does not work with mingwin. Thus I add this two vars to 
# configure.in 

XXTXEXT="-lXt -lXext"
XX11="-lX11"

  case "$host" in
      *-*-mingw32*)
      XXTXEXT=
      XX11=
    ;;
  esac
  
###########################
## test for JAVA compiler
###########################

JAVASCITARGET=javasci_disabled
JAVASCITARGET_DISTCLEAN=javasci_disabled

if test "$with_java" != no; then
	AC_CHECK_PROG(WITH_JAVAC,javac,yes,no)
	if test "$WITH_JAVAC" = yes; then
		JAVASCITARGET=scilex-lib
		JAVASCITARGET_DISTCLEAN=distclean
		JAVAC=javac
		JAVA_INCL=
		AC_JNI_INCLUDE_DIR
		for JNI_INCLUDE_DIR in $JNI_INCLUDE_DIRS
		do
			JAVA_INCL="$JAVA_INCL -I$JNI_INCLUDE_DIR"
		done
	else
		AC_MSG_WARN([javac not found: I will not build the java interface])
		JAVASCITARGET=javasci_disabled
		JAVASCITARGET_DISTCLEAN=javasci_disabled
	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 $NMOPT pipof.o|grep _pipof 2>&1`
if test ! -z "$output"; then
  FC_LEADING_UNDERSCORE=yes
  FC_TRAILING_UNDERSCORE=no
fi

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

output=`nm $NMOPT 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)
AC_CHECK_FUNCS(finite)

########################
## test for header files
########################

AC_CHECK_HEADERS(limits.h values.h) 

##################
## termcap library
##################

TERMCAPLIB=no
AC_CHECK_LIB(ncurses,main,
  [TERMCAPLIB=-lncurses])
if test "$TERMCAPLIB" = no; then
  AC_CHECK_LIB(curses,main,
  [TERMCAPLIB=-lcurses])
fi
if test "$TERMCAPLIB" = no; then
  AC_CHECK_LIB(termcap,main,
  [TERMCAPLIB=-ltermcap])
fi
if test "$TERMCAPLIB" = no; then
  AC_CHECK_LIB(termlib,main,
  [TERMCAPLIB=-ltermlib])
fi
if test "$TERMCAPLIB" != no; then
  AC_DEFINE(HAVE_TERMCAP)
else
  TERMCAPLIB=
fi

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

PVMTARGET=pvm_disabled
PVMTARGET_DISTCLEAN=pvm_disabled

PVMARCH=
PVMLIB=
PVMGLIB=
PVMSCIDIR=
PVMSCILIB=
PVMROOT=
PVMHELP=
# need an non empty default value for scilab script 
PVMROOTR='$SCI/pvm3'
PVMINST=
PVMINST1=

# files to be added for building the hoster with mingw 
PVMHOSTERFILES= 
# compile hoster ? 
PVMHOSTER=

if test "$with_pvm" != no; then

	# check for a locally installed PVM
	
	PVMHELP=pvm
	
	if test -x $PVM_ROOT/lib/pvmgetarch ; then
		PVMROOT=$PVM_ROOT
		PVMROOTR=$PVM_ROOT
		PVMTARGET=pvm_disabled
		PVMTARGET_DISTCLEAN=pvm_disabled
	else
		PVMTARGET=scilex-lib
		PVMTARGET_DISTCLEAN=distclean
		PVMROOT="$SCIDIR/pvm3"
		PVMROOTR='$SCI/pvm3'
		PVMINST='$(PVMBINDISTFILES) $(PVMBINDISTFILES1)'
		PVMINST1='$(INSTPVMBINDISTFILES) $(INSTPVMBINDISTFILES1)'
	fi
	
	PVMINCLUDE=$PVMROOT/include
	
	AC_ARG_WITH(pvm-include,
		[  --with-pvm-include=DIR  PVM include files are in DIR ],
		[  PVMINCLUDE=$withval
	])
	
	AC_CACHE_CHECK([for PVM architecture],ac_cv_PVM_arch,
	[
	ac_cv_PVM_arch=`$PVMROOT/lib/pvmgetarch`
	])

	if test "$ac_cv_PVM_arch" = UNKNOWN; then
		AC_MSG_WARN([PVM unable to find architecture: I will not use PVM])
		PVMTARGET=pvm_disabled
		PVMTARGET_DISTCLEAN=pvm_disabled
		PVMINST='$(PVMBINDISTFILES)'
		PVMINST1='$(INSTPVMBINDISTFILES)'
	else
		AC_DEFINE(WITH_PVM)
		PVMARCH="$ac_cv_PVM_arch"
		
		case "$host" in
		*-*-mingw32*)
			ac_cv_PVM_arch=MINGW
			PVMARCH="$ac_cv_PVM_arch"
			PVMHOSTERFILES="pvmwinrexec.o pvmwinrsh.o"
			PVMHOSTER=h
			;;
		esac
		
		PVMLIBDIR=$PVMROOT/lib/$ac_cv_PVM_arch
		AC_ARG_WITH(pvm-library,
			[  --with-pvm-library=DIR  PVM library files are in DIR ],
			[  PVMLIBDIR=$withval
		])
		
		PVMGLIB="$PVMLIBDIR/libgpvm3.a"
		PVMLIB="$PVMLIBDIR/libpvm3.a"
		PVMSCIDIR=pvm
		PVMSCILIB="\$(SCIDIR)/libs/pvm.a"
		
		case "$host" in
		*-*-mingw32*)
			# add src to PVMINCLUDE 
			PVMINCLUDE="$PVMINCLUDE -I$SCIDIR/pvm3/src"
			#     to have path with SCIDIR 
			# PVMROOT=`echo $PVMROOT | sed -e "s+$SCIDIR+\\$(SCIDIR)+g" `
			
			PVMLIB=`echo $PVMLIB | sed -e "s+$SCIDIR/pvm3+\\$(PVMROOT)+g" `
			PVMGLIB=`echo $PVMGLIB | sed -e "s+$SCIDIR/pvm3+\\$(PVMROOT)+g" `
			PVMINCLUDE=`echo $PVMINCLUDE | sed -e "s+$SCIDIR/pvm3+\\$(PVMROOT)+g" ` 
			;;
		esac
	fi
fi

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

TK_INC_PATH=
TK_LIB_PATH=
TCLTK_LIBS=
TCLSCILIB=
TCLSCIDIR=
TCLTKHELP=

if test "$with_tk" != no; then

	TCLTKHELP=tksci

	# check user arguments
	USER_TCL_LIB_PATH=""
	USER_TCL_INC_PATH=""
	AC_ARG_WITH(tcl-library,
		[  --with-tcl-library=DIR  Tcl library files are in DIR ],
		[  USER_TCL_LIB_PATH=$withval
	])
	AC_ARG_WITH(tcl-include,
		[  --with-tcl-include=DIR  Tcl include files are in 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=DIR   Tk library files are in DIR ],
		[  USER_TK_LIB_PATH=$withval
	])
	
	AC_ARG_WITH(tk-include,
		[  --with-tk-include=DIR   Tk include files are in 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)
		TCLSCILIB="\$(SCIDIR)/libs/tclsci.a"
		TCLSCIDIR=tclsci
	else
		AC_MSG_ERROR([TCL/TK not found. Use --without-tk or specify the librairies and include paths manually])
	fi
	
	TKBASE=
	case "$host" in
	*-*-mingw32*)
		TKBASE=$SCIDIR
		TK_INC_PATH=`echo $TK_INC_PATH | sed -e "s+$SCIDIR+\\$(TKBASE)+g" `
		TCL_INC_PATH=`echo $TCL_INC_PATH | sed -e "s+$SCIDIR+\\$(TKBASE)+g" `
		TCLTK_LIBS=`echo $TCLTK_LIBS | sed -e "s+$SCIDIR+\\$(TKBASE)+g" `
	;;
	esac
	
	GETLIBTK=libtk$TK_MAJOR_VERSION.$TK_MINOR_VERSION.$SONAME
	
	case "$host" in
		*-*-darwin*)
		GETLIBTK=/sw/lib/libtk$TK_MAJOR_VERSION.$TK_MINOR_VERSION.dylib
		;;
		*-*-cygwin* |   *-*-mingw32*)
		GETLIBTK=tk$TK_MAJOR_VERSION$TK_MINOR_VERSION.dll
	esac 

fi

#################
## GTK
#################

ZZLEDT=
GTKPLUGBUG=

if test "$with_gtk" = yes; then
  AC_CHECK_PROG(GTK_CONFIG,gtk-config,yes,no)
  if test "$GTK_CONFIG" = no; then
    AC_MSG_WARN([gtk-config not found: I will not use -with-gtk])
    with_gtk="no"
  fi
  AC_CHECK_PROG(GNOME_CONFIG,gnome-config,yes,no)
  if test "$GNOME_CONFIG" = no; then
    AC_MSG_WARN([gnome-config not found: I will not use -with-gtk])
    with_gtk="no"
  fi
  if test "$with_gtk" = yes; then
    AC_MSG_CHECKING([if gtk is version 1.2 or later])
    GTK_VER=`gtk-config --version`
    case $GTK_VER in
      0.* )
        AC_MSG_ERROR([you need at least version 1.2 of gtk])
        ;;
      1.1* )
        AC_MSG_ERROR([you need at least version 1.2 of gtk])
        ;;
      * )
      # we have cheched above that gtk-config is in the 
      # path, then we don't want to generate a full path 
      # for gtk-config or to directly generate the 
      # result of `gtk-config --cflags`. Idem for gnome
      AC_MSG_RESULT([$GTK_VER])
      GTKCFLAGS='`gtk-config --cflags`'
      GTKLIBS='`gtk-config --libs` `gnome-config --libs  gtkxmhtml`'
      GNOMECFLAGS='`gnome-config --cflags gnome`'
      ;;
    esac    
    AC_DEFINE(WITH_GTK)
    GUILIB='gtksci'
    GZVT='gzvt'
    SCILABSCRIPT=scilab-gtk.g
    MENUSOBJS=GOBJS
    PERIFILE=periGtk.o
    # gtk 1 HTMLFLAGS=`gnome-config --cflags gnome`
    # gtk 2 HTMLFLAGS=`pkg-config libgtkhtml-2.0 --cflags`
    HTMLFLAGS='`gnome-config --cflags gnome`'
  fi
  # try to use readline with the gtk version 
  ac_save_LIBS="$LIBS"
  LIBS="$TERMCAPLIB  $LIBS"
  AC_CHECK_LIB(readline, rl_callback_read_char,[READLINE=-lreadline])
  LIBS=$ac_save_LIBS
  TERMCAPLIB="$READLINE $TERMCAPLIB"
  if test "no$READLINE" != no; then
     ZZLEDT="zzledt-rl.o"
     AC_DEFINE(WITH_READLINE)
  fi
  # we remove the X libs they were just used above during tcl/tk check 
  if test "$with_gtk" = yes; then
    XAWLIB=
    XMULIB=
    XAW_LOCAL_SUBDIR=
    XAW_LOCAL_LIB=
    X_CFLAGS=
    XAW_LOCAL_INCLUDES=
    X_EXTRA_LIBS=
    XXTXEXT=
    XX11=
    X_LIBS= 
    X_PRE_LIBS=
    if test "$TK_INC_PATH" = '-I/usr/include' ; then
        TK_INC_PATH=
    fi
    if test "$TCL_INC_PATH" = '-I/usr/include' ; then
        TCL_INC_PATH=
    fi
  fi
fi


#################
## GTK2 
#################

TERM_NAME=vte
TERM_LDFLAGS=VTE_LDFLAGS

if test "$with_gtk2" = yes; then
  AC_PATH_PROG(PKG_CONFIG,pkg-config)
  if test "x$PKG_CONFIG" = x; then
    # @*%&$ Ximian programmers renamed this application
    AC_PATH_PROG(PKG_CONFIG,pkgconfig,yes,no)
    if test "x$PKG_CONFIG" = x; then
    	AC_MSG_ERROR([Could not find the pkg-config (or pkgconfig) program.],)
	with_gtk2="no"
    fi
  fi
  #  AC_CHECK_PROG(GNOME_CONFIG,gnome-config,yes,no)
  #if test "$GNOME_CONFIG" = no; then
  #  AC_MSG_WARN([gnome-config not found: I will not use -with-gtk])
  #  with_gtk2="no"
  # fi
  if test "$with_gtk2" = yes; then
    AC_MSG_CHECKING([if gtk is version 2.1 or later])
    GTK_VER=`$PKG_CONFIG --modversion gtk+-2.0`
    case $GTK_VER in
      2.2.* | 2.3.0 | 2.3.1| 2.3.2| 2.3.4 )
        GTKPLUGBUG=gtkmenu.o
	;;
    esac    
    AC_MSG_RESULT([$GTK_VER])
    # we have cheched above that gtk-config is in the 
    # path, then we don't want to generate a full path 
    # for gtk-config or to directly generate the 
    # result of `gtk-config --cflags`. Idem for gnome
    GTKCFLAGS='`pkg-config gtk+-2.0 --cflags`'
    GTKLIBS='`pkg-config gtk+-2.0 libgtkhtml-2.0 --libs`'
    GNOMECFLAGS='`pkg-config gtk+-2.0 --cflags`'
    AC_DEFINE(WITH_GTK)
    GUILIB='gtksci'
    # GZVT='gzvt2' dose not work: gtk2 bug with plugged menus
    # gzvt2 works again with a gtk patch 
    GZVT='gzvt2'
    # we need a patched version 
    SCILABSCRIPT=scilab-gtk.g
    MENUSOBJS=GOBJS
    PERIFILE=periGtk.o
    # gtk 1 HTMLFLAGS=`gnome-config --cflags gnome`
    # gtk 2 HTMLFLAGS=`pkg-config libgtkhtml-2.0 --cflags`
    HTMLFLAGS='`pkg-config libgtkhtml-2.0 --cflags`'
    # check for libgtkhtml-2.0
    ac_save_LIBS="$LIBS"
    LIBS=`pkg-config libgtkhtml-2.0 --cflags --libs`
    GTKHTML=no
    AC_CHECK_LIB(gtkhtml-2,html_document_open_stream,[GTKHTML=yes])
    if test "$GTKHTML" = no; then
    	AC_MSG_ERROR([Could not find the libgtkhtml-2.0 package.],)
    fi
    LIBS=$ac_save_LIBS
    # check first for vte 
    ac_save_LIBS="$LIBS"
    LIBS=`pkg-config vte --cflags --libs` 
    VTE=no 
    AC_CHECK_LIB(vte,vte_terminal_new,[VTE=yes])
    if test "$VTE" = no; then
       AC_MSG_WARN([Could not find the vte library. I will try libzvt-2.0 ],)
       AC_MSG_WARN([you should install vte and vte-devel ],)
       # check for zzledt 
       LIBS=`pkg-config libzvt-2.0 --cflags --libs` 
       GZVT2=no
       AC_CHECK_LIB(zvt-2.0, zvt_term_new_with_size,[GZVT2=yes])
       if test "$GZVT2" = no; then
	  AC_MSG_ERROR([Could not find vte library or libzvt-2.0 library.],)
       else 
         TERM_NAME=zterm
         TERM_LDFLAGS=ZTERM_LDFLAGS
       fi
    else 
	 TERM_NAME=vte
	 TERM_LDFLAGS=VTE_LDFLAGS
    fi
    LIBS=$ac_save_LIBS
  fi
  # try to use readline with the gtk version 
  ac_save_LIBS="$LIBS"
  LIBS="$TERMCAPLIB  $LIBS"
  AC_CHECK_LIB(readline, rl_callback_read_char,[READLINE=-lreadline])
  LIBS=$ac_save_LIBS
  TERMCAPLIB="$READLINE $TERMCAPLIB"
  if test "no$READLINE" != no; then
     ZZLEDT="zzledt-rl.o"
     AC_DEFINE(WITH_READLINE)
  fi
  # we remove the X libs they were just used above during tcl/tk check 
  if test "$with_gtk2" = yes; then
    XAWLIB=
    XMULIB=
    XAW_LOCAL_SUBDIR=
    XAW_LOCAL_LIB=
    X_CFLAGS=
    XAW_LOCAL_INCLUDES=
    X_EXTRA_LIBS=
    XXTXEXT=
    XX11=
    X_LIBS= 
    X_PRE_LIBS=
    if test "$TK_INC_PATH" = '-I/usr/include' ; then
        TK_INC_PATH=
    fi
    if test "$TCL_INC_PATH" = '-I/usr/include' ; then
        TCL_INC_PATH=
    fi
  fi
fi


#################
## atlas 
#################

# check user arguments
USER_ATLAS_LIB_PATH=""

AC_ARG_WITH(atlas-library,
    [  --with-atlas-library=DIR  Atlas library files are in DIR and we use Atlas ],
    [  USER_ATLAS_LIB_PATH=$withval
    CC_OPTIONS="$CC_OPTIONS -DWITH_ATLAS"],
    )

if test "$USER_ATLAS_LIB_PATH" = ""; then
	WHICH_BLAS="STD_BLAS"
	IN_ATLAS=LOCAL
else 
	echo "using Atlas library"
	WHICH_BLAS="ATLAS_LAPACKBLAS"
	ATLAS_DIR=$USER_ATLAS_LIB_PATH
	IN_ATLAS=ATLAS
	AC_DEFINE(WITH_ATLAS)
fi


#################
## ocaml 
#################

OCAMLTARGET=ocaml_disabled
OCAMLTARGET_DISTCLEAN=ocaml_disabled

if test "$with_ocaml" != no; then
	AC_CHECK_PROG(with_ocamlc,ocamlc,yes,no)
	if test "$with_ocamlc" = no; then
		AC_MSG_WARN([ocamlc not found: I will not build Modelica compiler])
		OCAMLTARGET=ocaml_disabled
		OCAMLTARGET_DISTCLEAN=ocaml_disabled
	else
		AC_CHECK_PROG(with_ocamlopt,ocamlopt,yes,no)
		if test "$with_ocamlopt" = no; then
			AC_MSG_WARN([ocamlopt not found: I will not build Modelica compiler])
			OCAMLTARGET=ocaml_disabled
			OCAMLTARGET_DISTCLEAN=ocaml_disabled 
		else
			AC_CHECK_PROG(with_ocamldep,ocamldep,yes,no)
			if test "$with_ocamldep" = no; then
				AC_MSG_WARN([ocamldep not found: I will not build Modelica compiler])
				OCAMLTARGET=ocaml_disabled
				OCAMLTARGET_DISTCLEAN=ocaml_disabled
			else
				AC_DEFINE(WITH_OCAML)
				OCAMLTARGET=scilex-lib
				OCAMLTARGET_DISTCLEAN=distclean
			fi
		fi
	fi
fi

#################
## Man management
#################

# Sablotron or xsltproc
# ===================

AC_CHECK_PROG(WITH_XSLTPROC,xsltproc,yes,no)

if test "$WITH_XSLTPROC" = yes; then
	MANTARGET=man
	MANGENERATOR=xsltproc
else 
	AC_CHECK_PROG(WITH_SABCMD,sabcmd,yes,no)
	if test "$WITH_SABCMD" = yes; then
		MANTARGET=man
		MANGENERATOR=sabcmd
	else
		AC_MSG_WARN([Sablotron "sabcmd" or xmlto not found: I will not build man pages])
		MANTARGET=
	fi
fi

# Now check if man sources 
# are checked out or not
# ===================

AC_CHECK_FILE(man/fr/Makefile.in,[MAN_FR=man/fr/Makefile],[MAN_FR=])

if test "$MAN_FR" = ''; then
	MANTARGET=
	AC_MSG_WARN([man/fr/Makefile.in not found : I will not build man pages])
else
	AC_CHECK_FILE(man/eng/Makefile.in,[MAN_ENG=man/eng/Makefile],[MAN_ENG=])
	if test "$MAN_ENG" = ''; then
		MANTARGET=
		AC_MSG_WARN([man/eng/Makefile.in not found : I will not build man pages])
	fi
fi

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

AC_SUBST(RM)
AC_SUBST(AR)
AC_SUBST(AR_FLAGS)
AC_SUBST(FILES_TO_CLEAN)
AC_SUBST(CC)
AC_SUBST(CC_OPTIONS)
AC_SUBST(CC_LDFLAGS)
AC_SUBST(CC_PICFLAGS)
AC_SUBST(CXX)
AC_SUBST(CXXFLAGS)
AC_SUBST(CXXCPP)
AC_SUBST(FC)
AC_SUBST(FC_OPTIONS)
AC_SUBST(FC_OPTIONS1)
AC_SUBST(FC_OPTIONS2)
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(GETARG)
AC_SUBST(SCIDCOPY)
AC_SUBST(UNSFDCOPY)
AC_SUBST(HPPA_OLD)
AC_SUBST(DLDLIB)
AC_SUBST(DLD_SUBDIR)
AC_SUBST(XAWLIB)
AC_SUBST(XAW)
AC_SUBST(XMULIB)
AC_SUBST(XAW_LOCAL_SUBDIR)
AC_SUBST(XAW_LOCAL_INCLUDES)
AC_SUBST(XAW_LOCAL_LIB)
AC_SUBST(GTKCFLAGS)
AC_SUBST(GTKLIBS)
AC_SUBST(GNOMECFLAGS)
AC_SUBST(TERMCAPLIB)
AC_SUBST(MAIN)
AC_SUBST(MAKEFILE_TARGET)
AC_SUBST(PERIFILE)
AC_SUBST(GUILIB)
AC_SUBST(GZVT)
AC_SUBST(XDRLIB)
AC_SUBST(XDRLIBNAME)
AC_SUBST(WINXFLAGS)
AC_SUBST(MENUSOBJS)
AC_SUBST(MALLOC)
AC_SUBST(PVMARCH)
AC_SUBST(PVMLIB)
AC_SUBST(PVMSCIDIR)
AC_SUBST(PVMSCILIB)
AC_SUBST(PVMGLIB)
AC_SUBST(PVMTARGET)
AC_SUBST(PVMTARGET_DISTCLEAN)
AC_SUBST(PVMROOT)
AC_SUBST(PVMROOTR)
AC_SUBST(PVMINST)
AC_SUBST(PVMINST1)
AC_SUBST(PVMINCLUDE)
AC_SUBST(PVMHOSTERFILES)
AC_SUBST(PVMHOSTER)
AC_SUBST(PVMHELP)

AC_SUBST(TKBASE)
AC_SUBST(TK_INC_PATH)
AC_SUBST(TCL_INC_PATH)
AC_SUBST(TCLTK_LIBS)
AC_SUBST(TCLSCILIB)
AC_SUBST(TCLSCIDIR)
AC_SUBST(TCLSCIDIR)
AC_SUBST(TCLTKHELP)
AC_SUBST(TK_MINOR_VERSION)
AC_SUBST(TK_MAJOR_VERSION)

AC_SUBST(NOINLINE)
AC_SUBST(WHICH_BLAS)
AC_SUBST(ATLAS_DIR)
AC_SUBST(IN_ATLAS)
AC_SUBST(OCAMLTARGET)
AC_SUBST(OCAMLTARGET_DISTCLEAN)
AC_SUBST(WITH_OCAML)
AC_SUBST(MANTARGET)
# for Makemex

AC_SUBST(SHELL)
AC_SUBST(DLLTOOL)
AC_SUBST(LD)
AC_SUBST(LIBM)
AC_SUBST(LIBTOOL)
AC_SUBST(LIBTOOL_DEPS)
AC_SUBST(LN_S)
AC_SUBST(NM)
AC_SUBST(OBJDUMP)
AC_SUBST(PACKAGE)
AC_SUBST(RANLIB)
AC_SUBST(STATIC)
AC_SUBST(SCIVERSION)
AC_SUBST(CPPFLAGS)
AC_SUBST(LDFLAGS)
AC_SUBST(LIBS)
AC_SUBST(FLIBS)
AC_SUBST(SONAME)
#AC_SUBST(CC)
AC_SUBST(CFLAGS)
#AC_SUBST(FC_USE_CDEC)
AC_SUBST(FC_SUBDIR)
AC_SUBST(BLPR_SCRIPTS)
AC_SUBST(SED_CYGDRIVE)
AC_SUBST(F2C_SUBDIR)
AC_SUBST(EXAMPLES_TESTS)
AC_SUBST(IMPPREF)
AC_SUBST(IMPENV)
AC_SUBST(ZZLEDT)
AC_SUBST(STRIP)
AC_SUBST(HTMLFLAGS)
AC_SUBST(GTKPLUGBUG)
AC_SUBST(XXTXEXT)
AC_SUBST(XX11)
AC_SUBST(PERIX11NOPT)
AC_SUBST(GETLIBTK)
AC_SUBST(MANGENERATOR)
AC_SUBST(TERM_NAME)
AC_SUBST(TERM_LDFLAGS)
AC_SUBST(JAVASCITARGET)
AC_SUBST(JAVASCITARGET_DISTCLEAN)
AC_SUBST(JAVA_INCL)
AC_SUBST(GCCFIX)
AC_OUTPUT(Makefile.OBJ Makefile.incl Makefile scripts/Makefile routines/Makefile routines/default/Makefile routines/os_specific/Makefile routines/graphics/Makefile routines/menusX/Makefile routines/xsci/Makefile routines/sparse/Makefile Makemex  config/Makeso.incl routines/interf/Makefile routines/control/Makefile routines/system/Makefile routines/calelm/Makefile  config/Makefile.aix config/Makefile.ultrix routines/lapack/Makefile scripts/scilab.g scripts/scilab-gtk.g examples/Makefile routines/version.h imp/Makefile routines/gtksci/Makefile pvm3/Makefile pvm3/Makefile.aimk pvm3/hoster/Makefile.aimk config/configuration macros/util/gettklib.sci  macros/util/xmlfiletohtml.sci routines/gzvt2/Makefile routines/Javasci/Makefile $MAN_FR $MAN_ENG)