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/libmctp.h b/libmctp.h
index 5c0c9f4..e3a125c 100644
--- a/libmctp.h
+++ b/libmctp.h
@@ -7,6 +7,7 @@
extern "C" {
#endif
+#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stddef.h>
@@ -102,6 +103,11 @@
void (*free)(void *),
void *(realloc)(void *, size_t));
+/* environment-specific logging */
+void mctp_set_log_stdio(int level);
+void mctp_set_log_syslog(void);
+void mctp_set_log_custom(void (*fn)(int, const char *, va_list));
+
#ifdef __cplusplus
}