File: configure.in

package info (click to toggle)
yap 5.1.1-3
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 16,124 kB
  • ctags: 14,650
  • sloc: ansic: 122,796; perl: 22,545; sh: 3,768; java: 1,277; makefile: 1,191; xml: 739; tcl: 624; lisp: 142; awk: 9
file content (1247 lines) | stat: -rw-r--r-- 29,923 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
dnl
dnl Process this file with autoconf to produce a configure script.
dnl

AC_PREREQ(2.13)

AC_INIT(console/yap.c)
AC_CONFIG_HEADER(config.h)

dnl store the environment's compilation flags
mycflags="$CFLAGS"

AC_PROG_CC
AC_SUBST(GCC)
AC_SUBST(C_INTERF_FLAGS)
AC_SUBST(C_PARSER_FLAGS)

AC_ARG_ENABLE(cut-c,
	[ --enable-cut-c             support for executing c code when a cut occurs ],
	cutc="$enableval", cutc=no)
AC_ARG_ENABLE(tabling,
	[ --enable-tabling           support tabling ],
	tabling="$enableval", tabling=no)
AC_ARG_ENABLE(or-parallelism,
	[ --enable-or-parallelism    support or-parallelism as: env-copy,sba,a-cow ],
	orparallelism="$enableval", orparallelism=no)
if test "$tabling" = yes -o "$orparallelism" = yes -o "$threads" = yes
then
AC_ARG_ENABLE(depth-limit,
	[ --enable-depth-limit       support depth-bound computation ],
	depthlimit="$enableval", depthlimit=no)
else
AC_ARG_ENABLE(rational-trees,
	[ --enable-rational-trees    support infinite rational trees ],
	rationaltrees="$enableval" , rationaltrees=yes)
AC_ARG_ENABLE(coroutining,
	[ --enable-coroutining       support co-routining, attributed variables and constraints],
	rationaltrees="$enableval";coroutining="$enableval", coroutining=yes)
AC_ARG_ENABLE(depth-limit,
	[ --enable-depth-limit       support depth-bound computation ],
	depthlimit="$enableval", depthlimit=yes)
fi
AC_ARG_ENABLE(wam-profile,
	[ --enable-wam-profile       support low level profiling of abstract machine ],
	wamprofile="$enableval", wamprofile=no)
AC_ARG_ENABLE(low-level-tracer,
	[ --enable-low-level-tracer  support support for procedure-call tracing ],
	lowleveltracer="$enableval", lowleveltracer=no)
AC_ARG_ENABLE(threads,
	[ --enable-threads           support system threads ],
	threads="$enableval", threads=no)
AC_ARG_ENABLE(pthread-locking,
	[ --pthread-locking           use pthread locking primitives for internal locking (requires threads)  ],
	pthreadlocking="$enableval", pthreadlocking=no)
AC_ARG_ENABLE(max-performance,
	[ --enable-max-performance   try using the best flags for specific architecture ],
	maxperformance="$enableval", maxperformance=no)
AC_ARG_ENABLE(max-memory,
	[ --enable-max-memory        try using the best flags for using the memory to the most ],
	maxmemory="$enableval", maxmemory=yes)
AC_ARG_ENABLE(debug-yap,
	[ --enable-debug-yap         enable C-debugging for YAP ],
	debugyap="$enableval", debugyap=no)
AC_ARG_ENABLE(eam,
	[ --enable-eam               enable EAM on YAP ],
	eam="$enableval", eam=no)
AC_ARG_ENABLE(cygwin,
	[ --enable-cygwin            use cygwin library in WIN32 ],
	cygwin="$enableval", cygwin=no)
AC_ARG_ENABLE(dynamic_loading,
	[ --enable-dynamic-loading   compile Yap as a DLL ],
	dynamic_loading="$enableval", dynamic_loading=no)
AC_ARG_ENABLE(use-malloc,
	[ --enable-use-malloc        use malloc to allocate memory ],
	use_malloc="$enableval", use_malloc=no)
AC_ARG_ENABLE(condor,
	[ --enable-condor            allow Yap to be used from condor ],
	use_condor="$enableval", use_condor=no)
	
AC_ARG_ENABLE(april,
	[ --enable-april             compile Yap to support April ILP system],
	use_april="$enableval", use_april=no)

AC_ARG_ENABLE(dlcompat,
	[ --enable-dlcompat          use dlcompat library for dynamic loading on Mac OS X],
	use_dlcompat="$enableval", use_dlcompat=no)
	
AC_ARG_WITH(gmp,
	[ --with-gmp[=DIR]           use GNU Multiple Precision in DIR],
	if test "$withval" = yes; then
		yap_cv_gmp=yes
	elif test "$withval" = no; then
		yap_cv_gmp=no
	else
		yap_cv_gmp=$with_gmp
		LDFLAGS="$LDFLAGS -L${yap_cv_gmp}/lib"
		CPPFLAGS="$CPPFLAGS -I${yap_cv_gmp}/include"
	fi,
	[yap_cv_gmp=yes])

AC_ARG_ENABLE(myddas,
	[ --enable-myddas         enable the MYDDAS library],
	if test "$enableval" = yes; then
		yap_cv_myddas=yes
	elif test "$enableval" = no; then
		yap_cv_myddas=no
	else
		yap_cv_myddas=$enable_myddas
		LDFLAGS="$LDFLAGS -L${yap_cv_myddas}/lib"
		CPPFLAGS="$CPPFLAGS -I${yap_cv_myddas}/include"
	fi,
	[yap_cv_myddas=no])

AC_ARG_ENABLE(myddas-stats,
	[ --enable-myddas-stats     enable the MYDDAS library statistics support],
	myddasstats="$enableval", myddasstats=no)

