automake-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] conditional info_TEXINFOS


From: Paolo Bonzini
Subject: [PATCH] conditional info_TEXINFOS
Date: Tue, 30 Jan 2007 12:41:57 +0100
User-agent: Thunderbird 1.5.0.9 (Macintosh/20061207)

The attached patch allows one to have conditional info_TEXINFOS values. This is required by GCC (see http://gcc.gnu.org/PR30546 for info).

I checked that the patch does not have any change on the automake makefiles themselves, besides passing the testsuite with a new test.

Ok for mainline *and* branch 1.9 since GCC is not quite ready to jump to autoconf 2.60?

Thanks,

Paolo
2007-01-30  Paolo Bonzini  <address@hidden>

        * automake.in (output_texinfo_build_rules): Add COND parameter.
        Emit INFO_DEPS and TEXINFOS.
        (handle_texinfo_helper): Remove references to dead variable
        info_deps_list.  Collect conditions for info_texinfos files and
        pass it to output_texinfo_build_rules.  Don't use TRUE as the location
        where mdate-sh or texinfo.tex are required.  Don't emit TEXINFOS.
        * automake.in (output_texinfo_build_rules): Add COND parameter.
        * lib/am/texibuild.am (INFODEPS): Don't emit it.
        * tests/Makefile.am (TESTS): Add condinfo.test.
        * tests/condinfo.test: New test.

Index: automake.in
===================================================================
RCS file: /sources/automake/automake/automake.in,v
retrieving revision 1.1641
diff -u -p -r1.1641 automake.in
--- automake.in 16 Oct 2006 05:24:17 -0000      1.1641
+++ automake.in 30 Jan 2007 11:24:36 -0000
@@ -2960,15 +2960,16 @@ sub scan_texinfo_file ($)
 
 
 # ($DIRSTAMP, @CLEAN_FILES)
-# output_texinfo_build_rules ($SOURCE, $DEST, $INSRC, @DEPENDENCIES)
-# ------------------------------------------------------------------
+# output_texinfo_build_rules ($SOURCE, $DEST, $INSRC, $COND, @DEPENDENCIES)
+# -------------------------------------------------------------------------
 # SOURCE - the source Texinfo file
 # DEST - the destination Info file
-# INSRC - wether DEST should be built in the source tree
+# INSRC - whether DEST should be built in the source tree
+# COND - the conditionn under which DEST should be built
 # DEPENDENCIES - known dependencies
-sub output_texinfo_build_rules ($$$@)
+sub output_texinfo_build_rules ($$$$@)
 {
-  my ($source, $dest, $insrc, @deps) = @_;
+  my ($source, $dest, $insrc, $cond, @deps) = @_;
 
   # Split `a.texi' into `a' and `.texi'.
   my ($spfx, $ssfx) = ($source =~ /^(.*?)(\.[^.]*)?$/);
@@ -3029,6 +3029,13 @@ sub output_texinfo_build_rules ($$$@)
 
   my $dipfx = ($insrc ? '$(srcdir)/' : '') . $dpfx;
 
+  define_pretty_variable ('INFO_DEPS', $cond, INTERNAL, "$dipfx$dsfx");
+
+  # This next isn't strictly needed now -- the places that look here
+  # could easily be changed to look in info_TEXINFOS.  But this is
+  # probably better, in case html_TEXINFOS is ever supported.
+  define_pretty_variable ('TEXINFOS', $cond, INTERNAL, $source);
+
   $output_rules .= file_contents ('texibuild',
                                  new Automake::Location,
                                  DEPS             => "@deps",
@@ -3058,7 +3065,7 @@ sub output_texinfo_build_rules ($$$@)
 sub handle_texinfo_helper ($)
 {
   my ($info_texinfos) = @_;
-  my (@infobase, @info_deps_list, @texi_deps);
+  my (@infobase, @texi_deps);
   my %versions;
   my $done = 0;
   my @texi_cleans;
@@ -3072,6 +3079,16 @@ sub handle_texinfo_helper ($)
   @f = map { s|[^A-Za-z_0-9*\[\]\-]|\\$&|g; s|\*|[^/]*|g; $_; } @f;
   my $user_cleaned_files = '^(?:' . join ('|', @f) . ')$';
 
+  my %info_texinfos_conds;
+
+  $info_texinfos->traverse_recursively
+    (sub {
+      my ($var, $val, $cond, $full_cond) = @_;
+      $info_texinfos_conds{$val} = $full_cond;
+    },
+    undef,
+    inner_expand => 1);
+
   foreach my $texi
       ($info_texinfos->value_as_list_recursive (inner_expand => 1))
     {
@@ -3219,11 +3236,10 @@ sub handle_texinfo_helper ($)
        }
 
       my ($dirstamp, @cfiles) =
-       output_texinfo_build_rules ($texi, $out_file, $insrc, @texi_deps);
+       output_texinfo_build_rules ($texi, $out_file, $insrc,
+                                   $info_texinfos_conds{$texi}, @texi_deps);
       push (@texi_cleans, @cfiles);
 
-      push (@info_deps_list, $out_file);
-
       # If a vers*.texi file is needed, emit the rule.
       if ($vtexi)
        {
@@ -3241,13 +3257,13 @@ sub handle_texinfo_helper ($)
          # This is ugly, but it is our historical practice.
          if ($config_aux_dir_set_in_configure_ac)
            {
-             require_conf_file_with_macro (TRUE, 'info_TEXINFOS', FOREIGN,
-                                           'mdate-sh');
+             require_conf_file_with_macro 
($info_texinfos->conditions->one_cond,
+                                           'info_TEXINFOS', FOREIGN, 
'mdate-sh');
            }
          else
            {
-             require_file_with_macro (TRUE, 'info_TEXINFOS',
-                                      FOREIGN, 'mdate-sh');
+             require_file_with_macro ($info_texinfos->conditions->one_cond,
+                                      'info_TEXINFOS', FOREIGN, 'mdate-sh');
            }
 
          my $conf_dir;
@@ -3313,11 +3329,6 @@ sub handle_texinfo_helper ($)
   define_files_variable ("PSS", @infobase, 'ps', INTERNAL);
   define_files_variable ("HTMLS", @infobase, 'html', INTERNAL);
 
-  # This next isn't strictly needed now -- the places that look here
-  # could easily be changed to look in info_TEXINFOS.  But this is
-  # probably better, in case noinst_TEXINFOS is ever supported.
-  define_variable ("TEXINFOS", variable_value ('info_TEXINFOS'), INTERNAL);
-
   # Do some error checking.  Note that this file is not required
   # when in Cygnus mode; instead we defined TEXINFO_TEX explicitly
   # up above.
@@ -3325,13 +3336,13 @@ sub handle_texinfo_helper ($)
     {
       if ($need_texi_file > 1)
        {
-         require_conf_file_with_macro (TRUE, 'info_TEXINFOS', FOREIGN,
-                                       'texinfo.tex');
+         require_conf_file_with_macro ($info_texinfos->conditions->one_cond,
+                                       'info_TEXINFOS', FOREIGN, 
'texinfo.tex');
        }
       else
        {
-         require_file_with_macro (TRUE, 'info_TEXINFOS', FOREIGN,
-                                  'texinfo.tex');
+         require_file_with_macro ($info_texinfos->conditions->one_cond,
+                                  'info_TEXINFOS', FOREIGN, 'texinfo.tex');
        }
     }
 
Index: lib/am/texibuild.am
===================================================================
RCS file: /sources/automake/automake/lib/am/texibuild.am,v
retrieving revision 1.27
diff -u -p -r1.27 texibuild.am
--- lib/am/texibuild.am 7 Aug 2005 08:30:30 -0000       1.27
+++ lib/am/texibuild.am 30 Jan 2007 11:24:39 -0000
@@ -60,8 +60,6 @@
        fi; \
        rm -rf $$backupdir; exit $$rc
 
-INFO_DEPS += %DEST_INFO_PREFIX%%DEST_SUFFIX%
-
 ?GENERIC?%SOURCE_SUFFIX%.dvi:
 ?!GENERIC?%DEST_PREFIX%.dvi: %SOURCE% %DEPS% %DIRSTAMP%
        TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \
Index: tests/Makefile.am
===================================================================
RCS file: /sources/automake/automake/tests/Makefile.am,v
retrieving revision 1.617
diff -u -p -r1.617 Makefile.am
--- tests/Makefile.am   16 Oct 2006 05:24:17 -0000      1.617
+++ tests/Makefile.am   30 Jan 2007 11:24:39 -0000
@@ -152,6 +152,7 @@ condd.test \
 condhook.test \
 condinc.test \
 condinc2.test \
+condinfo.test \
 condlib.test \
 condman.test \
 condman2.test \
Index: tests/condinfo.test
===================================================================
RCS file: tests/condinfo.test
diff -N tests/condinfo.test
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ tests/condinfo.test 30 Jan 2007 11:24:39 -0000
@@ -0,0 +1,48 @@
+#! /bin/sh
+# Copyright (C) 1998, 2001, 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 Automake; see the file COPYING.  If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+# Boston, MA 02110-1301, USA.
+
+# Test to make sure `.txi' extension works.
+. ./defs || exit 1
+
+cat > configure.in << 'END'
+AC_INIT(Makefile.am)
+AM_INIT_AUTOMAKE(foo,0.0)
+AC_PROG_CC
+AM_CONDITIONAL(USE_A,[test x = y])
+MAKEINFO=/bin/false
+AC_SUBST(MAKEINFO)
+AC_OUTPUT(Makefile)
+END
+
+cat > Makefile.am << 'END'
+if USE_A
+info_TEXINFOS = foo.texi
+endif
+END
+
+echo @setfilename foo.info > foo.texi
+: > texinfo.tex
+
+$ACLOCAL || exit 1
+$AUTOCONF || exit 1
+$AUTOMAKE || exit 1
+./configure || exit 1
+$MAKE || exit 1
+if $MAKE foo.info; then exit 1; else :; fi

reply via email to

[Prev in Thread] Current Thread [Next in Thread]