On MSVC 9, strsignal.c gets many compilation errors, because glthread/lock.h includes <windows.h>, which includes <winsock.h>, and <unistd.h> includes <winsock2.h>. The two socket headers collide.
Also, it can get a compilation error because it uses <unistd.h> without depending on the 'unistd' module. This fixes it. 2011-10-03 Bruno Haible <br...@clisp.org> glthread/*, strsignal: Support for MSVC. * lib/glthread/cond.h: Define WIN32_LEAN_AND_MEAN, so as to avoid including <winsock.h> on MSVC 9. * lib/glthread/lock.h: Likewise. * lib/glthread/thread.h: Likewise. * lib/glthread/tls.h: Likewise. * lib/glthread/yield.h: Likewise. * lib/strsignal.c: Include <string.h> first. Don't include <unistd.h> if HAVE_UNISTD_H is false. * m4/strsignal.m4 (gl_PREREQ_STRSIGNAL): Test for <unistd.h>. --- lib/glthread/cond.h.orig Tue Oct 4 01:15:22 2011 +++ lib/glthread/cond.h Tue Oct 4 00:35:09 2011 @@ -271,6 +271,7 @@ #if USE_WIN32_THREADS +# define WIN32_LEAN_AND_MEAN /* avoid including junk */ # include <windows.h> # ifdef __cplusplus --- lib/glthread/lock.h.orig Tue Oct 4 01:15:22 2011 +++ lib/glthread/lock.h Tue Oct 4 00:35:08 2011 @@ -616,6 +616,7 @@ #if USE_WIN32_THREADS +# define WIN32_LEAN_AND_MEAN /* avoid including junk */ # include <windows.h> # ifdef __cplusplus --- lib/glthread/thread.h.orig Tue Oct 4 01:15:22 2011 +++ lib/glthread/thread.h Tue Oct 4 00:35:09 2011 @@ -292,6 +292,7 @@ #if USE_WIN32_THREADS +# define WIN32_LEAN_AND_MEAN /* avoid including junk */ # include <windows.h> # ifdef __cplusplus --- lib/glthread/tls.h.orig Tue Oct 4 01:15:22 2011 +++ lib/glthread/tls.h Tue Oct 4 00:35:09 2011 @@ -222,6 +222,7 @@ #if USE_WIN32_THREADS +# define WIN32_LEAN_AND_MEAN /* avoid including junk */ # include <windows.h> /* ------------------------- gl_tls_key_t datatype ------------------------- */ --- lib/glthread/yield.h.orig Tue Oct 4 01:15:22 2011 +++ lib/glthread/yield.h Tue Oct 4 00:35:09 2011 @@ -91,6 +91,7 @@ #if USE_WIN32_THREADS +# define WIN32_LEAN_AND_MEAN /* avoid including junk */ # include <windows.h> # ifdef __cplusplus --- lib/strsignal.c.orig Tue Oct 4 01:15:22 2011 +++ lib/strsignal.c Tue Oct 4 00:53:30 2011 @@ -19,10 +19,12 @@ # include <config.h> #endif +/* Specification. */ +#include <string.h> + #include <signal.h> #include <stdio.h> #include <stdlib.h> -#include <string.h> #ifdef _LIBC # include <libintl.h> @@ -54,7 +56,9 @@ #else /* !_LIBC */ /* NetBSD declares sys_siglist in unistd.h. */ -# include <unistd.h> +# if HAVE_UNISTD_H +# include <unistd.h> +# endif # define INTUSE(x) (x) --- m4/strsignal.m4.orig Tue Oct 4 01:15:22 2011 +++ m4/strsignal.m4 Tue Oct 4 00:53:17 2011 @@ -1,4 +1,4 @@ -# strsignal.m4 serial 7 +# strsignal.m4 serial 8 dnl Copyright (C) 2008-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -53,6 +53,7 @@ # Prerequisites of lib/strsignal.c. AC_DEFUN([gl_PREREQ_STRSIGNAL], [ + AC_CHECK_HEADERS_ONCE([unistd.h]) AC_REQUIRE([AC_DECL_SYS_SIGLIST]) AC_CHECK_DECLS([_sys_siglist], [], [], [[#include <signal.h>]]) ])