AC_ARG_ENABLE(myddas-top-level,
	[ --enable-myddas-top-level enable the MYDDAS top-level support to MySQL],
	myddastoplevel="$enableval", myddastoplevel=no)

AC_ARG_WITH(jpl,
	[ --with-jpl=JAVA_HOME       use Java instalation in JAVA_HOME],
	if test "$withval" = yes; then
		yap_cv_jpl="$JAVA_HOME"
		dynamic_loading=yes
		maxmemory=yes
dnl		threads=yes
	elif test "$withval" = no; then
		yap_cv_jpl=no
	else
		yap_cv_jpl=$with_jpl
		dynamic_loading=yes
		maxmemory=yes
dnl		threads=yes
	fi,
	[yap_cv_jpl=no])

AC_ARG_WITH(readline,
	[ --with-readline[=DIR]      use GNU Readline Library in DIR],
	if test "$withval" = yes; then
		yap_cv_readline=yes
	elif test "$withval" = no; then
		yap_cv_readline=no
	else
		yap_cv_readline=$with_readline
		LDFLAGS="$LDFLAGS -L${yap_cv_readline}/lib"
		CPPFLAGS="$CPPFLAGS -I${yap_cv_readline}/include"
	fi,
	[yap_cv_readline=yes])

AC_ARG_WITH(mpi,
	[ --with-mpi[=DIR]           use MPI library in DIR],
	if test "$withval" = yes; then
		yap_cv_mpi=yes
	elif test "$withval" = no; then
		yap_cv_mpi=no
	else
		yap_cv_mpi=$with_mpi
		LDFLAGS="$LDFLAGS -L${yap_cv_mpi}/lib"
		CPPFLAGS="$CPPFLAGS -I${yap_cv_mpi}/include"
	fi,
	[yap_cv_mpi=no])

AC_ARG_WITH(mpe,
	[ --with-mpe[=DIR]           use MPE library in DIR],
	if test "$withval" = yes; then
		yap_cv_mpe=yes
	elif test "$withval" = no; then
		yap_cv_mpe=no
	else
		yap_cv_mpe=$with_mpe
		LDFLAGS="$LDFLAGS -L${yap_cv_mpe}/lib"
		CPPFLAGS="$CPPFLAGS -I${yap_cv_mpe}/include"
	fi,
	[yap_cv_mpe=no])

AC_ARG_WITH(heap-space,
	[ --with-heap-space[=space]  default heap size in Kbytes],
	if test "$withval" = yes; then
		yap_cv_heap_space=0
	elif test "$withval" = no; then
		yap_cv_heap_space=0
	else
		yap_cv_heap_space=$withval
	fi,
	[yap_cv_heap_space=0])

AC_ARG_WITH(stack-space,
	[ --with-stack-space[=space] default stack size in Kbytes],
	if test "$withval" = yes; then
		yap_cv_stack_space=0
	elif test "$withval" = no; then
		yap_cv_stack_space=0
	else
		yap_cv_stack_space=$withval
	fi,
	[yap_cv_stack_space=0])

AC_ARG_WITH(trail-space,
	[ --with-trail-space[=space] default trail size in Kbytes],
	if test "$withval" = yes; then
		yap_cv_trail_space=0
	elif test "$withval" = no; then
		yap_cv_trail_space=0
	else
		yap_cv_trail_space=$withval
	fi,
	[yap_cv_trail_space=0])

if test "$tabling" = yes -o "$orparallelism" = yes -o "$threads" = yes
then
  AC_DEFINE(MinHeapSpace, (400*SIZEOF_INT_P))
  AC_DEFINE(MinStackSpace,(300*SIZEOF_INT_P))
  AC_DEFINE(MinTrailSpace,( 48*SIZEOF_INT_P))
else
	AC_DEFINE(MinHeapSpace, (200*SIZEOF_INT_P))
	AC_DEFINE(MinStackSpace,(200*SIZEOF_INT_P))
	AC_DEFINE(MinTrailSpace,( 32*SIZEOF_INT_P))
fi

eval "AC_DEFINE(DefHeapSpace,($yap_cv_heap_space))"
eval "AC_DEFINE(DefStackSpace,($yap_cv_stack_space))"
eval "AC_DEFINE(DefTrailSpace,($yap_cv_trail_space))"

AC_CANONICAL_SYSTEM

AC_DEFINE_UNQUOTED(HOST_ALIAS,"${host}")

dnl condor does not like dynamic linking on Linux, DEC, and HP-UX platforms.
if test "$use_condor" = yes 
then
  use_malloc="yes"
  CC="condor_compile $CC"
  dnl no readline with condor.
  yap_cv_readline="no"
  AC_DEFINE(SUPPORT_CONDOR, 1)
fi

