#!/bin/sh
TAUROOT=/home/users/sameer/fresh/f/head/release/tau2
MACHINE=default

LIBDIR=${TAUROOT}/${MACHINE}/lib
JARDIR=${TAUROOT}/${MACHINE}/lib

JARS=${JARDIR}/paraprof.jar:${JARDIR}/perfdmf.jar:${JARDIR}/tau-common.jar:${JARDIR}/vis.jar:${JARDIR}/jogl.jar:${JARDIR}/jatha.jar:${JARDIR}/jgraph.jar:${JARDIR}/xerces.jar:${JARDIR}/jargs.jar:${JARDIR}/batik-combined.jar:${JARDIR}/jfreechart-1.0.12.jar:${JARDIR}/jcommon-1.0.15.jar:${JARDIR}/jython.jar

# Check machine type for a heap space boost
MEMORY=-Xmx800m

machine=`uname -m`
if [ "x$machine" = "xx86_64" ] ; then
    MEMORY=-Xmx2000m
fi
JAVA_VERSION=`java -version 2>&1 | head -1 | cut -d '.' -f2`
if [ "x$JAVA_VERSION" = "x4" ] ; then
        echo ""
        echo "Java 1.5 or newer is required to run perfdmf_configure."
        echo "Please update your Java SDK to a newer version to use the newest version."
        echo "You will still be able to use the version from the TAU v2.19.1 release."
        echo ""
        if [ ! -d ${TAUROOT}/${MACHINE}/bin/bin-1.4 ] ; then
                ${TAUROOT}/${MACHINE}/bin/configure-1.4
        fi
  :%      ${TAUROOT}/${MACHINE}/bin/bin-1.4/perfdmf_configure

        exit 0
fi
java $MEMORY \
-Dderby.system.home=${HOME}/.ParaProf \
-cp ${JARS} \
edu.uoregon.tau.perfdmf.loader.PhaseConverter \
"$@"
