2N/A# realloc.m4 serial 11
2N/Adnl Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc.
2N/Adnl This file is free software; the Free Software Foundation
2N/Adnl gives unlimited permission to copy and/or distribute it,
2N/Adnl with or without modifications, as long as this notice is preserved.
2N/A
2N/A# gl_FUNC_REALLOC_GNU
2N/A# -------------------
2N/A# Test whether 'realloc (0, 0)' is handled like in GNU libc, and replace
2N/A# realloc if it is not.
2N/AAC_DEFUN([gl_FUNC_REALLOC_GNU],
2N/A[
2N/A AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
2N/A dnl _AC_FUNC_REALLOC_IF is defined in Autoconf.
2N/A _AC_FUNC_REALLOC_IF(
2N/A [AC_DEFINE([HAVE_REALLOC_GNU], [1],
2N/A [Define to 1 if your system has a GNU libc compatible 'realloc'
2N/A function, and to 0 otherwise.])],
2N/A [AC_DEFINE([HAVE_REALLOC_GNU], [0])
2N/A gl_REPLACE_REALLOC
2N/A ])
2N/A])# gl_FUNC_REALLOC_GNU
2N/A
2N/A# gl_FUNC_REALLOC_POSIX
2N/A# ---------------------
2N/A# Test whether 'realloc' is POSIX compliant (sets errno to ENOMEM when it
2N/A# fails), and replace realloc if it is not.
2N/AAC_DEFUN([gl_FUNC_REALLOC_POSIX],
2N/A[
2N/A AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
2N/A AC_REQUIRE([gl_CHECK_MALLOC_POSIX])
2N/A if test $gl_cv_func_malloc_posix = yes; then
2N/A AC_DEFINE([HAVE_REALLOC_POSIX], [1],
2N/A [Define if the 'realloc' function is POSIX compliant.])
2N/A else
2N/A gl_REPLACE_REALLOC
2N/A fi
2N/A])
2N/A
2N/AAC_DEFUN([gl_REPLACE_REALLOC],
2N/A[
2N/A AC_LIBOBJ([realloc])
2N/A REPLACE_REALLOC=1
2N/A])