diff --git a/src/common/base32hex.c b/src/common/base32hex.c
index 9ee59243e8678133648c2c7027adb0768a3fa6a7..e1af3c7391c13e81a0c7a501f96b3fe6bedc3eb8 100644
--- a/src/common/base32hex.c
+++ b/src/common/base32hex.c
@@ -14,6 +14,7 @@
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <config.h>
 #include "base32hex.h"
 #include "errcode.h"
 
diff --git a/src/common/base64.c b/src/common/base64.c
index 8a3443667fc0cc9756e87e6affbb42361b5ba4b4..3deee97f0517b5db1a4f33c23f9ceb70e9733099 100644
--- a/src/common/base64.c
+++ b/src/common/base64.c
@@ -14,6 +14,7 @@
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <config.h>
 #include "base64.h"
 #include "errcode.h"
 
diff --git a/src/common/dSFMT-params.h b/src/common/dSFMT-params.h
index 610eb6a4a9f3ee3375d0a9e71c01c408e227635d..3a4a8686d16bd91b6df7e095a8098554a31387ff 100644
--- a/src/common/dSFMT-params.h
+++ b/src/common/dSFMT-params.h
@@ -1,5 +1,3 @@
-#include <config.h>
-
 #ifndef DSFMT_PARAMS_H
 #define DSFMT_PARAMS_H
 
diff --git a/src/common/dSFMT.c b/src/common/dSFMT.c
index 17db8285162f27f01cc1baca3ca6c8e793cdd037..4b238b546e33364bcf3d8001492d998362e296e9 100644
--- a/src/common/dSFMT.c
+++ b/src/common/dSFMT.c
@@ -11,6 +11,8 @@
  *
  * The new BSD License is applied to this software, see LICENSE.txt
  */
+
+#include <config.h>
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
diff --git a/src/common/dSFMT.h b/src/common/dSFMT.h
index 8441b952b0aa295570093d6c303cb97b2dbfa96e..aaad33371ac3c2b9dec60f7f99d599f665ddcced 100644
--- a/src/common/dSFMT.h
+++ b/src/common/dSFMT.h
@@ -28,8 +28,6 @@
  * unsigned int and 64-bit unsigned int in hexadecimal format.
  */
 
-#include <config.h>
-
 #ifndef DSFMT_H
 #define DSFMT_H
 
diff --git a/src/common/descriptor.c b/src/common/descriptor.c
index e713ba19c92084ebc700bbdd0fe94510891c034d..154a161c09218b1fedc88a2106f38fa1768c4d8f 100644
--- a/src/common/descriptor.c
+++ b/src/common/descriptor.c
@@ -14,6 +14,7 @@
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <config.h>
 #include "common/descriptor.h"
 #include "libknot/util/utils.h"		// knot_lookup_table_t
 
diff --git a/src/common/errcode.c b/src/common/errcode.c
index 1724f01f4ef83e701592b5fa2c1ed42762d81a91..54456b867af385e8d8df9bc8e736ea511d987e1f 100644
--- a/src/common/errcode.c
+++ b/src/common/errcode.c
@@ -14,6 +14,7 @@
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <config.h>
 #include "common/errcode.h"
 #include "common/errors.h"
 
diff --git a/src/common/errors.c b/src/common/errors.c
index 11aff95a736eb7219295f956047cc7174843e911..5215d205b717eb94c52e556ce59950fd57683b92 100644
--- a/src/common/errors.c
+++ b/src/common/errors.c
@@ -14,6 +14,7 @@
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <config.h>
 #include <stdarg.h>
 #include <stdio.h>
 #include <stdlib.h>
diff --git a/src/common/evqueue.c b/src/common/evqueue.c
index c3a629685d6868add1a5baaba02c2309667371a4..097d177deb2c8c2af7167eff051ba97dcbd622e2 100644
--- a/src/common/evqueue.c
+++ b/src/common/evqueue.c
@@ -14,10 +14,10 @@
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <config.h>
 #include <string.h>
 #include <stdlib.h>
 #include <unistd.h>
-#include <config.h>
 
 #include "common/evqueue.h"
 #include "common/fdset.h"
diff --git a/src/common/evsched.c b/src/common/evsched.c
index c5eae1492ec59c0d7342a8c14c04eafeaaedc798..7df2e0ce88e9896be81f5cdf1023c8fcfc4854aa 100644
--- a/src/common/evsched.c
+++ b/src/common/evsched.c
@@ -14,10 +14,10 @@
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <config.h>
 #include <sys/time.h>
 #include <stdlib.h>
 #include <stdio.h>
-#include <config.h>
 
 #include "common/evsched.h"
 
diff --git a/src/common/fdset.c b/src/common/fdset.c
index f7d2705692f333946c657a1b2c5ce1ab3677c31a..ab357bdb03aab8578f0212b579115f4fa327e524 100644
--- a/src/common/fdset.c
+++ b/src/common/fdset.c
@@ -14,12 +14,12 @@
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <config.h>
 #include <dlfcn.h>
 #include <string.h>
 #include <stdio.h>
 #include <time.h>
 #include <stdlib.h>
-#include <config.h>
 #include "common/fdset.h"
 
 /* Workarounds for clock_gettime() not available on some platforms. */
diff --git a/src/common/fdset.h b/src/common/fdset.h
index a589145ad47db2aa23d807fadba57be00262ddb6..e1facdb06e2ef64fb1fdd3fe68d94ac8e6bbbd77 100644
--- a/src/common/fdset.h
+++ b/src/common/fdset.h
@@ -32,7 +32,6 @@
 #ifndef _KNOTD_FDSET_H_
 #define _KNOTD_FDSET_H_
 
-#include "config.h"
 #include <stddef.h>
 #ifdef HAVE_SYS_SELECT_H
  #include <sys/select.h>
diff --git a/src/common/getline.c b/src/common/getline.c
index 6a5e0ad26b2a410ddbc7fcbde7716701800912e1..b2fa94e2f6511497d05400c4215f4eb981ae2d26 100644
--- a/src/common/getline.c
+++ b/src/common/getline.c
@@ -19,10 +19,9 @@
 #define _WITH_GETLINE
 #endif
 
+#include <config.h>
 #include "common/getline.h"
 
-#include "config.h"		// HAVE_
-
 #include <stdio.h>		// getline or fgetln
 #include <stdlib.h>		// free
 #include <string.h>		// memcpy
diff --git a/src/common/hattrie/ahtable.c b/src/common/hattrie/ahtable.c
index c9979c7feba0f514efca1cbfeb22fd81bd72da84..e8e2b4571f5311a67aba3c749008b5305bb3b5cf 100644
--- a/src/common/hattrie/ahtable.c
+++ b/src/common/hattrie/ahtable.c
@@ -5,6 +5,7 @@
  *
  */
 
