summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Adler <madler@alumni.caltech.edu>2011-10-09 10:16:43 -0700
committerMark Adler <madler@alumni.caltech.edu>2011-10-09 10:25:15 -0700
commitd66a30794183e04f121fd1464d7bfcfbbcaf64ed (patch)
tree4538067d01873be7a589c159886b47ce0b6e1ce0
parent1bd2fa1b241d24dc444f17d217429780f0b657c0 (diff)
downloadzlib-d66a30794183e04f121fd1464d7bfcfbbcaf64ed.tar.gz
zlib-d66a30794183e04f121fd1464d7bfcfbbcaf64ed.tar.bz2
zlib-d66a30794183e04f121fd1464d7bfcfbbcaf64ed.zip
Add --cover option to ./configure for gcc coverage testing.
This adds the -fprofile-arcs and -ftest-coverage options when compiling the source code for the static library. Those same options must then be used when linking the static library into an executable. This updates Makefile.in to remove and .gitignore to ignore the files generated when testing coverage.
-rw-r--r--.gitignore4
-rw-r--r--Makefile.in1
-rwxr-xr-xconfigure8
3 files changed, 12 insertions, 1 deletions
diff --git a/.gitignore b/.gitignore
index 81d3ed2..8c6bce0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -9,6 +9,10 @@
9*.o 9*.o
10*.dylib 10*.dylib
11 11
12*.gcda
13*.gcno
14*.gcov
15
12/example 16/example
13/example64 17/example64
14/examplesh 18/examplesh
diff --git a/Makefile.in b/Makefile.in
index 1b8bf3f..9ac0406 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -232,6 +232,7 @@ clean:
232 libz.* foo.gz so_locations \ 232 libz.* foo.gz so_locations \
233 _match.s maketree contrib/infback9/*.o 233 _match.s maketree contrib/infback9/*.o
234 rm -rf objs 234 rm -rf objs
235 rm -f *.gcda *.gcno *.gcov
235 236
236maintainer-clean: distclean 237maintainer-clean: distclean
237distclean: clean zconf zconf.h.cmakein docs 238distclean: clean zconf zconf.h.cmakein docs
diff --git a/configure b/configure
index 672b24f..d15c03b 100755
--- a/configure
+++ b/configure
@@ -55,6 +55,7 @@ mandir=${mandir-'${prefix}/share/man'}
55shared_ext='.so' 55shared_ext='.so'
56shared=1 56shared=1
57solo=0 57solo=0
58cover=0
58zprefix=0 59zprefix=0
59build64=0 60build64=0
60gcc=0 61gcc=0
@@ -85,6 +86,7 @@ case "$1" in
85 -s* | --shared | --enable-shared) shared=1; shift ;; 86 -s* | --shared | --enable-shared) shared=1; shift ;;
86 -t | --static) shared=0; shift ;; 87 -t | --static) shared=0; shift ;;
87 --solo) solo=1; shift ;; 88 --solo) solo=1; shift ;;
89 --cover) cover=1; shift ;;
88 -z* | --zprefix) zprefix=1; shift ;; 90 -z* | --zprefix) zprefix=1; shift ;;
89 -6* | --64) build64=1; shift ;; 91 -6* | --64) build64=1; shift ;;
90 -a*=* | --archs=*) ARCHS=`echo $1 | sed 's/.*=//'`; shift ;; 92 -a*=* | --archs=*) ARCHS=`echo $1 | sed 's/.*=//'`; shift ;;
@@ -345,6 +347,10 @@ OBJC='$(OBJZ)'
345PIC_OBJC='$(PIC_OBJZ)' 347PIC_OBJC='$(PIC_OBJZ)'
346fi 348fi
347 349
350if test $cover -eq 1; then
351 CFLAGS="${CFLAGS} -fprofile-arcs -ftest-coverage"
352fi
353
348cat > $test.c <<EOF 354cat > $test.c <<EOF
349#include <stdio.h> 355#include <stdio.h>
350#include <stdarg.h> 356#include <stdarg.h>
@@ -578,7 +584,7 @@ case $CFLAGS in
578 fi ;; 584 fi ;;
579esac 585esac
580 586
581rm -f $test.[co] $test $test$shared_ext 587rm -f $test.[co] $test $test$shared_ext $test.gcno
582 588
583# udpate Makefile 589# udpate Makefile
584sed < Makefile.in " 590sed < Makefile.in "