diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2025-02-06 17:41:36 +0100 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2025-02-06 17:42:02 +0100 |
commit | 5b65a0df0a45fa4fa5a38e6927acabe0e6855fa1 (patch) | |
tree | ad162468333eb6f29584a99756f4b5b37d9e0924 /src/configure.cc | |
parent | c2234f3421b3caec39bed6a0b65dcdbc5c336a6b (diff) |
Add support for bootstrapping with custom compiler (toolchain) and flags.
Diffstat (limited to 'src/configure.cc')
-rw-r--r-- | src/configure.cc | 13 |
1 files changed, 11 insertions, 2 deletions
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) { |