2 -- Copyright (C) 2008 Matthew Wild
3 -- Copyright (C) 2008 Waqas Hussain
5 -- This program is free software; you can redistribute it and/or
6 -- modify it under the terms of the GNU General Public License
7 -- as published by the Free Software Foundation; either version 2
8 -- of the License, or (at your option) any later version.
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23 local function softreq(...) local ok, lib = pcall(require, ...); if ok then return lib; else return nil; end end
25 local function missingdep(name, sources, msg)
27 print("**************************");
28 print("Prosody was unable to find "..tostring(name));
29 print("This package can be obtained in the following ways:");
31 for k,v in pairs(sources) do
35 print(msg or (name.." is required for Prosody to run, so we will now exit."));
36 print("More help can be found on our website, at http://prosody.im/doc/depends");
37 print("**************************");
41 local lxp = softreq "lxp"
44 missingdep("luaexpat", { ["Ubuntu 8.04 (Hardy)"] = "sudo apt-get install liblua5.1-expat0"; ["luarocks"] = "luarocks install luaexpat"; });
48 local socket = softreq "socket"
51 missingdep("luasocket", { ["Ubuntu 8.04 (Hardy)"] = "sudo apt-get install liblua5.1-socket2"; ["luarocks"] = "luarocks install luasocket"; });
55 local ssl = softreq "ssl"
58 if config.get("*", "core", "run_without_ssl") then
59 log("warn", "Running without SSL support because run_without_ssl is defined in the config");
61 missingdep("LuaSec", { ["Source"] = "http://www.inf.puc-rio.br/~brunoos/luasec/" }, "SSL/TLS support will not be available");
65 local encodings = softreq "util.encodings"
67 missingdep("util.encodings", { ["Windows"] = "Make sure you have encodings.dll from the Prosody distribution in util/";
68 ["GNU/Linux"] = "Run './configure' and 'make' in the Prosody source directory to build util/encodings.so";
72 local encodings = softreq "util.hashes"
74 missingdep("util.hashes", { ["Windows"] = "Make sure you have hashes.dll from the Prosody distribution in util/";
75 ["GNU/Linux"] = "Run './configure' and 'make' in the Prosody source directory to build util/hashes.so";
79 if fatal then os.exit(1); end