Patrick Venture | e620656 | 2018-03-08 15:36:53 -0800 | [diff] [blame] | 1 | # Initialization |
| 2 | AC_PREREQ([2.69]) |
Patrick Venture | d752357 | 2018-11-26 09:01:54 -0800 | [diff] [blame] | 3 | AC_INIT([swampd], [0.1], [https://github.com/openbmc/phosphor-pid-control/issues]) |
Patrick Venture | e620656 | 2018-03-08 15:36:53 -0800 | [diff] [blame] | 4 | AC_LANG([C++]) |
| 5 | AC_CONFIG_HEADERS([config.h]) |
| 6 | AM_INIT_AUTOMAKE([subdir-objects -Wall -Werror foreign dist-xz]) |
| 7 | AM_SILENT_RULES([yes]) |
| 8 | |
| 9 | # Checks for programs. |
| 10 | AC_PROG_CXX |
| 11 | AM_PROG_AR |
| 12 | AC_PROG_INSTALL |
| 13 | AC_PROG_MAKE_SET |
| 14 | |
Patrick Venture | e620656 | 2018-03-08 15:36:53 -0800 | [diff] [blame] | 15 | # Checks for typedefs, structures, and compiler characteristics. |
Patrick Venture | 54c2e5e | 2018-09-10 13:06:38 -0700 | [diff] [blame] | 16 | AX_CXX_COMPILE_STDCXX_17([noext]) |
Patrick Venture | ab28cb3 | 2018-06-20 18:37:48 -0700 | [diff] [blame] | 17 | AX_APPEND_COMPILE_FLAGS([-fpic -Wall -Werror], [CXXFLAGS]) |
Patrick Venture | e620656 | 2018-03-08 15:36:53 -0800 | [diff] [blame] | 18 | |
| 19 | # Checks for libraries. |
Patrick Venture | e54c7ff | 2018-11-21 21:30:56 -0800 | [diff] [blame] | 20 | PKG_CHECK_MODULES( |
| 21 | [SYSTEMD], |
| 22 | [libsystemd >= 221], |
| 23 | [], |
| 24 | [AC_MSG_ERROR(["systemd required and not found"])] |
| 25 | ) |
Patrick Venture | f72ad44 | 2019-02-13 07:28:58 -0800 | [diff] [blame] | 26 | PKG_CHECK_MODULES([SDBUSPLUS], [sdbusplus]) |
| 27 | PKG_CHECK_MODULES([PHOSPHOR_LOGGING], [phosphor-logging]) |
| 28 | PKG_CHECK_MODULES([PHOSPHOR_DBUS_INTERFACES], [phosphor-dbus-interfaces]) |
William A. Kennington III | 331143c | 2019-02-07 15:52:44 -0800 | [diff] [blame] | 29 | PKG_CHECK_MODULES( |
| 30 | [LIBIPMID], |
| 31 | [libipmid], |
| 32 | [], |
| 33 | [AC_MSG_ERROR([Could not find libipmid...openbmc/phosphor-host-ipmid package required])] |
Patrick Venture | e54c7ff | 2018-11-21 21:30:56 -0800 | [diff] [blame] | 34 | ) |
| 35 | AC_CHECK_HEADER( |
| 36 | experimental/filesystem, |
| 37 | [], |
| 38 | [AC_MSG_ERROR([Could not find experimental/filesystem...libstdc++fs development package required])] |
| 39 | ) |
Patrick Venture | 31eebcd | 2019-02-12 07:23:42 -0800 | [diff] [blame] | 40 | AC_CHECK_HEADER( |
| 41 | nlohmann/json.hpp, |
| 42 | [], |
| 43 | [AC_MSG_ERROR([Could not find nlohmann/json.hpp])] |
| 44 | ) |
Patrick Venture | 2e3ecb5 | 2018-06-22 08:18:19 -0700 | [diff] [blame] | 45 | AX_PTHREAD([], [AC_MSG_ERROR(["pthread required and not found"])]) |
Patrick Venture | e620656 | 2018-03-08 15:36:53 -0800 | [diff] [blame] | 46 | |
| 47 | # Checks for library functions. |
| 48 | LT_INIT # Required for systemd linking |
| 49 | |
| 50 | # Check/set gtest specific functions. |
Patrick Venture | f77ecc7 | 2018-11-26 09:08:49 -0800 | [diff] [blame] | 51 | PKG_CHECK_MODULES( |
| 52 | [GTEST], |
| 53 | [gtest], |
| 54 | [], |
| 55 | [AC_MSG_NOTICE([gtest not found, tests will not build])] |
| 56 | ) |
| 57 | PKG_CHECK_MODULES( |
| 58 | [GMOCK], |
| 59 | [gmock], |
| 60 | [], |
| 61 | [AC_MSG_NOTICE([gmock not found, tests will not build])] |
| 62 | ) |
| 63 | PKG_CHECK_MODULES( |
| 64 | [GTEST_MAIN], |
| 65 | [gtest_main], |
| 66 | [], |
| 67 | [AC_MSG_NOTICE([gtest_main not found, tests will not build])] |
| 68 | ) |
Patrick Venture | e620656 | 2018-03-08 15:36:53 -0800 | [diff] [blame] | 69 | |
| 70 | AC_ARG_ENABLE([oe-sdk], |
Patrick Venture | f77ecc7 | 2018-11-26 09:08:49 -0800 | [diff] [blame] | 71 | AS_HELP_STRING( |
| 72 | [--enable-oe-sdk], |
| 73 | [Link testcases absolutely against OE SDK so they can be ran within it.] |
| 74 | ) |
Patrick Venture | e620656 | 2018-03-08 15:36:53 -0800 | [diff] [blame] | 75 | ) |
| 76 | AC_ARG_VAR(OECORE_TARGET_SYSROOT, |
Patrick Venture | f77ecc7 | 2018-11-26 09:08:49 -0800 | [diff] [blame] | 77 | [Path to the OE SDK SYSROOT] |
| 78 | ) |
Patrick Venture | e620656 | 2018-03-08 15:36:53 -0800 | [diff] [blame] | 79 | AS_IF([test "x$enable_oe_sdk" == "xyes"], |
| 80 | AS_IF([test "x$OECORE_TARGET_SYSROOT" == "x"], |
| 81 | AC_MSG_ERROR([OECORE_TARGET_SYSROOT must be set with --enable-oe-sdk]) |
| 82 | ) |
| 83 | AC_MSG_NOTICE([Enabling OE-SDK at $OECORE_TARGET_SYSROOT]) |
| 84 | [ |
| 85 | testcase_flags="-Wl,-rpath,\${OECORE_TARGET_SYSROOT}/lib" |
| 86 | testcase_flags="${testcase_flags} -Wl,-rpath,\${OECORE_TARGET_SYSROOT}/usr/lib" |
| 87 | testcase_flags="${testcase_flags} -Wl,-dynamic-linker,`find \${OECORE_TARGET_SYSROOT}/lib/ld-*.so | sort -r -n | head -n1`" |
| 88 | ] |
| 89 | AC_SUBST([OESDK_TESTCASE_FLAGS], [$testcase_flags]) |
| 90 | ) |
| 91 | |
James Feist | 7136a5a | 2018-07-19 09:52:05 -0700 | [diff] [blame] | 92 | AC_ARG_ENABLE([configure-dbus], |
Patrick Venture | f77ecc7 | 2018-11-26 09:08:49 -0800 | [diff] [blame] | 93 | AS_HELP_STRING( |
| 94 | [--enable-configure-dbus], [Enable configuring pid from D-Bus.] |
| 95 | ) |
| 96 | ) |
James Feist | 7136a5a | 2018-07-19 09:52:05 -0700 | [diff] [blame] | 97 | AM_CONDITIONAL(CONFIGURE_DBUS, [test "x$enable_configure_dbus" = "xyes"]) |
| 98 | AS_IF([test "x$enable_configure_dbus" = "xyes"], |
James Feist | ce15e02 | 2018-09-26 10:01:33 -0700 | [diff] [blame] | 99 | [AC_DEFINE(CONFIGURE_DBUS, [1], [Read configuration from D-Bus.])], |
| 100 | [AC_DEFINE(CONFIGURE_DBUS, [0], [Do not read configuration from D-Bus.])] |
James Feist | 7136a5a | 2018-07-19 09:52:05 -0700 | [diff] [blame] | 101 | ) |
| 102 | |
Patrick Venture | e620656 | 2018-03-08 15:36:53 -0800 | [diff] [blame] | 103 | # Create configured output |
Patrick Venture | 7a841b6 | 2018-06-13 09:39:46 -0700 | [diff] [blame] | 104 | AC_CONFIG_FILES([Makefile test/Makefile]) |
Patrick Venture | e620656 | 2018-03-08 15:36:53 -0800 | [diff] [blame] | 105 | AC_OUTPUT |