Subject: 2.4.7 breaks if AR_FLAGS contains a space

From: Alexandre Duret-Lutz <[email-masked]>
Date: Tue, 29 Mar 2022 10:35:21 +0200

Hi!

When compiling with link-time optimization, I'm first running configure
with something like this:

./configure \
   LDFLAGS='-fuse-linker-plugin' \
   NM='nm --plugin /usr/lib/gcc/x86_64-linux-gnu/11/liblto_plugin.so' \
   ARFLAGS='cr --plugin /usr/lib/gcc/x86_64-linux-gnu/11/liblto_plugin.so' \
   AR_FLAGS='cr --plugin /usr/lib/gcc/x86_64-linux-gnu/11/liblto_plugin.so' \
   RANLIB='ranlib --plugin /usr/lib/gcc/x86_64-linux-gnu/11/liblto_plugin.so' \
   CFLAGS='-flto=jobserver -fprofile-generate' \
   CXXFLAGS='-flto=jobserver -fprofile-generate'

Libtool 2.4.6 had no problem with this.

In Libtool 2.4.7, the change to unify the handling for ARFLAGS and
AR_FLAGS seems to have introduced a quoting problem.   During link
I see many message like this:

| ../libtool: line 153: --plugin: command not found
| libtool: link: ar  .libs/libpico.a .libs/libpico_la-picosat.o 
| ar: invalid option -- '.'

And indeed, the generated libtool script contains an unquoted assignment
to lt_ar_flags:

   149  # The archiver.
   150  AR="ar"
   151  
   152  # Flags to create an archive (by configure).
   153  lt_ar_flags=cr --plugin /usr/lib/gcc/x86_64-linux-gnu/11/liblto_plugin.so
   154  
   155  # Flags to create an archive.
   156  AR_FLAGS=${ARFLAGS-"$lt_ar_flags"}