1 dnl Process this file with autoconf to produce a configure script.
2 AC_INIT(Include/swig.h)
5 # Set name for machine-dependent library files
7 AC_MSG_CHECKING(MACHDEP)
10 if test -f /usr/lib/NextStep/software_version; then
11 set X `hostinfo | grep 'NeXT Mach.*:' | \
12 sed -e 's/://' -e 's/\./_/'` && \
13 ac_sys_system=next && ac_sys_release=$4
14 MACHDEP="$ac_sys_system$ac_sys_release$ac_sys_cpu"
16 ac_sys_system=`uname -s`
17 if test "$ac_sys_system" = "AIX" ; then
18 ac_sys_release=`uname -v`
20 ac_sys_release=`uname -r`
22 ac_md_system=`echo $ac_sys_system |
23 tr -d '[/ ]' | tr '[[A-Z]]' '[[a-z]]'`
24 ac_md_release=`echo $ac_sys_release |
25 tr -d '[/ ]' | sed 's/\..*//'`
26 MACHDEP="$ac_md_system$ac_md_release"
32 AC_MSG_RESULT($MACHDEP)
36 dnl Checks for programs.
42 AC_CHECK_PROGS(AR, ar aal, ar)
44 dnl Checks for header files.
46 dnl Checks for library functions.
49 AC_ARG_WITH(lang,[ --with-lang=LANG Set SWIG target language (TCL,TCL8,PYTHON,PERL5,PERL4,GUILE)],[
50 AC_DEFINE_UNQUOTED(SWIG_LANG,$withval)], [AC_DEFINE(SWIG_LANG,PYTHON)])
52 AC_ARG_WITH(doc,[ --with-doc=DOC Set SWIG target documentation method (ASCII,LATEX,HTML,NODOC)], [
53 AC_DEFINE_UNQUOTED(SWIG_DOC,$withval)], [AC_DEFINE(SWIG_DOC,ASCII)])
55 AC_ARG_WITH(yacc,[ --without-yacc Try to compile without yacc/bison], [
56 YACC="cp parser.cxx.no y.tab.c; cp parser.h.no y.tab.h"
61 YACCFLAGS="-d parser.y"
62 AC_SUBST(YACCFLAGS) ])
64 # This borrowed from the Python configuration file
65 # Set info about shared libraries.
70 AC_SUBST(LINKFORSHARED)
71 # SO is the extension of shared libraries `(including the dot!)
72 # -- usually .so, .sl on HP-UX
76 case $ac_sys_system in
78 NeXT|next) SO=.a;; # no shared libs on NeXT 3.3 and less
83 # LDSHARED is the ld *command* used to create shared library
84 # -- "ld" on SunOS 4.x.x, "ld -G" on SunOS 5.x, "ld -shared" on IRIX 5
85 AC_MSG_CHECKING(LDSHARED)
86 if test -z "$LDSHARED"
88 case $ac_sys_system/$ac_sys_release in
89 AIX*) LDSHARED="ld_so_aix";;
90 IRIX*) LDSHARED="ld -shared";;
91 SunOS/4*) LDSHARED="ld";;
92 SunOS/5*) LDSHARED="ld -G";;
93 hp*|HP*) LDSHARED="ld -b";;
94 OSF*) LDSHARED="ld -shared -expect_unresolved \"*\"";;
95 DYNIX/ptx*) LDSHARED="ld -G";;
96 Linux*) LDSHARED="gcc -shared";;
97 FreeBSD*) LDSHARED="ld -Bshareable";;
98 NeXT|next/3*) LDSHARED="ld -u libsys_s";;
102 AC_MSG_RESULT($LDSHARED)
103 # CCSHARED are the C *flags* used to create objects to go into a shared
104 # library -- this is only needed for a few systems
105 AC_MSG_CHECKING(CCSHARED)
106 if test -z "$CCSHARED"
108 case $ac_sys_system in
109 hp*|HP*) if test "$GCC" = yes;
110 then CCSHARED="-fpic";
113 Linux*) CCSHARED="-fpic";;
114 FreeBSD*) CCSHARED="-fpic";;
117 AC_MSG_RESULT($CCSHARED)
119 # LINKFORSHARED are the flags passed to the $(CC) command that links
120 # the a few executables -- this is only needed for a few systems
122 AC_MSG_CHECKING(LINKFORSHARED)
123 if test -z "$LINKFORSHARED"
125 case $ac_sys_system/$ac_sys_release in
126 AIX*) LINKFORSHARED='-Wl,-bE:$(srcdir)/python.exp -lld';;
128 LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";;
129 Linux*) LINKFORSHARED="-Xlinker -export-dynamic";;
130 next/*) LINKFORSHARED="-u libsys_s";;
131 SCO_SV*) LINKFORSHARED="-Bdynamic -dy -Wl,-Bexport";;
132 IRIX*/6*) LINKFORSHARED="-all";;
135 AC_MSG_RESULT($LINKFORSHARED)
138 echo "Checking for installed packages."
139 echo "Note : None of the following packages are required to compile SWIG"
142 # Check for specific libraries. Used for SWIG examples
143 AC_CHECK_LIB(dl, dlopen) # Dynamic linking for SunOS/Solaris and SYSV
144 AC_CHECK_LIB(dld, shl_load) # Dynamic linking for HP-UX
146 # The following three (nsl,inet,socket) are needed on Sequent;
147 # the order of checking must be this. Most SVR4 platforms will
148 # need -lsocket and -lnsl. However on SGI IRIX 5, these exist but
149 # broken. I see no elegant solution (probably CHECK_LIB should be
150 # fixed to only add the library if the given entry point is not
151 # satisfied without it).
152 if test "`uname -s`" != IRIX
154 AC_CHECK_LIB(nsl, t_open, [LIBS="-lnsl $LIBS"]) # SVR4
155 AC_CHECK_LIB(inet, gethostbyname, [LIBS="-linet $LIBS"], [], -lnsl) # Sequent
156 AC_CHECK_LIB(socket, socket, [LIBS="-lsocket $LIBS"], [], $LIBS) # SVR4 sockets
159 # check for --with-libm=...
162 AC_ARG_WITH(libm, [ --with-libm=STRING math library], [
163 if test "$withval" != yes
165 else AC_ERROR(proper usage is --with-libm=STRING)
167 AC_CHECK_LIB(ieee, main, [LIBM="-lieee $LIBM"])
168 AC_CHECK_LIB(crypt,crypt, [LIBCRYPT="-lcrypt"])
171 # check for --with-libc=...
173 AC_ARG_WITH(libc, [ --with-libc=STRING C library], [
174 if test "$withval" != yes
176 else AC_ERROR(proper usage is --with-libc=STRING)
179 #--------------------------------------------------------------------
180 # Locate the X11 header files and the X11 library archive. Try
181 # the ac_path_x macro first, but if it doesn't find the X stuff
182 # (e.g. because there's no xmkmf program) then check through
183 # a list of possible directories. Under some conditions the
184 # autoconf macro will return an include directory that contains
185 # no include files, so double-check its result just to be safe.
186 #--------------------------------------------------------------------
190 if test "$no_x" = ""; then
191 if test "$x_includes" = ""; then
192 AC_TRY_CPP([#include <X11/XIntrinsic.h>], , not_really_there="yes")
194 if test ! -r $x_includes/X11/Intrinsic.h; then
195 not_really_there="yes"
199 if test "$no_x" = "yes" -o "$not_really_there" = "yes"; then
200 AC_MSG_CHECKING(for X11 header files)
201 XINCLUDES="# no special path needed"
202 AC_TRY_CPP([#include <X11/Intrinsic.h>], , XINCLUDES="nope")
203 if test "$XINCLUDES" = nope; then
204 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"
206 if test -r $i/X11/Intrinsic.h; then
214 if test "$x_includes" != ""; then
215 XINCLUDES=-I$x_includes
217 XINCLUDES="# no special path needed"
220 if test "$XINCLUDES" = nope; then
221 AC_MSG_RESULT(couldn't find any!)
222 XINCLUDES="# no include files found"
225 if test "$no_x" = yes; then
226 AC_MSG_CHECKING(for X11 libraries)
228 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"
230 if test -r $i/libX11.a -o -r $i/libX11.so -o -r $i/libX11.sl; then
237 if test "$x_libraries" = ""; then
240 XLIBSW="-L$x_libraries -lX11"
243 if test "$XLIBSW" = nope ; then
244 AC_CHECK_LIB(Xwindow, XCreateWindow, XLIBSW=-lXwindow)
246 if test "$XLIBSW" = nope ; then
247 AC_MSG_RESULT(couldn't find any! Using -lX11.)
254 #--------------------------------------------------------------------
255 # Try to locate the Tcl package
256 #--------------------------------------------------------------------
262 AC_ARG_WITH(tcl,[ --with-tcl=path Set location of Tcl package],[
263 TCLPACKAGE="$withval"], [TCLPACKAGE=nope])
264 AC_ARG_WITH(tclincl,[ --with-tclincl=path Set location of Tcl include directory],[
265 TCLINCLUDE="-I$withval"], [TCLINCLUDE=nope])
266 AC_ARG_WITH(tcllib,[ --with-tcllib=path Set location of Tcl library directory],[
267 TCLLIB="-L$withval"], [TCLLIB=nope])
269 if test "$TCLINCLUDE" = nope; then
270 if test "$TCLPACKAGE" != nope; then
271 TCLINCLUDE="-I$TCLPACKAGE/include"
275 if test "$TCLLIB" = nope; then
276 if test "$TCLPACKAGE" != nope; then
277 TCLLIB="-L$TCLPACKAGE/lib"
281 AC_MSG_CHECKING(for Tcl header files)
282 if test "$TCLINCLUDE" = nope; then
283 AC_TRY_CPP([#include <tcl.h>], , TCLINCLUDE="nope")
284 if test "$TCLINCLUDE" = nope; then
285 dirs="$prefix/include /usr/local/include /usr/include /opt/local/include /home/sci/local/include"
287 if test -r $i/tcl.h; then
294 if test "$TCLINCLUDE" = nope; then
295 TCLINCLUDE="-I/usr/local/include"
296 AC_MSG_RESULT(not found)
299 AC_MSG_RESULT($TCLINCLUDE)
302 AC_MSG_CHECKING(for Tcl library)
303 if test "$TCLLIB" = nope; then
304 dirs="$prefix/lib /usr/local/lib /usr/lib /opt/local/lib /home/sci/local/lib"
306 if test -r $i/libtcl.a; then
312 if test "$TCLLIB" = nope; then
313 AC_MSG_RESULT(not found)
314 TCLLIB="-L/usr/local/lib"
317 AC_MSG_RESULT($TCLLIB)
323 #----------------------------------------------------------------
325 #----------------------------------------------------------------
330 PYLINK="-lModules -lPython -lObjects -lParser"
332 AC_ARG_WITH(py,[ --with-py=path Set location of Python],[
333 PYPACKAGE="$withval"], [PYPACKAGE=nope])
334 AC_ARG_WITH(pyincl,[ --with-pyincl=path Set location of Python include directory],[
335 PYINCLUDE="$withval"], [PYINCLUDE=nope])
336 AC_ARG_WITH(pylib,[ --with-pylib=path Set location of Python library directory],[
337 PYLIB="$withval"], [PYLIB=nope])
339 if test "$PYINCLUDE" = nope; then
340 if test "$PYPACKAGE" != nope; then
341 PYINCLUDE="$PYPACKAGE/include"
345 if test "$PYLIB" = nope; then
346 if test "$PYPACKAGE" != nope; then
347 PYLIB="$PYPACKAGE/lib"
352 AC_MSG_CHECKING(for Python header files)
354 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"
356 if test -r $i/Python.h; then
362 if test "$PYINCLUDE" = nope; then
363 PYINCLUDE="-I/usr/local/include/Py"
364 AC_MSG_RESULT(not found)
367 AC_MSG_CHECKING(for Python library)
368 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"
371 if test -r $i/libpython1.5.a; then
374 PYINCLUDE="$PYINCLUDE -I$i"
378 if test -r $i/libPython.a; then
381 PYINCLUDE="$PYINCLUDE -I$i"
385 if test "$PYLIB" = nope; then
386 AC_MSG_RESULT(not found)
387 PYLIB="/usr/local/lib/python/lib"
388 PYINCLUDE="$PYINCLUDE -I$PYLIB"
395 #----------------------------------------------------------------
397 #----------------------------------------------------------------
401 AC_ARG_WITH(perl5,[ --with-perl5=path Set location of Perl5 executable],[
402 PERLBIN="$withval"], [PERLBIN=nope])
404 # First figure out what the name of Perl5 is
406 if test "$PERLBIN" = nope; then
407 AC_CHECK_PROGS(PERL, perl5.004 perl5.003 perl5.002 perl5.001 perl5 perl,nope)
411 AC_MSG_CHECKING(for Perl5 header files)
412 if test "$PERL" != nope; then
413 PERL5DIR=`($PERL -e 'use Config; print $Config{archlib};') 2>/dev/null`
414 if test "$PERL5DIR" != ""; then
415 dirs="$PERL5DIR $PERL5DIR/CORE"
418 if test -r $i/perl.h; then
424 if test "$PERL5EXT" = none; then
425 PERL5EXT="$PERL5DIR/CORE"
426 AC_MSG_RESULT(could not locate perl.h...using $PERL5EXT)
429 AC_MSG_RESULT(unable to determine perl5 configuration)
433 AC_MSG_RESULT(could not figure out how to run perl5)
434 PERL5EXT="/usr/local/lib/perl/archname/5.003/CORE"
439 AC_OUTPUT(Makefile SWIG/Makefile Modules/Makefile Runtime/Makefile swig_lib/tcl/Makefile swig_lib/python/Makefile swig_lib/perl5/Makefile)