Skip to content

Commit

Permalink
Autodetect libidn/libidn2 support with pkg-config
Browse files Browse the repository at this point in the history
libidn2 >= 2.0.3 must be used, or else it would silently remove
characters not valid in hostnames like "/" and "_".
For details see #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
  • Loading branch information
rfc1036 committed Aug 22, 2017
1 parent a786e83 commit e20b8bb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
14 changes: 6 additions & 8 deletions Makefile
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion debian/rules
Expand Up @@ -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:
Expand Down

0 comments on commit e20b8bb

Please sign in to comment.