changeset 14796:5fcbe73883bf

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 <time.h>): Add mktime-internal.
author Bruno Haible <bruno@clisp.org>
date Sun, 22 May 2011 16:39:23 +0200
parents d62488163e76
children 70abceb5dff3
files ChangeLog MODULES.html.sh m4/mktime.m4 m4/timegm.m4 modules/mktime-internal modules/timegm
diffstat 6 files changed, 56 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sun May 22 15:54:36 2011 +0200
+++ b/ChangeLog	Sun May 22 16:39:23 2011 +0200
@@ -1,3 +1,14 @@
+2011-05-22  Bruno Haible  <bruno@clisp.org>
+
+	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 <time.h>): Add mktime-internal.
+
 2011-05-22  Bruno Haible  <bruno@clisp.org>
 
 	timegm: Correct mktime replacement statements.
--- a/MODULES.html.sh	Sun May 22 15:54:36 2011 +0200
+++ b/MODULES.html.sh	Sun May 22 16:39:23 2011 +0200
@@ -1834,6 +1834,7 @@
   func_echo "$element"
 
   func_begin_table
+  func_module mktime-internal
   func_module parse-datetime
   func_module timegm
   func_module tzset
--- a/m4/mktime.m4	Sun May 22 15:54:36 2011 +0200
+++ b/m4/mktime.m4	Sun May 22 16:39:23 2011 +0200
@@ -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 @@
   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],
 [
--- a/m4/timegm.m4	Sun May 22 15:54:36 2011 +0200
+++ b/m4/timegm.m4	Sun May 22 16:39:23 2011 +0200
@@ -26,13 +26,5 @@
 
 # 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
+  :
 ])
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/mktime-internal	Sun May 22 16:39:23 2011 +0200
@@ -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
--- a/modules/timegm	Sun May 22 15:54:36 2011 +0200
+++ b/modules/timegm	Sun May 22 16:39:23 2011 +0200
@@ -7,9 +7,9 @@
 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