Rework conditional feature usage
Currently, the infrastructure that we have to enable a flexible
compilation environment has a few issues:
- the allocator configuration is performed at run-time, while the log
configuration is performed at compile-time
- for a standard compile (ie, standard userspace, using
autoconf+automake to build), we need a few pre-defined configuration
options.
This change adds a bit of runtime selection to the logging
infrastructure, to match the allocator setup. We also unify the
compile-time defines into config.h, using MCTP_-prefixed macro names,
allowing integration into other build systems.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
diff --git a/alloc.c b/alloc.c
index db16d84..1e7da5a 100644
--- a/alloc.c
+++ b/alloc.c
@@ -5,12 +5,16 @@
#include "libmctp.h"
#include "libmctp-alloc.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
struct {
void *(*m_alloc)(size_t);
void (*m_free)(void *);
void *(*m_realloc)(void *, size_t);
} alloc_ops = {
-#ifndef MCTP_NO_DEFAULT_ALLOC
+#ifdef MCTP_DEFAULT_ALLOC
malloc,
free,
realloc,