1 # Configure a replacement for <sys/time.h>.
3 # Copyright (C) 2007, 2009 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 REPLACE_GETTIMEOFDAY=0 statement
13 dnl below is expanded once only, before all REPLACE_GETTIMEOFDAY=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 gl_CHECK_NEXT_HEADERS([sys/time.h])
23 if test $ac_cv_header_sys_time_h = yes; then
28 AC_SUBST([HAVE_SYS_TIME_H])
30 AC_CACHE_CHECK([for struct timeval], [gl_cv_sys_struct_timeval],
38 [[static struct timeval x; x.tv_sec = x.tv_usec;]])],
39 [gl_cv_sys_struct_timeval=yes],
40 [gl_cv_sys_struct_timeval=no])])
41 if test $gl_cv_sys_struct_timeval = yes; then
46 AC_SUBST([HAVE_STRUCT_TIMEVAL])
48 dnl Assume POSIX behavior unless another module says otherwise.
49 REPLACE_GETTIMEOFDAY=0
50 AC_SUBST([REPLACE_GETTIMEOFDAY])
51 if test $HAVE_SYS_TIME_H = 0 || test $HAVE_STRUCT_TIMEVAL = 0; then
56 AC_SUBST([SYS_TIME_H])