qemu-stable
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] configure: Fix error message when C compiler is not working


From: Thomas Huth
Subject: [PATCH] configure: Fix error message when C compiler is not working
Date: Fri, 8 Mar 2024 07:00:34 +0100

If you try to run the configure script on a system without a working
C compiler, you get a very misleading error message:

 ERROR: Unrecognized host OS (uname -s reports 'Linux')

We should rather tell the user that we were not able to use the C
compiler instead, otherwise they will have a hard time to figure
out what was going wrong.

Fixes: 264b803721 ("configure: remove compiler sanity check")
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 configure | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/configure b/configure
index 3cd736b139..a036923dee 100755
--- a/configure
+++ b/configure
@@ -411,7 +411,7 @@ else
   # Using uname is really broken, but it is just a fallback for architectures
   # that are going to use TCI anyway
   cpu=$(uname -m)
-  echo "WARNING: unrecognized host CPU, proceeding with 'uname -m' output 
'$cpu'"
+  echo "WARNING: could not determine host CPU, proceeding with 'uname -m' 
output '$cpu'"
 fi
 
 # Normalise host CPU name to the values used by Meson cross files and in source
@@ -1000,10 +1000,12 @@ if test -z "$ninja"; then
 fi
 
 if test "$host_os" = "bogus"; then
-    # Now that we know that we're not printing the help and that
-    # the compiler works (so the results of the check_defines we used
-    # to identify the OS are reliable), if we didn't recognize the
-    # host OS we should stop now.
+    # Now that we know that we're not printing the help, we should stop now
+    # if we didn't recognize the host OS (or the C compiler is not working).
+    write_c_skeleton;
+    if ! compile_object ; then
+        error_exit "C compiler \"$cc\" is not usable"
+    fi
     error_exit "Unrecognized host OS (uname -s reports '$(uname -s)')"
 fi
 
-- 
2.44.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]