On Sat, Jul 24, 2010 at 11:44:09PM -0400, James Vega wrote:
> On Thu, Jul 22, 2010 at 10:39:38AM -0300, Luis Carvalho wrote:
> > Bram Moolenaar wrote:
> > <snip>
> > > I suppose it will now be easy to support --enable-pythoninterp=dynamic
> > > and --enable-python3interp=dynamic
> > > 
> > > We could wait for people to test this, but on the other hand if we want
> > > to do the same for ruby/tcl/mzscheme we need to do it now, next week I
> > > won't include patches like this.
> > 
> > In the same vein, I'll attaching a patch that adds dynamic support for the 
> > Lua
> > interface. I won't be able to test it in Windows until next week. I'm taking
> > the opportunity to also patch the help file.
> 
> Attached is a patch to use the SONAME-versioned liblua, if it exists,
> for dlopen.  The patch also changes how the version is determined to be
> more robust against future versions which are longer than 5.1, 5.0, etc.

Attached.

-- 
James
GPG Key: 1024D/61326D40 2003-09-02 James Vega <[email protected]>
diff --git a/src/configure.in b/src/configure.in
--- a/src/configure.in
+++ b/src/configure.in
@@ -452,7 +452,7 @@
       if test "X$vi_cv_path_lua" != "X"; then
         dnl -- find Lua version
         AC_CACHE_CHECK(Lua version, vi_cv_version_lua,
-        [ vi_cv_version_lua=`${vi_cv_path_lua} -e "print(_VERSION:sub(5,7))"` ])
+        [ vi_cv_version_lua=`${vi_cv_path_lua} -e "print(_VERSION)" | sed 's/.* //'` ])
         AC_MSG_CHECKING(if lua.h can be found in $vi_cv_path_lua_pfx/include/lua$vi_cv_version_lua)
         if test -f $vi_cv_path_lua_pfx/include/lua$vi_cv_version_lua/lua.h; then
           AC_MSG_RESULT(yes)
@@ -478,9 +478,17 @@
     LUA_PRO="if_lua.pro"
     AC_DEFINE(FEAT_LUA)
     if test "$enable_luainterp" = "dynamic"; then
+      dnl Determine the SONAME for the current version, but fallback to
+      dnl liblua${vi_cv_version_lua}.so if no SONAME-versioned file is found.
+      for i in 0 1 2 3 4 5 6 7 8 9; do
+	if test -f "${vi_cv_path_lua_pfx}/lib/liblua${vi_cv_version_lua}.so.$i"; then
+	  LUA_SONAME=".$i"
+	  break
+	fi
+      done
       AC_DEFINE(DYNAMIC_LUA)
       LUA_LIBS=""
-      LUA_CFLAGS="-DDYNAMIC_LUA_DLL=\\\"liblua${vi_cv_version_lua}.so\\\" $LUA_CFLAGS"
+      LUA_CFLAGS="-DDYNAMIC_LUA_DLL=\\\"liblua${vi_cv_version_lua}.so$LUA_SONAME\\\" $LUA_CFLAGS"
     fi
   fi
   AC_SUBST(LUA_SRC)

Attachment: signature.asc
Description: Digital signature

Raspunde prin e-mail lui