1 # Configure a replacement for <sys/time.h>.
3 # Copyright (C) 2007 Free Software Foundation, Inc.
4 # This file is free software; the Free Software Foundation
5 # gives unlimited permission to copy and/or distribute it,
6 # with or without modifications, as long as this notice is preserved.
8 # Written by Paul Eggert and Martin Lambers.
10 AC_DEFUN([gl_HEADER_SYS_TIME_H],
12 dnl Use AC_REQUIRE here, so that the GETTIMEOFDAY_REPLACEMENT=0 statement
13 dnl below is expanded once only, before all GETTIMEOFDAY_REPLACEMENT=1
14 dnl statements that occur in other macros.
15 AC_REQUIRE([gl_HEADER_SYS_TIME_H_BODY])
18 AC_DEFUN([gl_HEADER_SYS_TIME_H_BODY],
20 AC_REQUIRE([AC_C_RESTRICT])
21 AC_CHECK_HEADERS_ONCE([sys/time.h])
23 if test $ac_cv_header_sys_time_h = yes; then
24 gl_ABSOLUTE_HEADER([sys/time.h])
25 ABSOLUTE_SYS_TIME_H=\"$gl_cv_absolute_sys_time_h\"
28 ABSOLUTE_SYS_TIME_H=\"no/such/file/sys/time.h\"
31 AC_SUBST([ABSOLUTE_SYS_TIME_H])
32 AC_SUBST([HAVE_SYS_TIME_H])
34 AC_CACHE_CHECK([for struct timeval], [gl_cv_sys_struct_timeval],
42 [[static struct timeval x; x.tv_sec = x.tv_usec;]])],
43 [gl_cv_sys_struct_timeval=yes],
44 [gl_cv_sys_struct_timeval=no])])
45 if test $gl_cv_sys_struct_timeval = yes; then
50 AC_SUBST([HAVE_STRUCT_TIMEVAL])
52 dnl Assume POSIX behavior unless another module says otherwise.
53 GETTIMEOFDAY_REPLACEMENT=0
54 AC_SUBST([GETTIMEOFDAY_REPLACEMENT])