Portability fixes

 Portability fixes, with these changes I am able to build liblightgrep on FreeBSD.