gfortran Building Procedure (gcc-4.1 based)
gcc-4.0 that comes with Apple's standard DevTools does not include "gfortran",
the GNU fortran 95 compiler. Although its source tree does include one, building
gfortran from Apple's source tree requires some patching to satisfy undefined
references caused by Apple's modifications that broke Language independence.
Moreover, the gfortran source files are not up-to-date and require a lot of
patching to be usable: I had been using the patched versions for sometime but
recently switched to the version from the SVN source tree for gcc-4.1. In order
to make gcc-4.1 coexist with Apple's gcc-4.0, I decided to configure gcc-4.1
to be installed under /usr/local. To build gcc-4.1, first get the source files
from the official SVN site for gcc, cd into the source directory and do the
following:
$ ./configure --prefix=/usr/local --disable-checking --enable-languages=c,c++,f95
$ make
$ mkdir tmp
$ make install DESTDIR=`pwd`/tmp
$ cd tmp
$ su
# chown -R root:wheel usr
# tar -zcvf gcc-4.1.0-bin.tar.gz usr
# exit
This gives you a tarball of gcc-4.1 compiler suite including gcc, g++, and gfortran,
which can be expanded at the root directory to install under /usr/local.
How to Install a Precompiled Binary Package
A binary package is available as an RPM which can be installed using APT/RPM as
$ su
# apt-get update
# apt-get install gcc
# apt-get clean
# exit
Since the package is installed under /usr/local, you can use the gcc-4.1 as
your default compiler suite by putting /usr/local/bin in front of /usr/bin in
your PATH environmental variable.
REMARKS