summaryrefslogtreecommitdiffstats
path: root/gl/m4/malloc.m4
diff options
context:
space:
mode:
authorHolger Weiss <holger@zedat.fu-berlin.de>2013-08-18 09:03:36 (GMT)
committerHolger Weiss <holger@zedat.fu-berlin.de>2013-08-18 09:03:36 (GMT)
commitf3dbc2ec871da22028969540424a63ff51404cfd (patch)
tree4225e3007008839ec710fcc17ed6cc9bf8db748c /gl/m4/malloc.m4
parent5c8dd483ccc5f4cf2d86c4ae386efb86e3b259cd (diff)
downloadmonitoring-plugins-f3dbc2ec871da22028969540424a63ff51404cfd.tar.gz
Sync with the latest Gnulib code (6f2d632)
Diffstat (limited to 'gl/m4/malloc.m4')
-rw-r--r--gl/m4/malloc.m431
1 files changed, 26 insertions, 5 deletions
diff --git a/gl/m4/malloc.m4 b/gl/m4/malloc.m4
index 910ac92..fe5befc 100644
--- a/gl/m4/malloc.m4
+++ b/gl/m4/malloc.m4
@@ -1,25 +1,40 @@
1# malloc.m4 serial 9 1# malloc.m4 serial 10
2dnl Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc. 2dnl Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
6 6
7# gl_FUNC_MALLOC_GNU
8# ------------------
9# Test whether 'malloc (0)' is handled like in GNU libc, and replace malloc if
10# it is not.
11AC_DEFUN([gl_FUNC_MALLOC_GNU],
12[
13 AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
14 dnl _AC_FUNC_MALLOC_IF is defined in Autoconf.
15 _AC_FUNC_MALLOC_IF(
16 [AC_DEFINE([HAVE_MALLOC], [1],
17 [Define to 1 if your system has a GNU libc compatible 'malloc'
18 function, and to 0 otherwise.])],
19 [AC_DEFINE([HAVE_MALLOC], [0])
20 gl_REPLACE_MALLOC
21 ])
22])
23
7# gl_FUNC_MALLOC_POSIX 24# gl_FUNC_MALLOC_POSIX
8# -------------------- 25# --------------------
9# Test whether 'malloc' is POSIX compliant (sets errno to ENOMEM when it 26# Test whether 'malloc' is POSIX compliant (sets errno to ENOMEM when it
10# fails), and replace malloc if it is not. 27# fails), and replace malloc if it is not.
11AC_DEFUN([gl_FUNC_MALLOC_POSIX], 28AC_DEFUN([gl_FUNC_MALLOC_POSIX],
12[ 29[
30 AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
13 AC_REQUIRE([gl_CHECK_MALLOC_POSIX]) 31 AC_REQUIRE([gl_CHECK_MALLOC_POSIX])
14 if test $gl_cv_func_malloc_posix = yes; then 32 if test $gl_cv_func_malloc_posix = yes; then
15 HAVE_MALLOC_POSIX=1
16 AC_DEFINE([HAVE_MALLOC_POSIX], [1], 33 AC_DEFINE([HAVE_MALLOC_POSIX], [1],
17 [Define if the 'malloc' function is POSIX compliant.]) 34 [Define if the 'malloc' function is POSIX compliant.])
18 else 35 else
19 AC_LIBOBJ([malloc]) 36 gl_REPLACE_MALLOC
20 HAVE_MALLOC_POSIX=0
21 fi 37 fi
22 AC_SUBST([HAVE_MALLOC_POSIX])
23]) 38])
24 39
25# Test whether malloc, realloc, calloc are POSIX compliant, 40# Test whether malloc, realloc, calloc are POSIX compliant,
@@ -39,3 +54,9 @@ AC_DEFUN([gl_CHECK_MALLOC_POSIX],
39 ], [gl_cv_func_malloc_posix=yes], [gl_cv_func_malloc_posix=no]) 54 ], [gl_cv_func_malloc_posix=yes], [gl_cv_func_malloc_posix=no])
40 ]) 55 ])
41]) 56])
57
58AC_DEFUN([gl_REPLACE_MALLOC],
59[
60 AC_LIBOBJ([malloc])
61 REPLACE_MALLOC=1
62])