[2.2] add possibility for bundles extensions to pre process the app configs

Bug fix: #4652
Feature addition: yes
Backwards compatibility break: no
Symfony2 tests pass: yes
License of the code: MIT

As can be seen in the patch the extensions that should preprocess need to be enabled manually and the order is maintained from the users settings:
```
diff --git a/app/AppKernel.php b/app/AppKernel.php
index af5d9aa..d394b25 100644
--- a/app/AppKernel.php
+++ b/app/AppKernel.php
@@ -43,4 +43,11 @@ class AppKernel extends Kernel
     {
         $loader->load(__DIR__.'/config/config_'.$this->getEnvironment().'.yml');
     }
+
+    protected function getPreProcessExtensions()
+    {
+        return array(
+            'symfony_cmf_core'
+        );
+    }
 }
```

Just as an example, here an extension, which checks if SonataAdminBundle is available and if not disables integration with it in several Bundles. It also sets some default settings for ``document_class`` and ``default_document_manager_name``:
```
diff --git a/DependencyInjection/SymfonyCmfCoreExtension.php b/DependencyInjection/SymfonyCmfCoreExtension.php
index 9f92410..c0a8dbb 100644
--- a/DependencyInjection/SymfonyCmfCoreExtension.php
+++ b/DependencyInjection/SymfonyCmfCoreExtension.php
@@ -3,11 +3,12 @@
 namespace Symfony\Cmf\Bundle\CoreBundle\DependencyInjection;
 
 use Symfony\Component\HttpKernel\DependencyInjection\Extension;
+use Symfony\Component\HttpKernel\DependencyInjection\PreProcessExtensionInterface;
 use Symfony\Component\DependencyInjection\ContainerBuilder;
 use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
 use Symfony\Component\Config\FileLocator;
 
-class SymfonyCmfCoreExtension extends Extension
+class SymfonyCmfCoreExtension extends Extension implements PreProcessExtensionInterface
 {
     public function load(array $configs, ContainerBuilder $container)
     {
@@ -15,4 +16,45 @@ class SymfonyCmfCoreExtension extends Extension
         $loader->load('config.xml');
         $loader->load('services.xml');
     }
+
+    public function preProcess(ContainerBuilder $container)
+    {
+        $bundles = $container->getParameter('kernel.bundles');
+        if (!isset($bundles['SonataDoctrinePHPCRAdminBundle'])) {
+            foreach ($container->getExtensions() as $name => $extension) {
+                switch ($name) {
+                    case 'symfony_cmf_menu':
+                    case 'symfony_cmf_routing_extra':
+                    case 'symfony_cmf_simple_cms':
+                        $config = $container->getExtensionConfig($name);
+                        array_unshift($config, array('use_sonata_admin' => false));
+                        $container->setExtensionConfig($name, $config);
+                        break;
+                }
+            }
+        }
+
+        $configs = $container->getExtensionConfig('symfony_cmf_core');
+        $config = $this->processConfiguration(new Configuration(), $configs);
+        $standard_config = array();
+        if (isset($config['document_class'])) {
+            $standard_config['document_class'] = $config['document_class'];
+        }
+        if (isset($config['default_document_manager_name'])) {
+            $standard_config['default_document_manager_name'] = $config['default_document_manager_name'];
+        }
+        if (!empty($standard_config)) {
+            foreach ($container->getExtensions() as $name => $extension) {
+                switch ($name) {
+                    case 'symfony_cmf_content':
+                    case 'symfony_cmf_simple_cms':
+                        $config = $container->getExtensionConfig($name);
+
+                        array_unshift($config, $standard_config);
+                        $container->setExtensionConfig($name, $config);
+                        break;
+                }
+            }
+        }
+    }
 }
```