all.sh: only look for armcc if it is used

Only look for armcc if component_build_armcc or component_build_yotta
is to be executed, instead of requiring the option --no-armcc.

You can still pass --no-armcc, but it's no longer required when
listing components to run. With no list of components or an exclude
list on the command line, --no-armcc is equivalent to having
build_armcc in the exclude list.

Omit the yotta pre-checks if the build_yotta component is not going to
be executed. This makes --no-yotta equivalent to specifying a list of
components to run that doesn't include build_yotta.
diff --git a/tests/scripts/all.sh b/tests/scripts/all.sh
index 0386572..b723f02 100755
--- a/tests/scripts/all.sh
+++ b/tests/scripts/all.sh
@@ -94,7 +94,6 @@
     MEMORY=0
     FORCE=0
     KEEP_GOING=0
-    RUN_ARMCC=1
     YOTTA=1
 
     # Default commands, can be overriden by the environment
@@ -272,10 +271,11 @@
 pre_parse_command_line () {
     COMMAND_LINE_COMPONENTS=
     all_except=
+    no_armcc=
 
     while [ $# -gt 0 ]; do
         case "$1" in
-            --armcc) RUN_ARMCC=1;;
+            --armcc) no_armcc=;;
             --armc5-bin-dir) shift; ARMC5_BIN_DIR="$1";;
             --armc6-bin-dir) shift; ARMC6_BIN_DIR="$1";;
             --except) all_except=1;;
@@ -289,7 +289,7 @@
             --list-all-components) printf '%s\n' $ALL_COMPONENTS; exit;;
             --list-components) printf '%s\n' $SUPPORTED_COMPONENTS; exit;;
             --memory|-m) MEMORY=1;;
-            --no-armcc) RUN_ARMCC=0;;
+            --no-armcc) no_armcc=1;;
             --no-force) FORCE=0;;
             --no-keep-going) KEEP_GOING=0;;
             --no-memory) MEMORY=0;;
@@ -315,6 +315,14 @@
         all_except=1
     fi
 
+    # --no-armcc is a legacy option. The modern way is --except '*_armcc*'.
+    # Ignore it if components are listed explicitly on the command line.
+    if [ -n "$no_armcc" ] && [ -n "$all_except" ]; then
+        COMMAND_LINE_COMPONENTS="$COMMAND_LINE_COMPONENTS *_armcc*"
+        # --no-armcc also disables yotta.
+        COMMAND_LINE_COMPONENTS="$COMMAND_LINE_COMPONENTS *_yotta*"
+    fi
+
     # Build the list of components to run.
     if [ -n "$all_except" ]; then
         RUN_COMPONENTS=
@@ -328,6 +336,7 @@
     fi
 
     unset all_except
+    unset no_armcc
 }
 
 pre_check_git () {
@@ -460,15 +469,22 @@
     check_tools "$OPENSSL" "$OPENSSL_LEGACY" "$GNUTLS_CLI" "$GNUTLS_SERV" \
                 "$GNUTLS_LEGACY_CLI" "$GNUTLS_LEGACY_SERV" "doxygen" "dot" \
                 "arm-none-eabi-gcc" "i686-w64-mingw32-gcc"
-    if [ $RUN_ARMCC -ne 0 ]; then
-        check_tools "$ARMC5_CC" "$ARMC5_AR" "$ARMC6_CC" "$ARMC6_AR"
-    fi
+    case $RUN_COMPONENTS in
+        *_armcc*|*_yotta*)
+            check_tools "$ARMC5_CC" "$ARMC5_AR" "$ARMC6_CC" "$ARMC6_AR";;
+    esac
 
     msg "info: output_env.sh"
