From e20b8bbab3687aa26294bc3c443b4a43292b7636 Mon Sep 17 00:00:00 2001 From: Marco d'Itri Date: Tue, 22 Aug 2017 18:35:12 +0200 Subject: [PATCH] Autodetect libidn/libidn2 support with pkg-config libidn2 >= 2.0.3 must be used, or else it would silently remove characters not valid in hostnames like "/" and "_". For details see https://github.com/rfc1036/whois/issues/50 . For more information about IDNA2003 vs. IDNA2008 and TR46 see: http://nmav.gnutls.org/2017/04/the-mess-with-internationalized-domain.html http://unicode.org/faq/idn.html https://fedoraproject.org/wiki/Changes/IDNA2008 --- Makefile | 14 ++++++-------- debian/rules | 2 +- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 74ccb00..c52bf06 100644 --- a/Makefile +++ b/Makefile @@ -32,14 +32,12 @@ ifdef LOCALEDIR DEFS += -DLOCALEDIR=\"$(BASEDIR)$(prefix)/share/locale\" endif -ifdef HAVE_LIBIDN2 -whois_LDADD += -lidn2 -DEFS += -DHAVE_LIBIDN2 -else -ifdef HAVE_LIBIDN -whois_LDADD += -lidn -DEFS += -DHAVE_LIBIDN -endif +ifeq ($(shell pkg-config --exists 'libidn2 >= 2.0.3' || echo NO),) +whois_LDADD += $(shell pkg-config --libs libidn2) +DEFS += -DHAVE_LIBIDN2 $(shell pkg-config --cflags libidn2) +else ifeq ($(shell pkg-config --exists 'libidn' || echo NO),) +whois_LDADD += $(shell pkg-config --libs libidn) +DEFS += -DHAVE_LIBIDN $(shell pkg-config --cflags libidn) endif ifdef HAVE_ICONV diff --git a/debian/rules b/debian/rules index 179a446..fa9c899 100755 --- a/debian/rules +++ b/debian/rules @@ -16,7 +16,7 @@ D := $(CURDIR)/debian/whois build: dh_testdir - $(MAKE) CONFIG_FILE="/etc/whois.conf" HAVE_LIBIDN=1 HAVE_ICONV=1 + $(MAKE) CONFIG_FILE="/etc/whois.conf" HAVE_ICONV=1 touch $@ clean: