From 29285493764704eb59cfbb9b8ae8a4a2513d29a0 Mon Sep 17 00:00:00 2001 From: Simon Josefsson Date: Thu, 19 Jan 2006 15:45:27 +0000 Subject: [PATCH] Update. --- gl/gai_strerror.c | 6 ++++-- gl/getaddrinfo.h | 14 +++++++++++--- gl/m4/getaddrinfo.m4 | 46 ++++++++++++++++++++++++++++++---------------- gl/socket_.h | 1 + 4 files changed, 46 insertions(+), 21 deletions(-) diff --git a/gl/gai_strerror.c b/gl/gai_strerror.c index f289870..d97b858 100644 --- a/gl/gai_strerror.c +++ b/gl/gai_strerror.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1997, 2001, 2002, 2004, 2005 Free Software Foundation, Inc. +/* Copyright (C) 1997, 2001, 2002, 2004, 2005, 2006 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Philip Blundell , 1997. @@ -25,7 +25,9 @@ #endif #include -#include +#ifdef HAVE_NETDB_H +# include +#endif #ifdef _LIBC # include diff --git a/gl/getaddrinfo.h b/gl/getaddrinfo.h index 65f52cd..cc334cd 100644 --- a/gl/getaddrinfo.h +++ b/gl/getaddrinfo.h @@ -1,5 +1,5 @@ /* Get address information. - Copyright (C) 1996-2002, 2003, 2004, 2005 Free Software Foundation, Inc. + Copyright (C) 1996-2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. Contributed by Simon Josefsson . This program is free software; you can redistribute it and/or modify @@ -26,7 +26,9 @@ # include /* Get all getaddrinfo related declarations, if available. */ # include +#ifdef HAVE_NETDB_H # include +#endif # ifndef HAVE_STRUCT_ADDRINFO @@ -65,10 +67,16 @@ struct addrinfo # define EAI_FAMILY -6 /* `ai_family' not supported. */ # define EAI_SOCKTYPE -7 /* `ai_socktype' not supported. */ # define EAI_SERVICE -8 /* SERVICE not supported for `ai_socktype'. */ -# define EAI_ADDRFAMILY -9 /* Address family for NAME not supported. */ # define EAI_MEMORY -10 /* Memory allocation failure. */ -# define EAI_SYSTEM -11 /* System error returned in `errno'. */ # define EAI_OVERFLOW -12 /* Argument buffer overflow. */ +#endif +# ifndef EAI_ADDRFAMILY +/* Not define on mingw32. */ +# define EAI_ADDRFAMILY -9 /* Address family for NAME not supported. */ +# endif +# ifndef EAI_SYSTEM +/* Not define on mingw32. */ +# define EAI_SYSTEM -11 /* System error returned in `errno'. */ # endif # ifdef __USE_GNU diff --git a/gl/m4/getaddrinfo.m4 b/gl/m4/getaddrinfo.m4 index 709460d..006cdab 100644 --- a/gl/m4/getaddrinfo.m4 +++ b/gl/m4/getaddrinfo.m4 @@ -6,31 +6,29 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_GETADDRINFO], [ - AC_SEARCH_LIBS(getaddrinfo, [nsl socket]) + AC_MSG_NOTICE([checking how to do getaddrinfo]) - if test "$ac_cv_search_getaddrinfo" = "no"; then + AC_SEARCH_LIBS(getaddrinfo, [nsl socket]) + AC_CHECK_FUNCS(getaddrinfo,, [ AC_CACHE_CHECK(for getaddrinfo in ws2tcpip.h and -lws2_32, - gl_cv_getaddrinfo, [ - gl_cv_getaddrinfo=no + gl_cv_w32_getaddrinfo, [ + gl_cv_w32_getaddrinfo=no am_save_LIBS="$LIBS" LIBS="$LIBS -lws2_32" AC_TRY_LINK([ #define WINVER 0x0501 -if HAVE_WS2TCPIP_H -# include -#endif -], [getaddrinfo(0, 0, 0, 0);], gl_cv_getaddrinfo=yes) +#include +], [getaddrinfo(0, 0, 0, 0);], gl_cv_w32_getaddrinfo=yes) LIBS="$am_save_LIBS" - if test "$gl_cv_getaddrinfo" = "yes"; then + if test "$gl_cv_w32_getaddrinfo" = "yes"; then LIBS="$LIBS -lws2_32" + else + AC_LIBOBJ(getaddrinfo) fi - ]) - fi + ])]) - if test "$gl_cv_getaddrinfo" = "no"; then - AC_REPLACE_FUNCS(getaddrinfo gai_strerror) - gl_PREREQ_GETADDRINFO - fi + AC_REPLACE_FUNCS(gai_strerror) + gl_PREREQ_GETADDRINFO ]) # Prerequisites of lib/getaddrinfo.h and lib/getaddrinfo.c. @@ -41,18 +39,34 @@ AC_DEFUN([gl_PREREQ_GETADDRINFO], [ AC_REQUIRE([gl_SOCKET_FAMILIES]) AC_REQUIRE([AC_C_INLINE]) AC_REQUIRE([AC_GNU_SOURCE]) - AC_CHECK_HEADERS_ONCE(netinet/in.h) + AC_CHECK_HEADERS_ONCE(netinet/in.h sys/socket.h netdb.h ws2tcpip.h) AC_CHECK_DECLS([getaddrinfo, freeaddrinfo, gai_strerror],,,[ /* sys/types.h is not needed according to POSIX, but the sys/socket.h in i386-unknown-freebsd4.10 and powerpc-apple-darwin5.5 required it. */ #include +#ifdef HAVE_SYS_SOCKET_H #include +#endif +#ifdef HAVE_NETDB_H #include +#endif +#ifdef HAVE_WS2TCPIP_H +#define WINVER 0x0501 +#include +#endif ]) AC_CHECK_TYPES([struct addrinfo],,,[ #include +#ifdef HAVE_SYS_SOCKET_H #include +#endif +#ifdef HAVE_NETDB_H #include +#endif +#ifdef HAVE_WS2TCPIP_H +#define WINVER 0x0501 +#include +#endif ]) ]) diff --git a/gl/socket_.h b/gl/socket_.h index 5282ed5..244d034 100644 --- a/gl/socket_.h +++ b/gl/socket_.h @@ -27,6 +27,7 @@ winsock2.h and ws2tcpip.h that declare the sys/socket.h definitions we need. */ +#define WINVER 0x0501 #if HAVE_WINSOCK2_H # include #endif -- 2.11.4.GIT