+#include <config.h>
 #include <assert.h>
 #include <string.h>
 #include "ahtable.h"
diff --git a/src/common/hattrie/hat-trie.c b/src/common/hattrie/hat-trie.c
index 13778375928b340839a1bcbef022584222140cba..328a9d155ae84223c1c0e2ac81bd8dfd6fc9de64 100644
--- a/src/common/hattrie/hat-trie.c
+++ b/src/common/hattrie/hat-trie.c
@@ -5,6 +5,7 @@
  *
  */
 
+#include <config.h>
 #include <stdint.h>
 #include <assert.h>
 #include <string.h>
diff --git a/src/common/hattrie/murmurhash3.c b/src/common/hattrie/murmurhash3.c
index 612f1f7e70f2e7e87bf57e66d717bb313971bddd..73de0aefa6da76e62ed5c5e7c90da2367c4db3a7 100644
--- a/src/common/hattrie/murmurhash3.c
+++ b/src/common/hattrie/murmurhash3.c
@@ -1,6 +1,7 @@
 /* This is MurmurHash3. The original C++ code was placed in the public domain
  * by its author, Austin Appleby. */
 
+#include <config.h>
 #include "murmurhash3.h"
 
 static inline uint32_t fmix(uint32_t h)
diff --git a/src/common/heap.c b/src/common/heap.c
index b6181b10e4b8172afb4dc99fa1c238f27b177408..c8c7921e94784f4e244cda0dba46e37a8d87ba99 100644
--- a/src/common/heap.c
+++ b/src/common/heap.c
@@ -37,6 +37,7 @@
  * ------
  ***/
 
+#include <config.h>
 #include "heap.h"
 #include <string.h>
 #include <stdlib.h>
diff --git a/src/common/latency.c b/src/common/latency.c
index 7f5f5f846283f330702542b2da091498c25a38d5..ed4fb6756e42e2ef0c68d48f9963da47cb646c29 100644
--- a/src/common/latency.c
+++ b/src/common/latency.c
@@ -16,6 +16,7 @@
 
 #ifdef PROF_LATENCY
 
+#include <config.h>
 #include <sys/resource.h>
 #include <sys/types.h>
 #include <sys/socket.h>
diff --git a/src/common/lists.c b/src/common/lists.c
index 9672d630c09e825be63165e1bc6ec85e24fadeb5..e629e9dcc24e5431a0ddd8a0a0fb82f4a7918fcf 100644
--- a/src/common/lists.c
+++ b/src/common/lists.c
@@ -26,6 +26,7 @@
 
 #define _BIRD_LISTS_C_
 
+#include <config.h>
 #include <stdlib.h>
 #include <string.h>
 #include "common/lists.h"
diff --git a/src/common/mempattern.c b/src/common/mempattern.c
index 96e2db198e69aebf5870b53c9bce46bfb3fe4af4..d0841eb0938e2eadbbc2f3f7fccd036d3138105f 100644
--- a/src/common/mempattern.c
+++ b/src/common/mempattern.c
@@ -14,11 +14,11 @@
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <config.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
 #include <sys/resource.h>
-#include <config.h>
 #include <stdarg.h>
 
 #include "mempattern.h"
diff --git a/src/common/mempool.c b/src/common/mempool.c
index 0ec1b5c56b9c6528cbe53a058f82212e97411327..049b0161bbdd3985aa036004a251cbacf6f7d353 100644
--- a/src/common/mempool.c
+++ b/src/common/mempool.c
@@ -8,6 +8,8 @@
  *	of the GNU Lesser General Public License.
  */
 
+#include <config.h>
+
 #undef LOCAL_DEBUG
 
 #include "mempool.h"
diff --git a/src/common/mempool.h b/src/common/mempool.h
index b0f0aaa8b231bad9ee2253734c4003dca57a31c4..af457b329bdd364c95bf19f2e617649d73050203 100644
--- a/src/common/mempool.h
+++ b/src/common/mempool.h
@@ -13,7 +13,6 @@
 
 #include <string.h>
 #include <stdint.h>
-#include "config.h"
 
 #if __GNUC__ >= 4
 #define LIKE_MALLOC __attribute__((malloc))                             /** Function returns a "new" pointer **/
diff --git a/src/common/print.c b/src/common/print.c
index 7ebc0f59cb6207417f271f8c9562cfbeec8dea9f..dce5027533e0970ccd48b962bfe1a53065f4bcae 100644
--- a/src/common/print.c
+++ b/src/common/print.c
@@ -14,6 +14,7 @@
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <config.h>
 #include <stdio.h>
 #include <ctype.h>
 #include "print.h"
diff --git a/src/common/prng.c b/src/common/prng.c
index b85a18eb3305242de4be65a9a9b12adcf527979b..eac134714071bfba430d094e6de5c082bb0d7c47 100644
--- a/src/common/prng.c
+++ b/src/common/prng.c
@@ -14,6 +14,7 @@
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <config.h>
 #include <stdint.h>
 #include <stdlib.h>
 #include <string.h>
diff --git a/src/common/queue.c b/src/common/queue.c
index 182a8ddf3f98e121f37af0b002aa0f3acca8b427..26c6ed5cf73e4ec70a816bf740f231d0fe5fadd2 100644
--- a/src/common/queue.c
+++ b/src/common/queue.c
@@ -20,9 +20,10 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
+
+#include <config.h>
 #include "queue.h"
 #include "atomic.h"
-#include "config.h"
 #include <stdbool.h>
 #include <string.h>
 #include <assert.h>
diff --git a/src/common/ref.c b/src/common/ref.c
index 3b9c0336c8d36f922941371f3c22b0d7ad382edc..a042665aacd244de0ae8ddef822b532a04de72db 100644
--- a/src/common/ref.c
+++ b/src/common/ref.c
@@ -14,6 +14,7 @@
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <config.h>
 #include <stdio.h>
 
 #include "ref.h"
diff --git a/src/common/slab/slab.c b/src/common/slab/slab.c
index d3d059494baa76f2ede3552224fafbe7d3e79a40..7df05232d312941ea7e6174c4b6cf343f6fb05ec 100644
--- a/src/common/slab/slab.c
+++ b/src/common/slab/slab.c
@@ -12,7 +12,7 @@
 
     You should have received a copy of the GNU General Public License
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
+*/
 
 #include <config.h>
 #include <stdio.h>
diff --git a/src/common/sockaddr.c b/src/common/sockaddr.c
index 72b92acb6fabc92c97cdfe4e8dc98cdd55850dde..444434346298591ae36e832a26f11a9a13c83162 100644
--- a/src/common/sockaddr.c
+++ b/src/common/sockaddr.c
@@ -14,6 +14,7 @@
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <config.h>
 #include <stdlib.h>
 #include <string.h>
 #include <sys/types.h>
