aboutsummaryrefslogtreecommitdiff
path: root/auto.def
diff options
context:
space:
mode:
authorSteve Bennett <steveb@workware.net.au>2020-04-15 08:36:59 +1000
committerSteve Bennett <steveb@workware.net.au>2020-04-17 17:36:50 +1000
commitb3064200cd20bcbc34ed66f3b0f51929f9751189 (patch)
tree77c28c9e9903eb32cdac6dadcb0199016b5adf45 /auto.def
parent67703c4ea7b0ae290818d79beeacf931b08ea37e (diff)
downloadjimtcl-b3064200cd20bcbc34ed66f3b0f51929f9751189.zip
jimtcl-b3064200cd20bcbc34ed66f3b0f51929f9751189.tar.gz
jimtcl-b3064200cd20bcbc34ed66f3b0f51929f9751189.tar.bz2
build: Add ./configure --coverage
To make it easier to generate code coverage output. Ensure that gcovr is installed, then do: ./configure --coverage make test coverage And see the report in coverage.html Signed-off-by: Steve Bennett <steveb@workware.net.au>
Diffstat (limited to 'auto.def')
-rw-r--r--auto.def25
1 files changed, 23 insertions, 2 deletions
diff --git a/auto.def b/auto.def
index 681c913..7693e13 100644
--- a/auto.def
+++ b/auto.def
@@ -25,6 +25,7 @@ options {
docs=1 => "don't build or install the documentation"
docdir:path => "path to install docs (if built)"
random-hash => "randomise hash tables. more secure but hash table results are not predicable"
+ coverage => "build with code coverage support"
with-jim-ext: {with-ext:"ext1,ext2,..."} => {
Specify additional jim extensions to include.
These are enabled by default:
@@ -77,6 +78,8 @@ options {
install-jim=1
}
+set warnings {}
+
# Save the user-specified LIBS
# We add detected libs to LDLIBS explicitly
set LIBS [get-define LIBS]
@@ -98,6 +101,20 @@ if {[cctest -cflags -fno-unwind-tables]} {
if {[cctest -cflags -fno-asynchronous-unwind-tables]} {
define-append CCOPTS -fno-asynchronous-unwind-tables
}
+if {[opt-bool coverage]} {
+ if {[cctest -link 1 -cflags --coverage]} {
+ # Disable ccache when using coverage
+ define CCACHE ""
+ define-append CCOPTS --coverage
+ define-append LDFLAGS --coverage
+ define COVERAGE 1
+ if {![cc-check-progs gcovr]} {
+ lappend warnings "Note: gcovr is not available, falling back to gcov"
+ }
+ } else {
+ lappend warnings "Warning: --coverage specified, but compiler does not support --coverage"
+ }
+}
cc-check-includes time.h sys/time.h sys/socket.h netinet/in.h arpa/inet.h netdb.h
cc-check-includes sys/un.h dlfcn.h unistd.h dirent.h crt_externs.h
@@ -551,11 +568,15 @@ make-template jimtcl.pc.in
catch {exec chmod +x build-jim-ext}
-# Finally produce any warnings
if {[get-define SIZEOF_TIME_T] <= 4} {
set note ""
if {[have-feature windows]} {
set note ", consider CFLAGS=-D__MINGW_USE_VC2005_COMPAT on mingw32"
}
- user-notice "Warning: sizeof(time_t) is [get-define SIZEOF_TIME_T] -- not Y2038 compliant$note"
+ lappend warnings "Warning: sizeof(time_t) is [get-define SIZEOF_TIME_T] -- not Y2038 compliant$note"
+}
+
+# Output any warnings at the end to make them easier to see
+foreach warning $warnings {
+ user-notice $warning
}