1 # Taken from pyobject. It's Copyright Johan Dahlin and others. See the
2 # version control history in pygobject and pygtk for full details.
4 dnl a macro to check for ability to create python extensions
5 dnl JD_CHECK_PYTHON_HEADERS([ACTION-IF-POSSIBLE], [ACTION-IF-NOT-POSSIBLE])
6 dnl function also defines PYTHON_INCLUDES
7 AC_DEFUN([JD_CHECK_PYTHON_HEADERS],
8 [AC_REQUIRE([AM_PATH_PYTHON])
9 AC_MSG_CHECKING(for headers required to compile python extensions)
10 dnl deduce PYTHON_INCLUDES
11 py_prefix=`$PYTHON -c "import sys; sys.stdout.write(sys.prefix)"`
12 py_exec_prefix=`$PYTHON -c "import sys; sys.stdout.write(sys.exec_prefix)"`
13 if test -x "$PYTHON-config"; then
14 PYTHON_INCLUDES=`$PYTHON-config --includes 2>/dev/null`
16 PYTHON_INCLUDES="-I${py_prefix}/include/python${PYTHON_VERSION}"
17 if test "$py_prefix" != "$py_exec_prefix"; then
18 PYTHON_INCLUDES="$PYTHON_INCLUDES -I${py_exec_prefix}/include/python${PYTHON_VERSION}"
21 AC_SUBST(PYTHON_INCLUDES)
22 dnl check if the headers exist:
23 save_CPPFLAGS="$CPPFLAGS"
24 CPPFLAGS="$CPPFLAGS $PYTHON_INCLUDES"
25 AC_TRY_CPP([#include <Python.h>],dnl
28 [AC_MSG_RESULT(not found)
30 CPPFLAGS="$save_CPPFLAGS"