blob: 6c5ac705a8f6b707aeb8268618f63bea9db0d4fa [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
Vishwanatha Subbanna7e146552017-05-29 17:03:33 +053022PKG_CHECK_MODULES([SYSTEMD], [libsystemd >= 221], [], [AC_MSG_ERROR(["systemd required and not found"])])
William A. Kennington IIIe2aab942018-01-24 16:56:41 -080023PKG_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 +053024PKG_CHECK_MODULES([SDBUSPLUS], [sdbusplus],, [AC_MSG_ERROR([Could not find sdbusplus...openbmc/sdbusplus 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
Vishwanatha Subbanna00bd3772017-05-31 14:53:42 +053034AC_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
Vishwanatha Subbanna15b1dc12017-05-23 15:16:13 +053052# Create configured output
Vishwanatha Subbanna00bd3772017-05-31 14:53:42 +053053AC_CONFIG_FILES([Makefile test/Makefile])
Vishwanatha Subbanna15b1dc12017-05-23 15:16:13 +053054AC_OUTPUT