-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
2485 lines (2145 loc) · 73.2 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],[2.0.10],[http://www.swig.org])
dnl NB: When this requirement is increased to 2.60 or later, AC_PROG_SED
dnl definition below can be removed
AC_PREREQ(2.58)
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([
/* Default language */
#define SWIG_LANG "-tcl"
/* Deal with Microsofts attempt at deprecating 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
AC_EXEEXT
AC_OBJEXT
AM_PROG_CC_C_O # Needed for subdir-objects in AUTOMAKE_OPTIONS
AC_COMPILE_WARNINGS # Increase warning levels
AC_DEFINE_UNQUOTED(SWIG_CXX, ["$CXX"], [Compiler that built SWIG])
AC_DEFINE_UNQUOTED(SWIG_PLATFORM, ["$host"], [Platform that SWIG is built for])
dnl Checks for header files.
AC_HEADER_STDC
dnl Checks for types.
AC_LANG_PUSH([C++])
AC_CHECK_TYPES([bool])
AC_LANG_POP([C++])
dnl Look for popen
AC_ARG_WITH(popen, AS_HELP_STRING([--without-popen], [Disable popen]), with_popen="$withval")
if test x"${with_popen}" = xno ; then
AC_MSG_NOTICE([Disabling popen])
else
AC_CHECK_FUNC(popen, AC_DEFINE(HAVE_POPEN, 1, [Define if popen is available]), AC_MSG_NOTICE([Disabling popen]))
fi
dnl PCRE
dnl AX_PATH_GENERIC() relies on AC_PROG_SED() but it is defined only in
dnl autoconf 2.60 so trivially predefine it ourselves for the older versions
m4_ifdef([AC_PROG_SED],, [AC_DEFUN([AC_PROG_SED], [AC_PATH_PROG([SED], sed)])])
AC_ARG_WITH([pcre],
[AS_HELP_STRING([--without-pcre],
[Disable support for regular expressions using PCRE])],
[],
[with_pcre=yes])
AC_MSG_CHECKING([whether to enable PCRE 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 PCRE])
local_pcre_config=no
if test -z $PCRE_CONFIG; then
if test -f `pwd`/pcre/pcre-swig-install/bin/pcre-config; then
PCRE_CONFIG=`pwd`/pcre/pcre-swig-install/bin/pcre-config
local_pcre_config=$PCRE_CONFIG
fi
fi
AC_MSG_RESULT([$local_pcre_config])
fi
AS_IF([test "x$with_pcre" != xno],
[AX_PATH_GENERIC([pcre],
[], 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 PCRE library])
LIBS="$LIBS $PCRE_LIBS"
CPPFLAGS="$CPPFLAGS $PCRE_CFLAGS"
],
[AC_MSG_FAILURE([
Cannot find pcre-config script from PCRE (Perl Compatible Regular Expressions)
library package. This dependency is needed for configure to complete,
Either:
- Install the PCRE developer package on your system (preferred approach).
- Download the PCRE 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 PCRE just for SWIG to statically
link against. Run 'Tools/pcre-build.sh --help' for instructions.
(quite easy and does not require privileges to install PCRE on your system)
- Use configure --without-pcre to disable regular expressions support in SWIG
(not recommended).])
])
])
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_PROG_YACC
AC_PROG_RANLIB
AC_CHECK_PROGS(AR, ar aal, ar)
AC_SUBST(AR)
AC_CHECK_PROGS(YODL2MAN, yodl2man)
AC_CHECK_PROGS(YODL2HTML, yodl2html)
if test -n "$YODL2MAN"; then
AC_MSG_CHECKING([yodl2man version >= 2.02])
yodl_version=`$YODL2MAN --version 2>&1 | grep 'yodl version' | sed 's/.*\([0-9][0-9]*\.[0-9][0-9]*\.*[0-9]*\).*/\1/g'`
AX_COMPARE_VERSION([$yodl_version],[ge],[2.02], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no - $yodl_version found])])
fi
if test -n "$YODL2HTML"; then
AC_MSG_CHECKING([yodl2html version >= 2.02])
yodl_version=`$YODL2HTML --version 2>&1 | grep 'yodl version' | sed 's/.*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*/\1/g'`
AX_COMPARE_VERSION([$yodl_version],[ge],[2.02], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no - $yodl_version found])])
fi
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 How to specify include directories that may be system directories.
# -I should not be used on system directories (GCC)
if test "$GCC" = yes; then
ISYSTEM="-isystem "
else
ISYSTEM="-I"
fi
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="\$(srcdir)/ld_so_aix \$(CC)";;
*-*-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="gcc -shared";;
*-*-dgux*) LDSHARED="ld -G";;
*-*-freebsd3*) LDSHARED="gcc -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;;
*-*-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
# the 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(PLATFLAGS)
case $host in
*-*-solaris*) if test "$GCC" = yes;
then PLATFLAGS=
else PLATFLAGS=
# else PLATFLAGS="-errtags=yes" # Need more work as C examples use ld for linking
fi;;
*) PLATFLAGS=
esac
AC_MSG_RESULT($PLATFLAGS)
# 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(PLATFLAGS)
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
AC_CHECK_LIB(swill, swill_init, [SWIGLIBS="-lswill $LIBS" SWILL="-DSWIG_SWILL"])
AC_SUBST(SWIGLIBS)
AC_SUBST(SWILL)
# 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])
#--------------------------------------------------------------------
# Locate the X11 header files and the X11 library archive. Try
# the ac_path_x macro first, but if it doesn't find the X stuff
# (e.g. because there's no xmkmf program) then check through
# a list of possible directories. Under some conditions the
# autoconf macro will return an include directory that contains
# no include files, so double-check its result just to be safe.
#--------------------------------------------------------------------
AC_PATH_X
not_really_there=""
if test "$no_x" = ""; then
if test "$x_includes" = ""; then
AC_TRY_CPP([#include <X11/XIntrinsic.h>], , not_really_there="yes")
else
if test ! -r $x_includes/X11/Intrinsic.h; then
not_really_there="yes"
fi
fi
fi
if test "$no_x" = "yes" -o "$not_really_there" = "yes"; then
AC_MSG_CHECKING(for X11 header files)
XINCLUDES="# no special path needed"
AC_TRY_CPP([#include <X11/Intrinsic.h>], , XINCLUDES="")
if test -z "$XINCLUDES"; then
dirs="/usr/unsupported/include /usr/local/include /usr/X386/include /usr/include/X11R4 /usr/X11R5/include /usr/include/X11R5 /usr/openwin/include /usr/X11/include /usr/sww/include /usr/X11R6/include /usr/include/X11R6"
for i in $dirs ; do
if test -r $i/X11/Intrinsic.h; then
XINCLUDES=" -I$i"
break
fi
done
fi
AC_MSG_RESULT($XINCLUDES)
else
if test "$x_includes" != ""; then
XINCLUDES=-I$x_includes
else
XINCLUDES="# no special path needed"
fi
fi
if test -z "$XINCLUDES"; then
AC_MSG_RESULT(couldn't find any!)
XINCLUDES="# no include files found"
fi
if test "$no_x" = yes; then
AC_MSG_CHECKING(for X11 libraries)
XLIBSW=
dirs="/usr/unsupported/lib /usr/local/lib /usr/X386/lib /usr/lib/X11R4 /usr/X11R5/lib /usr/lib/X11R5 /usr/X11R6/lib /usr/lib/X11R6 /usr/openwin/lib /usr/X11/lib /usr/sww/X11/lib"
for i in $dirs ; do
if test -r $i/libX11.a -o -r $i/libX11.so -o -r $i/libX11.sl; then
AC_MSG_RESULT($i)
XLIBSW="-L$i -lX11"
break
fi
done
else
if test "$x_libraries" = ""; then
XLIBSW=-lX11
else
XLIBSW="-L$x_libraries -lX11"
fi
fi
if test -z "$XLIBSW" ; then
AC_CHECK_LIB(Xwindow, XCreateWindow, XLIBSW=-lXwindow)
fi
if test -z "$XLIBSW" ; then
AC_MSG_RESULT(couldn't find any! Using -lX11.)
XLIBSW=-lX11
fi
AC_SUBST(XINCLUDES)
AC_SUBST(XLIBSW)
AC_ARG_WITH(alllang, AS_HELP_STRING([--without-alllang], [Disable all languages]), with_alllang="$withval")
#--------------------------------------------------------------------
# Look for Tcl
#--------------------------------------------------------------------
TCLINCLUDE=
TCLLIB=
TCLPACKAGE=
AC_ARG_WITH(tclconfig, AS_HELP_STRING([--without-tcl], [Disable Tcl])
AS_HELP_STRING([--with-tclconfig=path], [Set location of tclConfig.sh]), [with_tclconfig="$withval"], [with_tclconfig=])
AC_ARG_WITH(tcl,
[ --with-tcl=path Set location of Tcl package],[
TCLPACKAGE="$withval"], [TCLPACKAGE=yes])
AC_ARG_WITH(tclincl,[ --with-tclincl=path Set location of Tcl include directory],[
TCLINCLUDE="$ISYSTEM$withval"], [TCLINCLUDE=])
AC_ARG_WITH(tcllib,[ --with-tcllib=path Set location of Tcl library directory],[
TCLLIB="-L$withval"], [TCLLIB=])
# First, check for "--without-tcl" or "--with-tcl=no".
if test x"${TCLPACKAGE}" = xno -o x"${with_alllang}" = xno; then
AC_MSG_NOTICE([Disabling Tcl])
else
AC_MSG_CHECKING([for Tcl configuration])
# First check to see if --with-tclconfig was specified.
if test x"${with_tclconfig}" != x ; then
if test -f "${with_tclconfig}/tclConfig.sh" ; then
TCLCONFIG=`(cd ${with_tclconfig}; pwd)`
else
AC_MSG_ERROR([${with_tcl} directory doesn't contain tclConfig.sh])
fi
fi
# check in a few common install locations
if test x"${TCLCONFIG}" = x ; then
for i in `ls -d /usr/lib/ 2>/dev/null` \
`ls -d -r /usr/lib/tcl*/ 2>/dev/null` \
`ls -d /usr/local/lib/ 2>/dev/null` \
`ls -d -r /usr/local/lib/tcl*/ 2>/dev/null` ; do
if test -f $i"tclConfig.sh" ; then
TCLCONFIG=`(cd $i; pwd)`
break
fi
done
fi
if test x"${TCLCONFIG}" = x ; then
AC_MSG_RESULT(no)
else
AC_MSG_RESULT(found $TCLCONFIG/tclConfig.sh)
. $TCLCONFIG/tclConfig.sh
if test -z "$TCLINCLUDE"; then
TCLINCLUDE=`echo $TCL_INCLUDE_SPEC | sed "s/-I/$ISYSTEM/"`
fi
if test -z "$TCLLIB"; then
TCLLIB=$TCL_LIB_SPEC
fi
fi
if test -z "$TCLINCLUDE"; then
if test "x$TCLPACKAGE" != xyes; then
TCLINCLUDE="$ISYSTEM$TCLPACKAGE/include"
fi
fi
if test -z "$TCLLIB"; then
if test "x$TCLPACKAGE" != xyes; then
TCLLIB="-L$TCLPACKAGE/lib -ltcl"
fi
fi
AC_MSG_CHECKING(for Tcl header files)
if test -z "$TCLINCLUDE"; then
AC_TRY_CPP([#include <tcl.h>], , TCLINCLUDE="")
if test -z "$TCLINCLUDE"; then
dirs="/usr/local/include /usr/include /opt/local/include"
for i in $dirs ; do
if test -r $i/tcl.h; then
AC_MSG_RESULT($i)
TCLINCLUDE="$ISYSTEM$i"
break
fi
done
fi
if test -z "$TCLINCLUDE"; then
AC_MSG_RESULT(not found)
fi
else
AC_MSG_RESULT($TCLINCLUDE)
fi
AC_MSG_CHECKING(for Tcl library)
if test -z "$TCLLIB"; then
dirs="/usr/local/lib /usr/lib /opt/local/lib"
for i in $dirs ; do
if test -r $i/libtcl.a; then
AC_MSG_RESULT($i)
TCLLIB="-L$i -ltcl"
break
fi
done
if test -z "$TCLLIB"; then
AC_MSG_RESULT(not found)
fi
else
AC_MSG_RESULT($TCLLIB)
fi
# Cygwin (Windows) needs the library for dynamic linking
case $host in
*-*-cygwin* | *-*-mingw*) TCLDYNAMICLINKING="$TCLLIB";;
*)TCLDYNAMICLINKING="";;
esac
case $host in
*-*-darwin*)
TCLLDSHARED='$(CC) -dynamiclib -undefined suppress -flat_namespace'
TCLCXXSHARED='$(CXX) -dynamiclib -undefined suppress -flat_namespace'
;;
*)
TCLLDSHARED='$(LDSHARED)'
TCLCXXSHARED='$(CXXSHARED)'
;;
esac
fi
AC_SUBST(TCLINCLUDE)
AC_SUBST(TCLLIB)
AC_SUBST(TCLDYNAMICLINKING)
AC_SUBST(TCLLDSHARED)
AC_SUBST(TCLCXXSHARED)
#----------------------------------------------------------------
# Look for Python
#----------------------------------------------------------------
PYINCLUDE=
PYLIB=
PYPACKAGE=
AC_ARG_WITH(python, AS_HELP_STRING([--without-python], [Disable Python])
AS_HELP_STRING([--with-python=path], [Set location of Python executable]),[ PYBIN="$withval"], [PYBIN=yes])
# First, check for "--without-python" or "--with-python=no".
if test x"${PYBIN}" = xno -o x"${with_alllang}" = xno ; then
AC_MSG_NOTICE([Disabling Python])
else
# First figure out the name of the Python executable
if test "x$PYBIN" = xyes; then
AC_CHECK_PROGS(PYTHON, [python python2.8 python2.7 python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0 python1.6 python1.5 python1.4])
else
PYTHON="$PYBIN"
fi
if test -n "$PYTHON"; then
AC_MSG_CHECKING(for Python prefix)
PYPREFIX=`($PYTHON -c "import sys; print sys.prefix") 2>/dev/null`
AC_MSG_RESULT($PYPREFIX)
AC_MSG_CHECKING(for Python exec-prefix)
PYEPREFIX=`($PYTHON -c "import sys; print sys.exec_prefix") 2>/dev/null`
AC_MSG_RESULT($PYEPREFIX)
# Note: I could not think of a standard way to get the version string from different versions.
# This trick pulls it out of the file location for a standard library file.
AC_MSG_CHECKING(for Python version)
# Need to do this hack since autoconf replaces __file__ with the name of the configure file
filehack="file__"
PYVERSION=`($PYTHON -c "import string,operator,os.path; print operator.getitem(os.path.split(operator.getitem(os.path.split(string.__$filehack),0)),1)")`
AC_MSG_RESULT($PYVERSION)
# Find the directory for libraries this is necessary to deal with
# platforms that can have apps built for multiple archs: e.g. x86_64
AC_MSG_CHECKING(for Python lib dir)
PYLIBDIR=`($PYTHON -c "import sys; print sys.lib") 2>/dev/null`
if test -z "$PYLIBDIR"; then
# older versions don't have sys.lib so the best we can do is assume lib
PYLIBDIR="lib"
fi
AC_MSG_RESULT($PYLIBDIR)
# Set the include directory
AC_MSG_CHECKING(for Python header files)
if test -r $PYPREFIX/include/$PYVERSION/Python.h; then
PYINCLUDE="-I$PYPREFIX/include/$PYVERSION -I$PYEPREFIX/$PYLIBDIR/$PYVERSION/config"
fi
if test -z "$PYINCLUDE"; then
if test -r $PYPREFIX/include/Py/Python.h; then
PYINCLUDE="-I$PYPREFIX/include/Py -I$PYEPREFIX/$PYLIBDIR/python/lib"
fi
fi
AC_MSG_RESULT($PYINCLUDE)
# Set the library directory blindly. This probably won't work with older versions
AC_MSG_CHECKING(for Python library)
dirs="$PYVERSION/config $PYVERSION/$PYLIBDIR python/$PYLIBDIR"
for i in $dirs; do
if test -d $PYEPREFIX/$PYLIBDIR/$i; then
PYLIB="$PYEPREFIX/$PYLIBDIR/$i"
break
fi
done
if test -z "$PYLIB"; then
AC_MSG_RESULT(Not found)
else
AC_MSG_RESULT($PYLIB)
fi
# Check for really old versions
if test -r $PYLIB/libPython.a; then
PYLINK="-lModules -lPython -lObjects -lParser"
else
PYLINK="-l$PYVERSION"
fi
fi
# Cygwin (Windows) needs the library for dynamic linking
case $host in
*-*-cygwin* | *-*-mingw*) PYTHONDYNAMICLINKING="-L$PYLIB $PYLINK"
DEFS="-DUSE_DL_IMPORT $DEFS" PYINCLUDE="$PYINCLUDE"
;;
*)PYTHONDYNAMICLINKING="";;
esac
fi
AC_SUBST(PYINCLUDE)
AC_SUBST(PYLIB)
AC_SUBST(PYLINK)
AC_SUBST(PYTHONDYNAMICLINKING)
#----------------------------------------------------------------
# Look for Python 3.x
#----------------------------------------------------------------
# mostly copy & pasted from "Look for Python" section,
# did some trim, fix and rename
PY3INCLUDE=
PY3LIB=
PY3PACKAGE=
AC_ARG_WITH(python3, AS_HELP_STRING([--without-python3], [Disable Python 3.x support])
AS_HELP_STRING([--with-python3=path], [Set location of Python 3.x executable]),[ PY3BIN="$withval"], [PY3BIN=yes])
# First, check for "--without-python3" or "--with-python3=no".
if test x"${PY3BIN}" = xno -o x"${with_alllang}" = xno ; then
AC_MSG_NOTICE([Disabling Python 3.x support])
else
for py_ver in 3 3.6 3.5 3.4 3.3 3.2 3.1 3.0; do
AC_CHECK_PROGS(PYTHON3, [python$py_ver])
if test -n "$PYTHON3"; then
AC_CHECK_PROGS(PY3CONFIG, [$PYTHON3-config])
if test -n "$PY3CONFIG"; then
break
fi
fi
done
if test -n "$PYTHON3" -a -n "$PY3CONFIG"; then
AC_MSG_CHECKING([for Python 3.x prefix])
PY3PREFIX=`($PY3CONFIG --prefix) 2>/dev/null`
AC_MSG_RESULT($PY3PREFIX)
AC_MSG_CHECKING(for Python 3.x exec-prefix)
PY3EPREFIX=`($PY3CONFIG --exec-prefix) 2>/dev/null`
AC_MSG_RESULT($PY3EPREFIX)
# Note: I could not think of a standard way to get the version string from different versions.
# This trick pulls it out of the file location for a standard library file.
AC_MSG_CHECKING([for Python 3.x version])
# Need to do this hack since autoconf replaces __file__ with the name of the configure file
filehack="file__"
PY3VERSION=`($PYTHON3 -c "import string,operator,os.path; print(operator.getitem(os.path.split(operator.getitem(os.path.split(string.__$filehack),0)),1))")`
AC_MSG_RESULT($PY3VERSION)
# Find the directory for libraries this is necessary to deal with
# platforms that can have apps built for multiple archs: e.g. x86_64
AC_MSG_CHECKING([for Python 3.x lib dir])
PY3LIBDIR=`($PYTHON3 -c "import sys; print(sys.lib)") 2>/dev/null`
if test -z "$PY3LIBDIR"; then
# some dists don't have sys.lib so the best we can do is assume lib
PY3LIBDIR="lib"
fi
AC_MSG_RESULT($PY3LIBDIR)
# Set the include directory
AC_MSG_CHECKING([for Python 3.x header files])
PY3INCLUDE=`($PY3CONFIG --includes) 2>/dev/null`
AC_MSG_RESULT($PY3INCLUDE)
# Set the library directory blindly. This probably won't work with older versions
AC_MSG_CHECKING([for Python 3.x library])
dirs="$PY3VERSION/config $PY3VERSION/$PY3LIBDIR python/$PY3LIBDIR"
for i in $dirs; do
if test -d $PY3EPREFIX/$PY3LIBDIR/$i; then
PY3LIB="$PY3EPREFIX/$PY3LIBDIR/$i"
break
fi
done
if test -z "$PY3LIB"; then
AC_MSG_RESULT([Not found])
else
AC_MSG_RESULT($PY3LIB)
fi
PY3LINK="-l$PY3VERSION"
fi
# Cygwin (Windows) needs the library for dynamic linking
case $host in
*-*-cygwin* | *-*-mingw*) PYTHON3DYNAMICLINKING="-L$PYLIB $PY3LINK"
DEFS="-DUSE_DL_IMPORT $DEFS" PY3INCLUDE="$PY3INCLUDE"
;;
*)PYTHON3DYNAMICLINKING="";;
esac
fi
AC_SUBST(PY3INCLUDE)
AC_SUBST(PY3LIB)
AC_SUBST(PY3LINK)
AC_SUBST(PYTHON3DYNAMICLINKING)
#----------------------------------------------------------------
# Look for Perl5
#----------------------------------------------------------------
PERLBIN=
AC_ARG_WITH(perl5, AS_HELP_STRING([--without-perl5], [Disable Perl5])
AS_HELP_STRING([--with-perl5=path], [Set location of Perl5 executable]),[ PERLBIN="$withval"], [PERLBIN=yes])
# First, check for "--without-perl5" or "--with-perl5=no".
if test x"${PERLBIN}" = xno -o x"${with_alllang}" = xno ; then
AC_MSG_NOTICE([Disabling Perl5])
PERL=
else
# First figure out what the name of Perl5 is
if test "x$PERLBIN" = xyes; then
AC_CHECK_PROGS(PERL, perl perl5.6.1 perl5.6.0 perl5.004 perl5.003 perl5.002 perl5.001 perl5 perl)
else
PERL="$PERLBIN"
fi
# This could probably be simplified as for all platforms and all versions of Perl the following apparently should be run to get the compilation options:
# perl -MExtUtils::Embed -e ccopts
AC_MSG_CHECKING(for Perl5 header files)
if test -n "$PERL"; then
PERL5DIR=`($PERL -e 'use Config; print $Config{archlib}, "\n";') 2>/dev/null`
if test "$PERL5DIR" != ""; then
dirs="$PERL5DIR $PERL5DIR/CORE"
PERL5EXT=none
for i in $dirs; do
if test -r $i/perl.h; then
AC_MSG_RESULT($i)
PERL5EXT="$i"
break;
fi
done
if test "$PERL5EXT" = none; then
PERL5EXT="$PERL5DIR/CORE"
AC_MSG_RESULT(could not locate perl.h...using $PERL5EXT)
fi
AC_MSG_CHECKING(for Perl5 library)
PERL5LIB=`($PERL -e 'use Config; $_=$Config{libperl}; s/^lib//; s/$Config{_a}$//; print $_, "\n"') 2>/dev/null`
if test "$PERL5LIB" = "" ; then
AC_MSG_RESULT(not found)
else
AC_MSG_RESULT($PERL5LIB)
fi
AC_MSG_CHECKING(for Perl5 compiler options)
PERL5CCFLAGS=`($PERL -e 'use Config; print $Config{ccflags}, "\n"' | sed "s/-Wdeclaration-after-statement//" | sed "s/-I/$ISYSTEM/") 2>/dev/null`
if test "$PERL5CCFLAGS" = "" ; then
AC_MSG_RESULT(not found)
else
AC_MSG_RESULT($PERL5CCFLAGS)
fi
else
AC_MSG_RESULT(unable to determine perl5 configuration)
PERL5EXT=$PERL5DIR
fi
else
AC_MSG_RESULT(could not figure out how to run perl5)
fi
# Cygwin (Windows) needs the library for dynamic linking
case $host in
*-*-cygwin* | *-*-mingw*) PERL5DYNAMICLINKING="-L$PERL5EXT -l$PERL5LIB";;
*)PERL5DYNAMICLINKING="";;
esac
fi
AC_SUBST(PERL)
AC_SUBST(PERL5EXT)
AC_SUBST(PERL5DYNAMICLINKING)
AC_SUBST(PERL5LIB)
AC_SUBST(PERL5CCFLAGS)
#----------------------------------------------------------------
# Look for Octave
#----------------------------------------------------------------
OCTAVEBIN=
OCTAVE_SO=.oct
AC_ARG_WITH(octave, AS_HELP_STRING([--without-octave], [Disable Octave])
AS_HELP_STRING([--with-octave=path], [Set location of Octave executable]),[OCTAVEBIN="$withval"], [OCTAVEBIN=yes])
# First, check for "--without-octave" or "--with-octave=no".
if test x"${OCTAVEBIN}" = xno -o x"${with_alllang}" = xno ; then
AC_MSG_NOTICE([Disabling Octave])
OCTAVE=
# First figure out what the name of Octave is
elif test "x$OCTAVEBIN" = xyes; then
AC_CHECK_PROGS(OCTAVE, octave)
else
OCTAVE="$OCTAVEBIN"
fi
if test -n "$OCTAVE"; then
AC_MSG_CHECKING([for mkoctfile])
AS_IF([test "x`${OCTAVE} -qfH --eval 'mkoctfile -p CXX' 2>/dev/null`" != x],[
AC_MSG_RESULT([yes])
],[
AC_MSG_ERROR([mkoctfile is not installed])
])
AC_MSG_CHECKING([for Octave preprocessor flags])
OCTAVE_CPPFLAGS=
for n in CPPFLAGS INCFLAGS; do
OCTAVE_CPPFLAGS="${OCTAVE_CPPFLAGS} "`$OCTAVE -qfH --eval "mkoctfile -p $n"`
done
AC_MSG_RESULT($OCTAVE_CPPFLAGS)
AC_MSG_CHECKING([for Octave compiler flags])
OCTAVE_CXXFLAGS=
for n in ALL_CXXFLAGS; do
OCTAVE_CXXFLAGS="${OCTAVE_CXXFLAGS} "`$OCTAVE -qfH --eval "mkoctfile -p $n"`
done
AC_MSG_RESULT($OCTAVE_CXXFLAGS)
AC_MSG_CHECKING([for Octave linker flags])
OCTAVE_LDFLAGS=
for n in RDYNAMIC_FLAG LFLAGS RLD_FLAG OCTAVE_LIBS LIBS; do
OCTAVE_LDFLAGS="${OCTAVE_LDFLAGS} "`$OCTAVE -qfH --eval "mkoctfile -p $n"`
done
AC_MSG_RESULT($OCTAVE_LDFLAGS)
else
AC_MSG_RESULT(could not figure out how to run octave)
fi
AC_SUBST(OCTAVE)
AC_SUBST(OCTAVE_SO)
AC_SUBST(OCTAVE_CPPFLAGS)
AC_SUBST(OCTAVE_CXXFLAGS)
AC_SUBST(OCTAVE_LDFLAGS)
#----------------------------------------------------------------
# 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=yes])
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 -o x"${with_alllang}" = xno ; then
AC_MSG_NOTICE([Disabling Java])
JAVA=
else
if test "x$JAVABIN" = xyes; then
AC_CHECK_PROGS(JAVA, java kaffe guavac)
else
JAVA="$JAVABIN"
fi
if test -z "$JAVACBIN"; then
AC_CHECK_PROGS(JAVAC, javac)
else
JAVAC="$JAVACBIN"
fi
AC_MSG_CHECKING(for java include file jni.h)
AC_ARG_WITH(javaincl, [ --with-javaincl=path Set location of Java include directory], [JAVAINCDIR="$withval"], [JAVAINCDIR=])
if test -z "$JAVAINCDIR" ; then
JAVAINCDIR="/usr/j2sdk*/include /usr/local/j2sdk*/include /usr/jdk*/include /usr/local/jdk*/include /opt/j2sdk*/include /opt/jdk*/include /usr/java/include /usr/java/j2sdk*/include /usr/java/jdk*/include /usr/local/java/include /opt/java/include /usr/include/java /usr/local/include/java /usr/lib/java/include /usr/lib/jvm/java*/include /usr/include/kaffe /usr/local/include/kaffe /usr/include"
# Add in default installation directory on Windows for Cygwin
case $host in
*-*-cygwin* | *-*-mingw*) JAVAINCDIR="c:/Program*Files/Java/jdk*/include d:/Program*Files/Java/jdk*/include c:/j2sdk*/include d:/j2sdk*/include c:/jdk*/include d:/jdk*/include $JAVAINCDIR";;
*-*-darwin*) JAVAINCDIR="/System/Library/Frameworks/JavaVM.framework/Headers $JAVAINCDIR";;
*);;
esac
fi