changeset 13043:38940a410ec1

gethostname: further tweaks * lib/unistd.in.h (includes): Only worry about <winsock2.h> if we are overriding gethostname. Suggested by Bruno Haible. Signed-off-by: Eric Blake <eblake@redhat.com>
author Eric Blake <eblake@redhat.com>
date Mon, 22 Mar 2010 14:01:55 -0600
parents 80d3dab738c0
children 7568e65607d2
files ChangeLog lib/unistd.in.h
diffstat 2 files changed, 11 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2010-03-22  Eric Blake  <eblake@redhat.com>
+
+	gethostname: further tweaks
+	* lib/unistd.in.h (includes): Only worry about <winsock2.h> if we
+	are overriding gethostname.
+	Suggested by Bruno Haible.
+
 2010-03-21  Bruno Haible  <bruno@clisp.org>
 
 	Fix comments.
--- a/lib/unistd.in.h
+++ b/lib/unistd.in.h
@@ -19,8 +19,8 @@
    - On mingw, several headers, including <winsock2.h>, include <unistd.h>,
      but we need to ensure that both the system <unistd.h> and <winsock2.h>
      are completely included before we replace gethostname.  */
-#if @UNISTD_H_HAVE_WINSOCK2_H@ && !defined _GL_WINSOCK2_H_WITNESS \
-  && defined _WINSOCK2_H
+#if @GNULIB_GETHOSTNAME@ && @UNISTD_H_HAVE_WINSOCK2_H@ \
+  && !defined _GL_WINSOCK2_H_WITNESS && defined _WINSOCK2_H
 /* <unistd.h> is being indirectly included for the first time from
    <winsock2.h>; avoid declaring any overrides.  */
 # if @HAVE_UNISTD_H@
@@ -43,7 +43,8 @@
 #endif
 
 /* Get all possible declarations of gethostname().  */
-#if @UNISTD_H_HAVE_WINSOCK2_H@ && !defined _GL_INCLUDING_WINSOCK2_H
+#if @GNULIB_GETHOSTNAME@ && @UNISTD_H_HAVE_WINSOCK2_H@ \
+  && !defined _GL_INCLUDING_WINSOCK2_H
 # define _GL_INCLUDING_WINSOCK2_H
 # include <winsock2.h>
 # undef _GL_INCLUDING_WINSOCK2_H