summaryrefslogtreecommitdiff
path: root/configure
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 /configure
parent1bd2fa1b241d24dc444f17d217429780f0b657c0 (diff)
downloadzlib-d66a30794183e04f121fd1464d7bfcfbbcaf64ed.tar.gz
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.
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure8
1 files changed, 7 insertions, 1 deletions
diff --git a/configure b/configure
index 672b24f..d15c03b 100755
--- a/configure
+++ b/configure
@@ -55,6 +55,7 @@ mandir=${mandir-'${prefix}/share/man'}
shared_ext='.so'
shared=1
solo=0
+cover=0
zprefix=0
build64=0
gcc=0
@@ -85,6 +86,7 @@ case "$1" in
-s* | --shared | --enable-shared) shared=1; shift ;;
-t | --static) shared=0; shift ;;
--solo) solo=1; shift ;;
+ --cover) cover=1; shift ;;
-z* | --zprefix) zprefix=1; shift ;;
-6* | --64) build64=1; shift ;;
-a*=* | --archs=*) ARCHS=`echo $1 | sed 's/.*=//'`; shift ;;
@@ -345,6 +347,10 @@ OBJC='$(OBJZ)'
PIC_OBJC='$(PIC_OBJZ)'
fi
+if test $cover -eq 1; then
+ CFLAGS="${CFLAGS} -fprofile-arcs -ftest-coverage"
+fi
+
cat > $test.c <<EOF
#include <stdio.h>
#include <stdarg.h>
@@ -578,7 +584,7 @@ case $CFLAGS in
fi ;;
esac
-rm -f $test.[co] $test $test$shared_ext
+rm -f $test.[co] $test $test$shared_ext $test.gcno
# udpate Makefile
sed < Makefile.in "