diff options
author | Simon Josefsson <simon@josefsson.org> | 2009-05-08 16:24:26 +0200 |
---|---|---|
committer | Simon Josefsson <simon@josefsson.org> | 2009-05-08 16:24:26 +0200 |
commit | a1d8056ae7f39690f4f94e400db1228cf8ab8891 (patch) | |
tree | b4f38256fce7a99ea53bd74534b897ee37f107bf /gl | |
parent | 08c49d6067b908b3ddd403b3f91e990986c51f00 (diff) | |
download | gnutls-a1d8056ae7f39690f4f94e400db1228cf8ab8891.tar.gz |
Update gnulib files.
Diffstat (limited to 'gl')
-rw-r--r-- | gl/Makefile.am | 8 | ||||
-rw-r--r-- | gl/m4/errno_h.m4 | 3 | ||||
-rw-r--r-- | gl/m4/gnulib-comp.m4 | 5 | ||||
-rw-r--r-- | gl/m4/multiarch.m4 | 3 | ||||
-rw-r--r-- | gl/m4/sys_socket_h.m4 | 19 | ||||
-rw-r--r-- | gl/m4/vasnprintf.m4 | 6 | ||||
-rw-r--r-- | gl/sys_socket.in.h | 18 | ||||
-rw-r--r-- | gl/tests/test-sys_socket.c | 6 |
8 files changed, 57 insertions, 11 deletions
diff --git a/gl/Makefile.am b/gl/Makefile.am index 350cca57b5..4fd6aba83c 100644 --- a/gl/Makefile.am +++ b/gl/Makefile.am @@ -48,6 +48,13 @@ EXTRA_libgnu_la_SOURCES += accept.c ## end gnulib module accept +## begin gnulib module alignof + + +EXTRA_DIST += alignof.h + +## end gnulib module alignof + ## begin gnulib module alloca @@ -910,6 +917,7 @@ sys/socket.h: sys_socket.in.h -e 's|@''GNULIB_SHUTDOWN''@|$(GNULIB_SHUTDOWN)|g' \ -e 's|@''HAVE_WINSOCK2_H''@|$(HAVE_WINSOCK2_H)|g' \ -e 's|@''HAVE_WS2TCPIP_H''@|$(HAVE_WS2TCPIP_H)|g' \ + -e 's|@''HAVE_STRUCT_SOCKADDR_STORAGE''@|$(HAVE_STRUCT_SOCKADDR_STORAGE)|g' \ -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \ < $(srcdir)/sys_socket.in.h; \ } > $@-t diff --git a/gl/m4/errno_h.m4 b/gl/m4/errno_h.m4 index 4d77672cb7..16188d9bc0 100644 --- a/gl/m4/errno_h.m4 +++ b/gl/m4/errno_h.m4 @@ -1,10 +1,9 @@ -# errno_h.m4 serial 4 +# errno_h.m4 serial 5 dnl Copyright (C) 2004, 2006, 2008, 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. -dnl This macro must pass through AC_REQUIRE (never directly invoke it). AC_DEFUN_ONCE([gl_HEADER_ERRNO_H], [ AC_REQUIRE([AC_PROG_CC]) diff --git a/gl/m4/gnulib-comp.m4 b/gl/m4/gnulib-comp.m4 index fc7e4eb811..23d1198da7 100644 --- a/gl/m4/gnulib-comp.m4 +++ b/gl/m4/gnulib-comp.m4 @@ -72,7 +72,7 @@ AC_SUBST([LTALLOCA]) AC_LIBOBJ([connect]) fi gl_SYS_SOCKET_MODULE_INDICATOR([connect]) - AC_REQUIRE([gl_HEADER_ERRNO_H]) + gl_HEADER_ERRNO_H gl_ERROR m4_ifdef([AM_XGETTEXT_OPTION], [AM_XGETTEXT_OPTION([--flag=error:3:c-format]) @@ -116,7 +116,7 @@ AC_SUBST([LTALLOCA]) gl_FUNC_LSEEK gl_UNISTD_MODULE_INDICATOR([lseek]) gl_MINMAX - AC_REQUIRE([gl_MULTIARCH]) + gl_MULTIARCH gl_HEADER_NETDB gl_HEADER_NETINET_IN AC_PROG_MKDIR_P @@ -341,6 +341,7 @@ AC_DEFUN([gl_FILE_LIST], [ doc/gpl-3.0.texi doc/lgpl-2.1.texi lib/accept.c + lib/alignof.h lib/alloca.c lib/alloca.in.h lib/arpa_inet.in.h diff --git a/gl/m4/multiarch.m4 b/gl/m4/multiarch.m4 index 3948e6e0db..ec377bac86 100644 --- a/gl/m4/multiarch.m4 +++ b/gl/m4/multiarch.m4 @@ -1,4 +1,4 @@ -# multiarch.m4 serial 4 +# multiarch.m4 serial 5 dnl Copyright (C) 2008, 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, @@ -19,7 +19,6 @@ dnl with or without modifications, as long as this notice is preserved. # Detect this situation and set the macro AA_APPLE_UNIVERSAL_BUILD at the # beginning of config.h and set APPLE_UNIVERSAL_BUILD accordingly. -dnl This macro must pass through AC_REQUIRE (never directly invoke it). AC_DEFUN_ONCE([gl_MULTIARCH], [ dnl Code similar to autoconf-2.63 AC_C_BIGENDIAN. diff --git a/gl/m4/sys_socket_h.m4 b/gl/m4/sys_socket_h.m4 index 85a0ace8ad..5bbaad8df9 100644 --- a/gl/m4/sys_socket_h.m4 +++ b/gl/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]) ]) diff --git a/gl/m4/vasnprintf.m4 b/gl/m4/vasnprintf.m4 index 01e8772f11..3a1d1e0100 100644 --- a/gl/m4/vasnprintf.m4 +++ b/gl/m4/vasnprintf.m4 @@ -1,4 +1,4 @@ -# vasnprintf.m4 serial 28 +# vasnprintf.m4 serial 29 dnl Copyright (C) 2002-2004, 2006-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, @@ -52,7 +52,7 @@ AC_DEFUN([gl_PREREQ_PRINTF_PARSE], ]) # Prerequisites of lib/vasnprintf.c. -AC_DEFUN([gl_PREREQ_VASNPRINTF], +AC_DEFUN_ONCE([gl_PREREQ_VASNPRINTF], [ AC_REQUIRE([AC_FUNC_ALLOCA]) AC_REQUIRE([AC_TYPE_LONG_LONG_INT]) @@ -66,7 +66,7 @@ AC_DEFUN([gl_PREREQ_VASNPRINTF], # Extra prerequisites of lib/vasnprintf.c for supporting 'long double' # arguments. -AC_DEFUN([gl_PREREQ_VASNPRINTF_LONG_DOUBLE], +AC_DEFUN_ONCE([gl_PREREQ_VASNPRINTF_LONG_DOUBLE], [ AC_REQUIRE([gl_PRINTF_LONG_DOUBLE]) case "$gl_cv_func_printf_long_double" in diff --git a/gl/sys_socket.in.h b/gl/sys_socket.in.h index 311d2d69c7..87eed880ce 100644 --- a/gl/sys_socket.in.h +++ b/gl/sys_socket.in.h @@ -43,6 +43,24 @@ #ifndef _GL_SYS_SOCKET_H #define _GL_SYS_SOCKET_H +#if !@HAVE_STRUCT_SOCKADDR_STORAGE@ +#include <alignof.h> +/* Code taken from glibc sysdeps/unix/sysv/linux/bits/socket.h on + 2009-05-08, licensed under LGPLv2.1+, plus portability fixes. */ +#define __ss_aligntype unsigned long int +#define _SS_SIZE 256 +#define _SS_PADSIZE (_SS_SIZE - (max (sizeof (sa_family_t), \ + alignof (__ss_aligntype)) \ + + sizeof (__ss_aligntype))) + +struct sockaddr_storage +{ + sa_family_t ss_family; /* Address family, etc. */ + __ss_aligntype __ss_align; /* Force desired alignment. */ + char __ss_padding[_SS_PADSIZE]; +}; +#endif + #if @HAVE_SYS_SOCKET_H@ /* A platform that has <sys/socket.h>. */ diff --git a/gl/tests/test-sys_socket.c b/gl/tests/test-sys_socket.c index b7395b3c5b..fe7688e5c6 100644 --- a/gl/tests/test-sys_socket.c +++ b/gl/tests/test-sys_socket.c @@ -1,5 +1,5 @@ /* Test of <sys/socket.h> substitute. - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007, 2009 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -30,6 +30,8 @@ int a[] = { SHUT_RD, SHUT_WR, SHUT_RDWR }; int main () { + struct sockaddr_storage x; + /* Check some errno values. */ switch (0) { @@ -43,5 +45,7 @@ main () break; } + x.ss_family = 42; + return 0; } |