#include <qprocess.h>
#include <qstringlist.h>
/*
-----BEGIN QCMOD-----
name: libgcrypt
arg: gcrypt-config=[path],Path to the libgcrypt configure script
-----END QCMOD-----
*/

class qc_libgcrypt : public ConfObj
{
public:
	qc_libgcrypt(Conf *c) : ConfObj(c) {}
	QString name() const { return "libgcrypt"; }
	QString shortname() const { return "libgcrypt"; }

	bool exec()
	{
		QString path = conf->getenv("QC_GCRYPT_CONFIG");
		if(path.isEmpty())
			path = "libgcrypt-config";

		QStringList incs;
		QString ver, libs, other;
		if(!conf->findFooConfig(path, &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;
	}
};
