firmware_handler: add fake sdbusplus if not found
If HAVE_SDBUSPLUS is set, use the real header, otherwise define a fake
sdbusplus/bus/bus object.
Change-Id: I70e343dd726c2eaf0f03c0ab96898686161ade27
Signed-off-by: Patrick Venture <venture@google.com>
diff --git a/configure.ac b/configure.ac
index b722ec1..78c9887 100644
--- a/configure.ac
+++ b/configure.ac
@@ -24,7 +24,7 @@
PKG_CHECK_MODULES(
[SDBUSPLUS],
[sdbusplus],
- [],
+ [AC_DEFINE(HAVE_SDBUSPLUS, [1], [Found openbmc/sdbusplus package])],
[AC_MSG_ERROR([The openbmc/sdbusplus package is required])]
)
PKG_CHECK_MODULES(
diff --git a/firmware_handler.hpp b/firmware_handler.hpp
index 728fdca..212e570 100644
--- a/firmware_handler.hpp
+++ b/firmware_handler.hpp
@@ -1,5 +1,7 @@
#pragma once
+#include "config.h"
+
#include "data_handler.hpp"
#include "image_handler.hpp"
@@ -7,7 +9,19 @@
#include <cstdint>
#include <map>
#include <memory>
+#if HAVE_SDBUSPLUS
#include <sdbusplus/bus.hpp>
+#else
+namespace sdbusplus
+{
+namespace bus
+{
+class bus
+{
+};
+} // namespace bus
+} // namespace sdbusplus
+#endif
#include <string>
#include <vector>