Trivial whitespace fix in the missing dependency message
[prosody.git] / util / dependencies.lua
1 local fatal;
2
3 local function softreq(...) local ok, lib =  pcall(require, ...); if ok then return lib; else return nil; end end
4
5 local function missingdep(name, sources, msg)
6         print("");
7         print("**************************");
8         print("Prosody was unable to find "..tostring(name));
9         print("This package can be obtained in the following ways:");
10         print("");
11         for k,v in pairs(sources) do
12                 print("", k, v);
13         end
14         print("");
15         print(msg or (name.." is required for Prosody to run, so we will now exit."));
16         print("More help can be found on our website, at http://.../doc/depends");
17         print("**************************");
18         print("");
19 end
20
21 local lxp = softreq "lxp"
22
23 if not lxp then
24         missingdep("luaexpat", { ["Ubuntu 8.04 (Hardy)"] = "sudo apt-get install liblua5.1-expat0"; ["luarocks"] = "luarocks install luaexpat"; });
25         fatal = true;
26 end
27
28 local socket = softreq "socket"
29
30 if not socket then
31         missingdep("luasocket", { ["Ubuntu 8.04 (Hardy)"] = "sudo apt-get install liblua5.1-socket2"; ["luarocks"] = "luarocks install luasocket"; });
32         fatal = true;
33 end
34         
35 local ssl = softreq "ssl"
36
37 if not ssl then
38         missingdep("LuaSec", { ["Source"] = "http://www.inf.puc-rio.br/~brunoos/luasec/" }, "SSL/TLS support will not be available");
39 end
40
41
42 local md5 = softreq "md5";
43
44 if not md5 then
45         missingdep("MD5", { ["luarocks"] = "luarocks install md5"; ["Source"] = "http://luaforge.net/frs/?group_id=155" });     
46         fatal = true;
47 end
48
49
50 if fatal then os.exit(1); end