1
0
mirror of https://git.savannah.gnu.org/git/gnulib.git synced 2026-10-24 00:48:56 +03:00
Files
gnulib/m4/alignalloc.m4
Bruno Haible 99b5f472d4 alignalloc: Don't use aligned_alloc if it is buggy.
Reported by <gnulib@mifar.in> in
<https://lists.gnu.org/archive/html/bug-gnulib/2026-09/msg00097.html>.

* m4/aligned_alloc.m4 (gl_FUNC_ALIGNED_ALLOC_WORKS): New macro,
extracted from gl_FUNC_ALIGNED_ALLOC.
(gl_FUNC_ALIGNED_ALLOC): Use it.
* m4/alignalloc.m4 (gl_ALIGNALLOC): Invoke gl_FUNC_ALIGNED_ALLOC_WORKS
and define HAVE_WORKING_ALIGNED_ALLOC.
* lib/alignalloc.h (ALIGNALLOC_VIA_ALIGNED_ALLOC): Test
HAVE_WORKING_ALIGNED_ALLOC, instead of testing for an address sanitizer.
* modules/alignalloc (Files): Add m4/aligned_alloc.m4.
2026-10-02 08:35:54 +02:00

21 lines
680 B
Plaintext

# alignalloc.m4
# serial 2
dnl Copyright 2022-2026 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
dnl This file is offered as-is, without any warranty.
AC_DEFUN([gl_ALIGNALLOC],
[
AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
gl_FUNC_ALIGNED_ALLOC_WORKS
case "$gl_cv_func_aligned_alloc_works" in
*yes)
AC_DEFINE([HAVE_WORKING_ALIGNED_ALLOC], [1],
[Define to 1 if aligned_alloc exists and works.])
;;
esac
gl_CHECK_FUNCS_ANDROID([posix_memalign], [[#include <stdlib.h>]])
])