summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2025-01-23 22:13:22 +0100
committerBent Bisballe Nyeng <deva@aasimon.org>2025-01-23 22:13:22 +0100
commit107924873bd31014bbe67899961e2970ac2334f3 (patch)
tree00c4ce08ff091bd15d61c04156e5ae782514ec1e
parentacb70c50c81d9f8898d6cfedbaee58139392fab5 (diff)
Use locate on env supplied tools.
-rwxr-xr-xbootstrap.sh1
-rw-r--r--src/bootstrap.cc13
2 files changed, 9 insertions, 5 deletions
diff --git a/bootstrap.sh b/bootstrap.sh
index 052d8b7..d10f54b 100755
--- a/bootstrap.sh
+++ b/bootstrap.sh
@@ -3,7 +3,6 @@ set -e
: ${CXX:=g++}
: ${BUILDDIR:=build}
-CXX=$(which $CXX)
echo "Bootstrapping..."
$CXX -std=c++20 -Wall -O3 -Isrc -pthread src/bootstrap.cc ctor.cc -o ctor
diff --git a/src/bootstrap.cc b/src/bootstrap.cc
index 0179f7b..42706c1 100644
--- a/src/bootstrap.cc
+++ b/src/bootstrap.cc
@@ -43,28 +43,33 @@ bool ctor::configuration::has(const std::string& key) const
std::string ctor::configuration::get(const std::string& key, const std::string& default_value) const
{
+ static auto paths = get_paths();
auto cxx_env = std::getenv("CXX");
if(key == ctor::cfg::build_cxx && cxx_env)
{
- return cxx_env;
+ static auto cxx_prog = locate(cxx_env, paths);
+ return cxx_prog;
}
auto cc_env = std::getenv("CC");
if(key == ctor::cfg::build_cc && cc_env)
{
- return cc_env;
+ static auto cc_prog = locate(cc_env, paths);
+ return cc_prog;
}
auto ld_env = std::getenv("LD");
if(key == ctor::cfg::build_ld && ld_env)
{
- return ld_env;
+ static auto ld_prog = locate(ld_env, paths);
+ return ld_prog;
}
auto ar_env = std::getenv("AR");
if(key == ctor::cfg::build_ar && ar_env)
{
- return ar_env;
+ static auto ar_prog = locate(ar_env, paths);
+ return ar_prog;
}
auto builddir_env = std::getenv("BUILDDIR");