From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:59270) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T1esK-0006To-8A for qemu-devel@nongnu.org; Wed, 15 Aug 2012 10:47:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T1esG-0002iC-7x for qemu-devel@nongnu.org; Wed, 15 Aug 2012 10:47:12 -0400 Received: from cantor2.suse.de ([195.135.220.15]:54226 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T1esF-0002hz-UP for qemu-devel@nongnu.org; Wed, 15 Aug 2012 10:47:08 -0400 Message-ID: <502BB667.5080009@suse.de> Date: Wed, 15 Aug 2012 16:47:03 +0200 From: =?ISO-8859-15?Q?Andreas_F=E4rber?= MIME-Version: 1.0 References: <1344720880-26881-1-git-send-email-peter.maydell@linaro.org> <1344720880-26881-3-git-send-email-peter.maydell@linaro.org> In-Reply-To: <1344720880-26881-3-git-send-email-peter.maydell@linaro.org> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 2/2] Support using a different compiler for Objective-C files List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: qemu-devel@nongnu.org, patches@linaro.org Am 11.08.2012 23:34, schrieb Peter Maydell: > 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. >=20 > 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). >=20 > Signed-off-by: Peter Maydell > --- > configure | 12 ++++++++++++ > rules.mak | 2 +- > 2 files changed, 13 insertions(+), 1 deletion(-) >=20 > diff --git a/configure b/configure > index be4a2bb..bd62d2c 100755 > --- a/configure > +++ b/configure > @@ -534,6 +534,13 @@ fi > : ${python=3D${PYTHON-python}} > : ${smbd=3D${SMBD-/usr/sbin/smbd}} > =20 > +# Default objcc to clang if available, otherwise use CC > +if has clang; then > + objcc=3Dclang On IRC I had commented that I find defaulting to clang whenever clang is available too aggressive (it may be some /usr/local/bin version that doesn't even have the right host architecture support compiled in). I won't object to this patch but would appreciate a follow-up limiting this to v10.8+ where it's actually needed and keep using gcc elsewhere. Andreas > +else > + objcc=3D"$cc" > +fi > + > if test "$mingw32" =3D "yes" ; then > EXESUF=3D".exe" > QEMU_CFLAGS=3D"-DWIN32_LEAN_AND_MEAN -DWINVER=3D0x501 $QEMU_CFLAGS" > @@ -577,6 +584,8 @@ for opt do > ;; > --host-cc=3D*) host_cc=3D"$optarg" > ;; > + --objcc=3D*) objcc=3D"$optarg" > + ;; > --make=3D*) make=3D"$optarg" > ;; > --install=3D*) install=3D"$optarg" > @@ -1024,6 +1033,7 @@ echo " --cross-prefix=3DPREFIX use PREFIX for= compile tools [$cross_prefix]" > echo " --cc=3DCC use C compiler CC [$cc]" > echo " --host-cc=3DCC use C compiler CC [$host_cc] for co= de run at" > echo " build time" > +echo " --objcc=3DOBJCC use Objective-C compiler OBJCC [$ob= jcc]" > echo " --extra-cflags=3DCFLAGS append extra C compiler flags QEMU_= CFLAGS" > echo " --extra-ldflags=3DLDFLAGS append extra linker flags LDFLAGS" > echo " --make=3DMAKE 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=3D$python" >> $config_host_mak > echo "CC=3D$cc" >> $config_host_mak > echo "CC_I386=3D$cc_i386" >> $config_host_mak > echo "HOST_CC=3D$host_cc" >> $config_host_mak > +echo "OBJCC=3D$objcc" >> $config_host_mak > echo "AR=3D$ar" >> $config_host_mak > echo "OBJCOPY=3D$objcopy" >> $config_host_mak > echo "LD=3D$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_DGF= LAGS) $(CFLAGS) -c -o $@ $<," AS $(TARGET_DIR)$@") > =20 > %.o: %.m > - $(call quiet-command,$(CC) $(QEMU_INCLUDES) $(QEMU_CFLAGS) $(QEMU_DGF= LAGS) $(CFLAGS) -c -o $@ $<," OBJC $(TARGET_DIR)$@") > + $(call quiet-command,$(OBJCC) $(QEMU_INCLUDES) $(QEMU_CFLAGS) $(QEMU_= DGFLAGS) $(CFLAGS) -c -o $@ $<," OBJC $(TARGET_DIR)$@") > =20 > LINK =3D $(call quiet-command,$(CC) $(QEMU_CFLAGS) $(CFLAGS) $(LDFLAGS= ) -o $@ $(sort $(1)) $(LIBS)," LINK $(TARGET_DIR)$@") > =20 >=20 --=20 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=FCrnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imend=F6rffer; HRB 16746 AG N=FCrnbe= rg