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
This commit is contained in:
Marco d'Itri 2017-08-22 18:35:12 +02:00
parent a786e83add
commit e20b8bbab3
2 changed files with 7 additions and 9 deletions

View File

@ -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

2
debian/rules vendored
View File

@ -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: