configure.ac: Correctly detect newer json-c too

Newer json-c had the pkg-config module renamed from json to json-c, and
while a compatiliby shim is available, we should not rely on that, but
detect json-c AND json as well.

To do that, we try the newer json-c first, and fall back to json if it
is not found.

Reported-by: Fabien Wernli <cpan@faxm0dem.org>
Signed-off-by: Gergely Nagy <algernon@balabit.hu>