export CFLAGS="-O2 -g -fPIC $CFLAGS"

cd src

# Use newer version of config.guess and config.sub (see Issue #19716)
cp "$SAGE_ROOT"/config/config.* .

sdh_configure $SAGE_CONFIGURE_MPFR $SAGE_CONFIGURE_GMP
sdh_make
sdh_make_install

if ! [ $? -eq 0 -a -f $SAGE_DESTDIR$SAGE_LOCAL/include/mpfi.h ]; then
    echo "An error occurred while building MPFI."
    exit 1
fi
