configure: detect IPv6 support on Windows

This patch was "nicked" from the MINGW-packages project by Daniel.

9253d0bf58
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This commit is contained in:
Johannes Schindelin 2015-09-17 20:03:34 +02:00 committed by Daniel Stenberg
parent bd431eef04
commit c208c783f5
2 changed files with 20 additions and 1 deletions

View File

@ -1083,7 +1083,11 @@ AC_HELP_STRING([--disable-ipv6],[Disable IPv6 support]),
AC_TRY_RUN([ /* is AF_INET6 available? */ AC_TRY_RUN([ /* is AF_INET6 available? */
#include <sys/types.h> #include <sys/types.h>
#ifdef HAVE_WINSOCK2_H
#include <winsock2.h>
#else
#include <sys/socket.h> #include <sys/socket.h>
#endif
#include <stdlib.h> /* for exit() */ #include <stdlib.h> /* for exit() */
main() main()
{ {
@ -1110,7 +1114,12 @@ if test "$ipv6" = yes; then
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>
#include <netinet/in.h>] , #ifdef HAVE_WINSOCK2_H
#include <winsock2.h>
#include <ws2tcpip.h>
#else
#include <netinet/in.h>
#endif] ,
struct sockaddr_in6 s; s.sin6_scope_id = 0; , have_sin6_scope_id=yes) struct sockaddr_in6 s; s.sin6_scope_id = 0; , have_sin6_scope_id=yes)
if test "$have_sin6_scope_id" = yes; then if test "$have_sin6_scope_id" = yes; then
AC_MSG_RESULT([yes]) AC_MSG_RESULT([yes])

View File

@ -44,6 +44,10 @@ curl_includes_arpa_inet="\
#ifdef HAVE_ARPA_INET_H #ifdef HAVE_ARPA_INET_H
# include <arpa/inet.h> # include <arpa/inet.h>
#endif #endif
#ifdef HAVE_WINSOCK2_H
#include <winsock2.h>
#include <ws2tcpip.h>
#endif
/* includes end */" /* includes end */"
AC_CHECK_HEADERS( AC_CHECK_HEADERS(
sys/types.h sys/socket.h netinet/in.h arpa/inet.h, sys/types.h sys/socket.h netinet/in.h arpa/inet.h,
@ -2098,6 +2102,12 @@ AC_DEFUN([CURL_CHECK_FUNC_GETADDRINFO], [
struct addrinfo *ai = 0; struct addrinfo *ai = 0;
int error; int error;
#ifdef HAVE_WINSOCK2_H
WSADATA wsa;
if (WSAStartup(MAKEWORD(2,2), &wsa))
exit(2);
#endif
memset(&hints, 0, sizeof(hints)); memset(&hints, 0, sizeof(hints));
hints.ai_flags = AI_NUMERICHOST; hints.ai_flags = AI_NUMERICHOST;
hints.ai_family = AF_UNSPEC; hints.ai_family = AF_UNSPEC;