There's no macro to check for musl, so check host_os like for malloc.
The same could be done for OpenBSD and Solaris to save a compilation.
---
v2: • Check musl version using SEEK_DATA
    • Use MUSL_LIBC macro

 m4/free.m4 | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/m4/free.m4 b/m4/free.m4
index c7a134bab8..3666978dff 100644
--- a/m4/free.m4
+++ b/m4/free.m4
@@ -18,6 +18,9 @@ AC_DEFUN([gl_FUNC_FREE],
   dnl So far, we know of three platforms that do this:
   dnl * glibc >= 2.33, thanks to the fix for this bug:
   dnl   <https://sourceware.org/PR17924>
+  dnl * musl >= 1.2.3, thanks to these commits:
+  dnl   
<https://git.musl-libc.org/cgit/musl/commit/?id=9b77aaca86b53c367f23505c24dd3c02e240efad>
+  dnl   
<https://git.musl-libc.org/cgit/musl/commit/?id=2010df0d64570db4ce29cc7df0e31f81aa26ae4a>
   dnl * OpenBSD >= 4.5, thanks to this commit:
   dnl   
<https://cvsweb.openbsd.org/cgi-bin/cvsweb/src/lib/libc/stdlib/malloc.c.diff?r1=1.100&r2=1.101&f=h>
   dnl * Solaris, because its malloc() implementation is based on brk(),
@@ -29,8 +32,12 @@ AC_DEFUN([gl_FUNC_FREE],
     [AC_COMPILE_IFELSE(
        [AC_LANG_PROGRAM(
           [[#include <stdlib.h>
+           #include <unistd.h>
           ]],
+         dnl SEEK_DATA was introduced in the same musl release as free
+         dnl was made to preserve errno.
           [[#if 2 < __GLIBC__ + (33 <= __GLIBC_MINOR__)
+            #elif defined MUSL_LIBC && defined SEEK_DATA
             #elif defined __OpenBSD__
             #elif defined __sun
             #else

base-commit: 4a127339b2446c4b0cec5b67cf29938a74c0acc8
-- 
2.53.0


Reply via email to