blob: 0b96f56b4a44072e0b74939b48b79794160187c1 [file] [log] [blame]
Deepak Kodihalli92a63412017-03-17 05:01:00 -05001AC_PREREQ([2.69])
2AC_INIT([openpower-occ-control], [1.0], [https://github.com/openbmc/openpower-occ-control/issues])
3
4AM_INIT_AUTOMAKE([subdir-objects -Wall -Werror foreign dist-xz])
5AM_SILENT_RULES([yes])
Patrick Venture5902d5f2018-10-29 18:59:37 -07006AC_LANG([C++])
Deepak Kodihalli92a63412017-03-17 05:01:00 -05007
8# Checks for programs
9AC_PROG_CXX
10AM_PROG_AR
11AC_PROG_INSTALL
12AC_PROG_MAKE_SET
13
Marri Devender Raocf4fdca2017-12-29 03:40:05 -060014# Check for compiler, packages only when install_error_yaml optional feature
15# is disabled
16AC_ARG_ENABLE([install_error_yaml],
17 AS_HELP_STRING([--enable-install_error_yaml], [Enable installing error yaml file]),
Marri Devender Rao777cee92018-01-17 00:23:29 -060018 [], [install_error_yaml=no])
Marri Devender Raocf4fdca2017-12-29 03:40:05 -060019AM_CONDITIONAL([INSTALL_ERROR_YAML], [test "x$enable_install_error_yaml" = "xyes"])
20AS_IF([test "x$enable_install_error_yaml" != "xyes"], [
Deepak Kodihalli92a63412017-03-17 05:01:00 -050021
Marri Devender Raocf4fdca2017-12-29 03:40:05 -060022 # Suppress the --with-libtool-sysroot error
23 LT_INIT
Andrew Geissler4cea4d22017-07-10 15:13:33 -050024
Marri Devender Raocf4fdca2017-12-29 03:40:05 -060025 # 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 Geissler4cea4d22017-07-10 15:13:33 -050033 )
Marri Devender Raocf4fdca2017-12-29 03:40:05 -060034 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 Geissler4cea4d22017-07-10 15:13:33 -050048
Patrick Venturedb58b742019-02-13 15:38:39 -080049 PKG_CHECK_MODULES([SDBUSPLUS], [sdbusplus])
50 PKG_CHECK_MODULES([PHOSPHOR_LOGGING], [phosphor-logging])
Patrick Venturedb58b742019-02-13 15:38:39 -080051 PKG_CHECK_MODULES([PHOSPHOR_DBUS_INTERFACES], [phosphor-dbus-interfaces])
Chris Caina8857c52021-01-27 11:53:05 -060052 PKG_CHECK_MODULES([SDEVENTPLUS], [sdeventplus])
53 PKG_CHECK_MODULES([FMT], [fmt])
Deepak Kodihalli92a63412017-03-17 05:01:00 -050054
Marri Devender Raocf4fdca2017-12-29 03:40:05 -060055 # Check for sdbusplus
Patrick Venturedb58b742019-02-13 15:38:39 -080056 PKG_CHECK_MODULES([SDBUSPLUS], [sdbusplus])
Vishwanatha Subbanna9bb065b2017-04-18 14:25:26 +053057
Marri Devender Raocf4fdca2017-12-29 03:40:05 -060058 # Check for sdbus++ tool
59 AC_PATH_PROG([SDBUSPLUSPLUS], [sdbus++])
60 AS_IF([test "x$SDBUSPLUSPLUS" == "x"], AC_MSG_ERROR([Cannot find sdbus++]))
Vishwanatha Subbanna9bb065b2017-04-18 14:25:26 +053061
Marri Devender Raocf4fdca2017-12-29 03:40:05 -060062 # Checks for typedefs, structures, and compiler characteristics.
Vernon Mauery1fcff952018-10-04 10:31:21 -070063 AX_CXX_COMPILE_STDCXX_17([noext])
Marri Devender Raocf4fdca2017-12-29 03:40:05 -060064 AX_APPEND_COMPILE_FLAGS([-Wall -Werror], [CXXFLAGS])
Deepak Kodihalli92a63412017-03-17 05:01:00 -050065
Marri Devender Raocf4fdca2017-12-29 03:40:05 -060066 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 Joseph815f9f52020-07-27 12:12:13 +053076
77 AC_ARG_WITH([host-communication-protocol],
78 AS_HELP_STRING([--with-host-communication-protocol], [To specify the host communication protocol])
79 )
80 AM_CONDITIONAL([ENABLE_PLDM], [test "$with_host_communication_protocol" == "pldm"])
81 AS_IF([test "x$with_host_communication_protocol" == "xpldm"],
82 AC_MSG_NOTICE([Enabling PLDM])
83 [
84 cpp_flags="$CPPFLAGS -DPLDM"
85 AX_PKG_CHECK_MODULES([LIBPLDM], [libpldm])
86 ]
87 AC_SUBST([CPPFLAGS], [$cpp_flags])
88 )
Marri Devender Raocf4fdca2017-12-29 03:40:05 -060089])
Lei YU0ab90ca2017-07-13 17:02:23 +080090
Vishwanatha Subbanna2180b2d2017-06-28 14:05:57 +053091AC_ARG_VAR(OCC_CONTROL_BUSNAME, [The Dbus busname to own])
92AS_IF([test "x$OCC_CONTROL_BUSNAME" == "x"], [OCC_CONTROL_BUSNAME="org.open_power.OCC.Control"])
93AC_DEFINE_UNQUOTED([OCC_CONTROL_BUSNAME], ["$OCC_CONTROL_BUSNAME"], [The DBus busname to own])
Deepak Kodihalli92a63412017-03-17 05:01:00 -050094
Vishwanatha Subbanna2180b2d2017-06-28 14:05:57 +053095AC_ARG_VAR(OCC_CONTROL_ROOT, [The Dbus root])
96AS_IF([test "x$OCC_CONTROL_ROOT" == "x"], [OCC_CONTROL_ROOT="/org/open_power/control"])
97AC_DEFINE_UNQUOTED([OCC_CONTROL_ROOT], ["$OCC_CONTROL_ROOT"], [The Dbus root])
Deepak Kodihalli92a63412017-03-17 05:01:00 -050098
Deepak Kodihallifd358d12017-05-08 07:11:22 -050099AC_ARG_VAR(MAX_CPUS, [The max number of CPUs])
100AS_IF([test "x$MAX_CPUS" == "x"], [MAX_CPUS=2])
101AC_DEFINE_UNQUOTED([MAX_CPUS], [$MAX_CPUS], [The max number of CPUs])
102
103AC_ARG_VAR(CPU_NAME, [The CPU object name])
Deepak Kodihalli92a63412017-03-17 05:01:00 -0500104AS_IF([test "x$CPU_NAME" == "x"], [CPU_NAME="cpu"])
Deepak Kodihallifd358d12017-05-08 07:11:22 -0500105AC_DEFINE_UNQUOTED([CPU_NAME], ["$CPU_NAME"], [The CPU object name])
Deepak Kodihalli92a63412017-03-17 05:01:00 -0500106
Deepak Kodihallifd358d12017-05-08 07:11:22 -0500107AC_ARG_VAR(OCC_NAME, [The OCC object name])
Deepak Kodihalli92a63412017-03-17 05:01:00 -0500108AS_IF([test "x$OCC_NAME" == "x"], [OCC_NAME="occ"])
Deepak Kodihallifd358d12017-05-08 07:11:22 -0500109AC_DEFINE_UNQUOTED([OCC_NAME], ["$OCC_NAME"], [The OCC object name])
Deepak Kodihalli92a63412017-03-17 05:01:00 -0500110
Andrew Geissler6ac874e2017-07-10 15:54:58 -0500111AC_ARG_VAR(OCC_MASTER_NAME, [The OCC master object name])
Eddie Jamese7d976b2018-02-26 13:42:45 -0600112AS_IF([test "x$OCC_MASTER_NAME" == "x"], [OCC_MASTER_NAME="occ-hwmon.1"])
Andrew Geissler6ac874e2017-07-10 15:54:58 -0500113AC_DEFINE_UNQUOTED([OCC_MASTER_NAME], ["$OCC_MASTER_NAME"], [The OCC master object name])
114
Vishwanatha Subbanna32e84e92017-06-28 19:17:28 +0530115AC_ARG_VAR(OCC_HWMON_PATH, [The OCC hwmon path])
Vishwanatha Subbannaee4d83d2017-06-29 18:35:00 +0530116AC_ARG_VAR(DEV_PATH, [The device path])
Lei YU0ab90ca2017-07-13 17:02:23 +0800117AC_ARG_VAR(I2C_OCC_DEVICE_NAME, [The device name of i2c occ hwmon])
118AS_IF([test "x$enable_i2c_occ" == "xyes"],
119 # If enable_2c_occ is defined, define occ hwmon path for I2C and its driver's name
120 AS_IF([test "x$OCC_HWMON_PATH" == "x"], [OCC_HWMON_PATH="/sys/bus/i2c/drivers/occ-hwmon/"])
121 AS_IF([test "x$DEV_PATH" == "x"], [DEV_PATH="/sys/bus/i2c/devices"])
122 AS_IF([test "x$I2C_OCC_DEVICE_NAME" == "x"], [I2C_OCC_DEVICE_NAME="p8-occ-hwmon"]),
123
124 # Else, define occ hwmon path for FSI
125 AS_IF([test "x$OCC_HWMON_PATH" == "x"], [OCC_HWMON_PATH="/sys/bus/platform/drivers/occ-hwmon/"])
126 AS_IF([test "x$DEV_PATH" == "x"], [DEV_PATH="/sys/bus/platform/devices/"]),
127)
128AC_DEFINE_UNQUOTED([OCC_HWMON_PATH], ["$OCC_HWMON_PATH"], [The OCC hwmon path])
Vishwanatha Subbannaee4d83d2017-06-29 18:35:00 +0530129AC_DEFINE_UNQUOTED([DEV_PATH], ["$DEV_PATH"], [The device path])
Lei YU0ab90ca2017-07-13 17:02:23 +0800130AC_DEFINE_UNQUOTED([I2C_OCC_DEVICE_NAME], ["$I2C_OCC_DEVICE_NAME"], [The device name of i2c occ hwmon])
Vishwanatha Subbannaee4d83d2017-06-29 18:35:00 +0530131
Vishwanatha Subbanna3e5422e2017-08-10 18:25:26 +0530132AC_ARG_VAR(OCC_DEV_PATH, [The OCC device path in /dev])
133AS_IF([test "x$OCC_DEV_PATH" == "x"], [OCC_DEV_PATH="/dev/occ"])
134AC_DEFINE_UNQUOTED([OCC_DEV_PATH], ["$OCC_DEV_PATH"], [The OCC device path in /dev])
135
Andrew Geissler4cea4d22017-07-10 15:13:33 -0500136AC_ARG_VAR(PS_DERATING_FACTOR, [The power supply derating factor])
137AS_IF([test "x$PS_DERATING_FACTOR" == "x"], [PS_DERATING_FACTOR=90])
138AC_DEFINE_UNQUOTED([PS_DERATING_FACTOR], [$PS_DERATING_FACTOR], [The power supply derating factor])
139
Deepak Kodihalli5f031f32017-07-26 08:25:59 -0500140AC_ARG_VAR(CPU_SUBPATH, [The subpath containing CPU objects])
141AS_IF([test "x$CPU_SUBPATH" == "x"], [CPU_SUBPATH="/xyz/openbmc_project/inventory/system/chassis/motherboard"])
142AC_DEFINE_UNQUOTED([CPU_SUBPATH], ["$CPU_SUBPATH"], [The subpath containing CPU objects])
143
Vishwanatha Subbanna6add0b82017-07-21 19:02:37 +0530144# Handling configuration files
145AC_ARG_VAR(YAML_PATH, [The path to the yaml config files.])
146AS_IF([test "x$YAML_PATH" == "x"], [YAML_PATH="$srcdir/example"])
147AC_DEFINE_UNQUOTED([YAML_PATH], ["$YAML_PATH"], [The path to the yaml config files])
148
Deepak Kodihalli92a63412017-03-17 05:01:00 -0500149AC_CONFIG_HEADERS([config.h])
Andrew Geissler4cea4d22017-07-10 15:13:33 -0500150AC_CONFIG_FILES([Makefile test/Makefile])
Deepak Kodihalli92a63412017-03-17 05:01:00 -0500151AC_OUTPUT