2006-09-30 20:02:39 +04:00
|
|
|
/*
|
|
|
|
-----BEGIN QCMOD-----
|
|
|
|
name: libtorrent
|
2007-03-12 15:21:02 +03:00
|
|
|
arg: with-libtorrent-inc=[path], Path to libtorrent include files
|
2007-03-12 15:34:57 +03:00
|
|
|
arg: with-libtorrent-lib=[path], Path to libtorrent library files
|
2007-06-15 15:29:00 +04:00
|
|
|
arg: with-libtorrent-static-lib=[path], Path to libtorrent .a file
|
2006-09-30 20:02:39 +04:00
|
|
|
-----END QCMOD-----
|
|
|
|
*/
|
|
|
|
class qc_libtorrent : public ConfObj
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
qc_libtorrent(Conf *c) : ConfObj(c) {}
|
2007-04-12 21:17:04 +04:00
|
|
|
QString name() const { return "libtorrent >= 0.13"; }
|
2006-09-30 20:02:39 +04:00
|
|
|
QString shortname() const { return "libtorrent"; }
|
|
|
|
bool exec(){
|
2007-04-04 01:49:52 +04:00
|
|
|
QString s;
|
|
|
|
s = conf->getenv("QC_WITH_LIBTORRENT_INC");
|
|
|
|
if(!s.isEmpty()) {
|
2007-04-12 21:17:04 +04:00
|
|
|
if(!conf->checkHeader(s, "libtorrent/lsd.hpp")) {
|
2007-04-04 01:49:52 +04:00
|
|
|
return false;
|
2007-03-12 15:21:02 +03:00
|
|
|
}
|
2007-04-04 01:49:52 +04:00
|
|
|
}else{
|
|
|
|
QStringList sl;
|
|
|
|
sl << "/usr/include";
|
|
|
|
sl << "/usr/local/include";
|
|
|
|
bool found = false;
|
|
|
|
foreach(s, sl){
|
2007-04-12 21:17:04 +04:00
|
|
|
if(conf->checkHeader(s, "libtorrent/lsd.hpp")){
|
2007-04-04 01:49:52 +04:00
|
|
|
found = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(!found) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
conf->addIncludePath(s);
|
|
|
|
conf->addIncludePath(s+QDir::separator()+"libtorrent");
|
2007-03-12 15:34:57 +03:00
|
|
|
|
2007-06-15 15:29:00 +04:00
|
|
|
s = conf->getenv("QC_WITH_LIBTORRENT_STATIC_LIB");
|
|
|
|
if(!s.isEmpty() && QFile::exists(s) && s.endsWith(".a")){
|
|
|
|
conf->addLib(s);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2007-04-04 01:49:52 +04:00
|
|
|
s = conf->getenv("QC_WITH_LIBTORRENT_LIB");
|
|
|
|
if(!s.isEmpty()) {
|
2007-03-12 15:34:57 +03:00
|
|
|
if(!conf->checkLibrary(s, "torrent")) {
|
|
|
|
return false;
|
2007-04-04 01:49:52 +04:00
|
|
|
}
|
2007-03-12 15:34:57 +03:00
|
|
|
conf->addLib(QString("-L") + s);
|
2007-04-04 01:49:52 +04:00
|
|
|
}else{
|
|
|
|
QStringList sl;
|
|
|
|
sl << "/usr/lib/";
|
2007-10-14 13:09:19 +04:00
|
|
|
sl << "/usr/lib64/";
|
2007-04-04 01:49:52 +04:00
|
|
|
sl << "/usr/local/lib/";
|
2007-10-14 13:09:19 +04:00
|
|
|
sl << "/usr/local/lib64/";
|
2007-04-04 01:49:52 +04:00
|
|
|
bool found = false;
|
|
|
|
foreach(s, sl){
|
|
|
|
if(conf->checkLibrary(s, "torrent")){
|
|
|
|
found = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(!found) return false;
|
|
|
|
conf->addLib(QString("-L") + s);
|
|
|
|
}
|
|
|
|
return true;
|
2006-09-30 20:02:39 +04:00
|
|
|
}
|
|
|
|
};
|