automake
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Per-Object Flags for Autotool C++ library?


From: Mathieu Lirzin
Subject: Re: Per-Object Flags for Autotool C++ library?
Date: Fri, 03 Nov 2017 10:54:16 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux)

Hello,

Nick Bowler <address@hidden> writes:
>
> On 11/2/17, Jeffrey Walton <address@hidden> wrote:
>>
>> CPU_FLAG = -msse2 -msse3 -mssse3
>> libcpu_a_SOURCES = cpu.cpp
>> libcpu_a_CXXFLAGS = $(CXXFLAGS) $(CPU_FLAG)
>
> Note that you should not include $(CXXFLAGS) here.  CXXFLAGS is always
> included (so with this it will duplicated on the command line, which
> might be undesired by the user).

I guess Jeffrey was intending to use AM_CXXFLAGS which is overridden by
libcpu_a_CXXFLAGS.

>> Now that the objects are built we need to add libcpu.a back into
>> libcryptopp.la in the exact position it would have been in if I could
>> have specified per-object flags. The Automake manual gives an example
>> of linking a program with disjoint libraries, but not adding the
>> extraneous library back to the main (primary?) library at a particular
>> position.
>>
>> The "in the exact position" is important.

I don't fully understand the "static initialization fiasco", however the
next entry in the FAQ [1] seems to suggest that it can be avoided
programmatically using a function wrapper instead of relying on the
linking order.

If this kind of issue is common in C++, I think it would be good to
give a hint in the Automake manual on how to solve it.

Thanks.

[1] https://isocpp.org/wiki/faq/ctors#static-init-order-on-first-use

-- 
Mathieu Lirzin
GPG: F2A3 8D7E EB2B 6640 5761  070D 0ADE E100 9460 4D37



reply via email to

[Prev in Thread] Current Thread [Next in Thread]