#! /bin/csh
#
# TJH: I installed HDF5 specifically so I could install netCDF4 ...
# The netCDF INSTALL document had a little section that I am repeating
# because it indicates where I got the source:
#
# "2.2 Building NetCDF With HDF5
# =============================
# 
# If you want to use the HDF5 storage format, you must have the HDF5
# 1.8.6 release. You must also have the zlib compression library, version
# 1.2.5. Both of these packages are available from the netCDF-4 ftp site
# at `ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf-4'."
#
# Having repeated that ... the newest version was actually something like 1.8.8,
# so I am using HDF 1.8.8

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 CC=${CC} FC=${FC} F90=${F90} CXX=${CXX} \
            CPPFLAGS="-gdwarf-2 -I/Users/thoar/gnu_4.5.0/include" \
            LDFLAGS="-gdwarf-2 -L/Users/thoar/gnu_4.5.0/lib" \
            FFLAGS="-gdwarf-2" \
            CFLAGS="-gdwarf-2" \
            --enable-fortran \
            --enable-cxx \
            --enable-production \
            --prefix=${PREFIX} || exit 1

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

echo "Finished at "`date`

