log: Allow disabling of stdio
Some firmwares (e.g. Hostboot) don't provide stdio.h. Make sure we can
compile in these environments.
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Change-Id: I3a5f414f12fbf9de70fb41033d610f81094848bf
diff --git a/log.c b/log.c
index 4df529b..cbdbbca 100644
--- a/log.c
+++ b/log.c
@@ -1,7 +1,6 @@
/* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */
#include <stdarg.h>
-#include <stdio.h>
#include "libmctp.h"
#include "libmctp-log.h"
@@ -10,6 +9,10 @@
#include "config.h"
#endif
+#ifdef MCTP_HAVE_STDIO
+#include <stdio.h>
+#endif
+
#ifdef MCTP_HAVE_SYSLOG
#include <syslog.h>
#endif
@@ -34,10 +37,12 @@
case MCTP_LOG_NONE:
break;
case MCTP_LOG_STDIO:
+#ifdef MCTP_HAVE_STDIO
if (level <= log_stdio_level) {
vfprintf(stderr, fmt, ap);
fputs("\n", stderr);
}
+#endif
break;
case MCTP_LOG_SYSLOG:
#ifdef MCTP_HAVE_SYSLOG