cd src/

# https://github.com/passagemath/passagemath/issues/821 lidia manylinux-aarch64: Build error
cp "$SAGE_ROOT"/config/config.* .

if [ -n "$SAGE_GMP_PREFIX" ]; then
   GMP_CONFIGURE="--with-extra-includes=$SAGE_GMP_PREFIX/include --with-extra-libs=$SAGE_GMP_PREFIX/lib"
fi

# Need std::auto_ptr removed in C++17
export CXXFLAGS="$CXXFLAGS -std=c++11"

sdh_configure --with-arithmetic=gmp \
              $GMP_CONFIGURE \
              --enable-shared=yes --enable-static=no
sdh_make
sdh_make_install

# LiDIA 2.2.0 installs its headers into lidia/ but expects them in LiDIA!?!
# So we make a symbolic link, just in case.
# (On the Mac, nothing is done because of its case-preserving, case-insensitive file system.)
( cd "$SAGE_DESTDIR_LOCAL/include" && if [ ! -r LiDIA ] ; then ln -s lidia LiDIA; fi  || true )

