blob: 23e07ff5648b201cab74d1f0eea93725f5b605e7 [file] [log] [blame]
Deepak Kodihalli1b24f972019-02-01 04:09:13 -06001# Initialization
2AC_PREREQ([2.69])
3AC_INIT([pldm], [1.0],
4 [https://github.com/openbmc/pldm/issues])
5AC_LANG([C++])
6AC_CONFIG_HEADERS([config.h])
7AM_INIT_AUTOMAKE([subdir-objects -Wall -Werror foreign dist-xz])
8AM_SILENT_RULES([yes])
9
Priyangafb4bec92019-03-25 11:51:31 +053010# Make sure the default CFLAGS of `-O2 -g` don't override CODE_COVERAGE_CFLAGS
11# It is important that this comes before AC_PROG_C{C,XX}, as we are attempting
12# to stop them from populating default CFLAGS and CXXFLAGS.
13#AS_IF([test "x$enable_tests" = "xno"], [enable_code_coverage=no])
14AS_IF([test "x$enable_code_coverage" != "xno"], [
15 AS_IF([test "x${CXXFLAGS+set}" != "xset"], [
16 AC_SUBST(CXXFLAGS, [""])
17 ])
18 AS_IF([test "x${CFLAGS+set}" != "xset"], [
19 AC_SUBST(CFLAGS, [""])
20 ])
21])
22
Deepak Kodihalli1b24f972019-02-01 04:09:13 -060023# Checks for programs.
24AC_PROG_CXX
25AC_PROG_CC
26AM_PROG_AR
27AC_PROG_INSTALL
28
29# Checks for typedefs, structures, and compiler characteristics.
30AX_CXX_COMPILE_STDCXX([17], [noext], [mandatory])
31AX_APPEND_COMPILE_FLAGS([-Wall -Werror], [CXXFLAGS])
32
33# For linking
34LT_INIT
35
Priyangafb4bec92019-03-25 11:51:31 +053036# Code coverage
37AX_CODE_COVERAGE
38AM_EXTRA_RECURSIVE_TARGETS([check-code-coverage])
39m4_ifdef([_AX_CODE_COVERAGE_RULES],
40 [AM_CONDITIONAL(AUTOCONF_CODE_COVERAGE_2019_01_06, [true])],
41 [AM_CONDITIONAL(AUTOCONF_CODE_COVERAGE_2019_01_06, [false])])
42AX_ADD_AM_MACRO_STATIC([])
43
Sampa Misra032bd502019-03-06 05:03:22 -060044AX_PKG_CHECK_MODULES([SDBUSPLUS], [sdbusplus])
45
Deepak Kodihalli1b24f972019-02-01 04:09:13 -060046# Check/set gtest specific functions.
47AX_PTHREAD([GTEST_CPPFLAGS="-DGTEST_HAS_PTHREAD=1"],[GTEST_CPPFLAGS="-DGTEST_HAS_PTHREAD=0"])
48AC_SUBST(GTEST_CPPFLAGS)
49AC_ARG_ENABLE([oe-sdk],
50 AS_HELP_STRING([--enable-oe-sdk], [Link testcases absolutely against OE SDK so they can be ran within it.])
51)
52AC_ARG_VAR(OECORE_TARGET_SYSROOT,
53 [Path to the OE SDK SYSROOT])
54AS_IF([test "x$enable_oe_sdk" == "xyes"],
55 AS_IF([test "x$OECORE_TARGET_SYSROOT" == "x"],
56 AC_MSG_ERROR([OECORE_TARGET_SYSROOT must be set with --enable-oe-sdk])
57 )
58 AC_MSG_NOTICE([Enabling OE-SDK at $OECORE_TARGET_SYSROOT])
59 [
60 testcase_flags="-Wl,-rpath,\${OECORE_TARGET_SYSROOT}/lib"
61 testcase_flags="${testcase_flags} -Wl,-rpath,\${OECORE_TARGET_SYSROOT}/usr/lib"
62 testcase_flags="${testcase_flags} -Wl,-dynamic-linker,`find \${OECORE_TARGET_SYSROOT}/lib/ld-*.so | sort -r -n | head -n1`"
63 ]
64 AC_SUBST([OESDK_TESTCASE_FLAGS], [$testcase_flags])
65)
66
67# Create configured output
68AC_CONFIG_FILES([Makefile libpldm/Makefile libpldmresponder/Makefile test/Makefile])
69AC_CONFIG_FILES([libpldm/libpldm.pc])
70AC_OUTPUT