]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: Makefile: fix compile error with USE_LUA=1 in ubuntu16.04
authorNan Liu <nan.liu619@gmail.com>
Fri, 9 Jun 2017 07:57:45 +0000 (15:57 +0800)
committerWilly Tarreau <w@1wt.eu>
Fri, 9 Jun 2017 09:14:26 +0000 (11:14 +0200)
include/types/hlua.h:6:17: fatal error: lua.h: No such file or directory

Makefile

index 88ba5525e28727db332a1577496852abd45a8092..60dd99b32890f867b341a3054669c7e6ddc9e0f6 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -591,6 +591,7 @@ 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;)
 
 BUILD_OPTIONS   += $(call ignore_implicit,USE_LUA)
 OPTIONS_CFLAGS  += -DUSE_LUA $(if $(LUA_INC),-I$(LUA_INC))
@@ -601,6 +602,10 @@ LUA_LIB_NAME := $(firstword $(foreach lib,lua5.3 lua53 lua,$(call check_lua_lib,
 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.3, lua53, lua, ...))
 endif
+LUA_INC := $(firstword $(foreach lib,lua5.3 lua53 lua,$(call check_lua_inc,$(lib),"/usr/include/")))
+ifneq ($(LUA_INC),)
+OPTIONS_CFLAGS  += -I$(LUA_INC)
+endif
 endif
 
 OPTIONS_LDFLAGS += $(LUA_LD_FLAGS) -l$(LUA_LIB_NAME) -lm