blob: b1e7fc1e7ef7cacba54d02ff4df589204026cd3e [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])
Deepak Kodihallic6e8fb52019-05-02 08:35:31 -050045AX_PKG_CHECK_MODULES([PHOSPHOR_LOGGING], [phosphor-logging])
46PKG_CHECK_MODULES([PHOSPHOR_DBUS_INTERFACES], [phosphor-dbus-interfaces])
Sampa Misra032bd502019-03-06 05:03:22 -060047
Deepak Kodihalli1b24f972019-02-01 04:09:13 -060048# Check/set gtest specific functions.
49AX_PTHREAD([GTEST_CPPFLAGS="-DGTEST_HAS_PTHREAD=1"],[GTEST_CPPFLAGS="-DGTEST_HAS_PTHREAD=0"])
50AC_SUBST(GTEST_CPPFLAGS)
51AC_ARG_ENABLE([oe-sdk],
52 AS_HELP_STRING([--enable-oe-sdk], [Link testcases absolutely against OE SDK so they can be ran within it.])
53)
54AC_ARG_VAR(OECORE_TARGET_SYSROOT,
55 [Path to the OE SDK SYSROOT])
56AS_IF([test "x$enable_oe_sdk" == "xyes"],
57 AS_IF([test "x$OECORE_TARGET_SYSROOT" == "x"],
58 AC_MSG_ERROR([OECORE_TARGET_SYSROOT must be set with --enable-oe-sdk])
59 )
60 AC_MSG_NOTICE([Enabling OE-SDK at $OECORE_TARGET_SYSROOT])
61 [
62 testcase_flags="-Wl,-rpath,\${OECORE_TARGET_SYSROOT}/lib"
63 testcase_flags="${testcase_flags} -Wl,-rpath,\${OECORE_TARGET_SYSROOT}/usr/lib"
64 testcase_flags="${testcase_flags} -Wl,-dynamic-linker,`find \${OECORE_TARGET_SYSROOT}/lib/ld-*.so | sort -r -n | head -n1`"
65 ]
66 AC_SUBST([OESDK_TESTCASE_FLAGS], [$testcase_flags])
67)
68
Jinu Joy Thomas7f57f442019-06-13 20:38:49 +053069# Setup IBM OEM commands support for PLDM
70AC_ARG_ENABLE([oem-ibm], AS_HELP_STRING([
71 --enable-oem-ibm
72 ], [
73 Enable PLDM OEM command support For IBM.
74]))
75AM_CONDITIONAL([OEM_IBM], [test "x$enable_oem_ibm" = "xyes"])
76AS_IF([test "x$oem-ibm" == "xtrue"], [
77 AX_APPEND_COMPILE_FLAGS([-DOEM_IBM], [CXXFLAGS])
78])
79
Deepak Kodihalli1b24f972019-02-01 04:09:13 -060080# Create configured output
81AC_CONFIG_FILES([Makefile libpldm/Makefile libpldmresponder/Makefile test/Makefile])
82AC_CONFIG_FILES([libpldm/libpldm.pc])
83AC_OUTPUT