# libpng needs to have no default options set for grep
unset GREP_OPTIONS

export CFLAGS="$CFLAGS -fPIC -g"

# Pick up Sage's zlib:
export CPPFLAGS="-I$SAGE_LOCAL/include $CPPFLAGS"

# Needed to generate a correct import library
if [ "$UNAME" = "CYGWIN" ]; then
    MAKE="$MAKE SYMBOL_PREFIX= "
fi

cd src

sdh_configure --enable-shared=yes
sdh_make
sdh_make_install

# Delete libpng.* symlinks, see SPKG.txt for details
rm -f "$SAGE_DESTDIR_LOCAL"/lib/libpng.*
