These instructions have been reported to work with gm2 grafted onto gcc-4.7.4 and built on Solaris 10/Sparc (sun4u).
1. Install gmp-5.1.2:
Note that configure invokes the Bourne shell /bin/sh; this must be changed to the BASH shell /bin/bash. Bourne shell will not work.
Note that the source Will not compile with cc; requires gcc. (In this example gcc-4.1.2 was used).
$ ./configure SHELL=/bin/bash CFLAGS='-O2 -m64' \ --bindir=/usr/local/bin/64 --libdir=/usr/local/lib/64 --disable-cxx
gmake check requires the following:
export LD_LIBRARY_PATH_64=$PWD/.libs:$LD_LIBRARY_PATH_64
(Vide http://gmplib.org/list-archives/gmp-bugs/2008-July/001084.html)
Replace call to ranlib with echo in libtool.
gmake check passes all tests.
gmake install succeeded.
2. Install mpfr-3.1.2
$ ./configure SHELL=/bin/bash CFLAGS='-O2 -m64' \ --bindir=/usr/local/bin/64 --libdir=/usr/local/lib/64 \ --with-gmp-lib=/usr/local/lib/64 --with-gmp-include=/usr/local/include
Replaced call to ranlib with echo in libtool.
gmake succeeded.
gmake check passed all tests.
gmake install succeeded.
3. Install mpc-1.0.1
$ ./configure SHELL=/bin/bash CFLAGS='-O2 -m64' \ --bindir=/usr/local/bin/64 --libdir=/usr/local/lib/64 \ --with-gmp-lib=/usr/local/lib/64 --with-gmp-include=/usr/local/include
Replaced call to ranlib with echo in libtool.
gmake succeeded.
gmake check passed all tests.
gmake install succeeded.
4. Finally, configuration script for gcc-4.7.4:
$ ../../src/gcc-4.7.4+gm2-git-latest/gm2/gcc-versionno/configure \ --prefix=$HOME/gcc-4.7.4 \ --exec-prefix=$HOME/gcc-4.7.4 --without-gnu-ld \ --with-ld=/usr/ccs/bin/ld --with-gnu-as --with-as=/usr/sfw/bin/gas \ --build=sparc64-sun-solaris2.10 --host=sparc64-sun-solaris2.10 \ --with-mpc-include=/usr/local/include --with-mpc-lib=/usr/local/lib/64 \ --with-mpfr-include=/usr/local/include \ --with-mpfr-lib=/usr/local/lib/64 \ --with-gmp-include=/usr/local/include --with-gmp-lib=/usr/local/lib/64 \ --enable-languages=c,c++,gm2 --disable-bootstrap --enable-checking \ --enable-shared --disable-libitm
Note that to build, you must export the locations of the libraries previously built, despite explicit location given in the configure options. (This is a known bug.)
Note that as per http://blogs.everycity.co.uk/alasdair/2012/12/building-gcc-4-7-2-on-smartos-and-friends --disable-libitm was added to configuration script.
gmake succeeded;
gmake install succeeded.