Deepak Kodihalli | 1b24f97 | 2019-02-01 04:09:13 -0600 | [diff] [blame] | 1 | # Initialization |
| 2 | AC_PREREQ([2.69]) |
| 3 | AC_INIT([pldm], [1.0], |
| 4 | [https://github.com/openbmc/pldm/issues]) |
| 5 | AC_LANG([C++]) |
| 6 | AC_CONFIG_HEADERS([config.h]) |
| 7 | AM_INIT_AUTOMAKE([subdir-objects -Wall -Werror foreign dist-xz]) |
| 8 | AM_SILENT_RULES([yes]) |
| 9 | |
Priyanga | fb4bec9 | 2019-03-25 11:51:31 +0530 | [diff] [blame] | 10 | # 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]) |
| 14 | AS_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 Kodihalli | 1b24f97 | 2019-02-01 04:09:13 -0600 | [diff] [blame] | 23 | # Checks for programs. |
| 24 | AC_PROG_CXX |
| 25 | AC_PROG_CC |
| 26 | AM_PROG_AR |
| 27 | AC_PROG_INSTALL |
| 28 | |
| 29 | # Checks for typedefs, structures, and compiler characteristics. |
| 30 | AX_CXX_COMPILE_STDCXX([17], [noext], [mandatory]) |
| 31 | AX_APPEND_COMPILE_FLAGS([-Wall -Werror], [CXXFLAGS]) |
| 32 | |
| 33 | # For linking |
| 34 | LT_INIT |
| 35 | |
Priyanga | fb4bec9 | 2019-03-25 11:51:31 +0530 | [diff] [blame] | 36 | # Code coverage |
| 37 | AX_CODE_COVERAGE |
| 38 | AM_EXTRA_RECURSIVE_TARGETS([check-code-coverage]) |
| 39 | m4_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])]) |
| 42 | AX_ADD_AM_MACRO_STATIC([]) |
| 43 | |
Sampa Misra | 032bd50 | 2019-03-06 05:03:22 -0600 | [diff] [blame] | 44 | AX_PKG_CHECK_MODULES([SDBUSPLUS], [sdbusplus]) |
Deepak Kodihalli | c6e8fb5 | 2019-05-02 08:35:31 -0500 | [diff] [blame^] | 45 | AX_PKG_CHECK_MODULES([PHOSPHOR_LOGGING], [phosphor-logging]) |
| 46 | PKG_CHECK_MODULES([PHOSPHOR_DBUS_INTERFACES], [phosphor-dbus-interfaces]) |
Sampa Misra | 032bd50 | 2019-03-06 05:03:22 -0600 | [diff] [blame] | 47 | |
Deepak Kodihalli | 1b24f97 | 2019-02-01 04:09:13 -0600 | [diff] [blame] | 48 | # Check/set gtest specific functions. |
| 49 | AX_PTHREAD([GTEST_CPPFLAGS="-DGTEST_HAS_PTHREAD=1"],[GTEST_CPPFLAGS="-DGTEST_HAS_PTHREAD=0"]) |
| 50 | AC_SUBST(GTEST_CPPFLAGS) |
| 51 | AC_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 | ) |
| 54 | AC_ARG_VAR(OECORE_TARGET_SYSROOT, |
| 55 | [Path to the OE SDK SYSROOT]) |
| 56 | AS_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 Thomas | 7f57f44 | 2019-06-13 20:38:49 +0530 | [diff] [blame] | 69 | # Setup IBM OEM commands support for PLDM |
| 70 | AC_ARG_ENABLE([oem-ibm], AS_HELP_STRING([ |
| 71 | --enable-oem-ibm |
| 72 | ], [ |
| 73 | Enable PLDM OEM command support For IBM. |
| 74 | ])) |
| 75 | AM_CONDITIONAL([OEM_IBM], [test "x$enable_oem_ibm" = "xyes"]) |
| 76 | AS_IF([test "x$oem-ibm" == "xtrue"], [ |
| 77 | AX_APPEND_COMPILE_FLAGS([-DOEM_IBM], [CXXFLAGS]) |
| 78 | ]) |
| 79 | |
Deepak Kodihalli | 1b24f97 | 2019-02-01 04:09:13 -0600 | [diff] [blame] | 80 | # Create configured output |
| 81 | AC_CONFIG_FILES([Makefile libpldm/Makefile libpldmresponder/Makefile test/Makefile]) |
| 82 | AC_CONFIG_FILES([libpldm/libpldm.pc]) |
| 83 | AC_OUTPUT |