Mercurial > hg > octave-shane > gnulib-hg
changeset 6646:c8acef83bf3f
* sys_socket_h.m4 (gl_HEADER_SYS_SOCKET): Don't attempt using
winsock2.h or ws2tcpip.h when sys/socket.h is present. Fixes
'present but cannot compile' warnings on cygwin.
* socklen.m4 (gl_TYPE_SOCKLEN_T): Use gl_HEADER_SYS_SOCKET. Don't
use ws2tcpip.h if sys/socket.h works.
* getaddrinfo.m4 (gl_PREREQ_GETADDRINFO): Use gl_HEADER_SYS_SOCKET.
(gl_GETADDRINFO): Don't use ws2tcpip.h when sys/socket.h is present.
author | Simon Josefsson <simon@josefsson.org> |
---|---|
date | Thu, 16 Feb 2006 09:48:07 +0000 |
parents | 12ac8b2edd9f |
children | ca74ccfe8d1b |
files | m4/ChangeLog m4/getaddrinfo.m4 m4/socklen.m4 m4/sys_socket_h.m4 |
diffstat | 4 files changed, 39 insertions(+), 22 deletions(-) [+] |
line wrap: on
line diff
--- a/m4/ChangeLog +++ b/m4/ChangeLog @@ -1,3 +1,13 @@ +2006-02-15 Eric Blake <ebb9@byu.net> + + * sys_socket_h.m4 (gl_HEADER_SYS_SOCKET): Don't attempt using + winsock2.h or ws2tcpip.h when sys/socket.h is present. Fixes + 'present but cannot compile' warnings on cygwin. + * socklen.m4 (gl_TYPE_SOCKLEN_T): Use gl_HEADER_SYS_SOCKET. Don't + use ws2tcpip.h if sys/socket.h works. + * getaddrinfo.m4 (gl_PREREQ_GETADDRINFO): Use gl_HEADER_SYS_SOCKET. + (gl_GETADDRINFO): Don't use ws2tcpip.h when sys/socket.h is present. + 2006-02-14 Jim Meyering <jim@meyering.net> Sync from coreutils.
--- a/m4/getaddrinfo.m4 +++ b/m4/getaddrinfo.m4 @@ -1,4 +1,4 @@ -# getaddrinfo.m4 serial 7 +# getaddrinfo.m4 serial 8 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, @@ -11,19 +11,21 @@ AC_SEARCH_LIBS(getaddrinfo, [nsl socket]) AC_CHECK_FUNCS(getaddrinfo,, [ AC_CACHE_CHECK(for getaddrinfo in ws2tcpip.h and -lws2_32, - gl_cv_w32_getaddrinfo, [ + gl_cv_w32_getaddrinfo, [ gl_cv_w32_getaddrinfo=no am_save_LIBS="$LIBS" LIBS="$LIBS -lws2_32" AC_TRY_LINK([ +#ifdef HAVE_WS2TCPIP_H #define WINVER 0x0501 #include <ws2tcpip.h> +#endif ], [getaddrinfo(0, 0, 0, 0);], gl_cv_w32_getaddrinfo=yes) LIBS="$am_save_LIBS" if test "$gl_cv_w32_getaddrinfo" = "yes"; then - LIBS="$LIBS -lws2_32" + LIBS="$LIBS -lws2_32" else - AC_LIBOBJ(getaddrinfo) + AC_LIBOBJ(getaddrinfo) fi ])]) @@ -37,9 +39,10 @@ AC_SEARCH_LIBS(getservbyname, [inet nsl socket xnet]) AC_REQUIRE([gl_C_RESTRICT]) AC_REQUIRE([gl_SOCKET_FAMILIES]) + AC_REQUIRE([gl_HEADER_SYS_SOCKET]) 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 netdb.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
--- a/m4/socklen.m4 +++ b/m4/socklen.m4 @@ -1,4 +1,4 @@ -# socklen.m4 serial 3 +# socklen.m4 serial 4 dnl Copyright (C) 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, @@ -13,40 +13,40 @@ 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. +dnl all users of this module should include. Cygwin must not include +dnl ws2tcpip.h. AC_DEFUN([gl_TYPE_SOCKLEN_T], - [AC_CHECK_HEADERS_ONCE([sys/socket.h ws2tcpip.h]) + [AC_REQUIRE([gl_HEADER_SYS_SOCKET])dnl AC_CHECK_TYPE([socklen_t], , [AC_MSG_CHECKING([for socklen_t equivalent]) AC_CACHE_VAL([gl_cv_gl_cv_socklen_t_equiv], - [# Systems have either "struct sockaddr *" or - # "void *" as the second argument to getpeername - gl_cv_socklen_t_equiv= - for arg2 in "struct sockaddr" void; do + [# Systems have either "struct sockaddr *" or + # "void *" as the second argument to getpeername + gl_cv_socklen_t_equiv= + for arg2 in "struct sockaddr" void; do for t in int size_t "unsigned int" "long int" "unsigned long int"; do AC_TRY_COMPILE( [#include <sys/types.h> - #include <sys/socket.h> + #include <sys/socket.h> int getpeername (int, $arg2 *, $t *);], - [$t len; + [$t len; getpeername (0, 0, &len);], [gl_cv_socklen_t_equiv="$t"]) - test "$gl_cv_socklen_t_equiv" != "" && break + test "$gl_cv_socklen_t_equiv" != "" && break done - test "$gl_cv_socklen_t_equiv" != "" && break - done + test "$gl_cv_socklen_t_equiv" != "" && break + done ]) if test "$gl_cv_socklen_t_equiv" = ""; then AC_MSG_ERROR([Cannot find a type to use in place of socklen_t]) fi AC_MSG_RESULT([$gl_cv_socklen_t_equiv]) AC_DEFINE_UNQUOTED([socklen_t], [$gl_cv_socklen_t_equiv], - [type to use in place of socklen_t if not defined])], + [type to use in place of socklen_t if not defined])], [#include <sys/types.h> #if HAVE_SYS_SOCKET_H # include <sys/socket.h> - #endif - #if HAVE_WS2TCPIP_H + #elif HAVE_WS2TCPIP_H # include <ws2tcpip.h> #endif])])
--- a/m4/sys_socket_h.m4 +++ b/m4/sys_socket_h.m4 @@ -1,4 +1,4 @@ -# sys_socket_h.m4 serial 1 +# sys_socket_h.m4 serial 2 dnl Copyright (C) 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, @@ -12,7 +12,11 @@ if test $ac_cv_header_sys_socket_h = yes; then SYS_SOCKET_H='' else - AC_CHECK_HEADERS_ONCE([winsock2.h ws2tcpip.h]) + dnl We cannot use AC_CHECK_HEADERS_ONCE here, because that would make + dnl the check for those headers unconditional; yet cygwin reports + dnl that the headers are present but cannot be compiled (since on + dnl cygwin, all socket information should come from sys/socket.h). + AC_CHECK_HEADERS([winsock2.h ws2tcpip.h]) SYS_SOCKET_H='sys/socket.h' fi AC_SUBST(SYS_SOCKET_H)