xref: /minix3/crypto/external/bsd/heimdal/dist/cf/broken-realloc.m4 (revision ebfedea0ce5bbe81e252ddf32d732e40fb633fae)
1*ebfedea0SLionel Sambucdnl
2*ebfedea0SLionel Sambucdnl Id
3*ebfedea0SLionel Sambucdnl
4*ebfedea0SLionel Sambucdnl Test for realloc that doesn't handle NULL as first parameter
5*ebfedea0SLionel Sambucdnl
6*ebfedea0SLionel SambucAC_DEFUN([rk_BROKEN_REALLOC], [
7*ebfedea0SLionel SambucAC_CACHE_CHECK(if realloc if broken, ac_cv_func_realloc_broken, [
8*ebfedea0SLionel Sambucac_cv_func_realloc_broken=no
9*ebfedea0SLionel SambucAC_RUN_IFELSE([AC_LANG_SOURCE([[
10*ebfedea0SLionel Sambuc#include <stddef.h>
11*ebfedea0SLionel Sambuc#include <stdlib.h>
12*ebfedea0SLionel Sambuc
13*ebfedea0SLionel Sambucint main(int argc, char **argv)
14*ebfedea0SLionel Sambuc{
15*ebfedea0SLionel Sambuc	return realloc(NULL, 17) == NULL;
16*ebfedea0SLionel Sambuc}
17*ebfedea0SLionel Sambuc]])],[:], [ac_cv_func_realloc_broken=yes],[:])
18*ebfedea0SLionel Sambuc])
19*ebfedea0SLionel Sambucif test "$ac_cv_func_realloc_broken" = yes ; then
20*ebfedea0SLionel Sambuc	AC_DEFINE(BROKEN_REALLOC, 1, [Define if realloc(NULL) doesn't work.])
21*ebfedea0SLionel Sambucfi
22*ebfedea0SLionel SambucAH_BOTTOM([#ifdef BROKEN_REALLOC
23*ebfedea0SLionel Sambuc#define realloc(X, Y) rk_realloc((X), (Y))
24*ebfedea0SLionel Sambuc#endif])
25*ebfedea0SLionel Sambuc])
26