1 dnl ######################################################################
2 dnl rlimit capabilities checks
3 AC_DEFUN([NTP_RLIMIT_ITEMS], [
7 [ntp_cv_rlimit_memlock],
11 #ifdef HAVE_SYS_TYPES_H
12 # include <sys/types.h>
14 #ifdef HAVE_SYS_TIME_H
15 # include <sys/time.h>
17 #ifdef HAVE_SYS_RESOURCE_H
18 # include <sys/resource.h>
22 getrlimit(RLIMIT_MEMLOCK, 0);
25 [ntp_cv_rlimit_memlock=yes],
26 [ntp_cv_rlimit_memlock=no]
31 ntp_dflt_rlimit_memlock="-1" ;;
32 *) ntp_dflt_rlimit_memlock="32" ;;
34 case "$ntp_cv_rlimit_memlock" in
36 AC_SUBST([HAVE_RLIMIT_MEMLOCK])
37 HAVE_RLIMIT_MEMLOCK=" memlock $ntp_dflt_rlimit_memlock" ;;
42 [ntp_cv_rlimit_stack],
46 #ifdef HAVE_SYS_TYPES_H
47 # include <sys/types.h>
49 #ifdef HAVE_SYS_TIME_H
50 # include <sys/time.h>
52 #ifdef HAVE_SYS_RESOURCE_H
53 # include <sys/resource.h>
57 getrlimit(RLIMIT_STACK, 0);
60 [ntp_cv_rlimit_stack=yes],
61 [ntp_cv_rlimit_stack=no]
64 case "$ntp_cv_rlimit_stack" in
66 AC_SUBST([HAVE_RLIMIT_STACK])
67 HAVE_RLIMIT_STACK=" stacksize 50"
70 # HMS: Only if we are doing the MLOCKALL stuff...
71 AC_MSG_CHECKING([for the default number of 4k stack pages])
76 [? =50 (200 for openbsd) 4k pages]
93 *) AC_MSG_ERROR(["--with-stack-limit requires an integer argument."])
97 AC_DEFINE_UNQUOTED([DFLT_RLIMIT_STACK], [$ans],
98 [Default number of 4k pages for RLIMIT_STACK])
100 # HMS: only if we have RLIMIT_MEMLOCK
101 AC_MSG_CHECKING([for the default number of megabytes to MEMLOCK])
106 [? =32 (-1 on linux) megabytes]
113 ans=$ntp_dflt_rlimit_memlock
116 *) AC_MSG_ERROR(["--with-memlock requires an integer argument."])
119 AC_MSG_RESULT([$ans])
120 AC_DEFINE_UNQUOTED([DFLT_RLIMIT_MEMLOCK], [$ans],
121 [Default number of megabytes for RLIMIT_MEMLOCK])
125 dnl ======================================================================