#!/bin/sh
EXEC="exec "

if test x$1 = x--debug; then
   DEBUG=--debug
   shift
fi

if test x$1 = x--gdb; then
   shift
   EXEC="gdb --eval-command=run --args "
fi

if test x$1 = x--valgrind; then
  shift
  EXEC="valgrind $VALGRIND_OPTIONS"   
fi

MONO_GC_OPTIONS=--gc=sgen
if test x$1 = x--gc=boehm; then
  shift
  MONO_GC_OPTIONS=--gc=boehm   
fi

# Beware this line must match the regular expression " (\/.*)\/fsi\.exe" when fsi.exe is fsi.exe.
# That's because the FSharp MonoDevelop addin looks inside the text of this script to determine the installation
# location of the default FSharp install in order to find the FSharp compiler binaries (see 
# fsharpbinding/MonoDevelop.FSharpBinding/Services/CompilerLocationUtils.fs). That's a pretty unfortunate
# way of finding those binaries. And really should be changed.
$EXEC mono $DEBUG $MONO_OPTIONS $MONO_GC_OPTIONS /usr/local/libdata/pkgconfig/../../lib/mono//4.0/fsi.exe $@
