home *** CD-ROM | disk | FTP | other *** search
- #!/bin/sh
- #
- # $Id: startapp,v 1.31 1997/04/02 16:52:42 kirk Exp $
- #
- # This script determines the operating system and hardware combination
- # and overlays itself with the correct binary for the desired program.
- # The program is determined from the name by which the script is invoked.
-
- APPLICATION=`basename $0`
- APP_ARGS=
- IDL_VERSION=5
-
- # Some applications can be invoked with or without a version suffix.
- # Recognise the versioned ones and remove the version.
- case $APPLICATION in
- "idl_$IDL_VERSION") APPLICATION=idl;;
- "idlde_$IDL_VERSION") APPLICATION=idlde;;
- "idlhelp_$IDL_VERSION") APPLICATION=idlhelp;;
- "idldemo_$IDL_VERSION") APPLICATION=idldemo;;
- esac
-
- # Find the main IDL directory
- if [ "$IDL_DIR" = "" ]; then
- for DIR in /usr/local/rsi/idl_$IDL_VERSION . ./idl /usr/local/lib/idl /usr/local/idl /usr/local/bin/idl
- do
- if [ -d $DIR ]; then
- if [ -f $DIR/resource/fonts/hersh1.chr ]; then
- IDL_DIR=$DIR
- break
- fi
- fi
- done
- fi
-
- if [ "$IDL_DIR" = "" ]; then
- echo "Unable to access $APPLICATION. You will have to
- define the IDL_DIR environment variable to point at the main
- IDL directory before it will work."
- exit 1
- fi
-
- # If LM_LICENSE_FILE is not defined and $IDL_DIR/license.dat
- # exists, then define LM_LICENSE_FILE. If LM_LICENSE_FILE is already set,
- # then respect that and leave it alone.
- if [ \( "$LM_LICENSE_FILE" = "" \) -a \( -f $IDL_DIR/license.dat \) ]; then
- LM_LICENSE_FILE=$IDL_DIR/license.dat
- export LM_LICENSE_FILE
- fi
-
-
- # Determine the operating system, hardware architecture, and os release
- # Make sure these agree with IDL's compiled in paths or online help
- # won't be found.
- OS=
- ARCH=
- OSVER=
- case `uname` in
-
- "SunOS")
- if [ -d /proc ]; then # Solaris
- OS="solaris"
- OSVER="2"
- if [ `/usr/bin/arch` = i86pc ]; then
- ARCH=".x86"
- else
- ARCH=".sparc"
- # If there is a special version of the program for the Ultra,
- # use it. Otherwise, use the regular sparc version.
- if [ \( -f $IDL_DIR/bin/bin.$OS${OSVER}.sun4u/$APPLICATION \) \
- -a \( `/usr/bin/arch -k` = sun4u \) ]; then
- ARCH=".sun4u"
- fi
- fi
- else # 4.1
- OS="sunos"
- OSVER=".4.1"
- fi
- ;;
-
- "AIX") OS="ibm";;
-
- "HP-UX") OS="hp";;
-
- "IRIX") OS="sgi";;
-
- "IRIX6") OS="sgi";;
-
- "IRIX64") OS="sgi";;
-
- "OSF1") OS="alpha";;
-
- "ULTRIX") OS="ultrix";;
-
- "Linux") OS="linux";;
-
- *)
- echo "$APPLICATION: Unable to recognise system architecture."
- exit 1
- ;;
-
- esac
-
- # Add the bin directory to the library search path
- case $OS in
- "ibm")
- if [ "$LIBPATH" = "" ]; then
- LIBPATH="/lib:/usr/lib:$IDL_DIR/bin/bin.$OS$OSVER$ARCH"
- else
- LIBPATH="/lib:/usr/lib:$IDL_DIR/bin/bin.$OS$OSVER$ARCH:$LIBPATH"
- fi
- export LIBPATH
- ;;
-
- "hp")
- if [ "$SHLIB_PATH" = "" ]; then
- SHLIB_PATH="/usr/lib/X11R5:/usr/lib/Motif1.2:$IDL_DIR/bin/bin.$OS$OSVER$ARCH"
- else
- SHLIB_PATH="/usr/lib/X11R5:/usr/lib/Motif1.2:$IDL_DIR/bin/bin.$OS$OSVER$ARCH:$SHLIB_PATH"
- fi
- export SHLIB_PATH
- ;;
-
- *)
- if [ "$LD_LIBRARY_PATH" = "" ]; then
- LD_LIBRARY_PATH="$IDL_DIR/bin/bin.$OS$OSVER$ARCH:/usr/openwin/lib"
- else
- LD_LIBRARY_PATH="$IDL_DIR/bin/bin.$OS$OSVER$ARCH:/usr/openwin/lib:$LD_LIBRARY_PATH"
- fi
- export LD_LIBRARY_PATH
- ;;
- esac
-
-
- # Users Libraries
- if [ "$IDL_PATH" = "" ]; then
- IDL_PATH="+$IDL_DIR/lib:+$IDL_DIR/examples"
- fi
-
- # Add the IDL bin directory to the path so that idlde will always find idl
- PATH=$IDL_DIR/bin:$PATH
- export PATH IDL_DIR IDL_PATH
-
- # HyperText help requires special setup
- if [ "$APPLICATION" = "idlhelp" ]; then
- # Set up environment variables for HyperHelp.
- HHHOME=$IDL_DIR/help
- HHPATH=$IDL_DIR/bin/bin.$OS$OSVER$ARCH
- XPPATH=$IDL_DIR/resource/xprinter
- if [ "$XLIBI18N_PATH" = "" ]; then
- XLIBI18N_PATH=$IDL_DIR/resource/X11/lib
- fi
- if [ "$XFILESEARCHPATH" = "" ]; then
- XFILESEARCHPATH=$IDL_DIR/resource/X11/lib/app-defaults/%N%S:$IDL_DIR/resource/X11/lib/app-defaults/%T/%N%S
- else
- XFILESEARCHPATH="$IDL_DIR/resource/X11/lib/app-defaults/%N%S:$IDL_DIR/resource/X11/lib/app-defaults/%T/%N%S:$XFILESEARCHPATH"
- fi
- export HHHOME HHPATH XPPATH XLIBI18N_PATH XFILESEARCHPATH
- APP_ARGS=$IDL_DIR/help/idl.hlp
- fi
-
-
-
- exec $IDL_DIR/bin/bin.$OS$OSVER$ARCH/$APPLICATION $* $APP_ARGS
-
- # We shouldn't get here unless there was an error.
- echo "$APPLICATION is not availible for this system ($OS/$ARCH)"
- exit 1
-