blob: 0538815aec1bcfb3a55e57aab6836d69f60d8a25 [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])
Jinu Joy Thomasf666db12019-05-29 05:22:31 -05009AC_CONFIG_MACRO_DIRS([m4])
Deepak Kodihalli1b24f972019-02-01 04:09:13 -060010
Priyangafb4bec92019-03-25 11:51:31 +053011# Make sure the default CFLAGS of `-O2 -g` don't override CODE_COVERAGE_CFLAGS
12# It is important that this comes before AC_PROG_C{C,XX}, as we are attempting
13# to stop them from populating default CFLAGS and CXXFLAGS.
14#AS_IF([test "x$enable_tests" = "xno"], [enable_code_coverage=no])
15AS_IF([test "x$enable_code_coverage" != "xno"], [
16 AS_IF([test "x${CXXFLAGS+set}" != "xset"], [
17 AC_SUBST(CXXFLAGS, [""])
18 ])
19 AS_IF([test "x${CFLAGS+set}" != "xset"], [
20 AC_SUBST(CFLAGS, [""])
21 ])
22])
23
Deepak Kodihalli1b24f972019-02-01 04:09:13 -060024# Checks for programs.
25AC_PROG_CXX
26AC_PROG_CC
27AM_PROG_AR
28AC_PROG_INSTALL
29
30# Checks for typedefs, structures, and compiler characteristics.
31AX_CXX_COMPILE_STDCXX([17], [noext], [mandatory])
32AX_APPEND_COMPILE_FLAGS([-Wall -Werror], [CXXFLAGS])
33
34# For linking
35LT_INIT
36
Priyangafb4bec92019-03-25 11:51:31 +053037# Code coverage
38AX_CODE_COVERAGE
39AM_EXTRA_RECURSIVE_TARGETS([check-code-coverage])
40m4_ifdef([_AX_CODE_COVERAGE_RULES],
41 [AM_CONDITIONAL(AUTOCONF_CODE_COVERAGE_2019_01_06, [true])],
42 [AM_CONDITIONAL(AUTOCONF_CODE_COVERAGE_2019_01_06, [false])])
43AX_ADD_AM_MACRO_STATIC([])
44
Sampa Misra032bd502019-03-06 05:03:22 -060045AX_PKG_CHECK_MODULES([SDBUSPLUS], [sdbusplus])
Deepak Kodihallic6e8fb52019-05-02 08:35:31 -050046AX_PKG_CHECK_MODULES([PHOSPHOR_LOGGING], [phosphor-logging])
47PKG_CHECK_MODULES([PHOSPHOR_DBUS_INTERFACES], [phosphor-dbus-interfaces])
Sampa Misra032bd502019-03-06 05:03:22 -060048
Deepak Kodihalli1b24f972019-02-01 04:09:13 -060049# Check/set gtest specific functions.
50AX_PTHREAD([GTEST_CPPFLAGS="-DGTEST_HAS_PTHREAD=1"],[GTEST_CPPFLAGS="-DGTEST_HAS_PTHREAD=0"])
51AC_SUBST(GTEST_CPPFLAGS)
52AC_ARG_ENABLE([oe-sdk],
53 AS_HELP_STRING([--enable-oe-sdk], [Link testcases absolutely against OE SDK so they can be ran within it.])
54)
55AC_ARG_VAR(OECORE_TARGET_SYSROOT,
56 [Path to the OE SDK SYSROOT])
57AS_IF([test "x$enable_oe_sdk" == "xyes"],
58 AS_IF([test "x$OECORE_TARGET_SYSROOT" == "x"],
59 AC_MSG_ERROR([OECORE_TARGET_SYSROOT must be set with --enable-oe-sdk])
60 )
61 AC_MSG_NOTICE([Enabling OE-SDK at $OECORE_TARGET_SYSROOT])
62 [
63 testcase_flags="-Wl,-rpath,\${OECORE_TARGET_SYSROOT}/lib"
64 testcase_flags="${testcase_flags} -Wl,-rpath,\${OECORE_TARGET_SYSROOT}/usr/lib"
65 testcase_flags="${testcase_flags} -Wl,-dynamic-linker,`find \${OECORE_TARGET_SYSROOT}/lib/ld-*.so | sort -r -n | head -n1`"
66 ]
67 AC_SUBST([OESDK_TESTCASE_FLAGS], [$testcase_flags])
68)
69
Jinu Joy Thomas7f57f442019-06-13 20:38:49 +053070# Setup IBM OEM commands support for PLDM
71AC_ARG_ENABLE([oem-ibm], AS_HELP_STRING([
72 --enable-oem-ibm
73 ], [
74 Enable PLDM OEM command support For IBM.
75]))
76AM_CONDITIONAL([OEM_IBM], [test "x$enable_oem_ibm" = "xyes"])
Jinu Joy Thomasf666db12019-05-29 05:22:31 -050077AS_IF([test "x$enable_oem_ibm" == "xyes"], [
Jinu Joy Thomas7f57f442019-06-13 20:38:49 +053078 AX_APPEND_COMPILE_FLAGS([-DOEM_IBM], [CXXFLAGS])
Jinu Joy Thomasf666db12019-05-29 05:22:31 -050079 AX_APPEND_COMPILE_FLAGS([-DOEM_IBM], [CFLAGS])
Deepak Kodihalli832d4ca2019-08-01 05:14:18 -050080 AC_DEFINE(FILE_TABLE_JSON, "/etc/default/obmc/pldm/fileTable.json", [JSON file containing file info for File I/O])
Jinu Joy Thomasf666db12019-05-29 05:22:31 -050081])
82
83# Setup verbose option
84AC_ARG_ENABLE([verbose], AS_HELP_STRING([
85 --enable-verbose
86 ], [
87 Enable verbosity for PLDM Daemon.
88]))
89AS_IF([test "x$enable_verbose" == "xyes"], [
90 AX_APPEND_COMPILE_FLAGS([-DVERBOSE], [CXXFLAGS])
91 AX_APPEND_COMPILE_FLAGS([-DVERBOSE], [CFLAGS])
Jinu Joy Thomas7f57f442019-06-13 20:38:49 +053092])
93
Deepak Kodihalli832d4ca2019-08-01 05:14:18 -050094AC_DEFINE(BIOS_JSONS_DIR, "/etc/default/obmc/pldm/bios", [Directory housing the json files for BIOS tables])
Sampa Misrab37be312019-07-03 02:26:41 -050095AC_DEFINE(BIOS_TABLES_DIR, "/var/lib/pldm/bios", [Directory housing actual BIOS tables])
96
Deepak Kodihalli1b24f972019-02-01 04:09:13 -060097# Create configured output
98AC_CONFIG_FILES([Makefile libpldm/Makefile libpldmresponder/Makefile test/Makefile])
99AC_CONFIG_FILES([libpldm/libpldm.pc])
100AC_OUTPUT