2005-06-25 05:17:57 +08:00
|
|
|
## Find the install dirs for the python installation.
|
|
|
|
## By James Henstridge
|
|
|
|
|
|
|
|
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)
|
2005-08-29 00:59:56 +08:00
|
|
|
dnl Win32 doesn't have a versioned directory for headers
|
|
|
|
if test "$PYTHON_PLATFORM" != "win32"; then
|
|
|
|
py_versiondir="/python${PYTHON_VERSION}"
|
|
|
|
else
|
|
|
|
py_versiondir=
|
|
|
|
fi
|
2005-06-25 05:17:57 +08:00
|
|
|
dnl deduce PYTHON_INCLUDES
|
|
|
|
py_prefix=`$PYTHON -c "import sys; print sys.prefix"`
|
|
|
|
py_exec_prefix=`$PYTHON -c "import sys; print sys.exec_prefix"`
|
2005-08-29 00:59:56 +08:00
|
|
|
PYTHON_INCLUDES="-I${py_prefix}/include${py_versiondir}"
|
2005-06-25 05:17:57 +08:00
|
|
|
if test "$py_prefix" != "$py_exec_prefix"; then
|
2005-08-29 00:59:56 +08:00
|
|
|
PYTHON_INCLUDES="$PYTHON_INCLUDES -I${py_exec_prefix}/include${py_versiondir}"
|
2005-06-25 05:17:57 +08:00
|
|
|
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"
|
|
|
|
])
|