blob: 6cebfaef81df50c17fb99a17fc753a988142b536 [file] [log] [blame]
Adriana Kobylak88d7cf82017-01-24 12:30:15 -06001# Initialization
Adriana Kobylakf855c3e2016-09-29 20:48:08 -05002AC_PREREQ([2.69])
3AC_INIT([phosphor-logging], [1.0], [https://github.com/openbmc/phosphor-logging/issues])
Andrew Geissler09a05492017-01-18 13:57:33 -06004AC_LANG([C++])
Matt Spinler7a6ed302020-06-05 14:38:32 -05005AM_INIT_AUTOMAKE([subdir-objects -Wall -Werror -Wno-portability foreign dist-xz])
Adriana Kobylakf855c3e2016-09-29 20:48:08 -05006AM_SILENT_RULES([yes])
7
Matt Spinler7a6ed302020-06-05 14:38:32 -05008# Make sure the default CFLAGS of `-O2 -g` don't override CODE_COVERAGE_CFLAGS
9# It is important that this comes before AC_PROG_C{C,XX}, as we are attempting
10# to stop them from populating default CFLAGS and CXXFLAGS.
11AS_IF([test "x$enable_tests" = "xno"], [enable_code_coverage=no])
12AS_IF([test "x$enable_code_coverage" != "xno"], [
13 AS_IF([test "x${CXXFLAGS+set}" != "xset"], [
14 AC_SUBST(CXXFLAGS, [""])
15 ])
16 AS_IF([test "x${CFLAGS+set}" != "xset"], [
17 AC_SUBST(CFLAGS, [""])
18 ])
19])
20
Adriana Kobylakf855c3e2016-09-29 20:48:08 -050021# Checks for programs
22AC_PROG_CXX
Adriana Kobylak88d7cf82017-01-24 12:30:15 -060023AM_PROG_AR
Adriana Kobylakf855c3e2016-09-29 20:48:08 -050024AC_PROG_INSTALL #Checks/sets the install variable to be used
25AC_PROG_MAKE_SET
Adriana Kobylak1a7508b2017-02-13 22:51:40 -060026AC_PROG_MKDIR_P
27AC_CHECK_PROG([DIRNAME], dirname, dirname)
Adriana Kobylakf855c3e2016-09-29 20:48:08 -050028
Marri Devender Raob0562c42017-10-12 23:55:08 -050029# Check for compiler, packages only when install_scripts flag is disabled.
Marri Devender Raodd508462017-09-20 04:17:58 -050030AC_ARG_ENABLE([install_scripts],
31 AS_HELP_STRING([--enable-install_scripts],
32 [Enable installing parser and mako script]),
Marri Devender Raobd682732017-10-12 02:06:55 -050033 [], [install_scripts=no])
34AM_CONDITIONAL([INSTALL_SCRIPTS], [test "x$enable_install_scripts" = "xyes"])
Marri Devender Raodd508462017-09-20 04:17:58 -050035AS_IF([test "x$enable_install_scripts" != "xyes"], [
36 # Checks for typedefs, structures, and compiler characteristics.
Vernon Mauery93b1b7c2018-10-04 10:00:12 -070037 AX_CXX_COMPILE_STDCXX_17([noext])
Marri Devender Raodd508462017-09-20 04:17:58 -050038 AX_APPEND_COMPILE_FLAGS([-fpic -Wall -Werror], [CXXFLAGS])
Adriana Kobylakf855c3e2016-09-29 20:48:08 -050039
Marri Devender Raodd508462017-09-20 04:17:58 -050040 # Python
Patrick Williams596b3252020-03-31 10:45:10 -050041 AM_PATH_PYTHON([3], [AC_SUBST([PYTHON], [echo "$PYTHON"])], [AC_MSG_ERROR(
42 [Could not find python-3 installed...python-3 is required])])
Brad Bishop9316b9a2017-02-10 14:21:37 -050043
Gunnar Mills4133daf2018-04-08 16:28:21 -050044 # Suppress the --with-libtool-sysroot error
Marri Devender Raodd508462017-09-20 04:17:58 -050045 LT_INIT
Adriana Kobylakf855c3e2016-09-29 20:48:08 -050046
Marri Devender Raodd508462017-09-20 04:17:58 -050047 # Checks for libraries.
48 AX_PKG_CHECK_MODULES([SYSTEMD], [], [libsystemd >= 221], [], [AC_MSG_ERROR(["systemd required and not found."])])
49
50 # sdbusplus is non-private because we have no library to link.
51 # If we ever have a library, move this to private.
Patrick Venture8024d1d2019-02-13 08:28:17 -080052 AX_PKG_CHECK_MODULES([SDBUSPLUS], [sdbusplus])
53 AX_PKG_CHECK_MODULES([PHOSPHOR_DBUS_INTERFACES], [phosphor-dbus-interfaces])
Matt Spinler8ebfd312019-06-03 12:43:59 -050054 PKG_CHECK_MODULES([SDEVENTPLUS], [sdeventplus])
Marri Devender Raodd508462017-09-20 04:17:58 -050055
56 # Check for sdbus++
57 AC_PATH_PROG([SDBUSPLUSPLUS], [sdbus++])
58 AS_IF([test "x$SDBUSPLUSPLUS" == "x"],
59 AC_MSG_ERROR(["Requires sdbus++"]))
60])
Adriana Kobylakf855c3e2016-09-29 20:48:08 -050061
Andrew Geissler328889d2016-10-10 12:43:48 -050062# Check/set gtest specific functions.
63AX_PTHREAD([GTEST_CPPFLAGS="-DGTEST_HAS_PTHREAD=1"],[GTEST_CPPFLAGS="-DGTEST_HAS_PTHREAD=0"])
64AC_SUBST(GTEST_CPPFLAGS)
65
66# Test cases require SDK so only build if we're told to (and SDK is available)
67AC_ARG_ENABLE([oe-sdk],
68 AS_HELP_STRING([--enable-oe-sdk], [Link testcases absolutely against OE SDK so they can be ran within it.])
69)
70AC_ARG_VAR(OECORE_TARGET_SYSROOT,
71 [Path to the OE SDK SYSROOT])
72AS_IF([test "x$enable_oe_sdk" == "xyes"],
73 AS_IF([test "x$OECORE_TARGET_SYSROOT" == "x"],
74 AC_MSG_ERROR([OECORE_TARGET_SYSROOT must be set with --enable-oe-sdk])
75 )
76 AC_MSG_NOTICE([Enabling OE-SDK at $OECORE_TARGET_SYSROOT])
77 [
78 testcase_flags="-Wl,-rpath,\${OECORE_TARGET_SYSROOT}/lib"
79 testcase_flags="${testcase_flags} -Wl,-rpath,\${OECORE_TARGET_SYSROOT}/usr/lib"
80 testcase_flags="${testcase_flags} -Wl,-dynamic-linker,`find \${OECORE_TARGET_SYSROOT}/lib/ld-*.so | sort -r -n | head -n1`"
81 ]
82 AC_SUBST([OESDK_TESTCASE_FLAGS], [$testcase_flags])
83)
84
Matt Spinler1e71a4d2020-03-04 13:40:22 -060085# The continuous integration tests set this.
86# Use it to know where to store logs.
87AC_ARG_ENABLE([tests],
88 AS_HELP_STRING([--enable-tests], [Specifies running in the CI environment])
89)
90
Matt Spinler7a6ed302020-06-05 14:38:32 -050091
92# Check for valgrind
93AS_IF([test "x$enable_tests" = "xno"], [enable_valgrind=no])
94m4_foreach([vgtool], [valgrind_tool_list],
95 [AX_VALGRIND_DFLT(vgtool, [off])])
96AX_VALGRIND_DFLT([memcheck], [on])
97AX_VALGRIND_CHECK
98AM_EXTRA_RECURSIVE_TARGETS([check-valgrind])
99m4_foreach([vgtool], [valgrind_tool_list],
100 [AM_EXTRA_RECURSIVE_TARGETS([check-valgrind-]vgtool)])
101
102# Code coverage
103AX_CODE_COVERAGE
104AS_IF([test "x$CODE_COVERAGE_ENABLED" = "xyes"], [
105 AX_APPEND_COMPILE_FLAGS([-DHAVE_GCOV], [CODE_COVERAGE_CPPFLAGS])
106])
107m4_ifdef([_AX_CODE_COVERAGE_RULES],
108 [AM_CONDITIONAL(AUTOCONF_CODE_COVERAGE_2019_01_06, [true])],
109 [AM_CONDITIONAL(AUTOCONF_CODE_COVERAGE_2019_01_06, [false])])
110AX_ADD_AM_MACRO_STATIC([])
111
Adriana Kobylakc0f05322017-01-12 13:27:49 -0600112AC_DEFINE(BUSNAME_LOGGING, "xyz.openbmc_project.Logging", [The log manager DBus busname to own.])
Adriana Kobylak7c30f492017-02-23 09:38:45 -0600113AC_DEFINE(OBJ_LOGGING, "/xyz/openbmc_project/logging", [The log manager DBus object path.])
114AC_DEFINE(OBJ_INTERNAL, "/xyz/openbmc_project/logging/internal/manager", [The private log manager DBus object path.])
115AC_DEFINE(OBJ_ENTRY, "/xyz/openbmc_project/logging/entry", [The log entry DBus object path.])
Deepak Kodihalli682326a2017-03-06 05:26:53 -0600116AC_DEFINE(INVENTORY_ROOT, "/xyz/openbmc_project/inventory", [The inventory root.])
117AC_DEFINE(CALLOUT_FWD_ASSOCIATION, "callout", [The name of the callout's forward association.])
118AC_DEFINE(CALLOUT_REV_ASSOCIATION, "fault", [The name of the callout's reverse association.])
Matt Spinler1275bd12018-05-01 15:13:53 -0500119AC_DEFINE(BMC_VERSION_FILE, "/etc/os-release", [The file that contains the BMC firmware version])
Matt Spinler375ac9b2018-05-01 15:20:55 -0500120AC_DEFINE(FIRST_CEREAL_CLASS_VERSION_WITH_FWLEVEL, "2",
121 [First Cereal class version with the BMC code version persisted])
Adriana Kobylakebd59fa2017-02-06 20:55:39 -0600122
Matt Spinler1e71a4d2020-03-04 13:40:22 -0600123AC_DEFINE(FIRST_CEREAL_CLASS_VERSION_WITH_UPDATE_TS, "3",
124 [First Cereal class version with the update timestamp persisted])
125
Adriana Kobylakebd59fa2017-02-06 20:55:39 -0600126AC_ARG_VAR(YAML_DIR_TEST, [The path to the test error yaml files.])
127AS_IF([test "x$YAML_DIR_TEST" == "x"], \
128 [YAML_DIR_TEST="${srcdir}/tools/"])
129AC_ARG_VAR(YAML_DIR, [The path to the yaml error files.])
130AS_IF([test "x$YAML_DIR" == "x"], \
131 [YAML_DIR="None"])
Deepak Kodihallia3db0772017-03-02 09:15:51 -0600132AC_ARG_VAR(CALLOUTS_YAML, [YAML filepath containing generated callouts.])
133AS_IF([test "x$CALLOUTS_YAML" == "x"], \
134 [CALLOUTS_YAML="callouts-example.yaml"])
Adriana Kobylakebd59fa2017-02-06 20:55:39 -0600135
Nagaraju Goruganti477b7312018-06-25 23:28:58 -0500136AC_ARG_VAR(ERRLOG_PERSIST_PATH, [Path of directory housing persisted errors.])\
137AS_IF([test "x$ERRLOG_PERSIST_PATH" == "x"],
138 AS_IF([test "x$enable_oe_sdk" == "xyes"], \
139 [ERRLOG_PERSIST_PATH="/tmp/errors"])
140 AS_IF([test "x$enable_oe_sdk" == "x"], \
141 [ERRLOG_PERSIST_PATH="/var/lib/phosphor-logging/errors"])
Matt Spinler1e71a4d2020-03-04 13:40:22 -0600142 AS_IF([test "x$enable_tests" == "xyes"], \
143 [ERRLOG_PERSIST_PATH="/tmp/errors"])
Nagaraju Goruganti477b7312018-06-25 23:28:58 -0500144 AC_DEFINE_UNQUOTED([ERRLOG_PERSIST_PATH], ["$ERRLOG_PERSIST_PATH"], \
145 [Path of directory housing persisted errors])
146)
Deepak Kodihalli72654f12017-06-12 04:33:29 -0500147
Deepak Kodihalli58f16f72017-03-28 07:32:12 -0500148# Compile error metadata handlers if we're asked to do so.
149AC_ARG_ENABLE([metadata-processing],
150 AS_HELP_STRING([--enable-metadata-processing], [Compile metadata handlers]),
151 [AX_APPEND_COMPILE_FLAGS([-DPROCESS_META], [CXXFLAGS])]
152)
153
Marri Devender Rao7656fba2017-08-06 05:42:52 -0500154AC_ARG_VAR(ERROR_CAP, [Max number of error entries allowed for commit])
Andrew Geissler4de76fb2017-12-15 09:03:51 -0600155AS_IF([test "x$ERROR_CAP" == "x"], [ERROR_CAP=200])
Marri Devender Rao7656fba2017-08-06 05:42:52 -0500156AC_DEFINE_UNQUOTED([ERROR_CAP], [$ERROR_CAP], [Max number of error entries allowed for commit])
157
Nagaraju Gorugantif8a5a792017-10-13 08:09:52 -0500158AC_ARG_VAR(ERROR_INFO_CAP, [Cap on informational (and below) severity errors])
159AS_IF([test "x$ERROR_INFO_CAP" == "x"], [ERROR_INFO_CAP=10])
160AC_DEFINE_UNQUOTED([ERROR_INFO_CAP], [$ERROR_INFO_CAP], \
161 [Cap on informational (and below) severity errors])
162
Vishwanatha Subbanna37af9ba2017-09-28 16:33:53 +0530163AC_ARG_VAR(CLASS_VERSION, [Class version to register with Cereal])
Matt Spinler1e71a4d2020-03-04 13:40:22 -0600164AS_IF([test "x$CLASS_VERSION" == "x"], [CLASS_VERSION=3])
Vishwanatha Subbanna37af9ba2017-09-28 16:33:53 +0530165AC_DEFINE_UNQUOTED([CLASS_VERSION], [$CLASS_VERSION], [Class version to register with Cereal])
166
Deepak Kodihallic4966192018-08-23 02:19:58 -0500167AC_ARG_VAR(RSYSLOG_SERVER_CONFIG_FILE, \
168 [Path of config file containing server address])
169AS_IF([test "x$RSYSLOG_SERVER_CONFIG_FILE" == "x"], \
170 [RSYSLOG_SERVER_CONFIG_FILE="/etc/rsyslog.d/server.conf"])
171AC_DEFINE_UNQUOTED([RSYSLOG_SERVER_CONFIG_FILE], \
172 ["$RSYSLOG_SERVER_CONFIG_FILE"], \
173 [Path of config file containing server address])
174
175AC_ARG_VAR(BUSNAME_SYSLOG_CONFIG, \
176 [D-Bus busname of syslog config service])
177AS_IF([test "x$BUSNAME_SYSLOG_CONFIG" == "x"], \
178 [BUSNAME_SYSLOG_CONFIG="xyz.openbmc_project.Syslog.Config"])
179AC_DEFINE_UNQUOTED([BUSNAME_SYSLOG_CONFIG], \
180 ["$BUSNAME_SYSLOG_CONFIG"], \
181 [D-Bus busname of syslog config service])
182
183AC_ARG_VAR(BUSPATH_REMOTE_LOGGING_CONFIG, \
184 [D-Bus path of remote logging config object])
185AS_IF([test "x$BUSPATH_REMOTE_LOGGING_CONFIG" == "x"], \
186 [BUSPATH_REMOTE_LOGGING_CONFIG="/xyz/openbmc_project/logging/config/remote"])
187AC_DEFINE_UNQUOTED([BUSPATH_REMOTE_LOGGING_CONFIG], \
188 ["$BUSPATH_REMOTE_LOGGING_CONFIG"], \
189 [D-Bus path of remote logging config object])
190
191AC_DEFINE(SYSTEMD_BUSNAME, "org.freedesktop.systemd1", [systemd busname.])
192AC_DEFINE(SYSTEMD_PATH, "/org/freedesktop/systemd1", [systemd path.])
193AC_DEFINE(SYSTEMD_INTERFACE, "org.freedesktop.systemd1.Manager", [systemd interface.])
194
Matt Spinler99c2b402019-05-23 14:29:16 -0500195AC_ARG_ENABLE([openpower-pel-extension],
196 AS_HELP_STRING([--enable-openpower-pel-extension], [Create PELs])
197)
Matt Spinlerdf13bdb2019-07-10 16:54:13 -0500198
199AC_ARG_VAR(EXTENSION_PERSIST_DIR, [Base directory for extension persistent data])
200AS_IF([test "x$EXTENSION_PERSIST_DIR" == "x"], \
201 [EXTENSION_PERSIST_DIR="/var/lib/phosphor-logging/extensions"])
202AC_DEFINE_UNQUOTED([EXTENSION_PERSIST_DIR], ["$EXTENSION_PERSIST_DIR"], \
203 [Base directory for extension persistent data])
204
Matt Spinler99c2b402019-05-23 14:29:16 -0500205AM_CONDITIONAL([ENABLE_PEL_EXTENSION], [test "x$enable_openpower_pel_extension" == "xyes"])
206
Matt Spinler367144c2019-09-19 15:33:52 -0500207AS_IF([test "x$enable_openpower_pel_extension" == "xyes"],
208 [AC_CHECK_HEADER(
209 nlohmann/json.hpp,
210 [],
Matt Spinler5c350fd2019-12-12 13:53:53 -0600211 [AC_MSG_ERROR([Could not find nlohmann/json.hpp])])
212 AC_CHECK_HEADER(
Matt Spinleracb7c102020-01-10 13:49:22 -0600213 fifo_map.hpp,
214 [],
Matt Spinler5c350fd2019-12-12 13:53:53 -0600215 [AC_MSG_ERROR([Could not find fifo_map.hpp])])
216
Harisuddin Mohamed Isaf67bafd2020-07-06 17:51:21 +0800217 AX_PKG_CHECK_MODULES([LIBPLDM], [libpldm])
Matt Spinler22421b92020-07-17 09:41:08 -0500218 PKG_CHECK_MODULES([FMT], [fmt])
Harisuddin Mohamed Isaf67bafd2020-07-06 17:51:21 +0800219 AC_ARG_VAR([PYTHON_INCLUDE], [Include flags for python, bypassing python-config])
220 AC_ARG_VAR([PKG_CONFIG], [Path to pkg-config])
221 AS_IF([test -z "$PYTHON_INCLUDE"], [
222 AS_IF([test -z "$PKG_CONFIG"], [
223 AC_PATH_PROGS([PKG_CONFIG],
224 [pkg-config],
225 [no],
226 [`dirname $PYTHON`])
227 AS_IF([test "$PKG_CONFIG" = no], [AC_MSG_ERROR([cannot find pkg-config.])])
228 ])
229 AC_MSG_CHECKING([python include flags])
230 PYTHON_INCLUDE=`$PKG_CONFIG --cflags python3`
231 AC_MSG_RESULT([$PYTHON_INCLUDE])
232 ])
233 AX_APPEND_COMPILE_FLAGS([$PYTHON_INCLUDE], [CXXFLAGS])]
Matt Spinler367144c2019-09-19 15:33:52 -0500234)
235
Matt Spinler17ed2ed2019-12-12 14:12:23 -0600236AC_ARG_ENABLE([dont-send-pels-to-host],
237 AS_HELP_STRING([--enable-dont-send-pels-to-host],
238 [Do not send PELs to the host. \
239 Only applies when PELs are enabled.]),
240 [AX_APPEND_COMPILE_FLAGS([-DDONT_SEND_PELS_TO_HOST])]
241)
242
Adriana Kobylakf855c3e2016-09-29 20:48:08 -0500243AC_CONFIG_HEADERS([config.h])
Deepak Kodihallic4966192018-08-23 02:19:58 -0500244AC_CONFIG_FILES([Makefile test/Makefile phosphor-rsyslog-config/Makefile])
Brad Bishop9316b9a2017-02-10 14:21:37 -0500245AC_CONFIG_FILES([phosphor-logging.pc])
Adriana Kobylak8f7941e2016-11-14 14:46:23 -0600246AC_OUTPUT