From 285bf935d0cf7fe12640d788b29fa092027a8d60 Mon Sep 17 00:00:00 2001 From: Peter Melnichenko Date: Sun, 21 Aug 2016 18:49:21 +0300 Subject: Refactor look_for_headers in install.bat One side effect should be that LUA_INCDIR does not have trailing backslash when inferred. --- install.bat | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/install.bat b/install.bat index 0f377d8d..41474c47 100644 --- a/install.bat +++ b/install.bat @@ -343,31 +343,33 @@ local function look_for_link_libraries(directory) return false end -local function look_for_headers (directory) +local function look_for_headers(directory) + local directories if vars.LUA_INCDIR then - print(S" checking for $LUA_INCDIR\\lua.h") - if exists(S"$LUA_INCDIR\\lua.h") then - print(" Found lua.h") - return true - end - die(S"lua.h not found in $LUA_INCDIR") + directories = {vars.LUA_INCDIR} + else + directories = { + directory .. S"\\include\\lua\\$LUA_VERSION", + directory .. S"\\include\\lua$LUA_SHORTV", + directory .. S"\\include\\lua$LUA_VERSION", + directory .. "\\include", + directory + } end - for _, e in ipairs{ - S([[\include\lua\$LUA_VERSION]]), - S([[\include\lua$LUA_SHORTV]]), - S([[\include\lua$LUA_VERSION]]), - S([[\include\$LUA_VERSION]]), - [[\include\]], - [[\]], - } do - print(" checking for "..directory..e.."\\lua.h") - if exists(directory..e.."\\lua.h") then - vars.LUA_INCDIR = directory..e + for _, dir in ipairs(directories) do + local full_name = dir .. "\\lua.h" + print(" checking for " .. full_name) + if exists(full_name) then + vars.LUA_INCDIR = dir print(" Found lua.h") return true end end + + if vars.LUA_INCDIR then + die(S"lua.h not found in $LUA_INCDIR") + end return false end -- cgit v1.2.3-55-g6feb