diff options
author | Bruno Haible <bruno@clisp.org> | 2011-09-14 02:08:36 +0200 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2011-09-14 02:08:36 +0200 |
commit | 022647638a69cf8657ccd41eda5dadc2c51c8705 (patch) | |
tree | f5bf5687dd9cc2b3cafa395dd68a1170e755065a /m4/sys_time_h.m4 | |
parent | d21e88b5e6e9c8c1065fbe1d3a641ccd531acc1c (diff) | |
download | gnulib-022647638a69cf8657ccd41eda5dadc2c51c8705.tar.gz |
sys_time: Support for MSVC.
* m4/sys_time_h.m4 (gl_HEADER_SYS_TIME_H_BODY): Invoke
gl_PREREQ_SYS_H_WINSOCK2. When testing for 'struct timeval', also
include <winsock2.h>.
* lib/sys_time.in.h: On MSVC, include <winsock2.h> and hide its
function declarations that collide with POSIX.
* modules/sys_time (Files): Add m4/sys_socket_h.m4.
(Makefile.am): Substitute HAVE_WINSOCK2_H.
Diffstat (limited to 'm4/sys_time_h.m4')
-rw-r--r-- | m4/sys_time_h.m4 | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/m4/sys_time_h.m4 b/m4/sys_time_h.m4 index 3a3adc8c47..064e0deeb7 100644 --- a/m4/sys_time_h.m4 +++ b/m4/sys_time_h.m4 @@ -1,5 +1,5 @@ # Configure a replacement for <sys/time.h>. -# serial 6 +# serial 7 # Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation @@ -27,6 +27,9 @@ AC_DEFUN([gl_HEADER_SYS_TIME_H_BODY], HAVE_SYS_TIME_H=0 fi + dnl On native Windows with MSVC, 'struct timeval' is defined in <winsock2.h> + dnl only. So include that header in the list. + gl_PREREQ_SYS_H_WINSOCK2 AC_CACHE_CHECK([for struct timeval], [gl_cv_sys_struct_timeval], [AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( @@ -34,6 +37,9 @@ AC_DEFUN([gl_HEADER_SYS_TIME_H_BODY], #include <sys/time.h> #endif #include <time.h> + #if HAVE_WINSOCK2_H + # include <winsock2.h> + #endif ]], [[static struct timeval x; x.tv_sec = x.tv_usec;]])], [gl_cv_sys_struct_timeval=yes], |