Only use Libgcrypt for GnuTLS < 2.12

Only initialize Libgcrypt threading functions on GnuTLS < 2.12 which
does not do this automatically. Also drop explicit linking against
Libgcrypt on newer GnuTLS version.

This should allow GKrellM to work with a GnuTLS that uses Nettle instead
of Libgcrypt as its cryptographic backend.
This commit is contained in:
Stefan Gehn 2011-08-27 16:32:31 +02:00
parent 50b126e085
commit 752e5965b1
3 changed files with 17 additions and 1 deletions

View File

@ -16,6 +16,9 @@ GKrellM Changelog
* Bugfixes
o Store lockfiles under /var/lock/gkrellm-UID directories to make
lockfiles work for multiple users.
* Only link against and initialize Libgcrypt when building with
GnuTLS < 2.12. This allows using GKrellM with GnuTLS versions built
against Nettle instead of Libgcrypt.
2.3.5 - Thu Oct 7, 2010
------------------------

7
src/configure vendored
View File

@ -96,7 +96,12 @@ echo -n "Checking for gnutls... "
echo "Checking for gnutls... " 1>& 5
GNUTLS_INCLUDE="$(pkg-config gnutls --cflags 2>& 5 || true)"
GNUTLS_LIBS="$(pkg-config gnutls --libs 2>& 5 || true) -lgnutls-openssl -lgcrypt"
GNUTLS_LIBS="$(pkg-config gnutls --libs 2>& 5 || true) -lgnutls-openssl"
# GnuTLS >= 2.12 does not need explicit gcrypt linking anymore
if $(pkg-config --max-version=2.11.99 gnutls 2>& 5 || false); then
GNUTLS_LIBS="$GNUTLS_LIBS -lgcrypt"
fi
cat << EOF > test.c
#include <gnutls/openssl.h>

View File

@ -51,6 +51,9 @@
#define MD5Update MD5_Update
#define MD5Final MD5_Final
#if GNUTLS_VERSION_NUMBER <= 0x020b00
/* gcrypt mutex setup is only needed for GnuTLS < 2.12 */
static int gk_gcry_glib_mutex_init (void **priv) {
GMutex *lock = g_mutex_new();
if (!lock)
@ -90,6 +93,8 @@ static struct gcry_thread_cbs gk_gcry_threads_glib = {
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
};
#endif
#else
#if defined(HAVE_SSL)
@ -4340,7 +4345,10 @@ gkrellm_init_mail_monitor(void)
_GK.decal_mail_delay = 1;
#ifdef HAVE_GNUTLS
#if GNUTLS_VERSION_NUMBER <= 0x020b00
/* gcrypt mutex setup, only needed for GnuTLS < 2.12 */
gcry_control (GCRYCTL_SET_THREAD_CBS, &gk_gcry_threads_glib);
#endif
gnutls_global_init();
SSL_load_error_strings();
SSL_library_init();