Commit b9fdc0c2 authored by Daniel Stenberg's avatar Daniel Stenberg
Browse files

- 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.
parent f471b483
Loading
Loading
Loading
Loading
+7 −0
Original line number Original line Diff line number Diff line
@@ -7,6 +7,13 @@
                                  Changelog
                                  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)
Daniel Stenberg (11 Jan 2009)
- Karl Moerder brought the patch that creates vc9 Makefiles, and I made
- 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
  'maketgz' now use the actual makefile targets to do the VC8 and VC9
+2 −1
Original line number Original line Diff line number Diff line
@@ -44,6 +44,7 @@ This release includes the following bugfixes:
 o improved NSS initing
 o improved NSS initing
 o curl_easy_reset now resets more options
 o curl_easy_reset now resets more options
 o rare Location: follow bug with the multi interface
 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:
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,
 Markus Koetter, Josef Wolf, Vlad Grachov, Pawel Kierski, Igor Novoseltsev,
 Fred Machado, Ken Hirsch, Keshav Krity, Patrick Monnerat, Mark Karpeles,
 Fred Machado, Ken Hirsch, Keshav Krity, Patrick Monnerat, Mark Karpeles,
 Anthony Bryan, Peter Korsgaard, Phil Lisiecki, Bas Mevissen, Rob Crittenden,
 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)
        Thanks! (and sorry if I forgot to mention someone)
+34 −1
Original line number Original line Diff line number Diff line
@@ -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
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# you should have received as part of this distribution. The terms
@@ -3057,3 +3057,36 @@ AC_DEFUN([CURL_CHECK_WIN32_LARGEFILE], [
      ;;
      ;;
  esac
  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
])
+61 −48
Original line number Original line Diff line number Diff line
@@ -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
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# you should have received as part of this distribution. The terms
@@ -1178,18 +1178,9 @@ if test X"$OPT_SSL" != Xno; then


  if test "$PKGTEST" = "yes"; then
  if test "$PKGTEST" = "yes"; then


    dnl Detect the pkg-config tool, as it may have extra info about the
    CURL_CHECK_PKGCONFIG(openssl)
    dnl openssl installation we can use. I *believe* this is what we are
    dnl expected to do on really recent Redhat Linux hosts.


    AC_PATH_PROG( PKGCONFIG, pkg-config, no, $PATH:/usr/bin:/usr/local/bin)
    if test "$PKGCONFIG" != "no" ; then
    if test "$PKGCONFIG" != "no" ; then
      AC_MSG_CHECKING([OpenSSL options with pkg-config])

      $PKGCONFIG --exists openssl
      SSL_EXISTS=$?

      if test "$SSL_EXISTS" -eq "0"; then
      SSL_LIBS=`$PKGCONFIG --libs-only-l openssl 2>/dev/null`
      SSL_LIBS=`$PKGCONFIG --libs-only-l openssl 2>/dev/null`
      SSL_LDFLAGS=`$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`
      SSL_CPPFLAGS=`$PKGCONFIG --cflags-only-I openssl 2>/dev/null`
@@ -1200,10 +1191,6 @@ if test X"$OPT_SSL" != Xno; then
      LIBS="$LIBS $SSL_LIBS"
      LIBS="$LIBS $SSL_LIBS"
      CPPFLAGS="$CPPFLAGS $SSL_CPPFLAGS"
      CPPFLAGS="$CPPFLAGS $SSL_CPPFLAGS"
      LDFLAGS="$LDFLAGS $SSL_LDFLAGS"
      LDFLAGS="$LDFLAGS $SSL_LDFLAGS"
        AC_MSG_RESULT([found])
      else
        AC_MSG_RESULT([no])
      fi
    fi
    fi
  fi
  fi


@@ -1544,7 +1531,7 @@ if test X"$OPENSSL_ENABLED" = X"1"; then
fi
fi


dnl ----------------------------------------------------
dnl ----------------------------------------------------
dnl FIX: only check for GnuTLS if OpenSSL is not enabled
dnl check for GnuTLS
dnl ----------------------------------------------------
dnl ----------------------------------------------------


