diff options
Diffstat (limited to 'src/configure.cc')
-rw-r--r-- | src/configure.cc | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/configure.cc b/src/configure.cc index 7a68f03..ff4f24d 100644 --- a/src/configure.cc +++ b/src/configure.cc @@ -99,6 +99,23 @@ std::string ctor::configuration::get(const std::string& key, const std::string& return default_value; } +std::string ctor::configuration::getenv(const std::string& key) const +{ + auto envit = env.find(key); + if(envit != env.end()) + { + return envit->second; + } + + auto sysenv = std::getenv(key.data()); + if(sysenv) + { + return sysenv; + } + + return {}; +} + class Args : public std::vector<char*> { @@ -838,12 +855,24 @@ int configure(const ctor::settings& global_settings, int argc, char* argv[]) env["CC"] = cc_env; } + auto cflags_env = getenv("CFLAGS"); + if(cflags_env) + { + env["CFLAGS"] = cflags_env; + } + auto cxx_env = getenv("CXX"); if(cxx_env) { env["CXX"] = cxx_env; } + auto cxxflags_env = getenv("CXXFLAGS"); + if(cxxflags_env) + { + env["CXXFLAGS"] = cxxflags_env; + } + auto ar_env = getenv("AR"); if(ar_env) { @@ -856,6 +885,12 @@ int configure(const ctor::settings& global_settings, int argc, char* argv[]) env["LD"] = ld_env; } + auto ldflags_env = getenv("LDFLAGS"); + if(ldflags_env) + { + env["LDFLAGS"] = ldflags_env; + } + auto path_env = getenv("PATH"); if(path_env) { |