2002-11-30 Alexandre Duret-Lutz <adl@gnu.org>
+ For PR automake/375 (Debian Bug #168671):
+ * automake.in (scan_texinfo_file): Erase all known index files, no
+ matter whether they are used at the top-level or not, because we
+ can never know if they are used in included files. The remaining
+ macros we recognize at the top-level of a Texi document are
+ @defindex, @defcodeindex, @synindex, and @syncodeindex.
+ * tests/texinfo18.test: New file.
+ * tests/Makefile.am (TESTS): Add texinfo18.test.
+ Reported by Simon Richter.
+
* automake.in (scan_texinfo_file): Honor only the first @setfilename.
* tests/texinfo17.test: New file.
* tests/Makefile.am (TESTS): Add texinfo17.test.
{
my ($filename) = @_;
- # These are always created, no matter whether indexes are used or not.
- # (Actually tmp is only created if an @macro is used and a certain e-TeX
+ # Some of the following extensions are always created, no matter
+ # whether indexes are used or not. Other (like cps, fns, ... pgs)
+ # are only created when they are used. We used to scan $FILENAME
+ # for their use, but that is not enough: they could be used in
+ # included files. We can't scan included files because we don't
+ # know the include path. Therefore we always erase these files,
+ # no matter whether they are used or not.
+ #
+ # (tmp is only created if an @macro is used and a certain e-TeX
# feature is not available.)
- my @clean_suffixes = qw(aux log toc tmp
- cp fn ky vr tp pg); # grep new.*index texinfo.tex
-
- # There are predefined indexes which don't follow the regular rules.
- my %predefined_index = qw(c cps
- f fns
- k kys
- v vrs
- t tps
- p pgs);
-
- # There are commands which include a hidden index command.
- my %hidden_index = (tp => 'tps');
- $hidden_index{$_} = 'fns' foreach qw(fn un typefn typefun max spec
- op typeop method typemethod);
- $hidden_index{$_} = 'vrs' foreach qw(vr var typevr typevar opt cv
- ivar typeivar);
-
- # Indexes stored into another one. In this case, the *.??s file
- # is not created.
- my @syncodeindexes = ();
+ my %clean_suffixes =
+ map { $_ => 1 } (qw(aux log toc tmp
+ cp cps
+ fn fns
+ ky kys
+ vr vrs
+ tp tps
+ pg pgs)); # grep 'new.*index' texinfo.tex
my $texi = new Automake::XFile "< $filename";
verb "reading $filename";
$vfile = $1;
}
- # Try to find what are the indexes which are used.
+ # Try to find new or unused indexes.
# Creating a new category of index.
elsif (/^\@def(code)?index (\w+)/)
{
- push @clean_suffixes, $2;
- }
-
- # Storing in a predefined index.
- elsif (/^\@([cfkvtp])index /)
- {
- push @clean_suffixes, $predefined_index{$1};
- }
- elsif (/^\@def(\w+) /)
- {
- push @clean_suffixes, $hidden_index{$1}
- if defined $hidden_index{$1};
+ $clean_suffixes{$2} = 1;
+ $clean_suffixes{"$2s"} = 1;
}
# Merging an index into an another.
elsif (/^\@syn(code)?index (\w+) (\w+)/)
{
- push @syncodeindexes, "$2s";
- push @clean_suffixes, "$3s";
+ delete $clean_suffixes{"$2s"};
+ $clean_suffixes{"$3s"} = 1;
}
}
my $infobase = basename ($filename);
$infobase =~ s/\.te?xi(nfo)?$//;
- my %clean_files = map { +"$infobase.$_" => 1 } @clean_suffixes;
- grep { delete $clean_files{"$infobase.$_"} } @syncodeindexes;
- return ($outfile, $vfile, (sort keys %clean_files));
+ return ($outfile, $vfile,
+ map { "$infobase.$_" } (sort keys %clean_suffixes));
}
# ($DIRSTAMP, @CLEAN_FILES)
--- /dev/null
+#! /bin/sh
+# Copyright (C) 2002 Free Software Foundation, Inc.
+#
+# This file is part of GNU Automake.
+#
+# GNU Automake is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# GNU Automake is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with autoconf; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+# Make sure we clean index files, even if they are not used at the top-level.
+# Only *new* indexes need to be declared at the top-level.
+# PR/375.
+
+required='makeinfo tex'
+. ./defs || exit 1
+
+set -e
+
+echo AC_OUTPUT >> configure.in
+
+cat > Makefile.am << 'END'
+info_TEXINFOS = main.texi
+main_TEXINFOS = sub.texi
+END
+
+cat > main.texi << 'END'
+\input texinfo
+@setfilename main.info
+@settitle main
+@defindex au
+@defindex sa
+@defindex sb
+@synindex sa sb
+@node Top
+Hello walls.
+@include sub.texi
+@bye
+END
+
+cat > sub.texi << 'END'
+@cindex foo
+foo
+@pindex bar
+bar
+@auindex baz
+baz
+@saindex sa
+sa
+@sbindex sb
+sb
+END
+
+$ACLOCAL
+$AUTOMAKE --add-missing
+$AUTOCONF
+
+./configure
+$MAKE distcheck