source: qca-tls/trunk/openssl.qcm@ 34

Last change on this file since 34 was 31, checked in by dmik, 19 years ago

QCA-TLS: Imported original QCA TLS 1.0 sources from Affinix

File size: 1.7 KB
Line 
1/*
2-----BEGIN QCMOD-----
3name: OpenSSL
4arg: with-openssl-inc=[path],Path to OpenSSL include files
5arg: with-openssl-lib=[path],Path to OpenSSL library files
6-----END QCMOD-----
7*/
8class qc_openssl : public ConfObj
9{
10public:
11 qc_openssl(Conf *c) : ConfObj(c) {}
12 QString name() const { return "OpenSSL"; }
13 QString shortname() const { return "openssl"; }
14 bool exec()
15 {
16 QString inc, lib;
17 QString s;
18 bool kb = false;
19 QString kbdir = "/usr/kerberos/include";
20
21 // Redhat 9?
22 if(QFileInfo(kbdir).exists())
23 kb = true;
24
25 s = conf->getenv("QC_WITH_OPENSSL_INC");
26 if(!s.isEmpty()) {
27 if(!conf->checkHeader(s, "openssl/ssl.h"))
28 return false;
29 inc = s;
30 }
31 else {
32 if(!conf->findHeader("openssl/ssl.h", QStringList(), &s))
33 return false;
34 inc = s;
35 }
36
37 s = conf->getenv("QC_WITH_OPENSSL_LIB");
38 if(!s.isEmpty()) {
39 if(!conf->checkLibrary(s, "ssl"))
40 return false;
41 lib = s;
42 }
43 else {
44 if(!conf->findLibrary("ssl", &s))
45 return false;
46 lib = s;
47 }
48
49 // is it at least openssl 0.9.7?
50 QString str =
51 "#include<openssl/opensslv.h>\n"
52 "int main()\n"
53 "{\n"
54 " unsigned long x = OPENSSL_VERSION_NUMBER;\n"
55 " if(x >= 0x00907000) return 0; else return 1;\n"
56 "}\n";
57 QString ext;
58 if(!inc.isEmpty())
59 ext += QString("-I") + inc + ' ';
60 if(kb)
61 ext += QString("-I") + kbdir + ' ';
62 if(!lib.isEmpty())
63 ext += QString("-L") + lib + " -lssl -lcrypto ";
64 int ret;
65 if(!conf->doCompileAndLink(str, ext, &ret))
66 return false;
67 if(ret == 0)
68 conf->addDefine("OSSL_097");
69
70 if(!inc.isEmpty())
71 conf->addIncludePath(inc);
72 if(kb)
73 conf->addIncludePath(kbdir);
74 if(!lib.isEmpty())
75 conf->addLib(QString("-L") + s);
76 conf->addLib("-lssl -lcrypto");
77
78 return true;
79 }
80};
Note: See TracBrowser for help on using the repository browser.