annotate m4/malloc.m4 @ 447:00924eeb2ec8 3.0

Fixed segfault with output outside of a section
author lost@l-w.ca
date Thu, 04 Nov 2010 23:25:18 -0600
parents b8bf63962a99
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
434
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
1 # malloc.m4 serial 9
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
2 dnl Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc.
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
3 dnl This file is free software; the Free Software Foundation
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
4 dnl gives unlimited permission to copy and/or distribute it,
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
5 dnl with or without modifications, as long as this notice is preserved.
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
6
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
7 # gl_FUNC_MALLOC_POSIX
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
8 # --------------------
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
9 # Test whether 'malloc' is POSIX compliant (sets errno to ENOMEM when it
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
10 # fails), and replace malloc if it is not.
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
11 AC_DEFUN([gl_FUNC_MALLOC_POSIX],
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
12 [
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
13 AC_REQUIRE([gl_CHECK_MALLOC_POSIX])
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
14 if test $gl_cv_func_malloc_posix = yes; then
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
15 HAVE_MALLOC_POSIX=1
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
16 AC_DEFINE([HAVE_MALLOC_POSIX], [1],
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
17 [Define if the 'malloc' function is POSIX compliant.])
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
18 else
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
19 AC_LIBOBJ([malloc])
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
20 HAVE_MALLOC_POSIX=0
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
21 fi
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
22 AC_SUBST([HAVE_MALLOC_POSIX])
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
23 ])
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
24
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
25 # Test whether malloc, realloc, calloc are POSIX compliant,
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
26 # Set gl_cv_func_malloc_posix to yes or no accordingly.
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
27 AC_DEFUN([gl_CHECK_MALLOC_POSIX],
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
28 [
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
29 AC_CACHE_CHECK([whether malloc, realloc, calloc are POSIX compliant],
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
30 [gl_cv_func_malloc_posix],
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
31 [
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
32 dnl It is too dangerous to try to allocate a large amount of memory:
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
33 dnl some systems go to their knees when you do that. So assume that
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
34 dnl all Unix implementations of the function are POSIX compliant.
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
35 AC_TRY_COMPILE([],
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
36 [#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
37 choke me
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
38 #endif
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
39 ], [gl_cv_func_malloc_posix=yes], [gl_cv_func_malloc_posix=no])
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
40 ])
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
41 ])