# This script is a temporary solution until I get autoconf to work.
#
# On most systems the openssl headers and lib will be found automatically
# if present, hence this script is not really required. On CRAN, we use
# the $OPENSSL_INCLUDES variable; elsewhere we assume to the standard
# linux location: /usr/include/openssl.
if [ "$OPENSSL_INCLUDES" ]; then
  echo "PKG_CPPFLAGS= -I$OPENSSL_INCLUDES" >> src/Makevars
else
  OPENSSL_INCLUDES="/usr/include"
fi

# Verify that openssl RNG is present
if [ ! -r $OPENSSL_INCLUDES/openssl/rand.h ]; then
  echo "File $OPENSSL_INCLUDES/openssl/rand.h not found. Make sure the OpenSSL development library is installed, e.g. libssl-dev (deb) or openssl-devel (rpm)."
  exit 1
fi
