diff configure.in @ 108379:203aa49071bf

Move MAIL_USE_FLOCK, MAIL_USE_LOCKF, BLESSMAIL_TARGET from cpp to configure. * configure.in (MAIL_USE_FLOCK, MAIL_USE_LOCKF): New AC_DEFINEs. (BLESSMAIL_TARGET): New output variable. * lib-src/Makefile.in (BLESSMAIL_TARGET): Set with configure, not cpp. * src/s/aix4-2.h (MAIL_USE_LOCKF): * src/s/bsd-common.h (MAIL_USE_FLOCK): * src/s/darwin.h (MAIL_USE_FLOCK): * src/s/gnu-linux.h (MAIL_USE_FLOCK): * src/s/irix6-5.h (MAIL_USE_FLOCK): * src/s/template.h (MAIL_USE_FLOCK): Move to configure. * src/s/ms-w32.h: Comment. * msdos/sed3v2.inp (BLESSMAIL_TARGET): Edit to need-blessmail.
author Glenn Morris <rgm@gnu.org>
date Sun, 09 May 2010 17:07:47 -0700
parents 973b5bc5fcfe
children b9b3b94979ee
line wrap: on
line diff
--- a/configure.in	Sun May 09 18:39:36 2010 -0400
+++ b/configure.in	Sun May 09 17:07:47 2010 -0700
@@ -2482,6 +2482,48 @@
 AC_CHECK_HEADERS(maillock.h)
 AC_SUBST(LIBS_MAIL)
 
+## Define MAIL_USE_FLOCK (or LOCKF) if the mailer uses flock (or lockf) to
+## interlock access to the mail spool.  The alternative is a lock file named
+## /usr/spool/mail/$USER.lock.
+mail_lock=no
+case "$opsys" in
+  aix4-2) mail_lock="lockf" ;;
+
+  gnu|freebsd|netbsd|openbsd|darwin|irix6-5) mail_lock="flock" ;;
+
+  ## On GNU/Linux systems, both methods are used by various mail programs.
+  ## I assume most people are using newer mailers that have heard of flock.
+  ## Change this if you need to.
+  ## Debian contains a patch which says: ``On Debian/GNU/Linux systems,
+  ## configure gets the right answers, and that means *NOT* using flock.
+  ## Using flock is guaranteed to be the wrong thing. See Debian Policy
+  ## for details.'' and then uses `#ifdef DEBIAN'.  Unfortunately the
+  ## Debian maintainer hasn't provided a clean fix for Emacs.
+  ## movemail.c will use `maillock' when MAILDIR, HAVE_LIBMAIL and
+  ## HAVE_MAILLOCK_H are defined, so the following appears to be the
+  ## correct logic.  -- fx
+  ## We must check for HAVE_LIBLOCKFILE too, as movemail does.
+  ## liblockfile is a Free Software replacement for libmail, used on
+  ## Debian systems and elsewhere. -rfr.
+  gnu-*)
+    mail_lock="flock"
+    if test $have_mail = yes || test $have_lockfile = yes; then
+      test $ac_cv_header_maillock_h = yes && mail_lock=no
+    fi
+    ;;
+esac
+
+BLESSMAIL_TARGET=
+case "$mail_lock" in
+  flock) AC_DEFINE(MAIL_USE_FLOCK, 1, [Define if the mailer uses flock to interlock the mail spool.]) ;;
+
+  lockf) AC_DEFINE(MAIL_USE_LOCKF, 1, [Define if the mailer uses lockf to interlock the mail spool.]) ;;
+
+  *) BLESSMAIL_TARGET="need-blessmail" ;;
+esac
+AC_SUBST(BLESSMAIL_TARGET)
+
+
 AC_CHECK_FUNCS(gethostname getdomainname dup2 \
 rename closedir mkdir rmdir sysinfo getrusage get_current_dir_name \
 random lrand48 bcopy bcmp logb frexp fmod rint cbrt ftime setsid \