Andreas Metzler <ametz...@downhill.at.eu.org> writes:

> The package's ./configure script is trying to invoke libgnutls-config
> and/or libgnutls-extra-config to search for the gnutls library. Newer
> version of gnutls do not ship these scripts anymore.

I'll push the following patch to elinks-0.12 in the weekend if
nobody objects.  And then perhaps a separate one to mention the
pkg-config dependency in doc/installation.txt.

From aed0cd5e1b1ed3043fe409619d5a832b39895496 Mon Sep 17 00:00:00 2001
From: Kalle Olavi Niemitalo <k...@iki.fi>
Date: Thu, 21 May 2009 22:52:57 +0300
Subject: [PATCH] Debian bug 529821: Use pkg-config, not libgnutls-config

The configure script used to run libgnutls-config in order to find the
compiler and linker options needed for using GNUTLS, but GNUTLS 2.7
apparently doesn't ship that script any more.  Use pkg-config instead.
GNUTLS 1.2.0 is the oldest version supported by ELinks, and that already
installs the gnutls.pc file required by pkg-config.

This commit also removes support for configure --with-gnutls=DIR.
The configure script used to look for libgnutls-config in DIR.
DIR thus had to be a directory where executable programs were installed,
and it's unlikely that gnutls.pc would be found there.  So, any callers
that used this feature would have to be changed anyway, and they can as
well be changed to set the PKG_CONFIG_PATH environment variable instead.
---
 NEWS         |    2 +
 configure.in |  110 +++++++++++++++++++++++++--------------------------------
 2 files changed, 50 insertions(+), 62 deletions(-)

diff --git a/NEWS b/NEWS
index 7a7ecc5..4b7a894 100644
--- a/NEWS
+++ b/NEWS
@@ -14,6 +14,8 @@ includes the changes listed under ``ELinks 0.11.6.GIT now'' 
below.
 * critical bug 1071: Fix crash in get_dom_node_child.
 * Debian build bug 526349: Include asciidoc.py from AsciiDoc 7.1.2,
   to remove all dependencies on the installed version.
+* Debian build bug 529821: Use ``pkg-config gnutls'' instead of
+  ``libgnutls-config'', which is not included in GNUTLS 2.7.x.
 * build enhancement: Recognize ``configure --without-tre''.
 
 ELinks 0.12pre3:
diff --git a/configure.in b/configure.in
index 46cbb9a..d2af322 100644
--- a/configure.in
+++ b/configure.in
@@ -1004,15 +1004,14 @@ disable_openssl=""
 disable_gnutls=""
 enable_gnutls=""
 
-AC_ARG_WITH(gnutls, [  --without-gnutls        disable GNUTLS SSL support],
-           [if test "$with_gnutls" = no;  then disable_gnutls=yes; fi])
-AC_ARG_WITH(gnutls, [[  --with-gnutls[=DIR]     enable GNUTLS SSL support]],
-           [if test "$with_gnutls" != no;  then enable_gnutls=yes; fi])
-gnutls_withval="$withval"
-
-if test "$enable_gnutls" = yes; then
-       disable_openssl=yes;
-fi
+AC_ARG_WITH(gnutls, [[  --without-gnutls        disable GNUTLS SSL support]])
+AC_ARG_WITH(gnutls, [[  --with-gnutls           enable GNUTLS SSL support]],
+           [case "$with_gnutls" in
+               "no") disable_gnutls=yes;;
+               "yes") enable_gnutls=yes; disable_openssl=yes;;
+               *) AC_MSG_WARN([[Support for --with-gnutls=DIR has been removed.
+You may have to set the PKG_CONFIG_PATH environment variable instead.]]);;
+            esac])
 
 AC_ARG_WITH(openssl, [  --without-openssl       disable OpenSSL support],
            [if test "$with_openssl" = no;  then disable_openssl=yes; fi])
@@ -1071,68 +1070,55 @@ AC_MSG_RESULT($cf_result)
 
 CONFIG_GNUTLS_OPENSSL_COMPAT=no
 # ---- GNU TLS
-dnl We can't have AC_MSG_CHECKING here, because AC_PATH_PROG prints its own and
-dnl it looks ugly then.
-
 if test "$cf_result" = yes; then
-       cf_result="not used"
-
-else
-       EL_SAVE_FLAGS
-       cf_result="no"
+       AC_MSG_CHECKING([[for GNUTLS]])
+       AC_MSG_RESULT([[not used, because OpenSSL was chosen]])
 
-       if test -z "$disable_gnutls"; then
-               # Sure, we maybe _could_ use their macro, but how to ensure
-               # that the ./configure script won't fail if the macro won't be
-               # found..? :( --pasky
+elif test -n "$disable_gnutls"; then
+       AC_MSG_CHECKING([[for GNUTLS]])
+       AC_MSG_RESULT([[explicitly disabled]])
 
