[Libguestfs] [PATCH 7/9] python: fix detection of libpython features

Pino Toscano ptoscano at redhat.com
Tue Nov 4 16:58:32 UTC 2014


On Tuesday 04 November 2014 16:11:39 Richard W.M. Jones wrote:
> On Tue, Nov 04, 2014 at 04:35:30PM +0100, Pino Toscano wrote:
> > Instead of querying distutils.sysconfig for the library name, just
> > use the $PYTHON_LIBS returned by pkg-config.  This makes sure the
> > tests can link even with a libpython in a non-standard library
> > directory. ---
> > 
> >  configure.ac | 10 ++--------
> >  1 file changed, 2 insertions(+), 8 deletions(-)
> > 
> > diff --git a/configure.ac b/configure.ac
> > index 87e066c..1bf291c 100644
> > --- a/configure.ac
> > +++ b/configure.ac
> > @@ -1216,20 +1216,14 @@ AS_IF([test "x$enable_python" != "xno"],[
> > 
> >          AC_MSG_RESULT([$PYTHON_EXT_SUFFIX])
> >          
> >          dnl Look for some optional symbols in libpython.
> > 
> > -        old_LIBS="$LIBS"
> > -
> > -        PYTHON_BLDLIBRARY=`$PYTHON -c "import distutils.sysconfig;
> > \
> > -                                       print
> > (distutils.sysconfig.get_config_var('BLDLIBRARY'))"`> 
> >          AC_CHECK_LIB([c],[PyCapsule_New],
> >          
> >                       [AC_DEFINE([HAVE_PYCAPSULE_NEW],1,
> >                       
> >                                  [Found PyCapsule_New in
> >                                  libpython.])],
> > 
> > -                     [],[$PYTHON_BLDLIBRARY])
> > +                     [],[$PYTHON_LIBS])
> > 
> >          AC_CHECK_LIB([c],[PyString_AsString],
> >          
> >                       [AC_DEFINE([HAVE_PYSTRING_ASSTRING],1,
> >                       
> >                                  [Found PyString_AsString in
> >                                  libpython.])],
> > 
> > -                     [],[$PYTHON_BLDLIBRARY])
> > -
> > -        LIBS="$old_LIBS"
> > +                     [],[$PYTHON_LIBS])
> > 
> >      fi
> >      
> >      AC_SUBST(PYTHON_PREFIX)
> 
> Will this break hillu's change (commit ad5b5f96da53)?

I found that commit, yes (I was wondering why AC_CHECK_LIB with "c" as 
primary library).

My commit should not (at least, it gave no changes on Fedora) break 
things; it just uses the more reliable variable instead of a config var 
which (at least to me) seems to be used only internally in python.

I can ask about it, anyway.

-- 
Pino Toscano




More information about the Libguestfs mailing list