dnl Compilation Flags
if test "$GCC" = "yes"
then
   if test -z "${mycflags}"
   then
     if test "$debugyap" = "yes" 
     then
       CFLAGS="-O -g -Wall -Wstrict-prototypes -Wmissing-prototypes"
       C_INTERF_FLAGS="-O -g -Wall -Wstrict-prototypes -Wmissing-prototypes"
     else
       CFLAGS="-O3 -fomit-frame-pointer -Wall -Wstrict-prototypes -Wmissing-prototypes"
       case "`$CC --version < /dev/null`" in	
	  *3.4*) CFLAGS="-fno-gcse -fno-crossjumping $CFLAGS" ;;
       esac
       C_INTERF_FLAGS="-O3 -Wall -Wstrict-prototypes -Wmissing-prototypes"
       C_PARSER_FLAGS="-O3 -Wall -Wstrict-prototypes -Wmissing-prototypes"
       case "$target_cpu" in
        i*86*)
           CFLAGS="-DBP_FREE $CFLAGS"
        ;;
        sparc*)
	  case "$target_os" in
           *solaris[2-9]*)
             CFLAGS="-mno-app-regs -DOPTIMISE_ALL_REGS_FOR_SPARC=1 $CFLAGS"
            ;;
          esac
        ;;
       esac
       if test "$tcpu"; then
          target_cpu=$tcpu
       fi
       if test "$maxperformance" = "yes"
       then
         case "$target_cpu" in
	  athlon)
           CFLAGS="-march=athlon $CFLAGS"
	  ;;
          i686*)
           CFLAGS="-march=i686 $CFLAGS"
          ;;
          i586*)
           CFLAGS="-march=i586 $CFLAGS"
          ;;
          i486*)
           CFLAGS="-march=i486 $CFLAGS"
          ;;
          i386*)
           CFLAGS="-march=i386 $CFLAGS"
          ;;
         esac
       fi
     fi
   fi
   if test "$CC" = "sslittle-na-sstrix-gcc"
   then
    RANLIB="sslittle-na-sstrix-ranlib"
    AR="sslittle-na-sstrix-ar"
    CROSS_SIMULATOR="sim-fast"
   fi
else
   if test -z "${mycflags}"
   then
     case "$target_cpu" in
       i?86*)
        if test "$CC" = "lcc"
        then
          CFLAGS="-A -A"
        elif test "$CC" = "cl"
        then
          CFLAGS="/nologo"
          CPP="/nologo /E"
        fi
        ;;
       hppa*)
        if test "$CC" = "cc" -o $CC = c89
         then
           if test "$debugyap" = "yes"
           then
             CFLAGS="-Ae -g -O"
           else
             CFLAGS="-Ae +O3 +Onolimit"
           fi
        fi
dnl	LDFLAGS="+e UserCPredicate $LDFLAGS"
        ;;
     esac
   fi
   C_INTERF_FLAGS="$CFLAGS"
   C_PARSER_FLAGS="$CFLAGS"
fi

dnl Checks for programs.
AC_PROG_LN_S
AC_PROG_INSTALL
AC_PROG_RANLIB
AC_CHECK_TOOL(INDENT,indent,:)
AC_CHECK_TOOL(AR,ar,:)
AC_CHECK_TOOL(MPI_CC,mpicc,:)
AC_PATH_PROG(INSTALL_INFO,install-info,true,$PATH:/sbin:/usr/sbin:/usr/etc:/usr/local/sbin)
AC_PATH_PROG(SHELL,sh)

dnl Check for libraries.
dnl mingw does not get along well with libm
dnl cygnus and mingw32 also need wsock32 to use sockets.
dnl
if test "$target_os" = "cygwin"
then
  INSTALL_COMMAND=install_win32
  if test "$cygwin" = "no"
  then
    CC="gcc  -mno-cygwin"
    AC_CHECK_LIB(wsock32,main)
    yap_cv_readline=no
    if test "$prefix" = "NONE"
    then
      prefix="c:/Yap"
    fi
  else
    use_malloc="yes"
    LIBS="-lcygwin"
   fi
elif test "$target_os" = "mingw32" 
then
  yap_cv_readline=no
  INSTALL_COMMAND=install_win32
  AC_CHECK_LIB(wsock32,main)
  if test "$prefix" = "NONE"
  then
    prefix="c:/Yap"
  fi
else
  INSTALL_COMMAND="install_unix"
  AC_CHECK_LIB(m,sin)
  AC_CHECK_LIB(socket,socket)
  dnl X/Open Networking is sometimes a separate library
  AC_CHECK_LIB(xnet,getsockname)
  AC_CHECK_LIB(nsl,main,
	have_nsl=yes
	,
	have_nsl=no)
fi

if test "$yap_cv_readline" != "no"
then
  AC_CHECK_LIB(termcap,tgetent)
  AC_CHECK_LIB(ncurses,main)
  AC_CHECK_LIB(readline,readline)
fi
if test "$yap_cv_gmp" != "no"
then
  AC_CHECK_LIB(gmp,main)
fi

if test "$yap_cv_myddas" != "no"
then
	dnl check for mysql
	AC_MSG_CHECKING(for main in -lmysqlclient)
	AC_CACHE_VAL(yap_mysql,[
	AC_TRY_COMPILE(
		#include <mysql/mysql.h>
		#include <stdio.h>
		,
		MYSQL *conn;
		conn = mysql_init(NULL);	
		,
		yap_mysql=yes,yap_mysql=no)])
	AC_MSG_RESULT($yap_mysql)
	if test "$yap_mysql" = yes 
	then
		YAP_EXTRAS="$YAP_EXTRAS -DMYDDAS_MYSQL"
		LIBS="$LIBS -L/usr/lib/mysql -lmysqlclient -lz -lcrypt -lnsl -lm -lc -lnss_files -lnss_dns -lresolv "
	fi
	
	dnl check for odbc
	AC_MSG_CHECKING(for main in -lodbc)
	AC_CACHE_VAL(yap_odbc,[
	AC_TRY_COMPILE(
		#include <sql.h>
		#include <sqlucode.h>
		#include <stdio.h>
		,
		SQLHENV henv;
  		SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &henv);
		,
		yap_odbc=yes,yap_odbc=no)])
	AC_MSG_RESULT($yap_odbc)
	if test "$yap_odbc" = yes 
	then
		YAP_EXTRAS="$YAP_EXTRAS -DMYDDAS_ODBC"
		LIBS="$LIBS -lodbc "
	fi
	
	if test "$yap_mysql" = no -a "$yap_odbc" = no
	then
		echo "-------------------------------"
	    	echo "--"
	    	echo "--"
	    	echo "--"
	    	echo "-- There\'s no devel libraries for MySQL or ODBC"
	    	echo "--"
	    	echo "--"
	    	echo "--"
	    	echo "-------------------------------"
	    	exit
	fi

	if test "$cutc" = no
	then
		echo
		echo
		echo "********************************************************"
		echo
		echo
		echo "!!!!!! WARNING !!!!!!"
		echo "The MYDDAS interface makes no sense without cut-c"
		echo "Please contact tiagosoares@ncc.up.pt for help"
		echo 
		echo "Enabling cut-c"
		echo
		echo "********************************************************"
		echo
		echo
		cutc="yes"
	fi
