Exclude setting BAZEL_USE_CPP_ONLY_TOOLCHAIN=1 for ios build

PiperOrigin-RevId: 239826351
diff --git a/configure.py b/configure.py
index 5ca6df7..8141588 100644
--- a/configure.py
+++ b/configure.py
@@ -1507,7 +1507,7 @@
         (mpi_home, mpi_home, mpi_home))
 
 
-def system_specific_config(env):
+def system_specific_test_config(env):
   """Add default build and test flags required for TF tests to bazelrc."""
   write_to_bazelrc('test --flaky_test_attempts=3')
   write_to_bazelrc('test --test_size_filters=small,medium')
@@ -1526,10 +1526,6 @@
   elif is_macos():
     write_to_bazelrc('test --test_tag_filters=-gpu,-nomac,-no_mac')
     write_to_bazelrc('test --build_tag_filters=-gpu,-nomac,-no_mac')
-    # TODO(pcloudy): Remove BAZEL_USE_CPP_ONLY_TOOLCHAIN after Bazel is upgraded
-    # to 0.24.0.
-    # For working around https://github.com/bazelbuild/bazel/issues/7607
-    write_to_bazelrc('build --action_env=BAZEL_USE_CPP_ONLY_TOOLCHAIN=1')
   elif is_linux():
     if env.get('TF_NEED_CUDA', None) == '1':
       write_to_bazelrc('test --test_tag_filters=-no_gpu')
@@ -1757,13 +1753,19 @@
     create_android_ndk_rule(environ_cp)
     create_android_sdk_rule(environ_cp)
 
-  system_specific_config(os.environ)
+  system_specific_test_config(os.environ)
 
   if get_var(environ_cp, 'TF_CONFIGURE_IOS', 'Configure TensorFlow for iOS',
              False, ('Would you like to configure TensorFlow for iOS builds?'),
              'Configuring TensorFlow for iOS builds.',
              'Not configuring TensorFlow for iOS builds.'):
     configure_ios()
+  else:
+    # TODO(pcloudy): Remove BAZEL_USE_CPP_ONLY_TOOLCHAIN after Bazel is upgraded
+    # to 0.24.0.
+    # For working around https://github.com/bazelbuild/bazel/issues/7607
+    if is_macos():
+      write_to_bazelrc('build --action_env=BAZEL_USE_CPP_ONLY_TOOLCHAIN=1')
 
   print('Preconfigured Bazel build configs. You can use any of the below by '
         'adding "--config=<>" to your build command. See .bazelrc for more '