Browse Source

Fix ax_lua.m4 so that it skips the header version checks and assumes they're ok when cross-compiling. Use ax_lua.m4's facilities to locate Lua libs and headers

Stanislav Galabov 11 years ago
parent
commit
cb8ca83a07
3 changed files with 11 additions and 50 deletions
  1. 7 45
      configure.ac
  2. 2 1
      m4/ax_lua.m4
  3. 2 4
      plugins/lua/module.am

+ 7 - 45
configure.ac

@@ -49,54 +49,16 @@ AC_ARG_WITH(lua,
             [use_lua=no])
 AM_CONDITIONAL(WITH_LUA,test x$use_lua != xno)
 
-LUA_LDFLAGS=""
-LUA_CFLAGS=""
-LUA_LIBS=""
-
-if test x$use_lua = xyes; then
-    AC_CHECK_LIB([lua],
-                 [lua_close],
-                 [lua_lib_found=yes],
-                 [lua_lib_found=no],
-                 [])
-    if test x$lua_lib_found = xno; then
-        AC_MSG_ERROR([cannot find Lua library])
-    fi
-    LUA_LIBS="-llua -lm"
-    AC_CHECK_HEADER([lua.h],
-                    [lua_h_found=yes],
-                    [lua_h_found=no],
-                    [/* force include check */])
-    if test x$lua_h_found = xno; then
-        AC_MSG_ERROR([cannot find <lua.h> header file])
-    fi
-    AC_CHECK_HEADER([lualib.h],
-                    [lualib_h_found=yes],
-                    [lualib_h_found=no],
-                    [/* force include check */])
-    if test x$lualib_h_found = xno; then
-        AC_MSG_ERROR([cannot find <lualib.h> header file])
-    fi
-    AC_CHECK_HEADER([lauxlib.h],
-                    [lauxlib_h_found=yes],
-                    [lauxlib_h_found=no],
-                    [/* force include check */])
-    if test x$lauxlib_h_found = xno; then
-        AC_MSG_ERROR([cannot find <lauxlib.h> header file])
+if test x$use_lua != xno; then
+    if test x$use_lua != xyes; then
+        CPPFLAGS="${CPPFLAGS} -I$use_lua/include"
+	LDFLAGS="${LDFLAGS} -L$use_lua/lib"
     fi
+    LUA_VERSION="5.1"
+    AX_LUA_HEADERS()
+    AX_LUA_LIBS()
 fi
 
-AC_SUBST(LUA_LDFLAGS)
-AC_SUBST(LUA_CFLAGS)
-AC_SUBST(LUA_LIBS)
-
-#AX_PROG_LUA([5.1], [5.2], ,[:])
-LUA_VERSION="5.1"
-AX_LUA_LIBS([
-    AM_CONDITIONAL(WITH_LUA, true)
-])
-AX_LUA_HEADERS()
-
 ################################
 # Check for the roxml library
 ################################

+ 2 - 1
m4/ax_lua.m4

@@ -492,7 +492,8 @@ int main(int argc, char ** argv)
                 sed "s|^Lua \(.*\)|\1|" | \
                 grep -o "^@<:@0-9@:>@\+\\.@<:@0-9@:>@\+"`
             ],
-            [ax_cv_lua_header_version='unknown'])
+            [ax_cv_lua_header_version='unknown'],
+            [ax_cv_lua_header_version=$LUA_VERSION])
           CPPFLAGS=$_ax_lua_saved_cppflags
         ])
 

+ 2 - 4
plugins/lua/module.am

@@ -1,12 +1,10 @@
 lib_LTLIBRARIES			+= clish_plugin_lua.la
 clish_plugin_lua_la_SOURCES	 = 
-clish_plugin_lua_la_LIBADD	 = @LUA_LIB@ @LUA_LIBS@
+clish_plugin_lua_la_LIBADD	 = @LUA_LIB@
 clish_plugin_lua_la_LDFLAGS	 = -avoid-version -module -shared
 clish_plugin_lua_la_LDFLAGS	+= -export-symbols-regex "^clish_plugin_lua_"
 
-clish_plugin_lua_la_LDFLAGS	+= @LUA_LDFLAGS@
-clish_plugin_lua_la_CFLAGS	 = @LUA_CFLAGS@
-clish_plugin_lua_la_CPPFLAGS	 = @LUA_INCLUDE@
+clish_plugin_lua_la_CPPFLAGS	 = $(AM_CPPFLAGS) @LUA_INCLUDE@
 
 clish_plugin_lua_la_LIBADD	+= \
 	liblub.la \