let gnutls use libidn2

Gnutls is supposed to be able to detect and use libidn2, but it
tries to do this without pkg-config, in a way that doesn't
consider transitive dependencies. Using pkg-config with libidn2.pc
seems to work okay with MXE's version of libidn2.
This commit is contained in:
Mark Brand 2017-05-08 00:22:46 +02:00
parent b326d3fd7b
commit 49fee79736
2 changed files with 60 additions and 2 deletions

View File

@ -69,3 +69,61 @@ index 1111111..2222222 100644
+Libs.private: @LIBZ_PC@ @LIBINTL@ @LIBSOCKET@ @LIBNSL@ @LIBPTHREAD@ @LIB_SELECT@ @TSS_LIBS@ @GMP_LIBS@ -lunistring -liconv @LIBIDN2_LIBS@ -lcrypt32
@GNUTLS_REQUIRES_PRIVATE@
Cflags: -I${includedir}
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Mark Brand <mabrand@mabrand.nl>
Date: Sun, 7 May 2017 20:17:13 +0200
Subject: [PATCH] let gnutls configure detect libidn2
diff --git a/configure.ac b/configure.ac
index 1111111..2222222 100644
--- a/configure.ac
+++ b/configure.ac
@@ -483,24 +483,19 @@ with_libidn=no
if test "$try_libidn" = yes;then
if test "$try_libidn2" = yes;then
- AC_SEARCH_LIBS(idn2_lookup_u8, idn2, [
- with_libidn2=yes;
+ PKG_CHECK_MODULES(LIBIDN2, libidn2, [with_libidn2=yes], [with_libidn2=no])
+ if test "$with_libidn2" != "no";then
idna_support="IDNA 2008 (libidn2)"
+
AC_DEFINE([HAVE_LIBIDN2], 1, [Define if IDNA 2008 support is enabled.])
- AC_SUBST([LIBIDN_LIBS], [-lidn2])
- AC_SUBST([LIBIDN2_LIBS], [-lidn2]) dnl used in gnutls.pc.in
-dnl enable once libidn2.pc is widespread; and remove LIBIDN2_LIBS from gnutls.pc.in (Libs.private)
-dnl if test "x$GNUTLS_REQUIRES_PRIVATE" = "x"; then
-dnl GNUTLS_REQUIRES_PRIVATE="Requires.private: libidn2"
-dnl else
-dnl GNUTLS_REQUIRES_PRIVATE="${GNUTLS_REQUIRES_PRIVATE}, libidn2"
-dnl fi
- ],[
- with_libidn2=no;
+ if test "x$GNUTLS_REQUIRES_PRIVATE" = "x"; then
+ GNUTLS_REQUIRES_PRIVATE="Requires.private: libidn2"
+ else
+ GNUTLS_REQUIRES_PRIVATE="${GNUTLS_REQUIRES_PRIVATE}, libidn2"
+ fi
+ else
AC_MSG_WARN(*** LIBIDN2 was not found. You will not be able to use IDN2008 support)
- ])
- else
- with_libidn2=no
+ fi
fi
if test "$with_libidn2" = "no"; then
diff --git a/lib/gnutls.pc.in b/lib/gnutls.pc.in
index 1111111..2222222 100644
--- a/lib/gnutls.pc.in
+++ b/lib/gnutls.pc.in
@@ -19,6 +19,6 @@ Description: Transport Security Layer implementation for the GNU system
URL: http://www.gnutls.org/
Version: @VERSION@
Libs: -L${libdir} -lgnutls
-Libs.private: @LIBZ_PC@ @LIBINTL@ @LIBSOCKET@ @LIBNSL@ @LIBPTHREAD@ @LIB_SELECT@ @TSS_LIBS@ @GMP_LIBS@ -lunistring -liconv @LIBIDN2_LIBS@ -lcrypt32
+Libs.private: @LIBZ_PC@ @LIBINTL@ @LIBSOCKET@ @LIBNSL@ @LIBPTHREAD@ @LIB_SELECT@ @TSS_LIBS@ @GMP_LIBS@ -lunistring -liconv -lcrypt32
@GNUTLS_REQUIRES_PRIVATE@
Cflags: -I${includedir}

View File

@ -9,7 +9,7 @@ $(PKG)_SUBDIR := gnutls-$($(PKG)_VERSION)
$(PKG)_FILE := gnutls-$($(PKG)_VERSION).tar.xz
$(PKG)_URL := https://gnupg.org/ftp/gcrypt/gnutls/v3.5/$($(PKG)_FILE)
$(PKG)_URL_2 := ftp://ftp.gnutls.org/gcrypt/gnutls/v3.5/$($(PKG)_FILE)
$(PKG)_DEPS := gcc gettext gmp libgnurx libidn libunistring nettle zlib
$(PKG)_DEPS := gcc gettext gmp libgnurx libidn2 libunistring nettle zlib
define $(PKG)_UPDATE
$(WGET) -q -O- https://gnupg.org/ftp/gcrypt/gnutls/v3.5/ | \
@ -21,7 +21,7 @@ endef
define $(PKG)_BUILD
# AI_ADDRCONFIG referenced by src/serv.c but not provided by mingw.
# Value taken from https://msdn.microsoft.com/en-us/library/windows/desktop/ms737530%28v=vs.85%29.aspx
cd '$(1)' && ./configure \
cd '$(1)' && autoreconf -fi && ./configure \
$(MXE_CONFIGURE_OPTS) \
--disable-rpath \
--disable-nls \