1 ##### http://autoconf-archive.cryp.to/ac_pkg_swig.html
5 # AC_PROG_SWIG([major.minor.micro])
9 # This macro searches for a SWIG installation on your system. If
10 # found you should call SWIG via $(SWIG). You can use the optional
11 # first argument to check if the version of the available SWIG is
12 # greater than or equal to the value of the argument. It should have
13 # the format: N[.N[.N]] (N is a number between 0 and 999. Only the
14 # first N is mandatory.)
16 # If the version argument is given (e.g. 1.3.17), AC_PROG_SWIG checks
17 # that the swig package is this version number or higher.
19 # In configure.in, use as:
21 # AC_PROG_SWIG(1.3.17)
23 # SWIG_MULTI_MODULE_SUPPORT
32 # Copyright (c) 2006 Sebastian Huber <sebastian-huber@web.de>
33 # Copyright (c) 2006 Alan W. Irwin <irwin@beluga.phys.uvic.ca>
34 # Copyright (c) 2006 Rafael Laboissiere <rafael@laboissiere.net>
35 # Copyright (c) 2006 Andrew Collier <colliera@ukzn.ac.za>
37 # This program is free software; you can redistribute it and/or
38 # modify it under the terms of the GNU General Public License as
39 # published by the Free Software Foundation; either version 2 of the
40 # License, or (at your option) any later version.
42 # This program is distributed in the hope that it will be useful, but
43 # WITHOUT ANY WARRANTY; without even the implied warranty of
44 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
45 # General Public License for more details.
47 # You should have received a copy of the GNU General Public License
48 # along with this program; if not, write to the Free Software
49 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
52 # As a special exception, the respective Autoconf Macro's copyright
53 # owner gives unlimited permission to copy, distribute and modify the
54 # configure scripts that are the output of Autoconf when processing
55 # the Macro. You need not follow the terms of the GNU General Public
56 # License when using or distributing such scripts, even though
57 # portions of the text of the Macro appear in them. The GNU General
58 # Public License (GPL) does govern all other use of the material that
59 # constitutes the Autoconf Macro.
61 # This special exception to the GPL applies to versions of the
62 # Autoconf Macro released by the Autoconf Macro Archive. When you
63 # make and distribute a modified version of the Autoconf Macro, you
64 # may extend this special exception to the GPL to apply to your
65 # modified version as well.
67 AC_DEFUN([AC_PROG_SWIG],[
68 AC_PATH_PROG([SWIG],[swig])
69 if test -z "$SWIG" ; then
70 AC_MSG_WARN([cannot find 'swig' program. You should look at http://www.swig.org])
72 elif test -n "$1" ; then
73 AC_MSG_CHECKING([for SWIG version])
74 [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'`]
75 AC_MSG_RESULT([$swig_version])
76 if test -n "$swig_version" ; then
77 # Calculate the required version number components
79 [required_major=`echo $required | sed 's/[^0-9].*//'`]
80 if test -z "$required_major" ; then
83 [required=`echo $required | sed 's/[0-9]*[^0-9]//'`]
84 [required_minor=`echo $required | sed 's/[^0-9].*//'`]
85 if test -z "$required_minor" ; then
88 [required=`echo $required | sed 's/[0-9]*[^0-9]//'`]
89 [required_patch=`echo $required | sed 's/[^0-9].*//'`]
90 if test -z "$required_patch" ; then
93 # Calculate the available version number components
94 [available=$swig_version]
95 [available_major=`echo $available | sed 's/[^0-9].*//'`]
96 if test -z "$available_major" ; then
99 [available=`echo $available | sed 's/[0-9]*[^0-9]//'`]
100 [available_minor=`echo $available | sed 's/[^0-9].*//'`]
101 if test -z "$available_minor" ; then
104 [available=`echo $available | sed 's/[0-9]*[^0-9]//'`]
105 [available_patch=`echo $available | sed 's/[^0-9].*//'`]
106 if test -z "$available_patch" ; then
109 if test $available_major -ne $required_major \
110 -o $available_minor -ne $required_minor \
111 -o $available_patch -lt $required_patch ; then
112 AC_MSG_WARN([SWIG version >= $1 is required. You have $swig_version. You should look at http://www.swig.org])
115 AC_MSG_NOTICE([SWIG executable is '$SWIG'])
116 SWIG_LIB=`$SWIG -swiglib`
117 AC_MSG_NOTICE([SWIG library directory is '$SWIG_LIB'])
120 AC_MSG_WARN([cannot determine SWIG version])