-               GNUTLS_PATH="$PATH:/usr/local/gnutls:/opt:/opt/gnutls"
-
-               if test -d "$gnutls_withval"; then
-                       GNUTLS_PATH="$gnutls_withval:$GNUTLS_PATH"
-               fi
-
-               AC_PATH_PROG(LIBGNUTLS_CONFIG, libgnutls-config, no, 
$GNUTLS_PATH)
-
-               if test "$LIBGNUTLS_CONFIG" = "no" ; then
-                       cf_result=no
-               else
-                       GNUTLS_CFLAGS=`$LIBGNUTLS_CONFIG --cflags`
-                       GNUTLS_LIBS=`$LIBGNUTLS_CONFIG --libs`
-
-                       LIBS="$GNUTLS_LIBS $LIBS_X"
-                       CFLAGS="$CFLAGS_X $GNUTLS_CFLAGS"
-                       CPPFLAGS="$CPPFLAGS_X $GNUTLS_CFLAGS"
-
-                       # Verify if it's really usable.  gnutls_session was
-                       # renamed to gnutls_session_t before GNU TLS 1.2.0
-                       # (on 2004-06-13); ELinks now requires this.
-                       AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include 
<gnutls/gnutls.h>]], [[gnutls_session_t dummy;
-                                    
gnutls_check_version(NULL)]])],[cf_result=yes],[cf_result=no])
-               fi
+else
+       cf_result=no
+       AC_MSG_CHECKING([[for GNUTLS (1.2 or later) in pkg-config]])
+       if pkg-config --atleast-version=1.2 gnutls; then
+               GNUTLS_CFLAGS=`pkg-config --cflags gnutls`
+               GNUTLS_LIBS=`pkg-config --libs gnutls`
+               AC_MSG_RESULT([[yes: $GNUTLS_CFLAGS $GNUTLS_LIBS]])
+
+               # Verify if it's really usable.  gnutls_session was
+               # renamed to gnutls_session_t before GNU TLS 1.2.0
+               # (on 2004-06-13); ELinks now requires this.
+               AC_MSG_CHECKING([[whether GNUTLS can be linked with]])
+               EL_SAVE_FLAGS
+               LIBS="$GNUTLS_LIBS $LIBS"
+               CFLAGS="$CFLAGS $GNUTLS_CFLAGS"
+               CPPFLAGS="$CPPFLAGS $GNUTLS_CFLAGS"
+               AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <gnutls/gnutls.h>]],
+                                               [[gnutls_session_t dummy;
+                                                 
gnutls_check_version(NULL)]])],
+                              [cf_result=yes],
+                              [cf_result=no])
+               EL_RESTORE_FLAGS
+       fi
+       # This can match either AC_MSG_CHECKING above.  A bit hacky...
+       AC_MSG_RESULT([[$cf_result]])
 
-               if test "$cf_result" = yes; then
-                       EL_CONFIG(CONFIG_GNUTLS, [GNUTLS])
+       if test "$cf_result" = yes; then
+               EL_CONFIG(CONFIG_GNUTLS, [GNUTLS])
 
-                       CFLAGS="$CFLAGS_X"
-                       AC_SUBST(GNUTLS_CFLAGS)
+               LIBS="$GNUTLS_LIBS $LIBS"
+               AC_SUBST(GNUTLS_CFLAGS)
 
-                       # GnuTLS 2.2.0 changed libgnutls-openssl from GPLv2+
-                       # to GPLv3+.  Don't link that with the GPLv2 ELinks.
-                       # ELinks will use its internal MD5 code instead.
-                       CONFIG_GNUTLS_OPENSSL_COMPAT=no
-               else
-                       if test -n "$gnutls_withval" && test "x$gnutls_withval" 
!= xno; then
-                               AC_MSG_ERROR([GNUTLS (1.2 or later) not found.  
ELinks no longer supports GNUTLS 1.1.])
-                       fi
-                       EL_RESTORE_FLAGS
-               fi
+               # GnuTLS 2.2.0 changed libgnutls-openssl from GPLv2+
+               # to GPLv3+.  Don't link that with the GPLv2 ELinks.
+               # ELinks will use its internal MD5 code instead.
+               CONFIG_GNUTLS_OPENSSL_COMPAT=no
+       elif test "${with_gnutls-no}" != "no"; then
+               AC_MSG_ERROR([[GNUTLS (1.2 or later) not found.  ELinks no 
longer supports GNUTLS 1.1.]])
        fi
 fi
 
-AC_MSG_CHECKING([for GNU TLS (1.2 or later)])
-AC_MSG_RESULT($cf_result)
-
 # Final SSL setup
 
 EL_CONFIG_DEPENDS(CONFIG_SSL, [CONFIG_OPENSSL CONFIG_GNUTLS], [SSL])
-- 
1.6.2.5.13.g7f975

Attachment: pgpJWJHmIrVUi.pgp
Description: PGP signature

_______________________________________________
elinks-dev mailing list
elinks-dev@linuxfromscratch.org
http://linuxfromscratch.org/mailman/listinfo/elinks-dev

Reply via email to