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
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?
))
24 # prior to 5.1 the lib didn't include version in name.
25 ifeq ($(LUA_VERSION
),5.0)
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
))
35 $(error
"pkg-config couldn't find linker flags for lua$(LUA_VERSION)!")
38 ifeq ($(LUA_INCLUDES
),)
39 $(error
"pkg-config couldn't find compiler flags for lua$(LUA_VERSION)!")
43 $(error No lua
$(LUA_VERSION
) interpreter found
!)
47 $(error No lua
$(LUA_VERSION
) compiler found
!)