time: work with mingw + pthreads-win32 library
authorEric Blake <eblake@redhat.com>
Wed, 2 Jun 2010 17:08:06 +0000 (11:08 -0600)
committerEric Blake <eblake@redhat.com>
Wed, 2 Jun 2010 20:12:18 +0000 (14:12 -0600)
commitdf6774c09485e6b0f31f4659eb55d50c68c008a8
tree0e506564b8d6f58d55f66474b922f9957e56ae71
parent2988c8c21303fdadb3a9efe321870d96f6bdc668
time: work with mingw + pthreads-win32 library

When using the pthreads-win32 library with mingw, struct timespec
is available in <pthread.h>.  Meanwhile, that header has some
rather buggy macros for localtime_r and gmtime_r that interfere
with proper gnulib replacement header actions.

Tested in a cross-compilation environment: Fedora 13 with mingw32-gcc
and mingw32-pthreads installed.

* m4/time_h.m4 (gl_CHECK_TYPE_STRUCT_TIMESPEC): Set new variable
if timespec is defined only in pthread.h.
* modules/time (Makefile.am): Substitute it.
* lib/time.in.h (!TIME_H_DEFINES_STRUCT_TIMESPEC): Include
<pthread.h>, when needed.
(GNULIB_TIME_R): Undefine broken localtime_r and gmtime_r macros
from the library.

Signed-off-by: Eric Blake <eblake@redhat.com>
ChangeLog
lib/time.in.h
m4/time_h.m4
modules/time