2 -- Copyright (C) 2008-2009 Matthew Wild
3 -- Copyright (C) 2008-2009 Waqas Hussain
5 -- This project is MIT/X11 licensed. Please see the
6 -- COPYING file in the source package for more information.
12 local function softreq(...) local ok, lib = pcall(require, ...); if ok then return lib; else return nil, lib; end end
14 local function missingdep(name, sources, msg)
16 print("**************************");
17 print("Prosody was unable to find "..tostring(name));
18 print("This package can be obtained in the following ways:");
20 for k,v in pairs(sources) do
24 print(msg or (name.." is required for Prosody to run, so we will now exit."));
25 print("More help can be found on our website, at http://prosody.im/doc/depends");
26 print("**************************");
30 local lxp = softreq "lxp"
33 missingdep("luaexpat", {
34 ["Debian/Ubuntu"] = "sudo apt-get install liblua5.1-expat0";
35 ["luarocks"] = "luarocks install luaexpat";
36 ["Source"] = "http://www.keplerproject.org/luaexpat/";
41 local socket = softreq "socket"
44 missingdep("luasocket", {
45 ["Ubuntu"] = "sudo apt-get install liblua5.1-socket2";
46 ["luarocks"] = "luarocks install luasocket";
47 ["Source"] = "http://www.tecgraf.puc-rio.br/~diego/professional/luasocket/";
52 local lfs, err = softreq "lfs"
54 missingdep("luafilesystem", {
55 ["luarocks"] = "luarocks install luafilesystem";
56 ["Debian/Ubuntu"] = "sudo apt-get install liblua5.1-luafilesystem0";
57 ["Source"] = "http://www.keplerproject.org/luafilesystem/";
62 local ssl = softreq "ssl"
65 if config.get("*", "core", "run_without_ssl") then
66 log("warn", "Running without SSL support because run_without_ssl is defined in the config");
68 missingdep("LuaSec", {
69 ["Debian/Ubuntu"] = "http://prosody.im/download/start#debian_and_ubuntu";
70 ["luarocks"] = "luarocks install luasec";
71 ["Source"] = "http://www.inf.puc-rio.br/~brunoos/luasec/";
72 }, "SSL/TLS support will not be available");
76 local encodings, err = softreq "util.encodings"
78 if err:match("not found") then
79 missingdep("util.encodings", { ["Windows"] = "Make sure you have encodings.dll from the Prosody distribution in util/";
80 ["GNU/Linux"] = "Run './configure' and 'make' in the Prosody source directory to build util/encodings.so";
83 print "***********************************"
84 print("util/encodings couldn't be loaded. Check that you have a recent version of libidn");
86 print("The full error was:");
88 print "***********************************"
93 local hashes, err = softreq "util.hashes"
95 if err:match("not found") then
96 missingdep("util.hashes", { ["Windows"] = "Make sure you have hashes.dll from the Prosody distribution in util/";
97 ["GNU/Linux"] = "Run './configure' and 'make' in the Prosody source directory to build util/hashes.so";
100 print "***********************************"
101 print("util/hashes couldn't be loaded. Check that you have a recent version of OpenSSL (libcrypto in particular)");
103 print("The full error was:");
105 print "***********************************"
110 if fatal then os.exit(1); end