#!/bin/sh
# Start MapSlicer
#
# The command library is the ccp4map package, which may
# either be part of a custom interpreter (ccp4mapwish) or
# a loadable package (libccp4.so)
# If neither are found in standard places then MapSlicer
# cannot be used.
# \
versions="wish wish8.4 wish8.3 wish8.1 wish8.0" ; \
got_wish=no ; \
if [ ! -z "$CCP4I_TCLTK" ] ; then \
    for v in $versions ; do \
      trywish="${CCP4I_TCLTK}/$v" ; \
      if [ -x $trywish ] ; then \
        got_wish=yes ; \
        wish=$trywish ; \
        break ; \
      fi ; \
    done ; \
fi ; \
if [ "$got_wish" != "yes" ] ; then \
  echo "Mapslicer: no version of wish found" ; \
  echo "Stopping" ; \
  exit 1 ; \
fi ; \
# \
if test -f $CCP4_LIB/libccp4map.so ; then \
  MAPSLICER_EXE=$wish ; \
else \
  if test -f $CBIN/ccp4mapwish ; then \
    MAPSLICER_EXE=$CBIN/ccp4mapwish ; \
  else \
    echo "MapSlicer: no command library found, sorry" ; \
    echo "Stopping." ; \
    exit ; \
  fi ; \
fi ; \
exec $MAPSLICER_EXE "$0" -- ${1+"$@"}
source [file join $env(CCP4I_TOP) bin mapslicer.tcl]
