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

[Xen-changelog] [xen-unstable] autoconf: use python-config when present, if not switch to distuti


  • To: xen-changelog@xxxxxxxxxxxxxxxxxxx
  • From: Xen patchbot-unstable <patchbot@xxxxxxx>
  • Date: Mon, 14 May 2012 16:31:57 +0000
  • Delivery-date: Mon, 14 May 2012 16:32:04 +0000
  • List-id: "Change log for Mercurial \(receive only\)" <xen-changelog.lists.xen.org>

# HG changeset patch
# User Roger Pau Monne <roger.pau@xxxxxxxxxx>
# Date 1335289344 -3600
# Node ID caee592e55cbaaf4157bd1ead097e571b1dfcef8
# Parent  d8ce6ab50fbce9b0072bc2df52f8f527f0c185e1
autoconf: use python-config when present, if not switch to distuti

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.

Signed-off-by: Roger Pau Monne <roger.pau@xxxxxxxxxx>
Tested-by: Olaf Hering <olaf@xxxxxxxxx>
Committed-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---


diff -r d8ce6ab50fbc -r caee592e55cb tools/configure
--- a/tools/configure   Tue Apr 24 18:40:15 2012 +0100
+++ b/tools/configure   Tue Apr 24 18:42:24 2012 +0100
@@ -616,6 +616,7 @@ PKG_CONFIG_LIBDIR
 PKG_CONFIG_PATH
 PKG_CONFIG
 CURSES_LIBS
+pyconfig
 PYTHONPATH
 OCAMLBUILD
 OCAMLDOC
@@ -6282,25 +6283,75 @@ else
 $as_echo "yes" >&6; }
 fi
 
+ac_previous_cppflags=$CPPFLAGS
+ac_previous_ldflags=$LDFLAGS
 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")'`"
+# Extract the first word of "$PYTHON-config", so it can be a program name with 
args.
+set dummy $PYTHON-config; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_pyconfig+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $pyconfig in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_pyconfig="$pyconfig" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x 
"$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_pyconfig="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" 
>&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  test -z "$ac_cv_path_pyconfig" && ac_cv_path_pyconfig="no"
+  ;;
+esac
+fi
+pyconfig=$ac_cv_path_pyconfig
+if test -n "$pyconfig"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $pyconfig" >&5
+$as_echo "$pyconfig" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+if test x"$pyconfig" == x"no"; then :
+
+        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")'`"
+
+else
+
+        CPPFLAGS="$CFLAGS `$PYTHON-config --cflags`"
+    LDFLAGS="$LDFLAGS `$PYTHON-config --ldflags`"
+
+fi
 
 ac_fn_c_check_header_mongrel "$LINENO" "Python.h" "ac_cv_header_Python_h" 
"$ac_includes_default"
 if test "x$ac_cv_header_Python_h" = x""yes; then :
diff -r d8ce6ab50fbc -r caee592e55cb tools/m4/python_devel.m4
--- a/tools/m4/python_devel.m4  Tue Apr 24 18:40:15 2012 +0100
+++ b/tools/m4/python_devel.m4  Tue Apr 24 18:42:24 2012 +0100
@@ -1,23 +1,31 @@
 AC_DEFUN([AX_CHECK_PYTHON_DEVEL], [
+ac_previous_cppflags=$CPPFLAGS
+ac_previous_ldflags=$LDFLAGS
 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_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])],)

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

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