summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGustavo Sverzut Barbieri <barbieri@gmail.com>2010-09-28 23:17:55 +0000
committerGustavo Sverzut Barbieri <barbieri@gmail.com>2010-09-28 23:17:55 +0000
commit787f9bfa0278f8261839cdfbfc2ca0dd1f6deb6b (patch)
tree6d03189dcc89760db4f06164c1c0f77653bc244f
parente95630bd19a0edceccd42e5a2db0198608d8c97c (diff)
Add PYTHON_INCLUDES env variable for cross-compiling
When cross-compiling Cython's generated code, host and target can have distinct python versions, located on separated directories. This patch adds the capability of defining an environment variable containing the location of the target's headers. Introspection using AM_CHECK_PYTHON_HEADERS is not possible as it cannot run the target's python (since it's another architecture). SVN revision: 52870
-rw-r--r--README4
-rw-r--r--m4/python.m44
2 files changed, 8 insertions, 0 deletions
diff --git a/README b/README
index 938e11b..c9397a9 100644
--- a/README
+++ b/README
@@ -36,3 +36,7 @@ variable to ./configure.
36The discovery of dependencies is done with pkg-config, thus all your 36The discovery of dependencies is done with pkg-config, thus all your
37packages must be properly accessible with such tool. Ensure your 37packages must be properly accessible with such tool. Ensure your
38PKG_CONFIG_PATH and PKG_CONFIG_LIBDIR (cross-compiles) are configured! 38PKG_CONFIG_PATH and PKG_CONFIG_LIBDIR (cross-compiles) are configured!
39
40When cross-compiling, if your target's Python headers differ from your
41host's headers, specify PYTHON_INCLUDES variable containing the
42directory of the correct version of Python.h!
diff --git a/m4/python.m4 b/m4/python.m4
index 3dd1aa6..02acac8 100644
--- a/m4/python.m4
+++ b/m4/python.m4
@@ -43,6 +43,9 @@ dnl function also defines PYTHON_INCLUDES
43AC_DEFUN([AM_CHECK_PYTHON_HEADERS], 43AC_DEFUN([AM_CHECK_PYTHON_HEADERS],
44[AC_REQUIRE([AM_PATH_PYTHON]) 44[AC_REQUIRE([AM_PATH_PYTHON])
45AC_MSG_CHECKING(for headers required to compile python extensions) 45AC_MSG_CHECKING(for headers required to compile python extensions)
46if test -x "$PYTHON_INCLUDES"; then
47PYTHON_INCLUDES="-I$PYTHON_INCLUDES"
48else
46dnl deduce PYTHON_INCLUDES 49dnl deduce PYTHON_INCLUDES
47py_prefix=`$PYTHON -c "import sys; print sys.prefix"` 50py_prefix=`$PYTHON -c "import sys; print sys.prefix"`
48py_exec_prefix=`$PYTHON -c "import sys; print sys.exec_prefix"` 51py_exec_prefix=`$PYTHON -c "import sys; print sys.exec_prefix"`
@@ -54,6 +57,7 @@ if test "$py_prefix" != "$py_exec_prefix"; then
54 PYTHON_INCLUDES="$PYTHON_INCLUDES -I${py_exec_prefix}/include/python${PYTHON_VERSION}" 57 PYTHON_INCLUDES="$PYTHON_INCLUDES -I${py_exec_prefix}/include/python${PYTHON_VERSION}"
55fi 58fi
56fi 59fi
60fi
57AC_SUBST(PYTHON_INCLUDES) 61AC_SUBST(PYTHON_INCLUDES)
58dnl check if the headers exist: 62dnl check if the headers exist:
59save_CPPFLAGS="$CPPFLAGS" 63save_CPPFLAGS="$CPPFLAGS"