aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsfan5 <sfan5@live.de>2022-09-26 15:26:34 +0200
committersfan5 <sfan5@live.de>2022-10-13 23:02:11 +0200
commit558cbd89fbb78be32f4fd7e944f163edd9fb7d42 (patch)
treef05dcb5f022d3fd115394482a5e1e3d1c9e1ffc5 /src
parentcb725a4555951b10c05379e3d34e398dd301f69e (diff)
downloadminetest-558cbd89fbb78be32f4fd7e944f163edd9fb7d42.tar.xz
Add extra check in case someone tries to unbundle Lua
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 60876044e..ee6409366 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -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")