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