Matthew Barth | 3cff7ed | 2016-07-27 14:50:51 -0500 | [diff] [blame] | 1 | # Initialization |
| 2 | AC_PREREQ([2.69]) |
| 3 | AC_INIT([phosphor-host-ipmid], [1.0], [https://github.com/openbmc/phosphor-host-ipmid/issues]) |
| 4 | AC_CONFIG_HEADERS([config.h]) |
William A. Kennington III | 5023aa9 | 2019-04-04 18:00:09 -0700 | [diff] [blame] | 5 | AM_INIT_AUTOMAKE([subdir-objects -Wall -Wno-portability -Werror foreign dist-xz]) |
Matthew Barth | 00b1e5b | 2016-09-09 12:15:46 -0500 | [diff] [blame] | 6 | AM_SILENT_RULES([yes]) |
Patrick Venture | 98c7bfc | 2018-10-29 18:43:35 -0700 | [diff] [blame] | 7 | AC_LANG([C++]) |
Matthew Barth | 3cff7ed | 2016-07-27 14:50:51 -0500 | [diff] [blame] | 8 | |
William A. Kennington III | 5023aa9 | 2019-04-04 18:00:09 -0700 | [diff] [blame] | 9 | # Make sure the default CFLAGS of `-O2 -g` don't override CODE_COVERAGE_CFLAGS |
| 10 | # It is important that this comes before AC_PROG_C{C,XX}, as we are attempting |
| 11 | # to stop them from populating default CFLAGS and CXXFLAGS. |
| 12 | AS_IF([test "x$enable_code_coverage" != "xno"], [ |
| 13 | AS_IF([test "x${CXXFLAGS+set}" != "xset"], [ |
| 14 | AC_SUBST(CXXFLAGS, [""]) |
| 15 | ]) |
| 16 | AS_IF([test "x${CFLAGS+set}" != "xset"], [ |
| 17 | AC_SUBST(CFLAGS, [""]) |
| 18 | ]) |
| 19 | ]) |
| 20 | |
Matthew Barth | 3cff7ed | 2016-07-27 14:50:51 -0500 | [diff] [blame] | 21 | # Checks for programs. |
| 22 | AC_PROG_CXX |
Matthew Barth | 3cff7ed | 2016-07-27 14:50:51 -0500 | [diff] [blame] | 23 | AC_PROG_CC |
Patrick Williams | 686df74 | 2016-09-02 17:52:59 -0500 | [diff] [blame] | 24 | AM_PROG_AR |
Matthew Barth | 3cff7ed | 2016-07-27 14:50:51 -0500 | [diff] [blame] | 25 | AC_PROG_INSTALL |
| 26 | AC_PROG_MAKE_SET |
| 27 | |
Vishwanatha Subbanna | 506aa0f | 2017-01-24 14:58:25 +0530 | [diff] [blame] | 28 | # softoff dir specific ones |
| 29 | AC_ARG_ENABLE([softoff], |
| 30 | AS_HELP_STRING([--enable-softoff], [Builds soft power off]) |
| 31 | ) |
| 32 | AS_IF([test "x$enable_softoff" != "xno"], |
| 33 | [AC_PROG_MKDIR_P] |
| 34 | [AC_CHECK_PROG([DIRNAME], dirname, dirname)] |
| 35 | ) |
| 36 | |
William A. Kennington III | 194375f | 2018-12-14 02:14:33 -0800 | [diff] [blame] | 37 | # Make sure the pkgconfigdata is configured for automake |
| 38 | PKG_INSTALLDIR |
| 39 | |
Matthew Barth | 3cff7ed | 2016-07-27 14:50:51 -0500 | [diff] [blame] | 40 | # Checks for libraries. |
Patrick Venture | 15bc918 | 2018-12-03 12:22:50 -0800 | [diff] [blame] | 41 | AC_CHECK_LIB([pam], [pam_start], [], [AC_MSG_ERROR([libpam not found])]) |
Matthew Barth | 80f714b | 2016-11-09 15:04:48 -0600 | [diff] [blame] | 42 | AC_CHECK_LIB([mapper], [mapper_get_service], ,[AC_MSG_ERROR([Could not find libmapper...openbmc/phosphor-objmgr package required])]) |
Vishwanatha Subbanna | 506aa0f | 2017-01-24 14:58:25 +0530 | [diff] [blame] | 43 | PKG_CHECK_MODULES([SYSTEMD], [libsystemd >= 221], [], [AC_MSG_ERROR(["systemd required and not found"])]) |
Richard Marian Thomaiyar | 4654d99 | 2018-04-19 05:38:37 +0530 | [diff] [blame] | 44 | PKG_CHECK_MODULES([CRYPTO], [libcrypto >= 1.0.2g], ,[AC_MSG_ERROR([can't find openssl libcrypto])]) |
Patrick Venture | 6719586 | 2019-02-13 08:24:00 -0800 | [diff] [blame] | 45 | PKG_CHECK_MODULES([PHOSPHOR_LOGGING], [phosphor-logging]) |
| 46 | PKG_CHECK_MODULES([PHOSPHOR_DBUS_INTERFACES], [phosphor-dbus-interfaces]) |
| 47 | PKG_CHECK_MODULES([SDBUSPLUS], [sdbusplus]) |
Patrick Venture | 97c22e1 | 2019-02-12 07:39:02 -0800 | [diff] [blame] | 48 | AC_CHECK_HEADER(nlohmann/json.hpp, [], [AC_MSG_ERROR([Could not find nlohmann/json.hpp])]) |
Matthew Barth | 3cff7ed | 2016-07-27 14:50:51 -0500 | [diff] [blame] | 49 | |
William A. Kennington III | 047412c | 2018-12-10 15:26:19 -0800 | [diff] [blame] | 50 | AS_IF([test "x$enable_softoff" != "xno"], [ |
Patrick Venture | 6719586 | 2019-02-13 08:24:00 -0800 | [diff] [blame] | 51 | PKG_CHECK_MODULES([SDEVENTPLUS], [sdeventplus]) |
William A. Kennington III | 4f67cc3 | 2018-10-18 15:24:49 -0700 | [diff] [blame] | 52 | |
Vishwanatha Subbanna | 506aa0f | 2017-01-24 14:58:25 +0530 | [diff] [blame] | 53 | # Check for sdbus++ tool |
William A. Kennington III | 047412c | 2018-12-10 15:26:19 -0800 | [diff] [blame] | 54 | AC_PATH_PROG([SDBUSPLUSPLUS], [sdbus++]) |
Vishwanatha Subbanna | 506aa0f | 2017-01-24 14:58:25 +0530 | [diff] [blame] | 55 | AS_IF([test "x$SDBUSPLUSPLUS" == "x"], |
| 56 | AC_MSG_ERROR([Cannot find sdbus++])) |
William A. Kennington III | 047412c | 2018-12-10 15:26:19 -0800 | [diff] [blame] | 57 | ]) |
Matthew Barth | 3cff7ed | 2016-07-27 14:50:51 -0500 | [diff] [blame] | 58 | |
| 59 | # Checks for typedefs, structures, and compiler characteristics. |
William A. Kennington III | 687a436 | 2018-10-18 15:22:43 -0700 | [diff] [blame] | 60 | AX_CXX_COMPILE_STDCXX([17], [noext], [mandatory]) |
Matthew Barth | 00b1e5b | 2016-09-09 12:15:46 -0500 | [diff] [blame] | 61 | AX_APPEND_COMPILE_FLAGS([-Wall -Werror], [CFLAGS]) |
| 62 | AX_APPEND_COMPILE_FLAGS([-Wall -Werror], [CXXFLAGS]) |
Matthew Barth | 3cff7ed | 2016-07-27 14:50:51 -0500 | [diff] [blame] | 63 | |
| 64 | # Checks for library functions. |
Patrick Williams | 686df74 | 2016-09-02 17:52:59 -0500 | [diff] [blame] | 65 | LT_INIT([dlopen disable-static shared]) |
Matthew Barth | 3cff7ed | 2016-07-27 14:50:51 -0500 | [diff] [blame] | 66 | LT_LIB_DLLOAD |
Matthew Barth | 3cff7ed | 2016-07-27 14:50:51 -0500 | [diff] [blame] | 67 | |
Matthew Barth | 00b1e5b | 2016-09-09 12:15:46 -0500 | [diff] [blame] | 68 | # Check/set gtest specific functions. |
Peter Hanson | 4a58985 | 2017-06-07 17:40:45 -0700 | [diff] [blame] | 69 | PKG_CHECK_MODULES([GTEST], [gtest], [], [AC_MSG_NOTICE([gtest not found, tests will not build])]) |
| 70 | PKG_CHECK_MODULES([GTEST_MAIN], [gtest_main], [], [AC_MSG_NOTICE([gtest_main not found, tests will not build])]) |
Matthew Barth | 00b1e5b | 2016-09-09 12:15:46 -0500 | [diff] [blame] | 71 | |
| 72 | AC_ARG_ENABLE([oe-sdk], |
| 73 | AS_HELP_STRING([--enable-oe-sdk], [Link testcases absolutely against OE SDK so they can be ran within it.]) |
| 74 | ) |
| 75 | AC_ARG_VAR(OECORE_TARGET_SYSROOT, |
| 76 | [Path to the OE SDK SYSROOT]) |
| 77 | AS_IF([test "x$enable_oe_sdk" == "xyes"], |
| 78 | AS_IF([test "x$OECORE_TARGET_SYSROOT" == "x"], |
| 79 | AC_MSG_ERROR([OECORE_TARGET_SYSROOT must be set with --enable-oe-sdk]) |
| 80 | ) |
| 81 | AC_MSG_NOTICE([Enabling OE-SDK at $OECORE_TARGET_SYSROOT]) |
| 82 | [ |
| 83 | testcase_flags="-Wl,-rpath,\${OECORE_TARGET_SYSROOT}/lib" |
| 84 | testcase_flags="${testcase_flags} -Wl,-rpath,\${OECORE_TARGET_SYSROOT}/usr/lib" |
| 85 | testcase_flags="${testcase_flags} -Wl,-dynamic-linker,`find \${OECORE_TARGET_SYSROOT}/lib/ld-*.so | sort -r -n | head -n1`" |
| 86 | ] |
| 87 | AC_SUBST([OESDK_TESTCASE_FLAGS], [$testcase_flags]) |
| 88 | ) |
| 89 | |
Emily Shaffer | c07e72c | 2018-06-18 10:37:31 -0700 | [diff] [blame] | 90 | # Add code coverage tool |
| 91 | AX_CODE_COVERAGE |
William A. Kennington III | 5023aa9 | 2019-04-04 18:00:09 -0700 | [diff] [blame] | 92 | AS_IF([test "x$CODE_COVERAGE_ENABLED" = "xyes"], [ |
| 93 | AX_APPEND_COMPILE_FLAGS([-DHAVE_GCOV], [CODE_COVERAGE_CPPFLAGS]) |
| 94 | ]) |
| 95 | m4_ifdef([_AX_CODE_COVERAGE_RULES], |
| 96 | [AM_CONDITIONAL(AUTOCONF_CODE_COVERAGE_2019_01_06, [true])], |
| 97 | [AM_CONDITIONAL(AUTOCONF_CODE_COVERAGE_2019_01_06, [false])]) |
| 98 | AX_ADD_AM_MACRO_STATIC([]) |
| 99 | |
Emily Shaffer | c07e72c | 2018-06-18 10:37:31 -0700 | [diff] [blame] | 100 | |
Tom Joseph | 51cb8ee | 2017-02-21 16:22:33 +0530 | [diff] [blame] | 101 | AC_ARG_VAR(WHITELIST_CONF, [Paths to IPMI whitelisted commands conf files. (default = ${srcdir}/host-ipmid-whitelist.conf)]) |
| 102 | if test -z "$WHITELIST_CONF"; then |
| 103 | WHITELIST_CONF=${srcdir}/host-ipmid-whitelist.conf |
| 104 | fi |
| 105 | |
Ratan Gupta | 28c2e73 | 2017-03-04 08:53:52 +0530 | [diff] [blame] | 106 | AS_IF([test "x$SENSOR_YAML_GEN" == "x"], [SENSOR_YAML_GEN="sensor-example.yaml"]) |
| 107 | SENSORGEN="$PYTHON ${srcdir}/scripts/sensor_gen.py -i $SENSOR_YAML_GEN" |
| 108 | AC_SUBST(SENSORGEN) |
| 109 | |
Tom Joseph | e19540e | 2019-02-04 14:06:58 +0530 | [diff] [blame] | 110 | AS_IF([test "x$INVSENSOR_YAML_GEN" == "x"], [INVSENSOR_YAML_GEN="inventory-sensor-example.yaml"]) |
| 111 | INVSENSORGEN="$PYTHON ${srcdir}/scripts/inventory-sensor.py -i $INVSENSOR_YAML_GEN" |
| 112 | AC_SUBST(INVSENSORGEN) |
| 113 | |
Marri Devender Rao | 81b8d55 | 2017-07-07 12:20:23 -0500 | [diff] [blame] | 114 | AS_IF([test "x$FRU_YAML_GEN" == "x"], [FRU_YAML_GEN="fru-read-example.yaml"]) |
Marri Devender Rao | a62bacc | 2017-06-04 23:40:16 -0500 | [diff] [blame] | 115 | FRUGEN="$PYTHON $srcdir/scripts/fru_gen.py -i $FRU_YAML_GEN" |
| 116 | AC_SUBST(FRUGEN) |
| 117 | |
Jaghathiswari Rankappagounder Natarajan | 9c11894 | 2019-02-12 13:22:55 -0800 | [diff] [blame] | 118 | AS_IF([test "x$ENTITY_YAML_GEN" == "x"], [ENTITY_YAML_GEN="entity-example.yaml"]) |
| 119 | ENTITYGEN="$PYTHON $srcdir/scripts/entity_gen.py -i $ENTITY_YAML_GEN" |
| 120 | AC_SUBST(ENTITYGEN) |
| 121 | |
Tom Joseph | 6edc8a0 | 2017-06-30 18:52:56 +0530 | [diff] [blame] | 122 | AC_DEFINE(CALLOUT_FWD_ASSOCIATION, "callout", [The name of the callout's forward association.]) |
| 123 | AC_DEFINE(BOARD_SENSOR, "/xyz/openbmc_project/inventory/system/chassis/motherboard", [The inventory path to the motherboard fault sensor.]) |
| 124 | AC_DEFINE(SYSTEM_SENSOR, "/xyz/openbmc_project/inventory/system", [The inventory path to the system event sensor.]) |
| 125 | |
Vishwanatha Subbanna | 506aa0f | 2017-01-24 14:58:25 +0530 | [diff] [blame] | 126 | # Soft Power off related. |
| 127 | AS_IF([test "x$enable_softoff" != "xno"], |
| 128 | # Dbus service name |
| 129 | [AC_ARG_VAR(SOFTOFF_BUSNAME, [The Dbus busname to own])] |
| 130 | AS_IF([test "x$SOFTOFF_BUSNAME" == "x"], |
| 131 | [SOFTOFF_BUSNAME="xyz.openbmc_project.Ipmi.Internal.SoftPowerOff"]) |
| 132 | [AC_DEFINE_UNQUOTED([SOFTOFF_BUSNAME], ["$SOFTOFF_BUSNAME"], [The Dbus busname to own])] |
| 133 | |
| 134 | # Service dbus root |
| 135 | [AC_ARG_VAR(SOFTOFF_OBJPATH, [The SoftPowerOff Dbus root])] |
| 136 | AS_IF([test "x$SOFTOFF_OBJPATH" == "x"], |
Vishwanatha Subbanna | b891a57 | 2017-03-31 11:34:48 +0530 | [diff] [blame] | 137 | [SOFTOFF_OBJPATH="/xyz/openbmc_project/ipmi/internal/soft_power_off"]) |
Vishwanatha Subbanna | 506aa0f | 2017-01-24 14:58:25 +0530 | [diff] [blame] | 138 | [AC_DEFINE_UNQUOTED([SOFTOFF_OBJPATH], ["$SOFTOFF_OBJPATH"], [The SoftPowerOff Dbus root])] |
Vishwanatha Subbanna | d27e71e | 2017-02-01 18:02:38 +0530 | [diff] [blame] | 139 | |
| 140 | # Timeouts in SECONDS for SoftPowerOff protocol |
Andrew Geissler | 6fcdc21 | 2018-01-26 11:53:46 -0800 | [diff] [blame] | 141 | [AC_ARG_VAR(IPMI_SMS_ATN_ACK_TIMEOUT_SECS, \ |
| 142 | [Initial timeout for host to ack and query SMS_ATN from BMC])] |
| 143 | [AC_DEFINE_UNQUOTED([IPMI_SMS_ATN_ACK_TIMEOUT_SECS], [30], \ |
| 144 | [Timeout for host to ack and query SMS_ATN from BMC])] |
Vishwanatha Subbanna | 31272b8 | 2017-02-01 18:53:14 +0530 | [diff] [blame] | 145 | |
Andrew Geissler | 48ce072 | 2017-08-16 19:51:51 -0500 | [diff] [blame] | 146 | [AC_ARG_VAR(IPMI_HOST_SHUTDOWN_COMPLETE_TIMEOUT_SECS, [Wait time for host to shutdown])] |
| 147 | [AC_DEFINE_UNQUOTED([IPMI_HOST_SHUTDOWN_COMPLETE_TIMEOUT_SECS], [45*60], [Wait time for host to shutdown])] |
Andrew Geissler | a6e3a30 | 2017-05-31 19:34:00 -0500 | [diff] [blame] | 148 | |
| 149 | # Indicates an in-band power off or reboot request from the host |
| 150 | # This file is used to ensure the soft off service does not run for host |
| 151 | # initiated shutdown or reboot requests |
| 152 | [AC_ARG_VAR(HOST_INBAND_REQUEST_DIR, [Directory used to indicate the host has initiated a shutdown or reboot])] |
| 153 | AS_IF([test "x$HOST_INBAND_REQUEST_DIR" == "x"], |
| 154 | [HOST_INBAND_REQUEST_DIR="/run/openbmc/"]) |
| 155 | [AC_DEFINE_UNQUOTED([HOST_INBAND_REQUEST_DIR], ["$HOST_INBAND_REQUEST_DIR"], [Directory to store host initiated shutdown file])] |
| 156 | |
| 157 | [AC_ARG_VAR(HOST_INBAND_REQUEST_FILE, [File which indicates the host has initiated a shutdown or reboot])] |
| 158 | AS_IF([test "x$HOST_INBAND_REQUEST_FILE" == "x"], |
| 159 | [HOST_INBAND_REQUEST_FILE="host@%u-request"]) |
| 160 | [AC_DEFINE_UNQUOTED([HOST_INBAND_REQUEST_FILE], ["$HOST_INBAND_REQUEST_FILE"], [File to create if host has initiated shutdown or reboot])] |
Vishwanatha Subbanna | 506aa0f | 2017-01-24 14:58:25 +0530 | [diff] [blame] | 161 | ) |
| 162 | |
Andrew Geissler | 62817fa9 | 2017-03-20 14:20:49 -0500 | [diff] [blame] | 163 | # Control Host Interfaces |
| 164 | # Dbus service name |
| 165 | AC_ARG_VAR(CONTROL_HOST_BUSNAME, [The Control Host Dbus busname to own]) |
| 166 | AS_IF([test "x$CONTROL_HOST_BUSNAME" == "x"], |
| 167 | [CONTROL_HOST_BUSNAME="xyz.openbmc_project.Control.Host"]) |
| 168 | AC_DEFINE_UNQUOTED([CONTROL_HOST_BUSNAME], ["$CONTROL_HOST_BUSNAME"], [The Control Host Dbus busname to own]) |
| 169 | |
Vishwanatha Subbanna | 3eb117a | 2017-07-12 16:13:49 +0530 | [diff] [blame] | 170 | # Host object name in the D-Bus |
| 171 | AC_ARG_VAR(HOST_NAME, [The Host name in the object path]) |
| 172 | AS_IF([test "x$HOST_NAME" == "x"], |
| 173 | [HOST_NAME="host"]) |
| 174 | AC_DEFINE_UNQUOTED([HOST_NAME], ["$HOST_NAME"], [The Host name in the object path]) |
| 175 | |
| 176 | # Service dbus object manager |
| 177 | AC_ARG_VAR(CONTROL_HOST_OBJ_MGR, [The Control Host D-Bus Object Manager]) |
| 178 | AS_IF([test "x$CONTROL_HOST_OBJ_MGR" == "x"], |
| 179 | [CONTROL_HOST_OBJ_MGR="/xyz/openbmc_project/control"]) |
| 180 | AC_DEFINE_UNQUOTED([CONTROL_HOST_OBJ_MGR], ["$CONTROL_HOST_OBJ_MGR"], [The Control Host D-Bus Object Manager]) |
Andrew Geissler | 62817fa9 | 2017-03-20 14:20:49 -0500 | [diff] [blame] | 181 | |
Marri Devender Rao | 66c5fda | 2018-01-18 10:48:37 -0600 | [diff] [blame] | 182 | # Power reading sensor configuration file |
| 183 | AC_ARG_VAR(POWER_READING_SENSOR, [Power reading sensor configuration file]) |
| 184 | AS_IF([test "x$POWER_READING_SENSOR" == "x"],[POWER_READING_SENSOR="/usr/share/ipmi-providers/power_reading.json"]) |
| 185 | AC_DEFINE_UNQUOTED([POWER_READING_SENSOR], ["$POWER_READING_SENSOR"], [Power reading sensor configuration file]) |
| 186 | |
Patrick Venture | 15e95f2 | 2018-11-14 19:25:08 -0800 | [diff] [blame] | 187 | AC_ARG_VAR(HOST_IPMI_LIB_PATH, [The file path to search for libraries.]) |
Vernon Mauery | 41c79e6 | 2019-02-04 15:54:28 -0800 | [diff] [blame] | 188 | AS_IF([test "x$HOST_IPMI_LIB_PATH" == "x"], [HOST_IPMI_LIB_PATH="/usr/lib/ipmid-providers/"]) |
Patrick Venture | 15e95f2 | 2018-11-14 19:25:08 -0800 | [diff] [blame] | 189 | AC_DEFINE_UNQUOTED([HOST_IPMI_LIB_PATH], ["$HOST_IPMI_LIB_PATH"], [The file path to search for libraries.]) |
| 190 | |
Matthew Barth | 00b1e5b | 2016-09-09 12:15:46 -0500 | [diff] [blame] | 191 | # Create configured output |
William A. Kennington III | 194375f | 2018-12-14 02:14:33 -0800 | [diff] [blame] | 192 | AC_CONFIG_FILES([ |
| 193 | Makefile |
| 194 | include/Makefile |
| 195 | libipmid/Makefile |
| 196 | libipmid/libipmid.pc |
| 197 | libipmid-host/Makefile |
| 198 | libipmid-host/libipmid-host.pc |
| 199 | softoff/Makefile |
| 200 | test/Makefile |
| 201 | user_channel/Makefile |
| 202 | ]) |
Matthew Barth | 3cff7ed | 2016-07-27 14:50:51 -0500 | [diff] [blame] | 203 | AC_OUTPUT |