1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-24 17:18:48 -05:00

configure: enable IPv6 support without getaddrinfo

This makes it possible to recognize and connect to literal IPv6
addresses when `getaddrinfo` is not available, which is already the
case for the CMake build. This affects e.g. classic MinGW because it
still targets Windows 2000 by default, where `getaddrinfo` is not
available, but general IPv6 support is.

Instead of checking for `getaddrinfo`, check for `sockaddr_in6` as the
CMake build does.

Closes https://github.com/curl/curl/pull/4662
This commit is contained in:
Marcel Raad 2019-11-30 15:49:32 +01:00
parent 67a08dca27
commit 226bf21702
No known key found for this signature in database
GPG Key ID: FE4D8BC5EE1701DD

View File

@ -1203,16 +1203,23 @@ AC_HELP_STRING([--disable-ipv6],[Disable IPv6 support]),
;; ;;
esac ], esac ],
AC_TRY_RUN([ /* is AF_INET6 available? */ AC_TRY_RUN([ /* are AF_INET6 and sockaddr_in6 available? */
#include <sys/types.h> #include <sys/types.h>
#ifdef HAVE_WINSOCK2_H #ifdef HAVE_WINSOCK2_H
#include <winsock2.h> #include <winsock2.h>
#include <ws2tcpip.h>
#else #else
#include <sys/socket.h> #include <sys/socket.h>
#include <netinet/in.h>
#if defined (__TANDEM)
# include <netinet/in6.h>
#endif
#endif #endif
#include <stdlib.h> /* for exit() */ #include <stdlib.h> /* for exit() */
main() main()
{ {
struct sockaddr_in6 s;
(void)s;
if (socket(AF_INET6, SOCK_STREAM, 0) < 0) if (socket(AF_INET6, SOCK_STREAM, 0) < 0)
exit(1); exit(1);
else else
@ -1227,8 +1234,12 @@ main()
ipv6=yes ipv6=yes
)) ))
# Check if struct sockaddr_in6 have sin6_scope_id member
if test "$ipv6" = yes; then if test "$ipv6" = yes; then
curl_ipv6_msg="enabled"
AC_DEFINE(ENABLE_IPV6, 1, [Define if you want to enable IPv6 support])
IPV6_ENABLED=1
AC_SUBST(IPV6_ENABLED)
AC_MSG_CHECKING([if struct sockaddr_in6 has sin6_scope_id member]) AC_MSG_CHECKING([if struct sockaddr_in6 has sin6_scope_id member])
AC_TRY_COMPILE([ AC_TRY_COMPILE([
#include <sys/types.h> #include <sys/types.h>
@ -4052,15 +4063,6 @@ AC_CHECK_FUNCS([fnmatch \
fi fi
]) ])
if test "$ipv6" = "yes"; then
if test "$curl_cv_func_getaddrinfo" = "yes"; then
AC_DEFINE(ENABLE_IPV6, 1, [Define if you want to enable IPv6 support])
IPV6_ENABLED=1
AC_SUBST(IPV6_ENABLED)
curl_ipv6_msg="enabled"
fi
fi
CURL_CHECK_NONBLOCKING_SOCKET CURL_CHECK_NONBLOCKING_SOCKET
dnl ************************************************************ dnl ************************************************************