summaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorSimon Josefsson <simon@josefsson.org>2009-05-08 16:21:34 +0200
committerSimon Josefsson <simon@josefsson.org>2009-05-08 16:21:34 +0200
commit014f60069ce88c16683c533813b2463771ac2d0b (patch)
tree673a36054cf4f52016ce3b1b1346b7b6619f8fb9 /m4
parent37654ecf58fe14c16eb3fbea289151c2e493e8cf (diff)
downloadgnulib-014f60069ce88c16683c533813b2463771ac2d0b.tar.gz
sys_socket: Define sockaddr_storage.
Diffstat (limited to 'm4')
-rw-r--r--m4/sys_socket_h.m419
1 files changed, 18 insertions, 1 deletions
diff --git a/m4/sys_socket_h.m4 b/m4/sys_socket_h.m4
index 85a0ace8ad..5bbaad8df9 100644
--- a/m4/sys_socket_h.m4
+++ b/m4/sys_socket_h.m4
@@ -1,5 +1,5 @@
# sys_socket_h.m4 serial 12
-dnl Copyright (C) 2005-2008 Free Software Foundation, Inc.
+dnl Copyright (C) 2005-2009 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.
@@ -40,6 +40,22 @@ AC_DEFUN([gl_HEADER_SYS_SOCKET],
else
SYS_SOCKET_H='sys/socket.h'
fi
+ AC_CHECK_TYPES([struct sockaddr_storage],,,[
+ /* 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_WS2TCPIP_H
+#include <ws2tcpip.h>
+#endif
+])
+ if test $ac_cv_type_struct_sockaddr_storage = no; then
+ HAVE_STRUCT_SOCKADDR_STORAGE=0
+ SYS_SOCKET_H='sys/socket.h'
+ fi
if test -n "$SYS_SOCKET_H"; then
dnl Check prerequisites of the <sys/socket.h> replacement.
gl_CHECK_NEXT_HEADERS([sys/socket.h])
@@ -114,4 +130,5 @@ AC_DEFUN([gl_SYS_SOCKET_H_DEFAULTS],
GNULIB_SENDTO=0; AC_SUBST([GNULIB_SENDTO])
GNULIB_SETSOCKOPT=0; AC_SUBST([GNULIB_SETSOCKOPT])
GNULIB_SHUTDOWN=0; AC_SUBST([GNULIB_SHUTDOWN])
+ HAVE_STRUCT_SOCKADDR_STORAGE=1; AC_SUBST([HAVE_STRUCT_SOCKADDR_STORAGE])
])