blob: df0d3102825f2842661ea24837d70b2112c4112b [file] [log] [blame]
Vishwanatha81ee91f2016-08-30 17:17:13 +05301# Initialization
2AC_PREREQ([2.69])
3AC_INIT([phosphor-time-manager], [1.0], [https://github.com/openbmc/phosphor-time-manager/issues])
Lei YU2f9c0cc2017-01-20 14:02:03 +08004AC_LANG([C++])
Vishwanatha81ee91f2016-08-30 17:17:13 +05305AC_CONFIG_HEADERS([config.h])
6AM_INIT_AUTOMAKE([subdir-objects -Wall -Werror foreign dist-xz])
Patrick Williamsf5211452016-11-09 21:58:38 -06007AM_SILENT_RULES([yes])
Vishwanatha81ee91f2016-08-30 17:17:13 +05308
Lei YU19b37ee2018-09-18 14:46:36 +08009# Use gcc-ar and gcc-ranlib for static libraries built with -flto
10AC_SUBST([AR], [${ac_tool_prefix}gcc-ar])
11AC_SUBST([RANLIB], [${ac_tool_prefix}gcc-ranlib])
12
Lei YU2f9c0cc2017-01-20 14:02:03 +080013# Checks for programs
Vishwanatha81ee91f2016-08-30 17:17:13 +053014AC_PROG_CXX
Vishwanatha81ee91f2016-08-30 17:17:13 +053015AM_PROG_AR
Vishwanatha81ee91f2016-08-30 17:17:13 +053016
Gunnar Mills7f25c532017-10-25 20:45:28 -050017# Suppress the --with-libtool-sysroot error
Lei YU2f9c0cc2017-01-20 14:02:03 +080018LT_INIT
19
20# Check for libraries
Patrick Venture6aca02e2019-02-13 15:18:40 -080021PKG_CHECK_MODULES([SYSTEMD], [libsystemd >= 221])
22PKG_CHECK_MODULES([PHOSPHOR_DBUS_INTERFACES], [phosphor-dbus-interfaces])
23PKG_CHECK_MODULES([SDBUSPLUS], [sdbusplus])
24PKG_CHECK_MODULES([PHOSPHOR_LOGGING], [phosphor-logging])
Lei YUbd024392018-09-10 10:34:56 +080025AX_PTHREAD([], [AC_MSG_ERROR(["pthread required and not found"])])
Vishwanatha81ee91f2016-08-30 17:17:13 +053026
Patrick Williamsf5211452016-11-09 21:58:38 -060027# Check/set gtest specific functions.
Lei YUbd024392018-09-10 10:34:56 +080028PKG_CHECK_MODULES([GTEST], [gtest], [], [AC_MSG_NOTICE([gtest not found, tests will not build])])
29PKG_CHECK_MODULES([GMOCK], [gmock], [], [AC_MSG_NOTICE([gmock not found, tests will not build])])
30PKG_CHECK_MODULES([GTEST_MAIN], [gtest_main], [], [AC_MSG_NOTICE([gtest_main not found, tests will not build])])
Patrick Williamsf5211452016-11-09 21:58:38 -060031
Lei YU2f9c0cc2017-01-20 14:02:03 +080032# Test cases require SDK so only build if we're told to (and SDK is available)
Patrick Williamsf5211452016-11-09 21:58:38 -060033AC_ARG_ENABLE([oe-sdk],
34 AS_HELP_STRING([--enable-oe-sdk], [Link testcases absolutely against OE SDK so they can be ran within it.])
35)
36AC_ARG_VAR(OECORE_TARGET_SYSROOT,
37 [Path to the OE SDK SYSROOT])
38AS_IF([test "x$enable_oe_sdk" == "xyes"],
39 AS_IF([test "x$OECORE_TARGET_SYSROOT" == "x"],
40 AC_MSG_ERROR([OECORE_TARGET_SYSROOT must be set with --enable-oe-sdk])
41 )
42 AC_MSG_NOTICE([Enabling OE-SDK at $OECORE_TARGET_SYSROOT])
43 [
44 testcase_flags="-Wl,-rpath,\${OECORE_TARGET_SYSROOT}/lib"
45 testcase_flags="${testcase_flags} -Wl,-rpath,\${OECORE_TARGET_SYSROOT}/usr/lib"
46 testcase_flags="${testcase_flags} -Wl,-dynamic-linker,`find \${OECORE_TARGET_SYSROOT}/lib/ld-*.so | sort -r -n | head -n1`"
47 ]
48 AC_SUBST([OESDK_TESTCASE_FLAGS], [$testcase_flags])
49)
50
Lei YU23d06af2017-07-11 17:22:17 +080051# Check for sdbus++ tool
52AC_PATH_PROG([SDBUSPLUSPLUS], [sdbus++])
53AS_IF([test "x$SDBUSPLUSPLUS" == "x"], AC_MSG_ERROR([Cannot find sdbus++]))
54
Lei YU2f9c0cc2017-01-20 14:02:03 +080055# Checks for typedefs, structures, and compiler characteristics.
Lei YU19b37ee2018-09-18 14:46:36 +080056AX_CXX_COMPILE_STDCXX_17([noext])
Lei YU2f9c0cc2017-01-20 14:02:03 +080057AX_APPEND_COMPILE_FLAGS([-fpic -Wall -Werror], [CXXFLAGS])
58
59# DBUS interface
60AC_ARG_VAR(BUSNAME, [The Time Manager Dbus busname to own])
61AS_IF([test "x$BUSNAME" == "x"], [BUSNAME="xyz.openbmc_project.Time.Manager"])
62AC_DEFINE_UNQUOTED([BUSNAME], ["$BUSNAME"], [The Time Manager DBus busname to own])
63
64AC_ARG_VAR(OBJPATH_BMC, [The bmc epoch Dbus root])
65AS_IF([test "x$OBJPATH_BMC" == "x"], [OBJPATH_BMC="/xyz/openbmc_project/time/bmc"])
66AC_DEFINE_UNQUOTED([OBJPATH_BMC], ["$OBJPATH_BMC"], [The bmc epoch Dbus root])
67
Lei YU1cd42482018-07-24 10:40:59 +080068AC_ARG_VAR(DEFAULT_TIME_MODE, [The default time mode])
69AS_IF([test "x$DEFAULT_TIME_MODE" == "x"], [DEFAULT_TIME_MODE=Mode::Manual])
70AC_DEFINE_UNQUOTED([DEFAULT_TIME_MODE], [$DEFAULT_TIME_MODE], [The default time mode])
71
Lei YU2f9c0cc2017-01-20 14:02:03 +080072AC_CONFIG_FILES([Makefile test/Makefile])
Vishwanatha81ee91f2016-08-30 17:17:13 +053073AC_OUTPUT