annotate m4/mktime.m4 @ 15308:a3ba680ad389

strerror_r: fix OpenBSD behavior on 0 OpenBSD treats strerror_r(0,,) as a success, but with a message "Undefined error: 0"; while this is distinct from strerror_r(-1,,) returning "Unknown error: -1", it does not imply success. Meanwhile, if buf is short enough for ERANGE, then we can't use strstr to look for "Unknown" or "Undefined" in the resulting message, like we had been doing for strerror(). Fix this by shifting the burden - now the strerror-override code guarantees that 0 will have an override when needed. * lib/strerror-override.c (strerror_override): Also override 0 when needed. * lib/strerror-override.h (strerror_override): Likewise. * lib/strerror.c (strerror): Simplify, now that 0 override is done earlier. * lib/strerror_r.c (strerror_r): Likewise. * m4/strerror.m4 (gl_FUNC_STRERROR): Split detection of 0 behavior... (gl_FUNC_STRERROR_0): ...into new macro. * m4/strerror_r.m4 (gl_FUNC_STRERROR_R): Replace strerror_r if 0 is overridden. (gl_FUNC_STRERROR_R_WORKS): Avoid extra tests if 0 is broken. * modules/strerror-override (Files): Add strerror.m4. (configure.ac): Also provide override for 0 when needed. * doc/posix-functions/strerror.texi (strerror): Document this. * doc/posix-functions/perror.texi (perror): Likewise. Signed-off-by: Eric Blake <eblake@redhat.com>
author Eric Blake <eblake@redhat.com>
date Tue, 21 Jun 2011 08:50:51 -0600
parents d8eeaab555f5
children 8250f2777afc
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15053
d8eeaab555f5 mktime: Respect rules for use of AC_LIBOBJ.
Bruno Haible <bruno@clisp.org>
parents: 14796
diff changeset
1 # serial 21
14079
97fc9a21a8fb maint: update almost all copyright ranges to include 2011
Jim Meyering <meyering@redhat.com>
parents: 13918
diff changeset
2 dnl Copyright (C) 2002-2003, 2005-2007, 2009-2011 Free Software Foundation,
12559
c2cbabec01dd update nearly all FSF copyright year lists to include 2010
Jim Meyering <meyering@redhat.com>
parents: 12421
diff changeset
3 dnl Inc.
5611
87c42e194f4a Use an all-permissive copyright notice, recommended by RMS.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4666
diff changeset
4 dnl This file is free software; the Free Software Foundation
87c42e194f4a Use an all-permissive copyright notice, recommended by RMS.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4666
diff changeset
5 dnl gives unlimited permission to copy and/or distribute it,
87c42e194f4a Use an all-permissive copyright notice, recommended by RMS.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4666
diff changeset
6 dnl with or without modifications, as long as this notice is preserved.
4107
7c1a6b73f48e An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
7
7c1a6b73f48e An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
8 dnl From Jim Meyering.
7c1a6b73f48e An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
9
15053
d8eeaab555f5 mktime: Respect rules for use of AC_LIBOBJ.
Bruno Haible <bruno@clisp.org>
parents: 14796
diff changeset
10 AC_DEFUN([gl_FUNC_MKTIME],
d8eeaab555f5 mktime: Respect rules for use of AC_LIBOBJ.
Bruno Haible <bruno@clisp.org>
parents: 14796
diff changeset
11 [
d8eeaab555f5 mktime: Respect rules for use of AC_LIBOBJ.
Bruno Haible <bruno@clisp.org>
parents: 14796
diff changeset
12 AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS])
d8eeaab555f5 mktime: Respect rules for use of AC_LIBOBJ.
Bruno Haible <bruno@clisp.org>
parents: 14796
diff changeset
13
d8eeaab555f5 mktime: Respect rules for use of AC_LIBOBJ.
Bruno Haible <bruno@clisp.org>
parents: 14796
diff changeset
14 dnl We don't use AC_FUNC_MKTIME any more, because it is no longer maintained
d8eeaab555f5 mktime: Respect rules for use of AC_LIBOBJ.
Bruno Haible <bruno@clisp.org>
parents: 14796
diff changeset
15 dnl in Autoconf and because it invokes AC_LIBOBJ.
d8eeaab555f5 mktime: Respect rules for use of AC_LIBOBJ.
Bruno Haible <bruno@clisp.org>
parents: 14796
diff changeset
16 AC_CHECK_HEADERS_ONCE([unistd.h])
d8eeaab555f5 mktime: Respect rules for use of AC_LIBOBJ.
Bruno Haible <bruno@clisp.org>
parents: 14796
diff changeset
17 AC_CHECK_FUNCS_ONCE([alarm])
d8eeaab555f5 mktime: Respect rules for use of AC_LIBOBJ.
Bruno Haible <bruno@clisp.org>
parents: 14796
diff changeset
18 AC_REQUIRE([gl_MULTIARCH])
d8eeaab555f5 mktime: Respect rules for use of AC_LIBOBJ.
Bruno Haible <bruno@clisp.org>
parents: 14796
diff changeset
19 if test $APPLE_UNIVERSAL_BUILD = 1; then
d8eeaab555f5 mktime: Respect rules for use of AC_LIBOBJ.
Bruno Haible <bruno@clisp.org>
parents: 14796
diff changeset
20 # A universal build on Apple MacOS X platforms.
d8eeaab555f5 mktime: Respect rules for use of AC_LIBOBJ.
Bruno Haible <bruno@clisp.org>
parents: 14796
diff changeset
21 # The test result would be 'yes' in 32-bit mode and 'no' in 64-bit mode.
d8eeaab555f5 mktime: Respect rules for use of AC_LIBOBJ.
Bruno Haible <bruno@clisp.org>
parents: 14796
diff changeset
22 # But we need a configuration result that is valid in both modes.
d8eeaab555f5 mktime: Respect rules for use of AC_LIBOBJ.
Bruno Haible <bruno@clisp.org>
parents: 14796
diff changeset
23 gl_cv_func_working_mktime=no
d8eeaab555f5 mktime: Respect rules for use of AC_LIBOBJ.
Bruno Haible <bruno@clisp.org>
parents: 14796
diff changeset
24 fi
d8eeaab555f5 mktime: Respect rules for use of AC_LIBOBJ.
Bruno Haible <bruno@clisp.org>
parents: 14796
diff changeset
25 AC_CACHE_CHECK([for working mktime], [gl_cv_func_working_mktime],
d8eeaab555f5 mktime: Respect rules for use of AC_LIBOBJ.
Bruno Haible <bruno@clisp.org>
parents: 14796
diff changeset
26 [AC_RUN_IFELSE(
d8eeaab555f5 mktime: Respect rules for use of AC_LIBOBJ.
Bruno Haible <bruno@clisp.org>
parents: 14796
diff changeset
27 [AC_LANG_SOURCE(
4348
fc8667232bcc Ensure we use gnulib mktime rather than glibc's mktime, on hosts
Paul Eggert <eggert@cs.ucla.edu>
parents: 4107
diff changeset
28 [[/* Test program from Paul Eggert and Tony Leneis. */
7734
6cc7c62f16f7 * m4/mktime.m4 (AC_FUNC_MKTIME): Sync from Autoconf.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7276
diff changeset
29 #include <limits.h>
6275
fd0ccce602e4 Sync from coreutils.
Paul Eggert <eggert@cs.ucla.edu>
parents: 5611
diff changeset
30 #include <stdlib.h>
7897
b7a83a69ac23 * MODULES.html.sh (Support for systems lacking POSIX:2001): New
Paul Eggert <eggert@cs.ucla.edu>
parents: 7734
diff changeset
31 #include <time.h>
4348
fc8667232bcc Ensure we use gnulib mktime rather than glibc's mktime, on hosts
Paul Eggert <eggert@cs.ucla.edu>
parents: 4107
diff changeset
32
7276
4be2c469b318 * config/srclist.txt: Temporarily comment out mktime.c until glibc bug
Paul Eggert <eggert@cs.ucla.edu>
parents: 6275
diff changeset
33 #ifdef HAVE_UNISTD_H
4be2c469b318 * config/srclist.txt: Temporarily comment out mktime.c until glibc bug
Paul Eggert <eggert@cs.ucla.edu>
parents: 6275
diff changeset
34 # include <unistd.h>
4be2c469b318 * config/srclist.txt: Temporarily comment out mktime.c until glibc bug
Paul Eggert <eggert@cs.ucla.edu>
parents: 6275
diff changeset
35 #endif
4be2c469b318 * config/srclist.txt: Temporarily comment out mktime.c until glibc bug
Paul Eggert <eggert@cs.ucla.edu>
parents: 6275
diff changeset
36
4be2c469b318 * config/srclist.txt: Temporarily comment out mktime.c until glibc bug
Paul Eggert <eggert@cs.ucla.edu>
parents: 6275
diff changeset
37 #ifndef HAVE_ALARM
4348
fc8667232bcc Ensure we use gnulib mktime rather than glibc's mktime, on hosts
Paul Eggert <eggert@cs.ucla.edu>
parents: 4107
diff changeset
38 # define alarm(X) /* empty */
fc8667232bcc Ensure we use gnulib mktime rather than glibc's mktime, on hosts
Paul Eggert <eggert@cs.ucla.edu>
parents: 4107
diff changeset
39 #endif
fc8667232bcc Ensure we use gnulib mktime rather than glibc's mktime, on hosts
Paul Eggert <eggert@cs.ucla.edu>
parents: 4107
diff changeset
40
fc8667232bcc Ensure we use gnulib mktime rather than glibc's mktime, on hosts
Paul Eggert <eggert@cs.ucla.edu>
parents: 4107
diff changeset
41 /* Work around redefinition to rpl_putenv by other config tests. */
fc8667232bcc Ensure we use gnulib mktime rather than glibc's mktime, on hosts
Paul Eggert <eggert@cs.ucla.edu>
parents: 4107
diff changeset
42 #undef putenv
fc8667232bcc Ensure we use gnulib mktime rather than glibc's mktime, on hosts
Paul Eggert <eggert@cs.ucla.edu>
parents: 4107
diff changeset
43
fc8667232bcc Ensure we use gnulib mktime rather than glibc's mktime, on hosts
Paul Eggert <eggert@cs.ucla.edu>
parents: 4107
diff changeset
44 static time_t time_t_max;
fc8667232bcc Ensure we use gnulib mktime rather than glibc's mktime, on hosts
Paul Eggert <eggert@cs.ucla.edu>
parents: 4107
diff changeset
45 static time_t time_t_min;
fc8667232bcc Ensure we use gnulib mktime rather than glibc's mktime, on hosts
Paul Eggert <eggert@cs.ucla.edu>
parents: 4107
diff changeset
46
fc8667232bcc Ensure we use gnulib mktime rather than glibc's mktime, on hosts
Paul Eggert <eggert@cs.ucla.edu>
parents: 4107
diff changeset
47 /* Values we'll use to set the TZ environment variable. */
fc8667232bcc Ensure we use gnulib mktime rather than glibc's mktime, on hosts
Paul Eggert <eggert@cs.ucla.edu>
parents: 4107
diff changeset
48 static char *tz_strings[] = {
fc8667232bcc Ensure we use gnulib mktime rather than glibc's mktime, on hosts
Paul Eggert <eggert@cs.ucla.edu>
parents: 4107
diff changeset
49 (char *) 0, "TZ=GMT0", "TZ=JST-9",
fc8667232bcc Ensure we use gnulib mktime rather than glibc's mktime, on hosts
Paul Eggert <eggert@cs.ucla.edu>
parents: 4107
diff changeset
50 "TZ=EST+3EDT+2,M10.1.0/00:00:00,M2.3.0/00:00:00"
fc8667232bcc Ensure we use gnulib mktime rather than glibc's mktime, on hosts
Paul Eggert <eggert@cs.ucla.edu>
parents: 4107
diff changeset
51 };
fc8667232bcc Ensure we use gnulib mktime rather than glibc's mktime, on hosts
Paul Eggert <eggert@cs.ucla.edu>
parents: 4107
diff changeset
52 #define N_STRINGS (sizeof (tz_strings) / sizeof (tz_strings[0]))
fc8667232bcc Ensure we use gnulib mktime rather than glibc's mktime, on hosts
Paul Eggert <eggert@cs.ucla.edu>
parents: 4107
diff changeset
53
7276
4be2c469b318 * config/srclist.txt: Temporarily comment out mktime.c until glibc bug
Paul Eggert <eggert@cs.ucla.edu>
parents: 6275
diff changeset
54 /* Return 0 if mktime fails to convert a date in the spring-forward gap.
4348
fc8667232bcc Ensure we use gnulib mktime rather than glibc's mktime, on hosts
Paul Eggert <eggert@cs.ucla.edu>
parents: 4107
diff changeset
55 Based on a problem report from Andreas Jaeger. */
7276
4be2c469b318 * config/srclist.txt: Temporarily comment out mktime.c until glibc bug
Paul Eggert <eggert@cs.ucla.edu>
parents: 6275
diff changeset
56 static int
4348
fc8667232bcc Ensure we use gnulib mktime rather than glibc's mktime, on hosts
Paul Eggert <eggert@cs.ucla.edu>
parents: 4107
diff changeset
57 spring_forward_gap ()
fc8667232bcc Ensure we use gnulib mktime rather than glibc's mktime, on hosts
Paul Eggert <eggert@cs.ucla.edu>
parents: 4107
diff changeset
58 {
fc8667232bcc Ensure we use gnulib mktime rather than glibc's mktime, on hosts
Paul Eggert <eggert@cs.ucla.edu>
parents: 4107
diff changeset
59 /* glibc (up to about 1998-10-07) failed this test. */
fc8667232bcc Ensure we use gnulib mktime rather than glibc's mktime, on hosts
Paul Eggert <eggert@cs.ucla.edu>
parents: 4107
diff changeset
60 struct tm tm;
fc8667232bcc Ensure we use gnulib mktime rather than glibc's mktime, on hosts
Paul Eggert <eggert@cs.ucla.edu>
parents: 4107
diff changeset
61
fc8667232bcc Ensure we use gnulib mktime rather than glibc's mktime, on hosts
Paul Eggert <eggert@cs.ucla.edu>
parents: 4107
diff changeset
62 /* Use the portable POSIX.1 specification "TZ=PST8PDT,M4.1.0,M10.5.0"
fc8667232bcc Ensure we use gnulib mktime rather than glibc's mktime, on hosts
Paul Eggert <eggert@cs.ucla.edu>
parents: 4107
diff changeset
63 instead of "TZ=America/Vancouver" in order to detect the bug even
fc8667232bcc Ensure we use gnulib mktime rather than glibc's mktime, on hosts
Paul Eggert <eggert@cs.ucla.edu>
parents: 4107
diff changeset
64 on systems that don't support the Olson extension, or don't have the
fc8667232bcc Ensure we use gnulib mktime rather than glibc's mktime, on hosts
Paul Eggert <eggert@cs.ucla.edu>
parents: 4107
diff changeset
65 full zoneinfo tables installed. */
fc8667232bcc Ensure we use gnulib mktime rather than glibc's mktime, on hosts
Paul Eggert <eggert@cs.ucla.edu>
parents: 4107
diff changeset
66 putenv ("TZ=PST8PDT,M4.1.0,M10.5.0");
fc8667232bcc Ensure we use gnulib mktime rather than glibc's mktime, on hosts
Paul Eggert <eggert@cs.ucla.edu>
parents: 4107
diff changeset
67
fc8667232bcc Ensure we use gnulib mktime rather than glibc's mktime, on hosts
Paul Eggert <eggert@cs.ucla.edu>
parents: 4107
diff changeset
68 tm.tm_year = 98;
fc8667232bcc Ensure we use gnulib mktime rather than glibc's mktime, on hosts
Paul Eggert <eggert@cs.ucla.edu>
parents: 4107
diff changeset
69 tm.tm_mon = 3;
fc8667232bcc Ensure we use gnulib mktime rather than glibc's mktime, on hosts
Paul Eggert <eggert@cs.ucla.edu>
parents: 4107
diff changeset
70 tm.tm_mday = 5;
fc8667232bcc Ensure we use gnulib mktime rather than glibc's mktime, on hosts
Paul Eggert <eggert@cs.ucla.edu>
parents: 4107
diff changeset
71 tm.tm_hour = 2;
fc8667232bcc Ensure we use gnulib mktime rather than glibc's mktime, on hosts
Paul Eggert <eggert@cs.ucla.edu>
parents: 4107
diff changeset
72 tm.tm_min = 0;
fc8667232bcc Ensure we use gnulib mktime rather than glibc's mktime, on hosts
Paul Eggert <eggert@cs.ucla.edu>
parents: 4107
diff changeset
73 tm.tm_sec = 0;
fc8667232bcc Ensure we use gnulib mktime rather than glibc's mktime, on hosts
Paul Eggert <eggert@cs.ucla.edu>
parents: 4107
diff changeset
74 tm.tm_isdst = -1;
7276
4be2c469b318 * config/srclist.txt: Temporarily comment out mktime.c until glibc bug
Paul Eggert <eggert@cs.ucla.edu>
parents: 6275
diff changeset
75 return mktime (&tm) != (time_t) -1;
4348
fc8667232bcc Ensure we use gnulib mktime rather than glibc's mktime, on hosts
Paul Eggert <eggert@cs.ucla.edu>
parents: 4107
diff changeset
76 }
fc8667232bcc Ensure we use gnulib mktime rather than glibc's mktime, on hosts
Paul Eggert <eggert@cs.ucla.edu>
parents: 4107
diff changeset
77
7276
4be2c469b318 * config/srclist.txt: Temporarily comment out mktime.c until glibc bug
Paul Eggert <eggert@cs.ucla.edu>
parents: 6275
diff changeset
78 static int
11014
622b789a86c4 mktime.m4: remove K&R-style function prototypes
Albert Chin-A-Young <china@thewrittenword.com>
parents: 11007
diff changeset
79 mktime_test1 (time_t now)
4348
fc8667232bcc Ensure we use gnulib mktime rather than glibc's mktime, on hosts
Paul Eggert <eggert@cs.ucla.edu>
parents: 4107
diff changeset
80 {
fc8667232bcc Ensure we use gnulib mktime rather than glibc's mktime, on hosts
Paul Eggert <eggert@cs.ucla.edu>
parents: 4107
diff changeset
81 struct tm *lt;
7276
4be2c469b318 * config/srclist.txt: Temporarily comment out mktime.c until glibc bug
Paul Eggert <eggert@cs.ucla.edu>
parents: 6275
diff changeset
82 return ! (lt = localtime (&now)) || mktime (lt) == now;
4348
fc8667232bcc Ensure we use gnulib mktime rather than glibc's mktime, on hosts
Paul Eggert <eggert@cs.ucla.edu>
parents: 4107
diff changeset
83 }
fc8667232bcc Ensure we use gnulib mktime rather than glibc's mktime, on hosts
Paul Eggert <eggert@cs.ucla.edu>
parents: 4107
diff changeset
84
7276
4be2c469b318 * config/srclist.txt: Temporarily comment out mktime.c until glibc bug
Paul Eggert <eggert@cs.ucla.edu>
parents: 6275
diff changeset
85 static int
11014
622b789a86c4 mktime.m4: remove K&R-style function prototypes
Albert Chin-A-Young <china@thewrittenword.com>
parents: 11007
diff changeset
86 mktime_test (time_t now)
4348
fc8667232bcc Ensure we use gnulib mktime rather than glibc's mktime, on hosts
Paul Eggert <eggert@cs.ucla.edu>
parents: 4107
diff changeset
87 {
7276
4be2c469b318 * config/srclist.txt: Temporarily comment out mktime.c until glibc bug
Paul Eggert <eggert@cs.ucla.edu>
parents: 6275
diff changeset
88 return (mktime_test1 (now)
12421
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 11744
diff changeset
89 && mktime_test1 ((time_t) (time_t_max - now))
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 11744
diff changeset
90 && mktime_test1 ((time_t) (time_t_min + now)));
4348
fc8667232bcc Ensure we use gnulib mktime rather than glibc's mktime, on hosts
Paul Eggert <eggert@cs.ucla.edu>
parents: 4107
diff changeset
91 }
fc8667232bcc Ensure we use gnulib mktime rather than glibc's mktime, on hosts
Paul Eggert <eggert@cs.ucla.edu>
parents: 4107
diff changeset
92
7276
4be2c469b318 * config/srclist.txt: Temporarily comment out mktime.c until glibc bug
Paul Eggert <eggert@cs.ucla.edu>
parents: 6275
diff changeset
93 static int
4348
fc8667232bcc Ensure we use gnulib mktime rather than glibc's mktime, on hosts
Paul Eggert <eggert@cs.ucla.edu>
parents: 4107
diff changeset
94 irix_6_4_bug ()
fc8667232bcc Ensure we use gnulib mktime rather than glibc's mktime, on hosts
Paul Eggert <eggert@cs.ucla.edu>
parents: 4107
diff changeset
95 {
fc8667232bcc Ensure we use gnulib mktime rather than glibc's mktime, on hosts
Paul Eggert <eggert@cs.ucla.edu>
parents: 4107
diff changeset
96 /* Based on code from Ariel Faigon. */
fc8667232bcc Ensure we use gnulib mktime rather than glibc's mktime, on hosts
Paul Eggert <eggert@cs.ucla.edu>
parents: 4107
diff changeset
97 struct tm tm;
fc8667232bcc Ensure we use gnulib mktime rather than glibc's mktime, on hosts
Paul Eggert <eggert@cs.ucla.edu>
parents: 4107
diff changeset
98 tm.tm_year = 96;
fc8667232bcc Ensure we use gnulib mktime rather than glibc's mktime, on hosts
Paul Eggert <eggert@cs.ucla.edu>
parents: 4107
diff changeset
99 tm.tm_mon = 3;
fc8667232bcc Ensure we use gnulib mktime rather than glibc's mktime, on hosts
Paul Eggert <eggert@cs.ucla.edu>
parents: 4107
diff changeset
100 tm.tm_mday = 0;
fc8667232bcc Ensure we use gnulib mktime rather than glibc's mktime, on hosts
Paul Eggert <eggert@cs.ucla.edu>
parents: 4107
diff changeset
101 tm.tm_hour = 0;
fc8667232bcc Ensure we use gnulib mktime rather than glibc's mktime, on hosts
Paul Eggert <eggert@cs.ucla.edu>
parents: 4107
diff changeset
102 tm.tm_min = 0;
fc8667232bcc Ensure we use gnulib mktime rather than glibc's mktime, on hosts
Paul Eggert <eggert@cs.ucla.edu>
parents: 4107
diff changeset
103 tm.tm_sec = 0;
fc8667232bcc Ensure we use gnulib mktime rather than glibc's mktime, on hosts
Paul Eggert <eggert@cs.ucla.edu>
parents: 4107
diff changeset
104 tm.tm_isdst = -1;
fc8667232bcc Ensure we use gnulib mktime rather than glibc's mktime, on hosts
Paul Eggert <eggert@cs.ucla.edu>
parents: 4107
diff changeset
105 mktime (&tm);
7276
4be2c469b318 * config/srclist.txt: Temporarily comment out mktime.c until glibc bug
Paul Eggert <eggert@cs.ucla.edu>
parents: 6275
diff changeset
106 return tm.tm_mon == 2 && tm.tm_mday == 31;
4348
fc8667232bcc Ensure we use gnulib mktime rather than glibc's mktime, on hosts
Paul Eggert <eggert@cs.ucla.edu>
parents: 4107
diff changeset
107 }
fc8667232bcc Ensure we use gnulib mktime rather than glibc's mktime, on hosts
Paul Eggert <eggert@cs.ucla.edu>
parents: 4107
diff changeset
108
7276
4be2c469b318 * config/srclist.txt: Temporarily comment out mktime.c until glibc bug
Paul Eggert <eggert@cs.ucla.edu>
parents: 6275
diff changeset
109 static int
11014
622b789a86c4 mktime.m4: remove K&R-style function prototypes
Albert Chin-A-Young <china@thewrittenword.com>
parents: 11007
diff changeset
110 bigtime_test (int j)
4348
fc8667232bcc Ensure we use gnulib mktime rather than glibc's mktime, on hosts
Paul Eggert <eggert@cs.ucla.edu>
parents: 4107
diff changeset
111 {
fc8667232bcc Ensure we use gnulib mktime rather than glibc's mktime, on hosts
Paul Eggert <eggert@cs.ucla.edu>
parents: 4107
diff changeset
112 struct tm tm;
fc8667232bcc Ensure we use gnulib mktime rather than glibc's mktime, on hosts
Paul Eggert <eggert@cs.ucla.edu>
parents: 4107
diff changeset
113 time_t now;
fc8667232bcc Ensure we use gnulib mktime rather than glibc's mktime, on hosts
Paul Eggert <eggert@cs.ucla.edu>
parents: 4107
diff changeset
114 tm.tm_year = tm.tm_mon = tm.tm_mday = tm.tm_hour = tm.tm_min = tm.tm_sec = j;
fc8667232bcc Ensure we use gnulib mktime rather than glibc's mktime, on hosts
Paul Eggert <eggert@cs.ucla.edu>
parents: 4107
diff changeset
115 now = mktime (&tm);
fc8667232bcc Ensure we use gnulib mktime rather than glibc's mktime, on hosts
Paul Eggert <eggert@cs.ucla.edu>
parents: 4107
diff changeset
116 if (now != (time_t) -1)
fc8667232bcc Ensure we use gnulib mktime rather than glibc's mktime, on hosts
Paul Eggert <eggert@cs.ucla.edu>
parents: 4107
diff changeset
117 {
fc8667232bcc Ensure we use gnulib mktime rather than glibc's mktime, on hosts
Paul Eggert <eggert@cs.ucla.edu>
parents: 4107
diff changeset
118 struct tm *lt = localtime (&now);
fc8667232bcc Ensure we use gnulib mktime rather than glibc's mktime, on hosts
Paul Eggert <eggert@cs.ucla.edu>
parents: 4107
diff changeset
119 if (! (lt
12421
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 11744
diff changeset
120 && lt->tm_year == tm.tm_year
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 11744
diff changeset
121 && lt->tm_mon == tm.tm_mon
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 11744
diff changeset
122 && lt->tm_mday == tm.tm_mday
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 11744
diff changeset
123 && lt->tm_hour == tm.tm_hour
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 11744
diff changeset
124 && lt->tm_min == tm.tm_min
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 11744
diff changeset
125 && lt->tm_sec == tm.tm_sec
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 11744
diff changeset
126 && lt->tm_yday == tm.tm_yday
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 11744
diff changeset
127 && lt->tm_wday == tm.tm_wday
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 11744
diff changeset
128 && ((lt->tm_isdst < 0 ? -1 : 0 < lt->tm_isdst)
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 11744
diff changeset
129 == (tm.tm_isdst < 0 ? -1 : 0 < tm.tm_isdst))))
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 11744
diff changeset
130 return 0;
4348
fc8667232bcc Ensure we use gnulib mktime rather than glibc's mktime, on hosts
Paul Eggert <eggert@cs.ucla.edu>
parents: 4107
diff changeset
131 }
7276
4be2c469b318 * config/srclist.txt: Temporarily comment out mktime.c until glibc bug
Paul Eggert <eggert@cs.ucla.edu>
parents: 6275
diff changeset
132 return 1;
4be2c469b318 * config/srclist.txt: Temporarily comment out mktime.c until glibc bug
Paul Eggert <eggert@cs.ucla.edu>
parents: 6275
diff changeset
133 }
4be2c469b318 * config/srclist.txt: Temporarily comment out mktime.c until glibc bug
Paul Eggert <eggert@cs.ucla.edu>
parents: 6275
diff changeset
134
4be2c469b318 * config/srclist.txt: Temporarily comment out mktime.c until glibc bug
Paul Eggert <eggert@cs.ucla.edu>
parents: 6275
diff changeset
135 static int
4be2c469b318 * config/srclist.txt: Temporarily comment out mktime.c until glibc bug
Paul Eggert <eggert@cs.ucla.edu>
parents: 6275
diff changeset
136 year_2050_test ()
4be2c469b318 * config/srclist.txt: Temporarily comment out mktime.c until glibc bug
Paul Eggert <eggert@cs.ucla.edu>
parents: 6275
diff changeset
137 {
4be2c469b318 * config/srclist.txt: Temporarily comment out mktime.c until glibc bug
Paul Eggert <eggert@cs.ucla.edu>
parents: 6275
diff changeset
138 /* The correct answer for 2050-02-01 00:00:00 in Pacific time,
4be2c469b318 * config/srclist.txt: Temporarily comment out mktime.c until glibc bug
Paul Eggert <eggert@cs.ucla.edu>
parents: 6275
diff changeset
139 ignoring leap seconds. */
4be2c469b318 * config/srclist.txt: Temporarily comment out mktime.c until glibc bug
Paul Eggert <eggert@cs.ucla.edu>
parents: 6275
diff changeset
140 unsigned long int answer = 2527315200UL;
4be2c469b318 * config/srclist.txt: Temporarily comment out mktime.c until glibc bug
Paul Eggert <eggert@cs.ucla.edu>
parents: 6275
diff changeset
141
4be2c469b318 * config/srclist.txt: Temporarily comment out mktime.c until glibc bug
Paul Eggert <eggert@cs.ucla.edu>
parents: 6275
diff changeset
142 struct tm tm;
4be2c469b318 * config/srclist.txt: Temporarily comment out mktime.c until glibc bug
Paul Eggert <eggert@cs.ucla.edu>
parents: 6275
diff changeset
143 time_t t;
4be2c469b318 * config/srclist.txt: Temporarily comment out mktime.c until glibc bug
Paul Eggert <eggert@cs.ucla.edu>
parents: 6275
diff changeset
144 tm.tm_year = 2050 - 1900;
4be2c469b318 * config/srclist.txt: Temporarily comment out mktime.c until glibc bug
Paul Eggert <eggert@cs.ucla.edu>
parents: 6275
diff changeset
145 tm.tm_mon = 2 - 1;
4be2c469b318 * config/srclist.txt: Temporarily comment out mktime.c until glibc bug
Paul Eggert <eggert@cs.ucla.edu>
parents: 6275
diff changeset
146 tm.tm_mday = 1;
4be2c469b318 * config/srclist.txt: Temporarily comment out mktime.c until glibc bug
Paul Eggert <eggert@cs.ucla.edu>
parents: 6275
diff changeset
147 tm.tm_hour = tm.tm_min = tm.tm_sec = 0;
4be2c469b318 * config/srclist.txt: Temporarily comment out mktime.c until glibc bug
Paul Eggert <eggert@cs.ucla.edu>
parents: 6275
diff changeset
148 tm.tm_isdst = -1;
4be2c469b318 * config/srclist.txt: Temporarily comment out mktime.c until glibc bug
Paul Eggert <eggert@cs.ucla.edu>
parents: 6275
diff changeset
149
4be2c469b318 * config/srclist.txt: Temporarily comment out mktime.c until glibc bug
Paul Eggert <eggert@cs.ucla.edu>
parents: 6275
diff changeset
150 /* Use the portable POSIX.1 specification "TZ=PST8PDT,M4.1.0,M10.5.0"
4be2c469b318 * config/srclist.txt: Temporarily comment out mktime.c until glibc bug
Paul Eggert <eggert@cs.ucla.edu>
parents: 6275
diff changeset
151 instead of "TZ=America/Vancouver" in order to detect the bug even
4be2c469b318 * config/srclist.txt: Temporarily comment out mktime.c until glibc bug
Paul Eggert <eggert@cs.ucla.edu>
parents: 6275
diff changeset
152 on systems that don't support the Olson extension, or don't have the
4be2c469b318 * config/srclist.txt: Temporarily comment out mktime.c until glibc bug
Paul Eggert <eggert@cs.ucla.edu>
parents: 6275
diff changeset
153 full zoneinfo tables installed. */
4be2c469b318 * config/srclist.txt: Temporarily comment out mktime.c until glibc bug
Paul Eggert <eggert@cs.ucla.edu>
parents: 6275
diff changeset
154 putenv ("TZ=PST8PDT,M4.1.0,M10.5.0");
4be2c469b318 * config/srclist.txt: Temporarily comment out mktime.c until glibc bug
Paul Eggert <eggert@cs.ucla.edu>
parents: 6275
diff changeset
155
4be2c469b318 * config/srclist.txt: Temporarily comment out mktime.c until glibc bug
Paul Eggert <eggert@cs.ucla.edu>
parents: 6275
diff changeset
156 t = mktime (&tm);
4be2c469b318 * config/srclist.txt: Temporarily comment out mktime.c until glibc bug
Paul Eggert <eggert@cs.ucla.edu>
parents: 6275
diff changeset
157
4be2c469b318 * config/srclist.txt: Temporarily comment out mktime.c until glibc bug
Paul Eggert <eggert@cs.ucla.edu>
parents: 6275
diff changeset
158 /* Check that the result is either a failure, or close enough
4be2c469b318 * config/srclist.txt: Temporarily comment out mktime.c until glibc bug
Paul Eggert <eggert@cs.ucla.edu>
parents: 6275
diff changeset
159 to the correct answer that we can assume the discrepancy is
4be2c469b318 * config/srclist.txt: Temporarily comment out mktime.c until glibc bug
Paul Eggert <eggert@cs.ucla.edu>
parents: 6275
diff changeset
160 due to leap seconds. */
4be2c469b318 * config/srclist.txt: Temporarily comment out mktime.c until glibc bug
Paul Eggert <eggert@cs.ucla.edu>
parents: 6275
diff changeset
161 return (t == (time_t) -1
12421
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 11744
diff changeset
162 || (0 < t && answer - 120 <= t && t <= answer + 120));
4348
fc8667232bcc Ensure we use gnulib mktime rather than glibc's mktime, on hosts
Paul Eggert <eggert@cs.ucla.edu>
parents: 4107
diff changeset
163 }
fc8667232bcc Ensure we use gnulib mktime rather than glibc's mktime, on hosts
Paul Eggert <eggert@cs.ucla.edu>
parents: 4107
diff changeset
164
fc8667232bcc Ensure we use gnulib mktime rather than glibc's mktime, on hosts
Paul Eggert <eggert@cs.ucla.edu>
parents: 4107
diff changeset
165 int
fc8667232bcc Ensure we use gnulib mktime rather than glibc's mktime, on hosts
Paul Eggert <eggert@cs.ucla.edu>
parents: 4107
diff changeset
166 main ()
fc8667232bcc Ensure we use gnulib mktime rather than glibc's mktime, on hosts
Paul Eggert <eggert@cs.ucla.edu>
parents: 4107
diff changeset
167 {
13918
d5a74c6ec06b Put more information about failed tests into the test return codes.
Bruno Haible <bruno@clisp.org>
parents: 13695
diff changeset
168 int result = 0;
4348
fc8667232bcc Ensure we use gnulib mktime rather than glibc's mktime, on hosts
Paul Eggert <eggert@cs.ucla.edu>
parents: 4107
diff changeset
169 time_t t, delta;
fc8667232bcc Ensure we use gnulib mktime rather than glibc's mktime, on hosts
Paul Eggert <eggert@cs.ucla.edu>
parents: 4107
diff changeset
170 int i, j;
14245
21a50d7b2537 mktime: avoid infinite loop
Eric Blake <eblake@redhat.com>
parents: 14079
diff changeset
171 int time_t_signed_magnitude = (time_t) ~ (time_t) 0 < (time_t) -1;
21a50d7b2537 mktime: avoid infinite loop
Eric Blake <eblake@redhat.com>
parents: 14079
diff changeset
172 int time_t_signed = ! ((time_t) 0 < (time_t) -1);
4348
fc8667232bcc Ensure we use gnulib mktime rather than glibc's mktime, on hosts
Paul Eggert <eggert@cs.ucla.edu>
parents: 4107
diff changeset
173
fc8667232bcc Ensure we use gnulib mktime rather than glibc's mktime, on hosts
Paul Eggert <eggert@cs.ucla.edu>
parents: 4107
diff changeset
174 /* This test makes some buggy mktime implementations loop.
fc8667232bcc Ensure we use gnulib mktime rather than glibc's mktime, on hosts
Paul Eggert <eggert@cs.ucla.edu>
parents: 4107
diff changeset
175 Give up after 60 seconds; a mktime slower than that
fc8667232bcc Ensure we use gnulib mktime rather than glibc's mktime, on hosts
Paul Eggert <eggert@cs.ucla.edu>
parents: 4107
diff changeset
176 isn't worth using anyway. */
fc8667232bcc Ensure we use gnulib mktime rather than glibc's mktime, on hosts
Paul Eggert <eggert@cs.ucla.edu>
parents: 4107
diff changeset
177 alarm (60);
fc8667232bcc Ensure we use gnulib mktime rather than glibc's mktime, on hosts
Paul Eggert <eggert@cs.ucla.edu>
parents: 4107
diff changeset
178
14245
21a50d7b2537 mktime: avoid infinite loop
Eric Blake <eblake@redhat.com>
parents: 14079
diff changeset
179 time_t_max = (! time_t_signed
21a50d7b2537 mktime: avoid infinite loop
Eric Blake <eblake@redhat.com>
parents: 14079
diff changeset
180 ? (time_t) -1
14249
52b55b447c02 TYPE_MAXIMUM: avoid theoretically undefined behavior
Paul Eggert <eggert@cs.ucla.edu>
parents: 14245
diff changeset
181 : ((((time_t) 1 << (sizeof (time_t) * CHAR_BIT - 2)) - 1)
52b55b447c02 TYPE_MAXIMUM: avoid theoretically undefined behavior
Paul Eggert <eggert@cs.ucla.edu>
parents: 14245
diff changeset
182 * 2 + 1));
14245
21a50d7b2537 mktime: avoid infinite loop
Eric Blake <eblake@redhat.com>
parents: 14079
diff changeset
183 time_t_min = (! time_t_signed
21a50d7b2537 mktime: avoid infinite loop
Eric Blake <eblake@redhat.com>
parents: 14079
diff changeset
184 ? (time_t) 0
21a50d7b2537 mktime: avoid infinite loop
Eric Blake <eblake@redhat.com>
parents: 14079
diff changeset
185 : time_t_signed_magnitude
21a50d7b2537 mktime: avoid infinite loop
Eric Blake <eblake@redhat.com>
parents: 14079
diff changeset
186 ? ~ (time_t) 0
14249
52b55b447c02 TYPE_MAXIMUM: avoid theoretically undefined behavior
Paul Eggert <eggert@cs.ucla.edu>
parents: 14245
diff changeset
187 : ~ time_t_max);
7734
6cc7c62f16f7 * m4/mktime.m4 (AC_FUNC_MKTIME): Sync from Autoconf.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7276
diff changeset
188
4348
fc8667232bcc Ensure we use gnulib mktime rather than glibc's mktime, on hosts
Paul Eggert <eggert@cs.ucla.edu>
parents: 4107
diff changeset
189 delta = time_t_max / 997; /* a suitable prime number */
fc8667232bcc Ensure we use gnulib mktime rather than glibc's mktime, on hosts
Paul Eggert <eggert@cs.ucla.edu>
parents: 4107
diff changeset
190 for (i = 0; i < N_STRINGS; i++)
fc8667232bcc Ensure we use gnulib mktime rather than glibc's mktime, on hosts
Paul Eggert <eggert@cs.ucla.edu>
parents: 4107
diff changeset
191 {
fc8667232bcc Ensure we use gnulib mktime rather than glibc's mktime, on hosts
Paul Eggert <eggert@cs.ucla.edu>
parents: 4107
diff changeset
192 if (tz_strings[i])
12421
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 11744
diff changeset
193 putenv (tz_strings[i]);
4348
fc8667232bcc Ensure we use gnulib mktime rather than glibc's mktime, on hosts
Paul Eggert <eggert@cs.ucla.edu>
parents: 4107
diff changeset
194
fc8667232bcc Ensure we use gnulib mktime rather than glibc's mktime, on hosts
Paul Eggert <eggert@cs.ucla.edu>
parents: 4107
diff changeset
195 for (t = 0; t <= time_t_max - delta; t += delta)
12421
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 11744
diff changeset
196 if (! mktime_test (t))
13918
d5a74c6ec06b Put more information about failed tests into the test return codes.
Bruno Haible <bruno@clisp.org>
parents: 13695
diff changeset
197 result |= 1;
7276
4be2c469b318 * config/srclist.txt: Temporarily comment out mktime.c until glibc bug
Paul Eggert <eggert@cs.ucla.edu>
parents: 6275
diff changeset
198 if (! (mktime_test ((time_t) 1)
12421
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 11744
diff changeset
199 && mktime_test ((time_t) (60 * 60))
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 11744
diff changeset
200 && mktime_test ((time_t) (60 * 60 * 24))))
13918
d5a74c6ec06b Put more information about failed tests into the test return codes.
Bruno Haible <bruno@clisp.org>
parents: 13695
diff changeset
201 result |= 2;
4348
fc8667232bcc Ensure we use gnulib mktime rather than glibc's mktime, on hosts
Paul Eggert <eggert@cs.ucla.edu>
parents: 4107
diff changeset
202
7734
6cc7c62f16f7 * m4/mktime.m4 (AC_FUNC_MKTIME): Sync from Autoconf.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7276
diff changeset
203 for (j = 1; ; j <<= 1)
12421
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 11744
diff changeset
204 if (! bigtime_test (j))
13918
d5a74c6ec06b Put more information about failed tests into the test return codes.
Bruno Haible <bruno@clisp.org>
parents: 13695
diff changeset
205 result |= 4;
12421
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 11744
diff changeset
206 else if (INT_MAX / 2 < j)
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 11744
diff changeset
207 break;
7734
6cc7c62f16f7 * m4/mktime.m4 (AC_FUNC_MKTIME): Sync from Autoconf.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7276
diff changeset
208 if (! bigtime_test (INT_MAX))
13918
d5a74c6ec06b Put more information about failed tests into the test return codes.
Bruno Haible <bruno@clisp.org>
parents: 13695
diff changeset
209 result |= 8;
4348
fc8667232bcc Ensure we use gnulib mktime rather than glibc's mktime, on hosts
Paul Eggert <eggert@cs.ucla.edu>
parents: 4107
diff changeset
210 }
13918
d5a74c6ec06b Put more information about failed tests into the test return codes.
Bruno Haible <bruno@clisp.org>
parents: 13695
diff changeset
211 if (! irix_6_4_bug ())
d5a74c6ec06b Put more information about failed tests into the test return codes.
Bruno Haible <bruno@clisp.org>
parents: 13695
diff changeset
212 result |= 16;
d5a74c6ec06b Put more information about failed tests into the test return codes.
Bruno Haible <bruno@clisp.org>
parents: 13695
diff changeset
213 if (! spring_forward_gap ())
d5a74c6ec06b Put more information about failed tests into the test return codes.
Bruno Haible <bruno@clisp.org>
parents: 13695
diff changeset
214 result |= 32;
d5a74c6ec06b Put more information about failed tests into the test return codes.
Bruno Haible <bruno@clisp.org>
parents: 13695
diff changeset
215 if (! year_2050_test ())
d5a74c6ec06b Put more information about failed tests into the test return codes.
Bruno Haible <bruno@clisp.org>
parents: 13695
diff changeset
216 result |= 64;
d5a74c6ec06b Put more information about failed tests into the test return codes.
Bruno Haible <bruno@clisp.org>
parents: 13695
diff changeset
217 return result;
4348
fc8667232bcc Ensure we use gnulib mktime rather than glibc's mktime, on hosts
Paul Eggert <eggert@cs.ucla.edu>
parents: 4107
diff changeset
218 }]])],
15053
d8eeaab555f5 mktime: Respect rules for use of AC_LIBOBJ.
Bruno Haible <bruno@clisp.org>
parents: 14796
diff changeset
219 [gl_cv_func_working_mktime=yes],
d8eeaab555f5 mktime: Respect rules for use of AC_LIBOBJ.
Bruno Haible <bruno@clisp.org>
parents: 14796
diff changeset
220 [gl_cv_func_working_mktime=no],
d8eeaab555f5 mktime: Respect rules for use of AC_LIBOBJ.
Bruno Haible <bruno@clisp.org>
parents: 14796
diff changeset
221 [gl_cv_func_working_mktime=no])
d8eeaab555f5 mktime: Respect rules for use of AC_LIBOBJ.
Bruno Haible <bruno@clisp.org>
parents: 14796
diff changeset
222 ])
4348
fc8667232bcc Ensure we use gnulib mktime rather than glibc's mktime, on hosts
Paul Eggert <eggert@cs.ucla.edu>
parents: 4107
diff changeset
223
15053
d8eeaab555f5 mktime: Respect rules for use of AC_LIBOBJ.
Bruno Haible <bruno@clisp.org>
parents: 14796
diff changeset
224 if test $gl_cv_func_working_mktime = no; then
11742
531d4547f010 Fix compilation error when <ctime> is used and mktime is replaced.
Bruno Haible <bruno@clisp.org>
parents: 11068
diff changeset
225 REPLACE_MKTIME=1
11744
6fff409b3230 mktime: correct setting of REPLACE_MKTIME
Jim Meyering <meyering@redhat.com>
parents: 11742
diff changeset
226 else
6fff409b3230 mktime: correct setting of REPLACE_MKTIME
Jim Meyering <meyering@redhat.com>
parents: 11742
diff changeset
227 REPLACE_MKTIME=0
4107
7c1a6b73f48e An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
228 fi
7c1a6b73f48e An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
229 ])
7c1a6b73f48e An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
230
14796
5fcbe73883bf New module 'mktime-internal'.
Bruno Haible <bruno@clisp.org>
parents: 14249
diff changeset
231 AC_DEFUN([gl_FUNC_MKTIME_INTERNAL], [
5fcbe73883bf New module 'mktime-internal'.
Bruno Haible <bruno@clisp.org>
parents: 14249
diff changeset
232 AC_REQUIRE([gl_FUNC_MKTIME])
5fcbe73883bf New module 'mktime-internal'.
Bruno Haible <bruno@clisp.org>
parents: 14249
diff changeset
233 if test $REPLACE_MKTIME = 0; then
5fcbe73883bf New module 'mktime-internal'.
Bruno Haible <bruno@clisp.org>
parents: 14249
diff changeset
234 dnl BeOS has __mktime_internal in libc, but other platforms don't.
5fcbe73883bf New module 'mktime-internal'.
Bruno Haible <bruno@clisp.org>
parents: 14249
diff changeset
235 AC_CHECK_FUNC([__mktime_internal],
5fcbe73883bf New module 'mktime-internal'.
Bruno Haible <bruno@clisp.org>
parents: 14249
diff changeset
236 [AC_DEFINE([mktime_internal], [__mktime_internal],
5fcbe73883bf New module 'mktime-internal'.
Bruno Haible <bruno@clisp.org>
parents: 14249
diff changeset
237 [Define to the real name of the mktime_internal function.])
5fcbe73883bf New module 'mktime-internal'.
Bruno Haible <bruno@clisp.org>
parents: 14249
diff changeset
238 ],
5fcbe73883bf New module 'mktime-internal'.
Bruno Haible <bruno@clisp.org>
parents: 14249
diff changeset
239 [dnl mktime works but it doesn't export __mktime_internal,
5fcbe73883bf New module 'mktime-internal'.
Bruno Haible <bruno@clisp.org>
parents: 14249
diff changeset
240 dnl so we need to substitute our own mktime implementation.
5fcbe73883bf New module 'mktime-internal'.
Bruno Haible <bruno@clisp.org>
parents: 14249
diff changeset
241 REPLACE_MKTIME=1
5fcbe73883bf New module 'mktime-internal'.
Bruno Haible <bruno@clisp.org>
parents: 14249
diff changeset
242 ])
5fcbe73883bf New module 'mktime-internal'.
Bruno Haible <bruno@clisp.org>
parents: 14249
diff changeset
243 fi
5fcbe73883bf New module 'mktime-internal'.
Bruno Haible <bruno@clisp.org>
parents: 14249
diff changeset
244 ])
5fcbe73883bf New module 'mktime-internal'.
Bruno Haible <bruno@clisp.org>
parents: 14249
diff changeset
245
4107
7c1a6b73f48e An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
246 # Prerequisites of lib/mktime.c.
8427
8bd2ba354a25 mktime.c requires 'inline'.
Bruno Haible <bruno@clisp.org>
parents: 7942
diff changeset
247 AC_DEFUN([gl_PREREQ_MKTIME],
8bd2ba354a25 mktime.c requires 'inline'.
Bruno Haible <bruno@clisp.org>
parents: 7942
diff changeset
248 [
8bd2ba354a25 mktime.c requires 'inline'.
Bruno Haible <bruno@clisp.org>
parents: 7942
diff changeset
249 AC_REQUIRE([AC_C_INLINE])
8bd2ba354a25 mktime.c requires 'inline'.
Bruno Haible <bruno@clisp.org>
parents: 7942
diff changeset
250 ])