+ mkdir -p $(LUA_INSTALL_CMOD)
+ cp $(LIBNAME) $(LUA_INSTALL_CMOD)
+ #strip $(LUA_INSTALL_CMOD)/$(LIBNAME)
+ (cd $(LUA_INSTALL_CMOD) ; rm -f $T$(LIB_EXT) ; ln -fs $(LIBNAME) $T$(LIB_EXT))]])
+if lua_ver == '5.0' and opts['LUA_HAVE_COMPAT51'] ~= 'HAVE_COMPAT51' then
+ print([[
+ mkdir -p $(LUA_RRD_LANGPREF)/5.0
+ cp compat-5.1r5/compat-5.1.lua $(LUA_RRD_LANGPREF)/5.0
+]])
+end
+
+print([[
+
+test.lua: $(LIBNAME) test.lua.bottom
+ @echo "-- Created by Makefile." > test.lua
+ @echo "-- Test script adapted from the one in the Ruby binding." > test.lua
+ @echo >> test.lua]])
+if lua_ver == '5.0' then
+ print([[
+ @echo "--- compat-5.1.lua is only required for Lua 5.0 ----------" >> test.lua]])
+
+ if opts['LUA_HAVE_COMPAT51'] ~= 'HAVE_COMPAT51' then
+ print([[
+ @echo "original_LUA_PATH = LUA_PATH" >> test.lua
+ @echo "-- try only compat-5.1.lua installed with RRDtool package" >> test.lua
+ @echo "LUA_PATH = '$(LUA_RRD_LANGPREF)/5.0/?.lua'" >> test.lua]])
+ end
+ print([[
+ @echo "local r = pcall(require, 'compat-5.1')" >> test.lua
+ @echo "if not r then" >> test.lua
+ @echo " print('** compat-5.1.lua not found')" >> test.lua
+ @echo " os.exit(1)" >> test.lua
+ @echo "end" >> test.lua]])
+
+ if opts['LUA_HAVE_COMPAT51'] ~= 'HAVE_COMPAT51' then
+ print([[
+ @echo "LUA_PATH = original_LUA_PATH" >> test.lua
+ @echo "original_LUA_PATH = nil" >> test.lua]])
+ end
+ print([[
+ @echo "----------------------------------------------------------" >> test.lua
+ @echo >> test.lua]])
+end
+if opts['LUA_RRD_LANGPREF'] .. '/' .. lua_ver == opts['LUA_INSTALL_CMOD'] then
+ print([[
+ @echo "package.cpath = '$(LUA_INSTALL_CMOD)/?.so;' .. package.cpath" >> test.lua]])
+end
+print([[
+ @cat test.lua.bottom >> test.lua