Roger Pau Monne
2012-Mar-30 07:35 UTC
[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)
Zhang, Yang Z
2012-Mar-30 07:54 UTC
Re: [PATCH v2] autoconf: fix python-dev detection on old python versions
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)
Ian Campbell
2012-Mar-30 08:00 UTC
Re: [PATCH v2] autoconf: fix python-dev detection on old python versions
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
Roger Pau Monné
2012-Mar-30 08:26 UTC
Re: [PATCH v2] autoconf: fix python-dev detection on old python versions
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
Ian Campbell
2012-Mar-30 08:28 UTC
Re: [PATCH v2] autoconf: fix python-dev detection on old python versions
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
Roger Pau Monné
2012-Mar-30 08:31 UTC
Re: [PATCH v2] autoconf: fix python-dev detection on old python versions
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
Roger Pau Monné
2012-Mar-30 09:47 UTC
Re: [PATCH v2] autoconf: fix python-dev detection on old python versions
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.
KUWAMURA Shin''ya
2012-Apr-02 05:02 UTC
Re: [PATCH v2] autoconf: fix python-dev detection on old python versions
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