diff options
| author | Junio C Hamano <gitster@pobox.com> | 2023-05-09 16:45:45 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2023-05-09 16:45:45 -0700 |
| commit | ab828cde84c7cafb9942048d8e24ace9c625a041 (patch) | |
| tree | 0fea0df4d56bbe1cda2c940ded0bd91cc9737dae | |
| parent | 620e92b8454d2569b9ad9a2070fd2edea99895cc (diff) | |
| parent | 382a9464145de7c1d4f89a161184686cf8685886 (diff) | |
| download | git-ab828cde84c7cafb9942048d8e24ace9c625a041.tar.gz | |
Merge branch 'mh/fix-detect-compilers-with-nondigit-versions'
The detect-compilers script to help auto-tweaking the build system
had trouble working with compilers whose version number has extra
suffixes. The script has been taught that certain suffixes (like
"-win32" in "gcc 10-win32") can be safely stripped as they share
the same features and bugs with the version without the suffix.
* mh/fix-detect-compilers-with-nondigit-versions:
Handle some compiler versions containing a dash
| -rwxr-xr-x | detect-compiler | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/detect-compiler b/detect-compiler index 50087f5670..a87650b71b 100755 --- a/detect-compiler +++ b/detect-compiler @@ -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() { |
