"Derek R. Price" <[EMAIL PROTECTED]> writes:
> I've removed the references to $seen_canonical, re one of the FIXME
> comments on the way to enabling traces. I know this patch is kinda
> largish, but even if it doesn't get checked in yet, I'd like some
> feedback. This is somewhat integral to my work on traces.
I like your intentions, and as a matter of fact, I think we share the
same approach to hacking Automake.
> -
> - # Extra stuff for AC_CANONICAL_*
> - local (@whatlist) = ();
> - if ($seen_canonical)
> - {
> - push (@whatlist, 'host');
> - }
>
> - # Extra stuff only for AC_CANONICAL_SYSTEM.
> - if ($seen_canonical == $AC_CANONICAL_SYSTEM)
> + my $c;
> + foreach $c ('build', 'host', 'target')
> {
> - push (@whatlist, 'target', 'build');
> + # Maybe an error message if both of these are not set is a good
> + # idea? It might be overkill.
> + $output_rules .= "\t\@echo 'set ${c}_triplet \$(${c})' >> \$\@-t\n"
> + if defined $configure_vars{$c};
> + $output_rules .= "\t\@echo 'set ${c}_alias \$(${c}_alias})' >> \$\@-t\n"
> + if defined $configure_vars{"${c}_alias"};
> }
>
> - local ($c1, $c2);
> - foreach $c1 (@whatlist)
> - {
> - foreach $c2 ('alias', 'triplet')
> - {
> - $output_rules .= "\t\@echo 'set ${c1}_${c2} \$(${c1}_${c2})' >>
>\$\@-t\n";
> - }
> - }
> -
I like the intention, but I personally don't like the implementation:
it is leaving ad-hoc code in automake.in, and there should be as
little as possible.
I have sent a patch which precisely addresses this issue by moving
most of this code into *.am files. I think your patch would be an
excellent complement to it.
Maybe my patch will just make it more difficult for traces, no idea,
but in which case I would much prefer seeing a list of default
variables to AC_SUBST somewhere, and have the full list of build_alias
etc. defined there. But in no way ad-hoc code to make that Cartesian
product in the output routines.
Ad-hoc should be limited to predefined lists and *.am files. automake
should remain generic, and when it's not possible, it's usually
possible to make it more generic.