From f48be4e0c6542cc7759b25181dfd7c9e3463c284 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Mon, 27 Oct 2014 14:55:25 -0400 Subject: [PATCH] use pkg-config to check gnutls deps if available Newer versions of these packages ship with pkg-config files, so if we can detect it via those, do so. If that fails, fall back to the old methods. --- ChangeLog | 3 +++ configure.ac | 28 ++++++++++++++++++---------- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6680820e..6e240196 100644 --- a/ChangeLog +++ b/ChangeLog @@ -12,6 +12,9 @@ * configure.ac: Use pkg-config to check for openssl presence and fallback to the previous code if that doesn't work. + * configure.ac: Use pkg-config to check for gnutls presence and + fallback to the previous code if that doesn't work. + 2014-07-28 Ángel González * contrib: Created contrib folder. * contrib/tsocked-wget: Added wrapper for usage with socks proxy. diff --git a/configure.ac b/configure.ac index 0d170cbf..c2fbda80 100644 --- a/configure.ac +++ b/configure.ac @@ -348,18 +348,26 @@ AS_IF([test x"$with_ssl" = xopenssl], [ with_ssl=gnutls dnl Now actually check for -lgnutls - AC_LIB_HAVE_LINKFLAGS([gnutls], [], [ -#include - ], [gnutls_global_init()]) - if test x"$LIBGNUTLS" != x - then - ssl_found=yes + PKG_CHECK_MODULES([GNUTLS], [gnutls], [ AC_MSG_NOTICE([compiling in support for SSL via GnuTLS]) AC_LIBOBJ([gnutls]) - LIBS="$LIBGNUTLS $LIBS" - else - AC_MSG_ERROR([--with-ssl=gnutls was given, but GNUTLS is not available.]) - fi + LIBS="$GNUTLS_LIBS $LIBS" + CFLAGS="$GNUTLS_CFLAGS -DHAVE_LIBGNUTLS $CFLAGS" + AC_DEFINE([HAVE_LIBGNUTLS], [1], [Define if using gnutls.]) + ], [ + AC_LIB_HAVE_LINKFLAGS([gnutls], [], [ +#include + ], [gnutls_global_init()]) + if test x"$LIBGNUTLS" != x + then + ssl_found=yes + AC_MSG_NOTICE([compiling in support for SSL via GnuTLS]) + AC_LIBOBJ([gnutls]) + LIBS="$LIBGNUTLS $LIBS" + else + AC_MSG_ERROR([--with-ssl=gnutls was given, but GNUTLS is not available.]) + fi + ]) AC_CHECK_FUNCS(gnutls_priority_set_direct) ]) # endif: --with-ssl != no?