Add initial code for IPMI SoftPowerOff functionality

This commit puts a skeleton layout for the IPMI Soft Power Off
functionality.

Change-Id: I7c3ededc9d4038e172d7f6230270ecfe397330e9
Signed-off-by: Vishwanatha Subbanna <vishwa@linux.vnet.ibm.com>
diff --git a/configure.ac b/configure.ac
index b43adaf..68e0dc9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -12,14 +12,30 @@
 AC_PROG_INSTALL
 AC_PROG_MAKE_SET
 
+# softoff dir specific ones
+AC_ARG_ENABLE([softoff],
+    AS_HELP_STRING([--enable-softoff], [Builds soft power off])
+)
+AS_IF([test "x$enable_softoff" != "xno"],
+    [AC_PROG_MKDIR_P]
+    [AC_CHECK_PROG([DIRNAME], dirname, dirname)]
+)
+
 # Checks for libraries.
 AC_CHECK_LIB([mapper], [mapper_get_service], ,[AC_MSG_ERROR([Could not find libmapper...openbmc/phosphor-objmgr package required])])
-PKG_CHECK_MODULES([SYSTEMD], [libsystemd >= 221])
+PKG_CHECK_MODULES([SYSTEMD], [libsystemd >= 221], [], [AC_MSG_ERROR(["systemd required and not found"])])
 PKG_CHECK_MODULES([PHOSPHOR_LOGGING], [phosphor-logging],, [AC_MSG_ERROR([Could not find phosphor-logging...openbmc/phosphor-logging package required])])
 PKG_CHECK_MODULES([PHOSPHOR_DBUS_INTERFACES], [phosphor-dbus-interfaces],, [AC_MSG_ERROR([Could not find phosphor-dbus-interfaces...openbmc/phosphor-dbus-interfaces package required])])
 
-# Checks for header files.
-AC_CHECK_HEADER(systemd/sd-bus.h, ,[AC_MSG_ERROR([Could not find systemd/sd-bus.h...systemd developement package required])])
+AS_IF([test "x$enable_softoff" != "xno"],
+    # Check for sdbusplus
+    PKG_CHECK_MODULES([SDBUSPLUS], [sdbusplus],, [AC_MSG_ERROR(["sdbusplus packaged required and not found"])])
+
+    # Check for sdbus++ tool
+    [AC_PATH_PROG([SDBUSPLUSPLUS], [sdbus++])]
+    AS_IF([test "x$SDBUSPLUSPLUS" == "x"],
+          AC_MSG_ERROR([Cannot find sdbus++]))
+)
 
 # Checks for typedefs, structures, and compiler characteristics.
 AX_CXX_COMPILE_STDCXX_14([noext])
@@ -61,6 +77,21 @@
 SENSORGEN="$PYTHON ${srcdir}/scripts/sensor_gen.py -i $SENSOR_YAML_GEN"
 AC_SUBST(SENSORGEN)
 
+# Soft Power off related.
+AS_IF([test "x$enable_softoff" != "xno"],
+    # Dbus service name
+    [AC_ARG_VAR(SOFTOFF_BUSNAME, [The Dbus busname to own])]
+    AS_IF([test "x$SOFTOFF_BUSNAME" == "x"],
+          [SOFTOFF_BUSNAME="xyz.openbmc_project.Ipmi.Internal.SoftPowerOff"])
+    [AC_DEFINE_UNQUOTED([SOFTOFF_BUSNAME], ["$SOFTOFF_BUSNAME"], [The Dbus busname to own])]
+
+    # Service dbus root
+    [AC_ARG_VAR(SOFTOFF_OBJPATH, [The SoftPowerOff Dbus root])]
+    AS_IF([test "x$SOFTOFF_OBJPATH" == "x"],
+          [SOFTOFF_OBJPATH="/xyz/openbmc_project/ipmi/internal/softpoweroff"])
+    [AC_DEFINE_UNQUOTED([SOFTOFF_OBJPATH], ["$SOFTOFF_OBJPATH"], [The SoftPowerOff Dbus root])]
+)
+
 # Create configured output
-AC_CONFIG_FILES([Makefile test/Makefile])
+AC_CONFIG_FILES([Makefile test/Makefile softoff/Makefile])
 AC_OUTPUT