# HG changeset patch # User Bruno Haible # Date 1248807676 -7200 # Node ID 531d4547f010ec7519a25368541ffc25ea31f017 # Parent 5f5c1c77ef823bb3341e33c589579842ac866c14 Fix compilation error when 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 . diff --git a/ChangeLog b/ChangeLog --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2009-07-27 Bruno Haible + + Fix compilation error when 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 . + 2009-07-27 Bruno Haible * lib/math.in.h (cosl, logl, sinl): Undefine before declaring it. diff --git a/lib/time.in.h b/lib/time.in.h --- a/lib/time.in.h +++ b/lib/time.in.h @@ -1,6 +1,6 @@ /* A more-standard . - 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 @@ -66,6 +66,12 @@ 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 and . */ diff --git a/m4/mktime.m4 b/m4/mktime.m4 --- a/m4/mktime.m4 +++ b/m4/mktime.m4 @@ -215,11 +215,11 @@ 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 ]) diff --git a/m4/time_h.m4 b/m4/time_h.m4 --- a/m4/time_h.m4 +++ b/m4/time_h.m4 @@ -1,7 +1,6 @@ # Configure a more-standard replacement for . -# 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, @@ -30,6 +29,7 @@ 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]) diff --git a/modules/time b/modules/time --- a/modules/time +++ b/modules/time @@ -24,6 +24,7 @@ -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' \