immutable: Add tests.
[gnulib.git] / m4 / sys_times_h.m4
blobb9daaa7caf6d9ddb02a71b5633beb579aef11df7
1 # Configure a replacement for <sys/times.h>.
2 # serial 8
4 # Copyright (C) 2008-2021 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 Simon Josefsson.
11 AC_DEFUN([gl_SYS_TIMES_H],
13   AC_REQUIRE([gl_SYS_TIMES_H_DEFAULTS])
15   dnl <sys/times.h> is always overridden, because of GNULIB_POSIXCHECK.
16   gl_CHECK_NEXT_HEADERS([sys/times.h])
17   if test $ac_cv_header_sys_times_h = yes; then
18     HAVE_SYS_TIMES_H=1
19     AC_CHECK_TYPES([struct tms], [], [HAVE_STRUCT_TMS=0], [[
20 #include <sys/times.h>
21       ]])
22   else
23     HAVE_SYS_TIMES_H=0
24     HAVE_STRUCT_TMS=0
25   fi
26   AC_SUBST([HAVE_SYS_TIMES_H])
28   dnl Check for declarations of anything we want to poison if the
29   dnl corresponding gnulib module is not in use.
30   gl_WARN_ON_USE_PREPARE([[
31 /* Some systems have incomplete headers.  */
32 #if !(defined __GLIBC__ && !defined __UCLIBC__)
33 # include <time.h>
34 #endif
35 #include <sys/times.h>
36     ]], [times])
39 AC_DEFUN([gl_SYS_TIMES_MODULE_INDICATOR],
41   dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
42   AC_REQUIRE([gl_SYS_TIMES_H_DEFAULTS])
43   gl_MODULE_INDICATOR_SET_VARIABLE([$1])
46 AC_DEFUN([gl_SYS_TIMES_H_DEFAULTS],
48   GNULIB_TIMES=0;     AC_SUBST([GNULIB_TIMES])
49   HAVE_STRUCT_TMS=1;  AC_SUBST([HAVE_STRUCT_TMS])
50   HAVE_TIMES=1;       AC_SUBST([HAVE_TIMES])