meson support: configuration option removal

D-Bus names and paths that were previously configurable at build-time
are now hard-coded and moved to dbus_paths.hpp to reduce the number of
configure-time options and simplify maintenance.

Signed-off-by: Mike Capps <mikepcapps@gmail.com>
Change-Id: I16d88daad90e747cc40d87c853874b1a5fedf5fa
diff --git a/README.md b/README.md
index 9c23c26..c6a29c4 100755
--- a/README.md
+++ b/README.md
@@ -24,36 +24,36 @@
 
 The following applications are built by default:
 * [Fan Control](#fan-control)
-  * To disable from building, provide the `--disable-control` flag at
-  *configure* time:
+  * To disable from building, set the `-Dcontrol-service` flag to disabled
+  at *configure* time:
   ```
-  meson build -Ddisable-control
+  meson build -Dcontrol-service=disabled
   ```
 * [Fan Presence Detection](#fan-presence-detection)
-  * To disable from building, provide the `-Ddisable-presence` flag at
-  *configure* time:
+  * To disable from building, set the `-Dpresence-service` flag to disabled
+  at *configure* time:
   ```
-  meson build -Ddisable-presence
+  meson build -Dpresence-service=disabled
   ```
 * [Fan Monitoring](#fan-monitoring)
-  * To disable from building, provide the `-Ddisable-monitor` flag at
-  *configure* time:
+  * To disable from building, set the `-Dmonitor-service` flag to disabled
+  at *configure* time:
   ```
-  meson build -Ddisable-monitor
+  meson build -Dmonitor-service=disabled
   ```
 * [Cooling Type](#cooling-type)
-  * To disable from building, provide the `-Ddisable-cooling-type` flag at
+  * To enable it, set the `-Dcooling-type-service` flag to enabled at
   *configure* time:
   ```
-  meson build -Ddisable-cooling-type
+  meson build -cooling-type-service=enabled
   ```
 
 The following applications must be enabled at *configure* time to be built:
 * [Sensor Monitoring](#sensor-monitoring)
-  * To enable building this, provide the `--enable-sensor-monitor` flag at
+  * To enable building this, set the `--sensor-monitor-service` flag to enabled
   *configure* time:
   ```
-  meson build -Denable-sensor-monitor
+  meson build -Dsensor-monitor-service=enabled
   ```
 
 To clean the repository run `./bootstrap.sh clean`.
diff --git a/configure.ac b/configure.ac
index 4a1e6f7..8b8caad 100644
--- a/configure.ac
+++ b/configure.ac
@@ -150,19 +150,6 @@
 ])
 
 AS_IF([test "x$enable_control" != "xno"], [
-    # Add fan control Dbus attributes
-    AC_ARG_VAR(CONTROL_BUSNAME, [The fan control busname to own])
-    AS_IF([test "x$CONTROL_BUSNAME" == "x"],
-          [CONTROL_BUSNAME="xyz.openbmc_project.Control.Thermal"])
-    AC_DEFINE_UNQUOTED([CONTROL_BUSNAME], ["$CONTROL_BUSNAME"],
-                       [The fan control busname to own])
-
-    AC_ARG_VAR(CONTROL_OBJPATH, [The fan control root object path])
-    AS_IF([test "x$CONTROL_OBJPATH" == "x"],
-          [CONTROL_OBJPATH="/xyz/openbmc_project/control/thermal"])
-    AC_DEFINE_UNQUOTED([CONTROL_OBJPATH], ["$CONTROL_OBJPATH"],
-                       [The fan control root object path])
-
     AC_ARG_VAR(CONTROL_PERSIST_ROOT_PATH, [Root path for persisting zone property states])
     AS_IF([test "x$CONTROL_PERSIST_ROOT_PATH" == "x"],
           [CONTROL_PERSIST_ROOT_PATH="/var/lib/phosphor-fan-presence/control"])
@@ -262,18 +249,6 @@
     AC_DEFINE_UNQUOTED([NUM_MONITOR_LOG_ENTRIES], [$NUM_MONITOR_LOG_ENTRIES],
                        [Maximum number of entries in the message log])
 
-    AC_ARG_VAR(THERMAL_ALERT_BUSNAME, [The thermal alert busname to own])
-    AS_IF([test "x$THERMAL_ALERT_BUSNAME" == "x"],
-          [THERMAL_ALERT_BUSNAME="xyz.openbmc_project.Thermal.Alert"])
-    AC_DEFINE_UNQUOTED([THERMAL_ALERT_BUSNAME], ["$THERMAL_ALERT_BUSNAME"],
-                       [The thermal alert busname to own])
-
-    AC_ARG_VAR(THERMAL_ALERT_OBJPATH, [The thermal alert D-Bus object path])
-    AS_IF([test "x$THERMAL_ALERT_OBJPATH" == "x"],
-          [THERMAL_ALERT_OBJPATH="/xyz/openbmc_project/alerts/thermal_fault_alert"])
-    AC_DEFINE_UNQUOTED([THERMAL_ALERT_OBJPATH], ["$THERMAL_ALERT_OBJPATH"],
-                       [The thermal alert D-Bus object path])
-
     AC_CONFIG_FILES([monitor/Makefile])
 ])
 
diff --git a/control/json/dbus_zone.cpp b/control/json/dbus_zone.cpp
index 9f8c77d..733fb94 100644
--- a/control/json/dbus_zone.cpp
+++ b/control/json/dbus_zone.cpp
@@ -17,6 +17,7 @@
 
 #include "dbus_zone.hpp"
 
+#include "dbus_paths.hpp"
 #include "sdbusplus.hpp"
 #include "zone.hpp"
 
diff --git a/control/json/manager.cpp b/control/json/manager.cpp
index 0b1c45f..a505fce 100644
--- a/control/json/manager.cpp
+++ b/control/json/manager.cpp
@@ -18,6 +18,7 @@
 #include "manager.hpp"
 
 #include "action.hpp"
+#include "dbus_paths.hpp"
 #include "event.hpp"
 #include "fan.hpp"
 #include "group.hpp"
diff --git a/control/main.cpp b/control/main.cpp
index 201f7b0..ae46caa 100644
--- a/control/main.cpp
+++ b/control/main.cpp
@@ -23,6 +23,7 @@
 #include "json/manager.hpp"
 #endif
 
+#include "dbus_paths.hpp"
 #include "sdbusplus.hpp"
 #include "sdeventplus.hpp"
 
diff --git a/control/manager.cpp b/control/manager.cpp
index e00f9b5..db8dbea 100644
--- a/control/manager.cpp
+++ b/control/manager.cpp
@@ -17,6 +17,7 @@
 
 #include "manager.hpp"
 
+#include "dbus_paths.hpp"
 #include "sdbusplus.hpp"
 #include "utility.hpp"
 
diff --git a/dbus_paths.hpp b/dbus_paths.hpp
new file mode 100644
index 0000000..4fb4bd4
--- /dev/null
+++ b/dbus_paths.hpp
@@ -0,0 +1,19 @@
+
+#pragma once
+
+// Global constants from Phosphor Fan Presence's D-Bus names and paths
+
+// Control Application's D-Bus busname to own
+static constexpr char CONTROL_BUSNAME[] = "xyz.openbmc_project.Control.Thermal";
+
+// Control Application's root D-Bus object path
+static constexpr char CONTROL_OBJPATH[] =
+    "/xyz/openbmc_project/control/thermal";
+
+// Thermal Application's D-Bus busname to own
+static constexpr char THERMAL_ALERT_BUSNAME[] =
+    "xyz.openbmc_project.Thermal.Alert";
+
+// Thermal Application's root D-Bus object path
+static constexpr char THERMAL_ALERT_OBJPATH[] =
+    "/xyz/openbmc_project/alerts/thermal_fault_alert";
diff --git a/meson.build b/meson.build
index 42d1eae..0258246 100644
--- a/meson.build
+++ b/meson.build
@@ -74,12 +74,7 @@
 conf.set_quoted(
     'CONTROL_PERSIST_ROOT_PATH', get_option('control-persist-root-path'))
 conf.set_quoted(
-    'CONTROL_BUSNAME', get_option('control-busname'))
-conf.set_quoted(
-    'CONTROL_OBJPATH', get_option('control-objpath'))
-conf.set_quoted(
     'CONTROL_PERSIST_ROOT_PATH', get_option('control-persist-root-path'))
-
 conf.set_quoted(
     'FAN_DEF_YAML_FILE', get_option('fan-def-yaml-file'))
 conf.set_quoted(
@@ -89,22 +84,18 @@
 conf.set_quoted(
     'ZONE_CONDITIONS_YAML_FILE', get_option('zone-conditions-yaml-file'))
 
-# Monitor
-conf.set(
-    'NUM_MONITOR_LOG_ENTRIES', get_option('num-monitor-log-entries'))
-conf.set_quoted(
-    'THERMAL_ALERT_BUSNAME', get_option('thermal-alert-busname'))
-conf.set_quoted(
-    'THERMAL_ALERT_OBJPATH', get_option('thermal-alert-objpath'))
-conf.set_quoted(
-    'FAN_MONITOR_YAML_FILE', get_option('fan-monitor-yaml-file'))
-
 # Fan control can be in YAML mode when everything else is in JSON mode
 control_conf_type = 'yaml'
 if get_option('json-config').enabled() and get_option('json-control').enabled()
     control_conf_type = 'json'
 endif
 
+# Monitor
+conf.set(
+    'NUM_MONITOR_LOG_ENTRIES', get_option('num-monitor-log-entries'))
+conf.set_quoted(
+    'FAN_MONITOR_YAML_FILE', get_option('fan-monitor-yaml-file'))
+
 # JSON-or-YAML (all programs)
 if get_option('json-config').enabled()
     conf.set('PRESENCE_USE_JSON', '')
@@ -121,23 +112,25 @@
     conf_type = 'yaml'
 endif
 
-conf.set(
-    'NUM_PRESENCE_LOG_ENTRIES', get_option('num-presence-log-entries'))
-conf.set_quoted(
-    'PRESENCE_YAML_FILE', get_option('presence-config'))
+# Sensor Monitor
+conf.set_quoted('SENSOR_MONITOR_PERSIST_ROOT_PATH',
+                get_option('sensor-monitor-persist-root-path'))
 
-# Sensor
 if get_option('enable-host-state').enabled()
     conf.set('ENABLE_HOST_STATE', '')
 endif
 
-conf.set_quoted(
-    'SENSOR_MONITOR_PERSIST_ROOT_PATH', get_option('sensor-monitor-root-path'))
 conf.set(
     'SHUTDOWN_ALARM_HARD_SHUTDOWN_DELAY_MS', get_option('sensor-monitor-hard-shutdown-delay'))
 conf.set(
     'SHUTDOWN_ALARM_SOFT_SHUTDOWN_DELAY_MS', get_option('sensor-monitor-soft-shutdown-delay'))
 
+# Presence
+conf.set(
+    'NUM_PRESENCE_LOG_ENTRIES', get_option('num-presence-log-entries'))
+conf.set_quoted(
+    'PRESENCE_YAML_FILE', get_option('presence-config'))
+
 configure_file(output: 'config.h', configuration: conf)
 
 # Service: [name,[svcfiles]]
diff --git a/meson_options.txt b/meson_options.txt
index 6687422..4dc768a 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -26,16 +26,6 @@
 )
 
 option(
-    'control-busname', type: 'string', value: 'xyz.openbmc_project.Control.Thermal',
-    description: 'Application\'s D-Bus busname to own.'
-)
-
-option(
-    'control-objpath', type: 'string', value: '/xyz/openbmc_project/control/thermal',
-    description: 'Application\'s root D-Bus object path.'
-)
-
-option(
     'control-persist-root-path', type: 'string', value: '/var/lib/phosphor-fan-presence/control',
     description: 'Base location to persist zone property states'
 )
@@ -74,16 +64,6 @@
     description: 'Maximum number of entries in the monitor log.'
 )
 
-option(
-    'thermal-alert-busname', type: 'string', value: 'xyz.openbmc_project.Thermal.Alert',
-    description: 'Application\'s D-Bus busname to own.'
-)
-
-option(
-    'thermal-alert-objpath', type: 'string', value: '/xyz/openbmc_project/alerts/thermal_fault_alert',
-    description: 'Application\'s root D-Bus object path.'
-)
-
 # Presence
 
 option(
@@ -109,8 +89,9 @@
 )
 
 option(
-    'sensor-monitor-root-path', type: 'string', value: '/xyz/openbmc_project/alerts/thermal_fault_alert',
-    description: 'Application\'s root D-Bus object path.'
+    'sensor-monitor-persist-root-path', type: 'string',
+    value: '/var/lib/phosphor-fan-presence/sensor-monitor',
+    description: 'Root path for persisting sensor monitor data.'
 )
 
 option(
diff --git a/monitor/main.cpp b/monitor/main.cpp
index 5ed0953..9ab6d15 100644
--- a/monitor/main.cpp
+++ b/monitor/main.cpp
@@ -20,6 +20,7 @@
 #endif
 #include "fan.hpp"
 #ifdef MONITOR_USE_JSON
+#include "dbus_paths.hpp"
 #include "json_config.hpp"
 #include "json_parser.hpp"
 #endif
diff --git a/monitor/system.cpp b/monitor/system.cpp
index 98dcb20..1dfb5a2 100644
--- a/monitor/system.cpp
+++ b/monitor/system.cpp
@@ -15,6 +15,7 @@
  */
 #include "system.hpp"
 
+#include "dbus_paths.hpp"
 #include "fan.hpp"
 #include "fan_defs.hpp"
 #include "tach_sensor.hpp"