From 55afb299b5f091486e3d8bc49f31b7b9f3fbe3fb Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Mon, 22 Feb 2010 09:00:06 -0700 Subject: [PATCH] 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 --- ChangeLog | 8 ++++++++ lib/sys_time.in.h | 2 ++ m4/gettimeofday.m4 | 8 ++++++-- m4/sys_time_h.m4 | 3 ++- modules/sys_time | 1 + 5 files changed, 19 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6887124..a57be62 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ 2010-02-22 Eric Blake + 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. + bootstrap: use GNULIB_SRCDIR to reduce disk usage * build-aux/bootstrap (GNULIB_SRCDIR): If set, use as a reference, rather than reconfiguring where the submodule points. diff --git a/lib/sys_time.in.h b/lib/sys_time.in.h index 12f0860..fe7f624 100644 --- a/lib/sys_time.in.h +++ b/lib/sys_time.in.h @@ -59,6 +59,8 @@ struct timeval # if @REPLACE_GETTIMEOFDAY@ # undef gettimeofday # define gettimeofday rpl_gettimeofday +# endif +# if @REPLACE_GETTIMEOFDAY@ || address@hidden@ extern int gettimeofday (struct timeval *restrict, void *restrict) _GL_ARG_NONNULL ((1)); # endif diff --git a/m4/gettimeofday.m4 b/m4/gettimeofday.m4 index 32e4f29..709a4d4 100644 --- a/m4/gettimeofday.m4 +++ b/m4/gettimeofday.m4 @@ -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_DEFUN([gl_FUNC_GETTIMEOFDAY], 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], diff --git a/m4/sys_time_h.m4 b/m4/sys_time_h.m4 index b14bc4b..be6d7ec 100644 --- a/m4/sys_time_h.m4 +++ b/m4/sys_time_h.m4 @@ -1,5 +1,5 @@ # Configure a replacement for . -# 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 @@ AC_DEFUN([gl_HEADER_SYS_TIME_H_DEFAULTS], [ 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]) diff --git a/modules/sys_time b/modules/sys_time index 28d902e..adfa493 100644 --- a/modules/sys_time +++ b/modules/sys_time @@ -28,6 +28,7 @@ sys/time.h: sys_time.in.h $(WARN_ON_USE_H) $(ARG_NONNULL_H) -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)' \ -- 1.6.6.1