xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] autoconf: use python-config when present, if not switch to distutils
@ 2012-04-10 16:38 Roger Pau Monne
  2012-04-11 10:00 ` Olaf Hering
  2012-04-24 17:50 ` Ian Jackson
  0 siblings, 2 replies; 3+ messages in thread
From: Roger Pau Monne @ 2012-04-10 16:38 UTC (permalink / raw)
  To: xen-devel; +Cc: Olaf Hering, Roger Pau Monne

Use python-config utility when possible, and if it is not present switch to
distutils.

Should fix the bug reported by Olaf Hering on SuSE.

Rerun autoconf after applying the patch.

Signed-off-by: Roger Pau Monne <roger.pau@citrix.com>
Cc: Olaf Hering <olaf@aepfle.de>
---
 tools/m4/python_devel.m4 |   42 +++++++++++++++++++++++++-----------------
 1 files changed, 25 insertions(+), 17 deletions(-)

diff --git a/tools/m4/python_devel.m4 b/tools/m4/python_devel.m4
index 8bfcd0c..0a2202c 100644
--- a/tools/m4/python_devel.m4
+++ b/tools/m4/python_devel.m4
@@ -1,23 +1,31 @@
 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 -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
-LDFLAGS="$LDFLAGS `$PYTHON -c 'import distutils.sysconfig; \
-    print distutils.sysconfig.get_config_var("LIBS")'`"
-LDFLAGS="$LDFLAGS `$PYTHON -c 'import distutils.sysconfig; \
-    print distutils.sysconfig.get_config_var("SYSLIBS")'`"
-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")'`"
-LDFLAGS="$LDFLAGS `$PYTHON -c 'import distutils.sysconfig; \
-    print distutils.sysconfig.get_config_var("LDFLAGS")'`"
+ac_python_version=`$PYTHON -c 'import distutils.sysconfig; \
+    print distutils.sysconfig.get_config_var("VERSION")'`
+AC_PATH_PROG([pyconfig], [$PYTHON-config], [no])
+AS_IF([test x"$pyconfig" == x"no"], [
+    dnl For those that don't have python-config
+    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")'`"
+    LDFLAGS="$LDFLAGS `$PYTHON -c 'import distutils.sysconfig; \
+        print distutils.sysconfig.get_config_var("LIBS")'`"
+    LDFLAGS="$LDFLAGS `$PYTHON -c 'import distutils.sysconfig; \
+        print distutils.sysconfig.get_config_var("SYSLIBS")'`"
+    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")'`"
+    LDFLAGS="$LDFLAGS `$PYTHON -c 'import distutils.sysconfig; \
+        print distutils.sysconfig.get_config_var("LDFLAGS")'`"
+], [
+    dnl If python-config is found use it
+    CPPFLAGS="$CFLAGS `$PYTHON-config --cflags`"
+    LDFLAGS="$LDFLAGS `$PYTHON-config --ldflags`"
+])
 
 AC_CHECK_HEADER([Python.h], [],
     [AC_MSG_ERROR([Unable to find Python development headers])],)
-- 
1.7.7.5 (Apple Git-26)

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] autoconf: use python-config when present, if not switch to distutils
  2012-04-10 16:38 [PATCH] autoconf: use python-config when present, if not switch to distutils Roger Pau Monne
@ 2012-04-11 10:00 ` Olaf Hering
  2012-04-24 17:50 ` Ian Jackson
  1 sibling, 0 replies; 3+ messages in thread
From: Olaf Hering @ 2012-04-11 10:00 UTC (permalink / raw)
  To: Roger Pau Monne; +Cc: xen-devel

On Tue, Apr 10, Roger Pau Monne wrote:

> Use python-config utility when possible, and if it is not present switch to
> distutils.
> 
> Should fix the bug reported by Olaf Hering on SuSE.
> 
> Rerun autoconf after applying the patch.

Yes, this fixes the build on openSuSE 11.4 and later.

Olaf

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] autoconf: use python-config when present, if not switch to distutils
  2012-04-10 16:38 [PATCH] autoconf: use python-config when present, if not switch to distutils Roger Pau Monne
  2012-04-11 10:00 ` Olaf Hering
@ 2012-04-24 17:50 ` Ian Jackson
  1 sibling, 0 replies; 3+ messages in thread
From: Ian Jackson @ 2012-04-24 17:50 UTC (permalink / raw)
  To: Roger Pau Monne; +Cc: Olaf Hering, xen-devel

Roger Pau Monne writes ("[Xen-devel] [PATCH] autoconf: use python-config when present, if not switch to distutils"):
> Use python-config utility when possible, and if it is not present switch to
> distutils.
> 
> Should fix the bug reported by Olaf Hering on SuSE.
> 
> Rerun autoconf after applying the patch.
> 
> Signed-off-by: Roger Pau Monne <roger.pau@citrix.com>
> Cc: Olaf Hering <olaf@aepfle.de>

Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-04-24 17:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-10 16:38 [PATCH] autoconf: use python-config when present, if not switch to distutils Roger Pau Monne
2012-04-11 10:00 ` Olaf Hering
2012-04-24 17:50 ` Ian Jackson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).