cd src

export CFLAGS="-g $CFLAGS"

cp "$SAGE_ROOT"/config/config.* config/
# We explicitly disable X, fontconfig, and support of various formats/libraries.
# We only need png.
# see https://github.com/libgd/libgd/blob/master/configure.ac
sdh_configure --without-jpeg --without-xpm --without-x --without-fontconfig \
              --without-avif --without-freetype --without-raqm --without-liq \
              --without-tiff --without-webp --without-heif \
              --disable-gd-formats \
              --with-zlib="$SAGE_LOCAL" $LIBGD_CONFIGURE
sdh_make
sdh_make_install
