Log Message: Fix build on MirBSD. Remove all "#define _XOPEN_SOURCE" lines, as they break things horribly on MirBSD for some reason. Sprinkle a few <sys/types.h> includes. Add support for generating shared libraries on MirBSD.