Vishwanatha | 81ee91f | 2016-08-30 17:17:13 +0530 | [diff] [blame] | 1 | # Initialization |
| 2 | AC_PREREQ([2.69]) |
| 3 | AC_INIT([phosphor-time-manager], [1.0], [https://github.com/openbmc/phosphor-time-manager/issues]) |
Lei YU | 2f9c0cc | 2017-01-20 14:02:03 +0800 | [diff] [blame] | 4 | AC_LANG([C++]) |
Vishwanatha | 81ee91f | 2016-08-30 17:17:13 +0530 | [diff] [blame] | 5 | AC_CONFIG_HEADERS([config.h]) |
| 6 | AM_INIT_AUTOMAKE([subdir-objects -Wall -Werror foreign dist-xz]) |
Patrick Williams | f521145 | 2016-11-09 21:58:38 -0600 | [diff] [blame] | 7 | AM_SILENT_RULES([yes]) |
Vishwanatha | 81ee91f | 2016-08-30 17:17:13 +0530 | [diff] [blame] | 8 | |
Lei YU | 19b37ee | 2018-09-18 14:46:36 +0800 | [diff] [blame] | 9 | # Use gcc-ar and gcc-ranlib for static libraries built with -flto |
| 10 | AC_SUBST([AR], [${ac_tool_prefix}gcc-ar]) |
| 11 | AC_SUBST([RANLIB], [${ac_tool_prefix}gcc-ranlib]) |
| 12 | |
Lei YU | 2f9c0cc | 2017-01-20 14:02:03 +0800 | [diff] [blame] | 13 | # Checks for programs |
Vishwanatha | 81ee91f | 2016-08-30 17:17:13 +0530 | [diff] [blame] | 14 | AC_PROG_CXX |
Vishwanatha | 81ee91f | 2016-08-30 17:17:13 +0530 | [diff] [blame] | 15 | AM_PROG_AR |
Vishwanatha | 81ee91f | 2016-08-30 17:17:13 +0530 | [diff] [blame] | 16 | |
Gunnar Mills | 7f25c53 | 2017-10-25 20:45:28 -0500 | [diff] [blame] | 17 | # Suppress the --with-libtool-sysroot error |
Lei YU | 2f9c0cc | 2017-01-20 14:02:03 +0800 | [diff] [blame] | 18 | LT_INIT |
| 19 | |
| 20 | # Check for libraries |
| 21 | PKG_CHECK_MODULES([SYSTEMD], [libsystemd >= 221],,\ |
| 22 | AC_MSG_ERROR(["Systemd required and not found"])) |
Deepak Kodihalli | 20ed79e | 2017-07-25 05:48:58 -0500 | [diff] [blame] | 23 | PKG_CHECK_MODULES([PHOSPHOR_DBUS_INTERFACES], [phosphor-dbus-interfaces],,\ |
| 24 | AC_MSG_ERROR(["Requires phosphor-dbus-interfaces package."])) |
Lei YU | 2f9c0cc | 2017-01-20 14:02:03 +0800 | [diff] [blame] | 25 | PKG_CHECK_MODULES([SDBUSPLUS], [sdbusplus],,\ |
Deepak Kodihalli | 20ed79e | 2017-07-25 05:48:58 -0500 | [diff] [blame] | 26 | AC_MSG_ERROR(["Requires sdbusplus package."])) |
| 27 | PKG_CHECK_MODULES([PHOSPHOR_LOGGING], [phosphor-logging],,\ |
| 28 | AC_MSG_ERROR(["Requires phosphor-logging package."])) |
Lei YU | bd02439 | 2018-09-10 10:34:56 +0800 | [diff] [blame] | 29 | AX_PTHREAD([], [AC_MSG_ERROR(["pthread required and not found"])]) |
Vishwanatha | 81ee91f | 2016-08-30 17:17:13 +0530 | [diff] [blame] | 30 | |
Patrick Williams | f521145 | 2016-11-09 21:58:38 -0600 | [diff] [blame] | 31 | # Check/set gtest specific functions. |
Lei YU | bd02439 | 2018-09-10 10:34:56 +0800 | [diff] [blame] | 32 | PKG_CHECK_MODULES([GTEST], [gtest], [], [AC_MSG_NOTICE([gtest not found, tests will not build])]) |
| 33 | PKG_CHECK_MODULES([GMOCK], [gmock], [], [AC_MSG_NOTICE([gmock not found, tests will not build])]) |
| 34 | PKG_CHECK_MODULES([GTEST_MAIN], [gtest_main], [], [AC_MSG_NOTICE([gtest_main not found, tests will not build])]) |
Patrick Williams | f521145 | 2016-11-09 21:58:38 -0600 | [diff] [blame] | 35 | |
Lei YU | 2f9c0cc | 2017-01-20 14:02:03 +0800 | [diff] [blame] | 36 | # Test cases require SDK so only build if we're told to (and SDK is available) |
Patrick Williams | f521145 | 2016-11-09 21:58:38 -0600 | [diff] [blame] | 37 | AC_ARG_ENABLE([oe-sdk], |
| 38 | AS_HELP_STRING([--enable-oe-sdk], [Link testcases absolutely against OE SDK so they can be ran within it.]) |
| 39 | ) |
| 40 | AC_ARG_VAR(OECORE_TARGET_SYSROOT, |
| 41 | [Path to the OE SDK SYSROOT]) |
| 42 | AS_IF([test "x$enable_oe_sdk" == "xyes"], |
| 43 | AS_IF([test "x$OECORE_TARGET_SYSROOT" == "x"], |
| 44 | AC_MSG_ERROR([OECORE_TARGET_SYSROOT must be set with --enable-oe-sdk]) |
| 45 | ) |
| 46 | AC_MSG_NOTICE([Enabling OE-SDK at $OECORE_TARGET_SYSROOT]) |
| 47 | [ |
| 48 | testcase_flags="-Wl,-rpath,\${OECORE_TARGET_SYSROOT}/lib" |
| 49 | testcase_flags="${testcase_flags} -Wl,-rpath,\${OECORE_TARGET_SYSROOT}/usr/lib" |
| 50 | testcase_flags="${testcase_flags} -Wl,-dynamic-linker,`find \${OECORE_TARGET_SYSROOT}/lib/ld-*.so | sort -r -n | head -n1`" |
| 51 | ] |
| 52 | AC_SUBST([OESDK_TESTCASE_FLAGS], [$testcase_flags]) |
| 53 | ) |
| 54 | |
Lei YU | 23d06af | 2017-07-11 17:22:17 +0800 | [diff] [blame] | 55 | # Check for sdbus++ tool |
| 56 | AC_PATH_PROG([SDBUSPLUSPLUS], [sdbus++]) |
| 57 | AS_IF([test "x$SDBUSPLUSPLUS" == "x"], AC_MSG_ERROR([Cannot find sdbus++])) |
| 58 | |
Lei YU | 2f9c0cc | 2017-01-20 14:02:03 +0800 | [diff] [blame] | 59 | # Checks for typedefs, structures, and compiler characteristics. |
Lei YU | 19b37ee | 2018-09-18 14:46:36 +0800 | [diff] [blame] | 60 | AX_CXX_COMPILE_STDCXX_17([noext]) |
Lei YU | 2f9c0cc | 2017-01-20 14:02:03 +0800 | [diff] [blame] | 61 | AX_APPEND_COMPILE_FLAGS([-fpic -Wall -Werror], [CXXFLAGS]) |
| 62 | |
| 63 | # DBUS interface |
| 64 | AC_ARG_VAR(BUSNAME, [The Time Manager Dbus busname to own]) |
| 65 | AS_IF([test "x$BUSNAME" == "x"], [BUSNAME="xyz.openbmc_project.Time.Manager"]) |
| 66 | AC_DEFINE_UNQUOTED([BUSNAME], ["$BUSNAME"], [The Time Manager DBus busname to own]) |
| 67 | |
| 68 | AC_ARG_VAR(OBJPATH_BMC, [The bmc epoch Dbus root]) |
| 69 | AS_IF([test "x$OBJPATH_BMC" == "x"], [OBJPATH_BMC="/xyz/openbmc_project/time/bmc"]) |
| 70 | AC_DEFINE_UNQUOTED([OBJPATH_BMC], ["$OBJPATH_BMC"], [The bmc epoch Dbus root]) |
| 71 | |
| 72 | AC_ARG_VAR(OBJPATH_HOST, [The host epoch Dbus root]) |
| 73 | AS_IF([test "x$OBJPATH_HOST" == "x"], [OBJPATH_HOST="/xyz/openbmc_project/time/host"]) |
| 74 | AC_DEFINE_UNQUOTED([OBJPATH_HOST], ["$OBJPATH_HOST"], [The host epoch Dbus root]) |
| 75 | |
Lei YU | af5abc5 | 2017-03-07 17:49:17 +0800 | [diff] [blame] | 76 | AC_ARG_VAR(HOST_OFFSET_FILE, [The file to save host time offset]) |
| 77 | AS_IF([test "x$HOST_OFFSET_FILE" == "x"], [HOST_OFFSET_FILE="/var/lib/obmc/saved_host_offset"]) |
| 78 | AC_DEFINE_UNQUOTED([HOST_OFFSET_FILE], ["$HOST_OFFSET_FILE"], [The file to save host time offset]) |
| 79 | |
Lei YU | 1cd4248 | 2018-07-24 10:40:59 +0800 | [diff] [blame] | 80 | AC_ARG_VAR(DEFAULT_TIME_MODE, [The default time mode]) |
| 81 | AS_IF([test "x$DEFAULT_TIME_MODE" == "x"], [DEFAULT_TIME_MODE=Mode::Manual]) |
| 82 | AC_DEFINE_UNQUOTED([DEFAULT_TIME_MODE], [$DEFAULT_TIME_MODE], [The default time mode]) |
| 83 | |
| 84 | AC_ARG_VAR(DEFAULT_TIME_OWNER, [The default time owner]) |
| 85 | AS_IF([test "x$DEFAULT_TIME_OWNER" == "x"], [DEFAULT_TIME_OWNER=Owner::Both]) |
| 86 | AC_DEFINE_UNQUOTED([DEFAULT_TIME_OWNER], [$DEFAULT_TIME_OWNER], [The default time owner]) |
Lei YU | 2f9c0cc | 2017-01-20 14:02:03 +0800 | [diff] [blame] | 87 | |
| 88 | AC_CONFIG_FILES([Makefile test/Makefile]) |
Vishwanatha | 81ee91f | 2016-08-30 17:17:13 +0530 | [diff] [blame] | 89 | AC_OUTPUT |