Received: from eggs.gnu.org ([2001:4830:134:3::10]:40418) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WGW1A-0001Ua-Fy for qemu-devel@nongnu.org; Thu, 20 Feb 2014 10:58:39 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WGW13-0004DD-C4 for qemu-devel@nongnu.org; Thu, 20 Feb 2014 10:58:32 -0500 Received: from e06smtp13.uk.ibm.com ([195.75.94.109]:57564) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WGW13-0004Cw-3M for qemu-devel@nongnu.org; Thu, 20 Feb 2014 10:58:25 -0500 Received: from /spool/local by e06smtp13.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 20 Feb 2014 15:58:23 -0000 Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by d06dlp01.portsmouth.uk.ibm.com (Postfix) with ESMTP id 2379E17D8066 for ; Thu, 20 Feb 2014 15:58:53 +0000 (GMT) Received: from d06av01.portsmouth.uk.ibm.com (d06av01.portsmouth.uk.ibm.com [9.149.37.212]) by b06cxnps3074.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id s1KFwASO66715866 for ; Thu, 20 Feb 2014 15:58:10 GMT Received: from d06av01.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av01.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id s1KFwLlL010969 for ; Thu, 20 Feb 2014 08:58:22 -0700 Date: Thu, 20 Feb 2014 16:58:19 +0100 From: Thomas Huth Message-ID: <20140220165819.047aba8c@oc7435384737.ibm.com> In-Reply-To: <1392909016-14028-1-git-send-email-peter.maydell@linaro.org> References: <1392909016-14028-1-git-send-email-peter.maydell@linaro.org> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] configure: check that C++ compiler actually works List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: Alexey Kardashevskiy , qemu-devel@nongnu.org, patches@linaro.org On Thu, 20 Feb 2014 15:10:16 +0000 Peter Maydell wrote: > Check that the C++ compiler works with the C compiler; if it > does not, then don't pass CXX to the build process. This > fixes a regression where QEMU was no longer building if the > build environment didn't have a C++ compiler (introduced > in commit 3144f78b, which incorrectly assumed that rules.mak > would only see a non-empty $(CXX) if configure had actually > found a working C++ compiler). > > Signed-off-by: Peter Maydell > Reported-by: Alexey Kardashevskiy > Reported-by: Thomas Huth > --- > Apologies for the breakage for people who were building in > setups with no C++ compiler -- I should have tested the > original change more thoroughly. > > configure | 29 +++++++++++++++++++++++++++++ > 1 file changed, 29 insertions(+) > > diff --git a/configure b/configure > index 4648117..6829cbb 100755 > --- a/configure > +++ b/configure > @@ -1289,6 +1289,35 @@ else > error_exit "\"$cc\" either does not exist or does not work" > fi > > +# Check that the C++ compiler exists and works with the C compiler > +if has $cxx; then > + cat > $TMPC < +int c_function(void); > +int main(void) { return c_function(); } > +EOF > + > + compile_object > + > + cat > $TMPC < +extern "C" { > + int c_function(void); > +} > +int c_function(void) { return 42; } > +EOF > + > + if (cc=$cxx do_cc $QEMU_CFLAGS -o $TMPE $TMPC $TMPO $LDFLAGS); then > + # C++ compiler $cxx works ok with C compiler $cc > + : > + else > + echo "C++ compiler $cxx does not work with C compiler $cc" > + echo "Disabling C++ specific optional code" > + cxx= > + fi > +else > + echo "No C++ compiler available; disabling C++ specific optional code" > + cxx= > +fi > + > # Consult white-list to determine whether to enable werror > # by default. Only enable by default for git builds > z_version=`cut -f3 -d. $source_path/VERSION` Works fine for me now on my system w/o C++ compiler: Tested-by: Thomas Huth