diff --git a/common/stdstreams.cc b/common/stdstreams.cc
index eb0638f39e22977219717eb9c613b7b87255e668..f1f050abb712a902a5e3770f35cacef307880286 100644
--- a/common/stdstreams.cc
+++ b/common/stdstreams.cc
@@ -2,7 +2,10 @@
 // vi: set et ts=4 sw=2 sts=2:
 // $Id$
 
-#include <config.h>
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include "stdstreams.hh"
 
 namespace Dune {
diff --git a/common/test/arraylisttest.cc b/common/test/arraylisttest.cc
index b04057eb6f5be1a98c942634013d11bb152d1c51..9010605dfbc28221886dc8469057fefa5c0a41ef 100644
--- a/common/test/arraylisttest.cc
+++ b/common/test/arraylisttest.cc
@@ -1,7 +1,9 @@
 // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
 // vi: set et ts=4 sw=2 sts=2:
 // $Id$
+#ifdef HAVE_CONFIG_H
 #include "config.h"
+#endif
 
 #include <dune/common/arraylist.hh>
 #include <dune/common/test/iteratortest.hh>
diff --git a/common/test/bigunsignedinttest.cc b/common/test/bigunsignedinttest.cc
index 3cf85e3e19d25c5635abc5bbeb478f1758538427..607da28c968b3fe16c5b03ea4ed66a876fa61c39 100644
--- a/common/test/bigunsignedinttest.cc
+++ b/common/test/bigunsignedinttest.cc
@@ -1,6 +1,8 @@
 // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
 // vi: set et ts=4 sw=2 sts=2:
+#ifdef HAVE_CONFIG_H
 #include "config.h"
+#endif
 
 #include <dune/common/bigunsignedint.hh>
 #include <limits>
diff --git a/common/test/bitsetvectortest.cc b/common/test/bitsetvectortest.cc
index 5c4cf045dc42bd2df2c11aae044fdc54d6c2ca29..da317254d80c9b3741775e97296ab4f9a25ba507 100644
--- a/common/test/bitsetvectortest.cc
+++ b/common/test/bitsetvectortest.cc
@@ -1,6 +1,8 @@
 // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
 // vi: set et ts=4 sw=2 sts=2:
-#include <config.h>
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
 
 #include <dune/common/bitsetvector.hh>
 #ifdef __GNUC__
diff --git a/common/test/deprtuplestest.cc b/common/test/deprtuplestest.cc
index 48ad939a415ee49458a2de1a62fd4cd984ed8c4a..a53e825fb38db595bfa9e02e40fc5d5074b88557 100644
--- a/common/test/deprtuplestest.cc
+++ b/common/test/deprtuplestest.cc
@@ -1,7 +1,9 @@
 // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
 // vi: set et ts=4 sw=2 sts=2:
 // $Id$
+#ifdef HAVE_CONFIG_H
 #include "config.h"
+#endif
 
 #include <dune/common/tuples.hh>
 #include <dune/common/helpertemplates.hh>
diff --git a/common/test/exprtmpl.cc b/common/test/exprtmpl.cc
index 57a80adf53334ecd2093d6700f13d47498c76d0b..d7817fe78c8dcdbd9e3492bad7b4aa46abc9c70e 100644
--- a/common/test/exprtmpl.cc
+++ b/common/test/exprtmpl.cc
@@ -11,7 +11,9 @@
    - FlatColIterator<Matrix> does not work if Matrix is mutable
  */
 
+#ifdef HAVE_CONFIG_H
 #include "config.h"
+#endif
 
 #include <iostream>
 #include <fstream>
diff --git a/common/test/fmatrixtest.cc b/common/test/fmatrixtest.cc
index c57483c75eada7024866cea0fafb1a8ddfa9d108..e476bd005284db1d3ffb285ce034e6601843a128 100644
--- a/common/test/fmatrixtest.cc
+++ b/common/test/fmatrixtest.cc
@@ -1,6 +1,8 @@
 // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
 // vi: set et ts=4 sw=2 sts=2:
+#ifdef HAVE_CONFIG_H
 #include "config.h"
+#endif
 #define DUNE_ISTL_WITH_CHECKING
 #include "../fmatrix.hh"
 #include <iostream>
diff --git a/common/test/fvectortest.cc b/common/test/fvectortest.cc
index 715a5d93e507be296d679c46f68930fe79c25184..6a679ed2e5181bf3eaa6dbae3b30a0dc0cec6d24 100644
--- a/common/test/fvectortest.cc
+++ b/common/test/fvectortest.cc
@@ -1,6 +1,8 @@
 // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
 // vi: set et ts=4 sw=2 sts=2:
-#include <config.h>
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
 #include <dune/common/fvector.hh>
 #include <dune/common/exceptions.hh>
 #include <iostream>
diff --git a/common/test/gcdlcmtest.cc b/common/test/gcdlcmtest.cc
index 2462d04ae4bfdfc14d11e7295ee9720bafe1dbe6..f1f85407ef6bd9b8c6218bd6bd2ce6d2661be0c4 100644
--- a/common/test/gcdlcmtest.cc
+++ b/common/test/gcdlcmtest.cc
@@ -1,6 +1,8 @@
 // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
 // vi: set et ts=4 sw=2 sts=2:
+#ifdef HAVE_CONFIG_H
 #include "config.h"
+#endif
 
 #include <iostream>
 
diff --git a/common/test/iteratorfacadetest.cc b/common/test/iteratorfacadetest.cc
index 1995d11beab4c7dbfbdefbc7eb111a50cdc331b7..2d6e34cf3082c2e72ae905c06a4bdc2d6e5bb41f 100644
--- a/common/test/iteratorfacadetest.cc
+++ b/common/test/iteratorfacadetest.cc
@@ -1,6 +1,8 @@
 // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
 // vi: set et ts=4 sw=2 sts=2:
+#ifdef HAVE_CONFIG_H
 #include "config.h"
+#endif
 
 #include <dune/common/test/iteratorfacadetest.hh>
 #include <dune/common/test/iteratortest.hh>
diff --git a/common/test/mpicollectivecommunication.cc b/common/test/mpicollectivecommunication.cc
index af7f088b91251313d78ad007787d0f52a2d41e32..6d5b1f389faf1967e6f3a1e312c58dcb09e9e654 100644
--- a/common/test/mpicollectivecommunication.cc
+++ b/common/test/mpicollectivecommunication.cc
@@ -1,6 +1,8 @@
 // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
 // vi: set et ts=4 sw=2 sts=2:
+#ifdef HAVE_CONFIG_H
 #include "config.h"
+#endif
 
 #include <dune/common/mpihelper.hh>
 
diff --git a/common/test/mpihelpertest.cc b/common/test/mpihelpertest.cc
index 4a4a448e398a987cd3e9688b1a4d6804522a60a9..a7210da77287c66ece6db3d20ac448615f0d0ea3 100644
--- a/common/test/mpihelpertest.cc
+++ b/common/test/mpihelpertest.cc
@@ -1,6 +1,8 @@
 // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
 // vi: set et ts=4 sw=2 sts=2:
+#ifdef HAVE_CONFIG_H
 #include "config.h"
+#endif
 
 #include <dune/common/mpihelper.hh>
 #include <iostream>
diff --git a/common/test/nullptr-test.cc b/common/test/nullptr-test.cc
index 92f4bf99bbe7f9a2d9d0a327d4c9396e29fe9409..26e539d5adb7246dfee6ac1ae8760ccb3f9b48c0 100644
--- a/common/test/nullptr-test.cc
+++ b/common/test/nullptr-test.cc
@@ -1,6 +1,8 @@
 // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
 // vi: set et ts=4 sw=2 sts=2:
-#include <config.h>
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
 
 #include <dune/common/nullptr.hh>
 
diff --git a/common/test/nullptr-test2.cc b/common/test/nullptr-test2.cc
index 2c7b4cb1a68494e8109d1472b744366d8ad7f730..f940cdf5360c90639fade0d0ddcb244bfa2e0cc1 100644
--- a/common/test/nullptr-test2.cc
+++ b/common/test/nullptr-test2.cc
@@ -1,5 +1,7 @@
 // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
 // vi: set et ts=4 sw=2 sts=2:
-#include <config.h>
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
 
 #include <dune/common/nullptr.hh>
diff --git a/common/test/parsetest.cc b/common/test/parsetest.cc
index 3ba0cdcd0f7558a172298f8bfdd01aad8e8b892a..511c3b228a7e0f661386b804e6a2d8e4bdac754b 100644
--- a/common/test/parsetest.cc
+++ b/common/test/parsetest.cc
@@ -3,7 +3,9 @@
 // $Id$
 
 /* test if the common headers can be parsed without errors */
+#ifdef HAVE_CONFIG_H
 #include "config.h"
+#endif
 
 /*
 
diff --git a/common/test/poolallocatortest.cc b/common/test/poolallocatortest.cc
index 85db7879ee76e32474673a9e9b733c32bed418b3..8eb1e6c764b0c531733b3fac253511c3336bf521 100644
--- a/common/test/poolallocatortest.cc
+++ b/common/test/poolallocatortest.cc
@@ -1,6 +1,8 @@
 // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
 // vi: set et ts=4 sw=2 sts=2:
+#ifdef HAVE_CONFIG_H
 #include "config.h"
+#endif
 
 #include <dune/common/poolallocator.hh>
 #include <dune/common/alignment.hh>
diff --git a/common/test/settest.cc b/common/test/settest.cc
index e529c82fa0efd8d0110604c59020131848977f20..6c57a418cbf528fe1c0501d37780861c0e95858f 100644
--- a/common/test/settest.cc
+++ b/common/test/settest.cc
@@ -1,6 +1,8 @@
 // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
 // vi: set et ts=4 sw=2 sts=2:
+#ifdef HAVE_CONFIG_H
 #include "config.h"
+#endif
 
 #include <dune/common/enumset.hh>
 #include <iostream>
diff --git a/common/test/singletontest.cc b/common/test/singletontest.cc
index bdd1746e387d7a418c46ddd9f62920367d682ff5..8d25fc305c7c66c28adfff7c4d6e3f5c7ea56728 100644
--- a/common/test/singletontest.cc
+++ b/common/test/singletontest.cc
@@ -1,6 +1,8 @@
 // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
 // vi: set et ts=4 sw=2 sts=2:
+#ifdef HAVE_CONFIG_H
 #include "config.h"
+#endif
 
 #include <dune/common/singleton.hh>
 #include <iostream>
diff --git a/common/test/sllisttest.cc b/common/test/sllisttest.cc
index 06d2f9a8562a81e97234b7ae33ebac4a424c0da9..acccbf56d5a6c45ecf1fb16c2dbaab8d185a57d5 100644
--- a/common/test/sllisttest.cc
+++ b/common/test/sllisttest.cc
@@ -1,6 +1,8 @@
 // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
 // vi: set et ts=4 sw=2 sts=2:
+#ifdef HAVE_CONFIG_H
 #include "config.h"
+#endif
 
 #include <dune/common/sllist.hh>
 #include <dune/common/test/iteratortest.hh>
diff --git a/common/test/smallobject.cc b/common/test/smallobject.cc
index 6162b4e9161c655a57fe750a192ddf709761bfa6..7de693377144cb4ff946833e3cb43c33dc0e132a 100644
--- a/common/test/smallobject.cc
+++ b/common/test/smallobject.cc
@@ -1,6 +1,8 @@
 // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
 // vi: set et ts=4 sw=2 sts=2:
-#include <config.h>
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
 
 #include <iostream>
 
diff --git a/common/test/smartpointertest.cc b/common/test/smartpointertest.cc
index e7107201d61bdeec812d56e8034c37a96906c074..48665ea421eaf336ee7846905d551e91c3a09a39 100644
--- a/common/test/smartpointertest.cc
+++ b/common/test/smartpointertest.cc
@@ -1,7 +1,9 @@
 // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
 // vi: set et ts=4 sw=2 sts=2:
 // $Id$
+#ifdef HAVE_CONFIG_H
 #include "config.h"
+#endif
 
 #include <dune/common/smartpointer.hh>
 #include <iostream>
diff --git a/common/test/static_assert_test.cc b/common/test/static_assert_test.cc
index 5c7f4e6a6e9e3d53a9fb9a8716c679d4d3bc358c..bc2284fa93962e90880dd225ef7ef2518b8fa6f9 100644
--- a/common/test/static_assert_test.cc
+++ b/common/test/static_assert_test.cc
@@ -1,6 +1,8 @@
 // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
 // vi: set et ts=4 sw=2 sts=2:
-#include <config.h>
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
 #include <dune/common/static_assert.hh>
 
 int main()
diff --git a/common/test/streamtest.cc b/common/test/streamtest.cc
index 23f7f325f866eff47e9d2c20f1fb4ade5e256ed1..087e2fb1db84101a8d38cf095b46082b91e10e4c 100644
--- a/common/test/streamtest.cc
+++ b/common/test/streamtest.cc
@@ -9,7 +9,9 @@
 
  */
 
+#ifdef HAVE_CONFIG_H
 #include "config.h"
+#endif
 #include <fstream>
 
 #include <dune/common/stdstreams.hh>
diff --git a/common/test/test-stack.cc b/common/test/test-stack.cc
index 2ce13dc8e515e8bfa2b513e33d6901c471781db6..aec4a0aa8af7fd2aa819798e6ca712d7feded2de 100644
--- a/common/test/test-stack.cc
+++ b/common/test/test-stack.cc
@@ -1,7 +1,9 @@
 // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
 // vi: set et ts=4 sw=2 sts=2:
 // $Id$
+#ifdef HAVE_CONFIG_H
 #include "config.h"
+#endif
 
 #include <cassert>
 
diff --git a/common/test/testfassign.cc b/common/test/testfassign.cc
index ae5a188913bd7af5ef5f16fca20d0950bd337b6f..563a9a54b4891737e3f2126e4a97166119fe8fe6 100644
--- a/common/test/testfassign.cc
+++ b/common/test/testfassign.cc
@@ -1,6 +1,9 @@
 // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
 // vi: set et ts=4 sw=2 sts=2:
+#ifdef HAVE_CONFIG_H
 #include "config.h"
+#endif
+
 #include <iostream>
 #include <dune/common/fvector.hh>
 #include <dune/common/fassign.hh>
diff --git a/common/test/testfassign2.cc b/common/test/testfassign2.cc
index 09507346077e9c3bb840bc5d5a6819f4cab5bbaf..24cbafb58d52db7ef8ac4ca7450546aa85660361 100644
--- a/common/test/testfassign2.cc
+++ b/common/test/testfassign2.cc
@@ -1,4 +1,6 @@
 // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
 // vi: set et ts=4 sw=2 sts=2:
+#ifdef HAVE_CONFIG_H
 #include "config.h"
+#endif
 #include <dune/common/fassign.hh>
diff --git a/common/test/timing.cc b/common/test/timing.cc
index fd9b8df253864b1daf74223ffed5684620d4bec8..3abd6d31c37f6e43394f7b8be80df35042ad2808 100644
--- a/common/test/timing.cc
+++ b/common/test/timing.cc
@@ -1,6 +1,8 @@
 // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
 // vi: set et ts=4 sw=2 sts=2:
+#ifdef HAVE_CONFIG_H
 #include "config.h"
+#endif
 
 #include <iostream>
 #include <fstream>
diff --git a/common/test/tuplestest.cc b/common/test/tuplestest.cc
index a7d2c0e6b5c61451c5931640892ae4b1a8bb385a..fcfc022ef4dd6f48a6e9efe7d54f4f5833c02c83 100644
--- a/common/test/tuplestest.cc
+++ b/common/test/tuplestest.cc
@@ -1,7 +1,9 @@
 // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
 // vi: set et ts=4 sw=2 sts=2:
 // $Id$
+#ifdef HAVE_CONFIG_H
 #include "config.h"
+#endif
 
 #include <dune/common/tuples.hh>
 #include <dune/common/helpertemplates.hh>