#!/bin/sh
#BHEADER**********************************************************************
# Copyright (c) 2006   The Regents of the University of California.
# Produced at the Lawrence Livermore National Laboratory.
# Written by the HYPRE team, UCRL-CODE-222953.
# All rights reserved.
#
# This file is part of HYPRE (see http://www.llnl.gov/CASC/hypre/).
# Please see the COPYRIGHT_and_LICENSE file for the copyright notice, 
# disclaimer and the GNU Lesser General Public License.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License (as published by the Free
# Software Foundation) version 2.1 dated February 1999.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the IMPLIED WARRANTY OF MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE.  See the terms and conditions of the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# $Revision: 2.4 $
#EHEADER**********************************************************************


#=============================================================================
# This script prints the hypre version number, date, and time by
# grepping the HYPRE_utilities.h file for the HYPRE_Version macro.
#=============================================================================

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}/../HYPRE_config.h"
NUMBER=`grep "PACKAGE_VERSION " $VFILE|cut -d\  -f 3|sed 's/"//g'`
DATE=`grep "PACKAGE_DATE " $VFILE|cut -d\  -f 3|sed 's/"//g'`
TIME=`grep "PACKAGE_TIME " $VFILE|cut -d\  -f 3|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
