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

# Let GLPK use Sage's GMP/MPIR (cf. comments in SPKG.txt and spkg-install):
CPPFLAGS="-I$SAGE_LOCAL/include $CPPFLAGS"
LDFLAGS="-L$SAGE_LOCAL/lib $LDFLAGS"

# No need to (re)export LDFLAGS etc., as `sage-env` does this.
# But it currently *doesn't* export CPPFLAGS. For safety, export them all:
export CPPFLAGS LDFLAGS

cd src/

echo "Running GLPK's testsuite..."
$MAKE check
if [ $? -ne 0 ]; then
    echo >&2 "Error testing GLPK."
    exit 1
fi
