Switch to use pkg-config to find gnutls

This commit is contained in:
Daniel P. Berrange
2007-09-19 17:42:40 +00:00
parent e04914328d
commit 27b4293285
5 changed files with 38 additions and 9 deletions

View File

@@ -23,6 +23,7 @@ AC_SUBST(LIBVIRT_VERSION_NUMBER)
dnl Required minimum versions of all libs we depend on
LIBXML_REQUIRED="2.5.0"
GNUTLS_REQUIRED="1.2.0"
AVAHI_REQUIRED="0.6.0"
dnl Checks for programs.
@@ -292,20 +293,38 @@ CFLAGS="$old_cflags"
LDFLAGS="$old_ldflags"
dnl GnuTLS library
AC_CHECK_HEADER([gnutls/gnutls.h],
GNUTLS_CFLAGS=
GNUTLS_LIBS=
if test "x$PKG_CONFIG" != "x" ; then
PKG_CHECK_MODULES(GNUTLS, gnutls >= $GNUTLS_REQUIRED)
else
AC_CHECK_HEADER([gnutls/gnutls.h],
[],
AC_MSG_ERROR([You must install the GnuTLS development package in order to compile libvirt]))
AC_CHECK_LIB(gnutls, gnutls_handshake,
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])])
GNUTLS_LIBS=$LIBS
LIBS="$old_libs"
fi
AC_SUBST(GNUTLS_CFLAGS)
AC_SUBST(GNUTLS_LIBS)
dnl Old versions of GnuTLS uses types like 'gnutls_session' instead
dnl of 'gnutls_session_t'. Try to detect this type if defined so
dnl that we can offer backwards compatibility.
old_cflags="$CFLAGS"
old_ldflags="$LDFLAGS"
CFLAGS="$CFLAGS $GNUTLS_CFLAGS"
LDFLAGS="$LDFLAGS $GNUTLS_LIBS"
AC_CHECK_TYPE(gnutls_session,
AC_DEFINE(GNUTLS_1_0_COMPAT,[],
[enable GnuTLS 1.0 compatibility macros]),,
[#include <gnutls/gnutls.h>])
CFLAGS="$old_cflags"
LDFLAGS="$old_ldflags"
dnl Avahi library
@@ -513,6 +532,7 @@ AC_MSG_NOTICE([])
AC_MSG_NOTICE([Libraries])
AC_MSG_NOTICE([])
AC_MSG_NOTICE([ libxml: $LIBXML_CFLAGS $LIBXML_LIBS])
AC_MSG_NOTICE([ gnutls: $GNUTLS_CFLAGS $GNUTLS_LIBS])
if test "$with_avahi" = "yes" ; then
AC_MSG_NOTICE([ avahi: $AVAHI_CFLAGS $AVAHI_LIBS])
else