DO_GCC_TESTS=yes
GNU_LD=yes
;;
+linux-musl)
+ M4_FLAGS="${M4_FLAGS} -P __linux__,1"
+ CPPFLAGS="${CPPFLAGS} -DMUSL"
+ DO_GCC_TESTS=yes
+ GNU_LD=yes
+ ;;
freebsd*)
M4_FLAGS="${M4_FLAGS} -P SUPPRESS_LEADING_UNDERSCORE,1"
DO_GCC_TESTS=yes
# define USE_MAP_FIXED 1
#endif
-/* GNU C library defines environ if __USE_GNU is defined. */
-#ifndef __USE_GNU
+/* GNU C library defines environ if __USE_GNU is defined. musl libc
+ defines environ unconditionally, even though, when combined with
+ -Wredundant-decls, this breaks the POSIX requirement that users must
+ explicitly declare environ. */
+#if !defined __USE_GNU && !defined MUSL
extern char ** environ;
#endif
--- /dev/null
+Fix build with musl libc.
+
+Work around problem with musl's declaration of environ in unistd.h,
+which causes gcc -Wredundant-decls warnings to reject the POSIX
+requirement that users declare `extern char **environ'.