From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39355) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V1N6a-0004up-3Z for qemu-devel@nongnu.org; Mon, 22 Jul 2013 16:53:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V1N6V-00047I-1d for qemu-devel@nongnu.org; Mon, 22 Jul 2013 16:53:16 -0400 Received: from mail-ie0-x231.google.com ([2607:f8b0:4001:c03::231]:57023) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V1N6U-000477-Rp for qemu-devel@nongnu.org; Mon, 22 Jul 2013 16:53:10 -0400 Received: by mail-ie0-f177.google.com with SMTP id w15so8149147iea.36 for ; Mon, 22 Jul 2013 13:53:10 -0700 (PDT) Sender: fluxion Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Michael Roth In-Reply-To: <20130715162029.16676.92712.stgit@outback> References: <20130715162023.16676.87828.stgit@outback> <20130715162029.16676.92712.stgit@outback> Message-ID: <20130722205306.16294.66057@loki> Date: Mon, 22 Jul 2013 15:53:06 -0500 Subject: Re: [Qemu-devel] [PATCH v7 01/10] configure: Support configuring C++ compiler List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Tomoki Sekiyama , qemu-devel@nongnu.org Cc: libaiqing@huawei.com, ghammer@redhat.com, stefanha@gmail.com, lcapitulino@redhat.com, vrozenfe@redhat.com, pbonzini@redhat.com, seiji.aguchi@hds.com, Laszlo Ersek , areis@redhat.com Quoting Tomoki Sekiyama (2013-07-15 11:20:29) > Add configuration for C++ compiler in configure and Makefiles. > The C++ compiler is choosed as following: > - ${CXX}, if it is specified. > - ${cross_prefix}g++, if ${cross_prefix} is specified. > - Otherwise, c++ is used. > = > Currently, usage of C++ language is only for access to Windows VSS > using COM+ services in qemu-guest-agent for Windows. > = > Signed-off-by: Tomoki Sekiyama > Reviewed-by: Laszlo Ersek > --- > configure | 13 +++++++++++++ > rules.mak | 9 ++++++++- > 2 files changed, 21 insertions(+), 1 deletion(-) > = > diff --git a/configure b/configure > index cb0f870..6923b65 100755 > --- a/configure > +++ b/configure > @@ -251,6 +251,8 @@ for opt do > ;; > --cc=3D*) CC=3D"$optarg" > ;; > + --cxx=3D*) CXX=3D"$optarg" > + ;; > --source-path=3D*) source_path=3D"$optarg" > ;; > --cpu=3D*) cpu=3D"$optarg" > @@ -281,6 +283,12 @@ else > cc=3D"${CC-${cross_prefix}gcc}" > fi > = > +if test -z "${CXX}${cross_prefix}"; then > + cxx=3D"c++" > +else > + cxx=3D"${CXX-${cross_prefix}g++}" > +fi > + > ar=3D"${AR-${cross_prefix}ar}" > as=3D"${AS-${cross_prefix}as}" > cpp=3D"${CPP-$cc -E}" > @@ -621,6 +629,8 @@ for opt do > ;; > --host-cc=3D*) host_cc=3D"$optarg" > ;; > + --cxx=3D*) cxx=3D"$optarg" > + ;; Since we've already determined cxx in the first pass (overriding other defaults --cxx argument if it's present), I think re-assigning here is unecessary. Otherwise looks good. > --objcc=3D*) objcc=3D"$optarg" > ;; > --make=3D*) make=3D"$optarg" > @@ -1022,6 +1032,7 @@ echo " --cross-prefix=3DPREFIX use PREFIX for c= ompile tools [$cross_prefix]" > echo " --cc=3DCC use C compiler CC [$cc]" > echo " --host-cc=3DCC use C compiler CC [$host_cc] for code= run at" > echo " build time" > +echo " --cxx=3DCXX use C++ compiler CXX [$cxx]" > echo " --objcc=3DOBJCC use Objective-C compiler OBJCC [$objc= c]" > echo " --extra-cflags=3DCFLAGS append extra C compiler flags QEMU_CF= LAGS" > echo " --extra-ldflags=3DLDFLAGS append extra linker flags LDFLAGS" > @@ -3496,6 +3507,7 @@ fi > echo "Source path $source_path" > echo "C compiler $cc" > echo "Host C compiler $host_cc" > +echo "C++ compiler $cxx" > echo "Objective-C compiler $objcc" > echo "CFLAGS $CFLAGS" > echo "QEMU_CFLAGS $QEMU_CFLAGS" > @@ -4069,6 +4081,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 "CXX=3D$cxx" >> $config_host_mak > echo "OBJCC=3D$objcc" >> $config_host_mak > echo "AR=3D$ar" >> $config_host_mak > echo "AS=3D$as" >> $config_host_mak > diff --git a/rules.mak b/rules.mak > index 4499745..abc2e84 100644 > --- a/rules.mak > +++ b/rules.mak > @@ -8,9 +8,13 @@ MAKEFLAGS +=3D -rR > %.d: > %.h: > %.c: > +%.cpp: > %.m: > %.mak: > = > +# Flags for C++ compilation > +QEMU_CXXFLAGS =3D -D__STDC_LIMIT_MACROS $(filter-out -Wstrict-prototypes= -Wmissing-prototypes -Wnested-externs -Wold-style-declaration -Wold-style-= definition -Wredundant-decls, $(QEMU_CFLAGS)) > + > # Flags for dependency generation > QEMU_DGFLAGS +=3D -MMD -MP -MT $@ -MF $(*D)/$(*F).d > = > @@ -50,6 +54,9 @@ endif > %.o: %.asm > $(call quiet-command,$(AS) $(ASFLAGS) -o $@ $<," AS $(TARGET_= DIR)$@") > = > +%.o: %.cpp > + $(call quiet-command,$(CXX) $(QEMU_INCLUDES) $(QEMU_CXXFLAGS) $(Q= EMU_DGFLAGS) $(CFLAGS) -c -o $@ $<," CXX $(TARGET_DIR)$@") > + > %.o: %.m > $(call quiet-command,$(OBJCC) $(QEMU_INCLUDES) $(QEMU_CFLAGS) $(Q= EMU_DGFLAGS) $(CFLAGS) -c -o $@ $<," OBJC $(TARGET_DIR)$@") > = > @@ -70,7 +77,7 @@ quiet-command =3D $(if $(V),$1,$(if $(2),@echo $2 && $1= , @$1)) > cc-option =3D $(if $(shell $(CC) $1 $2 -S -o /dev/null -xc /dev/null \ > >/dev/null 2>&1 && echo OK), $2, $3) > = > -VPATH_SUFFIXES =3D %.c %.h %.S %.m %.mak %.texi %.sh %.rc > +VPATH_SUFFIXES =3D %.c %.h %.S %.cpp %.m %.mak %.texi %.sh %.rc > set-vpath =3D $(if $1,$(foreach PATTERN,$(VPATH_SUFFIXES),$(eval vpath $= (PATTERN) $1))) > = > # find-in-path