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])
7
8# Checks for programs.
9AC_PROG_CXX
10AM_PROG_AR
11AC_PROG_INSTALL
12AC_PROG_MAKE_SET
13
14# Checks for libraries.
15PKG_CHECK_MODULES([SYSTEMD], [libsystemd >= 221])
16
17# Checks for header files.
18AC_CHECK_HEADER(systemd/sd-bus.h, ,[AC_MSG_ERROR([Could not find systemd/sd-bus.h...systemd development package required])])
19AC_CHECK_HEADER(host-ipmid/ipmid-api.h, ,[AC_MSG_ERROR([Could not find host-ipmid/ipmid-api.h...host-ipmid package required])])
20PKG_CHECK_MODULES([OPENPOWER_DBUS_INTERFACES], [openpower-dbus-interfaces],,
21                  [AC_MSG_ERROR([Could not find openpower-dbus-interfaces...openbmc/openpower-dbus-interfaces package required])])
22
23# Checks for typedefs, structures, and compiler characteristics.
24AX_CXX_COMPILE_STDCXX(14, [noext])
25AX_APPEND_COMPILE_FLAGS([-Wall -Werror], [CXXFLAGS])
26
27# Checks for library functions.
28LT_INIT([disable-static shared])
29
30# Check/set gtest specific functions.
31AX_PTHREAD([GTEST_CPPFLAGS="-DGTEST_HAS_PTHREAD=1"],[GTEST_CPPFLAGS="-GTEST_HAS_PTHREAD=0"])
32AC_SUBST(GTEST_CPPFLAGS)
33
34AC_ARG_ENABLE([oe-sdk],
35    AS_HELP_STRING([--enable-oe-sdk], [Link testcases absolutely against OE SDK so they can be ran within it.])
36)
37AC_ARG_VAR(OECORE_TARGET_SYSROOT,
38    [Path to the OE SDK SYSROOT])
39AS_IF([test "x$enable_oe_sdk" == "xyes"],
40    AS_IF([test "x$OECORE_TARGET_SYSROOT" == "x"],
41          AC_MSG_ERROR([OECORE_TARGET_SYSROOT must be set with --enable-oe-sdk])
42    )
43    AC_MSG_NOTICE([Enabling OE-SDK at $OECORE_TARGET_SYSROOT])
44    [
45        testcase_flags="-Wl,-rpath,\${OECORE_TARGET_SYSROOT}/lib"
46        testcase_flags="${testcase_flags} -Wl,-rpath,\${OECORE_TARGET_SYSROOT}/usr/lib"
47        testcase_flags="${testcase_flags} -Wl,-dynamic-linker,`find \${OECORE_TARGET_SYSROOT}/lib/ld-*.so | sort -r -n | head -n1`"
48    ]
49    AC_SUBST([OESDK_TESTCASE_FLAGS], [$testcase_flags])
50)
51
52# Host object name in the D-Bus
53AC_ARG_VAR(HOST_NAME, [The Host name in the object path])
54AS_IF([test "x$HOST_NAME" == "x"],
55      [HOST_NAME="host"])
56AC_DEFINE_UNQUOTED([HOST_NAME], ["$HOST_NAME"], [The Host name in the object path])
57
58# Service dbus object manager
59AC_ARG_VAR(CONTROL_HOST_OBJ_MGR, [The Control Host D-Bus Object Manager])
60AS_IF([test "x$CONTROL_HOST_OBJ_MGR" == "x"],
61      [CONTROL_HOST_OBJ_MGR="/org/open_power/control"])
62AC_DEFINE_UNQUOTED([CONTROL_HOST_OBJ_MGR], ["$CONTROL_HOST_OBJ_MGR"], [The Control Host D-Bus Object Manager])
63
64# Create configured output.
65AC_CONFIG_FILES([Makefile])
66AC_OUTPUT
67