-    OPENSSL="$OPENSSL" OPENSSL_LEGACY="$OPENSSL_LEGACY" GNUTLS_CLI="$GNUTLS_CLI" \
-           GNUTLS_SERV="$GNUTLS_SERV" GNUTLS_LEGACY_CLI="$GNUTLS_LEGACY_CLI" \
-           GNUTLS_LEGACY_SERV="$GNUTLS_LEGACY_SERV" ARMC5_CC="$ARMC5_CC" \
-           ARMC6_CC="$ARMC6_CC" RUN_ARMCC="$RUN_ARMCC" scripts/output_env.sh
+    set env
+    set "$@" OPENSSL="$OPENSSL" OPENSSL_LEGACY="$OPENSSL_LEGACY"
+    set "$@" GNUTLS_CLI="$GNUTLS_CLI" GNUTLS_SERV="$GNUTLS_SERV"
+    set "$@" GNUTLS_LEGACY_CLI="$GNUTLS_LEGACY_CLI" GNUTLS_LEGACY_SERV="$GNUTLS_LEGACY_SERV"
+    case $RUN_COMPONENTS in
+        *_armcc*|*_yotta*)
+            set "$@" ARMC5_CC="$ARMC5_CC" ARMC6_CC="$ARMC6_CC" RUN_ARMCC=1;;
+        *) set "$@" RUN_ARMCC=0;;
+    esac
+    "$@" scripts/output_env.sh
 }
 
 
@@ -524,12 +540,13 @@
 ################################################################
 
 component_build_yotta () {
-    if [ $RUN_ARMCC -ne 0 ] && [ $YOTTA -ne 0 ]; then
-        # Note - use of yotta is deprecated, and yotta also requires armcc to be on the
-        # path, and uses whatever version of armcc it finds there.
-        msg "build: create and build yotta module" # ~ 30s
-        record_status tests/scripts/yotta-build.sh
-    fi
+    # Note - use of yotta is deprecated, and yotta also requires armcc to be on the
+    # path, and uses whatever version of armcc it finds there.
+    msg "build: create and build yotta module" # ~ 30s
+    record_status tests/scripts/yotta-build.sh
+}
+support_build_yotta () {
+    [ $YOTTA -ne 0 ]
 }
 
 component_test_default_cmake_gcc_asan () {
@@ -879,25 +896,23 @@
     scripts/config.pl unset MBEDTLS_MEMORY_BUFFER_ALLOC_C # calls exit
     scripts/config.pl unset MBEDTLS_PLATFORM_TIME_ALT # depends on MBEDTLS_HAVE_TIME
 
-    if [ $RUN_ARMCC -ne 0 ]; then
-        make CC="$ARMC5_CC" AR="$ARMC5_AR" WARNING_CFLAGS='--strict --c99' lib
-        make clean
+    make CC="$ARMC5_CC" AR="$ARMC5_AR" WARNING_CFLAGS='--strict --c99' lib
+    make clean
 
-        # ARM Compiler 6 - Target ARMv7-A
-        armc6_build_test "--target=arm-arm-none-eabi -march=armv7-a"
+    # ARM Compiler 6 - Target ARMv7-A
+    armc6_build_test "--target=arm-arm-none-eabi -march=armv7-a"
 
-        # ARM Compiler 6 - Target ARMv7-M
-        armc6_build_test "--target=arm-arm-none-eabi -march=armv7-m"
+    # ARM Compiler 6 - Target ARMv7-M
+    armc6_build_test "--target=arm-arm-none-eabi -march=armv7-m"
 
-        # ARM Compiler 6 - Target ARMv8-A - AArch32
-        armc6_build_test "--target=arm-arm-none-eabi -march=armv8.2-a"
+    # ARM Compiler 6 - Target ARMv8-A - AArch32
+    armc6_build_test "--target=arm-arm-none-eabi -march=armv8.2-a"
 
-        # ARM Compiler 6 - Target ARMv8-M
-        armc6_build_test "--target=arm-arm-none-eabi -march=armv8-m.main"
+    # ARM Compiler 6 - Target ARMv8-M
+    armc6_build_test "--target=arm-arm-none-eabi -march=armv8-m.main"
 
-        # ARM Compiler 6 - Target ARMv8-A - AArch64
-        armc6_build_test "--target=aarch64-arm-none-eabi -march=armv8.2-a"
-    fi
+    # ARM Compiler 6 - Target ARMv8-A - AArch64
+    armc6_build_test "--target=aarch64-arm-none-eabi -march=armv8.2-a"
 }
 
 component_test_allow_sha1 () {