maint: update copyright
[gnulib.git] / m4 / sys_resource_h.m4
1 # sys_resource_h.m4 serial 2
2 dnl Copyright (C) 2012-2014 Free Software Foundation, Inc.
3 dnl This file is free software; the Free Software Foundation
4 dnl gives unlimited permission to copy and/or distribute it,
5 dnl with or without modifications, as long as this notice is preserved.
6
7 AC_DEFUN([gl_HEADER_SYS_RESOURCE],
8 [
9   AC_REQUIRE([gl_SYS_RESOURCE_H_DEFAULTS])
10   dnl <sys/resource.h> is always overridden, because of GNULIB_POSIXCHECK.
11   gl_CHECK_NEXT_HEADERS([sys/resource.h])
12   if test $ac_cv_header_sys_resource_h = yes; then
13     HAVE_SYS_RESOURCE_H=1
14   else
15     HAVE_SYS_RESOURCE_H=0
16   fi
17   AC_SUBST([HAVE_SYS_RESOURCE_H])
18
19   dnl Check for declarations of anything we want to poison if the
20   dnl corresponding gnulib module is not in use.
21   gl_WARN_ON_USE_PREPARE([[
22 #if HAVE_SYS_RESOURCE_H
23 /* At least FreeBSD 5.0 needs extra headers before <sys/resource.h>
24    will compile.  */
25 # include <sys/types.h>
26 # include <sys/time.h>
27 # include <sys/resource.h>
28 #endif
29     ]],
30     [getrusage])
31 ])
32
33 AC_DEFUN([gl_SYS_RESOURCE_MODULE_INDICATOR],
34 [
35   dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
36   AC_REQUIRE([gl_SYS_RESOURCE_H_DEFAULTS])
37   gl_MODULE_INDICATOR_SET_VARIABLE([$1])
38   dnl Define it also as a C macro, for the benefit of the unit tests.
39   gl_MODULE_INDICATOR_FOR_TESTS([$1])
40 ])
41
42 AC_DEFUN([gl_SYS_RESOURCE_H_DEFAULTS],
43 [
44   GNULIB_GETRUSAGE=0;     AC_SUBST([GNULIB_GETRUSAGE])
45   dnl Assume proper GNU behavior unless another module says otherwise.
46   HAVE_GETRUSAGE=1;       AC_SUBST([HAVE_GETRUSAGE])
47 ])