Added a custom check for lua.

This commit is contained in:
Sergey Popov 2009-03-23 01:26:52 +00:00
parent 22f78e8e08
commit e94dcecf17
2 changed files with 31 additions and 2 deletions

View file

@ -82,6 +82,7 @@ opts.AddVariables(
('boost_suffix', 'Suffix of boost libraries.'),
PathVariable('gettextdir', 'Root directory of Gettext\'s installation.', "", OptionalPath),
PathVariable('gtkdir', 'Directory where GTK SDK is installed.', "", OptionalPath),
PathVariable('luadir', 'Directory where Lua binary package is unpacked.', "", OptionalPath),
('host', 'Cross-compile host.', ''),
('jobs', 'Set the number of parallel compilations', "1", lambda key, value, env: int(value), int),
BoolVariable('distcc', 'Use distcc', False),
@ -201,7 +202,7 @@ def Warning(message):
return False
from metasconf import init_metasconf
configure_args = dict(custom_tests = init_metasconf(env, ["cplusplus", "python_devel", "sdl", "boost", "pango", "pkgconfig", "gettext"]), config_h = "config.h",
configure_args = dict(custom_tests = init_metasconf(env, ["cplusplus", "python_devel", "sdl", "boost", "pango", "pkgconfig", "gettext", "lua"]), config_h = "config.h",
log_file="build/config.log", conf_dir="build/sconf_temp")
env.MergeFlags(env["extra_flags_config"])
@ -219,7 +220,7 @@ if env["prereqs"]:
have_client_prereqs = have_server_prereqs and \
conf.CheckPango("cairo") and \
conf.CheckPKG("fontconfig") and \
(conf.CheckPKG("lua >= 5.1") or conf.CheckPKG("lua5.1 >= 5.1")) and \
conf.CheckLua(require_version = "5.1") and \
conf.CheckBoost("regex") and \
conf.CheckSDL("SDL_ttf", require_version = "2.0.8") and \
conf.CheckSDL("SDL_mixer", require_version = '1.2.0') and \

28
scons/lua.py Normal file
View file

@ -0,0 +1,28 @@
# vi: syntax=python:et:ts=4
from pkgconfig import run_pkg_config
def CheckLua(context, require_version):
env = context.env
context.Message("Checking for Lua version " + require_version + "... ")
version = ".".join(require_version.split(".")[0:2])
if env.get("luadir"):
env.Append(LIBPATH = ["$luadir"], CPPPATH = ["$luadir/include"], LIBS = "lua" + version)
found = True
else:
found = run_pkg_config(env, "lua >= " + require_version) or run_pkg_config(env, "lua" + version + " >= " + require_version)
result = found and context.TryLink("""
#include <lualib.h>
int main() { luaL_newstate(); }
""", ".c")
if result:
context.Result("yes")
return True
else:
context.Result("no")
return False
config_checks = { "CheckLua" : CheckLua }