+2020-09-19 Bruno Haible <bruno@clisp.org>
+
+ havelib: Avoid linking with libc.a on GNU systems.
+ Reported by Bruce Dubbs <bruce.dubbs@gmail.com> in
+ <https://lists.gnu.org/archive/html/grep-devel/2020-09/msg00052.html>.
+ * m4/lib-link.m4 (AC_LIB_LINKFLAGS_BODY): When processing the
+ dependency_libs value of a .la file, ignore '-lc' options on GNU
+ systems.
+
2020-09-19 Bruno Haible <bruno@clisp.org>
Fix recognition of musl libc on Alpine Linux 3.10.
-# lib-link.m4 serial 31
+# lib-link.m4 serial 32
dnl Copyright (C) 2001-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,
;;
-l*)
dnl Handle this in the next round.
- names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
+ dnl But on GNU systems, ignore -lc options, because
+ dnl - linking with libc is the default anyway,
+ dnl - linking with libc.a may produce an error
+ dnl "/usr/bin/ld: dynamic STT_GNU_IFUNC symbol `strcmp' with pointer equality in `/usr/lib/libc.a(strcmp.o)' can not be used when making an executable; recompile with -fPIE and relink with -pie"
+ dnl or may produce an executable that always crashes, see
+ dnl <https://lists.gnu.org/archive/html/grep-devel/2020-09/msg00052.html>.
+ dep=`echo "X$dep" | sed -e 's/^X-l//'`
+ if test "X$dep" != Xc \
+ || case $host_os in
+ linux* | gnu* | k*bsd*-gnu) false ;;
+ *) true ;;
+ esac; then
+ names_next_round="$names_next_round $dep"
+ fi
;;
*.la)
dnl Handle this in the next round. Throw away the .la's