1
# Configure a replacement for <sys/time.h>.
4
# Copyright (C) 2007, 2009-2011 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_REQUIRE([gl_HEADER_SYS_TIME_H_DEFAULTS])
23
AC_CHECK_HEADERS_ONCE([sys/time.h])
24
gl_CHECK_NEXT_HEADERS([sys/time.h])
26
if test $ac_cv_header_sys_time_h != yes; then
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
45
dnl Check for declarations of anything we want to poison if the
46
dnl corresponding gnulib module is not in use.
47
gl_WARN_ON_USE_PREPARE([[
49
# include <sys/time.h>
55
AC_DEFUN([gl_SYS_TIME_MODULE_INDICATOR],
57
dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
58
AC_REQUIRE([gl_HEADER_SYS_TIME_H_DEFAULTS])
59
gl_MODULE_INDICATOR_SET_VARIABLE([$1])
60
dnl Define it also as a C macro, for the benefit of the unit tests.
61
gl_MODULE_INDICATOR_FOR_TESTS([$1])
64
AC_DEFUN([gl_HEADER_SYS_TIME_H_DEFAULTS],
66
GNULIB_GETTIMEOFDAY=0; AC_SUBST([GNULIB_GETTIMEOFDAY])
67
dnl Assume POSIX behavior unless another module says otherwise.
68
HAVE_GETTIMEOFDAY=1; AC_SUBST([HAVE_GETTIMEOFDAY])
69
HAVE_STRUCT_TIMEVAL=1; AC_SUBST([HAVE_STRUCT_TIMEVAL])
70
HAVE_SYS_TIME_H=1; AC_SUBST([HAVE_SYS_TIME_H])
71
REPLACE_GETTIMEOFDAY=0; AC_SUBST([REPLACE_GETTIMEOFDAY])