#! /bin/csh

unset CC
unset FC
unset F90
unset CXX
unset CFLAGS
unset CPPFLAGS
unset FFLAGS
unset F90FLAGS
unset CXXFLAGS
unset ARFLAGS
unset NMFLAGS
unset FPP
unset M4FLAGS
unset LIBS
unset FLIBS
unset FLDFLAGS

unsetenv CC
unsetenv FC
unsetenv F90
unsetenv CXX
unsetenv CFLAGS
unsetenv CPPFLAGS
unsetenv FFLAGS
unsetenv F90FLAGS
unsetenv CXXFLAGS
unsetenv ARFLAGS
unsetenv NMFLAGS
unsetenv FPP
unsetenv M4FLAGS
unsetenv LIBS
unsetenv FLIBS
unsetenv FLDFLAGS

setenv  CC /usr/local/bin/gcc
setenv  FC /usr/local/bin/gfortran
setenv F90 /usr/local/bin/gfortran
setenv CXX /usr/local/bin/g++

setenv PREFIX /Users/thoar/gnu_4.5.0

make clean
make distclean

if ( -d ${PREFIX} ) then
   echo "Installing into ${PREFIX} at "`date`
else   
   mkdir ${PREFIX}
   echo "Installing into ${PREFIX} at "`date`
endif

rm -fv macros.make config.status config.log config.cache

./configure --prefix=${PREFIX} || exit 1

make         || exit 2
make test    || exit 3
make install || exit 4

echo "Finished at "`date`

