broken-realloc.m4 revision 1.1.1.3 1 1.1 elric dnl
2 1.1.1.2 elric dnl Id
3 1.1 elric dnl
4 1.1 elric dnl Test for realloc that doesn't handle NULL as first parameter
5 1.1 elric dnl
6 1.1 elric AC_DEFUN([rk_BROKEN_REALLOC], [
7 1.1 elric AC_CACHE_CHECK(if realloc if broken, ac_cv_func_realloc_broken, [
8 1.1 elric ac_cv_func_realloc_broken=no
9 1.1 elric AC_RUN_IFELSE([AC_LANG_SOURCE([[
10 1.1 elric #include <stddef.h>
11 1.1 elric #include <stdlib.h>
12 1.1 elric
13 1.1 elric int main(int argc, char **argv)
14 1.1 elric {
15 1.1 elric return realloc(NULL, 17) == NULL;
16 1.1 elric }
17 1.1 elric ]])],[:], [ac_cv_func_realloc_broken=yes],[:])
18 1.1 elric ])
19 1.1 elric if test "$ac_cv_func_realloc_broken" = yes ; then
20 1.1 elric AC_DEFINE(BROKEN_REALLOC, 1, [Define if realloc(NULL) doesn't work.])
21 1.1 elric fi
22 1.1.1.3 christos dnl AH_BOTTOM([#ifdef BROKEN_REALLOC
23 1.1.1.3 christos dnl #ifndef realloc
24 1.1.1.3 christos dnl #define realloc(X, Y) rk_realloc((X), (Y))
25 1.1.1.3 christos dnl #endif
26 1.1.1.3 christos dnl #endif])
27 1.1 elric ])
28