I need to do this to use thermocalc tq on my linux computer (debian squeeze).
I think I downloaded and untarred (I had these on my computer from previous time)
gcc-fortran-4.1.2.tar.gz (not sure this is needed — I think other folder contains everything!?)
2) Install prerequisites
3) Make a new directory in which you will compile gcc (first trick you can learn from reading the documentation — unlike most other packages it is not intended to build gcc in the src directory)
enter DIR and run
/blah/blah/gcc-4.1.2/configure --prefix=/opt/gcc412 --program-suffix=412 --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --disable-libunwind-exceptions --enable-__cxa_atexit --disable-multilib
(ALL ONE LINE)
5) Avoid a bug
then edit the make file to remove error about makeinfo
MAKEINFO = /blah/missing makeinfo
needs to be changed to (make sure you actually have makeinfo! which is in texinfo package I think)
MAKEINFO = makeinfo
6) Compile and install
I think after that you can just compile with make or make all
More sophisticated things are possible build gcc, to bootstrap the compiler. I don’t think this is necessary for what I need.
Making destination be /opt means that gcc should not appear in the PATH with higher priority than /usr/bin, as will happen if you place in /usr/local. Suffix of 412 means you will get binaries with different name than gcc so it should not allow any confusion to occur.