Commit 9e0ced27 authored by Daniel Salzman's avatar Daniel Salzman

utils: add libidn2 support with libidn fallback

parent ca55e82b
......@@ -452,21 +452,28 @@ AS_IF([test "$enable_daemon" = "yes" -o "$enable_utilities" = "yes"], [
dnl Check for libidn.
AC_ARG_WITH(libidn,
AC_HELP_STRING([--with-libidn=[DIR]], [Support IDN (needs GNU Libidn)]),
with_libidn=$withval,
with_libidn=yes
)
AS_IF([test "$enable_utilities" = "yes"],[
AS_IF([test "$with_libidn" != "no"],[
PKG_CHECK_MODULES([libidn], [libidn >= 0.0.0], [
AC_HELP_STRING([--with-libidn=[DIR]], [Support IDN (needs GNU libidn2 or libidn)]),
with_libidn=$withval,
with_libidn=yes
)
AS_IF([test "$enable_utilities" = "yes"], [
AS_IF([test "$with_libidn" != "no"], [
PKG_CHECK_MODULES([libidn2], [libidn2 >= 0.0.0], [
with_libidn=yes
AC_DEFINE([LIBIDN], [1], [Define to 1 to enable IDN support])
AC_DEFINE([LIBIDN_HEADER], [<idn2.h>], [Define to proper libidn header])
], [
PKG_CHECK_MODULES([libidn], [libidn >= 0.0.0], [
with_libidn=yes
AC_DEFINE([LIBIDN], [1], [Define to 1 to enable IDN support])
],[
AC_DEFINE([LIBIDN_HEADER], [<idna.h>], [Define to proper libidn header])
], [
with_libidn=no
AC_MSG_WARN([libidn not found])
])])
AC_MSG_WARN([libidn2 or libidn not found])
])
])
])
]) # Knot DNS utilities dependencies
AC_SEARCH_LIBS([pow], [m])
......
......@@ -222,8 +222,8 @@ libknotus_la_SOURCES = \
utils/common/token.c \
utils/common/token.h
libknotus_la_CPPFLAGS = $(AM_CPPFLAGS) $(CFLAG_VISIBILITY) $(libidn_CFLAGS) $(libedit_CFLAGS) $(gnutls_CFLAGS)
libknotus_la_LDFLAGS = $(AM_LDFLAGS) $(libidn_LIBS) $(LDFLAG_EXCLUDE_LIBS)
libknotus_la_CPPFLAGS = $(AM_CPPFLAGS) $(CFLAG_VISIBILITY) $(libidn2_LIBS) $(libidn_CFLAGS) $(libedit_CFLAGS) $(gnutls_CFLAGS)
libknotus_la_LDFLAGS = $(AM_LDFLAGS) $(libidn2_LIBS) $(libidn_LIBS) $(LDFLAG_EXCLUDE_LIBS)
libknotus_la_LIBADD = libcontrib.la libknot.la
libknotd_la_SOURCES = \
......
/* Copyright (C) 2016 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
/* Copyright (C) 2017 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......@@ -21,7 +21,7 @@
#include <sys/socket.h>
#ifdef LIBIDN
#include <idna.h>
#include LIBIDN_HEADER
#endif
#include "utils/common/params.h"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment