From patchwork Sat Aug 11 21:34:40 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 10693 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id B265523E53 for ; Sat, 11 Aug 2012 21:34:46 +0000 (UTC) Received: from mail-ob0-f180.google.com (mail-ob0-f180.google.com [209.85.214.180]) by fiordland.canonical.com (Postfix) with ESMTP id 596DEA184CE for ; Sat, 11 Aug 2012 21:34:46 +0000 (UTC) Received: by obceq6 with SMTP id eq6so2997695obc.11 for ; Sat, 11 Aug 2012 14:34:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=/aZEp/Ej3wW6v95cRDYXt46EqXHeKGnPlh/05KZvPQA=; b=ZOkkAit/Nk2fxzOXo2ktgqh9/A503fAXEXlXiQHKf9r4DuDubu0QIgY4grj0Ry/kLn Xyaoj6g/rwhJJxBHElMAPt7sVcHN+DKAR8z/nXfQ71QRlqn6/arvfoVnkdSp/wY5L4C6 MwFwY+kLrRRInldg6YZGXyhUs/2YAu6iJISnijcMp+cSpFzG6QVluayqfPUCEf6fDkTR bWhbT3lB8P4sXrX3jAENDOA8fjYkK07CgNeNPMPflCm1xepst8boXerAi/rItVO+OGUj 0+VeLjcRewtS4AwouJB4Wv1aWlKc1bOjHkFdHou+X6SbUPkHD2KeEpJw8OqdP6UANyXW nXJg== Received: by 10.50.57.168 with SMTP id j8mr1779551igq.16.1344720885511; Sat, 11 Aug 2012 14:34:45 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.50.184.200 with SMTP id ew8csp117803igc; Sat, 11 Aug 2012 14:34:44 -0700 (PDT) Received: by 10.180.79.229 with SMTP id m5mr6166232wix.13.1344720883840; Sat, 11 Aug 2012 14:34:43 -0700 (PDT) Received: from mnementh.archaic.org.uk (mnementh.archaic.org.uk. [81.2.115.146]) by mx.google.com with ESMTPS id w2si7054490wiz.30.2012.08.11.14.34.43 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 11 Aug 2012 14:34:43 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 81.2.115.146 as permitted sender) client-ip=81.2.115.146; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 81.2.115.146 as permitted sender) smtp.mail=pm215@archaic.org.uk Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.72) (envelope-from ) id 1T0JKT-000704-0C; Sat, 11 Aug 2012 22:34:41 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org, =?UTF-8?q?Andreas=20F=C3=A4rber?= Subject: [PATCH 2/2] Support using a different compiler for Objective-C files Date: Sat, 11 Aug 2012 22:34:40 +0100 Message-Id: <1344720880-26881-3-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1344720880-26881-1-git-send-email-peter.maydell@linaro.org> References: <1344720880-26881-1-git-send-email-peter.maydell@linaro.org> X-Gm-Message-State: ALoCoQl5+BQbfUN+gEzzm2t2knJrrRGHCWKOSM8/atRfOUmPxh9CPlgf9nexZn4OXNnz5JEH/nuF MacOSX 10.8 ("Mountain Lion") requires us to compile our one Objective-C source file with clang even if the rest of QEMU requires a real gcc, because the system headers we use make use of Apple's "Blocks" extension to C/ObjC, and mainline gcc doesn't support that. Since we only need to use a true gcc for the parts of QEMU that use the fixed-register env variable, we can simply use clang to build the ObjC file: it will link to the gcc-built objects with no problems. Add the necessary support for an OBJCC variable in the makefile and configure machinery; we default to clang if we have it, otherwise whatever CC is (since gcc might be the Apple gcc which does support Blocks). Signed-off-by: Peter Maydell --- configure | 12 ++++++++++++ rules.mak | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/configure b/configure index be4a2bb..bd62d2c 100755 --- a/configure +++ b/configure @@ -534,6 +534,13 @@ fi : ${python=${PYTHON-python}} : ${smbd=${SMBD-/usr/sbin/smbd}} +# Default objcc to clang if available, otherwise use CC +if has clang; then + objcc=clang +else + objcc="$cc" +fi + if test "$mingw32" = "yes" ; then EXESUF=".exe" QEMU_CFLAGS="-DWIN32_LEAN_AND_MEAN -DWINVER=0x501 $QEMU_CFLAGS" @@ -577,6 +584,8 @@ for opt do ;; --host-cc=*) host_cc="$optarg" ;; + --objcc=*) objcc="$optarg" + ;; --make=*) make="$optarg" ;; --install=*) install="$optarg" @@ -1024,6 +1033,7 @@ echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]" echo " --cc=CC use C compiler CC [$cc]" echo " --host-cc=CC use C compiler CC [$host_cc] for code run at" echo " build time" +echo " --objcc=OBJCC use Objective-C compiler OBJCC [$objcc]" echo " --extra-cflags=CFLAGS append extra C compiler flags QEMU_CFLAGS" echo " --extra-ldflags=LDFLAGS append extra linker flags LDFLAGS" echo " --make=MAKE use specified make [$make]" @@ -3054,6 +3064,7 @@ fi echo "Source path $source_path" echo "C compiler $cc" echo "Host C compiler $host_cc" +echo "Objective-C compiler $objcc" echo "CFLAGS $CFLAGS" echo "QEMU_CFLAGS $QEMU_CFLAGS" echo "LDFLAGS $LDFLAGS" @@ -3521,6 +3532,7 @@ echo "PYTHON=$python" >> $config_host_mak echo "CC=$cc" >> $config_host_mak echo "CC_I386=$cc_i386" >> $config_host_mak echo "HOST_CC=$host_cc" >> $config_host_mak +echo "OBJCC=$objcc" >> $config_host_mak echo "AR=$ar" >> $config_host_mak echo "OBJCOPY=$objcopy" >> $config_host_mak echo "LD=$ld" >> $config_host_mak diff --git a/rules.mak b/rules.mak index a284946..1b173aa 100644 --- a/rules.mak +++ b/rules.mak @@ -29,7 +29,7 @@ endif $(call quiet-command,$(CC) $(QEMU_INCLUDES) $(QEMU_CFLAGS) $(QEMU_DGFLAGS) $(CFLAGS) -c -o $@ $<," AS $(TARGET_DIR)$@") %.o: %.m - $(call quiet-command,$(CC) $(QEMU_INCLUDES) $(QEMU_CFLAGS) $(QEMU_DGFLAGS) $(CFLAGS) -c -o $@ $<," OBJC $(TARGET_DIR)$@") + $(call quiet-command,$(OBJCC) $(QEMU_INCLUDES) $(QEMU_CFLAGS) $(QEMU_DGFLAGS) $(CFLAGS) -c -o $@ $<," OBJC $(TARGET_DIR)$@") LINK = $(call quiet-command,$(CC) $(QEMU_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ $(sort $(1)) $(LIBS)," LINK $(TARGET_DIR)$@")