build/core: Add MCTP_CUSTOM_ALLOC option

This avoids storing the allocator function pointers in mutable memory,
which is a problem when building on platforms with memory protection.
Instead the application/platform defines custom functions that are
linked with libmctp.

Change-Id: Icaf88968b50c88bbd2305d325f9530658465e21f
Signed-off-by: Matt Johnston <matt@codeconstruct.com.au>
diff --git a/meson.build b/meson.build
index d884c6a..7f44a46 100644
--- a/meson.build
+++ b/meson.build
@@ -53,7 +53,7 @@
 
 compiler = meson.get_compiler('c')
 
-if get_option('default_alloc').require(
+if not get_option('custom_alloc') and get_option('default_alloc').require(
     compiler.links('''
         #include <stdlib.h>
         void main()
@@ -64,6 +64,10 @@
     add_project_arguments('-DMCTP_DEFAULT_ALLOC', language : 'c')
 endif
 
+if get_option('custom_alloc')
+    add_project_arguments('-DMCTP_CUSTOM_ALLOC', language : 'c')
+endif
+
 feat_fileio = get_option('fileio').require(
     compiler.links('''
         #include <poll.h>