Patrick Venture | c7ca291 | 2018-11-02 11:38:33 -0700 | [diff] [blame] | 1 | # Initialization |
| 2 | AC_PREREQ([2.69]) |
| 3 | AC_INIT([phosphor-ipmi-flash], [0.1], [https://github.com/openbmc/phosphor-ipmi-flash/issues]) |
| 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 | |
| 15 | # Checks for typedefs, structures, and compiler characteristics. |
| 16 | AX_CXX_COMPILE_STDCXX_17([noext]) |
| 17 | AX_APPEND_COMPILE_FLAGS([-Wall -Werror], [CXXFLAGS]) |
| 18 | |
| 19 | # Checks for library functions. |
| 20 | LT_INIT # Required for systemd linking |
| 21 | |
| 22 | # Checks for libraries. |
| 23 | PKG_CHECK_MODULES([PHOSPHOR_LOGGING], [phosphor-logging],, [AC_MSG_ERROR([Could not find phosphor-logging...openbmc/phosphor-logging package required])]) |
| 24 | AC_CHECK_HEADER([blobs-ipmid], [AC_MSG_ERROR(["phosphor-ipmi-blobs required and not found."])]) |
| 25 | AX_PTHREAD([], [AC_MSG_ERROR(["pthread required and not found"])]) |
| 26 | |
Patrick Venture | fa6c4d9 | 2018-11-02 18:34:53 -0700 | [diff] [blame] | 27 | # Configurability |
| 28 | # Enable static layout for firmware image staging. |
| 29 | AC_ARG_ENABLE([static-layout], |
| 30 | AS_HELP_STRING([--enable-static-layout], |
| 31 | [Enable static layout firmware update via Blobs])) |
| 32 | AS_IF([test "x$enable_static_layout" = "xyes"], [ |
| 33 | AX_APPEND_COMPILE_FLAGS([-DENABLE_STATIC_LAYOUT], [CXXFLAGS]) |
| 34 | ]) |
Patrick Venture | 4306f68 | 2018-11-06 11:06:02 -0800 | [diff] [blame] | 35 | # Enable P2A, and or LPC (block-transfer is always enabled). |
Patrick Venture | 192d60f | 2018-11-06 11:11:59 -0800 | [diff] [blame] | 36 | AC_ARG_ENABLE([pci-bridge], |
| 37 | AS_HELP_STRING([--enable-pci-bridge], |
| 38 | [Enable pci-bridge transport mechanism])) |
| 39 | AS_IF([test "x$enable_pci_bridge" = "xyes"], [ |
| 40 | AX_APPEND_COMPILE_FLAGS([-DENABLE_PCI_BRIDGE], [CXXFLAGS]) |
| 41 | ]) |
| 42 | AC_ARG_ENABLE([lpc-bridge], |
| 43 | AS_HELP_STRING([--enable-lpc-bridge], |
| 44 | [Enable lpc-bridge transport mechanism])) |
| 45 | AS_IF([test "x$enable_lpc_bridge" = "xyes"], [ |
| 46 | AX_APPEND_COMPILE_FLAGS([-DENABLE_LPC_BRIDGE], [CXXFLAGS]) |
| 47 | ]) |
Patrick Venture | fa6c4d9 | 2018-11-02 18:34:53 -0700 | [diff] [blame] | 48 | |
Patrick Venture | c7ca291 | 2018-11-02 11:38:33 -0700 | [diff] [blame] | 49 | # Check/set gtest specific functions. |
| 50 | PKG_CHECK_MODULES([GTEST], [gtest], [], [AC_MSG_NOTICE([gtest not found, tests will not build])]) |
| 51 | PKG_CHECK_MODULES([GMOCK], [gmock], [], [AC_MSG_NOTICE([gmock not found, tests will not build])]) |
| 52 | PKG_CHECK_MODULES([GTEST_MAIN], [gtest_main], [], [AC_MSG_NOTICE([gtest_main not found, tests will not build])]) |
| 53 | |
| 54 | # Add --enable-oe-sdk flag to configure script |
| 55 | AC_ARG_ENABLE([oe-sdk], |
| 56 | AS_HELP_STRING([--enable-oe-sdk], [Link testcases absolutely against OE SDK so they can be ran within it.]) |
| 57 | ) |
| 58 | |
| 59 | # Check for OECORE_TARGET_SYSROOT in the environment. |
| 60 | AC_ARG_VAR(OECORE_TARGET_SYSROOT, |
| 61 | [Path to the OE SDK SYSROOT]) |
| 62 | |
| 63 | # Configure OESDK_TESTCASE_FLAGS environment variable, which will be later |
| 64 | # used in test/Makefile.am |
| 65 | AS_IF([test "x$enable_oe_sdk" == "xyes"], |
| 66 | AS_IF([test "x$OECORE_TARGET_SYSROOT" == "x"], |
| 67 | AC_MSG_ERROR([OECORE_TARGET_SYSROOT must be set with --enable-oe-sdk]) |
| 68 | ) |
| 69 | AC_MSG_NOTICE([Enabling OE-SDK at $OECORE_TARGET_SYSROOT]) |
| 70 | [ |
| 71 | testcase_flags="-Wl,-rpath,\${OECORE_TARGET_SYSROOT}/lib" |
| 72 | testcase_flags="${testcase_flags} -Wl,-rpath,\${OECORE_TARGET_SYSROOT}/usr/lib" |
| 73 | testcase_flags="${testcase_flags} -Wl,-dynamic-linker,`find \${OECORE_TARGET_SYSROOT}/lib/ld-*.so | sort -r -n | head -n1`" |
| 74 | ] |
| 75 | AC_SUBST([OESDK_TESTCASE_FLAGS], [$testcase_flags]) |
| 76 | ) |
| 77 | |
| 78 | # Create configured output |
| 79 | AC_CONFIG_FILES([Makefile]) |
| 80 | AC_OUTPUT |