#!/bin/sh
#BHEADER**********************************************************************
# Copyright (c) 2008,  Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
# This file is part of HYPRE.  See file COPYRIGHT for details.
#
# HYPRE is free software; you can redistribute it and/or modify it under the
# terms of the GNU Lesser General Public License (as published by the Free
# Software Foundation) version 2.1 dated February 1999.
#
# $Revision$
#EHEADER**********************************************************************

#=============================================================================
# This script prints the hypre version number, date, and time.
# It currently inspects the 'configure' file for this info.
#=============================================================================

case $1 in
    -h|-help) 
        echo 
        echo "$0 [options]"
        echo "  -h|-help       - prints usage information"
        echo "  -number        - prints the version number"
        echo "  -date          - prints the version day"
        echo "  -time          - prints the version day and time"
        echo 
        exit;;
esac

# NOTE: In order to call this script from other directories,
# we need to get the path info from the command line
VPATH=`dirname $0`
VFILE="${VPATH}/../configure"
NUMBER=`grep "HYPRE_VERSION=" $VFILE | cut -d= -f 2 | sed 's/"//g'`
DATE=`grep "HYPRE_DATE=" $VFILE | cut -d= -f 2 | sed 's/"//g'`
TIME=`grep "HYPRE_TIME=" $VFILE | cut -d= -f 2 | sed 's/"//g'`

# this is the no-option print line
VPRINT=`echo hypre Version $NUMBER Date: $DATE`

# this defines the print lines for the various options
case $1 in
    -number)
	VPRINT=$NUMBER;;
    -date)
	VPRINT=$DATE;;
    -time)
	VPRINT=$TIME;;
esac

# print the version information
echo $VPRINT
