Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libluajit not auto-detected #6423

Closed
zeha opened this issue Mar 30, 2018 · 4 comments
Closed

libluajit not auto-detected #6423

zeha opened this issue Mar 30, 2018 · 4 comments
Labels
Milestone

Comments

@zeha
Copy link
Collaborator

@zeha zeha commented Mar 30, 2018

dnsdist 1.3.0

Short description

Contrary to ./configure --help output, which shows --with-luajit ... [default=auto], not passing any of --with-luajit / --with-lua results in this:

checking whether we will be linking in LuaJIT... no
checking whether we will be linking in Lua... auto
checking for LUA... no
checking for LUA... no
checking for LUA... no
checking for LUA... no
checking for LUA... no
checking for LUA... no
checking for LUA... no
checking for LUA... no
checking for LUA... no
checking for LUA... no
checking for chosen LUA... not found
configure: error: Neither Lua nor LuaJIT found, Lua support is not optional

(Updated, as the version of luajit doesn't actually matter.)

@zeha zeha added the dnsdist label Mar 30, 2018
@rgacogne rgacogne added this to the dnsdist-1.3.x milestone Mar 30, 2018
@zeha zeha changed the title libluajit 2.1.0~beta3 not detected libluajit not auto-detected Apr 3, 2018
@zeha
Copy link
Collaborator Author

@zeha zeha commented Apr 3, 2018

This actually makes --with-luajit default to auto, but there's some ugly printout (see below) and I'm not sure this is actually correct. @pieterlexis can you check and possibly integrate this?

Index: dnsdist/m4/pdns_with_luajit.m4
===================================================================
--- dnsdist.orig/m4/pdns_with_luajit.m4
+++ dnsdist/m4/pdns_with_luajit.m4
@@ -3,19 +3,23 @@ AC_DEFUN([PDNS_WITH_LUAJIT],[
   AC_ARG_WITH([luajit],
     [AS_HELP_STRING([--with-luajit], [build LuaJIT bindings @<:@default=auto@:>@])],
     [with_luajit=$withval],
-    [with_luajit=no]
+    [with_luajit=auto]
   )
   AC_MSG_RESULT([$with_luajit])
 
-  AS_IF([test "x$with_luajit" = "xyes"], [
+  AS_IF([test "x$with_luajit" != "xno"], [
     LUAJITPC="$with_luajit"
     PKG_CHECK_MODULES([LUA], [luajit],
       [AC_DEFINE([HAVE_LUA], [1], [Define to 1 if you have LuaJIT])],
       [LUAJITPC=""]
     )
     AS_IF([test "x$LUAJITPC" = "x"], [
-      AC_MSG_ERROR([LuaJIT not found])]
-    )
+      AS_IF([test "x$with_luajit" = "xyes"],
+        [AC_MSG_ERROR([LuaJIT not found])],
+        [AC_MSG_RESULT([not found])]
+      )],[
+        AC_MSG_RESULT([$LUAJITPC])
+      ])
   ])
 
   AM_CONDITIONAL([LUA], [test "x$with_luajit" = "xyes"])

printout example:

checking whether we will be linking in LuaJIT... auto
checking for LUA... yes
auto
checking lua.hpp usability... no
checking lua.hpp presence... no
checking for lua.hpp... no
@pieterlexis
Copy link
Member

@pieterlexis pieterlexis commented Apr 4, 2018

This change also changes the explicit detection to an implicit detection. Perhaps we should merge the Lua detection with the LuaJit detection and prefer LuaJit over Lua and allow selection of the implementation at configure time switchable... e.g. --with-lua=luajit or --with-lua=5.1

@zeha
Copy link
Collaborator Author

@zeha zeha commented Apr 4, 2018

Well yeah I don't really understand the (autoconf) logic in there.

Mostly I'd like configure without any of --with-lua(jit) to find luajit and fallback to lua if any of them are available.

@pieterlexis
Copy link
Member

@pieterlexis pieterlexis commented Apr 4, 2018

Mostly I'd like configure without any of --with-lua(jit) to find luajit and fallback to lua if any of them are available.

Alright! I'll make the logic like this:

if --with is auto
  if found luajit => done
  if found lua => done
  if nothing found => error
if --with is set
  if found set value => done
  if not found => error
pieterlexis added a commit to pieterlexis/pdns that referenced this issue Apr 4, 2018
Detect LuaJIT first, then other implementations. Allows setting
`--with-lua` to a specific implementation as well (e.g. `lua51`). Will
produce errors appropriately.

Fixes PowerDNS#6423.
@pieterlexis pieterlexis mentioned this issue Apr 4, 2018
6 of 10 tasks complete
pieterlexis added a commit to pieterlexis/pdns that referenced this issue Apr 5, 2018
Detect LuaJIT first, then other implementations. Allows setting
`--with-lua` to a specific implementation as well (e.g. `lua51`). Will
produce errors appropriately.

Fixes PowerDNS#6423.
pieterlexis added a commit to pieterlexis/pdns that referenced this issue Apr 5, 2018
Detect LuaJIT first, then other implementations. Allows setting
`--with-lua` to a specific implementation as well (e.g. `lua51`). Will
produce errors appropriately.

Fixes PowerDNS#6423.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

3 participants
You can’t perform that action at this time.