fi	

if test "$myddasstats" = "yes"
  then
  YAP_EXTRAS="$YAP_EXTRAS -DMYDDAS_STATS"
fi

if test "$myddastoplevel" = "yes"
  then
  YAP_EXTRAS="$YAP_EXTRAS -DMYDDAS_TOP_LEVEL"
fi

if test "$threads" = yes
then
  AC_DEFINE(SUPPORT_THREADS, 1)
  AC_CHECK_LIB(pthread,pthread_create)
  AC_CHECK_HEADERS(pthread.h)	
  AC_CHECK_FUNCS(pthread_mutexattr_setkind_np pthread_mutexattr_settype)
  if test "$pthreadlocking" = yes
  then
    AC_DEFINE(USE_PTHREAD_LOCKING, 1)
  fi
  use_malloc=yes
fi

if test "$yap_cv_jpl" = no
then
	ENABLE_JPL="@#"   
else
	ENABLE_JPL=""
	JAVA_HOME="$yap_cv_jpl"
	JAVAC="$yap_cv_jpl"/bin/javac
	JAR="$yap_cv_jpl"/bin/jar
fi

MPI_OBJS=
if test "$yap_cv_mpi" != "no"
then
  OLD_CC=${CC}
  CC=${MPI_CC}
  AC_CHECK_LIB(mpi,MPI_Init,
		[AC_DEFINE(HAVE_LIBMPI, 1)],
		[AC_DEFINE(HAVE_LIBMPI, 0)])
  if test "$ac_cv_lib_mpi_MPI_Init" = yes
  then
	#YAPMPILIB=YapMPI.a
	MPI_OBJS=mpi.o
  else
    AC_CHECK_LIB(mpich,MPI_Init,
		[AC_DEFINE(HAVE_LIBMPICH, 1)],
		[AC_DEFINE(HAVE_LIBMPICH, 0)])
    if test "$ac_cv_lib_mpich_MPI_Init" = yes
    then
	#YAPMPILIB=YapMPI.a
	MPI_OBJS=mpi.o
    else
	#YAPMPILIB=
	MPI_CC=${CC}
    fi
  fi
  CC=${OLD_CC}
else
  MPI_CC=${CC}
fi

MPI_LIBS=
if test "$yap_cv_mpi" != "no" -a "$yap_cv_mpe" != "no"
then
  OLD_CC=${CC}
  CC=${MPI_CC}
  AC_CHECK_LIB(mpe,MPE_Init_log,
		[AC_DEFINE(HAVE_LIBMPE, 1)],
		[AC_DEFINE(HAVE_LIBMPE, 0)])
  if test "$ac_cv_lib_mpe_MPE_Init_log" = yes
  then
	MPI_LIBS="-lmpe"
	MPI_OBJS="$MPI_OBJS mpe.o"
  fi
  CC=${OLD_CC}
fi

AC_PROG_CPP

if test "$cross_compiling" = "yes"
then
  YAP_EXTRAS=
else
  AC_SYS_RESTARTABLE_SYSCALLS
fi


dnl defaults
INSTALL_DLLS="#"
EXTRA_OBJS=""
SHLIB_LD="@#"
DO_SECOND_LD="#"
M4="m4"
MERGE_DLL_OBJS="#"
IN_UNIX=""

dnl This has to be before $target_os
YAPLIB="libYap.a"

