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.
Change-Id: Ibb95188264f3fece4a18dbcb98f3e90f8350ff21
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/.gitignore b/.gitignore
index b6813f2..8164d51 100644
--- a/.gitignore
+++ b/.gitignore
@@ -27,6 +27,8 @@
.dirstamp
.libs
/aclocal.m4
+/aminclude_static.am
+/autom4te.cache
/build-aux
/config.h
/config.h.in
diff --git a/Makefile.am b/Makefile.am
index 0bab405..7669e9b 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,5 +1,13 @@
ACLOCAL_AMFLAGS = -Im4
+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
+
if WANT_LIBSDBUSPLUS
nobase_include_HEADERS = \
diff --git a/configure.ac b/configure.ac
index 2c88b97..ae32c44 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4,7 +4,7 @@
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_MACRO_DIRS([m4])
AC_CONFIG_AUX_DIR([build-aux])
-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++])
@@ -154,7 +154,13 @@
# Code coverage
AX_CODE_COVERAGE
-AM_EXTRA_RECURSIVE_TARGETS([check-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_ENABLE([oe-sdk],
AS_HELP_STRING([--enable-oe-sdk], [Link testcases absolutely against OE SDK so they can be ran within it.])
diff --git a/test/Makefile.am b/test/Makefile.am
index a2ea724..857f293 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -1,5 +1,4 @@
@VALGRIND_CHECK_RULES@
-@CODE_COVERAGE_RULES@
if WANT_LIBSDBUSPLUS