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:
rfm 2014-06-30 06:28:38 +00:00
parent 4cdd9aac1b
commit 21e157f656
5 changed files with 24 additions and 13 deletions

View file

@ -8,6 +8,10 @@
* Tools/DocMakefile:
Flags alterations to build documentation before base/autogsdoc is
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>

View file

@ -49,7 +49,9 @@ extern NSString * const GSTLSVerify;
#define _GCRYPT_IN_LIBGCRYPT
#include <gnutls/gnutls.h>
#include <gnutls/x509.h>
#if GNUTLS_VERSION_NUMBER <= 0x020b00
#include <gcrypt.h>
#endif
#undef id
/* 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 GNUTLS_VERSION_NUMBER <= 0x020b00
/* Set up locking callbacks for gcrypt so that it will be thread-safe.
*/
static int gcry_mutex_init(void **priv)
@ -98,6 +99,7 @@ static struct gcry_thread_cbs gcry_threads_other = {
gcry_mutex_lock,
gcry_mutex_unlock
};
#endif
static void
GSTLSLog(int level, const char *msg)
@ -324,9 +326,11 @@ static NSMutableDictionary *fileMap = nil;
name: NSUserDefaultsDidChangeNotification
object: nil];
#if GNUTLS_VERSION_NUMBER <= 0x020b00
/* Make gcrypt thread-safe
*/
gcry_control(GCRYCTL_SET_THREAD_CBS, &gcry_threads_other);
#endif
/* Initialise gnutls
*/

14
configure vendored
View file

@ -25301,7 +25301,8 @@ $as_echo "no" >&6; }
fi
fi
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; }
if test "${ac_cv_lib_gcrypt_gcry_control+set}" = set; then
$as_echo_n "(cached) " >&6
@ -25372,12 +25373,11 @@ else
have_gcrypt=no
fi
if test "$have_gcrypt" = "no"; then
{ $as_echo "$as_me:$LINENO: WARNING: Missing support for thread-safe operation in GNUTLS. Disabling TLS support)." >&5
$as_echo "$as_me: WARNING: Missing support for thread-safe operation in GNUTLS. Disabling TLS support)." >&2;}
HAVE_GNUTLS=0
else
TLS_LIBS="$TLS_LIBS -lgcrypt"
if test "$have_gcrypt" = "no"; then
HAVE_GNUTLS=0
else
TLS_LIBS="$TLS_LIBS -lgcrypt"
fi
fi
fi
if test $HAVE_GNUTLS = 0; then

View file

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