From nobody Wed Oct 29 06:55:36 2025 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.zohomail.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 1513548654616458.611067577983; Sun, 17 Dec 2017 14:10:54 -0800 (PST) Received: from localhost ([::1]:55756 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eQh93-0006xR-K5 for importer@patchew.org; Sun, 17 Dec 2017 17:10:53 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47812) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eQh3U-0002zf-NL for qemu-devel@nongnu.org; Sun, 17 Dec 2017 17:05:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eQh3O-00067B-AY for qemu-devel@nongnu.org; Sun, 17 Dec 2017 17:05:08 -0500 Received: from isrv.corpit.ru ([86.62.121.231]:33619) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eQh3N-00065m-Ue; Sun, 17 Dec 2017 17:05:02 -0500 Received: from tsrv.corpit.ru (tsrv.tls.msk.ru [192.168.177.2]) by isrv.corpit.ru (Postfix) with ESMTP id 465B341178; Mon, 18 Dec 2017 01:04:56 +0300 (MSK) Received: from tls.msk.ru (mjt.vpn.tls.msk.ru [192.168.177.99]) by tsrv.corpit.ru (Postfix) with SMTP id 39079CAE; Mon, 18 Dec 2017 00:25:46 +0300 (MSK) Received: (nullmailer pid 30895 invoked by uid 1000); Sun, 17 Dec 2017 21:28:08 -0000 From: Michael Tokarev To: qemu-devel@nongnu.org Date: Mon, 18 Dec 2017 00:27:11 +0300 Message-Id: <9dcfdb30a300bc4ff11354da251a11c1c995e003.1513545944.git.mjt@msgid.tls.msk.ru> X-Mailer: git-send-email 2.11.0 In-Reply-To: References: In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 86.62.121.231 Subject: [Qemu-devel] [PULL 06/61] configure: check $CC available before verifying host CPU 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: qemu-trivial@nongnu.org, Michael Tokarev , Daniel Henrique Barboza 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" From: Daniel Henrique Barboza When executing 'configure' in a fresh QEMU clone, in a fresh OS install running in a ppc64le host, this is the error shown: Reviewed-by: Peter Maydell ----- ../configure --enable-trace-backend=3Dsimple --enable-debug --target-list=3Dppc64-softmmu ERROR: Unsupported CPU =3D ppc64le, try --enable-tcg-interpreter ----- This isn't true, ppc64le host CPU is supported. This happens because, in a fresh install, we don't have a C compiler to autodetect the $cpu variable to "ppc64". This patch moves the CC available check up a bit, just before verifying the host CPU. This ensures that we bail out with a $CC not available error instead of unsupported CPU (the host CPU detection without the compiler wouldn't work properly anyway). It also allows --help to keep working without a C compiler. With this patch, in the same ppc64le host without gcc: $ ../configure --enable-trace-backend=3Dsimple --enable-debug --target-list=3Dppc64-softmmu ERROR: "cc" either does not exist or does not work $ ../configure --help Usage: configure [options] Options: [defaults in brackets after descriptions] Standard options: --help print this message --prefix=3DPREFIX install in PREFIX [/usr/local] --interp-prefix=3DPREFIX where to find shared libraries, etc. (...) Signed-off-by: Daniel Henrique Barboza Reviewed-by: Peter Maydell Signed-off-by: Michael Tokarev --- configure | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/configure b/configure index 0c6e7572db..9c8aa5a98b 100755 --- a/configure +++ b/configure @@ -1582,6 +1582,20 @@ fi # Suppress writing compiled files python=3D"$python -B" =20 +# Check that the C compiler works. Doing this here before testing +# the host CPU ensures that we had a valid CC to autodetect the +# $cpu var (and we should bail right here if that's not the case). +# It also allows the help message to be printed without a CC. +write_c_skeleton; +if compile_object ; then + : C compiler works ok +else + error_exit "\"$cc\" either does not exist or does not work" +fi +if ! compile_prog ; then + error_exit "\"$cc\" cannot build an executable (is your linker broken?= )" +fi + # Now we have handled --enable-tcg-interpreter and know we're not just # printing the help message, bail out if the host CPU isn't supported. if test "$ARCH" =3D "unknown"; then @@ -1603,17 +1617,6 @@ if test -z "$werror" ; then fi fi =20 -# check that the C compiler works. -write_c_skeleton; -if compile_object ; then - : C compiler works ok -else - error_exit "\"$cc\" either does not exist or does not work" -fi -if ! compile_prog ; then - error_exit "\"$cc\" cannot build an executable (is your linker broken?= )" -fi - 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 --=20 2.11.0