#!/bin/sh

. ../../hmpi.version

OUTFILE=$1
TARGET=$2

#Platform information on which HMPI is being built
PLATFORM=`uname -s`
DATE=`date`
VERSION="`uname -r`"

if [ "$PLATFORM" = "AIX" ] ; then
        VERSION="`oslevel`"
fi

if [ "$PLATFORM" = "OSF1" ] ; then
        PLATFORM="Tru64 Unix"
        VERSION="`uname -r` (Rev. `uname -v`)"
fi

#Obtain HMPI information
HMPIINFO="HMPI $_HMPI_VERSION"

#Obtain mpC information
MPCINFO="`mpcc -v`"

#Obtain MPI information
if test -f $MPIDIR/bin/lamd; then
        if test -f $MPIDIR/bin/laminfo; then
                MPIINFO="`laminfo -version lam full`"
        else
                MPIINFO="LAM"
        fi
fi

if test -f $MPIDIR/bin/mpichversion; then
        MPIINFO="`mpichversion | grep "MPICH Version:" | awk '{print $3}'`"
fi

if test -f $MPIDIR/bin/ompi_info; then
        MPIINFO="`ompi_info | grep "Open MPI:"`"
fi

echo 'static char *__hmpi_what_info = "@(#)' \($HMPIINFO/$MPCINFO/$MPIINFO\) $PLATFORM $VERSION $TARGET $DATE '";' > $OUTFILE
