xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Roger Pau Monne <roger.pau@citrix.com>
To: xen-devel@lists.xen.org
Cc: Olaf Hering <olaf@aepfle.de>, Roger Pau Monne <roger.pau@citrix.com>
Subject: [PATCH] autoconf: use python-config when present, if not switch to distutils
Date: Tue, 10 Apr 2012 17:38:48 +0100	[thread overview]
Message-ID: <1334075928-5045-1-git-send-email-roger.pau@citrix.com> (raw)

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)

             reply	other threads:[~2012-04-10 16:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-10 16:38 Roger Pau Monne [this message]
2012-04-11 10:00 ` [PATCH] autoconf: use python-config when present, if not switch to distutils Olaf Hering
2012-04-24 17:50 ` Ian Jackson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1334075928-5045-1-git-send-email-roger.pau@citrix.com \
    --to=roger.pau@citrix.com \
    --cc=olaf@aepfle.de \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).