# HG changeset patch # User Simon Josefsson # Date 1136903332 0 # Node ID 169ab032c734e5260fa93a07fdf70275922780ba # Parent f0b048cba3a9aeb2896491d299dbab8e503cddab Add sys_socket module. diff --git a/ChangeLog b/ChangeLog --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2006-01-10 Simon Josefsson + + * modules/sys_socket: New file. + 2006-01-07 Bruno Haible * gnulib-tool (func_emit_tests_Makefile_am): Emit an empty SUBDIR diff --git a/lib/ChangeLog b/lib/ChangeLog --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,3 +1,7 @@ +2006-01-10 Simon Josefsson + + * socket_.h: New file. + 2006-01-10 Bruno Haible * localcharset.c: Update from GNU gettext. diff --git a/lib/socket_.h b/lib/socket_.h new file mode 100644 --- /dev/null +++ b/lib/socket_.h @@ -0,0 +1,37 @@ +/* Provide a sys/socket header file for systems lacking it (read: mingw32). + Copyright (C) 2005, 2006 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. */ + +#ifndef _SYS_SOCKET_H +#define _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. + + Currently only mingw32 is supported, which has the header files + winsock2.h and ws2tcpip.h that declare the sys/socket.h definitions + we need. */ + +#if HAVE_WINSOCK2_H +# include +#endif +#if HAVE_WS2TCPIP_H +# include +#endif + +#endif /* _SYS_SOCKET_H */ diff --git a/m4/ChangeLog b/m4/ChangeLog --- a/m4/ChangeLog +++ b/m4/ChangeLog @@ -1,3 +1,7 @@ +2006-01-10 Simon Josefsson + + * sys_socket_h.m4: New file. + 2006-01-10 Bruno Haible * localcharset.m4 (gl_LOCALCHARSET): Also test for getc_unlocked. diff --git a/m4/sys_socket_h.m4 b/m4/sys_socket_h.m4 new file mode 100644 --- /dev/null +++ b/m4/sys_socket_h.m4 @@ -0,0 +1,19 @@ +# sys_socket_h.m4 serial 1 +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 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 + SYS_SOCKET_H='' + else + AC_CHECK_HEADERS_ONCE([winsock2.h ws2tcpip.h]) + SYS_SOCKET_H='sys/socket.h' + fi + AC_SUBST(SYS_SOCKET_H) +]) diff --git a/modules/sys_socket b/modules/sys_socket new file mode 100644 --- /dev/null +++ b/modules/sys_socket @@ -0,0 +1,35 @@ +Description: +A for systems lacking it. + +Files: +lib/socket_.h +m4/sys_socket_h.m4 + +Depends-on: + +configure.ac: +gl_HEADER_SYS_SOCKET + +Makefile.am: +BUILT_SOURCES += $(SYS_SOCKET_H) +EXTRA_DIST += 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: socket_.h + test -d sys || mkdir sys + cp $(srcdir)/socket_.h $@-t + mv $@-t $@ +MOSTLYCLEANFILES += sys/socket.h sys/socket.h-t + +mostlyclean-local: + -rmdir sys 2>/dev/null + +Include: +#include + +License: +LGPL + +Maintainer: +Simon Josefsson