2 dnl Our functions to check the locking functions available and select a
3 dnl default locking function for the spool file
5 dnl Since we're assuming POSIX as a minimum, we always assume we have fcntl
9 AC_DEFUN([NMH_LOCKING],
10 [AC_CHECK_FUNCS([flock lockf])
12 [aix*|cygwin*|linux*],
13 [default_locktype="fcntl"],
14 [freebsd*|openbsd*|darwin*], [default_locktype="flock"],
15 [default_locktype="dot"])
17 AC_MSG_CHECKING([default locking method for the mail spool])
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"])
24 AS_CASE([$with_locking],
27 [AS_IF([test x"$ac_cv_func_flock" != x"yes"],
28 [AC_MSG_ERROR([flock locks not supported on this system])])],
30 [AS_IF([test x"$ac_cv_func_lockf" != x"yes"],
31 [AC_MSG_ERROR([lockf locks not supported on this system])])],
33 [AC_MSG_ERROR([--without-locking not supported])],
34 [AC_MSG_ERROR([Unknown locking type $with_locking])])
36 AC_DEFINE_UNQUOTED([DEFAULT_LOCKING], [$with_locking],
37 [The default lock type for the mail spool file])
39 AC_MSG_RESULT([$with_locking])
41 dnl Should we use a locking directory?
42 AC_ARG_ENABLE([lockdir],
43 [AS_HELP_STRING([--enable-lockdir=dir], [Store dot-lock files in "dir"])], [
44 AS_IF([test "x$enableval" = xyes],[
45 AC_MSG_ERROR([--enable-lockdir requires an argument])])
46 AC_DEFINE_UNQUOTED([LOCKDIR], ["$enableval"],
47 [Directory to store dot-locking lock files])