Check whether res_init() really lives in libresolv.
authorGuus Sliepen <guus@tinc-vpn.org>
Mon, 22 Dec 2014 17:17:11 +0000 (18:17 +0100)
committerGuus Sliepen <guus@tinc-vpn.org>
Mon, 22 Dec 2014 17:17:11 +0000 (18:17 +0100)
On some platforms (Mac OS X for example), the res_init() function requires
linking with libresolv. On others (Linux, OpenBSD for example), res_init()
lives in libc.

configure.ac

index b43bec8..85df11e 100644 (file)
@@ -202,7 +202,7 @@ AC_CHECK_DECLS([freeaddrinfo, gai_strerror, getaddrinfo, getnameinfo],
   [], [], [#include "src/have.h"]
 )
 
   [], [], [#include "src/have.h"]
 )
 
-AC_CHECK_DECLS([res_init], [LIBS="$LIBS -lresolv"], [], [
+AC_CHECK_DECLS([res_init], [AC_CHECK_LIB(resolv, res_init)], [], [
   #include <netinet/in.h>
   #include <resolv.h>
 ])
   #include <netinet/in.h>
   #include <resolv.h>
 ])