meson: Force inclusion of config.h via `-include`

Make sure there's no ambiguity about which config.h is used for includes
in the event that libpldm acquires subprojects, or is used as a
subproject itself.

Tested: `meson compile -C build` succeeds

Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Change-Id: I08c3bdc807cc268d2401e06f0bfaee07f89ba534
diff --git a/README.md b/README.md
index 91f9ace..1510b60 100644
--- a/README.md
+++ b/README.md
@@ -111,8 +111,8 @@
 
 ### Marking functions as testing, stable or deprecated
 
-Three macros are provided through `config.h` to mark functions as testing,
-stable or deprecated:
+Three macros are provided through `config.h` (automatically included for all
+translation units) to mark functions as testing, stable or deprecated:
 
 1. `LIBPLDM_ABI_TESTING`
 2. `LIBPLDM_ABI_STABLE`
@@ -121,10 +121,6 @@
 These annotations go immediately before your function signature:
 
 ```c
-#include "config.h"
-
-...
-
 LIBPLDM_ABI_TESTING
 pldm_requester_rc_t pldm_transport_send_msg(struct pldm_transport *transport,
 					    pldm_tid_t tid,
diff --git a/include/libpldm/transport/af-mctp.h b/include/libpldm/transport/af-mctp.h
index 1fb0c9d..3908929 100644
--- a/include/libpldm/transport/af-mctp.h
+++ b/include/libpldm/transport/af-mctp.h
@@ -2,7 +2,6 @@
 #ifndef LIBPLDM_AF_MCTP_H
 #define LIBPLDM_AF_MCTP_H
 
-#include "config.h"
 #include "libpldm/base.h"
 #include "libpldm/pldm.h"
 
diff --git a/include/libpldm/transport/mctp-demux.h b/include/libpldm/transport/mctp-demux.h
index 48b85d4..78001a3 100644
--- a/include/libpldm/transport/mctp-demux.h
+++ b/include/libpldm/transport/mctp-demux.h
@@ -2,7 +2,6 @@
 #ifndef LIBPLDM_DEMUX_H
 #define LIBPLDM_DEMUX_H
 
-#include "config.h"
 #include "libpldm/base.h"
 #include "libpldm/pldm.h"
 
diff --git a/meson.build b/meson.build
index 0f8fa91..9e2096b 100644
--- a/meson.build
+++ b/meson.build
@@ -36,6 +36,12 @@
   conf.set('LIBPLDM_ABI_TESTING', '')
 endif
 
+config = configure_file(output: 'config.h',
+  configuration: conf
+)
+
+add_project_arguments('-include', '@0@'.format(config), language: 'c')
+
 libpldm_sources = files()
 subdir('src')
 
@@ -75,10 +81,6 @@
   version: meson.project_version(),
   libraries: libpldm)
 
-configure_file(output: 'config.h',
-  configuration: conf
-)
-
 if get_option('tests').enabled()
   subdir('tests')
 
diff --git a/src/base.c b/src/base.c
index f0bbe82..02dca1a 100644
--- a/src/base.c
+++ b/src/base.c
@@ -1,4 +1,3 @@
-#include "config.h"
 #include "base.h"
 #include "pldm_types.h"
 #include <endian.h>
diff --git a/src/bios.c b/src/bios.c
index d833293..45dc897 100644
--- a/src/bios.c
+++ b/src/bios.c
@@ -1,4 +1,3 @@
-#include "config.h"
 #include "bios.h"
 #include "base.h"
 #include "utils.h"
diff --git a/src/bios_table.c b/src/bios_table.c
index 945cdbe..a191a42 100644
--- a/src/bios_table.c
+++ b/src/bios_table.c
@@ -1,4 +1,3 @@
-#include "config.h"
 #include "bios_table.h"
 #include "base.h"
 #include "bios.h"
diff --git a/src/firmware_update.c b/src/firmware_update.c
index df58faa..3cab7d0 100644
--- a/src/firmware_update.c
+++ b/src/firmware_update.c
@@ -1,4 +1,3 @@
-#include "config.h"
 #include "firmware_update.h"
 #include "utils.h"
 #include <endian.h>
diff --git a/src/fru.c b/src/fru.c
index de66074..aeb7d50 100644
--- a/src/fru.c
+++ b/src/fru.c
@@ -1,5 +1,3 @@
-#include "config.h"
-
 #include <assert.h>
 #include <endian.h>
 #include <stdbool.h>
diff --git a/src/oem/ibm/file_io.c b/src/oem/ibm/file_io.c
index 01d3e43..05b81c6 100644
--- a/src/oem/ibm/file_io.c
+++ b/src/oem/ibm/file_io.c
@@ -1,4 +1,3 @@
-#include "config.h"
 #include "libpldm/file_io.h"
 #include "base.h"
 #include <endian.h>
diff --git a/src/oem/ibm/host.c b/src/oem/ibm/host.c
index d2c297a..04ba5f3 100644
--- a/src/oem/ibm/host.c
+++ b/src/oem/ibm/host.c
@@ -1,4 +1,3 @@
-#include "config.h"
 #include "base.h"
 #include <endian.h>
 #include <stdint.h>
diff --git a/src/oem/ibm/platform.c b/src/oem/ibm/platform.c
index ab18671..462f378 100644
--- a/src/oem/ibm/platform.c
+++ b/src/oem/ibm/platform.c
@@ -1,4 +1,3 @@
-#include "config.h"
 #include "libpldm/platform.h"
 #include "libpldm/platform_oem_ibm.h"
 #include <string.h>
diff --git a/src/pdr.c b/src/pdr.c
index 8a63e95..600f789 100644
--- a/src/pdr.c
+++ b/src/pdr.c
@@ -1,4 +1,3 @@
-#include "config.h"
 #include "pdr.h"
 #include "platform.h"
 #include <assert.h>
diff --git a/src/platform.c b/src/platform.c
index 775b181..8619772 100644
--- a/src/platform.c
+++ b/src/platform.c
@@ -1,4 +1,3 @@
-#include "config.h"
 #include "msgbuf/platform.h"
 #include "base.h"
 #include "msgbuf.h"
diff --git a/src/requester/instance-id.c b/src/requester/instance-id.c
index 10d5988..a079f7b 100644
--- a/src/requester/instance-id.c
+++ b/src/requester/instance-id.c
@@ -1,6 +1,5 @@
 // NOLINTNEXTLINE(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
 #define _GNU_SOURCE
-#include "config.h"
 #include "libpldm/instance-id.h"
 #include "libpldm/pldm.h"
 #include <errno.h>
diff --git a/src/requester/pldm.c b/src/requester/pldm.c
index 89fd188..78e1e52 100644
--- a/src/requester/pldm.c
+++ b/src/requester/pldm.c
@@ -1,4 +1,3 @@
-#include "config.h"
 #include "libpldm/requester/pldm.h"
 #include "base.h"
 #include "libpldm/transport.h"
diff --git a/src/transport/af-mctp.c b/src/transport/af-mctp.c
index 2ba854e..4766d14 100644
--- a/src/transport/af-mctp.c
+++ b/src/transport/af-mctp.c
@@ -1,4 +1,3 @@
-#include "config.h"
 #include "mctp-defines.h"
 #include "base.h"
 #include "container-of.h"
diff --git a/src/transport/mctp-demux.c b/src/transport/mctp-demux.c
index 2518d93..8988889 100644
--- a/src/transport/mctp-demux.c
+++ b/src/transport/mctp-demux.c
@@ -1,4 +1,3 @@
-#include "config.h"
 #include "mctp-defines.h"
 #include "base.h"
 #include "container-of.h"
diff --git a/src/transport/transport.c b/src/transport/transport.c
index 1219147..21fb878 100644
--- a/src/transport/transport.c
+++ b/src/transport/transport.c
@@ -1,4 +1,3 @@
-#include "config.h"
 #include "libpldm/transport.h"
 #include "base.h"
 #include "libpldm/requester/pldm.h"
diff --git a/src/utils.c b/src/utils.c
index 5547002..2f46b75 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -1,4 +1,3 @@
-#include "config.h"
 #include "utils.h"
 #include "base.h"
 #include <limits.h>