Update how we search for Lua with pkg-config.

First, search for packages with the version number without the period (bug
11219).

Second, don't look for Lua 5.3 because we don't work with it.  If what we find
(without pkg-config's help) is Lua 5.3, disable Lua support (bug 10881).

Cmake support by Peter Wu (originally Ie73e5b53640f10432881a9671c0a605f7f027ed8):
Note the check for "lua<=5.2.99" instead of "lua<5.3" since cmake does not
support the latter syntax. Tested with lua5.2, lua5.1 and lua (5.3) installed.

Bug: 11219
Ping-Bug: 10881
Change-Id: I382d07ca00eafc6111cd4e9faa2b66f6b8f95b6e
Reviewed-on: https://code.wireshark.org/review/8783
Petri-Dish: Jeff Morriss <jeff.morriss.ws@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
This commit is contained in:
Jeff Morriss 2015-06-05 22:04:29 -04:00 committed by Alexis La Goutte
parent da1766e987
commit 032ad5a7aa
2 changed files with 30 additions and 19 deletions

View File

@ -808,22 +808,23 @@ AC_DEFUN([AC_WIRESHARK_LIBLUA_CHECK],[
# The user didn't tell us where to find Lua. Let's go look for it.
# First, try the standard (pkg-config) way.
PKG_CHECK_MODULES(LUA, lua, [have_lua=yes], [true])
# Unfortunately Lua's pkg-config file isn't standardly named.
# Apparently Debian, in particular, allows installation of multiple
# versions of Lua at the same time (thus each version has its own
# package name).
for ver in 5.2 -5.2 5.1 -5.1 5.0 -5.0
# Some distributions allow installation of multiple versions of
# Lua at the same time. On such systems each version has its
# own package name.
#
# We use a for loop instead of giving all the package names to
# PKG_CHECK_MODULES because doing the latter doesn't appear to
# work reliably (some package names are not searched for).
for pkg in lua5.2 lua-5.2 lua52 lua5.1 lua-5.1 lua51 lua5.0 lua-5.0 lua50 "lua < 5.3"
do
PKG_CHECK_MODULES(LUA, $pkg, [have_lua=yes], [true])
if test "x$have_lua" = "xyes"
then
break
fi
PKG_CHECK_MODULES(LUA, lua$ver, [have_lua=yes], [true])
done
fi
if test "x$have_lua" != "xyes"
@ -868,17 +869,24 @@ AC_DEFUN([AC_WIRESHARK_LIBLUA_CHECK],[
AC_MSG_CHECKING(the Lua version)
lua_ver=`$AWK AS_ESCAPE('/LUA_VERSION_NUM/ { print $NF; }' $header_dir/lua.h | sed 's/0/./')`
AC_MSG_RESULT($lua_ver)
wireshark_save_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS -I$header_dir"
AC_CHECK_HEADERS(lua.h lualib.h lauxlib.h, ,
[
if test "x$lua_ver" = "x5.3"
then
# Wireshark doesn't compile with Lua 5.3 today
AC_MSG_RESULT($lua_ver - disabling Lua support)
have_lua=no
# Restore our CPPFLAGS
CPPFLAGS="$wireshark_save_CPPFLAGS"
break
])
else
AC_MSG_RESULT($lua_ver)
wireshark_save_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS -I$header_dir"
AC_CHECK_HEADERS(lua.h lualib.h lauxlib.h, ,
[
have_lua=no
# Restore our CPPFLAGS
CPPFLAGS="$wireshark_save_CPPFLAGS"
])
fi
if test "x$have_lua" = "x"
then

View File

@ -18,7 +18,10 @@ INCLUDE(FindWSWinLibs)
FindWSWinLibs("lua5*" "LUA_HINTS")
find_package(PkgConfig)
pkg_search_module(LUA lua)
pkg_search_module(LUA lua5.2 lua-5.2 lua52 lua5.1 lua-5.1 lua51 lua5.0 lua-5.0 lua50)
if(NOT LUA_FOUND)
pkg_search_module(LUA "lua<=5.2.99")
endif()
FIND_PATH(LUA_INCLUDE_DIR lua.h
HINTS