AC_CANONICAL_HOST replaces proprietary uname approach.

Initial support for mingw added (untested right now).
Autotool support files moved to Tools/conf directory to get them out of the way. Might be a temporary home until the runtime libraries and libtool is fixed.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@4204 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2002-12-16 21:38:13 +00:00
commit b9d6e1536d
2 changed files with 80 additions and 106 deletions

View file

@ -1,5 +1,7 @@
#! /bin/sh #! /bin/sh
# Bootstrap the development environment # Bootstrap the development environment
autoconf
set -x
autoheader autoheader
autoconf
(cd Tools; autoconf) (cd Tools; autoconf)

View file

@ -3,6 +3,7 @@ dnl Process this file with autoconf to produce a configure script.
AC_INIT([swig],[1.3.18],[http://www.swig.org]) AC_INIT([swig],[1.3.18],[http://www.swig.org])
AC_PREREQ(2.53) AC_PREREQ(2.53)
AC_CONFIG_SRCDIR([Source/Swig/swig.h]) AC_CONFIG_SRCDIR([Source/Swig/swig.h])
AC_CONFIG_AUX_DIR([Tools/config])
AC_CONFIG_HEADERS([Source/Include/swigconfig.h]) AC_CONFIG_HEADERS([Source/Include/swigconfig.h])
dnl Some extra defines for the config file dnl Some extra defines for the config file
@ -23,35 +24,9 @@ AH_TOP([
#define SWIG_TCL_RUNTIME "-L" LIBDIR " -lswigtcl" RELEASE_SUFFIX #define SWIG_TCL_RUNTIME "-L" LIBDIR " -lswigtcl" RELEASE_SUFFIX
]) ])
AC_CANONICAL_HOST
# Set name for machine-dependent library files dnl Checks for programs.
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_PROG_CC AC_PROG_CC
AC_PROG_CXX AC_PROG_CXX
@ -59,11 +34,12 @@ AC_PROG_RANLIB
AC_DEFINE_UNQUOTED(SWIG_CXX, ["$CXX"], [Compiler that built SWIG]) AC_DEFINE_UNQUOTED(SWIG_CXX, ["$CXX"], [Compiler that built SWIG])
dnl Checks for programs.
AC_SUBST(AR) AC_SUBST(AR)
AC_CHECK_PROGS(AR, ar aal, ar) AC_CHECK_PROGS(AR, ar aal, ar)
AC_CHECK_PROGS(AUTOCONF, autoconf, "")
AC_PROG_YACC
YFLAGS=-d
AC_SUBST(YFLAGS)
dnl Checks for header files. dnl Checks for header files.
AC_HEADER_STDC AC_HEADER_STDC
@ -78,14 +54,13 @@ AC_SUBST(TRYLINKINGWITHCXX)
AC_SUBST(LINKFORSHARED) AC_SUBST(LINKFORSHARED)
# SO is the extension of shared libraries `(including the dot!) # SO is the extension of shared libraries `(including the dot!)
# -- usually .so, .sl on HP-UX
AC_MSG_CHECKING(SO) AC_MSG_CHECKING(SO)
if test -z "$SO" if test -z "$SO"
then then
case $ac_sys_system in case $host in
hp*|HP*) SO=.sl;; *-*-hp*) SO=.sl;;
CYGWIN*) SO=.dll;; *-*-cygwin* | *-*-mingw*) SO=.dll;;
*) SO=.so;; *) SO=.so;;
esac esac
fi fi
AC_MSG_RESULT($SO) AC_MSG_RESULT($SO)
@ -96,9 +71,9 @@ AC_MSG_RESULT($SO)
AC_MSG_CHECKING(LDSHARED) AC_MSG_CHECKING(LDSHARED)
if test -z "$LDSHARED" if test -z "$LDSHARED"
then then
case $ac_sys_system/$ac_sys_release in case $host in
AIX*) LDSHARED="\$(srcdir)/ld_so_aix \$(CC)";; *-*-aix*) LDSHARED="\$(srcdir)/ld_so_aix \$(CC)";;
CYGWIN*) *-*-cygwin* | *-*-mingw*)
if test "$GCC" = yes; then if test "$GCC" = yes; then
LDSHARED="$CC -shared" LDSHARED="$CC -shared"
else else
@ -110,14 +85,14 @@ then
LDSHARED="$CC -shared" LDSHARED="$CC -shared"
fi fi
fi ;; fi ;;
IRIX/5*) LDSHARED="ld -shared";; *-*-irix5*) LDSHARED="ld -shared";;
IRIX*/6*) LDSHARED="ld ${SGI_ABI} -shared -all";; *-*-irix6*) LDSHARED="ld ${SGI_ABI} -shared -all";;
SunOS/4*) LDSHARED="ld";; *-*-sunos4*) LDSHARED="ld";;
SunOS/5*) LDSHARED="ld -G";; *-*-solaris*) LDSHARED="ld -G";;
hp*|HP*) LDSHARED="ld -b";; *-*-hp*) LDSHARED="ld -b";;
OSF*) LDSHARED="ld -shared -expect_unresolved \"*\"";; *-*-osf*) LDSHARED="ld -shared -expect_unresolved \"*\"";;
DYNIX/ptx*) LDSHARED="ld -G";; *-sequent-sysv4) LDSHARED="ld -G";;
next/*) *-*-next*)
if test "$ns_dyld" if test "$ns_dyld"
then LDSHARED='$(CC) $(LDFLAGS) -bundle -prebind' then LDSHARED='$(CC) $(LDFLAGS) -bundle -prebind'
else LDSHARED='$(CC) $(CFLAGS) -nostdlib -r'; else LDSHARED='$(CC) $(CFLAGS) -nostdlib -r';
@ -125,19 +100,19 @@ then
if test "$with_next_framework" ; then if test "$with_next_framework" ; then
LDSHARED="$LDSHARED \$(LDLIBRARY)" LDSHARED="$LDSHARED \$(LDLIBRARY)"
fi ;; fi ;;
Linux*) LDSHARED="gcc -shared";; *-*-linux*) LDSHARED="gcc -shared";;
dgux*) LDSHARED="ld -G";; *-*-dgux*) LDSHARED="ld -G";;
FreeBSD*/3*) LDSHARED="gcc -shared";; *-*-freebsd3*) LDSHARED="gcc -shared";;
FreeBSD*|OpenBSD*) LDSHARED="ld -Bshareable";; *-*-freebsd* | *-*-openbsd*) LDSHARED="ld -Bshareable";;
NetBSD*) *-*-netbsd*)
if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]] if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
then then
LDSHARED="cc -shared" LDSHARED="cc -shared"
else else
LDSHARED="ld -Bshareable" LDSHARED="ld -Bshareable"
fi;; fi;;
SCO_SV*) LDSHARED="cc -G -KPIC -Ki486 -belf -Wl,-Bexport";; *-sco-sysv*) LDSHARED="cc -G -KPIC -Ki486 -belf -Wl,-Bexport";;
Darwin*) LDSHARED="cc -bundle -undefined suppress -flat_namespace";; *-*-darwin*) LDSHARED="cc -bundle -undefined suppress -flat_namespace";;
*) LDSHARED="ld";; *) LDSHARED="ld";;
esac esac
fi fi
@ -158,13 +133,13 @@ AC_MSG_RESULT($CXXSHARED)
AC_MSG_CHECKING(TRYLINKINGWITHCXX) AC_MSG_CHECKING(TRYLINKINGWITHCXX)
if test -z "$TRYLINKINGWITHCXX" if test -z "$TRYLINKINGWITHCXX"
then then
case $ac_sys_system/$ac_sys_release in case $host in
SunOS/5*) if test "$GCC" = yes; *-*-solaris*) if test "$GCC" = yes;
then TRYLINKINGWITHCXX="CXXSHARED= $CXX -Wl,-G"; then TRYLINKINGWITHCXX="CXXSHARED= $CXX -Wl,-G";
else TRYLINKINGWITHCXX="CXXSHARED= $CXX -G -L/opt/SUNWspro/lib -lCrun"; else TRYLINKINGWITHCXX="CXXSHARED= $CXX -G -L/opt/SUNWspro/lib -lCrun";
fi;; fi;;
Darwin*) TRYLINKINGWITHCXX="CXXSHARED= $CXX -bundle -undefined suppress -flat_namespace";; *-*-darwin*) TRYLINKINGWITHCXX="CXXSHARED= $CXX -bundle -undefined suppress -flat_namespace";;
CYGWIN*) *-*-cygwin* | *-*-mingw*)
if test "$GCC" = yes; then if test "$GCC" = yes; then
TRYLINKINGWITHCXX="CXXSHARED= $CXX -shared " TRYLINKINGWITHCXX="CXXSHARED= $CXX -shared "
else else
@ -184,16 +159,16 @@ AC_MSG_RESULT($TRYLINKINGWITHCXX)
AC_MSG_CHECKING(CCSHARED) AC_MSG_CHECKING(CCSHARED)
if test -z "$CCSHARED" if test -z "$CCSHARED"
then then
case $ac_sys_system/$ac_sys_release in case $host in
hp*|HP*) if test "$GCC" = yes; *-*-hp*) if test "$GCC" = yes;
then CCSHARED="-fpic"; then CCSHARED="-fpic";
else CCSHARED="+z"; else CCSHARED="+z";
fi;; fi;;
Linux*) CCSHARED="-fpic";; *-*-linux*) CCSHARED="-fpic";;
FreeBSD*|OpenBSD*) CCSHARED="-fpic";; *-*-freebsd* | *-*-openbsd*) CCSHARED="-fpic";;
NetBSD*) CCSHARED="-fPIC";; *-*-netbsd*) CCSHARED="-fPIC";;
SCO_SV*) CCSHARED="-KPIC -dy -Bdynamic";; *-sco-sysv*) CCSHARED="-KPIC -dy -Bdynamic";;
IRIX*/6*) case $CC in *-*-irix6*) case $CC in
*gcc*) CCSHARED="-shared";; *gcc*) CCSHARED="-shared";;
*) CCSHARED="";; *) CCSHARED="";;
esac;; esac;;
@ -201,18 +176,14 @@ then
fi fi
AC_MSG_RESULT($CCSHARED) AC_MSG_RESULT($CCSHARED)
AC_PROG_YACC
YFLAGS=-d
AC_SUBST(YFLAGS)
# RPATH is the path used to look for shared library files. # RPATH is the path used to look for shared library files.
AC_MSG_CHECKING(RPATH) AC_MSG_CHECKING(RPATH)
if test -z "$RPATH" if test -z "$RPATH"
then then
case $ac_sys_system/$ac_sys_release in case $host in
SunOS/5*) RPATH='-R. -R$(exec_prefix)/lib';; *-*-solaris*) RPATH='-R. -R$(exec_prefix)/lib';;
IRIX*) RPATH='-rpath .:$(exec_prefix)/lib';; *-*-irix*) RPATH='-rpath .:$(exec_prefix)/lib';;
Linux*) RPATH='-Xlinker -rpath $(exec_prefix)/lib -Xlinker -rpath .';; *-*-linux*) RPATH='-Xlinker -rpath $(exec_prefix)/lib -Xlinker -rpath .';;
*) RPATH='';; *) RPATH='';;
esac esac
fi fi
@ -225,14 +196,14 @@ AC_SUBST(RPATH)
AC_MSG_CHECKING(LINKFORSHARED) AC_MSG_CHECKING(LINKFORSHARED)
if test -z "$LINKFORSHARED" if test -z "$LINKFORSHARED"
then then
case $ac_sys_system/$ac_sys_release in case $host in
AIX*) LINKFORSHARED='-Wl,-bE:$(srcdir)/python.exp -lld';; *-*-aix*) LINKFORSHARED='-Wl,-bE:$(srcdir)/python.exp -lld';;
hp*|HP*) *-*-hp*)
LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";; LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";;
Linux*) LINKFORSHARED="-Xlinker -export-dynamic";; *-*-linux*) LINKFORSHARED="-Xlinker -export-dynamic";;
next/*) LINKFORSHARED="-u libsys_s";; *-*-next*) LINKFORSHARED="-u libsys_s";;
SCO_SV*) LINKFORSHARED="-Bdynamic -dy -Wl,-Bexport";; *-sco-sysv*) LINKFORSHARED="-Bdynamic -dy -Wl,-Bexport";;
IRIX*/6*) LINKFORSHARED="-all";; *-*-irix6*) LINKFORSHARED="-all";;
esac esac
fi fi
AC_MSG_RESULT($LINKFORSHARED) AC_MSG_RESULT($LINKFORSHARED)
@ -252,12 +223,13 @@ AC_CHECK_LIB(dld, shl_load) # Dynamic linking for HP-UX
# broken. I see no elegant solution (probably CHECK_LIB should be # broken. I see no elegant solution (probably CHECK_LIB should be
# fixed to only add the library if the given entry point is not # fixed to only add the library if the given entry point is not
# satisfied without it). # satisfied without it).
if test "`uname -s`" != IRIX case $host in
then *-*-irix*)
AC_CHECK_LIB(nsl, t_open, [LIBS="-lnsl $LIBS"]) # SVR4 AC_CHECK_LIB(nsl, t_open, [LIBS="-lnsl $LIBS"]) # SVR4
AC_CHECK_LIB(inet, gethostbyname, [LIBS="-linet $LIBS"], [], -lnsl) # Sequent AC_CHECK_LIB(inet, gethostbyname, [LIBS="-linet $LIBS"], [], -lnsl) # Sequent
AC_CHECK_LIB(socket, socket, [LIBS="-lsocket $LIBS"], [], $LIBS) # SVR4 sockets AC_CHECK_LIB(socket, socket, [LIBS="-lsocket $LIBS"], [], $LIBS) # SVR4 sockets
fi ;;
esac
AC_CHECK_LIB(swill, swill_init, [SWIGLIBS="-lswill $LIBS" SWILL="-DSWIG_SWILL"]) AC_CHECK_LIB(swill, swill_init, [SWIGLIBS="-lswill $LIBS" SWILL="-DSWIG_SWILL"])
@ -456,9 +428,9 @@ else
AC_MSG_RESULT($TCLLIB) AC_MSG_RESULT($TCLLIB)
fi fi
# Only Cygwin (Windows) needs the library for dynamic linking # Cygwin (Windows) needs the library for dynamic linking
case $ac_sys_system/$ac_sys_release in case $host in
CYGWIN*) TCLDYNAMICLINKING="$TCLLIB";; *-*-cygwin* | *-*-mingw*) TCLDYNAMICLINKING="$TCLLIB";;
*)TCLDYNAMICLINKING="";; *)TCLDYNAMICLINKING="";;
esac esac
@ -562,9 +534,9 @@ if test -n "$PYTHON"; then
fi fi
fi fi
# Only Cygwin (Windows) needs the library for dynamic linking # Cygwin (Windows) needs the library for dynamic linking
case $ac_sys_system/$ac_sys_release in case $host in
CYGWIN*) PYTHONDYNAMICLINKING="-L$PYLIB $PYLINK" *-*-cygwin* | *-*-mingw*) PYTHONDYNAMICLINKING="-L$PYLIB $PYLINK"
PYINCLUDE="-DUSE_DL_IMPORT $PYINCLUDE" PYINCLUDE="-DUSE_DL_IMPORT $PYINCLUDE"
;; ;;
*)PYTHONDYNAMICLINKING="";; *)PYTHONDYNAMICLINKING="";;
@ -627,9 +599,9 @@ else
# PERL5EXT="/usr/local/lib/perl/archname/5.003/CORE" # PERL5EXT="/usr/local/lib/perl/archname/5.003/CORE"
fi fi
# Only Cygwin (Windows) needs the library for dynamic linking # Cygwin (Windows) needs the library for dynamic linking
case $ac_sys_system/$ac_sys_release in case $host in
CYGWIN*) PERL5DYNAMICLINKING="-L$PERL5EXT -l$PERL5LIB";; *-*-cygwin* | *-*-mingw*) PERL5DYNAMICLINKING="-L$PERL5EXT -l$PERL5LIB";;
*)PERL5DYNAMICLINKING="";; *)PERL5DYNAMICLINKING="";;
esac esac
@ -668,8 +640,8 @@ 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/local/java/include /opt/java/include /usr/include/java /usr/local/include/java /usr/include/kaffe /usr/local/include/kaffe /usr/include /usr/local/include" 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/local/java/include /opt/java/include /usr/include/java /usr/local/include/java /usr/include/kaffe /usr/local/include/kaffe /usr/include /usr/local/include"
# Add in default installation directory on Windows for Cygwin # Add in default installation directory on Windows for Cygwin
case $ac_sys_system/$ac_sys_release in case $host in
CYGWIN*) JAVAINCDIR="c:/j2sdk*/include d:/j2sdk*/include c:/jdk*/include d:/jdk*/include $JAVAINCDIR";; *-*-cygwin* | *-*-mingw*) JAVAINCDIR="c:/j2sdk*/include d:/j2sdk*/include c:/jdk*/include d:/jdk*/include $JAVAINCDIR";;
*);; *);;
esac esac
fi fi
@ -700,8 +672,8 @@ else
fi fi
# java.exe on Cygwin requires the Windows standard (Pascal) calling convention as it is a normal Windows executable and not a Cygwin built executable # java.exe on Cygwin requires the Windows standard (Pascal) calling convention as it is a normal Windows executable and not a Cygwin built executable
case $ac_sys_system/$ac_sys_release in case $host in
CYGWIN*) *-*-cygwin* | *-*-mingw*)
if test "$GCC" = yes; then if test "$GCC" = yes; then
JAVADYNAMICLINKING=" -Wl,--add-stdcall-alias" JAVADYNAMICLINKING=" -Wl,--add-stdcall-alias"
else else
@ -711,8 +683,8 @@ CYGWIN*)
esac esac
# Java on Windows platforms including Cygwin doesn't use libname.dll, rather name.dll when loading dlls # Java on Windows platforms including Cygwin doesn't use libname.dll, rather name.dll when loading dlls
case $ac_sys_system/$ac_sys_release in case $host in
CYGWIN*) JAVALIBRARYPREFIX="";; *-*-cygwin* | *-*-mingw*) JAVALIBRARYPREFIX="";;
*)JAVALIBRARYPREFIX="lib";; *)JAVALIBRARYPREFIX="lib";;
esac esac
@ -836,8 +808,8 @@ if test -n "$RUBY"; then
# Find library and path for linking. Use libruby.a except on Cygwin use the DLL. # Find library and path for linking. Use libruby.a except on Cygwin use the DLL.
AC_MSG_CHECKING(for Ruby library) AC_MSG_CHECKING(for Ruby library)
RUBYLIB="" RUBYLIB=""
case $ac_sys_system/$ac_sys_release in case $host in
CYGWIN*) *-*-cygwin* | *-*-mingw*)
rb_libdir=`($RUBY -rrbconfig -e 'print Config::CONFIG[["libdir"]]') 2>/dev/null` rb_libdir=`($RUBY -rrbconfig -e 'print Config::CONFIG[["libdir"]]') 2>/dev/null`
rb_bindir=`($RUBY -rrbconfig -e 'print Config::CONFIG[["bindir"]]') 2>/dev/null` rb_bindir=`($RUBY -rrbconfig -e 'print Config::CONFIG[["bindir"]]') 2>/dev/null`
dirs="$dirs $rb_libdir $rb_bindir" dirs="$dirs $rb_libdir $rb_bindir"
@ -877,8 +849,8 @@ else
RUBYLINK="-lruby -lm" RUBYLINK="-lruby -lm"
fi fi
case $ac_sys_system/$ac_sys_release in case $host in
CYGWIN*) RUBYDYNAMICLINKING="-L$RUBYLIB $RUBYLINK";; *-*-cygwin* | *-*-mingw*) RUBYDYNAMICLINKING="-L$RUBYLIB $RUBYLINK";;
*) RUBYDYNAMICLINKING="";; *) RUBYDYNAMICLINKING="";;
esac esac
@ -928,7 +900,7 @@ AC_SUBST(PHP4INC)
done ) done )
#---------------------------------------------------------------- #----------------------------------------------------------------
# Detect ocaml # Look for ocaml
#---------------------------------------------------------------- #----------------------------------------------------------------
AC_ARG_WITH(ocaml,[ --with-ocaml=path Set location of ocaml executable],[ OCAMLBIN="$withval"], [OCAMLBIN=]) AC_ARG_WITH(ocaml,[ --with-ocaml=path Set location of ocaml executable],[ OCAMLBIN="$withval"], [OCAMLBIN=])
@ -1013,8 +985,8 @@ AC_SUBST(PIKEDYNAMICLINKING)
# Root directory # Root directory
# Translate path for native Windows compilers on Cygwin for use with 'make check' # Translate path for native Windows compilers on Cygwin for use with 'make check'
ROOT_DIR=`pwd` ROOT_DIR=`pwd`
case $ac_sys_system/$ac_sys_release in case $host in
CYGWIN*) ROOT_DIR=`cygpath --mixed $ROOT_DIR`;; *-*-cygwin* | *-*-mingw*) ROOT_DIR=`cygpath --mixed $ROOT_DIR`;;
esac esac
AC_SUBST(ROOT_DIR) AC_SUBST(ROOT_DIR)