1# LIBRESOLV_CHECK_CONFIG ([DEFAULT-ACTION]) 2# ---------------------------------------------------------- 3# Alexander Vladishev Dec-16-2009 4# 5# Checks for DNS functions. 6 7AC_DEFUN([LIBRESOLV_TRY_LINK], 8[ 9am_save_LIBS="$LIBS" 10LIBS="$LIBS $1" 11AC_TRY_LINK( 12[ 13#ifdef HAVE_SYS_TYPES_H 14# include <sys/types.h> 15#endif 16#ifdef HAVE_NETINET_IN_H 17# include <netinet/in.h> 18#endif 19#ifdef HAVE_ARPA_NAMESER_H 20# include <arpa/nameser.h> 21#endif 22#ifdef HAVE_RESOLV_H 23# include <resolv.h> 24#endif 25#ifndef C_IN 26# define C_IN ns_c_in 27#endif /* C_IN */ 28#ifndef T_SOA 29# define T_SOA ns_t_soa 30#endif /* T_SOA */ 31], 32[ 33 char *buf; 34 35 res_init(); 36 res_query("", C_IN, T_SOA, buf, 0); 37], 38found_resolv="yes" 39RESOLV_LIBS="$1") 40LIBS="$am_save_LIBS" 41])dnl 42 43AC_DEFUN([LIBRESOLV_CHECK_CONFIG], 44[ 45 AC_MSG_CHECKING(for DNS lookup functions) 46 47 LIBRESOLV_TRY_LINK([]) 48 49 if test "x$found_resolv" != "xyes"; then 50 LIBRESOLV_TRY_LINK([-lresolv]) 51 fi 52 if test "x$found_resolv" != "xyes"; then 53 LIBRESOLV_TRY_LINK([-lbind]) 54 fi 55 if test "x$found_resolv" != "xyes"; then 56 LIBRESOLV_TRY_LINK([-lsocket]) 57 fi 58 59 if test "x$found_resolv" = "xyes"; then 60 AC_DEFINE([HAVE_RES_QUERY], 1, [Define to 1 if you have the DNS functions]) 61 else 62 AC_MSG_RESULT(no) 63 fi 64 65 AC_MSG_RESULT($found_resolv) 66 67 AC_SUBST(RESOLV_LIBS) 68])dnl 69