]> CyberLeo.Net >> Repos - FreeBSD/releng/10.2.git/blob - contrib/ntp/sntp/m4/ntp_rlimit.m4
- Copy stable/10@285827 to releng/10.2 in preparation for 10.2-RC1
[FreeBSD/releng/10.2.git] / contrib / ntp / sntp / m4 / ntp_rlimit.m4
1 dnl ######################################################################
2 dnl rlimit capabilities checks
3 AC_DEFUN([NTP_RLIMIT_ITEMS], [
4
5 AC_CACHE_CHECK(
6     [for RLIMIT_MEMLOCK],
7     [ntp_cv_rlimit_memlock],
8     [AC_COMPILE_IFELSE(
9         [AC_LANG_PROGRAM(
10             [[
11                 #ifdef HAVE_SYS_TYPES_H
12                 # include <sys/types.h>
13                 #endif
14                 #ifdef HAVE_SYS_TIME_H
15                 # include <sys/time.h>
16                 #endif
17                 #ifdef HAVE_SYS_RESOURCE_H
18                 # include <sys/resource.h>
19                 #endif
20             ]],
21             [[
22                 getrlimit(RLIMIT_MEMLOCK, 0);
23             ]]
24         )],
25         [ntp_cv_rlimit_memlock=yes],
26         [ntp_cv_rlimit_memlock=no]
27     )]
28 )
29 case "$ntp_cv_rlimit_memlock" in
30  yes)
31     AC_SUBST([HAVE_RLIMIT_MEMLOCK])
32     HAVE_RLIMIT_MEMLOCK=" memlock 32"
33 esac
34
35 AC_CACHE_CHECK(
36     [for RLIMIT_STACK],
37     [ntp_cv_rlimit_stack],
38     [AC_COMPILE_IFELSE(
39         [AC_LANG_PROGRAM(
40             [[
41                 #ifdef HAVE_SYS_TYPES_H
42                 # include <sys/types.h>
43                 #endif
44                 #ifdef HAVE_SYS_TIME_H
45                 # include <sys/time.h>
46                 #endif
47                 #ifdef HAVE_SYS_RESOURCE_H
48                 # include <sys/resource.h>
49                 #endif
50             ]],
51             [[
52                 getrlimit(RLIMIT_STACK, 0);
53             ]]
54         )],
55         [ntp_cv_rlimit_stack=yes],
56         [ntp_cv_rlimit_stack=no]
57     )]
58 )
59 case "$ntp_cv_rlimit_stack" in
60  yes)
61     AC_SUBST([HAVE_RLIMIT_STACK])
62     HAVE_RLIMIT_STACK=" stacksize 50"
63 esac
64
65 ])dnl
66 dnl ======================================================================