aboutsummaryrefslogtreecommitdiffstats
path: root/tools/configure
diff options
context:
space:
mode:
authorRoger Pau Monne <roger.pau@entel.upc.edu>2012-04-03 14:28:45 +0100
committerRoger Pau Monne <roger.pau@entel.upc.edu>2012-04-03 14:28:45 +0100
commit474a0e59d821bfb49b64c3d722a000bd9b5b7599 (patch)
tree69ec47ff93293782791aedafbf223ed174950e3a /tools/configure
parent570c311ca2c7a1131570cdfc77e977bc7a9bf4c0 (diff)
downloadxen-474a0e59d821bfb49b64c3d722a000bd9b5b7599.tar.gz
xen-474a0e59d821bfb49b64c3d722a000bd9b5b7599.tar.bz2
xen-474a0e59d821bfb49b64c3d722a000bd9b5b7599.zip
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. Signed-off-by: Roger Pau Monne <roger.pau@entel.upc.edu> Cc: Zhang, Yang Z <yang.z.zhang@intel.com> Tested-by: KUWAMURA Shin'ya <kuwa@jp.fujitsu.com> Cc: Ian Campbell <ian.campbell@citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
Diffstat (limited to 'tools/configure')
-rwxr-xr-xtools/configure49
1 files changed, 24 insertions, 25 deletions
diff --git a/tools/configure b/tools/configure
index c686130322..8649ecfe73 100755
--- a/tools/configure
+++ b/tools/configure
@@ -6143,27 +6143,26 @@ else
$as_echo "yes" >&6; }
fi
+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
- ;;
- *)
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Strange ldflag found in $PYTHON-config output: $flag" >&5
-$as_echo "$as_me: WARNING: Strange ldflag found in $PYTHON-config output: $flag" >&2;}
- ;;
- esac
-done
+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_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 :
@@ -6172,14 +6171,14 @@ else
fi
-as_ac_Lib=`$as_echo "ac_cv_lib_$python_lib''_PyArg_ParseTuple" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for PyArg_ParseTuple in -l$python_lib" >&5
-$as_echo_n "checking for PyArg_ParseTuple in -l$python_lib... " >&6; }
+as_ac_Lib=`$as_echo "ac_cv_lib_python$ac_python_version''_PyArg_ParseTuple" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for PyArg_ParseTuple in -lpython$ac_python_version" >&5
+$as_echo_n "checking for PyArg_ParseTuple in -lpython$ac_python_version... " >&6; }
if eval "test \"\${$as_ac_Lib+set}\"" = set; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
-LIBS="-l$python_lib $LIBS"
+LIBS="-lpython$ac_python_version $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
@@ -6212,10 +6211,10 @@ eval ac_res=\$$as_ac_Lib
$as_echo "$ac_res" >&6; }
if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_LIB$python_lib" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_LIBpython$ac_python_version" | $as_tr_cpp` 1
_ACEOF
- LIBS="-l$python_lib $LIBS"
+ LIBS="-lpython$ac_python_version $LIBS"
else
as_fn_error $? "Unable to find a suitable python development library" "$LINENO" 5