3 local function softreq(...) local ok, lib = pcall(require, ...); if ok then return lib; else return nil; end end
5 local function missingdep(name, sources, msg)
6 print("Prosody was unable to find "..tostring(name));
7 print("This package can be obtained in the following ways:");
9 for k,v in pairs(sources) do
12 print(msg or (name.." is required for Prosody to run, so we will now exit."));
15 local lxp = softreq "lxp"
18 missingdep("luaexpat", { ["Ubuntu 8.04 (Hardy)"] = "sudo apt-get install liblua5.1-expat0"; ["luarocks"] = "luarocks install luaexpat"; });
22 local socket = softreq "socket"
25 missingdep("luasocket", { ["Ubuntu 8.04 (Hardy)"] = "sudo apt-get install liblua5.1-socket2"; ["luarocks"] = "luarocks install luasocket"; });
29 local ssl = softreq "ssl"
32 missingdep("LuaSec", { ["Source"] = "http://www.inf.puc-rio.br/~brunoos/luasec/" }, "SSL/TLS support will not be available");
35 if fatal then os.exit(1); end