#! /bin/sh
# Wrapper script to start up Tcl/Tk 8.x shell with tcl blend
if test "0" = "1" ; then
if (uname -s | grep MINGW > /dev/null) ; then
    no=op ;
else
    echo "Must be run from msys shell" ;
    exit 1 ;
fi
fi

# Do not edit this script unless it is called jtclsh.in.
# tclBlend/unix/configure takes jtclsh.in, substitutes the @xx@
# fields and creates jtclsh.

# Author:  Christopher Hylands
# Version: @(#) jtclsh.in 1.9 08/07/98
#
# Copyright (c) 1997-1998 The Regents of the University of California.
# 	All Rights Reserved.
# Copyright (c) 2000 Moses DeJong
#
# Permission is hereby granted, without written agreement and without
# license or royalty fees, to use, copy, modify, and distribute this
# software and its documentation for any purpose, provided that the
# above copyright notice and the following two paragraphs appear in all
# copies of this software.
# 
# IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
# FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
# ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
# THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
# 
# THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
# PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
# CALIFORNIA HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,
# ENHANCEMENTS, OR MODIFICATIONS.
# 
# 						PT_COPYRIGHT_VERSION_2
# 						COPYRIGHTENDKEY

# Install prefix and binary prefix for tclblend, defaults to /usr/local
prefix=/usr
exec_prefix=/usr
libdir=/usr/lib64/tcl

# Tcl/Java version number
TCLJAVA_VERSION=1.4.9

# Directory where platform independent files live. This
# includes the .jar files and any .tcl files
XP_TCLJAVA_INSTALL_DIR=${libdir}/tcljava${TCLJAVA_VERSION}

# Directory where platform dependent files (shared libraries) live.
TCLJAVA_INSTALL_DIR=${libdir}/tcljava${TCLJAVA_VERSION}


# Fully qualified path name of wish and tclsh
WISH=/usr/bin/wish8.6
TCLSH=/usr/bin/tclsh8.6

# Setting for CLASSPATH determined by configure
JAVA_CLASSPATH=

# Colon separated list of shared lib directories to search
JAVA_LIB_RUNTIME_PATH=/usr/lib64/jvm/java/lib:/usr/lib64/jvm/java/lib/server:${TCLJAVA_INSTALL_DIR}

# extra shared lib hack
TCLBLEND_LD_PRELOAD=""
TCLBLEND_LD_BIND_NOW=


# Tcl Blend under Linux AWT Workaround! (Required before JDK 1.1.8 from Blackdown)
#
# If you want to use the AWT in Tcl Blend on a Linux system with
# the Blackdown port of the JDK then you should uncomment the
# command you need in the next section. This will preload the
# X toolkit and Motif libs into your Tcl Blend shell so
# that you will not get a "no awt in shared lib path"
# error when displaying a Java GUI component.
# Note: this is only required before Blackdown version 1.1.8

# If you are using Motif then uncomment this line

#TCLBLEND_LD_PRELOAD="${TCLBLEND_LD_PRELOAD} libXm.so libXpm.so libXt.so libSM.so libICE.so libXext.so libX11.so"

# If you are using LessTif then uncomment this line

#TCLBLEND_LD_PRELOAD="${TCLBLEND_LD_PRELOAD} libXt.so libXm.so libXext.so"




#######################################################################
# You probably don't want to edit below here
########################################################################


# Make sure we can find the tclblend directory

if test ! -d ${XP_TCLJAVA_INSTALL_DIR} ; then
    echo "$0: XP_TCLJAVA_INSTALL_DIR was set to ${XP_TCLJAVA_INSTALL_DIR}, which does not exist."
    echo " Please check the tclblend instalation for possible corruption."
    exit 3
fi

# Set up our PATH, LD_LIBRARY_PATH, or SHLIB_PATH
# Note that the directory that contains the Tcl Blend
# shared library appears before the existing path
# that that the install location is  searched before
# the current directory.

if test "$OSTYPE" = "msys"; then
    PATH="${JAVA_LIB_RUNTIME_PATH}:${PATH}"
    export PATH
elif test "`uname -s`" = "HP-UX" ; then
    SHLIB_PATH=${JAVA_LIB_RUNTIME_PATH}:${SHLIB_PATH}
    export SHLIB_PATH
    # Export the Kaffe library path in case we are running Kaffe
    KAFFELIBRARYPATH=${JAVA_LIB_RUNTIME_PATH}:${LD_LIBRARY_PATH}
    export KAFFELIBRARYPATH
else
    LD_LIBRARY_PATH=${JAVA_LIB_RUNTIME_PATH}:${LD_LIBRARY_PATH}
    export LD_LIBRARY_PATH
    # Export the Kaffe library path in case we are running Kaffe
    KAFFELIBRARYPATH=${JAVA_LIB_RUNTIME_PATH}:${LD_LIBRARY_PATH}
    export KAFFELIBRARYPATH
fi    

# Extra shared lib stuff for Unix

if test "$OSTYPE" != "msys"; then

LD_PRELOAD=${TCLBLEND_LD_PRELOAD}
export LD_PRELOAD

LD_BIND_NOW=${TCLBLEND_LD_BIND_NOW}
export LD_BIND_NOW

export TCLBLEND_SHLIB_NAMES

fi

# set up the CLASSPATH environmental variable

if test "${JAVA_CLASSPATH}" != ""; then
    if test "${CLASSPATH}" = ""; then
        CLASSPATH=${JAVA_CLASSPATH}
    else
        CLASSPATH=${JAVA_CLASSPATH}:${CLASSPATH}
    fi
    export CLASSPATH
fi

# Set up TCLLIBPATH which becomes the default setting for the auto_path
# in the Tcl shell. Tcl uses this when doing a "package require java".

if test "$TCLLIBPATH" = ""; then
    TCLLIBPATH=${prefix}/lib
else
    TCLLIBPATH="${prefix}/lib ${TCLLIBPATH}"
fi
export TCLLIBPATH


# If the script is called as jtclsh, then use tclsh8.0, otherwise, use wish8.0
case "`basename $0`" in
    jtclsh) WISH_OR_TCLSH=${TCLSH} ;;
    jwish) WISH_OR_TCLSH=${WISH} ;;
    *)
    echo "The wrapper script must be named jtclsh or jwish."
    exit 3
    ;;
esac

# exec wish of tclsh with the env vars already set up
exec $WISH_OR_TCLSH ${1+"$@"}

