add command check to check_c_compiler/check_cpp_compiler, because some shells print an error if it doesn't exist

Sun, 12 Jan 2025 12:40:20 +0100

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Sun, 12 Jan 2025 12:40:20 +0100
changeset 132
e0478362c2cf
parent 131
7241d072ace4
child 133
59b14b75f12b

add command check to check_c_compiler/check_cpp_compiler, because some shells print an error if it doesn't exist

src/main/resources/make/toolchain.sh file | annotate | diff | comparison | revisions
test/make/toolchain.sh file | annotate | diff | comparison | revisions
--- a/src/main/resources/make/toolchain.sh	Sun Jan 12 11:26:16 2025 +0100
+++ b/src/main/resources/make/toolchain.sh	Sun Jan 12 12:40:20 2025 +0100
@@ -17,6 +17,10 @@
 
 check_c_compiler()
 {
+  command -v $1 2>&1 >/dev/null
+  if [ $? -ne 0 ]; then
+    return 1
+  fi
   cat > "$TEMP_DIR/test.c" << __EOF__
 /* test file */
 #include <stdio.h>
@@ -41,6 +45,10 @@
 
 check_cpp_compiler()
 {
+  command -v $1 2>&1 >/dev/null
+  if [ $? -ne 0 ]; then
+    return 1
+  fi
   cat > "$TEMP_DIR/test.cpp" << __EOF__
 /* test file */
 #include <iostream>
--- a/test/make/toolchain.sh	Sun Jan 12 11:26:16 2025 +0100
+++ b/test/make/toolchain.sh	Sun Jan 12 12:40:20 2025 +0100
@@ -17,6 +17,10 @@
 
 check_c_compiler()
 {
+  command -v $1 2>&1 >/dev/null
+  if [ $? -ne 0 ]; then
+    return 1
+  fi
   cat > "$TEMP_DIR/test.c" << __EOF__
 /* test file */
 #include <stdio.h>
@@ -41,6 +45,10 @@
 
 check_cpp_compiler()
 {
+  command -v $1 2>&1 >/dev/null
+  if [ $? -ne 0 ]; then
+    return 1
+  fi
   cat > "$TEMP_DIR/test.cpp" << __EOF__
 /* test file */
 #include <iostream>

mercurial