summaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2007-07-31 18:49:43 +0100
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2007-07-31 18:49:43 +0100
commite821e102b2fa3baff4de719411b03385132dd0f4 (patch)
tree909fd972bd6fbe17eb692da1178368e28b544d3f /m4
parentf0291410ce950913593d5ae6c9fd4fabd5eaaa3f (diff)
downloaddbus-python-e821e102b2fa3baff4de719411b03385132dd0f4.tar.gz
Re-fix checking for Python include paths. Use $PYTHON-config like in 0.82.1 if we can, use the hard-coded logic from versions prior to 0.82.0 if we can't.
Diffstat (limited to 'm4')
-rw-r--r--m4/am-check-python-headers.m427
1 files changed, 19 insertions, 8 deletions
diff --git a/m4/am-check-python-headers.m4 b/m4/am-check-python-headers.m4
index 1e0f2b6..92ea204 100644
--- a/m4/am-check-python-headers.m4
+++ b/m4/am-check-python-headers.m4
@@ -3,22 +3,33 @@ 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)
dnl deduce PYTHON_INCLUDES
-py_prefix=`$PYTHON -c "import sys; print sys.prefix"`
-py_exec_prefix=`$PYTHON -c "import sys; print sys.exec_prefix"`
-PYTHON_INCLUDES="-I${py_prefix}/include/python${PYTHON_VERSION}"
-if test "$py_prefix" != "$py_exec_prefix"; then
- PYTHON_INCLUDES="$PYTHON_INCLUDES -I${py_exec_prefix}/include/python${PYTHON_VERSION}"
+
+AC_MSG_CHECKING(for Python headers using $PYTHON-config --includes)
+PYTHON_INCLUDES=`$PYTHON-config --includes`
+if test $? = 0; then
+ AC_MSG_RESULT($PYTHON_INCLUDES)
+else
+ AC_MSG_RESULT([failed, will try another way])
+ py_prefix=`$PYTHON -c "import sys; print sys.prefix"`
+ py_exec_prefix=`$PYTHON -c "import sys; print sys.exec_prefix"`
+ AC_MSG_CHECKING(for Python headers in $py_prefix and $py_exec_prefix)
+ PYTHON_INCLUDES="-I${py_prefix}/include/python${PYTHON_VERSION}"
+ if test "$py_prefix" != "$py_exec_prefix"; then
+ PYTHON_INCLUDES="$PYTHON_INCLUDES -I${py_exec_prefix}/include/python${PYTHON_VERSION}"
+ fi
+ AC_MSG_RESULT($PYTHON_INCLUDES)
fi
+
+AC_MSG_CHECKING(whether those headers are sufficient)
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)
+[AC_MSG_RESULT(yes)
$1],dnl
-[AC_MSG_RESULT(not found)
+[AC_MSG_RESULT(no)
$2])
CPPFLAGS="$save_CPPFLAGS"
])