relocatable-prog: fix link error
[gnulib.git] / lib / sys_socket.in.h
index 72d1150..c42497d 100644 (file)
@@ -194,6 +194,8 @@ struct msghdr {
 
 #endif
 
+/* Fix some definitions from <winsock2.h>.  */
+
 #if @HAVE_WINSOCK2_H@
 
 # if !GNULIB_defined_rpl_fd_isset
@@ -222,28 +224,38 @@ rpl_fd_isset (SOCKET fd, fd_set * set)
 
 #endif
 
-/* Wrap everything else to use libc file descriptors for sockets.  */
+/* Hide some function declarations from <winsock2.h>.  */
 
-#if @HAVE_WINSOCK2_H@ && !defined _@GUARD_PREFIX@_UNISTD_H
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#  undef close
-#  define close close_used_without_including_unistd_h
-# else
-   _GL_WARN_ON_USE (close,
-                    "close() used without including <unistd.h>");
+#if @HAVE_WINSOCK2_H@
+# if !defined _@GUARD_PREFIX@_UNISTD_H
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef close
+#   define close close_used_without_including_unistd_h
+#  else
+    _GL_WARN_ON_USE (close,
+                     "close() used without including <unistd.h>");
+#  endif
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef gethostname
+#   define gethostname gethostname_used_without_including_unistd_h
+#  else
+    _GL_WARN_ON_USE (gethostname,
+                     "gethostname() used without including <unistd.h>");
+#  endif
 # endif
-#endif
-
-#if @HAVE_WINSOCK2_H@ && !defined _@GUARD_PREFIX@_UNISTD_H
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#  undef gethostname
-#  define gethostname gethostname_used_without_including_unistd_h
-# else
-   _GL_WARN_ON_USE (gethostname,
-                    "gethostname() used without including <unistd.h>");
+# if !defined _@GUARD_PREFIX@_SYS_SELECT_H
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef select
+#   define select select_used_without_including_sys_select_h
+#  else
+    _GL_WARN_ON_USE (select,
+                     "select() used without including <sys/select.h>");
+#  endif
 # endif
 #endif
 
+/* Wrap everything else to use libc file descriptors for sockets.  */
+
 #if @GNULIB_SOCKET@
 # if @HAVE_WINSOCK2_H@
 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -633,16 +645,6 @@ _GL_WARN_ON_USE (shutdown, "shutdown is not always POSIX compliant - "
 # endif
 #endif
 
-#if @HAVE_WINSOCK2_H@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#  undef select
-#  define select select_used_without_including_sys_select_h
-# else
-   _GL_WARN_ON_USE (select,
-                    "select() used without including <sys/select.h>");
-# endif
-#endif
-
 #if @GNULIB_ACCEPT4@
 /* Accept a connection on a socket, with specific opening flags.
    The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)