case "$target_os" in
      *linux*)
        if test "$use_condor" = "no"
        then
	  AC_CHECK_LIB(dl,dlopen,
	     have_dl=yes
	   ,
	     have_dl=no)
          if test "$have_dl" = "yes"
	  then
	    SHLIB_SUFFIX=".so"
            SHLIB_LD="ld -shared -export-dynamic"
            DO_SECOND_LD=""
	    LIBS="$LIBS -ldl"
	    case "$host_cpu" in
	      alpha*)
	        LDFLAGS="-dynamic $LDFLAGS"
              ;;
              *)
	        if test "$CC" != "lcc"
                then
	          LDFLAGS="-rdynamic $LDFLAGS"
                fi
              ;;
            esac
          fi
	  if test "$ac_cv_prog_gcc" = "yes"
	  then
	   SHLIB_CFLAGS="-shared -fPIC"
	   INSTALL_DLLS=""
          fi
        fi
        if test "$have_nsl" = yes
	 then
	 LIBS="$LIBS -lnsl"
        fi
	;;
      *sunos4*)
	M4="/usr/5bin/m4"
	LDFLAGS="$LDFLAGS -N"
        if test "$have_nsl" = yes
	 then
	 LIBS="$LIBS -lnsl"
        fi
        SHLIB_SUFFIX=".o"
	INSTALL_DLLS=""
	;;
      *hpux*)
	#do not use the first memory quadrant
	AC_DEFINE(FORCE_SECOND_QUADRANT)
	M4="/usr/bin/m4"
	if test ${use_condor} = no
        then
	  SHLIB_INTERFACE="load_shl.o"
	  if test "$CC" = cc -o "$CC" = c89
	  then
	    #this tells ld to export all non-static symbols,
	    #otherwise no external predicates.
	    SHLIB_LD="ld -b -E ${LDFLAGS}"
            DO_SECOND_LD=""
            SHLIB_SUFFIX=".sl"
	    SHLIB_CFLAGS="+z"
	    INSTALL_DLLS=""
	    # If the xnet library was found, turn on X/Open networking
	    if test "$ac_cv_lib_xnet_getsockname" = yes
	    then
	     AC_DEFINE(_XOPEN_SOURCE)
	     AC_DEFINE(_XOPEN_SOURCE_EXTENDED,1)
	    fi
	  else
	    INSTALL_DLLS="#"
          fi
        fi
	#do not use realloc() from HP-UX 10.20 together with MPI
	if test ${target_os} = hpux10.20
	then
	  AC_DEFINE(MPI_AVOID_REALLOC,1)
	fi
	;;
      *aix*)
	# To actually use dlls in AIX I'd need to build YAP as a DLL first.
	# I won't bother for now.
	#
        # SHLIB_SUFFIX=".a"
        #SHLIB_LD="\$(srcdir)/../../ldAix /bin/ld -bhalt:4 -bM:SRE -bE:lib.exp -H512 -T512 -bnoentry"
	#INSTALL_DLLS=""
	;;
      *osf*)
        if ${use_condor} = no
        then
	  AC_CHECK_LIB(dl,dlopen,
dnl Linux has both elf and a.out, in this case we found elf
	     have_dl=yes
	   ,
	     have_dl=no)
          SHLIB_SUFFIX=".so"
          SHLIB_LD="ld -shared -expect_unresolved '*'"
          DO_SECOND_LD=""
        fi
	;;
      *irix6*)
	SHLIB_CFLAGS=""
	SHLIB_SUFFIX=".so"
        DO_SECOND_LD=""
	SHLIB_LD="ld -n32 -shared -rdata_shared"
	INSTALL_DLLS=""
	;;
      *darwin*)
	if test ${use_dlcompat} = yes
	then
	  AC_CHECK_LIB(dl,dlopen,
	     have_dl=yes
	   ,
	     have_dl=no)
	  if test ${have_dl} = yes
	  then
	    LIBS="$LIBS -ldl"	  
	  fi
	fi
	SHLIB_CFLAGS="-fno-common"
	SHLIB_SUFFIX=".so"
        DO_SECOND_LD=""
	SHLIB_LD="cc -bundle -flat_namespace -undefined suppress"
	INSTALL_DLLS=""
        CC="cc -no-cpp-precomp"
	;;
      *netbsd*|*freebsd*)
	if echo __ELF__ | ${CC:-cc} -E - | grep -q __ELF__
        then
	  #an a.out system 	
	  SHLIB_CFLAGS=""
	  SHLIB_SUFFIX=".o"
        else
	  #an elf system
	  LDFLAGS="-Wl,--export-dynamic $LDFLAGS"
	  SHLIB_CFLAGS="-fPIC"
	  SHLIB_LD="ld -Bshareable -x"
          DO_SECOND_LD=""
	  SHLIB_SUFFIX=".so"
	  INSTALL_DLLS=""
        fi
	;;
      *cyg*|*mingw*)
	# gcc on cygwin seems to have trouble with longjmp
        # and -fomit-frame-point -DBP_FREE
	YAPLIB="libWYap.a"
	SHLIB_CFLAGS=""
        SHLIB_LD="\$(CC) -shared ../../yap.dll"
	SHLIB_SUFFIX=".dll"
	C_PARSER_FLAGS="$C_INTERF_FLAGS"
	EXEC_SUFFIX=".exe"
	INSTALL_DLLS=""
	DO_SECOND_LD=""
	MERGE_DLL_OBJS=""
	IN_UNIX="#"
	;;
      *)
	AC_CHECK_LIB(dl,dlopen,
	   have_dl=yes
	 ,
	   have_dl=no)
        if test "$have_dl" = yes
	 then
         SHLIB_SUFFIX=".o"
	 LIBS="$LIBS -ldl"
	 INSTALL_DLLS=""
	 if test "$CC" = gcc
	 then
	   SHLIB_CFLAGS="-fPIC"
	 fi
        fi
        if test "$have_nsl" = yes
	 then
	 LIBS="$LIBS -lnsl"
        fi
	;;
esac

if test "$dynamic_loading" = "yes"
then 
  YAP_EXTRAS="$SHLIB_CFLAGS $YAP_EXTRAS"
  YAPLIB=libYap"$SHLIB_SUFFIX"
  CROSS_SIMULATOR="LD_LIBRARY_PATH=."
  LDFLAGS="$LDFLAGS -Wl,-R,$prefix/lib"
fi

if test "$coroutining" = "yes"
  then
  YAP_EXTRAS="$YAP_EXTRAS -DCOROUTINING=1"
fi
  
if test "$rationaltrees" = "yes"
  then
  YAP_EXTRAS="$YAP_EXTRAS -DRATIONAL_TREES=1"
fi

if test "$rationaltrees" = "yes" -a "$coroutining" = "yes"
  then
  INSTALLCLP=""
  else
  INSTALLCLP="#"
fi
  
if test "$debugyap" = "yes"
  then
  YAP_EXTRAS="$YAP_EXTRAS -DDEBUG=1"
fi

if test "$eam" = "yes"
  then
  YAP_EXTRAS="$YAP_EXTRAS -DBEAM"
fi
  
if test "$wamprofile" = "yes"
  then
  YAP_EXTRAS="$YAP_EXTRAS -DANALYST=1"
fi
  
if test "$depthlimit" = "yes"
  then
  YAP_EXTRAS="$YAP_EXTRAS -DDEPTH_LIMIT=1"
fi
  
if test "$use_april" = "yes"
  then	
   YAP_EXTRAS="$YAP_EXTRAS -DDEPTH_LIMIT=1 -DAPRIL"
   LDFLAGS="$LDFLAGS -L."
   LIBS="$LIBS -lApril"
