Merge branch 'wsfulton-appveyor2'

* wsfulton-appveyor2:
  Appveyor: partialcheck test-suite
  Remove appveyor debugging code
  Add CI testing for Windows using Appveyor
  Python 2 and 3 testing on Windows
  Detect Java on 64 bit windows
  Allow for spaces in path to java include directory and executables
  gcc and mno-cygwin tweaks on cygwin/mingw
  preinst-swig script support for native windows paths
  Add CSHARPOPTIONS for users to customise C# compiler flags
  Portability fixes for python example
  PY3 fixes for import_package example
  Update AX_PATH_GENERIC for spaces support
  Add support for Windows in AX_BOOST_BASE
  CSharp test-suite support on windows
This commit is contained in:
William S Fulton 2015-04-04 02:18:15 +01:00
commit 10c34adf25
17 changed files with 384 additions and 146 deletions

View file

@ -1345,6 +1345,8 @@ CSHARPCOMPILER = @CSHARPCOMPILER@
CSHARPCILINTERPRETER = @CSHARPCILINTERPRETER@ CSHARPCILINTERPRETER = @CSHARPCILINTERPRETER@
CSHARPCILINTERPRETER_FLAGS = @CSHARPCILINTERPRETER_FLAGS@ CSHARPCILINTERPRETER_FLAGS = @CSHARPCILINTERPRETER_FLAGS@
CSHARPCFLAGS = @CSHARPCFLAGS@ CSHARPCFLAGS = @CSHARPCFLAGS@
CSHARPFLAGS =
CSHARPOPTIONS =
CSHARPSO = @CSHARPSO@ CSHARPSO = @CSHARPSO@
CSHARP_RUNME = $(CSHARPCILINTERPRETER) $(CSHARPCILINTERPRETER_FLAGS) ./$(RUNME).exe CSHARP_RUNME = $(CSHARPCILINTERPRETER) $(CSHARPCILINTERPRETER_FLAGS) ./$(RUNME).exe
@ -1377,7 +1379,7 @@ SRCDIR_CSHARPSRCS =
endif endif
csharp_compile: $(SRCDIR_SRCS) csharp_compile: $(SRCDIR_SRCS)
$(COMPILETOOL) $(CSHARPCOMPILER) $(CSHARPFLAGS) $(CSHARPSRCS) $(SRCDIR_CSHARPSRCS) $(COMPILETOOL) $(CSHARPCOMPILER) $(CSHARPFLAGS) $(CSHARPOPTIONS) $(CSHARPSRCS) $(SRCDIR_CSHARPSRCS)
# ----------------------------------------------------------------- # -----------------------------------------------------------------
# Run CSharp example # Run CSharp example

View file

@ -2,7 +2,6 @@ TOP = ../..
SWIG = $(realpath $(TOP)/../preinst-swig) SWIG = $(realpath $(TOP)/../preinst-swig)
SWIGOPT = SWIGOPT =
LIBS = LIBS =
PY3 =
import_packages_subdirs = \ import_packages_subdirs = \
same_modnames1 \ same_modnames1 \

View file

@ -2,7 +2,6 @@ TOP = ../../..
SWIG = $(realpath $(TOP)/../preinst-swig) SWIG = $(realpath $(TOP)/../preinst-swig)
SWIGOPT = SWIGOPT =
LIBS = LIBS =
PY3 =
ifeq (,$(PY3)) ifeq (,$(PY3))
PKG1DIR = "py2" PKG1DIR = "py2"

View file

@ -2,7 +2,6 @@ TOP = ../../..
SWIG = $(realpath $(TOP)/../preinst-swig) SWIG = $(realpath $(TOP)/../preinst-swig)
SWIGOPT = SWIGOPT =
LIBS = LIBS =
PY3 =
ifeq (,$(PY3)) ifeq (,$(PY3))
PKG1DIR = "py2" PKG1DIR = "py2"

View file

@ -2,7 +2,6 @@ TOP = ../../..
SWIG = $(realpath $(TOP)/../preinst-swig) SWIG = $(realpath $(TOP)/../preinst-swig)
SWIGOPT = SWIGOPT =
LIBS = LIBS =
PY3 =
ifeq (,$(PY3)) ifeq (,$(PY3))
PKG1DIR = "py2" PKG1DIR = "py2"

View file

@ -2,7 +2,6 @@ TOP = ../../..
SWIG = $(realpath $(TOP)/../preinst-swig) SWIG = $(realpath $(TOP)/../preinst-swig)
SWIGOPT = SWIGOPT =
LIBS = LIBS =
PY3 =
ifeq (,$(PY3)) ifeq (,$(PY3))
PKG1DIR = "py2" PKG1DIR = "py2"

View file

@ -2,7 +2,6 @@ TOP = ../../..
SWIG = $(realpath $(TOP)/../preinst-swig) SWIG = $(realpath $(TOP)/../preinst-swig)
SWIGOPT = SWIGOPT =
LIBS = LIBS =
PY3 =
ifeq (,$(PY3)) ifeq (,$(PY3))
PKG1DIR = "py2" PKG1DIR = "py2"

View file

