3
name: OpenSSL (bundled QCA only)
4
arg: with-openssl-inc=[path],Path to OpenSSL include files (bundled QCA only)
5
arg: with-openssl-lib=[path],Path to OpenSSL library files (bundled QCA only)
8
class qc_openssl : public ConfObj
11
qc_openssl(Conf *c) : ConfObj(c) {}
12
QString name() const { return "OpenSSL"; }
13
QString shortname() const { return "openssl"; }
15
QString checkString() const {
16
if (!QFile::exists("third-party/qca/qca") || !conf->getenv("QC_DISABLE_bundled_qca").isEmpty())
19
return ConfObj::checkString();
24
if (!QFile::exists("third-party/qca/qca") || !conf->getenv("QC_DISABLE_bundled_qca").isEmpty() || !QFile::exists("third-party/qca/qca-ossl"))
28
QString ossl_inc = conf->getenv("QC_WITH_OPENSSL_INC");
29
if(ossl_inc.isEmpty())
32
QString ossl_lib = conf->getenv("QC_WITH_OPENSSL_LIB");
33
if(ossl_lib.isEmpty())
37
libnames += "-llibeay32 -lssleay32";
38
libnames += "-leay32 -lssl32";
39
libnames += "-leay32 " + ossl_lib + "/ssleay32.a";
42
QString libname_success;
43
foreach(const QString &libname, libnames)
46
"#include<openssl/opensslv.h>\n"
49
" unsigned long x = OPENSSL_VERSION_NUMBER;\n"
50
" if(x >= 0x00907000) return 0; else return 1;\n"
55
ext += QString("-L") + ossl_lib + " " + libname;
57
if(conf->doCompileAndLink(str, incs, ext, QString(), &ret))
60
libname_success = libname;
62
conf->addDefine("OSSL_097");
70
conf->addIncludePath(ossl_inc);
71
conf->addLib(QString("-L") + ossl_lib);
72
conf->addLib(libname_success);
74
conf->addDefine("HAVE_OPENSSL");
81
QString kbdir = "/usr/kerberos/include";
84
if(QFileInfo(kbdir).exists())
87
s = conf->getenv("QC_WITH_OPENSSL_INC");
89
if(!conf->checkHeader(s, "openssl/ssl.h"))
94
if(!conf->findHeader("openssl/ssl.h", QStringList(), &s))
99
s = conf->getenv("QC_WITH_OPENSSL_LIB");
101
if(!conf->checkLibrary(s, "ssl"))
106
if(!conf->findLibrary("ssl", &s))
111
// is it at least openssl 0.9.7?
113
"#include<openssl/opensslv.h>\n"
116
" unsigned long x = OPENSSL_VERSION_NUMBER;\n"
117
" if(x >= 0x00907000) return 0; else return 1;\n"
126
ext += QString("-L") + lib + " -lssl -lcrypto ";
128
if(!conf->doCompileAndLink(str, incs, ext, QString(), &ret))
131
conf->addDefine("OSSL_097");
134
conf->addIncludePath(inc);
136
conf->addIncludePath(kbdir);
138
conf->addLib(QString("-L") + s);
139
conf->addLib("-lssl -lcrypto");
141
conf->addDefine("HAVE_OPENSSL");