]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUILD: link with libdl if needed for Lua support
authorVincent Bernat <vincent@bernat.im>
Thu, 16 Jul 2015 18:52:51 +0000 (20:52 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 23 Jul 2015 07:47:02 +0000 (09:47 +0200)
On platforms where the dl*() functions are not part of the libc, a
program linking Lua also needs to link to libdl.

Moreover, on platforms using a gold linker with the --as-needed flag,
the libdl library needs to be linked after linking Lua, otherwise, it
won't be marked as needed and will be discarded and its symbols won't be
present at the end of the linking phase.

Ubuntu enables the --as-needed flag by default. Other distributions may
advertise its use, like Gentoo.

Makefile

index 6ab7d5469d904d65e1bec95f386805098bcb4b30..a1383a38c539fe4f0101a986746d8290ad3eebfa 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -606,6 +606,9 @@ endif
 endif
 
 OPTIONS_LDFLAGS += $(LUA_LD_FLAGS) -l$(LUA_LIB_NAME) -lm
+ifneq ($(USE_DL),)
+OPTIONS_LDFLAGS += -ldl
+endif
 OPTIONS_OBJS    += src/hlua.o
 endif