aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYang Tse <yangsita@gmail.com>2008-10-30 17:45:47 +0000
committerYang Tse <yangsita@gmail.com>2008-10-30 17:45:47 +0000
commit33319f5d2d0063b311fd2945a3eb409fdddec842 (patch)
tree25d9c21dbe5cd5c1cb19b0aa1deffa18419e23f7
parentad3c1c37bb9a81e86274ba09dd42d1d7f5b62f75 (diff)
check for freeaddrinfo() at configuration phase
-rw-r--r--ares/configure.ac1
-rw-r--r--ares/m4/cares-functions.m498
-rw-r--r--configure.ac1
-rw-r--r--m4/curl-functions.m498
4 files changed, 196 insertions, 2 deletions
diff --git a/ares/configure.ac b/ares/configure.ac
index 125d47a57..641a83e3e 100644
--- a/ares/configure.ac
+++ b/ares/configure.ac
@@ -553,6 +553,7 @@ CURL_CHECK_FUNC_RECVFROM
CURL_CHECK_FUNC_SEND
CURL_CHECK_MSG_NOSIGNAL
+CARES_CHECK_FUNC_FREEADDRINFO
CARES_CHECK_FUNC_GETADDRINFO
CARES_CHECK_FUNC_GETHOSTNAME
CARES_CHECK_FUNC_GETSERVBYPORT_R
diff --git a/ares/m4/cares-functions.m4 b/ares/m4/cares-functions.m4
index 8fc25a6d7..98bd070f0 100644
--- a/ares/m4/cares-functions.m4
+++ b/ares/m4/cares-functions.m4
@@ -16,7 +16,7 @@
#***************************************************************************
# File version for 'aclocal' use. Keep it a single number.
-# serial 17
+# serial 18
dnl CARES_INCLUDES_ARPA_INET
@@ -230,6 +230,102 @@ cares_includes_ws2tcpip="\
])
+dnl CARES_CHECK_FUNC_FREEADDRINFO
+dnl -------------------------------------------------
+dnl Verify if freeaddrinfo 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_freeaddrinfo, then
+dnl HAVE_FREEADDRINFO will be defined.
+
+AC_DEFUN([CARES_CHECK_FUNC_FREEADDRINFO], [
+ AC_REQUIRE([CARES_INCLUDES_WS2TCPIP])dnl
+ AC_REQUIRE([CARES_INCLUDES_SYS_SOCKET])dnl
+ AC_REQUIRE([CARES_INCLUDES_NETDB])dnl
+ #
+ tst_links_freeaddrinfo="unknown"
+ tst_proto_freeaddrinfo="unknown"
+ tst_compi_freeaddrinfo="unknown"
+ tst_allow_freeaddrinfo="unknown"
+ #
+ AC_MSG_CHECKING([if freeaddrinfo can be linked])
+ AC_LINK_IFELSE([
+ AC_LANG_PROGRAM([[
+ $cares_includes_ws2tcpip
+ $cares_includes_sys_socket
+ $cares_includes_netdb
+ ]],[[
+ freeaddrinfo(0);
+ ]])
+ ],[
+ AC_MSG_RESULT([yes])
+ tst_links_freeaddrinfo="yes"
+ ],[
+ AC_MSG_RESULT([no])
+ tst_links_freeaddrinfo="no"
+ ])
+ #
+ if test "$tst_links_freeaddrinfo" = "yes"; then
+ AC_MSG_CHECKING([if freeaddrinfo is prototyped])
+ AC_EGREP_CPP([freeaddrinfo],[
+ $cares_includes_ws2tcpip
+ $cares_includes_sys_socket
+ $cares_includes_netdb
+ ],[
+ AC_MSG_RESULT([yes])
+ tst_proto_freeaddrinfo="yes"
+ ],[
+ AC_MSG_RESULT([no])
+ tst_proto_freeaddrinfo="no"
+ ])
+ fi
+ #
+ if test "$tst_proto_freeaddrinfo" = "yes"; then
+ AC_MSG_CHECKING([if freeaddrinfo is compilable])
+ AC_COMPILE_IFELSE([
+ AC_LANG_PROGRAM([[
+ $cares_includes_ws2tcpip
+ $cares_includes_sys_socket
+ $cares_includes_netdb
+ ]],[[
+ freeaddrinfo(0);
+ ]])
+ ],[
+ AC_MSG_RESULT([yes])
+ tst_compi_freeaddrinfo="yes"
+ ],[
+ AC_MSG_RESULT([no])
+ tst_compi_freeaddrinfo="no"
+ ])
+ fi
+ #
+ if test "$tst_compi_freeaddrinfo" = "yes"; then
+ AC_MSG_CHECKING([if freeaddrinfo usage allowed])
+ if test "x$cares_disallow_freeaddrinfo" != "xyes"; then
+ AC_MSG_RESULT([yes])
+ tst_allow_freeaddrinfo="yes"
+ else
+ AC_MSG_RESULT([no])
+ tst_allow_freeaddrinfo="no"
+ fi
+ fi
+ #
+ AC_MSG_CHECKING([if freeaddrinfo might be used])
+ if test "$tst_links_freeaddrinfo" = "yes" &&
+ test "$tst_proto_freeaddrinfo" = "yes" &&
+ test "$tst_compi_freeaddrinfo" = "yes" &&
+ test "$tst_allow_freeaddrinfo" = "yes"; then
+ AC_MSG_RESULT([yes])
+ AC_DEFINE_UNQUOTED(HAVE_FREEADDRINFO, 1,
+ [Define to 1 if you have the freeaddrinfo function.])
+ ac_cv_func_freeaddrinfo="yes"
+ else
+ AC_MSG_RESULT([no])
+ ac_cv_func_freeaddrinfo="no"
+ fi
+])
+
+
dnl CARES_CHECK_FUNC_GETADDRINFO
dnl -------------------------------------------------
dnl Verify if getaddrinfo is available, prototyped, can
diff --git a/configure.ac b/configure.ac
index 30be28ea0..56251b0eb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2015,6 +2015,7 @@ CURL_CHECK_MSG_NOSIGNAL
CURL_CHECK_FUNC_ALARM
CURL_CHECK_FUNC_FDOPEN
+CURL_CHECK_FUNC_FREEADDRINFO
CURL_CHECK_FUNC_FTRUNCATE
CURL_CHECK_FUNC_GETADDRINFO
CURL_CHECK_FUNC_GETHOSTBYADDR_R
diff --git a/m4/curl-functions.m4 b/m4/curl-functions.m4
index edf88cb6b..619b9e11f 100644
--- a/m4/curl-functions.m4
+++ b/m4/curl-functions.m4
@@ -22,7 +22,7 @@
#***************************************************************************
# File version for 'aclocal' use. Keep it a single number.
-# serial 32
+# serial 33
dnl CURL_INCLUDES_ARPA_INET
@@ -498,6 +498,102 @@ AC_DEFUN([CURL_CHECK_FUNC_FDOPEN], [
])
+dnl CURL_CHECK_FUNC_FREEADDRINFO
+dnl -------------------------------------------------
+dnl Verify if freeaddrinfo 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 curl_disallow_freeaddrinfo, then
+dnl HAVE_FREEADDRINFO will be defined.
+
+AC_DEFUN([CURL_CHECK_FUNC_FREEADDRINFO], [
+ AC_REQUIRE([CURL_INCLUDES_WS2TCPIP])dnl
+ AC_REQUIRE([CURL_INCLUDES_SYS_SOCKET])dnl
+ AC_REQUIRE([CURL_INCLUDES_NETDB])dnl
+ #
+ tst_links_freeaddrinfo="unknown"
+ tst_proto_freeaddrinfo="unknown"
+ tst_compi_freeaddrinfo="unknown"
+ tst_allow_freeaddrinfo="unknown"
+ #
+ AC_MSG_CHECKING([if freeaddrinfo can be linked])
+ AC_LINK_IFELSE([
+ AC_LANG_PROGRAM([[
+ $curl_includes_ws2tcpip
+ $curl_includes_sys_socket
+ $curl_includes_netdb
+ ]],[[
+ freeaddrinfo(0);
+ ]])
+ ],[
+ AC_MSG_RESULT([yes])
+ tst_links_freeaddrinfo="yes"
+ ],[
+ AC_MSG_RESULT([no])
+ tst_links_freeaddrinfo="no"
+ ])
+ #
+ if test "$tst_links_freeaddrinfo" = "yes"; then
+ AC_MSG_CHECKING([if freeaddrinfo is prototyped])
+ AC_EGREP_CPP([freeaddrinfo],[
+ $curl_includes_ws2tcpip
+ $curl_includes_sys_socket
+ $curl_includes_netdb
+ ],[
+ AC_MSG_RESULT([yes])
+ tst_proto_freeaddrinfo="yes"
+ ],[
+ AC_MSG_RESULT([no])
+ tst_proto_freeaddrinfo="no"
+ ])
+ fi
+ #
+ if test "$tst_proto_freeaddrinfo" = "yes"; then
+ AC_MSG_CHECKING([if freeaddrinfo is compilable])
+ AC_COMPILE_IFELSE([
+ AC_LANG_PROGRAM([[
+ $curl_includes_ws2tcpip
+ $curl_includes_sys_socket
+ $curl_includes_netdb
+ ]],[[
+ freeaddrinfo(0);
+ ]])
+ ],[
+ AC_MSG_RESULT([yes])
+ tst_compi_freeaddrinfo="yes"
+ ],[
+ AC_MSG_RESULT([no])
+ tst_compi_freeaddrinfo="no"
+ ])
+ fi
+ #
+ if test "$tst_compi_freeaddrinfo" = "yes"; then
+ AC_MSG_CHECKING([if freeaddrinfo usage allowed])
+ if test "x$curl_disallow_freeaddrinfo" != "xyes"; then
+ AC_MSG_RESULT([yes])
+ tst_allow_freeaddrinfo="yes"
+ else
+ AC_MSG_RESULT([no])
+ tst_allow_freeaddrinfo="no"
+ fi
+ fi
+ #
+ AC_MSG_CHECKING([if freeaddrinfo might be used])
+ if test "$tst_links_freeaddrinfo" = "yes" &&
+ test "$tst_proto_freeaddrinfo" = "yes" &&
+ test "$tst_compi_freeaddrinfo" = "yes" &&
+ test "$tst_allow_freeaddrinfo" = "yes"; then
+ AC_MSG_RESULT([yes])
+ AC_DEFINE_UNQUOTED(HAVE_FREEADDRINFO, 1,
+ [Define to 1 if you have the freeaddrinfo function.])
+ ac_cv_func_freeaddrinfo="yes"
+ else
+ AC_MSG_RESULT([no])
+ ac_cv_func_freeaddrinfo="no"
+ fi
+])
+
+
dnl CURL_CHECK_FUNC_FTRUNCATE
dnl -------------------------------------------------
dnl Verify if ftruncate is available, prototyped, and