unset RM

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

if [ "$SAGE64" = "yes" ]; then
    CFLAGS="$CFLAGS -m64";
    CXXFLAGS="$CXXFLAGS -m64";
    # FIXME: Do we need LDFLAGS here, too?
    #        But looks as if all linking is performed by libtool/
    #        gcc, so we do not really need it here.
    #        In general, "-m64" should be added to CPPFLAGS and
    #        CXXFLAGS as well. (There are no C++ sources though.)
fi

INCLUDES="-I$SAGE_LOCAL/include"
LIBDIRS="-L$SAGE_LOCAL/lib"

CFLAGS="$CFLAGS $INCLUDES $LIBDIRS -g"
CXXFLAGS="$CXXFLAGS $INCLUDES $LIBDIRS -g"

export CFLAGS
export CXXFLAGS

cd src

echo "Testing the M4RIE library"

$MAKE check
