#!/usr/bin/env bash

# ##############################################################################
#
# Amanzi HDF5 Configuration 
#
# ##############################################################################

print_usage()
{
    echo ""
    echo "Usage: $0 [-h] [prefix_path]"
    echo ""
    echo "OPTIONS"
    echo "-h        Print this message and exit"
    echo ""
    echo "If prefix path is not passed in, the default will be ${HOME}/hdf5"
    echo ""
    echo ""
}


# Parse the command line
help_flag=
if [ $# -ne 0 ]; then
    args=$@
    help_flag=`expr match "${args}" '\(-h\)'`

    if [ -n "${help_flag}" ]; then
        print_usage
        exit 0
    fi
fi

prefix_path="${HOME}/hdf5"
if [ $# -ne 0 ]; then
    prefix_path="$1"
fi

echo ""
echo "PREFIX=${prefix_path}"

# Simple configure 
#  Build without Fortran, with MPI, production mode and largefiles (>2Gb)

# Set CC and CXX
export CC=mpicc
export CXX=mpic++

./configure --prefix=${prefix_path}\
            --disable-fortran \
            --enable-production \
            --enable-largefile \
            --enable-parallel 
