blob: 09fceb39a8181f27401f73854bb33fbdb09eb235 [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 Venturefa6c4d92018-11-02 18:34:53 -070036
Patrick Venturec7ca2912018-11-02 11:38:33 -070037# Check/set gtest specific functions.
38PKG_CHECK_MODULES([GTEST], [gtest], [], [AC_MSG_NOTICE([gtest not found, tests will not build])])
39PKG_CHECK_MODULES([GMOCK], [gmock], [], [AC_MSG_NOTICE([gmock not found, tests will not build])])
40PKG_CHECK_MODULES([GTEST_MAIN], [gtest_main], [], [AC_MSG_NOTICE([gtest_main not found, tests will not build])])
41
42# Add --enable-oe-sdk flag to configure script
43AC_ARG_ENABLE([oe-sdk],
44 AS_HELP_STRING([--enable-oe-sdk], [Link testcases absolutely against OE SDK so they can be ran within it.])
45)
46
47# Check for OECORE_TARGET_SYSROOT in the environment.
48AC_ARG_VAR(OECORE_TARGET_SYSROOT,
49 [Path to the OE SDK SYSROOT])
50
51# Configure OESDK_TESTCASE_FLAGS environment variable, which will be later
52# used in test/Makefile.am
53AS_IF([test "x$enable_oe_sdk" == "xyes"],
54 AS_IF([test "x$OECORE_TARGET_SYSROOT" == "x"],
55 AC_MSG_ERROR([OECORE_TARGET_SYSROOT must be set with --enable-oe-sdk])
56 )
57 AC_MSG_NOTICE([Enabling OE-SDK at $OECORE_TARGET_SYSROOT])
58 [
59 testcase_flags="-Wl,-rpath,\${OECORE_TARGET_SYSROOT}/lib"
60 testcase_flags="${testcase_flags} -Wl,-rpath,\${OECORE_TARGET_SYSROOT}/usr/lib"
61 testcase_flags="${testcase_flags} -Wl,-dynamic-linker,`find \${OECORE_TARGET_SYSROOT}/lib/ld-*.so | sort -r -n | head -n1`"
62 ]
63 AC_SUBST([OESDK_TESTCASE_FLAGS], [$testcase_flags])
64)
65
66# Create configured output
67AC_CONFIG_FILES([Makefile])
68AC_OUTPUT