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

cd src

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

sdh_configure --with-mpfr="$SAGE_LOCAL" --with-gmp="$SAGE_LOCAL"
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
