diff --git a/src/dht_proxy_server.cpp b/src/dht_proxy_server.cpp
index 78bbd2cd3f46ccc1bac16793acfd0e8aafa18802..07b9f89cce72a918218f6a07d464d8338751dd23 100644
--- a/src/dht_proxy_server.cpp
+++ b/src/dht_proxy_server.cpp
@@ -18,6 +18,10 @@
  *  along with this program. If not, see <https://www.gnu.org/licenses/>.
  */
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include "dht_proxy_server.h"
 
 #include "default_types.h"
diff --git a/src/dhtrunner.cpp b/src/dhtrunner.cpp
index f68e76ec93573d5c45fb246d10e4602505f2d591..15633679848b130294f926d94a321f7b078c4842 100644
--- a/src/dhtrunner.cpp
+++ b/src/dhtrunner.cpp
@@ -18,6 +18,10 @@
  *  along with this program. If not, see <https://www.gnu.org/licenses/>.
  */
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include "dhtrunner.h"
 #include "securedht.h"
 #include "network_utils.h"
diff --git a/src/securedht.cpp b/src/securedht.cpp
index d117d5610ec7bff8c9539f44c37557a62d4ef7c6..18dd951e0982d60d576f306887e7c1d75ac74a07 100644
--- a/src/securedht.cpp
+++ b/src/securedht.cpp
@@ -17,6 +17,9 @@
  *  You should have received a copy of the GNU General Public License
  *  along with this program. If not, see <https://www.gnu.org/licenses/>.
  */
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
 
 #include "securedht.h"
 #include "rng.h"
diff --git a/src/value.cpp b/src/value.cpp
index 5a77f70c561eff0e1785b5389923735fbb894eb2..0750a530c71c3875b713156af5223634cf4ca280 100644
--- a/src/value.cpp
+++ b/src/value.cpp
@@ -17,6 +17,10 @@
  *  along with this program. If not, see <https://www.gnu.org/licenses/>.
  */
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include "value.h"
 
 #include "default_types.h"
diff --git a/tools/dhtnode.cpp b/tools/dhtnode.cpp
index 7b200b9bbbe83a6652403d7a5ffaa6e6511b441b..85eb7be783e33dd653f08a57ddc9926c3d1b91b7 100644
--- a/tools/dhtnode.cpp
+++ b/tools/dhtnode.cpp
@@ -18,6 +18,9 @@
  *  You should have received a copy of the GNU General Public License
  *  along with this program. If not, see <https://www.gnu.org/licenses/>.
  */
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
 
 #include "tools_common.h"
 extern "C" {