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: I71627d62a41d2c3cc07764cd0901354680092f07
Signed-off-by: Patrick Venture <venture@google.com>
diff --git a/.gitignore b/.gitignore
index 9d66280..dd057dd 100644
--- a/.gitignore
+++ b/.gitignore
@@ -19,6 +19,7 @@
.dirstamp
.libs
/aclocal.m4
+/aminclude_static.am
/autom4te.cache
/build-aux
/config.h
diff --git a/Makefile.am b/Makefile.am
index d7b5c35..234496e 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -26,6 +26,14 @@
CODE_COVERAGE_GENHTML_OPTIONS += --prefix $(abs_srcdir) --prefix $(abs_builddir)
export CODE_COVERAGE_GENHTML_OPTIONS
+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
+
ACLOCAL_AMFLAGS = -I m4
AM_DEFAULT_SOURCE_EXT = .cpp
diff --git a/configure.ac b/configure.ac
index 2a8bda3..a83479e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4,7 +4,7 @@
AC_LANG([C++])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_MACRO_DIRS([m4])
-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])
# Make sure the default CFLAGS of `-O2 -g` don't override CODE_COVERAGE_CFLAGS
@@ -213,10 +213,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([])
# Add --enable-oe-sdk flag to configure script
AC_ARG_ENABLE([oe-sdk],
diff --git a/test/Makefile.am b/test/Makefile.am
index 568b361..117e3d3 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -1,5 +1,3 @@
-@CODE_COVERAGE_RULES@
-
AM_CPPFLAGS = \
-I$(top_srcdir)/ \
-I$(top_srcdir)/tools/ \