diff mbox

[libdrm,v2] meson,configure: include config.h automatically

Message ID 20180201121027.23986-1-eric.engestrom@imgtec.com (mailing list archive)
State New, archived
Headers show

Commit Message

Eric Engestrom Feb. 1, 2018, 12:10 p.m. UTC
This will prevent any more missing `#include "config.h"` bug, at the
cost of having to recompile some files that didn't need to be when
changing build options.

Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
---
v2: forgot to `make clean` when testing autotools...
    needed to move the CFLAGS line after all compile tests in
    configure.ac, and `+=` doesn't work, so using `CFLAGS="$CFLAGS foo"`
    instead. (nothing besides configure.ac changed)
---
 amdgpu/amdgpu_asic_id.c               | 4 ----
 amdgpu/amdgpu_bo.c                    | 4 ----
 amdgpu/amdgpu_cs.c                    | 4 ----
 amdgpu/amdgpu_device.c                | 4 ----
 amdgpu/amdgpu_gpu_info.c              | 4 ----
 amdgpu/amdgpu_internal.h              | 4 ----
 amdgpu/amdgpu_vamgr.c                 | 4 ----
 amdgpu/amdgpu_vm.c                    | 4 ----
 amdgpu/util_hash.c                    | 4 ----
 amdgpu/util_hash.h                    | 4 ----
 amdgpu/util_hash_table.c              | 4 ----
 amdgpu/util_hash_table.h              | 4 ----
 configure.ac                          | 2 ++
 etnaviv/etnaviv_bo.c                  | 4 ----
 etnaviv/etnaviv_bo_cache.c            | 4 ----
 etnaviv/etnaviv_cmd_stream.c          | 4 ----
 etnaviv/etnaviv_device.c              | 4 ----
 etnaviv/etnaviv_gpu.c                 | 4 ----
 etnaviv/etnaviv_perfmon.c             | 4 ----
 etnaviv/etnaviv_pipe.c                | 4 ----
 exynos/exynos_drm.c                   | 4 ----
 exynos/exynos_fimg2d.c                | 4 ----
 freedreno/freedreno_bo.c              | 4 ----
 freedreno/freedreno_bo_cache.c        | 4 ----
 freedreno/freedreno_device.c          | 4 ----
 freedreno/freedreno_pipe.c            | 4 ----
 freedreno/freedreno_priv.h            | 4 ----
 freedreno/freedreno_ringbuffer.c      | 4 ----
 freedreno/kgsl/kgsl_bo.c              | 4 ----
 freedreno/kgsl/kgsl_device.c          | 4 ----
 freedreno/kgsl/kgsl_pipe.c            | 4 ----
 freedreno/kgsl/kgsl_ringbuffer.c      | 4 ----
 freedreno/msm/msm_bo.c                | 4 ----
 freedreno/msm/msm_device.c            | 4 ----
 freedreno/msm/msm_pipe.c              | 4 ----
 freedreno/msm/msm_ringbuffer.c        | 4 ----
 intel/intel_bufmgr.c                  | 4 ----
 intel/intel_bufmgr_fake.c             | 4 ----
 intel/intel_bufmgr_gem.c              | 4 ----
 intel/intel_decode.c                  | 4 ----
 intel/mm.c                            | 4 ----
 intel/mm.h                            | 4 ----
 intel/test_decode.c                   | 4 ----
 libkms/api.c                          | 4 ----
 libkms/dumb.c                         | 4 ----
 libkms/exynos.c                       | 4 ----
 libkms/intel.c                        | 4 ----
 libkms/internal.h                     | 4 ----
 libkms/linux.c                        | 4 ----
 libkms/nouveau.c                      | 4 ----
 libkms/radeon.c                       | 4 ----
 libkms/vmwgfx.c                       | 4 ----
 meson.build                           | 2 +-
 nouveau/abi16.c                       | 4 ----
 nouveau/bufctx.c                      | 4 ----
 nouveau/nouveau.c                     | 4 ----
 nouveau/pushbuf.c                     | 4 ----
 omap/omap_drm.c                       | 4 ----
 radeon/radeon_bo.c                    | 3 ---
 radeon/radeon_bo_gem.c                | 3 ---
 radeon/radeon_cs.c                    | 3 ---
 radeon/radeon_cs_gem.c                | 3 ---
 radeon/radeon_cs_space.c              | 3 ---
 radeon/radeon_surface.c               | 3 ---
 tegra/tegra.c                         | 4 ----
 tests/amdgpu/amdgpu_test.c            | 4 ----
 tests/amdgpu/basic_tests.c            | 4 ----
 tests/amdgpu/bo_tests.c               | 4 ----
 tests/amdgpu/cs_tests.c               | 4 ----
 tests/amdgpu/deadlock_tests.c         | 4 ----
 tests/amdgpu/uvd_enc_tests.c          | 4 ----
 tests/amdgpu/vce_tests.c              | 4 ----
 tests/amdgpu/vcn_tests.c              | 4 ----
 tests/etnaviv/etnaviv_2d_test.c       | 4 ----
 tests/etnaviv/etnaviv_bo_cache_test.c | 4 ----
 tests/exynos/exynos_fimg2d_test.c     | 4 ----
 tests/kms/kms-steal-crtc.c            | 4 ----
 tests/kms/kms-universal-planes.c      | 4 ----
 tests/kms/libkms-test-crtc.c          | 4 ----
 tests/kms/libkms-test-device.c        | 4 ----
 tests/kms/libkms-test-framebuffer.c   | 4 ----
 tests/kms/libkms-test-plane.c         | 4 ----
 tests/kms/libkms-test-screen.c        | 4 ----
 tests/modetest/buffers.c              | 4 ----
 tests/modetest/cursor.c               | 4 ----
 tests/modetest/modetest.c             | 4 ----
 tests/nouveau/threaded.c              | 4 ----
 tests/tegra/openclose.c               | 4 ----
 tests/util/format.c                   | 4 ----
 tests/util/kms.c                      | 4 ----
 tests/util/pattern.c                  | 4 ----
 tests/vbltest/vbltest.c               | 4 ----
 xf86atomic.h                          | 4 ----
 xf86drm.c                             | 3 ---
 xf86drmMode.c                         | 4 ----
 95 files changed, 3 insertions(+), 366 deletions(-)

Comments

