After some pains I was finally able to build me a gcc 4.9.3 (I don't have root on the machine I'm working on, and Fedora 22 doesn't package gcc 4.9 anyway). And it even works, i.e. using it to compile simple programs results in executables which do their job.
However... what happens when I want to use it with packages that have autotools configure scripts, or CMake? I probably need to set some environment variables to let them know they should prefer the new compiler - and its associated include & library files. I guess I can set
export CC=$HOME/opt/gcc/bin/gcc export CXX=$HOME/opt/gcc/bin/g++
but I'm sure there are a few other environment variables settings to make. What are they?