1 AC_DEFUN([PDNS_WITH_LUA],[
2 AC_PROG_GREP()dnl Ensure we have grep
3 AC_MSG_CHECKING([which Lua implementation to use])
5 [AS_HELP_STRING([--with-lua], [select Lua implementation @<:@default=auto@:>@])
12 AS_IF([test "x$with_lua" = "xyes"], [
13 dnl --with-lua was passed, make it auto
17 AC_MSG_RESULT([$with_lua])
19 AS_IF([test "x$with_lua" = "xno" -a "$1" = "mandatory"], [
20 AC_MSG_ERROR([--without-lua specified, but Lua is not optional])
24 luajit_min_version='2.0.2'
27 AS_IF([test "x$with_lua" != "xno"], [
28 AS_IF([test "x$with_lua" != "xauto"], [
29 with_lua_version=${lua_min_version}
30 AS_IF([echo "x$with_lua" | ${GREP} 'jit' >/dev/null 2>&1], [with_lua_version=${luajit_min_version}])
31 PKG_CHECK_MODULES([LUA], $with_lua >= $with_lua_version, [
32 AC_DEFINE([HAVE_LUA], [1], [Define to 1 if you have Lua])
35 AC_MSG_ERROR([Selected Lua ($with_lua) not found])
38 PKG_CHECK_MODULES([LUA], [luajit >= ${luajit_min_version}], [
40 AC_DEFINE([HAVE_LUA], [1], [Define to 1 if you have Lua])
42 AS_IF([test -z "$LUAPC"], [
44 m4_foreach_w([luapc], [lua5.3 lua-5.3 lua53 lua5.2 lua-5.2 lua52 lua5.1 lua-5.1 lua51 lua], [
45 AS_IF([test "$found_lua" != "y"], [
46 PKG_CHECK_MODULES([LUA], [luapc >= ${lua_min_version}], [
47 AC_DEFINE([HAVE_LUA], [1], [Define to 1 if you have lua])
57 AS_IF([test -z "$LUAPC" -a "$1" = "mandatory"], [
58 AC_MSG_ERROR([No Lua not found, but is mandatory])
61 AM_CONDITIONAL([LUA], [test -n "x$LUAPC"])