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