diff --git a/src/knot/common.h b/src/knot/common.h
index 36097e28264f7297c93e82cfa2732a9539d90caf..f677f93d5650fb8ceb49dc0da06c07b5d991b563 100644
--- a/src/knot/common.h
+++ b/src/knot/common.h
@@ -29,7 +29,6 @@
 
 #include <signal.h>
 #include <stdint.h>
-#include <config.h>
 
 /*
  * Common types and constants.
diff --git a/src/knot/conf/conf.c b/src/knot/conf/conf.c
index 7ab2a163766ab35e3a38d93c775322388a98d88d..80cf0f28133b88144f04842a5717583964ecb81b 100644
--- a/src/knot/conf/conf.c
+++ b/src/knot/conf/conf.c
@@ -12,8 +12,9 @@
 
     You should have received a copy of the GNU General Public License
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
+*/
 
+#include <config.h>
 #include <assert.h>
 #include <stdarg.h>
 #include <string.h>
diff --git a/src/knot/conf/extra.c b/src/knot/conf/extra.c
index ef43e6cfbf9536513101bfc96f9b1b7a4b89a425..c172a1521fcc80b249be553771168287f01a7c47 100644
--- a/src/knot/conf/extra.c
+++ b/src/knot/conf/extra.c
@@ -14,6 +14,7 @@
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <config.h>
 #include <stdlib.h>
 #include <stdbool.h>
 #include <string.h>
diff --git a/src/knot/conf/includes.c b/src/knot/conf/includes.c
index de9c9c15bf1dff99d39398eb74fb36aab1787b6f..2ca54c90472b7da1ae401144c928be50ab94e5cf 100644
--- a/src/knot/conf/includes.c
+++ b/src/knot/conf/includes.c
@@ -12,8 +12,9 @@
 
     You should have received a copy of the GNU General Public License
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
+*/
 
+#include <config.h>
 #include <assert.h>
 #include <stdbool.h>
 #include <stdio.h>
diff --git a/src/knot/conf/logconf.c b/src/knot/conf/logconf.c
index fa37273edcafea36eeebbd9ce5e848ef9068aab5..273a5979952eeb675024e42cbe4965ff248484cd 100644
--- a/src/knot/conf/logconf.c
+++ b/src/knot/conf/logconf.c
@@ -14,6 +14,7 @@
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <config.h>
 #include <stdarg.h>
 #include <stdio.h>
 #include <string.h>
diff --git a/src/knot/ctl/remote.c b/src/knot/ctl/remote.c
index e4150a891ce674232be4dd7a9b694b7d3bcf000f..054c0c78a08b06dc352ae28907de4e66e54a0329 100644
--- a/src/knot/ctl/remote.c
+++ b/src/knot/ctl/remote.c
@@ -14,6 +14,7 @@
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <config.h>
 #include "remote.h"
 #include "common/log.h"
 #include "common/fdset.h"
diff --git a/src/knot/ctl/remote.h b/src/knot/ctl/remote.h
index 533801247f170b8f44084b3c1df7560ac7f02993..4d4ae0d93962030cb993d282effadf0bbc4cae63 100644
--- a/src/knot/ctl/remote.h
+++ b/src/knot/ctl/remote.h
@@ -27,7 +27,6 @@
 #ifndef _KNOTD_REMOTE_H_
 #define _KNOTD_REMOTE_H_
 
-#include <config.h>
 #include "knot/conf/conf.h"
 #include "libknot/packet/packet.h"
 #include "libknot/rrset.h"
diff --git a/src/knot/other/debug.h b/src/knot/other/debug.h
index 955043c6eaa6680f9168a1741e3f801f29b086f5..b5fd9bcd1013b4ae3c6c00233ffba2099c314414 100644
--- a/src/knot/other/debug.h
+++ b/src/knot/other/debug.h
@@ -27,8 +27,6 @@
 #ifndef _KNOTD_DEBUG_H_
 #define _KNOTD_DEBUG_H_
 
-#include "config.h" /* autoconf generated */
-
 #ifdef KNOTD_SERVER_DEBUG
   #define KNOTD_THREADS_DEBUG
   #define KNOTD_JOURNAL_DEBUG
diff --git a/src/knot/server/notify.c b/src/knot/server/notify.c
index d1dbd3fd8141d04931a84f9a6420a4297eb33b7c..e6c95649fd10542228d40c23a514339bcff53d6c 100644
--- a/src/knot/server/notify.c
+++ b/src/knot/server/notify.c
@@ -14,6 +14,7 @@
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <config.h>
 #include <assert.h>
 
 #include "knot/server/notify.h"
diff --git a/src/knot/server/rrl.c b/src/knot/server/rrl.c
index d37691eaf2632c304c7419c7b4dc4110ebc7808b..30dd5ace9142f2d4b17d08f696e904346667d1cb 100644
--- a/src/knot/server/rrl.c
+++ b/src/knot/server/rrl.c
@@ -14,6 +14,7 @@
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <config.h>
 #include <time.h>
 #include <unistd.h>
 #include <sys/types.h>
diff --git a/src/knot/server/udp-handler.c b/src/knot/server/udp-handler.c
index a189b370abf4fb3cbbd17c16551a1df7d5e8e6d9..3ed57c5b8e36a2475fe4fd9b2ebf59443897030a 100644
--- a/src/knot/server/udp-handler.c
+++ b/src/knot/server/udp-handler.c
@@ -14,8 +14,8 @@
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include <dlfcn.h>
 #include <config.h>
+#include <dlfcn.h>
 #include <time.h>
 #include <unistd.h>
 #include <errno.h>
diff --git a/src/knot/server/zones.c b/src/knot/server/zones.c
index c7b8949186699efeaf3a7fcd8e6a2a13fde7e9fc..659f59d4a2abe053e78fb462b63183164653261d 100644
--- a/src/knot/server/zones.c
+++ b/src/knot/server/zones.c
@@ -14,6 +14,7 @@
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <config.h>
 #include <sys/stat.h>
 #include <unistd.h>
 
