]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUILD: Makefile: add USE_RT to pass -lrt for clock_gettime() and friends
authorWilly Tarreau <w@1wt.eu>
Thu, 18 Oct 2018 14:28:54 +0000 (16:28 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 18 Oct 2018 14:39:03 +0000 (16:39 +0200)
Some code will require clock_gettime() which needs -lrt on most Linux
distros (those with glibc < 2.17). For this reason, this patch introduces
USE_RT to enable -lrt, which is implicitly set for all Linux flavors,
since it's harmless to link with it on more recent ones. Those who know
they can safely get rid of -lrt can remove it using "USE_RT=".

Makefile

index 821d314b66fc61fd914150cac6ad5a33c0736bb2..b3b68957139ec5ba035ccba825be38bce5a72bb9 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -40,6 +40,7 @@
 #   USE_TFO              : enable TCP fast open. Supported on Linux >= 3.7.
 #   USE_NS               : enable network namespace support. Supported on Linux >= 2.6.24.
 #   USE_DL               : enable it if your system requires -ldl. Automatic on Linux.
+#   USE_RT               : enable it if your system requires -lrt. Automatic on Linux.
 #   USE_DEVICEATLAS      : enable DeviceAtlas api.
 #   USE_51DEGREES        : enable third party device detection library from 51Degrees
 #   USE_WURFL            : enable WURFL detection library from Scientiamobile
@@ -281,6 +282,7 @@ ifeq ($(TARGET),linux22)
   USE_TPROXY      = implicit
   USE_LIBCRYPT    = implicit
   USE_DL          = implicit
+  USE_RT          = implicit
 else
 ifeq ($(TARGET),linux24)
   # This is for standard Linux 2.4 with netfilter but without epoll()
@@ -289,6 +291,7 @@ ifeq ($(TARGET),linux24)
   USE_TPROXY      = implicit
   USE_LIBCRYPT    = implicit
   USE_DL          = implicit
+  USE_RT          = implicit
 else
 ifeq ($(TARGET),linux24e)
   # This is for enhanced Linux 2.4 with netfilter and epoll() patch > 0.21
@@ -299,6 +302,7 @@ ifeq ($(TARGET),linux24e)
   USE_TPROXY      = implicit
   USE_LIBCRYPT    = implicit
   USE_DL          = implicit
+  USE_RT          = implicit
 else
 ifeq ($(TARGET),linux26)
   # This is for standard Linux 2.6 with netfilter and standard epoll()
@@ -309,6 +313,7 @@ ifeq ($(TARGET),linux26)
   USE_LIBCRYPT    = implicit
   USE_FUTEX       = implicit
   USE_DL          = implicit
+  USE_RT          = implicit
 else
 ifeq ($(TARGET),linux2628)
   # This is for standard Linux >= 2.6.28 with netfilter, epoll, tproxy and splice
@@ -324,6 +329,7 @@ ifeq ($(TARGET),linux2628)
   USE_CPU_AFFINITY= implicit
   ASSUME_SPLICE_WORKS= implicit
   USE_DL          = implicit
+  USE_RT          = implicit
   USE_THREAD      = implicit
 else
 ifeq ($(TARGET),solaris)
@@ -599,6 +605,11 @@ OPTIONS_CFLAGS  += -DUSE_THREAD
 OPTIONS_LDFLAGS += -lpthread
 endif
 
+ifneq ($(USE_RT),)
+BUILD_OPTIONS   += $(call ignore_implicit,USE_RT)
+OPTIONS_LDFLAGS += -lrt
+endif
+
 # report DLMALLOC_SRC only if explicitly specified
 ifneq ($(DLMALLOC_SRC),)
 BUILD_OPTIONS += DLMALLOC_SRC=$(DLMALLOC_SRC)