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