dnl Default to compiler & linker defaults for GnuTLS files & libraries.
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 "$OPENSSL_ENABLED" != "1"; then


  if test X"$OPT_GNUTLS" != Xno; then
  if test X"$OPT_GNUTLS" != Xno; then

    AC_MSG_NOTICE([OPT_GNUTLS is $OPT_GNUTLS])

    addld=""
    if test "x$OPT_GNUTLS" = "xyes"; then
    if test "x$OPT_GNUTLS" = "xyes"; then
      check=`libgnutls-config --version 2>/dev/null`
      check=`libgnutls-config --version 2>/dev/null`
      if test -n "$check"; then
      if test -n "$check"; then
        addlib=`libgnutls-config --libs`
        addlib=`libgnutls-config --libs`
        addcflags=`libgnutls-config --cflags`
        addcflags=`libgnutls-config --cflags`
        version=`libgnutls-config --version`
        version=`libgnutls-config --version`
       gtlsprefix=`libgnutls-config --prefix`
        gtlslib=`libgnutls-config --prefix`/lib$libsuff
      fi
      fi
    else
    else
      addlib=`$OPT_GNUTLS/bin/libgnutls-config --libs`
      addlib=`$OPT_GNUTLS/bin/libgnutls-config --libs`
      addcflags=`$OPT_GNUTLS/bin/libgnutls-config --cflags`
      addcflags=`$OPT_GNUTLS/bin/libgnutls-config --cflags`
      version=`$OPT_GNUTLS/bin/libgnutls-config --version 2>/dev/null`
      version=`$OPT_GNUTLS/bin/libgnutls-config --version 2>/dev/null`
      gtlsprefix=$OPT_GNUTLS
      gtlslib=$OPT_GNUTLS/lib$libsuff
    fi

    if test -z "$version"; then
    if test -z "$version"; then
        version="unknown"
      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
    fi

    if test -z "$version"; then
      dnl lots of efforts, still no go
      version="unknown"
    fi
    fi

    if test -n "$addlib"; then
    if test -n "$addlib"; then


      CLEANLIBS="$LIBS"
      CLEANLIBS="$LIBS"
      CLEANCPPFLAGS="$CPPFLAGS"
      CLEANCPPFLAGS="$CPPFLAGS"
      CLEADLDFLAGS="$LDFLAGS"


      LIBS="$LIBS $addlib"
      LIBS="$LIBS $addlib"
      LDFLAGS="$LDFLAGS $addld"
      if test "$addcflags" != "-I/usr/include"; then
      if test "$addcflags" != "-I/usr/include"; then
         CPPFLAGS="$CPPFLAGS $addcflags"
         CPPFLAGS="$CPPFLAGS $addcflags"
      fi
      fi
@@ -1601,14 +1610,16 @@ if test "$OPENSSL_ENABLED" != "1"; then
      if test "x$USE_GNUTLS" = "xyes"; then
      if test "x$USE_GNUTLS" = "xyes"; then
        AC_MSG_NOTICE([detected GnuTLS version $version])
        AC_MSG_NOTICE([detected GnuTLS version $version])


        if test -n "$gtlslib"; then
          dnl when shared libs were found in a path that the run-time
          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 linker doesn't search through, we need to add it to
          dnl LD_LIBRARY_PATH to prevent further configure tests to fail
          dnl LD_LIBRARY_PATH to prevent further configure tests to fail
          dnl due to this
          dnl due to this


        LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$gtlsprefix/lib$libsuff"
          LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$gtlslib"
          export LD_LIBRARY_PATH
          export LD_LIBRARY_PATH
        AC_MSG_NOTICE([Added $gtlsprefix/lib$libsuff to LD_LIBRARY_PATH])
          AC_MSG_NOTICE([Added $gtlslib to LD_LIBRARY_PATH])
        fi
      fi
      fi


    fi
    fi
@@ -1633,12 +1644,14 @@ if test "$OPENSSL_ENABLED" != "1" -a "$GNUTLS_ENABLED" != "1"; then


  if test X"$OPT_NSS" != Xno; then
  if test X"$OPT_NSS" != Xno; then
    if test "x$OPT_NSS" = "xyes"; then
    if test "x$OPT_NSS" = "xyes"; then
     check=`pkg-config --version 2>/dev/null`

     if test -n "$check"; then
      CURL_CHECK_PKGCONFIG(nss)
       addlib=`pkg-config --libs nss`

       addcflags=`pkg-config --cflags nss`
      if test "$PKGCONFIG" != "no" ; then
       version=`pkg-config --modversion nss`
        addlib=`$PKGCONFIG --libs nss`
       nssprefix=`pkg-config --variable=prefix nss`
        addcflags=`$PKGCONFIG --cflags nss`
        version=`$PKGCONFIG --modversion nss`
        nssprefix=`$PKGCONFIG --variable=prefix nss`
      fi
      fi
    else
    else
      # Without pkg-config, we'll kludge in some defaults
      # Without pkg-config, we'll kludge in some defaults