From 2d971e7172e51aca4ff8ccd02cfabdaf1b8fb5fc Mon Sep 17 00:00:00 2001 From: Marko Kreen Date: Mon, 29 Nov 2010 18:03:10 +0200 Subject: [PATCH] dnslookup: --enable-evdns arg to configure --- configure.ac | 11 +++++++++++ include/dnslookup.h | 18 ------------------ src/dnslookup.c | 23 ++++++++++++++++------- 3 files changed, 27 insertions(+), 25 deletions(-) diff --git a/configure.ac b/configure.ac index ccc01a0..f6302e3 100644 --- a/configure.ac +++ b/configure.ac @@ -75,6 +75,17 @@ AC_CHECK_FUNCS(crypt lstat) dnl Find libevent AC_USUAL_LIBEVENT +use_evdns=no +AC_ARG_ENABLE(evdns, AC_HELP_STRING([--enable-evdns],[Use libevent for DNS lookups]), + [use_evdns=yes]) +AC_MSG_CHECKING([whether to use libevent for DNS lookups]) +if test "$use_evdns" = "yes"; then + AC_DEFINE(USE_EVDNS, 1, [Use libevent for DNS lookups.]) + AC_MSG_RESULT([yes]) +else + AC_MSG_RESULT([no]) +fi + AC_USUAL_DEBUG AC_USUAL_CASSERT AC_USUAL_WERROR diff --git a/include/dnslookup.h b/include/dnslookup.h index 28459ff..b497449 100644 --- a/include/dnslookup.h +++ b/include/dnslookup.h @@ -16,24 +16,6 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#if 1 - -/* pick dns implementation */ -#ifdef EV_ET -#define USE_LIBEVENT2 -#else -#ifdef HAVE_GETADDRINFO_A -#define USE_GETADDRINFO_A -#else -#define USE_LIBEVENT1 -#endif -#endif - -#else -#define USE_LIBEVENT2 -#endif - - struct DNSContext; struct DNSToken; diff --git a/src/dnslookup.c b/src/dnslookup.c index a639e85..ac136a2 100644 --- a/src/dnslookup.c +++ b/src/dnslookup.c @@ -24,21 +24,30 @@ * libevent2 - does not return TTL, uses hosts file. */ -#ifdef USE_GETADDRINFO_A +#include + +#ifndef USE_EVDNS + /* getaddrinfo_a */ -#include -#include -#endif +#define USE_GETADDRINFO_A -#ifdef USE_LIBEVENT2 +#else + +#ifdef EV_ET + +/* libevent 2 */ +#define USE_LIBEVENT2 #include #define addrinfo evutil_addrinfo #define freeaddrinfo evutil_freeaddrinfo -#endif -#ifdef USE_LIBEVENT1 +#else + /* libevent 1 */ +#define USE_LIBEVENT1 #include + +#endif #endif -- 2.50.1