diff options
author | Alexander Vladishev <aleksander.vladishev@zabbix.com> | 2009-12-22 19:00:30 +0300 |
---|---|---|
committer | Alexander Vladishev <aleksander.vladishev@zabbix.com> | 2009-12-22 19:00:30 +0300 |
commit | 5c0b541527e636956c81dd306f8e76531e1c5437 (patch) | |
tree | ba34b462f9950698782fe6386fe36f527fa9ae43 /m4 | |
parent | 2b499d3e5602910886b26c071f1758a4f4ca2a87 (diff) |
- [ZBX-479] fixed compilation of ZABBIX agent under Mac OS/X
[svn merge svn://svn.zabbix.com/branches/1.8 -r8845:8851]
Diffstat (limited to 'm4')
-rw-r--r-- | m4/resolv.m4 | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/m4/resolv.m4 b/m4/resolv.m4 new file mode 100644 index 00000000000..26c654aa599 --- /dev/null +++ b/m4/resolv.m4 @@ -0,0 +1,62 @@ +# LIBRESOLV_CHECK_CONFIG ([DEFAULT-ACTION]) +# ---------------------------------------------------------- +# Aleksander Vladishev Dec-16-2009 +# +# Checks for DNS functions. + +AC_DEFUN([LIBRESOLV_TRY_LINK], +[ +am_save_LIBS="$LIBS" +LIBS="$LIBS $1" +AC_TRY_LINK( +[ +#ifdef HAVE_SYS_TYPES_H +# include <sys/types.h> +#endif +#ifdef HAVE_NETINET_IN_H +# include <netinet/in.h> +#endif +#ifdef HAVE_ARPA_NAMESER_H +# include <arpa/nameser.h> +#endif +#ifdef HAVE_RESOLV_H +# include <resolv.h> +#endif +], +[ + char *buf; + + res_init(); + res_query("", ns_c_in, ns_t_soa, buf, 0); +], +found_resolv="yes" +RESOLV_LIBS="$1") +LIBS="$am_save_LIBS" +])dnl + +AC_DEFUN([LIBRESOLV_CHECK_CONFIG], +[ + AC_MSG_CHECKING(for DNS lookup functions) + + LIBRESOLV_TRY_LINK([]) + + if test "x$found_resolv" != "xyes"; then + LIBRESOLV_TRY_LINK([-lresolv]) + fi + if test "x$found_resolv" != "xyes"; then + LIBRESOLV_TRY_LINK([-lbind]) + fi + if test "x$found_resolv" != "xyes"; then + LIBRESOLV_TRY_LINK([-lsocket]) + fi + + if test "x$found_resolv" = "xyes"; then + AC_DEFINE([HAVE_RES_QUERY], 1, [Define to 1 if you have the DNS functions]) + else + AC_MSG_RESULT(no) + fi + + AC_MSG_RESULT($found_resolv) + + AC_SUBST(RESOLV_LIBS) +])dnl |