annotate m4/ax_pkg_swig.m4 @ 126:0d49e1502159

- updated to latest SWIG macros - added __init__.py so generated python module loads
author Jamie Bullock <jamie@postlude.co.uk>
date Thu, 29 Mar 2012 17:24:45 +0000
parents
children
rev   line source
jamie@126 1 # ===========================================================================
jamie@126 2 # http://www.gnu.org/software/autoconf-archive/ax_pkg_swig.html
jamie@126 3 # ===========================================================================
jamie@126 4 #
jamie@126 5 # SYNOPSIS
jamie@126 6 #
jamie@126 7 # AX_PKG_SWIG([major.minor.micro], [action-if-found], [action-if-not-found])
jamie@126 8 #
jamie@126 9 # DESCRIPTION
jamie@126 10 #
jamie@126 11 # This macro searches for a SWIG installation on your system. If found,
jamie@126 12 # then SWIG is AC_SUBST'd; if not found, then $SWIG is empty. If SWIG is
jamie@126 13 # found, then SWIG_LIB is set to the SWIG library path, and AC_SUBST'd.
jamie@126 14 #
jamie@126 15 # You can use the optional first argument to check if the version of the
jamie@126 16 # available SWIG is greater than or equal to the value of the argument. It
jamie@126 17 # should have the format: N[.N[.N]] (N is a number between 0 and 999. Only
jamie@126 18 # the first N is mandatory.) If the version argument is given (e.g.
jamie@126 19 # 1.3.17), AX_PKG_SWIG checks that the swig package is this version number
jamie@126 20 # or higher.
jamie@126 21 #
jamie@126 22 # As usual, action-if-found is executed if SWIG is found, otherwise
jamie@126 23 # action-if-not-found is executed.
jamie@126 24 #
jamie@126 25 # In configure.in, use as:
jamie@126 26 #
jamie@126 27 # AX_PKG_SWIG(1.3.17, [], [ AC_MSG_ERROR([SWIG is required to build..]) ])
jamie@126 28 # AX_SWIG_ENABLE_CXX
jamie@126 29 # AX_SWIG_MULTI_MODULE_SUPPORT
jamie@126 30 # AX_SWIG_PYTHON
jamie@126 31 #
jamie@126 32 # LICENSE
jamie@126 33 #
jamie@126 34 # Copyright (c) 2008 Sebastian Huber <sebastian-huber@web.de>
jamie@126 35 # Copyright (c) 2008 Alan W. Irwin <irwin@beluga.phys.uvic.ca>
jamie@126 36 # Copyright (c) 2008 Rafael Laboissiere <rafael@laboissiere.net>
jamie@126 37 # Copyright (c) 2008 Andrew Collier <colliera@ukzn.ac.za>
jamie@126 38 # Copyright (c) 2011 Murray Cumming <murrayc@openismus.com>
jamie@126 39 #
jamie@126 40 # This program is free software; you can redistribute it and/or modify it
jamie@126 41 # under the terms of the GNU General Public License as published by the
jamie@126 42 # Free Software Foundation; either version 2 of the License, or (at your
jamie@126 43 # option) any later version.
jamie@126 44 #
jamie@126 45 # This program is distributed in the hope that it will be useful, but
jamie@126 46 # WITHOUT ANY WARRANTY; without even the implied warranty of
jamie@126 47 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
jamie@126 48 # Public License for more details.
jamie@126 49 #
jamie@126 50 # You should have received a copy of the GNU General Public License along
jamie@126 51 # with this program. If not, see <http://www.gnu.org/licenses/>.
jamie@126 52 #
jamie@126 53 # As a special exception, the respective Autoconf Macro's copyright owner
jamie@126 54 # gives unlimited permission to copy, distribute and modify the configure
jamie@126 55 # scripts that are the output of Autoconf when processing the Macro. You
jamie@126 56 # need not follow the terms of the GNU General Public License when using
jamie@126 57 # or distributing such scripts, even though portions of the text of the
jamie@126 58 # Macro appear in them. The GNU General Public License (GPL) does govern
jamie@126 59 # all other use of the material that constitutes the Autoconf Macro.
jamie@126 60 #
jamie@126 61 # This special exception to the GPL applies to versions of the Autoconf
jamie@126 62 # Macro released by the Autoconf Archive. When you make and distribute a
jamie@126 63 # modified version of the Autoconf Macro, you may extend this special
jamie@126 64 # exception to the GPL to apply to your modified version as well.
jamie@126 65
jamie@126 66 #serial 8
jamie@126 67
jamie@126 68 AC_DEFUN([AX_PKG_SWIG],[
jamie@126 69 # Ubuntu has swig 2.0 as /usr/bin/swig2.0
jamie@126 70 AC_PATH_PROGS([SWIG],[swig swig2.0])
jamie@126 71 if test -z "$SWIG" ; then
jamie@126 72 m4_ifval([$3],[$3],[:])
jamie@126 73 elif test -n "$1" ; then
jamie@126 74 AC_MSG_CHECKING([SWIG version])
jamie@126 75 [swig_version=`$SWIG -version 2>&1 | grep 'SWIG Version' | sed 's/.*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*/\1/g'`]
jamie@126 76 AC_MSG_RESULT([$swig_version])
jamie@126 77 if test -n "$swig_version" ; then
jamie@126 78 # Calculate the required version number components
jamie@126 79 [required=$1]
jamie@126 80 [required_major=`echo $required | sed 's/[^0-9].*//'`]
jamie@126 81 if test -z "$required_major" ; then
jamie@126 82 [required_major=0]
jamie@126 83 fi
jamie@126 84 [required=`echo $required | sed 's/[0-9]*[^0-9]//'`]
jamie@126 85 [required_minor=`echo $required | sed 's/[^0-9].*//'`]
jamie@126 86 if test -z "$required_minor" ; then
jamie@126 87 [required_minor=0]
jamie@126 88 fi
jamie@126 89 [required=`echo $required | sed 's/[0-9]*[^0-9]//'`]
jamie@126 90 [required_patch=`echo $required | sed 's/[^0-9].*//'`]
jamie@126 91 if test -z "$required_patch" ; then
jamie@126 92 [required_patch=0]
jamie@126 93 fi
jamie@126 94 # Calculate the available version number components
jamie@126 95 [available=$swig_version]
jamie@126 96 [available_major=`echo $available | sed 's/[^0-9].*//'`]
jamie@126 97 if test -z "$available_major" ; then
jamie@126 98 [available_major=0]
jamie@126 99 fi
jamie@126 100 [available=`echo $available | sed 's/[0-9]*[^0-9]//'`]
jamie@126 101 [available_minor=`echo $available | sed 's/[^0-9].*//'`]
jamie@126 102 if test -z "$available_minor" ; then
jamie@126 103 [available_minor=0]
jamie@126 104 fi
jamie@126 105 [available=`echo $available | sed 's/[0-9]*[^0-9]//'`]
jamie@126 106 [available_patch=`echo $available | sed 's/[^0-9].*//'`]
jamie@126 107 if test -z "$available_patch" ; then
jamie@126 108 [available_patch=0]
jamie@126 109 fi
jamie@126 110 # Convert the version tuple into a single number for easier comparison.
jamie@126 111 # Using base 100 should be safe since SWIG internally uses BCD values
jamie@126 112 # to encode its version number.
jamie@126 113 required_swig_vernum=`expr $required_major \* 10000 \
jamie@126 114 \+ $required_minor \* 100 \+ $required_patch`
jamie@126 115 available_swig_vernum=`expr $available_major \* 10000 \
jamie@126 116 \+ $available_minor \* 100 \+ $available_patch`
jamie@126 117
jamie@126 118 if test $available_swig_vernum -lt $required_swig_vernum; then
jamie@126 119 AC_MSG_WARN([SWIG version >= $1 is required. You have $swig_version.])
jamie@126 120 SWIG=''
jamie@126 121 m4_ifval([$3],[$3],[])
jamie@126 122 else
jamie@126 123 AC_MSG_CHECKING([for SWIG library])
jamie@126 124 SWIG_LIB=`$SWIG -swiglib`
jamie@126 125 AC_MSG_RESULT([$SWIG_LIB])
jamie@126 126 m4_ifval([$2],[$2],[])
jamie@126 127 fi
jamie@126 128 else
jamie@126 129 AC_MSG_WARN([cannot determine SWIG version])
jamie@126 130 SWIG=''
jamie@126 131 m4_ifval([$3],[$3],[])
jamie@126 132 fi
jamie@126 133 fi
jamie@126 134 AC_SUBST([SWIG_LIB])
jamie@126 135 ])