From: Guus Sliepen Date: Fri, 25 Apr 2014 15:12:07 +0000 (+0200) Subject: Add an autoconf check for res_init(). X-Git-Tag: release-1.0.24~14 X-Git-Url: https://git.tinc-vpn.org/git/browse?a=commitdiff_plain;h=745a5d0d3eae05f8aa94b7948ee4c796accbb09c;p=tinc Add an autoconf check for res_init(). --- diff --git a/configure.ac b/configure.ac index 1a5113fc..000c7cf6 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 392aa7ac..fd79fdc7 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)