From 0769b34a23107c6e82683f72fe38ccea3006fd52 Mon Sep 17 00:00:00 2001 From: Sebastian Leonhardt Date: Tue, 19 May 2020 00:21:41 +0200 Subject: fix configure script failing on gcc version numbers There were two problems on my system: * MinGW-gcc returns version "7.3-win32" => the "-win32"-part must be stripped off * gcc -dumpversion returns only the major version number => use both -dumpfullversion and -dumpversion (in this order) as described here: https://stackoverflow.com/questions/45168516/gcc-7-1-1-on-fedora-26-dumpversion-now-only-includes-major-version-by-default Change-Id: I74fa1c572426aab2525a00a80170d859c166e31c --- tools/configure | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/tools/configure b/tools/configure index eb426ec0d0..585eadd357 100755 --- a/tools/configure +++ b/tools/configure @@ -4694,17 +4694,20 @@ if [ -z "$gccver" ]; then echo "[WARNING] checks we want now." else - # gccver should now be "3.3.5", "3.4.3", "2.95.3-6" and similar, but don't - # DEPEND on it - - num1=`echo $gccver | cut -d . -f1` - num2=`echo $gccver | cut -d . -f2` + # convert gcc version to a number (major*100 + minor). + # Newer compilers may only return the major number, so we neen to fetch the + # version using -dumpfullversion. MinGW compilers may return names like + # "7.3-win32", so me must strip off the last part. + gccver2=`$CC -dumpfullversion -dumpversion | cut -d "-" -f1`; + num1=`echo $gccver2 | cut -d . -f1` + num2=`echo $gccver2 | cut -d . -f2` gccnum=`(expr $num1 "*" 100 + $num2) 2>/dev/null` # This makes: # 3.3.X => 303 # 3.4.X => 304 # 2.95.3 => 295 + # 7.3-win32 => 703 echo "Using $CC $gccver ($gccnum)" -- cgit v1.2.3