+2010-03-14 Bruno Haible <bruno@clisp.org>
+
+ Fix compilation error on mingw when module 'time_r' is not used.
+ * lib/time.in.h (localtime_r, gmtime_r): Declare only if GNULIB_TIME_R
+ is 1.
+ * tests/test-time-c++.cc (localtime_r, gmtime_r): Likewise.
+ * modules/time_r (configure.ac): Invoke gl_TIME_MODULE_INDICATOR.
+ * modules/time (Makefile.am): Substitute GNULIB_TIME_R.
+ * m4/time_h.m4 (gl_HEADER_TIME_H_DEFAULTS): Initialize GNULIB_TIME_R.
+
2010-03-14 Bruno Haible <bruno@clisp.org>
Fix compilation error with Sun C.
/* Convert TIMER to RESULT, assuming local time and UTC respectively. See
<http://www.opengroup.org/susv3xsh/localtime_r.html> and
<http://www.opengroup.org/susv3xsh/gmtime_r.html>. */
-# if @REPLACE_LOCALTIME_R@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef localtime_r
-# define localtime_r rpl_localtime_r
-# endif
+# if @GNULIB_TIME_R@
+# if @REPLACE_LOCALTIME_R@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef localtime_r
+# define localtime_r rpl_localtime_r
+# endif
_GL_FUNCDECL_RPL (localtime_r, struct tm *, (time_t const *restrict __timer,
struct tm *restrict __result)
_GL_ARG_NONNULL ((1, 2)));
_GL_CXXALIAS_RPL (localtime_r, struct tm *, (time_t const *restrict __timer,
struct tm *restrict __result));
-# else
+# else
_GL_CXXALIAS_SYS (localtime_r, struct tm *, (time_t const *restrict __timer,
struct tm *restrict __result));
-# endif
-_GL_CXXALIASWARN (localtime_r);
-# if @REPLACE_LOCALTIME_R@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef gmtime_r
-# define gmtime_r rpl_gmtime_r
# endif
+_GL_CXXALIASWARN (localtime_r);
+# if @REPLACE_LOCALTIME_R@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef gmtime_r
+# define gmtime_r rpl_gmtime_r
+# endif
_GL_FUNCDECL_RPL (gmtime_r, struct tm *, (time_t const *restrict __timer,
struct tm *restrict __result)
_GL_ARG_NONNULL ((1, 2)));
_GL_CXXALIAS_RPL (gmtime_r, struct tm *, (time_t const *restrict __timer,
struct tm *restrict __result));
-# else
+# else
_GL_CXXALIAS_SYS (gmtime_r, struct tm *, (time_t const *restrict __timer,
struct tm *restrict __result));
-# endif
+# endif
_GL_CXXALIASWARN (gmtime_r);
+# endif
/* Parse BUF as a time stamp, assuming FORMAT specifies its layout, and store
the resulting broken-down time into TM. See
GNULIB_NANOSLEEP=0; AC_SUBST([GNULIB_NANOSLEEP])
GNULIB_STRPTIME=0; AC_SUBST([GNULIB_STRPTIME])
GNULIB_TIMEGM=0; AC_SUBST([GNULIB_TIMEGM])
+ GNULIB_TIME_R=0; AC_SUBST([GNULIB_TIME_R])
dnl If another module says to replace or to not replace, do that.
dnl Otherwise, replace only if someone compiles with -DGNULIB_PORTCHECK;
dnl this lets maintainers check for portability.
SIGNATURE_CHECK (GNULIB_NAMESPACE::mktime, time_t, (struct tm *));
#endif
+#if GNULIB_TIME_R
SIGNATURE_CHECK (GNULIB_NAMESPACE::localtime_r, struct tm *,
(time_t const *, struct tm *));
SIGNATURE_CHECK (GNULIB_NAMESPACE::gmtime_r, struct tm *,
(time_t const *, struct tm *));
+#endif
#if GNULIB_STRPTIME
SIGNATURE_CHECK (GNULIB_NAMESPACE::strptime, char *,