blob: 977bcb094c4ee04125729fb35154bb136bfa09fa [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++])
Adriana Kobylakf855c3e2016-09-29 20:48:08 -05005AM_INIT_AUTOMAKE([subdir-objects -Wall -Werror foreign dist-xz])
Adriana Kobylakf855c3e2016-09-29 20:48:08 -05006AM_SILENT_RULES([yes])
7
Adriana Kobylak88d7cf82017-01-24 12:30:15 -06008# Checks for typedefs, structures, and compiler characteristics.
9AX_CXX_COMPILE_STDCXX_14([noext])
10AX_APPEND_COMPILE_FLAGS([-fpic -Wall -Werror], [CXXFLAGS])
11
Adriana Kobylakf855c3e2016-09-29 20:48:08 -050012# Checks for programs
13AC_PROG_CXX
Adriana Kobylak88d7cf82017-01-24 12:30:15 -060014AM_PROG_AR
Adriana Kobylakf855c3e2016-09-29 20:48:08 -050015AC_PROG_INSTALL #Checks/sets the install variable to be used
16AC_PROG_MAKE_SET
Adriana Kobylak1a7508b2017-02-13 22:51:40 -060017AC_PROG_MKDIR_P
18AC_CHECK_PROG([DIRNAME], dirname, dirname)
Adriana Kobylak7298dc22017-01-24 12:21:50 -060019# Python
20AM_PATH_PYTHON([2.7], [AC_SUBST([PYTHON], [echo "$PYTHON"])], [AC_MSG_ERROR(
21 [Could not find python-2.7 installed...python-2.7 is required])])
Adriana Kobylakf855c3e2016-09-29 20:48:08 -050022
23# Surpress the --with-libtool-sysroot error
24LT_INIT
25
Brad Bishop9316b9a2017-02-10 14:21:37 -050026# Checks for libraries.
27AX_PKG_CHECK_MODULES([SYSTEMD], [], [libsystemd >= 221], [], [AC_MSG_ERROR(["systemd required and not found."])])
28
29# sdbusplus is non-private because we have no library to link.
30# If we ever have a library, move this to private.
31AX_PKG_CHECK_MODULES([SDBUSPLUS], [sdbusplus], [], [], [AC_MSG_ERROR(["sdbusplus required and not found."])])
32AX_PKG_CHECK_MODULES([PHOSPHOR_DBUS_INTERFACES], [], [phosphor-dbus-interfaces], [], [AC_MSG_ERROR(["phosphor-dbus-interfaces required and not found."])])
Adriana Kobylakf855c3e2016-09-29 20:48:08 -050033
Adriana Kobylak1a7508b2017-02-13 22:51:40 -060034# Check for sdbus++
35AC_PATH_PROG([SDBUSPLUSPLUS], [sdbus++])
36AS_IF([test "x$SDBUSPLUSPLUS" == "x"],
37 AC_MSG_ERROR(["Requires sdbus++"]))
Adriana Kobylakf855c3e2016-09-29 20:48:08 -050038
Andrew Geissler328889d2016-10-10 12:43:48 -050039# Check/set gtest specific functions.
40AX_PTHREAD([GTEST_CPPFLAGS="-DGTEST_HAS_PTHREAD=1"],[GTEST_CPPFLAGS="-DGTEST_HAS_PTHREAD=0"])
41AC_SUBST(GTEST_CPPFLAGS)
42
43# Test cases require SDK so only build if we're told to (and SDK is available)
44AC_ARG_ENABLE([oe-sdk],
45 AS_HELP_STRING([--enable-oe-sdk], [Link testcases absolutely against OE SDK so they can be ran within it.])
46)
47AC_ARG_VAR(OECORE_TARGET_SYSROOT,
48 [Path to the OE SDK SYSROOT])
49AS_IF([test "x$enable_oe_sdk" == "xyes"],
50 AS_IF([test "x$OECORE_TARGET_SYSROOT" == "x"],
51 AC_MSG_ERROR([OECORE_TARGET_SYSROOT must be set with --enable-oe-sdk])
52 )
53 AC_MSG_NOTICE([Enabling OE-SDK at $OECORE_TARGET_SYSROOT])
54 [
55 testcase_flags="-Wl,-rpath,\${OECORE_TARGET_SYSROOT}/lib"
56 testcase_flags="${testcase_flags} -Wl,-rpath,\${OECORE_TARGET_SYSROOT}/usr/lib"
57 testcase_flags="${testcase_flags} -Wl,-dynamic-linker,`find \${OECORE_TARGET_SYSROOT}/lib/ld-*.so | sort -r -n | head -n1`"
58 ]
59 AC_SUBST([OESDK_TESTCASE_FLAGS], [$testcase_flags])
60)
61
Adriana Kobylakc0f05322017-01-12 13:27:49 -060062AC_DEFINE(BUSNAME_LOGGING, "xyz.openbmc_project.Logging", [The log manager DBus busname to own.])
Adriana Kobylak7c30f492017-02-23 09:38:45 -060063AC_DEFINE(OBJ_LOGGING, "/xyz/openbmc_project/logging", [The log manager DBus object path.])
64AC_DEFINE(OBJ_INTERNAL, "/xyz/openbmc_project/logging/internal/manager", [The private log manager DBus object path.])
65AC_DEFINE(OBJ_ENTRY, "/xyz/openbmc_project/logging/entry", [The log entry DBus object path.])
Deepak Kodihalli682326a2017-03-06 05:26:53 -060066AC_DEFINE(INVENTORY_ROOT, "/xyz/openbmc_project/inventory", [The inventory root.])
67AC_DEFINE(CALLOUT_FWD_ASSOCIATION, "callout", [The name of the callout's forward association.])
68AC_DEFINE(CALLOUT_REV_ASSOCIATION, "fault", [The name of the callout's reverse association.])
Adriana Kobylakebd59fa2017-02-06 20:55:39 -060069
70AC_ARG_VAR(YAML_DIR_TEST, [The path to the test error yaml files.])
71AS_IF([test "x$YAML_DIR_TEST" == "x"], \
72 [YAML_DIR_TEST="${srcdir}/tools/"])
73AC_ARG_VAR(YAML_DIR, [The path to the yaml error files.])
74AS_IF([test "x$YAML_DIR" == "x"], \
75 [YAML_DIR="None"])
Deepak Kodihallia3db0772017-03-02 09:15:51 -060076AC_ARG_VAR(CALLOUTS_YAML, [YAML filepath containing generated callouts.])
77AS_IF([test "x$CALLOUTS_YAML" == "x"], \
78 [CALLOUTS_YAML="callouts-example.yaml"])
Adriana Kobylakebd59fa2017-02-06 20:55:39 -060079
Deepak Kodihalli72654f12017-06-12 04:33:29 -050080AC_ARG_VAR(ERRLOG_PERSIST_PATH, [Path of directory housing persisted errors.])
81AS_IF([test "x$ERRLOG_PERSIST_PATH" == "x"], \
82 [ERRLOG_PERSIST_PATH="/var/lib/phosphor-logging/errors"])
83AC_DEFINE_UNQUOTED([ERRLOG_PERSIST_PATH], ["$ERRLOG_PERSIST_PATH"], \
84 [Path of directory housing persisted errors])
85
Deepak Kodihalli58f16f72017-03-28 07:32:12 -050086# Compile error metadata handlers if we're asked to do so.
87AC_ARG_ENABLE([metadata-processing],
88 AS_HELP_STRING([--enable-metadata-processing], [Compile metadata handlers]),
89 [AX_APPEND_COMPILE_FLAGS([-DPROCESS_META], [CXXFLAGS])]
90)
91
Adriana Kobylakf855c3e2016-09-29 20:48:08 -050092AC_CONFIG_HEADERS([config.h])
Andrew Geissler328889d2016-10-10 12:43:48 -050093AC_CONFIG_FILES([Makefile test/Makefile])
Brad Bishop9316b9a2017-02-10 14:21:37 -050094AC_CONFIG_FILES([phosphor-logging.pc])
Adriana Kobylak8f7941e2016-11-14 14:46:23 -060095AC_OUTPUT