tests: Updated gtester scripts to improve testing system

We imported Makefile.decl from glib when it was using Subversion, a long time
ago. The script had a few issues (like running all unit tests twice on make
distcheck) and needed to be updated.

I've stolen a latest version from GLib's glib.mk and also their m4 macros
which are required to make this all work too.

This gives us the advantage of defining installable and uninstallable test
cases as well as test data, scripts and other useful stuff.

The debug output also looks quite good.
And distcheck passes :)