strptime: Fix C++ test error on mingw.
authorBruno Haible <bruno@clisp.org>
Sat, 3 Apr 2010 18:23:47 +0000 (20:23 +0200)
committerBruno Haible <bruno@clisp.org>
Sat, 3 Apr 2010 18:23:47 +0000 (20:23 +0200)
ChangeLog
lib/time.in.h
m4/strptime.m4
m4/time_h.m4
modules/time

index cd8c296..2e94a3e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,17 @@
 2010-04-03  Bruno Haible  <bruno@clisp.org>
 
+       strptime: Fix C++ test error on mingw.
+       * lib/time.in.h (strptime): Use HAVE_STRPTIME, not REPLACE_STRPTIME.
+       * m4/strptime.m4 (gl_FUNC_STRPTIME): Set HAVE_STRPTIME, not
+       REPLACE_STRPTIME. Invoke gl_PREREQ_STRPTIME.
+       (gl_PREREQ_STRPTIME): New macro, extracted from gl_FUNC_STRPTIME.
+       * m4/time_h.m4 (gl_HEADER_TIME_H_DEFAULTS): Initialize HAVE_STRPTIME,
+       not REPLACE_STRPTIME.
+       * modules/time (Makefile.am): Substitute HAVE_STRPTIME, not
+       REPLACE_STRPTIME.
+
+2010-04-03  Bruno Haible  <bruno@clisp.org>
+
        timegm: Fix C++ test error on mingw.
        * lib/time.in.h (timegm): Use modern idiom.
        * m4/timegm.m4 (gl_FUNC_TIMEGM): When timegm does not exist, set
index aeea0b2..437cf86 100644 (file)
@@ -157,23 +157,15 @@ _GL_CXXALIASWARN (gmtime_r);
    the resulting broken-down time into TM.  See
    <http://www.opengroup.org/susv3xsh/strptime.html>.  */
 # if @GNULIB_STRPTIME@
-#  if @REPLACE_STRPTIME@
-#   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#    undef strptime
-#    define strptime rpl_strptime
-#   endif
-_GL_FUNCDECL_RPL (strptime, char *, (char const *restrict __buf,
+#  if ! @HAVE_STRPTIME@
+_GL_FUNCDECL_SYS (strptime, char *, (char const *restrict __buf,
                                      char const *restrict __format,
                                      struct tm *restrict __tm)
                                     _GL_ARG_NONNULL ((1, 2, 3)));
-_GL_CXXALIAS_RPL (strptime, char *, (char const *restrict __buf,
-                                     char const *restrict __format,
-                                     struct tm *restrict __tm));
-#  else
+#  endif
 _GL_CXXALIAS_SYS (strptime, char *, (char const *restrict __buf,
                                      char const *restrict __format,
                                      struct tm *restrict __tm));
-#  endif
 _GL_CXXALIASWARN (strptime);
 # endif
 
index 7c081f1..1e4e95d 100644 (file)
@@ -1,4 +1,4 @@
-# strptime.m4 serial 5
+# strptime.m4 serial 6
 dnl Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -8,11 +8,17 @@ AC_DEFUN([gl_FUNC_STRPTIME],
 [
   AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS])
   AC_REQUIRE([AC_C_RESTRICT])
-  AC_REPLACE_FUNCS([strptime])
-  AC_REQUIRE([gl_TM_GMTOFF])
-  if test $ac_cv_func_strptime = yes; then
-    REPLACE_STRPTIME=0
-  else
-    REPLACE_STRPTIME=1
+  AC_CHECK_FUNCS_ONCE([strptime])
+  if test $ac_cv_func_strptime != yes; then
+    HAVE_STRPTIME=0
+    AC_LIBOBJ([strptime])
+    gl_PREREQ_STRPTIME
   fi
 ])
+
+# Prerequisites of lib/strptime.c.
+AC_DEFUN([gl_PREREQ_STRPTIME],
+[
+  AC_REQUIRE([gl_TM_GMTOFF])
+  :
+])
index 013b68c..7d9984e 100644 (file)
@@ -79,6 +79,7 @@ AC_DEFUN([gl_HEADER_TIME_H_DEFAULTS],
   GNULIB_TIME_R=0;                       AC_SUBST([GNULIB_TIME_R])
   dnl Assume proper GNU behavior unless another module says otherwise.
   HAVE_LOCALTIME_R=1;                    AC_SUBST([HAVE_LOCALTIME_R])
+  HAVE_STRPTIME=1;                       AC_SUBST([HAVE_STRPTIME])
   HAVE_TIMEGM=1;                         AC_SUBST([HAVE_TIMEGM])
   dnl If another module says to replace or to not replace, do that.
   dnl Otherwise, replace only if someone compiles with -DGNULIB_PORTCHECK;
@@ -86,6 +87,5 @@ AC_DEFUN([gl_HEADER_TIME_H_DEFAULTS],
   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])
 ])
index 287dec1..aee2628 100644 (file)
@@ -33,11 +33,11 @@ time.h: time.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
              -e 's|@''GNULIB_TIMEGM''@|$(GNULIB_TIMEGM)|g' \
              -e 's|@''GNULIB_TIME_R''@|$(GNULIB_TIME_R)|g' \
              -e 's|@''HAVE_LOCALTIME_R''@|$(HAVE_LOCALTIME_R)|g' \
+             -e 's|@''HAVE_STRPTIME''@|$(HAVE_STRPTIME)|g' \
              -e 's|@''HAVE_TIMEGM''@|$(HAVE_TIMEGM)|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' \
              -e 's|@''SYS_TIME_H_DEFINES_STRUCT_TIMESPEC''@|$(SYS_TIME_H_DEFINES_STRUCT_TIMESPEC)|g' \
              -e 's|@''TIME_H_DEFINES_STRUCT_TIMESPEC''@|$(TIME_H_DEFINES_STRUCT_TIMESPEC)|g' \