From 793bf7e605e7451db47af0b47d7135767549a09c Mon Sep 17 00:00:00 2001 From: Patrick Georgi Date: Mon, 6 Jul 2020 16:37:33 +0200 Subject: [PATCH] util/xcompile: Look for the host compiler in XGCCPATH, too (and first) If there's a host compiler in XGCCPATH, it's likely the same relatively-current version we use for coreboot, and it's a well-known quantity, so let's prefer that over alternatives by default. In addition, look for the C++ host compiler as well. Change-Id: If50341df169a476899b5a5ffd4c4fb6d21c3f4ac Signed-off-by: Patrick Georgi Reviewed-on: https://review.coreboot.org/c/coreboot/+/43144 Reviewed-by: Nico Huber Tested-by: build bot (Jenkins) --- util/xcompile/xcompile | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/util/xcompile/xcompile b/util/xcompile/xcompile index 6629546ef1..c2374230d6 100755 --- a/util/xcompile/xcompile +++ b/util/xcompile/xcompile @@ -56,7 +56,9 @@ elif [ "$(iasl 2>/dev/null | grep -c ACPI)" -gt 0 ]; then IASL=iasl fi -if program_exists gcc; then +if program_exists "${XGCCPATH}/gcc"; then + HOSTCC="${XGCCPATH}/gcc" +elif program_exists gcc; then HOSTCC=gcc elif program_exists cc; then HOSTCC=cc @@ -64,6 +66,20 @@ else die "no host compiler found" fi +# Look for a C++ compiler (for kconfig's qconf), but don't fail if there is +# none, just set the compiler to false(1) which will break early enough if +# used while being less confusing than errors about "g not found" when +# "$HOSTCXX -g" evaluates to "-g" and make drops the leading dash. +if program_exists "${XGCCPATH}/g++"; then + HOSTCXX="${XGCCPATH}/g++" +elif program_exists g++; then + HOSTCXX=g++ +elif program_exists c++; then + HOSTCXX=c++ +else + HOSTCXX=false +fi + # try to find the core count using various methods CORES="$(getconf _NPROCESSORS_ONLN 2>/dev/null)" if [ -z "$CORES" ]; then @@ -87,6 +103,7 @@ cat <