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.

Dan.
-- 
|=- Red Hat, Engineering, Emerging Technologies, Boston.  +1 978 392 2496 -=|
|=-           Perl modules: http://search.cpan.org/~danberr/              -=|
|=-               Projects: http://freshmeat.net/~danielpb/               -=|
|=-  GnuPG: 7D3B9505   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505  -=| 
diff -r 8da97fbcb094 configure.in
--- a/configure.in      Thu Sep 13 21:06:55 2007 +0000
+++ b/configure.in      Mon Sep 17 03:51:05 2007 -0400
@@ -28,6 +28,8 @@ AC_SUBST(LIBVIRT_VERSION_INFO)
 AC_SUBST(LIBVIRT_VERSION_INFO)
 AC_SUBST(LIBVIRT_VERSION_NUMBER)
 AC_SUBST(LIBVIRT_VERSION_EXTRA)
+
+LIBXML_REQUIRED="2.5.0"
 
 VERSION=${LIBVIRT_VERSION}
 
@@ -253,57 +255,25 @@ AC_CHECK_HEADERS(linux/param.h linux/soc
 AC_CHECK_HEADERS(linux/param.h linux/sockios.h linux/if_bridge.h 
linux/if_tun.h,,
                  AC_MSG_ERROR([You must install kernel-headers in order to 
compile libvirt]))
 
+
+PKG_PROG_PKG_CONFIG()
+
 dnl ==========================================================================
-dnl find libxml2 library, borrowed from xmlsec
-dnl ==========================================================================
-LIBXML_MIN_VERSION="2.5.0"
-LIBXML_CONFIG="xml2-config"
-LIBXML_CFLAGS=""
-LIBXML_LIBS=""
-LIBXML_FOUND="no"
-AC_ARG_WITH(libxml, [  --with-libxml=[PFX]       libxml2 location])
-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
-AC_MSG_CHECKING(libxml2 $with_libxml  $LIBXML_FOUND  )
-if test "z$LIBXML_FOUND" = "zno" ; then
-    AC_MSG_CHECKING(for libxml2 libraries >= $LIBXML_MIN_VERSION) 
-    if test "z$with_libxml" != "z" ; then 
-       LIBXML_CONFIG=$with_libxml/bin/$LIBXML_CONFIG
-    fi
-    AC_MSG_CHECKING(libxml2 $with_libxml  $LIBXML_CONFIG  )
-    if ! $LIBXML_CONFIG --version > /dev/null 2>&1 ; then
-       AC_MSG_ERROR(Could not find libxml2 anywhere (see config.log for 
details).)
-    fi
-    vers=`$LIBXML_CONFIG --version | awk -F. '{ printf "%d", ($1 * 1000 + $2) 
* 1000 + $3;}'`
-    minvers=`echo $LIBXML_MIN_VERSION | awk -F. '{ printf "%d", ($1 * 1000 + 
$2) * 1000 + $3;}'`
-    if test "$vers" -ge "$minvers" ; then
-        LIBXML_LIBS="`$LIBXML_CONFIG --libs`"
-        LIBXML_CFLAGS="`$LIBXML_CONFIG --cflags`"
-       LIBXML_FOUND="yes"
-        AC_MSG_RESULT(yes ('$LIBXML_VERSION'))
-    else
-        AC_MSG_ERROR(You need at least libxml2 $LIBXML_MIN_VERSION for this 
version of $XMLSEC_PACKAGE)
-    fi
-fi
-
+
+PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= $LIBXML_REQUIRED)
 AC_SUBST(LIBXML_CFLAGS)
 AC_SUBST(LIBXML_LIBS)
-AC_SUBST(LIBXML_CONFIG)
-AC_SUBST(LIBXML_MIN_VERSION)
 
 dnl xmlURI structure has query_raw?
 old_cflags="$CFLAGS"
+old_ldflags="$LDFLAGS"
 CFLAGS="$CFLAGS $LIBXML_CFLAGS"
+LDFLAGS="$LDFLAGS $LIBXML_LIBS"
 AC_CHECK_MEMBER(struct _xmlURI.query_raw,
                [AC_DEFINE(HAVE_XMLURI_QUERY_RAW, [], [Have query_raw field in 
libxml2 xmlURI structure])],,
                [#include <libxml/uri.h>])
 CFLAGS="$old_cflags"
+LDFLAGS="$old_ldflags"
 
 dnl GnuTLS library
 AC_CHECK_HEADER([gnutls/gnutls.h],
--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to