From 745a5d0d3eae05f8aa94b7948ee4c796accbb09c Mon Sep 17 00:00:00 2001 From: Guus Sliepen Date: Fri, 25 Apr 2014 17:12:07 +0200 Subject: [PATCH 1/1] Add an autoconf check for res_init(). --- configure.ac | 7 ++++++- src/net.c | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 1a5113f..000c7cf 100644 --- a/configure.ac +++ b/configure.ac @@ -158,7 +158,7 @@ dnl Checks for header files. dnl We do this in multiple stages, because unlike Linux all the other operating systems really suck and don't include their own dependencies. AC_HEADER_STDC -AC_CHECK_HEADERS([stdbool.h syslog.h sys/file.h sys/ioctl.h sys/mman.h sys/param.h sys/resource.h sys/socket.h sys/time.h time.h sys/uio.h sys/wait.h netdb.h arpa/inet.h dirent.h]) +AC_CHECK_HEADERS([stdbool.h syslog.h sys/file.h sys/ioctl.h sys/mman.h sys/param.h sys/resource.h sys/socket.h sys/time.h time.h sys/uio.h sys/wait.h netdb.h arpa/inet.h dirent.h resolv.h]) AC_CHECK_HEADERS([net/if.h net/if_types.h linux/if_tun.h net/if_tun.h net/tun/if_tun.h net/if_tap.h net/tap/if_tap.h net/ethernet.h net/if_arp.h netinet/in_systm.h netinet/in.h netinet/in6.h netpacket/packet.h], [], [], [#include "src/have.h"] ) @@ -202,6 +202,11 @@ AC_CHECK_DECLS([freeaddrinfo, gai_strerror, getaddrinfo, getnameinfo], [], [], [#include "src/have.h"] ) +AC_CHECK_DECLS([res_init], [], [], [ + #include + #include +]) + AC_CACHE_SAVE dnl These are defined in files in m4/ diff --git a/src/net.c b/src/net.c index 392aa7a..fd79fdc 100644 --- a/src/net.c +++ b/src/net.c @@ -40,7 +40,10 @@ #include "route.h" #include "subnet.h" #include "xalloc.h" -#include "resolv.h" + +#ifdef HAVE_RESOLV_H +#include +#endif bool do_purge = false; volatile bool running = false; @@ -495,7 +498,9 @@ int main_loop(void) { avl_node_t *node; logger(LOG_INFO, "Flushing event queue"); expire_events(); +#ifdef HAVE_DECL_RES_INIT res_init(); +#endif for(node = connection_tree->head; node; node = node->next) { connection_t *c = node->data; if(c->status.active) -- 2.25.1