#! /bin/csh
#
#
# Scott ... The following assumes you have compiled and installed netCDF
#           into /home/grad/sgoddard/netcdf   
#
# I would execute this script in the following way (if your SHELL is tcsh)
#
# csh Build_R_scott.csh |& tee my.build.log
#
# This will capture the output and stuff it into a file called my.build.log,
# and it will also get printed to the screen. (You can also then send me the 
# file so I can take a peek at it.)
# Good luck -- Tim

setenv PREFIX /home/grad/sgoddard/R
setenv NETCDF /home/grad/sgoddard/netcdf

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

make clean
make distclean

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

./configure R_PAPERSIZE=letter \
            CPPFLAGS="-I${NETCDF}/include" \
             LDFLAGS="-L${NETCDF}/lib" \
            --enable-BLAS-shlib \
            --with-libpng \
            --with-tcltk \
            --with-jpeglib \
            --disable-R-profiling \
            --disable-memory-profiling \
            --prefix=${PREFIX} || exit 1

make              || exit 2
make check        || exit 3
make dvi          || exit 4
make pdf          || exit 5
make info         || exit 6
make install      || exit 7
make install-dvi  || exit 8
make install-info || exit 9
make install-pdf  || exit 10

exit

R CMD INSTALL --configure-args="-with-netcdf_incdir=${NETCDF}/include -with-netcdf_libdir=${NETCDF}/lib" ncdf_1.6.tar.gz
