#!/usr/bin/env bash

if [ "$SAGE_LOCAL" = "" ]; then
   echo "SAGE_LOCAL undefined ... exiting";
   echo "Maybe run 'sage -sh'?"
   exit 1
fi

cd src

./configure --prefix="$SAGE_LOCAL" --with-gmp="$SAGE_LOCAL"
if [ $? -ne 0 ]; then
   echo "Error configuring blad."
   exit 1
fi

make
if [ $? -ne 0 ]; then
   echo "Error building blad."
   exit 1
fi

make install
if [ $? -ne 0 ]; then
   echo "Error installing blad."
   exit 1
fi
