diff options
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac index 73960b5..d6fbe00 100644 --- a/configure.ac +++ b/configure.ac @@ -7,6 +7,19 @@ AC_CONFIG_MACRO_DIRS([m4]) AM_INIT_AUTOMAKE([subdir-objects -Wall -Werror foreign dist-xz]) AM_SILENT_RULES([yes]) +# 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_tests" = "xno"], [enable_code_coverage=no]) +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 AM_PROG_AR @@ -105,6 +118,13 @@ AS_IF([test "x$enable_tests" != "xno"], [ AX_RESTORE_FLAGS_WITH_PREFIX(OLD, [LDFLAGS]) ]) +# 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]) +]) + # Add --enable-oe-sdk flag to configure script AC_ARG_ENABLE([oe-sdk], AS_HELP_STRING([--enable-oe-sdk], [Link testcases absolutely against OE SDK so they can be ran within it.]) |