Emil Velikov March 20, 2018, 12:06 p.m. UTC | #1
On 1 February 2018 at 12:10, Eric Engestrom <eric.engestrom@imgtec.com> wrote:
> This will prevent any more missing `#include "config.h"` bug, at the
> cost of having to recompile some files that didn't need to be when
> changing build options.
>
> Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
> ---
> v2: forgot to `make clean` when testing autotools...
>     needed to move the CFLAGS line after all compile tests in
>     configure.ac, and `+=` doesn't work, so using `CFLAGS="$CFLAGS foo"`
>     instead. (nothing besides configure.ac changed)
I'm not sure how well this will work with non gcc/clang, yet anyone
using those compilers is welcome to send us a patch ;-)

Reviewed-by: Emil Velikov <emil.velikov@collabora.com>

-Emil
diff mbox

Patch

diff --git a/amdgpu/amdgpu_asic_id.c b/amdgpu/amdgpu_asic_id.c
index 62459c093842225da170..a5007ffc80a74e517b6a 100644
--- a/amdgpu/amdgpu_asic_id.c
+++ b/amdgpu/amdgpu_asic_id.c
@@ -22,10 +22,6 @@ 
  *
  */
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
 #include <ctype.h>
 #include <stdio.h>
 #include <stdlib.h>
diff --git a/amdgpu/amdgpu_bo.c b/amdgpu/amdgpu_bo.c
index 3853fd03d33bf9d8f276..cb255cb05c42743b9c79 100644
--- a/amdgpu/amdgpu_bo.c
+++ b/amdgpu/amdgpu_bo.c
@@ -22,10 +22,6 @@ 
  *
  */
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
 #include <stdlib.h>
 #include <stdio.h>
 #include <stdint.h>
diff --git a/amdgpu/amdgpu_cs.c b/amdgpu/amdgpu_cs.c
index 46dffe1dffc7a68408fa..baba8ddde2cdbcbe5db7 100644
--- a/amdgpu/amdgpu_cs.c
+++ b/amdgpu/amdgpu_cs.c
@@ -21,10 +21,6 @@ 
  *
  */
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
diff --git a/amdgpu/amdgpu_device.c b/amdgpu/amdgpu_device.c
index f34e27a9773cabdb29ad..071641c4fc7a6742235b 100644
--- a/amdgpu/amdgpu_device.c
+++ b/amdgpu/amdgpu_device.c
@@ -28,10 +28,6 @@ 
  *
  */
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
 #include <sys/stat.h>
 #include <errno.h>
 #include <string.h>
diff --git a/amdgpu/amdgpu_gpu_info.c b/amdgpu/amdgpu_gpu_info.c
index 1efffc6f1310a3d2482c..b68e1c4fe82cf06908fe 100644
--- a/amdgpu/amdgpu_gpu_info.c
+++ b/amdgpu/amdgpu_gpu_info.c
@@ -22,10 +22,6 @@ 
  *
  */
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
 #include <errno.h>
 #include <string.h>
 
diff --git a/amdgpu/amdgpu_internal.h b/amdgpu/amdgpu_internal.h
index 3e044f11d61452b39f78..114f20985ac2561ed1f4 100644
--- a/amdgpu/amdgpu_internal.h
+++ b/amdgpu/amdgpu_internal.h
@@ -25,10 +25,6 @@ 
 #ifndef _AMDGPU_INTERNAL_H_
 #define _AMDGPU_INTERNAL_H_
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
 #include <assert.h>
 #include <pthread.h>
 
diff --git a/amdgpu/amdgpu_vamgr.c b/amdgpu/amdgpu_vamgr.c
index ab425ef7c0153f2c4266..d90ad58ee80bcfd5cd16 100644
--- a/amdgpu/amdgpu_vamgr.c
+++ b/amdgpu/amdgpu_vamgr.c
@@ -21,10 +21,6 @@ 
  *
  */
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
 #include <stdlib.h>
 #include <string.h>
 #include <errno.h>
diff --git a/amdgpu/amdgpu_vm.c b/amdgpu/amdgpu_vm.c
index 5ba7c082de712134d2bb..da9d07f81428ca471f93 100644
--- a/amdgpu/amdgpu_vm.c
+++ b/amdgpu/amdgpu_vm.c
@@ -21,10 +21,6 @@ 
  *
  */
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
 #include "amdgpu.h"
 #include "amdgpu_drm.h"
 #include "xf86drm.h"
diff --git a/amdgpu/util_hash.c b/amdgpu/util_hash.c
index 87cb671b6a03a5371870..7e590419500858ae9606 100644
--- a/amdgpu/util_hash.c
+++ b/amdgpu/util_hash.c
@@ -30,10 +30,6 @@ 
   *   Zack Rusin <zackr@vmware.com>
   */
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
 #include "util_hash.h"
 
 #include <stdlib.h>
diff --git a/amdgpu/util_hash.h b/amdgpu/util_hash.h
index 01a4779ba0dbf5b03376..6eed156953f917036550 100644
--- a/amdgpu/util_hash.h
+++ b/amdgpu/util_hash.h
@@ -44,10 +44,6 @@ 
 #ifndef UTIL_HASH_H
 #define UTIL_HASH_H
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
 #include <stdbool.h>
 
 #include "libdrm_macros.h"
diff --git a/amdgpu/util_hash_table.c b/amdgpu/util_hash_table.c
index fa7f6eabbfa519e530fa..89a8bf9b4e4e4eb34dae 100644
--- a/amdgpu/util_hash_table.c
+++ b/amdgpu/util_hash_table.c
@@ -38,10 +38,6 @@ 
  */
 
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
 #include "util_hash_table.h"
 #include "util_hash.h"
 
