summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Georgi <pgeorgi@google.com>2020-07-06 16:37:33 +0200
committerPatrick Georgi <pgeorgi@google.com>2020-07-08 08:53:41 +0000
commit793bf7e605e7451db47af0b47d7135767549a09c (patch)
treed00283957fee63841b7aa076cf06a9bf5f8a09a4
parentfca0cba6a15176002bbeadd4e41a7634928481de (diff)
downloadcoreboot-793bf7e605e7451db47af0b47d7135767549a09c.tar.xz
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 <pgeorgi@google.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/43144 Reviewed-by: Nico Huber <nico.h@gmx.de> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
-rwxr-xr-xutil/xcompile/xcompile19
1 files changed, 18 insertions, 1 deletions
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 <<EOF
XGCCPATH:=${XGCCPATH}
IASL:=${IASL}
HOSTCC?=${HOSTCC}
+HOSTCXX?=${HOSTCXX}
CPUS?=${CORES}
EOF