mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-11-27 11:49:01 +03:00
62 lines
1.7 KiB
Text
62 lines
1.7 KiB
Text
/*
|
|
-----BEGIN QCMOD-----
|
|
name: libupnp
|
|
arg: disable-upnp, disable UPnP support
|
|
arg: with-libupnp-inc=[path], Path to libupnp include files
|
|
arg: with-libupnp-lib=[path], Path to libupnp library files
|
|
-----END QCMOD-----
|
|
*/
|
|
class qc_libupnp : public ConfObj
|
|
{
|
|
public:
|
|
qc_libupnp(Conf *c) : ConfObj(c) {}
|
|
QString name() const { return "libupnp"; }
|
|
QString shortname() const { return "libupnp"; }
|
|
bool exec(){
|
|
QString s;
|
|
s = conf->getenv("QC_DISABLE_UPNP");
|
|
if(!s.isEmpty()){
|
|
conf->addDefine("NO_UPNP");
|
|
return false;
|
|
}
|
|
s = conf->getenv("QC_WITH_LIBUPNP_INC");
|
|
if(!s.isEmpty()) {
|
|
if(!conf->checkHeader(s, "upnp/upnp.h")) {
|
|
//qWarning("libupnp includes not found!");
|
|
conf->addDefine("NO_UPNP");
|
|
return false;
|
|
}
|
|
conf->addIncludePath(s);
|
|
}else{
|
|
QStringList sl;
|
|
sl += "/usr/include";
|
|
sl += "/usr/local/include";
|
|
if(!conf->findHeader("upnp/upnp.h", sl, &s)) {
|
|
//qWarning("libupnp includes not found!");
|
|
conf->addDefine("NO_UPNP");
|
|
return false;
|
|
}
|
|
conf->addIncludePath(s);
|
|
}
|
|
|
|
s = conf->getenv("QC_WITH_LIBUPNP_LIB");
|
|
if(!s.isEmpty()) {
|
|
if(!conf->checkLibrary(s, "upnp")) {
|
|
qWarning("libupnp library not found!");
|
|
return false;
|
|
}
|
|
conf->addLib(QString("-L") + s);
|
|
}else{
|
|
if(!conf->findLibrary("upnp", &s)) {
|
|
qWarning("libupnp library not found!");
|
|
return false;
|
|
}
|
|
if (!s.isEmpty())
|
|
conf->addLib(QString("-L") + s);
|
|
}
|
|
|
|
conf->addLib("-lupnp");
|
|
|
|
return true;
|
|
}
|
|
};
|