+2009-09-09 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+
+ Allow to work on systems without Fcntl::flock implementation.
+ * configure.ac (PERL_FLOCK): New substitution variable with test
+ whether Fcntl::flock is implemented by the system.
+ * bin/Makefile.am (edit): Substitute @PERL_FLOCK@.
+ * bin/autom4te.in: Call XFile::lock only if flock is
+ implemented.
+
2009-09-04 Reuben Thomas <rrt@sc3d.org> (tiny change)
Mention the Autoconf archive.
edit = sed \
-e 's|@SHELL[@]|$(SHELL)|g' \
-e 's|@PERL[@]|$(PERL)|g' \
+ -e 's|@PERL_FLOCK[@]|$(PERL_FLOCK)|g' \
-e 's|@bindir[@]|$(bindir)|g' \
-e 's|@pkgdatadir[@]|$(pkgdatadir)|g' \
-e 's|@prefix[@]|$(prefix)|g' \
my $ocache;
my $icache_file;
+my $flock_implemented = '@PERL_FLOCK@';
+
# The macros to trace mapped to their format, as specified by the
# user.
my %trace;
# files, but the index is the first and last file to be updated, so
# locking it is sufficient.
$icache_file = new Autom4te::XFile $icache, O_RDWR|O_CREAT;
-$icache_file->lock (LOCK_EX);
+$icache_file->lock (LOCK_EX)
+ if ($flock_implemented eq "yes");
# Read the cache index if available and older than autom4te itself.
# If autom4te is younger, then some structures such as C4che might
AC_MSG_ERROR([Perl 5.005_03 or better is required])
}
+# Find out whether the system supports flock
+# Note this test does not try to find out whether it works with this
+# particular file system. It merely avoids us running flock on systems
+# where that bails out.
+AC_CACHE_CHECK([whether $PERL Fcntl::flock is implemented],
+ [ac_cv_perl_flock_implemented],
+ [echo lock me > conftest.fil
+ if $PERL -e 'use Fcntl ":flock"; flock("conftest.fil", LOCK_EX); 1;'; then
+ ac_cv_perl_flock_implemented=yes
+ else
+ ac_cv_perl_flock_implemented=no
+ fi
+ rm -f conftest.fil
+ ])
+AC_SUBST([PERL_FLOCK], [$ac_cv_perl_flock_implemented])
+
## ------- ##
## Emacs. ##