[Libvir] PATCH 1/5: Use pkg-config for libxml

Daniel Veillard veillard at redhat.com
Tue Sep 18 07:32:35 UTC 2007


On Tue, Sep 18, 2007 at 02:29:50AM +0100, Daniel P. Berrange wrote:
> Currently if you have a configured working directory and you touch some
> file that would cause autoconf to re-run configure it'll crash & burn with
> an error like
> 
> 
> $ make
> cd . && /bin/sh /home/berrange/src/xen/libvirt/missing --run aclocal-1.9 -I m4
> cd . && /bin/sh /home/berrange/src/xen/libvirt/missing --run automake-1.9 --gnu 
> cd . && /bin/sh /home/berrange/src/xen/libvirt/missing --run autoconf
> configure.in:268: error: possibly undefined macro: PKG_CONFIG_ENABLED
>       If this token and others are legitimate, please use m4_pattern_allow.
>       See the Autoconf documentation.
> 
> 
> This is due to this bit of configure where we reference an env variable
> which doesn't exist:
> 
> 
> if test "z$with_libxml" = "zno" ; then 
>     AC_MSG_CHECKING(for libxml2 libraries >= $LIBXML_MIN_VERSION) 
>     AC_MSG_ERROR(libxml2 >= $LIBXML_MIN_VERSION is required for $XMLSEC_PACKAGE)
> elif test "z$with_libxml" = "z" -a "z$PKG_CONFIG_ENABLED" = "zyes" ; then
>     PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= $LIBXML_MIN_VERSION,
>         [LIBXML_FOUND=yes],
>         [LIBXML_FOUND=no])
> fi
> 
> 
> The whole test for libxml is overly complex and can be reduced to a single
> call to PKG_CHECK_MODULES. There is no need to have special configure 
> script --with_libxml args to override the location, since pkg-config already
> gives you two ways todo that - either use PKG_CONFIG_PATH to point to your
> alternative install, or use  LIBXML_CFLAGS and LIBXML_LIBS env vars to set
> the explicitly flags.

  IMHO this severely reduces the set of OSes where configure will wok as a
result. Not everything ships with all libraries registered with pkg-config.
I would like to hear what the non-Linux users think. xml2-config is part of
libxml2 distribution, pkg-config is not, so the pkg-config check will work
only if the OS integration decided to make it work. To me the goal of configure
is to get maximum portability (otherwise honnestly, why bother with the 
auto*, right ?)
  In the case of libvirt though we may conclude that we target only OSes
where pkg-config is set up, could someone clarify to me the status of
pkg-config (at least for libxml2) on:
     - Solaris (I guess yes)
     - OS-X
     - cygwin
     
The alternative is to fix the configure.in script, maybe that's the right
approach, maybe it's not worth it. I can't tell but I would like to make
sure we don't break the detection on at least the 3 mentionned platforms.
And I know it does work now, since xmlsec is ported to those.

Daniel

-- 
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard      | virtualization library  http://libvirt.org/
veillard at redhat.com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine  http://rpmfind.net/




More information about the libvir-list mailing list