+2010-12-31 Bruno Haible <bruno@clisp.org>
+
+ time_r: Add missing declarations on HP-UX 11.
+ * lib/time.in.h (localtime_r, gmtime_r): Test HAVE_DECL_LOCALTIME_R
+ instead of HAVE_LOCALTIME_R.
+ * m4/time_r.m4 (gl_TIME_R): Test whether localtime_r is declared. Set
+ HAVE_LOCALTIME_R always.
+ * m4/time_h.m4 (gl_HEADER_TIME_H_DEFAULTS): Initialize
+ HAVE_DECL_LOCALTIME_R, not HAVE_LOCALTIME_R.
+ * modules/time (Makefile.am): Substitute HAVE_DECL_LOCALTIME_R, not
+ HAVE_LOCALTIME_R.
+ * doc/posix-functions/gmtime_r.texi: Document the HP-UX 11 problem.
+ * doc/posix-functions/localtime_r.texi: Likewise.
+
2010-12-29 Eric Blake <eblake@redhat.com>
mountlist: tweak previous commit
This function is missing on some platforms:
mingw.
@item
+This function is not declared unless @code{_REENTRANT} is defined,
+on some platforms:
+HP-UX 11.
+@item
Some platforms define a function of this name that is incompatible to POSIX:
HP-UX 10.
@end itemize
This function is missing on some platforms:
mingw.
@item
+This function is not declared unless @code{_REENTRANT} is defined,
+on some platforms:
+HP-UX 11.
+@item
Some platforms define a function of this name that is incompatible to POSIX:
HP-UX 10.
@end itemize
_GL_CXXALIAS_RPL (localtime_r, struct tm *, (time_t const *restrict __timer,
struct tm *restrict __result));
# else
-# if ! @HAVE_LOCALTIME_R@
+# if ! @HAVE_DECL_LOCALTIME_R@
_GL_FUNCDECL_SYS (localtime_r, struct tm *, (time_t const *restrict __timer,
struct tm *restrict __result)
_GL_ARG_NONNULL ((1, 2)));
_GL_CXXALIAS_SYS (localtime_r, struct tm *, (time_t const *restrict __timer,
struct tm *restrict __result));
# endif
+# if @HAVE_DECL_LOCALTIME_R@
_GL_CXXALIASWARN (localtime_r);
+# endif
# if @REPLACE_LOCALTIME_R@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef gmtime_r
_GL_CXXALIAS_RPL (gmtime_r, struct tm *, (time_t const *restrict __timer,
struct tm *restrict __result));
# else
-# if ! @HAVE_LOCALTIME_R@
+# if ! @HAVE_DECL_LOCALTIME_R@
_GL_FUNCDECL_SYS (gmtime_r, struct tm *, (time_t const *restrict __timer,
struct tm *restrict __result)
_GL_ARG_NONNULL ((1, 2)));
_GL_CXXALIAS_SYS (gmtime_r, struct tm *, (time_t const *restrict __timer,
struct tm *restrict __result));
# endif
+# if @HAVE_DECL_LOCALTIME_R@
_GL_CXXALIASWARN (gmtime_r);
+# endif
# endif
/* Parse BUF as a time stamp, assuming FORMAT specifies its layout, and store
# Copyright (C) 2000-2001, 2003-2007, 2009-2010 Free Software Foundation, Inc.
-# serial 2
+# serial 3
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
GNULIB_TIMEGM=0; AC_SUBST([GNULIB_TIMEGM])
GNULIB_TIME_R=0; AC_SUBST([GNULIB_TIME_R])
dnl Assume proper GNU behavior unless another module says otherwise.
- HAVE_LOCALTIME_R=1; AC_SUBST([HAVE_LOCALTIME_R])
+ HAVE_DECL_LOCALTIME_R=1; AC_SUBST([HAVE_DECL_LOCALTIME_R])
HAVE_NANOSLEEP=1; AC_SUBST([HAVE_NANOSLEEP])
HAVE_STRPTIME=1; AC_SUBST([HAVE_STRPTIME])
HAVE_TIMEGM=1; AC_SUBST([HAVE_TIMEGM])
AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS])
AC_REQUIRE([AC_C_RESTRICT])
+ dnl Some systems don't declare localtime_r() and gmtime_r() if _REENTRANT is
+ dnl not defined.
+ AC_CHECK_DECLS_ONCE([localtime_r])
+ if test $ac_cv_have_decl_localtime_r = no; then
+ HAVE_DECL_LOCALTIME_R=0
+ fi
+
AC_CHECK_FUNCS_ONCE([localtime_r])
if test $ac_cv_func_localtime_r = yes; then
+ HAVE_LOCALTIME_R=1
AC_CACHE_CHECK([whether localtime_r is compatible with its POSIX signature],
[gl_cv_time_r_posix],
[AC_COMPILE_IFELSE(
-e 's|@''GNULIB_STRPTIME''@|$(GNULIB_STRPTIME)|g' \
-e 's|@''GNULIB_TIMEGM''@|$(GNULIB_TIMEGM)|g' \
-e 's|@''GNULIB_TIME_R''@|$(GNULIB_TIME_R)|g' \
- -e 's|@''HAVE_LOCALTIME_R''@|$(HAVE_LOCALTIME_R)|g' \
+ -e 's|@''HAVE_DECL_LOCALTIME_R''@|$(HAVE_DECL_LOCALTIME_R)|g' \
-e 's|@''HAVE_NANOSLEEP''@|$(HAVE_NANOSLEEP)|g' \
-e 's|@''HAVE_STRPTIME''@|$(HAVE_STRPTIME)|g' \
-e 's|@''HAVE_TIMEGM''@|$(HAVE_TIMEGM)|g' \