Use correct compiler version flag in the autoconf script
The autoconf script prints used compiler version at the end of the configure script. Solaris native compiler doesn't support --version, and -V has to be used which in turn isn't supported by Gcc/Clang. Detect which version flag has to be used and call $CC with it.
(cherry picked from commit 7eb20800)
Closes #2873 (closed)