Yavor Doganov's patch to avoid unnecessary link to libgcrypt

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@37966 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2014-06-30 06:28:38 +00:00
parent 54b5b64c5d
commit 7f80c0df75
5 changed files with 24 additions and 13 deletions

View file

@ -8,6 +8,10 @@
* Tools/DocMakefile: * Tools/DocMakefile:
Flags alterations to build documentation before base/autogsdoc is Flags alterations to build documentation before base/autogsdoc is
installed. installed.
* configure.ac: Test whether gnutls needs libgcrypt
* Source/GSTLS.h: Use test
* Source/GSTLS.m: Use test
* configure: regenerate
2014-06-26 Riccardo Mottola <rm@gnu.org> 2014-06-26 Riccardo Mottola <rm@gnu.org>

View file

@ -49,7 +49,9 @@ extern NSString * const GSTLSVerify;
#define _GCRYPT_IN_LIBGCRYPT #define _GCRYPT_IN_LIBGCRYPT
#include <gnutls/gnutls.h> #include <gnutls/gnutls.h>
#include <gnutls/x509.h> #include <gnutls/x509.h>
#if GNUTLS_VERSION_NUMBER <= 0x020b00
#include <gcrypt.h> #include <gcrypt.h>
#endif
#undef id #undef id
/* This class is used to ensure that the GNUTLS system is initialised /* This class is used to ensure that the GNUTLS system is initialised

View file

@ -67,6 +67,7 @@ standardizedPath(NSString *path)
#if defined(HAVE_GNUTLS) #if defined(HAVE_GNUTLS)
#if GNUTLS_VERSION_NUMBER <= 0x020b00
/* Set up locking callbacks for gcrypt so that it will be thread-safe. /* Set up locking callbacks for gcrypt so that it will be thread-safe.
*/ */
static int gcry_mutex_init(void **priv) static int gcry_mutex_init(void **priv)
@ -98,6 +99,7 @@ static struct gcry_thread_cbs gcry_threads_other = {
gcry_mutex_lock, gcry_mutex_lock,
gcry_mutex_unlock gcry_mutex_unlock
}; };
#endif
static void static void
GSTLSLog(int level, const char *msg) GSTLSLog(int level, const char *msg)
@ -324,9 +326,11 @@ static NSMutableDictionary *fileMap = nil;
name: NSUserDefaultsDidChangeNotification name: NSUserDefaultsDidChangeNotification
object: nil]; object: nil];
#if GNUTLS_VERSION_NUMBER <= 0x020b00
/* Make gcrypt thread-safe /* Make gcrypt thread-safe
*/ */
gcry_control(GCRYCTL_SET_THREAD_CBS, &gcry_threads_other); gcry_control(GCRYCTL_SET_THREAD_CBS, &gcry_threads_other);
#endif
/* Initialise gnutls /* Initialise gnutls
*/ */

14
configure vendored
View file

@ -25301,7 +25301,8 @@ $as_echo "no" >&6; }
fi fi
fi fi
if test $HAVE_GNUTLS = 1; then if test $HAVE_GNUTLS = 1; then
{ $as_echo "$as_me:$LINENO: checking for gcry_control in -lgcrypt" >&5 if ! pkg-config --atleast-version=2.12 gnutls; then
{ $as_echo "$as_me:$LINENO: checking for gcry_control in -lgcrypt" >&5
$as_echo_n "checking for gcry_control in -lgcrypt... " >&6; } $as_echo_n "checking for gcry_control in -lgcrypt... " >&6; }
if test "${ac_cv_lib_gcrypt_gcry_control+set}" = set; then if test "${ac_cv_lib_gcrypt_gcry_control+set}" = set; then
$as_echo_n "(cached) " >&6 $as_echo_n "(cached) " >&6
@ -25372,12 +25373,11 @@ else
have_gcrypt=no have_gcrypt=no
fi fi
if test "$have_gcrypt" = "no"; then if test "$have_gcrypt" = "no"; then
{ $as_echo "$as_me:$LINENO: WARNING: Missing support for thread-safe operation in GNUTLS. Disabling TLS support)." >&5 HAVE_GNUTLS=0
$as_echo "$as_me: WARNING: Missing support for thread-safe operation in GNUTLS. Disabling TLS support)." >&2;} else
HAVE_GNUTLS=0 TLS_LIBS="$TLS_LIBS -lgcrypt"
else fi
TLS_LIBS="$TLS_LIBS -lgcrypt"
fi fi
fi fi
if test $HAVE_GNUTLS = 0; then if test $HAVE_GNUTLS = 0; then

View file

@ -3130,12 +3130,13 @@ if test $enable_tls = yes; then
fi fi
fi fi
if test $HAVE_GNUTLS = 1; then if test $HAVE_GNUTLS = 1; then
AC_CHECK_LIB(gcrypt, gcry_control, have_gcrypt=yes, have_gcrypt=no) if ! pkg-config --atleast-version=2.12 gnutls; then
if test "$have_gcrypt" = "no"; then AC_CHECK_LIB(gcrypt, gcry_control, have_gcrypt=yes, have_gcrypt=no)
AC_MSG_WARN([Missing support for thread-safe operation in GNUTLS. Disabling TLS support).]) if test "$have_gcrypt" = "no"; then
HAVE_GNUTLS=0 HAVE_GNUTLS=0
else else
TLS_LIBS="$TLS_LIBS -lgcrypt" TLS_LIBS="$TLS_LIBS -lgcrypt"
fi
fi fi
fi fi
if test $HAVE_GNUTLS = 0; then if test $HAVE_GNUTLS = 0; then