diff --git a/arch_init.c b/arch_init.c
index e6effe8..dde7fad 100644
--- a/arch_init.c
+++ b/arch_init.c
@@ -46,6 +46,7 @@
 #include "exec-memory.h"
 #include "hw/pcspk.h"
 #include "qemu/page_cache.h"
+#include "qemu-config.h"
 #include "qmp-commands.h"
 #include "trace.h"
 
diff --git a/audio/alsaaudio.c b/audio/alsaaudio.c
index cb45b49..564d632 100644
--- a/audio/alsaaudio.c
+++ b/audio/alsaaudio.c
@@ -23,6 +23,7 @@
  */
 #include <alsa/asoundlib.h>
 #include "qemu-common.h"
+#include "main-loop.h"
 #include "qemu-char.h"
 #include "audio.h"
 
diff --git a/audio/ossaudio.c b/audio/ossaudio.c
index df51b7c..45abe39 100644
--- a/audio/ossaudio.c
+++ b/audio/ossaudio.c
@@ -31,6 +31,7 @@
 #include <sys/soundcard.h>
 #endif
 #include "qemu-common.h"
+#include "main-loop.h"
 #include "host-utils.h"
 #include "qemu-char.h"
 #include "audio.h"
diff --git a/block/blkdebug.c b/block/blkdebug.c
index d61ece8..19df74e 100644
--- a/block/blkdebug.c
+++ b/block/blkdebug.c
@@ -23,6 +23,7 @@
  */
 
 #include "qemu-common.h"
+#include "qemu-config.h"
 #include "block_int.h"
 #include "module.h"
 
diff --git a/block/iscsi.c b/block/iscsi.c
index c0b70b3..33b93d8 100644
--- a/block/iscsi.c
+++ b/block/iscsi.c
@@ -27,6 +27,7 @@
 #include <poll.h>
 #include <arpa/inet.h>
 #include "qemu-common.h"
+#include "qemu-config.h"
 #include "qemu-error.h"
 #include "block_int.h"
 #include "trace.h"
diff --git a/bt-host.c b/bt-host.c
index 0d3ad28..8b47370 100644
--- a/bt-host.c
+++ b/bt-host.c
@@ -21,6 +21,7 @@
 #include "qemu-char.h"
 #include "net.h"
 #include "bt-host.h"
+#include "main-loop.h"
 
 #ifndef _WIN32
 # include <errno.h>
diff --git a/bt-vhci.c b/bt-vhci.c
index bbc1029..878460a 100644
--- a/bt-vhci.c
+++ b/bt-vhci.c
@@ -21,6 +21,7 @@
 #include "qemu-char.h"
 #include "net.h"
 #include "hw/bt.h"
+#include "main-loop.h"
 
 #define VHCI_DEV	"/dev/vhci"
 #define VHCI_UDEV	"/dev/hci_vhci"
diff --git a/event_notifier-posix.c b/event_notifier-posix.c
index 6f3239a..f0bd839 100644
--- a/event_notifier-posix.c
+++ b/event_notifier-posix.c
@@ -13,6 +13,7 @@
 #include "qemu-common.h"
 #include "event_notifier.h"
 #include "qemu-char.h"
+#include "main-loop.h"
 
 #ifdef CONFIG_EVENTFD
 #include <sys/eventfd.h>
diff --git a/exec.c b/exec.c
index 8435de0..d4ef5b2 100644
--- a/exec.c
+++ b/exec.c
@@ -33,6 +33,7 @@
 #include "kvm.h"
 #include "hw/xen.h"
 #include "qemu-timer.h"
+#include "qemu-config.h"
 #include "memory.h"
 #include "dma.h"
 #include "exec-memory.h"
diff --git a/hw/arm_boot.c b/hw/arm_boot.c
index 92e2cab..ae1cf66 100644
--- a/hw/arm_boot.c
+++ b/hw/arm_boot.c
@@ -15,6 +15,7 @@
 #include "loader.h"
 #include "elf.h"
 #include "device_tree.h"
+#include "qemu-config.h"
 
 #define KERNEL_ARGS_ADDR 0x100
 #define KERNEL_LOAD_ADDR 0x00010000
diff --git a/hw/dma.c b/hw/dma.c
index d6aeac2..b5d9f7f 100644
--- a/hw/dma.c
+++ b/hw/dma.c
@@ -23,6 +23,7 @@
  */
 #include "hw.h"
 #include "isa.h"
+#include "main-loop.h"
 
 /* #define DEBUG_DMA */
 
diff --git a/hw/fw_cfg.c b/hw/fw_cfg.c
index 2b92cda..7b0e50f 100644
--- a/hw/fw_cfg.c
+++ b/hw/fw_cfg.c
@@ -27,6 +27,7 @@
 #include "fw_cfg.h"
 #include "sysbus.h"
 #include "qemu-error.h"
+#include "qemu-config.h"
 
 /* debug firmware config */
 //#define DEBUG_FW_CFG
