Browse Source

Handle some compiler versions containing a dash

The version reported by e.g. x86_64-w64-mingw32-gcc on Debian bullseye
looks like:
  gcc version 10-win32 20210110 (GCC)

This ends up with detect-compiler failing with:
  ./detect-compiler: 30: test: Illegal number: 10-win32

This change removes the two known suffixes known to exist in GCC versions
in Debian: -win32 and -posix.

Signed-off-by: Mike Hommey <mh@glandium.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
main
Mike Hommey 2 years ago committed by Junio C Hamano
parent
commit
382a946414
  1. 10
      detect-compiler

10
detect-compiler

@ -17,7 +17,15 @@ get_family() { @@ -17,7 +17,15 @@ get_family() {
}

get_version() {
get_version_line | sed 's/^.* version \([0-9][^ ]*\).*/\1/'
# A string that begins with a digit up to the next SP
ver=$(get_version_line | sed 's/^.* version \([0-9][^ ]*\).*/\1/')

# There are known -variant suffixes that do not affect the
# meaning of the main version number. Strip them.
ver=${ver%-win32}
ver=${ver%-posix}

echo "$ver"
}

print_flags() {

Loading…
Cancel
Save