export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/data/local/tmp/develop/sysroot/usr/lib

export CFLAGS="$CFLAGS -D__ANDROID_API__=31 -O3  -Wno-implicit-function-declaration -Wno-int-conversion "
export CPPFLAGS="$CFLAGS"

export TARGET_ROOT=/system

export PKG_CONFIG=/data/local/tmp/sysroot/usr/clang19/bin/pkgconf


AC_OPTIONS="ac_cv_func_shm_unlink=no  ac_cv_func_shm_open=yesac_cv_posix_semaphores_enabled=yes ac_cv_func_linkat=no ac_cv_func_faccessat=no  ac_cv_file__dev_ptc=no" 

LDFLAGS="$LDFLAGS /data/local/tmp/develop/sysroot/usr/lib/libncursesw.a"

# --enable-optimizations
eval ${AC_OPTIONS} ./configure  --prefix=${TARGET_ROOT}/usr --with-openssl=/data/local/tmp/develop/sysroot/usr \
  --enable-loadable-sqlite-extensions --enable-shared  --enable-pystats  --with-builtin-hashlib-hashes=md5,sha1,sha2,sha3,blake2,sha256,sha512 \
   --with-system-expat --without-ensurepip  --with-tzpath=/system/usr/share/zoneinfo --with-system_libmpdec 

OLDFLAGS="$LDFLAGS"

LDFLAGS="$( echo "$LDFLAGS" | sed "s/-pie//g" )"

echo "LDFLAGS:  $LDFLAGS"
echo "OLDFLAGS: $OLDFLAGS"

echo "Correcting the Makefile ..."

sed -i -e "s/none required//g" Makefile

