Matthew Barth | ae0e96c | 2017-01-20 13:54:59 -0600 | [diff] [blame] | 1 | # Initialization |
| 2 | AC_PREREQ([2.69]) |
| 3 | AC_INIT([phosphor-fan-presence], [1.0], |
| 4 | [https://github.com/openbmc/phosphor-fan-presence/issues]) |
| 5 | AC_LANG([C++]) |
| 6 | AC_CONFIG_HEADERS([config.h]) |
| 7 | AM_INIT_AUTOMAKE([subdir-objects -Wall -Werror foreign dist-xz]) |
| 8 | AM_SILENT_RULES([yes]) |
| 9 | |
Lei YU | bd2e80a | 2018-09-19 11:17:09 +0800 | [diff] [blame] | 10 | # Use gcc-ar and gcc-ranlib for static libraries built with -flto |
| 11 | AC_SUBST([AR], [${ac_tool_prefix}gcc-ar]) |
| 12 | AC_SUBST([RANLIB], [${ac_tool_prefix}gcc-ranlib]) |
| 13 | |
Matthew Barth | ae0e96c | 2017-01-20 13:54:59 -0600 | [diff] [blame] | 14 | # Checks for programs. |
| 15 | AC_PROG_CXX |
| 16 | AM_PROG_AR |
| 17 | AC_PROG_INSTALL |
| 18 | AC_PROG_MAKE_SET |
Brad Bishop | 93919bb | 2017-04-22 14:58:29 -0400 | [diff] [blame] | 19 | |
Matthew Barth | 681c98d | 2017-02-17 16:05:57 -0600 | [diff] [blame] | 20 | # Python |
Matthew Barth | f24d774 | 2020-03-17 16:12:15 -0500 | [diff] [blame] | 21 | AM_PATH_PYTHON([3], [AC_SUBST([PYTHON], [echo "$PYTHON"])], |
| 22 | [AC_MSG_ERROR([Minimum python version(3) not found])]) |
Matthew Barth | ae0e96c | 2017-01-20 13:54:59 -0600 | [diff] [blame] | 23 | |
| 24 | # Checks for typedefs, structures, and compiler characteristics. |
Patrick Williams | a0594a0 | 2022-04-15 10:12:01 -0500 | [diff] [blame] | 25 | AX_CXX_COMPILE_STDCXX([20],[noext]) |
Matthew Barth | ae0e96c | 2017-01-20 13:54:59 -0600 | [diff] [blame] | 26 | AX_APPEND_COMPILE_FLAGS([-Wall -Werror], [CXXFLAGS]) |
| 27 | |
| 28 | # Checks for libraries. |
Patrick Venture | 4b258ac | 2019-02-13 14:48:21 -0800 | [diff] [blame] | 29 | PKG_CHECK_MODULES([SDBUSPLUS], [sdbusplus]) |
| 30 | PKG_CHECK_MODULES([SDEVENTPLUS], [sdeventplus]) |
| 31 | PKG_CHECK_MODULES([PHOSPHOR_LOGGING], [phosphor-logging]) |
| 32 | PKG_CHECK_MODULES([SYSTEMD], [libsystemd >= 221]) |
| 33 | PKG_CHECK_MODULES([PHOSPHOR_DBUS_INTERFACES], [phosphor-dbus-interfaces]) |
| 34 | PKG_CHECK_MODULES([LIBEVDEV], [libevdev]) |
Matthew Barth | f3e7047 | 2019-12-03 13:33:20 -0600 | [diff] [blame] | 35 | PKG_CHECK_MODULES([STDPLUS], [stdplus]) |
Matthew Barth | 1826c73 | 2020-08-28 08:40:59 -0500 | [diff] [blame] | 36 | PKG_CHECK_MODULES([FMT], [fmt]) |
Matthew Barth | 293477d | 2017-02-17 15:39:36 -0600 | [diff] [blame] | 37 | |
Matthew Barth | ae0e96c | 2017-01-20 13:54:59 -0600 | [diff] [blame] | 38 | # Checks for library functions. |
| 39 | LT_INIT # Required for systemd linking |
| 40 | |
Matt Spinler | 59c29c7 | 2017-04-27 11:17:28 -0500 | [diff] [blame] | 41 | # Check/set gtest specific functions. |
| 42 | AX_PTHREAD([GTEST_CPPFLAGS="-DGTEST_HAS_PTHREAD=1"],[GTEST_CPPFLAGS="-DGTEST_HAS_PTHREAD=0"]) |
| 43 | AC_SUBST(GTEST_CPPFLAGS) |
| 44 | AC_ARG_ENABLE([oe-sdk], |
| 45 | AS_HELP_STRING([--enable-oe-sdk], [Link testcases absolutely against OE SDK so they can be ran within it.]) |
| 46 | ) |
| 47 | AC_ARG_VAR(OECORE_TARGET_SYSROOT, |
| 48 | [Path to the OE SDK SYSROOT]) |
| 49 | AS_IF([test "x$enable_oe_sdk" == "xyes"], |
| 50 | AS_IF([test "x$OECORE_TARGET_SYSROOT" == "x"], |
| 51 | AC_MSG_ERROR([OECORE_TARGET_SYSROOT must be set with --enable-oe-sdk]) |
| 52 | ) |
| 53 | AC_MSG_NOTICE([Enabling OE-SDK at $OECORE_TARGET_SYSROOT]) |
| 54 | [ |
| 55 | testcase_flags="-Wl,-rpath,\${OECORE_TARGET_SYSROOT}/lib" |
| 56 | testcase_flags="${testcase_flags} -Wl,-rpath,\${OECORE_TARGET_SYSROOT}/usr/lib" |
| 57 | testcase_flags="${testcase_flags} -Wl,-dynamic-linker,`find \${OECORE_TARGET_SYSROOT}/lib/ld-*.so | sort -r -n | head -n1`" |
| 58 | ] |
| 59 | AC_SUBST([OESDK_TESTCASE_FLAGS], [$testcase_flags]) |
| 60 | ) |
| 61 | |
Matt Spinler | 00db950 | 2021-02-04 16:43:31 -0600 | [diff] [blame] | 62 | PKG_PROG_PKG_CONFIG |
| 63 | AC_ARG_WITH([systemdsystemunitdir], |
| 64 | [AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files])],, |
| 65 | [with_systemdsystemunitdir=auto]) |
| 66 | AS_IF([test "x$with_systemdsystemunitdir" = "xyes" -o "x$with_systemdsystemunitdir" = "xauto"], [ |
| 67 | def_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd) |
| 68 | |
| 69 | AS_IF([test "x$def_systemdsystemunitdir" = "x"], |
| 70 | [AS_IF([test "x$with_systemdsystemunitdir" = "xyes"], |
| 71 | [AC_MSG_ERROR([systemd support requested but pkg-config unable to query systemd package])]) |
| 72 | with_systemdsystemunitdir=no], |
| 73 | [with_systemdsystemunitdir="$def_systemdsystemunitdir"])]) |
| 74 | AS_IF([test "x$with_systemdsystemunitdir" != "xno"], |
| 75 | [AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])]) |
| 76 | |
Matthew Barth | cc19480 | 2020-01-09 13:55:34 -0600 | [diff] [blame] | 77 | AC_ARG_ENABLE([json], |
| 78 | AS_HELP_STRING([--enable-json], [Use json at runtime to configure fan packages.])) |
Brad Bishop | 93919bb | 2017-04-22 14:58:29 -0400 | [diff] [blame] | 79 | AC_ARG_ENABLE([presence], |
| 80 | AS_HELP_STRING([--disable-presence], [Disable fan presence package.])) |
| 81 | AC_ARG_ENABLE([control], |
| 82 | AS_HELP_STRING([--disable-control], [Disable fan control package.])) |
Matthew Barth | 8e1b382 | 2020-11-12 11:57:23 -0600 | [diff] [blame] | 83 | AC_ARG_ENABLE([json-control], |
| 84 | AS_HELP_STRING([--disable-json-control], [Disable the use of JSON to configure fan control in favor of YAML.])) |
Brandon Wyman | ca60e10 | 2017-03-29 17:06:02 -0500 | [diff] [blame] | 85 | AC_ARG_ENABLE([cooling-type], |
| 86 | AS_HELP_STRING([--disable-cooling-type], [Disable cooling-type package.])) |
Matt Spinler | af5d4c5 | 2017-05-16 10:38:43 -0500 | [diff] [blame] | 87 | AC_ARG_ENABLE([monitor], |
| 88 | AS_HELP_STRING([--disable-monitor], [Disable monitor])) |
Matt Spinler | 9c0715b | 2021-01-21 11:15:33 -0600 | [diff] [blame] | 89 | AC_ARG_ENABLE([sensor-monitor], |
| 90 | AS_HELP_STRING([--enable-sensor-monitor], [Enable sensor monitor])) |
Brad Bishop | 93919bb | 2017-04-22 14:58:29 -0400 | [diff] [blame] | 91 | |
Matthew Barth | cc19480 | 2020-01-09 13:55:34 -0600 | [diff] [blame] | 92 | AM_CONDITIONAL([WANT_JSON], [test "x$enable_json" == "xyes"]) |
Matthew Barth | 8e1b382 | 2020-11-12 11:57:23 -0600 | [diff] [blame] | 93 | AM_CONDITIONAL([WANT_JSON_CONTROL], [test "x$enable_json" == "xyes" -a "x$enable_json_control" != "xno"]) |
Brad Bishop | 93919bb | 2017-04-22 14:58:29 -0400 | [diff] [blame] | 94 | AM_CONDITIONAL([WANT_PRESENCE], [test "x$enable_presence" != "xno"]) |
| 95 | AM_CONDITIONAL([WANT_CONTROL], [test "x$enable_control" != "xno"]) |
Brandon Wyman | ce82244 | 2017-04-10 17:48:02 -0500 | [diff] [blame] | 96 | AM_CONDITIONAL([WANT_COOLING_TYPE], [test "x$enable_cooling_type" != "xno"]) |
Matt Spinler | e567dd2 | 2017-04-27 12:27:17 -0500 | [diff] [blame] | 97 | AM_CONDITIONAL([WANT_MONITOR], [test "x$enable_monitor" != "xno"]) |
Matt Spinler | 9c0715b | 2021-01-21 11:15:33 -0600 | [diff] [blame] | 98 | AM_CONDITIONAL([WANT_SENSOR_MONITOR], [test "x$enable_sensor_monitor" == "xyes"]) |
Brad Bishop | 93919bb | 2017-04-22 14:58:29 -0400 | [diff] [blame] | 99 | |
Kumar Thangavel | 2dd87bd | 2021-11-24 20:13:16 +0530 | [diff] [blame] | 100 | |
| 101 | AC_ARG_ENABLE([host-state], |
| 102 | AS_HELP_STRING([--enable-host-state], [Enable host state])) |
| 103 | |
| 104 | AM_CONDITIONAL([WANT_HOST_STATE], [test "x$enable_host_state" == "xyes"]) |
| 105 | |
| 106 | AM_COND_IF([WANT_HOST_STATE], |
| 107 | [ |
| 108 | AM_CONDITIONAL(HOST_STATE_ENABLED, true) |
| 109 | ], |
| 110 | [ |
| 111 | AM_CONDITIONAL(HOST_STATE_ENABLED, false) |
| 112 | ] |
| 113 | ) |
| 114 | |
Brad Bishop | 93919bb | 2017-04-22 14:58:29 -0400 | [diff] [blame] | 115 | # Package specific checks. |
| 116 | AS_IF([test "x$enable_presence" != "xno"], [ |
Matthew Barth | cc19480 | 2020-01-09 13:55:34 -0600 | [diff] [blame] | 117 | # Use runtime(json) config, otherwise default to compile time(yaml) config |
| 118 | AM_COND_IF([WANT_JSON], |
| 119 | [ |
Matthew Barth | 8bf1c42 | 2021-08-05 11:30:09 -0500 | [diff] [blame] | 120 | AC_ARG_VAR(MACHINE, [Machine name to install a particular set of associated config file(s)]) |
Matthew Barth | cc19480 | 2020-01-09 13:55:34 -0600 | [diff] [blame] | 121 | AC_CHECK_HEADER(nlohmann/json.hpp, , |
| 122 | [AC_MSG_ERROR([Could not find nlohmann/json.hpp... nlohmann/json package required])]) |
| 123 | # Set config flag for runtime json usage |
| 124 | AC_DEFINE([PRESENCE_USE_JSON], [1], [Fan presence use runtime json configuration]) |
| 125 | AC_MSG_NOTICE([Fan presence json configuration usage enabled]) |
Matt Spinler | 00db950 | 2021-02-04 16:43:31 -0600 | [diff] [blame] | 126 | AC_CONFIG_FILES([presence/service_files/json/phosphor-fan-presence-tach@.service]) |
Matthew Barth | cc19480 | 2020-01-09 13:55:34 -0600 | [diff] [blame] | 127 | ], |
| 128 | [ |
| 129 | # Add optional yaml file argument |
| 130 | AC_ARG_VAR(PRESENCE_CONFIG, [The fan presence config file.]) |
Brad Bishop | 76596b2 | 2017-06-13 14:39:13 -0400 | [diff] [blame] | 131 | |
Brad Bishop | 76596b2 | 2017-06-13 14:39:13 -0400 | [diff] [blame] | 132 | AS_IF([test "x$PRESENCE_CONFIG" == "x"], |
| 133 | [PRESENCE_CONFIG="\${top_srcdir}/presence/example/example.yaml"]) |
| 134 | |
Brad Bishop | 76596b2 | 2017-06-13 14:39:13 -0400 | [diff] [blame] | 135 | AC_DEFINE_UNQUOTED([PRESENCE_CONFIG], ["$PRESENCE_CONFIG"], |
| 136 | [The fan presence config file.]) |
Brad Bishop | 93919bb | 2017-04-22 14:58:29 -0400 | [diff] [blame] | 137 | |
Brad Bishop | 76596b2 | 2017-06-13 14:39:13 -0400 | [diff] [blame] | 138 | AC_SUBST([PFPGEN], |
| 139 | ["$PYTHON \${top_srcdir}/presence/pfpgen.py generate-cpp -i $PRESENCE_CONFIG"]) |
Matt Spinler | 00db950 | 2021-02-04 16:43:31 -0600 | [diff] [blame] | 140 | |
| 141 | AC_CONFIG_FILES([presence/service_files/yaml/phosphor-fan-presence-tach@.service]) |
Matthew Barth | cc19480 | 2020-01-09 13:55:34 -0600 | [diff] [blame] | 142 | ]) |
Matt Spinler | 635de8c | 2020-09-24 13:51:40 -0500 | [diff] [blame] | 143 | |
| 144 | AC_ARG_VAR(NUM_PRESENCE_LOG_ENTRIES, [Maximum number of entries in the message log]) |
| 145 | AS_IF([test "x$NUM_PRESENCE_LOG_ENTRIES" == "x"], [NUM_PRESENCE_LOG_ENTRIES=50]) |
| 146 | AC_DEFINE_UNQUOTED([NUM_PRESENCE_LOG_ENTRIES], [$NUM_PRESENCE_LOG_ENTRIES], |
| 147 | [Maximum number of entries in the message log]) |
| 148 | |
Matthew Barth | cc19480 | 2020-01-09 13:55:34 -0600 | [diff] [blame] | 149 | AC_CONFIG_FILES([presence/Makefile]) |
| 150 | ]) |
Brad Bishop | 93919bb | 2017-04-22 14:58:29 -0400 | [diff] [blame] | 151 | |
| 152 | AS_IF([test "x$enable_control" != "xno"], [ |
Matthew Barth | d87f89f | 2020-07-30 10:41:32 -0500 | [diff] [blame] | 153 | # Add fan control Dbus attributes |
| 154 | AC_ARG_VAR(CONTROL_BUSNAME, [The fan control busname to own]) |
| 155 | AS_IF([test "x$CONTROL_BUSNAME" == "x"], |
| 156 | [CONTROL_BUSNAME="xyz.openbmc_project.Control.Thermal"]) |
| 157 | AC_DEFINE_UNQUOTED([CONTROL_BUSNAME], ["$CONTROL_BUSNAME"], |
| 158 | [The fan control busname to own]) |
Matthew Barth | 14cc043 | 2019-01-16 15:06:41 -0600 | [diff] [blame] | 159 | |
Matthew Barth | d87f89f | 2020-07-30 10:41:32 -0500 | [diff] [blame] | 160 | AC_ARG_VAR(CONTROL_OBJPATH, [The fan control root object path]) |
| 161 | AS_IF([test "x$CONTROL_OBJPATH" == "x"], |
| 162 | [CONTROL_OBJPATH="/xyz/openbmc_project/control/thermal"]) |
| 163 | AC_DEFINE_UNQUOTED([CONTROL_OBJPATH], ["$CONTROL_OBJPATH"], |
| 164 | [The fan control root object path]) |
Matthew Barth | 14cc043 | 2019-01-16 15:06:41 -0600 | [diff] [blame] | 165 | |
Matthew Barth | d87f89f | 2020-07-30 10:41:32 -0500 | [diff] [blame] | 166 | AC_ARG_VAR(CONTROL_PERSIST_ROOT_PATH, [Root path for persisting zone property states]) |
| 167 | AS_IF([test "x$CONTROL_PERSIST_ROOT_PATH" == "x"], |
| 168 | [CONTROL_PERSIST_ROOT_PATH="/var/lib/phosphor-fan-presence/control"]) |
| 169 | AC_DEFINE_UNQUOTED([CONTROL_PERSIST_ROOT_PATH], ["$CONTROL_PERSIST_ROOT_PATH"], |
| 170 | [Root path for persisting zone property states]) |
Matthew Barth | cc8912e | 2019-01-21 11:35:27 -0600 | [diff] [blame] | 171 | |
Matthew Barth | d87f89f | 2020-07-30 10:41:32 -0500 | [diff] [blame] | 172 | # Use runtime(json) config, otherwise default to compile time(yaml) config |
Matthew Barth | 8e1b382 | 2020-11-12 11:57:23 -0600 | [diff] [blame] | 173 | AM_COND_IF([WANT_JSON_CONTROL], |
Matthew Barth | d87f89f | 2020-07-30 10:41:32 -0500 | [diff] [blame] | 174 | [ |
Matthew Barth | ceb75d7 | 2021-08-18 15:18:43 -0500 | [diff] [blame] | 175 | AC_ARG_VAR(MACHINE, [Machine name to install a particular set of associated config file(s)]) |
Matthew Barth | d87f89f | 2020-07-30 10:41:32 -0500 | [diff] [blame] | 176 | AC_CHECK_HEADER(nlohmann/json.hpp, , |
| 177 | [AC_MSG_ERROR([Could not find nlohmann/json.hpp... nlohmann/json package required])]) |
Mike Capps | 69834cf | 2021-09-24 09:58:27 -0400 | [diff] [blame] | 178 | AC_CHECK_HEADER(CLI/CLI.hpp, , |
| 179 | [AC_MSG_ERROR([Could not find CLI/CLI.hpp... cli11 package required])]) |
Matthew Barth | d87f89f | 2020-07-30 10:41:32 -0500 | [diff] [blame] | 180 | # Set config flag for runtime json usage |
| 181 | AC_DEFINE([CONTROL_USE_JSON], [1], [Fan control use runtime json configuration]) |
| 182 | AC_MSG_NOTICE([Fan control json configuration usage enabled]) |
Matthew Barth | 058180f | 2021-06-16 11:41:58 -0500 | [diff] [blame] | 183 | AC_CONFIG_FILES([control/service_files/json/phosphor-fan-control@.service]) |
Matthew Barth | d87f89f | 2020-07-30 10:41:32 -0500 | [diff] [blame] | 184 | ], |
| 185 | [ |
| 186 | # Add optional yaml file arguments |
| 187 | AC_ARG_VAR(FAN_DEF_YAML_FILE, |
| 188 | [The fan definition file to use]) |
| 189 | AS_IF([test "x$FAN_DEF_YAML_FILE" == "x"], |
| 190 | [FAN_DEF_YAML_FILE="\${top_srcdir}/control/example/fans.yaml"]) |
| 191 | AC_DEFINE_UNQUOTED([FAN_DEF_YAML_FILE], ["$FAN_DEF_YAML_FILE"], |
| 192 | [The fan definition file to use]) |
Matt Spinler | 77d32d1 | 2017-04-12 09:51:41 -0500 | [diff] [blame] | 193 | |
Matthew Barth | d87f89f | 2020-07-30 10:41:32 -0500 | [diff] [blame] | 194 | AC_ARG_VAR(FAN_ZONE_YAML_FILE, |
| 195 | [The fan zone definition file to use]) |
| 196 | AS_IF([test "x$FAN_ZONE_YAML_FILE" == "x"], |
| 197 | [FAN_ZONE_YAML_FILE="\${top_srcdir}/control/example/zones.yaml"]) |
| 198 | AC_DEFINE_UNQUOTED([FAN_ZONE_YAML_FILE], ["$FAN_ZONE_YAML_FILE"], |
| 199 | [The fan zone definition file to use]) |
Matt Spinler | 77d32d1 | 2017-04-12 09:51:41 -0500 | [diff] [blame] | 200 | |
Matthew Barth | d87f89f | 2020-07-30 10:41:32 -0500 | [diff] [blame] | 201 | AC_ARG_VAR(ZONE_EVENTS_YAML_FILE, |
| 202 | [The zone events definition file to use]) |
| 203 | AS_IF([test "x$ZONE_EVENTS_YAML_FILE" == "x"], |
| 204 | [ZONE_EVENTS_YAML_FILE="\${top_srcdir}/control/example/events.yaml"]) |
| 205 | AC_DEFINE_UNQUOTED([ZONE_EVENTS_YAML_FILE], ["$ZONE_EVENTS_YAML_FILE"], |
| 206 | [The zone events definition file to use]) |
Matthew Barth | d4d0f08 | 2017-05-16 13:51:10 -0500 | [diff] [blame] | 207 | |
Matthew Barth | d87f89f | 2020-07-30 10:41:32 -0500 | [diff] [blame] | 208 | AC_ARG_VAR(ZONE_CONDITIONS_YAML_FILE, |
| 209 | [The zone conditions definition file to use]) |
| 210 | AS_IF([test "x$ZONE_CONDITIONS_YAML_FILE" == "x"], |
| 211 | [ZONE_CONDITIONS_YAML_FILE="\${top_srcdir}/control/example/zone_conditions.yaml"]) |
| 212 | AC_DEFINE_UNQUOTED([ZONE_CONDITIONS_YAML_FILE], ["$ZONE_CONDITIONS_YAML_FILE"], |
| 213 | [The zone conditions definition file to use]) |
Gunnar Mills | 28c1a09 | 2017-06-26 11:16:41 -0500 | [diff] [blame] | 214 | |
Matthew Barth | d87f89f | 2020-07-30 10:41:32 -0500 | [diff] [blame] | 215 | AC_SUBST([GEN_FAN_ZONE_DEFS], |
| 216 | ["$PYTHON \${top_srcdir}/control/gen-fan-zone-defs.py \ |
| 217 | -f $FAN_DEF_YAML_FILE \ |
| 218 | -z $FAN_ZONE_YAML_FILE \ |
| 219 | -e $ZONE_EVENTS_YAML_FILE \ |
| 220 | -c $ZONE_CONDITIONS_YAML_FILE"]) |
Matthew Barth | 058180f | 2021-06-16 11:41:58 -0500 | [diff] [blame] | 221 | |
| 222 | AC_CONFIG_FILES([control/service_files/yaml/phosphor-fan-control-init@.service |
| 223 | control/service_files/yaml/phosphor-fan-control@.service]) |
Matthew Barth | d87f89f | 2020-07-30 10:41:32 -0500 | [diff] [blame] | 224 | ]) |
Matthew Barth | e6704b9 | 2020-10-20 16:14:08 -0500 | [diff] [blame] | 225 | AC_CONFIG_FILES([control/Makefile]) |
Brad Bishop | 93919bb | 2017-04-22 14:58:29 -0400 | [diff] [blame] | 226 | ]) |
Matthew Barth | 681c98d | 2017-02-17 16:05:57 -0600 | [diff] [blame] | 227 | |
Brandon Wyman | ce82244 | 2017-04-10 17:48:02 -0500 | [diff] [blame] | 228 | AS_IF([test "x$enable_cooling_type" != "xno"], [ |
Brandon Wyman | fef0295 | 2017-03-31 18:13:21 -0500 | [diff] [blame] | 229 | AC_CONFIG_FILES([cooling-type/Makefile]) |
Brandon Wyman | ca60e10 | 2017-03-29 17:06:02 -0500 | [diff] [blame] | 230 | ]) |
Matthew Barth | bedefd8 | 2020-06-02 15:39:56 -0500 | [diff] [blame] | 231 | |
Matt Spinler | e567dd2 | 2017-04-27 12:27:17 -0500 | [diff] [blame] | 232 | AS_IF([test "x$enable_monitor" != "xno"], [ |
Matthew Barth | bedefd8 | 2020-06-02 15:39:56 -0500 | [diff] [blame] | 233 | # Use runtime(json) config, otherwise default to compile time(yaml) config |
| 234 | AM_COND_IF([WANT_JSON], |
| 235 | [ |
Matthew Barth | a5c6274 | 2021-08-18 14:12:09 -0500 | [diff] [blame] | 236 | AC_ARG_VAR(MACHINE, [Machine name to install a particular set of associated config file(s)]) |
Matthew Barth | bedefd8 | 2020-06-02 15:39:56 -0500 | [diff] [blame] | 237 | AC_CHECK_HEADER(nlohmann/json.hpp, , |
| 238 | [AC_MSG_ERROR([Could not find nlohmann/json.hpp... nlohmann/json package required])]) |
| 239 | # Set config flag for runtime json usage |
| 240 | AC_DEFINE([MONITOR_USE_JSON], [1], [Fan monitor use runtime json configuration]) |
| 241 | AC_MSG_NOTICE([Fan monitor json configuration usage enabled]) |
Matt Spinler | 7df2d9f | 2021-02-04 16:44:25 -0600 | [diff] [blame] | 242 | AC_CONFIG_FILES([monitor/service_files/json/phosphor-fan-monitor@.service]) |
Matthew Barth | bedefd8 | 2020-06-02 15:39:56 -0500 | [diff] [blame] | 243 | ], |
| 244 | [ |
| 245 | AC_ARG_VAR(FAN_MONITOR_YAML_FILE, |
| 246 | [The fan monitor definition file to use]) |
| 247 | AS_IF([test "x$FAN_MONITOR_YAML_FILE" == "x"], |
| 248 | [FAN_MONITOR_YAML_FILE="\${top_srcdir}/monitor/example/monitor.yaml"]) |
| 249 | AC_DEFINE_UNQUOTED([FAN_MONITOR_YAML_FILE], ["$FAN_MONITOR_YAML_FILE"], |
| 250 | [The fan monitor definition file to use]) |
Matt Spinler | 1432184 | 2017-04-28 15:27:43 -0500 | [diff] [blame] | 251 | |
Matthew Barth | bedefd8 | 2020-06-02 15:39:56 -0500 | [diff] [blame] | 252 | AC_SUBST([GEN_FAN_MONITOR_DEFS], |
| 253 | ["$PYTHON \${top_srcdir}/monitor/gen-fan-monitor-defs.py \ |
| 254 | -m $FAN_MONITOR_YAML_FILE"]) |
Matt Spinler | 7df2d9f | 2021-02-04 16:44:25 -0600 | [diff] [blame] | 255 | |
| 256 | AC_CONFIG_FILES([monitor/service_files/yaml/phosphor-fan-monitor-init@.service |
| 257 | monitor/service_files/yaml/phosphor-fan-monitor@.service]) |
Matthew Barth | bedefd8 | 2020-06-02 15:39:56 -0500 | [diff] [blame] | 258 | ]) |
Matt Spinler | 69b0cf0 | 2020-10-14 10:59:03 -0500 | [diff] [blame] | 259 | |
| 260 | AC_ARG_VAR(NUM_MONITOR_LOG_ENTRIES, [Maximum number of entries in the message log]) |
| 261 | AS_IF([test "x$NUM_MONITOR_LOG_ENTRIES" == "x"], [NUM_MONITOR_LOG_ENTRIES=75]) |
| 262 | AC_DEFINE_UNQUOTED([NUM_MONITOR_LOG_ENTRIES], [$NUM_MONITOR_LOG_ENTRIES], |
| 263 | [Maximum number of entries in the message log]) |
| 264 | |
Matt Spinler | c8d3c51 | 2021-01-06 14:22:25 -0600 | [diff] [blame] | 265 | AC_ARG_VAR(THERMAL_ALERT_BUSNAME, [The thermal alert busname to own]) |
| 266 | AS_IF([test "x$THERMAL_ALERT_BUSNAME" == "x"], |
| 267 | [THERMAL_ALERT_BUSNAME="xyz.openbmc_project.Thermal.Alert"]) |
| 268 | AC_DEFINE_UNQUOTED([THERMAL_ALERT_BUSNAME], ["$THERMAL_ALERT_BUSNAME"], |
| 269 | [The thermal alert busname to own]) |
| 270 | |
| 271 | AC_ARG_VAR(THERMAL_ALERT_OBJPATH, [The thermal alert D-Bus object path]) |
| 272 | AS_IF([test "x$THERMAL_ALERT_OBJPATH" == "x"], |
| 273 | [THERMAL_ALERT_OBJPATH="/xyz/openbmc_project/alerts/thermal_fault_alert"]) |
| 274 | AC_DEFINE_UNQUOTED([THERMAL_ALERT_OBJPATH], ["$THERMAL_ALERT_OBJPATH"], |
| 275 | [The thermal alert D-Bus object path]) |
| 276 | |
Matthew Barth | bedefd8 | 2020-06-02 15:39:56 -0500 | [diff] [blame] | 277 | AC_CONFIG_FILES([monitor/Makefile]) |
Matt Spinler | e567dd2 | 2017-04-27 12:27:17 -0500 | [diff] [blame] | 278 | ]) |
Brandon Wyman | ca60e10 | 2017-03-29 17:06:02 -0500 | [diff] [blame] | 279 | |
Matt Spinler | 9c0715b | 2021-01-21 11:15:33 -0600 | [diff] [blame] | 280 | AS_IF([test "x$enable_sensor_monitor" == "xyes"], [ |
| 281 | |
Matt Spinler | 08a66ef | 2021-01-21 13:46:45 -0600 | [diff] [blame] | 282 | AC_ARG_VAR(SENSOR_MONITOR_PERSIST_ROOT_PATH, |
| 283 | [Root path for persisting sensor monitor data]) |
| 284 | AS_IF([test "x$SENSOR_MONITOR_PERSIST_ROOT_PATH" == "x"], |
| 285 | [SENSOR_MONITOR_PERSIST_ROOT_PATH="/var/lib/phosphor-fan-presence/sensor-monitor"]) |
| 286 | AC_DEFINE_UNQUOTED([SENSOR_MONITOR_PERSIST_ROOT_PATH], |
| 287 | ["$SENSOR_MONITOR_PERSIST_ROOT_PATH"], |
| 288 | [Root path for persisting sensor monitor data]) |
| 289 | |
Matt Spinler | 0b83951 | 2021-01-21 13:21:03 -0600 | [diff] [blame] | 290 | #Default hard shutdown delay is 23 seconds |
| 291 | AC_ARG_VAR(SHUTDOWN_ALARM_HARD_SHUTDOWN_DELAY_MS, |
| 292 | [Milliseconds to delay the alarm hard shutdown]) |
| 293 | AS_IF([test "x$SHUTDOWN_ALARM_HARD_SHUTDOWN_DELAY_MS" == "x"], |
| 294 | [SHUTDOWN_ALARM_HARD_SHUTDOWN_DELAY_MS=23000]) |
| 295 | AC_DEFINE_UNQUOTED([SHUTDOWN_ALARM_HARD_SHUTDOWN_DELAY_MS], |
| 296 | [$SHUTDOWN_ALARM_HARD_SHUTDOWN_DELAY_MS], |
| 297 | [Milliseconds to delay the alarm hard shutdown]) |
| 298 | |
| 299 | #Default soft shutdown delay is 15 minutes |
| 300 | AC_ARG_VAR(SHUTDOWN_ALARM_SOFT_SHUTDOWN_DELAY_MS, |
| 301 | [Milliseconds to delay the alarm soft shutdown]) |
| 302 | AS_IF([test "x$SHUTDOWN_ALARM_SOFT_SHUTDOWN_DELAY_MS" == "x"], |
| 303 | [SHUTDOWN_ALARM_SOFT_SHUTDOWN_DELAY_MS=900000]) |
| 304 | AC_DEFINE_UNQUOTED([SHUTDOWN_ALARM_SOFT_SHUTDOWN_DELAY_MS], |
| 305 | [$SHUTDOWN_ALARM_SOFT_SHUTDOWN_DELAY_MS], |
| 306 | [Milliseconds to delay the alarm soft shutdown]) |
| 307 | |
Matt Spinler | bcc12cb | 2021-02-12 08:32:30 -0600 | [diff] [blame] | 308 | AC_CONFIG_FILES([sensor-monitor/Makefile sensor-monitor/service_files/sensor-monitor.service]) |
Matt Spinler | 9c0715b | 2021-01-21 11:15:33 -0600 | [diff] [blame] | 309 | ]) |
| 310 | |
Matt Spinler | 00db950 | 2021-02-04 16:43:31 -0600 | [diff] [blame] | 311 | eval "eval BINDIR=$bindir" |
| 312 | AC_SUBST([BINDIR]) |
| 313 | |
| 314 | |
Matthew Barth | ae0e96c | 2017-01-20 13:54:59 -0600 | [diff] [blame] | 315 | # Create configured output |
Matt Spinler | 0023743 | 2020-10-14 10:36:41 -0500 | [diff] [blame] | 316 | AC_CONFIG_FILES([Makefile test/Makefile presence/test/Makefile monitor/test/Makefile]) |
Matthew Barth | ae0e96c | 2017-01-20 13:54:59 -0600 | [diff] [blame] | 317 | AC_OUTPUT |