From: Bruno Haible Date: Sat, 3 Apr 2010 18:23:47 +0000 (+0200) Subject: strptime: Fix C++ test error on mingw. X-Git-Tag: v0.1~4354 X-Git-Url: http://erislabs.org.uk/gitweb/?a=commitdiff_plain;h=3361b6d48f06367906059ba220639436b50dbe4d;p=gnulib.git strptime: Fix C++ test error on mingw. --- diff --git a/ChangeLog b/ChangeLog index cd8c29658..2e94a3ebd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,17 @@ 2010-04-03 Bruno Haible + 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 + 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 diff --git a/lib/time.in.h b/lib/time.in.h index aeea0b21c..437cf8618 100644 --- a/lib/time.in.h +++ b/lib/time.in.h @@ -157,23 +157,15 @@ _GL_CXXALIASWARN (gmtime_r); the resulting broken-down time into TM. See . */ # 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 diff --git a/m4/strptime.m4 b/m4/strptime.m4 index 7c081f1ec..1e4e95d24 100644 --- a/m4/strptime.m4 +++ b/m4/strptime.m4 @@ -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]) + : +]) diff --git a/m4/time_h.m4 b/m4/time_h.m4 index 013b68c4f..7d9984ed3 100644 --- a/m4/time_h.m4 +++ b/m4/time_h.m4 @@ -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]) ]) diff --git a/modules/time b/modules/time index 287dec193..aee2628a2 100644 --- a/modules/time +++ b/modules/time @@ -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' \