From 5023aa95ff56ea9ebf6a9e265dc4498c38f18bc7 Mon Sep 17 00:00:00 2001 From: "William A. Kennington III" Date: Thu, 4 Apr 2019 18:00:09 -0700 Subject: autotools: Fix for autoconf-archive 2019.01.19 The code coverage macros from the archive changed in a backward incompatible way. This adds a workaround to autodetect either version and do the right thing. Tested: Against the typical, older autotools and the new autotools 2019.01.09 in the CI environment. Change-Id: I765ec46051c2666874dce51675092aa4da989ec5 Signed-off-by: William A. Kennington III --- .gitignore | 1 + Makefile.am | 10 ++++++++-- configure.ac | 22 +++++++++++++++++++++- 3 files changed, 30 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 5c5f8c1..288aef3 100644 --- a/.gitignore +++ b/.gitignore @@ -42,6 +42,7 @@ Makefile.in *.la *.so* *.pc +/aminclude_static.am /config.h /config.h.in~ /config.log diff --git a/Makefile.am b/Makefile.am index 5af2544..864eb93 100644 --- a/Makefile.am +++ b/Makefile.am @@ -3,6 +3,14 @@ AM_DEFAULT_SOURCE_EXT = .cpp AM_CPPFLAGS = -I$(abs_srcdir) -I$(abs_srcdir)/include export AM_CPPFLAGS +if AUTOCONF_CODE_COVERAGE_2019_01_06 +include $(top_srcdir)/aminclude_static.am +clean-local: code-coverage-clean +distclean-local: code-coverage-dist-clean +else +@CODE_COVERAGE_RULES@ +endif + providersdir = ${libdir}/ipmid-providers providers_LTLIBRARIES = @@ -97,8 +105,6 @@ libipmi20_la_SOURCES = \ user_channel/channelcommands.cpp \ $(libipmi20_BUILT_LIST) -@CODE_COVERAGE_RULES@ - check_PROGRAMS = XFAIL_TESTS = diff --git a/configure.ac b/configure.ac index a73976e..2bb011f 100644 --- a/configure.ac +++ b/configure.ac @@ -2,10 +2,22 @@ AC_PREREQ([2.69]) AC_INIT([phosphor-host-ipmid], [1.0], [https://github.com/openbmc/phosphor-host-ipmid/issues]) AC_CONFIG_HEADERS([config.h]) -AM_INIT_AUTOMAKE([subdir-objects -Wall -Werror foreign dist-xz]) +AM_INIT_AUTOMAKE([subdir-objects -Wall -Wno-portability -Werror foreign dist-xz]) AM_SILENT_RULES([yes]) AC_LANG([C++]) +# Make sure the default CFLAGS of `-O2 -g` don't override CODE_COVERAGE_CFLAGS +# It is important that this comes before AC_PROG_C{C,XX}, as we are attempting +# to stop them from populating default CFLAGS and CXXFLAGS. +AS_IF([test "x$enable_code_coverage" != "xno"], [ + AS_IF([test "x${CXXFLAGS+set}" != "xset"], [ + AC_SUBST(CXXFLAGS, [""]) + ]) + AS_IF([test "x${CFLAGS+set}" != "xset"], [ + AC_SUBST(CFLAGS, [""]) + ]) +]) + # Checks for programs. AC_PROG_CXX AC_PROG_CC @@ -77,6 +89,14 @@ AS_IF([test "x$enable_oe_sdk" == "xyes"], # Add code coverage tool AX_CODE_COVERAGE +AS_IF([test "x$CODE_COVERAGE_ENABLED" = "xyes"], [ + AX_APPEND_COMPILE_FLAGS([-DHAVE_GCOV], [CODE_COVERAGE_CPPFLAGS]) +]) +m4_ifdef([_AX_CODE_COVERAGE_RULES], + [AM_CONDITIONAL(AUTOCONF_CODE_COVERAGE_2019_01_06, [true])], + [AM_CONDITIONAL(AUTOCONF_CODE_COVERAGE_2019_01_06, [false])]) +AX_ADD_AM_MACRO_STATIC([]) + AC_ARG_VAR(WHITELIST_CONF, [Paths to IPMI whitelisted commands conf files. (default = ${srcdir}/host-ipmid-whitelist.conf)]) if test -z "$WHITELIST_CONF"; then -- cgit v1.2.1