buildgcc: Be less restrictive when trying to build GNAT

It turned out that newer GNAT versions can build our current (5.3.0)
GNAT without bootstrapping. So adapt the version enforcement.

Change-Id: Ie7189e8bcadeee56cf5c2172e8c0ae7cd534685a
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/17706
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
diff --git a/util/crossgcc/buildgcc b/util/crossgcc/buildgcc
index d64b687..97c38b8 100755
--- a/util/crossgcc/buildgcc
+++ b/util/crossgcc/buildgcc
@@ -211,6 +211,10 @@
 	echo "${GCC_VERSION}" | cut -d. -f1
 }
 
+buildcc_minor() {
+	echo "${GCC_VERSION}" | cut -d. -f2
+}
+
 buildcc_version() {
 	echo "${GCC_VERSION}" | cut -d. -f1-2
 }
@@ -237,9 +241,14 @@
 
 check_gnat() {
 	if hostcc_has_gnat1; then
-		if [ "$(hostcc_version)" != "$(buildcc_version)" -a "${BOOTSTRAP}" != "1" ]; then
+		if [ \( "$(hostcc_major)" -lt "$(buildcc_major)" -o \
+			\( "$(hostcc_major)" -eq "$(buildcc_major)" -a \
+			   "$(hostcc_minor)" -lt "$(buildcc_minor)" \) \) \
+			-a \
+			"${BOOTSTRAP}" != "1" ]; \
+		then
 			printf "\n${RED}ERROR:${red} Building the Ada compiler (gnat $(buildcc_version)) "
-			printf "with a different host compiler\n       version ($(hostcc_version)) "
+			printf "with an older host compiler\n       version ($(hostcc_version)) "
 			printf "requires bootstrapping (-b).${NC}\n\n"
 			HALT_FOR_TOOLS=1
 		fi