summaryrefslogtreecommitdiff
path: root/config_office/configure.in
blob: 0bf6db346b4dbbb2e58cf0a44960fd6d5ed9fd63 (plain)
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
dnl /******************************************************************
dnl *     vi:set sw=3 ts=3 et:
dnl *
dnl * Name: configure.in
dnl * Auth: Willem van Dorp, Ross Nicholson, Oisin Boydell - Sun Microsystems Ireland
dnl * Date: May 2000
dnl *
dnl * Desc: This file serves as input for the GNU autoconf package
dnl *       in order to create a configure script.
dnl *       In this stage configure just checks the pre-requisites
dnl *       necessary to build OpenOffice.org
dnl *
dnl *
dnl ******************************************************************/
AC_REVISION( $Revision: 1.54 $ )
AC_PREREQ(2.50)
AC_INIT()
echo "$@" >config.parms
AC_ARG_WITH(gpc,
[  --without-gpc           *NOT RECOMMENDED*  Removes GPC code from
                          openoffice.org Reduces some graphics capability
                          slightly.
                          This is required to allow some strict packagers to
                          comply with their distrubution policy.
],,)
AC_ARG_ENABLE(gcc3,
[  --enable-gcc3          Deprecated: Now has no effect, checks compiler version.
],,)
AC_ARG_ENABLE(symbols,
[  --enable-symbols        Include debugging symbols in output.  Warning -  
                          a complete build needs 8 Gb of space and takes 
                          much longer.  (enables -g compiler flag)

],,)
AC_ARG_ENABLE(debug,
[  --enable-debug:         Include debugging symbols from --enable-symbols
                          plus extra debugging code.  Extra large build!
                          (enables -g compiler flag and dmake debug=true)
],,)
AC_ARG_ENABLE(static-gtk,
[  --enable-static-gtk:    Modules that are linked against gtk libraries use
                          the static libraries instead of the dynmaic ones. 
                          (enables -Bstatic linker flag for gtk libraries)
],,)
AC_ARG_WITH(stlport4-home,
[  --with-stlport4-home    The location that STLport4 is installed in. The STL
                          header files are assumed to be in stlport4-home/stlport
                          and the STLport4 library in stlport4-home/lib.

                          Usage: --with-stlport4-home=<absolute path to stlport4 home>
],,)
AC_ARG_WITH(jdk-home,
[  --with-jdk-home         if you have installed JDK 1.3, on your system,
                          please supply the path here.
                          Note that this is not the location of the Java binary but the
                          location of the entire distribution.
 
                          Usage: --with-jdk-home=<absolute path to JDK 1.3 home>
],,)
AC_ARG_WITH(ant-home,
[  --with-ant-home         If you have installed Jakarta Ant on your system,
                          please supply the path here.
                          Note that this is not the location of the Ant binary
                          but the location of the entire distribution.
 
                          Usage: --with-ant-home=<absolute path to Ant home>
],,)
AC_ARG_WITH(perl-home,
[  --with-perl-home        If you have installed the Perl 5 Distribution, on your
                          system, please supply the path here.
                          Note that this is not the location of the Perl binary
                          but the location of the entire distribution.
 
                          Usage: --with-perl-home=<absolute path to Perl 5 home>
],,)
AC_ARG_WITH(cl-home,
[  --with-cl-home          For Windows NT users, please supply the path
                          for the Microsoft C/C++ compiler. 
                          Note that this is not the location of the compiler
                          binary but the location of the entire distribution.
 
                          Usage: --with-cl-home=<absolute path to Microsoft C/C++ compiler home>
],,)
AC_ARG_WITH(psdk-home,
[  --with-psdk-home        For Windows NT users, please supply the path
                          for the Microsoft Platform SDK.
 
                          Usage: --with-psdk-home=<absolute path to Microsoft Platform SDK>
],,)
AC_ARG_WITH(2003-psdk,
[  --with-2003-psdk        Deprecated: Now has no effect.
],,)
AC_ARG_WITH(old-psdk,
[  --with-old-psdk         For Windows users, and compatibility reasons. Please use
                          this option for the October 2002 version of the Microsoft
                          Platform SDK.

                          This is a temporary workaround! 
 
                          Usage: --with-old-psdk
],,)
AC_ARG_WITH(local-solenv,
[  --with-local-solenv     If you have solenv in a location other than ../solenv,
                          please supply the path here.
 
                          Usage: --with-local-solenv=<absolute path to solenv>
],,)
AC_ARG_WITH(local-solver,
[  --with-local-solver     if you have solver in a location other than ../solver,
                          please supply the path here.
 
                          Usage: --with-local-solver=<absolute path to solver>
],,)
AC_ARG_ENABLE(check-only,
[  --enable-check-only     Use this option option if you just want to check your
                          environment.  This option stops the generation of an 
                          ????env.set
 
                          Usage: --enable-check-only=yes
],,)
AC_ARG_ENABLE(macos9,
[  --enable-macos9         Use this option option if you want to generate a
                          macos9 environment on macosx.
                          
                          Usage: --enable-macos9
],,)
AC_ARG_WITH(lang,
[  --with-lang             Use this option to build OpenOffice.org with
                          additional language support. US English is always
                          included by default. Separate multiple languages with
                          commas. For all languages, use --with-lang=ALL.

                          Usage: --with-lang=SPAN,SWED,TURK
],,)
AC_ARG_WITH(dict,
[  --with-dict             Use this option to build OpenOffice.org with
                          dictionary support. US English is always
                          included by default unless overridden with
                          this options. Separate multiple dictionaries with
                          commas. For all dictionaries, use --with-dict=ALL.

                          Usage: --with-dict=ENGB,ENUS,ITIT
],,)
AC_ARG_WITH(asm-home,
[  --with-asm-home         For Windows users, please supply the path for the
                          ml.exe assembler.

                          Usage: --with-asm-home=<path to ml.exe directory>
],,)
AC_ARG_WITH(os-version,
[  --with-os-version       For FreeBSD users, use this option option to build
                          OpenOffice.org with the correct OSVERSION.

                          Usage: --with-os-version=<OSVERSION>
],,)
AC_ARG_WITH(unzip-home,
[  --with-unzip-home       For Windows users, please supply the path for 
                          unzip.exe.

                          Usage: --with-unzip-home=<path to unzip.exe directory>
],,)
AC_ARG_WITH(mingwin,
[  --with-mingwin          For Windows users, use the mingwin32 compiler within
                          cygwin environment (this implies --with-use-shell=tcsh)

                          Usage: --with-mingwin=yes
],WITH_MINGWIN=$withval,WITH_MINGWIN=0)
AC_ARG_WITH(use-shell,
[  --with-use-shell        Select shell different form the default shell. For
                          Windows users, don't use the 4NT shell with
                          "mingwin32" environment

                          Usage: --with-use-shell=<desired shell>
],with_use_shell=$withval,with_use_shell=0)
AC_ARG_ENABLE(sgistl,
[  --enable-sgistl         for IRIX users, use this option option to build
                          OpenOffice.org using SGI's STL.

                          Usage: --enable-check-only=yes
],,)
dnl ===================================================================
dnl Message.
dnl ===================================================================
echo "********************************************************************"
echo "*                                                                  *"
echo "*   OpenOffice.org build configuration.                            *"
echo "*                                                                  *"
echo "*   The configure proces checks your platform to see whether       *"
echo "*   you can build OpenOffice.org on it.                            *"
echo "*   This proces checks all pre-requisites and generates a file     *"
echo "*   containing the necessary environment variables.                *"
echo "*   Source this file after configure has ended successfully.       *"
echo "*                                                                  *"
echo "*   Any warning that is generated during the configure process     *"
echo "*   must be taken into account, since it can be a reason for       *"
echo "*   an unsuccessfull build of OpenOffice.org                       *"
echo "*                                                                  *"
echo "********************************************************************"
echo "********************************************************************"
echo "*                                                                  *"
echo "*   Checking the platform pre-requisites.                          *"
echo "*                                                                  *"
echo "********************************************************************"
dnl ===================================================================
dnl Configure pre-requisites.
dnl ===================================================================
cat /dev/null > warn
AC_PROG_AWK
AC_PATH_PROG( AWK, $AWK)
if test -z "$AWK"; then
   AC_MSG_ERROR([install awk to run this script])
