summaryrefslogtreecommitdiffstats
path: root/gl/m4/time_h.m4
diff options
context:
space:
mode:
Diffstat (limited to 'gl/m4/time_h.m4')
-rw-r--r--gl/m4/time_h.m462
1 files changed, 40 insertions, 22 deletions
diff --git a/gl/m4/time_h.m4 b/gl/m4/time_h.m4
index d42a635e..b88ba94d 100644
--- a/gl/m4/time_h.m4
+++ b/gl/m4/time_h.m4
@@ -1,7 +1,6 @@
1# Configure a more-standard replacement for <time.h>. 1# Configure a more-standard replacement for <time.h>.
2 2
3# Copyright (C) 2000, 2001, 2003, 2004, 2005, 2006, 2007 Free Software 3# Copyright (C) 2000-2001, 2003-2007, 2009-2010 Free Software Foundation, Inc.
4# Foundation, Inc.
5 4
6# This file is free software; the Free Software Foundation 5# This file is free software; the Free Software Foundation
7# gives unlimited permission to copy and/or distribute it, 6# gives unlimited permission to copy and/or distribute it,
@@ -24,17 +23,6 @@ AC_DEFUN([gl_HEADER_TIME_H_BODY],
24 AC_REQUIRE([gl_CHECK_TYPE_STRUCT_TIMESPEC]) 23 AC_REQUIRE([gl_CHECK_TYPE_STRUCT_TIMESPEC])
25]) 24])
26 25
27AC_DEFUN([gl_HEADER_TIME_H_DEFAULTS],
28[
29 dnl If another module says to replace or to not replace, do that.
30 dnl Otherwise, replace only if someone compiles with -DGNULIB_PORTCHECK;
31 dnl this lets maintainers check for portability.
32 REPLACE_LOCALTIME_R=GNULIB_PORTCHECK; AC_SUBST([REPLACE_LOCALTIME_R])
33 REPLACE_NANOSLEEP=GNULIB_PORTCHECK; AC_SUBST([REPLACE_NANOSLEEP])
34 REPLACE_STRPTIME=GNULIB_PORTCHECK; AC_SUBST([REPLACE_STRPTIME])
35 REPLACE_TIMEGM=GNULIB_PORTCHECK; AC_SUBST([REPLACE_TIMEGM])
36])
37
38dnl Define HAVE_STRUCT_TIMESPEC if `struct timespec' is declared 26dnl Define HAVE_STRUCT_TIMESPEC if `struct timespec' is declared
39dnl in time.h or sys/time.h. 27dnl in time.h or sys/time.h.
40 28
@@ -45,9 +33,9 @@ AC_DEFUN([gl_CHECK_TYPE_STRUCT_TIMESPEC],
45 [gl_cv_sys_struct_timespec_in_time_h], 33 [gl_cv_sys_struct_timespec_in_time_h],
46 [AC_COMPILE_IFELSE( 34 [AC_COMPILE_IFELSE(
47 [AC_LANG_PROGRAM( 35 [AC_LANG_PROGRAM(
48 [[#include <time.h> 36 [[#include <time.h>
49 ]], 37 ]],
50 [[static struct timespec x; x.tv_sec = x.tv_nsec;]])], 38 [[static struct timespec x; x.tv_sec = x.tv_nsec;]])],
51 [gl_cv_sys_struct_timespec_in_time_h=yes], 39 [gl_cv_sys_struct_timespec_in_time_h=yes],
52 [gl_cv_sys_struct_timespec_in_time_h=no])]) 40 [gl_cv_sys_struct_timespec_in_time_h=no])])
53 41
@@ -59,12 +47,12 @@ AC_DEFUN([gl_CHECK_TYPE_STRUCT_TIMESPEC],
59 AC_CACHE_CHECK([for struct timespec in <sys/time.h>], 47 AC_CACHE_CHECK([for struct timespec in <sys/time.h>],
60 [gl_cv_sys_struct_timespec_in_sys_time_h], 48 [gl_cv_sys_struct_timespec_in_sys_time_h],
61 [AC_COMPILE_IFELSE( 49 [AC_COMPILE_IFELSE(
62 [AC_LANG_PROGRAM( 50 [AC_LANG_PROGRAM(
63 [[#include <sys/time.h> 51 [[#include <sys/time.h>
64 ]], 52 ]],
65 [[static struct timespec x; x.tv_sec = x.tv_nsec;]])], 53 [[static struct timespec x; x.tv_sec = x.tv_nsec;]])],
66 [gl_cv_sys_struct_timespec_in_sys_time_h=yes], 54 [gl_cv_sys_struct_timespec_in_sys_time_h=yes],
67 [gl_cv_sys_struct_timespec_in_sys_time_h=no])]) 55 [gl_cv_sys_struct_timespec_in_sys_time_h=no])])
68 if test $gl_cv_sys_struct_timespec_in_sys_time_h = yes; then 56 if test $gl_cv_sys_struct_timespec_in_sys_time_h = yes; then
69 SYS_TIME_H_DEFINES_STRUCT_TIMESPEC=1 57 SYS_TIME_H_DEFINES_STRUCT_TIMESPEC=1
70 fi 58 fi
@@ -72,3 +60,33 @@ AC_DEFUN([gl_CHECK_TYPE_STRUCT_TIMESPEC],
72 AC_SUBST([TIME_H_DEFINES_STRUCT_TIMESPEC]) 60 AC_SUBST([TIME_H_DEFINES_STRUCT_TIMESPEC])
73 AC_SUBST([SYS_TIME_H_DEFINES_STRUCT_TIMESPEC]) 61 AC_SUBST([SYS_TIME_H_DEFINES_STRUCT_TIMESPEC])
74]) 62])
63
64AC_DEFUN([gl_TIME_MODULE_INDICATOR],
65[
66 dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
67 AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS])
68 gl_MODULE_INDICATOR_SET_VARIABLE([$1])
69 dnl Define it also as a C macro, for the benefit of the unit tests.
70 gl_MODULE_INDICATOR_FOR_TESTS([$1])
71])
72
73AC_DEFUN([gl_HEADER_TIME_H_DEFAULTS],
74[
75 GNULIB_MKTIME=0; AC_SUBST([GNULIB_MKTIME])
76 GNULIB_NANOSLEEP=0; AC_SUBST([GNULIB_NANOSLEEP])
77 GNULIB_STRPTIME=0; AC_SUBST([GNULIB_STRPTIME])
78 GNULIB_TIMEGM=0; AC_SUBST([GNULIB_TIMEGM])
79 GNULIB_TIME_R=0; AC_SUBST([GNULIB_TIME_R])
80 dnl Assume proper GNU behavior unless another module says otherwise.
81 HAVE_LOCALTIME_R=1; AC_SUBST([HAVE_LOCALTIME_R])
82 HAVE_NANOSLEEP=1; AC_SUBST([HAVE_NANOSLEEP])
83 HAVE_STRPTIME=1; AC_SUBST([HAVE_STRPTIME])
84 HAVE_TIMEGM=1; AC_SUBST([HAVE_TIMEGM])
85 dnl If another module says to replace or to not replace, do that.
86 dnl Otherwise, replace only if someone compiles with -DGNULIB_PORTCHECK;
87 dnl this lets maintainers check for portability.
88 REPLACE_LOCALTIME_R=GNULIB_PORTCHECK; AC_SUBST([REPLACE_LOCALTIME_R])
89 REPLACE_MKTIME=GNULIB_PORTCHECK; AC_SUBST([REPLACE_MKTIME])
90 REPLACE_NANOSLEEP=GNULIB_PORTCHECK; AC_SUBST([REPLACE_NANOSLEEP])
91 REPLACE_TIMEGM=GNULIB_PORTCHECK; AC_SUBST([REPLACE_TIMEGM])
92])