summaryrefslogtreecommitdiff
path: root/Tools
diff options
context:
space:
mode:
authorWilliam S Fulton <wsf@fultondesigns.co.uk>2013-01-28 07:01:37 +0000
committerWilliam S Fulton <wsf@fultondesigns.co.uk>2013-01-28 07:01:37 +0000
commite805d5f9256cdafab06f9958cc48c51083d860da (patch)
treed5ab9ab1f58d3c291a49529a2696798f46de70fa /Tools
parent34d46510cfbcecdeb4fd1a98a2957ecfe5a2db6a (diff)
parent38d454a1022f65d76e292fd13d699da896c0c2cf (diff)
downloadswig-e805d5f9256cdafab06f9958cc48c51083d860da.tar.gz
Merge branch 'master' into gsoc2009-matevz
parser.y still to be fixed up Conflicts: Doc/Devel/engineering.html Examples/Makefile.in Lib/allegrocl/allegrocl.swg Lib/csharp/csharp.swg Lib/csharp/enums.swg Lib/csharp/enumsimple.swg Lib/csharp/enumtypesafe.swg Lib/java/java.swg Lib/python/pydocs.swg Lib/r/rtype.swg Source/Include/swigwarn.h Source/Modules/octave.cxx Source/Modules/python.cxx Source/Modules/ruby.cxx Source/Swig/scanner.c Source/Swig/stype.c Source/Swig/swig.h configure.ac
Diffstat (limited to 'Tools')
-rw-r--r--Tools/config/ac_compare_version.m412
-rw-r--r--Tools/config/ax_boost_base.m4258
-rw-r--r--Tools/config/ax_compare_version.m4177
-rw-r--r--Tools/config/ax_path_generic.m4164
-rwxr-xr-xTools/mkrelease.py13
-rwxr-xr-xTools/mkwindows.sh14
-rwxr-xr-xTools/pcre-build.sh55
-rw-r--r--Tools/pyname_patch.py2
-rw-r--r--Tools/swig.gdb41
9 files changed, 721 insertions, 15 deletions
diff --git a/Tools/config/ac_compare_version.m4 b/Tools/config/ac_compare_version.m4
index 79e94cc83..0828f4789 100644
--- a/Tools/config/ac_compare_version.m4
+++ b/Tools/config/ac_compare_version.m4
@@ -22,19 +22,19 @@ AC_DEFUN([AC_COMPARE_VERSION], [
isolate_b_regex='\([[0-9]]\+\).*'
for ver_part in $nodots_a ; do
b_ver_part=`echo "$ver_b" | sed -e 's/'"$isolate_b_regex"'/\1/'`
- if test \( "$ver_part" -lt "$b_ver_part" \) -a \( "x$condition" == "xequal" \) ; then
+ if test \( "$ver_part" -lt "$b_ver_part" \) -a \( "x$condition" = "xequal" \) ; then
condition=less
- elif test \( "$ver_part" -gt "$b_ver_part" \) -a \( "x$condition" == "xequal" \) ; then
+ elif test \( "$ver_part" -gt "$b_ver_part" \) -a \( "x$condition" = "xequal" \) ; then
condition=greater
fi
isolate_b_regex='[[0-9]]\+\.'"$isolate_b_regex"
done
- if test "x$condition" == "xequal" ; then
+ if test "x$condition" = "xequal" ; then
[$4]
- elif test "x$condition" == "xless" ; then
+ elif test "x$condition" = "xless" ; then
[$3]
- elif test "x$condition" == "xgreater" ; then
+ elif test "x$condition" = "xgreater" ; then
[$5]
fi
-]) \ No newline at end of file
+])
diff --git a/Tools/config/ax_boost_base.m4 b/Tools/config/ax_boost_base.m4
new file mode 100644
index 000000000..54a2a1bee
--- /dev/null
+++ b/Tools/config/ax_boost_base.m4
@@ -0,0 +1,258 @@
+# ===========================================================================
+# http://www.gnu.org/software/autoconf-archive/ax_boost_base.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+# AX_BOOST_BASE([MINIMUM-VERSION], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
+#
+# DESCRIPTION
+#
+# Test for the Boost C++ libraries of a particular version (or newer)
+#
+# If no path to the installed boost library is given the macro searchs
+# under /usr, /usr/local, /opt and /opt/local and evaluates the
+# $BOOST_ROOT environment variable. Further documentation is available at
+# <http://randspringer.de/boost/index.html>.
+#
+# This macro calls:
+#
+# AC_SUBST(BOOST_CPPFLAGS) / AC_SUBST(BOOST_LDFLAGS)
+#
+# And sets:
+#
+# HAVE_BOOST
+#
+# LICENSE
+#
+# Copyright (c) 2008 Thomas Porschberg <thomas@randspringer.de>
+# Copyright (c) 2009 Peter Adolphs
+#
+# Copying and distribution of this file, with or without modification, are
+# permitted in any medium without royalty provided the copyright notice
+# and this notice are preserved. This file is offered as-is, without any
+# warranty.
+
+#serial 20
+
+AC_DEFUN([AX_BOOST_BASE],
+[
+AC_ARG_WITH([boost],
+ [AS_HELP_STRING([--with-boost@<:@=ARG@:>@],
+ [use Boost library from a standard location (ARG=yes),
+ from the specified location (ARG=<path>),
+ or disable it (ARG=no)
+ @<:@ARG=yes@:>@ ])],
+ [
+ if test "$withval" = "no"; then
+ want_boost="no"
+ elif test "$withval" = "yes"; then
+ want_boost="yes"
+ ac_boost_path=""
+ else
+ want_boost="yes"
+ ac_boost_path="$withval"
+ fi
+ ],
+ [want_boost="yes"])
+
+
+AC_ARG_WITH([boost-libdir],
+ AS_HELP_STRING([--with-boost-libdir=LIB_DIR],
+ [Force given directory for boost libraries. Note that this will override library path detection, so use this parameter only if default library detection fails and you know exactly where your boost libraries are located.]),
+ [
+ if test -d "$withval"
+ then
+ ac_boost_lib_path="$withval"
+ else
+ AC_MSG_ERROR(--with-boost-libdir expected directory name)
+ fi
+ ],
+ [ac_boost_lib_path=""]
+)
+
+if test "x$want_boost" = "xyes"; then
+ boost_lib_version_req=ifelse([$1], ,1.20.0,$1)
+ boost_lib_version_req_shorten=`expr $boost_lib_version_req : '\([[0-9]]*\.[[0-9]]*\)'`
+ boost_lib_version_req_major=`expr $boost_lib_version_req : '\([[0-9]]*\)'`
+ boost_lib_version_req_minor=`expr $boost_lib_version_req : '[[0-9]]*\.\([[0-9]]*\)'`
+ boost_lib_version_req_sub_minor=`expr $boost_lib_version_req : '[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)'`
+ if test "x$boost_lib_version_req_sub_minor" = "x" ; then
+ boost_lib_version_req_sub_minor="0"
+ fi
+ WANT_BOOST_VERSION=`expr $boost_lib_version_req_major \* 100000 \+ $boost_lib_version_req_minor \* 100 \+ $boost_lib_version_req_sub_minor`
+ AC_MSG_CHECKING(for boostlib >= $boost_lib_version_req)
+ succeeded=no
+
+ dnl On 64-bit systems check for system libraries in both lib64 and lib.
+ dnl The former is specified by FHS, but e.g. Debian does not adhere to
+ dnl this (as it rises problems for generic multi-arch support).
+ dnl The last entry in the list is chosen by default when no libraries
+ dnl are found, e.g. when only header-only libraries are installed!
+ libsubdirs="lib"
+ ax_arch=`uname -m`
+ if test $ax_arch = x86_64 -o $ax_arch = ppc64 -o $ax_arch = s390x -o $ax_arch = sparc64; then
+ libsubdirs="lib64 lib lib64"
+ fi
+
+ dnl first we check the system location for boost libraries
+ dnl this location ist chosen if boost libraries are installed with the --layout=system option
+ dnl or if you install boost with RPM
+ if test "$ac_boost_path" != ""; then
+ BOOST_CPPFLAGS="-I$ac_boost_path/include"
+ for ac_boost_path_tmp in $libsubdirs; do
+ if test -d "$ac_boost_path"/"$ac_boost_path_tmp" ; then
+ BOOST_LDFLAGS="-L$ac_boost_path/$ac_boost_path_tmp"
+ break
+ fi
+ done
+ elif test "$cross_compiling" != yes; then
+ for ac_boost_path_tmp in /usr /usr/local /opt /opt/local ; do
+ if test -d "$ac_boost_path_tmp/include/boost" && test -r "$ac_boost_path_tmp/include/boost"; then
+ for libsubdir in $libsubdirs ; do
+ if ls "$ac_boost_path_tmp/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi
+ done
+ BOOST_LDFLAGS="-L$ac_boost_path_tmp/$libsubdir"
+ BOOST_CPPFLAGS="-I$ac_boost_path_tmp/include"
+ break;
+ fi
+ done
+ fi
+
+ dnl overwrite ld flags if we have required special directory with
+ dnl --with-boost-libdir parameter
+ if test "$ac_boost_lib_path" != ""; then
+ BOOST_LDFLAGS="-L$ac_boost_lib_path"
+ fi
+
+ CPPFLAGS_SAVED="$CPPFLAGS"
+ CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
+ export CPPFLAGS
+
+ LDFLAGS_SAVED="$LDFLAGS"
+ LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
+ export LDFLAGS
+
+ AC_REQUIRE([AC_PROG_CXX])
+ AC_LANG_PUSH(C++)
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+ @%:@include <boost/version.hpp>
+ ]], [[
+ #if BOOST_VERSION >= $WANT_BOOST_VERSION
+ // Everything is okay
+ #else
+ # error Boost version is too old
+ #endif
+ ]])],[
+ AC_MSG_RESULT(yes)
+ succeeded=yes
+ found_system=yes
+ ],[
+ ])
+ AC_LANG_POP([C++])
+
+
+
+ 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
+ if test "x$succeeded" != "xyes"; then
+ _version=0
+ if test "$ac_boost_path" != ""; then
+ if test -d "$ac_boost_path" && test -r "$ac_boost_path"; then
+ for i in `ls -d $ac_boost_path/include/boost-* 2>/dev/null`; do
+ _version_tmp=`echo $i | sed "s#$ac_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'`
+ V_CHECK=`expr $_version_tmp \> $_version`
+ if test "$V_CHECK" = "1" ; then
+ _version=$_version_tmp
+ fi
+ VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'`
+ BOOST_CPPFLAGS="-I$ac_boost_path/include/boost-$VERSION_UNDERSCORE"
+ done
+ fi
+ else
+ if test "$cross_compiling" != yes; then
+ for ac_boost_path in /usr /usr/local /opt /opt/local ; do
+ if test -d "$ac_boost_path" && test -r "$ac_boost_path"; then
+ for i in `ls -d $ac_boost_path/include/boost-* 2>/dev/null`; do
+ _version_tmp=`echo $i | sed "s#$ac_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'`
+ V_CHECK=`expr $_version_tmp \> $_version`
+ if test "$V_CHECK" = "1" ; then
+ _version=$_version_tmp
+ best_path=$ac_boost_path
+ fi
+ done
+ fi
+ done
+
+ VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'`
+ BOOST_CPPFLAGS="-I$best_path/include/boost-$VERSION_UNDERSCORE"
+ if test "$ac_boost_lib_path" = ""; then
+ for libsubdir in $libsubdirs ; do
+ if ls "$best_path/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi
+ done
+ BOOST_LDFLAGS="-L$best_path/$libsubdir"
+ fi
+ fi
+
+ if test "x$BOOST_ROOT" != "x"; then
+ for libsubdir in $libsubdirs ; do
+ if ls "$BOOST_ROOT/stage/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi
+ done
+ if test -d "$BOOST_ROOT" && test -r "$BOOST_ROOT" && test -d "$BOOST_ROOT/stage/$libsubdir" && test -r "$BOOST_ROOT/stage/$libsubdir"; then
+ version_dir=`expr //$BOOST_ROOT : '.*/\(.*\)'`
+ stage_version=`echo $version_dir | sed 's/boost_//' | sed 's/_/./g'`
+ stage_version_shorten=`expr $stage_version : '\([[0-9]]*\.[[0-9]]*\)'`
+ V_CHECK=`expr $stage_version_shorten \>\= $_version`
+ if test "$V_CHECK" = "1" -a "$ac_boost_lib_path" = "" ; then
+ AC_MSG_NOTICE(We will use a staged boost library from $BOOST_ROOT)
+ BOOST_CPPFLAGS="-I$BOOST_ROOT"
+ BOOST_LDFLAGS="-L$BOOST_ROOT/stage/$libsubdir"
+ fi
+ fi
+ fi
+ fi
+
+ CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
+ export CPPFLAGS
+ LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
+ export LDFLAGS
+
+ AC_LANG_PUSH(C++)
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+ @%:@include <boost/version.hpp>
+ ]], [[
+ #if BOOST_VERSION >= $WANT_BOOST_VERSION
+ // Everything is okay
+ #else
+ # error Boost version is too old
+ #endif
+ ]])],[
+ AC_MSG_RESULT(yes)
+ succeeded=yes
+ found_system=yes
+ ],[
+ ])
+ AC_LANG_POP([C++])
+ fi
+
+ if test "$succeeded" != "yes" ; then
+ if test "$_version" = "0" ; then
+ AC_MSG_NOTICE([[We could not detect the boost libraries (version $boost_lib_version_req_shorten or higher). If you have a staged boost library (still not installed) please specify \$BOOST_ROOT in your environment and do not give a PATH to --with-boost option. If you are sure you have boost installed, then check your version number looking in <boost/version.hpp>. See http://randspringer.de/boost for more documentation.]])
+ else
+ AC_MSG_NOTICE([Your boost libraries seems to old (version $_version).])
+ fi
+ # execute ACTION-IF-NOT-FOUND (if present):
+ ifelse([$3], , :, [$3])
+ else
+ AC_SUBST(BOOST_CPPFLAGS)
+ AC_SUBST(BOOST_LDFLAGS)
+ AC_DEFINE(HAVE_BOOST,,[define if the Boost library is available])
+ # execute ACTION-IF-FOUND (if present):
+ ifelse([$2], , :, [$2])
+ fi
+
+ CPPFLAGS="$CPPFLAGS_SAVED"
+ LDFLAGS="$LDFLAGS_SAVED"
+fi
+
+])
diff --git a/Tools/config/ax_compare_version.m4 b/Tools/config/ax_compare_version.m4
new file mode 100644
index 000000000..74dc0fdd9
--- /dev/null
+++ b/Tools/config/ax_compare_version.m4
@@ -0,0 +1,177 @@
+# ===========================================================================
+# http://www.gnu.org/software/autoconf-archive/ax_compare_version.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+# AX_COMPARE_VERSION(VERSION_A, OP, VERSION_B, [ACTION-IF-TRUE], [ACTION-IF-FALSE])
+#
+# DESCRIPTION
+#
+# This macro compares two version strings. Due to the various number of
+# minor-version numbers that can exist, and the fact that string
+# comparisons are not compatible with numeric comparisons, this is not
+# necessarily trivial to do in a autoconf script. This macro makes doing
+# these comparisons easy.
+#
+# The six basic comparisons are available, as well as checking equality
+# limited to a certain number of minor-version levels.
+#
+# The operator OP determines what type of comparison to do, and can be one
+# of:
+#
+# eq - equal (test A == B)
+# ne - not equal (test A != B)
+# le - less than or equal (test A <= B)
+# ge - greater than or equal (test A >= B)
+# lt - less than (test A < B)
+# gt - greater than (test A > B)
+#
+# Additionally, the eq and ne operator can have a number after it to limit
+# the test to that number of minor versions.
+#
+# eq0 - equal up to the length of the shorter version
+# ne0 - not equal up to the length of the shorter version
+# eqN - equal up to N sub-version levels
+# neN - not equal up to N sub-version levels
+#
+# When the condition is true, shell commands ACTION-IF-TRUE are run,
+# otherwise shell commands ACTION-IF-FALSE are run. The environment
+# variable 'ax_compare_version' is always set to either 'true' or 'false'
+# as well.
+#
+# Examples:
+#
+# AX_COMPARE_VERSION([3.15.7],[lt],[3.15.8])
+# AX_COMPARE_VERSION([3.15],[lt],[3.15.8])
+#
+# would both be true.
+#
+# AX_COMPARE_VERSION([3.15.7],[eq],[3.15.8])
+# AX_COMPARE_VERSION([3.15],[gt],[3.15.8])
+#
+# would both be false.
+#
+# AX_COMPARE_VERSION([3.15.7],[eq2],[3.15.8])
+#
+# would be true because it is only comparing two minor versions.
+#
+# AX_COMPARE_VERSION([3.15.7],[eq0],[3.15])
+#
+# would be true because it is only comparing the lesser number of minor
+# versions of the two values.
+#
+# Note: The characters that separate the version numbers do not matter. An
+# empty string is the same as version 0. OP is evaluated by autoconf, not
+# configure, so must be a string, not a variable.
+#
+# The author would like to acknowledge Guido Draheim whose advice about
+# the m4_case and m4_ifvaln functions make this macro only include the
+# portions necessary to perform the specific comparison specified by the
+# OP argument in the final configure script.
+#
+# LICENSE
+#
+# Copyright (c) 2008 Tim Toolan <toolan@ele.uri.edu>
+#
+# Copying and distribution of this file, with or without modification, are
+# permitted in any medium without royalty provided the copyright notice
+# and this notice are preserved. This file is offered as-is, without any
+# warranty.
+
+#serial 11
+
+dnl #########################################################################
+AC_DEFUN([AX_COMPARE_VERSION], [
+ AC_REQUIRE([AC_PROG_AWK])
+
+ # Used to indicate true or false condition
+ ax_compare_version=false
+
+ # Convert the two version strings to be compared into a format that
+ # allows a simple string comparison. The end result is that a version
+ # string of the form 1.12.5-r617 will be converted to the form
+ # 0001001200050617. In other words, each number is zero padded to four
+ # digits, and non digits are removed.
+ AS_VAR_PUSHDEF([A],[ax_compare_version_A])
+ A=`echo "$1" | sed -e 's/\([[0-9]]*\)/Z\1Z/g' \
+ -e 's/Z\([[0-9]]\)Z/Z0\1Z/g' \
+ -e 's/Z\([[0-9]][[0-9]]\)Z/Z0\1Z/g' \
+ -e 's/Z\([[0-9]][[0-9]][[0-9]]\)Z/Z0\1Z/g' \
+ -e 's/[[^0-9]]//g'`
+
+ AS_VAR_PUSHDEF([B],[ax_compare_version_B])
+ B=`echo "$3" | sed -e 's/\([[0-9]]*\)/Z\1Z/g' \
+ -e 's/Z\([[0-9]]\)Z/Z0\1Z/g' \
+ -e 's/Z\([[0-9]][[0-9]]\)Z/Z0\1Z/g' \
+ -e 's/Z\([[0-9]][[0-9]][[0-9]]\)Z/Z0\1Z/g' \
+ -e 's/[[^0-9]]//g'`
+
+ dnl # In the case of le, ge, lt, and gt, the strings are sorted as necessary
+ dnl # then the first line is used to determine if the condition is true.
+ dnl # The sed right after the echo is to remove any indented white space.
+ m4_case(m4_tolower($2),
+ [lt],[
+ ax_compare_version=`echo "x$A
+x$B" | sed 's/^ *//' | sort -r | sed "s/x${A}/false/;s/x${B}/true/;1q"`
+ ],
+ [gt],[
+ ax_compare_version=`echo "x$A
+x$B" | sed 's/^ *//' | sort | sed "s/x${A}/false/;s/x${B}/true/;1q"`
+ ],
+ [le],[
+ ax_compare_version=`echo "x$A
+x$B" | sed 's/^ *//' | sort | sed "s/x${A}/true/;s/x${B}/false/;1q"`
+ ],
+ [ge],[
+ ax_compare_version=`echo "x$A
+x$B" | sed 's/^ *//' | sort -r | sed "s/x${A}/true/;s/x${B}/false/;1q"`
+ ],[
+ dnl Split the operator from the subversion count if present.
+ m4_bmatch(m4_substr($2,2),
+ [0],[
+ # A count of zero means use the length of the shorter version.
+ # Determine the number of characters in A and B.
+ ax_compare_version_len_A=`echo "$A" | $AWK '{print(length)}'`
+ ax_compare_version_len_B=`echo "$B" | $AWK '{print(length)}'`
+
+ # Set A to no more than B's length and B to no more than A's length.
+ A=`echo "$A" | sed "s/\(.\{$ax_compare_version_len_B\}\).*/\1/"`
+ B=`echo "$B" | sed "s/\(.\{$ax_compare_version_len_A\}\).*/\1/"`
+ ],
+ [[0-9]+],[
+ # A count greater than zero means use only that many subversions
+ A=`echo "$A" | sed "s/\(\([[0-9]]\{4\}\)\{m4_substr($2,2)\}\).*/\1/"`
+ B=`echo "$B" | sed "s/\(\([[0-9]]\{4\}\)\{m4_substr($2,2)\}\).*/\1/"`
+ ],
+ [.+],[
+ AC_WARNING(
+ [illegal OP numeric parameter: $2])
+ ],[])
+
+ # Pad zeros at end of numbers to make same length.
+ ax_compare_version_tmp_A="$A`echo $B | sed 's/./0/g'`"
+ B="$B`echo $A | sed 's/./0/g'`"
+ A="$ax_compare_version_tmp_A"
+
+ # Check for equality or inequality as necessary.
+ m4_case(m4_tolower(m4_substr($2,0,2)),
+ [eq],[
+ test "x$A" = "x$B" && ax_compare_version=true
+ ],
+ [ne],[
+ test "x$A" != "x$B" && ax_compare_version=true
+ ],[
+ AC_WARNING([illegal OP parameter: $2])
+ ])
+ ])
+
+ AS_VAR_POPDEF([A])dnl
+ AS_VAR_POPDEF([B])dnl
+
+ dnl # Execute ACTION-IF-TRUE / ACTION-IF-FALSE.
+ if test "$ax_compare_version" = "true" ; then
+ m4_ifvaln([$4],[$4],[:])dnl
+ m4_ifvaln([$5],[else $5])dnl
+ fi
+]) dnl AX_COMPARE_VERSION
diff --git a/Tools/config/ax_path_generic.m4 b/Tools/config/ax_path_generic.m4
new file mode 100644
index 000000000..6960d612a
--- /dev/null
+++ b/Tools/config/ax_path_generic.m4
@@ -0,0 +1,164 @@
+# ===========================================================================
+# http://www.gnu.org/software/autoconf-archive/ax_path_generic.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+# AX_PATH_GENERIC(LIBRARY,[MINIMUM-VERSION,[SED-EXPR-EXTRACTOR]],[ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND],[CONFIG-SCRIPTS],[CFLAGS-ARG],[LIBS-ARG])
+#
+# DESCRIPTION
+#
+# Runs the LIBRARY-config script and defines LIBRARY_CFLAGS and
+# LIBRARY_LIBS unless the user had predefined them in the environment.
+#
+# The script must support `--cflags' and `--libs' args. If MINIMUM-VERSION
+# is specified, the script must also support the `--version' arg. If the
+# `--with-library-[exec-]prefix' arguments to ./configure are given, it
+# must also support `--prefix' and `--exec-prefix'. Prefereable use
+# CONFIG-SCRIPTS as config script, CFLAGS-ARG instead of `--cflags` and
+# LIBS-ARG instead of `--libs`, if given.
+#
+# The SED-EXPR-EXTRACTOR parameter representes the expression used in sed
+# to extract the version number. Use it if your 'foo-config --version'
+# dumps something like 'Foo library v1.0.0 (alfa)' instead of '1.0.0'.
+#
+# The macro respects LIBRARY_CONFIG, LIBRARY_CFLAGS and LIBRARY_LIBS
+# variables. If the first one is defined, it specifies the name of the
+# config script to use. If the latter two are defined, the script is not
+# ran at all and their values are used instead (if only one of them is
+# defined, the empty value of the remaining one is still used).
+#
+# Example:
+#
+# AX_PATH_GENERIC(Foo, 1.0.0)
+#
+# would run `foo-config --version' and check that it is at least 1.0.0, if
+# successful the following variables would be defined and substituted:
+#
+# FOO_CFLAGS to `foo-config --cflags`
+# FOO_LIBS to `foo-config --libs`
+#
+# Example:
+#
+# AX_PATH_GENERIC([Bar],,,[
+# AC_MSG_ERROR([Cannot find Bar library])
+# ])
+#
+# would check for bar-config program, defining and substituting the
+# following variables:
+#
+# BAR_CFLAGS to `bar-config --cflags`
+# BAR_LIBS to `bar-config --libs`
+#
+# Example:
+#
+# ./configure BAZ_LIBS=/usr/lib/libbaz.a
+#
+# would link with a static version of baz library even if `baz-config
+# --libs` returns just "-lbaz" that would normally result in using the
+# shared library.
+#
+# This macro is a rearranged version of AC_PATH_GENERIC from Angus Lees.
+#
+# LICENSE
+#
+# Copyright (c) 2009 Francesco Salvestrini <salvestrini@users.sourceforge.net>
+#
+# Copying and distribution of this file, with or without modification, are
+# permitted in any medium without royalty provided the copyright notice
+# and this notice are preserved. This file is offered as-is, without any
+# warranty.
+
+#serial 11
+
+AU_ALIAS([AC_PATH_GENERIC], [AX_PATH_GENERIC])
+AC_DEFUN([AX_PATH_GENERIC],[
+ AC_REQUIRE([AC_PROG_SED])
+
+ dnl we're going to need uppercase and lowercase versions of the
+ dnl string `LIBRARY'
+ pushdef([UP], translit([$1], [a-z], [A-Z]))dnl
+ pushdef([DOWN], translit([$1], [A-Z], [a-z]))dnl
+
+ AC_ARG_WITH(DOWN-prefix,[AS_HELP_STRING([--with-]DOWN[-prefix=PREFIX], [Prefix where $1 is installed (optional)])],
+ DOWN[]_config_prefix="$withval", DOWN[]_config_prefix="")
+ AC_ARG_WITH(DOWN-exec-prefix,[AS_HELP_STRING([--with-]DOWN[-exec-prefix=EPREFIX], [Exec prefix where $1 is installed (optional)])],
+ DOWN[]_config_exec_prefix="$withval", DOWN[]_config_exec_prefix="")
+
+ AC_ARG_VAR(UP[]_CONFIG, [config script used for $1])
+ AC_ARG_VAR(UP[]_CFLAGS, [CFLAGS used for $1])
+ AC_ARG_VAR(UP[]_LIBS, [LIBS used for $1])
+
+ 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.
+ AC_SUBST(UP[]_CFLAGS)
+ AC_SUBST(UP[]_LIBS)
+ :
+ $4
+ ],[
+ AS_IF([test x$DOWN[]_config_exec_prefix != x],[
+ DOWN[]_config_args="$DOWN[]_config_args --exec-prefix=$DOWN[]_config_exec_prefix"
+ AS_IF([test x${UP[]_CONFIG+set} != xset],[
+ UP[]_CONFIG=$DOWN[]_config_exec_prefix/bin/DOWN-config
+ ])
+ ])
+ AS_IF([test x$DOWN[]_config_prefix != x],[
+ DOWN[]_config_args="$DOWN[]_config_args --prefix=$DOWN[]_config_prefix"
+ AS_IF([test x${UP[]_CONFIG+set} != xset],[
+ UP[]_CONFIG=$DOWN[]_config_prefix/bin/DOWN-config
+ ])
+ ])
+
+ AC_PATH_PROGS(UP[]_CONFIG,[$6 DOWN-config],[no])
+ AS_IF([test "$UP[]_CONFIG" = "no"],[
+ :
+ $5
+ ],[
+ dnl Get the CFLAGS from LIBRARY-config script
+ AS_IF([test x"$7" = x],[
+ UP[]_CFLAGS="`$UP[]_CONFIG $DOWN[]_config_args --cflags`"
+ ],[
+ UP[]_CFLAGS="`$UP[]_CONFIG $DOWN[]_config_args $7`"
+ ])
+
+ dnl Get the LIBS from LIBRARY-config script
+ AS_IF([test x"$8" = x],[
+ UP[]_LIBS="`$UP[]_CONFIG $DOWN[]_config_args --libs`"
+ ],[
+ UP[]_LIBS="`$UP[]_CONFIG $DOWN[]_config_args $8`"
+ ])
+
+ AS_IF([test x"$2" != x],[
+ dnl Check for provided library version
+ AS_IF([test x"$3" != x],[
+ dnl Use provided sed expression
+ DOWN[]_version="`$UP[]_CONFIG $DOWN[]_config_args --version | $SED -e $3`"
+ ],[
+ DOWN[]_version="`$UP[]_CONFIG $DOWN[]_config_args --version | $SED -e 's/^\ *\(.*\)\ *$/\1/'`"
+ ])
+
+ AC_MSG_CHECKING([for $1 ($DOWN[]_version) >= $2])
+ AX_COMPARE_VERSION($DOWN[]_version,[ge],[$2],[
+ AC_MSG_RESULT([yes])
+
+ AC_SUBST(UP[]_CFLAGS)
+ AC_SUBST(UP[]_LIBS)
+ :
+ $4
+ ],[
+ AC_MSG_RESULT([no])
+ :
+ $5
+ ])
+ ],[
+ AC_SUBST(UP[]_CFLAGS)
+ AC_SUBST(UP[]_LIBS)
+ :
+ $4
+ ])
+ ])
+ ])
+
+ popdef([UP])
+ popdef([DOWN])
+])
diff --git a/Tools/mkrelease.py b/Tools/mkrelease.py
index fc404d43f..9ca96bc6f 100755
--- a/Tools/mkrelease.py
+++ b/Tools/mkrelease.py
@@ -35,16 +35,17 @@ print "Uploading to SourceForge"
swig_dir_sf = username + ",swig@frs.sourceforge.net:/home/frs/project/s/sw/swig/swig/swig-" + version + "/"
swigwin_dir_sf = username + ",swig@frs.sourceforge.net:/home/frs/project/s/sw/swig/swigwin/swigwin-" + version + "/"
-release_notes_file = "release-notes-" + version + ".txt"
-os.system("rm -f " + release_notes_file)
-os.system("cat swig-" + version + "/README " + "swig-" + version + "/CHANGES.current " + "swig-" + version + "/RELEASENOTES " + "> " + release_notes_file)
+# If a file with 'readme' in the name exists in the same folder as the zip/tarball, it gets automatically displayed as the release notes by SF
+full_readme_file = "readme-" + version + ".txt"
+os.system("rm -f " + full_readme_file)
+os.system("cat swig-" + version + "/README " + "swig-" + version + "/CHANGES.current " + "swig-" + version + "/RELEASENOTES " + "> " + full_readme_file)
-os.system("rsync --archive --verbose -P --times -e ssh " + "swig-" + version + ".tar.gz " + release_notes_file + " " + swig_dir_sf) and failed("")
-os.system("rsync --archive --verbose -P --times -e ssh " + "swigwin-" + version + ".zip " + swigwin_dir_sf) and failed("")
+os.system("rsync --archive --verbose -P --times -e ssh " + "swig-" + version + ".tar.gz " + full_readme_file + " " + swig_dir_sf) and failed("")
+os.system("rsync --archive --verbose -P --times -e ssh " + "swigwin-" + version + ".zip " + full_readme_file + " " + swigwin_dir_sf) and failed("")
print "Tagging release"
os.system("svn copy -m \"rel-" + version + "\" https://swig.svn.sourceforge.net/svnroot/swig/trunk https://swig.svn.sourceforge.net/svnroot/swig/tags/rel-" + version + "/")
print "Finished"
-print "Now log in to SourceForge and set the operating system and link the release notes to each of the tarball and zip file in the File Manager."
+print "Now log in to SourceForge and set the operating systems applicable to the newly uploaded tarball and zip file."
diff --git a/Tools/mkwindows.sh b/Tools/mkwindows.sh
index 869fce01a..6042361b3 100755
--- a/Tools/mkwindows.sh
+++ b/Tools/mkwindows.sh
@@ -43,7 +43,7 @@ else
if test x$zip = x; then
zip=zip
fi
- extraconfigureoptions="--host=i586-mingw32msvc --build=i686-linux CXXFLAGS=-O2 CFLAGS=-O2"
+ extraconfigureoptions="--host=i586-mingw32msvc --build=i686-linux"
else
if test "$cygwin"; then
echo "Building native Windows executable on Cygwin"
@@ -61,6 +61,13 @@ fi
swigbasename=swig-$version
swigwinbasename=swigwin-$version
tarball=$swigbasename.tar.gz
+pcre_tarball=`ls pcre-*.tar.*`
+
+if ! test -f "$pcre_tarball"; then
+ echo "Could not find PCRE tarball. Please download a PCRE source tarball from http://www.pcre.org"
+ echo "and place in the same directory as the SWIG tarball."
+ exit 1
+fi
if test -f "$tarball"; then
builddir=build-$version
@@ -78,8 +85,11 @@ if test -f "$tarball"; then
mv $swigbasename $swigwinbasename
tar -zxf ../$tarball
cd $swigbasename
+ (cd ../.. && cp $pcre_tarball $builddir/$swigbasename)
+ echo Running: Tools/pcre-build.sh $extraconfigureoptions CFLAGS="$compileflags" CXXFLAGS="$compileflags"
+ ./Tools/pcre-build.sh $extraconfigureoptions CFLAGS="$compileflags" CXXFLAGS="$compileflags" || exit 1
echo Running: ./configure $extraconfigureoptions CFLAGS="$compileflags" CXXFLAGS="$compileflags"
- ./configure $extraconfigureoptions CFLAGS="$compileflags" CXXFLAGS="$compileflags"
+ ./configure $extraconfigureoptions CFLAGS="$compileflags" CXXFLAGS="$compileflags" || exit 1
echo "Compiling (quietly)..."
make > build.log
echo "Simple check to see if swig.exe runs..."
diff --git a/Tools/pcre-build.sh b/Tools/pcre-build.sh
new file mode 100755
index 000000000..92f645da2
--- /dev/null
+++ b/Tools/pcre-build.sh
@@ -0,0 +1,55 @@
+#!/bin/sh
+
+pcre_subdir=pcre/pcre-swig-install
+pcre_install_dir=`pwd`/$pcre_subdir
+
+usage() {
+ echo "Helper script to build PCRE as a static library from a tarball just for use during the"
+ echo "SWIG build. It does not install PCRE for global use on your system."
+ echo "Usage: pcre-build.sh [--help] [args]"
+ echo " args - optional additional arguments passed on to the PCRE configure script (leave out"
+ echo " unless you are an expert at configure)"
+ echo " --help - Display this help information."
+ echo "Instructions:"
+ echo " - Download the latest PCRE source tarball from http://www.pcre.org and place in the"
+ echo " directory that you will configure and build SWIG."
+ echo " - Run this script in the same directory that you intend to configure and build SWIG in."
+ echo " This will configure and build PCRE as a static library."
+ echo " - Afterwards run the SWIG configure script which will then find and use the PCRE static"
+ echo " libraries in the $pcre_subdir subdirectory."
+ exit 0
+}
+
+bail() {
+ echo $1 >&2
+ exit 1
+}
+
+if test "$1" = "-h" -o "$1" = "-help" -o "$1" = "--help" ; then
+ usage
+fi
+
+if test -f "pcre-build.sh" ; then
+ echo "Error: this script should not be run in the Tools directory" >&2
+ echo ""
+ usage
+fi
+
+echo "Looking for PCRE tarball..."
+rm -rf pcre
+pcre_tarball=`ls pcre-*.tar*`
+test -n "$pcre_tarball" || bail "Could not find tarball matching pattern: pcre-*.tar*"
+test -f "$pcre_tarball" || bail "Could not find a single PCRE tarball. Found: $pcre_tarball"
+
+echo "Extracting tarball: $pcre_tarball"
+tar -xf $pcre_tarball || bail "Could not untar $pcre_tarball"
+pcre_dir=`echo $pcre_tarball | sed -e "s/\.tar.*//"`
+echo "Configuring PCRE in directory: pcre"
+mv $pcre_dir pcre || bail "Could not create pcre directory"
+cd pcre && ./configure --prefix=$pcre_install_dir --disable-shared $* || bail "PCRE configure failed"
+echo "Building PCRE..."
+${MAKE:-make} -s || bail "Could not build PCRE"
+echo "Installing PCRE locally to $pcre_install_dir..."
+${MAKE:-make} -s install || bail "Could not install PCRE"
+echo ""
+echo "The SWIG configure script can now be run, whereupon PCRE will automatically be detected and used from $pcre_install_dir/bin/pcre-config."
diff --git a/Tools/pyname_patch.py b/Tools/pyname_patch.py
index 5931269f9..f8f436c38 100644
--- a/Tools/pyname_patch.py
+++ b/Tools/pyname_patch.py
@@ -109,7 +109,7 @@ def main(fns):
if patch_file(fn):
print "Patched file", fn
except IOError:
- print "Error occured during patching", fn
+ print "Error occurred during patching", fn
return
if __name__=="__main__":
diff --git a/Tools/swig.gdb b/Tools/swig.gdb
new file mode 100644
index 000000000..61872c5d6
--- /dev/null
+++ b/Tools/swig.gdb
@@ -0,0 +1,41 @@
+# User-defined commands for easier debugging of SWIG in gdb
+#
+# This file can be "included" into your main .gdbinit file using:
+# source swig.gdb
+# or otherwise paste the contents into .gdbinit
+#
+# Note all user defined commands can be seen using:
+# (gdb) show user
+# The documentation for each command can be easily viewed, for example:
+# (gdb) help swigprint
+
+define swigprint
+ if ($argc == 2)
+ set $expand_count = $arg1
+ else
+ set $expand_count = -1
+ end
+ Printf "%s\n", Swig_to_string($arg0, $expand_count)
+end
+document swigprint
+Displays any SWIG DOH object
+Usage: swigprint swigobject [hashexpandcount]
+ swigobject - The object to display.
+ hashexpandcount - Number of nested Hash types to expand (default is 1). See Swig_set_max_hash_expand() to change default.
+end
+
+
+define locswigprint
+ if ($argc == 2)
+ set $expand_count = $arg1
+ else
+ set $expand_count = -1
+ end
+ Printf "%s\n", Swig_to_string_with_location($arg0, $expand_count)
+end
+document locswigprint
+Displays any SWIG DOH object prefixed with file and line location
+Usage: locswigprint swigobject [hashexpandcount]
+ swigobject - The object to display.
+ hashexpandcount - Number of nested Hash types to expand (default is 1). See Swig_set_max_hash_expand() to change default.
+end