Made all libraries SHARED. This fits the Debian build practices,
and also helps with some circular dependencies that remain to be
cleaned up.
In this patch we also identified a set of .c file that have a main
function, and therefore must be taken out of the libraries and put
into executables.