fi
  
if test "$lowleveltracer" = "yes"
  then
  YAP_EXTRAS="$YAP_EXTRAS -DLOW_LEVEL_TRACER=1"
fi
  
if test "$threads" = "yes"
  then
  YAP_EXTRAS="$YAP_EXTRAS -DTHREADS=1"
  if test "$GCC" = "yes"
  then
    YAP_EXTRAS="$YAP_EXTRAS -D_GNU_SOURCE"
  fi
fi
  
case "$orparallelism" in
  sba)
   YAP_EXTRAS="$YAP_EXTRAS -DSBA=1"
  ;;
  a-cow)
   YAP_EXTRAS="$YAP_EXTRAS -DACOW=1"
  ;;
  yes|env-copy)
   YAP_EXTRAS="$YAP_EXTRAS -DENV_COPY=1"
  ;;
esac

if test "$cutc" = "yes"
  then
  YAP_EXTRAS="$YAP_EXTRAS -DCUT_C=1"
fi

if test "$tabling" = "yes"
  then
  YAP_EXTRAS="$YAP_EXTRAS -DTABLING=1"
fi

dnl Checks for header files.
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS(arpa/inet.h ctype.h direct.h dirent.h dlfcn.h)
AC_CHECK_HEADERS(errno.h fcntl.h)
AC_CHECK_HEADERS(fenv.h fpu_control.h ieeefp.h io.h limits.h)
AC_CHECK_HEADERS(malloc.h math.h memory.h)
AC_CHECK_HEADERS(netdb.h netinet/in.h regex.h)
AC_CHECK_HEADERS(siginfo.h signal.h stdarg.h string.h stropts.h)
AC_CHECK_HEADERS(sys/conf.h sys/file.h)
AC_CHECK_HEADERS(sys/mman.h sys/param.h sys/resource.h sys/select.h)
AC_CHECK_HEADERS(sys/shm.h sys/socket.h sys/stat.h)
AC_CHECK_HEADERS(sys/time.h sys/times.h sys/types.h)
AC_CHECK_HEADERS(sys/ucontext.h sys/un.h)
AC_CHECK_HEADERS(time.h unistd.h winsock.h winsock2.h)
AC_CHECK_HEADERS(mach-o/dyld.h)
if test "$yap_cv_gmp" != "no"
then
  AC_CHECK_HEADERS(gmp.h)
fi
if test "$yap_cv_myddas" != "no"
then
  AC_CHECK_HEADERS(mysql/mysql.h)
fi
if test "$yap_cv_readline" != "no"
then
  AC_CHECK_HEADERS( readline/readline.h)
fi
if test "$yap_cv_mpi" != "no"
then
  AC_CHECK_HEADERS(mpi.h)
fi
if test "$yap_cv_mpe" != "no"
then
  AC_CHECK_HEADERS(mpe.h)
fi

dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_INLINE
AC_STRUCT_TM
AC_CHECK_SIZEOF(int *,4)
AC_CHECK_SIZEOF(short int,2)
AC_CHECK_SIZEOF(int,4)
AC_CHECK_SIZEOF(long int,4)
AC_CHECK_SIZEOF(long long int,8)
AC_CHECK_SIZEOF(float,4)
AC_CHECK_SIZEOF(double,8)

dnl check type of malloc (i.e. char *  or void *)
AC_MSG_CHECKING(for type of malloc)
AC_CACHE_VAL(yap_cv_malloct,[
AC_TRY_RUN(
	#include <stdlib.h>
	char *malloc(size_t);
	int main() {
	   void *p=malloc(1);
	   return 0;
	}
	,
	yap_cv_malloct=char,yap_cv_malloct=void,yap_cv_malloct=void)])
AC_MSG_RESULT($yap_cv_malloct *)
if test "$yap_cv_malloct" = void
then AC_DEFINE(MALLOC_T,void *)
else AC_DEFINE(MALLOC_T,char *)
fi


dnl check how to generate headers (i.e. should we use GCC inline?)
AC_MSG_CHECKING(for gcc inline)
AC_CACHE_VAL(yap_cv_gcc,[
AC_TRY_RUN(
	#undef inline
	inline int f(int x) {return x+1;}
	int main() { return 0;}
	,
	yap_cv_gcc=yes,yap_cv_gcc=no,yap_cv_gcc=yes)])
AC_MSG_RESULT($yap_cv_gcc)
if test "$yap_cv_gcc" = yes 
then
M4GENHDRS=m4/gcc_genhdrs.m4
AC_DEFINE(HAVE_GCC,1)
else
M4GENHDRS=m4/cc_genhdrs.m4
AC_DEFINE(HAVE_GCC,0)
fi
AC_SUBST(M4)
AC_SUBST(M4GENHDRS)

dnl System stuff for dynamic linking.
dnl
dnl Exports:
dnl
dnl "" if we can do dynamic linking, "#" otherwise
AC_SUBST(INSTALL_DLLS)
dnl if we need to merge several .o files into a single dll.
AC_SUBST(MERGE_DLL_OBJS)
dnl C-flags used to compile a file that will be loaded dynamically
AC_SUBST(SHLIB_CFLAGS)
dnl suffix for loadable binary (.so,.dll,.o)
AC_SUBST(SHLIB_SUFFIX)
dnl suffix for executable (.exe)
EXEC_SUFFIX=""
AC_SUBST(EXEC_SUFFIX)
dnl how to call the loader
AC_SUBST(DO_SECOND_LD)
AC_SUBST(SHLIB_LD)
dnl objects in YAP library
AC_SUBST(YAPLIB)
dnl install_info
AC_SUBST(INSTALL_INFO)
dnl let YAP_EXTRAS fall through configure, from the env into Makefile
AC_SUBST(YAP_EXTRAS)
AC_SUBST(NO_BUILTIN_REGEXP)
AC_SUBST(ENABLE_JPL)
AC_SUBST(JAVA_HOME)
AC_SUBST(JAVAC)
AC_SUBST(JAR)
AC_SUBST(IN_UNIX)
AC_SUBST(YAPMPILIB)
AC_SUBST(MPI_OBJS)
AC_SUBST(MPI_LIBS)
AC_SUBST(INSTALL_COMMAND)
AC_SUBST(CROSS_SIMULATOR)
AC_SUBST(INSTALLCLP)


