Subject: bug#54020: Allow user-defined libtool options

From: Roumen Petrov <[email-masked]>
Date: Sun, 21 Jan 2024 19:22:38 +0200

Hi,

Mike Frysinger wrote:
> On 16 Jan 2024 22:43, Roumen Petrov wrote:
>> Mike Frysinger wrote:
>>> On 13 Jan 2024 22:29, Bogdan wrote:
>>>> Mike Frysinger <[email-masked]>, 2024-01-13 07:19:
>>>>> On 15 Mar 2023 17:31, Bogdan wrote:
>>>>>>      Another patch from my side. This one makes it possible for users to
>>>>>> pass additional options to libtool in 'compile' mode. Fixes #54020.
>>>>>>
>> [SNIP]
>>
>> Libtool support options that allows user to pass flags either or compiler or linker.
>> I cannot see needs for more flags and variables.
> 
> sorry, but i'm not following what you're trying to say here
> -mike
> 
In automake we could use target_XXXX or AM_XXXX to define flags.

Patch does not add new XXXX if I understand properly.
It is just to wrap "compile command". Simplified version of command when libtool is integrated with automake is
LTCOMPILE=$(LIBTOOL) ... $(LIBTOOLFLAGS) --mode=compile $(CC) ...

Patch propose more complex syntax i.e. ... --mode=compile $(PRE-FLAG) $(CC) ... $(POST-FLAGS)

For flags supported by libtool mode we could use command ./libtool--mode=compile --help
Some of arguments are controlled by configuration as goal of libtool is to hide complexity of library build and build of position independent code.
The user may break this with unsuitable values in PRE-FLAG.
What are other options :
-no-suppress (1) i.e.  do not redirect subsequent compilations to null device
-Wc,... (2)

Case (1)
This is exceptional case.
Remark: usual compilation is shared and static i.e. libtool shows errors from first.

(a) With LIBTOOLFLAGS=-verbose flag we will could see commands. If second (static) build fail we could just copy & paste without redirection.

(b) Also we could update Makefile and to set -no-suppress and to debug compilation failure.

(c) We could configure with --disable-shared.  As result static compilation is only one i.e. first and libtool will shows errors.

So (a) or (b) or (c) ?

Case (2)
We could always run CC='cc my-flags' make -e or to use updated CFLAGS or ....  This is also valid for linker.
So what to do with $(POST-FLAGS) as we could pass flags at build time?
It is not only for -Wc,... Also -Xcompiler should work fine.

Regards,
Roumen

----

P.S. With other words CFLAGS='-Wall -W.... -W....' ./configure --disable-shared  ... replaces patch.