diff options
author | Daniel Stenberg <daniel@haxx.se> | 2009-01-11 23:41:50 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2009-01-11 23:41:50 +0000 |
commit | b9fdc0c251a2a2e8aaec9651768dec8c1b3faff4 (patch) | |
tree | c92b055e62265985e9bdfacec5f6be9aa889bcf7 | |
parent | f471b4836f414def75f2ac5e379d9a1a044570f0 (diff) |
- Based on bug report #2498665 (http://curl.haxx.se/bug/view.cgi?id=2498665)
by Daniel Black, I've now added magic to the configure script that makes it
use pkg-config to detect gnutls details as well if the existing method
(using libgnutls-config) fails. While doing this, I cleaned up and unified
the pkg-config usage when detecting openssl and nss as well.
-rw-r--r-- | CHANGES | 7 | ||||
-rw-r--r-- | RELEASE-NOTES | 3 | ||||
-rw-r--r-- | acinclude.m4 | 35 | ||||
-rw-r--r-- | configure.ac | 109 |
4 files changed, 104 insertions, 50 deletions
@@ -7,6 +7,13 @@ Changelog +Daniel Stenberg (12 Jan 2009) +- Based on bug report #2498665 (http://curl.haxx.se/bug/view.cgi?id=2498665) + by Daniel Black, I've now added magic to the configure script that makes it + use pkg-config to detect gnutls details as well if the existing method + (using libgnutls-config) fails. While doing this, I cleaned up and unified + the pkg-config usage when detecting openssl and nss as well. + Daniel Stenberg (11 Jan 2009) - Karl Moerder brought the patch that creates vc9 Makefiles, and I made 'maketgz' now use the actual makefile targets to do the VC8 and VC9 diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 1013e1a37..6aa8cf784 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -44,6 +44,7 @@ This release includes the following bugfixes: o improved NSS initing o curl_easy_reset now resets more options o rare Location: follow bug with the multi interface + o the configure script can now detect gnutls with pkg-config This release includes the following known bugs: @@ -56,6 +57,6 @@ advice from friends like these: Markus Koetter, Josef Wolf, Vlad Grachov, Pawel Kierski, Igor Novoseltsev, Fred Machado, Ken Hirsch, Keshav Krity, Patrick Monnerat, Mark Karpeles, Anthony Bryan, Peter Korsgaard, Phil Lisiecki, Bas Mevissen, Rob Crittenden, - Emil Romanus, Karl Moerder + Emil Romanus, Karl Moerder, Daniel Black Thanks! (and sorry if I forgot to mention someone) diff --git a/acinclude.m4 b/acinclude.m4 index 71cf5e21a..c4b7a1395 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -5,7 +5,7 @@ # | (__| |_| | _ <| |___ # \___|\___/|_| \_\_____| # -# Copyright (C) 1998 - 2008, Daniel Stenberg, <daniel@haxx.se>, et al. +# Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. The terms @@ -3057,3 +3057,36 @@ AC_DEFUN([CURL_CHECK_WIN32_LARGEFILE], [ ;; esac ]) + +dnl CURL_CHECK_PKGCONFIG ($module) +dnl ------------------------ +dnl search for the pkg-config tool (if not cross-compiling). Set the PKGCONFIG +dnl variable to hold the path to it, or 'no' if not found/present. +dnl +dnl If pkg-config is present, check that it has info about the $module or return +dnl "no" anyway! +dnl + +AC_DEFUN([CURL_CHECK_PKGCONFIG], [ + if test x$cross_compiling != xyes; then + dnl only do pkg-config magic when not cross-compiling + AC_PATH_PROG( PKGCONFIG, pkg-config, no, $PATH:/usr/bin:/usr/local/bin) + + if test x$PKGCONFIG != xno; then + AC_MSG_CHECKING([for $1 options with pkg-config]) + dnl ask pkg-config about $1 + $PKGCONFIG --exists $1 + if test "$?" -ne "0"; then + dnl pkg-config does not have info about the given module! set the + dnl variable to 'no' + PKGCONFIG="no" + AC_MSG_RESULT([no]) + else + AC_MSG_RESULT([found]) + fi + fi + + else + PKGCONFIG="no" + fi +]) diff --git a/configure.ac b/configure.ac index 62712d0d3..4275f3325 100644 --- a/configure.ac +++ b/configure.ac @@ -5,7 +5,7 @@ # | (__| |_| | _ <| |___ # \___|\___/|_| \_\_____| # -# Copyright (C) 1998 - 2008, Daniel Stenberg, <daniel@haxx.se>, et al. +# Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. The terms @@ -1178,32 +1178,19 @@ if test X"$OPT_SSL" != Xno; then if test "$PKGTEST" = "yes"; then - dnl Detect the pkg-config tool, as it may have extra info about the - dnl openssl installation we can use. I *believe* this is what we are - dnl expected to do on really recent Redhat Linux hosts. + CURL_CHECK_PKGCONFIG(openssl) - AC_PATH_PROG( PKGCONFIG, pkg-config, no, $PATH:/usr/bin:/usr/local/bin) if test "$PKGCONFIG" != "no" ; then - AC_MSG_CHECKING([OpenSSL options with pkg-config]) + SSL_LIBS=`$PKGCONFIG --libs-only-l openssl 2>/dev/null` + SSL_LDFLAGS=`$PKGCONFIG --libs-only-L openssl 2>/dev/null` + SSL_CPPFLAGS=`$PKGCONFIG --cflags-only-I openssl 2>/dev/null` - $PKGCONFIG --exists openssl - SSL_EXISTS=$? + LIB_OPENSSL=`echo $SSL_LDFLAGS | sed -e 's/-L//g'` - if test "$SSL_EXISTS" -eq "0"; then - SSL_LIBS=`$PKGCONFIG --libs-only-l openssl 2>/dev/null` - SSL_LDFLAGS=`$PKGCONFIG --libs-only-L openssl 2>/dev/null` - SSL_CPPFLAGS=`$PKGCONFIG --cflags-only-I openssl 2>/dev/null` - - LIB_OPENSSL=`echo $SSL_LDFLAGS | sed -e 's/-L//g'` - - dnl use the values pkg-config reported - LIBS="$LIBS $SSL_LIBS" - CPPFLAGS="$CPPFLAGS $SSL_CPPFLAGS" - LDFLAGS="$LDFLAGS $SSL_LDFLAGS" - AC_MSG_RESULT([found]) - else - AC_MSG_RESULT([no]) - fi + dnl use the values pkg-config reported + LIBS="$LIBS $SSL_LIBS" + CPPFLAGS="$CPPFLAGS $SSL_CPPFLAGS" + LDFLAGS="$LDFLAGS $SSL_LDFLAGS" fi fi @@ -1544,7 +1531,7 @@ if test X"$OPENSSL_ENABLED" = X"1"; then fi dnl ---------------------------------------------------- -dnl FIX: only check for GnuTLS if OpenSSL is not enabled +dnl check for GnuTLS dnl ---------------------------------------------------- dnl Default to compiler & linker defaults for GnuTLS files & libraries. @@ -1558,29 +1545,51 @@ AC_HELP_STRING([--without-gnutls], [disable GnuTLS detection]), if test "$OPENSSL_ENABLED" != "1"; then if test X"$OPT_GNUTLS" != Xno; then + + AC_MSG_NOTICE([OPT_GNUTLS is $OPT_GNUTLS]) + + addld="" if test "x$OPT_GNUTLS" = "xyes"; then - check=`libgnutls-config --version 2>/dev/null` - if test -n "$check"; then - addlib=`libgnutls-config --libs` - addcflags=`libgnutls-config --cflags` - version=`libgnutls-config --version` - gtlsprefix=`libgnutls-config --prefix` - fi + check=`libgnutls-config --version 2>/dev/null` + if test -n "$check"; then + addlib=`libgnutls-config --libs` + addcflags=`libgnutls-config --cflags` + version=`libgnutls-config --version` + gtlslib=`libgnutls-config --prefix`/lib$libsuff + fi else addlib=`$OPT_GNUTLS/bin/libgnutls-config --libs` addcflags=`$OPT_GNUTLS/bin/libgnutls-config --cflags` version=`$OPT_GNUTLS/bin/libgnutls-config --version 2>/dev/null` - gtlsprefix=$OPT_GNUTLS - if test -z "$version"; then - version="unknown" + gtlslib=$OPT_GNUTLS/lib$libsuff + fi + + if test -z "$version"; then + CURL_CHECK_PKGCONFIG(gnutls) + + if test "$PKGCONFIG" != "no" ; then + addlib=`$PKGCONFIG --libs-only-l gnutls` + addld=`$PKGCONFIG --libs-only-L gnutls` + addcflags=`$PKGCONFIG --cflags-only-I gnutls` + version=`$PKGCONFIG --modversion gnutls` + gtlslib=`echo $addld | $SED -e 's/-L//'` fi + fi + + if test -z "$version"; then + dnl lots of efforts, still no go + version="unknown" + fi + if test -n "$addlib"; then CLEANLIBS="$LIBS" CLEANCPPFLAGS="$CPPFLAGS" + CLEADLDFLAGS="$LDFLAGS" LIBS="$LIBS $addlib" + LDFLAGS="$LDFLAGS $addld" if test "$addcflags" != "-I/usr/include"; then CPPFLAGS="$CPPFLAGS $addcflags" fi @@ -1601,14 +1610,16 @@ if test "$OPENSSL_ENABLED" != "1"; then if test "x$USE_GNUTLS" = "xyes"; then AC_MSG_NOTICE([detected GnuTLS version $version]) - dnl when shared libs were found in a path that the run-time - dnl linker doesn't search through, we need to add it to - dnl LD_LIBRARY_PATH to prevent further configure tests to fail - dnl due to this + if test -n "$gtlslib"; then + dnl when shared libs were found in a path that the run-time + dnl linker doesn't search through, we need to add it to + dnl LD_LIBRARY_PATH to prevent further configure tests to fail + dnl due to this - LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$gtlsprefix/lib$libsuff" - export LD_LIBRARY_PATH - AC_MSG_NOTICE([Added $gtlsprefix/lib$libsuff to LD_LIBRARY_PATH]) + LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$gtlslib" + export LD_LIBRARY_PATH + AC_MSG_NOTICE([Added $gtlslib to LD_LIBRARY_PATH]) + fi fi fi @@ -1633,13 +1644,15 @@ if test "$OPENSSL_ENABLED" != "1" -a "$GNUTLS_ENABLED" != "1"; then if test X"$OPT_NSS" != Xno; then if test "x$OPT_NSS" = "xyes"; then - check=`pkg-config --version 2>/dev/null` - if test -n "$check"; then - addlib=`pkg-config --libs nss` - addcflags=`pkg-config --cflags nss` - version=`pkg-config --modversion nss` - nssprefix=`pkg-config --variable=prefix nss` - fi + + CURL_CHECK_PKGCONFIG(nss) + + if test "$PKGCONFIG" != "no" ; then + addlib=`$PKGCONFIG --libs nss` + addcflags=`$PKGCONFIG --cflags nss` + version=`$PKGCONFIG --modversion nss` + nssprefix=`$PKGCONFIG --variable=prefix nss` + fi else # Without pkg-config, we'll kludge in some defaults addlib="-lssl3 -lsmime3 -lnss3 -lplds4 -lplc4 -lnspr4 -lpthread -ldl" |