blob: b73f2ca70b0bc3c6ee613cede17f094309bf424d [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
8# Checks for programs
9AC_PROG_CXX
Adriana Kobylak88d7cf82017-01-24 12:30:15 -060010AM_PROG_AR
Adriana Kobylakf855c3e2016-09-29 20:48:08 -050011AC_PROG_INSTALL #Checks/sets the install variable to be used
12AC_PROG_MAKE_SET
Adriana Kobylak1a7508b2017-02-13 22:51:40 -060013AC_PROG_MKDIR_P
14AC_CHECK_PROG([DIRNAME], dirname, dirname)
Adriana Kobylakf855c3e2016-09-29 20:48:08 -050015
Marri Devender Raob0562c42017-10-12 23:55:08 -050016# Check for compiler, packages only when install_scripts flag is disabled.
Marri Devender Raodd508462017-09-20 04:17:58 -050017AC_ARG_ENABLE([install_scripts],
18 AS_HELP_STRING([--enable-install_scripts],
19 [Enable installing parser and mako script]),
Marri Devender Raobd682732017-10-12 02:06:55 -050020 [], [install_scripts=no])
21AM_CONDITIONAL([INSTALL_SCRIPTS], [test "x$enable_install_scripts" = "xyes"])
Marri Devender Raodd508462017-09-20 04:17:58 -050022AS_IF([test "x$enable_install_scripts" != "xyes"], [
23 # Checks for typedefs, structures, and compiler characteristics.
24 AX_CXX_COMPILE_STDCXX_14([noext])
25 AX_APPEND_COMPILE_FLAGS([-fpic -Wall -Werror], [CXXFLAGS])
Adriana Kobylakf855c3e2016-09-29 20:48:08 -050026
Marri Devender Raodd508462017-09-20 04:17:58 -050027 # Python
28 AM_PATH_PYTHON([2.7], [AC_SUBST([PYTHON], [echo "$PYTHON"])], [AC_MSG_ERROR(
29 [Could not find python-2.7 installed...python-2.7 is required])])
Brad Bishop9316b9a2017-02-10 14:21:37 -050030
Marri Devender Raodd508462017-09-20 04:17:58 -050031 # Surpress the --with-libtool-sysroot error
32 LT_INIT
Adriana Kobylakf855c3e2016-09-29 20:48:08 -050033
Marri Devender Raodd508462017-09-20 04:17:58 -050034 # 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.
39 AX_PKG_CHECK_MODULES([SDBUSPLUS], [sdbusplus], [], [], [AC_MSG_ERROR(["sdbusplus required and not found."])])
40 AX_PKG_CHECK_MODULES([PHOSPHOR_DBUS_INTERFACES], [], [phosphor-dbus-interfaces], [], [AC_MSG_ERROR(["phosphor-dbus-interfaces required and not found."])])
41
42 # Check for sdbus++
43 AC_PATH_PROG([SDBUSPLUSPLUS], [sdbus++])
44 AS_IF([test "x$SDBUSPLUSPLUS" == "x"],
45 AC_MSG_ERROR(["Requires sdbus++"]))
46])
Adriana Kobylakf855c3e2016-09-29 20:48:08 -050047
Andrew Geissler328889d2016-10-10 12:43:48 -050048# Check/set gtest specific functions.
49AX_PTHREAD([GTEST_CPPFLAGS="-DGTEST_HAS_PTHREAD=1"],[GTEST_CPPFLAGS="-DGTEST_HAS_PTHREAD=0"])
50AC_SUBST(GTEST_CPPFLAGS)
51
52# Test cases require SDK so only build if we're told to (and SDK is available)
53AC_ARG_ENABLE([oe-sdk],
54 AS_HELP_STRING([--enable-oe-sdk], [Link testcases absolutely against OE SDK so they can be ran within it.])
55)
56AC_ARG_VAR(OECORE_TARGET_SYSROOT,
57 [Path to the OE SDK SYSROOT])
58AS_IF([test "x$enable_oe_sdk" == "xyes"],
59 AS_IF([test "x$OECORE_TARGET_SYSROOT" == "x"],
60 AC_MSG_ERROR([OECORE_TARGET_SYSROOT must be set with --enable-oe-sdk])
61 )
62 AC_MSG_NOTICE([Enabling OE-SDK at $OECORE_TARGET_SYSROOT])
63 [
64 testcase_flags="-Wl,-rpath,\${OECORE_TARGET_SYSROOT}/lib"
65 testcase_flags="${testcase_flags} -Wl,-rpath,\${OECORE_TARGET_SYSROOT}/usr/lib"
66 testcase_flags="${testcase_flags} -Wl,-dynamic-linker,`find \${OECORE_TARGET_SYSROOT}/lib/ld-*.so | sort -r -n | head -n1`"
67 ]
68 AC_SUBST([OESDK_TESTCASE_FLAGS], [$testcase_flags])
69)
70
Adriana Kobylakc0f05322017-01-12 13:27:49 -060071AC_DEFINE(BUSNAME_LOGGING, "xyz.openbmc_project.Logging", [The log manager DBus busname to own.])
Adriana Kobylak7c30f492017-02-23 09:38:45 -060072AC_DEFINE(OBJ_LOGGING, "/xyz/openbmc_project/logging", [The log manager DBus object path.])
73AC_DEFINE(OBJ_INTERNAL, "/xyz/openbmc_project/logging/internal/manager", [The private log manager DBus object path.])
74AC_DEFINE(OBJ_ENTRY, "/xyz/openbmc_project/logging/entry", [The log entry DBus object path.])
Deepak Kodihalli682326a2017-03-06 05:26:53 -060075AC_DEFINE(INVENTORY_ROOT, "/xyz/openbmc_project/inventory", [The inventory root.])
76AC_DEFINE(CALLOUT_FWD_ASSOCIATION, "callout", [The name of the callout's forward association.])
77AC_DEFINE(CALLOUT_REV_ASSOCIATION, "fault", [The name of the callout's reverse association.])
Adriana Kobylakebd59fa2017-02-06 20:55:39 -060078
79AC_ARG_VAR(YAML_DIR_TEST, [The path to the test error yaml files.])
80AS_IF([test "x$YAML_DIR_TEST" == "x"], \
81 [YAML_DIR_TEST="${srcdir}/tools/"])
82AC_ARG_VAR(YAML_DIR, [The path to the yaml error files.])
83AS_IF([test "x$YAML_DIR" == "x"], \
84 [YAML_DIR="None"])
Deepak Kodihallia3db0772017-03-02 09:15:51 -060085AC_ARG_VAR(CALLOUTS_YAML, [YAML filepath containing generated callouts.])
86AS_IF([test "x$CALLOUTS_YAML" == "x"], \
87 [CALLOUTS_YAML="callouts-example.yaml"])
Adriana Kobylakebd59fa2017-02-06 20:55:39 -060088
Deepak Kodihalli72654f12017-06-12 04:33:29 -050089AC_ARG_VAR(ERRLOG_PERSIST_PATH, [Path of directory housing persisted errors.])
90AS_IF([test "x$ERRLOG_PERSIST_PATH" == "x"], \
91 [ERRLOG_PERSIST_PATH="/var/lib/phosphor-logging/errors"])
92AC_DEFINE_UNQUOTED([ERRLOG_PERSIST_PATH], ["$ERRLOG_PERSIST_PATH"], \
93 [Path of directory housing persisted errors])
94
Deepak Kodihalli58f16f72017-03-28 07:32:12 -050095# Compile error metadata handlers if we're asked to do so.
96AC_ARG_ENABLE([metadata-processing],
97 AS_HELP_STRING([--enable-metadata-processing], [Compile metadata handlers]),
98 [AX_APPEND_COMPILE_FLAGS([-DPROCESS_META], [CXXFLAGS])]
99)
100
Marri Devender Rao7656fba2017-08-06 05:42:52 -0500101AC_ARG_VAR(ERROR_CAP, [Max number of error entries allowed for commit])
102AS_IF([test "x$ERROR_CAP" == "x"], [ERROR_CAP=100])
103AC_DEFINE_UNQUOTED([ERROR_CAP], [$ERROR_CAP], [Max number of error entries allowed for commit])
104
Vishwanatha Subbanna37af9ba2017-09-28 16:33:53 +0530105AC_ARG_VAR(CLASS_VERSION, [Class version to register with Cereal])
106AS_IF([test "x$CLASS_VERSION" == "x"], [CLASS_VERSION=1])
107AC_DEFINE_UNQUOTED([CLASS_VERSION], [$CLASS_VERSION], [Class version to register with Cereal])
108
Adriana Kobylakf855c3e2016-09-29 20:48:08 -0500109AC_CONFIG_HEADERS([config.h])
Andrew Geissler328889d2016-10-10 12:43:48 -0500110AC_CONFIG_FILES([Makefile test/Makefile])
Brad Bishop9316b9a2017-02-10 14:21:37 -0500111AC_CONFIG_FILES([phosphor-logging.pc])
Adriana Kobylak8f7941e2016-11-14 14:46:23 -0600112AC_OUTPUT