]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUILD: makefile: never force -latomic, set USE_LIBATOMIC instead
authorWilly Tarreau <w@1wt.eu>
Wed, 21 Dec 2022 09:46:07 +0000 (10:46 +0100)
committerWilly Tarreau <w@1wt.eu>
Fri, 23 Dec 2022 15:53:35 +0000 (16:53 +0100)
Two places, 51Dv4 and AIX7.2, used to forcefully add -latomic to the
ldflags (and via different variables). This must not be done because
it depends on compiler, arch, etc. USE_LIBATOMIC=implicit is much
better: it allows the user to forcefully disable it if undesired.
The LIBATOMIC_LDFLAGS are set to -latomic and automatically added
to OPTIONS_LDFLAGS.

It will make this dependency appear in haproxy -vv but that's not
and issue and it may even sometimes help when troubleshooting.

Makefile

index 9f5b6813007a0a891f8171fb8027811f938bb69e..6a02ab4315d75e30c53af4d08d72fd98a1f40df3 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -302,7 +302,7 @@ use_opts = USE_EPOLL USE_KQUEUE USE_NETFILTER                                 \
            USE_LINUX_SPLICE USE_LIBCRYPT USE_CRYPT_H USE_ENGINE               \
            USE_GETADDRINFO USE_OPENSSL USE_OPENSSL_WOLFSSL USE_LUA            \
            USE_ACCEPT4 USE_CLOSEFROM USE_ZLIB USE_SLZ USE_CPU_AFFINITY        \
-           USE_TFO USE_NS USE_DL USE_RT                                       \
+           USE_TFO USE_NS USE_DL USE_RT USE_LIBATOMIC                         \
            USE_DEVICEATLAS USE_51DEGREES USE_51DEGREES_V4                     \
            USE_WURFL USE_SYSTEMD USE_OBSOLETE_LINKER USE_PRCTL USE_PROCCTL    \
            USE_THREAD_DUMP USE_EVPORTS USE_OT USE_QUIC USE_PROMEX             \
@@ -436,7 +436,7 @@ ifeq ($(TARGET),aix72-gcc)
   set_target_defaults = $(call default_opts, \
     USE_POLL USE_THREAD USE_LIBCRYPT USE_OBSOLETE_LINKER USE_GETADDRINFO)
   TARGET_CFLAGS   = -D_H_XMEM -D_H_VAR
-  TARGET_LDFLAGS  = -latomic
+  USE_LIBATOMIC   = implicit
 endif
 
 # Cygwin
@@ -458,7 +458,7 @@ $(set_target_defaults)
 # (especially on archs which do not need it).
 ifneq ($(USE_THREAD),)
 ifneq ($(shell $(CC) $(CFLAGS) -dM -E -xc - </dev/null 2>/dev/null | grep -c 'LOCK_FREE.*1'),0)
-  USE_LIBATOMIC=1
+  USE_LIBATOMIC   = implicit
 endif
 endif
 
@@ -694,7 +694,7 @@ endif
 
 OPTIONS_LDFLAGS += $(if $(51DEGREES_LIB),-L$(51DEGREES_LIB)) -lm
 ifneq ($(USE_51DEGREES_V4),)
-OPTIONS_LDFLAGS += -latomic
+USE_LIBATOMIC    = implicit
 endif
 endif
 
@@ -803,7 +803,7 @@ ifneq ($(USE_DL),)
 endif
 
 ifneq ($(USE_LIBATOMIC),)
-  TARGET_LDFLAGS += -latomic
+  LIBATOMIC_LDFLAGS = -latomic
 endif
 
 #### End of the USE_* options handling, any such option that would be added