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 | 2f9c0cc | 2017-01-20 14:02:03 +0800 | [diff] [blame] | 9 | # Checks for programs |
Vishwanatha | 81ee91f | 2016-08-30 17:17:13 +0530 | [diff] [blame] | 10 | AC_PROG_CXX |
Vishwanatha | 81ee91f | 2016-08-30 17:17:13 +0530 | [diff] [blame] | 11 | AM_PROG_AR |
Vishwanatha | 81ee91f | 2016-08-30 17:17:13 +0530 | [diff] [blame] | 12 | |
Lei YU | 2f9c0cc | 2017-01-20 14:02:03 +0800 | [diff] [blame] | 13 | # Surpress the --with-libtool-sysroot error |
| 14 | LT_INIT |
| 15 | |
| 16 | # Check for libraries |
| 17 | PKG_CHECK_MODULES([SYSTEMD], [libsystemd >= 221],,\ |
| 18 | AC_MSG_ERROR(["Systemd required and not found"])) |
Deepak Kodihalli | 20ed79e | 2017-07-25 05:48:58 -0500 | [diff] [blame] | 19 | PKG_CHECK_MODULES([PHOSPHOR_DBUS_INTERFACES], [phosphor-dbus-interfaces],,\ |
| 20 | AC_MSG_ERROR(["Requires phosphor-dbus-interfaces package."])) |
Lei YU | 2f9c0cc | 2017-01-20 14:02:03 +0800 | [diff] [blame] | 21 | PKG_CHECK_MODULES([SDBUSPLUS], [sdbusplus],,\ |
Deepak Kodihalli | 20ed79e | 2017-07-25 05:48:58 -0500 | [diff] [blame] | 22 | AC_MSG_ERROR(["Requires sdbusplus package."])) |
| 23 | PKG_CHECK_MODULES([PHOSPHOR_LOGGING], [phosphor-logging],,\ |
| 24 | AC_MSG_ERROR(["Requires phosphor-logging package."])) |
Vishwanatha | 81ee91f | 2016-08-30 17:17:13 +0530 | [diff] [blame] | 25 | |
Lei YU | 2f9c0cc | 2017-01-20 14:02:03 +0800 | [diff] [blame] | 26 | # gtest |
Patrick Williams | f521145 | 2016-11-09 21:58:38 -0600 | [diff] [blame] | 27 | # Check/set gtest specific functions. |
| 28 | AX_PTHREAD([GTEST_CPPFLAGS="-DGTEST_HAS_PTHREAD=1"],[GTEST_CPPFLAGS="-DGTEST_HAS_PTHREAD=0"]) |
| 29 | AC_SUBST(GTEST_CPPFLAGS) |
| 30 | |
Lei YU | 2f9c0cc | 2017-01-20 14:02:03 +0800 | [diff] [blame] | 31 | # 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] | 32 | AC_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 | ) |
| 35 | AC_ARG_VAR(OECORE_TARGET_SYSROOT, |
| 36 | [Path to the OE SDK SYSROOT]) |
| 37 | AS_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 YU | 23d06af | 2017-07-11 17:22:17 +0800 | [diff] [blame] | 50 | # Check for sdbus++ tool |
| 51 | AC_PATH_PROG([SDBUSPLUSPLUS], [sdbus++]) |
| 52 | AS_IF([test "x$SDBUSPLUSPLUS" == "x"], AC_MSG_ERROR([Cannot find sdbus++])) |
| 53 | |
Lei YU | 2f9c0cc | 2017-01-20 14:02:03 +0800 | [diff] [blame] | 54 | # Checks for typedefs, structures, and compiler characteristics. |
| 55 | AX_CXX_COMPILE_STDCXX_14([noext]) |
| 56 | AX_APPEND_COMPILE_FLAGS([-fpic -Wall -Werror], [CXXFLAGS]) |
| 57 | |
| 58 | # DBUS interface |
| 59 | AC_ARG_VAR(BUSNAME, [The Time Manager Dbus busname to own]) |
| 60 | AS_IF([test "x$BUSNAME" == "x"], [BUSNAME="xyz.openbmc_project.Time.Manager"]) |
| 61 | AC_DEFINE_UNQUOTED([BUSNAME], ["$BUSNAME"], [The Time Manager DBus busname to own]) |
| 62 | |
| 63 | AC_ARG_VAR(OBJPATH_BMC, [The bmc epoch Dbus root]) |
| 64 | AS_IF([test "x$OBJPATH_BMC" == "x"], [OBJPATH_BMC="/xyz/openbmc_project/time/bmc"]) |
| 65 | AC_DEFINE_UNQUOTED([OBJPATH_BMC], ["$OBJPATH_BMC"], [The bmc epoch Dbus root]) |
| 66 | |
| 67 | AC_ARG_VAR(OBJPATH_HOST, [The host epoch Dbus root]) |
| 68 | AS_IF([test "x$OBJPATH_HOST" == "x"], [OBJPATH_HOST="/xyz/openbmc_project/time/host"]) |
| 69 | AC_DEFINE_UNQUOTED([OBJPATH_HOST], ["$OBJPATH_HOST"], [The host epoch Dbus root]) |
| 70 | |
Lei YU | af5abc5 | 2017-03-07 17:49:17 +0800 | [diff] [blame] | 71 | AC_ARG_VAR(HOST_OFFSET_FILE, [The file to save host time offset]) |
| 72 | AS_IF([test "x$HOST_OFFSET_FILE" == "x"], [HOST_OFFSET_FILE="/var/lib/obmc/saved_host_offset"]) |
| 73 | AC_DEFINE_UNQUOTED([HOST_OFFSET_FILE], ["$HOST_OFFSET_FILE"], [The file to save host time offset]) |
| 74 | |
Lei YU | 2f9c0cc | 2017-01-20 14:02:03 +0800 | [diff] [blame] | 75 | |
| 76 | AC_CONFIG_FILES([Makefile test/Makefile]) |
Vishwanatha | 81ee91f | 2016-08-30 17:17:13 +0530 | [diff] [blame] | 77 | AC_OUTPUT |