Make LibEvent compatible with Android NDK

In order to do this, I used and slightly edited patches created by
@ventureresearch.
Merge branch 'release-2.0.21-stable' of https://github.com/alessandro40/libevent into release-2.0.21-stable