[Libguestfs] [PATCH] Use pkg-config for Python

Richard W.M. Jones rjones at redhat.com
Mon Jun 17 07:50:47 UTC 2013


On Sun, Jun 16, 2013 at 02:55:29PM +0200, Olaf Hering wrote:
> On Thu, May 16, Hilko Bengen wrote:
> 
> >  	AC_MSG_RESULT([$PYTHON_VERSION])
> > -
> > -        AC_MSG_CHECKING([for Python include path])
> > -        if test -z "$PYTHON_INCLUDEDIR"; then
> > -            python_path=`$PYTHON -c "import distutils.sysconfig; \
> > -                                     print (distutils.sysconfig.get_python_inc ());"`
> > -            PYTHON_INCLUDEDIR=$python_path
> > -        fi
> > -        AC_MSG_RESULT([$PYTHON_INCLUDEDIR])
> > +        # Debian: python-2.7.pc, python-3.2.pc
> > +        PKG_CHECK_MODULES([PYTHON], [python-"$PYTHON_VERSION"],[
> > +            AC_SUBST([PYTHON_CFLAGS])
> > +            AC_SUBST([PYTHON_LIBS])
> > +            AC_SUBST([PYTHON_VERSION])
> > +            AC_DEFINE([HAVE_PYTHON],[1],[Python library found at compile time])
> > +        ],[
> > +            PKG_CHECK_MODULES([PYTHON], [python],[
> > +                AC_SUBST([PYTHON_CFLAGS])
> > +                AC_SUBST([PYTHON_LIBS])
> > +                AC_SUBST([PYTHON_VERSION])
> > +                AC_DEFINE([HAVE_PYTHON],[1],[Python library found at compile time])
> > +            ],[
> > +                AC_MSG_WARN([python $PYTHON_VERSION not found])
> > +            ])
> > +        ])
> > +        AC_MSG_CHECKING([Python prefix])
> > +        PYTHON_PREFIX=`$PYTHON -c "import sys; print (sys.prefix)"`
> > +        AC_MSG_RESULT([$PYTHON_PREFIX])
> >  
> >          AC_ARG_WITH([python-installdir],
> >                      [AS_HELP_STRING([--with-python-installdir],
> > @@ -1171,11 +1177,10 @@ AS_IF([test "x$enable_python" != "xno"],[
> >  
> >      AC_SUBST(PYTHON_PREFIX)
> >      AC_SUBST(PYTHON_VERSION)
> > -    AC_SUBST(PYTHON_INCLUDEDIR)
> >      AC_SUBST(PYTHON_INSTALLDIR)
> >  ])
> >  AM_CONDITIONAL([HAVE_PYTHON],
> > -    [test "x$PYTHON" != "xno" && test "x$PYTHON_INCLUDEDIR" != "x" && test "x$PYTHON_INSTALLDIR" != "x"])
> > +    [test "x$PYTHON" != "xno" && test "x$PYTHON_LIBS" != "x" ])
> 
> If pkg-config check fails, PYTHON_LIBS remains empty (at least for me)
> and as a result python gets disabled.
> Without this change, PYTHON_INCLUDEDIR was retreived directly from
> python itself.
> 
> For me current 1.20 branch fails to build python in SLE11.

Does SuSE's python have a pkg-config file?

RHEL 5 didn't have one, but it was added in RHEL 6.  So for the branch
of libguestfs we use on RHEL 5 ('oldlinux'[1]) I have reverted this
patch[2].

Rich.

[1] https://github.com/libguestfs/libguestfs/tree/oldlinux
[2] https://github.com/libguestfs/libguestfs/commit/5f7acbb95e055efa840d2108e207e3ef8106761a

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-top is 'top' for virtual machines.  Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://people.redhat.com/~rjones/virt-top




More information about the Libguestfs mailing list