summaryrefslogtreecommitdiff
path: root/m4/malloc_h.m4
diff options
context:
space:
mode:
Diffstat (limited to 'm4/malloc_h.m4')
-rw-r--r--m4/malloc_h.m422
1 files changed, 15 insertions, 7 deletions
diff --git a/m4/malloc_h.m4 b/m4/malloc_h.m4
index 4e64b51633..6144ce50c7 100644
--- a/m4/malloc_h.m4
+++ b/m4/malloc_h.m4
@@ -1,4 +1,4 @@
-# malloc_h.m4 serial 2
+# malloc_h.m4 serial 3
dnl Copyright (C) 2020-2021 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -6,10 +6,10 @@ dnl with or without modifications, as long as this notice is preserved.
dnl Written by Bruno Haible.
-AC_DEFUN([gl_MALLOC_H],
+AC_DEFUN_ONCE([gl_MALLOC_H],
[
- dnl Use AC_REQUIRE here, so that the default behavior below is expanded
- dnl once only, before all statements that occur in other macros.
+ dnl Ensure to expand the default settings once only, before all statements
+ dnl that occur in other macros.
AC_REQUIRE([gl_MALLOC_H_DEFAULTS])
gl_CHECK_NEXT_HEADERS([malloc.h])
@@ -31,16 +31,24 @@ AC_DEFUN([gl_MALLOC_H],
AC_DEFUN([gl_MALLOC_MODULE_INDICATOR],
[
- dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
- AC_REQUIRE([gl_MALLOC_H_DEFAULTS])
+ dnl Ensure to expand the default settings once only.
+ gl_MALLOC_H_REQUIRE_DEFAULTS
gl_MODULE_INDICATOR_SET_VARIABLE([$1])
dnl Define it also as a C macro, for the benefit of the unit tests.
gl_MODULE_INDICATOR_FOR_TESTS([$1])
])
+AC_DEFUN([gl_MALLOC_H_REQUIRE_DEFAULTS],
+[
+ m4_defun(GL_MODULE_INDICATOR_PREFIX[_MALLOC_H_MODULE_INDICATOR_DEFAULTS], [
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MEMALIGN])
+ ])
+ m4_require(GL_MODULE_INDICATOR_PREFIX[_MALLOC_H_MODULE_INDICATOR_DEFAULTS])
+ AC_REQUIRE([gl_MALLOC_H_DEFAULTS])
+])
+
AC_DEFUN([gl_MALLOC_H_DEFAULTS],
[
- gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MEMALIGN])
dnl Assume proper GNU behavior unless another module says otherwise.
HAVE_MEMALIGN=1; AC_SUBST([HAVE_MEMALIGN])
REPLACE_MEMALIGN=0; AC_SUBST([REPLACE_MEMALIGN])