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