#! /usr/bin/env sh

# Check that this is not just ./configure. We need to run this
# from R CMD INSTALL, to have the R env vars set.

if [ -z "$R_HOME" ]; then
  echo >&2 R_HOME is not set, are you running R CMD INSTALL?
  exit 1
fi

# Find the R binary we need to use. This is a bit trickier on
# Windows, because it has two architectures. On windows R_ARCH_BIN
# is set, so this should work everywhere.
RBIN="${R_HOME}/bin${R_ARCH_BIN}/R"

 "$RBIN" --vanilla --slave -f tools/examples.R
