home *** CD-ROM | disk | FTP | other *** search
/ SGI Hot Mix 17 / Hot Mix 17.iso / HM17_SGI / research / bin / idlde < prev    next >
Encoding:
Text File  |  1997-07-08  |  4.3 KB  |  168 lines

  1. #!/bin/sh
  2. #
  3. #    $Id: startapp,v 1.31 1997/04/02 16:52:42 kirk Exp $
  4. #
  5. # This script determines the operating system and hardware combination
  6. # and overlays itself with the correct binary for the desired program.
  7. # The program is determined from the name by which the script is invoked.
  8.  
  9. APPLICATION=`basename $0`
  10. APP_ARGS=
  11. IDL_VERSION=5
  12.  
  13. # Some applications can be invoked with or without a version suffix.
  14. # Recognise the versioned ones and remove the version.
  15. case $APPLICATION in
  16. "idl_$IDL_VERSION") APPLICATION=idl;;
  17. "idlde_$IDL_VERSION") APPLICATION=idlde;;
  18. "idlhelp_$IDL_VERSION") APPLICATION=idlhelp;;
  19. "idldemo_$IDL_VERSION") APPLICATION=idldemo;;
  20. esac
  21.  
  22. # Find the main IDL directory
  23. if [ "$IDL_DIR" = "" ]; then
  24.     for DIR in /usr/local/rsi/idl_$IDL_VERSION . ./idl /usr/local/lib/idl /usr/local/idl /usr/local/bin/idl
  25.     do
  26.     if [ -d $DIR ]; then
  27.         if [ -f $DIR/resource/fonts/hersh1.chr ]; then
  28.             IDL_DIR=$DIR
  29.         break
  30.         fi
  31.         fi
  32.     done
  33. fi
  34.  
  35. if [ "$IDL_DIR" = "" ]; then
  36.     echo "Unable to access $APPLICATION. You will have to
  37. define the IDL_DIR environment variable to point at the main
  38. IDL directory before it will work."
  39.     exit 1
  40. fi
  41.  
  42. # If LM_LICENSE_FILE is not defined and $IDL_DIR/license.dat
  43. # exists, then define LM_LICENSE_FILE. If LM_LICENSE_FILE is already set,
  44. # then respect that and leave it alone.
  45. if [ \( "$LM_LICENSE_FILE" = "" \) -a \( -f $IDL_DIR/license.dat \) ]; then
  46.     LM_LICENSE_FILE=$IDL_DIR/license.dat
  47.     export LM_LICENSE_FILE
  48. fi
  49.  
  50.  
  51. # Determine the operating system, hardware architecture, and os release
  52. # Make sure these agree with IDL's compiled in paths or online help
  53. # won't be found.
  54. OS=
  55. ARCH=
  56. OSVER=
  57. case `uname` in
  58.  
  59.     "SunOS")
  60.     if [ -d /proc ]; then            # Solaris
  61.         OS="solaris"
  62.         OSVER="2"
  63.         if [ `/usr/bin/arch` = i86pc ]; then
  64.               ARCH=".x86"
  65.         else
  66.               ARCH=".sparc"
  67.           # If there is a special version of the program for the Ultra,
  68.           # use it. Otherwise, use the regular sparc version.
  69.           if [ \( -f $IDL_DIR/bin/bin.$OS${OSVER}.sun4u/$APPLICATION \) \
  70.                -a \( `/usr/bin/arch -k` = sun4u \) ]; then
  71.             ARCH=".sun4u"
  72.               fi
  73.             fi
  74.     else                    # 4.1
  75.         OS="sunos"
  76.         OSVER=".4.1"
  77.     fi
  78.     ;;
  79.  
  80.     "AIX") OS="ibm";;
  81.  
  82.     "HP-UX") OS="hp";;
  83.  
  84.     "IRIX") OS="sgi";;
  85.  
  86.     "IRIX6") OS="sgi";;
  87.  
  88.     "IRIX64") OS="sgi";;
  89.  
  90.     "OSF1") OS="alpha";;
  91.  
  92.     "ULTRIX") OS="ultrix";;
  93.  
  94.     "Linux") OS="linux";;
  95.         
  96.     *)
  97.     echo "$APPLICATION: Unable to recognise system architecture."
  98.     exit 1
  99.     ;;
  100.  
  101. esac
  102.  
  103. # Add the bin directory to the library search path
  104. case $OS in
  105.     "ibm")
  106.     if [ "$LIBPATH" = "" ]; then
  107.         LIBPATH="/lib:/usr/lib:$IDL_DIR/bin/bin.$OS$OSVER$ARCH"
  108.     else
  109.         LIBPATH="/lib:/usr/lib:$IDL_DIR/bin/bin.$OS$OSVER$ARCH:$LIBPATH"
  110.     fi
  111.     export LIBPATH
  112.     ;;
  113.  
  114.     "hp")
  115.     if [ "$SHLIB_PATH" = "" ]; then
  116.         SHLIB_PATH="/usr/lib/X11R5:/usr/lib/Motif1.2:$IDL_DIR/bin/bin.$OS$OSVER$ARCH"
  117.       else
  118.         SHLIB_PATH="/usr/lib/X11R5:/usr/lib/Motif1.2:$IDL_DIR/bin/bin.$OS$OSVER$ARCH:$SHLIB_PATH"
  119.     fi
  120.     export SHLIB_PATH
  121.     ;;
  122.  
  123.     *)
  124.     if [ "$LD_LIBRARY_PATH" = "" ]; then
  125.         LD_LIBRARY_PATH="$IDL_DIR/bin/bin.$OS$OSVER$ARCH:/usr/openwin/lib"
  126.     else
  127.         LD_LIBRARY_PATH="$IDL_DIR/bin/bin.$OS$OSVER$ARCH:/usr/openwin/lib:$LD_LIBRARY_PATH"
  128.     fi
  129.     export LD_LIBRARY_PATH
  130.     ;;
  131. esac
  132.  
  133.  
  134. # Users Libraries
  135. if [ "$IDL_PATH" = "" ]; then
  136.     IDL_PATH="+$IDL_DIR/lib:+$IDL_DIR/examples"
  137. fi
  138.  
  139. # Add the IDL bin directory to the path so that idlde will always find idl
  140. PATH=$IDL_DIR/bin:$PATH
  141. export PATH IDL_DIR IDL_PATH
  142.  
  143. # HyperText help requires special setup
  144. if [ "$APPLICATION" = "idlhelp" ]; then
  145.   # Set up environment variables for HyperHelp.
  146.   HHHOME=$IDL_DIR/help
  147.   HHPATH=$IDL_DIR/bin/bin.$OS$OSVER$ARCH
  148.   XPPATH=$IDL_DIR/resource/xprinter
  149.   if [ "$XLIBI18N_PATH" = "" ]; then
  150.     XLIBI18N_PATH=$IDL_DIR/resource/X11/lib
  151.   fi
  152.   if [ "$XFILESEARCHPATH" = "" ]; then
  153.     XFILESEARCHPATH=$IDL_DIR/resource/X11/lib/app-defaults/%N%S:$IDL_DIR/resource/X11/lib/app-defaults/%T/%N%S
  154.   else
  155.     XFILESEARCHPATH="$IDL_DIR/resource/X11/lib/app-defaults/%N%S:$IDL_DIR/resource/X11/lib/app-defaults/%T/%N%S:$XFILESEARCHPATH"
  156.   fi
  157.   export HHHOME HHPATH XPPATH XLIBI18N_PATH XFILESEARCHPATH
  158.   APP_ARGS=$IDL_DIR/help/idl.hlp
  159. fi
  160.  
  161.  
  162.  
  163. exec $IDL_DIR/bin/bin.$OS$OSVER$ARCH/$APPLICATION $* $APP_ARGS
  164.  
  165. # We shouldn't get here unless there was an error.
  166. echo "$APPLICATION is not availible for this system ($OS/$ARCH)"
  167. exit 1
  168.