annotate m4/free.m4 @ 40196:e63f5d3edab5

relocatable-prog: Update documentation. * doc/relocatable-maint.texi (Supporting Relocation): Update to match the recent changes.
author Bruno Haible <bruno@clisp.org>
date Sun, 24 Feb 2019 01:49:15 +0100
parents b06060465f09
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4753
6b790c4dd07d Add 'free' module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
1 # Check whether free (NULL) is supposed to work.
6b790c4dd07d Add 'free' module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
2
40057
b06060465f09 maint: Run 'make update-copyright'
Paul Eggert <eggert@cs.ucla.edu>
parents: 19484
diff changeset
3 # Copyright (C) 2003-2005, 2009-2019 Free Software Foundation, Inc.
5611
87c42e194f4a Use an all-permissive copyright notice, recommended by RMS.
Paul Eggert <eggert@cs.ucla.edu>
parents: 5072
diff changeset
4 # This file is free software; the Free Software Foundation
87c42e194f4a Use an all-permissive copyright notice, recommended by RMS.
Paul Eggert <eggert@cs.ucla.edu>
parents: 5072
diff changeset
5 # gives unlimited permission to copy and/or distribute it,
87c42e194f4a Use an all-permissive copyright notice, recommended by RMS.
Paul Eggert <eggert@cs.ucla.edu>
parents: 5072
diff changeset
6 # with or without modifications, as long as this notice is preserved.
4753
6b790c4dd07d Add 'free' module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
7
6b790c4dd07d Add 'free' module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
8 # Written by Paul Eggert.
6b790c4dd07d Add 'free' module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
9
6b790c4dd07d Add 'free' module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
10 # We can't test for free (NULL) even at runtime, since it might
6b790c4dd07d Add 'free' module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
11 # happen to "work" for our test program, but not in general. So, be
6b790c4dd07d Add 'free' module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
12 # conservative and use feature tests for relatively modern hosts,
6b790c4dd07d Add 'free' module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
13 # where free (NULL) is known to work. This costs a bit of
6b790c4dd07d Add 'free' module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
14 # performance on some older hosts, but we can fix that later if
6b790c4dd07d Add 'free' module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
15 # needed.
6b790c4dd07d Add 'free' module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
16
6b790c4dd07d Add 'free' module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
17 AC_DEFUN([gl_FUNC_FREE],
6b790c4dd07d Add 'free' module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
18 [
15606
f62f29997e98 unistd et al.: Don't assume <unistd.h> exists.
Bruno Haible <bruno@clisp.org>
parents: 14946
diff changeset
19 AC_REQUIRE([AC_CANONICAL_HOST])
4753
6b790c4dd07d Add 'free' module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
20 AC_CACHE_CHECK([whether free (NULL) is known to work],
6b790c4dd07d Add 'free' module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
21 [gl_cv_func_free],
15606
f62f29997e98 unistd et al.: Don't assume <unistd.h> exists.
Bruno Haible <bruno@clisp.org>
parents: 14946
diff changeset
22 [case "$host_os" in
f62f29997e98 unistd et al.: Don't assume <unistd.h> exists.
Bruno Haible <bruno@clisp.org>
parents: 14946
diff changeset
23 mingw*) gl_cv_func_free=yes ;;
f62f29997e98 unistd et al.: Don't assume <unistd.h> exists.
Bruno Haible <bruno@clisp.org>
parents: 14946
diff changeset
24 *)
f62f29997e98 unistd et al.: Don't assume <unistd.h> exists.
Bruno Haible <bruno@clisp.org>
parents: 14946
diff changeset
25 AC_COMPILE_IFELSE(
f62f29997e98 unistd et al.: Don't assume <unistd.h> exists.
Bruno Haible <bruno@clisp.org>
parents: 14946
diff changeset
26 [AC_LANG_PROGRAM(
f62f29997e98 unistd et al.: Don't assume <unistd.h> exists.
Bruno Haible <bruno@clisp.org>
parents: 14946
diff changeset
27 [[@%:@include <unistd.h>]],
f62f29997e98 unistd et al.: Don't assume <unistd.h> exists.
Bruno Haible <bruno@clisp.org>
parents: 14946
diff changeset
28 [[@%:@if _POSIX_VERSION < 199009L && \
f62f29997e98 unistd et al.: Don't assume <unistd.h> exists.
Bruno Haible <bruno@clisp.org>
parents: 14946
diff changeset
29 (defined unix || defined _unix || defined _unix_ \
f62f29997e98 unistd et al.: Don't assume <unistd.h> exists.
Bruno Haible <bruno@clisp.org>
parents: 14946
diff changeset
30 || defined __unix || defined __unix__)
f62f29997e98 unistd et al.: Don't assume <unistd.h> exists.
Bruno Haible <bruno@clisp.org>
parents: 14946
diff changeset
31 @%:@error "'free (NULL)' is not known to work"
f62f29997e98 unistd et al.: Don't assume <unistd.h> exists.
Bruno Haible <bruno@clisp.org>
parents: 14946
diff changeset
32 @%:@endif]])],
f62f29997e98 unistd et al.: Don't assume <unistd.h> exists.
Bruno Haible <bruno@clisp.org>
parents: 14946
diff changeset
33 [gl_cv_func_free=yes],
f62f29997e98 unistd et al.: Don't assume <unistd.h> exists.
Bruno Haible <bruno@clisp.org>
parents: 14946
diff changeset
34 [gl_cv_func_free=no])
f62f29997e98 unistd et al.: Don't assume <unistd.h> exists.
Bruno Haible <bruno@clisp.org>
parents: 14946
diff changeset
35 esac
f62f29997e98 unistd et al.: Don't assume <unistd.h> exists.
Bruno Haible <bruno@clisp.org>
parents: 14946
diff changeset
36 ])
4753
6b790c4dd07d Add 'free' module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
37
5072
d7698ffc0e5e * free.m4: Replace free if it not known to work, not the other way round.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4753
diff changeset
38 if test $gl_cv_func_free = no; then
11007
f6cba5a556ce many *.m4 files: improve m4 quoting
Jim Meyering <meyering@redhat.com>
parents: 6275
diff changeset
39 AC_DEFINE([free], [rpl_free],
4753
6b790c4dd07d Add 'free' module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
40 [Define to rpl_free if the replacement function should be used.])
6b790c4dd07d Add 'free' module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
41 fi
6b790c4dd07d Add 'free' module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
42 ])
6b790c4dd07d Add 'free' module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
43
6b790c4dd07d Add 'free' module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
44 # Prerequisites of lib/free.c.
6b790c4dd07d Add 'free' module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
45 AC_DEFUN([gl_PREREQ_FREE], [:])