diff options
author | Bruno Haible <bruno@clisp.org> | 2020-09-19 15:08:43 +0200 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2020-09-19 15:08:43 +0200 |
commit | aae308a3354bb3d0ae0bdf8647ce9be8e46abbce (patch) | |
tree | ce6663968d93ce365e77693f8a2606288215b391 | |
parent | 3d87a9ada8e2cf75cac9d969d76c5f2ac0b9b38d (diff) | |
download | gnulib-aae308a3354bb3d0ae0bdf8647ce9be8e46abbce.tar.gz |
Fix recognition of musl libc on Alpine Linux 3.10.
Reported by Jeffrey Walton <noloader@gmail.com> in
<https://lists.gnu.org/archive/html/grep-devel/2020-09/msg00020.html>.
* m4/musl.m4 (gl_MUSL_CANONICAL_HOST): New macro.
(gl_MUSL_LIBC): Require it.
* m4/setlocale_null.m4 (gl_FUNC_SETLOCALE_NULL): Likewise.
* modules/setlocale-null (Files): Add m4/musl.m4.
-rw-r--r-- | ChangeLog | 10 | ||||
-rw-r--r-- | m4/musl.m4 | 34 | ||||
-rw-r--r-- | m4/setlocale_null.m4 | 4 | ||||
-rw-r--r-- | modules/setlocale-null | 1 |
4 files changed, 45 insertions, 4 deletions
@@ -1,5 +1,15 @@ 2020-09-19 Bruno Haible <bruno@clisp.org> + Fix recognition of musl libc on Alpine Linux 3.10. + Reported by Jeffrey Walton <noloader@gmail.com> in + <https://lists.gnu.org/archive/html/grep-devel/2020-09/msg00020.html>. + * m4/musl.m4 (gl_MUSL_CANONICAL_HOST): New macro. + (gl_MUSL_LIBC): Require it. + * m4/setlocale_null.m4 (gl_FUNC_SETLOCALE_NULL): Likewise. + * modules/setlocale-null (Files): Add m4/musl.m4. + +2020-09-19 Bruno Haible <bruno@clisp.org> + nl_langinfo: Make multithread-safe on Solaris 10 and Solaris 11.3. Reported for Solaris 10 by Dagobert Michelsen via Paul Eggert in <https://lists.gnu.org/archive/html/bug-gnulib/2020-01/msg00023.html> diff --git a/m4/musl.m4 b/m4/musl.m4 index 252054c99b..343c71a7ce 100644 --- a/m4/musl.m4 +++ b/m4/musl.m4 @@ -1,4 +1,4 @@ -# musl.m4 serial 1 +# musl.m4 serial 2 dnl Copyright (C) 2019-2020 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -9,10 +9,40 @@ dnl with or without modifications, as long as this notice is preserved. # <https://lists.gnu.org/archive/html/bug-gnulib/2018-02/msg00079.html>. # From Bruno Haible. +# There are three ways to test for musl libc: +# a. Look at the 'ldd --version' output. This is how config.guess +# does it. But it fails on Alpine Linux 3.10, because on this system +# 'ldd' is a shell script that does not understand the '--version' +# option. +# b. Test whether the header file <bits/alltypes.h> exists. +# c. Test whether the header file <stdarg.h> defines the macro +# __DEFINED_va_list. +# We use a+c. + AC_DEFUN_ONCE([gl_MUSL_LIBC], [ - AC_REQUIRE([AC_CANONICAL_HOST]) + AC_REQUIRE([gl_MUSL_CANONICAL_HOST]) case "$host_os" in *-musl*) AC_DEFINE([MUSL_LIBC], [1], [Define to 1 on musl libc.]) ;; esac ]) + +# Like AC_CANONICAL_HOST, except for a fix regarding Alpine Linux 3.10. + +AC_DEFUN([gl_MUSL_CANONICAL_HOST], +[ + AC_REQUIRE([AC_CANONICAL_HOST]) + case "$host_os" in + linux*-gnu*) + AC_EGREP_CPP([actually_musl], + [#include <stdarg.h> + #ifdef __DEFINED_va_list + actually_musl + #endif + ], + [host=`echo "$host" | sed -e 's/gnu.*/musl/'` + host_os=`echo "$host_os" | sed -e 's/gnu.*/musl/'` + ]) + ;; + esac +]) diff --git a/m4/setlocale_null.m4 b/m4/setlocale_null.m4 index c1ee1f799e..20c5c99cc0 100644 --- a/m4/setlocale_null.m4 +++ b/m4/setlocale_null.m4 @@ -1,4 +1,4 @@ -# setlocale_null.m4 serial 2 +# setlocale_null.m4 serial 3 dnl Copyright (C) 2019-2020 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,7 +6,7 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_SETLOCALE_NULL], [ - AC_REQUIRE([AC_CANONICAL_HOST]) + AC_REQUIRE([gl_MUSL_CANONICAL_HOST]) AC_REQUIRE([gl_PTHREADLIB]) AC_CHECK_HEADERS_ONCE([threads.h]) diff --git a/modules/setlocale-null b/modules/setlocale-null index 2774004ff1..d8c57a240e 100644 --- a/modules/setlocale-null +++ b/modules/setlocale-null @@ -7,6 +7,7 @@ lib/setlocale_null.c lib/setlocale-lock.c lib/windows-initguard.h m4/setlocale_null.m4 +m4/musl.m4 m4/threadlib.m4 m4/visibility.m4 |