--- Begin Message ---
Subject: |
Make @setfilename optional in Texinfo files |
Date: |
Fri, 25 Jan 2019 21:22:33 +0000 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
@setfilename should not be required to occur inside Texinfo files, as it
makes it harder to get them working.
Earlier on this:
https://lists.gnu.org/archive/html/automake/2015-09/msg00000.html
Here is a patch. I added a test which is passing now, but it wasn't
passing when I first added the test, so am not sure if it is written
correctly. I based it on the existing test
t/txinfo-setfilename-repeated.sh.
It says GPL version 2 in the licence because that's what was in the
existing tests, although they should probably all be version 3.
ChangeLog entry:
Do not require @setfilename in Texinfo files.
* bin/automake.in (scan_texinfo_file): Derive name of info file from
name of input file if no @setfilename line occurs in the file.
* t/texinfo-no-setfilename.sh: New test.
diff --git a/bin/automake.in b/bin/automake.in
index b4ae8f4..01e6a58 100644
--- a/bin/automake.in
+++ b/bin/automake.in
@@ -3083,8 +3083,10 @@ sub scan_texinfo_file
if (! $outfile)
{
- err_am "'$filename' missing \@setfilename";
- return;
+ # Replace a .texi extension with .info
+ $outfile = basename($filename);
+ $outfile =~ s/\.[^.]+$//;
+ $outfile .= '.info';
}
return ($outfile, $vfile);
diff --git a/t/list-of-tests.mk b/t/list-of-tests.mk
index 84dd29a..32fca84 100644
--- a/t/list-of-tests.mk
+++ b/t/list-of-tests.mk
@@ -1214,6 +1214,7 @@ t/txinfo-no-clutter.sh \
t/txinfo-no-extra-dist.sh \
t/txinfo-no-installinfo.sh \
t/txinfo-no-repeated-targets.sh \
+t/txinfo-no-setfilename.sh \
t/txinfo-other-suffixes.sh \
t/txinfo-override-infodeps.sh \
t/txinfo-override-texinfo-tex.sh \
diff --git a/t/txinfo-no-setfilename.sh b/t/txinfo-no-setfilename.sh
new file mode 100644
index 0000000..3ef1730
--- /dev/null
+++ b/t/txinfo-no-setfilename.sh
@@ -0,0 +1,35 @@
+#! /bin/sh
+# Copyright (C) 2019 Free Software Foundation, Inc.
+#
+# This program 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.
+#
+# This program 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 this program. If not, see <https://www.gnu.org/licenses/>.
+
+# Check Texinfo files work without a @setfilename line
+
+. test-init.sh
+
+cat > Makefile.am << 'END'
+info_TEXINFOS = file.texi
+END
+
+cat > file.texi << 'END'
+contents
+END
+
+$ACLOCAL
+$AUTOMAKE --add-missing
+
+
+grep 'file.info:' Makefile.in
+
+:
--- End Message ---