diff --git a/amdgpu/util_hash_table.h b/amdgpu/util_hash_table.h
index e00012890e768f7d10a5..5e295a812e17c1cadc0e 100644
--- a/amdgpu/util_hash_table.h
+++ b/amdgpu/util_hash_table.h
@@ -34,10 +34,6 @@ 
 #ifndef U_HASH_TABLE_H_
 #define U_HASH_TABLE_H_
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
 #include "libdrm_macros.h"
 
 /**
diff --git a/configure.ac b/configure.ac
index 5063cffba868467c83c0..3e9ff1007062bbd15b4d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -539,6 +539,8 @@  if test "x$HAVE_ATTRIBUTE_VISIBILITY" = xyes; then
     AC_DEFINE(HAVE_VISIBILITY, 1, [Compiler supports __attribute__(("hidden"))])
 fi
 
+CFLAGS="$CFLAGS -include config.h"
+
 AC_SUBST(WARN_CFLAGS)
 AC_CONFIG_FILES([
 	Makefile
diff --git a/etnaviv/etnaviv_bo.c b/etnaviv/etnaviv_bo.c
index 78b9cd2728a6cf63c660..32f7b3487c12ddc5a970 100644
--- a/etnaviv/etnaviv_bo.c
+++ b/etnaviv/etnaviv_bo.c
@@ -24,10 +24,6 @@ 
  *    Christian Gmeiner <christian.gmeiner@gmail.com>
  */
 
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
 #include "etnaviv_priv.h"
 #include "etnaviv_drmif.h"
 
diff --git a/etnaviv/etnaviv_bo_cache.c b/etnaviv/etnaviv_bo_cache.c
index 6208230dc81a8b0ef569..c81de262f8ae147b1059 100644
--- a/etnaviv/etnaviv_bo_cache.c
+++ b/etnaviv/etnaviv_bo_cache.c
@@ -24,10 +24,6 @@ 
  *    Christian Gmeiner <christian.gmeiner@gmail.com>
  */
 
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
 #include "etnaviv_priv.h"
 #include "etnaviv_drmif.h"
 
diff --git a/etnaviv/etnaviv_cmd_stream.c b/etnaviv/etnaviv_cmd_stream.c
index e8c58cd5d092a3288b4d..1373016819bd21d597fa 100644
--- a/etnaviv/etnaviv_cmd_stream.c
+++ b/etnaviv/etnaviv_cmd_stream.c
@@ -24,10 +24,6 @@ 
  *    Christian Gmeiner <christian.gmeiner@gmail.com>
  */
 
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
 #include <assert.h>
 
 #include "etnaviv_drmif.h"
diff --git a/etnaviv/etnaviv_device.c b/etnaviv/etnaviv_device.c
index 3ce92030e5058eccc5a8..d83e8d3e6c86aac4014e 100644
--- a/etnaviv/etnaviv_device.c
+++ b/etnaviv/etnaviv_device.c
@@ -24,10 +24,6 @@ 
  *    Christian Gmeiner <christian.gmeiner@gmail.com>
  */
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
 #include <stdlib.h>
 #include <linux/stddef.h>
 #include <linux/types.h>
diff --git a/etnaviv/etnaviv_gpu.c b/etnaviv/etnaviv_gpu.c
index bc355e8fc97957cfcc69..f7efa0289f9fbde33d54 100644
--- a/etnaviv/etnaviv_gpu.c
+++ b/etnaviv/etnaviv_gpu.c
@@ -24,10 +24,6 @@ 
  *    Christian Gmeiner <christian.gmeiner@gmail.com>
  */
 
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
 #include "etnaviv_priv.h"
 #include "etnaviv_drmif.h"
 
diff --git a/etnaviv/etnaviv_perfmon.c b/etnaviv/etnaviv_perfmon.c
index aa5130a657cf90a6f7f8..5f408a7bc6d1ea063c6d 100644
--- a/etnaviv/etnaviv_perfmon.c
+++ b/etnaviv/etnaviv_perfmon.c
@@ -25,10 +25,6 @@ 
  *    Christian Gmeiner <christian.gmeiner@gmail.com>
  */
 
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
 #include "etnaviv_priv.h"
 
 static int etna_perfmon_query_signals(struct etna_perfmon *pm, struct etna_perfmon_domain *dom)
diff --git a/etnaviv/etnaviv_pipe.c b/etnaviv/etnaviv_pipe.c
index 94c5d3778f1bbbcb8a4a..53954aa32333bb4eab57 100644
--- a/etnaviv/etnaviv_pipe.c
+++ b/etnaviv/etnaviv_pipe.c
@@ -24,10 +24,6 @@ 
  *    Christian Gmeiner <christian.gmeiner@gmail.com>
  */
 
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
 #include "etnaviv_priv.h"
 
 int etna_pipe_wait(struct etna_pipe *pipe, uint32_t timestamp, uint32_t ms)
diff --git a/exynos/exynos_drm.c b/exynos/exynos_drm.c
index f6204f1c24f3db5552ef..e1afef6506d754fa8bf0 100644
--- a/exynos/exynos_drm.c
+++ b/exynos/exynos_drm.c
@@ -24,10 +24,6 @@ 
  *    Inki Dae <inki.dae@samsung.com>
  */
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
diff --git a/exynos/exynos_fimg2d.c b/exynos/exynos_fimg2d.c
index 5658a48e0d289d158a4f..bca884b9ee01392add5d 100644
--- a/exynos/exynos_fimg2d.c
+++ b/exynos/exynos_fimg2d.c
@@ -23,10 +23,6 @@ 
  * OTHER DEALINGS IN THE SOFTWARE.
  */
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
diff --git a/freedreno/freedreno_bo.c b/freedreno/freedreno_bo.c
index df35c36a2dacdd2c6fdc..288c00aec7a18edf19e8 100644
--- a/freedreno/freedreno_bo.c
+++ b/freedreno/freedreno_bo.c
@@ -26,10 +26,6 @@ 
  *    Rob Clark <robclark@freedesktop.org>
  */
 
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
 #include "freedreno_drmif.h"
 #include "freedreno_priv.h"
 
diff --git a/freedreno/freedreno_bo_cache.c b/freedreno/freedreno_bo_cache.c
index d922f3a90d4221c4279c..3b737159cb4bea19c57a 100644
--- a/freedreno/freedreno_bo_cache.c
+++ b/freedreno/freedreno_bo_cache.c
@@ -26,10 +26,6 @@ 
  *    Rob Clark <robclark@freedesktop.org>
  */
 
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
 #include "freedreno_drmif.h"
 #include "freedreno_priv.h"
 
