blob: b7b972e99156ed37393bfa4f0e08d6d9b176b013 [file] [log] [blame]
Patrick Venturec7ca2912018-11-02 11:38:33 -07001# Initialization
2AC_PREREQ([2.69])
3AC_INIT([phosphor-ipmi-flash], [0.1], [https://github.com/openbmc/phosphor-ipmi-flash/issues])
4AC_LANG([C++])
5AC_CONFIG_HEADERS([config.h])
6AM_INIT_AUTOMAKE([subdir-objects -Wall -Werror foreign dist-xz])
7AM_SILENT_RULES([yes])
8
9# Checks for programs.
10AC_PROG_CXX
11AM_PROG_AR
12AC_PROG_INSTALL
13AC_PROG_MAKE_SET
14
15# Checks for typedefs, structures, and compiler characteristics.
16AX_CXX_COMPILE_STDCXX_17([noext])
17AX_APPEND_COMPILE_FLAGS([-Wall -Werror], [CXXFLAGS])
18
19# Checks for library functions.
20LT_INIT # Required for systemd linking
21
22# Checks for libraries.
23PKG_CHECK_MODULES([PHOSPHOR_LOGGING], [phosphor-logging],, [AC_MSG_ERROR([Could not find phosphor-logging...openbmc/phosphor-logging package required])])
24AC_CHECK_HEADER([blobs-ipmid], [AC_MSG_ERROR(["phosphor-ipmi-blobs required and not found."])])
25AX_PTHREAD([], [AC_MSG_ERROR(["pthread required and not found"])])
26
Patrick Venturefa6c4d92018-11-02 18:34:53 -070027# Configurability
28# Enable static layout for firmware image staging.
29AC_ARG_ENABLE([static-layout],
30 AS_HELP_STRING([--enable-static-layout],
31 [Enable static layout firmware update via Blobs]))
32AS_IF([test "x$enable_static_layout" = "xyes"], [
33 AX_APPEND_COMPILE_FLAGS([-DENABLE_STATIC_LAYOUT], [CXXFLAGS])
34])
Patrick Venture4306f682018-11-06 11:06:02 -080035# Enable P2A, and or LPC (block-transfer is always enabled).
Patrick Venture192d60f2018-11-06 11:11:59 -080036AC_ARG_ENABLE([pci-bridge],
37 AS_HELP_STRING([--enable-pci-bridge],
38 [Enable pci-bridge transport mechanism]))
39AS_IF([test "x$enable_pci_bridge" = "xyes"], [
40 AX_APPEND_COMPILE_FLAGS([-DENABLE_PCI_BRIDGE], [CXXFLAGS])
41])
42AC_ARG_ENABLE([lpc-bridge],
43 AS_HELP_STRING([--enable-lpc-bridge],
44 [Enable lpc-bridge transport mechanism]))
45AS_IF([test "x$enable_lpc_bridge" = "xyes"], [
46 AX_APPEND_COMPILE_FLAGS([-DENABLE_LPC_BRIDGE], [CXXFLAGS])
47])
Patrick Venturefa6c4d92018-11-02 18:34:53 -070048
Patrick Venturec7ca2912018-11-02 11:38:33 -070049# Check/set gtest specific functions.
50PKG_CHECK_MODULES([GTEST], [gtest], [], [AC_MSG_NOTICE([gtest not found, tests will not build])])
51PKG_CHECK_MODULES([GMOCK], [gmock], [], [AC_MSG_NOTICE([gmock not found, tests will not build])])
52PKG_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
55AC_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.
60AC_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
65AS_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
Patrick Ventureb0c84d02018-11-09 12:00:31 -080078AC_ARG_VAR(PCI_PHYSICAL_ADDRESS, [The physical address to use on the BMC for the PCI-to-AHB Bridge.])
79AS_IF([test "x$PCI_PHYSICAL_ADDRESS" == "x"],
80 [AC_DEFINE(PCI_PHYSICAL_ADDRESS, [0], [Default address to 0.])],
81 [AC_DEFINE(PCI_PHYSICAL_ADDRESS, [$PCI_PHYSICAL_ADDRESS], [Value for PCI-to-AHB bridge set.])]
82)
83
Patrick Venturea5c59062018-11-09 12:25:52 -080084AC_ARG_VAR(STATIC_HANDLER_STAGED_NAME, [The file to use for staging the firmware update.])
85AS_IF([test "x$STATIC_HANDLER_STAGED_NAME" == "x"], [STATIC_HANDLER_STAGED_NAME="/run/initramfs/bmc-image"])
86AC_DEFINE_UNQUOTED([STATIC_HANDLER_STAGED_NAME], ["$STATIC_HANDLER_STAGED_NAME"], [The file to use for staging the firmware update.])
87
88
Patrick Venturec7ca2912018-11-02 11:38:33 -070089# Create configured output
Patrick Venture21be45a2018-11-06 12:08:52 -080090AC_CONFIG_FILES([Makefile test/Makefile])
Patrick Venturec7ca2912018-11-02 11:38:33 -070091AC_OUTPUT