diff options
author | Simon Josefsson <simon@josefsson.org> | 2007-03-12 13:25:25 +0000 |
---|---|---|
committer | Simon Josefsson <simon@josefsson.org> | 2007-03-12 13:25:25 +0000 |
commit | 2e9dd60314fb99822eafa8b8f26e56dc65e796cd (patch) | |
tree | 63d9b3e129fdc7d3f4d874eb6173188252344d8e /gl | |
parent | 9d052968fda1fbcd034a894ef893c06be8df1f70 (diff) | |
download | gnutls-2e9dd60314fb99822eafa8b8f26e56dc65e796cd.tar.gz |
Update.
Diffstat (limited to 'gl')
-rw-r--r-- | gl/gnulib.mk | 12 | ||||
-rw-r--r-- | gl/m4/gnulib-comp.m4 | 1 | ||||
-rw-r--r-- | gl/m4/netinet_in_h.m4 | 28 | ||||
-rw-r--r-- | gl/m4/sys_socket_h.m4 | 51 | ||||
-rw-r--r-- | gl/netinet_in_.h | 37 | ||||
-rw-r--r-- | gl/socket_.h | 81 |
6 files changed, 158 insertions, 52 deletions
diff --git a/gl/gnulib.mk b/gl/gnulib.mk index 3f99da8ba4..852ee192c9 100644 --- a/gl/gnulib.mk +++ b/gl/gnulib.mk @@ -125,12 +125,16 @@ netinet/in.h: @MKDIR_P@ netinet rm -f $@-t $@ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ - echo '#include <sys/socket.h>'; \ + sed -e 's|@''ABSOLUTE_NETINET_IN_H''@|$(ABSOLUTE_NETINET_IN_H)|g' \ + -e 's|@''HAVE_NETINET_IN_H''@|$(HAVE_NETINET_IN_H)|g' \ + < $(srcdir)/netinet_in_.h; \ } > $@-t mv $@-t $@ MOSTLYCLEANFILES += netinet/in.h netinet/in.h-t MOSTLYCLEANDIRS += netinet +EXTRA_DIST += netinet_in_.h + ## end gnulib module netinet_in ## begin gnulib module progname @@ -246,7 +250,11 @@ BUILT_SOURCES += $(SYS_SOCKET_H) sys/socket.h: socket_.h @MKDIR_P@ sys { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ - cat $(srcdir)/socket_.h; \ + sed -e 's|@''ABSOLUTE_SYS_SOCKET_H''@|$(ABSOLUTE_SYS_SOCKET_H)|g' \ + -e 's|@''HAVE_SYS_SOCKET_H''@|$(HAVE_SYS_SOCKET_H)|g' \ + -e 's|@''HAVE_WINSOCK2_H''@|$(HAVE_WINSOCK2_H)|g' \ + -e 's|@''HAVE_WS2TCPIP_H''@|$(HAVE_WS2TCPIP_H)|g' \ + < $(srcdir)/socket_.h; \ } > $@-t mv -f $@-t $@ MOSTLYCLEANFILES += sys/socket.h sys/socket.h-t diff --git a/gl/m4/gnulib-comp.m4 b/gl/m4/gnulib-comp.m4 index 2cb226967b..a28591f353 100644 --- a/gl/m4/gnulib-comp.m4 +++ b/gl/m4/gnulib-comp.m4 @@ -126,6 +126,7 @@ AC_DEFUN([gl_FILE_LIST], [ lib/inet_ntop.h lib/inet_pton.c lib/inet_pton.h + lib/netinet_in_.h lib/progname.c lib/progname.h lib/readline.c diff --git a/gl/m4/netinet_in_h.m4 b/gl/m4/netinet_in_h.m4 index d73531a051..966bfe6a11 100644 --- a/gl/m4/netinet_in_h.m4 +++ b/gl/m4/netinet_in_h.m4 @@ -1,18 +1,32 @@ -# netinet_in_h.m4 serial 1 -dnl Copyright (C) 2006 Free Software Foundation, Inc. +# netinet_in_h.m4 serial 2 +dnl Copyright (C) 2006-2007 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 Written by Simon Josefsson - AC_DEFUN([gl_HEADER_NETINET_IN], [ - AC_CHECK_HEADERS_ONCE([netinet/in.h]) - if test $ac_cv_header_netinet_in_h = yes; then + AC_CACHE_CHECK([whether <netinet/in.h> is self-contained], + [gl_cv_header_netinet_in_h_selfcontained], + [ + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <netinet/in.h>], [])], + [gl_cv_header_netinet_in_h_selfcontained=yes], + [gl_cv_header_netinet_in_h_selfcontained=no]) + ]) + if test $gl_cv_header_netinet_in_h_selfcontained = yes; then NETINET_IN_H='' else NETINET_IN_H='netinet/in.h' + AC_CHECK_HEADERS([netinet/in.h]) + gl_ABSOLUTE_HEADER([netinet/in.h]) + ABSOLUTE_NETINET_IN_H=\"$gl_cv_absolute_netinet_in_h\" + AC_SUBST([ABSOLUTE_NETINET_IN_H]) + if test $ac_cv_header_netinet_in_h = yes; then + HAVE_NETINET_IN_H=1 + else + HAVE_NETINET_IN_H=0 + fi + AC_SUBST([HAVE_NETINET_IN_H]) fi - AC_SUBST(NETINET_IN_H) + AC_SUBST([NETINET_IN_H]) ]) diff --git a/gl/m4/sys_socket_h.m4 b/gl/m4/sys_socket_h.m4 index d3e45b48c1..ce5acf6e24 100644 --- a/gl/m4/sys_socket_h.m4 +++ b/gl/m4/sys_socket_h.m4 @@ -1,5 +1,5 @@ -# sys_socket_h.m4 serial 2 -dnl Copyright (C) 2005, 2006 Free Software Foundation, Inc. +# sys_socket_h.m4 serial 3 +dnl Copyright (C) 2005, 2006, 2007 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. @@ -8,16 +8,47 @@ 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 + AC_CACHE_CHECK([whether <sys/socket.h> is self-contained], + [gl_cv_header_sys_socket_h_selfcontained], + [ + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <sys/socket.h>], [])], + [gl_cv_header_sys_socket_h_selfcontained=yes], + [gl_cv_header_sys_socket_h_selfcontained=no]) + ]) + if test $gl_cv_header_sys_socket_h_selfcontained = 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' + + AC_CHECK_HEADERS([sys/socket.h]) + gl_ABSOLUTE_HEADER([sys/socket.h]) + ABSOLUTE_SYS_SOCKET_H=\"$gl_cv_absolute_sys_socket_h\" + AC_SUBST([ABSOLUTE_SYS_SOCKET_H]) + if test $ac_cv_header_sys_socket_h = yes; then + HAVE_SYS_SOCKET_H=1 + HAVE_WINSOCK2_H=0 + HAVE_WS2TCPIP_H=0 + else + HAVE_SYS_SOCKET_H=0 + 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]) + if test $ac_cv_header_winsock2_h = yes; then + HAVE_WINSOCK2_H=1 + else + HAVE_WINSOCK2_H=0 + fi + if test $ac_cv_header_ws2tcpip_h = yes; then + HAVE_WS2TCPIP_H=1 + else + HAVE_WS2TCPIP_H=0 + fi + fi + AC_SUBST([HAVE_SYS_SOCKET_H]) + AC_SUBST([HAVE_WINSOCK2_H]) + AC_SUBST([HAVE_WS2TCPIP_H]) fi - AC_SUBST(SYS_SOCKET_H) + AC_SUBST([SYS_SOCKET_H]) ]) diff --git a/gl/netinet_in_.h b/gl/netinet_in_.h new file mode 100644 index 0000000000..4a53605f5d --- /dev/null +++ b/gl/netinet_in_.h @@ -0,0 +1,37 @@ +/* Substitute for <netinet/in.h>. + Copyright (C) 2007 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 + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#ifndef _GL_NETINET_IN_H +#define _GL_NETINET_IN_H + +#if @HAVE_NETINET_IN_H@ + +/* On many platforms, <netinet/in.h> assumes prior inclusion of + <sys/types.h>. */ + +# include <sys/types.h> +# include @ABSOLUTE_NETINET_IN_H@ + +#else + +/* A platform that lacks <netinet/in.h>. */ + +# include <sys/socket.h> + +#endif + +#endif /* _GL_NETINET_IN_H */ diff --git a/gl/socket_.h b/gl/socket_.h index 8b28b5ed39..623c98c2f1 100644 --- a/gl/socket_.h +++ b/gl/socket_.h @@ -1,5 +1,5 @@ /* Provide a sys/socket header file for systems lacking it (read: MinGW). - Copyright (C) 2005, 2006 Free Software Foundation, Inc. + Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc. Written by Simon Josefsson. This program is free software; you can redistribute it and/or modify @@ -16,12 +16,25 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef _SYS_SOCKET_H -#define _SYS_SOCKET_H +#ifndef _GL_SYS_SOCKET_H +#define _GL_SYS_SOCKET_H -/* This file is supposed to be used on platforms that lack - sys/socket.h. It is intended to provide definitions and prototypes - needed by an application. +/* This file is supposed to be used on platforms that lack <sys/socket.h> + and on platforms where <sys/socket.h> cannot be included standalone. + It is intended to provide definitions and prototypes needed by an + application. */ + +#if @HAVE_SYS_SOCKET_H@ + +/* On many platforms, <sys/socket.h> assumes prior inclusion of + <sys/types.h>. */ + +# include <sys/types.h> +# include @ABSOLUTE_SYS_SOCKET_H@ + +#else + +/* A platform that lacks <sys/socket.h>. Currently only MinGW is supported. See the gnulib manual regarding Windows sockets. MinGW has the header files winsock2.h and @@ -39,32 +52,34 @@ releases. */ -#if HAVE_WINSOCK2_H -# include <winsock2.h> -#endif -#if HAVE_WS2TCPIP_H -# include <ws2tcpip.h> -#endif +# if @HAVE_WINSOCK2_H@ +# include <winsock2.h> +# endif +# if @HAVE_WS2TCPIP_H@ +# include <ws2tcpip.h> +# endif /* For shutdown(). */ -#if !defined SHUT_RD && defined SD_RECEIVE -# define SHUT_RD SD_RECEIVE -#endif -#if !defined SHUT_WR && defined SD_SEND -# define SHUT_WR SD_SEND -#endif -#if !defined SHUT_RDWR && defined SD_BOTH -# define SHUT_RDWR SD_BOTH -#endif - -#if defined _WIN32 || defined __WIN32__ -# define ENOTSOCK WSAENOTSOCK -# define EADDRINUSE WSAEADDRINUSE -# define ENETRESET WSAENETRESET -# define ECONNABORTED WSAECONNABORTED -# define ECONNRESET WSAECONNRESET -# define ENOTCONN WSAENOTCONN -# define ESHUTDOWN WSAESHUTDOWN -#endif - -#endif /* _SYS_SOCKET_H */ +# if !defined SHUT_RD && defined SD_RECEIVE +# define SHUT_RD SD_RECEIVE +# endif +# if !defined SHUT_WR && defined SD_SEND +# define SHUT_WR SD_SEND +# endif +# if !defined SHUT_RDWR && defined SD_BOTH +# define SHUT_RDWR SD_BOTH +# endif + +# if defined _WIN32 || defined __WIN32__ +# define ENOTSOCK WSAENOTSOCK +# define EADDRINUSE WSAEADDRINUSE +# define ENETRESET WSAENETRESET +# define ECONNABORTED WSAECONNABORTED +# define ECONNRESET WSAECONNRESET +# define ENOTCONN WSAENOTCONN +# define ESHUTDOWN WSAESHUTDOWN +# endif + +#endif /* HAVE_SYS_SOCKET_H */ + +#endif /* _GL_SYS_SOCKET_H */ |