For PR automake/450:
authorAlexandre Duret-Lutz <adl@gnu.org>
Thu, 3 Mar 2005 21:35:44 +0000 (21:35 +0000)
committerAlexandre Duret-Lutz <adl@gnu.org>
Thu, 3 Mar 2005 21:35:44 +0000 (21:35 +0000)
* aclocal.in (scan_file, scan_configure_dep): Skip missing sincluded
files.
* automake.in (scan_autoconf_traces): Likewise.
* tests/sinclude.test: Augment.
Report from Peter Breitenlohner.

ChangeLog
aclocal.in
automake.in
tests/sinclude.test

index a9b273c..2dd6568 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,13 @@
 2005-03-03  Alexandre Duret-Lutz  <adl@gnu.org>
 
        For PR automake/450:
+       * aclocal.in (scan_file, scan_configure_dep): Skip missing sincluded
+       files.
+       * automake.in (scan_autoconf_traces): Likewise.
+       * tests/sinclude.test: Augment.
+       Report from Peter Breitenlohner.
+
+       For PR automake/450:
        * aclocal.in (write_aclocal, trace_used_macros): Do not add/remove
        acinclude.m4 and configure.ac to the include map in these two
        places ...
index 427185e..2d61773 100644 (file)
@@ -135,7 +135,7 @@ my $ac_defun_rx =
 my $ac_require_rx = "AC_REQUIRE\\((?:\\[([^]]+)\\]|([^],)\n]+))\\)";
 
 # Matches an m4_include line
-my $m4_include_rx = "(?:m4_)?s?include\\((?:\\[([^]]+)\\]|([^],)\n]+))\\)";
+my $m4_include_rx = "(?:m4_)?(s?)include\\((?:\\[([^]]+)\\]|([^],)\n]+))\\)";
 
 # Match a serial number
 my $serial_line_rx = '^#\s*serial\s+(\S*)';
@@ -351,7 +351,10 @@ sub scan_configure_dep ($)
 
       while (/$m4_include_rx/go)
        {
-         push (@ilist, $1 || $2);
+         my $ifile = $2 || $3;
+         # Skip missing `sinclude'd files.
+         next if $1 eq 's' && ! -f $ifile;
+         push @ilist, $ifile;
        }
 
       while (/$ac_require_rx/go)
@@ -525,7 +528,9 @@ sub scan_file ($$$)
 
       while ($line =~ /$m4_include_rx/go)
        {
-         my $ifile = $1 || $2;
+         my $ifile = $2 || $3;
+         # Skip missing `sinclude'd files.
+         next if $1 eq 's' && ! -f $ifile;
          # m4_include is relative to the directory of the file which
          # perform the include, but we want paths relative to the
          # directory where aclocal is run.  Do not use
index b427399..9e2a986 100755 (executable)
@@ -4899,6 +4899,9 @@ sub scan_autoconf_traces ($)
             || $macro eq 'm4_sinclude'
             || $macro eq 'sinclude')
        {
+          # Skip missing `sinclude'd files.
+          next if $macro ne 'm4_include' && ! -f $args[1];
+
          # Some modified versions of Autoconf don't use
          # forzen files.  Consequently it's possible that we see all
          # m4_include's performed during Autoconf's startup.
index ffe65cc..7c7ab2a 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 1998, 2001, 2002, 2003  Free Software Foundation, Inc.
+# Copyright (C) 1998, 2001, 2002, 2003, 2005  Free Software Foundation, Inc.
 #
 # This file is part of GNU Automake.
 #
@@ -31,6 +31,7 @@ cat > configure.in <<EOF
 AC_INIT([amsinclude], [1.0])
 AM_INIT_AUTOMAKE
 AC_CONFIG_FILES([Makefile])
+sinclude([doesntexist.m4])
 EOF
 
 mkdir sub
@@ -49,6 +50,7 @@ END
 : > Makefile.am
 
 echo 'sinclude(sub/g.m4)' >> acinclude.m4
+echo 'm4_sinclude(sub/doesntexist.m4)' >> acinclude.m4
 
 $ACLOCAL
 
@@ -57,6 +59,7 @@ echo 'm4_include(sub/h.m4)' >> aclocal.m4
 
 $AUTOMAKE
 
+grep doesntexist Makefile.in && exit 1
 grep MAGICALPIG Makefile.in
 grep MAGICALHOG Makefile.in
 grep GREPME Makefile.in