-
-
Notifications
You must be signed in to change notification settings - Fork 123
/
zlib.qcm
93 lines (82 loc) · 2.15 KB
/
zlib.qcm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
/*
-----BEGIN QCMOD-----
name: zlib
arg: with-zlib-inc=[path],Path to zlib include files
arg: with-zlib-lib=[path],Path to zlib library files
-----END QCMOD-----
*/
//----------------------------------------------------------------------------
// qc_zlib
//----------------------------------------------------------------------------
class qc_zlib : public ConfObj
{
public:
qc_zlib(Conf *c) : ConfObj(c) {}
QString name() const { return "zlib"; }
QString shortname() const { return "zlib"; }
#ifdef Q_OS_WIN
QString resultString() const
{
return "using bundled";
}
#endif
bool exec()
{
#ifdef Q_OS_WIN
// HACK: on windows, always use psi's bundled zlib
conf->addExtra("CONFIG += psi-winzlib psi-minizip");
return true;
#else
QStringList incs;
QString version, libs, other;
QString s;
if(!conf->findPkgConfig("zlib", VersionAny, "", &version, &incs, &libs, &other)) {
s = conf->getenv("QC_WITH_ZLIB_INC");
if(!s.isEmpty()) {
if(!conf->checkHeader(s, "zlib.h"))
return false;
}
else {
if(!conf->findHeader("zlib.h", QStringList(), &s))
return false;
}
incs.append(s);
s = conf->getenv("QC_WITH_ZLIB_LIB");
if(!s.isEmpty()) {
if(!conf->checkLibrary(s, "z"))
return false;
}
else {
if(!conf->findLibrary("z", &s))
return false;
}
libs = QString("-L%1 -lz").arg(s);
}
foreach(const QString &inc, incs) {
conf->addIncludePath(inc);
}
conf->addLib(libs);
if(!conf->findPkgConfig("minizip", VersionAny, "", &version, &incs, &libs, &other)) {
s = conf->getenv("QC_WITH_MINIZIP_INC");
if ((!s.isEmpty() && conf->checkHeader(s, "unzip.h")) ||
(s.isEmpty() && conf->findHeader("unzip.h", QStringList(), &s))) {
incs.append(s);
}
s = conf->getenv("QC_WITH_MINIZIP_LIB");
if((!s.isEmpty() && conf->checkLibrary(s, "minizip")) ||
(s.isEmpty() && conf->findLibrary("minizip", &s))) {
libs = QString("-L%1 -lminizip").arg(s);
}
}
if (!incs.isEmpty() && !libs.isEmpty()) {
foreach(const QString &inc, incs) {
conf->addIncludePath(inc);
}
conf->addLib(libs);
} else {
conf->addExtra("CONFIG += psi-minizip");
}
return true;
#endif
}
};