1 # Check whether free (NULL) is supposed to work.
3 # Copyright (C) 2003 Free Software Foundation, Inc.
5 # This file is free software, distributed under the terms of the GNU
6 # General Public License. As a special exception to the GNU General
7 # Public License, this file may be distributed as part of a program
8 # that contains a configuration script generated by Autoconf, under
9 # the same distribution terms as the rest of that program.
11 # Written by Paul Eggert.
13 # We can't test for free (NULL) even at runtime, since it might
14 # happen to "work" for our test program, but not in general. So, be
15 # conservative and use feature tests for relatively modern hosts,
16 # where free (NULL) is known to work. This costs a bit of
17 # performance on some older hosts, but we can fix that later if
20 AC_DEFUN([gl_FUNC_FREE],
22 AC_CHECK_HEADERS_ONCE(unistd.h)
23 AC_CACHE_CHECK([whether free (NULL) is known to work],
27 [[@%:@if HAVE_UNISTD_H
28 @%:@include <unistd.h>
30 [[@%:@if _POSIX_VERSION < 199009L && \
31 (defined unix || defined _unix || defined _unix_ \
32 || defined __unix || defined __unix__)
33 @%:@error "'free (NULL)' is not known to work"
35 [gl_cv_func_free=yes],
36 [gl_cv_func_free=no])])
38 if test $gl_cv_func_free = yes; then
40 AC_DEFINE(free, rpl_free,
41 [Define to rpl_free if the replacement function should be used.])
45 # Prerequisites of lib/free.c.
46 AC_DEFUN([gl_PREREQ_FREE], [:])