1 dnl @synopsis AC_PROG_SWIG([major.minor.micro])
3 dnl This macro searches for a SWIG installation on your system. If
4 dnl found you should call SWIG via $(SWIG). You can use the optional
5 dnl first argument to check if the version of the available SWIG is
6 dnl greater than or equal to the value of the argument. It should have
7 dnl the format: N[.N[.N]] (N is a number between 0 and 999. Only the
8 dnl first N is mandatory.)
10 dnl If the version argument is given (e.g. 1.3.17), AC_PROG_SWIG checks
11 dnl that the swig package is this version number or higher.
13 dnl In configure.in, use as:
15 dnl AC_PROG_SWIG(1.3.17)
17 dnl SWIG_MULTI_MODULE_SUPPORT
20 dnl @category InstalledPackages
21 dnl @author Sebastian Huber <sebastian-huber@web.de>
22 dnl @author Alan W. Irwin <irwin@beluga.phys.uvic.ca>
23 dnl @author Rafael Laboissiere <rafael@laboissiere.net>
24 dnl @author Andrew Collier <abcollier@yahoo.com>
25 dnl @version 2004-09-20
26 dnl @license GPLWithACException
28 dnl Fixed by Sandro Santilli to consider 2.0.0 > 1.3.37 (2010-06-15)
31 AC_DEFUN([AC_PROG_SWIG],[
32 AC_PATH_PROG([SWIG],[swig])
33 if test -z "$SWIG" ; then
34 AC_MSG_WARN([cannot find 'swig' program. You should look at http://www.swig.org])
36 elif test -n "$1" ; then
37 AC_MSG_CHECKING([for SWIG version])
38 [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'`]
39 AC_MSG_RESULT([$swig_version])
40 if test -n "$swig_version" ; then
41 # Calculate the required version number components
43 [required_major=`echo $required | sed 's/[^0-9].*//'`]
44 if test -z "$required_major" ; then
47 [required=`echo $required | sed 's/[0-9]*[^0-9]//'`]
48 [required_minor=`echo $required | sed 's/[^0-9].*//'`]
49 if test -z "$required_minor" ; then
52 [required=`echo $required | sed 's/[0-9]*[^0-9]//'`]
53 [required_patch=`echo $required | sed 's/[^0-9].*//'`]
54 if test -z "$required_patch" ; then
57 # Calculate the available version number components
58 [available=$swig_version]
59 [available_major=`echo $available | sed 's/[^0-9].*//'`]
60 if test -z "$available_major" ; then
63 [available=`echo $available | sed 's/[0-9]*[^0-9]//'`]
64 [available_minor=`echo $available | sed 's/[^0-9].*//'`]
65 if test -z "$available_minor" ; then
68 [available=`echo $available | sed 's/[0-9]*[^0-9]//'`]
69 [available_patch=`echo $available | sed 's/[^0-9].*//'`]
70 if test -z "$available_patch" ; then
73 [required_full=`printf %2.2d%2.2d%2.2d%2.2d $required_major $required_minor $required_patch]`
74 [available_full=`printf %2.2d%2.2d%2.2d%2.2d $available_major $available_minor $available_patch]`
75 if test $available_full -lt $required_full; then
76 AC_MSG_WARN([SWIG version >= $1 is required. You have $swig_version. You should look at http://www.swig.org])
79 AC_MSG_NOTICE([SWIG executable is '$SWIG'])
80 SWIG_LIB=`$SWIG -swiglib | sed -e :a -e N -e 's/\n/ /' -e ta`
81 AC_MSG_NOTICE([SWIG library directory is '$SWIG_LIB'])
84 AC_MSG_WARN([cannot determine SWIG version])
93 # Enable SWIG C++ support. This affects all invocations of $(SWIG).
94 AC_DEFUN([SWIG_ENABLE_CXX],[
95 AC_REQUIRE([AC_PROG_SWIG])
96 AC_REQUIRE([AC_PROG_CXX])
100 # SWIG_MULTI_MODULE_SUPPORT()
102 # Enable support for multiple modules. This effects all invocations
103 # of $(SWIG). You have to link all generated modules against the
104 # appropriate SWIG runtime library. If you want to build Python
105 # modules for example, use the SWIG_PYTHON() macro and link the
106 # modules against $(SWIG_PYTHON_LIBS).
108 AC_DEFUN([SWIG_MULTI_MODULE_SUPPORT],[
109 AC_REQUIRE([AC_PROG_SWIG])
110 SWIG="$SWIG -noruntime"
113 # SWIG_PYTHON([use-shadow-classes = {no, yes}])
115 # Checks for Python and provides the $(SWIG_PYTHON_CPPFLAGS),
116 # and $(SWIG_PYTHON_OPT) output variables.
118 # $(SWIG_PYTHON_OPT) contains all necessary SWIG options to generate
119 # code for Python. Shadow classes are enabled unless the value of the
120 # optional first argument is exactly 'no'. If you need multi module
121 # support (provided by the SWIG_MULTI_MODULE_SUPPORT() macro) use
122 # $(SWIG_PYTHON_LIBS) to link against the appropriate library. It
123 # contains the SWIG Python runtime library that is needed by the type
124 # check system for example.
125 AC_DEFUN([SWIG_PYTHON],[
126 AC_REQUIRE([AC_PROG_SWIG])
127 AC_REQUIRE([AC_PYTHON_DEVEL])
128 test "x$1" != "xno" || swig_shadow=" -noproxy"
129 AC_SUBST([SWIG_PYTHON_OPT],["-python -modern$swig_shadow"])
130 AC_SUBST([SWIG_PYTHON_CPPFLAGS],[$PYTHON_CPPFLAGS])
134 dnl @synopsis AC_LIB_WAD
136 dnl This macro searches for installed WAD library.
138 AC_DEFUN([AC_LIB_WAD],
140 AC_REQUIRE([AC_PYTHON_DEVEL])
142 AC_HELP_STRING([--enable-wad], [enable wad module]),
144 case "${enableval}" in
146 *) if test "x${enableval}" = xyes;
153 if test -n "$check_wad";
155 AC_CHECK_LIB(wadpy, _init, [WADPY=-lwadpy], [], $PYTHON_LDFLAGS $PYTHON_EXTRA_LIBS)