]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
added ntp_rlimit.m4
authorHarlan Stenn <stenn@ntp.org>
Sun, 18 Nov 2012 12:31:57 +0000 (07:31 -0500)
committerHarlan Stenn <stenn@ntp.org>
Sun, 18 Nov 2012 12:31:57 +0000 (07:31 -0500)
bk: 50a8d53dz42ceY7XIW5BrMRHVJEn7A

sntp/m4/ntp_rlimit.m4 [new file with mode: 0644]

diff --git a/sntp/m4/ntp_rlimit.m4 b/sntp/m4/ntp_rlimit.m4
new file mode 100644 (file)
index 0000000..c1267b7
--- /dev/null
@@ -0,0 +1,66 @@
+dnl ######################################################################
+dnl rlimit capabilities checks
+AC_DEFUN([NTP_RLIMIT_ITEMS], [
+
+AC_CACHE_CHECK(
+    [for RLIMIT_MEMLOCK],
+    [ntp_cv_rlimit_memlock],
+    [AC_COMPILE_IFELSE(
+       [AC_LANG_PROGRAM(
+           [[
+               #ifdef HAVE_SYS_TYPES_H
+               # include <sys/types.h>
+               #endif
+               #ifdef HAVE_SYS_TIME_H
+               # include <sys/time.h>
+               #endif
+               #ifdef HAVE_SYS_RESOURCE_H
+               # include <sys/resource.h>
+               #endif
+           ]],
+           [[
+               getrlimit(RLIMIT_MEMLOCK, 0);
+           ]]
+       )],
+       [ntp_cv_rlimit_memlock=yes],
+       [ntp_cv_rlimit_memlock=no]
+    )]
+)
+case "$ntp_cv_rlimit_memlock" in
+ yes)
+    AC_SUBST([HAVE_RLIMIT_MEMLOCK])
+    HAVE_RLIMIT_MEMLOCK=" memlock 32"
+esac
+
+AC_CACHE_CHECK(
+    [for RLIMIT_STACK],
+    [ntp_cv_rlimit_stack],
+    [AC_COMPILE_IFELSE(
+       [AC_LANG_PROGRAM(
+           [[
+               #ifdef HAVE_SYS_TYPES_H
+               # include <sys/types.h>
+               #endif
+               #ifdef HAVE_SYS_TIME_H
+               # include <sys/time.h>
+               #endif
+               #ifdef HAVE_SYS_RESOURCE_H
+               # include <sys/resource.h>
+               #endif
+           ]],
+           [[
+               getrlimit(RLIMIT_STACK, 0);
+           ]]
+       )],
+       [ntp_cv_rlimit_stack=yes],
+       [ntp_cv_rlimit_stack=no]
+    )]
+)
+case "$ntp_cv_rlimit_stack" in
+ yes)
+    AC_SUBST([HAVE_RLIMIT_STACK])
+    HAVE_RLIMIT_STACK=" stacksize 50"
+esac
+
+])dnl
+dnl ======================================================================