BUILD: fix automatic inclusion of libdl.
Last commit ecc9547 ("BUILD: lua: it miss the '-ldl' directive") broke
build on systems without libdl (eg: FreeBSD). Since lua requires libdl
on some systems, let's simplify this by adding a USE_DL build directive
to enable/disable use of libdl. It's set by default on all linux flavors.
diff --git a/Makefile b/Makefile
index e403239..e3efcc6 100644
--- a/Makefile
+++ b/Makefile
@@ -36,6 +36,7 @@
# USE_CPU_AFFINITY : enable pinning processes to CPU on Linux. Automatic.
# 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.
#
# Options can be forced by specifying "USE_xxx=1" or can be disabled by using
# "USE_xxx=" (empty string).
@@ -223,6 +224,7 @@
USE_POLL = implicit
USE_TPROXY = implicit
USE_LIBCRYPT = implicit
+ USE_DL = implicit
else
ifeq ($(TARGET),linux24)
# This is for standard Linux 2.4 with netfilter but without epoll()
@@ -231,6 +233,7 @@
USE_POLL = implicit
USE_TPROXY = implicit
USE_LIBCRYPT = implicit
+ USE_DL = implicit
else
ifeq ($(TARGET),linux24e)
# This is for enhanced Linux 2.4 with netfilter and epoll() patch > 0.21
@@ -241,6 +244,7 @@
USE_MY_EPOLL = implicit
USE_TPROXY = implicit
USE_LIBCRYPT = implicit
+ USE_DL = implicit
else
ifeq ($(TARGET),linux26)
# This is for standard Linux 2.6 with netfilter and standard epoll()
@@ -252,6 +256,7 @@
USE_LIBCRYPT = implicit
USE_FUTEX = implicit
EXTRA += haproxy-systemd-wrapper
+ USE_DL = implicit
else
ifeq ($(TARGET),linux2628)
# This is for standard Linux >= 2.6.28 with netfilter, epoll, tproxy and splice
@@ -268,6 +273,7 @@
USE_CPU_AFFINITY= implicit
ASSUME_SPLICE_WORKS= implicit
EXTRA += haproxy-systemd-wrapper
+ USE_DL = implicit
else
ifeq ($(TARGET),solaris)
# This is for Solaris 8
@@ -520,6 +526,11 @@
BUILD_OPTIONS += $(call ignore_implicit,USE_REGPARM)
endif
+ifneq ($(USE_DL),)
+BUILD_OPTIONS += $(call ignore_implicit,USE_DL)
+OPTIONS_LDFLAGS += -ldl
+endif
+
# report DLMALLOC_SRC only if explicitly specified
ifneq ($(DLMALLOC_SRC),)
BUILD_OPTIONS += DLMALLOC_SRC=$(DLMALLOC_SRC)
@@ -575,7 +586,7 @@
endif
endif
-OPTIONS_LDFLAGS += $(LUA_LD_FLAGS) -l$(LUA_LIB_NAME) -lm -ldl
+OPTIONS_LDFLAGS += $(LUA_LD_FLAGS) -l$(LUA_LIB_NAME) -lm
OPTIONS_OBJS += src/hlua.o
endif