#!/bin/sh

R_HOME=@R_HOME@

R_SHARE_DIR=@R_SHARE_DIR@
export R_SHARE_DIR
R_INCLUDE_DIR=@R_INCLUDE_DIR@
export R_INCLUDE_DIR
R_DOC_DIR=@R_DOC_DIR@
export R_DOC_DIR

JRI_LD_PATH=${R_HOME}/lib:${R_HOME}/bin:@JAVA_LD_PATH@
if test -z "$LD_LIBRARY_PATH"; then
  LD_LIBRARY_PATH=$JRI_LD_PATH
else
  LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$JRI_LD_PATH
fi
JAVA=@JAVA_PROG@

: ${CLASSPATH=.:examples}

export R_HOME
export LD_LIBRARY_PATH

if [ -z "$1" ]; then
    echo ""
    echo " Usage: run <class> [...]"
    echo ""
    echo " For example: ./run rtest"
    echo " Set CLASSPATH variable if other than .:examples is desired"
    echo ""
else
    ${JAVA} -Djava.library.path=.:@JAVA_LD_PATH@ -cp ${CLASSPATH}:src/JRI.jar:JRI.jar $*
fi