diff --git a/freedreno/freedreno_device.c b/freedreno/freedreno_device.c
index a0334bf4764e009f6c32..0b42561a466a0ae6d686 100644
--- a/freedreno/freedreno_device.c
+++ b/freedreno/freedreno_device.c
@@ -26,10 +26,6 @@ 
  *    Rob Clark <robclark@freedesktop.org>
  */
 
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <unistd.h>
diff --git a/freedreno/freedreno_pipe.c b/freedreno/freedreno_pipe.c
index 1540474bdf5d2159d12e..77b160e70e4b30bf88f0 100644
--- a/freedreno/freedreno_pipe.c
+++ b/freedreno/freedreno_pipe.c
@@ -26,10 +26,6 @@ 
  *    Rob Clark <robclark@freedesktop.org>
  */
 
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
 #include "freedreno_drmif.h"
 #include "freedreno_priv.h"
 
diff --git a/freedreno/freedreno_priv.h b/freedreno/freedreno_priv.h
index 81ad6092b01b7af3a764..8a19e9f8de085c003a2f 100644
--- a/freedreno/freedreno_priv.h
+++ b/freedreno/freedreno_priv.h
@@ -29,10 +29,6 @@ 
 #ifndef FREEDRENO_PRIV_H_
 #define FREEDRENO_PRIV_H_
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
 #include <stdlib.h>
 #include <errno.h>
 #include <string.h>
diff --git a/freedreno/freedreno_ringbuffer.c b/freedreno/freedreno_ringbuffer.c
index 7310f1fd4a800d909640..3834b51baadbe31f231c 100644
--- a/freedreno/freedreno_ringbuffer.c
+++ b/freedreno/freedreno_ringbuffer.c
@@ -26,10 +26,6 @@ 
  *    Rob Clark <robclark@freedesktop.org>
  */
 
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
 #include <assert.h>
 
 #include "freedreno_drmif.h"
diff --git a/freedreno/kgsl/kgsl_bo.c b/freedreno/kgsl/kgsl_bo.c
index ab3485e36b16195d0a25..c6d2d4999203a553809d 100644
--- a/freedreno/kgsl/kgsl_bo.c
+++ b/freedreno/kgsl/kgsl_bo.c
@@ -26,10 +26,6 @@ 
  *    Rob Clark <robclark@freedesktop.org>
  */
 
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
 #include "kgsl_priv.h"
 
 #include <linux/fb.h>
diff --git a/freedreno/kgsl/kgsl_device.c b/freedreno/kgsl/kgsl_device.c
index 958e8a7286c5641071ec..914f3412dd8271b52bf0 100644
--- a/freedreno/kgsl/kgsl_device.c
+++ b/freedreno/kgsl/kgsl_device.c
@@ -26,10 +26,6 @@ 
  *    Rob Clark <robclark@freedesktop.org>
  */
 
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <unistd.h>
diff --git a/freedreno/kgsl/kgsl_pipe.c b/freedreno/kgsl/kgsl_pipe.c
index 80bd13133cc5418dc5c5..0a8b6586d6d7e11d4abc 100644
--- a/freedreno/kgsl/kgsl_pipe.c
+++ b/freedreno/kgsl/kgsl_pipe.c
@@ -26,10 +26,6 @@ 
  *    Rob Clark <robclark@freedesktop.org>
  */
 
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
 #include "kgsl_priv.h"
 
 
diff --git a/freedreno/kgsl/kgsl_ringbuffer.c b/freedreno/kgsl/kgsl_ringbuffer.c
index f09c433bbe11eed4191b..a756deda97ea4e13acf2 100644
--- a/freedreno/kgsl/kgsl_ringbuffer.c
+++ b/freedreno/kgsl/kgsl_ringbuffer.c
@@ -26,10 +26,6 @@ 
  *    Rob Clark <robclark@freedesktop.org>
  */
 
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
 #include <assert.h>
 
 #include "freedreno_ringbuffer.h"
diff --git a/freedreno/msm/msm_bo.c b/freedreno/msm/msm_bo.c
index 72471df65b22f9a934fa..f9cfff894a400621a25c 100644
--- a/freedreno/msm/msm_bo.c
+++ b/freedreno/msm/msm_bo.c
@@ -26,10 +26,6 @@ 
  *    Rob Clark <robclark@freedesktop.org>
  */
 
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
 #include "msm_priv.h"
 
 static int bo_allocate(struct msm_bo *msm_bo)
