fix toolchain.sh compatibility with older shells

Sat, 29 Nov 2025 12:18:10 +0100

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Sat, 29 Nov 2025 12:18:10 +0100
changeset 163
12a5e64cab34
parent 162
79eeb33c738f
child 164
099448bcc943

fix toolchain.sh compatibility with older shells

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	Fri Nov 14 15:09:37 2025 +0100
+++ b/src/main/resources/make/toolchain.sh	Sat Nov 29 12:18:10 2025 +0100
@@ -24,7 +24,8 @@
 
 check_c_compiler()
 {
-  if ! command -v "$1" >/dev/null 2>&1 ; then
+  command -v "$1" >/dev/null 2>&1
+  if [ $? -ne 0 ] ; then
     return 1
   fi
   cat > "$TEMP_DIR/test.c" << __EOF__
@@ -55,7 +56,8 @@
 
 check_cpp_compiler()
 {
-  if ! command -v "$1" >/dev/null 2>&1 ; then
+  command -v "$1" >/dev/null 2>&1
+  if [ $? -ne 0 ] ; then
     return 1
   fi
   cat > "$TEMP_DIR/test.cpp" << __EOF__
--- a/test/make/toolchain.sh	Fri Nov 14 15:09:37 2025 +0100
+++ b/test/make/toolchain.sh	Sat Nov 29 12:18:10 2025 +0100
@@ -24,7 +24,8 @@
 
 check_c_compiler()
 {
-  if ! command -v "$1" >/dev/null 2>&1 ; then
+  command -v "$1" >/dev/null 2>&1
+  if [ $? -ne 0 ] ; then
     return 1
   fi
   cat > "$TEMP_DIR/test.c" << __EOF__
@@ -55,7 +56,8 @@
 
 check_cpp_compiler()
 {
-  if ! command -v "$1" >/dev/null 2>&1 ; then
+  command -v "$1" >/dev/null 2>&1
+  if [ $? -ne 0 ] ; then
     return 1
   fi
   cat > "$TEMP_DIR/test.cpp" << __EOF__

mercurial