4 dnl Determine whether realloc works when both arguments are 0.
5 dnl If it doesn't, arrange to use the replacement function.
7 dnl If you use this macro in a package, you should
8 dnl add the following two lines to acconfig.h:
9 dnl /* Define to rpl_realloc if the replacement function should be used. */
13 AC_DEFUN(jm_FUNC_REALLOC,
15 dnl xmalloc.c requires that this symbol be defined so it doesn't
16 dnl mistakenly use a broken realloc -- as it might if this test were omitted.
17 AC_DEFINE_UNQUOTED(HAVE_DONE_WORKING_REALLOC_CHECK, 1,
18 [Define if the realloc check has been performed. ])
20 AC_CACHE_CHECK([for working realloc], jm_cv_func_working_realloc,
26 exit (realloc (0, 0) ? 0 : 1);
29 jm_cv_func_working_realloc=yes,
30 jm_cv_func_working_realloc=no,
31 dnl When crosscompiling, assume realloc is broken.
32 jm_cv_func_working_realloc=no)
34 if test $jm_cv_func_working_realloc = no; then
35 LIBOBJS="$LIBOBJS realloc.o"
36 AC_DEFINE_UNQUOTED(realloc, rpl_realloc)