httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wr...@apache.org
Subject svn commit: r772864 - /httpd/httpd/trunk/modules/lua/config.m4
Date Fri, 08 May 2009 06:47:34 GMT
Author: wrowe
Date: Fri May  8 06:47:33 2009
New Revision: 772864

URL: http://svn.apache.org/viewvc?rev=772864&view=rev
Log:
Add . 'default' test first before searching paths, to determine if the
lua.h, liblua5.1, liblua-5.1 or liblua can be resolved.  This avoids
adding strange paths on fedora/redhat, and choosing the wrong /lib[64]
flavor.

Also ensure -lm is always added to the actual linked libraries, avoiding
a LoadModule failure on fedora/redhat.  Still should first try to search 
for pkg-config lua settings, but note this would break fedora until that
build hackery is corrected, c.f. the bug
https://bugzilla.redhat.com/show_bug.cgi?id=499238


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=772864&r1=772863&r2=772864&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/lua/config.m4 (original)
+++ httpd/httpd/trunk/modules/lua/config.m4 Fri May  8 06:47:33 2009
@@ -17,13 +17,37 @@
 
 dnl # Determine lua lib directory
 if test -z $lua_path; then
-    test_paths="/usr/local /usr"
+    test_paths=". /usr/local /usr"
 else
     test_paths="${lua_path}"
 fi
 
-AC_CHECK_LIB([m], [pow], lib_m=" -lm")
+AC_CHECK_LIB(m, pow, lib_m="-lm")
+AC_CHECK_LIB(m, sqrt, lib_m="-lm")
 for x in $test_paths ; do
+  if test "x$x" == "x."; then
+    AC_CHECK_HEADER(lua.h,[
+        save_CFLAGS=$CFLAGS
+        save_LDFLAGS=$LDFLAGS
+        CFLAGS="$CFLAGS"
+        LDFLAGS="$LDFLAGS $lib_m"
+        AC_CHECK_LIB(lua5.1, luaL_newstate, [
+            LUA_LIBS="-llua5.1 $lib_m"
+        ],[
+            AC_CHECK_LIB(lua-5.1, luaL_newstate, [
+                LUA_LIBS="-llua-5.1 $lib_m"
+            ],[
+                AC_CHECK_LIB(lua, luaL_newstate, [
+                    LUA_LIBS="-llua $lib_m"
+                ])
+            ])
+        ])
+        LUA_CFLAGS=
+        CFLAGS=$save_CFLAGS
+        LDFLAGS=$save_LDFLAGS
+        break
+    ])
+  else
     AC_MSG_CHECKING([for lua.h in ${x}/include/lua5.1])
     if test -f ${x}/include/lua5.1/lua.h; then
         AC_MSG_RESULT([yes])
@@ -31,9 +55,8 @@
         save_LDFLAGS=$LDFLAGS
         CFLAGS="$CFLAGS"
         LDFLAGS="-L$x/lib $LDFLAGS $lib_m"
-        AC_CHECK_LIB(lua5.1, luaL_newstate,
-            [
-            LUA_LIBS="-L$x/lib -llua5.1"
+        AC_CHECK_LIB(lua5.1, luaL_newstate, [
+            LUA_LIBS="-L$x/lib -llua5.1 $lib_m"
             LUA_CFLAGS="-I$x/include/lua5.1"
             ])
         CFLAGS=$save_CFLAGS
@@ -49,9 +72,8 @@
         save_LDFLAGS=$LDFLAGS
         CFLAGS="$CFLAGS"
         LDFLAGS="-L$x/lib/lua51 $LDFLAGS $lib_m"
-        AC_CHECK_LIB(lua, luaL_newstate,
-            [
-            LUA_LIBS="-L$x/lib/lua51 -llua"
+        AC_CHECK_LIB(lua, luaL_newstate, [
+            LUA_LIBS="-L$x/lib/lua51 -llua $lib_m"
             LUA_CFLAGS="-I$x/include/lua51"
             ])
         CFLAGS=$save_CFLAGS
@@ -67,9 +89,8 @@
         save_LDFLAGS=$LDFLAGS
         CFLAGS="$CFLAGS"
         LDFLAGS="-L$x/lib $LDFLAGS $lib_m"
-        AC_CHECK_LIB(lua, luaL_newstate,
-            [
-            LUA_LIBS="-L$x/lib -llua"
+        AC_CHECK_LIB(lua, luaL_newstate, [
+            LUA_LIBS="-L$x/lib -llua $lib_m"
             LUA_CFLAGS="-I$x/include"
             ])
         CFLAGS=$save_CFLAGS
@@ -78,6 +99,7 @@
     else
         AC_MSG_RESULT([no])
     fi
+  fi
 done
 
 AC_SUBST(LUA_LIBS)
@@ -97,11 +119,10 @@
 
 lua_objects="lua_apr.lo lua_config.lo mod_lua.lo lua_request.lo lua_vmprep.lo"
 
-APACHE_MODULE(lua, Apache Lua Framework, $lua_objects, , no,
-[
-CHECK_LUA()
-APR_ADDTO(INCLUDES, ["$LUA_CFLAGS"])
-MOD_LUA_LDADD="$LUA_LIBS"
+APACHE_MODULE(lua, Apache Lua Framework, $lua_objects, , no, [
+  CHECK_LUA()
+  APR_ADDTO(INCLUDES, ["$LUA_CFLAGS"])
+  MOD_LUA_LDADD="$LUA_LIBS"
 ])
 
 APACHE_MODPATH_FINISH



Mime
View raw message