summaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorYang Tse <yangsita@gmail.com>2008-11-18 01:57:29 +0000
committerYang Tse <yangsita@gmail.com>2008-11-18 01:57:29 +0000
commitd3609a98e599c241ac0650cba7e524be471f3ce5 (patch)
treeabaed4d058175cee72a56c9ac545ef106b5911a9 /m4
parentb0b6a7c8aad5b6013e5e18ba0c4ea0952d472644 (diff)
downloadc-ares-d3609a98e599c241ac0650cba7e524be471f3ce5.tar.gz
c-ares-d3609a98e599c241ac0650cba7e524be471f3ce5.tar.bz2
c-ares-d3609a98e599c241ac0650cba7e524be471f3ce5.zip
check for gethostbyaddr and gethostbyname as it is done for other functions
Diffstat (limited to 'm4')
-rw-r--r--m4/cares-functions.m4190
1 files changed, 189 insertions, 1 deletions
diff --git a/m4/cares-functions.m4 b/m4/cares-functions.m4
index bfc2c0b..5cfc35a 100644
--- a/m4/cares-functions.m4
+++ b/m4/cares-functions.m4
@@ -16,7 +16,7 @@
#***************************************************************************
# File version for 'aclocal' use. Keep it a single number.
-# serial 25
+# serial 26
dnl CARES_INCLUDES_ARPA_INET
@@ -667,6 +667,194 @@ AC_DEFUN([CARES_CHECK_FUNC_GETADDRINFO], [
])
+dnl CARES_CHECK_FUNC_GETHOSTBYADDR
+dnl -------------------------------------------------
+dnl Verify if gethostbyaddr is available, prototyped,
+dnl and can be compiled. If all of these are true,
+dnl and usage has not been previously disallowed with
+dnl shell variable cares_disallow_gethostbyaddr, then
+dnl HAVE_GETHOSTBYADDR will be defined.
+
+AC_DEFUN([CARES_CHECK_FUNC_GETHOSTBYADDR], [
+ AC_REQUIRE([CARES_INCLUDES_WINSOCK2])dnl
+ AC_REQUIRE([CARES_INCLUDES_NETDB])dnl
+ #
+ tst_links_gethostbyaddr="unknown"
+ tst_proto_gethostbyaddr="unknown"
+ tst_compi_gethostbyaddr="unknown"
+ tst_allow_gethostbyaddr="unknown"
+ #
+ AC_MSG_CHECKING([if gethostbyaddr can be linked])
+ AC_LINK_IFELSE([
+ AC_LANG_PROGRAM([[
+ $cares_includes_winsock2
+ $cares_includes_netdb
+ ]],[[
+ if(0 != gethostbyaddr(0, 0, 0))
+ return 1;
+ ]])
+ ],[
+ AC_MSG_RESULT([yes])
+ tst_links_gethostbyaddr="yes"
+ ],[
+ AC_MSG_RESULT([no])
+ tst_links_gethostbyaddr="no"
+ ])
+ #
+ if test "$tst_links_gethostbyaddr" = "yes"; then
+ AC_MSG_CHECKING([if gethostbyaddr is prototyped])
+ AC_EGREP_CPP([gethostbyaddr],[
+ $cares_includes_winsock2
+ $cares_includes_netdb
+ ],[
+ AC_MSG_RESULT([yes])
+ tst_proto_gethostbyaddr="yes"
+ ],[
+ AC_MSG_RESULT([no])
+ tst_proto_gethostbyaddr="no"
+ ])
+ fi
+ #
+ if test "$tst_proto_gethostbyaddr" = "yes"; then
+ AC_MSG_CHECKING([if gethostbyaddr is compilable])
+ AC_COMPILE_IFELSE([
+ AC_LANG_PROGRAM([[
+ $cares_includes_winsock2
+ $cares_includes_netdb
+ ]],[[
+ if(0 != gethostbyaddr(0, 0, 0))
+ return 1;
+ ]])
+ ],[
+ AC_MSG_RESULT([yes])
+ tst_compi_gethostbyaddr="yes"
+ ],[
+ AC_MSG_RESULT([no])
+ tst_compi_gethostbyaddr="no"
+ ])
+ fi
+ #
+ if test "$tst_compi_gethostbyaddr" = "yes"; then
+ AC_MSG_CHECKING([if gethostbyaddr usage allowed])
+ if test "x$cares_disallow_gethostbyaddr" != "xyes"; then
+ AC_MSG_RESULT([yes])
+ tst_allow_gethostbyaddr="yes"
+ else
+ AC_MSG_RESULT([no])
+ tst_allow_gethostbyaddr="no"
+ fi
+ fi
+ #
+ AC_MSG_CHECKING([if gethostbyaddr might be used])
+ if test "$tst_links_gethostbyaddr" = "yes" &&
+ test "$tst_proto_gethostbyaddr" = "yes" &&
+ test "$tst_compi_gethostbyaddr" = "yes" &&
+ test "$tst_allow_gethostbyaddr" = "yes"; then
+ AC_MSG_RESULT([yes])
+ AC_DEFINE_UNQUOTED(HAVE_GETHOSTBYADDR, 1,
+ [Define to 1 if you have the gethostbyaddr function.])
+ ac_cv_func_gethostbyaddr="yes"
+ else
+ AC_MSG_RESULT([no])
+ ac_cv_func_gethostbyaddr="no"
+ fi
+])
+
+
+dnl CARES_CHECK_FUNC_GETHOSTBYNAME
+dnl -------------------------------------------------
+dnl Verify if gethostbyname is available, prototyped,
+dnl and can be compiled. If all of these are true,
+dnl and usage has not been previously disallowed with
+dnl shell variable cares_disallow_gethostbyname, then
+dnl HAVE_GETHOSTBYNAME will be defined.
+
+AC_DEFUN([CARES_CHECK_FUNC_GETHOSTBYNAME], [
+ AC_REQUIRE([CARES_INCLUDES_WINSOCK2])dnl
+ AC_REQUIRE([CARES_INCLUDES_NETDB])dnl
+ #
+ tst_links_gethostbyname="unknown"
+ tst_proto_gethostbyname="unknown"
+ tst_compi_gethostbyname="unknown"
+ tst_allow_gethostbyname="unknown"
+ #
+ AC_MSG_CHECKING([if gethostbyname can be linked])
+ AC_LINK_IFELSE([
+ AC_LANG_PROGRAM([[
+ $cares_includes_winsock2
+ $cares_includes_netdb
+ ]],[[
+ if(0 != gethostbyname(0))
+ return 1;
+ ]])
+ ],[
+ AC_MSG_RESULT([yes])
+ tst_links_gethostbyname="yes"
+ ],[
+ AC_MSG_RESULT([no])
+ tst_links_gethostbyname="no"
+ ])
+ #
+ if test "$tst_links_gethostbyname" = "yes"; then
+ AC_MSG_CHECKING([if gethostbyname is prototyped])
+ AC_EGREP_CPP([gethostbyname],[
+ $cares_includes_winsock2
+ $cares_includes_netdb
+ ],[
+ AC_MSG_RESULT([yes])
+ tst_proto_gethostbyname="yes"
+ ],[
+ AC_MSG_RESULT([no])
+ tst_proto_gethostbyname="no"
+ ])
+ fi
+ #
+ if test "$tst_proto_gethostbyname" = "yes"; then
+ AC_MSG_CHECKING([if gethostbyname is compilable])
+ AC_COMPILE_IFELSE([
+ AC_LANG_PROGRAM([[
+ $cares_includes_winsock2
+ $cares_includes_netdb
+ ]],[[
+ if(0 != gethostbyname(0))
+ return 1;
+ ]])
+ ],[
+ AC_MSG_RESULT([yes])
+ tst_compi_gethostbyname="yes"
+ ],[
+ AC_MSG_RESULT([no])
+ tst_compi_gethostbyname="no"
+ ])
+ fi
+ #
+ if test "$tst_compi_gethostbyname" = "yes"; then
+ AC_MSG_CHECKING([if gethostbyname usage allowed])
+ if test "x$cares_disallow_gethostbyname" != "xyes"; then
+ AC_MSG_RESULT([yes])
+ tst_allow_gethostbyname="yes"
+ else
+ AC_MSG_RESULT([no])
+ tst_allow_gethostbyname="no"
+ fi
+ fi
+ #
+ AC_MSG_CHECKING([if gethostbyname might be used])
+ if test "$tst_links_gethostbyname" = "yes" &&
+ test "$tst_proto_gethostbyname" = "yes" &&
+ test "$tst_compi_gethostbyname" = "yes" &&
+ test "$tst_allow_gethostbyname" = "yes"; then
+ AC_MSG_RESULT([yes])
+ AC_DEFINE_UNQUOTED(HAVE_GETHOSTBYNAME, 1,
+ [Define to 1 if you have the gethostbyname function.])
+ ac_cv_func_gethostbyname="yes"
+ else
+ AC_MSG_RESULT([no])
+ ac_cv_func_gethostbyname="no"
+ fi
+])
+
+
dnl CARES_CHECK_FUNC_GETHOSTNAME
dnl -------------------------------------------------
dnl Verify if gethostname is available, prototyped, and