dnl check for threaded code
AC_MSG_CHECKING(for gcc threaded code)
AC_CACHE_VAL(yap_cv_threaded_code,[
AC_TRY_RUN(
	int main() {
	void *t = &&l2;
	l1: goto *t;
	l2: return 0;
}
	,
	yap_cv_threaded_code=yes,yap_cv_threaded_code=no,yap_cv_threaded_code=yes)])
AC_MSG_RESULT($yap_cv_threaded_code)
if test "$yap_cv_threaded_code" = yes && test "$yap_cv_gcc" = yes
then
	AC_DEFINE(USE_THREADED_CODE,1)
	M4GENABSMI=gen_gcc.m4
else	
	AC_DEFINE(USE_THREADED_CODE,0)
	M4GENABSMI=gen_ansi.m4
fi

AC_SUBST(M4GENABSMI)


dnl check for IEEE floats
AC_MSG_CHECKING(for IEEE floats)
AC_CACHE_VAL(yap_cv_ffieee,[
AC_TRY_RUN(
	int main() {
	  union { float f; int i} a;
	  a.f = 1;
	  if (a.i==0x3f800000) return 0;
	  return 1;
	}
	,
	yap_cv_ffieee=yes,yap_cv_ffieee=no,yap_cv_ffieee=yes)])
AC_MSG_RESULT($yap_cv_ffieee)
if test "$yap_cv_ffieee" = yes 
then
AC_DEFINE(FFIEEE,1)
else
AC_DEFINE(FFIEEE,0)
fi

dnl check for sigsetjmp
AC_MSG_CHECKING(for sigsetjmp)
AC_CACHE_VAL(yap_sigsetjmp,[
AC_TRY_COMPILE(
	#include <setjmp.h>
	,
	sigjmp_buf         RestartEnv;

	siglongjmp (RestartEnv, 1);
	,
	yap_sigsetjmp=yes,yap_sigsetjmp=no)])
AC_MSG_RESULT($yap_sigsetjmp)
if test "$yap_sigsetjmp" = yes 
then
AC_DEFINE(HAVE_SIGSETJMP,1)
else
AC_DEFINE(HAVE_SIGSETJMP,0)
fi

dnl check for sigsegv
AC_MSG_CHECKING(for sigsegv)
AC_CACHE_VAL(yap_sigsegv,[
AC_TRY_COMPILE(
	#include <signal.h>
	#include <stdio.h>
	,
	printf("Signal value is %d\n", SIGSEGV);
	,
	yap_sigsegv=yes,yap_sigsegv=no)])
AC_MSG_RESULT($yap_sigsegv)
if test "$yap_sigsegv" = yes 
then
AC_DEFINE(HAVE_SIGSEGV,1)
else
AC_DEFINE(HAVE_SIGSEGV,0)
fi

dnl check for sigsegv
AC_MSG_CHECKING(for sigprof)
AC_CACHE_VAL(yap_sigprof,[
AC_TRY_COMPILE(
	#include <signal.h>
	#include <stdio.h>
	,
	printf("Signal value is %d\n", SIGPROF);
	,
	yap_sigprof=yes,yap_sigprof=no)])
AC_MSG_RESULT($yap_sigprof)
if test "$yap_sigsegv" = yes 
then
AC_DEFINE(HAVE_SIGPROF,1)
else
AC_DEFINE(HAVE_SIGPROF,0)
fi

dnl check for siginfo
AC_MSG_CHECKING(for siginfo)
AC_CACHE_VAL(yap_siginfo,[
AC_TRY_COMPILE(
	#include <signal.h>
	#include <stdio.h>
	,
	printf("SIGINFO value is %d\n", SA_SIGINFO);
	,
	yap_siginfo=yes,yap_siginfo=no)])
AC_MSG_RESULT($yap_siginfo)
if test "$yap_siginfo" = yes 
then
AC_DEFINE(HAVE_SIGINFO,1)
else
AC_DEFINE(HAVE_SIGINFO,0)
fi

dnl this is copied from the Tcl code
dnl this code checks whether the system defines an union wait
AC_MSG_CHECKING([union wait])
AC_TRY_LINK([#include <sys/types.h> 
#include <sys/wait.h>], [
union wait x;
wait(&x);		/* make sure we can compile wait */
WIFEXITED(x);		/* Generates compiler error if WIFEXITED
			 * uses an int. */
], union_wait_ok=yes, union_wait_ok=no)
AC_MSG_RESULT($union_wait_ok)
if test "$union_wait_ok" = no; then
    AC_DEFINE(NO_UNION_WAIT)
fi

dnl check whether the system supports the environ variable
AC_MSG_CHECKING([environ])
AC_TRY_LINK([], [
extern char **environ;
], environ_ok=yes, environ_ok=no)
AC_MSG_RESULT($environ_ok)
if test "$environ_ok" = yes; then
    AC_DEFINE(HAVE_ENVIRON)
fi