fi

AC_PATH_PROGS(SED, sed )
if test -z "$SED"; then
   AC_MSG_ERROR([install sed to run this script])
fi

dnl ===================================================================
dnl Checks for the operating system and processor.
dnl ===================================================================
dnl checking the os
AC_MSG_CHECKING([the operating system])
_os=`uname`
if test `echo $_os | $AWK -F_ '{ print $1 }'` = "CYGWIN"; then
   _os="WINNT"
   CygwinVer="true"
else
   CygwinVer="false"
fi


dnl ===================================================================
dnl The following is a list of supported systems.
dnl Sequential to keep the logic very simple
dnl These values may be checked and reset later.
dnl ===================================================================
case "$_os" in
	"SunOS")
		test_x=yes
		test_gtk=yes
		;;
	"Linux")
		test_x=yes
		test_gtk=yes
		;;
	"GNU")
		test_x=yes
		;;
	"WINNT")
		test_x=no
		;;
	"Darwin")
		test_x=no
		;;
	"FreeBSD")
		test_x=yes
		test_gtk=yes
		;;
	"OSF1")
		test_x=dontknow
		;;
	"NetBSD")
		test_x=yes
		;;
	"IRIX")
		test_x=yes
		;;
	"IRIX64")
		test_x=yes
		;;
	"AIX")
		test_x=yes
	   	PTHREAD_LIBS=-pthread
		echo "AIX is an alpha port --- Use at own risk" >> warn
		;;
   *)
   AC_MSG_ERROR([$_os operating system is not suitable to build OpenOffice.org!])
   ;;
esac

AC_MSG_RESULT([checked ($_os)])

dnl ===================================================================
dnl First setting is whether to include symbols into final build.
dnl ===================================================================
if test "$enable_symbols" = "yes"; then
   ENVCFLAGSCXX="-g"
   ENVCFLAGS="-g"
else
   ENVCFLAGSCXX=""
   ENVCFLAGS=""
fi

