httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jchamp...@apache.org
Subject svn commit: r1785753 - /httpd/httpd/trunk/modules/lua/config.m4
Date Mon, 06 Mar 2017 19:49:23 GMT
Author: jchampion
Date: Mon Mar  6 19:49:23 2017
New Revision: 1785753

URL: http://svn.apache.org/viewvc?rev=1785753&view=rev
Log:
configure: check for luaL_register in liblua

This is a temporary workaround for a missing compatibility API on
Debian-like systems (and anyone else who doesn't compile with
LUA_COMPAT_MODULE). Ignore any such libraries so we don't fail
confusingly later.

Modified:
    httpd/httpd/trunk/modules/lua/config.m4

Modified: httpd/httpd/trunk/modules/lua/config.m4
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/lua/config.m4?rev=1785753&r1=1785752&r2=1785753&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/lua/config.m4 (original)
+++ httpd/httpd/trunk/modules/lua/config.m4 Mon Mar  6 19:49:23 2017
@@ -12,20 +12,51 @@ AC_DEFUN([CHECK_LUA_PATH], [dnl
     AC_MSG_CHECKING([for lua.h in $1/$2])
     if test -f $1/$2/lua.h; then
         AC_MSG_RESULT([yes])
+
         save_CFLAGS=$CFLAGS
         save_LDFLAGS=$LDFLAGS
+        save_LIBS=$LIBS
+
         CFLAGS="$CFLAGS"
         LDFLAGS="-L$1/$3 $LDFLAGS $lib_m"
+
         AC_CHECK_LIB($4, luaL_newstate, [
-            LUA_LIBS="-L$1/$3 -l$4 $lib_m"
-            if test "x$ap_platform_runtime_link_flag" != "x"; then
-               APR_ADDTO(LUA_LIBS, [$ap_platform_runtime_link_flag$1/$3])
-            fi
-            LUA_CFLAGS="-I$1/$2"
+            dnl mod_lua relies on some compatibility APIs to function.
+            AC_MSG_CHECKING([for luaL_register in -l$4])
+            CFLAGS="$CFLAGS -I$1/$2"
+            LIBS="-l$4"
+            AC_LINK_IFELSE([
+                AC_LANG_PROGRAM([[
+                    #define LUA_COMPAT_ALL
+                    #define LUA_COMPAT_5_2
+                    #define LUA_COMPAT_5_1
+                    #define LUA_COMPAT_MODULE
+
+                    #include <lua.h>
+                    #include <lauxlib.h>
+                ]], [[
+                    /* This isn't a valid call, but we're testing linkability */
+                    luaL_register(NULL, NULL, NULL);
+                ]])
+            ], [
+                AC_MSG_RESULT([yes])
+                LUA_LIBS="-L$1/$3 -l$4 $lib_m"
+                if test "x$ap_platform_runtime_link_flag" != "x"; then
+                   APR_ADDTO(LUA_LIBS, [$ap_platform_runtime_link_flag$1/$3])
+                fi
+                LUA_CFLAGS="-I$1/$2"
+            ], [
+                AC_MSG_RESULT([no])
             ])
+        ])
+
         CFLAGS=$save_CFLAGS
         LDFLAGS=$save_LDFLAGS
-        break
+        LIBS=$save_LIBS
+
+        if test -n "${LUA_LIBS}"; then
+            break
+        fi
     else
         AC_MSG_RESULT([no])
     fi



Mime
View raw message