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
diff --git a/tools/cpp/cc_configure.bzl b/tools/cpp/cc_configure.bzl
index cb5354e..9e19625 100644
--- a/tools/cpp/cc_configure.bzl
+++ b/tools/cpp/cc_configure.bzl
@@ -261,15 +261,15 @@
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={}):