From b8dff30e13560a9a3f973c6334f8b39917004e37 Mon Sep 17 00:00:00 2001 From: Simon Josefsson Date: Tue, 10 Jan 2006 14:28:52 +0000 Subject: [PATCH] Add sys_socket module. --- ChangeLog | 4 ++++ lib/ChangeLog | 4 ++++ lib/socket_.h | 37 +++++++++++++++++++++++++++++++++++++ m4/ChangeLog | 4 ++++ m4/sys_socket_h.m4 | 19 +++++++++++++++++++ modules/sys_socket | 35 +++++++++++++++++++++++++++++++++++ 6 files changed, 103 insertions(+) create mode 100644 lib/socket_.h create mode 100644 m4/sys_socket_h.m4 create mode 100644 modules/sys_socket diff --git a/ChangeLog b/ChangeLog index c62cb38dea..3af1bc40de 100644 --- 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 index 7d87fcb22b..ccad8070cc 100644 --- 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 index 0000000000..f3a63b72e2 --- /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 index 35e0441945..3dbe1c929e 100644 --- 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 index 0000000000..10d042c321 --- /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 index 0000000000..5da2ac5bdb --- /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 -- 2.30.2