1
0
mirror of git://git.sv.gnu.org/coreutils.git synced 2026-07-26 10:39:01 +02:00

Sync from gnulib.

This commit is contained in:
Paul Eggert
2006-02-16 23:34:00 +00:00
parent 74699a2b52
commit 4492bcd9ef
4 changed files with 58 additions and 20 deletions
+12
View File
@@ -1,3 +1,15 @@
2006-02-16 Eric Blake <ebb9@byu.net>
Sync from gnulib.
* sys_socket_h.m4: New file. Solves 'present but cannot compile'
warnings on cygwin, which cannot use ws2tcpip.h.
* 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 Simon Josefsson <jas@extundo.com>
Sync from gnulib.
+8 -5
View File
@@ -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_DEFUN([gl_GETADDRINFO],
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_DEFUN([gl_PREREQ_GETADDRINFO], [
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
+15 -15
View File
@@ -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 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.
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])])
+23
View File
@@ -0,0 +1,23 @@
# 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,
dnl with or without modifications, as long as this notice is preserved.
dnl From Simon Josefsson.
AC_DEFUN([gl_HEADER_SYS_SOCKET],
[
AC_CHECK_HEADERS_ONCE([sys/socket.h])
if test $ac_cv_header_sys_socket_h = yes; then
SYS_SOCKET_H=''
else
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)
])