From: Vsevolod Stakhov Date: Tue, 19 May 2015 12:51:50 +0000 (+0100) Subject: Fallback to plain lua if luajit has not been found. X-Git-Tag: 0.9.2~9 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=762fdd196a1e9cc8317a7ae87b11acd7f817871e;p=rspamd.git Fallback to plain lua if luajit has not been found. --- diff --git a/CMakeLists.txt b/CMakeLists.txt index c9d8ae987..d9c627113 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -161,6 +161,34 @@ MACRO(FindLua _major _minor) PATHS ${RSPAMD_DEFAULT_LIBRARY_PATHS} DOC "Lua library" ) + + IF(NOT LUA_LIBRARY OR NOT LUA_INCLUDE_DIR) + MESSAGE(STATUS "Fallback from luajit to plain lua") + SET(ENABLE_LUAJIT "OFF") + MESSAGE(STATUS "Check for lua ${_major}.${_minor}") + FIND_PATH(LUA_INCLUDE_DIR lua.h + HINTS + "${RSPAMD_SEARCH_PATH}" + $ENV{LUA_DIR} + PATH_SUFFIXES "include/lua${_major}${_minor}" + "include/lua${_major}.${_minor}" + "include/lua-${_major}.${_minor}" + include/lua include + PATHS ${RSPAMD_DEFAULT_INCLUDE_PATHS} + ) + FIND_LIBRARY(LUA_LIBRARY + NAMES lua + "lua${_major}${_minor}" + "lua${_major}.${_minor}" + "lua-${_major}.${_minor}" + HINTS + "${RSPAMD_SEARCH_PATH}" + $ENV{LUA_DIR} + PATH_SUFFIXES lib64 lib + PATHS ${RSPAMD_DEFAULT_LIBRARY_PATHS} + DOC "Lua library" + ) + ENDIF() ELSE(ENABLE_LUAJIT MATCHES "ON") MESSAGE(STATUS "Check for lua ${_major}.${_minor}") FIND_PATH(LUA_INCLUDE_DIR lua.h @@ -510,11 +538,11 @@ ENDIF(CMAKE_SYSTEM_NAME STREQUAL "SunOS") # Now find libraries and headers IF(ENABLE_LUAJIT MATCHES "ON") - ProcessPackage(LUAJIT luajit) + #ProcessPackage(LUAJIT luajit) SET(WITH_LUA 1) FindLua(5 1) IF(NOT LUA_FOUND) - MESSAGE(FATAL_ERROR "Lua not found, lua support is required for working") + MESSAGE(FATAL_ERROR "Lua not found, lua support is required") ELSE(NOT LUA_FOUND) SET(WITH_LUA 1) INCLUDE_DIRECTORIES("${LUA_INCLUDE_DIR}") @@ -525,7 +553,7 @@ ELSE(ENABLE_LUAJIT MATCHES "ON") FindLua(5 1) ENDIF(NOT LUA_FOUND) IF(NOT LUA_FOUND) - MESSAGE(FATAL_ERROR "Lua not found, lua support is required for working") + MESSAGE(FATAL_ERROR "Lua not found, lua support is required") ELSE(NOT LUA_FOUND) SET(WITH_LUA 1) INCLUDE_DIRECTORIES("${LUA_INCLUDE_DIR}")