@ -2,7 +2,6 @@ TOP = ../../..
SWIG = $(realpath $(TOP)/../preinst-swig) SWIG = $(realpath $(TOP)/../preinst-swig)
SWIGOPT = SWIGOPT =
LIBS = LIBS =
PY3 =
ifeq (,$(PY3)) ifeq (,$(PY3))
PKG1DIR = "py2" PKG1DIR = "py2"

View file

@ -73,7 +73,7 @@ extern int gcdmain(int argc, char *argv[]);
} }
utf8str = PyUnicode_AsUTF8String($input); utf8str = PyUnicode_AsUTF8String($input);
PyBytes_AsStringAndSize(utf8str, &cstr, &len); PyBytes_AsStringAndSize(utf8str, &cstr, &len);
$1 = strndup(cstr, (size_t)len); $1 = strncpy((char *)malloc(len+1), cstr, (size_t)len);
$2 = (int)len; $2 = (int)len;
Py_DECREF(utf8str); Py_DECREF(utf8str);
%#else %#else
@ -106,7 +106,7 @@ extern int count(char *bytes, int len, char c);
Py_ssize_t len; Py_ssize_t len;
PyObject *utf8str = PyUnicode_AsUTF8String($input); PyObject *utf8str = PyUnicode_AsUTF8String($input);
PyBytes_AsStringAndSize(utf8str, &cstr, &len); PyBytes_AsStringAndSize(utf8str, &cstr, &len);
$1 = strndup(cstr, (size_t)len); $1 = strncpy((char *)malloc(len+1), cstr, (size_t)len);
$2 = (int)len; $2 = (int)len;
Py_DECREF(utf8str); Py_DECREF(utf8str);
%#else %#else

View file

