#!/usr/bin/env bash

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

if [  "$SAGE64" = "yes" ]; then
   CFLAGS="-O2 -g -m64 "; export CFLAGS
   LDFLAGS="-m64"; export LDFLAGS
fi

cd src

GNUMAKE=${MAKE} ./configure --prefix="$SAGE_LOCAL" --libdir="$SAGE_LOCAL/lib"

if [ $? -ne 0 ]; then
    exit 1;
fi;

${MAKE}

if [ $? -ne 0 ]; then
    exit 1;
fi;

${MAKE} install

if [ $? -ne 0 ]; then
    exit 1;
fi;
