@@ -0,0 +1,1153 @@
1+From 453ff940449bbbde9ec00f0bbf82a359c5598fc7 Mon Sep 17 00:00:00 2001
2+From: Bruno Haible <bruno@clisp.org>
3+Date: Sat, 23 Mar 2019 23:00:52 +0100
4+Subject: [PATCH 1/1] Support cross-compilation to musl libc.
5+
6+Reported by Necktwi Ozfguah <necktwi@ferryfair.com>.
7+
8+* m4/calloc.m4 (_AC_FUNC_CALLOC_IF): Add cross-compilation guesses for
9+musl libc.
10+* m4/canonicalize.m4 (gl_FUNC_REALPATH_WORKS): Likewise.
11+* m4/chown.m4 (gl_FUNC_CHOWN): Likewise.
12+* m4/d-ino.m4 (gl_CHECK_TYPE_STRUCT_DIRENT_D_INO): Likewise.
13+* m4/fdopendir.m4 (gl_FUNC_FDOPENDIR): Likewise.
14+* m4/fnmatch.m4 (gl_FUNC_FNMATCH_POSIX): Likewise.
15+* m4/fpurge.m4 (gl_FUNC_FPURGE): Likewise.
16+* m4/getcwd.m4 (gl_FUNC_GETCWD_NULL): Likewise.
17+* m4/getcwd-abort-bug.m4 (gl_FUNC_GETCWD_ABORT_BUG): Likewise.
18+* m4/getdelim.m4 (gl_FUNC_GETDELIM): Likewise.
19+* m4/getgroups.m4 (AC_FUNC_GETGROUPS, gl_FUNC_GETGROUPS): Likewise.
20+* m4/getline.m4 (gl_FUNC_GETLINE): Likewise.
21+* m4/gettimeofday.m4 (gl_FUNC_GETTIMEOFDAY_CLOBBER): Likewise.
22+* m4/hypot.m4 (gl_FUNC_HYPOT): Likewise. // removed
23+* m4/hypotf.m4 (gl_FUNC_HYPOTF): Likewise. // removed
24+* m4/hypotl.m4 (gl_FUNC_HYPOTL): Likewise. // removed
25+* m4/iconv_open-utf.m4 (gl_FUNC_ICONV_OPEN_UTF_SUPPORT): Likewise. // removed
26+* m4/link-follow.m4 (gl_FUNC_LINK_FOLLOWS_SYMLINK): Likewise.
27+* m4/log.m4 (gl_FUNC_LOG): Likewise. // removed
28+* m4/logf.m4 (gl_FUNC_LOGF): Likewise. // removed
29+* m4/logl.m4 (gl_FUNC_LOGL_WORKS): Likewise. // removed
30+* m4/log10.m4 (gl_FUNC_LOG10): Likewise. // removed
31+* m4/log10f.m4 (gl_FUNC_LOG10F): Likewise. // removed
32+* m4/log10l.m4 (gl_FUNC_LOG10L): Likewise. // removed
33+* m4/log1p.m4 (gl_FUNC_LOG1P): Likewise. // removed
34+* m4/log1pf.m4 (gl_FUNC_LOG1PF): Likewise. // removed
35+* m4/log1pl.m4 (gl_FUNC_LOG1PL): Likewise. // removed
36+* m4/log2.m4 (gl_FUNC_LOG2): Likewise. // removed
37+* m4/log2f.m4 (gl_FUNC_LOG2F): Likewise. // removed
38+* m4/malloc.m4 (_AC_FUNC_MALLOC_IF): Likewise.
39+* m4/mkdir.m4 (gl_FUNC_MKDIR): Likewise.
40+* m4/mkstemp.m4 (gl_FUNC_MKSTEMP): Likewise.
41+* m4/modf.m4 (gl_FUNC_MODF): Likewise. // removed
42+* m4/modff.m4 (gl_FUNC_MODFF): Likewise. // removed
43+* m4/modfl.m4 (gl_FUNC_MODFL): Likewise. // removed
44+* m4/perror.m4 (gl_FUNC_PERROR): Likewise.
45+* m4/printf.m4 (gl_PRINTF_SIZES_C99, gl_PRINTF_INFINITE,
46+gl_PRINTF_INFINITE_LONG_DOUBLE, gl_PRINTF_DIRECTIVE_A,
47+gl_PRINTF_DIRECTIVE_F, gl_PRINTF_FLAG_ZERO, gl_SNPRINTF_TRUNCATION_C99,
48+gl_SNPRINTF_RETVAL_C99, gl_SNPRINTF_DIRECTIVE_N,
49+gl_VSNPRINTF_ZEROSIZE_C99): Likewise.
50+* m4/ptsname.m4 (gl_FUNC_PTSNAME): Likewise. // removed
51+* m4/putenv.m4 (gl_FUNC_PUTENV): Likewise.
52+* m4/realloc.m4 (_AC_FUNC_REALLOC_IF): Likewise.
53+* m4/remainder.m4 (gl_FUNC_REMAINDER): Likewise. // removed
54+* m4/remainderf.m4 (gl_FUNC_REMAINDERF): Likewise. // removed
55+* m4/remainderl.m4 (gl_FUNC_REMAINDERL): Likewise. // removed
56+* m4/rintl.m4 (gl_FUNC_RINTL): Likewise. // removed
57+* m4/round.m4 (gl_FUNC_ROUND): Likewise. // removed
58+* m4/roundf.m4 (gl_FUNC_ROUNDF): Likewise. // removed
59+* m4/roundl.m4 (gl_FUNC_ROUNDL): Likewise. // removed
60+* m4/setenv.m4 (gl_FUNC_SETENV): Likewise.
61+* m4/signbit.m4 (gl_SIGNBIT): Likewise.
62+* m4/sleep.m4 (gl_FUNC_SLEEP): Likewise.
63+* m4/stpncpy.m4 (gl_FUNC_STPNCPY): Likewise.
64+* m4/strerror.m4 (gl_FUNC_STRERROR, gl_FUNC_STRERROR_0): Likewise.
65+* m4/strtod.m4 (gl_FUNC_STRTOD): Likewise.
66+* m4/strtold.m4 (gl_FUNC_STRTOLD): Likewise.
67+* m4/trunc.m4 (gl_FUNC_TRUNC): Likewise. // removed
68+* m4/truncf.m4 (gl_FUNC_TRUNCF): Likewise. // removed
69+* m4/truncl.m4 (gl_FUNC_TRUNCL): Likewise. // removed
70+* m4/tzset.m4 (gl_FUNC_TZSET_CLOBBER): Likewise.
71+* m4/ungetc.m4 (gl_FUNC_UNGETC_WORKS): Likewise.
72+* m4/usleep.m4 (gl_FUNC_USLEEP): Likewise.
73+* m4/utimes.m4 (gl_FUNC_UTIMES): Likewise.
74+* m4/wcwidth.m4 (gl_FUNC_WCWIDTH): Likewise.
75+---
76+ m4/calloc.m4 | 4 ++-
77+ m4/canonicalize.m4 | 4 ++-
78+ m4/chown.m4 | 22 +++++++------
79+ m4/d-ino.m4 | 16 +++++-----
80+ m4/fdopendir.m4 | 12 ++++---
81+ m4/fnmatch.m4 | 18 ++++++++---
82+ m4/fpurge.m4 | 24 +++++++++-----
83+ m4/getcwd-abort-bug.m4 | 11 +++++--
84+ m4/getcwd.m4 | 4 ++-
85+ m4/getdelim.m4 | 40 ++++++++++++++----------
86+ m4/getgroups.m4 | 6 +++-
87+ m4/getline.m4 | 38 +++++++++++++---------
88+ m4/gettimeofday.m4 | 4 ++-
89+ m4/link-follow.m4 | 4 ++-
90+ m4/malloc.m4 | 4 +--
91+ m4/mkdir.m4 | 4 ++-
92+ m4/mkstemp.m4 | 4 ++-
93+ m4/perror.m4 | 12 ++++---
94+ m4/printf.m4 | 22 ++++++++++++-
95+ m4/putenv.m4 | 4 ++-
96+ m4/realloc.m4 | 4 +--
97+ m4/setenv.m4 | 4 ++-
98+ m4/signbit.m4 | 6 +++-
99+ m4/sleep.m4 | 4 ++-
100+ m4/stpncpy.m4 | 14 +++++++--
101+ m4/strerror.m4 | 6 +++-
102+ m4/strtod.m4 | 10 +++---
103+ m4/strtold.m4 | 9 ++++--
104+ m4/tzset.m4 | 4 ++-
105+ m4/ungetc.m4 | 18 ++++++-----
106+ m4/usleep.m4 | 4 ++-
107+ m4/utimes.m4 | 10 +++---
108+ m4/wcwidth.m4 | 12 ++++---
109+ 76 files changed, 461 insertions(+), 157 deletions(-)
110+
111+diff --git a/m4/calloc.m4 b/m4/calloc.m4
112+index 012a5bf..d76535d 100644
113+--- a/m4/calloc.m4
114++++ b/m4/calloc.m4
115+@@ -1,4 +1,4 @@
116+-# calloc.m4 serial 18
117++# calloc.m4 serial 19
118+
119+ # Copyright (C) 2004-2019 Free Software Foundation, Inc.
120+ # This file is free software; the Free Software Foundation
121+@@ -40,6 +40,8 @@ AC_DEFUN([_AC_FUNC_CALLOC_IF],
122+ [case "$host_os" in
123+ # Guess yes on glibc systems.
124+ *-gnu* | gnu*) ac_cv_func_calloc_0_nonnull="guessing yes" ;;
125++ # Guess yes on musl systems.
126++ *-musl*) ac_cv_func_calloc_0_nonnull="guessing yes" ;;
127+ # Guess yes on native Windows.
128+ mingw*) ac_cv_func_calloc_0_nonnull="guessing yes" ;;
129+ # If we don't know, assume the worst.
130+diff --git a/m4/canonicalize.m4 b/m4/canonicalize.m4
131+index 5b6e25d..b61747b 100644
132+--- a/m4/canonicalize.m4
133++++ b/m4/canonicalize.m4
134+@@ -1,4 +1,4 @@
135+-# canonicalize.m4 serial 29
136++# canonicalize.m4 serial 30
137+
138+ dnl Copyright (C) 2003-2007, 2009-2019 Free Software Foundation, Inc.
139+
140+@@ -113,6 +113,8 @@ AC_DEFUN([gl_FUNC_REALPATH_WORKS],
141+ [case "$host_os" in
142+ # Guess yes on glibc systems.
143+ *-gnu* | gnu*) gl_cv_func_realpath_works="guessing yes" ;;
144++ # Guess yes on musl systems.
145++ *-musl*) gl_cv_func_realpath_works="guessing yes" ;;
146+ # Guess no on native Windows.
147+ mingw*) gl_cv_func_realpath_works="guessing no" ;;
148+ # If we don't know, assume the worst.
149+diff --git a/m4/chown.m4 b/m4/chown.m4
150+index ecfc0c0..b798325 100644
151+--- a/m4/chown.m4
152++++ b/m4/chown.m4
153+@@ -1,4 +1,4 @@
154+-# serial 30
155++# serial 32
156+ # Determine whether we need the chown wrapper.
157+
158+ dnl Copyright (C) 1997-2001, 2003-2005, 2007, 2009-2019 Free Software
159+@@ -109,10 +109,12 @@ AC_DEFUN_ONCE([gl_FUNC_CHOWN],
160+ [gl_cv_func_chown_slash_works=yes],
161+ [gl_cv_func_chown_slash_works=no],
162+ [case "$host_os" in
163+- # Guess yes on glibc systems.
164+- *-gnu*) gl_cv_func_chown_slash_works="guessing yes" ;;
165+- # If we don't know, assume the worst.
166+- *) gl_cv_func_chown_slash_works="guessing no" ;;
167++ # Guess yes on glibc systems.
168++ *-gnu*) gl_cv_func_chown_slash_works="guessing yes" ;;
169++ # Guess yes on musl systems.
170++ *-musl*) gl_cv_func_chown_slash_works="guessing yes" ;;
171++ # If we don't know, assume the worst.
172++ *) gl_cv_func_chown_slash_works="guessing no" ;;
173+ esac
174+ ])
175+ rm -f conftest.link conftest.file])
176+@@ -145,10 +147,12 @@ AC_DEFUN_ONCE([gl_FUNC_CHOWN],
177+ [gl_cv_func_chown_ctime_works=yes],
178+ [gl_cv_func_chown_ctime_works=no],
179+ [case "$host_os" in
180+- # Guess yes on glibc systems.
181+- *-gnu*) gl_cv_func_chown_ctime_works="guessing yes" ;;
182+- # If we don't know, assume the worst.
183+- *) gl_cv_func_chown_ctime_works="guessing no" ;;
184++ # Guess yes on glibc systems.
185++ *-gnu*) gl_cv_func_chown_ctime_works="guessing yes" ;;
186++ # Guess yes on musl systems.
187++ *-musl*) gl_cv_func_chown_ctime_works="guessing yes" ;;
188++ # If we don't know, assume the worst.
189++ *) gl_cv_func_chown_ctime_works="guessing no" ;;
190+ esac
191+ ])
192+ rm -f conftest.file])
193+diff --git a/m4/d-ino.m4 b/m4/d-ino.m4
194+index f1420cc..87dcacc 100644
195+--- a/m4/d-ino.m4
196++++ b/m4/d-ino.m4
197+@@ -1,4 +1,4 @@
198+-# serial 18
199++# serial 19
200+
201+ dnl From Jim Meyering.
202+ dnl
203+@@ -40,12 +40,14 @@ AC_DEFUN([gl_CHECK_TYPE_STRUCT_DIRENT_D_INO],
204+ [gl_cv_struct_dirent_d_ino=yes],
205+ [gl_cv_struct_dirent_d_ino=no],
206+ [case "$host_os" in
207+- # Guess yes on glibc systems with Linux kernel.
208+- linux*-gnu*) gl_cv_struct_dirent_d_ino="guessing yes" ;;
209+- # Guess no on native Windows.
210+- mingw*) gl_cv_struct_dirent_d_ino="guessing no" ;;
211+- # If we don't know, assume the worst.
212+- *) gl_cv_struct_dirent_d_ino="guessing no" ;;
213++ # Guess yes on glibc systems with Linux kernel.
214++ linux*-gnu*) gl_cv_struct_dirent_d_ino="guessing yes" ;;
215++ # Guess yes on musl systems with Linux kernel.
216++ linux*-musl*) gl_cv_struct_dirent_d_ino="guessing yes" ;;
217++ # Guess no on native Windows.
218++ mingw*) gl_cv_struct_dirent_d_ino="guessing no" ;;
219++ # If we don't know, assume the worst.
220++ *) gl_cv_struct_dirent_d_ino="guessing no" ;;
221+ esac
222+ ])])
223+ case "$gl_cv_struct_dirent_d_ino" in
224+diff --git a/m4/fdopendir.m4 b/m4/fdopendir.m4
225+index 0490551..b2b3b03 100644
226+--- a/m4/fdopendir.m4
227++++ b/m4/fdopendir.m4
228+@@ -1,4 +1,4 @@
229+-# serial 10
230++# serial 11
231+ # See if we need to provide fdopendir.
232+
233+ dnl Copyright (C) 2009-2019 Free Software Foundation, Inc.
234+@@ -45,10 +45,12 @@ DIR *fdopendir (int);
235+ [gl_cv_func_fdopendir_works=yes],
236+ [gl_cv_func_fdopendir_works=no],
237+ [case "$host_os" in
238+- # Guess yes on glibc systems.
239+- *-gnu*) gl_cv_func_fdopendir_works="guessing yes" ;;
240+- # If we don't know, assume the worst.
241+- *) gl_cv_func_fdopendir_works="guessing no" ;;
242++ # Guess yes on glibc systems.
243++ *-gnu*) gl_cv_func_fdopendir_works="guessing yes" ;;
244++ # Guess yes on musl systems.
245++ *-musl*) gl_cv_func_fdopendir_works="guessing yes" ;;
246++ # If we don't know, assume the worst.
247++ *) gl_cv_func_fdopendir_works="guessing no" ;;
248+ esac
249+ ])])
250+ case "$gl_cv_func_fdopendir_works" in
251+diff --git a/m4/fnmatch.m4 b/m4/fnmatch.m4
252+index c264ca7..75ba55b 100644
253+--- a/m4/fnmatch.m4
254++++ b/m4/fnmatch.m4
255+@@ -1,4 +1,4 @@
256+-# Check for fnmatch - serial 13. -*- coding: utf-8 -*-
257++# Check for fnmatch - serial 14. -*- coding: utf-8 -*-
258+
259+ # Copyright (C) 2000-2007, 2009-2019 Free Software Foundation, Inc.
260+ # This file is free software; the Free Software Foundation
261+@@ -14,6 +14,7 @@ AC_DEFUN([gl_FUNC_FNMATCH_POSIX],
262+ m4_divert_text([DEFAULTS], [gl_fnmatch_required=POSIX])
263+
264+ AC_REQUIRE([gl_FNMATCH_H])
265++ AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
266+ gl_fnmatch_required_lowercase=`
267+ echo $gl_fnmatch_required | LC_ALL=C tr '[[A-Z]]' '[[a-z]]'
268+ `
269+@@ -117,12 +118,19 @@ AC_DEFUN([gl_FUNC_FNMATCH_POSIX],
270+ ]])],
271+ [eval "$gl_fnmatch_cache_var=yes"],
272+ [eval "$gl_fnmatch_cache_var=no"],
273+- [eval "$gl_fnmatch_cache_var=\"guessing no\""])
274++ [case "$host_os" in
275++ # Guess yes on musl systems.
276++ *-musl*) eval "$gl_fnmatch_cache_var=\"guessing yes\"" ;;
277++ # Guess no otherwise, even on glibc systems.
278++ *) eval "$gl_fnmatch_cache_var=\"guessing no\"" ;;
279++ esac
280++ ])
281+ ])
282+ eval "gl_fnmatch_result=\"\$$gl_fnmatch_cache_var\""
283+- if test "$gl_fnmatch_result" != yes; then
284+- REPLACE_FNMATCH=1
285+- fi
286++ case "$gl_fnmatch_result" in
287++ *yes) ;;
288++ *) REPLACE_FNMATCH=1 ;;
289++ esac
290+ fi
291+ if test $HAVE_FNMATCH = 0 || test $REPLACE_FNMATCH = 1; then
292+ gl_REPLACE_FNMATCH_H
293+diff --git a/m4/fpurge.m4 b/m4/fpurge.m4
294+index cb21f56..6c5b3e9 100644
295+--- a/m4/fpurge.m4
296++++ b/m4/fpurge.m4
297+@@ -1,4 +1,4 @@
298+-# fpurge.m4 serial 8
299++# fpurge.m4 serial 9
300+ dnl Copyright (C) 2007, 2009-2019 Free Software Foundation, Inc.
301+ dnl This file is free software; the Free Software Foundation
302+ dnl gives unlimited permission to copy and/or distribute it,
303+@@ -7,12 +7,13 @@ dnl with or without modifications, as long as this notice is preserved.
304+ AC_DEFUN([gl_FUNC_FPURGE],
305+ [
306+ AC_REQUIRE([gl_STDIO_H_DEFAULTS])
307++ AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
308+ AC_CHECK_FUNCS_ONCE([fpurge])
309+ AC_CHECK_FUNCS_ONCE([__fpurge])
310+ AC_CHECK_DECLS([fpurge], , , [[#include <stdio.h>]])
311+ if test "x$ac_cv_func_fpurge" = xyes; then
312+ HAVE_FPURGE=1
313+- # Detect BSD bug. Only cygwin 1.7 is known to be immune.
314++ # Detect BSD bug. Only cygwin 1.7 and musl are known to be immune.
315+ AC_CACHE_CHECK([whether fpurge works], [gl_cv_func_fpurge_works],
316+ [AC_RUN_IFELSE(
317+ [AC_LANG_PROGRAM(
318+@@ -48,11 +49,20 @@ AC_DEFUN([gl_FUNC_FPURGE],
319+ return 13;
320+ return 0;
321+ ])],
322+- [gl_cv_func_fpurge_works=yes], [gl_cv_func_fpurge_works=no],
323+- [gl_cv_func_fpurge_works='guessing no'])])
324+- if test "x$gl_cv_func_fpurge_works" != xyes; then
325+- REPLACE_FPURGE=1
326+- fi
327++ [gl_cv_func_fpurge_works=yes],
328++ [gl_cv_func_fpurge_works=no],
329++ [case "$host_os" in
330++ # Guess yes on musl systems.
331++ *-musl*) gl_cv_func_fpurge_works="guessing yes" ;;
332++ # Guess no otherwise.
333++ *) gl_cv_func_fpurge_works="guessing no" ;;
334++ esac
335++ ])
336++ ])
337++ case "$gl_cv_func_fpurge_works" in
338++ *yes) ;;
339++ *) REPLACE_FPURGE=1 ;;
340++ esac
341+ else
342+ HAVE_FPURGE=0
343+ fi
344+diff --git a/m4/getcwd-abort-bug.m4 b/m4/getcwd-abort-bug.m4
345+index f0f24a5..7227f08 100644
346+--- a/m4/getcwd-abort-bug.m4
347++++ b/m4/getcwd-abort-bug.m4
348+@@ -1,4 +1,4 @@
349+-# serial 9
350++# serial 11
351+ # Determine whether getcwd aborts when the length of the working directory
352+ # name is unusually large. Any length between 4k and 16k trigger the bug
353+ # when using glibc-2.4.90-9 or older.
354+@@ -13,6 +13,7 @@
355+ # gl_FUNC_GETCWD_ABORT_BUG([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
356+ AC_DEFUN([gl_FUNC_GETCWD_ABORT_BUG],
357+ [
358++ AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
359+ AC_CHECK_DECLS_ONCE([getcwd])
360+ AC_CHECK_HEADERS_ONCE([unistd.h])
361+ AC_REQUIRE([gl_PATHMAX_SNIPPET_PREREQ])
362+@@ -142,7 +143,13 @@ main ()
363+ else
364+ gl_cv_func_getcwd_abort_bug=no
365+ fi],
366+- [gl_cv_func_getcwd_abort_bug=yes])
367++ [case "$host_os" in
368++ # Guess no on musl systems.
369++ *-musl*) gl_cv_func_getcwd_abort_bug="guessing no" ;;
370++ # Guess yes otherwise, even on glibc systems.
371++ *) gl_cv_func_getcwd_abort_bug="guessing yes"
372++ esac
373++ ])
374+ ])
375+ AS_IF([test $gl_cv_func_getcwd_abort_bug = yes], [$1], [$2])
376+ ])
377+diff --git a/m4/getcwd.m4 b/m4/getcwd.m4
378+index 4929b51..625171a 100644
379+--- a/m4/getcwd.m4
380++++ b/m4/getcwd.m4
381+@@ -6,7 +6,7 @@
382+ # with or without modifications, as long as this notice is preserved.
383+
384+ # Written by Paul Eggert.
385+-# serial 16
386++# serial 17
387+
388+ AC_DEFUN([gl_FUNC_GETCWD_NULL],
389+ [
390+@@ -50,6 +50,8 @@ AC_DEFUN([gl_FUNC_GETCWD_NULL],
391+ [[case "$host_os" in
392+ # Guess yes on glibc systems.
393+ *-gnu* | gnu*) gl_cv_func_getcwd_null="guessing yes";;
394++ # Guess yes on musl systems.
395++ *-musl*) gl_cv_func_getcwd_null="guessing yes";;
396+ # Guess yes on Cygwin.
397+ cygwin*) gl_cv_func_getcwd_null="guessing yes";;
398+ # If we don't know, assume the worst.
399+diff --git a/m4/getdelim.m4 b/m4/getdelim.m4
400+index bf17c57..e77c379 100644
401+--- a/m4/getdelim.m4
402++++ b/m4/getdelim.m4
403+@@ -1,4 +1,4 @@
404+-# getdelim.m4 serial 12
405++# getdelim.m4 serial 13
406+
407+ dnl Copyright (C) 2005-2007, 2009-2019 Free Software Foundation, Inc.
408+ dnl
409+@@ -11,6 +11,7 @@ AC_PREREQ([2.59])
410+ AC_DEFUN([gl_FUNC_GETDELIM],
411+ [
412+ AC_REQUIRE([gl_STDIO_H_DEFAULTS])
413++ AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
414+
415+ dnl Persuade glibc <stdio.h> to declare getdelim().
416+ AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
417+@@ -21,9 +22,10 @@ AC_DEFUN([gl_FUNC_GETDELIM],
418+ if test $ac_cv_func_getdelim = yes; then
419+ HAVE_GETDELIM=1
420+ dnl Found it in some library. Verify that it works.
421+- AC_CACHE_CHECK([for working getdelim function], [gl_cv_func_working_getdelim],
422+- [echo fooNbarN | tr -d '\012' | tr N '\012' > conftest.data
423+- AC_RUN_IFELSE([AC_LANG_SOURCE([[
424++ AC_CACHE_CHECK([for working getdelim function],
425++ [gl_cv_func_working_getdelim],
426++ [echo fooNbarN | tr -d '\012' | tr N '\012' > conftest.data
427++ AC_RUN_IFELSE([AC_LANG_SOURCE([[
428+ # include <stdio.h>
429+ # include <stdlib.h>
430+ # include <string.h>
431+@@ -53,25 +55,31 @@ AC_DEFUN([gl_FUNC_GETDELIM],
432+ fclose (in);
433+ return 0;
434+ }
435+- ]])], [gl_cv_func_working_getdelim=yes] dnl The library version works.
436+- , [gl_cv_func_working_getdelim=no] dnl The library version does NOT work.
437+- , dnl We're cross compiling. Assume it works on glibc2 systems.
438+- [AC_EGREP_CPP([Lucky GNU user],
439+- [
440++ ]])],
441++ [gl_cv_func_working_getdelim=yes],
442++ [gl_cv_func_working_getdelim=no],
443++ [dnl We're cross compiling.
444++ dnl Guess it works on glibc2 systems and musl systems.
445++ AC_EGREP_CPP([Lucky GNU user],
446++ [
447+ #include <features.h>
448+ #ifdef __GNU_LIBRARY__
449+ #if (__GLIBC__ >= 2) && !defined __UCLIBC__
450+ Lucky GNU user
451+ #endif
452+ #endif
453+- ],
454+- [gl_cv_func_working_getdelim="guessing yes"],
455+- [gl_cv_func_working_getdelim="guessing no"])]
456+- )])
457++ ],
458++ [gl_cv_func_working_getdelim="guessing yes"],
459++ [case "$host_os" in
460++ *-musl*) gl_cv_func_working_getdelim="guessing yes" ;;
461++ *) gl_cv_func_working_getdelim="guessing no" ;;
462++ esac
463++ ])
464++ ])
465++ ])
466+ case "$gl_cv_func_working_getdelim" in
467+- *no)
468+- REPLACE_GETDELIM=1
469+- ;;
470++ *yes) ;;
471++ *) REPLACE_GETDELIM=1 ;;
472+ esac
473+ else
474+ HAVE_GETDELIM=0
475+diff --git a/m4/getgroups.m4 b/m4/getgroups.m4
476+index 2ce986e..c93447b 100644
477+--- a/m4/getgroups.m4
478++++ b/m4/getgroups.m4
479+@@ -1,4 +1,4 @@
480+-# serial 21
481++# serial 22
482+
483+ dnl From Jim Meyering.
484+ dnl A wrapper around AC_FUNC_GETGROUPS.
485+@@ -42,6 +42,8 @@ AC_DEFUN([AC_FUNC_GETGROUPS],
486+ [case "$host_os" in # ((
487+ # Guess yes on glibc systems.
488+ *-gnu* | gnu*) ac_cv_func_getgroups_works="guessing yes" ;;
489++ # Guess yes on musl systems.
490++ *-musl*) ac_cv_func_getgroups_works="guessing yes" ;;
491+ # If we don't know, assume the worst.
492+ *) ac_cv_func_getgroups_works="guessing no" ;;
493+ esac
494+@@ -95,6 +97,8 @@ AC_DEFUN([gl_FUNC_GETGROUPS],
495+ [case "$host_os" in
496+ # Guess yes on glibc systems.
497+ *-gnu* | gnu*) gl_cv_func_getgroups_works="guessing yes" ;;
498++ # Guess yes on musl systems.
499++ *-musl*) gl_cv_func_getgroups_works="guessing yes" ;;
500+ # If we don't know, assume the worst.
501+ *) gl_cv_func_getgroups_works="guessing no" ;;
502+ esac
503+diff --git a/m4/getline.m4 b/m4/getline.m4
504+index 5b2ead2..32f771c 100644
505+--- a/m4/getline.m4
506++++ b/m4/getline.m4
507+@@ -1,4 +1,4 @@
508+-# getline.m4 serial 28
509++# getline.m4 serial 29
510+
511+ dnl Copyright (C) 1998-2003, 2005-2007, 2009-2019 Free Software Foundation,
512+ dnl Inc.
513+@@ -16,6 +16,7 @@ dnl to do with the function we need.
514+ AC_DEFUN([gl_FUNC_GETLINE],
515+ [
516+ AC_REQUIRE([gl_STDIO_H_DEFAULTS])
517++ AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
518+
519+ dnl Persuade glibc <stdio.h> to declare getline().
520+ AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
521+@@ -28,9 +29,10 @@ AC_DEFUN([gl_FUNC_GETLINE],
522+ gl_getline_needs_run_time_check=yes],
523+ [am_cv_func_working_getline=no])
524+ if test $gl_getline_needs_run_time_check = yes; then
525+- AC_CACHE_CHECK([for working getline function], [am_cv_func_working_getline],
526+- [echo fooNbarN | tr -d '\012' | tr N '\012' > conftest.data
527+- AC_RUN_IFELSE([AC_LANG_SOURCE([[
528++ AC_CACHE_CHECK([for working getline function],
529++ [am_cv_func_working_getline],
530++ [echo fooNbarN | tr -d '\012' | tr N '\012' > conftest.data
531++ AC_RUN_IFELSE([AC_LANG_SOURCE([[
532+ # include <stdio.h>
533+ # include <stdlib.h>
534+ # include <string.h>
535+@@ -61,21 +63,28 @@ AC_DEFUN([gl_FUNC_GETLINE],
536+ fclose (in);
537+ return 0;
538+ }
539+- ]])], [am_cv_func_working_getline=yes] dnl The library version works.
540+- , [am_cv_func_working_getline=no] dnl The library version does NOT work.
541+- , dnl We're cross compiling. Assume it works on glibc2 systems.
542+- [AC_EGREP_CPP([Lucky GNU user],
543+- [
544++ ]])],
545++ [am_cv_func_working_getline=yes],
546++ [am_cv_func_working_getline=no],
547++ [dnl We're cross compiling.
548++ dnl Guess it works on glibc2 systems and musl systems.
549++ AC_EGREP_CPP([Lucky GNU user],
550++ [
551+ #include <features.h>
552+ #ifdef __GNU_LIBRARY__
553+ #if (__GLIBC__ >= 2) && !defined __UCLIBC__
554+ Lucky GNU user
555+ #endif
556+ #endif
557+- ],
558+- [am_cv_func_working_getline="guessing yes"],
559+- [am_cv_func_working_getline="guessing no"])]
560+- )])
561++ ],
562++ [am_cv_func_working_getline="guessing yes"],
563++ [case "$host_os" in
564++ *-musl*) am_cv_func_working_getline="guessing yes" ;;
565++ *) am_cv_func_working_getline="guessing no" ;;
566++ esac
567++ ])
568++ ])
569++ ])
570+ fi
571+
572+ if test $ac_cv_have_decl_getline = no; then
573+@@ -83,7 +92,8 @@ AC_DEFUN([gl_FUNC_GETLINE],
574+ fi
575+
576+ case "$am_cv_func_working_getline" in
577+- *no)
578++ *yes) ;;
579++ *)
580+ dnl Set REPLACE_GETLINE always: Even if we have not found the broken
581+ dnl getline function among $LIBS, it may exist in libinet and the
582+ dnl executable may be linked with -linet.
583+diff --git a/m4/gettimeofday.m4 b/m4/gettimeofday.m4
584+index d29b4bf..5e2ef6f 100644
585+--- a/m4/gettimeofday.m4
586++++ b/m4/gettimeofday.m4
587+@@ -1,4 +1,4 @@
588+-# serial 25
589++# serial 26
590+
591+ # Copyright (C) 2001-2003, 2005, 2007, 2009-2019 Free Software Foundation, Inc.
592+ # This file is free software; the Free Software Foundation
593+@@ -105,6 +105,8 @@ AC_DEFUN([gl_FUNC_GETTIMEOFDAY_CLOBBER],
594+ case "$host_os" in
595+ # Guess all is fine on glibc systems.
596+ *-gnu* | gnu*) gl_cv_func_gettimeofday_clobber="guessing no" ;;
597++ # Guess all is fine on musl systems.
598++ *-musl*) gl_cv_func_gettimeofday_clobber="guessing no" ;;
599+ # Guess no on native Windows.
600+ mingw*) gl_cv_func_gettimeofday_clobber="guessing no" ;;
601+ # If we don't know, assume the worst.
602+diff --git a/m4/link-follow.m4 b/m4/link-follow.m4
603+index cbd2dca..8ac7301 100644
604+--- a/m4/link-follow.m4
605++++ b/m4/link-follow.m4
606+@@ -1,4 +1,4 @@
607+-# serial 20
608++# serial 21
609+ dnl Run a program to determine whether link(2) follows symlinks.
610+ dnl Set LINK_FOLLOWS_SYMLINKS accordingly.
611+
612+@@ -88,6 +88,8 @@ AC_DEFUN([gl_FUNC_LINK_FOLLOWS_SYMLINK],
613+ case "$host_os" in
614+ # On glibc/Linux we know the result.
615+ linux*-gnu* | gnu*) gl_cv_func_link_follows_symlink="guessing no" ;;
616++ # On musl/Linux we know the result.
617++ linux*-musl*) gl_cv_func_link_follows_symlink="guessing no" ;;
618+ # Otherwise, we don't know.
619+ *) gl_cv_func_link_follows_symlink=unknown ;;
620+ esac
621+diff --git a/m4/malloc.m4 b/m4/malloc.m4
622+index b9b8d4b..c469c45 100644
623+--- a/m4/malloc.m4
624++++ b/m4/malloc.m4
625+@@ -1,4 +1,4 @@
626+-# malloc.m4 serial 17
627++# malloc.m4 serial 19
628+ dnl Copyright (C) 2007, 2009-2019 Free Software Foundation, Inc.
629+ dnl This file is free software; the Free Software Foundation
630+ dnl gives unlimited permission to copy and/or distribute it,
631+@@ -32,7 +32,7 @@ AC_DEFUN([_AC_FUNC_MALLOC_IF],
632+ [ac_cv_func_malloc_0_nonnull=no],
633+ [case "$host_os" in
634+ # Guess yes on platforms where we know the result.
635+- *-gnu* | gnu* | freebsd* | netbsd* | openbsd* \
636++ *-gnu* | gnu* | *-musl* | freebsd* | netbsd* | openbsd* \
637+ | hpux* | solaris* | cygwin* | mingw*)
638+ ac_cv_func_malloc_0_nonnull="guessing yes" ;;
639+ # If we don't know, assume the worst.
640+diff --git a/m4/mkdir.m4 b/m4/mkdir.m4
641+index 4cd9590..366a3cd 100644
642+--- a/m4/mkdir.m4
643++++ b/m4/mkdir.m4
644+@@ -1,4 +1,4 @@
645+-# serial 14
646++# serial 15
647+
648+ # Copyright (C) 2001, 2003-2004, 2006, 2008-2019 Free Software Foundation, Inc.
649+ # This file is free software; the Free Software Foundation
650+@@ -62,6 +62,8 @@ AC_DEFUN([gl_FUNC_MKDIR],
651+ [case "$host_os" in
652+ # Guess yes on glibc systems.
653+ *-gnu* | gnu*) gl_cv_func_mkdir_trailing_dot_works="guessing yes" ;;
654++ # Guess yes on musl systems.
655++ *-musl*) gl_cv_func_mkdir_trailing_dot_works="guessing yes" ;;
656+ # Guess no on native Windows.
657+ mingw*) gl_cv_func_mkdir_trailing_dot_works="guessing no" ;;
658+ # If we don't know, assume the worst.
659+diff --git a/m4/mkstemp.m4 b/m4/mkstemp.m4
660+index ae24c3b..1b15c2e 100644
661+--- a/m4/mkstemp.m4
662++++ b/m4/mkstemp.m4
663+@@ -1,4 +1,4 @@
664+-#serial 25
665++#serial 26
666+
667+ # Copyright (C) 2001, 2003-2007, 2009-2019 Free Software Foundation, Inc.
668+ # This file is free software; the Free Software Foundation
669+@@ -59,6 +59,8 @@ AC_DEFUN([gl_FUNC_MKSTEMP],
670+ [case "$host_os" in
671+ # Guess yes on glibc systems.
672+ *-gnu* | gnu*) gl_cv_func_working_mkstemp="guessing yes" ;;
673++ # Guess yes on musl systems.
674++ *-musl*) gl_cv_func_working_mkstemp="guessing yes" ;;
675+ # Guess no on native Windows.
676+ mingw*) gl_cv_func_working_mkstemp="guessing no" ;;
677+ # If we don't know, assume the worst.
678+diff --git a/m4/perror.m4 b/m4/perror.m4
679+index 335be72..08e2db1 100644
680+--- a/m4/perror.m4
681++++ b/m4/perror.m4
682+@@ -1,4 +1,4 @@
683+-# perror.m4 serial 7
684++# perror.m4 serial 8
685+ dnl Copyright (C) 2008-2019 Free Software Foundation, Inc.
686+ dnl This file is free software; the Free Software Foundation
687+ dnl gives unlimited permission to copy and/or distribute it,
688+@@ -48,10 +48,12 @@ AC_DEFUN([gl_FUNC_PERROR],
689+ rm -rf conftest.txt1 conftest.txt2],
690+ [gl_cv_func_perror_works=no],
691+ [case "$host_os" in
692+- # Guess yes on native Windows.
693+- mingw*) gl_cv_func_perror_works="guessing yes" ;;
694+- # Otherwise guess no.
695+- *) gl_cv_func_perror_works="guessing no" ;;
696++ # Guess yes on musl systems.
697++ *-musl*) gl_cv_func_perror_works="guessing yes" ;;
698++ # Guess yes on native Windows.
699++ mingw*) gl_cv_func_perror_works="guessing yes" ;;
700++ # Otherwise guess no.
701++ *) gl_cv_func_perror_works="guessing no" ;;
702+ esac
703+ ])
704+ ])
705+diff --git a/m4/printf.m4 b/m4/printf.m4
706+index cbf6ae4..6d2280e 100644
707+--- a/m4/printf.m4
708++++ b/m4/printf.m4
709+@@ -1,4 +1,4 @@
710+-# printf.m4 serial 60
711++# printf.m4 serial 61
712+ dnl Copyright (C) 2003, 2007-2019 Free Software Foundation, Inc.
713+ dnl This file is free software; the Free Software Foundation
714+ dnl gives unlimited permission to copy and/or distribute it,
715+@@ -62,6 +62,8 @@ int main ()
716+ changequote(,)dnl
717+ # Guess yes on glibc systems.
718+ *-gnu* | gnu*) gl_cv_func_printf_sizes_c99="guessing yes";;
719++ # Guess yes on musl systems.
720++ *-musl*) gl_cv_func_printf_sizes_c99="guessing yes";;
721+ # Guess yes on FreeBSD >= 5.
722+ freebsd[1-4].*) gl_cv_func_printf_sizes_c99="guessing no";;
723+ freebsd* | kfreebsd*) gl_cv_func_printf_sizes_c99="guessing yes";;
724+@@ -240,6 +242,8 @@ int main ()
725+ changequote(,)dnl
726+ # Guess yes on glibc systems.
727+ *-gnu* | gnu*) gl_cv_func_printf_infinite="guessing yes";;
728++ # Guess yes on musl systems.
729++ *-musl*) gl_cv_func_printf_infinite="guessing yes";;
730+ # Guess yes on FreeBSD >= 6.
731+ freebsd[1-5].*) gl_cv_func_printf_infinite="guessing no";;
732+ freebsd* | kfreebsd*) gl_cv_func_printf_infinite="guessing yes";;
733+@@ -457,6 +461,8 @@ int main ()
734+ changequote(,)dnl
735+ # Guess yes on glibc systems.
736+ *-gnu* | gnu*) gl_cv_func_printf_infinite_long_double="guessing yes";;
737++ # Guess yes on musl systems.
738++ *-musl*) gl_cv_func_printf_infinite_long_double="guessing yes";;
739+ # Guess yes on FreeBSD >= 6.
740+ freebsd[1-5].*) gl_cv_func_printf_infinite_long_double="guessing no";;
741+ freebsd* | kfreebsd*) gl_cv_func_printf_infinite_long_double="guessing yes";;
742+@@ -575,6 +581,8 @@ int main ()
743+ [gl_cv_func_printf_directive_a="guessing yes"],
744+ [gl_cv_func_printf_directive_a="guessing no"])
745+ ;;
746++ # Guess yes on musl systems.
747++ *-musl*) gl_cv_func_printf_directive_a="guessing yes";;
748+ # Guess no on Android.
749+ linux*-android*) gl_cv_func_printf_directive_a="guessing no";;
750+ # Guess no on native Windows.
751+@@ -625,6 +633,8 @@ int main ()
752+ changequote(,)dnl
753+ # Guess yes on glibc systems.
754+ *-gnu* | gnu*) gl_cv_func_printf_directive_f="guessing yes";;
755++ # Guess yes on musl systems.
756++ *-musl*) gl_cv_func_printf_directive_f="guessing yes";;
757+ # Guess yes on FreeBSD >= 6.
758+ freebsd[1-5].*) gl_cv_func_printf_directive_f="guessing no";;
759+ freebsd* | kfreebsd*) gl_cv_func_printf_directive_f="guessing yes";;
760+@@ -960,6 +970,8 @@ changequote(,)dnl
761+ case "$host_os" in
762+ # Guess yes on glibc systems.
763+ *-gnu* | gnu*) gl_cv_func_printf_flag_zero="guessing yes";;
764++ # Guess yes on musl systems.
765++ *-musl*) gl_cv_func_printf_flag_zero="guessing yes";;
766+ # Guess yes on BeOS.
767+ beos*) gl_cv_func_printf_flag_zero="guessing yes";;
768+ # Guess no on Android.
769+@@ -1206,6 +1218,8 @@ changequote(,)dnl
770+ case "$host_os" in
771+ # Guess yes on glibc systems.
772+ *-gnu* | gnu*) gl_cv_func_snprintf_truncation_c99="guessing yes";;
773++ # Guess yes on musl systems.
774++ *-musl*) gl_cv_func_snprintf_truncation_c99="guessing yes";;
775+ # Guess yes on FreeBSD >= 5.
776+ freebsd[1-4].*) gl_cv_func_snprintf_truncation_c99="guessing no";;
777+ freebsd* | kfreebsd*) gl_cv_func_snprintf_truncation_c99="guessing yes";;
778+@@ -1308,6 +1322,8 @@ int main ()
779+ changequote(,)dnl
780+ # Guess yes on glibc systems.
781+ *-gnu* | gnu*) gl_cv_func_snprintf_retval_c99="guessing yes";;
782++ # Guess yes on musl systems.
783++ *-musl*) gl_cv_func_snprintf_retval_c99="guessing yes";;
784+ # Guess yes on FreeBSD >= 5.
785+ freebsd[1-4].*) gl_cv_func_snprintf_retval_c99="guessing no";;
786+ freebsd* | kfreebsd*) gl_cv_func_snprintf_retval_c99="guessing yes";;
787+@@ -1400,6 +1416,8 @@ changequote(,)dnl
788+ case "$host_os" in
789+ # Guess yes on glibc systems.
790+ *-gnu* | gnu*) gl_cv_func_snprintf_directive_n="guessing yes";;
791++ # Guess yes on musl systems.
792++ *-musl*) gl_cv_func_snprintf_directive_n="guessing yes";;
793+ # Guess yes on FreeBSD >= 5.
794+ freebsd[1-4].*) gl_cv_func_snprintf_directive_n="guessing no";;
795+ freebsd* | kfreebsd*) gl_cv_func_snprintf_directive_n="guessing yes";;
796+@@ -1554,6 +1572,8 @@ changequote(,)dnl
797+ case "$host_os" in
798+ # Guess yes on glibc systems.
799+ *-gnu* | gnu*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
800++ # Guess yes on musl systems.
801++ *-musl*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
802+ # Guess yes on FreeBSD >= 5.
803+ freebsd[1-4].*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";;
804+ freebsd* | kfreebsd*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
805+diff --git a/m4/putenv.m4 b/m4/putenv.m4
806+index f8960f6..342ba26 100644
807+--- a/m4/putenv.m4
808++++ b/m4/putenv.m4
809+@@ -1,4 +1,4 @@
810+-# putenv.m4 serial 22
811++# putenv.m4 serial 23
812+ dnl Copyright (C) 2002-2019 Free Software Foundation, Inc.
813+ dnl This file is free software; the Free Software Foundation
814+ dnl gives unlimited permission to copy and/or distribute it,
815+@@ -36,6 +36,8 @@ AC_DEFUN([gl_FUNC_PUTENV],
816+ [case "$host_os" in
817+ # Guess yes on glibc systems.
818+ *-gnu* | gnu*) gl_cv_func_svid_putenv="guessing yes" ;;
819++ # Guess yes on musl systems.
820++ *-musl*) gl_cv_func_svid_putenv="guessing yes" ;;
821+ # Guess no on native Windows.
822+ mingw*) gl_cv_func_svid_putenv="guessing no" ;;
823+ # If we don't know, assume the worst.
824+diff --git a/m4/realloc.m4 b/m4/realloc.m4
825+index f9f15ad..93066e8 100644
826+--- a/m4/realloc.m4
827++++ b/m4/realloc.m4
828+@@ -1,4 +1,4 @@
829+-# realloc.m4 serial 15
830++# realloc.m4 serial 17
831+ dnl Copyright (C) 2007, 2009-2019 Free Software Foundation, Inc.
832+ dnl This file is free software; the Free Software Foundation
833+ dnl gives unlimited permission to copy and/or distribute it,
834+@@ -32,7 +32,7 @@ AC_DEFUN([_AC_FUNC_REALLOC_IF],
835+ [ac_cv_func_realloc_0_nonnull=no],
836+ [case "$host_os" in
837+ # Guess yes on platforms where we know the result.
838+- *-gnu* | gnu* | freebsd* | netbsd* | openbsd* \
839++ *-gnu* | gnu* | *-musl* | freebsd* | netbsd* | openbsd* \
840+ | hpux* | solaris* | cygwin* | mingw*)
841+ ac_cv_func_realloc_0_nonnull="guessing yes" ;;
842+ # If we don't know, assume the worst.
843+diff --git a/m4/setenv.m4 b/m4/setenv.m4
844+index 6101274..a8f83d6 100644
845+--- a/m4/setenv.m4
846++++ b/m4/setenv.m4
847+@@ -1,4 +1,4 @@
848+-# setenv.m4 serial 27
849++# setenv.m4 serial 28
850+ dnl Copyright (C) 2001-2004, 2006-2019 Free Software Foundation, Inc.
851+ dnl This file is free software; the Free Software Foundation
852+ dnl gives unlimited permission to copy and/or distribute it,
853+@@ -37,6 +37,8 @@ AC_DEFUN([gl_FUNC_SETENV],
854+ [case "$host_os" in
855+ # Guess yes on glibc systems.
856+ *-gnu* | gnu*) gl_cv_func_setenv_works="guessing yes" ;;
857++ # Guess yes on musl systems.
858++ *-musl*) gl_cv_func_setenv_works="guessing yes" ;;
859+ # If we don't know, assume the worst.
860+ *) gl_cv_func_setenv_works="guessing no" ;;
861+ esac
862+diff --git a/m4/signbit.m4 b/m4/signbit.m4
863+index bf5bce5..f7f2f3d 100644
864+--- a/m4/signbit.m4
865++++ b/m4/signbit.m4
866+@@ -1,4 +1,4 @@
867+-# signbit.m4 serial 16
868++# signbit.m4 serial 17
869+ dnl Copyright (C) 2007-2019 Free Software Foundation, Inc.
870+ dnl This file is free software; the Free Software Foundation
871+ dnl gives unlimited permission to copy and/or distribute it,
872+@@ -31,6 +31,8 @@ AC_DEFUN([gl_SIGNBIT],
873+ [case "$host_os" in
874+ # Guess yes on glibc systems.
875+ *-gnu* | gnu*) gl_cv_func_signbit="guessing yes" ;;
876++ # Guess yes on musl systems.
877++ *-musl*) gl_cv_func_signbit="guessing yes" ;;
878+ # Guess yes on native Windows.
879+ mingw*) gl_cv_func_signbit="guessing yes" ;;
880+ # If we don't know, assume the worst.
881+@@ -62,6 +64,8 @@ AC_DEFUN([gl_SIGNBIT],
882+ [case "$host_os" in
883+ # Guess yes on glibc systems.
884+ *-gnu* | gnu*) gl_cv_func_signbit_gcc="guessing yes" ;;
885++ # Guess yes on musl systems.
886++ *-musl*) gl_cv_func_signbit_gcc="guessing yes" ;;
887+ # Guess yes on mingw, no on MSVC.
888+ mingw*) if test -n "$GCC"; then
889+ gl_cv_func_signbit_gcc="guessing yes"
890+diff --git a/m4/sleep.m4 b/m4/sleep.m4
891+index 5f71cc7..7bab467 100644
892+--- a/m4/sleep.m4
893++++ b/m4/sleep.m4
894+@@ -1,4 +1,4 @@
895+-# sleep.m4 serial 9
896++# sleep.m4 serial 10
897+ dnl Copyright (C) 2007-2019 Free Software Foundation, Inc.
898+ dnl This file is free software; the Free Software Foundation
899+ dnl gives unlimited permission to copy and/or distribute it,
900+@@ -48,6 +48,8 @@ handle_alarm (int sig)
901+ [case "$host_os" in
902+ # Guess yes on glibc systems.
903+ *-gnu* | gnu*) gl_cv_func_sleep_works="guessing yes" ;;
904++ # Guess yes on musl systems.
905++ *-musl*) gl_cv_func_sleep_works="guessing yes" ;;
906+ # Guess no on native Windows.
907+ mingw*) gl_cv_func_sleep_works="guessing no" ;;
908+ # If we don't know, assume the worst.
909+diff --git a/m4/stpncpy.m4 b/m4/stpncpy.m4
910+index 83425dd..f8e1a7c 100644
911+--- a/m4/stpncpy.m4
912++++ b/m4/stpncpy.m4
913+@@ -1,4 +1,4 @@
914+-# stpncpy.m4 serial 16
915++# stpncpy.m4 serial 17
916+ dnl Copyright (C) 2002-2003, 2005-2007, 2009-2019 Free Software Foundation,
917+ dnl Inc.
918+ dnl This file is free software; the Free Software Foundation
919+@@ -7,6 +7,8 @@ dnl with or without modifications, as long as this notice is preserved.
920+
921+ AC_DEFUN([gl_FUNC_STPNCPY],
922+ [
923++ AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
924++
925+ dnl Persuade glibc <string.h> to declare stpncpy().
926+ AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
927+
928+@@ -69,12 +71,18 @@ int main ()
929+ ]])],
930+ [gl_cv_func_stpncpy=yes],
931+ [gl_cv_func_stpncpy=no],
932+- [AC_EGREP_CPP([Thanks for using GNU], [
933++ [dnl Guess yes on glibc systems and musl systems.
934++ AC_EGREP_CPP([Thanks for using GNU], [
935+ #include <features.h>
936+ #ifdef __GNU_LIBRARY__
937+ Thanks for using GNU
938+ #endif
939+-], [gl_cv_func_stpncpy="guessing yes"], [gl_cv_func_stpncpy="guessing no"])
940++], [gl_cv_func_stpncpy="guessing yes"],
941++ [case "$host_os" in
942++ *-musl*) gl_cv_func_stpncpy="guessing yes" ;;
943++ *) gl_cv_func_stpncpy="guessing no" ;;
944++ esac
945++ ])
946+ ])
947+ ])
948+ case "$gl_cv_func_stpncpy" in
949+diff --git a/m4/strerror.m4 b/m4/strerror.m4
950+index b452f7f..2c90f31 100644
951+--- a/m4/strerror.m4
952++++ b/m4/strerror.m4
953+@@ -1,4 +1,4 @@
954+-# strerror.m4 serial 19
955++# strerror.m4 serial 20
956+ dnl Copyright (C) 2002, 2007-2019 Free Software Foundation, Inc.
957+ dnl This file is free software; the Free Software Foundation
958+ dnl gives unlimited permission to copy and/or distribute it,
959+@@ -26,6 +26,8 @@ AC_DEFUN([gl_FUNC_STRERROR],
960+ [case "$host_os" in
961+ # Guess yes on glibc systems.
962+ *-gnu* | gnu*) gl_cv_func_working_strerror="guessing yes" ;;
963++ # Guess yes on musl systems.
964++ *-musl*) gl_cv_func_working_strerror="guessing yes" ;;
965+ # If we don't know, assume the worst.
966+ *) gl_cv_func_working_strerror="guessing no" ;;
967+ esac
968+@@ -80,6 +82,8 @@ AC_DEFUN([gl_FUNC_STRERROR_0],
969+ [case "$host_os" in
970+ # Guess yes on glibc systems.
971+ *-gnu* | gnu*) gl_cv_func_strerror_0_works="guessing yes" ;;
972++ # Guess yes on musl systems.
973++ *-musl*) gl_cv_func_strerror_0_works="guessing yes" ;;
974+ # Guess yes on native Windows.
975+ mingw*) gl_cv_func_strerror_0_works="guessing yes" ;;
976+ # If we don't know, assume the worst.
977+diff --git a/m4/strtod.m4 b/m4/strtod.m4
978+index 9912217..d68ab75 100644
979+--- a/m4/strtod.m4
980++++ b/m4/strtod.m4
981+@@ -1,4 +1,4 @@
982+-# strtod.m4 serial 24
983++# strtod.m4 serial 25
984+ dnl Copyright (C) 2002-2003, 2006-2019 Free Software Foundation, Inc.
985+ dnl This file is free software; the Free Software Foundation
986+ dnl gives unlimited permission to copy and/or distribute it,
987+@@ -115,9 +115,11 @@ numeric_equal (double x, double y)
988+ ],
989+ [gl_cv_func_strtod_works="guessing yes"],
990+ [case "$host_os" in
991+- # Guess yes on native Windows.
992+- mingw*) gl_cv_func_strtod_works="guessing yes" ;;
993+- *) gl_cv_func_strtod_works="guessing no" ;;
994++ # Guess yes on musl systems.
995++ *-musl*) gl_cv_func_strtod_works="guessing yes" ;;
996++ # Guess yes on native Windows.
997++ mingw*) gl_cv_func_strtod_works="guessing yes" ;;
998++ *) gl_cv_func_strtod_works="guessing no" ;;
999+ esac
1000+ ])
1001+ ])
1002+diff --git a/m4/strtold.m4 b/m4/strtold.m4
1003+index 16b4eda..17125fe 100644
1004+--- a/m4/strtold.m4
1005++++ b/m4/strtold.m4
1006+@@ -1,4 +1,4 @@
1007+-# strtold.m4 serial 2
1008++# strtold.m4 serial 4
1009+ dnl Copyright (C) 2002-2003, 2006-2019 Free Software Foundation, Inc.
1010+ dnl This file is free software; the Free Software Foundation
1011+ dnl gives unlimited permission to copy and/or distribute it,
1012+@@ -98,7 +98,12 @@ numeric_equal (long double x, long double y)
1013+ #endif
1014+ ],
1015+ [gl_cv_func_strtold_works="guessing yes"],
1016+- [gl_cv_func_strtod_works="guessing no"])
1017++ [case "$host_os" in
1018++ # Guess yes on musl systems.
1019++ *-musl*) gl_cv_func_strtold_works="guessing yes" ;;
1020++ *) gl_cv_func_strtold_works="guessing no" ;;
1021++ esac
1022++ ])
1023+ ])
1024+ ])
1025+ case "$gl_cv_func_strtold_works" in
1026+diff --git a/m4/tzset.m4 b/m4/tzset.m4
1027+index 1278801..afdfa8e 100644
1028+--- a/m4/tzset.m4
1029++++ b/m4/tzset.m4
1030+@@ -1,4 +1,4 @@
1031+-# serial 11
1032++# serial 12
1033+
1034+ # Copyright (C) 2003, 2007, 2009-2019 Free Software Foundation, Inc.
1035+ # This file is free software; the Free Software Foundation
1036+@@ -70,6 +70,8 @@ main ()
1037+ [case "$host_os" in
1038+ # Guess all is fine on glibc systems.
1039+ *-gnu* | gnu*) gl_cv_func_tzset_clobber="guessing no" ;;
1040++ # Guess all is fine on musl systems.
1041++ *-musl*) gl_cv_func_tzset_clobber="guessing no" ;;
1042+ # Guess no on native Windows.
1043+ mingw*) gl_cv_func_tzset_clobber="guessing no" ;;
1044+ # If we don't know, assume the worst.
1045+diff --git a/m4/ungetc.m4 b/m4/ungetc.m4
1046+index ab8757b..08baf33 100644
1047+--- a/m4/ungetc.m4
1048++++ b/m4/ungetc.m4
1049+@@ -1,4 +1,4 @@
1050+-# ungetc.m4 serial 6
1051++# ungetc.m4 serial 7
1052+ dnl Copyright (C) 2009-2019 Free Software Foundation, Inc.
1053+ dnl This file is free software; the Free Software Foundation
1054+ dnl gives unlimited permission to copy and/or distribute it,
1055+@@ -41,12 +41,16 @@ AC_DEFUN_ONCE([gl_FUNC_UNGETC_WORKS],
1056+ remove ("conftest.tmp");])],
1057+ [gl_cv_func_ungetc_works=yes], [gl_cv_func_ungetc_works=no],
1058+ [case "$host_os" in
1059+- # Guess yes on glibc and bionic systems.
1060+- *-gnu* | gnu* | *-android*) gl_cv_func_ungetc_works="guessing yes" ;;
1061+- # Guess yes on native Windows.
1062+- mingw*) gl_cv_func_ungetc_works="guessing yes" ;;
1063+- # If we don't know, assume the worst.
1064+- *) gl_cv_func_ungetc_works="guessing no" ;;
1065++ # Guess yes on glibc systems.
1066++ *-gnu* | gnu*) gl_cv_func_ungetc_works="guessing yes" ;;
1067++ # Guess yes on musl systems.
1068++ *-musl*) gl_cv_func_ungetc_works="guessing yes" ;;
1069++ # Guess yes on bionic systems.
1070++ *-android*) gl_cv_func_ungetc_works="guessing yes" ;;
1071++ # Guess yes on native Windows.
1072++ mingw*) gl_cv_func_ungetc_works="guessing yes" ;;
1073++ # If we don't know, assume the worst.
1074++ *) gl_cv_func_ungetc_works="guessing no" ;;
1075+ esac
1076+ ])
1077+ ])
1078+diff --git a/m4/usleep.m4 b/m4/usleep.m4
1079+index 59605a8..4a6bff0 100644
1080+--- a/m4/usleep.m4
1081++++ b/m4/usleep.m4
1082+@@ -1,4 +1,4 @@
1083+-# usleep.m4 serial 5
1084++# usleep.m4 serial 6
1085+ dnl Copyright (C) 2009-2019 Free Software Foundation, Inc.
1086+ dnl This file is free software; the Free Software Foundation
1087+ dnl gives unlimited permission to copy and/or distribute it,
1088+@@ -31,6 +31,8 @@ AC_DEFUN([gl_FUNC_USLEEP],
1089+ [case "$host_os" in
1090+ # Guess yes on glibc systems.
1091+ *-gnu* | gnu*) gl_cv_func_usleep_works="guessing yes" ;;
1092++ # Guess yes on musl systems.
1093++ *-musl*) gl_cv_func_usleep_works="guessing yes" ;;
1094+ # Guess no on native Windows.
1095+ mingw*) gl_cv_func_usleep_works="guessing no" ;;
1096+ # If we don't know, assume the worst.
1097+diff --git a/m4/utimes.m4 b/m4/utimes.m4
1098+index 7209b6d..5806d8f 100644
1099+--- a/m4/utimes.m4
1100++++ b/m4/utimes.m4
1101+@@ -1,5 +1,5 @@
1102+ # Detect some bugs in glibc's implementation of utimes.
1103+-# serial 5
1104++# serial 6
1105+
1106+ dnl Copyright (C) 2003-2005, 2009-2019 Free Software Foundation, Inc.
1107+ dnl This file is free software; the Free Software Foundation
1108+@@ -143,9 +143,11 @@ main ()
1109+ [gl_cv_func_working_utimes=yes],
1110+ [gl_cv_func_working_utimes=no],
1111+ [case "$host_os" in
1112+- # Guess no on native Windows.
1113+- mingw*) gl_cv_func_working_utimes="guessing no" ;;
1114+- *) gl_cv_func_working_utimes="guessing no" ;;
1115++ # Guess yes on musl systems.
1116++ *-musl*) gl_cv_func_working_utimes="guessing yes" ;;
1117++ # Guess no on native Windows.
1118++ mingw*) gl_cv_func_working_utimes="guessing no" ;;
1119++ *) gl_cv_func_working_utimes="guessing no" ;;
1120+ esac
1121+ ])
1122+ ])
1123+diff --git a/m4/wcwidth.m4 b/m4/wcwidth.m4
1124+index baa2002..3952fd2 100644
1125+--- a/m4/wcwidth.m4
1126++++ b/m4/wcwidth.m4
1127+@@ -1,4 +1,4 @@
1128+-# wcwidth.m4 serial 27
1129++# wcwidth.m4 serial 28
1130+ dnl Copyright (C) 2006-2019 Free Software Foundation, Inc.
1131+ dnl This file is free software; the Free Software Foundation
1132+ dnl gives unlimited permission to copy and/or distribute it,
1133+@@ -98,9 +98,13 @@ int main ()
1134+ [
1135+ changequote(,)dnl
1136+ case "$host_os" in
1137+- # Guess yes on glibc and AIX 7 systems.
1138+- *-gnu* | gnu* | aix[7-9]*) gl_cv_func_wcwidth_works="guessing yes";;
1139+- *) gl_cv_func_wcwidth_works="guessing no";;
1140++ # Guess yes on glibc systems.
1141++ *-gnu* | gnu*) gl_cv_func_wcwidth_works="guessing yes";;
1142++ # Guess yes on musl systems.
1143++ *-musl*) gl_cv_func_wcwidth_works="guessing yes";;
1144++ # Guess yes on AIX 7 systems.
1145++ aix[7-9]*) gl_cv_func_wcwidth_works="guessing yes";;
1146++ *) gl_cv_func_wcwidth_works="guessing no";;
1147+ esac
1148+ changequote([,])dnl
1149+ ])
1150+--
1151+1.9.1
1152+
1153+