From patchwork Fri Nov 16 16:37:23 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 199685 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id CBB9A2C0089 for ; Sat, 17 Nov 2012 03:37:50 +1100 (EST) Received: from localhost ([::1]:54023 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TZOvM-0001xt-PN for incoming@patchwork.ozlabs.org; Fri, 16 Nov 2012 11:37:48 -0500 Received: from eggs.gnu.org ([208.118.235.92]:58375) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TZOvD-0001pJ-T7 for qemu-devel@nongnu.org; Fri, 16 Nov 2012 11:37:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TZOvA-0005kq-R9 for qemu-devel@nongnu.org; Fri, 16 Nov 2012 11:37:39 -0500 Received: from 38.0.169.217.in-addr.arpa ([217.169.0.38]:42097 helo=mnementh.archaic.org.uk) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TZOvA-0005jN-Jl for qemu-devel@nongnu.org; Fri, 16 Nov 2012 11:37:36 -0500 Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.72) (envelope-from ) id 1TZOux-0004TS-Sv; Fri, 16 Nov 2012 16:37:23 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Date: Fri, 16 Nov 2012 16:37:23 +0000 Message-Id: <1353083843-17175-1-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.2.5 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 217.169.0.38 Cc: Paolo Bonzini , Anthony Liguori , =?UTF-8?q?Andreas=20F=C3=A4rber?= , patches@linaro.org Subject: [Qemu-devel] [PATCH] configure: Default to 'cc', not 'gcc', on MacOS X X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org When building for MacOS X, default the C compiler to 'cc' (usually clang) rather than 'gcc'. This avoids the Apple 'gcc', which is generally an elderly llvm-gcc provided mostly for legacy purposes, in favour of the best supported compiler available on the platform. Signed-off-by: Peter Maydell --- I now seem to be getting failures to compile due to weak refs on clang as well, but defaulting to cc seems like a good long term plan anyway. I've mostly been building and testing with --cc=clang so this isn't a sudden compiler switch from my point of view. I'm ambivalent about whether this should go in 1.3 or not, given it doesn't actually fix the weakref issues. configure | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/configure b/configure index f847ee2..ec9932b 100755 --- a/configure +++ b/configure @@ -116,7 +116,13 @@ audio_drv_list="" audio_card_list="ac97 es1370 sb16 hda" audio_possible_cards="ac97 es1370 sb16 cs4231a adlib gus hda" block_drv_whitelist="" -host_cc="gcc" +if test "$(uname -s)" = "Darwin"; then + # On MacOS X the standard supported system compiler is 'cc' (usually clang), + # and 'gcc' is a legacy llvm-gcc which is rather elderly and best avoided. + host_cc="cc" +else + host_cc="gcc" +fi libs_softmmu="" libs_tools="" audio_pt_int="" @@ -250,7 +256,16 @@ done # Using uname is really, really broken. Once we have the right set of checks # we can eliminate its usage altogether. -cc="${CC-${cross_prefix}gcc}" +# Preferred compiler: +# ${CC} (if set) +# ${cross_prefix}gcc (if cross-prefix specified) +# system compiler +if test -z "${CC}${cross_prefix}"; then + cc="$host_cc" +else + cc="${CC-${cross_prefix}gcc}" +fi + ar="${AR-${cross_prefix}ar}" objcopy="${OBJCOPY-${cross_prefix}objcopy}" ld="${LD-${cross_prefix}ld}"