Fix smp building and remove references to includes that don't exist.

This is a partial commit of the patches I maintain for the official Fedora Linux package.

The others for unbundling libraries and setting a library soname could use more tweaking to make them acceptable upstream.