]> granicus.if.org Git - curl/commitdiff
check for freeaddrinfo() at configuration phase
authorYang Tse <yangsita@gmail.com>
Thu, 30 Oct 2008 17:45:47 +0000 (17:45 +0000)
committerYang Tse <yangsita@gmail.com>
Thu, 30 Oct 2008 17:45:47 +0000 (17:45 +0000)
ares/configure.ac
ares/m4/cares-functions.m4
configure.ac
m4/curl-functions.m4

index 125d47a57623dde782e29aeac69bc214939f63df..641a83e3e1ec18b7a2af1268f3702f32b2d116bb 100644 (file)
@@ -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
index 8fc25a6d7421efb22d35bd9e0317daa985ac18a7..98bd070f0de707d0d529483e41146e7145249926 100644 (file)
@@ -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
index 30be28ea0d61e6f16cae4a5afbd1e7cab8c0476e..56251b0eb81344cf4175850b3eec7c2fa6e5b666 100644 (file)
@@ -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
index edf88cb6bd192ccadaf3696334159f239a08cecc..619b9e11fdafcb0119efcf5d5ba2cae413dbae31 100644 (file)
@@ -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