#include <qprocess.h>
#include <qstringlist.h>
/*
-----BEGIN QCMOD-----
name: mozilla_nss
-----END QCMOD-----
*/

class qc_mozilla_nss : public ConfObj
{
public:
    qc_mozilla_nss(Conf *c) : ConfObj(c) {}
    QString name() const { return "mozilla-nss"; }
    QString shortname() const { return "nss"; }
    
    bool exec()
	{
	    QStringList incs;
	    QString ver, libs, other;

	    if (!conf->findPkgConfig(QString("mozilla-nss"),
				     VersionAny, 0, &ver,
				     &incs, &libs, &other)) {
		// try just nss - FC5 does this.
		if (!conf->findPkgConfig(QString("nss"),
					 VersionAny, 0, &ver,
					 &incs, &libs, &other)) {
		    return false;
		}
	    }	  
	    for(int n = 0; n < incs.count(); ++n) {
		conf->addIncludePath(incs[n]);
	    }
	    if (!libs.isEmpty()) {
		conf->addLib(libs);
	    }
	    if(!other.isEmpty()) {
		conf->addExtra(QString("QMAKE_CFLAGS += %1\n").arg(other));
	    }
	    return true;
	}
};