diff --git a/src/knot/zone/semantic-check.c b/src/knot/zone/semantic-check.c
index 4bf5a614269bd7c75520da9b6d0b343a11aa919c..44374c9f87ec4b42a2b78cf170ea040b15bd5980 100644
--- a/src/knot/zone/semantic-check.c
+++ b/src/knot/zone/semantic-check.c
@@ -1,3 +1,20 @@
+/*  Copyright (C) 2011 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
+
+    This program is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include <config.h>
 #include <stdlib.h>
 #include <stdint.h>
 #include <sys/types.h>
diff --git a/src/knot/zone/zone-dump.c b/src/knot/zone/zone-dump.c
index 081f5199b70a94a3b17cf03bf7f9eb1a91299324..aa630efef57da7bbd31b35bbcbddb74e3be19ca4 100644
--- a/src/knot/zone/zone-dump.c
+++ b/src/knot/zone/zone-dump.c
@@ -14,11 +14,10 @@
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include "knot/zone/zone-dump.h"
-
 #include <config.h>
 #include <inttypes.h>
 
+#include "knot/zone/zone-dump.h"
 #include "common/descriptor.h"
 #include "knot/conf/conf.h"
 #include "knot/server/zones.h"
diff --git a/src/libknot/binary.c b/src/libknot/binary.c
index b9777ed63db00a0ff779f713db759470c45fcf39..aba35607efbebecbab9c2a2f91b2245e3628c5d6 100644
--- a/src/libknot/binary.c
+++ b/src/libknot/binary.c
@@ -14,6 +14,7 @@
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <config.h>
 #include <stdlib.h>
 #include <string.h>
 
diff --git a/src/libknot/common.h b/src/libknot/common.h
index 7892985c5c02669f6726c393759495874151154a..b5bb956150ad9ee0218142939cc5b570e174d66b 100644
--- a/src/libknot/common.h
+++ b/src/libknot/common.h
@@ -24,7 +24,6 @@
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include <config.h>
 #include "common/errcode.h"
 #include "common/mempattern.h"
 
diff --git a/src/libknot/consts.c b/src/libknot/consts.c
index 4b5aa3aa927d2ca3915dc3a1f7b914882928fec7..5471d76af8f0a8f042d4ef5454f7a4b35e1372d4 100644
--- a/src/libknot/consts.c
+++ b/src/libknot/consts.c
@@ -14,6 +14,7 @@
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
+#include <config.h>
 #include <libknot/consts.h>
 
 knot_lookup_table_t knot_opcode_names[] = {
diff --git a/src/libknot/edns.c b/src/libknot/edns.c
index 5990f70cce0d0ef39fd5fc01b5197af14a636df4..015100e8e4d3f389fd607db622ea328032e67dcd 100644
--- a/src/libknot/edns.c
+++ b/src/libknot/edns.c
@@ -14,6 +14,7 @@
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <config.h>
 #include <stdint.h>
 #include <stdlib.h>
 #include <assert.h>
diff --git a/src/libknot/nameserver/chaos.c b/src/libknot/nameserver/chaos.c
index 389da12c3d8219cba206ed9398835de2954c56c2..e5484821e8db596654c10f91f4df3e5d37205b47 100644
--- a/src/libknot/nameserver/chaos.c
+++ b/src/libknot/nameserver/chaos.c
@@ -14,6 +14,7 @@
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <config.h>
 #include <strings.h>
 
 #include "chaos.h"
diff --git a/src/libknot/nameserver/name-server.c b/src/libknot/nameserver/name-server.c
index 873541338fa5f2948e6ce27390dca7ec394bb60f..e635836164b6225208a71c9fd4e60c294d1d7215 100644
--- a/src/libknot/nameserver/name-server.c
+++ b/src/libknot/nameserver/name-server.c
@@ -14,6 +14,7 @@
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <config.h>
 #include <stdio.h>
 #include <assert.h>
 #include <sys/time.h>
diff --git a/src/libknot/nsec3.c b/src/libknot/nsec3.c
index eb5d69f1086a688ac95ff582abc406b9a9d20c1d..3dd2e317868da62aeeb32393a876680b2b2df960 100644
--- a/src/libknot/nsec3.c
+++ b/src/libknot/nsec3.c
@@ -14,6 +14,7 @@
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <config.h>
 #include <stdint.h>
 #include <assert.h>
 #include <stdlib.h>
diff --git a/src/libknot/packet/packet.c b/src/libknot/packet/packet.c
index 4cea44b623b0c5646669fa4ca63280cf129eb1e5..52ed72b7796b041cf7df35a64a7c546184acd5f4 100644
--- a/src/libknot/packet/packet.c
+++ b/src/libknot/packet/packet.c
@@ -14,6 +14,7 @@
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <config.h>
 #include <assert.h>
 #include <stdlib.h>
 
diff --git a/src/libknot/packet/query.c b/src/libknot/packet/query.c
index c20ae15a52e40fb3d47cfdb5107c3134d1c6032b..4bededc9f113524ad015d75c14a290e4dc04e835 100644
--- a/src/libknot/packet/query.c
+++ b/src/libknot/packet/query.c
@@ -14,6 +14,7 @@
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <config.h>
 #include <stdlib.h>
 #include "packet/query.h"
 #include "util/wire.h"
diff --git a/src/libknot/packet/response.c b/src/libknot/packet/response.c
index fde996ba000d0b1f06a9c69f60abd0e5927324b8..067b4f81d1832388e7d5891a2e5a2f4d7773241c 100644
--- a/src/libknot/packet/response.c
+++ b/src/libknot/packet/response.c
@@ -14,6 +14,7 @@
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <config.h>
 #include <stdlib.h>
 #include <stdint.h>
 
diff --git a/src/libknot/rrset-dump.c b/src/libknot/rrset-dump.c
index 15905816bc7b887d8400cde9121e821f68be6720..0cd876b83ab5c3537a7fc85f7a89606592a86957 100644
--- a/src/libknot/rrset-dump.c
+++ b/src/libknot/rrset-dump.c
@@ -14,6 +14,7 @@
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <config.h>
 #include "libknot/rrset-dump.h"
 
 #include <stdlib.h>			// free
diff --git a/src/libknot/rrset.c b/src/libknot/rrset.c
index 65bef6373ad0cfa3b82b9f7f0d8beeb85a48bc1e..24ddb8894b6681db1738fbc556e81396fde93407 100644
--- a/src/libknot/rrset.c
+++ b/src/libknot/rrset.c
@@ -1,4 +1,4 @@
-	/*  Copyright (C) 2011 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
+/*  Copyright (C) 2011 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
 
     This program is free software: you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
diff --git a/src/libknot/sign/bnutils.c b/src/libknot/sign/bnutils.c
index d209ca67d84b20ed3dde8eb4b46625ca79f695c9..c328f4436eb161a4e530b8fc2b218bfa200106d5 100644
--- a/src/libknot/sign/bnutils.c
+++ b/src/libknot/sign/bnutils.c
@@ -14,6 +14,7 @@
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
+#include <config.h>
 #include <stddef.h>
 #include <string.h>
 #include <stdlib.h>
diff --git a/src/libknot/sign/dnssec.c b/src/libknot/sign/dnssec.c
index ece6844b4d5cf7f00cc07fa7f768c486ffcfcae9..7c524cbc79ac0ccdc77af6091a666888ff27f9e4 100644
--- a/src/libknot/sign/dnssec.c
+++ b/src/libknot/sign/dnssec.c
@@ -1,3 +1,20 @@
+/*  Copyright (C) 2011 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
+
+    This program is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include <config.h>
 #include "common/descriptor.h"
 #include "common/errcode.h"
 #include "sign/bnutils.h"
diff --git a/src/libknot/sign/key.c b/src/libknot/sign/key.c
index 8ae5aa59dd39a62a47169134c6dcc7cc633d15f5..7b92e9ce6b8fb0b30b69c489009191c9ed057728 100644
--- a/src/libknot/sign/key.c
+++ b/src/libknot/sign/key.c
@@ -14,6 +14,7 @@
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
+#include <config.h>
 #include <assert.h>
 #include <ctype.h>
 #include <stddef.h>
diff --git a/src/libknot/sign/sig0.c b/src/libknot/sign/sig0.c
index 18fd0d55a5198e996590846eb7af4d9fde8f50a2..d1f1ea93cce18eb18e13e971202e6291e8e8cc69 100644
--- a/src/libknot/sign/sig0.c
+++ b/src/libknot/sign/sig0.c
@@ -1,3 +1,20 @@
+/*  Copyright (C) 2011 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
+
+    This program is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include <config.h>
 #include "sign/dnssec.h"
 #include "sign/sig0.h"
 #include "common/errcode.h"
diff --git a/src/libknot/tsig-op.c b/src/libknot/tsig-op.c
index b9b000a3a9c8d8025e7b5298d409cd3abd442295..e6b11162a2b47584375daef3666eef8857baf7b3 100644
--- a/src/libknot/tsig-op.c
+++ b/src/libknot/tsig-op.c
@@ -14,6 +14,7 @@
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <config.h>
 #include <assert.h>
 #include <stdint.h>
 #include <openssl/hmac.h>
diff --git a/src/libknot/tsig.c b/src/libknot/tsig.c
index 5cb1dc1cb91ad7c29c950e9568971595fd3af59e..fd5970985951738b31c06c9e1cc3ee183b53177c 100644
--- a/src/libknot/tsig.c
+++ b/src/libknot/tsig.c
@@ -14,6 +14,7 @@
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <config.h>
 #include <string.h>
 #include <stdlib.h>
 #include <stdint.h>
diff --git a/src/libknot/updates/changesets.c b/src/libknot/updates/changesets.c
index b00ae6fb0739a2f1498acc6b452fbdb46e1f16cd..1f7997cf6be80875dce38a2998acf00c0af4fa7c 100644
--- a/src/libknot/updates/changesets.c
+++ b/src/libknot/updates/changesets.c
@@ -14,6 +14,7 @@
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <config.h>
 #include <string.h>
 #include <stdlib.h>
 #include <assert.h>
diff --git a/src/libknot/updates/ddns.c b/src/libknot/updates/ddns.c
index 0dcf43cbfe922ae665788cb805881fd5badc2187..d81ec72615ece9fcba141a8cdcb2d466db705694 100644
--- a/src/libknot/updates/ddns.c
+++ b/src/libknot/updates/ddns.c
@@ -14,6 +14,7 @@
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <config.h>
 #include <assert.h>
 #include <stdlib.h>
 #include <inttypes.h>
diff --git a/src/libknot/updates/xfr-in.c b/src/libknot/updates/xfr-in.c
index 77d2b05cb19d9344c35a6c091af35e2011a19f8b..3928a7f1dba567b8c79d9fa526e603245ec1d768 100644
--- a/src/libknot/updates/xfr-in.c
+++ b/src/libknot/updates/xfr-in.c
@@ -14,6 +14,7 @@
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <config.h>
 #include <assert.h>
 #include <urcu.h>
 
diff --git a/src/libknot/util/debug.h b/src/libknot/util/debug.h
index 31935dd22c88fd9f2ff954194624c52d192b7b6f..c994f985d28269d0f7a79f69af0052994b285e6d 100644
--- a/src/libknot/util/debug.h
+++ b/src/libknot/util/debug.h
@@ -32,7 +32,6 @@
 #include <stdint.h>
 #include <stdio.h>
 
-#include "config.h" /* autoconf generated */
 #include "common/log.h"
 
 /*
diff --git a/src/libknot/util/tolower.c b/src/libknot/util/tolower.c
index d71c4678d447f2d03e011de0dae14f9f546a5cc4..d8ca17d0ac47e7842b8f6b6ce928337440c91764 100644
--- a/src/libknot/util/tolower.c
+++ b/src/libknot/util/tolower.c
@@ -14,6 +14,7 @@
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <config.h>
 #include "util/tolower.h"
 
 const uint8_t char_table[CHAR_TABLE_SIZE] = {
diff --git a/src/libknot/zone/zone-contents.c b/src/libknot/zone/zone-contents.c
index d125ac029d072a3edca1239605ea28e6e99dc506..72e2129d808bdd332aac813fc08b969892d75ad5 100644
--- a/src/libknot/zone/zone-contents.c
+++ b/src/libknot/zone/zone-contents.c
@@ -14,6 +14,7 @@
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <config.h>
 #include <assert.h>
 
 #include "zone/zone-contents.h"
diff --git a/src/libknot/zone/zone-diff.c b/src/libknot/zone/zone-diff.c
index f86b726b1b48d87723830b2b8b942523eba41cd1..009aa31c4adf297b7317efc50e0e42882530b101 100644
--- a/src/libknot/zone/zone-diff.c
+++ b/src/libknot/zone/zone-diff.c
@@ -14,8 +14,8 @@
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include <assert.h>
 #include <config.h>
+#include <assert.h>
 #include <stdlib.h>
 #include <inttypes.h>
 
diff --git a/src/libknot/zone/zone-tree.c b/src/libknot/zone/zone-tree.c
index 5d40449591af78ba73bc87b51287bd01e20e9da0..a7e3d9f288f3d912ad96d73144d2a632ae2b8728 100644
--- a/src/libknot/zone/zone-tree.c
+++ b/src/libknot/zone/zone-tree.c
@@ -14,6 +14,7 @@
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <config.h>
 #include <assert.h>
 #include <stdlib.h>
 #include <stdio.h>
diff --git a/src/tests/common/acl_tests.c b/src/tests/common/acl_tests.c
index dc490fc80a2de10d064835ab1ff46ad0a013b4d0..f8ab106a3e2e0c001f87521c1b9f493b64567db3 100644
--- a/src/tests/common/acl_tests.c
+++ b/src/tests/common/acl_tests.c
@@ -14,6 +14,7 @@
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <config.h>
 #include <sys/types.h>
 #include <sys/socket.h>
 
diff --git a/src/tests/common/base32hex_tests.c b/src/tests/common/base32hex_tests.c
index cc33ec5128e8a6663e8d2eaf3172cac4f7e951c7..1303e4405dff77946a7a59ed01247f1a2ebd35a5 100644
--- a/src/tests/common/base32hex_tests.c
+++ b/src/tests/common/base32hex_tests.c
@@ -14,6 +14,7 @@
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <config.h>
 #include "tests/common/base32hex_tests.h"
 
 #include <stdlib.h>
diff --git a/src/tests/common/base64_tests.c b/src/tests/common/base64_tests.c
index c5398d728acb9a4bec2c2e036af5dfb5875d7d97..0893c0949d567163b685f104dad67f3310b676d9 100644
--- a/src/tests/common/base64_tests.c
+++ b/src/tests/common/base64_tests.c
@@ -14,6 +14,7 @@
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <config.h>
 #include "tests/common/base64_tests.h"
 
 #include <stdlib.h>
diff --git a/src/tests/common/descriptor_tests.c b/src/tests/common/descriptor_tests.c
index f294d7a46a8563d1a35a9115eef996f658bb2e67..9d752f552b75a541652ac5179010e1c3b1aacaf2 100644
--- a/src/tests/common/descriptor_tests.c
+++ b/src/tests/common/descriptor_tests.c
@@ -14,6 +14,7 @@
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <config.h>
 #include "tests/common/descriptor_tests.h"
 
 #include <stdlib.h>
diff --git a/src/tests/common/events_tests.c b/src/tests/common/events_tests.c
index a9b3de6b7fb544980c42c68c252e89382cc198d0..713bb5a056645e31b10e4e35ea8ef069ce9d0469 100644
--- a/src/tests/common/events_tests.c
+++ b/src/tests/common/events_tests.c
@@ -14,6 +14,7 @@
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <config.h>
 #include <stdlib.h>
 #include <stdint.h>
 #include <sys/time.h>
diff --git a/src/tests/common/fdset_tests.c b/src/tests/common/fdset_tests.c
index f8872c68f0fedd8efa96ae3ab3e432de249d2839..d7b29fa52887fd7837b7e99c1da4253b1f38de83 100644
--- a/src/tests/common/fdset_tests.c
+++ b/src/tests/common/fdset_tests.c
@@ -14,6 +14,7 @@
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <config.h>
 #include <stdlib.h>
 #include <stdint.h>
 #include <sys/time.h>
diff --git a/src/tests/common/hattrie_tests.c b/src/tests/common/hattrie_tests.c
index 7df50744d8ad5f4aa3fc0c999b12868a7cacd778..941f38cc976221e626c3396d36e33d0172a5782c 100644
--- a/src/tests/common/hattrie_tests.c
+++ b/src/tests/common/hattrie_tests.c
@@ -14,6 +14,7 @@
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <config.h>
 #include <string.h>
 #include <time.h>
 
diff --git a/src/tests/common/skiplist_tests.c b/src/tests/common/skiplist_tests.c
index 4fe99ec8bd3fc6e63c4f117be259f6a2236519e7..68ad139bc2b6e446458a9500e2b7bda43f6c47cc 100644
--- a/src/tests/common/skiplist_tests.c
+++ b/src/tests/common/skiplist_tests.c
@@ -14,6 +14,7 @@
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <config.h>
 #include <time.h>
 
 #include "tests/common/skiplist_tests.h"
diff --git a/src/tests/common/slab_tests.c b/src/tests/common/slab_tests.c
index a5de1c25cb6b7282bc0df8804ed47ad226f54102..ad2eee13570114c0be2e5a8688cbe306103ac6dc 100644
--- a/src/tests/common/slab_tests.c
+++ b/src/tests/common/slab_tests.c
@@ -14,6 +14,7 @@
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <config.h>
 #include <unistd.h>
 #include <stdlib.h>
 #include <time.h>
diff --git a/src/tests/knot/conf_tests.c b/src/tests/knot/conf_tests.c
index eb1c5914bcf70207e5674d62578134f1c8450360..0904a4e2a7ea83916a437bbc7b50d62929ba4265 100644
--- a/src/tests/knot/conf_tests.c
+++ b/src/tests/knot/conf_tests.c
@@ -14,6 +14,7 @@
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <config.h>
 #include <stdio.h>
 
 #include "tests/knot/conf_tests.h"
diff --git a/src/tests/knot/dthreads_tests.c b/src/tests/knot/dthreads_tests.c
index efc3f63c39a648963568e192ab2ad8b88e9efec3..247f66e91cfd734682d22fdfefd2edb1b0d4a997 100644
--- a/src/tests/knot/dthreads_tests.c
+++ b/src/tests/knot/dthreads_tests.c
@@ -13,6 +13,8 @@
     You should have received a copy of the GNU General Public License
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
+
+#include <config.h>
 #include <pthread.h>
 #include <sched.h>
 #include <sys/select.h>
diff --git a/src/tests/knot/journal_tests.c b/src/tests/knot/journal_tests.c
index 658b4a14d1f2f03ec40300e6b7a6625630b498b7..0146e5f475f6571c9021dc7383f3f69c589fe2ff 100644
--- a/src/tests/knot/journal_tests.c
+++ b/src/tests/knot/journal_tests.c
@@ -13,6 +13,8 @@
     You should have received a copy of the GNU General Public License
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
+
+#include <config.h>
 #include <string.h>
 
 #include "tests/knot/journal_tests.h"
diff --git a/src/tests/knot/rrl_tests.c b/src/tests/knot/rrl_tests.c
index 9cb46f88d5f7d8fa7d2c591e076d5eacaf16356f..db0bbb995256fd41690fc96b9380efac960086f9 100644
--- a/src/tests/knot/rrl_tests.c
+++ b/src/tests/knot/rrl_tests.c
@@ -14,6 +14,7 @@
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <config.h>
 #include <sys/types.h>
 #include <sys/socket.h>
 #include "tests/knot/rrl_tests.h"
diff --git a/src/tests/knot/server_tests.c b/src/tests/knot/server_tests.c
index 5ae04d8071e686b8f4c2239da0d0b4d558402c3f..d84d2c9dc3524b149751bf25b3de2dde88eb8a70 100644
--- a/src/tests/knot/server_tests.c
+++ b/src/tests/knot/server_tests.c
@@ -13,6 +13,8 @@
     You should have received a copy of the GNU General Public License
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
+
+#include <config.h>
 #include "tests/knot/server_tests.h"
 #include "knot/server/server.h"
 
diff --git a/src/tests/libknot/dname_tests.c b/src/tests/libknot/dname_tests.c
index 64fd836341a699de32ae07ebcdb86f9e524d254f..73ca67de9647df7a8133d922fb8836bf36e1fbe1 100644
--- a/src/tests/libknot/dname_tests.c
+++ b/src/tests/libknot/dname_tests.c
@@ -14,6 +14,7 @@
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <config.h>
 #include "tests/libknot/dname_tests.h"
 #include "libknot/dname.h"
 
diff --git a/src/tests/libknot/rrset_tests.c b/src/tests/libknot/rrset_tests.c
index 6db8c1a2c4fe6951a9c3d9e93e188b09d9ca402f..d140681017bf7d023b6bbcdbfd5b732165e16353 100644
--- a/src/tests/libknot/rrset_tests.c
+++ b/src/tests/libknot/rrset_tests.c
@@ -14,6 +14,7 @@
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <config.h>
 #include <assert.h>
 #include <stdint.h>
 #include <inttypes.h>
diff --git a/src/tests/libknot/sign_tests.c b/src/tests/libknot/sign_tests.c
index a32ce32898658ffd28c9630e6f5f6d7f00fd6a59..6b77218bf08bb9774a4a91d137b927d6a64d4295 100644
--- a/src/tests/libknot/sign_tests.c
+++ b/src/tests/libknot/sign_tests.c
@@ -14,6 +14,7 @@
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <config.h>
 #include "tests/libknot/sign_tests.h"
 #include "libknot/sign/key.h"
 #include "libknot/sign/key.c" // testing static functions
diff --git a/src/tests/libknot/wire_tests.c b/src/tests/libknot/wire_tests.c
index a56d3f91d38fd352716968a23ffb61c9e7577c32..7e4d001395c010bd9b5aa6dabea06a877c4d58b8 100644
--- a/src/tests/libknot/wire_tests.c
+++ b/src/tests/libknot/wire_tests.c
@@ -14,6 +14,7 @@
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <config.h>
 #include "tests/libknot/wire_tests.h"
 #include "libknot/util/utils.h"
 
diff --git a/src/tests/libknot/ztree_tests.c b/src/tests/libknot/ztree_tests.c
index e592c6027bac5c8d7e4280f3cbd815e7d65a4bc6..53506af7b6530a3c8c85c015dda897d836f5cc60 100644
--- a/src/tests/libknot/ztree_tests.c
+++ b/src/tests/libknot/ztree_tests.c
@@ -14,6 +14,7 @@
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <config.h>
 #include "tests/libknot/ztree_tests.h"
 #include "libknot/zone/zone-tree.h"
 
diff --git a/src/tests/xfr_tests.c b/src/tests/xfr_tests.c
index 77db11cc48f3bb73134d2b8e9310ee7c17296e19..70360d14d47602ea71d9639d03c8469a6beb727e 100644
--- a/src/tests/xfr_tests.c
+++ b/src/tests/xfr_tests.c
@@ -21,8 +21,8 @@
  *    binary that an integrity check should be done
 */
 
