Diff options
Diffstat (limited to 'source/cgit.mk')
| -rw-r--r-- | source/cgit.mk | 16 |
1 file changed, 15 insertions, 1 deletion
diff --git a/source/cgit.mk b/source/cgit.mk index 66b94d3..629c111 100644 --- a/source/cgit.mk +++ b/source/cgit.mk @@ -58,6 +58,10 @@ CGIT_CFLAGS += $(CGIT_EXTRA_CFLAGS) PKG_CONFIG ?= pkg-config +# Why pkg-config gave no Lua, for the messages below. Recursive, so the shell +# runs only when one of them is wanted. +LUA_NO_PKG_CONFIG = $(if $(shell command -v $(PKG_CONFIG) 2>/dev/null),,$(PKG_CONFIG) is not installed) + ifdef NO_LUA LUA_MESSAGE := linking without specified Lua support CGIT_CFLAGS += -DNO_LUA @@ -75,12 +79,22 @@ else endif ifneq ($(LUA_PKGCONFIG),) LUA_MESSAGE := linking with $(LUA_MODE) $(LUA_PKGCONFIG) +# Flags passed by hand stand in for pkg-config's. Without them, a package it +# cannot find leaves the build no Lua flags at all, and the compile would +# then stop at lua.h without a word of why. +ifeq ($(filter command line override,$(origin LUA_LIBS) $(origin LUA_CFLAGS)),) +ifneq ($(shell $(PKG_CONFIG) --exists $(LUA_PKGCONFIG) 2>/dev/null && echo yes),yes) + LUA_FAULT := $(or $(LUA_NO_PKG_CONFIG),$(PKG_CONFIG) does not know $(LUA_PKGCONFIG)) + LUA_MESSAGE := $(LUA_MESSAGE), though $(LUA_FAULT) +$(warning $(LUA_FAULT), so LUA_LIBS and LUA_CFLAGS are empty. Install pkg-config and the Lua development package, or pass LUA_LIBS and LUA_CFLAGS) +endif +endif LUA_LIBS := $(shell $(PKG_CONFIG) --libs $(LUA_PKGCONFIG) 2>/dev/null) LUA_CFLAGS := $(shell $(PKG_CONFIG) --cflags $(LUA_PKGCONFIG) 2>/dev/null) CGIT_LIBS += $(LUA_LIBS) CGIT_CFLAGS += $(LUA_CFLAGS) else - LUA_MESSAGE := linking without autodetected Lua support + LUA_MESSAGE := linking without Lua, since $(or $(LUA_NO_PKG_CONFIG),$(PKG_CONFIG) found no Lua package). Install pkg-config and a Lua development package, or pass LUA_PKGCONFIG, LUA_LIBS and LUA_CFLAGS NO_LUA := YesPlease CGIT_CFLAGS += -DNO_LUA endif |
