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],[
25 AC_PATH_PROG([SWIG],[swig])
26 if test -z "$SWIG" ; then
27 AC_MSG_WARN([cannot find 'swig' program. You should look at http://www.swig.org])
28 SWIG='echo "Error: SWIG is not installed. You should look at http://www.swig.org" ; false'
29 elif test -n "$1" ; then
30 AC_MSG_CHECKING([for SWIG version])
31 [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'`]
32 AC_MSG_RESULT([$swig_version])
33 if test -n "$swig_version" ; then
34 # Calculate the required version number components
36 [required_major=`echo $required | sed 's/[^0-9].*//'`]
37 if test -z "$required_major" ; then
40 [required=`echo $required | sed 's/[0-9]*[^0-9]//'`]
41 [required_minor=`echo $required | sed 's/[^0-9].*//'`]
42 if test -z "$required_minor" ; then
45 [required=`echo $required | sed 's/[0-9]*[^0-9]//'`]
46 [required_patch=`echo $required | sed 's/[^0-9].*//'`]
47 if test -z "$required_patch" ; then
50 # Calculate the available version number components
51 [available=$swig_version]
52 [available_major=`echo $available | sed 's/[^0-9].*//'`]
53 if test -z "$available_major" ; then
56 [available=`echo $available | sed 's/[0-9]*[^0-9]//'`]
57 [available_minor=`echo $available | sed 's/[^0-9].*//'`]
58 if test -z "$available_minor" ; then
61 [available=`echo $available | sed 's/[0-9]*[^0-9]//'`]
62 [available_patch=`echo $available | sed 's/[^0-9].*//'`]
63 if test -z "$available_patch" ; then
66 if test $available_major -ne $required_major \
67 -o $available_minor -ne $required_minor \
68 -o $available_patch -lt $required_patch ; then
69 AC_MSG_WARN([SWIG version >= $1 is required. You have $swig_version. You should look at http://www.swig.org])
70 SWIG='echo "Error: SWIG version >= $1 is required. You have '"$swig_version"'. You should look at http://www.swig.org" ; false'
72 AC_MSG_NOTICE([SWIG executable is '$SWIG'])
73 SWIG_LIB=`$SWIG -swiglib`
74 AC_MSG_NOTICE([SWIG runtime library directory is '$SWIG_LIB'])
77 AC_MSG_WARN([cannot determine SWIG version])
78 SWIG='echo "Error: Cannot determine SWIG version. You should look at http://www.swig.org" ; false'
86 # Enable SWIG C++ support. This affects all invocations of $(SWIG).
87 AC_DEFUN([SWIG_ENABLE_CXX],[
88 AC_REQUIRE([AC_PROG_SWIG])
89 AC_REQUIRE([AC_PROG_CXX])
93 # SWIG_MULTI_MODULE_SUPPORT()
95 # Enable support for multiple modules. This effects all invocations
96 # of $(SWIG). You have to link all generated modules against the
97 # appropriate SWIG runtime library. If you want to build Python
98 # modules for example, use the SWIG_PYTHON() macro and link the
99 # modules against $(SWIG_PYTHON_LIBS).
100 AC_DEFUN([SWIG_MULTI_MODULE_SUPPORT],[
101 AC_REQUIRE([AC_PROG_SWIG])
105 # SWIG_PYTHON([use-shadow-classes = {no, yes}])
107 # Checks for Python and provides the $(SWIG_PYTHON_CPPFLAGS),
108 # $(SWIG_PYTHON_LIBS) and $(SWIG_PYTHON_OPT) output variables.
109 # $(SWIG_PYTHON_OPT) contains all necessary SWIG options to generate
110 # code for Python. Shadow classes are enabled unless the value of the
111 # optional first argument is exactly 'no'. If you need multi module
112 # support (provided by the SWIG_MULTI_MODULE_SUPPORT() macro) use
113 # $(SWIG_PYTHON_LIBS) to link against the appropriate library. It
114 # contains the SWIG Python runtime library that is needed by the type
115 # check system for example.
116 AC_DEFUN([SWIG_PYTHON],[
117 AC_REQUIRE([AC_PROG_SWIG])
118 AC_REQUIRE([AC_PYTHON_DEVEL])
119 test "x$1" != "xno" || swig_shadow=" -noproxy"
120 AC_SUBST([SWIG_PYTHON_OPT],[-python$swig_shadow])
121 AC_SUBST([SWIG_PYTHON_CPPFLAGS],[$PYTHON_CPPFLAGS])
122 AC_SUBST([SWIG_PYTHON_LIBS],["-L$SWIG_LIB -lswigpy"])
126 dnl @synopsis AC_LIB_WAD
128 dnl This macro searches for installed WAD library.
130 AC_DEFUN([AC_LIB_WAD],
132 AC_REQUIRE([AC_PYTHON_DEVEL])
134 AC_HELP_STRING([--enable-wad], [enable wad module]),
136 case "${enableval}" in
138 *) if test "x${enableval}" = xyes;
145 if test -n "$check_wad";
147 AC_CHECK_LIB(wadpy, _init, [WADPY=-lwadpy], [], $PYTHON_LDFLAGS $PYTHON_EXTRA_LIBS)