build: simplify test handling and speed up build.

Instead of using a ./configure parameter to decide whehter to build
tests or not, use the check_PROGRAMS variable so that the tests are
only built when running `make check`.

To avoid slowing down the test phase itself, collapse the declaration
of the test targets in the tests/Makefile.am file, this way they can
be built and linked in parallel before the testsuite is executed.

Signed-off-by: Diego Elio Pettenò <flameeyes@flameeyes.eu>
diff --git a/.gitignore b/.gitignore
index 82e43e3..3c8afd9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,7 @@
 Makefile
 Makefile.in
 .deps
+.dirstamp
 .libs
 *.o
 *.lo