| 1 |
dnl @synopsis AC_PROG_SWIG([major.minor.micro]) |
| 2 |
dnl |
| 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.) |
| 9 |
dnl |
| 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. |
| 12 |
dnl |
| 13 |
dnl In configure.in, use as: |
| 14 |
dnl |
| 15 |
dnl AC_PROG_SWIG(1.3.17) |
| 16 |
dnl SWIG_ENABLE_CXX |
| 17 |
dnl SWIG_MULTI_MODULE_SUPPORT |
| 18 |
dnl SWIG_PYTHON |
| 19 |
dnl |
| 20 |
dnl @category InstalledPackages |
| 21 |
dnl @author Sebastian Huber <[email protected]> |
| 22 |
dnl @author Alan W. Irwin <[email protected]> |
| 23 |
dnl @author Rafael Laboissiere <[email protected]> |
| 24 |
dnl @author Andrew Collier <[email protected]> |
| 25 |
dnl @version 2004-09-20 |
| 26 |
dnl @license GPLWithACException |
| 27 |
|
| 28 |
AC_DEFUN([AC_PROG_SWIG],[ |
| 29 |
AC_PATH_PROG([SWIG],[swig]) |
| 30 |
if test -z "$SWIG" ; then |
| 31 |
AC_MSG_WARN([cannot find 'swig' program. You should look at http://www.swig.org]) |
| 32 |
SWIG='echo "Error: SWIG is not installed. You should look at http://www.swig.org" ; false' |
| 33 |
elif test -n "$1" ; then |
| 34 |
AC_MSG_CHECKING([for SWIG version]) |
| 35 |
[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'`] |
| 36 |
AC_MSG_RESULT([$swig_version]) |
| 37 |
if test -n "$swig_version" ; then |
| 38 |
# Calculate the required version number components |
| 39 |
[required=$1] |
| 40 |
[required_major=`echo $required | sed 's/[^0-9].*//'`] |
| 41 |
if test -z "$required_major" ; then |
| 42 |
[required_major=0] |
| 43 |
fi |
| 44 |
[required=`echo $required | sed 's/[0-9]*[^0-9]//'`] |
| 45 |
[required_minor=`echo $required | sed 's/[^0-9].*//'`] |
| 46 |
if test -z "$required_minor" ; then |
| 47 |
[required_minor=0] |
| 48 |
fi |
| 49 |
[required=`echo $required | sed 's/[0-9]*[^0-9]//'`] |
| 50 |
[required_patch=`echo $required | sed 's/[^0-9].*//'`] |
| 51 |
if test -z "$required_patch" ; then |
| 52 |
[required_patch=0] |
| 53 |
fi |
| 54 |
# Calculate the available version number components |
| 55 |
[available=$swig_version] |
| 56 |
[available_major=`echo $available | sed 's/[^0-9].*//'`] |
| 57 |
if test -z "$available_major" ; then |
| 58 |
[available_major=0] |
| 59 |
fi |
| 60 |
[available=`echo $available | sed 's/[0-9]*[^0-9]//'`] |
| 61 |
[available_minor=`echo $available | sed 's/[^0-9].*//'`] |
| 62 |
if test -z "$available_minor" ; then |
| 63 |
[available_minor=0] |
| 64 |
fi |
| 65 |
[available=`echo $available | sed 's/[0-9]*[^0-9]//'`] |
| 66 |
[available_patch=`echo $available | sed 's/[^0-9].*//'`] |
| 67 |
if test -z "$available_patch" ; then |
| 68 |
[available_patch=0] |
| 69 |
fi |
| 70 |
dnl if test $available_major -ne $required_major \ |
| 71 |
dnl -o $available_minor -ne $required_minor \ |
| 72 |
dnl -o $available_patch -lt $required_patch ; then |
| 73 |
if test $available_major -lt $required_major ; then |
| 74 |
AC_MSG_WARN([SWIG version >= $1 is required. You have $swig_version. You should look at http://www.swig.org]) |
| 75 |
SWIG='echo "Error: SWIG version >= $1 is required. You have '"$swig_version"'. You should look at http://www.swig.org" ; false' |
| 76 |
else |
| 77 |
AC_MSG_NOTICE([SWIG executable is '$SWIG']) |
| 78 |
SWIG_LIB=`$SWIG -swiglib` |
| 79 |
AC_MSG_NOTICE([SWIG library directory is '$SWIG_LIB']) |
| 80 |
fi |
| 81 |
else |
| 82 |
AC_MSG_WARN([cannot determine SWIG version]) |
| 83 |
SWIG='echo "Error: Cannot determine SWIG version. You should look at http://www.swig.org" ; false' |
| 84 |
fi |
| 85 |
fi |
| 86 |
AC_SUBST([SWIG_LIB]) |
| 87 |
]) |
| 88 |
|
| 89 |
# SWIG_ENABLE_CXX() |
| 90 |
# |
| 91 |
# Enable SWIG C++ support. This affects all invocations of $(SWIG). |
| 92 |
AC_DEFUN([SWIG_ENABLE_CXX],[ |
| 93 |
AC_REQUIRE([AC_PROG_SWIG]) |
| 94 |
AC_REQUIRE([AC_PROG_CXX]) |
| 95 |
SWIG="$SWIG -c++" |
| 96 |
]) |
| 97 |
|
| 98 |
# SWIG_MULTI_MODULE_SUPPORT() |
| 99 |
# |
| 100 |
# Enable support for multiple modules. This effects all invocations |
| 101 |
# of $(SWIG). You have to link all generated modules against the |
| 102 |
# appropriate SWIG runtime library. If you want to build Python |
| 103 |
# modules for example, use the SWIG_PYTHON() macro and link the |
| 104 |
# modules against $(SWIG_PYTHON_LIBS). |
| 105 |
# |
| 106 |
AC_DEFUN([SWIG_MULTI_MODULE_SUPPORT],[ |
| 107 |
AC_REQUIRE([AC_PROG_SWIG]) |
| 108 |
SWIG="$SWIG -noruntime" |
| 109 |
]) |
| 110 |
|
| 111 |
# SWIG_PYTHON([use-shadow-classes = {no, yes}]) |
| 112 |
# |
| 113 |
# Checks for Python and provides the $(SWIG_PYTHON_CPPFLAGS), |
| 114 |
# and $(SWIG_PYTHON_OPT) output variables. |
| 115 |
# |
| 116 |
# $(SWIG_PYTHON_OPT) contains all necessary SWIG options to generate |
| 117 |
# code for Python. Shadow classes are enabled unless the value of the |
| 118 |
# optional first argument is exactly 'no'. If you need multi module |
| 119 |
# support (provided by the SWIG_MULTI_MODULE_SUPPORT() macro) use |
| 120 |
# $(SWIG_PYTHON_LIBS) to link against the appropriate library. It |
| 121 |
# contains the SWIG Python runtime library that is needed by the type |
| 122 |
# check system for example. |
| 123 |
AC_DEFUN([SWIG_PYTHON],[ |
| 124 |
AC_REQUIRE([AC_PROG_SWIG]) |
| 125 |
AC_REQUIRE([AC_PYTHON_DEVEL]) |
| 126 |
test "x$1" != "xno" || swig_shadow=" -noproxy" |
| 127 |
AC_SUBST([SWIG_PYTHON_OPT],[-python$swig_shadow]) |
| 128 |
AC_SUBST([SWIG_PYTHON_CPPFLAGS],[$PYTHON_CPPFLAGS]) |
| 129 |
]) |
| 130 |
|
| 131 |
|
| 132 |
dnl @synopsis AC_LIB_WAD |
| 133 |
dnl |
| 134 |
dnl This macro searches for installed WAD library. |
| 135 |
dnl |
| 136 |
AC_DEFUN([AC_LIB_WAD], |
| 137 |
[ |
| 138 |
AC_REQUIRE([AC_PYTHON_DEVEL]) |
| 139 |
AC_ARG_ENABLE(wad, |
| 140 |
AC_HELP_STRING([--enable-wad], [enable wad module]), |
| 141 |
[ |
| 142 |
case "${enableval}" in |
| 143 |
no) ;; |
| 144 |
*) if test "x${enableval}" = xyes; |
| 145 |
then |
| 146 |
check_wad="yes" |
| 147 |
fi ;; |
| 148 |
esac |
| 149 |
], []) |
| 150 |
|
| 151 |
if test -n "$check_wad"; |
| 152 |
then |
| 153 |
AC_CHECK_LIB(wadpy, _init, [WADPY=-lwadpy], [], $PYTHON_LDFLAGS $PYTHON_EXTRA_LIBS) |
| 154 |
AC_SUBST(WADPY) |
| 155 |
fi |
| 156 |
]) |