7326edb1135127cd88adf7284844b524a39d52aa
[openafs.git] / src / cf / ressearch.m4
1 AC_DEFUN([AC_CHECK_RESOLV_RETRANS],[
2   AC_CACHE_CHECK([for retransmit support in res_state],
3     [ac_cv_res_retransretry],[
4     AC_TRY_COMPILE( [
5 #include <sys/types.h>
6 #if defined(__sun__)
7 #include <inet/ip.h>
8 #endif
9 #include <netinet/in.h>
10 #include <resolv.h>
11 ],[
12     _res.retrans = 2;
13     _res.retry = 1;
14 ],
15       [ac_cv_res_retransretry="yes"],
16       [ac_cv_res_retransretry="no"])
17   ])
18   AS_IF([test "$ac_cv_res_retransretry" = "yes"],
19         [AC_DEFINE([HAVE_RES_RETRANSRETRY], 1,
20            [Define if resolv.h's res_state has the fields retrans/retry])
21   ])
22 ])
23
24 AC_DEFUN([AC_FUNC_RES_SEARCH], [
25   ac_cv_func_res_search=no
26   AC_TRY_LINK([
27 #include <sys/types.h>
28 #include <netinet/in.h>
29 #include <arpa/nameser.h>
30 #ifdef HAVE_ARPA_NAMESER_COMPAT_H
31 #include <arpa/nameser_compat.h>
32 #endif
33 #include <resolv.h>],
34   [
35 const char host[11]="openafs.org";
36 u_char ans[1024];
37 int r;
38 res_init();
39 /* Capture result in r but return 0, since a working nameserver is
40  * not a requirement for compilation.
41  */
42 r =  res_search( host, C_IN, T_MX, (u_char *)&ans, sizeof(ans));
43 return 0;
44   ],
45   ac_cv_func_res_search=yes)
46 ])