* [Qemu-devel] [PATCH] configure: check that C++ compiler actually works
@ 2014-02-20 15:10 Peter Maydell
2014-02-20 15:58 ` Thomas Huth
2014-02-24 15:38 ` Peter Maydell
0 siblings, 2 replies; 4+ messages in thread
From: Peter Maydell @ 2014-02-20 15:10 UTC (permalink / raw)
To: qemu-devel; +Cc: Alexey Kardashevskiy, Thomas Huth, patches
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 <peter.maydell@linaro.org>
Reported-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Reported-by: Thomas Huth <thuth@linux.vnet.ibm.com>
---
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 <<EOF
+int c_function(void);
+int main(void) { return c_function(); }
+EOF
+
+ compile_object
+
+ cat > $TMPC <<EOF
+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`
--
1.8.5
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] configure: check that C++ compiler actually works
2014-02-20 15:10 [Qemu-devel] [PATCH] configure: check that C++ compiler actually works Peter Maydell
@ 2014-02-20 15:58 ` Thomas Huth
2014-02-21 1:43 ` Alexey Kardashevskiy
2014-02-24 15:38 ` Peter Maydell
1 sibling, 1 reply; 4+ messages in thread
From: Thomas Huth @ 2014-02-20 15:58 UTC (permalink / raw)
To: Peter Maydell; +Cc: Alexey Kardashevskiy, qemu-devel, patches
On Thu, 20 Feb 2014 15:10:16 +0000
Peter Maydell <peter.maydell@linaro.org> 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 <peter.maydell@linaro.org>
> Reported-by: Alexey Kardashevskiy <aik@ozlabs.ru>
> Reported-by: Thomas Huth <thuth@linux.vnet.ibm.com>
> ---
> 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 <<EOF
> +int c_function(void);
> +int main(void) { return c_function(); }
> +EOF
> +
> + compile_object
> +
> + cat > $TMPC <<EOF
> +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 <thuth@linux.vnet.ibm.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] configure: check that C++ compiler actually works
2014-02-20 15:58 ` Thomas Huth
@ 2014-02-21 1:43 ` Alexey Kardashevskiy
0 siblings, 0 replies; 4+ messages in thread
From: Alexey Kardashevskiy @ 2014-02-21 1:43 UTC (permalink / raw)
To: Thomas Huth, Peter Maydell; +Cc: qemu-devel, patches
On 02/21/2014 02:58 AM, Thomas Huth wrote:
> On Thu, 20 Feb 2014 15:10:16 +0000
> Peter Maydell <peter.maydell@linaro.org> 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 <peter.maydell@linaro.org>
>> Reported-by: Alexey Kardashevskiy <aik@ozlabs.ru>
>> Reported-by: Thomas Huth <thuth@linux.vnet.ibm.com>
>> ---
>> 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 <<EOF
>> +int c_function(void);
>> +int main(void) { return c_function(); }
>> +EOF
>> +
>> + compile_object
>> +
>> + cat > $TMPC <<EOF
>> +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 <thuth@linux.vnet.ibm.com>
Works for me too, in cross environment for ppc64 on x86_64,
Tested-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Thanks.
--
Alexey
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] configure: check that C++ compiler actually works
2014-02-20 15:10 [Qemu-devel] [PATCH] configure: check that C++ compiler actually works Peter Maydell
2014-02-20 15:58 ` Thomas Huth
@ 2014-02-24 15:38 ` Peter Maydell
1 sibling, 0 replies; 4+ messages in thread
From: Peter Maydell @ 2014-02-24 15:38 UTC (permalink / raw)
To: QEMU Developers; +Cc: Alexey Kardashevskiy, Thomas Huth, Patch Tracking
On 20 February 2014 15:10, Peter Maydell <peter.maydell@linaro.org> 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 <peter.maydell@linaro.org>
> Reported-by: Alexey Kardashevskiy <aik@ozlabs.ru>
> Reported-by: Thomas Huth <thuth@linux.vnet.ibm.com>
> ---
> Apologies for the breakage for people who were building in
> setups with no C++ compiler -- I should have tested the
> original change more thoroughly
Applied directly to master since it's a build-breakage fix.
thanks
-- PMM
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-02-24 15:39 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-20 15:10 [Qemu-devel] [PATCH] configure: check that C++ compiler actually works Peter Maydell
2014-02-20 15:58 ` Thomas Huth
2014-02-21 1:43 ` Alexey Kardashevskiy
2014-02-24 15:38 ` Peter Maydell
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).