summaryrefslogtreecommitdiffstats
path: root/m4/rlimit.m4
blob: 9e652a4924b601fb2590325b203a147be9e67010 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
dnl * Do we have RLIMIT_AS?
AC_DEFUN([DOVECOT_RLIMIT_AS], [
  AC_CACHE_CHECK([whether RLIMIT_AS exists],i_cv_have_rlimit_as,[
    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
      #include <sys/types.h>
      #include <sys/time.h>
      #include <sys/resource.h>
    ]], [[
      struct rlimit r;
      getrlimit(RLIMIT_AS, &r);
    ]])],[
      i_cv_have_rlimit_as=yes
    ], [
      i_cv_have_rlimit_as=no
    ])
  ])
  
  if test $i_cv_have_rlimit_as = yes; then
    AC_DEFINE(HAVE_RLIMIT_AS,, [Define if you have RLIMIT_AS for setrlimit()])
  fi
])

dnl * Do we have RLIMIT_NPROC?
AC_DEFUN([DOVECOT_RLIMIT_NPROC], [
  AC_CACHE_CHECK([whether RLIMIT_NPROC exists],i_cv_have_rlimit_nproc,[
    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
      #include <sys/types.h>
      #include <sys/time.h>
      #include <sys/resource.h>
    ]], [[
      struct rlimit r;
      getrlimit(RLIMIT_NPROC, &r);
    ]])],[
      i_cv_have_rlimit_nproc=yes
    ],[
      i_cv_have_rlimit_nproc=no
    ])
  ])
  
  if test $i_cv_have_rlimit_nproc = yes; then
    AC_DEFINE(HAVE_RLIMIT_NPROC,, [Define if you have RLIMIT_NPROC for setrlimit()])
  fi
])

dnl * Do we have RLIMIT_CORE?
AC_DEFUN([DOVECOT_RLIMIT_CORE], [
  AC_CACHE_CHECK([whether RLIMIT_CORE exists],i_cv_have_rlimit_core,[
    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
      #include <sys/types.h>
      #include <sys/time.h>
      #include <sys/resource.h>
    ]], [[
      struct rlimit r;
      getrlimit(RLIMIT_CORE, &r);
    ]])],[
      i_cv_have_rlimit_core=yes
    ],[
      i_cv_have_rlimit_core=no
    ])
  ])
  
  if test $i_cv_have_rlimit_core = yes; then
    AC_DEFINE(HAVE_RLIMIT_CORE,, [Define if you have RLIMIT_CORE for getrlimit()])
  fi
])