GCC requires `ar` and `ranlib` to have plugin support when using LTO. While the situation has improved as many distributions install the GCC plugin to a location that GNU Binutils can automatically find, this isn't required and isn't done by default.
By searching for `gcc-ar` and `gcc-ranlib` first, we can make those cases work without intervention from the user. Note that we need to do `gcc-ar` here in autoconf too since AC_PROG_AR was added by c48fdb81191c8b7c7c0dde6141b861b178a6a284. Problem reported by R. Diez in: https://savannah.gnu.org/support/?110475 * lib/autoconf/programs.m4 (AC_PROG_AR): Search for gcc-ar. (AC_PROG_RANLIB): Search for gcc-ranlib. --- I'm still testing this, but how does this look in principle? I've sent a corresponding change to automake-patches at https://lists.libreplanet.org/archive/html/automake-patches/2025-05/msg00001.html. NEWS | 3 +++ lib/autoconf/programs.m4 | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 1e4e513e..89974e7b 100644 --- a/NEWS +++ b/NEWS @@ -32,6 +32,9 @@ GNU Autoconf NEWS - User visible changes. *** AC_USE_SYSTEM_EXTENSIONS now defines _COSMO_SOURCE for Cosmopolitan Libc. +*** AC_PROG_AR and AC_PROG_RANLIB search for 'gcc-ar' and 'gcc-ranlib' + first, respectively. + ** Notable bug fixes *** AC_DEFINE_UNQUOTED no longer mishandles double-quotes inside $(...) diff --git a/lib/autoconf/programs.m4 b/lib/autoconf/programs.m4 index d8b8b8b1..9cbe32da 100644 --- a/lib/autoconf/programs.m4 +++ b/lib/autoconf/programs.m4 @@ -346,8 +346,9 @@ fi # -------------- AN_MAKEVAR([AR], [AC_PROG_AR]) AN_PROGRAM([ar], [AC_PROG_AR]) +AN_PROGRAM([gcc-ar], [AC_PROG_AR]) AC_DEFUN([AC_PROG_AR], -[AC_CHECK_TOOL(AR, ar, :)]) +[AC_CHECK_TOOL(AR, gcc-ar ar, :)]) # Check for gawk first since it's generally better. @@ -962,8 +963,9 @@ AC_SUBST([SET_MAKE])dnl # -------------- AN_MAKEVAR([RANLIB], [AC_PROG_RANLIB]) AN_PROGRAM([ranlib], [AC_PROG_RANLIB]) +AN_PROGRAM([gcc-ranlib], [AC_PROG_RANLIB]) AC_DEFUN([AC_PROG_RANLIB], -[AC_CHECK_TOOL(RANLIB, ranlib, :)]) +[AC_CHECK_TOOL(RANLIB, gcc-ranlib ranlib, :)]) # AC_RSH -- 2.49.0