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/Makefile.am b/Makefile.am
index 1f3cd2a..b14f3d2 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,11 +1,8 @@
ACLOCAL_AMFLAGS = -I m4
-# standalone compilation uses stdio
-libmctp_la_CPPFLAGS = -DMCTP_LOG_STDERR -DMCTP_FILEIO
-
lib_LTLIBRARIES = libmctp.la
-libmctp_la_SOURCES = core.c alloc.c \
- libmctp.h libmctp-alloc.h
+libmctp_la_SOURCES = core.c alloc.c log.c \
+ libmctp.h libmctp-alloc.h libmctp-log.h
if LIBMCTP_BINDING_serial
libmctp_la_SOURCES += serial.c libmctp-serial.h