diff --git a/hw/jazz_led.c b/hw/jazz_led.c
index 640e75e..09c7742 100644
--- a/hw/jazz_led.c
+++ b/hw/jazz_led.c
@@ -22,6 +22,7 @@
  * THE SOFTWARE.
  */
 
+#include "qemu-common.h"
 #include "console.h"
 #include "pixel_ops.h"
 #include "trace.h"
diff --git a/hw/mac_dbdma.c b/hw/mac_dbdma.c
index e551156..41eee50 100644
--- a/hw/mac_dbdma.c
+++ b/hw/mac_dbdma.c
@@ -39,6 +39,7 @@
 #include "hw.h"
 #include "isa.h"
 #include "mac_dbdma.h"
+#include "main-loop.h"
 
 /* debug DBDMA */
 //#define DEBUG_DBDMA
diff --git a/hw/puv3.c b/hw/puv3.c
index 764799c..57c4e19 100644
--- a/hw/puv3.c
+++ b/hw/puv3.c
@@ -8,6 +8,8 @@
  * published by the Free Software Foundation, or any later version.
  * See the COPYING file in the top-level directory.
  */
+
+#include "qemu-common.h"
 #include "console.h"
 #include "elf.h"
 #include "exec-memory.h"
diff --git a/hw/qdev-monitor.c b/hw/qdev-monitor.c
index a1b4d6a..5aaf74b 100644
--- a/hw/qdev-monitor.c
+++ b/hw/qdev-monitor.c
@@ -21,6 +21,7 @@
 #include "monitor.h"
 #include "qmp-commands.h"
 #include "arch_init.h"
+#include "qemu-config.h"
 
 /*
  * Aliases were a bad idea from the start.  Let's keep them
diff --git a/hw/qdev-properties.c b/hw/qdev-properties.c
index 81d901c..b9cd3c0 100644
--- a/hw/qdev-properties.c
+++ b/hw/qdev-properties.c
@@ -5,6 +5,7 @@
 #include "hw/block-common.h"
 #include "net/hub.h"
 #include "qapi/qapi-visit-core.h"
+#include "qemu-char.h"
 
 void *qdev_get_prop_ptr(DeviceState *dev, Property *prop)
 {
diff --git a/hw/s390x/sclpconsole.c b/hw/s390x/sclpconsole.c
index 0ec5623..15e7b61 100644
--- a/hw/s390x/sclpconsole.c
+++ b/hw/s390x/sclpconsole.c
@@ -17,6 +17,7 @@
 
 #include "sclp.h"
 #include "event-facility.h"
+#include "qemu-char.h"
 
 typedef struct ASCIIConsoleData {
     EventBufferHeader ebh;
diff --git a/hw/tcx.c b/hw/tcx.c
index 7aee2a9..a66fbee 100644
--- a/hw/tcx.c
+++ b/hw/tcx.c
@@ -22,6 +22,7 @@
  * THE SOFTWARE.
  */
 
+#include "qemu-common.h"
 #include "console.h"
 #include "pixel_ops.h"
 #include "sysbus.h"
diff --git a/hw/usb/dev-network.c b/hw/usb/dev-network.c
index 14d9e5a..3a7c607 100644
--- a/hw/usb/dev-network.c
+++ b/hw/usb/dev-network.c
@@ -28,6 +28,7 @@
 #include "hw/usb/desc.h"
 #include "net.h"
 #include "qemu-queue.h"
+#include "qemu-config.h"
 #include "sysemu.h"
 #include "iov.h"
 
diff --git a/net.c b/net.c
index e8ae13e..4f3d642 100644
--- a/net.c
+++ b/net.c
@@ -32,6 +32,7 @@
 #include "monitor.h"
 #include "qemu-common.h"
 #include "qemu_socket.h"
+#include "qemu-config.h"
 #include "qmp-commands.h"
 #include "hw/qdev.h"
 #include "iov.h"
diff --git a/qemu-config.h b/qemu-config.h
index 812c4c5..eb50eca 100644
--- a/qemu-config.h
+++ b/qemu-config.h
@@ -4,6 +4,7 @@
 #include <stdio.h>
 #include "qemu-option.h"
 #include "error.h"
+#include "qemu-option.h"
 
 extern QemuOptsList qemu_fsdev_opts;
 extern QemuOptsList qemu_virtfs_opts;
diff --git a/spice-qemu-char.c b/spice-qemu-char.c
index 09aa22d..5f95c93 100644
--- a/spice-qemu-char.c
+++ b/spice-qemu-char.c
@@ -1,6 +1,7 @@
 #include "config-host.h"
 #include "trace.h"
 #include "ui/qemu-spice.h"
+#include "qemu-char.h"
 #include <spice.h>
 #include <spice-experimental.h>
 
diff --git a/target-i386/kvm.c b/target-i386/kvm.c
index f669281..93d4524 100644
--- a/target-i386/kvm.c
+++ b/target-i386/kvm.c
@@ -27,6 +27,7 @@
 #include "cpu.h"
 #include "gdbstub.h"
 #include "host-utils.h"
+#include "qemu-config.h"
 #include "hw/pc.h"
 #include "hw/apic.h"
 #include "ioport.h"
