build: Use pkg-config for libev

Fedora requires an additional -I flag to find libev.h.
build: Do proper check for Bison

This checks for bison which is only required when bootstrapping. It's
not required if configuring from the distribution tar.gz. I.e. if the
generated file is present already.
build: Do proper check for Flex

Similar to Bison in previous commit. Only require Flex if the generated
file isn't present.
planet: Fix possible deadlock

Unlock rwlock when failing, otherwise we might have a deadlock on our
hands.
Merge pull request #3 from gonzzor/deadlock

planet: Fix possible deadlock
Merge pull request #2 from gonzzor/build_fixes

Build fixes