diff --git a/src/compat.h b/src/compat.h
index 80e53fe55..dffd4ecf5 100644
--- a/src/compat.h
+++ b/src/compat.h
@@ -6,6 +6,10 @@
 #ifndef BITCOIN_COMPAT_H
 #define BITCOIN_COMPAT_H
 
+#if defined(HAVE_CONFIG_H)
+#include "config/bitcoin-config.h"
+#endif
+
 #ifdef WIN32
 #ifdef _WIN32_WINNT
 #undef _WIN32_WINNT