* [PATCH v2] autoconf: fix python-dev detection on old python versions
@ 2012-03-30 7:35 Roger Pau Monne
2012-03-30 7:54 ` Zhang, Yang Z
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Roger Pau Monne @ 2012-03-30 7:35 UTC (permalink / raw)
To: xen-devel
Cc: Roger Pau Monne, Zhang, Yang Z, KUWAMURA Shin'ya,
Ian Campbell
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.
Again, this has only been tested on OS X Python 2.7.
Changes since v1:
* Added Python LDFLAGS to library test.
Signed-off-by: Roger Pau Monne <roger.pau@entel.upc.edu>
Cc: Zhang, Yang Z <yang.z.zhang@intel.com>
Cc: KUWAMURA Shin'ya <kuwa@jp.fujitsu.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
---
tools/m4/python_devel.m4 | 36 +++++++++++++++++-------------------
1 files changed, 17 insertions(+), 19 deletions(-)
diff --git a/tools/m4/python_devel.m4 b/tools/m4/python_devel.m4
index 3bcca7b..dada92a 100644
--- a/tools/m4/python_devel.m4
+++ b/tools/m4/python_devel.m4
@@ -1,27 +1,25 @@
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")'`"
+LDFLAGS="$LDFLAGS `$PYTHON -c 'import distutils.sysconfig; \
+ print distutils.sysconfig.get_config_var("LDFLAGS")'`"
+
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)
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH v2] autoconf: fix python-dev detection on old python versions
2012-03-30 7:35 [PATCH v2] autoconf: fix python-dev detection on old python versions Roger Pau Monne
@ 2012-03-30 7:54 ` Zhang, Yang Z
2012-03-30 9:47 ` Roger Pau Monné
2012-03-30 8:00 ` Ian Campbell
2012-04-02 5:02 ` KUWAMURA Shin'ya
2 siblings, 1 reply; 8+ messages in thread
From: Zhang, Yang Z @ 2012-03-30 7:54 UTC (permalink / raw)
To: Roger Pau Monne, xen-devel@lists.xen.org
Cc: KUWAMURA Shin'ya, Ian Campbell
This patch isn't working, still get the same error.
best regards
yang
> -----Original Message-----
> From: Roger Pau Monné [mailto:royger@gmail.com] On Behalf Of Roger Pau
> Monne
> Sent: Friday, March 30, 2012 3:36 PM
> To: xen-devel@lists.xen.org
> Cc: Roger Pau Monne; Zhang, Yang Z; KUWAMURA Shin'ya; Ian Campbell
> Subject: [PATCH v2] 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.
>
> Please run ./autogen.sh after applying the patch.
>
> Again, this has only been tested on OS X Python 2.7.
>
> Changes since v1:
>
> * Added Python LDFLAGS to library test.
>
> Signed-off-by: Roger Pau Monne <roger.pau@entel.upc.edu>
> Cc: Zhang, Yang Z <yang.z.zhang@intel.com>
> Cc: KUWAMURA Shin'ya <kuwa@jp.fujitsu.com>
> Cc: Ian Campbell <ian.campbell@citrix.com>
> ---
> tools/m4/python_devel.m4 | 36 +++++++++++++++++-------------------
> 1 files changed, 17 insertions(+), 19 deletions(-)
>
> diff --git a/tools/m4/python_devel.m4 b/tools/m4/python_devel.m4
> index 3bcca7b..dada92a 100644
> --- a/tools/m4/python_devel.m4
> +++ b/tools/m4/python_devel.m4
> @@ -1,27 +1,25 @@
> 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")'`"
> +LDFLAGS="$LDFLAGS `$PYTHON -c 'import distutils.sysconfig; \
> + print distutils.sysconfig.get_config_var("LDFLAGS")'`"
> +
> 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)
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2] autoconf: fix python-dev detection on old python versions
2012-03-30 7:35 [PATCH v2] autoconf: fix python-dev detection on old python versions Roger Pau Monne
2012-03-30 7:54 ` Zhang, Yang Z
@ 2012-03-30 8:00 ` Ian Campbell
2012-03-30 8:26 ` Roger Pau Monné
2012-04-02 5:02 ` KUWAMURA Shin'ya
2 siblings, 1 reply; 8+ messages in thread
From: Ian Campbell @ 2012-03-30 8:00 UTC (permalink / raw)
To: Roger Pau Monne
Cc: Zhang, Yang Z, KUWAMURA Shin'ya, xen-devel@lists.xen.org
On Fri, 2012-03-30 at 08:35 +0100, Roger Pau Monne wrote:
> 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.
>
> Again, this has only been tested on OS X Python 2.7.
>
> Changes since v1:
>
> * Added Python LDFLAGS to library test.
>
> Signed-off-by: Roger Pau Monne <roger.pau@entel.upc.edu>
> Cc: Zhang, Yang Z <yang.z.zhang@intel.com>
> Cc: KUWAMURA Shin'ya <kuwa@jp.fujitsu.com>
> Cc: Ian Campbell <ian.campbell@citrix.com>
> ---
> tools/m4/python_devel.m4 | 36 +++++++++++++++++-------------------
> 1 files changed, 17 insertions(+), 19 deletions(-)
>
> diff --git a/tools/m4/python_devel.m4 b/tools/m4/python_devel.m4
> index 3bcca7b..dada92a 100644
> --- a/tools/m4/python_devel.m4
> +++ b/tools/m4/python_devel.m4
> @@ -1,27 +1,25 @@
> 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")'`"
This mixes up CPPFLAGS and CFLAGS in what looks like a very strange way
to me, is it right?
[...]
> +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")'`"
Elsewhere in the Xen build system we would call these LDLIBS_<blah>
and/or SHLIBS_<blah> (see tools/Rules.mk for examples). I think in the
case of libpython, which is not built in tree you would only want to use
SHLIBS_PYTHON.
On a similar note do we really want to add the python stuff to the
global CFLAGS and LDFLABS etc? Wouldn't it be better to have
CFLAGS_PYTHON etc and to use them explicitly in tools/python/Makefile
rather than using them for all compilations?
Although that might require other build system changes which could be
done later in the interests of fixing getting a fix for people using
python 2.3/2.4 into the tree.
> +LDFLAGS="$LDFLAGS `$PYTHON -c 'import distutils.sysconfig; \
> + print distutils.sysconfig.get_config_var("LDFLAGS")'`"
> +
> 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
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2] autoconf: fix python-dev detection on old python versions
2012-03-30 8:00 ` Ian Campbell
@ 2012-03-30 8:26 ` Roger Pau Monné
2012-03-30 8:28 ` Ian Campbell
0 siblings, 1 reply; 8+ messages in thread
From: Roger Pau Monné @ 2012-03-30 8:26 UTC (permalink / raw)
To: Ian Campbell; +Cc: Zhang, Yang Z, KUWAMURA Shin'ya, xen-devel@lists.xen.org
2012/3/30 Ian Campbell <Ian.Campbell@citrix.com>:
> On Fri, 2012-03-30 at 08:35 +0100, Roger Pau Monne wrote:
>> 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.
>>
>> Again, this has only been tested on OS X Python 2.7.
>>
>> Changes since v1:
>>
>> * Added Python LDFLAGS to library test.
>>
>> Signed-off-by: Roger Pau Monne <roger.pau@entel.upc.edu>
>> Cc: Zhang, Yang Z <yang.z.zhang@intel.com>
>> Cc: KUWAMURA Shin'ya <kuwa@jp.fujitsu.com>
>> Cc: Ian Campbell <ian.campbell@citrix.com>
>> ---
>> tools/m4/python_devel.m4 | 36 +++++++++++++++++-------------------
>> 1 files changed, 17 insertions(+), 19 deletions(-)
>>
>> diff --git a/tools/m4/python_devel.m4 b/tools/m4/python_devel.m4
>> index 3bcca7b..dada92a 100644
>> --- a/tools/m4/python_devel.m4
>> +++ b/tools/m4/python_devel.m4
>> @@ -1,27 +1,25 @@
>> 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")'`"
>
> This mixes up CPPFLAGS and CFLAGS in what looks like a very strange way
> to me, is it right?
Yes, this is kind of a work around, since the header preprocessor
check ignores CFLAGS and only uses CPPFLAGS, so if CFLAGS are used,
the preprocessor check fails, although the header is there.
>
> [...]
>
>> +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")'`"
>
> Elsewhere in the Xen build system we would call these LDLIBS_<blah>
> and/or SHLIBS_<blah> (see tools/Rules.mk for examples). I think in the
> case of libpython, which is not built in tree you would only want to use
> SHLIBS_PYTHON.
>
> On a similar note do we really want to add the python stuff to the
> global CFLAGS and LDFLABS etc? Wouldn't it be better to have
> CFLAGS_PYTHON etc and to use them explicitly in tools/python/Makefile
> rather than using them for all compilations?
This is only added to CFLAGS/LDFLAGS temporary, to perform the checks,
and on the build system they are automatically added by setup.py.
> Although that might require other build system changes which could be
> done later in the interests of fixing getting a fix for people using
> python 2.3/2.4 into the tree.
>
>> +LDFLAGS="$LDFLAGS `$PYTHON -c 'import distutils.sysconfig; \
>> + print distutils.sysconfig.get_config_var("LDFLAGS")'`"
>> +
>> 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
>
>
I will have to check again, maybe python-config script has the clue to
what parameters have to be passed to link against libpython. I'm in a
hurry, so I don't think I will have time to look into this until the
following week, sorry (I'm not leaving it apart).
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2] autoconf: fix python-dev detection on old python versions
2012-03-30 8:26 ` Roger Pau Monné
@ 2012-03-30 8:28 ` Ian Campbell
2012-03-30 8:31 ` Roger Pau Monné
0 siblings, 1 reply; 8+ messages in thread
From: Ian Campbell @ 2012-03-30 8:28 UTC (permalink / raw)
To: Roger Pau Monné
Cc: Zhang, Yang Z, KUWAMURA Shin'ya, xen-devel@lists.xen.org
On Fri, 2012-03-30 at 09:26 +0100, Roger Pau Monné wrote:
> 2012/3/30 Ian Campbell <Ian.Campbell@citrix.com>:
> > On Fri, 2012-03-30 at 08:35 +0100, Roger Pau Monne wrote:
> >> 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.
> >>
> >> Again, this has only been tested on OS X Python 2.7.
> >>
> >> Changes since v1:
> >>
> >> * Added Python LDFLAGS to library test.
> >>
> >> Signed-off-by: Roger Pau Monne <roger.pau@entel.upc.edu>
> >> Cc: Zhang, Yang Z <yang.z.zhang@intel.com>
> >> Cc: KUWAMURA Shin'ya <kuwa@jp.fujitsu.com>
> >> Cc: Ian Campbell <ian.campbell@citrix.com>
> >> ---
> >> tools/m4/python_devel.m4 | 36 +++++++++++++++++-------------------
> >> 1 files changed, 17 insertions(+), 19 deletions(-)
> >>
> >> diff --git a/tools/m4/python_devel.m4 b/tools/m4/python_devel.m4
> >> index 3bcca7b..dada92a 100644
> >> --- a/tools/m4/python_devel.m4
> >> +++ b/tools/m4/python_devel.m4
> >> @@ -1,27 +1,25 @@
> >> 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")'`"
> >
> > This mixes up CPPFLAGS and CFLAGS in what looks like a very strange way
> > to me, is it right?
>
> Yes, this is kind of a work around, since the header preprocessor
> check ignores CFLAGS and only uses CPPFLAGS, so if CFLAGS are used,
> the preprocessor check fails, although the header is there.
Which check is this?
> > [...]
> >
> >> +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")'`"
> >
> > Elsewhere in the Xen build system we would call these LDLIBS_<blah>
> > and/or SHLIBS_<blah> (see tools/Rules.mk for examples). I think in the
> > case of libpython, which is not built in tree you would only want to use
> > SHLIBS_PYTHON.
> >
> > On a similar note do we really want to add the python stuff to the
> > global CFLAGS and LDFLABS etc? Wouldn't it be better to have
> > CFLAGS_PYTHON etc and to use them explicitly in tools/python/Makefile
> > rather than using them for all compilations?
>
> This is only added to CFLAGS/LDFLAGS temporary, to perform the checks,
> and on the build system they are automatically added by setup.py.
AH, great then!
>
> > Although that might require other build system changes which could be
> > done later in the interests of fixing getting a fix for people using
> > python 2.3/2.4 into the tree.
> >
> >> +LDFLAGS="$LDFLAGS `$PYTHON -c 'import distutils.sysconfig; \
> >> + print distutils.sysconfig.get_config_var("LDFLAGS")'`"
> >> +
> >> 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
> >
> >
>
> I will have to check again, maybe python-config script has the clue to
> what parameters have to be passed to link against libpython. I'm in a
> hurry, so I don't think I will have time to look into this until the
> following week, sorry (I'm not leaving it apart).
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2] autoconf: fix python-dev detection on old python versions
2012-03-30 8:28 ` Ian Campbell
@ 2012-03-30 8:31 ` Roger Pau Monné
0 siblings, 0 replies; 8+ messages in thread
From: Roger Pau Monné @ 2012-03-30 8:31 UTC (permalink / raw)
To: Ian Campbell; +Cc: Zhang, Yang Z, KUWAMURA Shin'ya, xen-devel@lists.xen.org
2012/3/30 Ian Campbell <Ian.Campbell@citrix.com>:
> On Fri, 2012-03-30 at 09:26 +0100, Roger Pau Monné wrote:
>> 2012/3/30 Ian Campbell <Ian.Campbell@citrix.com>:
>> > On Fri, 2012-03-30 at 08:35 +0100, Roger Pau Monne wrote:
>> >> 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.
>> >>
>> >> Again, this has only been tested on OS X Python 2.7.
>> >>
>> >> Changes since v1:
>> >>
>> >> * Added Python LDFLAGS to library test.
>> >>
>> >> Signed-off-by: Roger Pau Monne <roger.pau@entel.upc.edu>
>> >> Cc: Zhang, Yang Z <yang.z.zhang@intel.com>
>> >> Cc: KUWAMURA Shin'ya <kuwa@jp.fujitsu.com>
>> >> Cc: Ian Campbell <ian.campbell@citrix.com>
>> >> ---
>> >> tools/m4/python_devel.m4 | 36 +++++++++++++++++-------------------
>> >> 1 files changed, 17 insertions(+), 19 deletions(-)
>> >>
>> >> diff --git a/tools/m4/python_devel.m4 b/tools/m4/python_devel.m4
>> >> index 3bcca7b..dada92a 100644
>> >> --- a/tools/m4/python_devel.m4
>> >> +++ b/tools/m4/python_devel.m4
>> >> @@ -1,27 +1,25 @@
>> >> 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")'`"
>> >
>> > This mixes up CPPFLAGS and CFLAGS in what looks like a very strange way
>> > to me, is it right?
>>
>> Yes, this is kind of a work around, since the header preprocessor
>> check ignores CFLAGS and only uses CPPFLAGS, so if CFLAGS are used,
>> the preprocessor check fails, although the header is there.
>
> Which check is this?
AC_CHECK_HEADER, it checks header usability (by trying to include it
in a sample program) and presence, by checking the paths. The
usability check fails if the header path is not added to CPPFLAGS,
because CFLAGS are ignored by the preprocessor on this tests (which is
really strange strange...)
>
>> > [...]
>> >
>> >> +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")'`"
>> >
>> > Elsewhere in the Xen build system we would call these LDLIBS_<blah>
>> > and/or SHLIBS_<blah> (see tools/Rules.mk for examples). I think in the
>> > case of libpython, which is not built in tree you would only want to use
>> > SHLIBS_PYTHON.
>> >
>> > On a similar note do we really want to add the python stuff to the
>> > global CFLAGS and LDFLABS etc? Wouldn't it be better to have
>> > CFLAGS_PYTHON etc and to use them explicitly in tools/python/Makefile
>> > rather than using them for all compilations?
>>
>> This is only added to CFLAGS/LDFLAGS temporary, to perform the checks,
>> and on the build system they are automatically added by setup.py.
>
> AH, great then!
>
>>
>> > Although that might require other build system changes which could be
>> > done later in the interests of fixing getting a fix for people using
>> > python 2.3/2.4 into the tree.
>> >
>> >> +LDFLAGS="$LDFLAGS `$PYTHON -c 'import distutils.sysconfig; \
>> >> + print distutils.sysconfig.get_config_var("LDFLAGS")'`"
>> >> +
>> >> 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
>> >
>> >
>>
>> I will have to check again, maybe python-config script has the clue to
>> what parameters have to be passed to link against libpython. I'm in a
>> hurry, so I don't think I will have time to look into this until the
>> following week, sorry (I'm not leaving it apart).
>
>
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2] autoconf: fix python-dev detection on old python versions
2012-03-30 7:54 ` Zhang, Yang Z
@ 2012-03-30 9:47 ` Roger Pau Monné
0 siblings, 0 replies; 8+ messages in thread
From: Roger Pau Monné @ 2012-03-30 9:47 UTC (permalink / raw)
To: Zhang, Yang Z; +Cc: KUWAMURA Shin'ya, Ian Campbell, xen-devel@lists.xen.org
2012/3/30 Zhang, Yang Z <yang.z.zhang@intel.com>:
> This patch isn't working, still get the same error.
>
Could you please execute this:
python -c 'import distutils.sysconfig; print
distutils.sysconfig.get_config_vars()'
and send me the output?
Thanks, Roger.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2] autoconf: fix python-dev detection on old python versions
2012-03-30 7:35 [PATCH v2] autoconf: fix python-dev detection on old python versions Roger Pau Monne
2012-03-30 7:54 ` Zhang, Yang Z
2012-03-30 8:00 ` Ian Campbell
@ 2012-04-02 5:02 ` KUWAMURA Shin'ya
2 siblings, 0 replies; 8+ messages in thread
From: KUWAMURA Shin'ya @ 2012-04-02 5:02 UTC (permalink / raw)
To: roger.pau; +Cc: yang.z.zhang, ian.campbell, xen-devel
Hi,
>>>>> On Fri, 30 Mar 2012 09:35:30 +0200
>>>>> roger.pau@entel.upc.edu(Roger Pau Monne) said:
>
> +LDFLAGS="$LDFLAGS `$PYTHON -c 'import distutils.sysconfig; \
> + print distutils.sysconfig.get_config_var("LIBS")'`"
"SYSLIBS" is also needed.
e.g.:
$ python -c 'import distutils.sysconfig; print distutils.sysconfig.get_config_var("SYSLIBS")'
-lm
Best regards,
--
KUWAMURA Shin'ya
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2012-04-02 5:02 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-30 7:35 [PATCH v2] autoconf: fix python-dev detection on old python versions Roger Pau Monne
2012-03-30 7:54 ` Zhang, Yang Z
2012-03-30 9:47 ` Roger Pau Monné
2012-03-30 8:00 ` Ian Campbell
2012-03-30 8:26 ` Roger Pau Monné
2012-03-30 8:28 ` Ian Campbell
2012-03-30 8:31 ` Roger Pau Monné
2012-04-02 5:02 ` KUWAMURA Shin'ya
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).