#!/bin/bash

source /opt/modules/init/bash
module load intel/2013sp1
module load hdf5/1.8.11
module load szip/2.1
module load netcdf/4.1.3

set -xuve

LOCAL=$(pwd)
DST=$( echo ${LOCAL}/../.. )
DIR_UUID=/scratch/cfu/opt/uuid-1.6.2/intel-13
DIR_UDUNITS=/scratch/cfu/opt/udunits-2.1.24/intel-13
DIR_NETCDF=/scratch/cfu/opt/netcdf-4.1.3/intel13
DIR_HDF5=/scratch/cfu/opt/hdf5-1.8.8

export CC=icc
export CFLAGS='-fpic -O3 -ip -no-prec-div -static'

export CPP='icc -E'
export CPPFLAGS='-DpgiFortran'

export CXX=icpc
export CXXFLAGS='-O3 -ip -no-prec-div -static'
export CXXCPP='icpc -E'

export F77=ifort
export FFLAGS='-fpic -O3 -ip -no-prec-div -static'

export FC=ifort
export FCFLAGS='-g'

set +e
make clean
set -e
./configure --prefix=$DST --with-netcdf=$DIR_NETCDF --with-hdf5=$DIR_HDF5 --with-udunits2=$DIR_UDUNITS --with-uuid=$DIR_UUID
make
make install

