diff --git a/SWIG/configure.in b/SWIG/configure.in index 382a1a266..e146077fb 100644 --- a/SWIG/configure.in +++ b/SWIG/configure.in @@ -131,11 +131,237 @@ AC_ARG_WITH(yacc,[ --without-yacc Try to compile without yacc/bison], YACCFLAGS="-d parser.y" AC_SUBST(YACCFLAGS) ]) + +# RPATH is the path used to look for shared library files. +AC_MSG_CHECKING(RPATH) +if test -z "$RPATH" +then + case $ac_sys_system/$ac_sys_release in + SunOS/5*) 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) +AC_SUBST(RPATH) + + + +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"]) +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_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 ], , 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 ], , 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 ], , 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) + #---------------------------------------------------------------- # 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) @@ -152,24 +378,80 @@ if test "$PYINCLUDE" = nope; then AC_MSG_RESULT(not found) fi -AC_SUBST(PYINCLUDE) +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" -# RPATH is the path used to look for shared library files. -AC_MSG_CHECKING(RPATH) -if test -z "$RPATH" -then - case $ac_sys_system/$ac_sys_release in - SunOS/5*) RPATH="-R. -R$(exec_prefix)/lib";; - IRIX*) RPATH="-rpath .:$(exec_prefix)/lib";; - Linux*) RPATH="-Xlinker -rpath $(exec_prefix)/lib -Xlinker -rpath .";; - *) RPATH="";; - esac +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_MSG_RESULT($RPATH) -AC_SUBST(RPATH) + +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) # Note we write DOH's Makefiles for it -- if it has any special configure # stuff, we're going to skip it! AC_OUTPUT(Makefile Source/Core/Makefile Source/DOH/Doh/Makefile Source/DOH/Makefile Source/Preprocessor/Makefile Source/SWIG1.1/Makefile - Source/Modules1.1/Makefile) + Source/Modules1.1/Makefile Examples/Makefile)