Re: removing $seen_canonical

2001-02-19 Thread Akim Demaille

"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.




removing $seen_canonical

2001-02-09 Thread Derek R. Price

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.

Derek

--
Derek Price  CVS Solutions Architect ( http://CVSHome.org )
mailto:[EMAIL PROTECTED] OpenAvenue ( http://OpenAvenue.com )
Once Law was sitting on the bench
And Mercy knelt a-weeping.
"Clear out!" he cried, "disordered wench!
Nor come before me creeping.
Upon you knees if you appear,
'Tis plain you have no standing here."

Then Justice came.  His Honor cried:
"YOUR states? -- Devil seize you!"
"Amica curiae," she replied --
"Friend of the court, so please you."
"Begone!" he shouted -- "There's the door --
I never saw your face before!"
-- Ambrose Bierce, "The Devil's Dictionary"




Index: ChangeLog
===
RCS file: /cvs/automake/automake/ChangeLog,v
retrieving revision 1.1014
diff -u -r1.1014 ChangeLog
--- ChangeLog   2001/02/10 01:26:54 1.1014
+++ ChangeLog   2001/02/10 05:06:50
@@ -1,3 +1,7 @@
+2001-02-10  Derek Price  <[EMAIL PROTECTED]>
+
+   * automake.in: Replace $seen_canonical with %configure_vars.
+
 2001-02-09  Raja R Harinath  <[EMAIL PROTECTED]>
 
* depcomp (gcc3): Propagate exit code.
Index: automake.in
===
RCS file: /cvs/automake/automake/automake.in,v
retrieving revision 1.872
diff -u -r1.872 automake.in
--- automake.in 2001/02/09 07:06:53 1.872
+++ automake.in 2001/02/10 05:06:54
@@ -191,10 +191,6 @@
 # TRUE if AC_DECL_YYTEXT was seen.
 $seen_decl_yytext = 0;
 
-# TRUE if we've seen AC_CANONICAL_(HOST|SYSTEM).  The presence of
-# AC_CHECK_TOOL also sets this.
-$seen_canonical = 0;
-
 # TRUE if we've seen AC_ARG_PROGRAM.
 $seen_arg_prog = 0;
 
@@ -606,10 +602,14 @@
   @libtoolize_files)
if $seen_libtool;
 
-# AC_CANONICAL_HOST and AC_CANONICAL_SYSTEM need config.guess and
-# config.sub.
+   # AC_CANONICAL_BUILD, AC_CANONICAL_HOST, and
+   # AC_CANONICAL_(SYSTEM|TARGET) need config.guess and config.sub.
+   #
+   # FIXME - When traces is enabled, only 'build' need be checked here
+   # since AC_CANONICAL_BUILD is required by AC_CANONICAL_HOST, which is
+   # required by AC_CANONICAL_TARGET, as of AC 2.50..
 &require_config_file ($FOREIGN, 'config.guess', 'config.sub')
-   if $seen_canonical;
+   if $configure_vars{'build'} || $configure_vars{'host'};
 }
 
 # We still need Makefile.in here, because sometimes the `dist'
@@ -3932,29 +3932,18 @@
   . "\t\@echo 'set tool \$(DEJATOOL)' >> \$\@-t\n"
   . "\t\@echo 'set srcdir \$(srcdir)' >> \$\@-t\n"
   . "\t\@echo 'set objdir' \`pwd\` >> \$\@-t\n");
-
-# 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";
-}
-}
-
 $output_rules .= ("\t\@echo '## All variables above are generated by 
configure. Do Not Edit ##' >> \$\@-t\n"
   . "\t\@test ! -f site.exp || sed '1,/^## All variables 
above are.*##/ d' site.exp >> \$\@-t\n"
   . "\t\@test ! -f site.exp || mv site.exp site.bak\n"
@@ -4228,6 +4217,21 @@
 }
 
 
+
+# &found_ac_canonical_x ($x, $where)
+# --
+# Helper function which sets %configure_vars for an AC_CANONICAL_* invocation
+sub found_ac_canonical_x
+{
+my $c;
+foreach $c ('', '_alias', '_cpu', '_vendor', '_os')
+{
+   $configure_vars{$_[0] . $c} = $_[1];
+}
+}
+
+
+
 # &scan_one_autoconf_file ($FILENAME)
 # ---
 # Scan one file for interesting things.  Subroutine of
@@ -,12 +4448,25 @@
}
}
 
-# Handle AC_CANONICAL_*.  Always allow u