diff --git a/freedreno/msm/msm_device.c b/freedreno/msm/msm_device.c
index c454938d43dc05fdd571..7bb576774b8a71ae87d7 100644
--- a/freedreno/msm/msm_device.c
+++ b/freedreno/msm/msm_device.c
@@ -26,10 +26,6 @@ 
  *    Rob Clark <robclark@freedesktop.org>
  */
 
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <unistd.h>
diff --git a/freedreno/msm/msm_pipe.c b/freedreno/msm/msm_pipe.c
index 12e4be59b21c900a32ed..f28778ef947194bec875 100644
--- a/freedreno/msm/msm_pipe.c
+++ b/freedreno/msm/msm_pipe.c
@@ -26,10 +26,6 @@ 
  *    Rob Clark <robclark@freedesktop.org>
  */
 
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
 #include "msm_priv.h"
 
 static int query_param(struct fd_pipe *pipe, uint32_t param,
diff --git a/freedreno/msm/msm_ringbuffer.c b/freedreno/msm/msm_ringbuffer.c
index c75bb1692cffe0d6add4..a87e1b9a26c0aad7ef32 100644
--- a/freedreno/msm/msm_ringbuffer.c
+++ b/freedreno/msm/msm_ringbuffer.c
@@ -26,10 +26,6 @@ 
  *    Rob Clark <robclark@freedesktop.org>
  */
 
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
 #include <assert.h>
 #include <inttypes.h>
 
diff --git a/intel/intel_bufmgr.c b/intel/intel_bufmgr.c
index a285340039fe2370e053..bede0a21d12dce4d329e 100644
--- a/intel/intel_bufmgr.c
+++ b/intel/intel_bufmgr.c
@@ -25,10 +25,6 @@ 
  *
  */
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
 #include <string.h>
 #include <stdlib.h>
 #include <stdint.h>
diff --git a/intel/intel_bufmgr_fake.c b/intel/intel_bufmgr_fake.c
index 641df6a1e5bd6f46a343..3b24b81bb30403c37194 100644
--- a/intel/intel_bufmgr_fake.c
+++ b/intel/intel_bufmgr_fake.c
@@ -34,10 +34,6 @@ 
  * the bugs in the old texture manager.
  */
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
 #include <stdlib.h>
 #include <string.h>
 #include <assert.h>
diff --git a/intel/intel_bufmgr_gem.c b/intel/intel_bufmgr_gem.c
index 386da30e230627242be2..5c47a46f71d4ddc034bf 100644
--- a/intel/intel_bufmgr_gem.c
+++ b/intel/intel_bufmgr_gem.c
@@ -34,10 +34,6 @@ 
  *	    Dave Airlie <airlied@linux.ie>
  */
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
 #include <xf86drm.h>
 #include <xf86atomic.h>
 #include <fcntl.h>
diff --git a/intel/intel_decode.c b/intel/intel_decode.c
index 3a81500f745a6a5b5556..bc7b04b811132684fac4 100644
--- a/intel/intel_decode.c
+++ b/intel/intel_decode.c
@@ -21,10 +21,6 @@ 
  * IN THE SOFTWARE.
  */
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
 #include <assert.h>
 #include <stdint.h>
 #include <stdlib.h>
diff --git a/intel/mm.c b/intel/mm.c
index 954e9dcb1603f7cba53e..79d8719dbba881c83102 100644
--- a/intel/mm.c
+++ b/intel/mm.c
@@ -22,10 +22,6 @@ 
  *
  */
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
 #include <stdlib.h>
 #include <assert.h>
 
diff --git a/intel/mm.h b/intel/mm.h
index 8d83743fd1cb3ea532aa..1b0f84fcc4bd6011db2c 100644
--- a/intel/mm.h
+++ b/intel/mm.h
@@ -29,10 +29,6 @@ 
 #ifndef MM_H
 #define MM_H
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
 #include "libdrm_macros.h"
 
 struct mem_block {
diff --git a/intel/test_decode.c b/intel/test_decode.c
index 68f777b0d4d8e913eede..b9f5b92791d5ff0c8052 100644
--- a/intel/test_decode.c
+++ b/intel/test_decode.c
@@ -21,10 +21,6 @@ 
  * IN THE SOFTWARE.
  */
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
 #include <string.h>
 #include <stdlib.h>
 #include <stdio.h>
diff --git a/libkms/api.c b/libkms/api.c
index 354d8a2ebe0541695ffe..22dd32d7897fa2053de5 100644
--- a/libkms/api.c
+++ b/libkms/api.c
@@ -26,10 +26,6 @@ 
  **************************************************************************/
 
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
 #include <errno.h>
 #include <stdlib.h>
 #include <string.h>
diff --git a/libkms/dumb.c b/libkms/dumb.c
index b95a072c13dd26cc46f9..17efc10a904c3641bfb6 100644
--- a/libkms/dumb.c
+++ b/libkms/dumb.c
@@ -26,10 +26,6 @@ 
  **************************************************************************/
 
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
 #include <errno.h>
 #include <stdio.h>
 #include <stdlib.h>
diff --git a/libkms/exynos.c b/libkms/exynos.c
index c20b6b05dd327595a0e3..ef64a668b4eb51c69a25 100644
--- a/libkms/exynos.c
+++ b/libkms/exynos.c
@@ -25,10 +25,6 @@ 
  * SOFTWARE.
  */
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
 #include <errno.h>
 #include <stdio.h>
 #include <stdlib.h>
diff --git a/libkms/intel.c b/libkms/intel.c
index 3d8ca055f2790e9032c4..859e7a0f15c6eac932a6 100644
--- a/libkms/intel.c
+++ b/libkms/intel.c
@@ -26,10 +26,6 @@ 
  **************************************************************************/
 
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
 #include <errno.h>
 #include <stdio.h>
 #include <stdlib.h>
diff --git a/libkms/internal.h b/libkms/internal.h
index 905f5b1705f9416a886c..8b386db62c2e19d47eb0 100644
--- a/libkms/internal.h
+++ b/libkms/internal.h
@@ -29,10 +29,6 @@ 
 #ifndef INTERNAL_H_
 #define INTERNAL_H_
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
 #include "libdrm_macros.h"
 #include "libkms.h"
 
diff --git a/libkms/linux.c b/libkms/linux.c
index 1431eb1078307ecebe54..56205054e67dae4a592e 100644
--- a/libkms/linux.c
+++ b/libkms/linux.c
@@ -29,10 +29,6 @@ 
  * going from fd to pci id via fstat and udev.
  */
 
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
 #include <errno.h>
 #include <stdio.h>
 #include <stdlib.h>
diff --git a/libkms/nouveau.c b/libkms/nouveau.c
index d10e0fdb056e9bdc7594..7fe23db3334d6a708121 100644
--- a/libkms/nouveau.c
+++ b/libkms/nouveau.c
@@ -26,10 +26,6 @@ 
  **************************************************************************/
 
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
 #include <errno.h>
 #include <stdio.h>
 #include <stdlib.h>
diff --git a/libkms/radeon.c b/libkms/radeon.c
index aaeeaf31dc26c4729f5c..2cb2b11fbbe834756795 100644
--- a/libkms/radeon.c
+++ b/libkms/radeon.c
@@ -26,10 +26,6 @@ 
  **************************************************************************/
 
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
 #include <errno.h>
 #include <stdio.h>
 #include <stdlib.h>
diff --git a/libkms/vmwgfx.c b/libkms/vmwgfx.c
index 6a24fd4dffa64eb80008..f0e40be756c29151e382 100644
--- a/libkms/vmwgfx.c
+++ b/libkms/vmwgfx.c
@@ -26,10 +26,6 @@ 
  **************************************************************************/
 
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
 #include <errno.h>
 #include <stdlib.h>
 #include <string.h>
diff --git a/meson.build b/meson.build
index cef71d67720341a236d8..a19e600c7475b2578e2d 100644
--- a/meson.build
+++ b/meson.build
@@ -270,7 +270,7 @@  config_file = configure_file(
   configuration : config,
   output : 'config.h',
 )
-add_project_arguments('-DHAVE_CONFIG_H', language : 'c')
+add_project_arguments('-include', 'config.h', language : 'c')
 
 inc_root = include_directories('.')
 inc_drm = include_directories('include/drm')
diff --git a/nouveau/abi16.c b/nouveau/abi16.c
index ee38c0cb228826346bfb..ba2501ea3ca4264a7322 100644
--- a/nouveau/abi16.c
+++ b/nouveau/abi16.c
@@ -22,10 +22,6 @@ 
  * Authors: Ben Skeggs
  */
 
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
 #include <stdlib.h>
 #include <stdint.h>
 #include <stddef.h>
diff --git a/nouveau/bufctx.c b/nouveau/bufctx.c
index 4f76e5dff3506ee6055b..67b7570ef39bf8e0c91a 100644
--- a/nouveau/bufctx.c
+++ b/nouveau/bufctx.c
@@ -22,10 +22,6 @@ 
  * Authors: Ben Skeggs
  */
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <stdint.h>
diff --git a/nouveau/nouveau.c b/nouveau/nouveau.c
index e68de16fe42c1953e9c0..369b788f7b797b171a18 100644
--- a/nouveau/nouveau.c
+++ b/nouveau/nouveau.c
@@ -22,10 +22,6 @@ 
  * Authors: Ben Skeggs
  */
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <stdint.h>
diff --git a/nouveau/pushbuf.c b/nouveau/pushbuf.c
index 035e3019f2cd2387ae4e..445c966e43214ec787d8 100644
--- a/nouveau/pushbuf.c
+++ b/nouveau/pushbuf.c
@@ -22,10 +22,6 @@ 
  * Authors: Ben Skeggs
  */
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <stdint.h>
diff --git a/omap/omap_drm.c b/omap/omap_drm.c
index 08ba64eb694d7404095e..417d522c3f83908101bf 100644
--- a/omap/omap_drm.c
+++ b/omap/omap_drm.c
@@ -26,10 +26,6 @@ 
  *    Rob Clark <rob@ti.com>
  */
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
 #include <stdlib.h>
 #include <linux/stddef.h>
 #include <linux/types.h>
diff --git a/radeon/radeon_bo.c b/radeon/radeon_bo.c
index 447f92803418feff2200..821807bcc31d15b56db3 100644
--- a/radeon/radeon_bo.c
+++ b/radeon/radeon_bo.c
@@ -29,9 +29,6 @@ 
  *      Dave Airlie
  *      Jérôme Glisse <glisse@freedesktop.org>
  */
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
 #include <libdrm_macros.h>
 #include <radeon_bo.h>
 #include <radeon_bo_int.h>
diff --git a/radeon/radeon_bo_gem.c b/radeon/radeon_bo_gem.c
index fbd453d9c7e4e98d64fd..774b26e41d711168735c 100644
--- a/radeon/radeon_bo_gem.c
+++ b/radeon/radeon_bo_gem.c
@@ -29,9 +29,6 @@ 
  *      Dave Airlie
  *      Jérôme Glisse <glisse@freedesktop.org>
  */
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
 #include <stdio.h>
 #include <stdint.h>
 #include <stdlib.h>
diff --git a/radeon/radeon_cs.c b/radeon/radeon_cs.c
index dffb869faa1a457d578b..eb7859e5043cba2c5d68 100644
--- a/radeon/radeon_cs.c
+++ b/radeon/radeon_cs.c
@@ -1,6 +1,3 @@ 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
 #include "libdrm_macros.h"
 #include <stdio.h>
 #include "radeon_cs.h"
diff --git a/radeon/radeon_cs_gem.c b/radeon/radeon_cs_gem.c
index f3dccb6c2c7522949919..4d5fc13ad273c43834e3 100644
--- a/radeon/radeon_cs_gem.c
+++ b/radeon/radeon_cs_gem.c
@@ -29,9 +29,6 @@ 
  *      Nicolai Haehnle <prefect_@gmx.net>
  *      Jérôme Glisse <glisse@freedesktop.org>
  */
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
 #include <assert.h>
 #include <errno.h>
 #include <stdlib.h>
diff --git a/radeon/radeon_cs_space.c b/radeon/radeon_cs_space.c
index 69287be5bc89f815eb6e..8531c345a3f7012af0b7 100644
--- a/radeon/radeon_cs_space.c
+++ b/radeon/radeon_cs_space.c
@@ -25,9 +25,6 @@ 
  */
 /*
  */
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
 #include <assert.h>
 #include <errno.h>
 #include <stdlib.h>
diff --git a/radeon/radeon_surface.c b/radeon/radeon_surface.c
index 04df77d633c8694ae079..3cafcfcbad428d1e69fb 100644
--- a/radeon/radeon_surface.c
+++ b/radeon/radeon_surface.c
@@ -26,9 +26,6 @@ 
  * Authors:
  *      Jérôme Glisse <jglisse@redhat.com>
  */
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
 #include <stdbool.h>
 #include <assert.h>
 #include <errno.h>
diff --git a/tegra/tegra.c b/tegra/tegra.c
index f7dc89ad0980f1c978a6..1d7268e5c26aa42df0b2 100644
--- a/tegra/tegra.c
+++ b/tegra/tegra.c
@@ -22,10 +22,6 @@ 
  * OTHER DEALINGS IN THE SOFTWARE.
  */
 
-#ifdef HAVE_CONFIG_H
-#  include "config.h"
-#endif
-
 #include <errno.h>
 #include <fcntl.h>
 #include <string.h>
diff --git a/tests/amdgpu/amdgpu_test.c b/tests/amdgpu/amdgpu_test.c
index 4f766aafa0f2d33ecec0..68b2f886809f55461f37 100644
--- a/tests/amdgpu/amdgpu_test.c
+++ b/tests/amdgpu/amdgpu_test.c
@@ -21,10 +21,6 @@ 
  *
 */
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
 #include <string.h>
 #include <stdio.h>
 #include <stdlib.h>
diff --git a/tests/amdgpu/basic_tests.c b/tests/amdgpu/basic_tests.c
index 354b015758559c164415..ab9a2ea185c8383d12b5 100644
--- a/tests/amdgpu/basic_tests.c
+++ b/tests/amdgpu/basic_tests.c
@@ -21,10 +21,6 @@ 
  *
 */
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
diff --git a/tests/amdgpu/bo_tests.c b/tests/amdgpu/bo_tests.c
index 24698bcb047b1a32006a..9d4da4af552e739eeaca 100644
--- a/tests/amdgpu/bo_tests.c
+++ b/tests/amdgpu/bo_tests.c
@@ -21,10 +21,6 @@ 
  *
 */
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
 #include <stdio.h>
 
 #include "CUnit/Basic.h"
diff --git a/tests/amdgpu/cs_tests.c b/tests/amdgpu/cs_tests.c
index 40700f53d35f3340b895..068de87eb9165421b8be 100644
--- a/tests/amdgpu/cs_tests.c
+++ b/tests/amdgpu/cs_tests.c
@@ -21,10 +21,6 @@ 
  *
 */
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
 #include <stdio.h>
 
 #include "CUnit/Basic.h"
diff --git a/tests/amdgpu/deadlock_tests.c b/tests/amdgpu/deadlock_tests.c
index 96c99c96551b16c772f3..1eb5761a049784fb04a4 100644
--- a/tests/amdgpu/deadlock_tests.c
+++ b/tests/amdgpu/deadlock_tests.c
@@ -21,10 +21,6 @@ 
  *
 */
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
diff --git a/tests/amdgpu/uvd_enc_tests.c b/tests/amdgpu/uvd_enc_tests.c
index c1b840e3e56d83d0a3af..f3a0010570e072b23747 100644
--- a/tests/amdgpu/uvd_enc_tests.c
+++ b/tests/amdgpu/uvd_enc_tests.c
@@ -21,10 +21,6 @@ 
  *
 */
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
 #include <stdio.h>
 #include <inttypes.h>
 
diff --git a/tests/amdgpu/vce_tests.c b/tests/amdgpu/vce_tests.c
index 6da6511793a1cf0ab488..e63e81de822d2dad2d96 100644
--- a/tests/amdgpu/vce_tests.c
+++ b/tests/amdgpu/vce_tests.c
@@ -21,10 +21,6 @@ 
  *
 */
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
 #include <stdio.h>
 #include <inttypes.h>
 
diff --git a/tests/amdgpu/vcn_tests.c b/tests/amdgpu/vcn_tests.c
index b228db609f0e0c0fefdd..82805e1eb5392de3e1ec 100644
--- a/tests/amdgpu/vcn_tests.c
+++ b/tests/amdgpu/vcn_tests.c
@@ -21,10 +21,6 @@ 
  *
 */
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
 #include <stdio.h>
 #include <inttypes.h>
 
diff --git a/tests/etnaviv/etnaviv_2d_test.c b/tests/etnaviv/etnaviv_2d_test.c
index 10751c730ae5d96e2af0..8dd77b666a18c24b6d6a 100644
--- a/tests/etnaviv/etnaviv_2d_test.c
+++ b/tests/etnaviv/etnaviv_2d_test.c
@@ -24,10 +24,6 @@ 
  *    Christian Gmeiner <christian.gmeiner@gmail.com>
  */
 
-#ifdef HAVE_CONFIG_H
-#  include "config.h"
-#endif
-
 #include <fcntl.h>
 #include <stdio.h>
 #include <string.h>
diff --git a/tests/etnaviv/etnaviv_bo_cache_test.c b/tests/etnaviv/etnaviv_bo_cache_test.c
index fb01f8d37b647de4b8d1..7fb062930c21d29b010a 100644
--- a/tests/etnaviv/etnaviv_bo_cache_test.c
+++ b/tests/etnaviv/etnaviv_bo_cache_test.c
@@ -24,10 +24,6 @@ 
  *    Christian Gmeiner <christian.gmeiner@gmail.com>
  */
 
-#ifdef HAVE_CONFIG_H
-#  include "config.h"
-#endif
-
 #undef NDEBUG
 #include <assert.h>
 
diff --git a/tests/exynos/exynos_fimg2d_test.c b/tests/exynos/exynos_fimg2d_test.c
index dcb2e35ab3c5a15b3dd7..99bb9233a11eab185715 100644
--- a/tests/exynos/exynos_fimg2d_test.c
+++ b/tests/exynos/exynos_fimg2d_test.c
@@ -23,10 +23,6 @@ 
  * OTHER DEALINGS IN THE SOFTWARE.
  */
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
diff --git a/tests/kms/kms-steal-crtc.c b/tests/kms/kms-steal-crtc.c
index 4b830d27a1bfb412ded0..cd40758db92ad2f2e86d 100644
--- a/tests/kms/kms-steal-crtc.c
+++ b/tests/kms/kms-steal-crtc.c
@@ -21,10 +21,6 @@ 
  * IN THE SOFTWARE.
  */
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
 #include <errno.h>
 #include <fcntl.h>
 #include <signal.h>
diff --git a/tests/kms/kms-universal-planes.c b/tests/kms/kms-universal-planes.c
index 89057bb50aea136cefdb..2163c987cabb4fc9e0d7 100644
--- a/tests/kms/kms-universal-planes.c
+++ b/tests/kms/kms-universal-planes.c
@@ -21,10 +21,6 @@ 
  * IN THE SOFTWARE.
  */
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
 #include <fcntl.h>
 #include <getopt.h>
 #include <stdbool.h>
diff --git a/tests/kms/libkms-test-crtc.c b/tests/kms/libkms-test-crtc.c
index 3adb4903919f5a380666..2c28face0687daa435fc 100644
--- a/tests/kms/libkms-test-crtc.c
+++ b/tests/kms/libkms-test-crtc.c
@@ -21,10 +21,6 @@ 
  * IN THE SOFTWARE.
  */
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
 #include "libkms-test.h"
 
 struct kms_crtc *kms_crtc_create(struct kms_device *device, uint32_t id)
diff --git a/tests/kms/libkms-test-device.c b/tests/kms/libkms-test-device.c
index 53c7349b89ab45d2656f..37f26d99a5b0949ccdfa 100644
--- a/tests/kms/libkms-test-device.c
+++ b/tests/kms/libkms-test-device.c
@@ -21,10 +21,6 @@ 
  * IN THE SOFTWARE.
  */
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
 #include <stdio.h>
 #include <string.h>
 #include <unistd.h>
diff --git a/tests/kms/libkms-test-framebuffer.c b/tests/kms/libkms-test-framebuffer.c
index c9e5ad3c250d8c980cdc..9bb2d95b69f58836ed4a 100644
--- a/tests/kms/libkms-test-framebuffer.c
+++ b/tests/kms/libkms-test-framebuffer.c
@@ -21,10 +21,6 @@ 
  * IN THE SOFTWARE.
  */
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
 #include <errno.h>
 #include <string.h>
 
diff --git a/tests/kms/libkms-test-plane.c b/tests/kms/libkms-test-plane.c
index 8eb78af1dcc7db631bbd..6c40a3c9e41764c84443 100644
--- a/tests/kms/libkms-test-plane.c
+++ b/tests/kms/libkms-test-plane.c
@@ -21,10 +21,6 @@ 
  * IN THE SOFTWARE.
  */
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
 #include <errno.h>
 #include <string.h>
 
diff --git a/tests/kms/libkms-test-screen.c b/tests/kms/libkms-test-screen.c
index 33690222809044c07aa4..bbe972a0bc6552b16270 100644
--- a/tests/kms/libkms-test-screen.c
+++ b/tests/kms/libkms-test-screen.c
@@ -21,10 +21,6 @@ 
  * IN THE SOFTWARE.
  */
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
 #include <errno.h>
 #include <string.h>
 
diff --git a/tests/modetest/buffers.c b/tests/modetest/buffers.c
index 4fd310b9b00b2c676ffb..9b635c0cedc3d1944d22 100644
--- a/tests/modetest/buffers.c
+++ b/tests/modetest/buffers.c
@@ -24,10 +24,6 @@ 
  * IN THE SOFTWARE.
  */
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
 #include <assert.h>
 #include <errno.h>
 #include <stdio.h>
diff --git a/tests/modetest/cursor.c b/tests/modetest/cursor.c
index 6de82a4a719f8f73a7e4..829bced18119650352ad 100644
--- a/tests/modetest/cursor.c
+++ b/tests/modetest/cursor.c
@@ -22,10 +22,6 @@ 
  * IN THE SOFTWARE.
  */
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
 #include <assert.h>
 #include <errno.h>
 #include <stdio.h>
diff --git a/tests/modetest/modetest.c b/tests/modetest/modetest.c
index 0773bd0228960ca6ee9d..f964e23755a2e1adf900 100644
--- a/tests/modetest/modetest.c
+++ b/tests/modetest/modetest.c
@@ -38,10 +38,6 @@ 
  *       the mode has been programmed, along with possible test patterns.
  */
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
 #include <assert.h>
 #include <ctype.h>
 #include <stdbool.h>
diff --git a/tests/nouveau/threaded.c b/tests/nouveau/threaded.c
index 281af4605bb58366e342..3669bcd32666f77b3b16 100644
--- a/tests/nouveau/threaded.c
+++ b/tests/nouveau/threaded.c
@@ -20,10 +20,6 @@ 
  * OTHER DEALINGS IN THE SOFTWARE.
  */
 
-#ifdef HAVE_CONFIG_H
-#  include "config.h"
-#endif
-
 #include <sys/ioctl.h>
 #include <dlfcn.h>
 #include <fcntl.h>
diff --git a/tests/tegra/openclose.c b/tests/tegra/openclose.c
index 881d8aa47cec89446243..f80f52d477ee48e9a9c6 100644
--- a/tests/tegra/openclose.c
+++ b/tests/tegra/openclose.c
@@ -20,10 +20,6 @@ 
  * OTHER DEALINGS IN THE SOFTWARE.
  */
 
-#ifdef HAVE_CONFIG_H
-#  include "config.h"
-#endif
-
 #include <fcntl.h>
 #include <stdio.h>
 #include <unistd.h>
diff --git a/tests/util/format.c b/tests/util/format.c
index 043cfe7f1eaf140deeca..15ac5e1e29e351fb81c6 100644
--- a/tests/util/format.c
+++ b/tests/util/format.c
@@ -23,10 +23,6 @@ 
  * IN THE SOFTWARE.
  */
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
 #include <stdint.h>
 #include <stdlib.h>
 #include <string.h>
diff --git a/tests/util/kms.c b/tests/util/kms.c
index 028cc8d956df196544ba..8b3e7878c4c0a1b98f82 100644
--- a/tests/util/kms.c
+++ b/tests/util/kms.c
@@ -37,10 +37,6 @@ 
  *       the mode has been programmed, along with possible test patterns.
  */
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
 #include <errno.h>
 #include <stdint.h>
 #include <stdio.h>
diff --git a/tests/util/pattern.c b/tests/util/pattern.c
index 75a458d4b7ce78204991..9fa0a417b0a6aec11f29 100644
--- a/tests/util/pattern.c
+++ b/tests/util/pattern.c
@@ -23,10 +23,6 @@ 
  * IN THE SOFTWARE.
  */
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
 #include <stdint.h>
 #include <stdio.h>
 #include <stdlib.h>
diff --git a/tests/vbltest/vbltest.c b/tests/vbltest/vbltest.c
index 3f6b803a743ca753ca06..48708d2012a4e1f117d5 100644
--- a/tests/vbltest/vbltest.c
+++ b/tests/vbltest/vbltest.c
@@ -24,10 +24,6 @@ 
  * IN THE SOFTWARE.
  */
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
 #include <assert.h>
 #include <stdio.h>
 #include <stdlib.h>
diff --git a/xf86atomic.h b/xf86atomic.h
index 70e918663c3b015f2881..2d733bd53eea3868259c 100644
--- a/xf86atomic.h
+++ b/xf86atomic.h
@@ -34,10 +34,6 @@ 
 #ifndef LIBDRM_ATOMICS_H
 #define LIBDRM_ATOMICS_H
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
 #if HAVE_LIBDRM_ATOMIC_PRIMITIVES
 
 #define HAS_ATOMIC_OPS 1
diff --git a/xf86drm.c b/xf86drm.c
index 74b4e230a7cb137df621..efa326b2deadb66d0762 100644
--- a/xf86drm.c
+++ b/xf86drm.c
@@ -31,9 +31,6 @@ 
  * DEALINGS IN THE SOFTWARE.
  */
 
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
 #include <stdio.h>
 #include <stdlib.h>
 #include <stdbool.h>
diff --git a/xf86drmMode.c b/xf86drmMode.c
index 15957ffcba1601e40290..e7074857e28d804ed3c6 100644
--- a/xf86drmMode.c
+++ b/xf86drmMode.c
@@ -38,10 +38,6 @@ 
  * platforms find which headers to include to get uint32_t
  */
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
 #include <limits.h>
 #include <stdint.h>
 #include <stdlib.h>