-#include <time.h>
 #include <config.h>
+#include <time.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
diff --git a/src/tests/zscanner/zscanner_tests.c b/src/tests/zscanner/zscanner_tests.c
index c1ae23b154375392bf1371c2d29eaa47334ed5ac..3d755ede63e2542c97b723e0c49d5a07771c054b 100644
--- a/src/tests/zscanner/zscanner_tests.c
+++ b/src/tests/zscanner/zscanner_tests.c
@@ -14,10 +14,10 @@
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <config.h>
 #include "tests/zscanner/zscanner_tests.h"
 
 #include <stdlib.h>
-#include <config.h>
 
 static int zscanner_tests_count(int argc, char *argv[]);
 static int zscanner_tests_run(int argc, char *argv[]);
diff --git a/src/utils/common/exec.c b/src/utils/common/exec.c
index 87fd116c66a78950992fe416b316f8e389c60fb6..0a9c1a9f2889575735a71b0cc734e28eb5fae070 100644
--- a/src/utils/common/exec.c
+++ b/src/utils/common/exec.c
@@ -14,6 +14,7 @@
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
+#include <config.h>
 #include "utils/common/exec.h"
 
 #include <stdlib.h>			// free
diff --git a/src/utils/common/msg.c b/src/utils/common/msg.c
index a1b61a60e336cc622823bf6d87cb4e893a5e43cb..412bee805e5da5ca609c81ba2911fed192fcc9ec 100644
--- a/src/utils/common/msg.c
+++ b/src/utils/common/msg.c
@@ -14,6 +14,7 @@
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
+#include <config.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <stdarg.h>
diff --git a/src/utils/common/netio.c b/src/utils/common/netio.c
index 5fd1df7b0642316931a65b2abdb5602c631af88f..e3f8a52dc4529bddb8feb13be84da800052b54a2 100644
--- a/src/utils/common/netio.c
+++ b/src/utils/common/netio.c
@@ -14,6 +14,7 @@
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
+#include <config.h>
 #include "utils/common/netio.h"
 
 #include <stdlib.h>			// free
