blob: b1e9527f1121601a16169ba6be5a14168189510e [file] [log] [blame]
Vishwanatha Subbanna15b1dc12017-05-23 15:16:13 +05301# Initialization
2AC_PREREQ([2.69])
3AC_INIT([phosphor-watchdog], [1.0],
4 [https://github.com/openbmc/phosphor-watchdog/issues])
5AC_LANG([C++])
6AC_CONFIG_HEADERS([config.h])
7AM_INIT_AUTOMAKE([subdir-objects -Wall -Werror foreign dist-xz])
8AM_SILENT_RULES([yes])
9
10# Checks for programs.
11AC_PROG_CXX
12AC_PROG_INSTALL
13
14# Checks for typedefs, structures, and compiler characteristics.
William A. Kennington III73c2cfb2018-09-12 18:01:37 -070015AX_CXX_COMPILE_STDCXX([17], [noext], [mandatory])
Vishwanatha Subbanna15b1dc12017-05-23 15:16:13 +053016AX_APPEND_COMPILE_FLAGS([-Wall -Werror], [CXXFLAGS])
17
18# For linking
19LT_INIT
20
Vishwanatha Subbannad7a3f132017-05-29 19:39:08 +053021# Check for needed modules
William A. Kennington IIIe2aab942018-01-24 16:56:41 -080022PKG_CHECK_MODULES([PHOSPHOR_LOGGING], [phosphor-logging], [], [AC_MSG_ERROR([Could not find phosphor-logging...openbmc/phosphor-logging package required])])
Vishwanatha Subbannad7a3f132017-05-29 19:39:08 +053023PKG_CHECK_MODULES([SDBUSPLUS], [sdbusplus],, [AC_MSG_ERROR([Could not find sdbusplus...openbmc/sdbusplus package required])])
William A. Kennington IIIf505fc02018-09-12 18:30:09 -070024PKG_CHECK_MODULES([SDEVENTPLUS], [sdeventplus],, [AC_MSG_ERROR([Could not find sdeventplus...openbmc/sdeventplus package required])])
William A. Kennington IIIe2aab942018-01-24 16:56:41 -080025PKG_CHECK_MODULES([PHOSPHOR_DBUS_INTERFACES], [phosphor-dbus-interfaces], [], [AC_MSG_ERROR([Could not find phosphor-dbus-interfaces...openbmc/phosphor-dbus-interfaces package required])])
26PKG_CHECK_MODULES([GTEST_MAIN], [gtest_main], [],
27 [
28 AX_PTHREAD([GTEST_MAIN_CFLAGS="-DGTEST_HAS_PTHREAD=1"],[GTEST_MAIN_CFLAGS="-DGTEST_HAS_PTHREAD=0"])
29 [GTEST_MAIN_LIBS="-lgtest_main -lgtest"]
30 AC_SUBST(GTEST_MAIN_CFLAGS)
31 AC_SUBST(GTEST_MAIN_LIBS)
32 ])
Vishwanatha Subbanna7e146552017-05-29 17:03:33 +053033
William A. Kennington III1eb97d92018-09-13 00:36:12 -070034# We need the header only CLI library
35AC_CHECK_HEADERS([CLI/CLI.hpp], [], [
36 AC_MSG_ERROR([Could not find CLI11 CLI/CLI.hpp])
37])
38
Vishwanatha Subbanna00bd3772017-05-31 14:53:42 +053039AC_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
Vishwanatha Subbanna15b1dc12017-05-23 15:16:13 +053057# Create configured output
Vishwanatha Subbanna00bd3772017-05-31 14:53:42 +053058AC_CONFIG_FILES([Makefile test/Makefile])
Vishwanatha Subbanna15b1dc12017-05-23 15:16:13 +053059AC_OUTPUT