Compile fixes for non-gnu systems like FreeBSD or Mac OS X