Add verification on gcc version and command.
Most importantly, if version is specified and command is not, check for
g++-$version and failing that, check if g++ -dumpversion returns the
version we've asked about.
Patch from Moritz Hassert.
Addresses #4667.
[SVN r65633]