#! /bin/bash


# Run this script as root to install netcdf 4.3.2 using gnu compilers

# mandaroty requirement: 
# openmpi installed in /share/apps/openmpi-1.8.5/gcc/
CC=/share/apps/openmpi-1.8.5/gcc/bin/mpicc 
CXX=/share/apps/openmpi-1.8.5/gcc/bin/mpicc 
FC=/share/apps/openmpi-1.8.5/gcc/bin/mpif90  

yum install zlib-devel.x86_64
yum instal hdf5-openmpi-devel.x86_64
yum install hdf5-devel.x86_64

#CC=mpicc 
#CXX=mpicc 
#FC=mpif90  

mkdir /share/apps/configrepo

####netcdf
#First, make sure netcdf is installed in /share/apps/netcdf

cd /share/apps/configrepo
mkdir /share/apps/configrepo/install_netcdf_gnu
cd /share/apps/configrepo/install_netcdf_gnu
wget http://www2.fizik.usm.my/configrepo/howto/netcdf/netcdf-4.3.3.1.tar.gz
tar -zxvf netcdf-4.3.3.1.tar.gz 
cd netcdf-4.3.3.1
./configure --prefix=/share/apps/netcdf/4.3.3.1 CC=$CC CXX=$CXX FC=$FC --enable-static --enable-shared --enable-netcdf-4 --enable-parallel-tests --enable-dynamic-loading 
#--disable-netcdf-4

make

make check

make install
#### end of netcdf
