>From de715b44d25ad523b558d7321ce87bcf8c0cdb09 Mon Sep 17 00:00:00 2001 Message-Id: From: Stefano Lattarini Date: Tue, 3 Apr 2012 22:02:55 +0200 Subject: [PATCH] texinfo: hack to allow '.info' files to be generated in the builddir The possibility to force the '.info' files to be generated in the builddir rather than the srcdir is requested by the developers of GCC, GDB, GNU binutils and the GNU bfd library. The lack of such a possibility being the last obstacle to the removal of the support for Cygnus-style trees (for which such a setup for '.info' files generation was automatically implied). So allow the developers to have the '.info' files to be generated in the builddir rather than the srcdir, through the use of the new *undocumented* option '!hack!info-in-builddir' (whose name should made it clear that it is not meant for public consumption). See also the extensive discussion about automake bug#11034. * lib/Automake/Options.pm (_is_valid_easy_option): Recognize the new option. * automake.in (handle_texinfo_helper): If it's set, initialize '$insrc' to '0', so that info files will be generated in the builddir. Adjust comments to match. * tests/txinfo-builddir.test: New test. * tests/list-of-tests.mk: Add it. Signed-off-by: Stefano Lattarini --- automake.in | 28 +++++++++++----- lib/Automake/Options.pm | 1 + tests/list-of-tests.mk | 1 + tests/txinfo-builddir.test | 74 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 95 insertions(+), 9 deletions(-) create mode 100755 tests/txinfo-builddir.test diff --git a/automake.in b/automake.in index f96e36b..b793a12 100644 --- a/automake.in +++ b/automake.in @@ -3278,15 +3278,25 @@ sub handle_texinfo_helper ($) # have a single variable ($INSRC) that controls whether # the current .info file must be built in the source tree # or in the build tree. Actually this variable is switched - # off for .info files that appear to be cleaned; this is - # for backward compatibility with package such as Texinfo, - # which do things like - # info_TEXINFOS = texinfo.txi info-stnd.texi info.texi - # DISTCLEANFILES = texinfo texinfo-* info*.info* - # # Do not create info files for distribution. - # dist-info: - # in order not to distribute .info files. - my $insrc = ($out_file =~ $user_cleaned_files) ? 0 : 1; + # off in two cases: + # (1) For '.info' files that appear to be cleaned; this is for + # backward compatibility with package such as Texinfo, + # which do things like + # info_TEXINFOS = texinfo.txi info-stnd.texi info.texi + # DISTCLEANFILES = texinfo texinfo-* info*.info* + # # Do not create info files for distribution. + # dist-info: + # in order not to distribute .info files. + # (2) When the undocumented option '!hack!info-in-builddir' + # is given. This is done to allow the developers of + # GCC, GDB, GNU binutils and the GNU bfd library to force + # force the '.info' files to be generated in the builddir + # rather than the srcdir, as was once done when the (now + # obsolete) 'cygnus' option was given. See automake + # bug#11034 for more discussion. + my $insrc = 1; + $insrc = 0 if $out_file =~ $user_cleaned_files; + $insrc = 0 if option '!hack!info-in-builddir'; my $soutdir = '$(srcdir)/' . $outdir; $outdir = $soutdir if $insrc; diff --git a/lib/Automake/Options.pm b/lib/Automake/Options.pm index 2f977bd..ee33837 100644 --- a/lib/Automake/Options.pm +++ b/lib/Automake/Options.pm @@ -267,6 +267,7 @@ sub _is_valid_easy_option ($) { my $opt = shift; return scalar grep { $opt eq $_ } qw( + !hack!info-in-builddir check-news color-tests cygnus diff --git a/tests/list-of-tests.mk b/tests/list-of-tests.mk index de022a2..fa57ce5 100644 --- a/tests/list-of-tests.mk +++ b/tests/list-of-tests.mk @@ -1181,6 +1181,7 @@ txinfo31.test \ txinfo32.test \ txinfo33.test \ txinfo-unrecognized-extension.test \ +txinfo-builddir.test \ transform.test \ transform2.test \ transform3.test \ diff --git a/tests/txinfo-builddir.test b/tests/txinfo-builddir.test new file mode 100755 index 0000000..64ca190 --- /dev/null +++ b/tests/txinfo-builddir.test @@ -0,0 +1,74 @@ +#! /bin/sh +# Copyright (C) 2012 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 . + +# Check that info files are built in builddir when needed. +# This test that this can be done through the "magic" undocumented +# option '!hack!info-in-builddir', as requested by at least GCC, GDB, +# GNU binutils and the GNU bfd library. See automake bug#11034. + +# See also txinfo23.test, txinfo24.test, txinfo25.test. + +required=makeinfo +. ./defs || Exit 1 + +echo AC_OUTPUT >> configure.ac + +cat > Makefile.am << 'END' +AUTOMAKE_OPTIONS = cygnus ##!hack!info-in-builddir +info_TEXINFOS = foo.texi subdir/bar.texi +subdir_bar_TEXINFOS = subdir/inc.texi +END + +mkdir subdir + +cat > foo.texi << 'END' +\input texinfo address@hidden foo.info address@hidden foo address@hidden Top +Hello walls. address@hidden version.texi address@hidden +END + +cat > subdir/bar.texi << 'END' +\input texinfo address@hidden bar.info address@hidden bar address@hidden Top +Hello walls. address@hidden inc.texi address@hidden +END + +cat > subdir/inc.texi << 'END' +I'm included. +END + +$ACLOCAL +$AUTOMAKE --add-missing +$AUTOCONF + +mkdir build +cd build +../configure +$MAKE info +test -f foo.info +test -f subdir/bar.info +test ! -f ../foo.info +test ! -f ../subdir/bar.info + +: -- 1.7.9