Remove --ldap-base from the python provision script
[samba.git] / source4 / scripting / python / ac_pkg_swig.m4
1 ##### http://autoconf-archive.cryp.to/ac_pkg_swig.html
2 #
3 # SYNOPSIS
4 #
5 #   AC_PROG_SWIG([major.minor.micro])
6 #
7 # DESCRIPTION
8 #
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.)
15 #
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.
18 #
19 #   In configure.in, use as:
20 #
21 #     AC_PROG_SWIG(1.3.17)
22 #     SWIG_ENABLE_CXX
23 #     SWIG_MULTI_MODULE_SUPPORT
24 #     SWIG_PYTHON
25 #
26 # LAST MODIFICATION
27 #
28 #   2006-10-22
29 #
30 # COPYLEFT
31 #
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>
36 #
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.
41 #
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.
46 #
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
50 #   02111-1307, USA.
51 #
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.
60 #
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.
66
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])
71                 SWIG='no'
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
78                         [required=$1]
79                         [required_major=`echo $required | sed 's/[^0-9].*//'`]
80                         if test -z "$required_major" ; then
81                                 [required_major=0]
82                         fi
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
86                                 [required_minor=0]
87                         fi
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
91                                 [required_patch=0]
92                         fi
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
97                                 [available_major=0]
98                         fi
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
102                                 [available_minor=0]
103                         fi
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
107                                 [available_patch=0]
108                         fi
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])
113                                 SWIG='no'
114                         else
115                                 AC_MSG_NOTICE([SWIG executable is '$SWIG'])
116                                 SWIG_LIB=`$SWIG -swiglib`
117                                 AC_MSG_NOTICE([SWIG library directory is '$SWIG_LIB'])
118                         fi
119                 else
120                         AC_MSG_WARN([cannot determine SWIG version])
121                         SWIG='no'
122                 fi
123         fi
124         AC_SUBST([SWIG_LIB])
125 ])