[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: would like to break sys_select's dependency on sys_socket
From: |
Paul Eggert |
Subject: |
Re: would like to break sys_select's dependency on sys_socket |
Date: |
Thu, 30 Jun 2011 11:07:35 -0700 |
User-agent: |
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110428 Fedora/3.1.10-1.fc14 Thunderbird/3.1.10 |
On 06/30/11 04:45, Simon Josefsson wrote:
> Is it native Windows or MinGW?
Sorry, I don't know Windows well enough to answer that question.
For Emacs, Windows support is done completely differently:
it doesn't use gnulib, and it is done by other people, and I
try to avoid thinking about it as much as I can.
On 06/30/11 06:02, Eric Blake wrote:
> But I would be okay with making the use of sys_uio.h
> conditional on whether or not we are overriding sendmsg and recvmsg,
> since they are the only clients of struct msghdr (but that in itself
> entails some work, since we don't yet have sendmsg and recvmsg modules).
That sounds good too, but isn't that for sys_socket? I'm trying
not to use sys_socket in the first place.
Here's what I just now pushed. It works for non-Windows, and it'll
work for Emacs (since Emacs avoids gnulib on Windows), but I'm not
sure it'll work for arbitrary applications that use sys_select but not
sys_socket and that want to run on Windows. (If there are no such
applications then we don't have to worry about it. :-)
If you're in the mood to improve things further, that comment
"Also, gnulib's <sys/socket.h> redefines select
so as to hide the declaration from <winsock2.h>." is a bit confusing,
as gnulib's <sys/select.h> also redefines select in the same way,
and the comment gives the incorrect impression (at least to me) that
the #include is needed to hide 'select'. I left that comment alone, though,
since I don't really understand the Windows side of this.
sys_select: don't depend on sys_socket
This is so that Emacs doesn't have to drag in m4/sockpfaf.m4 etc; see
<http://lists.gnu.org/archive/html/bug-gnulib/2011-06/msg00358.html>.
This fix works on GNU and GNU-like platforms, but has not been tested
on native Windows.
* lib/sys_select.in.h: Include <sys/socket.h> only if native Windows.
* m4/sys_select_h.m4 (gl_HEADER_SYS_SELECT): Do not require
gl_HEADER_SYS_SOCKET.
* modules/sys_select (Files): Add m4/sys_socket_h.m4, for
gl_PREREQ_SYS_H_WINSOCK2.
diff --git a/lib/sys_select.in.h b/lib/sys_select.in.h
index d6d8c7b..ef4c6f3 100644
--- a/lib/sys_select.in.h
+++ b/lib/sys_select.in.h
@@ -80,7 +80,9 @@
/* On native Windows platforms:
Get the 'fd_set' type. Also, gnulib's <sys/socket.h> redefines select
so as to hide the declaration from <winsock2.h>. */
-# include <sys/socket.h>
+# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+# include <sys/socket.h>
+# endif
#endif
/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
diff --git a/m4/sys_select_h.m4 b/m4/sys_select_h.m4
index f167118..5b51af4 100644
--- a/m4/sys_select_h.m4
+++ b/m4/sys_select_h.m4
@@ -1,4 +1,4 @@
-# sys_select_h.m4 serial 16
+# sys_select_h.m4 serial 17
dnl Copyright (C) 2006-2011 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -6,7 +6,6 @@ dnl with or without modifications, as long as this notice is
preserved.
AC_DEFUN([gl_HEADER_SYS_SELECT],
[
- AC_REQUIRE([gl_HEADER_SYS_SOCKET])
AC_REQUIRE([gl_SYS_SELECT_H_DEFAULTS])
AC_CACHE_CHECK([whether <sys/select.h> is self-contained],
[gl_cv_header_sys_select_h_selfcontained],
diff --git a/modules/sys_select b/modules/sys_select
index ef5462a..d0c0209 100644
--- a/modules/sys_select
+++ b/modules/sys_select
@@ -4,11 +4,11 @@ A <sys/select.h> for systems lacking it.
Files:
lib/sys_select.in.h
m4/sys_select_h.m4
+m4/sys_socket_h.m4
Depends-on:
include_next
c++defs
-sys_socket
sys_time
warn-on-use