Adriana Kobylak | 88d7cf8 | 2017-01-24 12:30:15 -0600 | [diff] [blame] | 1 | # Initialization |
Adriana Kobylak | f855c3e | 2016-09-29 20:48:08 -0500 | [diff] [blame] | 2 | AC_PREREQ([2.69]) |
| 3 | AC_INIT([phosphor-logging], [1.0], [https://github.com/openbmc/phosphor-logging/issues]) |
Andrew Geissler | 09a0549 | 2017-01-18 13:57:33 -0600 | [diff] [blame] | 4 | AC_LANG([C++]) |
Adriana Kobylak | f855c3e | 2016-09-29 20:48:08 -0500 | [diff] [blame] | 5 | AM_INIT_AUTOMAKE([subdir-objects -Wall -Werror foreign dist-xz]) |
Adriana Kobylak | f855c3e | 2016-09-29 20:48:08 -0500 | [diff] [blame] | 6 | AM_SILENT_RULES([yes]) |
| 7 | |
| 8 | # Checks for programs |
| 9 | AC_PROG_CXX |
Adriana Kobylak | 88d7cf8 | 2017-01-24 12:30:15 -0600 | [diff] [blame] | 10 | AM_PROG_AR |
Adriana Kobylak | f855c3e | 2016-09-29 20:48:08 -0500 | [diff] [blame] | 11 | AC_PROG_INSTALL #Checks/sets the install variable to be used |
| 12 | AC_PROG_MAKE_SET |
Adriana Kobylak | 1a7508b | 2017-02-13 22:51:40 -0600 | [diff] [blame] | 13 | AC_PROG_MKDIR_P |
| 14 | AC_CHECK_PROG([DIRNAME], dirname, dirname) |
Adriana Kobylak | f855c3e | 2016-09-29 20:48:08 -0500 | [diff] [blame] | 15 | |
Marri Devender Rao | b0562c4 | 2017-10-12 23:55:08 -0500 | [diff] [blame] | 16 | # Check for compiler, packages only when install_scripts flag is disabled. |
Marri Devender Rao | dd50846 | 2017-09-20 04:17:58 -0500 | [diff] [blame] | 17 | AC_ARG_ENABLE([install_scripts], |
| 18 | AS_HELP_STRING([--enable-install_scripts], |
| 19 | [Enable installing parser and mako script]), |
Marri Devender Rao | bd68273 | 2017-10-12 02:06:55 -0500 | [diff] [blame] | 20 | [], [install_scripts=no]) |
| 21 | AM_CONDITIONAL([INSTALL_SCRIPTS], [test "x$enable_install_scripts" = "xyes"]) |
Marri Devender Rao | dd50846 | 2017-09-20 04:17:58 -0500 | [diff] [blame] | 22 | AS_IF([test "x$enable_install_scripts" != "xyes"], [ |
| 23 | # Checks for typedefs, structures, and compiler characteristics. |
Vernon Mauery | 93b1b7c | 2018-10-04 10:00:12 -0700 | [diff] [blame] | 24 | AX_CXX_COMPILE_STDCXX_17([noext]) |
Marri Devender Rao | dd50846 | 2017-09-20 04:17:58 -0500 | [diff] [blame] | 25 | AX_APPEND_COMPILE_FLAGS([-fpic -Wall -Werror], [CXXFLAGS]) |
Adriana Kobylak | f855c3e | 2016-09-29 20:48:08 -0500 | [diff] [blame] | 26 | |
Marri Devender Rao | dd50846 | 2017-09-20 04:17:58 -0500 | [diff] [blame] | 27 | # Python |
Patrick Williams | 596b325 | 2020-03-31 10:45:10 -0500 | [diff] [blame] | 28 | AM_PATH_PYTHON([3], [AC_SUBST([PYTHON], [echo "$PYTHON"])], [AC_MSG_ERROR( |
| 29 | [Could not find python-3 installed...python-3 is required])]) |
Brad Bishop | 9316b9a | 2017-02-10 14:21:37 -0500 | [diff] [blame] | 30 | |
Gunnar Mills | 4133daf | 2018-04-08 16:28:21 -0500 | [diff] [blame] | 31 | # Suppress the --with-libtool-sysroot error |
Marri Devender Rao | dd50846 | 2017-09-20 04:17:58 -0500 | [diff] [blame] | 32 | LT_INIT |
Adriana Kobylak | f855c3e | 2016-09-29 20:48:08 -0500 | [diff] [blame] | 33 | |
Marri Devender Rao | dd50846 | 2017-09-20 04:17:58 -0500 | [diff] [blame] | 34 | # Checks for libraries. |
| 35 | AX_PKG_CHECK_MODULES([SYSTEMD], [], [libsystemd >= 221], [], [AC_MSG_ERROR(["systemd required and not found."])]) |
| 36 | |
| 37 | # sdbusplus is non-private because we have no library to link. |
| 38 | # If we ever have a library, move this to private. |
Patrick Venture | 8024d1d | 2019-02-13 08:28:17 -0800 | [diff] [blame] | 39 | AX_PKG_CHECK_MODULES([SDBUSPLUS], [sdbusplus]) |
| 40 | AX_PKG_CHECK_MODULES([PHOSPHOR_DBUS_INTERFACES], [phosphor-dbus-interfaces]) |
Matt Spinler | 8ebfd31 | 2019-06-03 12:43:59 -0500 | [diff] [blame] | 41 | PKG_CHECK_MODULES([SDEVENTPLUS], [sdeventplus]) |
Marri Devender Rao | dd50846 | 2017-09-20 04:17:58 -0500 | [diff] [blame] | 42 | |
| 43 | # Check for sdbus++ |
| 44 | AC_PATH_PROG([SDBUSPLUSPLUS], [sdbus++]) |
| 45 | AS_IF([test "x$SDBUSPLUSPLUS" == "x"], |
| 46 | AC_MSG_ERROR(["Requires sdbus++"])) |
| 47 | ]) |
Adriana Kobylak | f855c3e | 2016-09-29 20:48:08 -0500 | [diff] [blame] | 48 | |
Andrew Geissler | 328889d | 2016-10-10 12:43:48 -0500 | [diff] [blame] | 49 | # Check/set gtest specific functions. |
| 50 | AX_PTHREAD([GTEST_CPPFLAGS="-DGTEST_HAS_PTHREAD=1"],[GTEST_CPPFLAGS="-DGTEST_HAS_PTHREAD=0"]) |
| 51 | AC_SUBST(GTEST_CPPFLAGS) |
| 52 | |
| 53 | # Test cases require SDK so only build if we're told to (and SDK is available) |
| 54 | AC_ARG_ENABLE([oe-sdk], |
| 55 | AS_HELP_STRING([--enable-oe-sdk], [Link testcases absolutely against OE SDK so they can be ran within it.]) |
| 56 | ) |
| 57 | AC_ARG_VAR(OECORE_TARGET_SYSROOT, |
| 58 | [Path to the OE SDK SYSROOT]) |
| 59 | AS_IF([test "x$enable_oe_sdk" == "xyes"], |
| 60 | AS_IF([test "x$OECORE_TARGET_SYSROOT" == "x"], |
| 61 | AC_MSG_ERROR([OECORE_TARGET_SYSROOT must be set with --enable-oe-sdk]) |
| 62 | ) |
| 63 | AC_MSG_NOTICE([Enabling OE-SDK at $OECORE_TARGET_SYSROOT]) |
| 64 | [ |
| 65 | testcase_flags="-Wl,-rpath,\${OECORE_TARGET_SYSROOT}/lib" |
| 66 | testcase_flags="${testcase_flags} -Wl,-rpath,\${OECORE_TARGET_SYSROOT}/usr/lib" |
| 67 | testcase_flags="${testcase_flags} -Wl,-dynamic-linker,`find \${OECORE_TARGET_SYSROOT}/lib/ld-*.so | sort -r -n | head -n1`" |
| 68 | ] |
| 69 | AC_SUBST([OESDK_TESTCASE_FLAGS], [$testcase_flags]) |
| 70 | ) |
| 71 | |
Matt Spinler | 1e71a4d | 2020-03-04 13:40:22 -0600 | [diff] [blame] | 72 | # The continuous integration tests set this. |
| 73 | # Use it to know where to store logs. |
| 74 | AC_ARG_ENABLE([tests], |
| 75 | AS_HELP_STRING([--enable-tests], [Specifies running in the CI environment]) |
| 76 | ) |
| 77 | |
Adriana Kobylak | c0f0532 | 2017-01-12 13:27:49 -0600 | [diff] [blame] | 78 | AC_DEFINE(BUSNAME_LOGGING, "xyz.openbmc_project.Logging", [The log manager DBus busname to own.]) |
Adriana Kobylak | 7c30f49 | 2017-02-23 09:38:45 -0600 | [diff] [blame] | 79 | AC_DEFINE(OBJ_LOGGING, "/xyz/openbmc_project/logging", [The log manager DBus object path.]) |
| 80 | AC_DEFINE(OBJ_INTERNAL, "/xyz/openbmc_project/logging/internal/manager", [The private log manager DBus object path.]) |
| 81 | AC_DEFINE(OBJ_ENTRY, "/xyz/openbmc_project/logging/entry", [The log entry DBus object path.]) |
Deepak Kodihalli | 682326a | 2017-03-06 05:26:53 -0600 | [diff] [blame] | 82 | AC_DEFINE(INVENTORY_ROOT, "/xyz/openbmc_project/inventory", [The inventory root.]) |
| 83 | AC_DEFINE(CALLOUT_FWD_ASSOCIATION, "callout", [The name of the callout's forward association.]) |
| 84 | AC_DEFINE(CALLOUT_REV_ASSOCIATION, "fault", [The name of the callout's reverse association.]) |
Matt Spinler | 1275bd1 | 2018-05-01 15:13:53 -0500 | [diff] [blame] | 85 | AC_DEFINE(BMC_VERSION_FILE, "/etc/os-release", [The file that contains the BMC firmware version]) |
Matt Spinler | 375ac9b | 2018-05-01 15:20:55 -0500 | [diff] [blame] | 86 | AC_DEFINE(FIRST_CEREAL_CLASS_VERSION_WITH_FWLEVEL, "2", |
| 87 | [First Cereal class version with the BMC code version persisted]) |
Adriana Kobylak | ebd59fa | 2017-02-06 20:55:39 -0600 | [diff] [blame] | 88 | |
Matt Spinler | 1e71a4d | 2020-03-04 13:40:22 -0600 | [diff] [blame] | 89 | AC_DEFINE(FIRST_CEREAL_CLASS_VERSION_WITH_UPDATE_TS, "3", |
| 90 | [First Cereal class version with the update timestamp persisted]) |
| 91 | |
Adriana Kobylak | ebd59fa | 2017-02-06 20:55:39 -0600 | [diff] [blame] | 92 | AC_ARG_VAR(YAML_DIR_TEST, [The path to the test error yaml files.]) |
| 93 | AS_IF([test "x$YAML_DIR_TEST" == "x"], \ |
| 94 | [YAML_DIR_TEST="${srcdir}/tools/"]) |
| 95 | AC_ARG_VAR(YAML_DIR, [The path to the yaml error files.]) |
| 96 | AS_IF([test "x$YAML_DIR" == "x"], \ |
| 97 | [YAML_DIR="None"]) |
Deepak Kodihalli | a3db077 | 2017-03-02 09:15:51 -0600 | [diff] [blame] | 98 | AC_ARG_VAR(CALLOUTS_YAML, [YAML filepath containing generated callouts.]) |
| 99 | AS_IF([test "x$CALLOUTS_YAML" == "x"], \ |
| 100 | [CALLOUTS_YAML="callouts-example.yaml"]) |
Adriana Kobylak | ebd59fa | 2017-02-06 20:55:39 -0600 | [diff] [blame] | 101 | |
Nagaraju Goruganti | 477b731 | 2018-06-25 23:28:58 -0500 | [diff] [blame] | 102 | AC_ARG_VAR(ERRLOG_PERSIST_PATH, [Path of directory housing persisted errors.])\ |
| 103 | AS_IF([test "x$ERRLOG_PERSIST_PATH" == "x"], |
| 104 | AS_IF([test "x$enable_oe_sdk" == "xyes"], \ |
| 105 | [ERRLOG_PERSIST_PATH="/tmp/errors"]) |
| 106 | AS_IF([test "x$enable_oe_sdk" == "x"], \ |
| 107 | [ERRLOG_PERSIST_PATH="/var/lib/phosphor-logging/errors"]) |
Matt Spinler | 1e71a4d | 2020-03-04 13:40:22 -0600 | [diff] [blame] | 108 | AS_IF([test "x$enable_tests" == "xyes"], \ |
| 109 | [ERRLOG_PERSIST_PATH="/tmp/errors"]) |
Nagaraju Goruganti | 477b731 | 2018-06-25 23:28:58 -0500 | [diff] [blame] | 110 | AC_DEFINE_UNQUOTED([ERRLOG_PERSIST_PATH], ["$ERRLOG_PERSIST_PATH"], \ |
| 111 | [Path of directory housing persisted errors]) |
| 112 | ) |
Deepak Kodihalli | 72654f1 | 2017-06-12 04:33:29 -0500 | [diff] [blame] | 113 | |
Deepak Kodihalli | 58f16f7 | 2017-03-28 07:32:12 -0500 | [diff] [blame] | 114 | # Compile error metadata handlers if we're asked to do so. |
| 115 | AC_ARG_ENABLE([metadata-processing], |
| 116 | AS_HELP_STRING([--enable-metadata-processing], [Compile metadata handlers]), |
| 117 | [AX_APPEND_COMPILE_FLAGS([-DPROCESS_META], [CXXFLAGS])] |
| 118 | ) |
| 119 | |
Marri Devender Rao | 7656fba | 2017-08-06 05:42:52 -0500 | [diff] [blame] | 120 | AC_ARG_VAR(ERROR_CAP, [Max number of error entries allowed for commit]) |
Andrew Geissler | 4de76fb | 2017-12-15 09:03:51 -0600 | [diff] [blame] | 121 | AS_IF([test "x$ERROR_CAP" == "x"], [ERROR_CAP=200]) |
Marri Devender Rao | 7656fba | 2017-08-06 05:42:52 -0500 | [diff] [blame] | 122 | AC_DEFINE_UNQUOTED([ERROR_CAP], [$ERROR_CAP], [Max number of error entries allowed for commit]) |
| 123 | |
Nagaraju Goruganti | f8a5a79 | 2017-10-13 08:09:52 -0500 | [diff] [blame] | 124 | AC_ARG_VAR(ERROR_INFO_CAP, [Cap on informational (and below) severity errors]) |
| 125 | AS_IF([test "x$ERROR_INFO_CAP" == "x"], [ERROR_INFO_CAP=10]) |
| 126 | AC_DEFINE_UNQUOTED([ERROR_INFO_CAP], [$ERROR_INFO_CAP], \ |
| 127 | [Cap on informational (and below) severity errors]) |
| 128 | |
Vishwanatha Subbanna | 37af9ba | 2017-09-28 16:33:53 +0530 | [diff] [blame] | 129 | AC_ARG_VAR(CLASS_VERSION, [Class version to register with Cereal]) |
Matt Spinler | 1e71a4d | 2020-03-04 13:40:22 -0600 | [diff] [blame] | 130 | AS_IF([test "x$CLASS_VERSION" == "x"], [CLASS_VERSION=3]) |
Vishwanatha Subbanna | 37af9ba | 2017-09-28 16:33:53 +0530 | [diff] [blame] | 131 | AC_DEFINE_UNQUOTED([CLASS_VERSION], [$CLASS_VERSION], [Class version to register with Cereal]) |
| 132 | |
Deepak Kodihalli | c496619 | 2018-08-23 02:19:58 -0500 | [diff] [blame] | 133 | AC_ARG_VAR(RSYSLOG_SERVER_CONFIG_FILE, \ |
| 134 | [Path of config file containing server address]) |
| 135 | AS_IF([test "x$RSYSLOG_SERVER_CONFIG_FILE" == "x"], \ |
| 136 | [RSYSLOG_SERVER_CONFIG_FILE="/etc/rsyslog.d/server.conf"]) |
| 137 | AC_DEFINE_UNQUOTED([RSYSLOG_SERVER_CONFIG_FILE], \ |
| 138 | ["$RSYSLOG_SERVER_CONFIG_FILE"], \ |
| 139 | [Path of config file containing server address]) |
| 140 | |
| 141 | AC_ARG_VAR(BUSNAME_SYSLOG_CONFIG, \ |
| 142 | [D-Bus busname of syslog config service]) |
| 143 | AS_IF([test "x$BUSNAME_SYSLOG_CONFIG" == "x"], \ |
| 144 | [BUSNAME_SYSLOG_CONFIG="xyz.openbmc_project.Syslog.Config"]) |
| 145 | AC_DEFINE_UNQUOTED([BUSNAME_SYSLOG_CONFIG], \ |
| 146 | ["$BUSNAME_SYSLOG_CONFIG"], \ |
| 147 | [D-Bus busname of syslog config service]) |
| 148 | |
| 149 | AC_ARG_VAR(BUSPATH_REMOTE_LOGGING_CONFIG, \ |
| 150 | [D-Bus path of remote logging config object]) |
| 151 | AS_IF([test "x$BUSPATH_REMOTE_LOGGING_CONFIG" == "x"], \ |
| 152 | [BUSPATH_REMOTE_LOGGING_CONFIG="/xyz/openbmc_project/logging/config/remote"]) |
| 153 | AC_DEFINE_UNQUOTED([BUSPATH_REMOTE_LOGGING_CONFIG], \ |
| 154 | ["$BUSPATH_REMOTE_LOGGING_CONFIG"], \ |
| 155 | [D-Bus path of remote logging config object]) |
| 156 | |
| 157 | AC_DEFINE(SYSTEMD_BUSNAME, "org.freedesktop.systemd1", [systemd busname.]) |
| 158 | AC_DEFINE(SYSTEMD_PATH, "/org/freedesktop/systemd1", [systemd path.]) |
| 159 | AC_DEFINE(SYSTEMD_INTERFACE, "org.freedesktop.systemd1.Manager", [systemd interface.]) |
| 160 | |
Matt Spinler | 99c2b40 | 2019-05-23 14:29:16 -0500 | [diff] [blame] | 161 | AC_ARG_ENABLE([openpower-pel-extension], |
| 162 | AS_HELP_STRING([--enable-openpower-pel-extension], [Create PELs]) |
| 163 | ) |
Matt Spinler | df13bdb | 2019-07-10 16:54:13 -0500 | [diff] [blame] | 164 | |
| 165 | AC_ARG_VAR(EXTENSION_PERSIST_DIR, [Base directory for extension persistent data]) |
| 166 | AS_IF([test "x$EXTENSION_PERSIST_DIR" == "x"], \ |
| 167 | [EXTENSION_PERSIST_DIR="/var/lib/phosphor-logging/extensions"]) |
| 168 | AC_DEFINE_UNQUOTED([EXTENSION_PERSIST_DIR], ["$EXTENSION_PERSIST_DIR"], \ |
| 169 | [Base directory for extension persistent data]) |
| 170 | |
Matt Spinler | 99c2b40 | 2019-05-23 14:29:16 -0500 | [diff] [blame] | 171 | AM_CONDITIONAL([ENABLE_PEL_EXTENSION], [test "x$enable_openpower_pel_extension" == "xyes"]) |
| 172 | |
Matt Spinler | 367144c | 2019-09-19 15:33:52 -0500 | [diff] [blame] | 173 | AS_IF([test "x$enable_openpower_pel_extension" == "xyes"], |
| 174 | [AC_CHECK_HEADER( |
| 175 | nlohmann/json.hpp, |
| 176 | [], |
Matt Spinler | 5c350fd | 2019-12-12 13:53:53 -0600 | [diff] [blame] | 177 | [AC_MSG_ERROR([Could not find nlohmann/json.hpp])]) |
| 178 | AC_CHECK_HEADER( |
Matt Spinler | acb7c10 | 2020-01-10 13:49:22 -0600 | [diff] [blame] | 179 | fifo_map.hpp, |
| 180 | [], |
Matt Spinler | 5c350fd | 2019-12-12 13:53:53 -0600 | [diff] [blame] | 181 | [AC_MSG_ERROR([Could not find fifo_map.hpp])]) |
| 182 | |
Matt Spinler | a34ab72 | 2019-12-16 10:39:32 -0600 | [diff] [blame] | 183 | AX_PKG_CHECK_MODULES([LIBPLDM], [libpldm])] |
Matt Spinler | 367144c | 2019-09-19 15:33:52 -0500 | [diff] [blame] | 184 | ) |
| 185 | |
Matt Spinler | 17ed2ed | 2019-12-12 14:12:23 -0600 | [diff] [blame] | 186 | AC_ARG_ENABLE([dont-send-pels-to-host], |
| 187 | AS_HELP_STRING([--enable-dont-send-pels-to-host], |
| 188 | [Do not send PELs to the host. \ |
| 189 | Only applies when PELs are enabled.]), |
| 190 | [AX_APPEND_COMPILE_FLAGS([-DDONT_SEND_PELS_TO_HOST])] |
| 191 | ) |
| 192 | |
Adriana Kobylak | f855c3e | 2016-09-29 20:48:08 -0500 | [diff] [blame] | 193 | AC_CONFIG_HEADERS([config.h]) |
Deepak Kodihalli | c496619 | 2018-08-23 02:19:58 -0500 | [diff] [blame] | 194 | AC_CONFIG_FILES([Makefile test/Makefile phosphor-rsyslog-config/Makefile]) |
Brad Bishop | 9316b9a | 2017-02-10 14:21:37 -0500 | [diff] [blame] | 195 | AC_CONFIG_FILES([phosphor-logging.pc]) |
Adriana Kobylak | 8f7941e | 2016-11-14 14:46:23 -0600 | [diff] [blame] | 196 | AC_OUTPUT |