From cafa730ce5e1b13135ccbdc0befa58d693302999 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 3 Sep 2018 10:18:23 +0200 Subject: Use (native) C and C++ compilers we were built with as defaults --- build2/cc/module.cxx | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'build2/cc') diff --git a/build2/cc/module.cxx b/build2/cc/module.cxx index 858a2fd..e9d5c09 100644 --- a/build2/cc/module.cxx +++ b/build2/cc/module.cxx @@ -87,11 +87,20 @@ namespace build2 // (optional) pattern to guess an appropriate default (e.g., for {gcc, // *-4.9} we will get g++-4.9). // - path d (cc_loaded - ? guess_default (x_lang, - cast (rs["cc.id"]), - cast (rs["cc.pattern"])) - : path (x_default)); + path d; + + if (cc_loaded) + d = guess_default (x_lang, + cast (rs["cc.id"]), + cast (rs["cc.pattern"])); + else + { + d = path (x_default); + + if (d.empty ()) + fail << "not built with default " << x_lang << " compiler" << + info << "use config." << x << " to specify"; + } // If this value was hinted, save it as commented out so that if the // user changes the source of the pattern, this one will get updated -- cgit v1.1