On Tue, Jan 22, 2008 at 04:00:49PM +0000, Daniel P. Berrange wrote: > This patch removes the use of PKG_CHECK_EXISTS which is only available in > new versions of pkg-config. Instead we use the 3rd and 4th args of the > PKG_CHECK_MODULES macro to control the if-found/not-found behaviour. This > allows us to auto-disable features if they're missing, rather than aborting > the configure run. This patch also updates the SASL tests to support the > value 'check' for auto-enable/disable like the rest of the modules. > > With this applied I can successfully run the following on RHEL-4 hosts > with the default RPMs installed > > ./autogen.sh --without-xen > make > make dist And now with a patch... Dan. Index: configure.in =================================================================== RCS file: /data/cvs/libvirt/configure.in,v retrieving revision 1.121 diff -u -r1.121 configure.in --- configure.in 19 Jan 2008 18:36:01 -0000 1.121 +++ configure.in 22 Jan 2008 15:55:44 -0000 @@ -218,12 +218,6 @@ LDFLAGS="$LDFLAGS -L$withval/install/usr/lib" fi -dnl -dnl To be able to make dist on a non-xenified host -dnl -AC_ARG_WITH(depends, - [ --with-depends check for dependancies (on)]) - LIBVIRT_FEATURES= WITH_XEN=0 @@ -242,9 +236,6 @@ LIBVIRT_FEATURES="$LIBVIRT_FEATURES -DWITH_REMOTE" fi -if test "$with_depends" != "no" -then - if test "$with_xen" = "yes" ; then dnl search for the Xen store library AC_SEARCH_LIBS(xs_read, [xenstore], @@ -286,7 +277,7 @@ fi dnl Need to test if pkg-config exists -PKG_PROG_PKG_CONFIG +dnl PKG_PROG_PKG_CONFIG dnl ========================================================================== dnl find libxml2 library, borrowed from xmlsec @@ -301,10 +292,7 @@ AC_MSG_CHECKING(for libxml2 libraries >= $LIBXML_REQUIRED) AC_MSG_ERROR(libxml2 >= $LIBXML_REQUIRED is required for libvirt) elif test "z$with_libxml" = "z" -a "x$PKG_CONFIG" != "x" ; then - PKG_CHECK_EXISTS(libxml-2.0,[LIBXML_FOUND=yes]) - if test "$LIBXML_FOUND" != "no" ; then - PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= $LIBXML_REQUIRED) - fi + PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= $LIBXML_REQUIRED, [LIBXML_FOUND=yes], [LIBXML_FOUND=no]) fi if test "z$LIBXML_FOUND" = "zno" ; then if test "z$with_libxml" != "z" ; then @@ -379,12 +367,12 @@ AC_ARG_WITH(sasl, [ --with-sasl use cyrus SASL for authentication], [], - [with_sasl=yes]) + [with_sasl=check]) SASL_CFLAGS= SASL_LIBS= if test "$with_sasl" != "no"; then - if test "$with_sasl" != "yes"; then + if test "$with_sasl" != "yes" -a "$with_sasl" != "check"; then SASL_CFLAGS="-I$with_sasl" SASL_LIBS="-L$with_sasl" fi @@ -392,18 +380,28 @@ old_libs="$LIBS" CFLAGS="$CFLAGS $SASL_CFLAGS" LIBS="$LIBS $SASL_LIBS" - AC_CHECK_HEADER([sasl/sasl.h], - [], - AC_MSG_ERROR([You must install the Cyrus SASL development package in order to compile libvirt])) - AC_CHECK_LIB(sasl2, sasl_client_init, - [], - [AC_MSG_ERROR([You must install the Cyrus SASL library in order to compile and run libvirt])]) + AC_CHECK_HEADER([sasl/sasl.h],[],[ + if test "$with_sasl" != "check" ; then + with_sasl=no + else + AC_MSG_ERROR([You must install the Cyrus SASL development package in order to compile libvirt]) + fi]) + if test "$with_sasl" != "no" ; then + AC_CHECK_LIB(sasl2, sasl_client_init,[],[ + if test "$with_sasl" = "check" ; then + with_sasl=no + else + AC_MSG_ERROR([You must install the Cyrus SASL library in order to compile and run libvirt]) + fi]) + fi CFLAGS="$old_cflags" LIBS="$old_libs" SASL_LIBS="$SASL_LIBS -lsasl2" - AC_DEFINE_UNQUOTED(HAVE_SASL, 1, [whether Cyrus SASL is available for authentication]) + if test "$with_sasl" = "yes" ; then + AC_DEFINE_UNQUOTED(HAVE_SASL, 1, [whether Cyrus SASL is available for authentication]) + fi fi -AM_CONDITIONAL(HAVE_SASL, [test "$with_sasl" != "no"]) +AM_CONDITIONAL(HAVE_SASL, [test "$with_sasl" = "yes"]) AC_SUBST(SASL_CFLAGS) AC_SUBST(SASL_LIBS) @@ -416,13 +414,17 @@ [], [with_polkit=check]) -if test "$with_polkit" = "check"; then - PKG_CHECK_EXISTS(polkit-dbus >= $POLKIT_REQUIRED, [with_polkit=yes], [with_polkit=no]) -fi - -if test "$with_polkit" = "yes"; then - PKG_CHECK_MODULES(POLKIT, polkit-dbus >= $POLKIT_REQUIRED) - AC_DEFINE_UNQUOTED(HAVE_POLKIT, 1, [use PolicyKit for UNIX socket access checks]) +if test "$with_polkit" = "yes" -o "$with_polkit" = "check"; then + PKG_CHECK_MODULES(POLKIT, polkit-dbus >= $POLKIT_REQUIRED, [with_polkit=yes], [ + if test "$with_polkit" = "check" ; then + with_polkit=no + else + AC_MSG_ERROR([You must install PolicyKit >= $POLKIT_REQUIRED to compile libvirt]) + fi + ]) + if test "$with_polkit" = "yes" ; then + AC_DEFINE_UNQUOTED(HAVE_POLKIT, 1, [use PolicyKit for UNIX socket access checks]) + fi fi AM_CONDITIONAL(HAVE_POLKIT, [test "$with_polkit" = "yes"]) AC_SUBST(POLKIT_CFLAGS) @@ -434,15 +436,19 @@ [], [with_avahi=check]) -if test "$with_avahi" = "check" -a "x$PKG_CONFIG" != "x" ; then - PKG_CHECK_EXISTS(avahi-client >= $AVAHI_REQUIRED, [with_avahi=yes], [with_avahi=no]) -fi - AVAHI_CFLAGS= AVAHI_LIBS= -if test "$with_avahi" = "yes"; then - PKG_CHECK_MODULES(AVAHI, avahi-client >= $AVAHI_REQUIRED) - AC_DEFINE_UNQUOTED(HAVE_AVAHI, 1, [whether Avahi is used to broadcast server presense]) +if test "$with_avahi" = "yes" -o "$with_avahi" = "check"; then + PKG_CHECK_MODULES(AVAHI, avahi-client >= $AVAHI_REQUIRED, [with_avahi=yes], [ + if test "$with_avahi" = "check" ; then + with_avahi=no + else + AC_MSG_ERROR([You must install Avahi >= $AVAHI_REQUIRED to compile libvirt]) + fi + ]) + if test "$with_avahi" = "yes" ; then + AC_DEFINE_UNQUOTED(HAVE_AVAHI, 1, [whether Avahi is used to broadcast server presense]) + fi fi AM_CONDITIONAL(HAVE_AVAHI, [test "$with_avahi" = "yes"]) AC_SUBST(AVAHI_CFLAGS) @@ -490,9 +496,6 @@ AC_SUBST(READLINE_CFLAGS) AC_SUBST(VIRSH_LIBS) -# end of if with_depends -fi - AC_SUBST(WITH_XEN) AC_SUBST(LIBVIRT_FEATURES) -- |=- 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 -=| -- Libvir-list mailing list Libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list