doc: Remove references to POSIX 202x.
[gnulib.git] / m4 / sys_resource_h.m4
blob70a77abcde238ca02eed6f3ff3d552ce8085c22a
1 # sys_resource_h.m4
2 # serial 5
3 dnl Copyright (C) 2012-2024 Free Software Foundation, Inc.
4 dnl This file is free software; the Free Software Foundation
5 dnl gives unlimited permission to copy and/or distribute it,
6 dnl with or without modifications, as long as this notice is preserved.
8 AC_DEFUN_ONCE([gl_SYS_RESOURCE_H],
10   AC_REQUIRE([gl_SYS_RESOURCE_H_DEFAULTS])
11   dnl <sys/resource.h> is always overridden, because of GNULIB_POSIXCHECK.
12   gl_CHECK_NEXT_HEADERS([sys/resource.h])
13   if test $ac_cv_header_sys_resource_h = yes; then
14     HAVE_SYS_RESOURCE_H=1
15   else
16     HAVE_SYS_RESOURCE_H=0
17   fi
18   AC_SUBST([HAVE_SYS_RESOURCE_H])
20   dnl Check for declarations of anything we want to poison if the
21   dnl corresponding gnulib module is not in use.
22   gl_WARN_ON_USE_PREPARE([[
23 #if HAVE_SYS_RESOURCE_H
24 /* At least FreeBSD 5.0 needs extra headers before <sys/resource.h>
25    will compile.  */
26 # include <sys/types.h>
27 # include <sys/time.h>
28 # include <sys/resource.h>
29 #endif
30     ]],
31     [getrusage])
34 # gl_SYS_RESOURCE_MODULE_INDICATOR([modulename])
35 # sets the shell variable that indicates the presence of the given module
36 # to a C preprocessor expression that will evaluate to 1.
37 # This macro invocation must not occur in macros that are AC_REQUIREd.
38 AC_DEFUN([gl_SYS_RESOURCE_MODULE_INDICATOR],
40   dnl Ensure to expand the default settings once only.
41   gl_SYS_RESOURCE_H_REQUIRE_DEFAULTS
42   gl_MODULE_INDICATOR_SET_VARIABLE([$1])
43   dnl Define it also as a C macro, for the benefit of the unit tests.
44   gl_MODULE_INDICATOR_FOR_TESTS([$1])
47 # Initializes the default values for AC_SUBSTed shell variables.
48 # This macro must not be AC_REQUIREd.  It must only be invoked, and only
49 # outside of macros or in macros that are not AC_REQUIREd.
50 AC_DEFUN([gl_SYS_RESOURCE_H_REQUIRE_DEFAULTS],
52   m4_defun(GL_MODULE_INDICATOR_PREFIX[_SYS_RESOURCE_H_MODULE_INDICATOR_DEFAULTS], [
53     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETRUSAGE])
54   ])
55   m4_require(GL_MODULE_INDICATOR_PREFIX[_SYS_RESOURCE_H_MODULE_INDICATOR_DEFAULTS])
56   AC_REQUIRE([gl_SYS_RESOURCE_H_DEFAULTS])
59 AC_DEFUN([gl_SYS_RESOURCE_H_DEFAULTS],
61   dnl Assume proper GNU behavior unless another module says otherwise.
62   HAVE_GETRUSAGE=1;       AC_SUBST([HAVE_GETRUSAGE])