• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1dnl a macro to check for ability to create python extensions
2dnl  AM_CHECK_PYTHON_HEADERS([ACTION-IF-POSSIBLE], [ACTION-IF-NOT-POSSIBLE])
3dnl function also defines PYTHON_INCLUDES
4AC_DEFUN([AM_CHECK_PYTHON_HEADERS],
5[AC_REQUIRE([AM_PATH_PYTHON])
6AC_MSG_CHECKING(for headers required to compile python extensions)
7dnl deduce PYTHON_INCLUDES
8py_prefix=`$PYTHON -c "import sys; print sys.prefix"`
9py_exec_prefix=`$PYTHON -c "import sys; print sys.exec_prefix"`
10PYTHON_INCLUDES="-I${py_prefix}/include/python${PYTHON_VERSION}"
11if test "$py_prefix" != "$py_exec_prefix"; then
12  PYTHON_INCLUDES="$PYTHON_INCLUDES -I${py_exec_prefix}/include/python${PYTHON_VERSION}"
13fi
14AC_SUBST(PYTHON_INCLUDES)
15dnl check if the headers exist:
16save_CPPFLAGS="$CPPFLAGS"
17CPPFLAGS="$CPPFLAGS $PYTHON_INCLUDES"
18AC_TRY_CPP([#include <Python.h>],dnl
19[AC_MSG_RESULT(found)
20$1],dnl
21[AC_MSG_RESULT(not found)
22$2])
23CPPFLAGS="$save_CPPFLAGS"
24])
25