From 9d7661e4156e645d6cbb745a9c5bd0c68eb5e75f Mon Sep 17 00:00:00 2001 From: "Daniel P. Berrange" Date: Tue, 22 Jan 2008 21:30:05 +0000 Subject: [PATCH] Fix compat for old pkg-config and gnutls --- ChangeLog | 8 +++ acinclude.m4 | 26 ++++++++ configure.in | 128 +++++++++++++++++++++++----------------- src/gnutls_1_0_compat.h | 1 + 4 files changed, 108 insertions(+), 55 deletions(-) diff --git a/ChangeLog b/ChangeLog index b4a5f14662..c9b253e37f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +Tue Jan 22 16:27:47 EST 2008 Daniel P. Berrange + + * configure.ac: Remove use of PKG_CHECK_EXISTS macro. Avoid + lines going over 80 chars wide. Make sasl check automatic + enable/disable as neccessary. + * acinclude.m4: Added compatability macro for old pkg-config + * src/gnutls_1_0_compat.h: Add compat for gnutls_cipher_algorithm_t + Mon Jan 21 18:03:47 CET 2008 Jim Meyering Avoid "may be used uninitialized" warning. diff --git a/acinclude.m4 b/acinclude.m4 index 8ec39209a2..0cfc1bc1e6 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -88,3 +88,29 @@ AC_DEFUN([LIBVIRT_COMPILE_WARNINGS],[ WARN_CFLAGS="$compiler_flags $complCFLAGS" AC_SUBST(WARN_CFLAGS) ]) + + +dnl +dnl To support the old pkg-config from RHEL4 vintage, we need +dnl to define the PKG_PROG_PKG_CONFIG macro if its not already +dnl present +m4_ifndef([PKG_PROG_PKG_CONFIG], + [AC_DEFUN([PKG_PROG_PKG_CONFIG], +[m4_pattern_forbid([^_?PKG_[A-Z_]+$]) +m4_pattern_allow([^PKG_CONFIG(_PATH)?$]) +AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=m4_default([$1], [0.9.0]) + AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + PKG_CONFIG="" + fi +fi[]dnl +])]) + diff --git a/configure.in b/configure.in index 06c6b641e4..6cadb41c63 100644 --- a/configure.in +++ b/configure.in @@ -218,12 +218,6 @@ CPPFLAGS="$CPPFLAGS -I$withval/install/usr/include" 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 @@ if test "$with_remote" = "yes" ; then 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], @@ -297,17 +288,14 @@ LIBXML_LIBS="" LIBXML_FOUND="no" AC_ARG_WITH(libxml, [ --with-libxml=[PFX] libxml2 location]) -if test "z$with_libxml" = "zno" ; then +if test "x$with_libxml" = "xno" ; then 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 +elif test "x$with_libxml" = "x" -a "x$PKG_CONFIG" = "x" ; then + 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 +if test "$LIBXML_FOUND" = "no" ; then + if test "x$with_libxml" != "x" ; then LIBXML_CONFIG=$with_libxml/bin/$LIBXML_CONFIG fi AC_MSG_CHECKING(libxml2 $LIBXML_CONFIG >= $LIBXML_REQUIRED ) @@ -322,7 +310,8 @@ if test "z$LIBXML_FOUND" = "zno" ; then LIBXML_FOUND="yes" AC_MSG_RESULT(yes) else - AC_MSG_ERROR(You need at least libxml2 $LIBXML_REQUIRED for this version of libvirt) + AC_MSG_ERROR( + [You need at least libxml2 $LIBXML_REQUIRED for this version of libvirt]) fi fi @@ -343,16 +332,21 @@ LDFLAGS="$old_ldflags" dnl GnuTLS library GNUTLS_CFLAGS= GNUTLS_LIBS= -if test "x$PKG_CONFIG" != "x" ; then - PKG_CHECK_MODULES(GNUTLS, gnutls >= $GNUTLS_REQUIRED) -else +GNUTLS_FOUND=no +if test -z "$PKG_CONFIG" ; then + PKG_CHECK_MODULES(GNUTLS, gnutls >= $GNUTLS_REQUIRED, + [GNUTLS_FOUND=yes], [GNUTLS_FOUND=no]) +fi +if test "$GNUTLS_FOUND" = "no"; then AC_CHECK_HEADER([gnutls/gnutls.h], - [], - AC_MSG_ERROR([You must install the GnuTLS development package in order to compile libvirt])) + [], + AC_MSG_ERROR( + [You must install the GnuTLS development package in order to compile libvirt])) old_libs="$LIBS" AC_CHECK_LIB(gnutls, gnutls_handshake, - [], - [AC_MSG_ERROR([You must install the GnuTLS library in order to compile and run libvirt])]) + [], + [AC_MSG_ERROR( + [You must install the GnuTLS library in order to compile and run libvirt])]) GNUTLS_LIBS=$LIBS LIBS="$old_libs" fi @@ -379,12 +373,12 @@ dnl Cyrus SASL 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 "x$with_sasl" != "xno"; then + if test "x$with_sasl" != "xyes" -a "x$with_sasl" != "xcheck"; then SASL_CFLAGS="-I$with_sasl" SASL_LIBS="-L$with_sasl" fi @@ -392,18 +386,31 @@ if test "$with_sasl" != "no"; then 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 "x$with_sasl" != "xcheck" ; then + with_sasl=no + else + AC_MSG_ERROR( + [You must install the Cyrus SASL development package in order to compile libvirt]) + fi]) + if test "x$with_sasl" != "xno" ; then + AC_CHECK_LIB(sasl2, sasl_client_init,[],[ + if test "x$with_sasl" = "xcheck" ; 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 "x$with_sasl" = "xyes" ; 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 "x$with_sasl" = "xyes"]) AC_SUBST(SASL_CFLAGS) AC_SUBST(SASL_LIBS) @@ -416,15 +423,22 @@ AC_ARG_WITH(polkit, [], [with_polkit=check]) -if test "$with_polkit" = "check"; then - PKG_CHECK_EXISTS(polkit-dbus >= $POLKIT_REQUIRED, [with_polkit=yes], [with_polkit=no]) +if test "x$with_polkit" = "xyes" -o "x$with_polkit" = "xcheck"; then + PKG_CHECK_MODULES(POLKIT, polkit-dbus >= $POLKIT_REQUIRED, + [with_polkit=yes], [ + if test "x$with_polkit" = "xcheck" ; then + with_polkit=no + else + AC_MSG_ERROR( + [You must install PolicyKit >= $POLKIT_REQUIRED to compile libvirt]) + fi + ]) + if test "x$with_polkit" = "xyes" ; then + AC_DEFINE_UNQUOTED(HAVE_POLKIT, 1, + [use PolicyKit for UNIX socket access checks]) + fi 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]) -fi -AM_CONDITIONAL(HAVE_POLKIT, [test "$with_polkit" = "yes"]) +AM_CONDITIONAL(HAVE_POLKIT, [test "x$with_polkit" = "xyes"]) AC_SUBST(POLKIT_CFLAGS) AC_SUBST(POLKIT_LIBS) @@ -434,17 +448,24 @@ AC_ARG_WITH(avahi, [], [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 "x$with_avahi" = "xyes" -o "x$with_avahi" = "xcheck"; then + PKG_CHECK_MODULES(AVAHI, avahi-client >= $AVAHI_REQUIRED, + [with_avahi=yes], [ + if test "x$with_avahi" = "xcheck" ; then + with_avahi=no + else + AC_MSG_ERROR( + [You must install Avahi >= $AVAHI_REQUIRED to compile libvirt]) + fi + ]) + if test "x$with_avahi" = "xyes" ; 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"]) +AM_CONDITIONAL(HAVE_AVAHI, [test "x$with_avahi" = "xyes"]) AC_SUBST(AVAHI_CFLAGS) AC_SUBST(AVAHI_LIBS) @@ -490,9 +511,6 @@ fi AC_SUBST(READLINE_CFLAGS) AC_SUBST(VIRSH_LIBS) -# end of if with_depends -fi - AC_SUBST(WITH_XEN) AC_SUBST(LIBVIRT_FEATURES) diff --git a/src/gnutls_1_0_compat.h b/src/gnutls_1_0_compat.h index 2b3111fa26..7ec8b63823 100644 --- a/src/gnutls_1_0_compat.h +++ b/src/gnutls_1_0_compat.h @@ -31,6 +31,7 @@ #define gnutls_transport_ptr_t gnutls_transport_ptr #define gnutls_datum_t gnutls_datum #define gnutls_certificate_credentials_t gnutls_certificate_credentials +#define gnutls_cipher_algorithm_t gnutls_cipher_algorithm #endif #endif /* LIBVIRT_GNUTLS_1_0_COMPAT_H__ */