+AC_ARG_WITH([adns],
+ AS_HELP_STRING([--with-adns],
+ [use ADNS library for background name resolution]),
+ [want_adns=$withval],
+ [want_adns=auto])
+case $want_adns in
+ no) ;;
+ *) AC_CHECK_LIB([adns], [adns_submit], [have_adns=yes], [have_adns=no]) ;;
+esac
+AC_SUBST([ADNS_LIBS])
+case $want_adns,$have_adns in
+ yes,no)
+ AC_MSG_ERROR([ADNS library not found but explicitly requested])
+ ;;
+ yes,yes | auto,yes)
+ ADNS_LIBS="-ladns"
+ AC_DEFINE([HAVE_LIBADNS], [1],
+ [Define if the GNU adns library is available.])
+ ;;
+esac
+