configure: check that C++ compiler actually works
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>
Tested-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Tested-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Message-id: 1392909016-14028-1-git-send-email-peter.maydell@linaro.org
This commit is contained in:
parent
105a060188
commit
98b21dcdb3
29
configure
vendored
29
configure
vendored
@ -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`
|
||||
|
Loading…
Reference in New Issue
Block a user