smalltalk
author Claus Gittinger <cg@exept.de>
Mon, 27 Apr 1998 10:04:30 +0200
changeset 280 f267c84f06ac
parent 278 ec63b8666cde
child 281 3c2e6f8ca288
permissions -rwxr-xr-x
*** empty log message ***

#!/bin/sh

# $Header$
#
#
# startup script for smalltalk
# actually, simply calls stx, passing all arguments.
#

# In previous versions, smalltalk used to be the executable itself.
# This lead to problems on systems, where things like LD_LIBRARY_PATH
# should be set in advance. 
# Now, here is a place to do such things ...

#
# -x name specifies an explicit executable
#         to avoid executing another stx from some directory along the PATH
#         (i.e to force use: ./smalltalk -x ./stx)
#
# -X name specifies an explicit path to the stx executable 
#         to avoid executing another stx from some directory along the PATH
#         (i.e to force use: ./smalltalk -X .)
#	  [almost the same as above]
#
# -ldd    show ldd-output (to debug, which libs are loaded)
#
# all other args go to stc & the user classes
#

STX=stx

if [ "$1" = "-x" ]
then
    shift
    STX=$1
    shift
fi

if [ "$1" = "-X" ]
then
    shift
    STX=$1/stx
    shift
fi

if [ "$1" = "-ldd" ]
then
    shift
    DEBUGLIB="yes"
fi

#
#
# some have Xlibs in /usr/openwin/lib ...
#
if [ -d /usr/openwin/lib ]
then
    if [ "$LD_LIBRARY_PATH" != "" ]
    then
	LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/openwin/lib:/usr/local/lib/smalltalk/lib
    else
	LD_LIBRARY_PATH=/usr/openwin/lib:/usr/local/lib/smalltalk/lib
    fi
else
    if [ "$LD_LIBRARY_PATH" != "" ]
    then
	LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib/smalltalk/lib
    else
	LD_LIBRARY_PATH=/usr/local/lib/smalltalk/lib
    fi
fi

#
# my own libs may be found in STX_LIBDIR/lib
# STX_LIBDIR is to be set to the top of the smalltalk installation
# (i.e. where all the .rc files are located)
#

if [ "$STX_LIBDIR" != "" ]
then
    if [ "$STX_LIBDIR" != "/usr/local/smalltalk" ]
    then
        LD_LIBRARY_PATH=$STX_LIBDIR/lib:$LD_LIBRARY_PATH
    fi
fi

LD_LIBRARY_PATH=.:./lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH

#
# debugging which stx & shared libs are used ...
#
if [ "$DEBUGLIB" = "yes" ]
then
  if [ "$STX" = "stx" ]
  then
    if [ -f stx ]
    then
	whichOne=`/bin/sh -c "type stx"`
        if [ "$whichOne" != "stx is ./stx" ]
	then
	    echo "************* WARNING the executed" $whichOne
	    echo "************* (may not be appropriate for used shared libs)"
	    echo "************* Try './smalltalk -ldd' for more details"
	    echo "************* or force the local stx to be used with"
	    echo "************* './smalltalk -x ./stx'"
	    echo
	fi
    fi

    echo "used LD_LIBRARY_PATH is " $LD_LIBRARY_PATH
    ldd -r $STX
  fi
fi

PATH=$PATH:.
export PATH
exec $STX $*