2007-08-29 17:22:21 +08: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 22:04:45 +08:00
|
|
|
#include <QProcess>
|
2007-08-29 17:22:21 +08: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 18:20:39 +08:00
|
|
|
QString checkString() const {
|
|
|
|
if(!conf->getenv("QC_DISABLE_libmagick").isEmpty())
|
|
|
|
return "";
|
|
|
|
return ConfObj::checkString();
|
|
|
|
}
|
2007-08-29 17:22:21 +08:00
|
|
|
bool exec(){
|
2007-08-29 18:20:39 +08:00
|
|
|
if(!conf->getenv("QC_DISABLE_libmagick").isEmpty())
|
|
|
|
return false;
|
|
|
|
QString s;
|
2007-08-29 17:22:21 +08:00
|
|
|
s = conf->getenv("QC_WITH_LIBMAGICK_INC");
|
|
|
|
if(!s.isEmpty()) {
|
|
|
|
if(!conf->checkHeader(s, "Magick++.h")) {
|
|
|
|
return false;
|
2007-08-29 18:20:39 +08:00
|
|
|
}
|
2007-08-29 17:22:21 +08: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 18:20:39 +08:00
|
|
|
if(!found)
|
2007-08-29 17:22:21 +08:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
conf->addIncludePath(s);
|
|
|
|
|
|
|
|
s = conf->getenv("QC_WITH_LIBMAGICK_LIB");
|
|
|
|
if(!s.isEmpty()) {
|
2008-04-12 00:47:55 +08:00
|
|
|
if(!conf->checkLibrary(s, "Magick++")) {
|
|
|
|
return false;
|
|
|
|
}
|
2007-08-29 17:22:21 +08:00
|
|
|
}else{
|
|
|
|
QStringList sl;
|
|
|
|
sl << "/usr/lib/";
|
2007-10-14 17:09:19 +08:00
|
|
|
sl << "/usr/lib64/";
|
2007-08-29 17:22:21 +08:00
|
|
|
sl << "/usr/local/lib/";
|
2007-10-14 17:09:19 +08:00
|
|
|
sl << "/usr/local/lib64/";
|
2007-08-29 17:22:21 +08:00
|
|
|
bool found = false;
|
|
|
|
foreach(s, sl){
|
2008-04-12 00:47:55 +08:00
|
|
|
if(conf->checkLibrary(s, "Magick++")) {
|
2007-08-29 17:22:21 +08:00
|
|
|
found = true;
|
2008-04-12 00:47:55 +08:00
|
|
|
break;
|
2007-08-29 17:22:21 +08:00
|
|
|
}
|
|
|
|
}
|
2007-08-29 18:20:39 +08:00
|
|
|
if(!found)
|
|
|
|
return false;
|
2007-08-29 17:22:21 +08:00
|
|
|
}
|
2007-08-29 22:04:45 +08:00
|
|
|
conf->addLib(QString("-L") + s);
|
2009-08-02 14:33:43 +08:00
|
|
|
QString out = "";
|
2007-08-29 22:04:45 +08:00
|
|
|
QStringList params;
|
2009-08-02 14:33:43 +08:00
|
|
|
params << "--libs";
|
|
|
|
qconf->doCommand("Magick++-config", params, &out);
|
|
|
|
out = out.replace("\n", "");
|
2007-08-29 22:04:45 +08:00
|
|
|
conf->addLib(result.data());
|
2007-08-29 18:20:39 +08:00
|
|
|
conf->addDefine("HAVE_MAGICK");
|
2007-08-29 17:22:21 +08:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
};
|