BUILD: makefile: simplify detection of libatomic
authorWilly Tarreau <w@1wt.eu>
Sun, 14 Nov 2021 14:28:38 +0000 (15:28 +0100)
committerWilly Tarreau <w@1wt.eu>
Sun, 14 Nov 2021 14:37:29 +0000 (15:37 +0100)
commit70c268b4dae1efd184448c385ce47277b0563d1f
treeb8b28a7eb7319e8990f13aa599d25124aeffa873
parent8c13a92da036b99bdff903f40b24a6d37bb9d781
BUILD: makefile: simplify detection of libatomic

We've had libatomic enabled on arm and aarch64 for some Raspberry PI
while usually it's not needed, but it was a bit arbitrary and in
issue #1455 it was reported that RISCV requires it for single-byte
atomics.

This changes the approach to detect the explicit requirement of
external functions for the builtins, as reported with *_LOCK_FREE=1.
If any of the atomics requires libatomic, it will be used. Older
compilers do not report any such atomic as they use sync_* instead
and will not match it nor include libatomic (which usually is not
present there).

On x86, the rules depend on -march. i386 uses LOCK_FREE=1 for all of
them. i486 uses it only for the 8-byte CAS and i586 doesn't require
it at all. For this reason, the build flags are used during the test.

This was tested with armv7, aarch64, mips, riscv, i
Makefile