build/core: Add 'nolog' build option to omit logging entirely

This can be used to avoid dereferencing the global `log_type`
which may be inaccessible on platforms with memory protection.

Change-Id: Ib48468018e3afaf05978018199a9a2022cb49fdf
Signed-off-by: Matt Johnston <matt@codeconstruct.com.au>
diff --git a/meson.build b/meson.build
index 7f44a46..ab16cab 100644
--- a/meson.build
+++ b/meson.build
@@ -14,7 +14,6 @@
 sources = [
      'core.c',
      'alloc.c',
-     'log.c',
 ]
 
 headers = [
@@ -68,6 +67,12 @@
     add_project_arguments('-DMCTP_CUSTOM_ALLOC', language : 'c')
 endif
 
+if get_option('nolog')
+    add_project_arguments('-DMCTP_NOLOG', language : 'c')
+else
+    libmctp_sources += ['log.c']
+endif
+
 feat_fileio = get_option('fileio').require(
     compiler.links('''
         #include <poll.h>