1.
wget http://ftp.gnu.org/gnu/gcc/gcc-4.9.4/gcc-4.9.4.tar.gz
2.
tar -zxvf gcc-4.9.4.tar.gz
3.
cd gcc-4.9.4
4.
./contrib/download_prerequisites
5.
cd ..
mkdir build_gcc_4.9.4
6.
cd build_gcc_4.9.4
7.
../gcc-4.9.4/configure --enable-checking=release --enable-languages=c,c++ --disable-multilib
8.
make -j20
make install
9.
/usr/sbin/update-alternatives --install /usr/bin/gcc gcc /usr/local/bin/x86_64-unknown-linux-gnu-gcc-4.9.4 40
/usr/sbin/update-alternatives --install /usr/bin/g++ g++ /usr/local/bin/g++ 40
10.
vi /etc/profile
export LD_LIBRARY_PATH=/usr/local/lib64:$LD_LIBRARY_PATH
export LD_RUN_PATH=/usr/local/lib64:$LD_RUN_PATH
source /etc/profile
11.
echo "/usr/local/lib64" >> /etc/ld.so.conf
12.
gcc --version
------------------------------