]> diplodocus.org Git - nmh/blob - m4/locking.m4
Changed build_nmh sasl and tls defaults to be configure's.
[nmh] / m4 / locking.m4
1 dnl
2 dnl Our functions to check the locking functions available and select a
3 dnl default locking function for the spool file
4 dnl
5 dnl Since we're assuming POSIX as a minimum, we always assume we have fcntl
6 dnl locking available.
7 dnl
8
9 AC_DEFUN([NMH_LOCKING],
10 [AC_CHECK_FUNCS([flock lockf])
11 AS_CASE(["$host_os"],
12 [aix*|cygwin*|linux*],
13 [default_locktype="fcntl"],
14 [freebsd*|*netbsd*|openbsd*|darwin*], [default_locktype="flock"],
15 [default_locktype="dot"])
16
17 AC_MSG_CHECKING([default locking method for the mail spool])
18
19 AC_ARG_WITH([locking],
20 AS_HELP_STRING([--with-locking=@<:@dot|fcntl|flock|lockf@:>@],
21 [The default locking method for the mail spool file]), ,
22 [with_locking="$default_locktype"])
23
24 AS_CASE([$with_locking],
25 [fcntl|dot], ,
26 [flock],
27 [AS_IF([test x"$ac_cv_func_flock" != x"yes"],
28 [AC_MSG_ERROR([flock locks not supported on this system])])],
29 [lockf],
30 [AS_IF([test x"$ac_cv_func_lockf" != x"yes"],
31 [AC_MSG_ERROR([lockf locks not supported on this system])])],
32 [no],
33 [AC_MSG_ERROR([--without-locking not supported])],
34 [AC_MSG_ERROR([Unknown locking type $with_locking])])
35
36 AC_DEFINE_UNQUOTED([DEFAULT_LOCKING], ["$with_locking"],
37 [The default lock type for the mail spool file])
38 AC_SUBST([default_locking], [$with_locking])
39
40 AC_MSG_RESULT([$with_locking])
41
42 supported_locks="fcntl dot"
43 AS_IF([test x"$ac_cv_func_flock" = x"yes"],
44 [supported_locks="$supported_locks flock"])
45 AS_IF([test x"$ac_cv_func_lockf" = x"yes"],
46 [supported_locks="$supported_locks lockf"])
47 AC_SUBST([supported_locks])
48
49 dnl Should we use a locking directory?
50 AC_ARG_ENABLE([lockdir],
51 [AS_HELP_STRING([--enable-lockdir=dir], [Store dot-lock files in "dir"])], [
52 AS_IF([test "x$enableval" = xyes],[
53 AC_MSG_ERROR([--enable-lockdir requires an argument])])
54 AC_DEFINE_UNQUOTED([LOCKDIR], ["$enableval"],
55 [Directory to store dot-locking lock files])
56 ])])