[vlc-devel] [PATCH 5/5] configure.ac: look for lua.pc first

Alexandre Janniaux ajanni at videolabs.io
Mon Apr 6 15:56:04 CEST 2020


If contrib has been built but is not detected first, contrib includes
were used but the final binaries were linked to another library.

In particular, on Archlinux, when using the default lua (5.3) version,
the contrib would be built but it would still link lua5.3 which has no
symbol for the luaL_register function used when header version is less
than or equal to 5.2.

Instead, check for lua.pc that has the most opportunity to be the
lastest on the system and is also the name of the contrib pkg-config
file when installed.
---
 configure.ac | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/configure.ac b/configure.ac
index 049f590ca6..34f863d436 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1854,16 +1854,18 @@ AC_ARG_ENABLE([lua],
     [disable LUA scripting support (default enabled)]))
 if test "${enable_lua}" != "no"
 then
-  PKG_CHECK_MODULES(LUA, lua5.2, [ have_lua=yes ], [])
+  dnl Lua from contrib will install a lua.pc pkg-config file  so this must be
+  dnl checked first to avoid mixing contribs includes and system libs
+  PKG_CHECK_MODULES(LUA, lua >= 5.1, [ have_lua=yes ], [])
+
+  AS_IF([test "${have_lua}" != "yes"], [
+    AC_MSG_WARN([${LUA_PKG_ERRORS}, trying lua5.2 instead])
+    PKG_CHECK_MODULES(LUA, lua5.2, [ have_lua=yes ], []) ])
 
   AS_IF([test "${have_lua}" != "yes"], [
     AC_MSG_WARN([${LUA_PKG_ERRORS}, trying lua 5.1 instead])
     PKG_CHECK_MODULES(LUA, lua5.1, [ have_lua=yes ], []) ])
 
-  AS_IF([test "${have_lua}" != "yes"], [
-    AC_MSG_WARN([${LUA_PKG_ERRORS}, trying lua >= 5.1 instead])
-    PKG_CHECK_MODULES(LUA, lua >= 5.1, [ have_lua=yes ], []) ])
-
   AS_IF([test "${have_lua}" != "yes"], [
      AC_MSG_WARN([${LUA_PKG_ERRORS}, trying manual detection instead])
      have_lua_lib=no
-- 
2.26.0



More information about the vlc-devel mailing list