2007-08-29 13:22:21 +04:00
|
|
|
/*
|
|
|
|
-----BEGIN QCMOD-----
|
|
|
|
name: libmagick
|
|
|
|
arg: with-libmagick-inc=[path], Path to libmagick++ include files
|
|
|
|
arg: with-libmagick-lib=[path], Path to libmagick++ library files
|
|
|
|
-----END QCMOD-----
|
|
|
|
*/
|
2007-08-29 18:04:45 +04:00
|
|
|
#include <QProcess>
|
2007-08-29 13:22:21 +04:00
|
|
|
class qc_libmagick : public ConfObj
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
qc_libmagick(Conf *c) : ConfObj(c) {}
|
|
|
|
QString name() const { return "ImageMagick library (libmagick++)"; }
|
|
|
|
QString shortname() const { return "libmagick++"; }
|
2007-08-29 14:20:39 +04:00
|
|
|
QString checkString() const {
|
|
|
|
if(!conf->getenv("QC_DISABLE_libmagick").isEmpty())
|
|
|
|
return "";
|
|
|
|
return ConfObj::checkString();
|
|
|
|
}
|
2007-08-29 13:22:21 +04:00
|
|
|
bool exec(){
|
2007-08-29 14:20:39 +04:00
|
|
|
if(!conf->getenv("QC_DISABLE_libmagick").isEmpty())
|
|
|
|
return false;
|
|
|
|
QString s;
|
2007-08-29 13:22:21 +04:00
|
|
|
s = conf->getenv("QC_WITH_LIBMAGICK_INC");
|
|
|
|
if(!s.isEmpty()) {
|
|
|
|
if(!conf->checkHeader(s, "Magick++.h")) {
|
|
|
|
return false;
|
2007-08-29 14:20:39 +04:00
|
|
|
}
|
2007-08-29 13:22:21 +04:00
|
|
|
}else{
|
|
|
|
QStringList sl;
|
|
|
|
sl << "/usr/include";
|
|
|
|
sl << "/usr/local/include";
|
|
|
|
bool found = false;
|
|
|
|
foreach(s, sl){
|
|
|
|
if(conf->checkHeader(s, "Magick++.h")){
|
|
|
|
found = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2007-08-29 14:20:39 +04:00
|
|
|
if(!found)
|
2007-08-29 13:22:21 +04:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
conf->addIncludePath(s);
|
|
|
|
|
|
|
|
s = conf->getenv("QC_WITH_LIBMAGICK_LIB");
|
|
|
|
if(!s.isEmpty()) {
|
2008-04-11 20:47:55 +04:00
|
|
|
if(!conf->checkLibrary(s, "Magick++")) {
|
|
|
|
return false;
|
|
|
|
}
|
2007-08-29 13:22:21 +04:00
|
|
|
}else{
|
|
|
|
QStringList sl;
|
|
|
|
sl << "/usr/lib/";
|
2007-10-14 13:09:19 +04:00
|
|
|
sl << "/usr/lib64/";
|
2007-08-29 13:22:21 +04:00
|
|
|
sl << "/usr/local/lib/";
|
2007-10-14 13:09:19 +04:00
|
|
|
sl << "/usr/local/lib64/";
|
2007-08-29 13:22:21 +04:00
|
|
|
bool found = false;
|
|
|
|
foreach(s, sl){
|
2008-04-11 20:47:55 +04:00
|
|
|
if(conf->checkLibrary(s, "Magick++")) {
|
2007-08-29 13:22:21 +04:00
|
|
|
found = true;
|
2008-04-11 20:47:55 +04:00
|
|
|
break;
|
2007-08-29 13:22:21 +04:00
|
|
|
}
|
|
|
|
}
|
2007-08-29 14:20:39 +04:00
|
|
|
if(!found)
|
|
|
|
return false;
|
2007-08-29 13:22:21 +04:00
|
|
|
}
|
2007-08-29 18:04:45 +04:00
|
|
|
conf->addLib(QString("-L") + s);
|
2009-08-02 10:33:43 +04:00
|
|
|
QString out = "";
|
2007-08-29 18:04:45 +04:00
|
|
|
QStringList params;
|
2009-08-02 10:33:43 +04:00
|
|
|
params << "--libs";
|
|
|
|
qconf->doCommand("Magick++-config", params, &out);
|
|
|
|
out = out.replace("\n", "");
|
2007-08-29 18:04:45 +04:00
|
|
|
conf->addLib(result.data());
|
2007-08-29 14:20:39 +04:00
|
|
|
conf->addDefine("HAVE_MAGICK");
|
2007-08-29 13:22:21 +04:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
};
|