You can control the version of GCC that is invoked with the
GCC_EXEC_PREFIX environment-variable. Refer to
info gcc for more details.
It is actually quite common to have more than one version of a compiler installed on the system at the same time. People who are "cross-compiling" applications (running a compiler on machine-X that generates code for machine-Y) do this all the time.
It can also be useful to read the section about
specs files. The
info node under "spec files" says this:
Quote:
gcc is a driver program. It performs its job by invoking a sequence of other programs to do the work of compiling, assembling and linking. GCC interprets its command-line parameters and uses these to deduce which programs it should invoke, and which command-line options it ought to place on their command lines. This behavior is controlled by "spec strings." In most cases there is one spec string for each program that GCC can invoke, but a few programs have multiple spec strings to control their behavior. The spec strings built into GCC can be overridden by using the -specs= command-line switch to specify a spec file.
"Spec files" are plaintext files that are used to construct spec strings. They consist of a sequence of directives separated by blank lines....
|