blob: aa54962cafa825393f692b5446979a8b77a87bc4 [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
Lei YU2f9c0cc2017-01-20 14:02:03 +080013# Surpress the --with-libtool-sysroot error
14LT_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."]))
Vishwanatha81ee91f2016-08-30 17:17:13 +053025
Lei YU2f9c0cc2017-01-20 14:02:03 +080026# gtest
Patrick Williamsf5211452016-11-09 21:58:38 -060027# Check/set gtest specific functions.
28AX_PTHREAD([GTEST_CPPFLAGS="-DGTEST_HAS_PTHREAD=1"],[GTEST_CPPFLAGS="-DGTEST_HAS_PTHREAD=0"])
29AC_SUBST(GTEST_CPPFLAGS)
30
Lei YU2f9c0cc2017-01-20 14:02:03 +080031# Test cases require SDK so only build if we're told to (and SDK is available)
Patrick Williamsf5211452016-11-09 21:58:38 -060032AC_ARG_ENABLE([oe-sdk],
33 AS_HELP_STRING([--enable-oe-sdk], [Link testcases absolutely against OE SDK so they can be ran within it.])
34)
35AC_ARG_VAR(OECORE_TARGET_SYSROOT,
36 [Path to the OE SDK SYSROOT])
37AS_IF([test "x$enable_oe_sdk" == "xyes"],
38 AS_IF([test "x$OECORE_TARGET_SYSROOT" == "x"],
39 AC_MSG_ERROR([OECORE_TARGET_SYSROOT must be set with --enable-oe-sdk])
40 )
41 AC_MSG_NOTICE([Enabling OE-SDK at $OECORE_TARGET_SYSROOT])
42 [
43 testcase_flags="-Wl,-rpath,\${OECORE_TARGET_SYSROOT}/lib"
44 testcase_flags="${testcase_flags} -Wl,-rpath,\${OECORE_TARGET_SYSROOT}/usr/lib"
45 testcase_flags="${testcase_flags} -Wl,-dynamic-linker,`find \${OECORE_TARGET_SYSROOT}/lib/ld-*.so | sort -r -n | head -n1`"
46 ]
47 AC_SUBST([OESDK_TESTCASE_FLAGS], [$testcase_flags])
48)
49
Lei YU23d06af2017-07-11 17:22:17 +080050# Check for sdbus++ tool
51AC_PATH_PROG([SDBUSPLUSPLUS], [sdbus++])
52AS_IF([test "x$SDBUSPLUSPLUS" == "x"], AC_MSG_ERROR([Cannot find sdbus++]))
53
Lei YU2f9c0cc2017-01-20 14:02:03 +080054# Checks for typedefs, structures, and compiler characteristics.
55AX_CXX_COMPILE_STDCXX_14([noext])
56AX_APPEND_COMPILE_FLAGS([-fpic -Wall -Werror], [CXXFLAGS])
57
58# DBUS interface
59AC_ARG_VAR(BUSNAME, [The Time Manager Dbus busname to own])
60AS_IF([test "x$BUSNAME" == "x"], [BUSNAME="xyz.openbmc_project.Time.Manager"])
61AC_DEFINE_UNQUOTED([BUSNAME], ["$BUSNAME"], [The Time Manager DBus busname to own])
62
63AC_ARG_VAR(OBJPATH_BMC, [The bmc epoch Dbus root])
64AS_IF([test "x$OBJPATH_BMC" == "x"], [OBJPATH_BMC="/xyz/openbmc_project/time/bmc"])
65AC_DEFINE_UNQUOTED([OBJPATH_BMC], ["$OBJPATH_BMC"], [The bmc epoch Dbus root])
66
67AC_ARG_VAR(OBJPATH_HOST, [The host epoch Dbus root])
68AS_IF([test "x$OBJPATH_HOST" == "x"], [OBJPATH_HOST="/xyz/openbmc_project/time/host"])
69AC_DEFINE_UNQUOTED([OBJPATH_HOST], ["$OBJPATH_HOST"], [The host epoch Dbus root])
70
Lei YUaf5abc52017-03-07 17:49:17 +080071AC_ARG_VAR(HOST_OFFSET_FILE, [The file to save host time offset])
72AS_IF([test "x$HOST_OFFSET_FILE" == "x"], [HOST_OFFSET_FILE="/var/lib/obmc/saved_host_offset"])
73AC_DEFINE_UNQUOTED([HOST_OFFSET_FILE], ["$HOST_OFFSET_FILE"], [The file to save host time offset])
74
Lei YU2f9c0cc2017-01-20 14:02:03 +080075
76AC_CONFIG_FILES([Makefile test/Makefile])
Vishwanatha81ee91f2016-08-30 17:17:13 +053077AC_OUTPUT