make/toolchain.sh

changeset 1492
cc83ce484bf7
parent 1470
c1a144db699f
--- a/make/toolchain.sh	Thu Nov 13 17:47:00 2025 +0100
+++ b/make/toolchain.sh	Sat Nov 15 08:30:00 2025 +0100
@@ -3,7 +3,7 @@
 # toolchain detection
 #
 
-TAIL=tail
+TAIL="tail"
 if isplatform "bsd" && notisplatform "openbsd"; then
   C_COMPILERS="clang gcc cc"
   CPP_COMPILERS="clang++ g++ CC"
@@ -24,14 +24,13 @@
 
 check_c_compiler()
 {
-  command -v $1 2>&1 >/dev/null
-  if [ $? -ne 0 ]; then
+  if ! command -v "$1" >/dev/null 2>&1 ; then
     return 1
   fi
   cat > "$TEMP_DIR/test.c" << __EOF__
 /* test file */
 #include <stdio.h>
-int main(int argc, char **argv) {
+int main(void) {
 #if defined(_MSC_VER)
   printf("toolchain:msc\n");
 #elif defined(__clang__)
@@ -45,7 +44,7 @@
 #endif
   printf("wsize:%d\n", (int)sizeof(void*)*8);
 #ifdef __STDC_VERSION__
-  printf("stdcversion:%d\n", __STDC_VERSION__);
+  printf("stdcversion:%ld\n", (long int)__STDC_VERSION__);
 #endif
   return 0;
 }
@@ -56,14 +55,13 @@
 
 check_cpp_compiler()
 {
-  command -v $1 2>&1 >/dev/null
-  if [ $? -ne 0 ]; then
+  if ! command -v "$1" >/dev/null 2>&1 ; then
     return 1
   fi
   cat > "$TEMP_DIR/test.cpp" << __EOF__
 /* test file */
 #include <iostream>
-int main(int argc, char **argv) {
+int main(void) {
 #if defined(_MSC_VER)
   std::cout << "toolchain:msc" << std::endl;
 #elif defined(__clang__)
@@ -83,21 +81,6 @@
   $1 -o "$TEMP_DIR/checkcc" $CXXFLAGS $LDFLAGS "$TEMP_DIR/test.cpp" 2> /dev/null
 }
 
-create_libtest_source()
-{
-  # $1: filename
-  # $2: optional include
-  cat > "$TEMP_DIR/$1" << __EOF__
-/* libtest file */
-int main(int argc, char **argv) {
-  return 0;
-}
-__EOF__
-  if [ -n "$2" ]; then
-    echo "#include <$2>" >> "$TEMP_DIR/$1"
-  fi
-}
-
 parse_toolchain_properties()
 {
   info_file="$1"

mercurial