diff --git a/src/utils/common/params.c b/src/utils/common/params.c
index b0c1cd245069c7d770cd5f47518cc3799d0e740b..f5a0a80794afaf12e2916008e104438c081ba4d4 100644
--- a/src/utils/common/params.c
+++ b/src/utils/common/params.c
@@ -14,6 +14,7 @@
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
+#include <config.h>
 #include "utils/common/params.h"
 
 #include <stdio.h>
diff --git a/src/utils/common/resolv.c b/src/utils/common/resolv.c
index 09d4fb1095ac76451d016f4afea191a5f82355ab..864a2a9838ffd0802d7be99ac96f2d706be1779d 100644
--- a/src/utils/common/resolv.c
+++ b/src/utils/common/resolv.c
@@ -14,6 +14,7 @@
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
+#include <config.h>
 #include "utils/common/resolv.h"
 
 #include <stdio.h>			// fopen
diff --git a/src/utils/common/token.c b/src/utils/common/token.c
index 3463dbbfbc97c94cb660428fdc364e1e9b60a8df..457a7c0fd3375ce9761003b6d97b70dead8effd2 100644
--- a/src/utils/common/token.c
+++ b/src/utils/common/token.c
@@ -14,6 +14,7 @@
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
+#include <config.h>
 #include "utils/common/token.h"
 
 #include <stdio.h>
