From 776c6fb7175efbe14bfeab2b7028e5ad444b46bb Mon Sep 17 00:00:00 2001 From: Simon Josefsson Date: Thu, 19 Jan 2006 14:47:16 +0000 Subject: [PATCH] Update. --- gl/gai_strerror.c | 10 ++------ gl/getaddrinfo.h | 6 ++--- gl/m4/getaddrinfo.m4 | 67 ++++++++++++++++++++++------------------------------ gl/m4/socklen.m4 | 11 ++++----- 4 files changed, 37 insertions(+), 57 deletions(-) diff --git a/gl/gai_strerror.c b/gl/gai_strerror.c index cbb8d65..f289870 100644 --- a/gl/gai_strerror.c +++ b/gl/gai_strerror.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1997, 2001, 2002, 2004, 2005, 2006 Free Software Foundation, Inc. +/* Copyright (C) 1997, 2001, 2002, 2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Philip Blundell , 1997. @@ -25,9 +25,7 @@ #endif #include -#ifdef HAVE_NETDB_H -# include -#endif +#include #ifdef _LIBC # include @@ -44,9 +42,7 @@ static struct } values[] = { -#ifdef EAI_ADDRFAMILY { EAI_ADDRFAMILY, N_("Address family for hostname not supported") }, -#endif { EAI_AGAIN, N_("Temporary failure in name resolution") }, { EAI_BADFLAGS, N_("Bad value for ai_flags") }, { EAI_FAIL, N_("Non-recoverable failure in name resolution") }, @@ -56,9 +52,7 @@ values[] = { EAI_NONAME, N_("Name or service not known") }, { EAI_SERVICE, N_("Servname not supported for ai_socktype") }, { EAI_SOCKTYPE, N_("ai_socktype not supported") }, -#ifdef EAI_ADDRFAMILY { EAI_SYSTEM, N_("System error") }, -#endif #ifdef __USE_GNU { EAI_INPROGRESS, N_("Processing request in progress") }, { EAI_CANCELED, N_("Request canceled") }, diff --git a/gl/getaddrinfo.h b/gl/getaddrinfo.h index bd31602..65f52cd 100644 --- a/gl/getaddrinfo.h +++ b/gl/getaddrinfo.h @@ -1,5 +1,5 @@ /* Get address information. - Copyright (C) 1996-2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. + Copyright (C) 1996-2002, 2003, 2004, 2005 Free Software Foundation, Inc. Contributed by Simon Josefsson . This program is free software; you can redistribute it and/or modify @@ -26,9 +26,7 @@ # include /* Get all getaddrinfo related declarations, if available. */ # include -# ifdef HAVE_NETDB_H -# include -# endif +# include # ifndef HAVE_STRUCT_ADDRINFO diff --git a/gl/m4/getaddrinfo.m4 b/gl/m4/getaddrinfo.m4 index 2c9d3e2..709460d 100644 --- a/gl/m4/getaddrinfo.m4 +++ b/gl/m4/getaddrinfo.m4 @@ -1,4 +1,4 @@ -# getaddrinfo.m4 serial 8 +# getaddrinfo.m4 serial 7 dnl Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -6,64 +6,53 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_GETADDRINFO], [ - AC_MSG_NOTICE([checking how to do getaddrinfo]) - AC_SEARCH_LIBS(getaddrinfo, [nsl socket]) - AC_SEARCH_LIBS(gethostbyname, [inet nsl]) - AC_SEARCH_LIBS(getservbyname, [inet nsl socket xnet]) - if test "$ac_cv_search_gethostbyname" = "no"; then - save_LIBS="$LIBS" - LIBS="$LIBS -lws2_32" - AC_MSG_CHECKING([whether we need -lws2_32 for gethostbyname]) - AC_LINK_IFELSE([ - AC_LANG_PROGRAM([[ -#include -]], [gethostbyname (0);])], - need_ws2=yes, need_ws2=no) - AC_MSG_RESULT($need_ws2) - LIBS="$save_LIBS" - if test "$need_ws2" = "yes"; then + if test "$ac_cv_search_getaddrinfo" = "no"; then + AC_CACHE_CHECK(for getaddrinfo in ws2tcpip.h and -lws2_32, + gl_cv_getaddrinfo, [ + gl_cv_getaddrinfo=no + am_save_LIBS="$LIBS" LIBS="$LIBS -lws2_32" - fi + AC_TRY_LINK([ +#define WINVER 0x0501 +if HAVE_WS2TCPIP_H +# include +#endif +], [getaddrinfo(0, 0, 0, 0);], gl_cv_getaddrinfo=yes) + LIBS="$am_save_LIBS" + if test "$gl_cv_getaddrinfo" = "yes"; then + LIBS="$LIBS -lws2_32" + fi + ]) fi - AC_REPLACE_FUNCS(getaddrinfo gai_strerror) - gl_PREREQ_GETADDRINFO + if test "$gl_cv_getaddrinfo" = "no"; then + AC_REPLACE_FUNCS(getaddrinfo gai_strerror) + gl_PREREQ_GETADDRINFO + fi ]) # Prerequisites of lib/getaddrinfo.h and lib/getaddrinfo.c. AC_DEFUN([gl_PREREQ_GETADDRINFO], [ + AC_SEARCH_LIBS(gethostbyname, [inet nsl]) + AC_SEARCH_LIBS(getservbyname, [inet nsl socket xnet]) AC_REQUIRE([gl_C_RESTRICT]) AC_REQUIRE([gl_SOCKET_FAMILIES]) AC_REQUIRE([AC_C_INLINE]) AC_REQUIRE([AC_GNU_SOURCE]) - AC_CHECK_HEADERS_ONCE(netinet/in.h sys/socket.h netdb.h ws2tcpip.h) + AC_CHECK_HEADERS_ONCE(netinet/in.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 -#if HAVE_SYS_SOCKET_H -# include -#endif -#if HAVE_NETDB_H -# include -#endif -#if HAVE_WS2TCPIP_H -# include -#endif +#include +#include ]) AC_CHECK_TYPES([struct addrinfo],,,[ #include -#if HAVE_SYS_SOCKET_H -# include -#endif -#if HAVE_NETDB_H -# include -#endif -#if HAVE_WS2TCPIP_H -# include -#endif +#include +#include ]) ]) diff --git a/gl/m4/socklen.m4 b/gl/m4/socklen.m4 index bbeaae8..01da2b5 100644 --- a/gl/m4/socklen.m4 +++ b/gl/m4/socklen.m4 @@ -10,6 +10,10 @@ dnl Check for socklen_t: historically on BSD it is an int, and in dnl POSIX 1g it is a type of its own, but some platforms use different dnl types for the argument to getsockopt, getpeername, etc. So we dnl have to test to find something that will work. + +dnl On mingw32, socklen_t is in ws2tcpip.h ('int'), so we try to find +dnl it there first. That file is included by gnulib's socket_.h, which +dnl all users of this module should include. AC_DEFUN([gl_TYPE_SOCKLEN_T], [AC_CHECK_HEADERS_ONCE([sys/socket.h ws2tcpip.h]) AC_CHECK_TYPE([socklen_t], , @@ -22,12 +26,7 @@ AC_DEFUN([gl_TYPE_SOCKLEN_T], for t in int size_t "unsigned int" "long int" "unsigned long int"; do AC_TRY_COMPILE( [#include - #if HAVE_SYS_SOCKET_H - # include - #endif - #if HAVE_WS2TCPIP_H - # include - #endif + #include int getpeername (int, $arg2 *, $t *);], [$t len; -- 2.11.4.GIT