No longer trap fatal signals
[notion/jeffpc.git] / build / lua-detect.mk
blob79b91fdbc32f7af50fec7c7581be4d7b19b00b43
1 # Find highest known lua version.
3 # It uses pkg-config to do this, but will fail if you have liblua, but
4 # not the corresponding interpreter/compiler. Let's say you have liblua5.2
5 # but want to build with liblua5.1 (for which you have the lib, interpreter
6 # and compiler), you can override by setting LUA_VERSION=5.0 when invoking
7 # make.
9 # If successful, sets the following variables:
10 # * LUA_VERSION (unless already set)
11 # * LUA_LIBS (can be appended to LDFLAGS directly)
12 # * LUA_INCLUDES (can be appended to CFLAGS directly)
13 # * LUA (full path to lua interpreter)
14 # * LUAC (full path to lua compiler)
16 LUA_VERSION := $(or $(LUA_VERSION), $(shell \
17 (pkg-config --exists lua5.2 && echo 5.2) \
18 || (pkg-config --exists lua5.1 && echo 5.1) \
19 || (pkg-config --exists lua && echo 5.0)))
21 ifeq ($(LUA_VERSION),)
22 $(error Could not find any lua version. (Did you install the -dev package?))
23 endif
25 # prior to 5.1 the lib didn't include version in name.
26 ifeq ($(LUA_VERSION),5.0)
27 LUA_VERSION=
28 endif
30 LUA_LIBS := $(or $(shell pkg-config --libs lua$(LUA_VERSION)), $(error "pkg-config couldn't find linker flags for lua$(LUA_VERSION)!"))
31 LUA_INCLUDES := $(shell pkg-config --cflags lua$(LUA_VERSION))
32 LUA := $(or $(shell which lua$(LUA_VERSION)), $(error No lua$(LUA_VERSION) interpreter found!))
33 LUAC := $(or $(shell which luac$(LUA_VERSION)), $(error No lua$(LUA_VERSION) compiler found!))