--- CMakeLists.txt.orig	2017-05-04 05:07:26 UTC
+++ CMakeLists.txt
@@ -223,7 +223,7 @@ else()
 
   # On FreeBSD 64 math.h uses unguarded C11 extension, which taints clang
   # 3.4.1 used there.
-  if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
+  if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" AND CMAKE_C_COMPILER_ID MATCHES "Clang")
     add_definitions(-Wno-c11-extensions)
   endif()
 endif()
@@ -401,9 +401,9 @@ endforeach()
 
 # Find Lua interpreter
 include(LuaHelpers)
-set(LUA_DEPENDENCIES lpeg mpack bit)
+set(LUA_DEPENDENCIES lpeg bit)
 if(NOT LUA_PRG)
-  foreach(CURRENT_LUA_PRG luajit lua5.1 lua5.2 lua)
+  foreach(CURRENT_LUA_PRG luajit)
     # If LUA_PRG is set find_program() will not search
     unset(LUA_PRG CACHE)
     unset(LUA_PRG_WORKS)
