mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-10 23:45:53 -06:00
Fix detection of GnuTLS 1.x.y
Detection based on gnutls_session doesn't work because GnuTLS 2.x.y comes with a compat.h that defines gnutls_session to gnutls_session_t. Instead detect this based on LIBGNUTLS_VERSION_MAJOR. Move this from configure/config.h to gnutls_1_0_compat.h and make sure that all users include gnutls_1_0_compat.h properly. Also fix header guard in gnutls_1_0_compat.h.
This commit is contained in:
parent
14c2ca3db9
commit
099d30a825
14
configure.ac
14
configure.ac
@ -834,20 +834,6 @@ 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_libs="$LIBS"
|
||||
CFLAGS="$CFLAGS $GNUTLS_CFLAGS"
|
||||
LIBS="$LIBS $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"
|
||||
LIBS="$old_libs"
|
||||
|
||||
|
||||
dnl Cyrus SASL
|
||||
AC_ARG_WITH([sasl],
|
||||
|
@ -21,9 +21,17 @@
|
||||
*/
|
||||
|
||||
#ifndef LIBVIRT_GNUTLS_1_0_COMPAT_H__
|
||||
# define LIBVIRT_GNUTLS_1_0_COMPAT_H__
|
||||
|
||||
# include <config.h>
|
||||
|
||||
# include <gnutls/gnutls.h>
|
||||
|
||||
/* enable backward compatibility macros for gnutls 1.x.y */
|
||||
# if LIBGNUTLS_VERSION_MAJOR < 2
|
||||
# define GNUTLS_1_0_COMPAT
|
||||
# endif
|
||||
|
||||
# ifdef GNUTLS_1_0_COMPAT
|
||||
# define gnutls_session_t gnutls_session
|
||||
# define gnutls_x509_crt_t gnutls_x509_crt
|
||||
|
@ -23,6 +23,8 @@
|
||||
#include <stdlib.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/socket.h>
|
||||
#include <gnutls/gnutls.h>
|
||||
#include <gnutls/x509.h>
|
||||
|
||||
#include "testutils.h"
|
||||
#include "util.h"
|
||||
@ -32,12 +34,10 @@
|
||||
#include "virfile.h"
|
||||
#include "command.h"
|
||||
#include "network.h"
|
||||
#include "gnutls_1_0_compat.h"
|
||||
|
||||
#if !defined WIN32 && HAVE_LIBTASN1_H && !defined GNUTLS_1_0_COMPAT
|
||||
# include <libtasn1.h>
|
||||
# include <gnutls/gnutls.h>
|
||||
# include <gnutls/x509.h>
|
||||
# include "gnutls_1_0_compat.h"
|
||||
|
||||
# include "rpc/virnettlscontext.h"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user