bazelrc: support --enable_platform_specific_config

When the value of this flag is true, a host platform specific config
section will be enabled if it exists. Bazel recognizes your host
platform as linux, macos, windows or freebsd. It's equivalent to add
--config=linux on Linux platforms and --config=windows on Windows, etc.

Fixes https://github.com/bazelbuild/bazel/issues/5055

RELNOTES[NEW]: Platform-specific bazelrc: with --enable_platform_specific_config you can
enable flags in bazelrc according to your host platform.

PiperOrigin-RevId: 265641013
diff --git a/src/main/java/com/google/devtools/build/lib/runtime/CommonCommandOptions.java b/src/main/java/com/google/devtools/build/lib/runtime/CommonCommandOptions.java
index 1ce5163..706be93 100644
--- a/src/main/java/com/google/devtools/build/lib/runtime/CommonCommandOptions.java
+++ b/src/main/java/com/google/devtools/build/lib/runtime/CommonCommandOptions.java
@@ -57,6 +57,19 @@
   public Void allIncompatibleChanges;
 
   @Option(
+      name = "enable_platform_specific_config",
+      defaultValue = "false",
+      documentationCategory = OptionDocumentationCategory.UNCATEGORIZED,
+      effectTags = {OptionEffectTag.UNKNOWN},
+      help =
+          "If true, Bazel picks up host-OS-specific config lines from bazelrc files. For example, "
+              + "if the host OS is Linux and you run bazel build, Bazel picks up lines starting "
+              + "with build:linux. Supported OS identifiers are linux, macos, windows, and "
+              + "freebsd. Enabling this flag is equivalent to using --config=linux on Linux, "
+              + "--config=windows on Windows, etc.")
+  public boolean enablePlatformSpecificConfig;
+
+  @Option(
     name = "config",
     defaultValue = "",
     documentationCategory = OptionDocumentationCategory.UNCATEGORIZED,