blob: 4a48e57983ac89e89f9f65eeb20de18599852d34 [file] [log] [blame]
Vishwanatha Subbannab21fda72016-10-17 17:46:37 +05301# Initialization
2AC_PREREQ([2.69])
3AC_INIT([phosphor-led-manager], [1.0], [https://github.com/openbmc/phosphor-led-manager/issues])
Vishwanatha Subbannabb8fe0b2016-11-12 18:29:38 +05304AC_LANG([C++])
Vishwanatha Subbannab21fda72016-10-17 17:46:37 +05305AC_CONFIG_HEADERS([config.h])
6AM_INIT_AUTOMAKE([subdir-objects -Wall -Werror foreign dist-xz])
7AM_SILENT_RULES([yes])
8
9# Checks for programs.
10AC_PROG_CXX
Vishwanatha Subbannab21fda72016-10-17 17:46:37 +053011AC_PROG_INSTALL
12AC_PROG_MAKE_SET
Vishwanatha Subbannabb8fe0b2016-11-12 18:29:38 +053013
14# Checks for typedefs, structures, and compiler characteristics.
Vernon Mauery2ff07f32018-10-04 10:22:26 -070015AX_CXX_COMPILE_STDCXX_17([noext])
Vishwanatha Subbannabb8fe0b2016-11-12 18:29:38 +053016AX_APPEND_COMPILE_FLAGS([-Wall -Werror], [CXXFLAGS])
Vishwanatha Subbannab21fda72016-10-17 17:46:37 +053017
18# Python
Vishwanatha Subbanna4f43f5e2020-03-09 03:56:57 -050019AM_PATH_PYTHON([3], [AC_SUBST([PYTHON], [echo "$PYTHON"])], [AC_MSG_ERROR([Could not find python-3 installed...python-3 is required])])
Vishwanatha Subbannab21fda72016-10-17 17:46:37 +053020
Vishwanatha Subbannaed490732016-12-20 15:59:29 +053021LT_INIT # Removes WARNING: unrecognized options: --with-libtool-sysroot
Vishwanatha Subbannabb8fe0b2016-11-12 18:29:38 +053022# Check/set gtest specific functions.
23AX_PTHREAD([GTEST_CPPFLAGS="-DGTEST_HAS_PTHREAD=1"],[GTEST_CPPFLAGS="-DGTEST_HAS_PTHREAD=0"])
24AC_SUBST(GTEST_CPPFLAGS)
Vishwanatha Subbannaed490732016-12-20 15:59:29 +053025AC_ARG_ENABLE([oe-sdk],
26 AS_HELP_STRING([--enable-oe-sdk], [Link testcases absolutely against OE SDK so they can be ran within it.])
27)
28AC_ARG_VAR(OECORE_TARGET_SYSROOT,
29 [Path to the OE SDK SYSROOT])
30AS_IF([test "x$enable_oe_sdk" == "xyes"],
31 AS_IF([test "x$OECORE_TARGET_SYSROOT" == "x"],
32 AC_MSG_ERROR([OECORE_TARGET_SYSROOT must be set with --enable-oe-sdk])
33 )
34 AC_MSG_NOTICE([Enabling OE-SDK at $OECORE_TARGET_SYSROOT])
35 [
36 testcase_flags="-Wl,-rpath,\${OECORE_TARGET_SYSROOT}/lib"
37 testcase_flags="${testcase_flags} -Wl,-rpath,\${OECORE_TARGET_SYSROOT}/usr/lib"
38 testcase_flags="${testcase_flags} -Wl,-dynamic-linker,`find \${OECORE_TARGET_SYSROOT}/lib/ld-*.so | sort -r -n | head -n1`"
39 ]
40 AC_SUBST([OESDK_TESTCASE_FLAGS], [$testcase_flags])
41)
Vishwanatha Subbannabb8fe0b2016-11-12 18:29:38 +053042
Vishwanatha Subbannae89f7272017-03-10 13:16:20 +053043# Checks for modules
44PKG_CHECK_MODULES([SDBUSPLUS], [sdbusplus],, [AC_MSG_ERROR([Could not find sdbusplus...openbmc/sdbusplus package required])])
George Liu616a0712021-02-18 10:50:24 +080045PKG_CHECK_MODULES([SDEVENTPLUS], [sdeventplus],, [AC_MSG_ERROR([Could not find sdeventplus...openbmc/sdeventplus package required])])
Vishwanatha Subbanna11ca8f92017-02-27 19:33:45 +053046PKG_CHECK_MODULES([PHOSPHOR_LOGGING], [phosphor-logging],, [AC_MSG_ERROR([Could not find phosphor-logging...openbmc/phosphor-logging package required])])
Vishwanatha Subbanna55ef5b02017-03-10 13:32:08 +053047PKG_CHECK_MODULES([PHOSPHOR_DBUS_INTERFACES], [phosphor-dbus-interfaces],, [AC_MSG_ERROR([Could not find phosphor-dbus-interfaces...openbmc/phosphor-dbus-interfaces package required])])
George Liue91bc4c2020-07-01 10:49:13 +080048AC_CHECK_HEADER(nlohmann/json.hpp, ,[AC_MSG_ERROR([Could not find nlohmann/json.hpp...nlohmann/json package required])])
Vishwanatha Subbannab21fda72016-10-17 17:46:37 +053049
Dhruvaraj Subhashchandran3c6f29a2017-04-20 09:47:28 -050050# Check for sdbus++ tool
51AC_PATH_PROG([SDBUSPLUSPLUS], [sdbus++])
52AS_IF([test "x$SDBUSPLUSPLUS" == "x"], AC_MSG_ERROR([Cannot find sdbus++]))
53
Vishwanatha Subbannabb8fe0b2016-11-12 18:29:38 +053054# Dbus service name
Vishwanatha Subbannab21fda72016-10-17 17:46:37 +053055AC_ARG_VAR(BUSNAME, [The Dbus busname to own])
Vishwanatha Subbannaa1c7f6a2017-02-02 14:51:42 +053056AS_IF([test "x$BUSNAME" == "x"], [BUSNAME="xyz.openbmc_project.LED.GroupManager"])
Vishwanatha Subbannabb8fe0b2016-11-12 18:29:38 +053057AC_DEFINE_UNQUOTED([BUSNAME], ["$BUSNAME"], [The Dbus busname to own])
58
59# Service dbus root
Vishwanatha Subbannaa1c7f6a2017-02-02 14:51:42 +053060AC_ARG_VAR(OBJPATH, [The LED group Dbus root])
61AS_IF([test "x$OBJPATH" == "x"], [OBJPATH="/xyz/openbmc_project/led/groups"])
62AC_DEFINE_UNQUOTED([OBJPATH], ["$OBJPATH"], [The LED group Dbus root])
Vishwanatha Subbannabb8fe0b2016-11-12 18:29:38 +053063
Vishwanatha Subbannaa3523762017-01-23 17:26:46 +053064# Handling configuration files
65AC_ARG_VAR(YAML_PATH, [The path to the yaml config files.])
66AS_IF([test "x$YAML_PATH" == "x"], [YAML_PATH="$srcdir"])
Brad Bishop513f58e2017-02-08 13:25:17 -050067LEDGEN="$PYTHON $srcdir/parse_led.py -i $YAML_PATH"
Brad Bishopd782d8e2017-02-01 21:23:50 -050068AC_SUBST(LEDGEN)
Vishwanatha Subbannaa3523762017-01-23 17:26:46 +053069
George Liudef5f5a2020-04-10 11:23:52 +080070# JSON configuration file
71AC_ARG_VAR(LED_JSON_FILE, [The LED configuration JSON file])
72AS_IF([test "x$LED_JSON_FILE" == "x"], [LED_JSON_FILE="/usr/share/phosphor-led-manager/led-group-config.json"])
73AC_DEFINE_UNQUOTED([LED_JSON_FILE], ["$LED_JSON_FILE"], [The LED configuration JSON file])
74
George Liu2098aa62020-05-09 11:26:35 +080075AC_ARG_VAR(CLASS_VERSION, [Class version to register with Cereal])
76AS_IF([test "x$CLASS_VERSION" == "x"], [CLASS_VERSION=1])
77AC_DEFINE_UNQUOTED([CLASS_VERSION], [$CLASS_VERSION], [Class version to register with Cereal])
78
George Liudef5f5a2020-04-10 11:23:52 +080079# enable JSON configuration
George Liue06270c2020-07-17 16:45:35 +080080AC_ARG_ENABLE([use-json],
81 AS_HELP_STRING([--enable-use-json], [Enable JSON configuration.]))
George Liu937a0bd2020-07-03 15:29:20 +080082AM_CONDITIONAL([WANTS_JSON], [test "x$enable_use_json" == "xyes"])
83AS_IF([test "x$enable_use_json" == "xyes"],
84 AC_DEFINE([LED_USE_JSON],[],[Enable JSON configuration.])
85)
George Liudef5f5a2020-04-10 11:23:52 +080086
George Liu19c48e12020-09-21 14:41:33 +080087# enable lamp test configuration
88AC_ARG_ENABLE([use-lamp-test],
89 AS_HELP_STRING([--enable-use-lamp-test], [Enable lamp test configuration.]))
90AM_CONDITIONAL([WANTS_LAMP_TEST], [test "x$enable_use_lamp_test" == "xyes"])
91AS_IF([test "x$enable_use_lamp_test" == "xyes"],
92 AC_DEFINE([USE_LAMP_TEST],[],[Enable lamp test configuration.])
93)
94
George Liu2098aa62020-05-09 11:26:35 +080095# Path of file for storing the names of asserted groups
96AC_ARG_VAR(SAVED_GROUPS_FILE, [Path of file for storing the names of asserted groups])
97AS_IF([test "x$SAVED_GROUPS_FILE" == "x"], [SAVED_GROUPS_FILE="/var/lib/phosphor-led-manager/savedGroups"])
98AC_DEFINE_UNQUOTED([SAVED_GROUPS_FILE], ["$SAVED_GROUPS_FILE"], [Path of file for storing the names of asserted groups])
99
Dhruvaraj Subhashchandran59b86cd2017-04-13 00:19:44 -0500100AC_DEFINE(CALLOUT_FWD_ASSOCIATION, "callout", [The name of the callout's forward association.])
101AC_DEFINE(CALLOUT_REV_ASSOCIATION, "fault", [The name of the callout's reverse association.])
Dhruvaraj Subhashchandran3c6f29a2017-04-20 09:47:28 -0500102AC_DEFINE(ELOG_ENTRY, "entry", [Path element indicates an error log entry under logging namespace.])
103AC_DEFINE(LED_FAULT, "fault", [Path element to indicates a fault led under led groups.])
Dhruvaraj Subhashchandran59b86cd2017-04-13 00:19:44 -0500104
Vishwanatha Subbannab21fda72016-10-17 17:46:37 +0530105# Create configured output
Dhruvaraj Subhashchandran59b86cd2017-04-13 00:19:44 -0500106AC_CONFIG_FILES([Makefile test/Makefile fault-monitor/Makefile])
Vishwanatha Subbannab21fda72016-10-17 17:46:37 +0530107AC_OUTPUT