bug-gnulib
[Top][All Lists]
Advanced

[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: Wed, 06 Jul 2011 01:21:24 -0700
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.17) Gecko/20110516 Thunderbird/3.1.10

On 07/03/11 16:31, Bruno Haible wrote:
> On native Windows,
>   - <sys/socket.h> does not exist natively; gnulib provides it.
>   - The type fd_set and the FD_ZERO etc. macros are defined in <winsock2.h>.
>     Before your patch they were included via #include <sys/socket.h> which did
>     #include <winsock2.h>; now they are missing.
>   - The gnulib macro that defines HAVE_WINSOCK2_H is gl_HEADER_SYS_SOCKET or,
>     at least, gl_PREREQ_SYS_H_WINSOCK2. Such an invocation is fortunately 
> still
>     present in m4/sys_select_h.m4.

Thanks for that analysis.  Windows is not my strong suit, but does the
following little patch look reasonable?

diff --git a/lib/sys_select.in.h b/lib/sys_select.in.h
index 8cbeb66..cc39eed 100644
--- a/lib/sys_select.in.h
+++ b/lib/sys_select.in.h
@@ -84,11 +84,9 @@
 # if defined __hpux
 #  include <string.h>
 # endif
-/* 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>.  */
-# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
-#  include <sys/socket.h>
+/* On native Windows platforms, get the 'fd_set' type and related macros.  */
+# if @HAVE_WINSOCK2_H@
+#  include <winsock2.h>
 # endif
 #endif
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]