-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.in
510 lines (448 loc) · 14.4 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
dnl Process this file with autoconf to produce a configure script.
AC_INIT(Include/swig.h)
AC_PREREQ(2.0)
# Set name for machine-dependent library files
AC_SUBST(MACHDEP)
AC_MSG_CHECKING(MACHDEP)
if test -z "$MACHDEP"
then
if test -f /usr/lib/NextStep/software_version; then
set X `hostinfo | grep 'NeXT Mach.*:' | \
sed -e 's/://' -e 's/\./_/'` && \
ac_sys_system=next && ac_sys_release=$4
MACHDEP="$ac_sys_system$ac_sys_release$ac_sys_cpu"
else
ac_sys_system=`uname -s`
if test "$ac_sys_system" = "AIX" ; then
ac_sys_release=`uname -v`
else
ac_sys_release=`uname -r`
fi
ac_md_system=`echo $ac_sys_system |
tr -d '[/ ]' | tr '[[A-Z]]' '[[a-z]]'`
ac_md_release=`echo $ac_sys_release |
tr -d '[/ ]' | sed 's/\..*//'`
MACHDEP="$ac_md_system$ac_md_release"
fi
case MACHDEP in
'') MACHDEP=unknown;;
esac
fi
AC_MSG_RESULT($MACHDEP)
AC_LANG_CPLUSPLUS
dnl Checks for programs.
AC_PROG_CXX
AC_PROG_CC
AC_PROG_RANLIB
AC_SUBST(AR)
AC_CHECK_PROGS(AR, ar aal, ar)
dnl Checks for header files.
AC_HEADER_STDC
dnl Checks for library functions.
AC_FUNC_ALLOCA
AC_ARG_WITH(lang,[ --with-lang=LANG Set SWIG target language (TCL,TCL8,PYTHON,PERL5,PERL4,GUILE)],[
AC_DEFINE_UNQUOTED(SWIG_LANG,$withval)], [AC_DEFINE(SWIG_LANG,TCL)])
AC_ARG_WITH(doc,[ --with-doc=DOC Set SWIG target documentation method (ASCII,LATEX,HTML,NODOC)], [
AC_DEFINE_UNQUOTED(SWIG_DOC,$withval)], [AC_DEFINE(SWIG_DOC,ASCII)])
AC_ARG_WITH(yacc,[ --without-yacc Try to compile without yacc/bison], [
YACC="cp parser.cxx.no y.tab.c; cp parser.h.no y.tab.h"
AC_SUBST(YACC)
YACCFLAGS=""
AC_SUBST(YACCFLAGS)
], [ AC_PROG_YACC
YACCFLAGS="-d parser.y"
AC_SUBST(YACCFLAGS) ])
# This borrowed from the Python configuration file
# Set info about shared libraries.
AC_SUBST(SO)
AC_SUBST(LDSHARED)
AC_SUBST(CCSHARED)
AC_SUBST(LINKFORSHARED)
# SO is the extension of shared libraries `(including the dot!)
# -- usually .so, .sl on HP-UX
AC_MSG_CHECKING(SO)
if test -z "$SO"
then
case $ac_sys_system in
hp*|HP*) SO=.sl;;
NeXT|next) SO=.a;; # no shared libs on NeXT 3.3 and less
*) 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
AC_MSG_CHECKING(LDSHARED)
if test -z "$LDSHARED"
then
case $ac_sys_system/$ac_sys_release in
AIX*) LDSHARED="ld_so_aix";;
IRIX*) LDSHARED="ld -shared";;
SunOS/4*) LDSHARED="ld";;
SunOS/5*) LDSHARED="ld -G";;
hp*|HP*) LDSHARED="ld -b";;
OSF*) LDSHARED="ld -shared -expect_unresolved \"*\"";;
DYNIX/ptx*) LDSHARED="ld -G";;
Linux*) LDSHARED="gcc -shared";;
FreeBSD*) LDSHARED="ld -Bshareable";;
NeXT|next/3*) LDSHARED="ld -u libsys_s";;
*) LDSHARED="ld";;
esac
fi
AC_MSG_RESULT($LDSHARED)
# CCSHARED are the C *flags* used to create objects to go into a shared
# library -- this is only needed for a few systems
AC_MSG_CHECKING(CCSHARED)
if test -z "$CCSHARED"
then
case $ac_sys_system in
hp*|HP*) if test "$GCC" = yes;
then CCSHARED="-fpic";
else CCSHARED="+z";
fi;;
Linux*) CCSHARED="-fpic";;
FreeBSD*) CCSHARED="-fpic";;
esac
fi
AC_MSG_RESULT($CCSHARED)
# 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 $ac_sys_system/$ac_sys_release in
AIX*) LINKFORSHARED='-Wl,-bE:$(srcdir)/python.exp -lld';;
hp*|HP*)
LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";;
Linux*) LINKFORSHARED="-Xlinker -export-dynamic";;
next/*) LINKFORSHARED="-u libsys_s";;
SCO_SV*) LINKFORSHARED="-Bdynamic -dy -Wl,-Bexport";;
IRIX*/6*) LINKFORSHARED="-all";;
esac
fi
AC_MSG_RESULT($LINKFORSHARED)
echo ""
echo "Checking for installed packages."
echo "Note : None of the following packages are required to compile SWIG"
echo ""
# 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
# The following three (nsl,inet,socket) are needed on Sequent;
# the order of checking must be this. Most SVR4 platforms will
# need -lsocket and -lnsl. However on SGI IRIX 5, these exist but
# broken. I see no elegant solution (probably CHECK_LIB should be
# fixed to only add the library if the given entry point is not
# satisfied without it).
if test "`uname -s`" != IRIX
then
AC_CHECK_LIB(nsl, t_open, [LIBS="-lnsl $LIBS"]) # SVR4
AC_CHECK_LIB(inet, gethostbyname, [LIBS="-linet $LIBS"], [], -lnsl) # Sequent
AC_CHECK_LIB(socket, socket, [LIBS="-lsocket $LIBS"], [], $LIBS) # SVR4 sockets
fi
# 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_ERROR(proper usage is --with-libm=STRING)
fi])
AC_CHECK_LIB(ieee, main, [LIBM="-lieee $LIBM"])
# 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_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="nope")
if test "$XINCLUDES" = nope; 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
AC_MSG_RESULT($i)
XINCLUDES=" -I$i"
break
fi
done
fi
else
if test "$x_includes" != ""; then
XINCLUDES=-I$x_includes
else
XINCLUDES="# no special path needed"
fi
fi
if test "$XINCLUDES" = nope; 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=nope
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 "$XLIBSW" = nope ; then
AC_CHECK_LIB(Xwindow, XCreateWindow, XLIBSW=-lXwindow)
fi
if test "$XLIBSW" = nope ; then
AC_MSG_RESULT(couldn't find any! Using -lX11.)
XLIBSW=-lX11
fi
AC_SUBST(XINCLUDES)
AC_SUBST(XLIBSW)
#--------------------------------------------------------------------
# Try to locate the Tcl package
#--------------------------------------------------------------------
TCLINCLUDE=nope
TCLLIB=nope
TCLPACKAGE=nope
AC_ARG_WITH(tcl,[ --with-tcl=path Set location of Tcl package],[
TCLPACKAGE="$withval"], [TCLPACKAGE=nope])
AC_ARG_WITH(tclincl,[ --with-tclincl=path Set location of Tcl include directory],[
TCLINCLUDE="-I$withval"], [TCLINCLUDE=nope])
AC_ARG_WITH(tcllib,[ --with-tcllib=path Set location of Tcl library directory],[
TCLLIB="-L$withval"], [TCLLIB=nope])
if test "$TCLINCLUDE" = nope; then
if test "$TCLPACKAGE" != nope; then
TCLINCLUDE="-I$TCLPACKAGE/include"
fi
fi
if test "$TCLLIB" = nope; then
if test "$TCLPACKAGE" != nope; then
TCLLIB="-L$TCLPACKAGE/lib"
fi
fi
AC_MSG_CHECKING(for Tcl header files)
if test "$TCLINCLUDE" = nope; then
AC_TRY_CPP([#include <tcl.h>], , TCLINCLUDE="nope")
if test "$TCLINCLUDE" = nope; then
dirs="$prefix/include /usr/local/include /usr/include /opt/local/include /home/sci/local/include"
for i in $dirs ; do
if test -r $i/tcl.h; then
AC_MSG_RESULT($i)
TCLINCLUDE="-I$i"
break
fi
done
fi
if test "$TCLINCLUDE" = nope; then
TCLINCLUDE="-I/usr/local/include"
AC_MSG_RESULT(not found)
fi
else
AC_MSG_RESULT($TCLINCLUDE)
fi
AC_MSG_CHECKING(for Tcl library)
if test "$TCLLIB" = nope; then
dirs="$prefix/lib /usr/local/lib /usr/lib /opt/local/lib /home/sci/local/lib"
for i in $dirs ; do
if test -r $i/libtcl.a; then
AC_MSG_RESULT($i)
TCLLIB="-L$i"
break
fi
done
if test "$TCLLIB" = nope; then
AC_MSG_RESULT(not found)
TCLLIB="-L/usr/local/lib"
fi
else
AC_MSG_RESULT($TCLLIB)
fi
AC_SUBST(TCLINCLUDE)
AC_SUBST(TCLLIB)
#--------------------------------------------------------------------
# Try to locate the [incr Tcl] package
#--------------------------------------------------------------------
ITCLINCLUDE=nope
ITCLLIB=nope
ITCLPACKAGE=nope
AC_ARG_WITH(itcl,[ --with-itcl=path Set location of itcl package],[
ITCLPACKAGE="$withval"], [ITCLPACKAGE=nope])
AC_ARG_WITH(itclincl,[ --with-itclincl=path Set location of itcl include directory],[
ITCLINCLUDE="-I$withval"], [ITCLINCLUDE=nope])
AC_ARG_WITH(itcllib,[ --with-itcllib=path Set location of itcl library directory],[
ITCLLIB="-L$withval"], [ITCLLIB=nope])
if test "$ITCLINCLUDE" = nope; then
if test "$ITCLPACKAGE" != nope; then
ITCLINCLUDE="-I$ITCLPACKAGE/include"
fi
fi
if test "$ITCLLIB" = nope; then
if test "$ITCLPACKAGE" != nope; then
ITCLLIB="-L$ITCLPACKAGE/lib"
fi
fi
AC_MSG_CHECKING("for incr Tcl headers")
if test "$ITCLINCLUDE" = nope; then
dirs="$prefix/include/itcl /usr/local/include/itcl /usr/include/itcl /opt/local/include/itcl /home/sci/local/include/itcl"
for i in $dirs ; do
if test -r $i/tcl.h; then
AC_MSG_RESULT($i)
ITCLINCLUDE="-I$i"
break
fi
done
else
AC_MSG_RESULT($ITCLINCLUDE)
fi
if test "$ITCLINCLUDE" = nope; then
ITCLINCLUDE="-I$TCLINCLUDE/itcl"
AC_MSG_RESULT(not found)
fi
AC_MSG_CHECKING("for incr Tcl library")
if test "$ITCLLIB" = nope; then
dirs="$prefix/lib/itcl /usr/local/lib/itcl /usr/lib/itcl /opt/local/lib/itcl /home/sci/local/lib/itcl"
for i in $dirs ; do
if test -r $i/libtcl.a; then
AC_MSG_RESULT($i)
ITCLLIB="-L$i"
break
fi
done
else
AC_MSG_RESULT($ITCLLIB)
fi
if test "$ITCLLIB" = nope; then
AC_MSG_RESULT(not found)
ITCLLIB="-L$TCLLIB/itcl"
fi
AC_SUBST(ITCLINCLUDE)
AC_SUBST(ITCLLIB)
#----------------------------------------------------------------
# Look for Python
#----------------------------------------------------------------
PYINCLUDE=nope
PYLIB=nope
PYPACKAGE=nope
PYLINK="-lModules -lPython -lObjects -lParser"
AC_ARG_WITH(py,[ --with-py=path Set location of Python],[
PYPACKAGE="$withval"], [PYPACKAGE=nope])
AC_ARG_WITH(pyincl,[ --with-pyincl=path Set location of Python include directory],[
PYINCLUDE="$withval"], [PYINCLUDE=nope])
AC_ARG_WITH(pylib,[ --with-pylib=path Set location of Python library directory],[
PYLIB="$withval"], [PYLIB=nope])
if test "$PYINCLUDE" = nope; then
if test "$PYPACKAGE" != nope; then
PYINCLUDE="$PYPACKAGE/include"
fi
fi
if test "$PYLIB" = nope; then
if test "$PYPACKAGE" != nope; then
PYLIB="$PYPACKAGE/lib"
fi
fi
AC_MSG_CHECKING(for Python header files)
dirs="$PYINCLUDE $PYINCLUDE/python1.5 $PYINCLUDE/python1.4 $PYINCLUDE/Py $prefix/include/python1.5 $prefix/include/python1.4 /usr/local/include/python1.5 /usr/include/python1.5 /usr/local/include/python1.4 /usr/include/python1.4 $prefix/include/Py /usr/local/include/Py /usr/include/Py"
for i in $dirs ; do
if test -r $i/Python.h; then
AC_MSG_RESULT($i)
PYINCLUDE="-I$i"
break
fi
done
if test "$PYINCLUDE" = nope; then
PYINCLUDE="-I/usr/local/include/Py"
AC_MSG_RESULT(not found)
fi
AC_MSG_CHECKING(for Python library)
dirs="$PYLIB $PYLIB/config $PYLIB/lib $PYLIB/python1.5/config $PYLIB/python1.4/config $PYLIB/python/lib $prefix/lib/python1.5/config $prefix/lib/python1.4/config /usr/local/lib/python1.5/config /usr/lib/python1.5 /usr/local/lib/python1.4/config /usr/lib/python1.4 $prefix/lib/python/lib /usr/local/lib/python/lib /usr/lib/python/lib /home/sci/local/lib/python"
for i in $dirs ; do
if test -r $i/libpython1.5.a; then
AC_MSG_RESULT($i)
PYLIB="$i"
PYINCLUDE="$PYINCLUDE -I$i"
PYLINK="-lpython1.5"
break
fi
if test -r $i/libPython.a; then
AC_MSG_RESULT($i)
PYLIB="$i"
PYINCLUDE="$PYINCLUDE -I$i"
break
fi
done
if test "$PYLIB" = nope; then
AC_MSG_RESULT(not found)
PYLIB="/usr/local/lib/python/lib"
PYINCLUDE="$PYINCLUDE -I$PYLIB"
fi
AC_SUBST(PYINCLUDE)
AC_SUBST(PYLIB)
AC_SUBST(PYLINK)
#----------------------------------------------------------------
# Look for Perl5
#----------------------------------------------------------------
PERLBIN=nope
AC_ARG_WITH(perl5,[ --with-perl5=path Set location of Perl5 executable],[
PERLBIN="$withval"], [PERLBIN=nope])
# First figure out what the name of Perl5 is
if test "$PERLBIN" = nope; then
AC_CHECK_PROGS(PERL, perl5.004 perl5.003 perl5.002 perl5.001 perl5 perl,nope)
else
PERL="$PERLBIN"
fi
AC_MSG_CHECKING(for Perl5 header files)
if test "$PERL" != nope; then
PERL5DIR=`($PERL -e 'use Config; print $Config{archlib};') 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
else
AC_MSG_RESULT(unable to determine perl5 configuration)
PERL5EXT=$PERL5DIR
fi
else
AC_MSG_RESULT(could not figure out how to run perl5)
PERL5EXT="/usr/local/lib/perl/archname/5.003/CORE"
fi
AC_SUBST(PERL5EXT)
AC_OUTPUT(Makefile SWIG/Makefile Modules/Makefile Runtime/Makefile swig_lib/tcl/Makefile swig_lib/python/Makefile swig_lib/perl5/Makefile Makefile.template)