Dependencies
First download the dependencies gmp-5.0.2, mpfr-3.0.1, mpc-0.9, ppl-0.11.2, cloog-ppl-0.15.11 (see http://gcc.gnu.org/install/prerequisites.html)
gmp
./configure --enable-cxx
make
make check
sudo make install
mpfr
./configure --with-gmp=/usr/local
make
make check
sudo make install
mpc
./configure --with-gmp=/usr/local
make
make check
sudo make install
ppl
./configure --with-gmp=/usr/local
make
make check
sudo make install
Grab some coffe, food, go for a stroll, etc. during make, this one takes a while (or at least it does in a VM)
cloog-ppl
./configure --with-gmp=/usr/local --with-ppl=/usr/local
make
make check
sudo make install
gcc
Download gcc (I used gcc-4.5.3), gcc-core, and g++
Then from the PARENT directory of where you extracted gcc:
mkdir gccbuild
cd gccbuild
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
../gcc-4.5.3/configure --enable-languages=c,c++ --with-gmp=/usr/local --with-mpfr=/usr/local --with-mpc=/usr/local --with-ppl=/usr/local --with-cloog=/usr/local
make -j 2
# go to sleep
make check
make install