Comparison

util/dependencies.lua @ 839:c45b5072f773

Better handling of found, but unloadable, core libraries (eg. undefined symbols)
author Matthew Wild <mwild1@gmail.com>
date Thu, 26 Feb 2009 02:42:47 +0000
parent 760:90ce865eebd8
child 896:2c0b9e3c11c3
comparison
equal deleted inserted replaced
838:1035846d6273 839:c45b5072f773
7 -- 7 --
8 8
9 9
10 local fatal; 10 local fatal;
11 11
12 local function softreq(...) local ok, lib = pcall(require, ...); if ok then return lib; else return nil; end end 12 local function softreq(...) local ok, lib = pcall(require, ...); if ok then return lib; else return nil, lib; end end
13 13
14 local function missingdep(name, sources, msg) 14 local function missingdep(name, sources, msg)
15 print(""); 15 print("");
16 print("**************************"); 16 print("**************************");
17 print("Prosody was unable to find "..tostring(name)); 17 print("Prosody was unable to find "..tostring(name));
49 else 49 else
50 missingdep("LuaSec", { ["Source"] = "http://www.inf.puc-rio.br/~brunoos/luasec/" }, "SSL/TLS support will not be available"); 50 missingdep("LuaSec", { ["Source"] = "http://www.inf.puc-rio.br/~brunoos/luasec/" }, "SSL/TLS support will not be available");
51 end 51 end
52 end 52 end
53 53
54 local encodings = softreq "util.encodings" 54 local encodings, err = softreq "util.encodings"
55 if not encodings then 55 if not encodings then
56 missingdep("util.encodings", { ["Windows"] = "Make sure you have encodings.dll from the Prosody distribution in util/"; 56 if err:match("not found") then
57 missingdep("util.encodings", { ["Windows"] = "Make sure you have encodings.dll from the Prosody distribution in util/";
57 ["GNU/Linux"] = "Run './configure' and 'make' in the Prosody source directory to build util/encodings.so"; 58 ["GNU/Linux"] = "Run './configure' and 'make' in the Prosody source directory to build util/encodings.so";
58 }); 59 });
60 else
61 print "***********************************"
62 print("util/encodings couldn't be loaded. Check that you have a recent version of libidn");
63 print ""
64 print("The full error was:");
65 print(err)
66 print "***********************************"
67 end
59 fatal = true; 68 fatal = true;
60 end 69 end
61 70
62 local encodings = softreq "util.hashes" 71 local hashes, err = softreq "util.hashes"
63 if not encodings then 72 if not hashes then
64 missingdep("util.hashes", { ["Windows"] = "Make sure you have hashes.dll from the Prosody distribution in util/"; 73 if err:match("not found") then
74 missingdep("util.hashes", { ["Windows"] = "Make sure you have hashes.dll from the Prosody distribution in util/";
65 ["GNU/Linux"] = "Run './configure' and 'make' in the Prosody source directory to build util/hashes.so"; 75 ["GNU/Linux"] = "Run './configure' and 'make' in the Prosody source directory to build util/hashes.so";
66 }); 76 });
77 else
78 print "***********************************"
79 print("util/hashes couldn't be loaded. Check that you have a recent version of OpenSSL (libcrypto in particular)");
80 print ""
81 print("The full error was:");
82 print(err)
83 print "***********************************"
84 end
67 fatal = true; 85 fatal = true;
68 end 86 end
69 87
70 if fatal then os.exit(1); end 88 if fatal then os.exit(1); end