mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2024-12-25 14:12:13 +00:00
BUILD: makefile: make sure LUA_INC and LUA_LIB are always initialized
While LUA_INC is sometimes set in the makefile (only when LUA_LIB_NAME is not set), LUA_LIB is never pre-initialized and faces the risk of being accidently inherited from the environment. Let's make sure both are properly reset first when not explicitly set. For this we always set LUA_INC based on the autodetection if it's not set, and always pre-initialize LUA_LIB to empty. This also helps make that block slightly less difficult to understand.
This commit is contained in:
parent
682b78b4e6
commit
2a3a882fe2
11
Makefile
11
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=<name> (where <name> 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)
|
||||
|
Loading…
Reference in New Issue
Block a user