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])])
20PKG_CHECK_MODULES([LIBIPMID], [libipmid])
21PKG_CHECK_MODULES([SDBUSPLUS], [sdbusplus])
22PKG_CHECK_MODULES([PHOSPHOR_LOGGING], [phosphor-logging])
23
24# Check for sdbus++ tool
25AC_PATH_PROG([SDBUSPLUSPLUS], [sdbus++])
26AS_IF([test "x$SDBUSPLUSPLUS" == "x"], AC_MSG_ERROR([Cannot find sdbus++]))
27
28# Checks for typedefs, structures, and compiler characteristics.
29AX_CXX_COMPILE_STDCXX([20],[noext])
30AX_APPEND_COMPILE_FLAGS([-Wall -Werror], [CXXFLAGS])
31
32# Checks for library functions.
33LT_INIT([disable-static shared])
34
35# Check/set gtest specific functions.
36AX_PTHREAD([GTEST_CPPFLAGS="-DGTEST_HAS_PTHREAD=1"],[GTEST_CPPFLAGS="-GTEST_HAS_PTHREAD=0"])
37AC_SUBST(GTEST_CPPFLAGS)
38
39AC_ARG_ENABLE([oe-sdk],
40    AS_HELP_STRING([--enable-oe-sdk], [Link testcases absolutely against OE SDK so they can be ran within it.])
41)
42AC_ARG_VAR(OECORE_TARGET_SYSROOT,
43    [Path to the OE SDK SYSROOT])
44AS_IF([test "x$enable_oe_sdk" == "xyes"],
45    AS_IF([test "x$OECORE_TARGET_SYSROOT" == "x"],
46          AC_MSG_ERROR([OECORE_TARGET_SYSROOT must be set with --enable-oe-sdk])
47    )
48    AC_MSG_NOTICE([Enabling OE-SDK at $OECORE_TARGET_SYSROOT])
49    [
50        testcase_flags="-Wl,-rpath,\${OECORE_TARGET_SYSROOT}/lib"
51        testcase_flags="${testcase_flags} -Wl,-rpath,\${OECORE_TARGET_SYSROOT}/usr/lib"
52        testcase_flags="${testcase_flags} -Wl,-dynamic-linker,`find \${OECORE_TARGET_SYSROOT}/lib/ld-*.so | sort -r -n | head -n1`"
53    ]
54    AC_SUBST([OESDK_TESTCASE_FLAGS], [$testcase_flags])
55)
56
57# Host object name in the D-Bus
58AC_ARG_VAR(HOST_NAME, [The Host name in the object path])
59AS_IF([test "x$HOST_NAME" == "x"],
60      [HOST_NAME="host"])
61AC_DEFINE_UNQUOTED([HOST_NAME], ["$HOST_NAME"], [The Host name in the object path])
62
63# Service dbus object manager
64AC_ARG_VAR(CONTROL_HOST_OBJ_MGR, [The Control Host D-Bus Object Manager])
65AS_IF([test "x$CONTROL_HOST_OBJ_MGR" == "x"],
66      [CONTROL_HOST_OBJ_MGR="/org/open_power/control"])
67AC_DEFINE_UNQUOTED([CONTROL_HOST_OBJ_MGR], ["$CONTROL_HOST_OBJ_MGR"], [The Control Host D-Bus Object Manager])
68
69AS_IF([test "x$INVSENSOR_YAML_GEN" == "x"], [INVSENSOR_YAML_GEN="inventory-sensor-example.yaml"])
70INVSENSORGEN="$PYTHON ${srcdir}/scripts/inventory-sensor.py -i $INVSENSOR_YAML_GEN"
71AC_SUBST(INVSENSORGEN)
72
73AC_DEFINE(MAPPER_BUS_NAME, "xyz.openbmc_project.ObjectMapper",
74          [The object mapper bus name])
75
76AC_DEFINE(MAPPER_OBJ, "/xyz/openbmc_project/object_mapper",
77          [The object mapper object path])
78
79AC_DEFINE(MAPPER_IFACE, "xyz.openbmc_project.ObjectMapper",
80          [The object mapper interface])
81
82# Create configured output.
83AC_CONFIG_FILES([Makefile])
84AC_OUTPUT
85