]> git.lizzy.rs Git - minetest.git/commitdiff
Add extra check in case someone tries to unbundle Lua
authorsfan5 <sfan5@live.de>
Mon, 26 Sep 2022 13:26:34 +0000 (15:26 +0200)
committersfan5 <sfan5@live.de>
Thu, 13 Oct 2022 21:02:11 +0000 (23:02 +0200)
src/CMakeLists.txt

index 60876044e6d4e77d75629d2ab1a2835408b407ab..ee6409366fc193dcff2188b0370d1e903bd254f3 100644 (file)
@@ -673,6 +673,22 @@ endif()
 
 include(CheckCSourceCompiles)
 
+if(NOT USE_LUAJIT)
+       set(CMAKE_REQUIRED_INCLUDES ${LUA_INCLUDE_DIR})
+       unset(HAVE_ATCCALL CACHE)
+       # Note: we need to check the function without having the library
+       #       available for linking, so check_symbol_exists won't work.
+       check_c_source_compiles("#include <lua.h>\nint main(){return sizeof(lua_atccall);}" HAVE_ATCCALL)
+       if(NOT HAVE_ATCCALL)
+               string(CONCAT explanation_msg
+                       "It looks like you're trying to build Minetest using a system-wide "
+                       "Lua installation. This is no longer supported because PUC Lua "
+                       "cannot interoperate with C++ correctly. Read src/unittest/test_lua.cpp "
+                       " for technical details.")
+               message(FATAL_ERROR ${explanation_msg})
+       endif()
+endif()
+
 if(MSVC)
        # Visual Studio
        set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /D WIN32_LEAN_AND_MEAN")