Browse Source

Merge branch 'master' into plugin

Serj Kalichev 11 years ago
parent
commit
2d20556df5

+ 30 - 0
configure.ac

@@ -29,6 +29,36 @@ AC_CHECK_SIZEOF(int)
 AC_CHECK_SIZEOF(long)
 AC_CHECK_SIZEOF(size_t)
 
+#########################################
+# See if linker supports version scripts
+#########################################
+# Check if LD supports linker scripts,
+# and define automake conditional HAVE_LD_VERSION_SCRIPT if so.
+AC_ARG_ENABLE([ld-version-script],
+              AS_HELP_STRING([--enable-ld-version-script],
+                             [enable linker version script (default is enabled when possible)]),
+                             [have_ld_version_script=$enableval], [])
+if test -z "$have_ld_version_script"; then
+    AC_MSG_CHECKING([if LD -Wl,--version-script works])
+    save_LDFLAGS="$LDFLAGS"
+    LDFLAGS="$LDFLAGS -Wl,--version-script=conftest.map"
+    cat > conftest.map <<EOF
+VERS_1 {
+    global: sym;
+};
+
+VERS_2 {
+    global: sym;
+} VERS_1;
+EOF
+    AC_LINK_IFELSE([AC_LANG_SOURCE([int main() { return 0; }])],
+                   [have_ld_version_script=yes], [have_ld_version_script=no])
+    rm -f conftest.map
+    LDFLAGS="$save_LDFLAGS"
+    AC_MSG_RESULT($have_ld_version_script)
+fi
+AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes")
+
 ################################
 # Deal with debugging options
 ################################

+ 5 - 1
plugins/lua/module.am

@@ -2,7 +2,11 @@ lib_LTLIBRARIES			+= clish_plugin_lua.la
 clish_plugin_lua_la_SOURCES	 = 
 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_"
+if HAVE_LD_VERSION_SCRIPT
+clish_plugin_lua_la_LDFLAGS	+= -Wl,--version-script=plugins/lua/version.map
+else
+clish_plugin_lua_la_LDFLAGS     += -export-symbols plugins/lua/symbols.map
+endif
 
 clish_plugin_lua_la_CPPFLAGS	 = $(AM_CPPFLAGS) @LUA_INCLUDE@
 

+ 3 - 0
plugins/lua/symbols.map

@@ -0,0 +1,3 @@
+clish_plugin_init
+clish_plugin_fini
+clish_plugin_lua_action

+ 4 - 0
plugins/lua/version.map

@@ -0,0 +1,4 @@
+{
+	global: clish_plugin_init; clish_plugin_fini; clish_plugin_lua_action;
+	local: *;
+};

+ 3 - 1
xml-examples/lua/startup.xml

@@ -7,7 +7,9 @@
      <PLUGIN name="lua" file="clish_plugin_lua.so">
 	 /usr2/klish-rw/xml-examples/lua
      </PLUGIN>
-     <STARTUP view="test-view" default_builtin="lua@lua"/>
+     <HOOK name="action" builtin="lua@lua"/>
+
+     <STARTUP view="test-view"/>
 
 </CLISH_MODULE>
 

+ 5 - 3
xml-examples/lua/test.xml

@@ -15,7 +15,9 @@
 	</COMMAND>
 
 	<COMMAND name="test1" help="" lock="false">
-		<ACTION> echo "Empty attribute" </ACTION>
+		<ACTION builtin="clish_script@clish">
+			echo "Empty attribute"
+		</ACTION>
 	</COMMAND>
 
 	<COMMAND name="test2" help='Single quotes' lock="false">
@@ -81,12 +83,12 @@ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 	</COMMAND>
 
 	<COMMAND name="test8" help="Call a Lua function">
-		<ACTION builtin="lua@lua">hello_world()</ACTION>
+		<ACTION>hello_world()</ACTION>
 	</COMMAND>
 
 	<COMMAND name="eval" help="Evaluate a string as Lua chunk">
 		<PARAM name="str" help="String to evaluate" ptype="STRING"/>
-		<ACTION builtin="lua@lua">loadstring("${str}")()</ACTION>
+		<ACTION>loadstring("${str}")()</ACTION>
 	</COMMAND>
 
 	<COMMAND name="test9" ref="eval" help="Alias for the eval command"/>