diff --git a/Makefile.am b/Makefile.am index 3de332ee..f8b6021a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -6,12 +6,29 @@ if MUPNP_ENABLE_TEST SUBDIRS += test endif -devdocsdir = $(datadir)/doc/clinkc-dev -docsdir = $(datadir)/doc/clinkc0 +############################## +# Code coverage +############################## + +# include $(top_srcdir)/aminclude_static.am + +CFLAGS="$CFLAGS $(CODE_COVERAGE_CFLAGS)" +CPPFLAGS="$CPPFLAGS $(CODE_COVERAGE_CPPFLAGS)" +CXXFLAGS="$CXXFLAGS $(CODE_COVERAGE_CXXFLAGS)" + +# clean-local: code-coverage-clean +# distclean-local: code-coverage-dist-clean + +############################## +# Dist +############################## + +devdocsdir = $(datadir)/doc/mupnp-dev +docsdir = $(datadir)/doc/mupnp0 EXTRA_DIST = debian/changelog \ - debian/clinkc0.install \ - debian/clinkc-dev.install \ + debian/mupnp0.install \ + debian/mupnp-dev.install \ debian/compat \ debian/control \ debian/copyright \ @@ -34,6 +51,17 @@ dist_devdocs_DATA = \ # doxygen/html/* \ # doxygen-objc/html/* +deb: dist + -mkdir $(top_builddir)/debian-build + -cp $(top_builddir)/../$(PACKAGE)*.orig.tar.gz $(top_builddir)/debian-build/ + cd $(top_builddir)/debian-build && tar zxf ../$(top_builddir)/$(PACKAGE)-$(VERSION).tar.gz + cd $(top_builddir)/debian-build/$(PACKAGE)-$(VERSION) && dpkg-buildpackage -rfakeroot -sa -D + -rm -rf $(top_builddir)/debian-build/$(PACKAGE)-$(VERSION) + +############################## +# Doxygen +############################## + doxygen: doxygen/html/* doxygen/html/* doxygen/html/*: @@ -42,11 +70,4 @@ doxygen/html/*: doxygen-objc/html/*: cd $(srcdir) && doxygen Doxyfile.objc -# scp -r doxygen-objc skonno,clinkobjc@frs.sourceforge.net:/home/groups/c/cl/clinkobjc/htdocs - -deb: dist - -mkdir $(top_builddir)/debian-build - -cp $(top_builddir)/../$(PACKAGE)*.orig.tar.gz $(top_builddir)/debian-build/ - cd $(top_builddir)/debian-build && tar zxf ../$(top_builddir)/$(PACKAGE)-$(VERSION).tar.gz - cd $(top_builddir)/debian-build/$(PACKAGE)-$(VERSION) && dpkg-buildpackage -rfakeroot -sa -D - -rm -rf $(top_builddir)/debian-build/$(PACKAGE)-$(VERSION) +# scp -r doxygen-objc skonno,clinkobjc@frs.sourceforge.net:/home/groups/c/cl/clinkobjc/htdocs \ No newline at end of file diff --git a/Makefile.in b/Makefile.in index 53bfa77a..ee19b7ee 100644 --- a/Makefile.in +++ b/Makefile.in @@ -244,14 +244,20 @@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ + +############################## +# Code coverage +############################## + +# include $(top_srcdir)/aminclude_static.am +CFLAGS = "$CFLAGS $(CODE_COVERAGE_CFLAGS)" CLOG_DEBUG_FLAGS = @CLOG_DEBUG_FLAGS@ -CPPFLAGS = @CPPFLAGS@ +CPPFLAGS = "$CPPFLAGS $(CODE_COVERAGE_CPPFLAGS)" CSCOPE = @CSCOPE@ CTAGS = @CTAGS@ CXX = @CXX@ CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ +CXXFLAGS = "$CXXFLAGS $(CODE_COVERAGE_CXXFLAGS)" CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ @@ -336,11 +342,18 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = include lib $(am__append_1) $(am__append_2) -devdocsdir = $(datadir)/doc/clinkc-dev -docsdir = $(datadir)/doc/clinkc0 + +# clean-local: code-coverage-clean +# distclean-local: code-coverage-dist-clean + +############################## +# Dist +############################## +devdocsdir = $(datadir)/doc/mupnp-dev +docsdir = $(datadir)/doc/mupnp0 EXTRA_DIST = debian/changelog \ - debian/clinkc0.install \ - debian/clinkc-dev.install \ + debian/mupnp0.install \ + debian/mupnp-dev.install \ debian/compat \ debian/control \ debian/copyright \ @@ -914,6 +927,17 @@ uninstall-am: uninstall-dist_devdocsDATA uninstall-dist_docsDATA \ # doxygen/html/* \ # doxygen-objc/html/* +deb: dist + -mkdir $(top_builddir)/debian-build + -cp $(top_builddir)/../$(PACKAGE)*.orig.tar.gz $(top_builddir)/debian-build/ + cd $(top_builddir)/debian-build && tar zxf ../$(top_builddir)/$(PACKAGE)-$(VERSION).tar.gz + cd $(top_builddir)/debian-build/$(PACKAGE)-$(VERSION) && dpkg-buildpackage -rfakeroot -sa -D + -rm -rf $(top_builddir)/debian-build/$(PACKAGE)-$(VERSION) + +############################## +# Doxygen +############################## + doxygen: doxygen/html/* doxygen/html/* doxygen/html/*: @@ -924,13 +948,6 @@ doxygen-objc/html/*: cd $(srcdir) && doxygen Doxyfile.objc # scp -r doxygen-objc skonno,clinkobjc@frs.sourceforge.net:/home/groups/c/cl/clinkobjc/htdocs -deb: dist - -mkdir $(top_builddir)/debian-build - -cp $(top_builddir)/../$(PACKAGE)*.orig.tar.gz $(top_builddir)/debian-build/ - cd $(top_builddir)/debian-build && tar zxf ../$(top_builddir)/$(PACKAGE)-$(VERSION).tar.gz - cd $(top_builddir)/debian-build/$(PACKAGE)-$(VERSION) && dpkg-buildpackage -rfakeroot -sa -D - -rm -rf $(top_builddir)/debian-build/$(PACKAGE)-$(VERSION) - # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: diff --git a/config.h.in b/config.h.in index 1cb3c4f1..9c832f83 100644 --- a/config.h.in +++ b/config.h.in @@ -44,6 +44,9 @@ (-lboost_unit_test_framework-mt). */ #undef HAVE_LIBBOOST_UNIT_TEST_FRAMEWORK_MT +/* Define to 1 if you have the `gcov' library (-lgcov). */ +#undef HAVE_LIBGCOV + /* Define to 1 if you have the `iconv' library (-liconv). */ #undef HAVE_LIBICONV diff --git a/configure b/configure index 8ad6a9d1..ece6aeef 100755 --- a/configure +++ b/configure @@ -5352,6 +5352,12 @@ then : fi +############################## +# Code coverage +############################## + +AX_CODE_COVERAGE + ############################## # Checks for Long Long ############################## @@ -7007,6 +7013,48 @@ else $as_nop as_fn_error $? "mUPnP needs boost::boost_unit_test_framework" "$LINENO" 5 fi +fi + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for main in -lgcov" >&5 +printf %s "checking for main in -lgcov... " >&6; } +if test ${ac_cv_lib_gcov_main+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_check_lib_save_LIBS=$LIBS +LIBS="-lgcov $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +namespace conftest { + extern "C" int main (); +} +int +main (void) +{ +return conftest::main (); + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO" +then : + ac_cv_lib_gcov_main=yes +else $as_nop + ac_cv_lib_gcov_main=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gcov_main" >&5 +printf "%s\n" "$ac_cv_lib_gcov_main" >&6; } +if test "x$ac_cv_lib_gcov_main" = xyes +then : + printf "%s\n" "#define HAVE_LIBGCOV 1" >>confdefs.h + + LIBS="-lgcov $LIBS" + fi fi diff --git a/configure.ac b/configure.ac index 082424b1..436ba74d 100644 --- a/configure.ac +++ b/configure.ac @@ -47,6 +47,12 @@ AM_PROG_CC_C_O AC_CHECK_HEADERS([stdbool.h]) +############################## +# Code coverage +############################## + +AX_CODE_COVERAGE + ############################## # Checks for Long Long ############################## @@ -549,6 +555,7 @@ AM_CONDITIONAL(MUPNP_ENABLE_TEST,test "$build_test" = yes) if [ test "$build_test" = yes ]; then AC_CHECK_LIB([boost_unit_test_framework-mt],[main],, [AC_CHECK_LIB([boost_unit_test_framework],[main],,[AC_MSG_ERROR(mUPnP needs boost::boost_unit_test_framework)])]) + AC_CHECK_LIB([gcov],[main]) fi ############################## diff --git a/lib/unix/Makefile.am b/lib/unix/Makefile.am index 3782b60c..54604bae 100644 --- a/lib/unix/Makefile.am +++ b/lib/unix/Makefile.am @@ -118,10 +118,10 @@ nobase_libmupnpinclude_HEADERS = \ #if HAVE_LIBTOOL #libmupnp_la_SOURCES = \ # $(mupnp_source) -#libmupnp_la_LIBADD = @HTTP_LIBS@ @XML_LIBS@ +#libmupnp_la_LIBADD = @HTTP_LIBS@ @XML_LIBS@ $(CODE_COVERAGE_LIBS) #else libmupnp_a_SOURCES = \ $(mupnp_sources) libmupnp_a_CFLAGS = $(AM_CFLAGS) -#libmupnp_a_LIBADD = @HTTP_LIBS@ @XML_LIBS@ +#libmupnp_a_LIBADD = @HTTP_LIBS@ @XML_LIBS@ $(CODE_COVERAGE_LIBS) #endif diff --git a/lib/unix/Makefile.am.build b/lib/unix/Makefile.am.build index df4088a8..34b69ac5 100755 --- a/lib/unix/Makefile.am.build +++ b/lib/unix/Makefile.am.build @@ -36,11 +36,11 @@ nobase_libmupnpinclude_HEADERS = \\ #if HAVE_LIBTOOL #libmupnp_la_SOURCES = \\ # \$(mupnp_source) -#libmupnp_la_LIBADD = \@HTTP_LIBS\@ \@XML_LIBS\@ +#libmupnp_la_LIBADD = \@HTTP_LIBS\@ \@XML_LIBS\@ \$(CODE_COVERAGE_LIBS) #else libmupnp_a_SOURCES = \\ \$(mupnp_sources) libmupnp_a_CFLAGS = \$(AM_CFLAGS) -#libmupnp_a_LIBADD = \@HTTP_LIBS\@ \@XML_LIBS\@ +#libmupnp_a_LIBADD = \@HTTP_LIBS\@ \@XML_LIBS\@ \$(CODE_COVERAGE_LIBS) #endif FOTTER diff --git a/lib/unix/Makefile.in b/lib/unix/Makefile.in index f7a258bc..59267ce6 100644 --- a/lib/unix/Makefile.in +++ b/lib/unix/Makefile.in @@ -609,7 +609,7 @@ nobase_libmupnpinclude_HEADERS = \ #if HAVE_LIBTOOL #libmupnp_la_SOURCES = \ # $(mupnp_source) -#libmupnp_la_LIBADD = @HTTP_LIBS@ @XML_LIBS@ +#libmupnp_la_LIBADD = @HTTP_LIBS@ @XML_LIBS@ $(CODE_COVERAGE_LIBS) #else libmupnp_a_SOURCES = \ $(mupnp_sources) @@ -2937,7 +2937,7 @@ uninstall-am: uninstall-libLIBRARIES \ .PRECIOUS: Makefile -#libmupnp_a_LIBADD = @HTTP_LIBS@ @XML_LIBS@ +#libmupnp_a_LIBADD = @HTTP_LIBS@ @XML_LIBS@ $(CODE_COVERAGE_LIBS) #endif # Tell versions [3.59,3.63) of GNU make to not export all variables. diff --git a/test/unix/Makefile.am b/test/unix/Makefile.am index 97a065b1..f146635c 100644 --- a/test/unix/Makefile.am +++ b/test/unix/Makefile.am @@ -9,7 +9,7 @@ TESTS = mupnptest check_PROGRAMS = mupnptest -AM_CPPFLAGS = -I$(top_srcdir)/include -I../ +AM_CPPFLAGS = -I$(top_srcdir)/include -I../ $(CODE_COVERAGE_CPPFLAGS) noinst_HEADERS = \ ../ClinkUnitTest.h \ @@ -31,7 +31,7 @@ mupnptest_SOURCES = \ ../DictionaryTest.cpp \ ../ServiceTest.cpp #if HAVE_LIBTOOL -#mupnptest_LDADD = ../../lib/unix/libmupnp.la @XML_LIBS@ +#mupnptest_LDADD = ../../lib/unix/libmupnp.la @XML_LIBS@ $(CODE_COVERAGE_LIBS) #else -mupnptest_LDADD = ../../lib/unix/libmupnp.a @XML_LIBS@ +mupnptest_LDADD = ../../lib/unix/libmupnp.a @XML_LIBS@ $(CODE_COVERAGE_LIBS) #endif diff --git a/test/unix/Makefile.am.build b/test/unix/Makefile.am.build index 737d7043..6709bcac 100755 --- a/test/unix/Makefile.am.build +++ b/test/unix/Makefile.am.build @@ -11,7 +11,7 @@ print<