1# Initialization
2AC_PREREQ([2.69])
3AC_INIT([openpower-host-ipmi-oem], [1.0], [https://github.com/openbmc/openpower-host-ipmi-oem/issues])
4AC_CONFIG_HEADERS([config.h])
5AM_INIT_AUTOMAKE([subdir-objects -Wall -Werror foreign dist-xz])
6AM_SILENT_RULES([yes])
7AC_LANG([C++])
8
9# Checks for programs.
10AC_PROG_CXX
11AM_PROG_AR
12AC_PROG_INSTALL
13AC_PROG_MAKE_SET
14
15# Checks for libraries.
16PKG_CHECK_MODULES([SYSTEMD], [libsystemd >= 221])
17
18# Checks for header files.
19AC_CHECK_HEADER(systemd/sd-bus.h, ,[AC_MSG_ERROR([Could not find systemd/sd-bus.h...systemd development package required])])
20AC_CHECK_HEADER(host-ipmid/ipmid-api.h, ,[AC_MSG_ERROR([Could not find host-ipmid/ipmid-api.h...host-ipmid package required])])
21PKG_CHECK_MODULES([OPENPOWER_DBUS_INTERFACES], [openpower-dbus-interfaces])
22PKG_CHECK_MODULES([SDBUSPLUS], [sdbusplus])
23PKG_CHECK_MODULES([PHOSPHOR_LOGGING], [phosphor-logging])
24
25# Check for sdbus++ tool
26AC_PATH_PROG([SDBUSPLUSPLUS], [sdbus++])
27AS_IF([test "x$SDBUSPLUSPLUS" == "x"], AC_MSG_ERROR([Cannot find sdbus++]))
28
29# Checks for typedefs, structures, and compiler characteristics.
30AX_CXX_COMPILE_STDCXX_17([noext])
31AX_APPEND_COMPILE_FLAGS([-Wall -Werror], [CXXFLAGS])
32
33# Checks for library functions.
34LT_INIT([disable-static shared])
35
36# Check/set gtest specific functions.
37AX_PTHREAD([GTEST_CPPFLAGS="-DGTEST_HAS_PTHREAD=1"],[GTEST_CPPFLAGS="-GTEST_HAS_PTHREAD=0"])
38AC_SUBST(GTEST_CPPFLAGS)
39
40AC_ARG_ENABLE([oe-sdk],
41    AS_HELP_STRING([--enable-oe-sdk], [Link testcases absolutely against OE SDK so they can be ran within it.])
42)
43AC_ARG_VAR(OECORE_TARGET_SYSROOT,
44    [Path to the OE SDK SYSROOT])
45AS_IF([test "x$enable_oe_sdk" == "xyes"],
46    AS_IF([test "x$OECORE_TARGET_SYSROOT" == "x"],
47          AC_MSG_ERROR([OECORE_TARGET_SYSROOT must be set with --enable-oe-sdk])
48    )
49    AC_MSG_NOTICE([Enabling OE-SDK at $OECORE_TARGET_SYSROOT])
50    [
51        testcase_flags="-Wl,-rpath,\${OECORE_TARGET_SYSROOT}/lib"
52        testcase_flags="${testcase_flags} -Wl,-rpath,\${OECORE_TARGET_SYSROOT}/usr/lib"
53        testcase_flags="${testcase_flags} -Wl,-dynamic-linker,`find \${OECORE_TARGET_SYSROOT}/lib/ld-*.so | sort -r -n | head -n1`"
54    ]
55    AC_SUBST([OESDK_TESTCASE_FLAGS], [$testcase_flags])
56)
57
58# Host object name in the D-Bus
59AC_ARG_VAR(HOST_NAME, [The Host name in the object path])
60AS_IF([test "x$HOST_NAME" == "x"],
61      [HOST_NAME="host"])
62AC_DEFINE_UNQUOTED([HOST_NAME], ["$HOST_NAME"], [The Host name in the object path])
63
64# Service dbus object manager
65AC_ARG_VAR(CONTROL_HOST_OBJ_MGR, [The Control Host D-Bus Object Manager])
66AS_IF([test "x$CONTROL_HOST_OBJ_MGR" == "x"],
67      [CONTROL_HOST_OBJ_MGR="/org/open_power/control"])
68AC_DEFINE_UNQUOTED([CONTROL_HOST_OBJ_MGR], ["$CONTROL_HOST_OBJ_MGR"], [The Control Host D-Bus Object Manager])
69
70AS_IF([test "x$INVSENSOR_YAML_GEN" == "x"], [INVSENSOR_YAML_GEN="inventory-sensor-example.yaml"])
71INVSENSORGEN="$PYTHON ${srcdir}/scripts/inventory-sensor.py -i $INVSENSOR_YAML_GEN"
72AC_SUBST(INVSENSORGEN)
73
74AC_DEFINE(MAPPER_BUS_NAME, "xyz.openbmc_project.ObjectMapper",
75          [The object mapper bus name])
76
77AC_DEFINE(MAPPER_OBJ, "/xyz/openbmc_project/object_mapper",
78          [The object mapper object path])
79
80AC_DEFINE(MAPPER_IFACE, "xyz.openbmc_project.ObjectMapper",
81          [The object mapper interface])
82
83# Create configured output.
84AC_CONFIG_FILES([Makefile])
85AC_OUTPUT
86