diff --git a/gettext-tools/src/hostname.c b/gettext-tools/src/hostname.c index e909637..c2e8065 100644 --- a/gettext-tools/src/hostname.c +++ b/gettext-tools/src/hostname.c @@ -29,7 +29,9 @@ #include #if defined _WIN32 +# if !HAVE_GETHOSTNAME # define WIN32_NATIVE +# endif #endif /* Get gethostname(). */ @@ -56,6 +58,9 @@ /* Support for using gethostbyname(). */ #if HAVE_GETHOSTBYNAME +# if HAVE_WINSOCK2_H +# include +# else # include # include /* defines AF_INET, AF_INET6 */ # include /* declares ntohs(), defines struct sockaddr_in */ @@ -76,6 +81,7 @@ # endif # endif # include /* defines struct hostent, declares gethostbyname() */ +# endif #endif /* Include this after , to avoid a syntax error on BeOS. */ diff --git a/libtextstyle/lib/unistd.in.h b/libtextstyle/lib/unistd.in.h index fd69a48..4ebdcaa 100644 --- a/libtextstyle/lib/unistd.in.h +++ b/libtextstyle/lib/unistd.in.h @@ -1240,7 +1240,7 @@ _GL_WARN_ON_USE (getgroups, "getgroups is unportable - " Null terminate it if the name is shorter than LEN. If the host name is longer than LEN, set errno = EINVAL and return -1. Return 0 if successful, otherwise set errno and return -1. */ -# if @UNISTD_H_HAVE_WINSOCK2_H@ +# if @UNISTD_H_HAVE_WINSOCK2_H@ && !@HAVE_GETHOSTNAME@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef gethostname # define gethostname rpl_gethostname