From: Baptiste Daroussin Date: Wed, 26 Oct 2022 12:31:43 +0000 (+0200) Subject: configure: add --enable-coverage X-Git-Tag: RELEASE_1_4_0a1~43 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ac01a52a8f4bee6eeb0f688dee0008478e66c000;p=thirdparty%2Fmlmmj.git configure: add --enable-coverage This option adds CLFAGS and LDFLAGS which are necessary to extract the code coverage informations --- diff --git a/configure.ac b/configure.ac index a94ad43b..f6b47b22 100644 --- a/configure.ac +++ b/configure.ac @@ -36,6 +36,11 @@ exec_prefix=$savex AC_SUBST(textlibdir) +AC_ARG_ENABLE([coverage], + AS_HELP_STRING([--enable-coverage], + [build with coverage flags activated (default is no)])) +AM_CONDITIONAL(WANT_COVERAGE, test x"$enable_coverage" = xyes) + AC_ARG_ENABLE([receive-strip], AS_HELP_STRING([--enable-receive-strip], [build mlmmj-receive-strip (default is no)])) diff --git a/src/Makefile.am b/src/Makefile.am index 61faaba8..569d0194 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -3,6 +3,11 @@ AUTOMAKE_OPTIONS = foreign AM_CFLAGS = -g -Wall -std=gnu99 -D_GNU_SOURCE=1 -Wextra -pedantic -Wsign-compare -DDEFAULTTEXTDIR='"@textlibdir@"' -I$(srcdir)/../include +AM_LDFLAGS = +if WANT_COVERAGE +AM_CFLAGS += -O0 -ggdb -fprofile-arcs -ftest-coverage -fprofile-instr-generate -fcoverage-mapping +AM_LDFLAGS += -fprofile-instr-generate +endif bin_PROGRAMS = mlmmj-send mlmmj-receive mlmmj-process mlmmj-sub \ mlmmj-unsub mlmmj-bounce mlmmj-maintd mlmmj-list diff --git a/tests/Makefile.am b/tests/Makefile.am index 21711720..61c46789 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -6,6 +6,11 @@ mlmmj_SOURCES = mlmmj.c AM_CFLAGS = -g -Wall -pedantic -Wsign-compare -DDEFAULTTEXTDIR='"@textlibdir@"' -I$(srcdir)/../include @ATF_CFLAGS@ mlmmj_LDADD = $(top_builddir)/src/libmlmmj.a @ATF_LIBS@ +AM_LDFLAGS = +if WANT_COVERAGE +AM_CFLAGS += -O0 -ggdb -fprofile-arcs -ftest-coverage -fprofile-instr-generate -fcoverage-mapping +AM_LDFLAGS += -fprofile-instr-generate +endif test_scripts = mlmmj-send.sh \ functional-tests.sh