From: Bruno Haible Date: Tue, 28 Jul 2009 19:01:16 +0000 (+0200) Subject: Fix compilation error when is used and mktime is replaced. X-Git-Tag: v0.1~5745 X-Git-Url: http://erislabs.org.uk/gitweb/?a=commitdiff_plain;h=ab3390dfbe250699c6c6f59654516b688363f38f;p=gnulib.git 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 index 07539f8b3..fa9a76b3b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,15 @@ 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. Reported by Matt Kraai . diff --git a/lib/time.in.h b/lib/time.in.h index fba8fce07..b9c2230d6 100644 --- 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 @@ struct timespec 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 index 1e926e86b..3eeace551 100644 --- a/m4/mktime.m4 +++ b/m4/mktime.m4 @@ -215,11 +215,11 @@ fi 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 index d42a635ec..16fefa197 100644 --- 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 @@ AC_DEFUN([gl_HEADER_TIME_H_DEFAULTS], 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 index 50b07afb2..a6c9fa74d 100644 --- a/modules/time +++ b/modules/time @@ -24,6 +24,7 @@ time.h: time.in.h -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' \