#!/bin/sh
# Wrapper for Sequin October 15, 2009

if [ $BIRCH_PLATFORM = osx-x86_64 ]
   then
       open $birch/lib-osx-x86_64/Sequin/Sequin.app
else

   # Sequin for linux-intel needs to find libXm.so.2 and libXp.so.6, which are not included
   # in many linux distributions. BIRCHLIBS is put first in the search path because
   # systems with older versions of libXm.so.2 will cause "Segmentation fault"
   # errors at many places in Sequin. This way, local copies of libXm.so.2 can be
   # overridden.
   BIRCHLIBS=""

   case $BIRCH_PLATFORM in
     "solaris-sparc")
          #    BIRCHLIBS="$BIRCH/local/lib-solaris-sparc:$BIRCH/lib-solaris-sparc"
       ;; 
     "solaris-amd64")
         #    BIRCHLIBS="$BIRCH/local/lib-solaris-amd64:$BIRCH/lib-solaris-amd64"
       ;;   
     "linux-intel")
         #BIRCHLIBS=$BIRCH/lib-linux-intel:$BIRCH/local/lib-linux-intel
       BIRCHLIBS=$BIRCH/local/lib-linux-intel:$BIRCH/lib-linux-intel
       ;;
     "linux-x86_64")
         #BIRCHLIBS=$BIRCH/lib-linux-x86_64:$BIRCH/local/lib-linux-x86_64
       BIRCHLIBS=$BIRCH/local/lib-linux-x86_64:$BIRCH/lib-linux-x86_64
       ;;
     *)
       ;;
   esac
   export BIRCHLIBS

   #echo BIRCHLIBS $BIRCHLIBS
   if [  "$BIRCHLIBS" != ""  ]
	  then
     if [ ! -z "$LD_LIBRARY_PATH" ]
	  then
	LD_LIBRARY_PATH="$BIRCHLIBS":"$LD_LIBRARY_PATH"
	export LD_LIBRARY_PATH
     else
	LD_LIBRARY_PATH="$BIRCHLIBS"
	export LD_LIBRARY_PATH
     fi
   fi

   sequin.bin $*

fi
