Fix compile warnings as seen on g++ 4.4.7
Fix module loading in PURE_STATIC builds
Deduplicate code in modmanager_static and modmanager_dynamic
Automatically register ServiceProviders created by modules