changeset 12888:88955fc5764d

gettimeofday: restore support for platforms that lack function Fixes a regression from 2010-02-04, commit de4d0a3. * m4/gettimeofday.m4 (gl_FUNC_GETTIMEOFDAY): Also compile replacement if function is missing. * m4/sys_time_h.m4 (gl_HEADER_SYS_TIME_H_DEFAULTS): New witness. * modules/sys_time (Makefile.am): Substitute it. * lib/sys_time.in.h (gettimeofday): Check it. Reported by Michael Goffioul. Signed-off-by: Eric Blake <eblake@redhat.com>
author Eric Blake <eblake@redhat.com>
date Mon, 22 Feb 2010 09:00:06 -0700
parents 1015aee00ece
children 551cabe1ed9f
files ChangeLog lib/sys_time.in.h m4/gettimeofday.m4 m4/sys_time_h.m4 modules/sys_time
diffstat 5 files changed, 21 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Mon Feb 22 14:30:18 2010 -0700
+++ b/ChangeLog	Mon Feb 22 09:00:06 2010 -0700
@@ -1,3 +1,13 @@
+2010-02-22  Eric Blake  <eblake@redhat.com>
+
+	gettimeofday: restore support for platforms that lack function
+	* m4/gettimeofday.m4 (gl_FUNC_GETTIMEOFDAY): Also compile
+	replacement if function is missing.
+	* m4/sys_time_h.m4 (gl_HEADER_SYS_TIME_H_DEFAULTS): New witness.
+	* modules/sys_time (Makefile.am): Substitute it.
+	* lib/sys_time.in.h (gettimeofday): Check it.
+	Reported by Michael Goffioul.
+
 2010-02-21  Bruno Haible  <bruno@clisp.org>
 
 	* lib/stdio.in.h (obstack_printf): Fix typo.
--- a/lib/sys_time.in.h	Mon Feb 22 14:30:18 2010 -0700
+++ b/lib/sys_time.in.h	Mon Feb 22 09:00:06 2010 -0700
@@ -59,6 +59,8 @@
 #  if @REPLACE_GETTIMEOFDAY@
 #   undef gettimeofday
 #   define gettimeofday rpl_gettimeofday
+#  endif
+#  if @REPLACE_GETTIMEOFDAY@ || !@HAVE_GETTIMEOFDAY@
 extern int gettimeofday (struct timeval *restrict, void *restrict)
      _GL_ARG_NONNULL ((1));
 #  endif
--- a/m4/gettimeofday.m4	Mon Feb 22 14:30:18 2010 -0700
+++ b/m4/gettimeofday.m4	Mon Feb 22 09:00:06 2010 -0700
@@ -1,4 +1,4 @@
-# serial 14
+# serial 15
 
 # Copyright (C) 2001-2003, 2005, 2007, 2009-2010 Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
@@ -15,7 +15,11 @@
   AC_CHECK_FUNCS_ONCE([gettimeofday])
 
   gl_gettimeofday_timezone=void
-  if test $ac_cv_func_gettimeofday = yes; then
+  if test $ac_cv_func_gettimeofday != yes; then
+    HAVE_GETTIMEOFDAY=0
+    AC_LIBOBJ([gettimeofday])
+    gl_PREREQ_GETTIMEOFDAY
+  else
     gl_FUNC_GETTIMEOFDAY_CLOBBER
     AC_CACHE_CHECK([for gettimeofday with POSIX signature],
       [gl_cv_func_gettimeofday_posix_signature],
--- a/m4/sys_time_h.m4	Mon Feb 22 14:30:18 2010 -0700
+++ b/m4/sys_time_h.m4	Mon Feb 22 09:00:06 2010 -0700
@@ -1,5 +1,5 @@
 # Configure a replacement for <sys/time.h>.
-# serial 3
+# serial 4
 
 # Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
@@ -63,6 +63,7 @@
 [
   GNULIB_GETTIMEOFDAY=0;     AC_SUBST([GNULIB_GETTIMEOFDAY])
   dnl Assume POSIX behavior unless another module says otherwise.
+  HAVE_GETTIMEOFDAY=1;       AC_SUBST([HAVE_GETTIMEOFDAY])
   HAVE_STRUCT_TIMEVAL=1;     AC_SUBST([HAVE_STRUCT_TIMEVAL])
   HAVE_SYS_TIME_H=1;         AC_SUBST([HAVE_SYS_TIME_H])
   REPLACE_GETTIMEOFDAY=0;    AC_SUBST([REPLACE_GETTIMEOFDAY])
--- a/modules/sys_time	Mon Feb 22 14:30:18 2010 -0700
+++ b/modules/sys_time	Mon Feb 22 09:00:06 2010 -0700
@@ -28,6 +28,7 @@
 	      -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
 	      -e 's|@''NEXT_SYS_TIME_H''@|$(NEXT_SYS_TIME_H)|g' \
 	      -e 's/@''GNULIB_GETTIMEOFDAY''@/$(GNULIB_GETTIMEOFDAY)/g' \
+	      -e 's/@''HAVE_GETTIMEOFDAY''@/$(HAVE_GETTIMEOFDAY)/g' \
 	      -e 's/@''HAVE_STRUCT_TIMEVAL''@/$(HAVE_STRUCT_TIMEVAL)/g' \
 	      -e 's/@''REPLACE_GETTIMEOFDAY''@/$(REPLACE_GETTIMEOFDAY)/g' \
 	      -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \