Restore dependency for Check and fixed some errors in Automake files

The dependency for Check must be set, otherwise the tests won't compile.