From nobody Mon Apr 29 02:28:27 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1490707187241608.9124840060929; Tue, 28 Mar 2017 06:19:47 -0700 (PDT) Received: from localhost ([::1]:53283 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1csr2I-0004xX-08 for importer@patchew.org; Tue, 28 Mar 2017 09:19:46 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53960) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1csr1U-0004f4-UO for qemu-devel@nongnu.org; Tue, 28 Mar 2017 09:18:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1csr1Q-0004bG-Oh for qemu-devel@nongnu.org; Tue, 28 Mar 2017 09:18:56 -0400 Received: from orth.archaic.org.uk ([2001:8b0:1d0::2]:48958) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1csr1Q-0004aZ-Hy for qemu-devel@nongnu.org; Tue, 28 Mar 2017 09:18:52 -0400 Received: from pm215 by orth.archaic.org.uk with local (Exim 4.84_2) (envelope-from ) id 1csr1O-0001PN-Hp; Tue, 28 Mar 2017 14:18:50 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Date: Tue, 28 Mar 2017 14:18:49 +0100 Message-Id: <1490707129-12622-1-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 2.7.4 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:8b0:1d0::2 Subject: [Qemu-devel] [PATCH for-2.9] configure: Don't claim 'unsupported host OS' when better message available X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Stefan Weil , patches@linaro.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The change in commit 898be3e0415c6d which made completely unrecognized OSes cause an error_exit "Unsupported host OS" has some unfortunate unintended effects: * if you run 'configure --help' on an unsupported host OS (eg if intending to use it as a build machine for a cross compile to a supported host) then the message is printed instead of --help * if the C compiler doesn't work or is missing (eg if you passed an incorrect --cross-prefix by mistake) the message is printed instead of the more useful 'compiler does not exist or does not work' message Fix this by postponing the error_exit in this situation until later, when we have already identified the more useful cases for this. The long term fix for this would be to move handling of --help much further up in the configure script, and make its output not dependent on checks that configure runs. However for 2.9 this would be too invasive. Reported-by: Stefan Weil Signed-off-by: Peter Maydell Reviewed-by: Stefan Weil Tested-by: Stefan Weil --- configure | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/configure b/configure index 82966f7..8820036 100755 --- a/configure +++ b/configure @@ -323,6 +323,7 @@ replication=3D"yes" =20 supported_cpu=3D"no" supported_os=3D"no" +bogus_os=3D"no" =20 # parse CC options first for opt do @@ -695,7 +696,10 @@ Linux) supported_os=3D"yes" ;; *) - error_exit "Unsupported host OS $targetos" + # This is a fatal error, but don't report it yet, because we + # might be going to just print the --help text, or it might + # be the result of a missing compiler. + bogus_os=3D"yes" ;; esac =20 @@ -1461,6 +1465,14 @@ if ! compile_prog ; then error_exit "\"$cc\" cannot build an executable (is your linker broken?= )" fi =20 +if test "$bogus_os" =3D "yes"; 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. + error_exit "Unsupported host OS $targetos" +fi + # Check that the C++ compiler exists and works with the C compiler if has $cxx; then cat > $TMPC <