Correctly check for and use Qt4's qmake

For some reason, qmake is the Qt 5 version on this machine. Compilation failed because it couldn't find the Qt 4 libraries.

Instead of just using qmake, check if either qmake or qmake or qmake-qt4
exists and uses version 4 of Qt. This affects both the dependency check
and the actual compilation of Dwarf Therapist.

This also generally fixes the dependency check. Previously, it actually
tested for Mercurial a second time.