Consult BAZEL_LINKOPTS env variable when detecting linker flags in autogenerated cc toolchain
Relevant to #4031, fixes #4524.
Does not affect the osx + xcode toolchain that supports both C++ and ObjC!
RELNOTES: BAZEL_LINKOPTS is now consulted when autoconfiguring c++ toolchain
Now linker flags for the autogenerated C++ toolchain can be controlled by
BAZEL_LINKOPTS environment variable (using colon as a flag separator):
BAZEL_LINKOPTS=-lc++ bazel build //...
The default value is "-lstdc++:-lm".
PiperOrigin-RevId: 187173297
diff --git a/tools/cpp/cc_configure.bzl b/tools/cpp/cc_configure.bzl
index 610f5a7..858c5bc 100644
--- a/tools/cpp/cc_configure.bzl
+++ b/tools/cpp/cc_configure.bzl
@@ -48,6 +48,7 @@
"ABI_VERSION",
"BAZEL_COMPILER",
"BAZEL_HOST_SYSTEM",
+ "BAZEL_LINKOPTS",
"BAZEL_PYTHON",
"BAZEL_SH",
"BAZEL_TARGET_CPU",