dnl Checks for library functions.
AC_TYPE_SIGNAL
AC_CHECK_FUNCS(acosh asinh atanh chdir ctime dlopen dup2)
AC_CHECK_FUNCS(fesettrapenable fgetpos finite getcwd getenv)
AC_CHECK_FUNCS(gethostbyname gethostid gethostname)
AC_CHECK_FUNCS(gethrtime getpwnam getrusage gettimeofday getwd)
AC_CHECK_FUNCS(isatty isnan kill labs link lgamma)
AC_CHECK_FUNCS(localtime lstat)
AC_CHECK_FUNCS(memcpy memmove mkstemp mktemp mktime opendir)
AC_CHECK_FUNCS(putenv rand random readlink regexec)
AC_CHECK_FUNCS(rename rint rl_set_prompt sbrk select)
AC_CHECK_FUNCS(setbuf setlinebuf sigaction siggetmask siginterrupt)
AC_CHECK_FUNCS(signal sigprocmask socket stat)
AC_CHECK_FUNCS(strchr strerror strncat strncpy strtod)
AC_CHECK_FUNCS(time times tmpnam usleep vsnprintf)

AC_CHECK_FUNC(regexec, [NO_BUILTIN_REGEXP="#"], [NO_BUILTIN_REGEXP=""])

AC_CHECK_FUNCS(NSLinkModule)

if test "$use_condor" = "no"
then
  AC_CHECK_FUNCS(alarm mmap popen shmat sleep system ttyname waitpid)
fi

if test "$target_os" != "mingw32" 
then
  AC_CHECK_FUNCS(fetestexcept snprintf)
fi

dnl check for mpz_xor
AC_MSG_CHECKING(for mpz_xor)
AC_CACHE_VAL(yap_mpz_xor,[
AC_TRY_LINK(
	#include <gmp.h>
	void check(mpz_t rop,mpz_t op1,mpz_t op2) {
	  mpz_xor(rop,op1,op2);
	}
	,
	,
	yap_mpz_xor=yes,yap_mpz_xor=no)])
AC_MSG_RESULT($yap_mpz_xor)
if test "$yap_mpz_xor" = yes 
then
AC_DEFINE(HAVE_MPZ_XOR,1)
else
AC_DEFINE(HAVE_MPZ_XOR,0)
fi

if test "$use_malloc" = "yes" -a "$maxmemory" = "yes" 
then
  maxmemory="no"
fi

dnl On some systems doing a fflush(NULL) to flush all output streams
dnl has the side-effect of makeing all charactes waiting in input
dnl pipes disapear.
AC_CACHE_CHECK(
[if fflush(NULL) clobbers input pipes],
[yap_cv_broken_fflush_null],
[ cat >conftest.$ac_ext <<EOF
  #include <stdio.h>
  #include <stdlib.h>
  int main(int argc, char **argv)
  {
      char *buf;
      int i;
      char *bp;
      bp = buf = malloc(1024);
      while (1) {
          while ((i = getc(stdin)) != -1
                 && (*bp++ = i) != '\n'
                 && (bp - buf < 1024) )
    	  /* DO NOTHING */ ;
          *bp = '\0';
          fprintf(stdout, "%s", buf);
          fflush(NULL);
          if( i == EOF ) return 0;
          bp = buf;
      }
  }
EOF
  AC_TRY_EVAL(ac_link)
  if test "$?" = 0
  then
    cat conftest.$ac_ext | ./conftest$ac_exeext > conftest.out
    AC_TRY_COMMAND(cmp conftest.$ac_ext conftest.out)
    if test "$?" = 0
    then
      AC_MSG_RESULT(no)
      yap_cv_broken_fflush_null=no
    else
      AC_MSG_RESULT(yes)
      yap_cv_broken_fflush_null=yes
    fi
  else
    dnl This should never happen
    AC_MSG_RESULT(failed)
    yap_cv_broken_fflush_null=failed
  fi
  rm -f conftest.$ac_ext conftest.$ac_objext conftest$ac_exeext conftest.out ])
if test "$yap_cv_broken_fflush_null" = no
then
  AC_DEFINE(BROKEN_FFLUSH_NULL,0)
else
  dnl be conservative: if the test failed, assume fflush(NULL) is
  dnl not working properly
  AC_DEFINE(BROKEN_FFLUSH_NULL,1)
fi

dnl disable smart memory management
if test "$use_malloc" = yes 
then
AC_DEFINE(USE_SYSTEM_MALLOC,1)
AC_DEFINE(GC_NO_TAGS,1)
fi

dnl large memory configuration, don't trust Yap allocation routines
if test "$maxmemory" = yes
then
AC_DEFINE(GC_NO_TAGS,1)
AC_DEFINE(USE_DL_MALLOC,1)
fi

mkdir -p  library/mpi
mkdir -p  library/random
mkdir -p  library/regex
mkdir -p  library/system
mkdir -p  library/Tries
mkdir -p  library/yap2swi
mkdir -p  CHR
mkdir -p  CLPQR
mkdir -p  CLPBN
mkdir -p  LGPL
mkdir -p  LGPL/JPL
mkdir -p  LGPL/JPL/java
mkdir -p  LGPL/JPL/java/jpl
mkdir -p  LGPL/JPL/java/jpl/fli
mkdir -p  LGPL/JPL/src
mkdir -p  LGPL/clp
mkdir -p  LGPL/clpr
mkdir -p  LGPL/chr

AC_OUTPUT(Makefile library/regex/Makefile library/system/Makefile library/random/Makefile library/yap2swi/Makefile library/mpi/Makefile .depend library/Makefile LGPL/chr/Makefile LGPL/chr/chr_swi_bootstrap.yap CLPBN/Makefile LGPL/clp/Makefile LGPL/clpr/Makefile library/Tries/Makefile LGPL/JPL/Makefile LGPL/JPL/src/Makefile LGPL/JPL/java/Makefile  LGPL/JPL/jpl_paths.yap)

make depend