2010/3/20 Eric Blake <ebl...@redhat.com>: > On 03/19/2010 05:35 PM, Matthias Bolte wrote: >>> I believe this will solve the issue, but would appreciate some testing >>> by Matthias. I also think that this is the same issue as: >>> http://lists.gnu.org/archive/html/bug-gnulib/2010-01/msg00183.html >>> >> >> I tested this patch and can confirm that this patch fixes the >> gethostname compile issue on MinGW. Thanks. > > I think the patch works for including <sys/socket.h> first, but what > happens if you include <unistd.h> or <winsock2.h> first? I think > there's still some circularities that need to be resolved. That is, > gnulib's unistd.h needs to be smarter about ensuring that winsock2.h is > completely included prior to getting to its own replacements. I'm > working on a respin along these lines... >
The first version of the patch solves the problem for the current gnulib code. But as you already supposed, if I change sockets.c to include <winsock2.h> before <sys/socket.h> (actually before "sockets.h", because it also includes <sys/socket.h>), then the problem is back again. On the other hand including <unistd.h> before <sys/socket.h> works. Matthias