diff --git a/src/utils/dig/dig_exec.c b/src/utils/dig/dig_exec.c
index 908c2e162554d24365b1acc035c1ea0c3315eab7..77323743beca4e6e7d0bd9ac855e07adaacb0f31 100644
--- a/src/utils/dig/dig_exec.c
+++ b/src/utils/dig/dig_exec.c
@@ -14,6 +14,7 @@
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
+#include <config.h>
 #include "utils/dig/dig_exec.h"
 
 #include <stdlib.h>			// free
diff --git a/src/utils/dig/dig_main.c b/src/utils/dig/dig_main.c
index 9bf68bd37cfd92b96592f1fd31fcf127c51fa556..b9b2f6d7b7934d336f2557c9ba570905d11ac909 100644
--- a/src/utils/dig/dig_main.c
+++ b/src/utils/dig/dig_main.c
@@ -14,6 +14,7 @@
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
+#include <config.h>
 #include <stdlib.h>			// EXIT_FAILURE
 
 #include "common/errcode.h"		// KNOT_EOK
diff --git a/src/utils/dig/dig_params.c b/src/utils/dig/dig_params.c
index d44b1c57b7fec38d55b6f11b64f5655f299158c1..64995b70d5a2d557b0a92540b284f898f4f7bf1e 100644
--- a/src/utils/dig/dig_params.c
+++ b/src/utils/dig/dig_params.c
@@ -14,6 +14,7 @@
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
+#include <config.h>
 #include "utils/dig/dig_params.h"
 
 #include <string.h>			// strncmp
