autoconf-deal-with-res-search-as-macro-20030428
[openafs.git] / src / cf / ressearch.m4
1 AC_DEFUN(AC_FUNC_RES_SEARCH, [
2   ac_cv_func_res_search=no
3   AC_TRY_LINK([
4 #include <sys/types.h>
5 #include <netinet/in.h>
6 #include <arpa/nameser.h>
7 #include <resolv.h>],
8   [
9 const char host[11]="openafs.org";
10 u_char ans[1024];
11 int r;
12 res_init();
13 /* Capture result in r but return 0, since a working nameserver is
14  * not a requirement for compilation.
15  */
16 r =  res_search( host, C_IN, T_MX, (u_char *)&ans, sizeof(ans));
17 return 0;
18 res_close();
19   ],
20   ac_cv_func_res_search=yes)
21 ])