blob: 268078806825efa2fa924b9e87bb0ed4f616e1aa [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 YU2f9c0cc2017-01-20 14:02:03 +08009# Checks for programs
Vishwanatha81ee91f2016-08-30 17:17:13 +053010AC_PROG_CXX
Vishwanatha81ee91f2016-08-30 17:17:13 +053011AM_PROG_AR
Vishwanatha81ee91f2016-08-30 17:17:13 +053012
Gunnar Mills7f25c532017-10-25 20:45:28 -050013# Suppress the --with-libtool-sysroot error
Lei YU2f9c0cc2017-01-20 14:02:03 +080014LT_INIT
15
16# Check for libraries
17PKG_CHECK_MODULES([SYSTEMD], [libsystemd >= 221],,\
18 AC_MSG_ERROR(["Systemd required and not found"]))
Deepak Kodihalli20ed79e2017-07-25 05:48:58 -050019PKG_CHECK_MODULES([PHOSPHOR_DBUS_INTERFACES], [phosphor-dbus-interfaces],,\
20 AC_MSG_ERROR(["Requires phosphor-dbus-interfaces package."]))
Lei YU2f9c0cc2017-01-20 14:02:03 +080021PKG_CHECK_MODULES([SDBUSPLUS], [sdbusplus],,\
Deepak Kodihalli20ed79e2017-07-25 05:48:58 -050022 AC_MSG_ERROR(["Requires sdbusplus package."]))
23PKG_CHECK_MODULES([PHOSPHOR_LOGGING], [phosphor-logging],,\
24 AC_MSG_ERROR(["Requires phosphor-logging package."]))
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.
56AX_CXX_COMPILE_STDCXX_14([noext])
57AX_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
68AC_ARG_VAR(OBJPATH_HOST, [The host epoch Dbus root])
69AS_IF([test "x$OBJPATH_HOST" == "x"], [OBJPATH_HOST="/xyz/openbmc_project/time/host"])
70AC_DEFINE_UNQUOTED([OBJPATH_HOST], ["$OBJPATH_HOST"], [The host epoch Dbus root])
71
Lei YUaf5abc52017-03-07 17:49:17 +080072AC_ARG_VAR(HOST_OFFSET_FILE, [The file to save host time offset])
73AS_IF([test "x$HOST_OFFSET_FILE" == "x"], [HOST_OFFSET_FILE="/var/lib/obmc/saved_host_offset"])
74AC_DEFINE_UNQUOTED([HOST_OFFSET_FILE], ["$HOST_OFFSET_FILE"], [The file to save host time offset])
75
Lei YU1cd42482018-07-24 10:40:59 +080076AC_ARG_VAR(DEFAULT_TIME_MODE, [The default time mode])
77AS_IF([test "x$DEFAULT_TIME_MODE" == "x"], [DEFAULT_TIME_MODE=Mode::Manual])
78AC_DEFINE_UNQUOTED([DEFAULT_TIME_MODE], [$DEFAULT_TIME_MODE], [The default time mode])
79
80AC_ARG_VAR(DEFAULT_TIME_OWNER, [The default time owner])
81AS_IF([test "x$DEFAULT_TIME_OWNER" == "x"], [DEFAULT_TIME_OWNER=Owner::Both])
82AC_DEFINE_UNQUOTED([DEFAULT_TIME_OWNER], [$DEFAULT_TIME_OWNER], [The default time owner])
Lei YU2f9c0cc2017-01-20 14:02:03 +080083
84AC_CONFIG_FILES([Makefile test/Makefile])
Vishwanatha81ee91f2016-08-30 17:17:13 +053085AC_OUTPUT