Fix rpl_malloc when cross compiling
[termux-packages] / build-package.sh
index a862244..eb04618 100755 (executable)
@@ -339,11 +339,17 @@ termux_step_configure () {
        set -e -o pipefail
        export PATH=$TERMUX_PKG_TMPDIR/config-scripts:$PATH
 
+       # See http://wiki.buici.com/xwiki/bin/view/Programing+C+and+C%2B%2B/Autoconf+and+RPL_MALLOC
+       # about this problem which may cause linker errors in test scripts not undef:ing malloc and
+       # also cause problems with e.g. malloc interceptors such as libgc:
+       local AVOID_AUTOCONF_WRAPPERS="ac_cv_func_malloc_0_nonnull=yes ac_cv_func_realloc_0_nonnull=yes"
+
        $TERMUX_PKG_SRCDIR/configure \
                --disable-dependency-tracking \
                --prefix=$TERMUX_PREFIX \
                 --disable-rpath --disable-rpath-hack \
                $HOST_FLAG \
+               $AVOID_AUTOCONF_WRAPPERS \
                $TERMUX_PKG_EXTRA_CONFIGURE_ARGS \
                $DISABLE_NLS \
                $ENABLE_SHARED \