AC_CHECK_FUNCS([])
+# --- BIND 9 libdns / libisc ---------------------------------------------
+
+# uv is BIND 9.20's event loop backend; OpenSSL for crypto/TLS;
+# pthread for the netmgr; dl for dlopen used by plugins/dst.
+PKG_CHECK_MODULES([LIBUV], [libuv])
+PKG_CHECK_MODULES([OPENSSL], [openssl])
+AX_PTHREAD([], [AC_MSG_ERROR([pthread support is required])])
+
+# libisc and libdns themselves — no .pc files, so link-test directly.
+# Order matters: libdns depends on libisc.
+BIND_LIBS="-ldns -lisc $LIBUV_LIBS $OPENSSL_LIBS $PTHREAD_LIBS -ldl"
+
+saved_LIBS="$LIBS"
+LIBS="$BIND_LIBS $LIBS"
+AC_MSG_CHECKING([whether libdns/libisc link])
+AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <isc/mem.h>
+ #include <dns/xfrin.h>]],
+ [[isc_mem_t *m = NULL; (void)dns_xfrin_shutdown; (void)m;]])],
+ [AC_MSG_RESULT([yes])],
+ [AC_MSG_RESULT([no])
+ AC_MSG_ERROR([cannot link against libdns/libisc])])
+LIBS="$saved_LIBS"
+
+AC_SUBST([BIND_LIBS])
+AC_SUBST([BIND_CFLAGS], ["$LIBUV_CFLAGS $OPENSSL_CFLAGS $PTHREAD_CFLAGS"])
+
AC_CONFIG_FILES([
Makefile
])