m4/resolv.m4
55144c47
 dnl AC_C_DNS
 dnl Checks resolv.h presence and usability
 dnl Checks for specific lresolv exports
 dnl Checks for lresolve reentrance
 dnl
 dnl Note using AC_LINK_IFELSE instead of AC_CHECK_LIB
 dnl as symbols are often redefined in resolv.h
 
 AC_DEFUN([AC_C_DNS], [
 
 AC_ARG_ENABLE([dns],
5e395b1f
     [AC_HELP_STRING([--disable-dns], [do not include support for database verification through DNS])],
55144c47
     [want_dns=$enableval], [want_dns=yes]
 )
 if test $want_dns = yes; then
80ecc71e
     ac_cv_have_lresolv=no
55144c47
     AC_CHECK_HEADER([resolv.h],
 	[
80ecc71e
 	    AC_CACHE_CHECK([for dn_expand in std libs], [ac_cv_have_lresolv_std], [
 	    	ac_cv_have_lresolv_std='no'
9ac67a47
 	        AC_LINK_IFELSE([AC_LANG_SOURCE([
80ecc71e
 #include <sys/types.h>
 #include <netinet/in.h>
 #include <arpa/nameser.h>
 #include <resolv.h>
f7e2294c
 int main() { return (long)dn_expand; }
9ac67a47
 		])],
80ecc71e
 		[
 		    ac_cv_have_lresolv_std='yes'
 		    ac_cv_have_lresolv=''
 		])
 	    ])
 	    if test "x$ac_cv_have_lresolv" = "xno"; then
 	    bklibs=$LIBS
 	    LIBS=-lresolv
 	    AC_CACHE_CHECK([for dn_expand in -lresolv], [ac_cv_have_lresolv_lresolv], [
 		ac_cv_have_lresolv_lresolv='yes'
9ac67a47
 		AC_LINK_IFELSE([AC_LANG_SOURCE([
55144c47
 #include <sys/types.h>
 #include <netinet/in.h>
 #include <arpa/nameser.h>
 #include <resolv.h>
f7e2294c
 int main() { return (long)dn_expand; }
9ac67a47
     	     	])],
55144c47
 		[
80ecc71e
 		    ac_cv_have_lresolv_lresolv='yes'
 		    ac_cv_have_lresolv=' -lresolv'
55144c47
 		])
 	    ])
 	    LIBS=$bklibs;
80ecc71e
 	    fi
55144c47
 	],
80ecc71e
 	[ ac_cv_have_lresolv=no ],
55144c47
 	[
 #include <sys/types.h>
 #include <netinet/in.h>
 #include <arpa/nameser.h>
     ])
80ecc71e
     if test "x$ac_cv_have_lresolv" != "xno"; then
     	FRESHCLAM_LIBS="$FRESHCLAM_LIBS$ac_cv_have_lresolv"
55144c47
 	AC_DEFINE([HAVE_RESOLV_H],1,[have resolv.h])
     else
 	AC_MSG_WARN([****** DNS support disabled])
     fi
 fi
 
 ])