1 ## this one is commonly used with AM_PATH_PYTHONDIR ...
2 dnl AM_CHECK_PYMOD(MODNAME [,SYMBOL [,ACTION-IF-FOUND [,ACTION-IF-NOT-FOUND]]])
3 dnl Check if a module containing a given symbol is visible to python.
4 AC_DEFUN([AM_CHECK_PYMOD],
5 [AC_REQUIRE([AM_PATH_PYTHON])
6 py_mod_var=`echo $1['_']$2 | sed 'y%./+-%__p_%'`
7 AC_MSG_CHECKING(for ifelse([$2],[],,[$2 in ])python module $1)
8 AC_CACHE_VAL(py_cv_mod_$py_mod_var, [
9 ifelse([$2],[], [prog="
17 sys.exit(0)"], [prog="
20 if $PYTHON -c "$prog" 1>&AC_FD_CC 2>&AC_FD_CC
22 eval "py_cv_mod_$py_mod_var=yes"
24 eval "py_cv_mod_$py_mod_var=no"
27 py_val=`eval "echo \`echo '$py_cv_mod_'$py_mod_var\`"`
28 if test "x$py_val" != xno; then
39 dnl a macro to check for ability to create python extensions
40 dnl AM_CHECK_PYTHON_HEADERS([ACTION-IF-POSSIBLE], [ACTION-IF-NOT-POSSIBLE])
41 dnl function also defines PYTHON_INCLUDES
42 AC_DEFUN([AM_CHECK_PYTHON_HEADERS],
43 [AC_REQUIRE([AM_PATH_PYTHON])
44 AC_MSG_CHECKING(for headers required to compile python extensions)
45 dnl deduce PYTHON_INCLUDES
46 py_prefix=`$PYTHON -c "import sys; print sys.prefix"`
47 py_exec_prefix=`$PYTHON -c "import sys; print sys.exec_prefix"`
48 if test -x "$PYTHON-config"; then
49 PYTHON_INCLUDES=`$PYTHON-config --includes 2>/dev/null`
51 PYTHON_INCLUDES="-I${py_prefix}/include/python${PYTHON_VERSION}"
52 if test "$py_prefix" != "$py_exec_prefix"; then
53 PYTHON_INCLUDES="$PYTHON_INCLUDES -I${py_exec_prefix}/include/python${PYTHON_VERSION}"
56 AC_SUBST(PYTHON_INCLUDES)
57 dnl check if the headers exist:
58 save_CPPFLAGS="$CPPFLAGS"
59 CPPFLAGS="$CPPFLAGS $PYTHON_INCLUDES"
60 AC_TRY_CPP([#include <Python.h>],dnl
63 [AC_MSG_RESULT(not found)
65 CPPFLAGS="$save_CPPFLAGS"