1 dnl @synopsis AC_PROG_SWIG([major.minor.micro])
3 dnl This macro searches for a SWIG installation on your system. If found you
4 dnl should) SWIG via $(SWIG). You can use the optional first argument to check
5 dnl if the version of the available SWIG is greater than or equal to the
6 dnl value of the argument. It should have the format: N[.N[.N]] (N is a
7 dnl number between 0 and 999. Only the first N is mandatory.)
9 dnl If the version argument is given (e.g. 1.3.17), AC_PROG_SWIG checks that the
10 dnl swig package is this version number or higher.
12 dnl In configure.in, use as:
14 dnl AC_PROG_SWIG(1.3.17)
16 dnl SWIG_MULTI_MODULE_SUPPORT
19 dnl @authors Sebastian Huber <address@hidden>, Alan W. Irwin
20 dnl <address@hidden>, Rafael Laboissiere <address@hidden> and
21 dnl Andrew Collier <address@hidden>.
24 AC_DEFUN([AC_PROG_SWIG],[
26 AC_PATH_PROG([SWIG],[swig])
27 if test -z "$SWIG" ; then
28 AC_MSG_WARN([cannot find 'swig' program. You should look at http://www.swig.org])
29 SWIG='echo "Error: SWIG is not installed. You should look at http://www.swig.org" ; false'
30 elif test -n "$1" ; then
31 AC_MSG_CHECKING([for SWIG version])
32 [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'`]
33 AC_MSG_RESULT([$swig_version])
34 if test -n "$swig_version" ; then
35 # Calculate the required version number components
37 [required_major=`echo $required | sed 's/[^0-9].*//'`]
38 if test -z "$required_major" ; then
41 [required=`echo $required | sed 's/[0-9]*[^0-9]//'`]
42 [required_minor=`echo $required | sed 's/[^0-9].*//'`]
43 if test -z "$required_minor" ; then
46 [required=`echo $required | sed 's/[0-9]*[^0-9]//'`]
47 [required_patch=`echo $required | sed 's/[^0-9].*//'`]
48 if test -z "$required_patch" ; then
51 # Calculate the available version number components
52 [available=$swig_version]
53 [available_major=`echo $available | sed 's/[^0-9].*//'`]
54 if test -z "$available_major" ; then
57 [available=`echo $available | sed 's/[0-9]*[^0-9]//'`]
58 [available_minor=`echo $available | sed 's/[^0-9].*//'`]
59 if test -z "$available_minor" ; then
62 [available=`echo $available | sed 's/[0-9]*[^0-9]//'`]
63 [available_patch=`echo $available | sed 's/[^0-9].*//'`]
64 if test -z "$available_patch" ; then
67 if test $available_major -ne $required_major \
68 -o $available_minor -ne $required_minor \
69 -o $available_patch -lt $required_patch ; then
70 AC_MSG_WARN([SWIG version >= $1 is required. You have $swig_version. You should look at http://www.swig.org])
71 SWIG='echo "Error: SWIG version >= $1 is required. You have '"$swig_version"'. You should look at http://www.swig.org" ; false'
73 AC_MSG_NOTICE([SWIG executable is '$SWIG'])
75 SWIG_LIB=`$SWIG -swiglib`
76 AC_MSG_NOTICE([SWIG runtime library directory is '$SWIG_LIB'])
79 AC_MSG_WARN([cannot determine SWIG version])
80 SWIG='echo "Error: Cannot determine SWIG version. You should look at http://www.swig.org" ; false'
88 # Enable SWIG C++ support. This affects all invocations of $(SWIG).
89 AC_DEFUN([SWIG_ENABLE_CXX],[
90 AC_REQUIRE([AC_PROG_SWIG])
91 AC_REQUIRE([AC_PROG_CXX])
95 # SWIG_MULTI_MODULE_SUPPORT()
97 # Enable support for multiple modules. This effects all invocations
98 # of $(SWIG). You have to link all generated modules against the
99 # appropriate SWIG runtime library. If you want to build Python
100 # modules for example, use the SWIG_PYTHON() macro and link the
101 # modules against $(SWIG_PYTHON_LIBS).
102 AC_DEFUN([SWIG_MULTI_MODULE_SUPPORT],[
103 AC_REQUIRE([AC_PROG_SWIG])
107 # SWIG_PYTHON([use-shadow-classes = {no, yes}])
109 # Checks for Python and provides the $(SWIG_PYTHON_CPPFLAGS),
110 # $(SWIG_PYTHON_LIBS) and $(SWIG_PYTHON_OPT) output variables.
111 # $(SWIG_PYTHON_OPT) contains all necessary SWIG options to generate
112 # code for Python. Shadow classes are enabled unless the value of the
113 # optional first argument is exactly 'no'. If you need multi module
114 # support (provided by the SWIG_MULTI_MODULE_SUPPORT() macro) use
115 # $(SWIG_PYTHON_LIBS) to link against the appropriate library. It
116 # contains the SWIG Python runtime library that is needed by the type
117 # check system for example.
118 AC_DEFUN([SWIG_PYTHON],[
119 AC_REQUIRE([AC_PROG_SWIG])
120 AC_REQUIRE([AC_PYTHON_DEVEL])
121 test "x$1" != "xno" || swig_shadow=" -noproxy"
122 AC_SUBST([SWIG_PYTHON_OPT],[-python$swig_shadow])
123 AC_SUBST([SWIG_PYTHON_CPPFLAGS],[$PYTHON_CPPFLAGS])
124 AC_SUBST([SWIG_PYTHON_LIBS],["-L$SWIG_LIB -lswigpy"])
128 dnl @synopsis AC_LIB_WAD
130 dnl This macro searches for installed WAD library.
132 AC_DEFUN([AC_LIB_WAD],
134 AC_REQUIRE([AC_PYTHON_DEVEL])
136 AC_HELP_STRING([--enable-wad], [enable wad module]),
138 case "${enableval}" in
140 *) if test "x${enableval}" = xyes;
147 if test -n "$check_wad";
149 AC_CHECK_LIB(wadpy, _init, [WADPY=-lwadpy], [], $PYTHON_LDFLAGS $PYTHON_EXTRA_LIBS)