From: Bruno Haible Date: Mon, 1 Oct 2007 22:35:36 +0000 (+0200) Subject: Rename sys_socket_.h to sys_socket.in.h. X-Git-Tag: v0.0~158 X-Git-Url: http://erislabs.net/gitweb/?a=commitdiff_plain;h=6bce7636fbce453498c8c5b14f036b2e19de6d22;p=gnulib.git Rename sys_socket_.h to sys_socket.in.h. --- diff --git a/ChangeLog b/ChangeLog index 5dc8183cf..7ab1290e0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -66,6 +66,9 @@ * lib/sys_select.in.h: Renamed from lib/sys_select_.h. * modules/sys_select (Files, Makefile.am): Use sys_select.in.h instead of sys_select_.h. Add dependency. + * lib/sys_socket.in.h: Renamed from lib/sys_socket_.h. + * modules/sys_socket (Files, Makefile.am): Use sys_socket.in.h instead + of sys_socket_.h. 2007-09-30 Bruno Haible diff --git a/lib/sys_socket.in.h b/lib/sys_socket.in.h new file mode 100644 index 000000000..c25b6ab84 --- /dev/null +++ b/lib/sys_socket.in.h @@ -0,0 +1,91 @@ +/* Provide a sys/socket header file for systems lacking it (read: MinGW). + 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 + 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. */ + +/* This file is supposed to be used on platforms that lack + and on platforms where cannot be included standalone. + It is intended to provide definitions and prototypes needed by an + application. */ + +#ifndef _GL_SYS_SOCKET_H + +#if @HAVE_SYS_SOCKET_H@ + +/* On many platforms, assumes prior inclusion of + . */ +# include + +/* The include_next requires a split double-inclusion guard. */ +# @INCLUDE_NEXT@ @NEXT_SYS_SOCKET_H@ + +#endif + +#ifndef _GL_SYS_SOCKET_H +#define _GL_SYS_SOCKET_H + +#if !@HAVE_SYS_SOCKET_H@ + +/* A platform that lacks . + + Currently only MinGW is supported. See the gnulib manual regarding + Windows sockets. MinGW has the header files winsock2.h and + ws2tcpip.h that declare the sys/socket.h definitions we need. Note + that you can influence which definitions you get by setting the + WINVER symbol before including these two files. For example, + getaddrinfo is only available if _WIN32_WINNT >= 0x0501 (that + symbol is set indiriectly through WINVER). You can set this by + adding AC_DEFINE(WINVER, 0x0501) to configure.ac. Note that your + code may not run on older Windows releases then. My Windows 2000 + box was not able to run the code, for example. The situation is + slightly confusing because: + http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winsock/winsock/getaddrinfo_2.asp + suggests that getaddrinfo should be available on all Windows + releases. */ + + +# if @HAVE_WINSOCK2_H@ +# include +# endif +# if @HAVE_WS2TCPIP_H@ +# include +# 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 /* HAVE_SYS_SOCKET_H */ + +#endif /* _GL_SYS_SOCKET_H */ +#endif /* _GL_SYS_SOCKET_H */ diff --git a/lib/sys_socket_.h b/lib/sys_socket_.h deleted file mode 100644 index c25b6ab84..000000000 --- a/lib/sys_socket_.h +++ /dev/null @@ -1,91 +0,0 @@ -/* Provide a sys/socket header file for systems lacking it (read: MinGW). - 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 - 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. */ - -/* This file is supposed to be used on platforms that lack - and on platforms where cannot be included standalone. - It is intended to provide definitions and prototypes needed by an - application. */ - -#ifndef _GL_SYS_SOCKET_H - -#if @HAVE_SYS_SOCKET_H@ - -/* On many platforms, assumes prior inclusion of - . */ -# include - -/* The include_next requires a split double-inclusion guard. */ -# @INCLUDE_NEXT@ @NEXT_SYS_SOCKET_H@ - -#endif - -#ifndef _GL_SYS_SOCKET_H -#define _GL_SYS_SOCKET_H - -#if !@HAVE_SYS_SOCKET_H@ - -/* A platform that lacks . - - Currently only MinGW is supported. See the gnulib manual regarding - Windows sockets. MinGW has the header files winsock2.h and - ws2tcpip.h that declare the sys/socket.h definitions we need. Note - that you can influence which definitions you get by setting the - WINVER symbol before including these two files. For example, - getaddrinfo is only available if _WIN32_WINNT >= 0x0501 (that - symbol is set indiriectly through WINVER). You can set this by - adding AC_DEFINE(WINVER, 0x0501) to configure.ac. Note that your - code may not run on older Windows releases then. My Windows 2000 - box was not able to run the code, for example. The situation is - slightly confusing because: - http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winsock/winsock/getaddrinfo_2.asp - suggests that getaddrinfo should be available on all Windows - releases. */ - - -# if @HAVE_WINSOCK2_H@ -# include -# endif -# if @HAVE_WS2TCPIP_H@ -# include -# 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 /* HAVE_SYS_SOCKET_H */ - -#endif /* _GL_SYS_SOCKET_H */ -#endif /* _GL_SYS_SOCKET_H */ diff --git a/m4/socklen.m4 b/m4/socklen.m4 index d39a314e1..b755757be 100644 --- a/m4/socklen.m4 +++ b/m4/socklen.m4 @@ -1,4 +1,4 @@ -# socklen.m4 serial 5 +# socklen.m4 serial 6 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, @@ -12,7 +12,7 @@ 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 sys_socket_.h, which +dnl it there first. That file is included by gnulib's sys_socket.in.h, which dnl all users of this module should include. Cygwin must not include dnl ws2tcpip.h. AC_DEFUN([gl_TYPE_SOCKLEN_T], diff --git a/modules/sys_socket b/modules/sys_socket index b44e4f10f..0c7b6dbb3 100644 --- a/modules/sys_socket +++ b/modules/sys_socket @@ -2,7 +2,7 @@ Description: A for systems lacking it. Files: -lib/sys_socket_.h +lib/sys_socket.in.h m4/sys_socket_h.m4 m4/sockpfaf.m4 @@ -18,7 +18,7 @@ BUILT_SOURCES += $(SYS_SOCKET_H) # We need the following in order to create when the system # doesn't have one that works with the given compiler. -sys/socket.h: sys_socket_.h +sys/socket.h: sys_socket.in.h @MKDIR_P@ sys { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \ @@ -26,7 +26,7 @@ sys/socket.h: sys_socket_.h -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)/sys_socket_.h; \ + < $(srcdir)/sys_socket.in.h; \ } > $@-t mv -f $@-t $@ MOSTLYCLEANFILES += sys/socket.h sys/socket.h-t