-
Notifications
You must be signed in to change notification settings - Fork 17
/
configure.in
executable file
·2116 lines (1899 loc) · 59.3 KB
/
configure.in
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
dnl
dnl Process this file with autoconf to produce a configure script.
dnl
AC_PREREQ([2.50])
dnl VARIABLES EXPORTED
dnl
dnl ARCH
dnl
dnl DefHeapSpace= Default DB space
dnl DefStackSpace= Default global+local
dnl DefTrailSpace= Default trail
dnl
dnl ENVIRONMENT to run YAP before Install is complete
dnl PRE_INSTALL_ENV= prefix to run YAP after libYap.so and yap are available
dnl but before make install
dnl INSTALL_ENV= prefix to run YAP while doing make install
dnl
dnl EXEC_SUFFIX=suffix for executable (.exe)
dnl
dnl INSTALL_DLLS= we can do dynamic linking
dnl SO= suffix for loadable binary (.so,.dll,.o)
dnl MERGE_DLL_OBJS= we need to merge several .o files into a single dll.
dnl
dnl CXXFLAGS= C++-flags
dnl SHLIB_FLAGS= C-flags used to compile a file that will be loaded dynamically
dnl DO_SECOND_LD= call a separate dll ld
dnl YAPLIB_LD= construct libYap.DLL
dnl SHLIB_LD= dll ld (C)
dnl SHLIB_CXX_LD= dll ld (C++)
dnl SHLIB_CFLAGS= cflags to use when constructing a DLL
dnl SHLIB_CXX_CFLAGS= c++flags to use when constructing a DLL
dnl YAPLIB_CFLAGS=flags to construct libYap
dnl EXTRA_LIBS_FOR_DLLS= libs that are required when lding a so
dnl EXTRA_LIBS_FOR_SWIDLLS= libs that are required when lding a SWI so
AC_INIT(YAP, 6.3.4, [email protected], yap )
DOC_VERSION=4.2.9
AC_CONFIG_HEADER(config.h)
AC_CONFIG_HEADER(YapTermConfig.h)
dnl store the environment's compilation flags
mycflags="$CFLAGS"
AC_PROG_CC
AC_PROG_CPP
AC_PROG_CXX
AC_PROG_AWK
AC_SUBST(GCC)
AC_SUBST(C_INTERF_FLAGS)
AC_SUBST(C_PARSER_FLAGS)
AC_LANG(C)
AC_CANONICAL_SYSTEM
AC_DEFINE_UNQUOTED(HOST_ALIAS,"${target}",[what is the configure host name])
m4_define([HAS_TOP])
AC_DEFUN([AX_SPLIT_VERSION],[
AC_REQUIRE([AC_PROG_SED])
YAP_VERSION="$PACKAGE_VERSION"
YAP_MAJOR_VERSION=`echo "$PACKAGE_VERSION" | $SED 's/\([[^.]][[^.]]*\).*/\1/'`
YAP_MINOR_VERSION=`echo "$PACKAGE_VERSION" | $SED 's/[[^.]][[^.]]*.\([[^.]][[^.]]*\).*/\1/'`
YAP_POINT_VERSION=`echo "$PACKAGE_VERSION" | $SED 's/[[^.]][[^.]]*.[[^.]][[^.]]*.\(.*\)/\1/'`
AC_MSG_CHECKING([Major version])
AC_MSG_RESULT([$YAP_MAJOR_VERSION])
AC_MSG_CHECKING([Minor version])
AC_MSG_RESULT([$YAP_MINOR_VERSION])
AC_MSG_CHECKING([Point version])
AC_MSG_RESULT([$YAP_POINT_VERSION])
])
AX_SPLIT_VERSION
case "$target_cpu" in
i*86*)
YAP_TARGET=i386
;;
x86*)
YAP_TARGET=amd64
;;
sparc*)
YAP_TARGET=sparc
;;
*)
YAP_TARGET=unknown
;;
esac
dnl hardware/engine
AC_DEFINE(MSHIFTOFFS, 1, [compiler should shift offsets.])
AC_DEFINE(ALIGN_LONGS, 1, [longs should be in addresses that are multiple of four.])
# AC_DEFINE(LOW_ABSMI, 1, [absmi located at initial addresses, unused.])
AC_ARG_ENABLE(tabling,
[ --enable-tabling support tabling ],
tabling="$enableval", tabling=yes)
AC_ARG_ENABLE(or-parallelism,
[ --enable-or-parallelism support or-parallelism as: copy,sba,a-cow,threads ],
orparallelism="$enableval", orparallelism=no)
AC_ARG_ENABLE(depth-limit,
[ --enable-depth-limit support depth-bound computation ],
depthlimit="$enableval", depthlimit=yes)
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,
[ --enable-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(prism,
[ --enable-prism use PRISM system in YAP ],
prism="$enableval", prism=yes)
AC_ARG_ENABLE(dynamic_loading,
[ --enable-dynamic-loading compile YAP as a DLL ],
dynamic_loading="$enableval", dynamic_loading=no)
AC_ARG_ENABLE(static_compilation,
[ --enable-static-compilation compile YAP statically ],
static_compilation="$enableval", static_compilation=no)
AC_ARG_ENABLE(use-malloc,
[ --enable-use-malloc use malloc to allocate memory ],
use_malloc="$enableval", use_malloc=yes)
AC_ARG_ENABLE(condor,
[ --enable-condor allow YAP to be used from condor ],
use_condor="$enableval", use_condor=no)
AC_ARG_ENABLE(chr,
[ --enable-chr install chr library ],
use_chr="$enableval", use_chr=yes)
AC_ARG_ENABLE(clpqr,
[ --enable-clpqr install clpqr library ],
use_clpqr="$enableval", use_clpqr=yes)
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_ENABLE(clpbn-horus,
[ --enable-clpbn-horus enable CLPBN HORUS library. ],
yap_cv_clpbn_horus="$enableval", horus=yes)
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"
LIBS="$LIBS -L${yap_cv_gmp}/lib"
CPPFLAGS="$CPPFLAGS -I${yap_cv_gmp}/include"
CFLAGS="$CFLAGS -I${yap_cv_gmp}/include"
fi,
[yap_cv_gmp=yes])
AC_ARG_WITH(R,
[ --with-R[=DIR] interface to R language],
if test "$withval" = yes; then
yap_cv_R=yes
elif test "$withval" = no; then
yap_cv_R=no
else
yap_cv_R=$withval
fi,
[yap_cv_R=no])
AC_ARG_WITH(judy,
[ --with-judy[=DIR] UDI needs judy library],
if test "$withval" = yes; then
yap_cv_judy=yes
elif test "$withval" = no; then
yap_cv_judy=no
else
yap_cv_judy=$withval
fi,
[yap_cv_judy=yes])
AC_ARG_WITH(minisat,
[ --enable-minisat use minisat interface],
if test "$withval" = yes; then
yap_cv_minisat=yes
elif test "$withval" = no; then
yap_cv_minisat=no
else
yap_cv_minisat="$GXX"
fi,
[yap_cv_minisat=yes])
AC_ARG_WITH(java,
[ --with-java=JAVA_HOME use JPL with Java setup in JAVA_HOME],
if test "$withval" = yes; then
yap_cv_java=yes
dynamic_loading=yes
maxmemory=yes
dnl threads=yes
elif test "$withval" = no; then
yap_cv_java=no
else
yap_cv_java=$with_java
dynamic_loading=yes
maxmemory=yes
dnl threads=yes
fi,
[yap_cv_java=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
if test -d "${yap_cv_readline}/lib64" -a "$YAP_TARGET" = amd64; then
LDFLAGS="-L${yap_cv_readline}/lib64 -L${yap_cv_readline}/lib $LDFLAGS"
else
LDFLAGS="-L${yap_cv_readline}/lib $LDFLAGS"
fi
CPPFLAGS="-I${yap_cv_readline}/include $CPPFLAGS"
fi,
[yap_cv_readline=yes])
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])
AC_ARG_WITH(max-workers,
[ --with-max-workers[=integer] maximum number of or-parallel processes],
if test "$withval" = yes; then
yap_cv_max_workers="(8*SIZEOF_INT_P)"
elif test "$withval" = no; then
yap_cv_max_workers="1"
else
yap_cv_max_workers=$withval
fi,
[yap_cv_max_workers="(8*SIZEOF_INT_P)"])
AC_ARG_WITH(max-threads,
[ --with-max-threads[=integer] maximum number of or-parallel processes],
if test "$withval" = yes; then
yap_cv_max_threads="1024"
elif test "$withval" = no; then
yap_cv_max_threads="1"
else
yap_cv_max_threads=$withval
fi,
[yap_cv_max_threads="1024"])
AC_DEFINE(MinHeapSpace, (2048*SIZEOF_INT_P), [at least 2M Cells for Heap])
AC_DEFINE(MinStackSpace,(1024*SIZEOF_INT_P), [at least 1M Cells for Stack])
AC_DEFINE(MinTrailSpace,(256*SIZEOF_INT_P), [at least 1/2M Cells for Trail])
AC_DEFINE(MAX_WORKERS,1)
if test "$orparallelism" = no
then
AC_DEFINE_UNQUOTED(MAX_WORKERS,$yap_cv_max_workers,[maximum amount of or-parallelism])
if test "$orparallelism" = copy -o "$orparallelism" = yes
then
use_malloc="no"
fi
if test "$orparallelism" = threads
then
threads="yes"
fi
fi
AC_DEFINE_UNQUOTED(DefHeapSpace,$yap_cv_heap_space, [Default Heap Space.])
AC_DEFINE_UNQUOTED(DefStackSpace,$yap_cv_stack_space, [Default Global+Local Space.])
AC_DEFINE_UNQUOTED(DefTrailSpace,$yap_cv_trail_space, [Default Trail Space.])
if test "$threads" = no
then
yap_cv_max_threads=1
fi
AC_DEFINE_UNQUOTED(MAX_THREADS,$yap_cv_max_threads,[max number of threads, default 1 or 1024])
if test "$yap_cv_prism" = no
then
INSTALL_PRISM=""
else
INSTALL_PRISM="packages/prism/src/c packages/prism/src/prolog"
fi
if test "$yap_cv_clpbn_bp"="yes"; then
AC_LANG_PUSH([C++])
my_save_cxxflags="$CXXFLAGS"
CXXFLAGS=-std=c++0x
AC_MSG_CHECKING([whether CXX supports -std-c++0x])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
[AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])]
[yap_cv_clpbn_bp=no]
)
CXXFLAGS="$my_save_cxxflags"
AC_LANG_POP()
fi
if test "$yap_cv_clpbn_bp" = no
then
PKG_CLPBN="packages/CLPBN"
else
PKG_CLPBN="packages/CLPBN packages/CLPBN/horus"
fi
dnl condor universe does not like dynamic linking on Linux, DEC, and HP-UX platforms.
if test "$use_condor" = yes
then
static_compilation="yes"
use_malloc="yes"
CC="condor_compile $CC"
CXX="condor_compile $CXX"
dnl no readline with condor.
yap_cv_readline="no"
AC_DEFINE(SUPPORT_CONDOR, 1, [enable condor distributed execution, static compilation])
dnl and it disables minisat
yap_cv_minisat=no
STATIC_MODE=""
else
static_compilation="no"
STATIC_MODE="# "
fi
dnl Compilation Flags
if test "$GCC" = "yes"
then
if test "$debugyap" = "yes"
then
CXXFLAGS="-O -g -Wall $CXXFLAGS"
C_INTERF_FLAGS="-O -g -Wall -Wstrict-prototypes -Wmissing-prototypes $CFLAGS"
CFLAGS="-O -g -Wall -Wstrict-prototypes -Wmissing-prototypes $CFLAGS"
else
CXXFLAGS="-O3 -fomit-frame-pointer -Wall $CXXFLAGS"
C_INTERF_FLAGS="-O3 -Wall -Wstrict-prototypes -Wmissing-prototypes $CFLAGS"
C_PARSER_FLAGS="-O3 -Wall -Wstrict-prototypes -Wmissing-prototypes $CFLAGS"
CFLAGS="-O3 -fomit-frame-pointer -Wall -Wstrict-prototypes -Wmissing-prototypes $CFLAGS"
case "`$CC --version < /dev/null`" in
*3.4*)
CFLAGS="-fno-gcse -fno-crossjumping $CFLAGS"
;;
esac
case "$target_cpu" in
i*86*)
CFLAGS="-DBP_FREE $CFLAGS"
CXXFLAGS="-DBP_FREE $CXXFLAGS"
;;
sparc*)
case "$target_os" in
*solaris[2-9]*) dnl
CFLAGS="-mno-app-regs -DOPTIMISE_ALL_REGS_FOR_SPARC=1 $CFLAGS"
CXXFLAGS="-mno-app-regs -DOPTIMISE_ALL_REGS_FOR_SPARC=1 $CXXFLAGS"
;;
esac
;;
esac
if test "$tcpu"; then
target_cpu=$tcpu
fi
if test "$maxperformance" = "yes"
then
case "$target_cpu" in
athlon)
CFLAGS="-march=athlon $CFLAGS"
CXXFLAGS="-march=athlon $CXXFLAGS"
;;
i686*)
CFLAGS="-march=i686 $CFLAGS"
CXXFLAGS="-march=i686 $CXXFLAGS"
;;
i586*)
CFLAGS="-march=i586 $CFLAGS"
CXXFLAGS="-march=i586 $CXXFLAGS"
;;
i486*)
CFLAGS="-march=i486 $CFLAGS"
CXXFLAGS="-march=i486 $CXXFLAGS"
;;
esac
fi
fi
if test "$CC" = "sslittle-na-sstrix-gcc"
then
RANLIB="sslittle-na-sstrix-ranlib"
AR="sslittle-na-sstrix-ar"
PRE_INSTALL_ENV="sim-fast"
INSTALL_ENV="sim-fast"
fi
else
case "$target_cpu" in
i?86*)
if test "$CC" = "lcc"
then
CFLAGS="-A -A $CFLAGS"
elif test "$CC" = "cl"
then
CXXFLAGS="-/nologo $CXXFLAGS"
CFLAGS="/nologo $CFLAGS"
CPP="/nologo /E"
fi
;;
hppa*)
if test "$CC" = "cc" -o $CC = c89
then
if test "$debugyap" = "yes"
then
CXXFLAGS="-Ae -g -O $CXXFLAGS"
CFLAGS="-Ae -g -O $CFLAGS"
else
CXXFLAGS="-Ae +O3 +Onolimit $CXXFLAGS"
CFLAGS="-Ae +O3 +Onolimit $CFLAGS"
fi
fi
dnl LDFLAGS="+e UserCPredicate $LDFLAGS"
;;
esac
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(AR,ar,:)
AC_PATH_PROG(INSTALL_INFO,install-info,true,$PATH:/sbin:/usr/sbin:/usr/etc:/usr/local/sbin)
AC_PATH_PROG(SHELL,sh)
AC_CHECK_TOOL([INDENT], [indent], [:])
dnl Check for libraries.
dnl mingw does not get along well with libm
dnl cygnus and mingw32 also need wsock32 to use sockets.
dnl
i_am_cross_compiling=$cross_compiling
if test "$target_os" = "cygwin" -o "$target_os" = "mingw32" -o "$target_os" = "mingw64"
then
INSTALL_COMMAND=install_win32
EXTRA_INCLUDES_FOR_WIN32="-I\$(srcdir)/packages/PLStream/windows"
if test "$cygwin" = "no" -o "$target_os" = "mingw32"
then
# locale complaints without this.
if test "$threads" = yes; then
AC_CHECK_LIB(pthread, main)
fi
AC_CHECK_LIB(mscrt,main)
if test "$target_cpu" = x86_64; then
YAP_TARGET=amd64
AC_CHECK_LIB(ws2_32,main)
AC_CHECK_LIB(comdlg32,main)
AC_CHECK_LIB(shell32,main)
EXTRA_LIBS_FOR_DLLS="-lws2_32"
elif test "$target_os" = "cygwin"; then
CC="${CC} -mno-cygwin"
CXX="${CXX} -mno-cygwin"
AC_CHECK_LIB(comdlg32,main)
AC_CHECK_LIB(wsock32,main)
AC_CHECK_LIB(shell32,main)
else
AC_CHECK_LIB(wsock32,main)
AC_CHECK_LIB(comdlg32,main)
AC_CHECK_LIB(shell32,main)
fi
AC_DEFINE(__WINDOWS__, 1, [compiling for Windows])
EXTRA_LIBS_FOR_DLLS="\$(abs_top_builddir)/yap.dll $EXTRA_LIBS_FOR_DLLS"
AC_CHECK_LIB(psapi,main)
yap_cv_readline=no
if test "$prefix" = "NONE"
then
#mingw64
case "$build_os" in
*linux*)
if test "${WINEPREFIX}x" = x
then
SYSTEMDRIVE=$HOME/.wine/drive_c
else
SYSTEMDRIVE="$WINEPREFIX"
fi
if test "$target_cpu" = "x86_64"
then
prefix="$SYSTEMDRIVE/Yap64"
else
prefix="$SYSTEMDRIVE/Yap"
fi
i_am_cross_compiling=yes
;;
**)
if test "$target_cpu" = "x86_64"
then
prefix="\${SYSTEMDRIVE}/Yap64"
else
prefix="\${SYSTEMDRIVE}/Yap"
fi
;;
esac
fi
WINDOWS=""
PKG_WINCONSOLE="swi/console"
else
WINDOWS="#"
PKG_WINCONSOLE=""
LIBS="-lcygwin"
EXTRA_LIBS_FOR_DLLS="\$(abs_top_builddir)/yap.dll"
EXTRA_INCLUDES_FOR_WIN32="-I\$(srcdir)/packages/PLStream/windows"
fi
else
if test "$prefix" = "NONE"
then
prefix=/usr/local
fi
if test -d "${prefix}/lib64" -a "$YAP_TARGET" = amd64
then
LDFLAGS="$LDFLAGS -L${prefix}/lib64"
fi
LDFLAGS="$LDFLAGS -L${prefix}/lib"
CPPFLAGS="$CPPFLAGS -I${prefix}/include"
if test "$exec_prefix" != "NONE" -a "$exec_prefix" != "$prefix"
then
if test -d "${exec_prefix}/lib64" -a "$YAP_TARGET" = amd64; then
LDFLAGS="$LDFLAGS -L${exec_prefix}/lib64"
fi
LDFLAGS="$LDFLAGS -L${exec_prefix}/lib"
fi
INSTALL_COMMAND="install_unix"
WINDOWS="#"
PKG_WINCONSOLE=""
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(stdc++,main)
AC_CHECK_LIB(nsl,main,
have_nsl=yes
,
have_nsl=no)
AC_CHECK_LIB(crypt,main)
AC_CHECK_LIB(nss_files,main)
AC_CHECK_LIB(nss_dns,main)
AC_CHECK_LIB(resolv,main)
fi
if test "$yap_cv_readline" != "no"
then
AC_CHECK_LIB([ncurses], [main],[
LIBS="-lncurses $LIBS"
])
AC_CHECK_LIB([readline], [main],[
AC_DEFINE([HAVE_LIBREADLINE], [1], [Define if you have libreadline])
LIBS="-lreadline $LIBS"
],
[if test "x$with_readline" != xcheck; then
AC_MSG_FAILURE(
[--with-readline was given, but test for readline failed])
fi
])
fi
if test "$yap_cv_gmp" != "no"
then
AC_CHECK_LIB(gmp,main)
fi
if test "$yap_cv_judy" != "no"; then
AC_CHECK_LIB(Judy, Judy1Set,,[AC_MSG_RESULT([libJudy not found, UDI will only work with one Index at a time])])
fi
if test "$threads" = yes
then
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, [do not use our own locking routines])
fi
use_malloc=yes
fi
if test ! -z "$GCC"; then
COFLAGS="${COFLAGS--O2 -cc-options,-fno-strict-aliasing}"
CWFLAGS="${CWFLAGS--Wall}"
else
COFLAGS="${COFLAGS--O}"
CWFLAGS="${CWFLAGS-}"
fi
CMFLAGS=-fpic
CIFLAGS=-I.
dnl Packages
if test "$use_prism" = no; then
PKG_PRISM=""
else
PKG_PRISM="packages/prism/src/c packages/prism/src/prolog"
fi
AC_SUBST(PKG_PRISM)
if test -e "$srcdir"/packages/archive/Makefile.in; then
PKG_LIBARCHIVE="packages/archive"
else
PKG_LIBARCHIVE=""
fi
if test -e "$srcdir"/packages/odbc/Makefile.in; then
PKG_ODBC="packages/odbc"
else
PKG_ODBC=""
fi
if test "$use_chr" = no; then
PKG_CHR=""
elif test -e "$srcdir"/packages/chr/Makefile.in; then
PKG_CHR="packages/chr"
else
PKG_CHR=""
fi
if test "$use_clpqr" = no; then
PKG_CLPQR=""
elif test -e "$srcdir"/packages/clpqr/Makefile.in; then
PKG_CLPQR="packages/clpqr"
else
PKG_CLPQR=""
fi
if test -e "$srcdir"/packages/clib/Makefile.in; then
PKG_CLIB="packages/clib"
else
PKG_CLIB=""
fi
if test -e "$srcdir"/packages/http/Makefile.in; then
PKG_HTTP="packages/http"
else
PKG_HTTP=""
fi
if test -e "$srcdir"/packages/pldoc/Makefile.in; then
PKG_PLDOC="packages/pldoc"
else
PKG_PLDOC=""
fi
if test -e "$srcdir"/packages/plunit/Makefile.in; then
PKG_PLUNIT="packages/plunit"
else
PKG_PLUNIT=""
fi
if test -e "$srcdir"/packages/R/Makefile.in; then
PKG_R="packages/R"
else
PKG_R=""
fi
if test -e "$srcdir"/packages/raptor/Makefile.in; then
ENABLE_RAPTOR="packages/raptor"
else
ENABLE_RAPTOR=""
fi
if test -e "$srcdir"/packages/RDF/Makefile.in; then
PKG_RDF="packages/RDF"
else
PKG_RDF=""
fi
if test -e "$srcdir"/packages/ltx2htm/Makefile.in; then
PKG_LTX2HTM="packages/ltx2htm"
else
PKG_LTX2HTM=""
fi
if test -e "$srcdir"/packages/semweb/Makefile.in; then
PKG_SEMWEB="packages/semweb"
else
PKG_SEMWEB=""
fi
if test -e "$srcdir"/packages/sgml/Makefile.in; then
PKG_SGML="packages/sgml"
else
PKG_SGML=""
fi
if test -e "$srcdir"/packages/zlib/Makefile.in; then
PKG_ZLIB="packages/zlib"
else
PKG_ZLIB=""
fi
dnl --enable-new-dtags seems to enable the use of --runpath
dnl instead of --rpath.
if test "$static_compilation" = "no"
then
OLDLDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS -Wl,--enable-new-dtags"
AC_MSG_CHECKING([whether ld supports --enable-new-dtags])
AC_LINK_IFELSE([AC_LANG_PROGRAM([])],
[AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])
LDFLAGS="$OLDLDFLAGS"]
)
fi
if test "$cross_compiling" = "yes"
then
YAP_EXTRAS=""
else
AC_SYS_RESTARTABLE_SYSCALLS
fi
dnl defaults
INSTALL_DLLS="no"
EXTRA_OBJS=""
SHLIB_LD="#"
SHLIB_CXX_LD="#"
DO_SECOND_LD="#"
M4="m4"
MERGE_DLL_OBJS="#"
IN_UNIX=""
dnl This has to be before $target_os
YAPLIB="libYap.a"
dnl now this is where things get nasty.
dnl trying to get the libraries
case "$target_os" in
*linux*)
if test "$static_compilation" = "no"
then
AC_CHECK_LIB(dl,dlopen,
have_dl=yes
,
have_dl=no)
if test "$have_dl" = "yes"
then
SO="so"
SHLIB_LD="$CC -shared -export-dynamic"
SHLIB_CXX_LD="$CXX -shared -export-dynamic"
DO_SECOND_LD=""
LIBS="$LIBS -ldl"
case "$target_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 $CFLAGS"
SHLIB_CXXFLAGS="-shared -fPIC $CXXFLAGS"
INSTALL_DLLS="yes"
fi
LDFLAGS="$LDFLAGS -L\$(abs_top_builddir) -Wl,-R\$(LIBDIR) -Wl,-R,\$(YAPLIBDIR)"
DYNYAPLIB=libYap."$SO"."$YAP_VERSION"
EXTRAYAPLIBS="libYap.$SO libYap.$SO.$YAP_MAJOR_VERSION"
SONAMEFLAG="-Wl,-soname=libYap.$SO.$YAP_MAJOR_VERSION"
fi
if test "$have_nsl" = yes
then
LIBS="$LIBS -lnsl"
fi
if test "$dynamic_loading" = "yes"
then
YAPLIB_LD="\$(CC) -shared"
EXTRA_LIBS_FOR_DLLS="$EXTRA_LIBS_FOR_DLLS -L\$(abs_top_builddir) -lYap -Wl,-rpath=\$(YAPLIBDIR) -Wl,-rpath=\$(LIBDIR)"
INSTALL_ENV="LD_LIBRARY_PATH=:\$(DESTDIR)\$(LIBDIR):\$(DESTDIR)\$(YAPLIBDIR): YAPSHAREDIR=\$(DESTDIR)\$(SHAREDIR) YAPLIBDIR=\$(DESTDIR)\$(YAPLIBDIR)"
else
YAPLIB_LD="\$(CC)"
EXTRA_LIBS_FOR_DLLS="$EXTRA_LIBS_FOR_DLLS -Wl,-R,\$(YAPLIBDIR) -Wl,-R,\$(LIBDIR)"
INSTALL_ENV="YAPSHAREDIR=\$(DESTDIR)\$(SHAREDIR) YAPLIBDIR=\$(DESTDIR)\$(YAPLIBDIR)"
fi
PRE_INSTALL_ENV="LD_LIBRARY_PATH=\$(abs_top_builddir):\$(abs_top_builddir)/library/system:$LD_LIBRARY_PATH"
;;
*sunos4*)
M4="/usr/5bin/m4"
LDFLAGS="$LDFLAGS -N"
if test "$have_nsl" = yes
then
LIBS="$LIBS -lnsl"
fi
SO="o"
INSTALL_DLLS="yes"
LDFLAGS="$LDFLAGS -L\$(abs_top_builddir) -Wl,-R,\$(LIBDIR) -Wl,-R,\$(YAPLIBDIR)"
DYNYAPLIB=libYap."$SO"
SONAMEFLAG=""
EXTRA_LIBS_FOR_DLLS="$EXTRA_LIBS_FOR_DLLS -L\$(abs_top_builddir) -lYap -Wl,-R,\$(YAPLIBDIR) -Wl,-R,\$(LIBDIR)"
PRE_INSTALL_ENV="LD_LIBRARY_PATH=\$(abs_top_builddir):\$(abs_top_builddir)/library/system:$LD_LIBRARY_PATH"
INSTALL_ENV="LD_LIBRARY_PATH=\$(DESTDIR)\$(LIBDIR):\$(DESTDIR)\$(YAPLIBDIR): YAPSHAREDIR=\$(DESTDIR)\$(SHAREDIR) YAPLIBDIR=\$(DESTDIR)\$(YAPLIBDIR)"
;;
*hpux*)
#do not use the first memory quadrant
AC_DEFINE(FORCE_SECOND_QUADRANT, 1, [old HP-UX VM magic, should be irrelevant now])
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="$CC -shared -export-dynamic"
SHLIB_CXX_LD="$CXX -shared -export-dynamic"
DO_SECOND_LD=""
SO="sl"
SHLIB_CFLAGS="+z $CFLAGS"
SHLIB_CXXFLAGS="+z $CXXFLAGS"
INSTALL_DLLS="yes"
# If the xnet library was found, turn on X/Open networking
if test "$ac_cv_lib_xnet_getsockname" = yes
then
AC_DEFINE(_XOPEN_SOURCE, 1, [HP-UX old socket stuff])
AC_DEFINE(_XOPEN_SOURCE_EXTENDED, 1, [HP-UX old socket stuff])
fi
else
INSTALL_DLLS="no"
fi
fi
if test ${target_os} = hpux10.20
then
AC_DEFINE(MPI_AVOID_REALLOC,1,[o not use realloc() from HP-UX 10.20 together with MPI])
fi
LDFLAGS="$LDFLAGS -L\$(abs_top_builddir) -Wl,-R,\$(LIBDIR) -Wl,-R,\$(YAPLIBDIR)"
DYNYAPLIB=libYap."$SO"
SONAMEFLAG=""
EXTRA_LIBS_FOR_DLLS="$EXTRA_LIBS_FOR_DLLS -L\$(abs_top_builddir) -lYap -Wl,-R,\$(YAPLIBDIR) -Wl,-R,\$(LIBDIR)"
PRE_INSTALL_ENV="LD_LIBRARY_PATH=\$(abs_top_builddir):\$(abs_top_builddir)/library/system:$LD_LIBRARY_PATH"
INSTALL_ENV="LD_LIBRARY_PATH=\$(DESTDIR)\$(LIBDIR):\$(DESTDIR)\$(YAPLIBDIR): YAPSHAREDIR=\$(DESTDIR)\$(SHAREDIR) YAPLIBDIR=\$(DESTDIR)\$(YAPLIBDIR)"
;;
*aix*)
# To actually use dlls in AIX I'd need to build YAP as a DLL first.
# I won't bother for now.
#
# SO="a"
#SHLIB_LD="\$(srcdir)/../../ldAix /bin/ld -bhalt:4 -bM:SRE -bE:lib.exp -H512 -T512 -bnoentry"
#INSTALL_DLLS="yes"
LDFLAGS="$LDFLAGS -L\$(abs_top_builddir) -Wl,-R,\$(LIBDIR) -Wl,-R,\$(YAPLIBDIR)"
DYNYAPLIB=libYap."$SO"
SONAMEFLAG=""
EXTRA_LIBS_FOR_DLLS="$EXTRA_LIBS_FOR_DLLS -L\$(abs_top_builddir) -lYap -Wl,-R,\$(YAPLIBDIR) -Wl,\$(LIBDIR)"
PRE_INSTALL_ENV="LD_LIBRARY_PATH=\$(abs_top_builddir):\$(abs_top_builddir)/library/system:$LD_LIBRARY_PATH"
INSTALL_ENV="LD_LIBRARY_PATH=\$(DESTDIR)\$(LIBDIR):\$(DESTDIR)\$(YAPLIBDIR): YAPSHAREDIR=\$(DESTDIR)\$(SHAREDIR) YAPLIBDIR=\$(DESTDIR)\$(YAPLIBDIR)"
;;
*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)
SO="so"
SHLIB_LD="ld -shared -expect_unresolved '*'"
DO_SECOND_LD=""
fi
LDFLAGS="$LDFLAGS -L\$(abs_top_builddir) -Wl,-R,\$(LIBDIR) -Wl,-R,\$(YAPLIBDIR)"
DYNYAPLIB=libYap."$SO"
SONAMEFLAG=""
EXTRA_LIBS_FOR_DLLS="$EXTRA_LIBS_FOR_DLLS -L\$(abs_top_builddir) -lYap -Wl,-R,\$(YAPLIBDIR) -Wl,-R,\$(LIBDIR)"
PRE_INSTALL_ENV="LD_LIBRARY_PATH=\$(abs_top_builddir):\$(abs_top_builddir)/library/system:$LD_LIBRARY_PATH"
INSTALL_ENV="LD_LIBRARY_PATH=\$(DESTDIR)\$(LIBDIR):\$(DESTDIR)\$(YAPLIBDIR): YAPSHAREDIR=\$(DESTDIR)\$(SHAREDIR) YAPLIBDIR=\$(DESTDIR)\$(YAPLIBDIR)"
;;
*irix6*)
SHLIB_CFLAGS="$CFLAGS"
SHLIB_CXXFLAGS="$CXXFLAGS"
SO="so"
DO_SECOND_LD=""
SHLIB_LD="ld -n32 -shared -rdata_shared"
SHLIB_CXX_LD="$SHLIB_LD"
INSTALL_DLLS="yes"
LDFLAGS="$LDFLAGS -L\$(abs_top_builddir) -Wl,-R,\$(LIBDIR) -Wl,-R,\$(YAPLIBDIR)"
DYNYAPLIB=libYap."$SO"
SONAMEFLAG=""
EXTRA_LIBS_FOR_DLLS="$EXTRA_LIBS_FOR_DLLS -L\$(abs_top_builddir) -lYap -Wl,-R,\$(YAPLIBDIR) -Wl,-R,\$(LIBDIR)"
PRE_INSTALL_ENV="LD_LIBRARY_PATH=\$(abs_top_builddir):\$(abs_top_builddir)/library/system:$LD_LIBRARY_PATH"
INSTALL_ENV="LD_LIBRARY_PATH=\$(DESTDIR)\$(LIBDIR):\$(DESTDIR)\$(YAPLIBDIR): YAPSHAREDIR=\$(DESTDIR)\$(SHAREDIR) YAPLIBDIR=\$(DESTDIR)\$(YAPLIBDIR)"
;;
*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
SO="dylib"
DO_SECOND_LD=""
if test "$dynamic_loading" = "yes"
then
SHLIB_LD="$CC -dynamiclib"
SHLIB_CXX_LD="$CXX -dynamiclib"
EXTRA_LIBS_FOR_DLLS="-L\$(abs_top_builddir) $LIBS $EXTRA_LIBS_FOR_DLLS -lYap -Wl,-install_name,\$(YAPLIBDIR)/\$@"
INSTALL_ENV="DYLD_LIBRARY_PATH=\$(DESTDIR)\$(LIBDIR):\$(DESTDIR)\$(YAPLIBDIR): YAPSHAREDIR=\$(DESTDIR)\$(SHAREDIR) YAPLIBDIR=\$(DESTDIR)\$(YAPLIBDIR)"
LDFLAGS="-L\$(abs_top_builddir) $LDFLAGS "
else
SHLIB_LD="$CC -dynamiclib -Wl,-undefined,dynamic_lookup"
SHLIB_CXX_LD="$CXX -dynamiclib -Wl,-undefined,dynamic_lookup"
EXTRA_LIBS_FOR_DLLS="$EXTRA_LIBS_FOR_DLLS -Wl,-install_name,\$(YAPLIBDIR)/\$@"
INSTALL_ENV="YAPSHAREDIR=\$(DESTDIR)\$(SHAREDIR) YAPLIBDIR=\$(DESTDIR)\$(YAPLIBDIR)"
fi
if test "$ac_cv_prog_gcc" = "yes"
then
SHLIB_CFLAGS="-shared -fPIC $CFLAGS"
SHLIB_CXXFLAGS="-shared -fPIC $CXXFLAGS"
INSTALL_DLLS="yes"
fi
CC="$CC -fstrict-aliasing -freorder-blocks -fsched-interblock -Wall"
DYNYAPLIB=libYap."$YAP_VERSION.$SO"
SONAMEFLAG="-Wl,-install_name,$prefix/lib/libYap.$YAP_MAJOR_VERSION.$SO -Wl,-compatibility_version,$YAP_MAJOR_VERSION.$YAP_MINOR_VERSION -Wl,-current_version,$YAP_VERSION"
YAPLIB_LD="$CC -dynamiclib"
PRE_INSTALL_ENV="DYLD_LIBRARY_PATH=\$(abs_top_builddir):\$(abs_top_builddir)/library/system:$DYLD_LIBRARY_PATH"
EXTRAYAPLIBS="libYap.$SO libYap.$YAP_MAJOR_VERSION.$SO"
;;
*netbsd*|*openbsd*|*freebsd*|*dragonfly*)
if echo __ELF__ | ${CC:-cc} -E - | grep -q __ELF__
then
#an a.out system
SHLIB_CFLAGS="$CFLAGS"
SHLIB_CXXFLAGS="$CXXFLAGS"
SO="o"
else
#an elf system
LDFLAGS="-Wl,--export-dynamic $LDFLAGS"
SHLIB_CFLAGS="-fPIC $CFLAGS"
SHLIB_CXXFLAGS="-fPIC $CXXFLAGS"
SHLIB_LD="$CC -shared -export-dynamic"
SHLIB_CXX_LD="$CXX -shared -export-dynamic"
DO_SECOND_LD=""
SO="so"