-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
2914 lines (2566 loc) · 89 KB
/
configure.ac
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 Process this file with autoconf to produce a configure script.
dnl The macros which aren't shipped with the autotools are stored in the
dnl Tools/config directory in .m4 files.
AC_INIT([swig],[4.2.1],[https://www.swig.org])
AC_PREREQ([2.60])
AC_CONFIG_SRCDIR([Source/Swig/swig.h])
AC_CONFIG_AUX_DIR([Tools/config])
AC_CONFIG_HEADERS([Source/Include/swigconfig.h])
AC_CANONICAL_HOST
AM_INIT_AUTOMAKE
dnl Some extra defines for the config file
AH_BOTTOM([
/* Deal with attempt by Microsoft to deprecate C standard runtime functions */
#if defined(_MSC_VER)
# define _CRT_SECURE_NO_DEPRECATE
#endif
])
dnl Check for programs that a user requires to build SWIG
AC_PROG_CC
AC_PROG_CXX
AM_PROG_CC_C_O # Needed for subdir-objects in AUTOMAKE_OPTIONS
AC_COMPILE_WARNINGS # Increase warning levels
AC_MSG_CHECKING([CFLAGS to compile SWIG executable])
AC_MSG_RESULT([$CFLAGS])
AC_MSG_CHECKING([CXXFLAGS to compile SWIG executable])
AC_MSG_RESULT([$CXXFLAGS])
AC_DEFINE_UNQUOTED(SWIG_CXX, ["$CXX"], [Compiler that built SWIG])
AC_DEFINE_UNQUOTED(SWIG_PLATFORM, ["$host"], [Platform that SWIG is built for])
# For AC_EGREP_CPP
AC_PROG_EGREP
dnl PCRE
AC_ARG_WITH([pcre],
[AS_HELP_STRING([--without-pcre],
[Disable support for regular expressions using PCRE2])],
[],
[with_pcre=yes])
AC_MSG_CHECKING([whether to enable PCRE2 support])
AC_MSG_RESULT([$with_pcre])
dnl To make configuring easier, check for a locally built PCRE using the Tools/pcre-build.sh script
if test x"${with_pcre}" = xyes ; then
AC_MSG_CHECKING([whether to use local PCRE2])
local_pcre_config=no
if test -z "$PCRE2_CONFIG"; then
if test -f `pwd`/pcre/pcre-swig-install/bin/pcre2-config; then
PCRE2_CONFIG=`pwd`/pcre/pcre-swig-install/bin/pcre2-config
local_pcre_config=$PCRE2_CONFIG
fi
fi
AC_MSG_RESULT([$local_pcre_config])
fi
AS_IF([test "x$with_pcre" != xno],
[AX_PATH_GENERIC([pcre2],
[], dnl Minimal version of PCRE we need -- accept any
[], dnl custom sed script for version parsing is not needed
[AC_DEFINE([HAVE_PCRE], [1], [Define if you have PCRE2 library])
LIBS="$LIBS $PCRE2_LIBS"
CPPFLAGS="$CPPFLAGS $PCRE2_CFLAGS"
],
[AC_MSG_FAILURE([
Cannot find pcre2-config script from PCRE2 (Perl Compatible Regular Expressions)
library package. This dependency is needed for configure to complete,
Either:
- Install the PCRE2 developer package on your system (preferred approach).
- Download the PCRE2 source tarball, build and install on your system
as you would for any package built from source distribution.
- Use the Tools/pcre-build.sh script to build PCRE2 just for SWIG to statically
link against. Run 'Tools/pcre-build.sh --help' for instructions.
(quite easy and does not require privileges to install PCRE2 on your system)
- Use configure --without-pcre to disable regular expressions support in SWIG
(not recommended).])
],
[],[],[--libs8])
])
dnl CCache
AC_ARG_ENABLE([ccache], AS_HELP_STRING([--disable-ccache], [disable building and installation of ccache-swig executable (default enabled)]), [enable_ccache=$enableval], [enable_ccache=yes])
AC_MSG_CHECKING([whether to enable ccache-swig])
AC_MSG_RESULT([$enable_ccache])
if test "$enable_ccache" = yes; then
AC_CONFIG_SUBDIRS(CCache)
ENABLE_CCACHE=1
fi
AC_SUBST(ENABLE_CCACHE)
echo ""
echo "Checking packages required for SWIG developers."
echo "Note : None of the following packages are required for users to compile and install SWIG from the distributed tarball"
echo ""
AC_CHECK_PROGS([BISON], [bison], [$MISSING bison])
echo ""
echo "Checking for installed target languages and other information in order to compile and run"
echo "the examples and test-suite invoked by 'make check'."
echo "Note : None of the following packages are required for users to compile and install SWIG from the distributed tarball"
echo ""
dnl Some test cases require Boost
AX_BOOST_BASE(,,,)
AC_SUBST(BOOST_CPPFLAGS)
dnl Info for building shared libraries ... in order to run the examples
# SO is the extension of shared libraries (including the dot!)
AC_MSG_CHECKING(SO)
if test -z "$SO"
then
case $host in
*-*-hp*) SO=.sl;;
*-*-darwin*) SO=.bundle;;
*-*-cygwin* | *-*-mingw*) SO=.dll;;
*) SO=.so;;
esac
fi
AC_MSG_RESULT($SO)
# LDSHARED is the ld *command* used to create shared library
# -- "ld" on SunOS 4.x.x, "ld -G" on SunOS 5.x, "ld -shared" on IRIX 5
# (Shared libraries in this instance are shared modules to be loaded into
# Python, as opposed to building Python itself as a shared library.)
AC_MSG_CHECKING(LDSHARED)
if test -z "$LDSHARED"
then
case $host in
*-*-aix*) LDSHARED="$CC -shared";;
*-*-cygwin* | *-*-mingw*)
if test "$GCC" = yes; then
LDSHARED="\$(CC) -shared"
else
if test "cl" = $CC ; then
# Microsoft Visual C++ (MSVC)
LDSHARED="\$(CC) -nologo -LD"
else
# Unknown compiler try gcc approach
LDSHARED="\$(CC) -shared"
fi
fi ;;
*-*-irix5*) LDSHARED="ld -shared";;
*-*-irix6*) LDSHARED="ld ${SGI_ABI} -shared -all";;
*-*-sunos4*) LDSHARED="ld";;
*-*-solaris*) LDSHARED="ld -G";;
*-*-hp*) LDSHARED="ld -b";;
*-*-osf*) LDSHARED="ld -shared -expect_unresolved \"*\"";;
*-sequent-sysv4) LDSHARED="ld -G";;
*-*-next*)
if test "$ns_dyld"
then LDSHARED="\$(CC) \$(LDFLAGS) -bundle -prebind"
else LDSHARED="\$(CC) \$(CFLAGS) -nostdlib -r"
fi
if test "$with_next_framework" ; then
LDSHARED="$LDSHARED \$(LDLIBRARY)"
fi ;;
*-*-linux*) LDSHARED="\$(CC) -shared";;
*-*-dgux*) LDSHARED="ld -G";;
*-*-freebsd3*) LDSHARED="\$(CC) -shared";;
*-*-freebsd* | *-*-openbsd*) LDSHARED="ld -Bshareable";;
*-*-netbsd*)
if [[ "`\$(CC) -dM -E - </dev/null | grep __ELF__`" != "" ]]
then
LDSHARED="\$(CC) -shared"
else
LDSHARED="ld -Bshareable"
fi;;
*-sco-sysv*) LDSHARED="\$(CC) -G -KPIC -Ki486 -belf -Wl,-Bexport";;
*-*-darwin*) LDSHARED="\$(CC) -bundle -undefined suppress -flat_namespace";;
*) LDSHARED="ld";;
esac
fi
AC_MSG_RESULT($LDSHARED)
# CXXSHARED is the ld *command* used to create C++ shared library
# -- "ld" on SunOS 4.x.x, "ld -G" on SunOS 5.x, "ld -shared" on IRIX 5
# (Shared libraries in this instance are shared modules to be loaded into
# Python, as opposed to building Python itself as a shared library.)
AC_MSG_CHECKING(CXXSHARED)
if test -z "$CXXSHARED"
then
CXXSHARED="$LDSHARED"
fi
AC_MSG_RESULT($CXXSHARED)
#
AC_MSG_CHECKING(TRYLINKINGWITHCXX)
if test -z "$TRYLINKINGWITHCXX"
then
case $host in
*-*-solaris*) if test "$GCC" = yes
then TRYLINKINGWITHCXX="CXXSHARED= \$(CXX) -Wl,-G"
else TRYLINKINGWITHCXX="CXXSHARED= \$(CXX) -G -L/opt/SUNWspro/lib -lCrun -lCstd"
fi;;
*-*-hp*) TRYLINKINGWITHCXX="CXXSHARED= \$(CXX) +z ";;
*-*-darwin*) TRYLINKINGWITHCXX="CXXSHARED= \$(CXX) -bundle -undefined suppress -flat_namespace";;
*-*-cygwin* | *-*-mingw*)
if test "$GCC" = yes; then
TRYLINKINGWITHCXX="CXXSHARED= \$(CXX) -shared "
else
if test "cl" = $CXX ; then
# Microsoft Visual C++ (MSVC)
TRYLINKINGWITHCXX="CXXSHARED= \$(CXX) -nologo -LD"
else
TRYLINKINGWITHCXX="#unknown Windows compiler"
fi
fi ;;
*) TRYLINKINGWITHCXX="CXXSHARED= \$(CXX) -shared ";;
esac
fi
AC_MSG_RESULT($TRYLINKINGWITHCXX)
# CCSHARED are the C *flags* used to create objects to go into a shared
# library (module) -- this is only needed for a few systems
AC_MSG_CHECKING(CCSHARED)
if test -z "$CCSHARED"
then
case $host in
*-*-hp*) if test "$GCC" = yes
then CCSHARED="-fpic"
else CCSHARED="+z"
fi;;
s390x*-*-*) CCSHARED="-fpic" ;;
s390*-*-*) CCSHARED="-fPIC" ;;
*-*-linux*) CCSHARED="-fpic";;
*-*-freebsd* | *-*-openbsd*) CCSHARED="-fpic";;
*-*-netbsd*) CCSHARED="-fPIC";;
*-sco-sysv*) CCSHARED="-KPIC -dy -Bdynamic";;
*-*-irix6*) case $CC in
*gcc*) CCSHARED="-shared";;
*) CCSHARED="";;
esac;;
esac
fi
AC_MSG_RESULT($CCSHARED)
# RPATH is the path used to look for shared library files.
AC_MSG_CHECKING(RPATH)
if test -z "$RPATH"
then
case $host in
*-*-solaris*) RPATH='-R. -R$(exec_prefix)/lib';;
*-*-irix*) RPATH='-rpath .:$(exec_prefix)/lib';;
*-*-linux*) RPATH='-Xlinker -rpath $(exec_prefix)/lib -Xlinker -rpath .';;
*) RPATH='';;
esac
fi
AC_MSG_RESULT($RPATH)
# LINKFORSHARED are the flags passed to the $(CC) command that links
# a few executables -- this is only needed for a few systems
AC_MSG_CHECKING(LINKFORSHARED)
if test -z "$LINKFORSHARED"
then
case $host in
*-*-aix*) LINKFORSHARED='-Wl,-bE:$(srcdir)/python.exp -lld';;
*-*-hp*)
LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";;
*-*-linux*) LINKFORSHARED="-Xlinker -export-dynamic";;
*-*-next*) LINKFORSHARED="-u libsys_s";;
*-sco-sysv*) LINKFORSHARED="-Bdynamic -dy -Wl,-Bexport";;
*-*-irix6*) LINKFORSHARED="-all";;
esac
fi
AC_MSG_RESULT($LINKFORSHARED)
# Optional CFLAGS used to silence/enhance compiler warnings on some platforms.
AC_MSG_CHECKING(CFLAGS to use for testing (PLATCFLAGS))
case $host in
*-*-solaris*) if test "$GCC" = yes
then PLATCFLAGS=
else PLATCFLAGS=
# else PLATCFLAGS="-errtags=yes" # Need more work as C examples use ld for linking
fi;;
*-*-aix*) PLATCFLAGS="$CFLAGS";;
*) PLATCFLAGS=
esac
AC_MSG_RESULT($PLATCFLAGS)
# Add switch if necessary to enable C++11 support - just for tests
AC_ARG_ENABLE([cpp11-testing], AS_HELP_STRING([--disable-cpp11-testing], [disable C++11 and later C++ standards testing even if supported by compiler (default enabled)]), [enable_cpp11_testing=$enableval], [enable_cpp11_testing=yes])
AC_MSG_CHECKING([whether to attempt to enable C++11 and later C++ standards testing])
AC_MSG_RESULT([$enable_cpp11_testing])
PLATCXXFLAGS="$PLATCFLAGS"
if test x"$enable_cpp11_testing" = xyes; then
CXX_SAVED=$CXX
CXXCPP_SAVED=$CXXCPP
# Test for c++20
CXXCPP=" "
AX_CXX_COMPILE_STDCXX(20, [noext], [optional])
AC_MSG_CHECKING([whether C++11 to C++20 testing is enabled])
if test "$HAVE_CXX20" = "1"; then
AC_MSG_RESULT([yes])
PLATCXXFLAGS="$CXXCPP $PLATCXXFLAGS"
HAVE_CXX17="1"
HAVE_CXX14="1"
HAVE_CXX11="1"
else
AC_MSG_RESULT([no])
# Test for c++17
CXXCPP=" "
AX_CXX_COMPILE_STDCXX(17, [noext], [optional])
AC_MSG_CHECKING([whether C++11 to C++17 testing is enabled])
if test "$HAVE_CXX17" = "1"; then
AC_MSG_RESULT([yes])
PLATCXXFLAGS="$CXXCPP $PLATCXXFLAGS"
HAVE_CXX14="1"
HAVE_CXX11="1"
else
AC_MSG_RESULT([no])
# Test for c++14
CXXCPP=" "
CXX=$CXX_SAVED
AX_CXX_COMPILE_STDCXX(14, [noext], [optional])
AC_MSG_CHECKING([whether C++11 to C++14 testing is enabled])
if test "$HAVE_CXX14" = "1"; then
AC_MSG_RESULT([yes])
PLATCXXFLAGS="$CXXCPP $PLATCXXFLAGS"
HAVE_CXX11="1"
else
AC_MSG_RESULT([no])
# Test for c++11
CXXCPP=" "
CXX=$CXX_SAVED
AX_CXX_COMPILE_STDCXX(11, [noext], [optional])
AC_MSG_CHECKING([whether C++11 testing is enabled])
if test "$HAVE_CXX11" = "1"; then
AC_MSG_RESULT([yes])
PLATCXXFLAGS="$CXXCPP $PLATCXXFLAGS"
else
AC_MSG_RESULT([no])
fi
fi
fi
fi
CXX=$CXX_SAVED
CXXCPP=$CXXCPP_SAVED
fi
AC_SUBST(HAVE_CXX11)
AC_SUBST(HAVE_CXX14)
AC_SUBST(HAVE_CXX17)
AC_SUBST(HAVE_CXX20)
# On darwin 10.7,10.8,10.9 using clang++, need to ensure using
# libc++ for tests and examples to run under mono. May affect
# other language targets as well - problem is a Mac OS X incompatibility
# between libraries depending on libstdc++ and libc++.
CLANGXX=
$CXX -v 2>&1 | grep -i clang >/dev/null && CLANGXX=yes
case $host in
*-*-darwin11* | *-*-darwin12* |*-*-darwin13* ) if test "$CLANGXX" = "yes";
then PLATCXXFLAGS="$PLATCXXFLAGS -stdlib=libc++"
fi;;
*) ;;
esac
AC_MSG_CHECKING(CXXFLAGS to use for testing (PLATCXXFLAGS))
PLATCXXFLAGS=$(echo $PLATCXXFLAGS | xargs) # Trim whitespace
AC_MSG_RESULT([$PLATCXXFLAGS])
# Check for compiler pre-compiled header support
AC_MSG_CHECKING([if compiler supports pre-compiled headers])
PCHSUPPORT=no
if test "$CLANGXX" = "yes"; then
PCHINCLUDEARG="-include-pch"
PCHINCLUDEEXT=".gch"
else
PCHINCLUDEARG="-include"
PCHINCLUDEEXT=""
fi
AC_LANG_PUSH([C++])
echo '#include <cstdlib>' > conftest.hpp
echo '#include "conftest.hpp"' > conftest.cpp
$CXX -c conftest.hpp 2>/dev/null
if test $? -eq 0; then
if test -f conftest.hpp.gch; then
$CXX -H -c -I. ${PCHINCLUDEARG} ./conftest.hpp${PCHINCLUDEEXT} -o conftest.o conftest.cpp >conftest.out 2>&1
if test $? -eq 0; then
if test "$CLANGXX" = "yes"; then
PCHSUPPORT=yes
elif grep -q '^!.*conftest.hpp.gch$' conftest.out; then
PCHSUPPORT=yes
fi
fi
fi
fi
rm -f conftest.hpp conftest.cpp conftest.out
AC_LANG_POP([C++])
AC_MSG_RESULT([$PCHSUPPORT])
AC_SUBST(PCHSUPPORT)
AC_SUBST(PCHINCLUDEARG)
AC_SUBST(PCHINCLUDEEXT)
# Set info about shared libraries.
AC_SUBST(SO)
AC_SUBST(LDSHARED)
AC_SUBST(CCSHARED)
AC_SUBST(CXXSHARED)
AC_SUBST(TRYLINKINGWITHCXX)
AC_SUBST(RPATH)
AC_SUBST(PLATCFLAGS)
AC_SUBST(PLATCXXFLAGS)
AC_SUBST(LINKFORSHARED)
# This variation is needed on OS-X because there is no (apparent) consistency in shared library naming.
# Sometimes .bundle works, but sometimes .so is needed. It depends on the target language
AC_SUBST(PYTHON_SO)
case $host in
*-*-mingw*) PYTHON_SO=.pyd;;
*-*-darwin*) PYTHON_SO=.so;;
*) PYTHON_SO=$SO;;
esac
AC_SUBST(TCL_SO)
case $host in
*-*-darwin*) TCL_SO=.dylib;;
*) TCL_SO=$SO;;
esac
AC_SUBST(GUILE_SO)
case $host in
*-*-darwin*) GUILE_SO=.so;;
*) GUILE_SO=$SO;;
esac
AC_SUBST(PHP_SO)
case $host in
*-*-darwin*) PHP_SO=.so;;
*) PHP_SO=$SO;;
esac
AC_SUBST(MZSCHEME_SO)
case $host in
*) MZSCHEME_SO=.so;;
esac
AC_SUBST(LUA_SO)
case $host in
*-*-darwin*) LUA_SO=.so;;
*) LUA_SO=$SO;;
esac
# Check for specific libraries. Used for SWIG examples
AC_CHECK_LIB(dl, dlopen) # Dynamic linking for SunOS/Solaris and SYSV
AC_CHECK_LIB(dld, shl_load) # Dynamic linking for HP-UX
dnl The following three libraries (nsl,inet,socket) are needed on Sequent,
dnl and must be checked for in this order since each library depends on the
dnl preceding one.
dnl
dnl Most SVR4 platforms will need -lsocket and -lnsl. However on SGI IRIX 5,
dnl these exist but are broken, so we use AC_SEARCH_LIBS which will only try
dnl the library if the function isn't already available without it.
AC_SEARCH_LIBS(t_open, nsl) # SVR4
AC_SEARCH_LIBS(gethostbyname, inet) # Sequent
AC_SEARCH_LIBS(socket, socket) # SVR4 sockets
# check for --with-libm=...
AC_SUBST(LIBM)
LIBM=-lm
AC_ARG_WITH(libm, [ --with-libm=STRING math library], [
if test "$withval" != yes
then LIBM=$withval
else AC_MSG_ERROR([proper usage is --with-libm=STRING])
fi])
AC_CHECK_LIB(ieee, main, [LIBM="-lieee $LIBM"])
AC_CHECK_LIB(crypt,crypt, [LIBCRYPT="-lcrypt"])
AC_SUBST(LIBCRYPT)
# check for --with-libc=...
AC_SUBST(LIBC)
AC_ARG_WITH(libc, [ --with-libc=STRING C library], [
if test "$withval" != yes
then LIBC=$withval
else AC_MSG_ERROR([proper usage is --with-libc=STRING])
fi])
#--------------------------------------------------------------------
# Target languages
#--------------------------------------------------------------------
AC_ARG_WITH(alllang, AS_HELP_STRING([--without-alllang], [Disable all languages]), with_alllang="$withval")
if test "$with_alllang" = "no"; then
alllang_default=no
else
alllang_default=yes
fi
AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
#----------------------------------------------------------------
# Look for Android
#----------------------------------------------------------------
AC_ARG_WITH(android, AS_HELP_STRING([--without-android], [Disable Android])
AS_HELP_STRING([--with-android=path], [Set location of android executable]),[ANDROIDBIN="$withval"], [ANDROIDBIN="$alllang_default"])
AC_ARG_WITH(adb, [ --with-adb=path Set location of adb executable - Android Debug Bridge],[ADBBIN="$withval"], [ADBBIN=])
AC_ARG_WITH(ant, [ --with-ant=path Set location of ant executable for Android],[ANTBIN="$withval"], [ANTBIN=])
AC_ARG_WITH(ndk-build, [ --with-ndk-build=path Set location of Android ndk-build executable],[NDKBUILDBIN="$withval"], [NDKBUILDBIN=])
# First, check for "--without-android" or "--with-android=no".
if test x"${ANDROIDBIN}" = xno; then
AC_MSG_NOTICE([Disabling Android])
ANDROID=
else
if test "x$ANDROIDBIN" = xyes; then
AC_CHECK_PROGS(ANDROID, android)
else
ANDROID="$ANDROIDBIN"
fi
if test -z "$ADBBIN"; then
AC_CHECK_PROGS(ADB, adb)
else
ADB="$ADBBIN"
fi
if test -z "$ANTBIN"; then
AC_CHECK_PROGS(ANT, ant)
else
ANT="$ANTBIN"
fi
if test -z "$NDKBUILDBIN"; then
AC_CHECK_PROGS(NDKBUILD, ndk-build)
else
NDKBUILD="$NDKBUILDBIN"
fi
fi
AC_SUBST(ANDROID)
AC_SUBST(ADB)
AC_SUBST(ANT)
AC_SUBST(NDKBUILD)
#----------------------------------------------------------------
# Look for C#
#----------------------------------------------------------------
AC_ARG_WITH(csharp, AS_HELP_STRING([--without-csharp], [Disable CSharp]), [with_csharp="$withval"], [with_csharp="$alllang_default"])
AC_ARG_WITH(cil-interpreter, [ --with-cil-interpreter=path Set location of CIL interpreter for CSharp],[CSHARPBIN="$withval"], [CSHARPBIN=])
AC_ARG_WITH(csharp-compiler, [ --with-csharp-compiler=path Set location of CSharp compiler],[CSHARPCOMPILERBIN="$withval"], [CSHARPCOMPILERBIN=])
# First, check for "--without-csharp" or "--with-csharp=no".
if test x"${with_csharp}" = xno; then
AC_MSG_NOTICE([Disabling CSharp])
CSHARPCOMPILER=
else
if test -z "$CSHARPCOMPILERBIN" ; then
case $host in
*-*-cygwin* | *-*-mingw*)
# prefer unified Mono mcs compiler (not to be confused with the ancient .NET 1 mcs) over older/alternative names.
AC_CHECK_PROGS(CSHARPCOMPILER, csc mcs mono-csc gmcs cscc)
if test -n "$CSHARPCOMPILER" && test "$CSHARPCOMPILER" = "csc" ; then
AC_MSG_CHECKING(whether csc is the Microsoft CSharp compiler)
csc 2>/dev/null | grep "C#" > /dev/null || CSHARPCOMPILER=""
if test -z "$CSHARPCOMPILER" ; then
AC_MSG_RESULT(no)
AC_CHECK_PROGS(CSHARPCOMPILER, mcs mono-csc gmcs cscc)
else
AC_MSG_RESULT(yes)
fi
fi
;;
*)AC_CHECK_PROGS(CSHARPCOMPILER, mono-csc gmcs mcs cscc);;
esac
else
CSHARPCOMPILER="$CSHARPCOMPILERBIN"
fi
CSHARPCONVERTPATH="Tools/convertpath -u"
if test -z "$CSHARPBIN" ; then
CSHARPCILINTERPRETER=""
CSHARPCILINTERPRETER_FLAGS=""
if test "cscc" = "$CSHARPCOMPILER" ; then
AC_CHECK_PROGS(CSHARPCILINTERPRETER, ilrun)
else
if test "mcs" = "$CSHARPCOMPILER"; then
# Check that mcs is the C# compiler and not the Unix mcs utility by examining the output of 'mcs --version'
# The Mono compiler should emit: Mono C# compiler version a.b.c.d
csharp_version_raw=`(mcs --version) 2>/dev/null`
csharp_version_searched=`(mcs --version | sed -e "/C#/b" -e "/Mono/b" -e d) 2>/dev/null` # return string if contains 'Mono' or 'C#'
CSHARPCOMPILER=""
if test -n "$csharp_version_raw" ; then
if test "$csharp_version_raw" = "$csharp_version_searched" ; then
CSHARPCOMPILER="mcs"
fi
fi
if test "mcs" != "$CSHARPCOMPILER" ; then
echo "mcs is not a working Mono C# compiler"
fi
fi
if test "mcs" = "$CSHARPCOMPILER" || test "gmcs" = "$CSHARPCOMPILER" || test "mono-csc" = "$CSHARPCOMPILER"; then
AC_CHECK_PROGS(CSHARPCILINTERPRETER, mono) # Mono JIT
CSHARPCILINTERPRETER_FLAGS="--debug"
else
if test "csc" = "$CSHARPCOMPILER"; then
CSHARPCONVERTPATH="Tools/convertpath -w"
fi
fi
fi
else
CSHARPCILINTERPRETER="$CSHARPBIN"
fi
# Cygwin requires the Windows standard (Pascal) calling convention as it is a Windows executable and not a Cygwin built executable
case $host in
*-*-cygwin* | *-*-mingw*)
if test "$GCC" = yes; then
CSHARPDYNAMICLINKING="$GCC_MNO_CYGWIN -mthreads -Wl,--add-stdcall-alias"
CSHARPCFLAGS="$GCC_MNO_CYGWIN -mthreads"
else
CSHARPDYNAMICLINKING=""
CSHARPCFLAGS=""
fi ;;
*)
CSHARPDYNAMICLINKING=""
CSHARPCFLAGS=""
;;
esac
# CSharp on Windows platforms including Cygwin doesn't use libname.dll, rather name.dll when loading dlls
case $host in
*-*-cygwin* | *-*-mingw*) CSHARPLIBRARYPREFIX="";;
*)CSHARPLIBRARYPREFIX="lib";;
esac
# C#/Mono on Mac OS X tweaks
case $host in
*-*-darwin*)
CSHARPSO=".so"
;;
*)
CSHARPSO=$SO
;;
esac
fi
AC_SUBST(CSHARPCILINTERPRETER_FLAGS)
AC_SUBST(CSHARPCILINTERPRETER)
AC_SUBST(CSHARPCONVERTPATH)
AC_SUBST(CSHARPCOMPILER)
AC_SUBST(CSHARPDYNAMICLINKING)
AC_SUBST(CSHARPLIBRARYPREFIX)
AC_SUBST(CSHARPCFLAGS)
AC_SUBST(CSHARPSO)
#----------------------------------------------------------------
# Look for D
#----------------------------------------------------------------
AC_ARG_WITH(d, AS_HELP_STRING([--without-d], [Disable D]), [with_d="$withval"], [with_d="$alllang_default"])
AC_ARG_WITH(d2-compiler, [ --with-d2-compiler=path Set location of D2 compiler (DMD compatible)],[D2COMPILERBIN="$withval"], [D2COMPILERBIN=])
# First, check for "--without-d" or "--with-d=no".
if test x"${with_d}" = xno; then
AC_MSG_NOTICE([Disabling D])
D2COMPILER=
else
if test -z "$D2COMPILERBIN" ; then
AC_CHECK_PROGS(D2COMPILER, dmd ldmd2 ldc2 gdmd)
if test -n "$D2COMPILER" ; then
old_ac_ext=$ac_ext
ac_ext=d
AC_MSG_CHECKING(whether the D2 compiler works)
cat > conftest.$ac_ext <<_ACEOF
import std.algorithm;
void main() {
}
_ACEOF
rm -f conftest.out
AS_IF(
[$D2COMPILER conftest.$ac_ext -ofconftest.out 2>&AS_MESSAGE_LOG_FD && test ! -s conftest.err && test -s conftest.out],
[AC_MSG_RESULT([yes])],
[_AC_MSG_LOG_CONFTEST AC_MSG_RESULT([no])
D2COMPILER=]
)
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext conftest.out
ac_ext=$old_ac_ext
fi
else
D2COMPILER="$D2COMPILERBIN"
fi
fi
# Do not prefix library file names with "lib" on Windows.
case $host in
*-*-cygwin* | *-*-mingw*) DLIBPREFIX="";;
*)DLIBPREFIX="lib";;
esac
AC_SUBST(D2COMPILER)
AC_SUBST(DLIBPREFIX)
#----------------------------------------------------------------
# Look for Go compilers
#----------------------------------------------------------------
AC_ARG_WITH(go, AS_HELP_STRING([--without-go], [Disable Go])
AS_HELP_STRING([--with-go=path], [Set location of Go compiler]),[GOBIN="$withval"], [GOBIN="$alllang_default"])
if test x"${GOBIN}" = xno; then
AC_MSG_NOTICE([Disabling Go])
GO=
GOGCC=false
GCCGO=
GOOPT=
GCCGOOPT=
GOVERSIONOPTION=
else
if test "x$GOBIN" = xyes; then
AC_CHECK_PROGS(GO, go)
else
GO="$GOBIN"
fi
GOGCC=false
GCCGO=
GOOPT=
GCCGOOPT=
GOVERSIONOPTION=
if test -n "$GO" ; then
GOVERSIONOPTION=version
go_version=$($GO $GOVERSIONOPTION | sed -e 's/go version //')
AC_MSG_CHECKING([whether go version is too old])
case $go_version in
go1.[012]*)
AC_MSG_RESULT([yes - minimum version is 1.3])
GO=
;;
*)
AC_MSG_RESULT([no])
;;
esac
fi
AC_CHECK_PROGS(GCCGO, gccgo)
if test -n "$GCCGO" ; then
if $GCCGO --help 2>/dev/null | grep gccgo >/dev/null 2>&1 ; then
AC_MSG_CHECKING([whether gccgo version is too old])
go_version=[`$GO $GOVERSIONOPTION | sed -n '1p' | sed -e 's/^.* \([0-9.]*\) *$/\1/' -e 's/[.]//g'`]
if test "x$go_version" = x; then
AC_MSG_RESULT([could not determine gccgo version])
GCCGO=
elif test "$go_version" -lt 470; then
AC_MSG_RESULT([yes - minimum version is 4.7.0])
GCCGO=
else
AC_MSG_RESULT([no])
if test "$go_version" -lt 480; then
GCCGOOPT="-intgosize 32"
fi
fi
fi
fi
fi
AC_SUBST(GOGCC)
AC_SUBST(GCCGO)
AC_SUBST(GO)
AC_SUBST(GOC)
AC_SUBST(GO1)
AC_SUBST(GO12)
AC_SUBST(GO13)
AC_SUBST(GO15)
AC_SUBST(GOOPT)
AC_SUBST(GCCGOOPT)
AC_SUBST(GOVERSIONOPTION)
#----------------------------------------------------------------
# Look for Guile
#----------------------------------------------------------------
GUILE=
GUILE_CFLAGS=
GUILE_LIBS=
AC_ARG_WITH(guile-config, AS_HELP_STRING([--without-guile], [Disable Guile])
AS_HELP_STRING([--with-guile-config=path], [Set location of guile-config]),[ GUILE_CONFIG="$withval"], [GUILE_CONFIG=])
AC_ARG_WITH(guile,[ --with-guile=path Set location of Guile executable],[
GUILE="$withval"], [GUILE="$alllang_default"])
AC_ARG_WITH(guile-cflags,[ --with-guile-cflags=cflags Set cflags required to compile against Guile],[
GUILE_CFLAGS="$withval"])
AC_ARG_WITH(guile-libs,[ --with-guile-libs=ldflags Set ldflags needed to link with Guile],[
GUILE_LIBS="$withval"])
# First, check for "--without-guile" or "--with-guile=no".
if test x"${GUILE}" = xno; then
AC_MSG_NOTICE([Disabling Guile])
else
if test -z "$GUILE_CONFIG" ; then
AC_PATH_PROG(GUILE_CONFIG, guile-config)
fi
if test -n "$GUILE_CONFIG" ; then
if test x"$GUILE" = xyes; then
AC_MSG_CHECKING([for guile executable])
# Try extracting it via guile-config first. If it's defined there it's the most reliable result
GUILE="`$GUILE_CONFIG info guile 2>/dev/null`"
if test -n "$GUILE"; then
AC_MSG_RESULT([$GUILE])
else
AC_MSG_RESULT([not found via guile-config - constructing path])
AC_MSG_CHECKING([for guile bindir])
guile_bindir="`$GUILE_CONFIG info bindir`"
AC_MSG_RESULT([$guile_bindir])
GUILE="$guile_bindir/guile"
fi
if ! test -f "$GUILE" ; then
GUILE=
AC_PATH_PROG(GUILE, guile)
fi
if test -z "$GUILE" ; then
AC_MSG_WARN([no suitable guile executable found. Disabling Guile])
fi
fi
if test -n "$GUILE" ; then
AC_MSG_CHECKING([for guile version])
guile_version=`$GUILE -c '(display (effective-version))'`
AC_MSG_RESULT([$guile_version])
AC_MSG_CHECKING([for guile version >= 1.8])
guile_good_version=`$GUILE -c '(if (>= (string->number (effective-version)) 1.8) (display "yes") (display "no"))'`
AC_MSG_RESULT([$guile_good_version])
if test x"$guile_good_version" != xyes ; then
AC_MSG_WARN([at least guile version 1.8 is required. Disabling Guile])
GUILE=
fi
fi
if test -n "$GUILE" ; then
# Test if guile-config and guile versions match. They should.
gc_version="`$GUILE_CONFIG --version 2>&1 | sed '1 s/.* //;q'`"
g_version="`$GUILE --version | sed '1 s/.* //;q'`"
if test "$gc_version" != "$g_version"; then
AC_MSG_WARN([different versions reported by $GUILE_CONFIG ($gc_version) and $GUILE ($g_version). Disabling Guile])
GUILE=
fi
fi
if test -n "$GUILE" ; then
if test -z "$GUILE_CFLAGS" ; then
AC_MSG_CHECKING([for guile compile flags])
GUILE_CFLAGS="`$GUILE_CONFIG compile`" # Note that this can sometimes be empty
AC_MSG_RESULT([$GUILE_CFLAGS])
fi
if test -z "$GUILE_LIBS" ; then
AC_MSG_CHECKING([for guile link flags])
GUILE_LIBS="`$GUILE_CONFIG link`"
AC_MSG_RESULT([$GUILE_LIBS])
fi
fi
fi
fi
AC_SUBST(GUILE)
AC_SUBST(GUILE_CFLAGS)
AC_SUBST(GUILE_LIBS)
#----------------------------------------------------------------
# Look for java
#----------------------------------------------------------------
AC_ARG_WITH(java, AS_HELP_STRING([--without-java], [Disable Java])
AS_HELP_STRING([--with-java=path], [Set location of java executable]),[JAVABIN="$withval"], [JAVABIN="$alllang_default"])
AC_ARG_WITH(javac, [ --with-javac=path Set location of javac executable],[JAVACBIN="$withval"], [JAVACBIN=])
# First, check for "--without-java" or "--with-java=no".
if test x"${JAVABIN}" = xno; then
AC_MSG_NOTICE([Disabling Java])
JAVA=
else
dnl Detect everything we need for Java: java for running Java tests, javac for
dnl compiling them and C headers for compiling C code.
dnl
dnl If JAVA_HOME is defined and contains everything needed, as it's supposed to,
dnl just use it. Otherwise try to locate the necessary files in the path.
case $host in
*-*-cygwin*)
dnl Ensure that JAVA_HOME is in the form we can use, it's typically set to Windows path by the installer.
if test -n "$JAVA_HOME"; then
JAVA_HOME=`cygpath --mixed "$JAVA_HOME"`
fi
dnl Java uses semicolons and not colons as separators in its classes search path under Windows.
JAVA_CLASSPATH_SEP=";"
;;
*-*-mingw*)
if test -n "$JAVA_HOME"; then
JAVA_HOME=`${srcdir}/Tools/convertpath -u "$JAVA_HOME"`
fi
JAVA_CLASSPATH_SEP=";"
;;
*-*-darwin*)
dnl Under OS X JAVA_HOME is not set by default, try to use the system default JRE.
if test -z "$JAVA_HOME" -a -x /usr/libexec/java_home; then
JAVA_HOME=`/usr/libexec/java_home`
fi
dnl The JAVA_HOME doesn't contain the JDK headers though, but they seem to
dnl always be in the same location, according to Apple JNI documentation.
JAVA_OSX_STD_INCDIR="/System/Library/Frameworks/JavaVM.framework/Headers"
if test -r "$JAVA_OSX_STD_INCDIR/jni.h"; then
JAVA_HOME_INCDIR=$JAVA_OSX_STD_INCDIR
fi
JAVA_CLASSPATH_SEP=":"
;;
*)
dnl Assume generic Unix.
JAVA_CLASSPATH_SEP=":"
;;
esac
AC_MSG_CHECKING(for java JDK)
if test -n "$JAVA_HOME"; then
dnl Don't complain about missing executables/headers if they had been
dnl explicitly overridden from the command line, but otherwise verify that we
dnl have everything we need.
java_home_ok=1
if test -z "$JAVABIN" -a ! -x "$JAVA_HOME/bin/java"; then
AC_MSG_WARN([No java executable under JAVA_HOME.])
java_home_ok=0
fi
if test -z "$JAVACBIN" -a ! -x "$JAVA_HOME/bin/javac"; then
AC_MSG_WARN([No javac executable under JAVA_HOME.])
java_home_ok=0
fi
dnl By default the headers are under JAVA_HOME/include, but OS X is special
dnl and defines JAVA_HOME_INCDIR differently above.
if test -z "$JAVA_HOME_INCDIR"; then
JAVA_HOME_INCDIR="$JAVA_HOME/include"
fi
if test -z "$JAVAINCDIR" -a ! -r "$JAVA_HOME_INCDIR/jni.h"; then
AC_MSG_WARN([No java headers under JAVA_HOME (does it point to a JDK and not just JRE?).])
java_home_ok=0
fi
if test "$java_home_ok" = 1; then
AC_MSG_RESULT([found (in $JAVA_HOME)])
else
AC_MSG_RESULT(no)
AC_MSG_WARN([JAVA_HOME ($JAVA_HOME) is defined but does not point to a complete JDK installation, ignoring it.])
JAVA_HOME=
fi
else
AC_MSG_RESULT([no (JAVA_HOME is not defined)])
fi
if test "x$JAVABIN" = xyes; then
if test -n "$JAVA_HOME"; then
JAVA="$JAVA_HOME/bin/java"
else
AC_CHECK_PROGS(JAVA, java kaffe guavac)
fi
else
JAVA="$JAVABIN"
fi
if test -z "$JAVACBIN"; then
if test -n "$JAVA_HOME"; then
JAVAC="$JAVA_HOME/bin/javac"
else
AC_CHECK_PROGS(JAVAC, javac)
fi
else
JAVAC="$JAVACBIN"
fi
# Check Java version: we require Java 9 or later for Doxygen tests.
if test -n "$JAVAC"; then
AC_MSG_CHECKING(if java version is 9 or greater)
javac_version=`"$JAVAC" -version 2>&1`
java_version_num=`echo $javac_version | sed -n 's/^javac //p'`
if test -z "$java_version_num"; then
AC_MSG_WARN([unknown format for Java version returned by "$JAVAC" ($javac_version)])
JAVA_SKIP_DOXYGEN_TEST_CASES=1
AC_MSG_RESULT(unknown)
else