configure: Add code coverage magic

Autoconf changed the way code-coverage was handled in the recent past,
so there a slight complication so we work across both implementations.

Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Change-Id: I675c64953d262cd4b26a8ab758290ef4325790c0
diff --git a/Makefile.am b/Makefile.am
index c712cfe..f187d9c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -20,6 +20,18 @@
 
 pkgconfig_DATA = libmctp.pc
 
+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
+
+AM_CPPFLAGS = $(CODE_COVERAGE_CPPFLAGS)
+AM_CFLAGS = $(CODE_COVERAGE_CFLAGS)
+AM_LDFLAGS = $(CODE_COVERAGE_LDFLAGS)
+
 TESTS = $(check_PROGRAMS)
 
 check_PROGRAMS = tests/test_eid tests/test_seq tests/test_bridge