#!/bin/sh

# $Id: psprocess.in,v 1.20 2011/02/09 17:41:34 ruiliu Exp $

############################################################################
#
#                    University of Illinois/NCSA
#                        Open Source License
# 
#        Copyright(C) 2002-2011, The Board of Trustees of the
#            University of Illinois. All rights reserved.
#
#                            Developed by:             
# 
#                        The PerfSuite Project
#           National Center for Supercomputing Applications 
#             University of Illinois at Urbana-Champaign
# 
#                  http://perfsuite.ncsa.uiuc.edu/
# 
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the "Software"),
# to deal with the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense, 
# and/or sell copies of the Software, and to permit persons to whom the 
# Software is furnished to do so, subject to the following conditions:
# 
# + Redistributions of source code must retain the above copyright notice, 
#   this list of conditions and the following disclaimers.
# + Redistributions in binary form must reproduce the above copyright
#   notice, this list of conditions and the following disclaimers in
#   the documentation and/or other materials provided with the distribution.
# + Neither the names of The PerfSuite Project, NCSA/University of Illinois
#   at Urbana-Champaign, nor the names of its contributors may be used to
#   endorse or promote products derived from this Software without specific
#   prior written permission.
# 
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 
# CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
# DEALINGS WITH THE SOFTWARE.
############################################################################

# This file was automatically generated during 
# PerfSuite configuration.

PS_VERSION=1.1.4
PS_TCLLIBDIR=/usr/share/perfsuite/tcllib
PS_XMLDIR=/usr/share/perfsuite/xml
PS_DTDDIR=/usr/share/perfsuite/dtds
TDOMLIBDIR=/usr/local/lib

export PS_VERSION PS_TCLLIBDIR PS_XMLDIR PS_DTDDIR TDOMLIBDIR

PSPROCESS_MODE=${PSPROCESS_MODE:-tcl}

if test "x$1" = "x--tcl"; then
    if test ! -f /usr/share/perfsuite/tclbin/psprocess/psprocess.tcl; then
        echo "Error: psprocess (Tcl version) not available in this installation"
        exit 1
    fi
    PSPROCESS_MODE=tcl
    shift
elif test "x$1" = "x--java"; then
    if test ! -f /usr/share/perfsuite/javalib/psprocess.jar; then
        echo "Error: psprocess (Java version) not available in this installation"
        exit 1
    fi
    PSPROCESS_MODE=java
    shift
fi

case $PSPROCESS_MODE in
    tcl)  exec /usr/bin/tclsh8.6 /usr/share/perfsuite/tclbin/psprocess/psprocess.tcl "$@" ;;
    java) exec   -classpath /usr/share/perfsuite/javalib/psprocess.jar:/usr/share/perfsuite/javalib/perfsuite.jar:/usr/share/perfsuite/javalib/resources:. PSProcess "$@" ;;
    *) echo "Error: unrecognized version selection."
       echo 'Please specify "--tcl" or "--java" as the first option to psprocess' 
       echo 'or set the environment variable PSPROCESS_MODE to "java" or "tcl".'
       exit 1 ;;
esac
