From fcc0380588b76f4b7d1d3931b688bfe065a1e0a2 Mon Sep 17 00:00:00 2001 From: Stig Venaas Date: Sat, 17 Aug 2002 13:56:39 +0000 Subject: [PATCH] Added --enable-ipv6 and only look up AAAA in DNS when enabled --- configure.in | 10 +++++++--- main/network.c | 4 ++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/configure.in b/configure.in index 129fdfeb2c..da232b0caa 100644 --- a/configure.in +++ b/configure.in @@ -410,9 +410,6 @@ AC_CACHE_CHECK([for IPv6 support], ac_cv_ipv6_support, #include #include ], [struct sockaddr_in6 s; struct in6_addr t=in6addr_any; int i=AF_INET6; s; t.s6_addr[0] = 0;], [ac_cv_ipv6_support=yes], [ac_cv_ipv6_support=no])]) -if test "$ac_cv_ipv6_support" = yes; then - AC_DEFINE(HAVE_IPV6,1,[Whether you have IPv6 support]) -fi @@ -692,6 +689,13 @@ if test "$PHP_DMALLOC" = "yes"; then ]) fi +PHP_ARG_ENABLE(ipv6,whether to enable IPv6 support, +[ --enable-ipv6 Enable IPv6 support],yes) + +if test "$PHP_IPV6" != "no" && test "$ac_cv_ipv6_support" = yes; then + AC_DEFINE(HAVE_IPV6,1,[Whether to enable IPv6 support]) +fi + AC_CHECK_LIB(crypt, crypt, [ PHP_ADD_LIBRARY(crypt) PHP_ADD_LIBRARY(crypt, 1) diff --git a/main/network.c b/main/network.c index a4bd9b4e42..3fe7e9a152 100644 --- a/main/network.c +++ b/main/network.c @@ -157,7 +157,11 @@ static int php_network_getaddresses(const char *host, struct sockaddr ***sal) struct addrinfo hints, *res, *sai; memset(&hints, '\0', sizeof(hints)); +# ifdef HAVE_IPV6 hints.ai_family = AF_UNSPEC; +# else + hints.ai_family = AF_INET; +# endif if ((n = getaddrinfo(host, NULL, &hints, &res))) { php_error(E_WARNING, "php_network_getaddresses: getaddrinfo failed: %s", PHP_GAI_STRERROR(n)); return 0; -- 2.50.1