> Paul> If that's the main problem, then we can use a heuristic: > Paul> report a lock failure and exit only if MAKEFLAGS contains > Paul> -j. It's a bit of a hack, admittedly. > > > This sounds like a good solution to me. > > Same here. OK, I installed this patch. I can't test it easily, though. (For one thing, CVS autoconf doesn't build itself on my host, since it depends on an alpha version of autoconf....) 2003-09-30 Paul Eggert <eggert@xxxxxxxxxxx> * lib/Autom4te/XFile.pm: Use Errno. (lock): Ignore ENOLCK errors. Problem reported Andreas Schwab in <http://mail.gnu.org/archive/html/bug-autoconf/2003-09/msg00141.html>. Index: XFile.pm =================================================================== RCS file: /cvsroot/autoconf/autoconf/lib/Autom4te/XFile.pm,v retrieving revision 1.8 retrieving revision 1.10 diff -p -u -r1.8 -r1.10 --- XFile.pm 13 Sep 2003 22:00:36 -0000 1.8 +++ XFile.pm 30 Sep 2003 19:34:28 -0000 1.10 @@ -87,6 +87,7 @@ require 5.000; use strict; use vars qw($VERSION @EXPORT @EXPORT_OK $AUTOLOAD @ISA); use Carp; +use Errno; use IO::File; use File::Basename; use Autom4te::ChannelDefs; @@ -216,7 +217,15 @@ sub lock { my ($fh, $mode) = @_; # Cannot use @_ here. - if (!flock ($fh, $mode)) + + # On some systems (e.g. GNU/Linux with NFSv2), flock(2) does not work over + # NFS, but Perl prefers that over fcntl(2) if it exists and if + # perl was not built with -Ud_flock. Normally, this problem is harmless, + # so ignore the ENOLCK errors that are reported in that situation, + # However, if the invoker is using "make -j", the problem is not harmless, + # so report it in that case. Admittedly this is a bit of a hack. + if (!flock ($fh, $mode) + && (!$!{ENOLCK} || " $ENV{'MAKEFLAGS'}" =~ / (-j|--jobs)/)) { my $file = $fh->name; fatal "cannot lock $file with mode $mode: $!";