Make the 'check' dependency optional

Since we only need Check for the test suite, make it an optional
dependency, and disable the tests if it is not found.

Signed-off-by: Gergely Nagy <algernon@balabit.hu>
configure.ac: Fix the json-c enable/disable logic

Signed-off-by: Gergely Nagy <algernon@balabit.hu>