[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH] autoconf: fix python-dev detection on old python versions



Replaced the use of python-config (that is only present in Python > 2.5.x)
with the distutils python module.

Please run ./autogen.sh after applying the patch.

Signed-off-by: Roger Pau Monne <roger.pau@xxxxxxxxxxxxx>
Cc: Zhang, Yang Z <yang.z.zhang@xxxxxxxxx>
Cc: KUWAMURA Shin'ya <kuwa@xxxxxxxxxxxxxx>
Cc: Ian Campbell <ian.campbell@xxxxxxxxxx>
---
 tools/m4/python_devel.m4 |   34 +++++++++++++++-------------------
 1 files changed, 15 insertions(+), 19 deletions(-)

diff --git a/tools/m4/python_devel.m4 b/tools/m4/python_devel.m4
index 3bcca7b..5f161f1 100644
--- a/tools/m4/python_devel.m4
+++ b/tools/m4/python_devel.m4
@@ -1,27 +1,23 @@
 AC_DEFUN([AX_CHECK_PYTHON_DEVEL], [
+ac_python_version=`$PYTHON -c 'import distutils.sysconfig; \
+    print distutils.sysconfig.get_config_var("VERSION")'`
 ac_previous_cppflags=$CPPFLAGS
-CPPFLAGS="$CFLAGS `$PYTHON-config --includes`"
+CPPFLAGS="$CFLAGS `$PYTHON -c 'import distutils.sysconfig; \
+    print "-I" + distutils.sysconfig.get_config_var("INCLUDEPY")'`"
+CPPFLAGS="$CPPFLAGS `$PYTHON -c 'import distutils.sysconfig; \
+    print distutils.sysconfig.get_config_var("CFLAGS")'`"
 ac_previous_ldflags=$LDFLAGS
-for flag in `$PYTHON-config --ldflags`
-do
-    case $flag in
-    -L*)
-        LDFLAGS="$LDLFAGS $flag"
-        ;;
-    -lpython*)
-        python_lib=`echo $flag | sed 's/^-l//'`
-        ;;
-    -l*)
-        # Ignore other libraries, we are only interested in testing python-dev
-        ;;
-    *)
-        AC_MSG_WARN([Strange ldflag found in $PYTHON-config output: $flag])
-        ;;
-    esac
-done
+LDFLAGS="$LDFLAGS `$PYTHON -c 'import distutils.sysconfig; \
+    print distutils.sysconfig.get_config_var("LIBS")'`"
+LDFLAGS="$LDFLAGS `$PYTHON -c 'import distutils.sysconfig; \
+    print "-L" + distutils.sysconfig.get_python_lib(plat_specific=1,\
+    standard_lib=1) + "/config"'`"
+LDFLAGS="$LDFLAGS `$PYTHON -c 'import distutils.sysconfig; \
+    print distutils.sysconfig.get_config_var("LINKFORSHARED")'`"
+
 AC_CHECK_HEADER([Python.h], [],
     [AC_MSG_ERROR([Unable to find Python development headers])],)
-AC_CHECK_LIB($python_lib, PyArg_ParseTuple, [],
+AC_CHECK_LIB(python$ac_python_version, PyArg_ParseTuple, [],
     [AC_MSG_ERROR([Unable to find a suitable python development library])])
 CPPFLAGS=$ac_previous_cppflags
 LDLFAGS=$ac_previous_ldflags
-- 
1.7.7.5 (Apple Git-26)


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.