126 lines
5.3 KiB
Plaintext
126 lines
5.3 KiB
Plaintext
AC_DEFUN([AC_PROG_SWIG],[
|
|
AC_PATH_PROG([SWIG],[swig])
|
|
if test -z "$SWIG" ; then
|
|
AC_MSG_WARN([cannot find 'swig' program. You should look at http://www.swig.org])
|
|
SWIG='echo "Error: SWIG is not installed. You should look at http://www.swig.org" ; false'
|
|
elif test -n "$1" ; then
|
|
AC_MSG_CHECKING([for SWIG version])
|
|
[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'`]
|
|
AC_MSG_RESULT([$swig_version])
|
|
if test -n "$swig_version" ; then
|
|
# Calculate the required version number components
|
|
[required=$1]
|
|
[required_major=`echo $required | sed 's/[^0-9].*//'`]
|
|
if test -z "$required_major" ; then
|
|
[required_major=0]
|
|
fi
|
|
[required=`echo $required | sed 's/[0-9]*[^0-9]//'`]
|
|
[required_minor=`echo $required | sed 's/[^0-9].*//'`]
|
|
if test -z "$required_minor" ; then
|
|
[required_minor=0]
|
|
fi
|
|
[required=`echo $required | sed 's/[0-9]*[^0-9]//'`]
|
|
[required_patch=`echo $required | sed 's/[^0-9].*//'`]
|
|
if test -z "$required_patch" ; then
|
|
[required_patch=0]
|
|
fi
|
|
# Calculate the available version number components
|
|
[available=$swig_version]
|
|
[available_major=`echo $available | sed 's/[^0-9].*//'`]
|
|
if test -z "$available_major" ; then
|
|
[available_major=0]
|
|
fi
|
|
[available=`echo $available | sed 's/[0-9]*[^0-9]//'`]
|
|
[available_minor=`echo $available | sed 's/[^0-9].*//'`]
|
|
if test -z "$available_minor" ; then
|
|
[available_minor=0]
|
|
fi
|
|
[available=`echo $available | sed 's/[0-9]*[^0-9]//'`]
|
|
[available_patch=`echo $available | sed 's/[^0-9].*//'`]
|
|
if test -z "$available_patch" ; then
|
|
[available_patch=0]
|
|
fi
|
|
if test $available_major -ne $required_major \
|
|
-o $available_minor -ne $required_minor \
|
|
-o $available_patch -lt $required_patch ; then
|
|
AC_MSG_WARN([SWIG version >= $1 is required. You have $swig_version. You should look at http://www.swig.org])
|
|
SWIG='echo "Error: SWIG version >= $1 is required. You have '"$swig_version"'. You should look at http://www.swig.org" ; false'
|
|
else
|
|
AC_MSG_NOTICE([SWIG executable is '$SWIG'])
|
|
SWIG_LIB=`$SWIG -swiglib`
|
|
AC_MSG_NOTICE([SWIG library directory is '$SWIG_LIB'])
|
|
fi
|
|
else
|
|
AC_MSG_WARN([cannot determine SWIG version])
|
|
SWIG='echo "Error: Cannot determine SWIG version. You should look at http://www.swig.org" ; false'
|
|
fi
|
|
fi
|
|
AC_SUBST([SWIG_LIB])
|
|
])
|
|
|
|
dnl a macro to check for ability to create python extensions
|
|
dnl AM_CHECK_PYTHON_HEADERS([ACTION-IF-POSSIBLE], [ACTION-IF-NOT-POSSIBLE])
|
|
dnl function also defines PYTHON_INCLUDES
|
|
AC_DEFUN([AM_CHECK_PYTHON_HEADERS],
|
|
[AC_REQUIRE([AM_PATH_PYTHON])
|
|
AC_MSG_CHECKING(for headers required to compile python extensions)
|
|
dnl deduce PYTHON_INCLUDES
|
|
py_prefix=`$PYTHON -c "import sys; print sys.prefix"`
|
|
py_exec_prefix=`$PYTHON -c "import sys; print sys.exec_prefix"`
|
|
PYTHON_INCLUDES="-I${py_prefix}/include/python${PYTHON_VERSION}"
|
|
if test "$py_prefix" != "$py_exec_prefix"; then
|
|
PYTHON_INCLUDES="$PYTHON_INCLUDES -I${py_exec_prefix}/include/python${PYTHON_VERSION}"
|
|
fi
|
|
AC_SUBST(PYTHON_INCLUDES)
|
|
dnl check if the headers exist:
|
|
save_CPPFLAGS="$CPPFLAGS"
|
|
CPPFLAGS="$CPPFLAGS $PYTHON_INCLUDES"
|
|
AC_TRY_CPP([#include <Python.h>],dnl
|
|
[AC_MSG_RESULT(found)
|
|
$1],dnl
|
|
[AC_MSG_RESULT(not found)
|
|
$2])
|
|
CPPFLAGS="$save_CPPFLAGS"
|
|
])
|
|
|
|
dnl AS_AC_EXPAND(VAR, CONFIGURE_VAR)
|
|
dnl example
|
|
dnl AS_AC_EXPAND(SYSCONFDIR, $sysconfdir)
|
|
dnl will set SYSCONFDIR to /usr/local/etc
|
|
|
|
dnl written by thomas vander stichele
|
|
|
|
AC_DEFUN([AS_AC_EXPAND],
|
|
[
|
|
EXP_VAR=[$1]
|
|
FROM_VAR=[$2]
|
|
|
|
dnl first expand prefix and exec_prefix if necessary
|
|
prefix_save=$prefix
|
|
if test "x$prefix" = "xNONE"; then
|
|
prefix=/usr/local
|
|
fi
|
|
exec_prefix_save=$exec_prefix
|
|
if test "x$exec_prefix" = "xNONE"; then
|
|
if test "x$prefix_save" = "xNONE"; then
|
|
exec_prefix=/usr/local
|
|
else
|
|
exec_prefix=$prefix
|
|
fi
|
|
fi
|
|
|
|
full_var="$FROM_VAR"
|
|
dnl loop until it doesn't change anymore
|
|
while true; do
|
|
new_full_var="`eval echo $full_var`"
|
|
if test "x$new_full_var" = "x$full_var"; then break; fi
|
|
full_var=$new_full_var
|
|
done
|
|
|
|
dnl clean up
|
|
full_var=$new_full_var
|
|
[$1]=$full_var
|
|
prefix=$prefix_save
|
|
exec_prefix=$exec_prefix_save
|
|
])
|