Add coverage testing using gcov

To check the coverage of e2fsprogs's regression test, do the
following:

	configure --enable-gcov
	make -j8 ; make -j8 check ; make coverage.txt

The coverage information will be the coverage.txt and *.gcov files in
the build directories.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
diff --git a/configure b/configure
index 19e8d82..44664c3 100755
--- a/configure
+++ b/configure
@@ -836,6 +836,7 @@
 enable_elf_shlibs
 enable_bsd_shlibs
 enable_profile
+enable_gcov
 enable_checker
 enable_jbd_debug
 enable_blkid_debug
@@ -1492,6 +1493,7 @@
   --enable-elf-shlibs	  select ELF shared libraries
   --enable-bsd-shlibs	  select BSD shared libraries
   --enable-profile	  build profiling libraries
+  --enable-gcov	  	  build for coverage testing using gcov
   --enable-checker	  build checker libraries
   --enable-jbd-debug  	  enable journal debugging
   --enable-blkid-debug    enable blkid debugging
@@ -4677,6 +4679,18 @@
 
 
 
+# Check whether --enable-gcov was given.
+if test "${enable_gcov+set}" = set; then :
+  enableval=$enable_gcov; if test "$enableval" = "yes"
+then
+	CFLAGS="-g -fprofile-arcs -ftest-coverage"
+	LDFLAGS="-fprofile-arcs -ftest-coverage"
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: Enabling gcov support" >&5
+$as_echo "Enabling gcov support" >&6; }
+fi
+
+fi
+
 # Check whether --enable-checker was given.
 if test "${enable_checker+set}" = set; then :
   enableval=$enable_checker; if test "$enableval" = "no"