if [[ -z "$SAGE_LOCAL" ]]; then
    echo >&2 "Error: SAGE_LOCAL undefined - exiting..."
    echo >&2 "Maybe run 'sage -sh'?"
    exit 1
fi

if [ "$UNAME" != "FreeBSD" ]; then
    echo "We only install the cephes library on FreeBSD."
    exit 0
fi

cd src

echo "Building Cephes..."
$MAKE
if [ $? -ne 0 ]; then
   echo >&2 "Error - Failed to build Cephes ... exiting"
   exit 1
fi

echo "Installing Cephes..."
$MAKE install
if [ $? -ne 0 ]; then
   echo >&2 "Error - Failed to build Cephes ... exiting"
   exit 1
fi
