diff options
author | Damien Martin-Guillerez <dmarting@google.com> | 2016-04-19 17:22:19 +0000 |
---|---|---|
committer | Damien Martin-Guillerez <dmarting@google.com> | 2016-04-20 11:16:46 +0000 |
commit | 3e4e416c9fafaa7a2c258d2ecf5a75b0369de1d2 (patch) | |
tree | 8e2e1aed6c3ffe9b513778086bb47f44c23b7bf2 /tools/cpp/cc_configure.bzl | |
parent | 4bb63d9e5bd970a62ab1dd3ed45bc3699e63256d (diff) |
cc_configure: uses which on the CC environment variable
It's wrong to assume it points to an absolute path.
Discovered in issue #1152.
--
MOS_MIGRATED_REVID=120242469
Diffstat (limited to 'tools/cpp/cc_configure.bzl')
-rw-r--r-- | tools/cpp/cc_configure.bzl | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/tools/cpp/cc_configure.bzl b/tools/cpp/cc_configure.bzl index cb5354ef5d..9e196253ba 100644 --- a/tools/cpp/cc_configure.bzl +++ b/tools/cpp/cc_configure.bzl @@ -261,15 +261,15 @@ def _dbg_content(): def _find_cc(repository_ctx): """Find the C++ compiler.""" + cc_name = "gcc" if "CC" in repository_ctx.os.environ: - return repository_ctx.path(repository_ctx.os.environ["CC"]) - else: - cc = repository_ctx.which("gcc") - if cc == None: - fail( - "Cannot find gcc, either correct your path or set the CC" + - " ennvironment variable") - return cc + cc_name = repository_ctx.os.environ["CC"] + cc = repository_ctx.which(cc_name) + if cc == None: + fail( + "Cannot find gcc, either correct your path or set the CC" + + " environment variable") + return cc def _tpl(repository_ctx, tpl, substitutions={}): |