From: Bruno Haible Date: Sun, 22 May 2011 14:39:23 +0000 (+0200) Subject: New module 'mktime-internal'. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=10b0d383559211c30490a72f2f2d3973dc60bf19;p=pspp New module 'mktime-internal'. * modules/mktime-internal: New file. * m4/timegm.m4 (gl_PREREQ_TIMEGM): Move contents to ... * m4/mktime.m4 (gl_FUNC_MKTIME_INTERNAL): New macro. Define mktime_internal as a C macro if libc has __mktime_internal. * modules/timegm (Depends-on): Add mktime-internal. Remove mktime. Add conditions. * MODULES.html.sh (Date and time ): Add mktime-internal. --- diff --git a/ChangeLog b/ChangeLog index fcdfe3c286..342a13039f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2011-05-22 Bruno Haible + + New module 'mktime-internal'. + * modules/mktime-internal: New file. + * m4/timegm.m4 (gl_PREREQ_TIMEGM): Move contents to ... + * m4/mktime.m4 (gl_FUNC_MKTIME_INTERNAL): New macro. Define + mktime_internal as a C macro if libc has __mktime_internal. + * modules/timegm (Depends-on): Add mktime-internal. Remove mktime. Add + conditions. + * MODULES.html.sh (Date and time ): Add mktime-internal. + 2011-05-22 Bruno Haible timegm: Correct mktime replacement statements. diff --git a/MODULES.html.sh b/MODULES.html.sh index 3d3add3b8e..18a7472d72 100755 --- a/MODULES.html.sh +++ b/MODULES.html.sh @@ -1834,6 +1834,7 @@ func_all_modules () func_echo "$element" func_begin_table + func_module mktime-internal func_module parse-datetime func_module timegm func_module tzset diff --git a/m4/mktime.m4 b/m4/mktime.m4 index 56b2416d61..01167a1ec0 100644 --- a/m4/mktime.m4 +++ b/m4/mktime.m4 @@ -1,4 +1,4 @@ -# serial 19 +# serial 20 dnl Copyright (C) 2002-2003, 2005-2007, 2009-2011 Free Software Foundation, dnl Inc. dnl This file is free software; the Free Software Foundation @@ -234,6 +234,23 @@ AC_DEFUN([gl_FUNC_MKTIME], fi ]) +AC_DEFUN([gl_FUNC_MKTIME_INTERNAL], [ + AC_REQUIRE([gl_FUNC_MKTIME]) + if test $REPLACE_MKTIME = 0; then + dnl BeOS has __mktime_internal in libc, but other platforms don't. + AC_CHECK_FUNC([__mktime_internal], + [AC_DEFINE([mktime_internal], [__mktime_internal], + [Define to the real name of the mktime_internal function.]) + ], + [dnl mktime works but it doesn't export __mktime_internal, + dnl so we need to substitute our own mktime implementation. + REPLACE_MKTIME=1 + AC_LIBOBJ([mktime]) + gl_PREREQ_MKTIME + ]) + fi +]) + # Prerequisites of lib/mktime.c. AC_DEFUN([gl_PREREQ_MKTIME], [ diff --git a/m4/timegm.m4 b/m4/timegm.m4 index 62e76b4437..ca97eb2529 100644 --- a/m4/timegm.m4 +++ b/m4/timegm.m4 @@ -26,13 +26,5 @@ AC_DEFUN([gl_FUNC_TIMEGM], # Prerequisites of lib/timegm.c. AC_DEFUN([gl_PREREQ_TIMEGM], [ - AC_REQUIRE([gl_FUNC_MKTIME]) - if test $ac_cv_func_working_mktime = yes; then - AC_CHECK_FUNC([__mktime_internal], , - [# mktime works but it doesn't export __mktime_internal, - # so we need to substitute our own mktime implementation. - AC_LIBOBJ([mktime]) - REPLACE_MKTIME=1 - gl_PREREQ_MKTIME]) - fi + : ]) diff --git a/modules/mktime-internal b/modules/mktime-internal new file mode 100644 index 0000000000..c26b622221 --- /dev/null +++ b/modules/mktime-internal @@ -0,0 +1,23 @@ +Description: +mktime_internal() function: convert broken-down time to linear time. + +Files: +lib/mktime-internal.h +lib/mktime.c + +Depends-on: +mktime + +configure.ac: +gl_FUNC_MKTIME_INTERNAL + +Makefile.am: + +Include: +"mktime-internal.h" + +License: +LGPLv2+ + +Maintainer: +Bruno Haible, Paul Eggert diff --git a/modules/timegm b/modules/timegm index 91623cf75b..ade34754ff 100644 --- a/modules/timegm +++ b/modules/timegm @@ -7,9 +7,9 @@ lib/timegm.c m4/timegm.m4 Depends-on: -mktime time -time_r +mktime-internal [test $HAVE_TIMEGM = 0 || test $REPLACE_TIMEGM = 1] +time_r [test $HAVE_TIMEGM = 0 || test $REPLACE_TIMEGM = 1] configure.ac: gl_FUNC_TIMEGM