#!/usr/bin/csh -exf

setenv MPICH $home/ALL_LIBS/mpich/         
set path=($home/ALL_LIBS/mpich/bin $path)
set path=($home/ALL_LIBS/mpich/lib $path)
set path=($home/ALL_LIBS/mpich/include $path)

setenv HDF5 $home/ALL_LIBS/hdf5                
set path=($home/ALL_LIBS/hdf5/bin $path) 
set path=($home/ALL_LIBS/hdf5/lib/ $path)
set path=($home/ALL_LIBS/hdf5/include/ $path)  

setenv ZLIB $home/ALL_LIBS/zlib                
setenv ZLIBLIB $home/all_libs/lib          
setenv ZLIBINC $home/all_libs/include  
set path=($home/all_libs/lib/ $path)
set path=($home/all_libs/include/ $path)

setenv SZIP $home/ALL_LIBS/szip                    
setenv SZIPLIB $home/ALL_LIBS/szip/lib          
setenv SZIPINC $home/ALL_LIBS/szip/include 


setenv NETCDF $home/ALL_LIBS/netcdf              
set path =($home/ALL_LIBS/netcdf/bin $path)
set path =($home/ALL_LIBS/netcdf/lib $path)  
set path =($home/ALL_LIBS/netcdf/include $path)            
setenv WRFIO_NCD_LARGE_FILE_SUPPORT 1          
setenv LD_LIBRARY_PATH $home/all_libs/lib 
setenv NETCDF_LIB $home/ALL_LIBS/netcdf/lib
setenv NETCDF_INC $home/ALL_LIBS/netcdf/include
#setenv LDFLAGS "-L/home/mostafa/ALL_LIBS/netcdf/lib -L/home/mostafa/ALL_LIBS/hdf5/lib -L/home/mostafa/ALL_LIBS/zlib/lib -L/home/mostafa/ALL_LIBS/szip/lib"
setenv LDFLAGS "-L/home/mostafa/ALL_LIBS/netcdf/lib -L/home/mostafa/ALL_LIBS/hdf5/lib -L/home/mostafa/ALL_LIBS/zlib/lib"
#setenv CPPFLAGS "-I/home/mostafa/ALL_LIBS/netcdf/include -I/home/mostafa/ALL_LIBS/hdf5/include -I/home/mostafa/ALL_LIBS/zlib/include -I/home/mostafa/ALL_LIBS/szip/include"
setenv CPPFLAGS "-I/home/mostafa/ALL_LIBS/netcdf/include -I/home/mostafa/ALL_LIBS/hdf5/include -I/home/mostafa/ALL_LIBS/zlib/include"



cd /home/mostafa/Src/
tar xzvf RegCM-4.6.0.tar.gz
cd RegCM-4.6.0

./configure CC=gcc FC=gfortran --prefix=/home/mostafa/RegCM-4.4.5.9 --with-netcdf=/home/mostafa/ALL_LIBS/netcdf --with-hdf5=/home/mostafa/ALL_LIBS/hdf5 --with-zlib=/home/mostafa/ALL_LIBS/zlib --with-szip=/home/mostafa/ALL_LIBS/szip --with-mpich=/home/mostafa/ALL_LIBS/mpich

# ./configure CC=gcc FC=gfortran --prefix=/home/mostafa/RegCM --with-netcdf-4=/home/mostafa/ALL_LIBS/netcdf --with-szip=/home/mostafa/ALL_LIBS/szip --with-hdf5=/home/mostafa/ALL_LIBS/hdf5

make
make install


rm -rf RegCM-4.6.0

cd ~

# ls -lh

echo "RegCM Finally Installed Successfully"
