]> Savannah Git Hosting - gnulib.git/commitdiff
time: port to MinGW32 3.21
authorPaul Eggert <eggert@cs.ucla.edu>
Fri, 16 Jan 2015 01:37:14 +0000 (17:37 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Fri, 16 Jan 2015 01:37:49 +0000 (17:37 -0800)
Problem reported by Eli Zaretskii in:
http://lists.gnu.org/archive/html/bug-gnulib/2015-01/msg00042.html
* lib/time.in.h:
* m4/time_h.m4 (gl_CHECK_TYPE_STRUCT_TIMESPEC):
* modules/time (Depends-on):
Fall back on unistd.h if the other include files don't define
struct timespec.

ChangeLog
lib/time.in.h
m4/time_h.m4
modules/time

index d1e878abb4bde96e117822c9dd5be7dc9d62a1a5..3a7ee141d85dcd80633d91b5ca04f002ef945722 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 2015-01-15  Paul Eggert  <eggert@cs.ucla.edu>
 
+       time: port to MinGW32 3.21
+       Problem reported by Eli Zaretskii in:
+       http://lists.gnu.org/archive/html/bug-gnulib/2015-01/msg00042.html
+       * lib/time.in.h:
+       * m4/time_h.m4 (gl_CHECK_TYPE_STRUCT_TIMESPEC):
+       * modules/time (Depends-on):
+       Fall back on unistd.h if the other include files don't define
+       struct timespec.
+
        update-copyright: apply to self
        * build-aux/update-copyright: Fix copyright date.  How ironic!
 
index 74bc1542a7a159e2f866bbee401b354bd4d77ce7..c374aebb96ae609954fca48e10346a4d13f15276 100644 (file)
@@ -55,6 +55,8 @@
 #   include <sys/time.h>
 #  elif @PTHREAD_H_DEFINES_STRUCT_TIMESPEC@
 #   include <pthread.h>
+#  elif @UNISTD_H_DEFINES_STRUCT_TIMESPEC@
+#   include <unistd.h>
 #  else
 
 #   ifdef __cplusplus
index 0f0b7d9a2acecd15f6e26d7ac7ed6322fe6b7e8e..d9c41a48f3392c9bc53578643fd47f97216788bd 100644 (file)
@@ -2,7 +2,7 @@
 
 # Copyright (C) 2000-2001, 2003-2007, 2009-2015 Free Software Foundation, Inc.
 
-# serial 8
+# serial 9
 
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -26,7 +26,7 @@ AC_DEFUN([gl_HEADER_TIME_H_BODY],
 ])
 
 dnl Check whether 'struct timespec' is declared
-dnl in time.h, sys/time.h, or pthread.h.
+dnl in time.h, sys/time.h, pthread.h, or unistd.h.
 
 AC_DEFUN([gl_CHECK_TYPE_STRUCT_TIMESPEC],
 [
@@ -44,6 +44,7 @@ AC_DEFUN([gl_CHECK_TYPE_STRUCT_TIMESPEC],
   TIME_H_DEFINES_STRUCT_TIMESPEC=0
   SYS_TIME_H_DEFINES_STRUCT_TIMESPEC=0
   PTHREAD_H_DEFINES_STRUCT_TIMESPEC=0
+  UNISTD_H_DEFINES_STRUCT_TIMESPEC=0
   if test $gl_cv_sys_struct_timespec_in_time_h = yes; then
     TIME_H_DEFINES_STRUCT_TIMESPEC=1
   else
@@ -70,12 +71,26 @@ AC_DEFUN([gl_CHECK_TYPE_STRUCT_TIMESPEC],
            [gl_cv_sys_struct_timespec_in_pthread_h=no])])
       if test $gl_cv_sys_struct_timespec_in_pthread_h = yes; then
         PTHREAD_H_DEFINES_STRUCT_TIMESPEC=1
+      else
+        AC_CACHE_CHECK([for struct timespec in <unistd.h>],
+          [gl_cv_sys_struct_timespec_in_unistd_h],
+          [AC_COMPILE_IFELSE(
+             [AC_LANG_PROGRAM(
+                [[#include <unistd.h>
+                ]],
+                [[static struct timespec x; x.tv_sec = x.tv_nsec;]])],
+             [gl_cv_sys_struct_timespec_in_unistd_h=yes],
+             [gl_cv_sys_struct_timespec_in_unistd_h=no])])
+        if test $gl_cv_sys_struct_timespec_in_unistd_h = yes; then
+          UNISTD_H_DEFINES_STRUCT_TIMESPEC=1
+        fi
       fi
     fi
   fi
   AC_SUBST([TIME_H_DEFINES_STRUCT_TIMESPEC])
   AC_SUBST([SYS_TIME_H_DEFINES_STRUCT_TIMESPEC])
   AC_SUBST([PTHREAD_H_DEFINES_STRUCT_TIMESPEC])
+  AC_SUBST([UNISTD_H_DEFINES_STRUCT_TIMESPEC])
 ])
 
 AC_DEFUN([gl_TIME_MODULE_INDICATOR],
index fd3c05d5f46bf56e32901938480ee05ba2c7fd44..55edc2572fb96a0296b480a9ae775c0d7496036d 100644 (file)
@@ -49,6 +49,7 @@ time.h: time.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(
              -e 's|@''PTHREAD_H_DEFINES_STRUCT_TIMESPEC''@|$(PTHREAD_H_DEFINES_STRUCT_TIMESPEC)|g' \
              -e 's|@''SYS_TIME_H_DEFINES_STRUCT_TIMESPEC''@|$(SYS_TIME_H_DEFINES_STRUCT_TIMESPEC)|g' \
              -e 's|@''TIME_H_DEFINES_STRUCT_TIMESPEC''@|$(TIME_H_DEFINES_STRUCT_TIMESPEC)|g' \
+             -e 's|@''UNISTD_H_DEFINES_STRUCT_TIMESPEC''@|$(UNISTD_H_DEFINES_STRUCT_TIMESPEC)|g' \
              -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
              -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
              -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \