* lib/time.in.h (mktime): New declaration.
* m4/mktime.m4 (gl_FUNC_MKTIME): Require gl_HEADER_TIME_H_DEFAULTS. Set
REPLACE_MKTIME instead of defining mktime in config.h.
* m4/time_h.m4 (gl_HEADER_TIME_H_DEFAULTS): Initialize REPLACE_MKTIME.
* modules/time (Makefile.am): Substitute REPLACE_MKTIME.
Reported by Ross McFarland <rwmcfa1@neces.com>.
+2009-07-27 Bruno Haible <bruno@clisp.org>
+
+ Fix compilation error when <ctime> is used and mktime is replaced.
+ * lib/time.in.h (mktime): New declaration.
+ * m4/mktime.m4 (gl_FUNC_MKTIME): Require gl_HEADER_TIME_H_DEFAULTS. Set
+ REPLACE_MKTIME instead of defining mktime in config.h.
+ * m4/time_h.m4 (gl_HEADER_TIME_H_DEFAULTS): Initialize REPLACE_MKTIME.
+ * modules/time (Makefile.am): Substitute REPLACE_MKTIME.
+ Reported by Ross McFarland <rwmcfa1@neces.com>.
+
2009-07-27 Bruno Haible <bruno@clisp.org>
* lib/math.in.h (cosl, logl, sinl): Undefine before declaring it.
/* A more-standard <time.h>.
- Copyright (C) 2007-2008 Free Software Foundation, Inc.
+ Copyright (C) 2007-2009 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
int nanosleep (struct timespec const *__rqtp, struct timespec *__rmtp);
# endif
+/* Return the 'time_t' representation of TP and normalize TP. */
+# if @REPLACE_MKTIME@
+# define mktime rpl_mktime
+extern time_t mktime (struct tm *__tp);
+# endif
+
/* 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>. */
AC_DEFUN([gl_FUNC_MKTIME],
[
+ AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS])
AC_FUNC_MKTIME
dnl Note: AC_FUNC_MKTIME does AC_LIBOBJ([mktime]).
if test $ac_cv_func_working_mktime = no; then
- AC_DEFINE([mktime], [rpl_mktime],
- [Define to rpl_mktime if the replacement function should be used.])
+ REPLACE_MKTIME=1
gl_PREREQ_MKTIME
fi
])
# Configure a more-standard replacement for <time.h>.
-# Copyright (C) 2000, 2001, 2003, 2004, 2005, 2006, 2007 Free Software
-# Foundation, Inc.
+# Copyright (C) 2000-2001, 2003-2007, 2009 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
dnl Otherwise, replace only if someone compiles with -DGNULIB_PORTCHECK;
dnl this lets maintainers check for portability.
REPLACE_LOCALTIME_R=GNULIB_PORTCHECK; AC_SUBST([REPLACE_LOCALTIME_R])
+ REPLACE_MKTIME=GNULIB_PORTCHECK; AC_SUBST([REPLACE_MKTIME])
REPLACE_NANOSLEEP=GNULIB_PORTCHECK; AC_SUBST([REPLACE_NANOSLEEP])
REPLACE_STRPTIME=GNULIB_PORTCHECK; AC_SUBST([REPLACE_STRPTIME])
REPLACE_TIMEGM=GNULIB_PORTCHECK; AC_SUBST([REPLACE_TIMEGM])
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-e 's|@NEXT_TIME_H''@|$(NEXT_TIME_H)|g' \
-e 's|@REPLACE_LOCALTIME_R''@|$(REPLACE_LOCALTIME_R)|g' \
+ -e 's|@REPLACE_MKTIME''@|$(REPLACE_MKTIME)|g' \
-e 's|@REPLACE_NANOSLEEP''@|$(REPLACE_NANOSLEEP)|g' \
-e 's|@REPLACE_STRPTIME''@|$(REPLACE_STRPTIME)|g' \
-e 's|@REPLACE_TIMEGM''@|$(REPLACE_TIMEGM)|g' \