summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorMartin Storsjo <martin@martin.st>2011-11-15 11:52:32 +0200
committerDaniel Stenberg <daniel@haxx.se>2011-11-19 22:23:14 +0100
commit64f328c787ab763cc994eadd6b82f32490d37ebb (patch)
tree415403f46b8610b7ae9ab8308abd6dd58e324d0a /configure.ac
parentc0db5ff678ecca068ca85b454517fb4585da85f1 (diff)
downloadcurl-64f328c787ab763cc994eadd6b82f32490d37ebb.tar.gz
Add support for using nettle instead of gcrypt as gnutls backend
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac29
1 files changed, 21 insertions, 8 deletions
diff --git a/configure.ac b/configure.ac
index 64ee1b7a6..2ba662560 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1799,17 +1799,30 @@ if test "$OPENSSL_ENABLED" != "1"; then
fi dnl OPENSSL != 1
dnl ---
-dnl If GnuTLS is enabled, we MUST verify that it uses libgcrypt since
-dnl curl code relies on that but recent GnuTLS versions can in fact build
-dnl with different crypto libraries which curl right now cannot handle
+dnl Check which crypto backend GnuTLS uses
dnl ---
if test "$GNUTLS_ENABLED" = "1"; then
- AC_CHECK_LIB(gcrypt,
- gcry_control, ,
- [
- AC_MSG_ERROR([need GnuTLS built with gcrypt to function with GnuTLS])
- ])
+ USE_GNUTLS_NETTLE=
+ # First check if we can detect either crypto library via transitive linking
+ AC_CHECK_LIB(gnutls, nettle_MD5Init, [ USE_GNUTLS_NETTLE=1 ])
+ if test "$USE_GNUTLS_NETTLE" = ""; then
+ AC_CHECK_LIB(gnutls, gcry_control, [ USE_GNUTLS_NETTLE=0 ])
+ fi
+ # If not, try linking directly to both of them to see if they are available
+ if test "$USE_GNUTLS_NETTLE" = ""; then
+ AC_CHECK_LIB(nettle, nettle_MD5Init, [ USE_GNUTLS_NETTLE=1 ])
+ fi
+ if test "$USE_GNUTLS_NETTLE" = ""; then
+ AC_CHECK_LIB(gcrypt, gcry_control, [ USE_GNUTLS_NETTLE=0 ])
+ fi
+ if test "$USE_GNUTLS_NETTLE" = ""; then
+ AC_MSG_ERROR([GnuTLS found, but neither gcrypt nor nettle found])
+ fi
+ if test "$USE_GNUTLS_NETTLE" = "1"; then
+ AC_DEFINE(USE_GNUTLS_NETTLE, 1, [if GnuTLS uses nettle as crypto backend])
+ AC_SUBST(USE_GNUTLS_NETTLE, [1])
+ fi
fi
dnl ---