1 # Configure a replacement for <sys/time.h>.
4 # Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc.
5 # This file is free software; the Free Software Foundation
6 # gives unlimited permission to copy and/or distribute it,
7 # with or without modifications, as long as this notice is preserved.
9 # Written by Paul Eggert and Martin Lambers.
11 AC_DEFUN([gl_HEADER_SYS_TIME_H],
13 dnl Use AC_REQUIRE here, so that the REPLACE_GETTIMEOFDAY=0 statement
14 dnl below is expanded once only, before all REPLACE_GETTIMEOFDAY=1
15 dnl statements that occur in other macros.
16 AC_REQUIRE([gl_HEADER_SYS_TIME_H_BODY])
19 AC_DEFUN([gl_HEADER_SYS_TIME_H_BODY],
21 AC_REQUIRE([AC_C_RESTRICT])
22 AC_CHECK_HEADERS_ONCE([sys/time.h])
23 gl_CHECK_NEXT_HEADERS([sys/time.h])
25 if test $ac_cv_header_sys_time_h = yes; then
30 AC_SUBST([HAVE_SYS_TIME_H])
32 AC_CACHE_CHECK([for struct timeval], [gl_cv_sys_struct_timeval],
40 [[static struct timeval x; x.tv_sec = x.tv_usec;]])],
41 [gl_cv_sys_struct_timeval=yes],
42 [gl_cv_sys_struct_timeval=no])])
43 if test $gl_cv_sys_struct_timeval = yes; then
48 AC_SUBST([HAVE_STRUCT_TIMEVAL])
50 dnl Assume POSIX behavior unless another module says otherwise.
51 REPLACE_GETTIMEOFDAY=0
52 AC_SUBST([REPLACE_GETTIMEOFDAY])
53 if test $HAVE_SYS_TIME_H = 0 || test $HAVE_STRUCT_TIMEVAL = 0; then
58 AC_SUBST([SYS_TIME_H])