dnl ===================================================================
dnl WINNT uses either 4nt or tcsh, all other O/S use tcsh.
dnl The following sets the with_use_shell variable.
dnl ===================================================================
if test $_os = "WINNT" -a $CygwinVer = "true"; then
   if test "$with_use_shell" = "0"; then
      with_use_shell="4nt"
   fi
   if test `uname -r | $AWK -F. '{ print $1"."$2 }'` = "1.3"; then
      CygwinVer="1"
   dnl ===================================================================
   dnl Sanity check! Native windows programs cannot use cygwin symlinks!
   dnl ===================================================================
   dnl As long as awk instead of $AWK is used somewhere in the sources,
   dnl check for $AWK and awk. $AWK is pointing to gawk in cygwin.
      if test -L $AWK -o -L `which awk` -o -L `which tar` -o -L `which gunzip` ; then
         AC_MSG_ERROR([$AWK, awk, tar or gunzip is a cygwin symlink!
Native windows programs cannot use cygwin symlinks. Remove the symbolic
link, and copy the program to the name of the link.])
      fi
   dnl ===================================================================
   dnl If $CC is set to a MinGW compiler, e.g. "gcc -mno-cygwin" enable
   dnl $WITH_MINGWIN
   dnl ===================================================================
      if test -n "$CC";then
         if test `$CC -dumpmachine | $AWK -F- '{ print $3 }'` = "mingw32"; then
            WITH_MINGWIN="yes"
         fi
      fi
   else
      CygwinVer="b"
   fi
   if test "$with_use_shell" != "4nt" -a "$CygwinVer" != "1"; then
      AC_MSG_ERROR([install Cygwin V1.3.x and tcsh if you don't use 4NT])
   fi
   dnl ===================================================================
   dnl If using Mingwin32 then don't use 4NT
   dnl ===================================================================
   if test "$WITH_MINGWIN" = "yes"; then
      with_use_shell="tcsh"
      if test -z "$CC"; then
         CC="gcc -mno-cygwin"
         CXX="g++ -mno-cygwin"
      fi
   fi
else 
   if test "$_os" = "WINNT"; then
      with_use_shell="4nt"
   else
   dnl ===================================================================
   dnl All other operating systems use tcsh.
   dnl ===================================================================
      if test "$with_use_shell" = "0"; then
            with_use_shell="tcsh"
      fi
   fi
fi

_machine_type=`uname -m`

dnl ===================================================================
dnl check whether we're using solaris 6,7,8 - sparc or intel.
dnl ===================================================================
if test "$_os" = "SunOS"; then 
   AC_MSG_CHECKING([the solaris operating system release])
   _os_release=`uname -r | $AWK -F. '{ print $2 }'`
   if test "$_os_release" != "9" -a "$_os_release" != "8" -a "$_os_release" != "7" -a "$_os_release" != "6"; then
      AC_MSG_ERROR([use solaris 6, 7, 8 or 9 to build OpenOffice.org])
   else
      AC_MSG_RESULT([ok ($_os_release)])
   fi

   dnl check whether we're using a sparc or i386 processor
   AC_MSG_CHECKING([the processor type])
   _processor=`uname -p`
   if test "$_processor" = "sparc" -o "$_processor" = "i386"
   then
      AC_MSG_RESULT([ok ($_processor)])
   else
      AC_MSG_ERROR([only sparc and i386 processors are supported])
   fi
fi

dnl ===================================================================
dnl  Checks for c compiler,
dnl  The check for the c++ compiler is later on.
dnl ===================================================================
if test -n "$with_gcc_home"; then
   if test -z "$CC"; then
      CC="$with_gcc_home/bin/gcc"
   fi
fi

dnl The following checks for gcc, cc and then (cl if win32)
AC_PROG_CC

COMPATH=`dirname "$CC"`
if test "$COMPATH" = "." ; then
    AC_PATH_PROGS(COMPATH, $CC)
    dnl double square bracket to get single because of M4 quote...
    COMPATH=`echo $COMPATH | $SED "s@/[[^/:]]*\\\$@@"`;
fi

dnl ===================================================================
dnl  Test the gcc version,  3 is OK, 2.96 invalid,  2.95+ is OK
dnl ===================================================================
if test "$GCC" = "yes"; then
    AC_MSG_CHECKING([the GNU gcc compiler version])
   _gcc_version=`$CC -dumpversion`
   _gcc_major=`echo $_gcc_version | $AWK -F. '{ print \$1 }'`
   _gcc_longver=`echo $_gcc_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`

   if test "$_gcc_major" = "3"; then
      USE_GCC3="TRUE"
   else
      USE_GCC3="FALSE"
      if test "$_gcc_longver"  -lt "029502"; then
         AC_MSG_ERROR([found version "$_gcc_version", use version 2.95.2+ of the gcc compiler])
      else
         if test "$_gcc_longver" -gt "029599"; then
            AC_MSG_ERROR([found version "$_gcc_version", Not supported. Upgrade to gcc 3])
         fi
      fi
	  echo "gcc 2.95 support is not perfect, suggest upgrade to gcc 3" >>warn
   fi
   AC_MSG_RESULT([checked (gcc $_gcc_version)])
fi  

dnl ===================================================================
dnl Search all the common names for GNU make
dnl ===================================================================
AC_MSG_CHECKING([the GNU make version])
for a in "$MAKE" $GNUMAKE make gmake gnumake ; do
      $a --version 2> /dev/null | grep GNU  2>&1 > /dev/null
      if test $? -eq 0 ;  then
           GNUMAKE=$a ;
           break;
      fi
done ;

dnl Change empty GNUMAKE from warning to error, pending testing.
if test -z "$GNUMAKE"; then
    AC_MSG_WARN([not found build may fail])
    echo "gnu make not found build may fail" >> warn
else
    _make_version=`$GNUMAKE --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`;
    _make_major=`echo $_make_version | $AWK -F. '{print $1;}'` 
    _make_middle=`echo $_make_version | $AWK -F. '{ print $2; }'` 
    _make_minor=`echo $_make_version | $AWK -F. '{ print $3; }'` 
    if test "$_make_major" -gt "3" ; then
       AC_MSG_RESULT([checked ($GNUMAKE $_make_version)])
    else
       if test "$_make_middle" -gt "79" ; then
          AC_MSG_RESULT([checked ($GNUMAKE $_make_version)])
       else
          if test "$_make_minor" -ge "1" ; then
             AC_MSG_RESULT([checked ($GNUMAKE $_make_version)])
          else
             if test "$_os" = "Darwin"; then
                 AC_MSG_WARN([failed ($GNUMAKE $_make_version need 3.79.1+)])
                 echo "$GNUMAKE $_make_version may cause problems need 3.79.1+" >> warn
			 else
                 AC_MSG_ERROR([failed ($GNUMAKE $_make_version need 3.79.1+)])
			 fi
          fi
       fi
    fi
fi

dnl ===================================================================
dnl  Test the solaris compiler version
dnl ===================================================================
if test "$_os" = "SunOS"; then
   if test "$CC" = "cc"; then
      AC_PATH_PROGS(_cc, cc)
      COMPATH=`echo $_cc | $SED -n "s/\/bin\/cc//p"`
      AC_MSG_CHECKING([the SUN Workshop C compiler version])
      dnl cc -V outputs to standard error!!!!
      _workshop_version=`$CC -V 2>&1 | $AWK '/^cc/ { print $7 }'`
      if test "$_workshop_version" = "C"; then
         _workshop_version=`$CC -V 2>&1 | $AWK '/^cc/ { print $8 }'`
      fi   
      _workshop_major=`echo $_workshop_version | $AWK -F. '{ print $1 }'` 
      if test "$_workshop_major" != "5"; then
         AC_MSG_ERROR([found version "$_workshop_version", use version 5.0 or 5.2 of the Sun Workshop C compiler])
      else
         _workshop_minor=`echo $_workshop_version | $AWK -F. '{ if ($2 == 0) print "true"; else if ($2 == 2) print "true"; else print "false" }'` 
         if test "$_workshop_minor" = "false"; then
            AC_MSG_ERROR([found version "$_workshop_version", use version 5.0 or 5.2 of the Sun Workshop C compiler])
         else
            dnl compiler will do
            AC_MSG_RESULT([checked])
         fi
      fi
   fi
fi

dnl ===================================================================
dnl  Test the IRIX SGI Mips pro compiler
dnl ===================================================================
if test "$_os" = "IRIX" -o "$_os" = "IRIX64"; then
   if test "$CC" = "cc"; then
      AC_PATH_PROGS(_cc, cc)
      COMPATH=`echo $_cc | $SED -n "s/\/usr\/bin\/cc//p"`
      AC_MSG_CHECKING([the SGI MIPSpro C compiler version])
      dnl cc -version outputs to standard error!!!!
      _mipspro_version=`$CC -version 2>&1 | $AWK '{ print $4 }'`
      _mipspro_major=`echo $_mipspro_version | $AWK -F. '{ print $1 }'`
      if test "$_mipspro_major" != "7"; then
         AC_MSG_ERROR([found version "$_mipspro_version", use version 7.2+ of the SGI MIPSpro C compiler])
      else
         _mipspro_minor=`echo $_mipspro_version | $AWK -F. '{ if ($2 <= 1) print "false"; else print "true" }'`
         if test "$_mipspro_minor" = "false"; then
            AC_MSG_ERROR([found version "$_mipspro_version", use version 7.2+ of the SGI MIPSpro C compiler])
         else
            dnl compiler will do
            AC_MSG_RESULT([checked])
         fi
      fi
   fi
fi

dnl ===================================================================
dnl  Test the Compaq compiler for OSF1
dnl ===================================================================
if test "$_os" = "OSF1"; then
   if test "$CC" = "cc"; then
      AC_PATH_PROGS(_cc, cc)
      COMPATH=`echo $_cc | $SED -n "s/\/usr\/bin\/cc//p"`
      AC_MSG_WARN([******* $_cc , $COMPATH])
      AC_MSG_CHECKING([the Compaq C compiler version])
      dnl cc -V outputs to standard error!!!!
      _compaqc_version=`$CC -V 2>&1 | $AWK '{ print $3 }'`
      _compaqc_major=`echo $_compaqc_version | $AWK -F. '{ print $1 }'`
      if test "$_compaqc_major" != "T6"; then
         AC_MSG_ERROR([found version "$_compaqc_version", use version 6 of the Compaq C compiler])
      else
         dnl compiler will do
         AC_MSG_RESULT([checked])
      fi
   fi
fi

dnl ===================================================================
dnl  Check which Microsoft C/C++ or MinGW compiler is used for WINNT
dnl ===================================================================
if test "$_os" = "WINNT"; then
	if test "$WITH_MINGWIN" != "yes"; then
		AC_MSG_CHECKING([the Microsoft C/C++ Compiler])
   		if test -x "$with_cl_home/bin/cl.exe"; then
   			CC="$with_cl_home/bin/cl.exe"
   		else
   			AC_PATH_PROG(CC, cl.exe)
   		fi
  		if test -e "$CC"; then
			# Don't use filenames with spaces AND the old cygwin b20
			if test "$CygwinVer" = "1"; then
				# This gives us a posix path with 8.3 filename restrictions
				CC=`cygpath -d "$CC"`
				CC=`cygpath -u "$CC"`
			fi
			# Remove /cl.exe from CC case insensitive
			COMPATH=`echo $CC | $SED 's@/[[cC]][[lL]\.[eE]][[xX]][[eE]]@@'`
			# Please set INCLUDE in your environement if you use the old cygwin b20
			if test "$CygwinVer" = "1"; then
				export INCLUDE=`cygpath -d "$COMPATH/../Include"`
			fi
			AC_MSG_RESULT([found.])
			dnl  Check which Microsoft C/C++ compiler is found
			AC_MSG_CHECKING([the Version of Microsoft C/C++ Compiler])
			CCNUMVER=`$CC 2>&1 | $AWK "/Microsoft.*..\\...\\...../ {
							x = match( \\\$0, /..\\...\\...../ )
							CCversion = substr( \\\$0, RSTART, RLENGTH)
							tokencount = split (CCversion,vertoken,\".\")
							for ( i = 1 ; i <= tokencount ; i++ ) {
								printf (\"%04d\",vertoken[[i]] )
							}
							}"`
			AC_MSG_RESULT([found Compiler version $CCNUMVER.])
			if test $CCNUMVER -ge "001300000000"; then
				COMEX=8
			else
				if test $CCNUMVER -ge "001200000000"; then
					if test "$with_old_psdk" != "yes"; then
						COMEX=9
					else
						COMEX=7
					fi
				else
					AC_MSG_ERROR([Compiler too old.])
				fi
			fi
		else
			AC_MSG_ERROR([Microsoft C/C++ Compiler not found. Use --with-cl-home or set path to cl.exe.])
		fi
	else
		AC_MSG_CHECKING([the Mingwin32 C++ Compiler])
		if test `$CC -dumpmachine | $AWK -F- '{ print $3 }'` = "mingw32"; then
			AC_MSG_RESULT([found.])
		else
			AC_MSG_ERROR([Mingwin32 C++ Compiler not found.])
		fi
	fi
fi

dnl ===================================================================
dnl Check if stdc headers are available excluding windows.
dnl ===================================================================
AC_HEADER_STDC

dnl ===================================================================
dnl Check if pam-appl.h is available on Linux or FreeBSD
dnl ===================================================================
if test "$_os" = "Linux" -o "$_os" = "FreeBSD" -o "$_os" = "GNU"; then
   AC_MSG_CHECKING([pam_appl.h])
   if test -f "/usr/include/security/pam_appl.h"; then
      AC_MSG_RESULT([yes])
   else
      AC_MSG_WARN([pam_appl.h could not be found in /usr/include/security])
      echo "pam_appl.h could not be found in /usr/include/security" >> warn
   fi
fi

dnl ===================================================================
dnl Testing for c++ compiler and version...
dnl ===================================================================
if test -n "$with_gcc_home"; then
   if test -z "$CXX"; then
      CXX="$with_gcc_home/bin/g++"
   fi
fi

if test "$_os" = "WINNT" -a "$WITH_MINGWIN" != "yes"; then
   if test -e "$CC"; then
      CXX="$CC"
   fi
fi

dnl Autoconf 2.53 can do this test for cl.exe, 2.13 can't!
if test "$_os" != "WINNT" -o "$WITH_MINGWIN" = "yes"; then
   AC_PROG_CXX
fi

dnl ===================================================================
dnl Set the gcc/gxx include directories
dnl ===================================================================
if test "$_os" = "FreeBSD" && test "$CC" != "cc"; then
if test "$GXX" = "yes"; then
   if test -n "$enable_gcc3"; then
		_gccincname1="g++-v3"
   else
		_gccincname1="g++-3"
   fi
	_gcc_include_path=".."
	_gxx_include_path="$_gcc_include_path/$_gccincname1"
fi
else
if test "$GXX" = "yes"; then
   _gxx_include_path=`echo "#include <cstring>" | $CXX -E -xc++ - | $SED -n '/.*1*"\(.*\)\/cstring".*/s//\1/p' | head -1`
   if test "$_gxx_include_path" = "/usr/libexec/(null)/include"; then
       _gxx_include_path="/usr/include"
   fi
dnl This is the original code...
dnl _gxx_include_path=`$CXX -print-search-dirs | grep instal |$AWK '{ print \$2 }'`/include 
fi
fi

dnl ===================================================================
dnl Extra checking for the SUN OS compiler
dnl ===================================================================
if test "$_os" = "SunOS"; then
   dnl Workshop C++ compiler packaged with Workshop C compiler
   if test "$CC" = "cc"; then
   AC_MSG_CHECKING([Sun Workshop C++ Compiler])
      if test "$CXX" != "CC"; then
         AC_MSG_WARN([Sun Workshop C++ was not found])
         echo "Sun Workshop C++ was not found" >> warn
      else
         AC_MSG_RESULT([checked]) 
      fi
   fi 
fi
dnl ===================================================================
dnl Extra checking for the DARWIN compiler
dnl ===================================================================
if test "$_os" = "Darwin"; then
   dnl c++ packaged with cc (gcc) for Macosx
   if test "$CC" = "cc"; then
      AC_MSG_CHECKING([Macosx c++ Compiler])
      if test "$CXX" != "c++"; then
         AC_MSG_WARN([Macosx C++ was not found])
         echo "Macosx C++ was not found" >> warn
      else
         AC_MSG_RESULT([checked]) 
      fi
   fi 
fi 
dnl ===================================================================
dnl Extra checking for the IRIX compiler
dnl ===================================================================
if test "$_os" = "IRIX" -o "$_os" = "IRIX64"; then
   dnl MIPSpro C++ compiler packaged with MIPSpro C compiler
   if test "$CC" = "cc"; then
      AC_MSG_CHECKING([SGI MIPSpro C++ Compiler])
      if test "$CXX" != "CC"; then
         AC_MSG_WARN([SGI MIPSpro C++ was not found])
         echo "SGI MIPSpro C++ was not found" >> warn
      else
         AC_MSG_RESULT([checked])
      fi
   fi
fi
dnl ===================================================================
dnl Extra checking for the OSF compiler
dnl ===================================================================
if test "$_os" = "OSF1"; then
   AC_MSG_CHECKING([Compaq C++ compiler version])
   dnl cxx -V outputs to standard error!!!!
   _compaqcxx_version=`$CXX -V 2>&1 | $AWK '{ print $3 }'`
   _compaqcxx_major=`echo $_compaqcxx_version | $AWK -F. '{ print $1 }'`
   if test "$_compaqcxx_major" != "V6"; then
      AC_MSG_WARN([found version "$_compaqc_version", use version 6 of the Compaq C++ compiler])
      echo "found version $_compaqc_version, use version 6 of the Compaq C++ compiler" >> warn
   else
      dnl compiler will do
      AC_MSG_RESULT([checked])
   fi
fi

dnl *************************************************************
dnl Testing for exception handling - dwarf2 or sjlj exceptions...
dnl *************************************************************
AC_MSG_CHECKING([try to compile exception code])
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_CACHE_VAL(exceptions_type, [AC_TRY_LINK(
	[#include <iostream>

extern "C" void __sjthrow(void) __attribute__ ((__noreturn__));

	],
	[__sjthrow() ],
	[exceptions_type="sjlj"],
	[exceptions_type="dwarf2"])
])

AC_MSG_RESULT(Exceptions type: $exceptions_type)
AC_LANG_RESTORE

dnl **************************************************************
dnl Testing for required  Solaris and workshop compiler patches...
dnl **************************************************************
dnl Check whether the OS is SunOS.
if test "$_os" = "SunOS"; then
   _temp=`showrev -p | $AWK -F" " '{ print $2 }'` 
   if test "$_os_release" = "7"; then
      dnl ***************
      dnl patch 106327-06
      dnl ***************
      AC_MSG_CHECKING([for patch 106327-06 or greater])
      _patch=`echo $_temp | $AWK '/106327-06/ { print "found" }'`
      _patch="false"
      for i in $_temp
      do
         _patch_major=`echo $i | $AWK -F"-" '{ print $1 }'`
         if test "$_patch_major" = "106327"; then
            _patch_rev=`echo $i | $AWK -F"-" '{ print $2 }'`
            if test "$_patch_rev" -ge "6"; then
               _patch="found"
            fi
        fi
      done
      if test "$_patch" = "found"; then
         AC_MSG_RESULT([found])
      else
         AC_MSG_WARN([patch 106327-06 not found, please install compiler patch 106327-06 or greater])
         echo "patch 106327-06 not found, please install compiler patch 106327-06 or greater" >> warn
      fi
      dnl ***************
      dnl patch 106950-11
      dnl ***************
      AC_MSG_CHECKING([for patch 106950-11 or greater])
      _patch=`echo $_temp | $AWK '/106950-11/ { print "found" }'`
      _patch="false"
      for i in $_temp
      do
         _patch_major=`echo $i | $AWK -F"-" '{ print $1 }'`
         if test "$_patch_major" = "106950"; then
            _patch_rev=`echo $i | $AWK -F"-" '{ print $2 }'`
            if test "$_patch_rev" -ge "11"; then
               _patch="found"
            fi
         fi
      done
      if test "$_patch" = "found"; then
         AC_MSG_RESULT([found])
      else
         AC_MSG_WARN([patch 106950-11 not found, please install linker patch 106950-11 or greater])
         echo "patch 106950-11 not found, please install linker patch 106950-11 or greater" >> warn
      fi
   else
      if test "$_os_release" = "6"; then
         dnl ***************
         dnl patch 105591-09
         dnl ***************
         AC_MSG_CHECKING([for patch 105591-09 or greater])
         _patch=`echo $_temp | $AWK '/105591-09/ { print "found" }'`
         _patch="false"
         for i in $_temp
         do
            _patch_major=`echo $i | $AWK -F"-" '{ print $1 }'`
            if test "$_patch_major" = "105591"; then
               _patch_rev=`echo $i | $AWK -F"-" '{ print $2 }'`
               if test "$_patch_rev" -ge "9"; then
                  _patch="found"
               fi
           fi
         done
         if test "$_patch" = "found"; then
            AC_MSG_RESULT([found])
         else
            AC_MSG_WARN([patch 105591-09 not found, please install compiler patch 105591-09 or greater])
            echo "patch 105591-09 not found, please install compiler patch 105591-09 or greater" >> warn
         fi
         dnl ***************
         dnl patch 107733-08
         dnl ***************
         AC_MSG_CHECKING([for patch 107733-08 or greater])
         _patch=`echo $_temp | $AWK '/107733-08/ { print "found" }'`
         _patch="false"
         for i in $_temp
         do
            _patch_major=`echo $i | $AWK -F"-" '{ print $1 }'`
            if test "$_patch_major" = "107733"; then
               _patch_rev=`echo $i | $AWK -F"-" '{ print $2 }'`
               if test "$_patch_rev" -ge "8"; then
                  _patch="found"
               fi
           fi
         done
         if test "$_patch" = "found"; then
            AC_MSG_RESULT([found])
         else
            AC_MSG_WARN([patch 107733-06 not found, please install linker patch 107733-08 or greater])
            echo "patch 107733-06 not found, please install linker patch 107733-08 or greater" >> warn
         fi
      fi
   fi
fi

dnl ===================================================================
dnl When using Sun Workshop compiler, there is a bug with the cc
dnl preprocessor, so use CC preprocessor for the following tests.
dnl See Issuezilla #445.
dnl ===================================================================
if test "$_os" = "SunOS"; then
AC_LANG_CPLUSPLUS
AC_TRY_CPP("", , )
fi

dnl ===================================================================
dnl Checks for SGI STL
dnl ===================================================================
if test -n "$enable_sgistl"; then
	if test "$_os" = "IRIX" -o "$_os" = "IRIX64"; then
		AC_MSG_CHECKING([for SGI STL])
		if test -d /usr/include/CC ; then
			AC_MSG_RESULT([yes.])

		else
			AC_MSG_RESULT([not found.])
		fi
	else
		AC_MSG_ERROR([IRIX not found.])
	fi
else

dnl ===================================================================
dnl Checks for STLPORT4
dnl ===================================================================
AC_MSG_CHECKING([for STLport4 headers])
if test -d "$with_stlport4_home"; then
	STLPORT4=$with_stlport4_home
        if test "$_os" != "WINNT" -o "$WITH_MINGWIN" = "yes"; then
           AC_TRY_CPP($STLPORT4/stlport/hash_map, AC_MSG_RESULT([checked.]), AC_MSG_ERROR([STLport4 headers not found.]))
        else
           dnl AC_TRY_CPP doesn't work for MSVC because C++ preprocessor is not found by autoconf.
           if test -f "$STLPORT4/stlport/hash_map"; then
              AC_MSG_RESULT([checked.])
           else
              AC_MSG_ERROR([STLport4 headers not found.])
           fi
        fi
        if test "$_os" != "WINNT" -o "$WITH_MINGWIN" = "yes"; then
		AC_MSG_CHECKING([for STLport4 libraries])
		if test "$_os" = "SunOS"; then
			if test -f "$STLPORT4/lib/libstlport_sunpro.so"; then
				AC_MSG_RESULT([checked])
			else
				AC_MSG_ERROR([STLport4 libraries not found])
			fi
		elif test "$_os" = "Darwin"; then
			if test -f "$STLPORT4/lib/libstlport_gcc.dylib"; then
				AC_MSG_RESULT([checked])
			else
				AC_MSG_ERROR([STLport4 libraries not found])
			fi
		elif test "$_os" = "IRIX" -o "$_os" = "IRIX64"; then
			if test -f "$STLPORT4/lib/libstlport_mipspro_41.so"; then
				AC_MSG_RESULT([checked])
			else
				if test -f "$STLPORT4/lib/libstlport_gcc.so"; then
					AC_MSG_RESULT([checked])
				else
					AC_MSG_ERROR([STLport4 libraries not found])
				fi
			fi
		else
			if test -f "$STLPORT4/lib/libstlport_gcc.so"; then
				AC_MSG_RESULT([checked])
			else
				AC_MSG_ERROR([STLport4 libraries not found])
			fi
		fi
	fi
else
	AC_MSG_RESULT([using internal stlport.])
fi

fi
dnl ===================================================================
dnl Checks for JDK.
dnl ===================================================================
JAVA_HOME=; export JAVA_HOME
if test -z "$with_jdk_home"; then
   AC_PATH_PROG(JAVA, javac)
else
   _java_path="$with_jdk_home/bin/javac"
   dnl Check if there is a java compiler at all.
   if test -x "$_java_path"; then
      JAVA=$_java_path
	else
		AC_MSG_ERROR([$_java_path not found set with_jdk_home])
   fi
fi
AC_MSG_CHECKING([the installed JDK])
if test "$JAVA"; then
   dnl java -version sends output to stderr!
   _jdk=`$JAVA -J-version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`

   _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`

   if test "$_jdk_ver" -lt 10300; then
        AC_MSG_ERROR([You need at least jdk-1.3])
   else
      JAVA_HOME=`echo $JAVA | $SED -n "s,//*bin//*javac,,p"`
      AC_MSG_RESULT([checked (JDK $_jdk)])
   fi
else
   AC_MSG_ERROR([JAVA not found. You need at least jdk-1.3])
fi
dnl ===================================================================
dnl Checks for specific files.
dnl ===================================================================
dnl ===================================================================
dnl Checks for programs.
dnl ===================================================================
dnl Check whether there's a C pre-processor.
if test "$_os" = "Linux" -o "$_os" = "FreeBSD" -o "$_os" = "NetBSD" ; then
   AC_PROG_CPP
fi
dnl Check whether there's a C++ pre-processor.
if test "$_os" = "Linux" -o "$_os" = "FreeBSD" -o "$_os" = "NetBSD" ; then
   AC_PROG_CXXCPP
fi
dnl Check for a BSD compatible install program.
dnl AC_PROG_INSTALL
dnl Check whether ln -s works on the current file system.
dnl AC_PROG_LN_S

dnl ===================================================================
dnl Check whether xmkmf program can be used, x systems only
dnl ===================================================================
if test  "$test_x" = "yes"; then
		AC_PATH_PROGS(XMKMF, xmkmf)
		if test -z "$XMKMF"; then
		   AC_MSG_ERROR([install xmkmf to run this script, include openwin in path])
		fi
else
	echo "Skipping xmkmf test $test_x"
fi

dnl ===================================================================
dnl Check whether there's a Perl version available.
dnl ===================================================================
if test -z "$with_perl_home"; then
   AC_PATH_PROG(PERL, perl)
else
   _perl_path="$with_perl_home/bin/perl"
   if test -x "$_perl_path"; then
      PERL=$_perl_path
   else
      AC_MSG_ERROR([$_perl_path not found])
   fi
fi

dnl ===================================================================
dnl Testing for Perl version 5 or greater.
dnl $] is the perl version variable, it is returned as an integer
dnl ===================================================================
if test "$PERL"; then
   AC_MSG_CHECKING([the Perl version])
   ${PERL} -e "exit($]);"
   _perl_version=$?
   if test "$_perl_version" -lt 5; then
      AC_MSG_ERROR([found Perl version "$_perl_version", use version 5 of Perl])
   fi 
   AC_MSG_RESULT([checked (perl $_perl_version)])
else
   AC_MSG_ERROR([Perl not found, install version 5 of Perl])
fi

dnl ===================================================================
dnl Check whether the tcsh can be used.
dnl ===================================================================
if test "$_os" != "WINNT" -o "$with_use_shell" != "4nt"; then
   AC_PATH_PROG(TCSH, tcsh)
   if test -z "$TCSH"; then
      AC_MSG_ERROR([tcsh not found in \$PATH])
   else
      TCSH=`echo $TCSH | $SED -n "s/\/tcsh//p"`
   fi
else
   AC_MSG_WARN([Windows 4NT builds don't need tcsh])
   TCSH="NO_TCSH_NEEDED"
fi
dnl ===================================================================
dnl Check whether the gtk 2.0 libraries are available.
dnl ===================================================================
if test  "$test_gtk" = "yes"; then
    pkg_modules="gtk+-2.0 >= 1.3.13"
    PKG_CHECK_MODULES( GTK, [$pkg_modules] )
dnl	AM_PATH_GTK("1.3.13", AC_MSG_RESULT([GTK OK]), AC_MSG_WARN([GTK 2.0 not found])
fi

dnl ===================================================================
dnl Checks for libraries.
dnl ===================================================================
dnl Check for Mac OS X native GUI, which may be used instead of X11.
dnl Check for a lack of --with-x option on Darwin.  If it is missing, look to
dnl see if we have the AppKit framework for building with Quartz graphics.

if test  "$_os" = "Darwin"  -a  "x$with_x" != "xyes"  -a  "x$x_includes" = "xNONE"  -a  "x$x_libraries" = "xNONE"; then
   dnl System is either Mac OS X or pure Darwin, and --with-x was not specified
   dnl Default to Aqua graphics if available.
   AC_MSG_CHECKING([for /System/Library/Frameworks/AppKit.framework])
   if test -d "/System/Library/Frameworks/AppKit.framework/"; then
      AC_MSG_RESULT([yes])
      x_includes="no_x_includes"
      x_libraries="no_x_libraries"
   else
      AC_MSG_RESULT([no])
      dnl Probably a pure Darwin system. Check for X11 below.
   fi
fi

dnl ***************************************
dnl testing for X libraries and includes...
dnl ***************************************
if test "$_os" = "Darwin" -a "x$x_includes" = "xno_x_includes"; then
   echo "Do Nothing for _os = Darwin and x_includes = no_x_includes"
   dnl Mac OS X using Aqua graphics. Don't check for X11.
   :
elif test "$_os" != "WINNT" ; then
   AC_PATH_X
   AC_PATH_XTRA

   if test "x$x_includes" = "x"; then
     x_includes="/usr/include"
   fi
   if test "x$x_libraries" = "x"; then
     x_libraries="/usr/lib"
   fi
   dnl The variables $x_libraries and $x_includes are set.
   if test -z "$x_libraries"; then
      AC_MSG_ERROR([No X libraries found]) # Exit
   fi
   if test -z "$x_includes"; then
      AC_MSG_ERROR([No X includes found]) # Exit
   fi
   CFLAGS=$X_CFLAGS
   LDFLAGS="$X_LDFLAGS $X_LIBS"
   AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
else
   x_includes="no_x_includes"
   x_libraries="no_x_libraries"
fi
dnl ***************************************
dnl testing libc version for Linux...
dnl ***************************************
if test "$_os" = "Linux"; then
   AC_CHECK_LIB(c, gnu_get_libc_version, HAVE_LIBC=yes; export HAVE_LIBC)
   AC_MSG_CHECKING([the installed libc is at least version 2.1.1])
   if test "$HAVE_LIBC"; then
      AC_MSG_RESULT([checked])
   else
      AC_MSG_ERROR([libc is less than version 2.1.1, upgrade libc])
   fi
fi
dnl =========================================
dnl Check for the Microsoft Platform SDK.
dnl =========================================
dnl FIXME: I don't know yet if PSDK works with MinGW, keep it until I know better,
dnl and add "-a \( "$WITH_MINGWIN" != "yes" \)" then
if test \( "$_os" = "WINNT" \) ; then
	AC_MSG_CHECKING([PSDK files])
	if test -z "$with_psdk_home"; then
		# This line will work with cygwin 1.3.? and newer, for older versions
		# cat will output nothing, therefore PSDK_HOME will be empty.
		PSDK_HOME=`cat "/proc/registry/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MicrosoftSDK/Directories/Install Dir"`
	else
		PSDK_HOME="$with_psdk_home"
	fi
	if test \( -f "$PSDK_HOME/Include/AdoCtint.h" \) \
		 -a \( -f "$PSDK_HOME/Include/SqlUcode.h" \) \
		 -a \( -f "$PSDK_HOME/Include/usp10.h" \); then
		HAVE_PSDK_H="yes"
	else
		HAVE_PSDK_H="no"
	fi
	if test -f "$PSDK_HOME/lib/unicows.lib"; then
		HAVE_PSDK_LIB="yes"
	else
		HAVE_PSDK_LIB="no"
	fi
	if test "$HAVE_PSDK_H" = "yes" -a "$HAVE_PSDK_LIB" = "yes"; then
		AC_MSG_RESULT([PSDK files found])
	else
		AC_MSG_ERROR([PSDK files not found, please use --with-psdk-home .])
	fi
fi
dnl ***************************************
dnl testing bison and flex exist
dnl ***************************************
AC_PATH_PROG(BISON, bison)
if test -z "$BISON"; then
   AC_MSG_ERROR([no bison found in \$PATH, install bison])
fi
AC_PATH_PROG(FLEX, flex)
if test -z "$FLEX"; then
   AC_MSG_ERROR([no flex found in \$PATH, install flex])
fi
dnl ***************************************
dnl testing that patch exists
dnl ***************************************
AC_PATH_PROG(PATCH, patch)
if test -z "$PATCH"; then
   AC_MSG_ERROR([\"patch\" not found in \$PATH, install the development tool named\"patch"\])
fi
dnl ***************************************
dnl testing bash tools path on Windows
dnl ***************************************
if test "$_os" = "WINNT"; then
	AC_PATH_PROG(CYGWIN, bash)
	CYGWIN=`dirname $CYGWIN`
fi
dnl ***************************************
dnl testing ml.exe assembler path
dnl ***************************************
if test "$_os" = "WINNT" -a "$WITH_MINGWIN" != "yes"; then
  if test ! -x "$with_asm_home/ml.exe"; then
    AC_PATH_PROG(ML_EXE, ml.exe)
    if test -z "$ML_EXE"; then
       AC_MSG_ERROR([Configure did not find ml.exe assembler.])
    else
       with_asm_home="ASM_IN_PATH"
    fi
  fi
else
	with_asm_home="NO_ASM_HOME"
fi
dnl ***************************************
dnl testing unzip.exe path
dnl ***************************************
if test "$_os" = "WINNT"; then
# We are looking for zip, not unzip. All occurences should
# change from UNZIP to ZIP
if test ! -x "$with_unzip_home/zip.exe"; then
   AC_PATH_PROG(ZIP_EXE, zip.exe)
   if test -z "$ZIP_EXE"; then
      with_unzip_home="NO_UNZIP_HOME"
   else
      if test "$with_use_shell" = "4nt" ; then
         if test -z "`$ZIP_EXE -h | grep -i WinNT`" ; then
AC_MSG_ERROR([$ZIP_EXE found in the path is not the required native Windows Version 2.3 of Info-ZIPs zip.exe.
Probably there is a cygwin version in the path.])
         fi
      else
         if test -n "`$ZIP_EXE -h | grep -i WinNT`" ; then
AC_MSG_ERROR([$ZIP_EXE found in the path is not the required cygwin version of Info-ZIPs zip.exe.])
         fi
      fi
      with_unzip_home="UNZIP_IN_PATH"
   fi
fi
else
        with_unzip_home="NO_UNZIP_HOME"
fi

dnl ===================================================================
dnl Test for the presence of the required gpc.{c,h} files
dnl ===================================================================

if test "$with_gpc" != "no" ; then
  WITH_GPC=YES

  AC_MSG_CHECKING([GPC files])
  if test -f ../external/gpc/gpc.h; then
	HAVE_GPC_H="yes"
  else
	HAVE_GPC_H="no"
  fi
  if test -f ../external/gpc/gpc.c; then
	HAVE_GPC_C="yes"
  else
	HAVE_GPC_C="no"
  fi

  if test "$HAVE_GPC_H" = "yes" -a "$HAVE_GPC_C" = "yes"; then
	AC_MSG_RESULT([GPC files found])
  else
	AC_MSG_ERROR([GPC files not found
ftp://ftp.cs.man.ac.uk/pub/toby/gpc/gpc231.tar.Z and untar in external/gpc])
  fi
else
  WITH_GPC=NO
fi

dnl ===================================================================
dnl Test for the presence of Ant and that it works
dnl ===================================================================

ANT_HOME=; export ANT_HOME
if test -z "$with_ant_home"; then
   AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat])
else
   AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat],,$with_ant_home/bin)
fi


if test -z "$ANT"; then
  AC_MSG_WARN([Ant not found - Some Java projects will not build])
  echo "Ant not found - Some Java projects will not build" >>warn
else
  AC_MSG_CHECKING([if $ANT works])
cat > conftest.java << EOF
    public class conftest {
	int testmethod(int a, int b) {
            return a + b;
	}
    }
EOF

cat > conftest.xml << EOF
    <project name="conftest" default="conftest">
	<target name="conftest">
            <javac srcdir="." includes="conftest.java">
	    </javac>
	</target>
    </project>
EOF

  ant_cmd="$ANT -buildfile conftest.xml 1>&2"
  AC_TRY_EVAL(ant_cmd)
  if test $? = 0 && test -f ./conftest.class ; then
    AC_MSG_RESULT([Ant works]) 
    ANT_HOME=`echo $ANT | $SED -n "s/\/bin\/ant.*\$//p"`
  else
    echo "configure: Ant test failed" >&5
    cat conftest.java >&5
    cat conftest.xml >&5
    AC_MSG_WARN([Ant does not work - Some Java projects will not build!])
    echo "Ant does not work - Some Java projects will not build!" >>warn
  fi

  rm -f conftest* core core.* *.core
fi


dnl ===================================================================
dnl Setting up the environment.
dnl ===================================================================
echo "********************************************************************"
echo "*                                                                  *"
echo "*   Setting up the build environment variables.                    *"
echo "*                                                                  *"
echo "********************************************************************"

# Get UPD number from ../solenv/inc/minor.mk
upd=`grep RSCVERSION= ../solenv/inc/minor.mk | $AWK -F"=" '{ print $2 }'` 

if test -z "$COMPATH"; then
   AC_MSG_ERROR([No compiler found.])
fi
if test -z "$_gxx_include_path"; then
   _gxx_include_path="NO_GXX_INCLUDE"
fi
if test -z "$JAVA_HOME"; then
   AC_MSG_ERROR([No java found.])
fi
if test -z "$ANT_HOME"; then
   ANT_HOME="NO_ANT_HOME"
fi
if test -z "$TCSH"; then
   AC_MSG_ERROR([No tcsh found.])
fi
if test -z "$STLPORT4"; then 
   STLPORT4="NO_STLPORT4"
fi
if test -z "$PERL"; then
   AC_MSG_ERROR([No perl found.])
fi
if test -z "$x_libraries"; then
   x_libraries="no_x_libraries"
fi
if test -z "$x_includes"; then
   x_includes="no_x_includes"
fi
if test -z "$with_local_solenv"; then
   LOCAL_SOLENV="DEFAULT"
else
   LOCAL_SOLENV=$with_local_solenv
fi
if test -z "$with_local_solver"; then
   LOCAL_SOLVER="DEFAULT"
else
   LOCAL_SOLVER=$with_local_solver
fi
if test -z "$CYGWIN"; then
   CYGWIN="NO_CYGWIN"
fi
if test -z "$with_lang"; then
   with_lang=,ENUS,
else
   with_lang=","$with_lang","
fi
if test -z "$with_dict"; then
   with_dict=,ALL,
else
   with_dict=","$with_dict","
fi

if test -n "$enable_debug"; then
   ENABLE_DEBUG="TRUE"
else
   ENABLE_DEBUG="FALSE"
fi

if test -n "$enable_static_gtk"; then
   ENABLE_STATIC_GTK="TRUE"
else
   ENABLE_STATIC_GTK="FALSE"	
fi

dnl ===================================================================
dnl Bits to substitute into set_soenv.in
dnl ===================================================================
AC_SUBST(ANT_HOME)
AC_SUBST(COMPATH)
GXX_INCLUDE_PATH="$_gxx_include_path"
AC_SUBST(GXX_INCLUDE_PATH)
GCC_HOME="$with_gcc_home"
AC_SUBST(GCC_HOME)
AC_SUBST(GNUMAKE)
AC_SUBST(JAVA_HOME)
AC_SUBST(TCSH)
AC_SUBST(PERL)
XLIB="$x_libraries"
AC_SUBST(XLIB)
XINC="$x_includes"
AC_SUBST(XINC)
AC_SUBST(LOCAL_SOLENV)
AC_SUBST(LOCAL_SOLVER)
UPD="$upd"
AC_SUBST(UPD)
AC_SUBST(CYGWIN)
AC_SUBST(COMEX)
AC_SUBST(STLPORT4)
WITH_LANG="$with_lang"
AC_SUBST(WITH_LANG)
WITH_DICT="$with_dict"
AC_SUBST(WITH_DICT)
AC_SUBST(PSDK_HOME)
ASM_HOME="$with_asm_home"
AC_SUBST(ASM_HOME)
UNZIP_HOME="$with_unzip_home"
AC_SUBST(UNZIP_HOME)
AC_SUBST(WITH_MINGWIN)
USE_SHELL="$with_use_shell"
AC_SUBST(USE_SHELL)
EXCEPTIONS="$exceptions_type"
AC_SUBST(EXCEPTIONS)
OSVERSION="$with_os_version"
AC_SUBST(OSVERSION)
AC_SUBST(USE_GCC3)
AC_SUBST(PTHREAD_CFLAGS)
AC_SUBST(PTHREAD_LIBS)
AC_SUBST(ENABLE_DEBUG)
AC_SUBST(ENABLE_STATIC_GTK)
AC_SUBST(ENVCFLAGSCXX)
AC_SUBST(WITH_GPC)

AC_OUTPUT([set_soenv])

dnl Executing the set_soenv script to setup the environment variables.
chmod a+x set_soenv
if test -z "$enable_check_only"; then
   './set_soenv'
else
   echo
   echo Test Complete
   echo No environment file will be generated
   echo
   num_warnings=`wc -l warn`
   _num=`echo $num_warnings | $AWK '{ print $1 }'`
   if test $_num -gt 0; then
      echo The following warning\(s\) were generated by configure
      echo ----------------------------------------------------
      echo
      cat warn
      echo
   else
      echo There were no warnings
   fi
   echo
fi