blob: 076cc6fbcc44389c8b48665e839942c50522f6a2 [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])
Matthew Barth3cff7ed2016-07-27 14:50:51 -05007
8# Checks for programs.
9AC_PROG_CXX
Matthew Barth3cff7ed2016-07-27 14:50:51 -050010AC_PROG_CC
Patrick Williams686df742016-09-02 17:52:59 -050011AM_PROG_AR
Matthew Barth3cff7ed2016-07-27 14:50:51 -050012AC_PROG_INSTALL
13AC_PROG_MAKE_SET
14
Vishwanatha Subbanna506aa0f2017-01-24 14:58:25 +053015# softoff dir specific ones
16AC_ARG_ENABLE([softoff],
17 AS_HELP_STRING([--enable-softoff], [Builds soft power off])
18)
19AS_IF([test "x$enable_softoff" != "xno"],
20 [AC_PROG_MKDIR_P]
21 [AC_CHECK_PROG([DIRNAME], dirname, dirname)]
22)
23
Matthew Barth3cff7ed2016-07-27 14:50:51 -050024# Checks for libraries.
Matthew Barth80f714b2016-11-09 15:04:48 -060025AC_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 +053026PKG_CHECK_MODULES([SYSTEMD], [libsystemd >= 221], [], [AC_MSG_ERROR(["systemd required and not found"])])
Adriana Kobylak2efb3e72017-02-06 21:43:59 -060027PKG_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 +053028PKG_CHECK_MODULES([PHOSPHOR_DBUS_INTERFACES], [phosphor-dbus-interfaces],, [AC_MSG_ERROR([Could not find phosphor-dbus-interfaces...openbmc/phosphor-dbus-interfaces package required])])
Matthew Barth3cff7ed2016-07-27 14:50:51 -050029
Vishwanatha Subbanna506aa0f2017-01-24 14:58:25 +053030AS_IF([test "x$enable_softoff" != "xno"],
31 # Check for sdbusplus
32 PKG_CHECK_MODULES([SDBUSPLUS], [sdbusplus],, [AC_MSG_ERROR(["sdbusplus packaged required and not found"])])
33
34 # Check for sdbus++ tool
35 [AC_PATH_PROG([SDBUSPLUSPLUS], [sdbus++])]
36 AS_IF([test "x$SDBUSPLUSPLUS" == "x"],
37 AC_MSG_ERROR([Cannot find sdbus++]))
38)
Matthew Barth3cff7ed2016-07-27 14:50:51 -050039
40# Checks for typedefs, structures, and compiler characteristics.
Matthew Barth00b1e5b2016-09-09 12:15:46 -050041AX_CXX_COMPILE_STDCXX_14([noext])
42AX_APPEND_COMPILE_FLAGS([-Wall -Werror], [CFLAGS])
43AX_APPEND_COMPILE_FLAGS([-Wall -Werror], [CXXFLAGS])
Matthew Barth3cff7ed2016-07-27 14:50:51 -050044
45# Checks for library functions.
Patrick Williams686df742016-09-02 17:52:59 -050046LT_INIT([dlopen disable-static shared])
Matthew Barth3cff7ed2016-07-27 14:50:51 -050047LT_LIB_DLLOAD
Matthew Barth3cff7ed2016-07-27 14:50:51 -050048
Matthew Barth00b1e5b2016-09-09 12:15:46 -050049# Check/set gtest specific functions.
50AX_PTHREAD([GTEST_CPPFLAGS="-DGTEST_HAS_PTHREAD=1"],[GTEST_CPPFLAGS="-DGTEST_HAS_PTHREAD=0"])
51AC_SUBST(GTEST_CPPFLAGS)
52
53AC_ARG_ENABLE([oe-sdk],
54 AS_HELP_STRING([--enable-oe-sdk], [Link testcases absolutely against OE SDK so they can be ran within it.])
55)
56AC_ARG_VAR(OECORE_TARGET_SYSROOT,
57 [Path to the OE SDK SYSROOT])
58AS_IF([test "x$enable_oe_sdk" == "xyes"],
59 AS_IF([test "x$OECORE_TARGET_SYSROOT" == "x"],
60 AC_MSG_ERROR([OECORE_TARGET_SYSROOT must be set with --enable-oe-sdk])
61 )
62 AC_MSG_NOTICE([Enabling OE-SDK at $OECORE_TARGET_SYSROOT])
63 [
64 testcase_flags="-Wl,-rpath,\${OECORE_TARGET_SYSROOT}/lib"
65 testcase_flags="${testcase_flags} -Wl,-rpath,\${OECORE_TARGET_SYSROOT}/usr/lib"
66 testcase_flags="${testcase_flags} -Wl,-dynamic-linker,`find \${OECORE_TARGET_SYSROOT}/lib/ld-*.so | sort -r -n | head -n1`"
67 ]
68 AC_SUBST([OESDK_TESTCASE_FLAGS], [$testcase_flags])
69)
70
Tom Joseph51cb8ee2017-02-21 16:22:33 +053071AC_ARG_VAR(WHITELIST_CONF, [Paths to IPMI whitelisted commands conf files. (default = ${srcdir}/host-ipmid-whitelist.conf)])
72if test -z "$WHITELIST_CONF"; then
73 WHITELIST_CONF=${srcdir}/host-ipmid-whitelist.conf
74fi
75
Ratan Gupta28c2e732017-03-04 08:53:52 +053076AS_IF([test "x$SENSOR_YAML_GEN" == "x"], [SENSOR_YAML_GEN="sensor-example.yaml"])
77SENSORGEN="$PYTHON ${srcdir}/scripts/sensor_gen.py -i $SENSOR_YAML_GEN"
78AC_SUBST(SENSORGEN)
79
Tom Josephd5899e72017-05-05 11:20:34 +053080AS_IF([test "x$INVSENSOR_YAML_GEN" == "x"], [INVSENSOR_YAML_GEN="inventory-sensor-example.yaml"])
81INVSENSORGEN="$PYTHON ${srcdir}/scripts/inventory-sensor.py -i $INVSENSOR_YAML_GEN"
82AC_SUBST(INVSENSORGEN)
83
Vishwanatha Subbanna506aa0f2017-01-24 14:58:25 +053084# Soft Power off related.
85AS_IF([test "x$enable_softoff" != "xno"],
86 # Dbus service name
87 [AC_ARG_VAR(SOFTOFF_BUSNAME, [The Dbus busname to own])]
88 AS_IF([test "x$SOFTOFF_BUSNAME" == "x"],
89 [SOFTOFF_BUSNAME="xyz.openbmc_project.Ipmi.Internal.SoftPowerOff"])
90 [AC_DEFINE_UNQUOTED([SOFTOFF_BUSNAME], ["$SOFTOFF_BUSNAME"], [The Dbus busname to own])]
91
92 # Service dbus root
93 [AC_ARG_VAR(SOFTOFF_OBJPATH, [The SoftPowerOff Dbus root])]
94 AS_IF([test "x$SOFTOFF_OBJPATH" == "x"],
Vishwanatha Subbannab891a572017-03-31 11:34:48 +053095 [SOFTOFF_OBJPATH="/xyz/openbmc_project/ipmi/internal/soft_power_off"])
Vishwanatha Subbanna506aa0f2017-01-24 14:58:25 +053096 [AC_DEFINE_UNQUOTED([SOFTOFF_OBJPATH], ["$SOFTOFF_OBJPATH"], [The SoftPowerOff Dbus root])]
Vishwanatha Subbannad27e71e2017-02-01 18:02:38 +053097
98 # Timeouts in SECONDS for SoftPowerOff protocol
99 [AC_ARG_VAR(IPMI_SMS_ATN_ACK_TIMEOUT_SECS, [Initial timeout for host to ack SMS_ATN from BMC])]
100 [AC_DEFINE_UNQUOTED([IPMI_SMS_ATN_ACK_TIMEOUT_SECS], [3], [Initial timeout for host to ack SMS_ATN from BMC])]
Vishwanatha Subbanna31272b82017-02-01 18:53:14 +0530101
102 [AC_ARG_VAR(IPMI_HOST_SHUTDOWN_COMPLETE_TIMEOUT_SECS, [Wait time until Host can quiesce])]
103 [AC_DEFINE_UNQUOTED([IPMI_HOST_SHUTDOWN_COMPLETE_TIMEOUT_SECS], [45*60], [Wait time until Host can quiesce])]
Andrew Geisslera6e3a302017-05-31 19:34:00 -0500104
105 # Indicates an in-band power off or reboot request from the host
106 # This file is used to ensure the soft off service does not run for host
107 # initiated shutdown or reboot requests
108 [AC_ARG_VAR(HOST_INBAND_REQUEST_DIR, [Directory used to indicate the host has initiated a shutdown or reboot])]
109 AS_IF([test "x$HOST_INBAND_REQUEST_DIR" == "x"],
110 [HOST_INBAND_REQUEST_DIR="/run/openbmc/"])
111 [AC_DEFINE_UNQUOTED([HOST_INBAND_REQUEST_DIR], ["$HOST_INBAND_REQUEST_DIR"], [Directory to store host initiated shutdown file])]
112
113 [AC_ARG_VAR(HOST_INBAND_REQUEST_FILE, [File which indicates the host has initiated a shutdown or reboot])]
114 AS_IF([test "x$HOST_INBAND_REQUEST_FILE" == "x"],
115 [HOST_INBAND_REQUEST_FILE="host@%u-request"])
116 [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 +0530117)
118
Andrew Geissler62817fa92017-03-20 14:20:49 -0500119# Control Host Interfaces
120# Dbus service name
121AC_ARG_VAR(CONTROL_HOST_BUSNAME, [The Control Host Dbus busname to own])
122AS_IF([test "x$CONTROL_HOST_BUSNAME" == "x"],
123 [CONTROL_HOST_BUSNAME="xyz.openbmc_project.Control.Host"])
124AC_DEFINE_UNQUOTED([CONTROL_HOST_BUSNAME], ["$CONTROL_HOST_BUSNAME"], [The Control Host Dbus busname to own])
125
126# Service dbus root
127AC_ARG_VAR(CONTROL_HOST_OBJPATH, [The Control Host Dbus root])
128AS_IF([test "x$CONTROL_HOST_OBJPATH" == "x"],
129 [CONTROL_HOST_OBJPATH="/xyz/openbmc_project/control/host"])
130AC_DEFINE_UNQUOTED([CONTROL_HOST_OBJPATH], ["$CONTROL_HOST_OBJPATH"], [The Control Host Dbus root])
131
Matthew Barth00b1e5b2016-09-09 12:15:46 -0500132# Create configured output
Vishwanatha Subbanna6dc96682017-02-06 21:47:18 +0530133AC_CONFIG_FILES([Makefile test/Makefile softoff/Makefile softoff/test/Makefile])
Matthew Barth3cff7ed2016-07-27 14:50:51 -0500134AC_OUTPUT