meson: add option for open-power functions

This repository has long had an open-power only function that ends
up compiled into all systems.  We cannot use the phosphor-logging
generated errors, unless we are able to disable this code on
non-open-power systems.  Add necessary meson options.

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: Icd5b2f4cdec206597029930790ef2b10170d232a
diff --git a/meson.build b/meson.build
index 4a4d01e..c043d79 100644
--- a/meson.build
+++ b/meson.build
@@ -40,6 +40,9 @@
 if get_option('shortname-replace-words').enabled()
   conf_data.set_quoted('SHORTNAME_REPLACE_WORDS', '1')
 endif
+if get_option('open-power').allowed()
+  conf_data.set_quoted('OPEN_POWER_SUPPORT', '1')
+endif
 
 matches_map = get_option('matches-map')
 conf_data.set('MAJOR_MATCH_INDEX', matches_map[0])
@@ -217,6 +220,11 @@
   storage_cmds_src = ['dbus-sdr/storagecommands.cpp', 'dbus-sdr/sdrutils.cpp']
 endif
 
+openpower_cmds_src = []
+if get_option('open-power').allowed()
+  openpower_cmds_src = [ 'storageaddsel.cpp' ]
+endif
+
 libipmi20_src = [
   'app/channel.cpp',
   'app/watchdog.cpp',
@@ -228,7 +236,6 @@
   'chassishandler.cpp',
   'dcmihandler.cpp',
   'ipmisensor.cpp',
-  'storageaddsel.cpp',
   'transporthandler.cpp',
   'globalhandler.cpp',
   'groupext.cpp',
@@ -240,6 +247,7 @@
   generated_src,
   transportoem_src,
   storage_cmds_src,
+  openpower_cmds_src,
   conf_h,
 ]
 
diff --git a/meson.options b/meson.options
index 2513c56..2553d89 100644
--- a/meson.options
+++ b/meson.options
@@ -78,4 +78,7 @@
 option('matches-map', type : 'array', value : ['1', '2', '0', '0', '0', '0'], description : 'An array of integers')
 
 # libipmi20.so library
-option('dynamic-storages-only', type: 'feature', value: 'disabled', description: 'Request to compile storage commands in the libipmi20 library')
\ No newline at end of file
+option('dynamic-storages-only', type: 'feature', value: 'disabled', description: 'Request to compile storage commands in the libipmi20 library')
+
+# open-power specific functionality.
+option('open-power', type: 'feature', description: 'Support open-power specific functions')
diff --git a/storagehandler.cpp b/storagehandler.cpp
index cf5ef5e..b9f654c 100644
--- a/storagehandler.cpp
+++ b/storagehandler.cpp
@@ -1,3 +1,5 @@
+#include "config.h"
+
 #include "storagehandler.hpp"
 
 #include "fruread.hpp"
@@ -710,12 +712,14 @@
                                       Created::EVENT_DIR(assert),
                                       Created::SENSOR_PATH(objpath.c_str()));
     }
+#ifdef OPEN_POWER_SUPPORT
     else if (recordType == procedureType)
     {
         // In the OEM record type 0xDE, byte 11 in the SEL record indicate the
         // procedure number.
         createProcedureLogEntry(sensorType);
     }
+#endif
 
     return ipmi::responseSuccess(recordID);
 }