Fix "rpl_malloc not found" when cross-compiling, re-run autoreconf

AC_FUNC_MALLOC & AC_FUNC_REALLOC cause link errors when cross-compiling.

It seems the preferred solution is to just remove them, and optionally adding
them to the AC_CHECK_FUNCS section.

Examples:
- https://github.com/LLNL/ior/issues/4
- 47331724c1
- 6667e4cb91
  (used as template for this commit message; thanks!)
- https://rickfoosusa.blogspot.de/2011/11/howto-fix-undefined-reference-to.html
- c58d62b509
This commit is contained in:
Ben Wiederhake 2017-06-16 17:20:00 +02:00
parent 550dc485c0
commit cb96ff77aa
3 changed files with 4 additions and 76 deletions

View file

@ -24,8 +24,7 @@
/* Define to 1 if you have `z' library (-lz) */
#undef HAVE_LIBZ
/* Define to 1 if your system has a GNU libc compatible `malloc' function, and
to 0 otherwise. */
/* Define to 1 if you have the `malloc' function. */
#undef HAVE_MALLOC
/* Define to 1 if you have the <memory.h> header file. */
@ -91,8 +90,5 @@
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Define to rpl_malloc if the replacement function should be used. */
#undef malloc
/* Define to `unsigned int' if <sys/types.h> does not define. */
#undef size_t

71
configure vendored
View file

@ -620,11 +620,11 @@ ac_includes_default="\
#endif"
ac_subst_vars='LTLIBOBJS
LIBOBJS
GETTEXT_PACKAGE
MSGFMT_PATH
CHECK_GETTEXT
PURPLE_CPPFLAGS
LIBOBJS
PURPLE_LIBS
PURPLE_CFLAGS
PKG_CONFIG_LIBDIR
@ -4444,74 +4444,7 @@ fi
# Checks for library functions.
for ac_header in stdlib.h
do :
ac_fn_c_check_header_mongrel "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default"
if test "x$ac_cv_header_stdlib_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_STDLIB_H 1
_ACEOF
fi
done
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU libc compatible malloc" >&5
$as_echo_n "checking for GNU libc compatible malloc... " >&6; }
if ${ac_cv_func_malloc_0_nonnull+:} false; then :
$as_echo_n "(cached) " >&6
else
if test "$cross_compiling" = yes; then :
ac_cv_func_malloc_0_nonnull=no
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#if defined STDC_HEADERS || defined HAVE_STDLIB_H
# include <stdlib.h>
#else
char *malloc ();
#endif
int
main ()
{
return ! malloc (0);
;
return 0;
}
_ACEOF
if ac_fn_c_try_run "$LINENO"; then :
ac_cv_func_malloc_0_nonnull=yes
else
ac_cv_func_malloc_0_nonnull=no
fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_malloc_0_nonnull" >&5
$as_echo "$ac_cv_func_malloc_0_nonnull" >&6; }
if test $ac_cv_func_malloc_0_nonnull = yes; then :
$as_echo "#define HAVE_MALLOC 1" >>confdefs.h
else
$as_echo "#define HAVE_MALLOC 0" >>confdefs.h
case " $LIBOBJS " in
*" malloc.$ac_objext "* ) ;;
*) LIBOBJS="$LIBOBJS malloc.$ac_objext"
;;
esac
$as_echo "#define malloc rpl_malloc" >>confdefs.h
fi
for ac_func in memset strdup
for ac_func in malloc memset strdup
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"

View file

@ -75,8 +75,7 @@ AC_CHECK_HEADERS([arpa/inet.h fcntl.h netdb.h netinet/in.h stdlib.h string.h sys
AC_TYPE_SIZE_T
# Checks for library functions.
AC_FUNC_MALLOC
AC_CHECK_FUNCS([memset strdup])
AC_CHECK_FUNCS([malloc memset strdup])
AC_SUBST(PURPLE_CFLAGS)
AC_SUBST(PURPLE_CPPFLAGS)