Add MD5 to the list of checked dependencies
[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(msg or (name.." is required for Prosody to run, so we will now exit."));
15         print("More help can be found on our website, at http://.../doc/depends");
16         print("**************************");
17         print("");
18 end
19
20 local lxp = softreq "lxp"
21
22 if not lxp then
23         missingdep("luaexpat", { ["Ubuntu 8.04 (Hardy)"] = "sudo apt-get install liblua5.1-expat0"; ["luarocks"] = "luarocks install luaexpat"; });
24         fatal = true;
25 end
26
27 local socket = softreq "socket"
28
29 if not socket then
30         missingdep("luasocket", { ["Ubuntu 8.04 (Hardy)"] = "sudo apt-get install liblua5.1-socket2"; ["luarocks"] = "luarocks install luasocket"; });
31         fatal = true;
32 end
33         
34 local ssl = softreq "ssl"
35
36 if not ssl then
37         missingdep("LuaSec", { ["Source"] = "http://www.inf.puc-rio.br/~brunoos/luasec/" }, "SSL/TLS support will not be available");
38 end
39
40
41 local md5 = softreq "md5";
42
43 if not md5 then
44         missingdep("MD5", { ["luarocks"] = "luarocks install md5"; ["Source"] = "http://luaforge.net/frs/?group_id=155" });     
45         fatal = true;
46 end
47
48
49 if fatal then os.exit(1); end