Better gcc compiler version check. Previous check failed for gcc-10 - #253
Conversation
There was a problem hiding this comment.
Can you please describe the motivation for this change?
A couple of comments about your approach:
- the $(...) syntax is specific to
bashorzsh(maybeksh, I forget). Specifically, it is not supported bysh. This is confused by the fact thatshmay actually be a link to a newer shell on some systems. Unless this is explicitly abashscript, this change may not work on some platforms. - regexes are powerful but hard to grok. It’s clear from your expected values what you think it should do but less clear how or that it does it. What value does this change provide over what is there? Why is it better?
- gcc has adopted the modern philosophy of rapidly increasing major numbers. I think 10 may be available. How will this logic support 2-digit major versions?
- what I expected was a numerical comparison rather than a lexical one. That seems more robust and easier to comprehend. Did you consider that, and if so, what were your reasons for rejecting it?
I understand that some older gcc version gave us only two version pieces: major.minor |
| # if minor or patch are 1 digits remove the '.' and add a 0 | ||
| # if there is no patch part, so the resulting version is 3 or 4 digits only add 00 ath the end | ||
| # This is to change 4.7.1 in 040701 or 3.4 in 030400 | ||
| GCCVER=`$CC -dumpversion | sed -e 's|\.\([[0-9]][[0-9]]\)|\1|g' -e 's|\.\([[0-9]]\)|0\1|g' -e 's|^[[0-9]]\{3,4\}$|&00|'` |
There was a problem hiding this comment.
This doesn't work for MacOS 10.13 (should it? does it need to?
Goliath:~ jwmelto$ gcc -dumpversion | sed -e 's|\.\([[0-9]][[0-9]]\)|\1|g' -e 's|\.\([[0-9]]\)|0\1|g' -e 's|^[[0-9]]\{3,4\}$|&00|'
4.2.1
| GCCVER=`$CC -dumpversion | sed -e 's|\.\([[0-9]][[0-9]]\)|\1|g' -e 's|\.\([[0-9]]\)|0\1|g' -e 's|^[[0-9]]\{3,4\}$|&00|'` | |
| GCCVER=`$CC -dumpversion | awk -F. '{printf "%02d%02d%02d", $1,$2,$3}'` |
or use ax_compare_version as @blast007 suggested
|
That looks familiar. Good change. |
|
Now I know why this looks familiar. See #236 |
No description provided.