]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
Allow to work on systems without Fcntl::flock implementation.
authorRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Wed, 9 Sep 2009 05:27:39 +0000 (07:27 +0200)
committerRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Wed, 9 Sep 2009 05:27:39 +0000 (07:27 +0200)
* 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.

Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
ChangeLog
bin/Makefile.am
bin/autom4te.in
configure.ac

index d074681b11adadaa0be2353ebb40259156ee4fe2..a6e453db258fad44902560b8cf86b03edf8b7380 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+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.
index da65b85ff4a0fb419cd50fbae2164e773d65746f..c84f5ae89e938b46b436b0032274b7be9426d115 100644 (file)
@@ -38,6 +38,7 @@ RELEASE_YEAR = \
 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' \
index 3103369c7b891ece22b7c942f10d40cf1f7fa098..d1aae949ffaa55c3f1fbe819bb429a53044a1824 100644 (file)
@@ -68,6 +68,8 @@ my $tcache;
 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;
@@ -981,7 +983,8 @@ if (! -d "$cache")
 # 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
index 0d579f8cb6f0579026a5ae4bf5444fca3d98be81..12412641712b4a7b604506828554c63abb0130ca 100644 (file)
@@ -137,6 +137,22 @@ $PERL -e 'require 5.005_03;' || {
    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.  ##