easily.
download and extract the gcc-2.95 (I use 2.95.3 (it's the most bug free of the series))
configure and build it. The way I do it is: ( I should point out that it is recommended to use a build directory instead of building in the top source directory. to do this, cd to the gcc-2.95 directory, do mkdir build, cd build, then execute the configure command below like this:
../configure etc... (notice the two .. before the / in the command)).
./configure --prefix=/opt/gcc-2.95.3 --enable-shared --with-languages=c,c++ --enable-threads=posix --enable-__cxa_atexit
make
make install
one thing you might want is to disable shared (--disable-shared) libraries if you don't want to have to put the libstdc++ libraries and such in your library path (and to build static executables, which are easier to manage if they have to be run on another computer with a different distro or something) but it will make the size of the binary a little bigger.
to use the new compiler, just modify your path to point to the new one first:
Code:
export PATH=/opt/gcc-2.95.3/bin:$PATH
then type in:
to verify that it is your new installation of gcc instead of the default 3.3 compiler
or
Code:
export CC=/opt/gcc-2.95.3/bin/gcc
if your gonna compile apps with it, make this symlink
Code:
ln -s /opt/gcc-2.95.3/bin/gcc /opt/gcc-2.95.3/bin/cc