[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
FYI: Add `file:line:' on `file not found' aclocal diagnostics.
From: |
Alexandre Duret-Lutz |
Subject: |
FYI: Add `file:line:' on `file not found' aclocal diagnostics. |
Date: |
Thu, 10 Jun 2004 23:11:54 +0200 |
User-agent: |
Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3.50 (gnu/linux) |
I'm checking this in.
2004-06-10 Alexandre Duret-Lutz <address@hidden>
For Debian Bug #251820:
* aclocal.in (scan_file): Keep track of the location where each
file is included, and display it when reporting a missing file.
Pass this location to scan_file as a second argument.
(scan_m4_files): Adjust calls to scan_file.
* tests/acloca14.test: Add a test for this diagnostic.
Index: aclocal.in
===================================================================
RCS file: /cvs/automake/automake/aclocal.in,v
retrieving revision 1.103
diff -u -r1.103 aclocal.in
--- aclocal.in 15 May 2004 18:19:57 -0000 1.103
+++ aclocal.in 10 Jun 2004 21:09:52 -0000
@@ -133,12 +133,12 @@
# First, scan configure.ac. It may contain macro definitions,
# or may include other files that define macros.
- &scan_file ($configure_ac);
+ &scan_file ($configure_ac, 'aclocal');
# Then, scan acinclude.m4 if it exists.
if (-f 'acinclude.m4')
{
- &scan_file ('acinclude.m4');
+ &scan_file ('acinclude.m4', 'aclocal');
}
# Finally, scan all files in our search path.
@@ -163,7 +163,7 @@
next if $file eq 'aclocal.m4';
$fullfile = File::Spec->canonpath ("$m4dir/$file");
- &scan_file ($fullfile);
+ &scan_file ($fullfile, 'aclocal');
}
closedir (DIR);
}
@@ -293,11 +293,15 @@
# Point to the documentation for underquoted AC_DEFUN only once.
my $underquoted_manual_once = 0;
-# Scan a single M4 file, and all files it includes.
+# scan_file ($FILE, $WHERE)
+# -------------------------
+# Scan a single M4 file ($FILE), and all files it includes.
# Return the list of included files.
-sub scan_file ($)
+# $WHERE is the location to use in the diagnostic if the file
+# does not exist.
+sub scan_file ($$)
{
- my ($file) = @_;
+ my ($file, $where) = @_;
my $base = dirname $file;
# Do not scan the same file twice.
@@ -307,9 +311,16 @@
unshift @file_order, $file;
+ if (! -e $file)
+ {
+ print STDERR "$where: file `$file' does not exist\n";
+ exit 1;
+ }
+
my $fh = new Automake::XFile $file;
my $contents = '';
my @inc_files = ();
+ my %inc_lines = ();
while ($_ = $fh->getline)
{
# Ignore `##' lines.
@@ -360,15 +371,17 @@
$ifile = "$base/$ifile"
unless $base eq '.' || File::Spec->file_name_is_absolute ($ifile);
push (@inc_files, $ifile);
+ $inc_lines{$ifile} = $.;
}
}
$file_contents{$file} = $contents;
# For some reason I don't understand, it does not work
- # to do `map { scan_file ($_) } @inc_files' below.
+ # to do `map { scan_file ($_, ...) } @inc_files' below.
# With Perl 5.8.2 it undefines @inc_files.
my @copy = @inc_files;
- my @all_inc_files = (@inc_files, map { scan_file ($_) } @copy);
+ my @all_inc_files = (@inc_files,
+ map { scan_file ($_, "$file:$inc_lines{$_}") } @copy);
$file_includes{$file} = address@hidden;
return @all_inc_files;
}
Index: tests/acloca14.test
===================================================================
RCS file: /cvs/automake/automake/tests/acloca14.test,v
retrieving revision 1.1
diff -u -r1.1 acloca14.test
--- tests/acloca14.test 2 Jan 2004 14:53:48 -0000 1.1
+++ tests/acloca14.test 10 Jun 2004 21:09:54 -0000
@@ -109,3 +109,8 @@
$MAKE
grep 'defs/f.m4' aclocal.m4
$MAKE testdist2
+
+# Make sure aclocal diagnose missing included files with correct `file:line:'.
+rm -f b.m4
+$ACLOCAL 2>stderr && exit 1
+grep 'a.m4:1:.*b.m4.*does not exist' stderr
--
Alexandre Duret-Lutz
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- FYI: Add `file:line:' on `file not found' aclocal diagnostics.,
Alexandre Duret-Lutz <=