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 @@ -4444,12 +4448,25 @@ } } - # Handle AC_CANONICAL_*. Always allow upgrading to - # AC_CANONICAL_SYSTEM, but never downgrading. - $seen_canonical = $AC_CANONICAL_HOST - if ! $seen_canonical - && (/AC_CANONICAL_HOST/ || /AC_CHECK_TOOL/); - $seen_canonical = $AC_CANONICAL_SYSTEM if /AC_CANONICAL_SYSTEM/; + # Handle AC_CANONICAL_*. + # + # This is kinda broken, or maybe just not optimized, under Autoconf + # 2.50 since then AC_CANONICAL_HOST requires AC_CANONICAL_BUILD. The + # reason I say maybe just not optimized is that if we really only care + # about HOST or SYSTEM, like the old code did and like I assume works + # with 2.13, then the following code should still work. + # + # The "fix" under 2.50 is to enable amtraces. + &found_ac_canonical_x ('build', $filename . ':' . $.) + if /AC_CANONICAL_BUILD/; + &found_ac_canonical_x ('host', $filename . ':' . $.) + if /AC_CANONICAL_HOST/ || /AC_CHECK_TOOL/; + if (/AC_CANONICAL_SYSTEM/ || /AC_CANONICAL_TARGET/) + { + &found_ac_canonical_x ('build', $filename . ':' . $.); + &found_ac_canonical_x ('host', $filename . ':' . $.); + &found_ac_canonical_x ('target', $filename . ':' . $.); + } $seen_path_xtra = 1 if /AC_PATH_XTRA/; @@ -4540,9 +4557,8 @@ $configure_vars{'LIBTOOL'} = $filename . ':' . $.; $configure_vars{'RANLIB'} = $filename . ':' . $.; $configure_vars{'CC'} = $filename . ':' . $.; - # AC_PROG_LIBTOOL runs AC_CANONICAL_HOST. Make sure we - # never downgrade (if we've seen AC_CANONICAL_SYSTEM). - $seen_canonical = $AC_CANONICAL_HOST if ! $seen_canonical; + # AC_PROG_LIBTOOL runs AC_CANONICAL_HOST. + &found_ac_canonical_x('host', $filename . ':' . $.); } $seen_multilib = 1 if (/AM_ENABLE_MULTILIB/); @@ -6400,27 +6416,6 @@ &file_contents ('header-vars', &transform ('top_builddir' => $top_builddir)); - # Generate some useful variables when AC_CANONICAL_* used. FIXME: - # this should use generic %configure_vars method. - if ($seen_canonical) - { - local ($curs, %vars); - $vars{'host_alias'} = 'host_alias'; - $vars{'host_triplet'} = 'host'; - if ($seen_canonical == $AC_CANONICAL_SYSTEM) - { - $vars{'build_alias'} = 'build_alias'; - $vars{'build_triplet'} = 'build'; - $vars{'target_alias'} = 'target_alias'; - $vars{'target_triplet'} = 'target'; - } - foreach $curs (sort keys %vars) - { - $output_vars .= "$curs = \@$vars{$curs}\@\n"; - $contents{$curs} = "\@$vars{$curs}\@"; - } - } - local ($curs); foreach $curs (sort keys %configure_vars) { @@ -6523,10 +6518,6 @@ sub initialize_global_constants { - # Values for AC_CANONICAL_* - $AC_CANONICAL_HOST = 1; - $AC_CANONICAL_SYSTEM = 2; - # Associative array of standard directory names. Entry is TRUE if # corresponding directory should be installed during # 'install-exec' phase.