From e4b10df9496b6cd1a50adf75e5c001d304176390 Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Sun, 31 May 2020 16:24:24 +0200 Subject: [PATCH] [configure.ac] --with-luapkg=name let user choose Lua version For example: --with-luapkg=luajit or --with-luapkg=lua5.2 etc. If you do not want lua, omit this configure option or pass --with-luapkg= Old --without-lua was removed. --- configure.ac | 47 +++++++++++++++++------------------------------ 1 file changed, 17 insertions(+), 30 deletions(-) diff --git a/configure.ac b/configure.ac index 9626a991..a8ed4aff 100644 --- a/configure.ac +++ b/configure.ac @@ -878,42 +878,29 @@ fi # Check for Lua, optional even if installed. # =================================================================== -# Do this the long way, as FreeBSD reportedly needs -L for -# anything other than /usr/lib, and Lua is very often in /usr/local/lib. - -AC_ARG_WITH(lua, [ --without-lua disable Lua support], - [if test "$withval" = no; then disable_lua=yes; fi]) +luapkg= +AC_ARG_WITH(luapkg, [ --with-luapkg=name choose Lua version], + [luapkg="$withval"]) AC_MSG_CHECKING([for Lua]) EL_SAVE_FLAGS cf_result=no -if test -z "$disable_lua"; then - if test ! -d "$withval"; then - withval=""; - fi - for luadir in "$withval" "" /usr /usr/local; do - for suffix in "" 5.1 51 5.3 53 5.2 52; do - if test "$cf_result" = no && ( test -f "$luadir/include/lua.h" || \ - test -f "$luadir/include/lua$suffix/lua.h" ) ; then - LUA_LIBS="-L$luadir/lib -llua$suffix -lm" - LUA_CFLAGS="-I$luadir/include -I$luadir/include/lua$suffix" +if test -n "$luapkg" && $PKG_CONFIG "$luapkg"; then + LUA_CFLAGS=`$PKG_CONFIG --cflags "$luapkg"` + LUA_LIBS=`$PKG_CONFIG --libs "$luapkg"` + CFLAGS="$CFLAGS_X $LUA_CFLAGS" + CPPFLAGS="$CPPFLAGS_X $LUA_CFLAGS" + LIBS="$LUA_LIBS $LIBS_X" - LIBS="$LUA_LIBS $LIBS_X" - CFLAGS="$CFLAGS_X $LUA_CFLAGS" - CPPFLAGS="$CPPFLAGS_X $LUA_CFLAGS" - - # Check that it is a compatible Lua version - AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include ] - #include - #include - ], [[ lua_State *L = luaL_newstate(); - luaL_openlibs(L); - lua_pushboolean(L, 1); - lua_close(L);]])],[cf_result=yes],[cf_result=no]) - fi - done - done + # Check that it is a compatible Lua version + AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include ] + #include + #include + ], [[lua_State *L = luaL_newstate(); + luaL_openlibs(L); + lua_pushboolean(L, 1); + lua_close(L);]])],[cf_result=yes],[cf_result=no]) fi AC_MSG_RESULT($cf_result)