summaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2006-02-14 23:08:59 +0000
committerPaul Eggert <eggert@cs.ucla.edu>2006-02-14 23:08:59 +0000
commit05e61daca4d7e0ed1f82e0e604812b90b8bcbde1 (patch)
treedfa8745d2ae39bfabc619e50d16f565a10fe16f8 /m4
parent83dcf2436fec5440943c03dac404f4b25f72e222 (diff)
downloadcoreutils-05e61daca4d7e0ed1f82e0e604812b90b8bcbde1.tar.xz
Sync from gnulib.
Diffstat (limited to 'm4')
-rw-r--r--m4/ChangeLog8
-rw-r--r--m4/getaddrinfo.m446
-rw-r--r--m4/ls-mntd-fs.m42
-rw-r--r--m4/socklen.m422
4 files changed, 66 insertions, 12 deletions
diff --git a/m4/ChangeLog b/m4/ChangeLog
index dd75ca4b5..699fe70ac 100644
--- a/m4/ChangeLog
+++ b/m4/ChangeLog
@@ -1,3 +1,11 @@
+2006-02-14 Simon Josefsson <jas@extundo.com>
+
+ Sync from gnulib.
+ * getaddrinfo.m4: Look for getaddrinfo inside ws2tcip.h and
+ -lws2_32. Protect sys/socket.h and netdb.h #include's. Include
+ ws2tcpip.h with WINVER=0x0501. All for mingw32.
+ * socklen.m4: Look in ws2tcpip.h too, for mingw32.
+
2006-02-05 Paul Eggert <eggert@cs.ucla.edu>
* extensions.m4 (gl_USE_SYSTEM_EXTENSIONS): Don't #define
diff --git a/m4/getaddrinfo.m4 b/m4/getaddrinfo.m4
index b3b7b0736..006cdab2a 100644
--- a/m4/getaddrinfo.m4
+++ b/m4/getaddrinfo.m4
@@ -1,36 +1,72 @@
# getaddrinfo.m4 serial 7
-dnl Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+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,
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])
- AC_REPLACE_FUNCS(getaddrinfo gai_strerror)
+ AC_CHECK_FUNCS(getaddrinfo,, [
+ AC_CACHE_CHECK(for getaddrinfo in ws2tcpip.h and -lws2_32,
+ gl_cv_w32_getaddrinfo, [
+ gl_cv_w32_getaddrinfo=no
+ am_save_LIBS="$LIBS"
+ LIBS="$LIBS -lws2_32"
+ AC_TRY_LINK([
+#define WINVER 0x0501
+#include <ws2tcpip.h>
+], [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"
+ else
+ AC_LIBOBJ(getaddrinfo)
+ fi
+ ])])
+
+ AC_REPLACE_FUNCS(gai_strerror)
gl_PREREQ_GETADDRINFO
])
# 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)
+ 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 <sys/types.h>
+#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
+#endif
+#ifdef HAVE_NETDB_H
#include <netdb.h>
+#endif
+#ifdef HAVE_WS2TCPIP_H
+#define WINVER 0x0501
+#include <ws2tcpip.h>
+#endif
])
AC_CHECK_TYPES([struct addrinfo],,,[
#include <sys/types.h>
+#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
+#endif
+#ifdef HAVE_NETDB_H
#include <netdb.h>
+#endif
+#ifdef HAVE_WS2TCPIP_H
+#define WINVER 0x0501
+#include <ws2tcpip.h>
+#endif
])
])
diff --git a/m4/ls-mntd-fs.m4 b/m4/ls-mntd-fs.m4
index af3eaa8c2..a4c808907 100644
--- a/m4/ls-mntd-fs.m4
+++ b/m4/ls-mntd-fs.m4
@@ -1,4 +1,4 @@
-#serial 20
+#serial 21
# How to list mounted file systems.
# Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2006 Free Software
diff --git a/m4/socklen.m4 b/m4/socklen.m4
index 7db6ba355..01da2b547 100644
--- a/m4/socklen.m4
+++ b/m4/socklen.m4
@@ -1,17 +1,22 @@
-# socklen.m4 serial 2
-dnl Copyright (C) 2005 Free Software Foundation, Inc.
+# socklen.m4 serial 3
+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 Albert Chin.
+dnl From Albert Chin, Windows fixes from Simon Josefsson.
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_TYPE([socklen_t], ,
+ [AC_CHECK_HEADERS_ONCE([sys/socket.h ws2tcpip.h])
+ 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
@@ -21,7 +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 <sys/types.h>
- #include <sys/socket.h>
+ #include <sys/socket.h>
int getpeername (int, $arg2 *, $t *);],
[$t len;
@@ -39,4 +44,9 @@ AC_DEFUN([gl_TYPE_SOCKLEN_T],
AC_DEFINE_UNQUOTED([socklen_t], [$gl_cv_socklen_t_equiv],
[type to use in place of socklen_t if not defined])],
[#include <sys/types.h>
- #include <sys/socket.h>])])
+ #if HAVE_SYS_SOCKET_H
+ # include <sys/socket.h>
+ #endif
+ #if HAVE_WS2TCPIP_H
+ # include <ws2tcpip.h>
+ #endif])])