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

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



2012/3/29 Roger Pau Monne <roger.pau@xxxxxxxxxxxxx>:
> 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.
>

I've forgot to say, but this has only been tested on my Mac, which has
Python 2.7, because I'm not able to test it anywhere else right now. I
hope it works with older Python versions, so we can get rid of
python-config.

> 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®.