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.
Finally fix the build on MirBSD.

Disable SSE{2,3,4} in the runtime CPU detection code as well.
Fix detection of unsetenv on MirBSD, unbreak build.

I have no idea why the extended regexp does not catch the unsetenv declaration
but the check is redundant anyway (there is another unsetenv check below in
configure) so I don't care that much.
Fix MirBSD build.
+ gnumeric112-1.12.9, poppler-0.24.4, raptor2-2.0.11, x264-devel-20131130.