jamie@89: ##### http://autoconf-archive.cryp.to/ac_pkg_swig.html jamie@89: # jamie@89: # SYNOPSIS jamie@89: # jamie@89: # AC_PROG_SWIG([major.minor.micro]) jamie@89: # jamie@89: # DESCRIPTION jamie@89: # jamie@89: # This macro searches for a SWIG installation on your system. If jamie@89: # found you should call SWIG via $(SWIG). You can use the optional jamie@89: # first argument to check if the version of the available SWIG is jamie@89: # greater than or equal to the value of the argument. It should have jamie@89: # the format: N[.N[.N]] (N is a number between 0 and 999. Only the jamie@89: # first N is mandatory.) jamie@89: # jamie@89: # If the version argument is given (e.g. 1.3.17), AC_PROG_SWIG checks jamie@89: # that the swig package is this version number or higher. jamie@89: # jamie@89: # In configure.in, use as: jamie@89: # jamie@89: # AC_PROG_SWIG(1.3.17) jamie@89: # SWIG_ENABLE_CXX jamie@89: # SWIG_MULTI_MODULE_SUPPORT jamie@89: # SWIG_PYTHON jamie@89: # jamie@89: # LAST MODIFICATION jamie@89: # jamie@89: # 2006-10-22 jamie@89: # jamie@89: # COPYLEFT jamie@89: # jamie@89: # Copyright (c) 2006 Sebastian Huber jamie@89: # Copyright (c) 2006 Alan W. Irwin jamie@89: # Copyright (c) 2006 Rafael Laboissiere jamie@89: # Copyright (c) 2006 Andrew Collier jamie@89: # jamie@89: # This program is free software; you can redistribute it and/or jamie@89: # modify it under the terms of the GNU General Public License as jamie@89: # published by the Free Software Foundation; either version 2 of the jamie@89: # License, or (at your option) any later version. jamie@89: # jamie@89: # This program is distributed in the hope that it will be useful, but jamie@89: # WITHOUT ANY WARRANTY; without even the implied warranty of jamie@89: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU jamie@89: # General Public License for more details. jamie@89: # jamie@89: # You should have received a copy of the GNU General Public License jamie@89: # along with this program; if not, write to the Free Software jamie@89: # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA jamie@89: # 02111-1307, USA. jamie@89: # jamie@89: # As a special exception, the respective Autoconf Macro's copyright jamie@89: # owner gives unlimited permission to copy, distribute and modify the jamie@89: # configure scripts that are the output of Autoconf when processing jamie@89: # the Macro. You need not follow the terms of the GNU General Public jamie@89: # License when using or distributing such scripts, even though jamie@89: # portions of the text of the Macro appear in them. The GNU General jamie@89: # Public License (GPL) does govern all other use of the material that jamie@89: # constitutes the Autoconf Macro. jamie@89: # jamie@89: # This special exception to the GPL applies to versions of the jamie@89: # Autoconf Macro released by the Autoconf Macro Archive. When you jamie@89: # make and distribute a modified version of the Autoconf Macro, you jamie@89: # may extend this special exception to the GPL to apply to your jamie@89: # modified version as well. jamie@89: jamie@89: AC_DEFUN([AC_PROG_SWIG],[ jamie@89: AC_PATH_PROG([SWIG],[swig]) jamie@89: if test -z "$SWIG" ; then jamie@89: AC_MSG_WARN([cannot find 'swig' program. You should look at http://www.swig.org]) jamie@89: SWIG='echo "Error: SWIG is not installed. You should look at http://www.swig.org" ; false' jamie@89: elif test -n "$1" ; then jamie@89: AC_MSG_CHECKING([for SWIG version]) jamie@89: [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@89: AC_MSG_RESULT([$swig_version]) jamie@89: if test -n "$swig_version" ; then jamie@89: # Calculate the required version number components jamie@89: [required=$1] jamie@89: [required_major=`echo $required | sed 's/[^0-9].*//'`] jamie@89: if test -z "$required_major" ; then jamie@89: [required_major=0] jamie@89: fi jamie@89: [required=`echo $required | sed 's/[0-9]*[^0-9]//'`] jamie@89: [required_minor=`echo $required | sed 's/[^0-9].*//'`] jamie@89: if test -z "$required_minor" ; then jamie@89: [required_minor=0] jamie@89: fi jamie@89: [required=`echo $required | sed 's/[0-9]*[^0-9]//'`] jamie@89: [required_patch=`echo $required | sed 's/[^0-9].*//'`] jamie@89: if test -z "$required_patch" ; then jamie@89: [required_patch=0] jamie@89: fi jamie@89: # Calculate the available version number components jamie@89: [available=$swig_version] jamie@89: [available_major=`echo $available | sed 's/[^0-9].*//'`] jamie@89: if test -z "$available_major" ; then jamie@89: [available_major=0] jamie@89: fi jamie@89: [available=`echo $available | sed 's/[0-9]*[^0-9]//'`] jamie@89: [available_minor=`echo $available | sed 's/[^0-9].*//'`] jamie@89: if test -z "$available_minor" ; then jamie@89: [available_minor=0] jamie@89: fi jamie@89: [available=`echo $available | sed 's/[0-9]*[^0-9]//'`] jamie@89: [available_patch=`echo $available | sed 's/[^0-9].*//'`] jamie@89: if test -z "$available_patch" ; then jamie@89: [available_patch=0] jamie@89: fi jamie@89: if test $available_major -ne $required_major \ jamie@89: -o $available_minor -ne $required_minor \ jamie@89: -o $available_patch -lt $required_patch ; then jamie@89: AC_MSG_WARN([SWIG version >= $1 is required. You have $swig_version. You should look at http://www.swig.org]) jamie@89: SWIG='echo "Error: SWIG version >= $1 is required. You have '"$swig_version"'. You should look at http://www.swig.org" ; false' jamie@89: else jamie@89: AC_MSG_NOTICE([SWIG executable is '$SWIG']) jamie@89: SWIG_LIB=`$SWIG -swiglib` jamie@89: AC_MSG_NOTICE([SWIG library directory is '$SWIG_LIB']) jamie@89: fi jamie@89: else jamie@89: AC_MSG_WARN([cannot determine SWIG version]) jamie@89: SWIG='echo "Error: Cannot determine SWIG version. You should look at http://www.swig.org" ; false' jamie@89: fi jamie@89: fi jamie@89: AC_SUBST([SWIG_LIB]) jamie@89: ])