cd src

export CFLAGS="-std=gnu17 $CFLAGS"
export CXXFLAGS
export LDFLAGS


# These are all used by GNU to specify compilers.
echo "Using CC=$CC"
echo "Using CXX=$CXX"

# Flags which may be set.
echo "The following environment variables will be exported"
echo "Using CFLAGS=$CFLAGS"
echo "Using CXXFLAGS=$CXXFLAGS"
echo "Using CPPFLAGS=$CPPFLAGS"
echo "Using LDFLAGS=$LDFLAGS"
echo "configure scripts and/or makefiles might override these later"
echo ""


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

if [ x"$SAGE_SPKG_INSTALL_DOCS" != xyes ] ; then
    ECL_CONFIGURE="$ECL_CONFIGURE --enable-manual=no"
fi

sdh_configure $SAGE_CONFIGURE_GMP \
              --enable-unicode=yes --with-defsystem $ECL_CONFIGURE

# Before running make we touch build/TAGS so its building process is never triggered
touch build/TAGS

# Ensure that ECL will not ask interactive questions (for example, when
# pressing CTRL-C during the build)
exec </dev/null

sdh_make
sdh_make_install
