test/make/toolchain.sh

changeset 105
4b3e655339cb
parent 101
7f40964bf1e9
--- a/test/make/toolchain.sh	Sat Jan 20 15:37:16 2024 +0100
+++ b/test/make/toolchain.sh	Sat Jan 20 15:47:39 2024 +0100
@@ -10,6 +10,7 @@
   C_COMPILERS="gcc clang suncc cc"
   CPP_COMPILERS="g++ clang++ sunCC CC"
 fi
+unset TOOLCHAIN
 unset TOOLCHAIN_NAME
 unset TOOLCHAIN_CC
 unset TOOLCHAIN_CXX
@@ -20,10 +21,12 @@
 /* test file */
 #include <stdio.h>
 int main(int argc, char **argv) {
-#if defined(__clang__)
-  printf("clang\n");
+#if defined(_MSC_VER)
+  printf("msc\n");
+#elif defined(__clang__)
+  printf("clang gnuc\n");
 #elif defined(__GNUC__)
-  printf("gcc\n");
+  printf("gcc gnuc\n");
 #elif defined(__sun)
   printf("suncc\n");
 #else
@@ -42,10 +45,12 @@
 /* test file */
 #include <iostream>
 int main(int argc, char **argv) {
-#if defined(__clang__)
-  std::cout << "clang" << std::endl;
+#if defined(_MSC_VER)
+  std::cout << "msc" << std::endl;
+#elif defined(__clang__)
+  std::cout << "clang gnuc" << std::endl;
 #elif defined(__GNUC__)
-  std::cout << "gcc" << std::endl;
+  std::cout << "gcc gnuc" << std::endl;
 #elif defined(__sun)
   std::cout << "suncc" << std::endl;
 #else
@@ -117,7 +122,8 @@
   if [ -n "$CC" ]; then
     if check_c_compiler "$CC"; then
       TOOLCHAIN_CC=$CC
-      TOOLCHAIN_NAME=`"$TEMP_DIR/checkcc"`
+      TOOLCHAIN=`"$TEMP_DIR/checkcc"`
+      TOOLCHAIN_NAME=`echo "$TOOLCHAIN" | cut -f1 -d' ' -`
       echo "$CC"
       return 0
     else
@@ -129,7 +135,8 @@
     do
       if check_c_compiler "$COMP"; then
         TOOLCHAIN_CC=$COMP
-        TOOLCHAIN_NAME=`"$TEMP_DIR/checkcc"`
+        TOOLCHAIN=`"$TEMP_DIR/checkcc"`
+        TOOLCHAIN_NAME=`echo "$TOOLCHAIN" | cut -f1 -d' ' -`
         echo "$COMP"
         return 0
       fi
@@ -149,7 +156,8 @@
   if [ -n "$CXX" ]; then
     if check_cpp_compiler "$CXX"; then
       TOOLCHAIN_CXX=$CXX
-      TOOLCHAIN_NAME=`"$TEMP_DIR/checkcc"`
+      TOOLCHAIN=`"$TEMP_DIR/checkcc"`
+      TOOLCHAIN_NAME=`echo "$TOOLCHAIN" | cut -f1 -d' ' -`
       echo "$CXX"
       return 0
     else
@@ -161,7 +169,8 @@
     do
       if check_cpp_compiler "$COMP"; then
         TOOLCHAIN_CXX=$COMP
-        TOOLCHAIN_NAME=`"$TEMP_DIR/checkcc"`
+        TOOLCHAIN=`"$TEMP_DIR/checkcc"`
+        TOOLCHAIN_NAME=`echo "$TOOLCHAIN" | cut -f1 -d' ' -`
         echo "$COMP"
         return 0
       fi

mercurial