Add version check to C code

This should cause pygit2 to fail a bit more gracefully when the wrong version of libgit2 is installed. I missed this when I was installing, and it should also be a good way to address #363.

I put the check in types.h because it seemed like the most central place to put this.