From 5b65a0df0a45fa4fa5a38e6927acabe0e6855fa1 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Thu, 6 Feb 2025 17:41:36 +0100 Subject: Add support for bootstrapping with custom compiler (toolchain) and flags. --- src/configure.cc | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/configure.cc b/src/configure.cc index ff4f24d..a43152f 100644 --- a/src/configure.cc +++ b/src/configure.cc @@ -31,7 +31,15 @@ const ctor::configuration& __attribute__((weak)) ctor::get_configuration() static bool initialised{false}; if(!initialised) { - cfg.build_toolchain = getToolChain(cfg.get(ctor::cfg::build_cxx, "/usr/bin/g++")); + std::string cxx_prog{"c++"}; + auto cxx_env = std::getenv("CXX"); + if(cxx_env) + { + cxx_prog = cxx_env; + } + + cfg.build_toolchain = getToolChain(cfg.get(ctor::cfg::build_cxx, cxx_prog)); + initialised = true; } return cfg; @@ -69,7 +77,8 @@ bool ctor::configuration::has(const std::string& key) const return tools.find(key) != tools.end(); } -std::string ctor::configuration::get(const std::string& key, const std::string& default_value) const +std::string ctor::configuration::get(const std::string& key, + const std::string& default_value) const { if(key == ctor::cfg::ctor_includedir && ctor::includedir) { -- cgit v1.2.3