]> git.ipfire.org Git - thirdparty/mlmmj.git/commitdiff
configure: add --enable-coverage
authorBaptiste Daroussin <bapt@FreeBSD.org>
Wed, 26 Oct 2022 12:31:43 +0000 (14:31 +0200)
committerBaptiste Daroussin <bapt@FreeBSD.org>
Wed, 26 Oct 2022 12:31:43 +0000 (14:31 +0200)
This option adds CLFAGS and LDFLAGS which are necessary to extract
the code coverage informations

configure.ac
src/Makefile.am
tests/Makefile.am

index a94ad43b675743fc8fb0dbcf95e63772665e9416..f6b47b223d944cfac5ec68697831784eead7b599 100644 (file)
@@ -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)]))
index 61faaba8737a0f3756e69087e25fdf43a2657724..569d01945041d53639916f5975234121e3e4c9fb 100644 (file)
@@ -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
index 21711720518d53a0c5c150ab92bc298da3843363..61c46789c6cfeb47eeae143c3fe1fb13c865232c 100644 (file)
@@ -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