[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
timegm on mingw
From: |
Bruno Haible |
Subject: |
timegm on mingw |
Date: |
Sat, 3 Apr 2010 18:38:30 +0100 |
User-agent: |
KMail/1.9.9 |
A similar error for timegm, in the C++ tests on mingw:
../gllib/time.h:448: error: `timegm' was not declared in this scope
Again, we need to distinguish the case of a missing function from the
case of a broken function.
m4/time_h.m4 contains some dubious code: If timegm exists and mktime
works fine, but timegm is not declared, it sets REPLACE_TIMEGM to 1,
and checks for the prerequisites of lib/timegm.c, but without doing a
AC_LIBOBJ([timegm]). This makes no sense to me. Since we don't know
of any platform that has timegm but does not declare it, I'm
removing this code.
2010-04-03 Bruno Haible <address@hidden>
timegm: Assume declaration if function exists.
* m4/timegm.m4 (gl_FUNC_TIMEGM): Assume timegm is declared if and only
if it exists. Don't clobber ac_cv_func_timegm.
*** m4/timegm.m4.orig Sat Apr 3 19:32:07 2010
--- m4/timegm.m4 Sat Apr 3 19:29:55 2010
***************
*** 1,4 ****
! # timegm.m4 serial 6
dnl Copyright (C) 2003, 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,
--- 1,4 ----
! # timegm.m4 serial 7
dnl Copyright (C) 2003, 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,25 ****
[
AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS])
AC_REQUIRE([gl_FUNC_MKTIME])
if test $ac_cv_func_working_mktime = no; then
# Assume that timegm is buggy if mktime is.
! AC_LIBOBJ([timegm])
! ac_cv_func_timegm=no
else
! AC_REPLACE_FUNCS([timegm])
! fi
! REPLACE_TIMEGM=1
! if test $ac_cv_func_timegm = yes; then
! AC_CHECK_DECLS([timegm], [REPLACE_TIMEGM=0], [], [#include <time.h>])
fi
if test $REPLACE_TIMEGM = 1; then
gl_PREREQ_TIMEGM
fi
])
--- 8,25 ----
[
AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS])
AC_REQUIRE([gl_FUNC_MKTIME])
+ REPLACE_TIMEGM=0
if test $ac_cv_func_working_mktime = no; then
# Assume that timegm is buggy if mktime is.
! REPLACE_TIMEGM=1
else
! AC_CHECK_FUNCS([timegm])
! if test $ac_cv_func_timegm != yes; then
! REPLACE_TIMEGM=1
! fi
fi
if test $REPLACE_TIMEGM = 1; then
+ AC_LIBOBJ([timegm])
gl_PREREQ_TIMEGM
fi
])
2010-04-03 Bruno Haible <address@hidden>
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
HAVE_TIMEGM to 0, not REPLACE_TIMEGM to 1.
* m4/time_h.m4 (gl_HEADER_TIME_H_DEFAULTS): Initialize HAVE_TIMEGM.
* modules/time (Makefile.am): Substitute HAVE_TIMEGM.
diff --git a/lib/time.in.h b/lib/time.in.h
index 3561016..aeea0b2 100644
--- a/lib/time.in.h
+++ b/lib/time.in.h
@@ -187,6 +187,9 @@ _GL_CXXALIASWARN (strptime);
_GL_FUNCDECL_RPL (timegm, time_t, (struct tm *__tm) _GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (timegm, time_t, (struct tm *__tm));
# else
+# if ! @HAVE_TIMEGM@
+_GL_FUNCDECL_SYS (timegm, time_t, (struct tm *__tm) _GL_ARG_NONNULL ((1)));
+# endif
_GL_CXXALIAS_SYS (timegm, time_t, (struct tm *__tm));
# endif
_GL_CXXALIASWARN (timegm);
diff --git a/m4/time_h.m4 b/m4/time_h.m4
index ecab807..f69038a 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=0; AC_SUBST([HAVE_LOCALTIME_R])
+ HAVE_TIMEGM=0; 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;
dnl this lets maintainers check for portability.
diff --git a/m4/timegm.m4 b/m4/timegm.m4
index 010a6f2..bdaafbf 100644
--- a/m4/timegm.m4
+++ b/m4/timegm.m4
@@ -1,4 +1,4 @@
-# timegm.m4 serial 7
+# timegm.m4 serial 8
dnl Copyright (C) 2003, 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,
@@ -9,16 +9,16 @@ AC_DEFUN([gl_FUNC_TIMEGM],
AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS])
AC_REQUIRE([gl_FUNC_MKTIME])
REPLACE_TIMEGM=0
- if test $ac_cv_func_working_mktime = no; then
- # Assume that timegm is buggy if mktime is.
- REPLACE_TIMEGM=1
- else
- AC_CHECK_FUNCS([timegm])
- if test $ac_cv_func_timegm != yes; then
+ AC_CHECK_FUNCS_ONCE([timegm])
+ if test $ac_cv_func_timegm = yes; then
+ if test $ac_cv_func_working_mktime = no; then
+ # Assume that timegm is buggy if mktime is.
REPLACE_TIMEGM=1
fi
+ else
+ HAVE_TIMEGM=0
fi
- if test $REPLACE_TIMEGM = 1; then
+ if test $HAVE_TIMEGM = 0 || test $REPLACE_TIMEGM = 1; then
AC_LIBOBJ([timegm])
gl_PREREQ_TIMEGM
fi
diff --git a/modules/time b/modules/time
index bfc208b..287dec1 100644
--- a/modules/time
+++ b/modules/time
@@ -33,6 +33,7 @@ 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_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' \
- getline on mingw, (continued)
- getline on mingw, Bruno Haible, 2010/04/03
- getpagesize on mingw, Bruno Haible, 2010/04/03
- fchdir on mingw, Bruno Haible, 2010/04/03
- nanosleep on mingw, Bruno Haible, 2010/04/03
- Re: nanosleep on mingw, Bruno Haible, 2010/04/04
- Re: nanosleep on mingw, Jim Meyering, 2010/04/04
- Re: nanosleep on mingw, Bruno Haible, 2010/04/04
localtime_r on mingw, Bruno Haible, 2010/04/03
timegm on mingw,
Bruno Haible <=
strptime on mingw, Bruno Haible, 2010/04/03
wcwidth on mingw, Bruno Haible, 2010/04/03
ioctl on mingw, Bruno Haible, 2010/04/04