annotate m4/time_r.m4 @ 112430:78c4c9559156

* lisp/emacs-lisp/copyright.el (copyright-fix-years): Use copyright-find-copyright.
author Glenn Morris <rgm@gnu.org>
date Sat, 22 Jan 2011 14:13:17 -0800
parents 474d5026a5a2
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
112308
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
1 dnl Reentrant time functions: localtime_r, gmtime_r.
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
2
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
3 dnl Copyright (C) 2003, 2006-2011 Free Software Foundation, Inc.
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
4 dnl This file is free software; the Free Software Foundation
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
5 dnl gives unlimited permission to copy and/or distribute it,
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
6 dnl with or without modifications, as long as this notice is preserved.
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
7
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
8 dnl Written by Paul Eggert.
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
9
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
10 AC_DEFUN([gl_TIME_R],
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
11 [
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
12 dnl Persuade glibc and Solaris <time.h> to declare localtime_r.
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
13 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
14
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
15 AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS])
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
16 AC_REQUIRE([AC_C_RESTRICT])
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
17
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
18 dnl Some systems don't declare localtime_r() and gmtime_r() if _REENTRANT is
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
19 dnl not defined.
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
20 AC_CHECK_DECLS_ONCE([localtime_r])
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
21 if test $ac_cv_have_decl_localtime_r = no; then
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
22 HAVE_DECL_LOCALTIME_R=0
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
23 fi
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
24
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
25 AC_CHECK_FUNCS_ONCE([localtime_r])
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
26 if test $ac_cv_func_localtime_r = yes; then
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
27 HAVE_LOCALTIME_R=1
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
28 AC_CACHE_CHECK([whether localtime_r is compatible with its POSIX signature],
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
29 [gl_cv_time_r_posix],
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
30 [AC_COMPILE_IFELSE(
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
31 [AC_LANG_PROGRAM(
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
32 [[#include <time.h>]],
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
33 [[/* We don't need to append 'restrict's to the argument types,
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
34 even though the POSIX signature has the 'restrict's,
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
35 since C99 says they can't affect type compatibility. */
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
36 struct tm * (*ptr) (time_t const *, struct tm *) = localtime_r;
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
37 if (ptr) return 0;
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
38 /* Check the return type is a pointer.
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
39 On HP-UX 10 it is 'int'. */
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
40 *localtime_r (0, 0);]])
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
41 ],
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
42 [gl_cv_time_r_posix=yes],
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
43 [gl_cv_time_r_posix=no])
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
44 ])
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
45 if test $gl_cv_time_r_posix = yes; then
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
46 REPLACE_LOCALTIME_R=0
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
47 else
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
48 REPLACE_LOCALTIME_R=1
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
49 fi
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
50 else
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
51 HAVE_LOCALTIME_R=0
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
52 fi
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
53 if test $HAVE_LOCALTIME_R = 0 || test $REPLACE_LOCALTIME_R = 1; then
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
54 AC_LIBOBJ([time_r])
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
55 gl_PREREQ_TIME_R
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
56 fi
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
57 ])
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
58
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
59 # Prerequisites of lib/time_r.c.
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
60 AC_DEFUN([gl_PREREQ_TIME_R], [
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
61 :
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
62 ])