util/crossgcc/buildgcc: Fix detection of GNAT on recent versions

gnatgcc is deprecated and in recent GCC releases its purpose is
fulfilled by the gcc binary. In case of a deprecated gnatgcc version is
installed, it doesn't provide the expected output and hostcc_has_gnat1()
fails. In this case, just set the value of CC to gcc.

It's still required to install GNAT in addition to GCC.

Change-Id: I730bdfda81268d10bd2a41ef5cb4e3810b76a42c
Signed-off-by: Felix Singer <felixsinger@posteo.net>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/78215
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Martin L Roth <gaumless@gmail.com>
This commit is contained in:
Felix Singer 2023-10-04 03:10:52 +00:00 committed by Martin L Roth
parent 750d171ba8
commit c374dee8b6
1 changed files with 10 additions and 0 deletions

View File

@ -1080,7 +1080,17 @@ if [ -n "$CC" ]; then
fi
else
if searchtool gnatgcc "Free Software Foundation" nofail > /dev/null; then
# gnatgcc is deprecated and in recent GCC releases its purpose is
# fulfilled by the gcc binary. In case of a deprecated gnatgcc
# version is installed, it doesn't provide the expected output and
# hostcc_has_gnat1() fails. In this case, just set the value of CC
# to gcc.
# TODO: Remove this whole branch when time is appropriate as the
# second branch fulfills our needs.
CC=gnatgcc
if ! hostcc_has_gnat1; then
CC=gcc
fi
elif searchtool gcc "Free Software Foundation" nofail > /dev/null; then
CC=gcc
else