blob: 471a7bebe7c9ebe4f351a5ef03a873fef30f2ff4 [file] [log] [blame]
Matthew Barth3cff7ed2016-07-27 14:50:51 -05001# Initialization
2AC_PREREQ([2.69])
3AC_INIT([phosphor-host-ipmid], [1.0], [https://github.com/openbmc/phosphor-host-ipmid/issues])
4AC_CONFIG_HEADERS([config.h])
5AM_INIT_AUTOMAKE([subdir-objects -Wall -Werror foreign dist-xz])
Matthew Barth00b1e5b2016-09-09 12:15:46 -05006AM_SILENT_RULES([yes])
Patrick Venture98c7bfc2018-10-29 18:43:35 -07007AC_LANG([C++])
Matthew Barth3cff7ed2016-07-27 14:50:51 -05008
9# Checks for programs.
10AC_PROG_CXX
Matthew Barth3cff7ed2016-07-27 14:50:51 -050011AC_PROG_CC
Patrick Williams686df742016-09-02 17:52:59 -050012AM_PROG_AR
Matthew Barth3cff7ed2016-07-27 14:50:51 -050013AC_PROG_INSTALL
14AC_PROG_MAKE_SET
15
Vishwanatha Subbanna506aa0f2017-01-24 14:58:25 +053016# softoff dir specific ones
17AC_ARG_ENABLE([softoff],
18 AS_HELP_STRING([--enable-softoff], [Builds soft power off])
19)
20AS_IF([test "x$enable_softoff" != "xno"],
21 [AC_PROG_MKDIR_P]
22 [AC_CHECK_PROG([DIRNAME], dirname, dirname)]
23)
24
William A. Kennington III194375f2018-12-14 02:14:33 -080025# Make sure the pkgconfigdata is configured for automake
26PKG_INSTALLDIR
27
Matthew Barth3cff7ed2016-07-27 14:50:51 -050028# Checks for libraries.
Patrick Venture15bc9182018-12-03 12:22:50 -080029AC_CHECK_LIB([pam], [pam_start], [], [AC_MSG_ERROR([libpam not found])])
Matthew Barth80f714b2016-11-09 15:04:48 -060030AC_CHECK_LIB([mapper], [mapper_get_service], ,[AC_MSG_ERROR([Could not find libmapper...openbmc/phosphor-objmgr package required])])
Vishwanatha Subbanna506aa0f2017-01-24 14:58:25 +053031PKG_CHECK_MODULES([SYSTEMD], [libsystemd >= 221], [], [AC_MSG_ERROR(["systemd required and not found"])])
Richard Marian Thomaiyar4654d992018-04-19 05:38:37 +053032PKG_CHECK_MODULES([CRYPTO], [libcrypto >= 1.0.2g], ,[AC_MSG_ERROR([can't find openssl libcrypto])])
Adriana Kobylak2efb3e72017-02-06 21:43:59 -060033PKG_CHECK_MODULES([PHOSPHOR_LOGGING], [phosphor-logging],, [AC_MSG_ERROR([Could not find phosphor-logging...openbmc/phosphor-logging package required])])
Vishwanatha Subbannab12b0c02017-03-07 18:17:19 +053034PKG_CHECK_MODULES([PHOSPHOR_DBUS_INTERFACES], [phosphor-dbus-interfaces],, [AC_MSG_ERROR([Could not find phosphor-dbus-interfaces...openbmc/phosphor-dbus-interfaces package required])])
Deepak Kodihalli18aa0442017-07-21 07:07:09 -050035PKG_CHECK_MODULES([SDBUSPLUS], [sdbusplus],,\
36 AC_MSG_ERROR(["Requires sdbusplus package."]))
Patrick Venture97c22e12019-02-12 07:39:02 -080037AC_CHECK_HEADER(nlohmann/json.hpp, [], [AC_MSG_ERROR([Could not find nlohmann/json.hpp])])
Matthew Barth3cff7ed2016-07-27 14:50:51 -050038
William A. Kennington III047412c2018-12-10 15:26:19 -080039AS_IF([test "x$enable_softoff" != "xno"], [
William A. Kennington III4f67cc32018-10-18 15:24:49 -070040 PKG_CHECK_MODULES([SDEVENTPLUS], [sdeventplus],,\
41 AC_MSG_ERROR(["Requires sdeventplus package."]))
42
Vishwanatha Subbanna506aa0f2017-01-24 14:58:25 +053043 # Check for sdbus++ tool
William A. Kennington III047412c2018-12-10 15:26:19 -080044 AC_PATH_PROG([SDBUSPLUSPLUS], [sdbus++])
Vishwanatha Subbanna506aa0f2017-01-24 14:58:25 +053045 AS_IF([test "x$SDBUSPLUSPLUS" == "x"],
46 AC_MSG_ERROR([Cannot find sdbus++]))
William A. Kennington III047412c2018-12-10 15:26:19 -080047])
Matthew Barth3cff7ed2016-07-27 14:50:51 -050048
49# Checks for typedefs, structures, and compiler characteristics.
William A. Kennington III687a4362018-10-18 15:22:43 -070050AX_CXX_COMPILE_STDCXX([17], [noext], [mandatory])
Matthew Barth00b1e5b2016-09-09 12:15:46 -050051AX_APPEND_COMPILE_FLAGS([-Wall -Werror], [CFLAGS])
52AX_APPEND_COMPILE_FLAGS([-Wall -Werror], [CXXFLAGS])
Matthew Barth3cff7ed2016-07-27 14:50:51 -050053
54# Checks for library functions.
Patrick Williams686df742016-09-02 17:52:59 -050055LT_INIT([dlopen disable-static shared])
Matthew Barth3cff7ed2016-07-27 14:50:51 -050056LT_LIB_DLLOAD
Matthew Barth3cff7ed2016-07-27 14:50:51 -050057
Matthew Barth00b1e5b2016-09-09 12:15:46 -050058# Check/set gtest specific functions.
Peter Hanson4a589852017-06-07 17:40:45 -070059PKG_CHECK_MODULES([GTEST], [gtest], [], [AC_MSG_NOTICE([gtest not found, tests will not build])])
60PKG_CHECK_MODULES([GTEST_MAIN], [gtest_main], [], [AC_MSG_NOTICE([gtest_main not found, tests will not build])])
Matthew Barth00b1e5b2016-09-09 12:15:46 -050061
62AC_ARG_ENABLE([oe-sdk],
63 AS_HELP_STRING([--enable-oe-sdk], [Link testcases absolutely against OE SDK so they can be ran within it.])
64)
65AC_ARG_VAR(OECORE_TARGET_SYSROOT,
66 [Path to the OE SDK SYSROOT])
67AS_IF([test "x$enable_oe_sdk" == "xyes"],
68 AS_IF([test "x$OECORE_TARGET_SYSROOT" == "x"],
69 AC_MSG_ERROR([OECORE_TARGET_SYSROOT must be set with --enable-oe-sdk])
70 )
71 AC_MSG_NOTICE([Enabling OE-SDK at $OECORE_TARGET_SYSROOT])
72 [
73 testcase_flags="-Wl,-rpath,\${OECORE_TARGET_SYSROOT}/lib"
74 testcase_flags="${testcase_flags} -Wl,-rpath,\${OECORE_TARGET_SYSROOT}/usr/lib"
75 testcase_flags="${testcase_flags} -Wl,-dynamic-linker,`find \${OECORE_TARGET_SYSROOT}/lib/ld-*.so | sort -r -n | head -n1`"
76 ]
77 AC_SUBST([OESDK_TESTCASE_FLAGS], [$testcase_flags])
78)
79
Emily Shafferc07e72c2018-06-18 10:37:31 -070080# Add code coverage tool
81AX_CODE_COVERAGE
82
Tom Joseph51cb8ee2017-02-21 16:22:33 +053083AC_ARG_VAR(WHITELIST_CONF, [Paths to IPMI whitelisted commands conf files. (default = ${srcdir}/host-ipmid-whitelist.conf)])
84if test -z "$WHITELIST_CONF"; then
85 WHITELIST_CONF=${srcdir}/host-ipmid-whitelist.conf
86fi
87
Ratan Gupta28c2e732017-03-04 08:53:52 +053088AS_IF([test "x$SENSOR_YAML_GEN" == "x"], [SENSOR_YAML_GEN="sensor-example.yaml"])
89SENSORGEN="$PYTHON ${srcdir}/scripts/sensor_gen.py -i $SENSOR_YAML_GEN"
90AC_SUBST(SENSORGEN)
91
Tom Josephe19540e2019-02-04 14:06:58 +053092AS_IF([test "x$INVSENSOR_YAML_GEN" == "x"], [INVSENSOR_YAML_GEN="inventory-sensor-example.yaml"])
93INVSENSORGEN="$PYTHON ${srcdir}/scripts/inventory-sensor.py -i $INVSENSOR_YAML_GEN"
94AC_SUBST(INVSENSORGEN)
95
Marri Devender Rao81b8d552017-07-07 12:20:23 -050096AS_IF([test "x$FRU_YAML_GEN" == "x"], [FRU_YAML_GEN="fru-read-example.yaml"])
Marri Devender Raoa62bacc2017-06-04 23:40:16 -050097FRUGEN="$PYTHON $srcdir/scripts/fru_gen.py -i $FRU_YAML_GEN"
98AC_SUBST(FRUGEN)
99
Jaghathiswari Rankappagounder Natarajan9c118942019-02-12 13:22:55 -0800100AS_IF([test "x$ENTITY_YAML_GEN" == "x"], [ENTITY_YAML_GEN="entity-example.yaml"])
101ENTITYGEN="$PYTHON $srcdir/scripts/entity_gen.py -i $ENTITY_YAML_GEN"
102AC_SUBST(ENTITYGEN)
103
Tom Joseph6edc8a02017-06-30 18:52:56 +0530104AC_DEFINE(CALLOUT_FWD_ASSOCIATION, "callout", [The name of the callout's forward association.])
105AC_DEFINE(BOARD_SENSOR, "/xyz/openbmc_project/inventory/system/chassis/motherboard", [The inventory path to the motherboard fault sensor.])
106AC_DEFINE(SYSTEM_SENSOR, "/xyz/openbmc_project/inventory/system", [The inventory path to the system event sensor.])
107
Vishwanatha Subbanna506aa0f2017-01-24 14:58:25 +0530108# Soft Power off related.
109AS_IF([test "x$enable_softoff" != "xno"],
110 # Dbus service name
111 [AC_ARG_VAR(SOFTOFF_BUSNAME, [The Dbus busname to own])]
112 AS_IF([test "x$SOFTOFF_BUSNAME" == "x"],
113 [SOFTOFF_BUSNAME="xyz.openbmc_project.Ipmi.Internal.SoftPowerOff"])
114 [AC_DEFINE_UNQUOTED([SOFTOFF_BUSNAME], ["$SOFTOFF_BUSNAME"], [The Dbus busname to own])]
115
116 # Service dbus root
117 [AC_ARG_VAR(SOFTOFF_OBJPATH, [The SoftPowerOff Dbus root])]
118 AS_IF([test "x$SOFTOFF_OBJPATH" == "x"],
Vishwanatha Subbannab891a572017-03-31 11:34:48 +0530119 [SOFTOFF_OBJPATH="/xyz/openbmc_project/ipmi/internal/soft_power_off"])
Vishwanatha Subbanna506aa0f2017-01-24 14:58:25 +0530120 [AC_DEFINE_UNQUOTED([SOFTOFF_OBJPATH], ["$SOFTOFF_OBJPATH"], [The SoftPowerOff Dbus root])]
Vishwanatha Subbannad27e71e2017-02-01 18:02:38 +0530121
122 # Timeouts in SECONDS for SoftPowerOff protocol
Andrew Geissler6fcdc212018-01-26 11:53:46 -0800123 [AC_ARG_VAR(IPMI_SMS_ATN_ACK_TIMEOUT_SECS, \
124 [Initial timeout for host to ack and query SMS_ATN from BMC])]
125 [AC_DEFINE_UNQUOTED([IPMI_SMS_ATN_ACK_TIMEOUT_SECS], [30], \
126 [Timeout for host to ack and query SMS_ATN from BMC])]
Vishwanatha Subbanna31272b82017-02-01 18:53:14 +0530127
Andrew Geissler48ce0722017-08-16 19:51:51 -0500128 [AC_ARG_VAR(IPMI_HOST_SHUTDOWN_COMPLETE_TIMEOUT_SECS, [Wait time for host to shutdown])]
129 [AC_DEFINE_UNQUOTED([IPMI_HOST_SHUTDOWN_COMPLETE_TIMEOUT_SECS], [45*60], [Wait time for host to shutdown])]
Andrew Geisslera6e3a302017-05-31 19:34:00 -0500130
131 # Indicates an in-band power off or reboot request from the host
132 # This file is used to ensure the soft off service does not run for host
133 # initiated shutdown or reboot requests
134 [AC_ARG_VAR(HOST_INBAND_REQUEST_DIR, [Directory used to indicate the host has initiated a shutdown or reboot])]
135 AS_IF([test "x$HOST_INBAND_REQUEST_DIR" == "x"],
136 [HOST_INBAND_REQUEST_DIR="/run/openbmc/"])
137 [AC_DEFINE_UNQUOTED([HOST_INBAND_REQUEST_DIR], ["$HOST_INBAND_REQUEST_DIR"], [Directory to store host initiated shutdown file])]
138
139 [AC_ARG_VAR(HOST_INBAND_REQUEST_FILE, [File which indicates the host has initiated a shutdown or reboot])]
140 AS_IF([test "x$HOST_INBAND_REQUEST_FILE" == "x"],
141 [HOST_INBAND_REQUEST_FILE="host@%u-request"])
142 [AC_DEFINE_UNQUOTED([HOST_INBAND_REQUEST_FILE], ["$HOST_INBAND_REQUEST_FILE"], [File to create if host has initiated shutdown or reboot])]
Vishwanatha Subbanna506aa0f2017-01-24 14:58:25 +0530143)
144
Andrew Geissler62817fa92017-03-20 14:20:49 -0500145# Control Host Interfaces
146# Dbus service name
147AC_ARG_VAR(CONTROL_HOST_BUSNAME, [The Control Host Dbus busname to own])
148AS_IF([test "x$CONTROL_HOST_BUSNAME" == "x"],
149 [CONTROL_HOST_BUSNAME="xyz.openbmc_project.Control.Host"])
150AC_DEFINE_UNQUOTED([CONTROL_HOST_BUSNAME], ["$CONTROL_HOST_BUSNAME"], [The Control Host Dbus busname to own])
151
Vishwanatha Subbanna3eb117a2017-07-12 16:13:49 +0530152# Host object name in the D-Bus
153AC_ARG_VAR(HOST_NAME, [The Host name in the object path])
154AS_IF([test "x$HOST_NAME" == "x"],
155 [HOST_NAME="host"])
156AC_DEFINE_UNQUOTED([HOST_NAME], ["$HOST_NAME"], [The Host name in the object path])
157
158# Service dbus object manager
159AC_ARG_VAR(CONTROL_HOST_OBJ_MGR, [The Control Host D-Bus Object Manager])
160AS_IF([test "x$CONTROL_HOST_OBJ_MGR" == "x"],
161 [CONTROL_HOST_OBJ_MGR="/xyz/openbmc_project/control"])
162AC_DEFINE_UNQUOTED([CONTROL_HOST_OBJ_MGR], ["$CONTROL_HOST_OBJ_MGR"], [The Control Host D-Bus Object Manager])
Andrew Geissler62817fa92017-03-20 14:20:49 -0500163
Marri Devender Rao66c5fda2018-01-18 10:48:37 -0600164# Power reading sensor configuration file
165AC_ARG_VAR(POWER_READING_SENSOR, [Power reading sensor configuration file])
166AS_IF([test "x$POWER_READING_SENSOR" == "x"],[POWER_READING_SENSOR="/usr/share/ipmi-providers/power_reading.json"])
167AC_DEFINE_UNQUOTED([POWER_READING_SENSOR], ["$POWER_READING_SENSOR"], [Power reading sensor configuration file])
168
Patrick Venture15e95f22018-11-14 19:25:08 -0800169AC_ARG_VAR(HOST_IPMI_LIB_PATH, [The file path to search for libraries.])
170AS_IF([test "x$HOST_IPMI_LIB_PATH" == "x"], [HOST_IPMI_LIB_PATH="/usr/lib/host-ipmid/"])
171AC_DEFINE_UNQUOTED([HOST_IPMI_LIB_PATH], ["$HOST_IPMI_LIB_PATH"], [The file path to search for libraries.])
172
Matthew Barth00b1e5b2016-09-09 12:15:46 -0500173# Create configured output
William A. Kennington III194375f2018-12-14 02:14:33 -0800174AC_CONFIG_FILES([
175 Makefile
176 include/Makefile
177 libipmid/Makefile
178 libipmid/libipmid.pc
179 libipmid-host/Makefile
180 libipmid-host/libipmid-host.pc
181 softoff/Makefile
182 test/Makefile
183 user_channel/Makefile
184])
Matthew Barth3cff7ed2016-07-27 14:50:51 -0500185AC_OUTPUT