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