From c0c0283356f288ba98e374964231007f623e84cd Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Wed, 31 Jan 2001 13:53:31 +0000 Subject: Added a check for a working getaddrinfo() that is required for the IPv6 to be considered enabled --- configure.in | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 52 insertions(+), 2 deletions(-) diff --git a/configure.in b/configure.in index ae7ca6540..052ed826c 100644 --- a/configure.in +++ b/configure.in @@ -26,6 +26,53 @@ dnl The install stuff has already been taken care of by the automake stuff dnl AC_PROG_INSTALL AC_PROG_MAKE_SET + + +dnl +dnl check for working getaddrinfo() +dnl +AC_DEFUN(CURL_CHECK_WORKING_GETADDRINFO,[ + AC_CACHE_CHECK(for working getaddrinfo, ac_cv_working_getaddrinfo,[ + AC_TRY_RUN( [ +#ifdef HAVE_NETDB_H +#include +#endif +#ifdef HAVE_STRING_H +#include +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif + +void main(void) { + struct addrinfo hints, *ai; + int error; + + memset(&hints, 0, sizeof(hints)); + hints.ai_family = AF_UNSPEC; + hints.ai_socktype = SOCK_STREAM; + error = getaddrinfo("127.0.0.1", "8080", &hints, &ai); + if (error) { + exit(1); + } + else { + exit(0); + } +} +],[ + ac_cv_working_getaddrinfo="yes" +],[ + ac_cv_working_getaddrinfo="no" +],[ + ac_cv_working_getaddrinfo="yes" +])]) +if test "$ac_cv_working_getaddrinfo" = "yes"; then + AC_DEFINE(HAVE_GETADDRINFO, 1, [Define if getaddrinfo exists and works]) + AC_DEFINE(ENABLE_IPV6, 1, [Define if you want to enable IPv6 support]) +fi +]) + + AC_DEFUN(CURL_CHECK_LOCALTIME_R, [ dnl check for a few thread-safe functions @@ -251,7 +298,6 @@ AC_ARG_ENABLE(ipv6, ipv6=no ;; *) AC_MSG_RESULT(yes) - AC_DEFINE(ENABLE_IPV6) ipv6=yes ;; esac ], @@ -268,7 +314,6 @@ main() } ], AC_MSG_RESULT(yes) - AC_DEFINE(ENABLE_IPV6) ipv6=yes, AC_MSG_RESULT(no) ipv6=no, @@ -276,6 +321,11 @@ main() ipv6=no )) +if test "$ipv6" = "yes"; then + CURL_CHECK_WORKING_GETADDRINFO +fi + + dnl ********************************************************************** dnl Checks for libraries. dnl ********************************************************************** -- cgit v1.2.3