diff --git a/Makefile b/Makefile index 803eb1489..4be54089f 100644 --- a/Makefile +++ b/Makefile @@ -596,21 +596,20 @@ OPTIONS_OBJS += src/quic_conn.o src/mux_quic.o src/h3.o src/xprt_quic.o \ endif ifneq ($(USE_LUA),) -check_lua_lib = $(shell echo "int main(){}" | $(CC) -o /dev/null -x c - $(2) -l$(1) 2>/dev/null && echo $(1)) check_lua_inc = $(shell if [ -d $(2)$(1) ]; then echo $(2)$(1); fi;) - +LUA_INC := $(firstword $(foreach lib,lua5.4 lua54 lua5.3 lua53 lua,$(call check_lua_inc,$(lib),"/usr/include/"))) OPTIONS_CFLAGS += $(if $(LUA_INC),-I$(LUA_INC)) + +check_lua_lib = $(shell echo "int main(){}" | $(CC) -o /dev/null -x c - $(2) -l$(1) 2>/dev/null && echo $(1)) +LUA_LIB = LUA_LD_FLAGS := -Wl,$(if $(EXPORT_SYMBOL),$(EXPORT_SYMBOL),--export-dynamic) $(if $(LUA_LIB),-L$(LUA_LIB)) + ifeq ($(LUA_LIB_NAME),) # Try to automatically detect the Lua library LUA_LIB_NAME := $(firstword $(foreach lib,lua5.4 lua54 lua5.3 lua53 lua,$(call check_lua_lib,$(lib),$(LUA_LD_FLAGS)))) ifeq ($(LUA_LIB_NAME),) $(error unable to automatically detect the Lua library name, you can enforce its name with LUA_LIB_NAME= (where can be lua5.4, lua54, lua, ...)) endif -LUA_INC := $(firstword $(foreach lib,lua5.4 lua54 lua5.3 lua53 lua,$(call check_lua_inc,$(lib),"/usr/include/"))) -ifneq ($(LUA_INC),) -OPTIONS_CFLAGS += -I$(LUA_INC) -endif ifneq ($(HLUA_PREPEND_PATH),) OPTIONS_CFLAGS += -DHLUA_PREPEND_PATH=$(HLUA_PREPEND_PATH) BUILD_OPTIONS += HLUA_PREPEND_PATH=$(HLUA_PREPEND_PATH)