Deepak Kodihalli | 92a6341 | 2017-03-17 05:01:00 -0500 | [diff] [blame] | 1 | AC_PREREQ([2.69]) |
| 2 | AC_INIT([openpower-occ-control], [1.0], [https://github.com/openbmc/openpower-occ-control/issues]) |
| 3 | |
| 4 | AM_INIT_AUTOMAKE([subdir-objects -Wall -Werror foreign dist-xz]) |
| 5 | AM_SILENT_RULES([yes]) |
Patrick Venture | 5902d5f | 2018-10-29 18:59:37 -0700 | [diff] [blame] | 6 | AC_LANG([C++]) |
Deepak Kodihalli | 92a6341 | 2017-03-17 05:01:00 -0500 | [diff] [blame] | 7 | |
| 8 | # Checks for programs |
| 9 | AC_PROG_CXX |
| 10 | AM_PROG_AR |
| 11 | AC_PROG_INSTALL |
| 12 | AC_PROG_MAKE_SET |
| 13 | |
Marri Devender Rao | cf4fdca | 2017-12-29 03:40:05 -0600 | [diff] [blame] | 14 | # Check for compiler, packages only when install_error_yaml optional feature |
| 15 | # is disabled |
| 16 | AC_ARG_ENABLE([install_error_yaml], |
| 17 | AS_HELP_STRING([--enable-install_error_yaml], [Enable installing error yaml file]), |
Marri Devender Rao | 777cee9 | 2018-01-17 00:23:29 -0600 | [diff] [blame] | 18 | [], [install_error_yaml=no]) |
Marri Devender Rao | cf4fdca | 2017-12-29 03:40:05 -0600 | [diff] [blame] | 19 | AM_CONDITIONAL([INSTALL_ERROR_YAML], [test "x$enable_install_error_yaml" = "xyes"]) |
| 20 | AS_IF([test "x$enable_install_error_yaml" != "xyes"], [ |
Deepak Kodihalli | 92a6341 | 2017-03-17 05:01:00 -0500 | [diff] [blame] | 21 | |
Marri Devender Rao | cf4fdca | 2017-12-29 03:40:05 -0600 | [diff] [blame] | 22 | # Suppress the --with-libtool-sysroot error |
| 23 | LT_INIT |
Andrew Geissler | 4cea4d2 | 2017-07-10 15:13:33 -0500 | [diff] [blame] | 24 | |
Marri Devender Rao | cf4fdca | 2017-12-29 03:40:05 -0600 | [diff] [blame] | 25 | # gtest |
| 26 | # Check/set gtest specific functions. |
| 27 | AX_PTHREAD([GTEST_CPPFLAGS="-DGTEST_HAS_PTHREAD=1"],[GTEST_CPPFLAGS="-DGTEST_HAS_PTHREAD=0"]) |
| 28 | AC_SUBST(GTEST_CPPFLAGS) |
| 29 | |
| 30 | # Test cases require SDK so only build if we're told to (and SDK is available) |
| 31 | AC_ARG_ENABLE([oe-sdk], |
| 32 | AS_HELP_STRING([--enable-oe-sdk], [Link testcases absolutely against OE SDK so they can be ran within it.]) |
Andrew Geissler | 4cea4d2 | 2017-07-10 15:13:33 -0500 | [diff] [blame] | 33 | ) |
Marri Devender Rao | cf4fdca | 2017-12-29 03:40:05 -0600 | [diff] [blame] | 34 | AC_ARG_VAR(OECORE_TARGET_SYSROOT, |
| 35 | [Path to the OE SDK SYSROOT]) |
| 36 | AS_IF([test "x$enable_oe_sdk" == "xyes"], |
| 37 | AS_IF([test "x$OECORE_TARGET_SYSROOT" == "x"], |
| 38 | AC_MSG_ERROR([OECORE_TARGET_SYSROOT must be set with --enable-oe-sdk]) |
| 39 | ) |
| 40 | AC_MSG_NOTICE([Enabling OE-SDK at $OECORE_TARGET_SYSROOT]) |
| 41 | [ |
| 42 | testcase_flags="-Wl,-rpath,\${OECORE_TARGET_SYSROOT}/lib" |
| 43 | testcase_flags="${testcase_flags} -Wl,-rpath,\${OECORE_TARGET_SYSROOT}/usr/lib" |
| 44 | testcase_flags="${testcase_flags} -Wl,-dynamic-linker,`find \${OECORE_TARGET_SYSROOT}/lib/ld-*.so | sort -r -n | head -n1`" |
| 45 | ] |
| 46 | AC_SUBST([OESDK_TESTCASE_FLAGS], [$testcase_flags]) |
| 47 | ) |
Andrew Geissler | 4cea4d2 | 2017-07-10 15:13:33 -0500 | [diff] [blame] | 48 | |
Patrick Venture | db58b74 | 2019-02-13 15:38:39 -0800 | [diff] [blame] | 49 | PKG_CHECK_MODULES([SDBUSPLUS], [sdbusplus]) |
| 50 | PKG_CHECK_MODULES([PHOSPHOR_LOGGING], [phosphor-logging]) |
Patrick Venture | db58b74 | 2019-02-13 15:38:39 -0800 | [diff] [blame] | 51 | PKG_CHECK_MODULES([PHOSPHOR_DBUS_INTERFACES], [phosphor-dbus-interfaces]) |
Chris Cain | a8857c5 | 2021-01-27 11:53:05 -0600 | [diff] [blame] | 52 | PKG_CHECK_MODULES([SDEVENTPLUS], [sdeventplus]) |
| 53 | PKG_CHECK_MODULES([FMT], [fmt]) |
Deepak Kodihalli | 92a6341 | 2017-03-17 05:01:00 -0500 | [diff] [blame] | 54 | |
Marri Devender Rao | cf4fdca | 2017-12-29 03:40:05 -0600 | [diff] [blame] | 55 | # Check for sdbusplus |
Patrick Venture | db58b74 | 2019-02-13 15:38:39 -0800 | [diff] [blame] | 56 | PKG_CHECK_MODULES([SDBUSPLUS], [sdbusplus]) |
Vishwanatha Subbanna | 9bb065b | 2017-04-18 14:25:26 +0530 | [diff] [blame] | 57 | |
Marri Devender Rao | cf4fdca | 2017-12-29 03:40:05 -0600 | [diff] [blame] | 58 | # Check for sdbus++ tool |
| 59 | AC_PATH_PROG([SDBUSPLUSPLUS], [sdbus++]) |
| 60 | AS_IF([test "x$SDBUSPLUSPLUS" == "x"], AC_MSG_ERROR([Cannot find sdbus++])) |
Vishwanatha Subbanna | 9bb065b | 2017-04-18 14:25:26 +0530 | [diff] [blame] | 61 | |
Marri Devender Rao | cf4fdca | 2017-12-29 03:40:05 -0600 | [diff] [blame] | 62 | # Checks for typedefs, structures, and compiler characteristics. |
Vernon Mauery | 1fcff95 | 2018-10-04 10:31:21 -0700 | [diff] [blame] | 63 | AX_CXX_COMPILE_STDCXX_17([noext]) |
Marri Devender Rao | cf4fdca | 2017-12-29 03:40:05 -0600 | [diff] [blame] | 64 | AX_APPEND_COMPILE_FLAGS([-Wall -Werror], [CXXFLAGS]) |
Deepak Kodihalli | 92a6341 | 2017-03-17 05:01:00 -0500 | [diff] [blame] | 65 | |
Marri Devender Rao | cf4fdca | 2017-12-29 03:40:05 -0600 | [diff] [blame] | 66 | AC_ARG_ENABLE([i2c-occ], |
| 67 | AS_HELP_STRING([--enable-i2c-occ], [Enable I2C OCC support]) |
| 68 | ) |
| 69 | AS_IF([test "x$enable_i2c_occ" == "xyes"], |
| 70 | AC_MSG_NOTICE([Enabling I2C OCC]) |
| 71 | [ |
| 72 | cpp_flags="-DI2C_OCC" |
| 73 | ] |
| 74 | AC_SUBST([CPPFLAGS], [$cpp_flags]) |
| 75 | ) |
Tom Joseph | 815f9f5 | 2020-07-27 12:12:13 +0530 | [diff] [blame] | 76 | |
Chicago Duan | bb895cb | 2021-06-18 19:37:16 +0800 | [diff] [blame] | 77 | AC_ARG_ENABLE([read-occ-sensors], |
| 78 | AS_HELP_STRING([--enable-read-occ-sensors], [Enable read occ sensors support]) |
| 79 | ) |
| 80 | AS_IF([test "x$enable_read_occ_sensors" == "xyes"], |
| 81 | AC_MSG_NOTICE([Enabling read occ sensors]) |
| 82 | [ |
| 83 | cpp_flags="$CPPFLAGS -DREAD_OCC_SENSORS" |
| 84 | ] |
| 85 | AC_SUBST([CPPFLAGS], [$cpp_flags]) |
| 86 | ) |
| 87 | |
Tom Joseph | 815f9f5 | 2020-07-27 12:12:13 +0530 | [diff] [blame] | 88 | AC_ARG_WITH([host-communication-protocol], |
| 89 | AS_HELP_STRING([--with-host-communication-protocol], [To specify the host communication protocol]) |
| 90 | ) |
| 91 | AM_CONDITIONAL([ENABLE_PLDM], [test "$with_host_communication_protocol" == "pldm"]) |
| 92 | AS_IF([test "x$with_host_communication_protocol" == "xpldm"], |
| 93 | AC_MSG_NOTICE([Enabling PLDM]) |
| 94 | [ |
| 95 | cpp_flags="$CPPFLAGS -DPLDM" |
| 96 | AX_PKG_CHECK_MODULES([LIBPLDM], [libpldm]) |
| 97 | ] |
| 98 | AC_SUBST([CPPFLAGS], [$cpp_flags]) |
| 99 | ) |
Chris Cain | 78e8601 | 2021-03-04 16:15:31 -0600 | [diff] [blame] | 100 | |
| 101 | AC_ARG_ENABLE([power10-support], |
Chris Cain | 45034b4 | 2021-06-29 17:37:36 -0500 | [diff] [blame] | 102 | AS_HELP_STRING([--enable-power10-support], [Enable Power10 support]) |
Chris Cain | 78e8601 | 2021-03-04 16:15:31 -0600 | [diff] [blame] | 103 | ) |
Chris Cain | 45034b4 | 2021-06-29 17:37:36 -0500 | [diff] [blame] | 104 | AM_CONDITIONAL([POWER10_SUPPORT], [test "$enable_power10_support" == "yes"]) |
| 105 | AS_IF([test "x$enable_power10_support" == "xyes"], |
| 106 | AC_MSG_NOTICE([Enabling POWER10 Support]) |
Chris Cain | 78e8601 | 2021-03-04 16:15:31 -0600 | [diff] [blame] | 107 | [ |
| 108 | cpp_flags="$CPPFLAGS -DPOWER10" |
| 109 | ] |
| 110 | AC_SUBST([CPPFLAGS], [$cpp_flags]) |
| 111 | ) |
Marri Devender Rao | cf4fdca | 2017-12-29 03:40:05 -0600 | [diff] [blame] | 112 | ]) |
Lei YU | 0ab90ca | 2017-07-13 17:02:23 +0800 | [diff] [blame] | 113 | |
Vishwanatha Subbanna | 2180b2d | 2017-06-28 14:05:57 +0530 | [diff] [blame] | 114 | AC_ARG_VAR(OCC_CONTROL_BUSNAME, [The Dbus busname to own]) |
| 115 | AS_IF([test "x$OCC_CONTROL_BUSNAME" == "x"], [OCC_CONTROL_BUSNAME="org.open_power.OCC.Control"]) |
| 116 | AC_DEFINE_UNQUOTED([OCC_CONTROL_BUSNAME], ["$OCC_CONTROL_BUSNAME"], [The DBus busname to own]) |
Deepak Kodihalli | 92a6341 | 2017-03-17 05:01:00 -0500 | [diff] [blame] | 117 | |
Vishwanatha Subbanna | 2180b2d | 2017-06-28 14:05:57 +0530 | [diff] [blame] | 118 | AC_ARG_VAR(OCC_CONTROL_ROOT, [The Dbus root]) |
| 119 | AS_IF([test "x$OCC_CONTROL_ROOT" == "x"], [OCC_CONTROL_ROOT="/org/open_power/control"]) |
| 120 | AC_DEFINE_UNQUOTED([OCC_CONTROL_ROOT], ["$OCC_CONTROL_ROOT"], [The Dbus root]) |
Deepak Kodihalli | 92a6341 | 2017-03-17 05:01:00 -0500 | [diff] [blame] | 121 | |
Chicago Duan | bb895cb | 2021-06-18 19:37:16 +0800 | [diff] [blame] | 122 | AC_ARG_VAR(OCC_SENSORS_ROOT, [The sensors Dbus root]) |
| 123 | AS_IF([test "x$OCC_SENSORS_ROOT" == "x"], [OCC_SENSORS_ROOT="/xyz/openbmc_project/sensors"]) |
| 124 | AC_DEFINE_UNQUOTED([OCC_SENSORS_ROOT], ["$OCC_SENSORS_ROOT"], [The sensors Dbus root]) |
| 125 | |
Deepak Kodihalli | fd358d1 | 2017-05-08 07:11:22 -0500 | [diff] [blame] | 126 | AC_ARG_VAR(MAX_CPUS, [The max number of CPUs]) |
| 127 | AS_IF([test "x$MAX_CPUS" == "x"], [MAX_CPUS=2]) |
| 128 | AC_DEFINE_UNQUOTED([MAX_CPUS], [$MAX_CPUS], [The max number of CPUs]) |
| 129 | |
| 130 | AC_ARG_VAR(CPU_NAME, [The CPU object name]) |
Deepak Kodihalli | 92a6341 | 2017-03-17 05:01:00 -0500 | [diff] [blame] | 131 | AS_IF([test "x$CPU_NAME" == "x"], [CPU_NAME="cpu"]) |
Deepak Kodihalli | fd358d1 | 2017-05-08 07:11:22 -0500 | [diff] [blame] | 132 | AC_DEFINE_UNQUOTED([CPU_NAME], ["$CPU_NAME"], [The CPU object name]) |
Deepak Kodihalli | 92a6341 | 2017-03-17 05:01:00 -0500 | [diff] [blame] | 133 | |
Deepak Kodihalli | fd358d1 | 2017-05-08 07:11:22 -0500 | [diff] [blame] | 134 | AC_ARG_VAR(OCC_NAME, [The OCC object name]) |
Deepak Kodihalli | 92a6341 | 2017-03-17 05:01:00 -0500 | [diff] [blame] | 135 | AS_IF([test "x$OCC_NAME" == "x"], [OCC_NAME="occ"]) |
Deepak Kodihalli | fd358d1 | 2017-05-08 07:11:22 -0500 | [diff] [blame] | 136 | AC_DEFINE_UNQUOTED([OCC_NAME], ["$OCC_NAME"], [The OCC object name]) |
Deepak Kodihalli | 92a6341 | 2017-03-17 05:01:00 -0500 | [diff] [blame] | 137 | |
Andrew Geissler | 6ac874e | 2017-07-10 15:54:58 -0500 | [diff] [blame] | 138 | AC_ARG_VAR(OCC_MASTER_NAME, [The OCC master object name]) |
Eddie James | e7d976b | 2018-02-26 13:42:45 -0600 | [diff] [blame] | 139 | AS_IF([test "x$OCC_MASTER_NAME" == "x"], [OCC_MASTER_NAME="occ-hwmon.1"]) |
Andrew Geissler | 6ac874e | 2017-07-10 15:54:58 -0500 | [diff] [blame] | 140 | AC_DEFINE_UNQUOTED([OCC_MASTER_NAME], ["$OCC_MASTER_NAME"], [The OCC master object name]) |
| 141 | |
Chicago Duan | bb895cb | 2021-06-18 19:37:16 +0800 | [diff] [blame] | 142 | AC_ARG_VAR(OCC_CPU_TEMP_SENSOR_TYPE, [The CPU temp sensor type]) |
| 143 | AS_IF([test "x$OCC_CPU_TEMP_SENSOR_TYPE" == "x"], [OCC_CPU_TEMP_SENSOR_TYPE="C0"]) |
| 144 | AC_DEFINE_UNQUOTED([OCC_CPU_TEMP_SENSOR_TYPE], ["$OCC_CPU_TEMP_SENSOR_TYPE"], [The CPU temp sensor type]) |
| 145 | |
| 146 | AC_ARG_VAR(OCC_DIMM_TEMP_SENSOR_TYPE, [The dimm temp sensor type]) |
| 147 | AS_IF([test "x$OCC_DIMM_TEMP_SENSOR_TYPE" == "x"], [OCC_DIMM_TEMP_SENSOR_TYPE="D0"]) |
| 148 | AC_DEFINE_UNQUOTED([OCC_DIMM_TEMP_SENSOR_TYPE], ["$OCC_DIMM_TEMP_SENSOR_TYPE"], [The dimm temp sensor type]) |
| 149 | |
Vishwanatha Subbanna | 32e84e9 | 2017-06-28 19:17:28 +0530 | [diff] [blame] | 150 | AC_ARG_VAR(OCC_HWMON_PATH, [The OCC hwmon path]) |
Vishwanatha Subbanna | ee4d83d | 2017-06-29 18:35:00 +0530 | [diff] [blame] | 151 | AC_ARG_VAR(DEV_PATH, [The device path]) |
Lei YU | 0ab90ca | 2017-07-13 17:02:23 +0800 | [diff] [blame] | 152 | AC_ARG_VAR(I2C_OCC_DEVICE_NAME, [The device name of i2c occ hwmon]) |
| 153 | AS_IF([test "x$enable_i2c_occ" == "xyes"], |
| 154 | # If enable_2c_occ is defined, define occ hwmon path for I2C and its driver's name |
| 155 | AS_IF([test "x$OCC_HWMON_PATH" == "x"], [OCC_HWMON_PATH="/sys/bus/i2c/drivers/occ-hwmon/"]) |
| 156 | AS_IF([test "x$DEV_PATH" == "x"], [DEV_PATH="/sys/bus/i2c/devices"]) |
| 157 | AS_IF([test "x$I2C_OCC_DEVICE_NAME" == "x"], [I2C_OCC_DEVICE_NAME="p8-occ-hwmon"]), |
| 158 | |
| 159 | # Else, define occ hwmon path for FSI |
| 160 | AS_IF([test "x$OCC_HWMON_PATH" == "x"], [OCC_HWMON_PATH="/sys/bus/platform/drivers/occ-hwmon/"]) |
| 161 | AS_IF([test "x$DEV_PATH" == "x"], [DEV_PATH="/sys/bus/platform/devices/"]), |
| 162 | ) |
| 163 | AC_DEFINE_UNQUOTED([OCC_HWMON_PATH], ["$OCC_HWMON_PATH"], [The OCC hwmon path]) |
Vishwanatha Subbanna | ee4d83d | 2017-06-29 18:35:00 +0530 | [diff] [blame] | 164 | AC_DEFINE_UNQUOTED([DEV_PATH], ["$DEV_PATH"], [The device path]) |
Lei YU | 0ab90ca | 2017-07-13 17:02:23 +0800 | [diff] [blame] | 165 | AC_DEFINE_UNQUOTED([I2C_OCC_DEVICE_NAME], ["$I2C_OCC_DEVICE_NAME"], [The device name of i2c occ hwmon]) |
Vishwanatha Subbanna | ee4d83d | 2017-06-29 18:35:00 +0530 | [diff] [blame] | 166 | |
Vishwanatha Subbanna | 3e5422e | 2017-08-10 18:25:26 +0530 | [diff] [blame] | 167 | AC_ARG_VAR(OCC_DEV_PATH, [The OCC device path in /dev]) |
| 168 | AS_IF([test "x$OCC_DEV_PATH" == "x"], [OCC_DEV_PATH="/dev/occ"]) |
| 169 | AC_DEFINE_UNQUOTED([OCC_DEV_PATH], ["$OCC_DEV_PATH"], [The OCC device path in /dev]) |
| 170 | |
Andrew Geissler | 4cea4d2 | 2017-07-10 15:13:33 -0500 | [diff] [blame] | 171 | AC_ARG_VAR(PS_DERATING_FACTOR, [The power supply derating factor]) |
| 172 | AS_IF([test "x$PS_DERATING_FACTOR" == "x"], [PS_DERATING_FACTOR=90]) |
| 173 | AC_DEFINE_UNQUOTED([PS_DERATING_FACTOR], [$PS_DERATING_FACTOR], [The power supply derating factor]) |
| 174 | |
Deepak Kodihalli | 5f031f3 | 2017-07-26 08:25:59 -0500 | [diff] [blame] | 175 | AC_ARG_VAR(CPU_SUBPATH, [The subpath containing CPU objects]) |
| 176 | AS_IF([test "x$CPU_SUBPATH" == "x"], [CPU_SUBPATH="/xyz/openbmc_project/inventory/system/chassis/motherboard"]) |
| 177 | AC_DEFINE_UNQUOTED([CPU_SUBPATH], ["$CPU_SUBPATH"], [The subpath containing CPU objects]) |
| 178 | |
Vishwanatha Subbanna | 6add0b8 | 2017-07-21 19:02:37 +0530 | [diff] [blame] | 179 | # Handling configuration files |
| 180 | AC_ARG_VAR(YAML_PATH, [The path to the yaml config files.]) |
| 181 | AS_IF([test "x$YAML_PATH" == "x"], [YAML_PATH="$srcdir/example"]) |
| 182 | AC_DEFINE_UNQUOTED([YAML_PATH], ["$YAML_PATH"], [The path to the yaml config files]) |
| 183 | |
Deepak Kodihalli | 92a6341 | 2017-03-17 05:01:00 -0500 | [diff] [blame] | 184 | AC_CONFIG_HEADERS([config.h]) |
Andrew Geissler | 4cea4d2 | 2017-07-10 15:13:33 -0500 | [diff] [blame] | 185 | AC_CONFIG_FILES([Makefile test/Makefile]) |
Deepak Kodihalli | 92a6341 | 2017-03-17 05:01:00 -0500 | [diff] [blame] | 186 | AC_OUTPUT |