diff --git a/libbuild2-autoconf/libbuild2/autoconf/init.cxx b/libbuild2-autoconf/libbuild2/autoconf/init.cxx index db41fd0..8c1017d 100644 --- a/libbuild2-autoconf/libbuild2/autoconf/init.cxx +++ b/libbuild2-autoconf/libbuild2/autoconf/init.cxx @@ -19,61 +19,64 @@ namespace build2 init (scope& rs, scope& bs, const location& l, - bool, + bool first, bool, module_init_extra&) { tracer trace ("autoconf::init"); l5 ([&]{trace << "for " << bs;}); - // Load in.base (in.* variables, in{} target type). - // - load_module (rs, rs, "in.base", l); - - // Enter variables. - // + if (first) { - // All the variables we enter are qualified so go straight for the - // public variable pool. + // Load in.base (in.* variables, in{} target type). // - auto& vp (rs.var_pool (true /* public */)); + load_module (rs, rs, "in.base", l); - // Configuration file flavor. Valid values are `autoconf` (default), - // `cmake`, and `meson`. + // Enter variables. // - vp.insert ("autoconf.flavor"); + { + // All the variables we enter are qualified so go straight for the + // public variable pool. + // + auto& vp (rs.var_pool (true /* public */)); - // Built-in checks prefix. - // - vp.insert ("autoconf.prefix"); + // Configuration file flavor. Valid values are `autoconf` (default), + // `cmake`, and `meson`. + // + vp.insert ("autoconf.flavor"); - // Substitution map (an alias for in.substitutions). - // - vp.insert_alias (*vp.find ("in.substitutions"), - "autoconf.substitutions"); + // Built-in checks prefix. + // + vp.insert ("autoconf.prefix"); - // Alias map. The key is the new name and the value is the aliased - // (old) name. + // Substitution map (an alias for in.substitutions). + // + vp.insert_alias (*vp.find ("in.substitutions"), + "autoconf.substitutions"); + + // Alias map. The key is the new name and the value is the aliased + // (old) name. + // + // Note that this map is only consulted when resolving build-in + // checks and the names should include the prefix, if any. + // + vp.insert> ("autoconf.aliases"); + } + + // Register the rule. // - // Note that this map is only consulted when resolving build-in checks - // and the names should include the prefix, if any. + // @@ TODO: this will be ambiguous, for example, version.in rule. Note + // also that if we register it for cc{}, then it will always take + // precedence over version.in, which is probably something we don't + // want. In fact, we would have liked it to be of lower precedence + // since version.in will only match if there is dependency on + // manifest. // - vp.insert> ("autoconf.aliases"); + rs.insert_rule (perform_update_id, "autoconf.in", rule_); + rs.insert_rule (perform_clean_id, "autoconf.in", rule_); + rs.insert_rule (configure_update_id, "autoconf.in", rule_); } - // Register the rule. - // - // @@ TODO: this will be ambiguous, for example, version.in rule. Note - // also that if we register it for cc{}, then it will always take - // precedence over version.in, which is probably something we don't - // want. In fact, we would have liked it to be of lower precedence - // since version.in will only match if there is dependency on - // manifest. - // - rs.insert_rule (perform_update_id, "autoconf.in", rule_); - rs.insert_rule (perform_clean_id, "autoconf.in", rule_); - rs.insert_rule (configure_update_id, "autoconf.in", rule_); - return true; }