Do not include gcrypt.h for newer GnuTLS versions

Not linking against Libgcrypt is not enough, we also should not try to
include headers. This fixes GnuTLS >= 2.12 detection when Libgcrypt
headers are not installed/found.
This commit is contained in:
Stefan Gehn 2011-11-26 20:00:53 +01:00
parent 752e5965b1
commit fdc17315b7
2 changed files with 5 additions and 2 deletions

4
src/configure vendored
View File

@ -99,13 +99,15 @@ GNUTLS_INCLUDE="$(pkg-config gnutls --cflags 2>& 5 || true)"
GNUTLS_LIBS="$(pkg-config gnutls --libs 2>& 5 || true) -lgnutls-openssl" GNUTLS_LIBS="$(pkg-config gnutls --libs 2>& 5 || true) -lgnutls-openssl"
# GnuTLS >= 2.12 does not need explicit gcrypt linking anymore # GnuTLS >= 2.12 does not need explicit gcrypt linking anymore
gcrypt_h=""
if $(pkg-config --max-version=2.11.99 gnutls 2>& 5 || false); then if $(pkg-config --max-version=2.11.99 gnutls 2>& 5 || false); then
GNUTLS_LIBS="$GNUTLS_LIBS -lgcrypt" GNUTLS_LIBS="$GNUTLS_LIBS -lgcrypt"
gcrypt_h="#include <gcrypt.h>"
fi fi
cat << EOF > test.c cat << EOF > test.c
#include <gnutls/openssl.h> #include <gnutls/openssl.h>
#include <gcrypt.h> $gcrypt_h
#include <errno.h> #include <errno.h>
int main() int main()

View File

@ -46,12 +46,13 @@
#if defined(HAVE_GNUTLS) #if defined(HAVE_GNUTLS)
#include <gnutls/openssl.h> #include <gnutls/openssl.h>
#include <gcrypt.h>
#define MD5Init MD5_Init #define MD5Init MD5_Init
#define MD5Update MD5_Update #define MD5Update MD5_Update
#define MD5Final MD5_Final #define MD5Final MD5_Final
#if GNUTLS_VERSION_NUMBER <= 0x020b00 #if GNUTLS_VERSION_NUMBER <= 0x020b00
#include <gcrypt.h>
/* gcrypt mutex setup is only needed for GnuTLS < 2.12 */ /* gcrypt mutex setup is only needed for GnuTLS < 2.12 */
static int gk_gcry_glib_mutex_init (void **priv) { static int gk_gcry_glib_mutex_init (void **priv) {