diff --git a/configure.ac b/configure.ac index 9369e55..17a9e1d 100644 --- a/configure.ac +++ b/configure.ac @@ -199,19 +199,31 @@ AM_CONDITIONAL(USE_GNUTLS, test x$enable_ssl = xGnuTLS) dnl +-------------------------------------------------------------------+ dnl | Checking for libasyncns | dnl +-------------------------------------------------------------------+ -AC_ARG_WITH(asyncns, [ --with-asyncns=yes/no define whether to use libasyncns, default=no], - ac_asyncns=$withval, - ac_asyncns=no - ) +AC_ARG_WITH(asyncns, + AS_HELP_STRING([--with-asyncns], + [define whether to use libasyncns, @<:@default=no@:>@ (internal/system/no)]), + ac_asyncns=$withval, + ac_asyncns=no) enable_asyncns=no +have_asyncns_system=no if test x$ac_asyncns != xno; then enable_asyncns=yes AC_DEFINE(HAVE_ASYNCNS, 1, [Whether to use libasyncns]) + + if test x$ac_asyncns = xsystem; then + PKG_CHECK_MODULES(ASYNCNS, [libasyncns >= 0.3], + [have_asyncns_system=yes], + [have_asyncns_system=no]) + fi else echo "Not using asynchronous dns lookups" fi +AC_SUBST(ASYNCNS_CFLAGS) +AC_SUBST(ASYNCNS_LIBS) +AM_CONDITIONAL(USE_SYSTEM_ASYNCNS, test x$have_asyncns_system = xyes) + dnl +-------------------------------------------------------------------+ dnl | Checking for Linux TCP/IP stack | dnl +-------------------------------------------------------------------+ diff --git a/loudmouth/Makefile.am b/loudmouth/Makefile.am index f73aa0c..e308e1c 100644 --- a/loudmouth/Makefile.am +++ b/loudmouth/Makefile.am @@ -6,6 +6,7 @@ AM_CPPFLAGS = \ -I. \ -I$(top_srcdir) \ $(LOUDMOUTH_CFLAGS) \ + $(ASYNCNS_CFLAGS) \ $(LIBIDN_CFLAGS) \ -DLM_COMPILATION \ -DRUNTIME_ENDIAN \ @@ -51,8 +52,6 @@ libloudmouth_1_la_SOURCES = \ lm-sock.c \ lm-socket.c \ lm-socket.h \ - asyncns.c \ - asyncns.h \ lm-sasl.c \ lm-sasl.h \ md5.c \ @@ -61,6 +60,13 @@ libloudmouth_1_la_SOURCES = \ base64.h \ $(NULL) +if ! USE_SYSTEM_ASYNCNS +libloudmouth_1_la_SOURCES += \ + asyncns.c \ + asyncns.h \ + $(NULL) +endif + libloudmouthinclude_HEADERS = \ lm-connection.h \ lm-error.h \ @@ -75,6 +81,7 @@ libloudmouthinclude_HEADERS = \ libloudmouth_1_la_LIBADD = \ $(LOUDMOUTH_LIBS) \ + $(ASYNCNS_LIBS) \ $(LIBIDN_LIBS) \ -lresolv