unset RM

ROOT_DIR="`pwd`"

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

CFLAGS="-fPIC -Wall -pedantic -g $CFLAGS $INCLUDES"
LDFLAGS="$LIBDIRS $LDFLAGS"

CPPFLAGS="$INCLUDES"

if [ "x$SAGE_DEBUG" = "xyes" ]; then
   ENABLE_DEBUG="--enable-debug"
else
   ENABLE_DEBUG=""
fi

export CFLAGS
export CPPFLAGS
export LDFLAGS

# build M4RIE

cd $ROOT_DIR/src/

cp "$SAGE_ROOT"/config/config.* .

sdh_configure --enable-shared --disable-static $ENABLE_DEBUG
sdh_make
sdh_make_install
