Only build the 'travis' github branch on Travis
[notion/jeffpc.git] / build / lua-detect.mk
bloba41b06f4cf065a3132352168a2ffb44c133d9e30
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 ?= $(shell pkg-config --exists lua5.2 && echo 5.2)
17 LUA_VERSION ?= $(shell pkg-config --exists lua5.1 && echo 5.1)
18 LUA_VERSION ?= $(shell pkg-config --exists lua && echo 5.0)
20 ifeq ($(LUA_VERSION),)
21 $(error Could not find any lua version. (Did you install the -dev package?))
22 endif
24 # prior to 5.1 the lib didn't include version in name.
25 ifeq ($(LUA_VERSION),5.0)
26 LUA_VERSION=
27 endif
29 LUA_LIBS = $(shell pkg-config --libs lua$(LUA_VERSION))
30 LUA_INCLUDES = $(shell pkg-config --cflags lua$(LUA_VERSION))
31 LUA = $(shell which lua$(LUA_VERSION))
32 LUAC = $(shell which luac$(LUA_VERSION))
34 ifeq ($(LUA_LIBS),)
35 $(error "pkg-config couldn't find linker flags for lua$(LUA_VERSION)!")
36 endif
38 ifeq ($(LUA_INCLUDES),)
39 $(error "pkg-config couldn't find compiler flags for lua$(LUA_VERSION)!")
40 endif
42 ifeq ($(LUA),)
43 $(error No lua$(LUA_VERSION) interpreter found!)
44 endif
46 ifeq ($(LUAC),)
47 $(error No lua$(LUA_VERSION) compiler found!)
48 endif