Skip to content

Commit

Permalink
lua.m4: clean up file
Browse files Browse the repository at this point in the history
- Rely on pkg-config or pkgconf instead of lua-config when querying
  lua's build config: lua-config is no longer distributed with many
  distributions.
- Bump the minimum version of lua to 5.3 (the last 5.2 release was
  in 2015).

Signed-off-by: Enji Cooper <ngie@FreeBSD.org>
  • Loading branch information
ngie-eign committed Dec 29, 2024
1 parent 5f85fe7 commit 02a2b33
Showing 1 changed file with 20 additions and 27 deletions.
47 changes: 20 additions & 27 deletions m4/lua.m4
Original file line number Diff line number Diff line change
Expand Up @@ -33,37 +33,30 @@ dnl Helper macro to detect Lua in a variety of systems.
dnl
AC_DEFUN([KYUA_LUA], [
lua_found=no
for lua_release in ${LUA_VERSION:-5.4 5.3 5.2 5.1}; do
if test "${lua_found}" = no; then
for lua_release in ${LUA_VERSION:-5.4 5.3}; do
AS_IF([test "${lua_found}" = no],[
PKG_CHECK_MODULES([LUA], [lua${lua_release} >= ${lua_release}],
[lua_found=yes], [true])
fi
if test "${lua_found}" = no; then
[lua_found="lua${lua_release}"; break],[])
])
AS_IF([test "${lua_found}" = no],[
PKG_CHECK_MODULES([LUA], [lua-${lua_release} >= ${lua_release}],
[lua_found=yes], [true])
fi
if test "${lua_found}" = no; then
[lua_found="lua-${lua_release}"; break],[])
])
AS_IF([test "${lua_found}" = no],[
PKG_CHECK_MODULES([LUA], [lua >= ${lua_release}],
[lua_found=yes], [true])
fi
test "${lua_found}" = no || break
[lua_found=lua; break],[])
])
done
if test "${lua_found}" = no; then
AC_PATH_PROGS([LUA_CONFIG], [lua-config], [unset])
if test "${LUA_CONFIG}" != unset; then
AC_SUBST([LUA_CFLAGS], [$(${LUA_CONFIG} --include)])
AC_SUBST([LUA_LIBS], [$(${LUA_CONFIG} --libs)])
lua_found=yes
fi
fi
AS_IF([test "${lua_found}" = no],[],[
AC_SUBST([LUA_CFLAGS], [$(${PKG_CONFIG} --cflags ${lua_found})])
AC_SUBST([LUA_LIBS], [$(${PKG_CONFIG} --libs ${lua_found})])
])
if test "${lua_found}" = no; then
AC_MSG_ERROR([lua (5.1 or newer) is required])
else
AC_MSG_NOTICE([using LUA_CFLAGS = ${LUA_CFLAGS}])
AC_MSG_NOTICE([using LUA_LIBS = ${LUA_LIBS}])
fi
AS_IF([test "${lua_found}" = no],
[AC_MSG_ERROR([lua (5.3 or newer) is required])],
[
AC_MSG_NOTICE([using LUA_CFLAGS = ${LUA_CFLAGS}])
AC_MSG_NOTICE([using LUA_LIBS = ${LUA_LIBS}])
])
])

0 comments on commit 02a2b33

Please sign in to comment.