Newer versions of openssl ship with pkg-config files, so if we can detect it via those, do so. If that fails, fall back to the classic method.
Signed-off-by: Mike Frysinger <[email protected]> --- configure.ac | 55 ++++++++++++++++++++++++++++++++----------------------- 1 files changed, 32 insertions(+), 23 deletions(-) diff --git a/configure.ac b/configure.ac index 873c3c9..d527587 100644 --- a/configure.ac +++ b/configure.ac @@ -241,7 +241,16 @@ AS_IF([test x"$with_zlib" != xno], [ AC_CHECK_LIB(z, compress) ]) +PKG_PROG_PKG_CONFIG + AS_IF([test x"$with_ssl" = xopenssl], [ + PKG_CHECK_MODULES([OPENSSL], [openssl], [ + AC_MSG_NOTICE([compiling in support for SSL via OpenSSL]) + AC_LIBOBJ([openssl]) + LIBS="$OPENSSL_LIBS $LIBS" + CFLAGS="$OPENSSL_CFLAGS -DHAVE_LIBSSL $CFLAGS" + LIBSSL=" " # ntlm check below wants this + ], [ dnl some versions of openssl use zlib compression AC_CHECK_LIB(z, compress) @@ -278,29 +287,29 @@ AS_IF([test x"$with_ssl" = xopenssl], [ ;; esac -AS_IF([test x$ssl_found != xyes], -[ - dnl Now actually check for -lssl if it wasn't already found - AC_LIB_HAVE_LINKFLAGS([ssl], [crypto z], [ - #include <openssl/ssl.h> - #include <openssl/x509.h> - #include <openssl/err.h> - #include <openssl/rand.h> - #include <openssl/des.h> - #include <openssl/md4.h> - #include <openssl/md5.h> - ], [SSL_library_init ()]) - if test x"$LIBSSL" != x - then - ssl_found=yes - AC_MSG_NOTICE([compiling in support for SSL via OpenSSL]) - AC_LIBOBJ([openssl]) - LIBS="$LIBSSL $LIBS" - elif test x"$with_ssl" != x - then - AC_MSG_ERROR([--with-ssl=openssl was given, but SSL is not available.]) - fi -]) + AS_IF([test x$ssl_found != xyes], [ + dnl Now actually check for -lssl if it wasn't already found + AC_LIB_HAVE_LINKFLAGS([ssl], [crypto z], [ +#include <openssl/ssl.h> +#include <openssl/x509.h> +#include <openssl/err.h> +#include <openssl/rand.h> +#include <openssl/des.h> +#include <openssl/md4.h> +#include <openssl/md5.h> + ], [SSL_library_init ()]) + if test x"$LIBSSL" != x + then + ssl_found=yes + AC_MSG_NOTICE([compiling in support for SSL via OpenSSL]) + AC_LIBOBJ([openssl]) + LIBS="$LIBSSL $LIBS" + elif test x"$with_ssl" != x + then + AC_MSG_ERROR([--with-ssl=openssl was given, but SSL is not available.]) + fi + ]) + ]) ], [ # --with-ssl is not gnutls: check if it's no -- 1.7.8.6
