MAJOR=4
MINOR=45
DEVNAME=tty45
 ?÷     f /^##/;

      $contents .= $_;
      my $line = $_;

      if ($line =~ /$serial_line_rx/go)
	{
	  my $number = $1;
	  if ($number !~ /$serial_number_rx/go)
	    {
	      msg ('syntax', "$file:$.",
		   "ill-formed serial number '$number', "
		   . "expecting a version string with only digits and dots");
	    }
	  elsif ($defun_seen)
	    {
	      # aclocal removes all definitions from M4 file with the
	      # same basename if a greater serial number is found.
	      # Encountering a serial after some macros will undefine
	      # these macros...
	      msg ('syntax', "$file:$.",
		   'the serial number must appear before any macro definition');
	    }
	  # We really care about serials only for non-automake macros
	  # and when --install is used.  But the above diagnostics are
	  # made regardless of this, because not using --install is
	  # not a reason not the fix macro files.
	  elsif ($install && $type != FT_AUTOMAKE)
	    {
	      $serial_seen = 1;
	      my @new = split (/\./, $number);

	      verb "$file:$.: serial $number";

	      if (!exists $serial{$basename}
		  || list_compare (@new, @{$serial{$basename}}) > 0)
		{
		  # Delete any definition we knew from the old macro.
		  foreach my $def (@{$invmap{$basename}})
		    {
		      verb "$file:$.: ignoring previous definition of $def";
		      delete $map{$def};
		    }
		  $invmap{$basename} = [];
		  $serial{$basename} = \@new;
		}
	      else
		{
		  $serial_older = 1;
		}
	    }
	}

      # Remove comments from current line.
      # Do not do it earlier, because the serial line is a comment.
      $line =~ s/\bdnl\b.*$//;
      $line =~ s/\#.*$//;

      while ($line =~ /$ac_defun_rx/go)
	{
	  $defun_seen = 1;
	  if (! defined $1)
	    {
	      msg ('syntax', "$file:$.", "underquoted definition of $2"
		   . "\n  run info Automake 'Extending aclocal'\n"
		   . "  or see https://www.gnu.org/software/automake/manual/"
		   . "automake.html#Extending-aclocal")
		unless $underquoted_manual_once;
	      $underquoted_manual_once = 1;
	    }

	  # If this macro does not have a serial and we have already
	  # seen a macro with the same basename earlier, we should
	  # ignore the macro (don't exit immediately so we can still
	  # diagnose later #serial numbers and underquoted macros).
	  $serial_older ||= ($type != FT_AUTOMAKE
			     && !$serial_seen && exists $serial{$basename});

	  my $macro = $1 || $2;
	  if (!$serial_older && !defined $map{$macro})
	    {
	      verb "found macro $macro in $file: $.";
	      $map{$macro} = $file;
	      push @{$invmap{$basename}}, $macro;
	    }
	  else
	    {
	      # Note: we used to give an error here if we saw a
	      # duplicated macro.  However, this turns out to be
	      # extremely unpopular.  It causes actual problems which
	      # are hard to work around, especially when you must
	      # mix-and-match tool versions.
	      verb "ignoring macro $macro in $file: $.";
	    }
	}

      while ($line =~ /$m4_include_rx/go)
	{
	  my $ifile = $2 || $3;
	  # Skip missing 'sinclude'd files.
	  next if $1 ne 'm4_' && ! -f $ifile;
	  push (@inc_files, $ifile);
	  $inc_lines{$ifile} = $.;
	}
    }

  # Ignore any file that has an old serial (or no serial if we know
  # another one with a serial).
  return ()
    if ($serial_older ||
	($type != FT_AUTOMAKE && !$serial_seen && exists $serial{$basename}));

  $file_contents{$file} = $contents;

  # For some reason I don't understand, it does not work
  # 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 ($type, $_,
					"$file:$inc_lines{$_}") } @copy);
  $file_includes{$file} = \@all_inc_files;
  return @all_inc_files;
}

# strip_redundant_includes (%FILES)
# ---------------------------------
# Each key in %FILES is a file that must be present in the output.
# However some of these files might already include other files in %FILES,
# so there is no point in including them another time.
# This removes it