From c684ca1db2ffbdffb3c907c9c5b4bd5caf6b6f8a Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Tue, 4 Oct 2011 01:19:29 +0200 Subject: [PATCH] glthread/*, strsignal: Support for MSVC. * lib/glthread/cond.h: Define WIN32_LEAN_AND_MEAN, so as to avoid including 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 first. Don't include if HAVE_UNISTD_H is false. * m4/strsignal.m4 (gl_PREREQ_STRSIGNAL): Test for . --- ChangeLog | 13 +++++++++++++ lib/glthread/cond.h | 1 + lib/glthread/lock.h | 1 + lib/glthread/thread.h | 1 + lib/glthread/tls.h | 1 + lib/glthread/yield.h | 1 + lib/strsignal.c | 8 ++++++-- m4/strsignal.m4 | 3 ++- 8 files changed, 26 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7f9e391f6..7bacbfe8a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,18 @@ 2011-10-03 Bruno Haible + glthread/*, strsignal: Support for MSVC. + * lib/glthread/cond.h: Define WIN32_LEAN_AND_MEAN, so as to avoid + including 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 first. Don't include + if HAVE_UNISTD_H is false. + * m4/strsignal.m4 (gl_PREREQ_STRSIGNAL): Test for . + +2011-10-03 Bruno Haible + nonblocking tests: Fix test failure on OpenBSD/SPARC64. * tests/test-nonblocking-socket.h (SOCKET_DATA_BLOCK_SIZE) [OpenBSD]: Set to 100000. diff --git a/lib/glthread/cond.h b/lib/glthread/cond.h index dc976468a..e2050458a 100644 --- a/lib/glthread/cond.h +++ b/lib/glthread/cond.h @@ -271,6 +271,7 @@ extern int glthread_cond_timedwait_multithreaded (gl_cond_t *cond, gl_lock_t *lo #if USE_WIN32_THREADS +# define WIN32_LEAN_AND_MEAN /* avoid including junk */ # include # ifdef __cplusplus diff --git a/lib/glthread/lock.h b/lib/glthread/lock.h index 20954133a..f764d141b 100644 --- a/lib/glthread/lock.h +++ b/lib/glthread/lock.h @@ -616,6 +616,7 @@ extern int glthread_once_singlethreaded (gl_once_t *once_control); #if USE_WIN32_THREADS +# define WIN32_LEAN_AND_MEAN /* avoid including junk */ # include # ifdef __cplusplus diff --git a/lib/glthread/thread.h b/lib/glthread/thread.h index 3d7f7601d..be13ed972 100644 --- a/lib/glthread/thread.h +++ b/lib/glthread/thread.h @@ -292,6 +292,7 @@ typedef thread_t gl_thread_t; #if USE_WIN32_THREADS +# define WIN32_LEAN_AND_MEAN /* avoid including junk */ # include # ifdef __cplusplus diff --git a/lib/glthread/tls.h b/lib/glthread/tls.h index 0ef32c017..4f3998690 100644 --- a/lib/glthread/tls.h +++ b/lib/glthread/tls.h @@ -222,6 +222,7 @@ extern void *glthread_tls_get_multithreaded (thread_key_t key); #if USE_WIN32_THREADS +# define WIN32_LEAN_AND_MEAN /* avoid including junk */ # include /* ------------------------- gl_tls_key_t datatype ------------------------- */ diff --git a/lib/glthread/yield.h b/lib/glthread/yield.h index 6911d02f2..04823151c 100644 --- a/lib/glthread/yield.h +++ b/lib/glthread/yield.h @@ -91,6 +91,7 @@ extern "C" { #if USE_WIN32_THREADS +# define WIN32_LEAN_AND_MEAN /* avoid including junk */ # include # ifdef __cplusplus diff --git a/lib/strsignal.c b/lib/strsignal.c index 5a415ca71..7caab1d45 100644 --- a/lib/strsignal.c +++ b/lib/strsignal.c @@ -19,10 +19,12 @@ # include #endif +/* Specification. */ +#include + #include #include #include -#include #ifdef _LIBC # include @@ -54,7 +56,9 @@ extern const char *const _sys_siglist_internal[] attribute_hidden; #else /* !_LIBC */ /* NetBSD declares sys_siglist in unistd.h. */ -# include +# if HAVE_UNISTD_H +# include +# endif # define INTUSE(x) (x) diff --git a/m4/strsignal.m4 b/m4/strsignal.m4 index 9c9c4110b..f4b014335 100644 --- a/m4/strsignal.m4 +++ b/m4/strsignal.m4 @@ -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 @@ AC_DEFUN([gl_FUNC_STRSIGNAL], # 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 ]]) ]) -- 2.11.0