Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def CheckLua(context, require_version):
env = context.env
backup = env.Clone().Dictionary()
context.Message("Checking for Lua development files 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(context, "lua >= " + require_version) or run_pkg_config(context, "lua" + version + " >= " + require_version) or run_pkg_config(context, "lua-" + version + " >= " + require_version)
if not found:
try:
prefix, include = find_include([env["prefix"]], "lualib.h", default_prefixes=not env["host"])[0]
found = True
context.Log("Found Lua header " + include + ".\n")
env.Append(LIBPATH = [join(prefix, "lib")], CPPPATH = [join(prefix, "include")], LIBS = ["lua"])
except IndexError:
pass
result = found and context.TryLink("""
#include
#include
int main() { luaL_newstate(); }
""", ".c")
if result:
context.Result("yes")
def CheckQtPkg(context, env, name, qtdir):
str=" "
seq=("Checking for", name, "development files... ")
context.Message(str.join(seq))
if qtdir:
backup_pkg_config_path = env["ENV"]["PKG_CONFIG_PATH"]
env["ENV"]["PKG_CONFIG_PATH"] = AppendPath(env.get("PKG_CONFIG_PATH",""), join(qtdir, "lib/pkgconfig"), sep=',')
found = run_pkg_config(context, name)
if qtdir:
env["ENV"]["PKG_CONFIG_PATH"] = backup_pkg_config_path
if found:
context.Result("yes")
return True
else:
context.Result("no")
return False