diff --git a/src/utils/host/host_main.c b/src/utils/host/host_main.c
index 0ac92fe32f3b5314a5334d1be558379e92d67b23..492a1bbbd152eceb3f85adfdb2d4b5d7a75dc9fd 100644
--- a/src/utils/host/host_main.c
+++ b/src/utils/host/host_main.c
@@ -14,6 +14,7 @@
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
+#include <config.h>
 #include <stdlib.h>			// EXIT_FAILURE
 
 #include "common/errcode.h"		// KNOT_EOK
diff --git a/src/utils/host/host_params.c b/src/utils/host/host_params.c
index 48638598701142efcba00ab8e352be272594eafc..ba6d9650689ac8742c380b1233f680c20b09eee2 100644
--- a/src/utils/host/host_params.c
+++ b/src/utils/host/host_params.c
@@ -14,6 +14,7 @@
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
+#include <config.h>
 #include "utils/host/host_params.h"
 
 #include <string.h>			// strncmp
diff --git a/src/utils/nsupdate/nsupdate_exec.c b/src/utils/nsupdate/nsupdate_exec.c
index 3cc283d4d58da85d8d9cbe51f365f288c7e99274..c891ca713831493fd36e65099595cc965ca3d431 100644
--- a/src/utils/nsupdate/nsupdate_exec.c
+++ b/src/utils/nsupdate/nsupdate_exec.c
@@ -14,6 +14,7 @@
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
+#include <config.h>
 #include <stdio.h>
 #include <errno.h>
 #include <assert.h>
diff --git a/src/utils/nsupdate/nsupdate_main.c b/src/utils/nsupdate/nsupdate_main.c
index 8bb56aeb87fc74f049650a77194d663d2b526ea3..590b4b98b76309076fc6fecbebf2055d53a97f30 100644
--- a/src/utils/nsupdate/nsupdate_main.c
+++ b/src/utils/nsupdate/nsupdate_main.c
@@ -14,6 +14,7 @@
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
+#include <config.h>
 #include <stdlib.h>				// EXIT_FAILURE
 
 #include "common/errcode.h"			// KNOT_EOK
diff --git a/src/utils/nsupdate/nsupdate_params.c b/src/utils/nsupdate/nsupdate_params.c
index 31481ca88257f196bc11c0df151ca978b9736bf2..e7d9433685a2553ebb6ca5553ee26a589f41b1dd 100644
--- a/src/utils/nsupdate/nsupdate_params.c
+++ b/src/utils/nsupdate/nsupdate_params.c
@@ -14,6 +14,7 @@
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
+#include <config.h>
 #include <string.h>
 #include <stdio.h>
 #include <getopt.h>
diff --git a/src/zscanner/file_loader.c b/src/zscanner/file_loader.c
index 90e1b7028accf8806f055346c15e40a107fcb7ea..39955f009d141c36d70af143b991d4e2fd57dc81 100644
--- a/src/zscanner/file_loader.c
+++ b/src/zscanner/file_loader.c
@@ -14,6 +14,7 @@
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <config.h>
 #include "zscanner/file_loader.h"
 
 #include <inttypes.h>			// PRIu64
diff --git a/src/zscanner/scanner_functions.c b/src/zscanner/scanner_functions.c
index bd6cab70a22d0afc34426bd2d5534c5b8a23f0d0..3d5685670a3c89cec70eae9c90b930d65801b93f 100644
--- a/src/zscanner/scanner_functions.c
+++ b/src/zscanner/scanner_functions.c
@@ -14,6 +14,7 @@
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <config.h>
 #include "zscanner/scanner_functions.h"
 
 #include <stdint.h>
diff --git a/src/zscanner/test/processing.c b/src/zscanner/test/processing.c
index c3a7218da8271b8ccc4fc131166c0f19871320f2..8c532595eb72bb7272b03adcb151a6d0ff540912 100644
--- a/src/zscanner/test/processing.c
+++ b/src/zscanner/test/processing.c
@@ -14,6 +14,7 @@
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <config.h>
 #include "zscanner/scanner_functions.h"
 
 #include <inttypes.h>			// PRIu64
diff --git a/src/zscanner/test/tests.c b/src/zscanner/test/tests.c
index 103bf114c8cca58b8c03d040334fe712a3c66d32..fdd87ccf6d676199f009450c83b46005a696868f 100644
--- a/src/zscanner/test/tests.c
+++ b/src/zscanner/test/tests.c
@@ -14,6 +14,7 @@
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <config.h>
 #include "zscanner/test/tests.h"
 
 #include <inttypes.h>			// PRIu64
diff --git a/src/zscanner/test/zscanner-tool.c b/src/zscanner/test/zscanner-tool.c
index fa93b797e0b4765f240e18123c692a0b0dd9d908..4ac4907eca87a1fd269dbaa92387a22986daa124 100644
--- a/src/zscanner/test/zscanner-tool.c
+++ b/src/zscanner/test/zscanner-tool.c
@@ -14,6 +14,7 @@
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
+#include <config.h>
 #include <inttypes.h>			// PRIu64
 #include <stdio.h>			// printf
 #include <stdlib.h>			// atoi
diff --git a/tests/chkjournal.c b/tests/chkjournal.c
index 5bc287a717b522d31b195ece9c88ec7b432df54c..f8ff83dd13e31e13f54287fb61f92fb6bdcf931d 100644
--- a/tests/chkjournal.c
+++ b/tests/chkjournal.c
@@ -29,6 +29,8 @@
      $ cd tests
      $ make chkjournal-i386
  */
+
+#include <config.h>
 #include <stdio.h>
 #include <unistd.h>
 #include <stdlib.h>