#!/bin/sh

# program name:
PROGRAM=mod
VERSION=8v2

# Install location
MODINSTALL8v2=xxx

# These variables can be overridden in your .cshrc/.bashrc if desired
# You can also set ${LIBS_LIB8v2} to override the default, which is
# ${MODINSTALL8v2}/modlib/libs.lib
if test -z "${EXECUTABLE_TYPE8v2}"; then EXECUTABLE_TYPE8v2=xxx; fi
if test -z "${KEY_MODELLER8v2}"; then KEY_MODELLER8v2=xxx; fi

export MODINSTALL8v2 KEY_MODELLER8v2

# select the nice level:
NICE=
# NICE=nice -20

# executable:
EXECUTABLE=${PROGRAM}${VERSION}_${EXECUTABLE_TYPE8v2}

# Provide do-nothing Python libraries if standard copies aren't on this system
if test -z "${PYTHONHOME}"; then
  if test ! -d /usr/lib/python2.3 \
       -a ! -d /System/Library/Frameworks/Python.framework/Versions/2.3/lib \
       -a ! -d /usr/local/lib/python2.3; then
    PYTHONHOME=${MODINSTALL8v2}/bin/
    export PYTHONHOME
  fi
fi

# On Mac OS X, fall back to bundled Python library if system one isn't found
DYLD_FALLBACK_LIBRARY_PATH=${MODINSTALL8v2}/bin/
export DYLD_FALLBACK_LIBRARY_PATH

# for IBM RS6000, to make the ERR keyword in I/O work:
cnverr=yes ; export cnverr

# to avoid running out of stack space
ulimit -S -s unlimited

# This is one way to get Modeller (which is linked against glibc-2.3) to work
# on Linux glibc-2.2 systems:
# 1. Copy at least ld-linux.so.2 libc.so.6 libdl.so.2 libm.so.6 libutil.so.1
#    from /lib/ on a RedHat 9 box (_not_ a later system with execshield) to
#    a directory on your glibc-2.2 box.
# 2. Set the GLIBC23 variable (below) to point to this directory.
# 3. Uncomment the two lines below to run Modeller with glibc-2.3 rather than
#    your system's native glibc-2.2.
# GLIBC23=~/glibc23/
# exec $NICE ${GLIBC23}/ld-linux.so.2 --library-path ${GLIBC23} ${MODINSTALL8v2}/bin/${EXECUTABLE} $* 

# run the program:
exec $NICE ${MODINSTALL8v2}/bin/${EXECUTABLE} $*
