Last active
December 29, 2015 11:28
-
-
Save deryni/7663554 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Find highest known lua version. | |
# | |
# It uses pkg-config to do this, but will fail if you have liblua, but | |
# not the corresponding interpreter/compiler. Let's say you have liblua5.2 | |
# but want to build with liblua5.1 (for which you have the lib, interpreter | |
# and compiler), you can override by setting LUA_SUFFIX=5.1 when invoking | |
# make. | |
# | |
# If successful, sets the following variables: | |
# * LUA_SUFFIX (unless already set) | |
# * LUA_LIBS (can be appended to LDFLAGS directly) | |
# * LUA_INCLUDES (can be appended to CFLAGS directly) | |
# * LUA (full path to lua interpreter) | |
# * LUAC (full path to lua compiler) | |
LUA_SUFFIX ?= $(shell \ | |
for ver in 5.2 5.1 ""; do\ | |
pkg-config --exists lua$$ver && echo "$$ver" && exit;\ | |
done) | |
LUA_VERSION := $(LUA_SUFFIX) | |
LUA_PCNAME := lua$(LUA_VERSION) | |
LUA_LIBS := $(shell pkg-config --libs $(LUA_PCNAME) 2>/dev/null) | |
LUA_INCLUDES := $(shell pkg-config --cflags $(LUA_PCNAME) 2>/dev/null) | |
LUA := $(or $(shell which lua$(LUA_SUFFIX)), $(error No lua$(LUA_SUFFIX) interpreter found!)) | |
LUAC := $(or $(shell which luac$(LUA_SUFFIX)), $(error No lua$(LUA_SUFFIX) compiler found!)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment