haproxy: tweak thread activation
authorFabrice Fontaine <fontaine.fabrice@gmail.com>
Tue, 2 Oct 2018 19:28:58 +0000 (21:28 +0200)
committerPeter Korsgaard <peter@korsgaard.com>
Wed, 3 Oct 2018 07:47:13 +0000 (09:47 +0200)
If threads are enabled, as described in include/common/hathreads.h,
haproxy uses __sync_*_4 intrisics if gcc < 4.7. Otherwise, haproxy
uses __atomic_ intrinsics.

As a result, instead of adding a dependency on BR2_TOOLCHAIN_HAS_SYNC_4
and BR2_TOOLCHAIN_HAS_ATOMIC in Config.in, enable threads only if the
dependencies are fulfilled in haproxy.mk

Fixes:
 - http://autobuild.buildroot.org/results/7f24873ecdd9246c95c03bb8d2fcd4c16c488c6c

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Reviewed-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
package/haproxy/Config.in
package/haproxy/haproxy.mk

index cbcbc0c388699c9ef563b00df8e6be5aafe2e478..fbe5941b551dbae544d7fec05e1c5fa83bb2b3e5 100644 (file)
@@ -1,7 +1,6 @@
 config BR2_PACKAGE_HAPROXY
        bool "haproxy"
        depends on BR2_USE_MMU # fork()
-       depends on BR2_TOOLCHAIN_HAS_SYNC_4 # __sync_*_4 intrisics
        help
          HAProxy is a free, very fast and reliable solution offering
          high availability, load balancing, and proxying for TCP and
index 363fc4447f1219b621ac13d4126016c7ed550cbb..061a8cbbafdabc06319f8906ffa2b47995cbbcc4 100644 (file)
@@ -20,7 +20,13 @@ HAPROXY_LIBS += -latomic
 endif
 
 ifeq ($(BR2_TOOLCHAIN_HAS_THREADS),y)
+# threads uses atomics on gcc >= 4.7 and sync otherwise (see
+# include/common/hathreads.h)
+ifeq ($(BR2_TOOLCHAIN_GCC_AT_LEAST_4_7):$(BR2_TOOLCHAIN_HAS_ATOMIC),y:y)
 HAPROXY_MAKE_OPTS += USE_THREAD=1
+else ifeq ($(BR2_TOOLCHAIN_GCC_AT_LEAST_4_7):$(BR2_TOOLCHAIN_HAS_SYNC_4),:y)
+HAPROXY_MAKE_OPTS += USE_THREAD=1
+endif
 endif
 
 ifeq ($(BR2_PACKAGE_LUA_5_3),y)