Mercurial > hg > octave-kai > gnulib-hg
annotate m4/mktime.m4 @ 17476:6057744acd2c default tip master
autoupdate
author | Karl Berry <karl@freefriends.org> |
---|---|
date | Fri, 16 Aug 2013 06:32:22 -0700 |
parents | a4a11de07980 |
children |
rev | line source |
---|---|
17366
9855b352e525
regex: port to mingw's recent addition of undeclared alarm
Eric Blake <eblake@redhat.com>
parents:
17249
diff
changeset
|
1 # serial 25 |
17249
e542fd46ad6f
maint: update all copyright year number ranges
Eric Blake <eblake@redhat.com>
parents:
17049
diff
changeset
|
2 dnl Copyright (C) 2002-2003, 2005-2007, 2009-2013 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]) |
17366
9855b352e525
regex: port to mingw's recent addition of undeclared alarm
Eric Blake <eblake@redhat.com>
parents:
17249
diff
changeset
|
17 AC_CHECK_DECLS_ONCE([alarm]) |
15053
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 |
16935
498a2211d839
Write "Mac OS X" instead of "MacOS X".
Bruno Haible <bruno@clisp.org>
parents:
16923
diff
changeset
|
20 # A universal build on Apple Mac OS X platforms. |
15053
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 | 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 |
17369
a4a11de07980
mktime: fix configure typo
Paul Eggert <eggert@cs.ucla.edu>
parents:
17366
diff
changeset
|
37 #if HAVE_DECL_ALARM |
17366
9855b352e525
regex: port to mingw's recent addition of undeclared alarm
Eric Blake <eblake@redhat.com>
parents:
17249
diff
changeset
|
38 # include <signal.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
|
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 |
17366
9855b352e525
regex: port to mingw's recent addition of undeclared alarm
Eric Blake <eblake@redhat.com>
parents:
17249
diff
changeset
|
174 #if HAVE_DECL_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
|
175 /* 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
|
176 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
|
177 isn't worth using anyway. */ |
17366
9855b352e525
regex: port to mingw's recent addition of undeclared alarm
Eric Blake <eblake@redhat.com>
parents:
17249
diff
changeset
|
178 signal (SIGALRM, SIG_DFL); |
4348
fc8667232bcc
Ensure we use gnulib mktime rather than glibc's mktime, on hosts
Paul Eggert <eggert@cs.ucla.edu>
parents:
4107
diff
changeset
|
179 alarm (60); |
17366
9855b352e525
regex: port to mingw's recent addition of undeclared alarm
Eric Blake <eblake@redhat.com>
parents:
17249
diff
changeset
|
180 #endif |
4348
fc8667232bcc
Ensure we use gnulib mktime rather than glibc's mktime, on hosts
Paul Eggert <eggert@cs.ucla.edu>
parents:
4107
diff
changeset
|
181 |
14245
21a50d7b2537
mktime: avoid infinite loop
Eric Blake <eblake@redhat.com>
parents:
14079
diff
changeset
|
182 time_t_max = (! time_t_signed |
21a50d7b2537
mktime: avoid infinite loop
Eric Blake <eblake@redhat.com>
parents:
14079
diff
changeset
|
183 ? (time_t) -1 |
14249
52b55b447c02
TYPE_MAXIMUM: avoid theoretically undefined behavior
Paul Eggert <eggert@cs.ucla.edu>
parents:
14245
diff
changeset
|
184 : ((((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
|
185 * 2 + 1)); |
14245
21a50d7b2537
mktime: avoid infinite loop
Eric Blake <eblake@redhat.com>
parents:
14079
diff
changeset
|
186 time_t_min = (! time_t_signed |
21a50d7b2537
mktime: avoid infinite loop
Eric Blake <eblake@redhat.com>
parents:
14079
diff
changeset
|
187 ? (time_t) 0 |
21a50d7b2537
mktime: avoid infinite loop
Eric Blake <eblake@redhat.com>
parents:
14079
diff
changeset
|
188 : time_t_signed_magnitude |
21a50d7b2537
mktime: avoid infinite loop
Eric Blake <eblake@redhat.com>
parents:
14079
diff
changeset
|
189 ? ~ (time_t) 0 |
14249
52b55b447c02
TYPE_MAXIMUM: avoid theoretically undefined behavior
Paul Eggert <eggert@cs.ucla.edu>
parents:
14245
diff
changeset
|
190 : ~ time_t_max); |
7734
6cc7c62f16f7
* m4/mktime.m4 (AC_FUNC_MKTIME): Sync from Autoconf.
Paul Eggert <eggert@cs.ucla.edu>
parents:
7276
diff
changeset
|
191 |
4348
fc8667232bcc
Ensure we use gnulib mktime rather than glibc's mktime, on hosts
Paul Eggert <eggert@cs.ucla.edu>
parents:
4107
diff
changeset
|
192 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
|
193 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
|
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 if (tz_strings[i]) |
12421
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11744
diff
changeset
|
196 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
|
197 |
16923
0bce099a6479
mktime: fix integer overflow in 'configure'-time test
Paul Eggert <eggert@cs.ucla.edu>
parents:
16201
diff
changeset
|
198 for (t = 0; t <= time_t_max - delta && (result & 1) == 0; t += delta) |
12421
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11744
diff
changeset
|
199 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
|
200 result |= 1; |
16923
0bce099a6479
mktime: fix integer overflow in 'configure'-time test
Paul Eggert <eggert@cs.ucla.edu>
parents:
16201
diff
changeset
|
201 if ((result & 2) == 0 |
0bce099a6479
mktime: fix integer overflow in 'configure'-time test
Paul Eggert <eggert@cs.ucla.edu>
parents:
16201
diff
changeset
|
202 && ! (mktime_test ((time_t) 1) |
0bce099a6479
mktime: fix integer overflow in 'configure'-time test
Paul Eggert <eggert@cs.ucla.edu>
parents:
16201
diff
changeset
|
203 && mktime_test ((time_t) (60 * 60)) |
0bce099a6479
mktime: fix integer overflow in 'configure'-time test
Paul Eggert <eggert@cs.ucla.edu>
parents:
16201
diff
changeset
|
204 && 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
|
205 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
|
206 |
16923
0bce099a6479
mktime: fix integer overflow in 'configure'-time test
Paul Eggert <eggert@cs.ucla.edu>
parents:
16201
diff
changeset
|
207 for (j = 1; (result & 4) == 0; j <<= 1) |
0bce099a6479
mktime: fix integer overflow in 'configure'-time test
Paul Eggert <eggert@cs.ucla.edu>
parents:
16201
diff
changeset
|
208 { |
0bce099a6479
mktime: fix integer overflow in 'configure'-time test
Paul Eggert <eggert@cs.ucla.edu>
parents:
16201
diff
changeset
|
209 if (! bigtime_test (j)) |
0bce099a6479
mktime: fix integer overflow in 'configure'-time test
Paul Eggert <eggert@cs.ucla.edu>
parents:
16201
diff
changeset
|
210 result |= 4; |
0bce099a6479
mktime: fix integer overflow in 'configure'-time test
Paul Eggert <eggert@cs.ucla.edu>
parents:
16201
diff
changeset
|
211 if (INT_MAX / 2 < j) |
0bce099a6479
mktime: fix integer overflow in 'configure'-time test
Paul Eggert <eggert@cs.ucla.edu>
parents:
16201
diff
changeset
|
212 break; |
0bce099a6479
mktime: fix integer overflow in 'configure'-time test
Paul Eggert <eggert@cs.ucla.edu>
parents:
16201
diff
changeset
|
213 } |
0bce099a6479
mktime: fix integer overflow in 'configure'-time test
Paul Eggert <eggert@cs.ucla.edu>
parents:
16201
diff
changeset
|
214 if ((result & 8) == 0 && ! 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
|
215 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
|
216 } |
13918
d5a74c6ec06b
Put more information about failed tests into the test return codes.
Bruno Haible <bruno@clisp.org>
parents:
13695
diff
changeset
|
217 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
|
218 result |= 16; |
d5a74c6ec06b
Put more information about failed tests into the test return codes.
Bruno Haible <bruno@clisp.org>
parents:
13695
diff
changeset
|
219 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
|
220 result |= 32; |
d5a74c6ec06b
Put more information about failed tests into the test return codes.
Bruno Haible <bruno@clisp.org>
parents:
13695
diff
changeset
|
221 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
|
222 result |= 64; |
d5a74c6ec06b
Put more information about failed tests into the test return codes.
Bruno Haible <bruno@clisp.org>
parents:
13695
diff
changeset
|
223 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
|
224 }]])], |
15053
d8eeaab555f5
mktime: Respect rules for use of AC_LIBOBJ.
Bruno Haible <bruno@clisp.org>
parents:
14796
diff
changeset
|
225 [gl_cv_func_working_mktime=yes], |
d8eeaab555f5
mktime: Respect rules for use of AC_LIBOBJ.
Bruno Haible <bruno@clisp.org>
parents:
14796
diff
changeset
|
226 [gl_cv_func_working_mktime=no], |
d8eeaab555f5
mktime: Respect rules for use of AC_LIBOBJ.
Bruno Haible <bruno@clisp.org>
parents:
14796
diff
changeset
|
227 [gl_cv_func_working_mktime=no]) |
d8eeaab555f5
mktime: Respect rules for use of AC_LIBOBJ.
Bruno Haible <bruno@clisp.org>
parents:
14796
diff
changeset
|
228 ]) |
4348
fc8667232bcc
Ensure we use gnulib mktime rather than glibc's mktime, on hosts
Paul Eggert <eggert@cs.ucla.edu>
parents:
4107
diff
changeset
|
229 |
15053
d8eeaab555f5
mktime: Respect rules for use of AC_LIBOBJ.
Bruno Haible <bruno@clisp.org>
parents:
14796
diff
changeset
|
230 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
|
231 REPLACE_MKTIME=1 |
11744
6fff409b3230
mktime: correct setting of REPLACE_MKTIME
Jim Meyering <meyering@redhat.com>
parents:
11742
diff
changeset
|
232 else |
6fff409b3230
mktime: correct setting of REPLACE_MKTIME
Jim Meyering <meyering@redhat.com>
parents:
11742
diff
changeset
|
233 REPLACE_MKTIME=0 |
4107
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
234 fi |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
235 ]) |
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
236 |
14796
5fcbe73883bf
New module 'mktime-internal'.
Bruno Haible <bruno@clisp.org>
parents:
14249
diff
changeset
|
237 AC_DEFUN([gl_FUNC_MKTIME_INTERNAL], [ |
5fcbe73883bf
New module 'mktime-internal'.
Bruno Haible <bruno@clisp.org>
parents:
14249
diff
changeset
|
238 AC_REQUIRE([gl_FUNC_MKTIME]) |
5fcbe73883bf
New module 'mktime-internal'.
Bruno Haible <bruno@clisp.org>
parents:
14249
diff
changeset
|
239 if test $REPLACE_MKTIME = 0; then |
5fcbe73883bf
New module 'mktime-internal'.
Bruno Haible <bruno@clisp.org>
parents:
14249
diff
changeset
|
240 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
|
241 AC_CHECK_FUNC([__mktime_internal], |
5fcbe73883bf
New module 'mktime-internal'.
Bruno Haible <bruno@clisp.org>
parents:
14249
diff
changeset
|
242 [AC_DEFINE([mktime_internal], [__mktime_internal], |
5fcbe73883bf
New module 'mktime-internal'.
Bruno Haible <bruno@clisp.org>
parents:
14249
diff
changeset
|
243 [Define to the real name of the mktime_internal function.]) |
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 [dnl mktime works but it doesn't export __mktime_internal, |
5fcbe73883bf
New module 'mktime-internal'.
Bruno Haible <bruno@clisp.org>
parents:
14249
diff
changeset
|
246 dnl so we need to substitute our own mktime implementation. |
5fcbe73883bf
New module 'mktime-internal'.
Bruno Haible <bruno@clisp.org>
parents:
14249
diff
changeset
|
247 REPLACE_MKTIME=1 |
5fcbe73883bf
New module 'mktime-internal'.
Bruno Haible <bruno@clisp.org>
parents:
14249
diff
changeset
|
248 ]) |
5fcbe73883bf
New module 'mktime-internal'.
Bruno Haible <bruno@clisp.org>
parents:
14249
diff
changeset
|
249 fi |
5fcbe73883bf
New module 'mktime-internal'.
Bruno Haible <bruno@clisp.org>
parents:
14249
diff
changeset
|
250 ]) |
5fcbe73883bf
New module 'mktime-internal'.
Bruno Haible <bruno@clisp.org>
parents:
14249
diff
changeset
|
251 |
4107
7c1a6b73f48e
An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
252 # Prerequisites of lib/mktime.c. |
17049
eaa24b775e15
mktime: avoid 'static inline'
Paul Eggert <eggert@cs.ucla.edu>
parents:
16935
diff
changeset
|
253 AC_DEFUN([gl_PREREQ_MKTIME], [:]) |