+2002-05-14 Alexandre Duret-Lutz <duret_g@epita.fr>
+
+ Fix for PR automake/322:
+ * automake.in (read_am_file): Rename $was_rule as $prev_state, and
+ set it with IN_RULE_DEF, IN_VAR_DEF, or IN_COMMENT as appropriate.
+ Handle comments continued by backslashes.
+ * tests/comment6.test: New file.
+ * tests/Makefile.am (TESTS): Add comment6.test.
+ Reported by Braden N. McDaniel.
+
2002-05-08 Charles Wilson <cwilson@ece.gatech.edu>
Alexandre Duret-Lutz <duret_g@epita.fr>
Bill Davidson bill@kayhay.com
Bill Fenner fenner@parc.xerox.com
Bob Proulx rwp@hprwp.fc.hp.com
+Braden N. McDaniel braden@endoframe.com
Brendan O'Dea bod@compusol.com.au
Brian Ford ford@vss.fsi.com
Brian Jones cbj@nortel.net
my $blank = 0;
my $saw_bk = 0;
+ use constant IN_VAR_DEF => 0;
+ use constant IN_RULE_DEF => 1;
+ use constant IN_COMMENT => 2;
+ my $prev_state = IN_RULE_DEF;
+
while ($_ = $am_file->getline)
{
if (/$IGNORE_PATTERN/o)
$blank = 1;
$comment .= $spacing . $_;
$spacing = '';
+ $prev_state = IN_COMMENT;
}
else
{
my @saved_cond_stack = @cond_stack;
my $cond = conditional_string (@cond_stack);
- my $was_rule = 0;
my $last_var_name = '';
my $last_var_type = '';
my $last_var_value = '';
$spacing = '';
file_error ($here, "comment following trailing backslash")
if $saw_bk && $comment eq '';
+ $prev_state = IN_COMMENT;
}
elsif ($saw_bk)
{
- if ($was_rule)
+ if ($prev_state == IN_RULE_DEF)
{
$output_trailer .= &make_condition (@cond_stack);
$output_trailer .= $_;
}
- else
+ elsif ($prev_state == IN_COMMENT)
+ {
+ $comment .= $spacing . $_;
+ }
+ else # $prev_state == IN_VAR_DEF
{
$last_var_value .= ' '
unless $last_var_value =~ /\s$/;
elsif (/$RULE_PATTERN/o)
{
# Found a rule.
- $was_rule = 1;
+ $prev_state = IN_RULE_DEF;
rule_define ($1, 0, $cond, $here);
elsif (/$ASSIGNMENT_PATTERN/o)
{
# Found a macro definition.
- $was_rule = 0;
+ $prev_state = IN_VAR_DEF;
$last_var_name = $1;
$last_var_type = $2;
$last_var_value = $3;
{
# This isn't an error; it is probably a continued rule.
# In fact, this is what we assume.
- $was_rule = 1;
+ $prev_state = IN_RULE_DEF;
$output_trailer .= $comment . $spacing;
$output_trailer .= &make_condition (@cond_stack);
$output_trailer .= $_;
--- /dev/null
+#! /bin/sh
+# Test for PR/322.
+
+. $srcdir/defs || exit 1
+
+set -e
+
+cat >> configure.in <<'EOF'
+AC_OUTPUT
+EOF
+
+## There are two tests: one with backslashed comments at the top
+## of the file, and one with a rule first. This is because
+## Comments at the top of the file are handled specially
+## since Automake 1.5.
+
+cat > Makefile.am << 'EOF'
+# SOME_FILES = \
+ file1 \
+ file2 \
+ file3
+
+all-local:
+ @echo Good
+
+EOF
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+./configure
+$MAKE
+
+cat > Makefile.am << 'EOF'
+all-local:
+ @echo Good
+
+# SOME_FILES = \
+ file1 \
+ file2 \
+ file3
+EOF
+
+$AUTOMAKE
+./configure
+$MAKE