die () {
    echo "$@" 1>&2
    exit 1
}

[ -n "$SAGE_LOCAL" ] || die 'Error: $SAGE_LOCAL not set. Source sage-env or run this script from `sage -sh`.'

cd src

# Disable features that require packages SCIP and CoCoA, for which we don't have packages (yet).
# FLINT is a standard package.  We pass --enable-flint to configure so that an error will be signalled
# if FLINT cannot be found, rather than building normaliz without it.
./configure --disable-scip --disable-nmzintegrate --enable-flint --prefix=$SAGE_LOCAL || die "Error configuring normaliz"
$MAKE || die "Error building normaliz"
$MAKE install || die "Error installing normaliz"

