autoconf-deal-with-res-search-as-macro-20030428
[openafs.git] / src / cf / ressearch.m4
diff --git a/src/cf/ressearch.m4 b/src/cf/ressearch.m4
new file mode 100644 (file)
index 0000000..2094a4f
--- /dev/null
@@ -0,0 +1,21 @@
+AC_DEFUN(AC_FUNC_RES_SEARCH, [
+  ac_cv_func_res_search=no
+  AC_TRY_LINK([
+#include <sys/types.h>
+#include <netinet/in.h>
+#include <arpa/nameser.h>
+#include <resolv.h>],
+  [
+const char host[11]="openafs.org";
+u_char ans[1024];
+int r;
+res_init();
+/* Capture result in r but return 0, since a working nameserver is
+ * not a requirement for compilation.
+ */
+r =  res_search( host, C_IN, T_MX, (u_char *)&ans, sizeof(ans));
+return 0;
+res_close();
+  ],
+  ac_cv_func_res_search=yes)
+])
\ No newline at end of file