From patchwork Thu Nov 2 09:09:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Henrique Barboza X-Patchwork-Id: 10038175 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 976CD6032D for ; Thu, 2 Nov 2017 09:11:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8DA1528ECE for ; Thu, 2 Nov 2017 09:11:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7C37828ECF; Thu, 2 Nov 2017 09:11:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1826328ECC for ; Thu, 2 Nov 2017 09:11:54 +0000 (UTC) Received: from localhost ([::1]:59289 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eABXV-00082O-5l for patchwork-qemu-devel@patchwork.kernel.org; Thu, 02 Nov 2017 05:11:53 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47907) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eABWB-0007rx-Af for qemu-devel@nongnu.org; Thu, 02 Nov 2017 05:10:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eABW6-0000Gn-Rj for qemu-devel@nongnu.org; Thu, 02 Nov 2017 05:10:31 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:56196 helo=mx0a-001b2d01.pphosted.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eABW6-0007bv-LV for qemu-devel@nongnu.org; Thu, 02 Nov 2017 05:10:26 -0400 Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id vA294AMQ093152 for ; Thu, 2 Nov 2017 05:09:20 -0400 Received: from e31.co.us.ibm.com (e31.co.us.ibm.com [32.97.110.149]) by mx0b-001b2d01.pphosted.com with ESMTP id 2dywm30wdg-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Thu, 02 Nov 2017 05:09:20 -0400 Received: from localhost by e31.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 2 Nov 2017 03:09:19 -0600 Received: from b03cxnp07029.gho.boulder.ibm.com (9.17.130.16) by e31.co.us.ibm.com (192.168.1.131) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 2 Nov 2017 03:09:15 -0600 Received: from b03ledav005.gho.boulder.ibm.com (b03ledav005.gho.boulder.ibm.com [9.17.130.236]) by b03cxnp07029.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id vA299C8A6619602; Thu, 2 Nov 2017 02:09:15 -0700 Received: from b03ledav005.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 50FEFBE053; Thu, 2 Nov 2017 03:09:15 -0600 (MDT) Received: from localhost.localdomain (unknown [9.85.172.126]) by b03ledav005.gho.boulder.ibm.com (Postfix) with ESMTP id 03F0EBE03A; Thu, 2 Nov 2017 03:09:13 -0600 (MDT) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Date: Thu, 2 Nov 2017 07:09:06 -0200 X-Mailer: git-send-email 2.13.6 X-TM-AS-GCONF: 00 x-cbid: 17110209-8235-0000-0000-00000C80B12D X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00007996; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000239; SDB=6.00939991; UDB=6.00473960; IPR=6.00720248; BA=6.00005666; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00017832; XFM=3.00000015; UTC=2017-11-02 09:09:18 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17110209-8236-0000-0000-00003E48A0F4 Message-Id: <20171102090906.30391-1-danielhb@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-11-02_02:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000 definitions=main-1711020119 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.158.5 Subject: [Qemu-devel] [PATCH v5] 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: peter.maydell@linaro.org, mdroth@linux.vnet.ibm.com, f4bug@amsat.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP When executing 'configure' in a fresh QEMU clone, in a fresh OS install running in a ppc64le host, this is the error shown: ----- ../configure --enable-trace-backend=simple --enable-debug --target-list=ppc64-softmmu ERROR: Unsupported CPU = 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=simple --enable-debug --target-list=ppc64-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=PREFIX install in PREFIX [/usr/local] --interp-prefix=PREFIX where to find shared libraries, etc. (...) Signed-off-by: Daniel Henrique Barboza Reviewed-by: Peter Maydell --- configure | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/configure b/configure index 285d123dbf..e78f07d5d9 100755 --- a/configure +++ b/configure @@ -1572,6 +1572,20 @@ fi # Suppress writing compiled files python="$python -B" +# 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" = "unknown"; then @@ -1593,17 +1607,6 @@ if test -z "$werror" ; then fi fi -# 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" = "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