#!/bin/csh -f

#      ./configure
#source .configure
if ( ! $?ARCH ) setenv ARCH `uname`
setenv GFIODIR /home/dao_ops/GEOSdas-2_1_4/GEOSadas

if ( ! $?ARCH ) setenv ARCH `uname`
set fname = stats

if(-e ${fname}_${ARCH}.x ) /bin/rm ${fname}_${ARCH}.x
if(-e test.F )             /bin/rm test.F
if(-e test.o )             /bin/rm test.o

cat $fname.F alias.F > test.F


# SGI Compilation
# ---------------
if( ${ARCH} == 'IRIX64' ) then


     f90   -c        -extend_source -O3  -64 -r8 -i4 -mips4 -I$GFIODIR2 -I. $GFIODIR2/gfioutil.f
     f90   -o test.x -extend_source -O3  -64 -r8 -i4 -mips4 -I. test.F gfioutil.o \
           -L$GFIODIR/$ARCH/lib -lGMAO_gfio_r8 \
           -L$BASEDIR/lib       -lmfhdf -ldf -lz -lm

     if(-e gfioutil.o ) /bin/rm gfioutil.o
endif

# Linux Compilation
# -----------------
if( ${ARCH} == 'Linux' ) then
     set gfio = GMAO_gfio_r4
     set cfio = MAPL_cfio_r4
     set hdf  = GMAO_mfhdf3

     ifort -o test.x -extend_source -O3 -convert big_endian -I. test.F \
           -L$GFIODIR/$ARCH/lib -l$cfio -l$gfio -l$hdf \
           -L$BASEDIR/$ARCH/lib -lmfhdf -ldf -lhdfjpeg -lhdfz -lsz
endif


if(-e test.F ) /bin/rm test.F
if(-e test.o ) /bin/rm test.o
/bin/mv test.x ${fname}_${ARCH}.x
             ./${fname}_${ARCH}.x