@ -6,8 +6,7 @@ LANGUAGE = csharp
SCRIPTSUFFIX = _runme.cs SCRIPTSUFFIX = _runme.cs
CSHARPCILINTERPRETER = @CSHARPCILINTERPRETER@ CSHARPCILINTERPRETER = @CSHARPCILINTERPRETER@
CSHARPCILINTERPRETER_FLAGS = @CSHARPCILINTERPRETER_FLAGS@ CSHARPCILINTERPRETER_FLAGS = @CSHARPCILINTERPRETER_FLAGS@
CSHARPPATHSEPARATOR = "@CSHARPPATHSEPARATOR@" CSHARPCONVERTPATH = @top_srcdir@/@CSHARPCONVERTPATH@
CSHARPCYGPATH_W = @CSHARPCYGPATH_W@
srcdir = @srcdir@ srcdir = @srcdir@
top_srcdir = ../@top_srcdir@ top_srcdir = ../@top_srcdir@
@ -79,13 +78,13 @@ run_testcase = \
if [ -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \ if [ -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
$(MAKE) -f $*/$(top_builddir)/$(EXAMPLES)/Makefile \ $(MAKE) -f $*/$(top_builddir)/$(EXAMPLES)/Makefile \
CSHARPFLAGS='-nologo -debug+ $(CSHARPFLAGSSPECIAL) -out:$*_runme.exe' \ CSHARPFLAGS='-nologo -debug+ $(CSHARPFLAGSSPECIAL) -out:$*_runme.exe' \
CSHARPSRCS='`$(CSHARPCYGPATH_W) $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX)` `find $* -name "*.cs" -exec $(CSHARPCYGPATH_W) "{}" \+`' csharp_compile && \ CSHARPSRCS='`$(CSHARPCONVERTPATH) $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX)` `find $* -name "*.cs" -exec $(CSHARPCONVERTPATH) "{}" \+`' csharp_compile && \
env LD_LIBRARY_PATH="$*:$$LD_LIBRARY_PATH" PATH="$*:$$PATH" SHLIB_PATH="$*:$$SHLIB_PATH" DYLD_FALLBACK_LIBRARY_PATH= $(RUNTOOL) $(CSHARPCILINTERPRETER) $(CSHARPCILINTERPRETER_FLAGS) ./$*_runme.exe; \ env LD_LIBRARY_PATH="$*:$$LD_LIBRARY_PATH" PATH="$*:$$PATH" SHLIB_PATH="$*:$$SHLIB_PATH" DYLD_FALLBACK_LIBRARY_PATH= $(RUNTOOL) $(CSHARPCILINTERPRETER) $(CSHARPCILINTERPRETER_FLAGS) ./$*_runme.exe; \
else \ else \
cd $* && \ cd $* && \
$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile \ $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile \
CSHARPFLAGS='-nologo -debug+ $(CSHARPFLAGSSPECIAL) -t:module -out:$*.netmodule' \ CSHARPFLAGS='-nologo -debug+ $(CSHARPFLAGSSPECIAL) -t:module -out:$*.netmodule' \
CSHARPSRCS='`find . -name "*.cs" -exec $(CSHARPCYGPATH_W) "{}" \+`' csharp_compile; \ CSHARPSRCS='`find . -name "*.cs" -exec ../$(CSHARPCONVERTPATH) "{}" \+`' csharp_compile; \
fi fi
# Clean: remove testcase directories # Clean: remove testcase directories

View file

@ -33,7 +33,7 @@
# and this notice are preserved. This file is offered as-is, without any # and this notice are preserved. This file is offered as-is, without any
# warranty. # warranty.
#serial 23 #serial 26
AC_DEFUN([AX_BOOST_BASE], AC_DEFUN([AX_BOOST_BASE],
[ [
@ -92,8 +92,11 @@ if test "x$want_boost" = "xyes"; then
libsubdirs="lib" libsubdirs="lib"
ax_arch=`uname -m` ax_arch=`uname -m`
case $ax_arch in case $ax_arch in
x86_64|ppc64|s390x|sparc64|aarch64) x86_64)
libsubdirs="lib64 lib lib64" libsubdirs="lib64 libx32 lib lib64"
;;
ppc64|s390x|sparc64|aarch64|ppc64le)
libsubdirs="lib64 lib lib64 ppc64le"
;; ;;
esac esac
@ -170,6 +173,10 @@ if test "x$want_boost" = "xyes"; then
dnl if we found no boost with system layout we search for boost libraries dnl if we found no boost with system layout we search for boost libraries
dnl built and installed without the --layout=system option or for a staged(not installed) version dnl built and installed without the --layout=system option or for a staged(not installed) version
if test "x$succeeded" != "xyes"; then if test "x$succeeded" != "xyes"; then
CPPFLAGS="$CPPFLAGS_SAVED"
LDFLAGS="$LDFLAGS_SAVED"
BOOST_CPPFLAGS=
BOOST_LDFLAGS=
_version=0 _version=0
if test "$ac_boost_path" != ""; then if test "$ac_boost_path" != ""; then
if test -d "$ac_boost_path" && test -r "$ac_boost_path"; then if test -d "$ac_boost_path" && test -r "$ac_boost_path"; then
@ -182,6 +189,12 @@ if test "x$want_boost" = "xyes"; then
VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'` VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'`
BOOST_CPPFLAGS="-I$ac_boost_path/include/boost-$VERSION_UNDERSCORE" BOOST_CPPFLAGS="-I$ac_boost_path/include/boost-$VERSION_UNDERSCORE"
done done
dnl if nothing found search for layout used in Windows distributions
if test -z "$BOOST_CPPFLAGS"; then
if test -d "$ac_boost_path/boost" && test -r "$ac_boost_path/boost"; then
BOOST_CPPFLAGS="-I$ac_boost_path"
fi
fi
fi fi
else else
if test "$cross_compiling" != yes; then if test "$cross_compiling" != yes; then
@ -270,4 +283,3 @@ if test "x$want_boost" = "xyes"; then
fi fi
]) ])

View file

@ -69,7 +69,7 @@
# and this notice are preserved. This file is offered as-is, without any # and this notice are preserved. This file is offered as-is, without any
# warranty. # warranty.
#serial 11 #serial 13
AU_ALIAS([AC_PATH_GENERIC], [AX_PATH_GENERIC]) AU_ALIAS([AC_PATH_GENERIC], [AX_PATH_GENERIC])
AC_DEFUN([AX_PATH_GENERIC],[ AC_DEFUN([AX_PATH_GENERIC],[
@ -89,7 +89,7 @@ AC_DEFUN([AX_PATH_GENERIC],[
AC_ARG_VAR(UP[]_CFLAGS, [CFLAGS used for $1]) AC_ARG_VAR(UP[]_CFLAGS, [CFLAGS used for $1])
AC_ARG_VAR(UP[]_LIBS, [LIBS used for $1]) AC_ARG_VAR(UP[]_LIBS, [LIBS used for $1])
AS_IF([test x$UP[]_CFLAGS != x -o x$UP[]_LIBS != x],[ AS_IF([test x"$UP[]_CFLAGS" != x -o x"$UP[]_LIBS" != x],[
dnl Don't run config script at all, use user-provided values instead. dnl Don't run config script at all, use user-provided values instead.
AC_SUBST(UP[]_CFLAGS) AC_SUBST(UP[]_CFLAGS)
AC_SUBST(UP[]_LIBS) AC_SUBST(UP[]_LIBS)

27
Tools/convertpath Executable file
View file

@ -0,0 +1,27 @@
#!/bin/sh
# Unix to Windows relative path conversion in a script.
# Useful for avoiding backslash quoting difficulties in Makefiles.
# Acts as a much dumbed down 'cygpath -w' tool.
usage()
{
cat <<EOF
Usage: $0 [-w|-u|-h] [path]...
Convert Windows and Unix paths (intended for simple relative paths only)
-w Convert backslashes to forward slashes in the paths
-u Convert forward slashes to backslashes in the paths
EOF
}
option="$1"
case "$option" in
-w) shift; echo $@ | sed -e 's,/,\\,g' ;;
-u) shift; echo $@ | sed -e 's,\\,/,g' ;;
-h) shift; usage; ;;
*) usage; exit 1 ;;
esac
exit 0

View file

@ -2,9 +2,9 @@
# This is a simple utility for Cygwin/Mingw which is useful when running the SWIG # This is a simple utility for Cygwin/Mingw which is useful when running the SWIG
# test-suite through Visual Studio. If the output from the test-suite is piped # test-suite through Visual Studio. If the output from the test-suite is piped
# through this utility, it will filter the junk that the compiler generates. # through this utility, it will filter the junk that the compiler outputs to stdout.
# Typical usage: make check | vcfilter # Typical usage: make check | vcfilter
# dos2unix needed for ^ and $ to work. # dos2unix needed for ^ and $ to work.
2>&1 dos2unix | grep -v "\.cxx$" | grep -v "\.c$" | grep -v "^ Creating library" | grep -v "^Generating Code" 2>&1 dos2unix | grep -v -e "\.cxx$" -e "\.c$" -e "^ Creating library" -e "^Generating Code"

74
appveyor.yml Executable file
View file

@ -0,0 +1,74 @@
os:
- Unstable
platform:
- x86
- x64
environment:
matrix:
- SWIGLANG: csharp
- SWIGLANG: java
- SWIGLANG: python
VER: 27
- SWIGLANG: python
VER: 34
PY3: 1
install:
- date /T & time /T
- set
- set PATH=C:\cygwin\bin;%PATH%
- set CYGWIN=nodosfilewarning
- git clone -q --depth=1 --single-branch --branch cccl-1.0 git://github.com/swig/cccl.git C:\cccl-1.0
- bash -c "cp C:/cccl-1.0/cccl /usr/bin"
- ps: >-
If ($env:Platform -Match "x86") {
$env:PCRE_PLATFORM="Win32"
$env:JAVA_HOME="C:/Program Files (x86)/Java/jdk1.8.0"
$env:VCVARS_PLATFORM="x86"
$env:LANG_PLATFORM=""
} Else {
$env:PCRE_PLATFORM="x64"
$env:JAVA_HOME="C:/Program Files/Java/jdk1.8.0"
$env:VCVARS_PLATFORM="amd64"
$env:LANG_PLATFORM="-x64"
}
- call "%VS120COMNTOOLS%\..\..\VC\vcvarsall.bat" %VCVARS_PLATFORM%
- nuget install pcre -Verbosity detailed -Version 8.33.0.1 -OutputDirectory C:\pcre
- set PCRE_ROOT=C:/pcre/pcre.8.33.0.1/build/native
- set PATH=C:\Python%VER%%LANG_PLATFORM%;%PATH%
- python -V
- bash -c "which python"
- bash -c "python -V"
- bash -c "which cl.exe"
- bash -c "cl.exe /? 2>&1 | head -n 2"
- bash -c "which csc.exe"
- bash -c "csc.exe /? | head -n 2"
- bash -c "which cccl"
- bash -c "cccl --version"
- make --version
- uname -a
build_script:
- set CCCL_OPTIONS=--cccl-muffle /W3
- set CHECK_OPTIONS=CSHARPOPTIONS=-platform:%Platform%
# Open dummy file descriptor to fix error on cygwin: ./configure: line 560: 0: Bad file descriptor
- bash -c "exec 0</dev/null && ./autogen.sh && time ./configure --disable-dependency-tracking --disable-ccache CC=cccl CXX=cccl CFLAGS='-O2' CXXFLAGS='-O2' LDFLAGS='--cccl-link /LTCG' PCRE_CFLAGS='-I%PCRE_ROOT%/include -DPCRE_STATIC' PCRE_LIBS='-L%PCRE_ROOT%/lib/v110/%PCRE_PLATFORM%/Release/static/utf8 -lpcre8' --with-java='%JAVA_HOME%/bin/java.exe' --with-javac='%JAVA_HOME%/bin/javac.exe' --with-javaincl='%JAVA_HOME%/include' --without-perl5 --without-go --with-boost=C:/Libraries/boost || cat config.log"
- bash -c "time make -s"
test_script:
- set CCCL_OPTIONS=--cccl-muffle /W3 /EHsc
# (Warning below is fixed in newer versions of Python (2.7.9)) '_hypot' : recursive on all control paths, function will cause runtime stack overflow
- ps: >-
If ("$env:SWIGLANG$env:VER" -Match "python27") {
$env:CCCL_OPTIONS="$env:CCCL_OPTIONS /wd4717"
}
- .\swig.exe -version
- bash -c "file ./swig.exe"
- bash -c "time make -k check-%SWIGLANG%-version"
- bash -c "time make -k check-%SWIGLANG%-examples %CHECK_OPTIONS%"
- bash -c "time make -k partialcheck-%SWIGLANG%-test-suite %CHECK_OPTIONS%"
# Do not build on tags (GitHub only)
skip_tags: true

375
configure.ac Normal file → Executable file
View file

@ -601,6 +601,7 @@ AC_SUBST(TCLCXXSHARED)
PYINCLUDE= PYINCLUDE=
PYLIB= PYLIB=
PYLINK=
PYPACKAGE= PYPACKAGE=
AC_ARG_WITH(python, AS_HELP_STRING([--without-python], [Disable Python]) AC_ARG_WITH(python, AS_HELP_STRING([--without-python], [Disable Python])
@ -617,64 +618,106 @@ else
PYTHON="$PYBIN" PYTHON="$PYBIN"
fi fi
PYVER=0
if test -n "$PYTHON"; then if test -n "$PYTHON"; then
AC_MSG_CHECKING([for $PYTHON major version number])
PYVER=`($PYTHON -c "import sys; sys.stdout.write(sys.version[[0]])") 2>/dev/null`
AC_MSG_RESULT($PYVER)
if test -z "$PYVER"; then
PYVER=0
fi
fi
if test $PYVER -le 2; then
AC_MSG_CHECKING(for Python prefix) AC_MSG_CHECKING(for Python prefix)
PYPREFIX=`($PYTHON -c "import sys; print sys.prefix") 2>/dev/null` PYPREFIX=`($PYTHON -c "import sys; sys.stdout.write(sys.prefix)") 2>/dev/null`
AC_MSG_RESULT($PYPREFIX) AC_MSG_RESULT($PYPREFIX)
AC_MSG_CHECKING(for Python exec-prefix) AC_MSG_CHECKING(for Python exec-prefix)
PYEPREFIX=`($PYTHON -c "import sys; print sys.exec_prefix") 2>/dev/null` PYEPREFIX=`($PYTHON -c "import sys; sys.stdout.write(sys.exec_prefix)") 2>/dev/null`
AC_MSG_RESULT($PYEPREFIX) AC_MSG_RESULT($PYEPREFIX)
AC_MSG_CHECKING(for Python os.name)
PYOSNAME=`($PYTHON -c "import sys, os; sys.stdout.write(os.name)")`
AC_MSG_RESULT($PYOSNAME)
if test x"$PYOSNAME" = x"nt"; then
# Windows installations are quite different to posix installations
PYPREFIX=`echo "$PYPREFIX" | sed -e 's,\\\\,/,g'` # Forward slashes are easier to use and even work on Windows most of the time
PYTHON_SO=.pyd
# Note: I could not think of a standard way to get the version string from different versions. AC_MSG_CHECKING(for Python header files)
# This trick pulls it out of the file location for a standard library file. if test -r $PYPREFIX/include/Python.h; then
PYINCLUDE="-I$PYPREFIX/include"
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
# Fedora patch Python to add sys.lib, for other distros we 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
fi AC_MSG_RESULT($PYINCLUDE)
AC_MSG_RESULT($PYINCLUDE)
# Set the library directory blindly. This probably won't work with older versions AC_MSG_CHECKING(for Python library directory)
AC_MSG_CHECKING(for Python library) if test -d $PYPREFIX/libs; then
dirs="$PYVERSION/config $PYVERSION/$PYLIBDIR python/$PYLIBDIR" PYLIB=$PYPREFIX/libs
for i in $dirs; do PYLINKFILE=`ls $PYLIB/python*.lib | grep "python[[0-9]][[0-9]]\.lib"`
if test -d $PYEPREFIX/$PYLIBDIR/$i; then if test -r "$PYLINKFILE"; then
PYLIB="$PYEPREFIX/$PYLIBDIR/$i" PYLINK=-l`basename $PYLINKFILE | sed -e 's/\.lib$//'`
break else
PYLIB=
fi
fi fi
done else
# 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 sys,string,operator,os.path; sys.stdout.write(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; sys.stdout.write(sys.lib)") 2>/dev/null`
if test -z "$PYLIBDIR"; then
# Fedora patch Python to add sys.lib, for other distros we 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 directory)
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
PYLINK="-l$PYVERSION"
fi
if test -z "$PYLIB"; then if test -z "$PYLIB"; then
AC_MSG_RESULT(Not found) AC_MSG_RESULT(Not found)
else else
AC_MSG_RESULT($PYLIB) AC_MSG_RESULT($PYLIB)
fi fi
AC_MSG_CHECKING(for Python library)
PYLINK="-l$PYVERSION" if test -z "$PYLINK"; then
AC_MSG_RESULT(Not found)
else
AC_MSG_RESULT($PYLINK)
fi
fi fi
# Cygwin (Windows) needs the library for dynamic linking # Cygwin (Windows) needs the library for dynamic linking
@ -697,11 +740,9 @@ AC_SUBST(PYTHONDYNAMICLINKING)
# Look for Python 3.x # Look for Python 3.x
#---------------------------------------------------------------- #----------------------------------------------------------------
# mostly copy & pasted from "Look for Python" section,
# did some trim, fix and rename
PY3INCLUDE= PY3INCLUDE=
PY3LIB= PY3LIB=
PY3LINK=
PY3PACKAGE= PY3PACKAGE=
AC_ARG_WITH(python3, AS_HELP_STRING([--without-python3], [Disable Python 3.x support]) AC_ARG_WITH(python3, AS_HELP_STRING([--without-python3], [Disable Python 3.x support])
@ -712,7 +753,7 @@ if test x"${PY3BIN}" = xno -o x"${with_alllang}" = xno ; then
AC_MSG_NOTICE([Disabling Python 3.x support]) AC_MSG_NOTICE([Disabling Python 3.x support])
else else
if test "x$PY3BIN" = xyes; then if test "x$PY3BIN" = xyes; then
for py_ver in 3 3.6 3.5 3.4 3.3 3.2 3.1 3.0; do for py_ver in 3 3.9 3.8 3.7 3.6 3.5 3.4 3.3 3.2 3.1 3.0 ""; do
AC_CHECK_PROGS(PYTHON3, [python$py_ver]) AC_CHECK_PROGS(PYTHON3, [python$py_ver])
if test -n "$PYTHON3"; then if test -n "$PYTHON3"; then
AC_CHECK_PROGS(PY3CONFIG, [$PYTHON3-config]) AC_CHECK_PROGS(PY3CONFIG, [$PYTHON3-config])
@ -726,63 +767,121 @@ else
AC_CHECK_PROGS(PY3CONFIG, [$PYTHON3-config]) AC_CHECK_PROGS(PY3CONFIG, [$PYTHON3-config])
fi fi
PYVER=0
if test -n "$PYTHON3" -a -n "$PY3CONFIG"; then if test -n "$PYTHON3"; then
AC_MSG_CHECKING([for Python 3.x prefix]) AC_MSG_CHECKING([for $PYTHON3 major version number])
PY3PREFIX=`($PY3CONFIG --prefix) 2>/dev/null` PYVER=`($PYTHON3 -c "import sys; sys.stdout.write(sys.version[[0]])") 2>/dev/null`
AC_MSG_RESULT($PY3PREFIX) AC_MSG_RESULT($PYVER)
AC_MSG_CHECKING(for Python 3.x exec-prefix) if test -z "$PYVER"; then
PY3EPREFIX=`($PY3CONFIG --exec-prefix) 2>/dev/null` PYVER=0
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 fi
AC_MSG_RESULT($PY3LIBDIR) fi
# Set the include directory if test $PYVER -ge 3; then
AC_MSG_CHECKING(for Python 3.x os.name)
PY3OSNAME=`($PYTHON3 -c "import sys, os; sys.stdout.write(os.name)")`
AC_MSG_RESULT($PY3OSNAME)
AC_MSG_CHECKING([for Python 3.x header files]) if test x"$PY3OSNAME" = x"nt"; then
PY3INCLUDE=`($PY3CONFIG --includes) 2>/dev/null` # Windows installations are quite different to posix installations
AC_MSG_RESULT($PY3INCLUDE) # There is no python-config to use
AC_MSG_CHECKING(for Python 3.x prefix)
PY3PREFIX=`($PYTHON3 -c "import sys; sys.stdout.write(sys.prefix)") 2>/dev/null`
AC_MSG_RESULT($PY3PREFIX)
PY3PREFIX=`echo "$PY3PREFIX" | sed -e 's,\\\\,/,g'` # Forward slashes are easier to use and even work on Windows most of the time
PYTHON_SO=.pyd
# Set the library directory blindly. This probably won't work with older versions AC_MSG_CHECKING(for Python 3.x header files)
AC_MSG_CHECKING([for Python 3.x library]) if test -r $PY3PREFIX/include/Python.h; then
dirs="$PY3VERSION/config $PY3VERSION/$PY3LIBDIR python/$PY3LIBDIR" PY3INCLUDE="-I$PY3PREFIX/include"
for i in $dirs; do
if test -d $PY3EPREFIX/$PY3LIBDIR/$i; then
PY3LIB="$PY3EPREFIX/$PY3LIBDIR/$i"
break
fi fi
done AC_MSG_RESULT($PY3INCLUDE)
if test -z "$PY3LIB"; then
AC_MSG_RESULT([Not found])
else
AC_MSG_RESULT($PY3LIB)
fi
PY3LINK="-l$PY3VERSION" AC_MSG_CHECKING(for Python 3.x library directory)
if test -d $PY3PREFIX/libs; then
PY3LIB=$PY3PREFIX/libs
PY3LINKFILE=`ls $PY3LIB/python*.lib | grep "python[[0-9]][[0-9]]\.lib"`
if test -r "$PY3LINKFILE"; then
PY3LINK=-l`basename $PY3LINKFILE | sed -e 's/\.lib$//'`
else
PY3LIB=
fi
fi
if test -z "$PY3LIB"; then
AC_MSG_RESULT([Not found])
else
AC_MSG_RESULT($PY3LIB)
fi
AC_MSG_CHECKING([for Python 3.x library])
if test -z "$PY3LINK"; then
AC_MSG_RESULT(Not found)
else
AC_MSG_RESULT($PY3LINK)
fi
elif test -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 directory])
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"
AC_MSG_CHECKING([for Python 3.x library])
if test -z "$PY3LINK"; then
AC_MSG_RESULT(Not found)
else
AC_MSG_RESULT($PY3LINK)
fi
fi
fi fi
# Cygwin (Windows) needs the library for dynamic linking # Cygwin (Windows) needs the library for dynamic linking
case $host in case $host in
*-*-cygwin* | *-*-mingw*) *-*-cygwin* | *-*-mingw*)
PYTHON3DYNAMICLINKING="-L$PYLIB $PY3LINK" PYTHON3DYNAMICLINKING="-L$PY3LIB $PY3LINK"
DEFS="-DUSE_DL_IMPORT $DEFS" DEFS="-DUSE_DL_IMPORT $DEFS"
;; ;;
*)PYTHON3DYNAMICLINKING="";; *)PYTHON3DYNAMICLINKING="";;
@ -1108,48 +1207,62 @@ fi
AC_MSG_CHECKING(for java include file jni.h) 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=]) AC_ARG_WITH(javaincl, [ --with-javaincl=path Set location of Java include directory], [JAVAINCDIR="$withval"], [JAVAINCDIR=])
JAVAINC=""
if test -z "$JAVAINCDIR" ; then 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/lib64/jvm/java*/include /usr/include/kaffe /usr/local/include/kaffe /usr/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/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/lib64/jvm/java*/include /usr/include/kaffe /usr/local/include/kaffe /usr/include"
# Add in default installation directory on Windows for Cygwin # Add in default installation directory on Windows for Cygwin
case $host in 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";; *-*-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";; *-*-darwin*) JAVAINCDIR="/System/Library/Frameworks/JavaVM.framework/Headers $JAVAINCDIR";;
*);; *);;
esac esac
fi
JAVAINC="" for d in $JAVAINCDIR ; do
for d in $JAVAINCDIR ; do if test -r "$d/jni.h" ; then
if test -r "$d/jni.h" ; then JAVAINCDIR=$d
AC_MSG_RESULT($d) JAVAINC=-I\"$d\"
JAVAINCDIR=$d break
JAVAINC=-I\"$d\" fi
break done
else
if test -r "$JAVAINCDIR/jni.h" ; then
JAVAINC=-I\"$JAVAINCDIR\"
fi fi
done fi
if test "$JAVAINC" = "" ; then if test "$JAVAINC" = "" ; then
AC_MSG_RESULT(not found) AC_MSG_RESULT(not found)
else else
AC_MSG_RESULT($JAVAINC)
# now look for <arch>/jni_md.h # now look for <arch>/jni_md.h
AC_MSG_CHECKING(for java include file jni_md.h) AC_MSG_CHECKING(for java include file jni_md.h)
JAVAMDDIR=`find "$JAVAINCDIR" -follow -name jni_md.h -print` JAVAMDDIR=`find "$JAVAINCDIR" -follow -name jni_md.h -print`
if test "$JAVAMDDIR" = "" ; then if test "$JAVAMDDIR" = "" ; then
AC_MSG_RESULT(not found) AC_MSG_RESULT(not found)
else else
JAVAMDDIR=`dirname "$JAVAMDDIR" | tail -1` JAVAMDDIR=-I\"`dirname "$JAVAMDDIR" | tail -1`\"
JAVAINC="${JAVAINC} -I\"$JAVAMDDIR\""
AC_MSG_RESULT($JAVAMDDIR) AC_MSG_RESULT($JAVAMDDIR)
JAVAINC="${JAVAINC} ${JAVAMDDIR}"
fi fi
fi fi
case $host in
*-*-cygwin*)
# TODO: Only use this flag if the compiler supports it, later versions of gcc no longer have it
GCC_MNO_CYGWIN=" -mno-cygwin"
;;
*)
GCC_MNO_CYGWIN=""
;;
esac
# 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 $host in case $host in
*-*-cygwin* | *-*-mingw*) *-*-cygwin* | *-*-mingw*)
if test "$GCC" = yes; then if test "$GCC" = yes; then
JAVADYNAMICLINKING=" -mno-cygwin -mthreads -Wl,--add-stdcall-alias" JAVADYNAMICLINKING="$GCC_MNO_CYGWIN -mthreads -Wl,--add-stdcall-alias"
JAVACFLAGS="-mno-cygwin -mthreads" JAVACFLAGS="$GCC_MNO_CYGWIN -mthreads"
else else
JAVADYNAMICLINKING="" JAVADYNAMICLINKING=""
JAVACFLAGS="" JAVACFLAGS=""
@ -1185,6 +1298,15 @@ case $host in
esac esac
fi fi
# Quote for spaces in path to executables
if test -n "$JAVA"; then
JAVA=\"$JAVA\"
fi
if test -n "$JAVAC"; then
JAVAC=\"$JAVAC\"
fi
AC_SUBST(JAVA) AC_SUBST(JAVA)
AC_SUBST(JAVAC) AC_SUBST(JAVAC)
AC_SUBST(JAVAINC) AC_SUBST(JAVAINC)
@ -1993,8 +2115,7 @@ else
CSHARPCOMPILER="$CSHARPCOMPILERBIN" CSHARPCOMPILER="$CSHARPCOMPILERBIN"
fi fi
CSHARPPATHSEPARATOR="/" CSHARPCONVERTPATH="Tools/convertpath -u"
CSHARPCYGPATH_W=echo
if test -z "$CSHARPBIN" ; then if test -z "$CSHARPBIN" ; then
CSHARPCILINTERPRETER="" CSHARPCILINTERPRETER=""
CSHARPCILINTERPRETER_FLAGS="" CSHARPCILINTERPRETER_FLAGS=""
@ -2021,8 +2142,7 @@ if test -z "$CSHARPBIN" ; then
CSHARPCILINTERPRETER_FLAGS="--debug" CSHARPCILINTERPRETER_FLAGS="--debug"
else else
if test "csc" = "$CSHARPCOMPILER"; then if test "csc" = "$CSHARPCOMPILER"; then
CSHARPPATHSEPARATOR="\\\\" CSHARPCONVERTPATH="Tools/convertpath -w"
CSHARPCYGPATH_W='cygpath -w'
fi fi
fi fi
fi fi
@ -2034,8 +2154,8 @@ fi
case $host in case $host in
*-*-cygwin* | *-*-mingw*) *-*-cygwin* | *-*-mingw*)
if test "$GCC" = yes; then if test "$GCC" = yes; then
CSHARPDYNAMICLINKING=" -mno-cygwin -mthreads -Wl,--add-stdcall-alias" CSHARPDYNAMICLINKING="$GCC_MNO_CYGWIN -mthreads -Wl,--add-stdcall-alias"
CSHARPCFLAGS="-mno-cygwin -mthreads" CSHARPCFLAGS="$GCC_MNO_CYGWIN -mthreads"
else else
CSHARPDYNAMICLINKING="" CSHARPDYNAMICLINKING=""
CSHARPCFLAGS="" CSHARPCFLAGS=""
@ -2065,11 +2185,10 @@ fi
AC_SUBST(CSHARPCILINTERPRETER_FLAGS) AC_SUBST(CSHARPCILINTERPRETER_FLAGS)
AC_SUBST(CSHARPCILINTERPRETER) AC_SUBST(CSHARPCILINTERPRETER)
AC_SUBST(CSHARPPATHSEPARATOR) AC_SUBST(CSHARPCONVERTPATH)
AC_SUBST(CSHARPCYGPATH_W)
AC_SUBST(CSHARPCOMPILER) AC_SUBST(CSHARPCOMPILER)
AC_SUBST(CSHARPDYNAMICLINKING) AC_SUBST(CSHARPDYNAMICLINKING)
AC_SUBST(CSHARPLIBRARYPREFIX) # Is this going to be used? AC_SUBST(CSHARPLIBRARYPREFIX)
AC_SUBST(CSHARPCFLAGS) AC_SUBST(CSHARPCFLAGS)
AC_SUBST(CSHARPSO) AC_SUBST(CSHARPSO)
@ -2492,14 +2611,14 @@ AC_SUBST(SKIP_OCTAVE)
SKIP_PYTHON= SKIP_PYTHON=
if (test -z "$PYINCLUDE") && if (test -z "$PYINCLUDE" || test -z "$PYLINK") &&
(test -z "$PY3INCLUDE") ; then (test -z "$PY3INCLUDE" || test -z "$PY3LINK") ; then
SKIP_PYTHON="1" SKIP_PYTHON="1"
fi fi
AC_SUBST(SKIP_PYTHON) AC_SUBST(SKIP_PYTHON)
SKIP_PYTHON3= SKIP_PYTHON3=
if test -z "$PY3INCLUDE" ; then if test -z "$PY3INCLUDE" || test -z "$PY3LINK" ; then
SKIP_PYTHON3="1" SKIP_PYTHON3="1"
fi fi
AC_SUBST(SKIP_PYTHON3) AC_SUBST(SKIP_PYTHON3)
@ -2659,15 +2778,21 @@ AC_SUBST(SKIP_ANDROID)
# Miscellaneous # Miscellaneous
#---------------------------------------------------------------- #----------------------------------------------------------------
ABS_SRCDIR=`(cd ${srcdir} && pwd)`
# Root directory # Root directory
# Translate path for native Windows compilers for use with 'make check'
ROOT_DIR=`pwd` ROOT_DIR=`pwd`
case $host in case $host in
*-*-cygwin* | *-*-mingw*) *-*-cygwin*)
# Translate path for native Windows compilers for use with 'make check'
if (cygpath --mixed $ROOT_DIR) >/dev/null 2>/dev/null; then if (cygpath --mixed $ROOT_DIR) >/dev/null 2>/dev/null; then
ROOT_DIR=`cygpath --mixed $ROOT_DIR` ROOT_DIR=`cygpath --mixed $ROOT_DIR`
fi fi
;;
esac
case $host in
*-*-cygwin* | *-*-mingw*)
# Extra files generated by some Windows compilers # Extra files generated by some Windows compilers
EXTRA_CLEAN="*.stackdump *.exp *.lib *.pdb *.ilk" EXTRA_CLEAN="*.stackdump *.exp *.lib *.pdb *.ilk"
;; ;;
@ -2692,6 +2817,14 @@ case $build in
esac esac
AC_DEFINE_UNQUOTED(SWIG_LIB_WIN_UNIX, ["$SWIG_LIB_WIN_UNIX"], [Directory for SWIG system-independent libraries (Unix install on native Windows)]) AC_DEFINE_UNQUOTED(SWIG_LIB_WIN_UNIX, ["$SWIG_LIB_WIN_UNIX"], [Directory for SWIG system-independent libraries (Unix install on native Windows)])
# For testing - Windows builds of SWIG do not need SWIG_LIB set
AC_EGREP_CPP([yes],
[#ifdef _WIN32
yes
#endif
], [SWIG_LIB_PREINST=], [SWIG_LIB_PREINST=$ABS_SRCDIR/Lib])
AC_SUBST(SWIG_LIB_PREINST)
AC_CONFIG_FILES([ AC_CONFIG_FILES([
Makefile Makefile
swig.spec swig.spec

View file

@ -1,7 +1,5 @@
#!/bin/sh #!/bin/sh
builddir=`dirname $0` builddir=`dirname $0`
srcdir=`cd "$builddir" && cd '@srcdir@' && pwd` SWIG_LIB=@SWIG_LIB_PREINST@
SWIG_LIB=$srcdir/Lib
#SWIG_LIB=`cygpath -w $srcdir/Lib` # For native Windows version of SWIG
export SWIG_LIB export SWIG_LIB
exec "$builddir/swig" "$@" exec "$builddir/swig" "$@"