]> xenbits.xensource.com Git - libvirt.git/commitdiff
build: fix build with newer gnutls
authorEric Blake <eblake@redhat.com>
Wed, 29 May 2013 03:15:08 +0000 (21:15 -0600)
committerEric Blake <eblake@redhat.com>
Wed, 29 May 2013 14:52:42 +0000 (08:52 -0600)
Building with gnutls 3.2.0 (such as shipped with current cygwin) fails
with:

rpc/virnettlscontext.c: In function 'virNetTLSSessionGetKeySize':
rpc/virnettlscontext.c:1358:5: error: implicit declaration of function 'gnutls_cipher_get_key_size' [-Wimplicit-function-declaration]

Yeah, it's stupid that gnutls broke API by moving their declaration
into a new header without including that header from the old one,
but it's easy enough to work around, all without breaking on gnutls
1.4.1 (hello RHEL 5) that lacked the new header.

* configure.ac (gnutls): Check for <gnutls/crypto.h>.
* src/rpc/virnettlscontext.c (includes): Include additional header.

Signed-off-by: Eric Blake <eblake@redhat.com>
configure.ac
src/rpc/virnettlscontext.c

index 2055637d7f83360c16a96c13b122d9faf39d2f37..a9ee0bb6ccc704b0d19e0931afb0abe842d76799 100644 (file)
@@ -1103,10 +1103,15 @@ if test "x$with_gnutls" != "xno"; then
     dnl it explicitly for the calls to gcry_control/check_version
     GNUTLS_LIBS="$GNUTLS_LIBS -lgcrypt"
 
-    dnl We're not using gcrypt deprecated features so define GCRYPT_NO_DEPRECATED
-    dnl to avoid deprecated warnings
+    dnl We're not using gcrypt deprecated features so define
+    dnl GCRYPT_NO_DEPRECATED to avoid deprecated warnings
     GNUTLS_CFLAGS="$GNUTLS_CFLAGS -DGCRYPT_NO_DEPRECATED"
 
+    dnl gnutls 3.x moved some declarations to a new header
+    AC_CHECK_HEADERS([gnutls/crypto.h], [], [], [[
+      #include <gnutls/gnutls.h>
+    ]])
+
     with_gnutls=yes
   fi
 
index e29c4392b2018907bdf0f0f0b5338cd5af891e1e..f2ac5510d44fd098d69eff2efd7d4049fb44ed49 100644 (file)
@@ -25,6 +25,9 @@
 #include <stdlib.h>
 
 #include <gnutls/gnutls.h>
+#if HAVE_GNULTLS_CRYPTO_H
+# include <gnutls/crypto.h>
+#endif
 #include <gnutls/x509.h>
 #include "gnutls_1_0_compat.h"