#! /bin/csh
#
#
# TJH : I used nco-4.2.1 

unset CC
unset FC
unset F77
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 F77
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 F77 /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}"
else   
   mkdir ${PREFIX}
   echo "Installing into ${PREFIX}"
endif

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

# UDUNITS_PATH

./configure CC=${CC} CXX=${CXX} F77=${F77} \
   NETCDF_INC=/Users/thoar/gnu_4.5.0/include \
   NETCDF_LIB=/Users/thoar/gnu_4.5.0/lib \
   --disable-ncoxx \
   --disable-ncap2 \
   --disable-dependency-tracking \
   --prefix=${PREFIX} || exit 1

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