#!/usr/bin/env sh

. tools/cmake_config.sh
if test -z "${CMAKE_BIN}"; then
   ## also error to end configure here
   as_fn_error $? "Could not find 'cmake'." "$LINENO" 5
fi
export PATH=$PATH:$(cd $(dirname -- $CMAKE_BIN) && pwd -P)

tools/r_config.sh

# It is required that setup.sh is run before R CMD build rlibkriging when submit to CRAN. 
# But not when installed using install_github
if [ ! -d R ]; then
  tools/setup.sh
fi

tools/build.sh
