summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 37a9517)
raw | patch | inline | side by side (parent: 37a9517)
author | Sebastian Harl <sh@tokkee.org> | |
Sat, 21 Dec 2013 20:08:43 +0000 (21:08 +0100) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Sat, 21 Dec 2013 20:08:43 +0000 (21:08 +0100) |
configure.ac | patch | blob | history | |
src/Makefile.am | patch | blob | history |
diff --git a/configure.ac b/configure.ac
index b7a07e662bdaf80ccfde933aaf26ce5a38cdf0ba..8620ff8246eab1a902522e44b4a5992343bd0ff8 100644 (file)
--- a/configure.ac
+++ b/configure.ac
fi
AC_SUBST([STRICT_CFLAGS])
+AC_ARG_ENABLE([gcov],
+ AS_HELP_STRING([--enable-gcov],
+ [Gcov coverage statistics @<:@default=no@:>@]),
+ [enable_gcov="$enableval"],
+ [enable_gcov="no"])
+
+COVERAGE_CFLAGS=""
+COVERAGE_LDFLAGS=""
+if test "x$enable_gcov" = "xyes"; then
+ COVERAGE_CFLAGS="-O0"
+ cov_flag_have_problem="no"
+
+ AC_MSG_CHECKING([whether $CC accepts --coverage])
+ if test_cc_flags --coverage; then
+ COVERAGE_CFLAGS="$COVERAGE_CFLAGS --coverage"
+ COVERAGE_LDFLAGS="$COVERAGE_LDFLAGS --coverage"
+ AC_MSG_RESULT([yes])
+ else
+ AC_MSG_RESULT([no])
+ cov_flag_have_problem="yes"
+ fi
+
+ for flag in -fno-inline; do
+ AC_MSG_CHECKING([whether $CC accepts $flag])
+ if test_cc_flags $flag; then
+ COVERAGE_CFLAGS="$COVERAGE_CFLAGS $flag"
+ AC_MSG_RESULT([yes])
+ else
+ AC_MSG_RESULT([no])
+ cov_flag_have_problem="yes"
+ fi
+ done
+
+ if test "x$cov_flag_have_problem" != "xno"; then
+ AC_MSG_WARN([Some coverage flags are not supported by your compiler!])
+ fi
+fi
+AC_SUBST([COVERAGE_CFLAGS])
+AC_SUBST([COVERAGE_LDFLAGS])
+
m4_divert_once([HELP_ENABLE], [
Build dependencies:])
AC_MSG_RESULT([ documentation: . . . . . . $build_documentation])
AC_MSG_RESULT([ unit testing: . . . . . . . $build_testing])
AC_MSG_RESULT([ stdio mocking: . . . . . $have_fopencookie])
+AC_MSG_RESULT([ coverage testing: . . . . . $enable_gcov])
AC_MSG_RESULT()
AC_MSG_RESULT([ Libraries:])
AC_MSG_RESULT([ libdbi: . . . . . . . . . . $with_libdbi])
diff --git a/src/Makefile.am b/src/Makefile.am
index fea709ecbdf43d4565a1c4b0c8daef2502d85eed..32da63591ecd09c5f376e18d88fca3f5abe4d1cc 100644 (file)
--- a/src/Makefile.am
+++ b/src/Makefile.am
SUBDIRS = liboconfig
-AM_CFLAGS = @STRICT_CFLAGS@
+# coverage related flags are only set when gcov is enabled
+AM_CFLAGS = @STRICT_CFLAGS@ @COVERAGE_CFLAGS@
+AM_LDFLAGS = @COVERAGE_LDFLAGS@
AM_CPPFLAGS = -Iinclude
AM_CPPFLAGS += -DSYSCONFDIR='"${sysconfdir}"'
AM_CPPFLAGS += -DLOCALSTATEDIR='"${localstatedir}"'
utils/strbuf.c include/utils/strbuf.h
libsysdbclient_la_CFLAGS = $(AM_CFLAGS)
libsysdbclient_la_CPPFLAGS = $(AM_CPPFLAGS) $(LTDLINCL)
-libsysdbclient_la_LDFLAGS = -version-info 0:0:0 -pthread
+libsysdbclient_la_LDFLAGS = $(AM_LDFLAGS) -version-info 0:0:0 -pthread
libsysdbclient_la_LIBADD = $(LIBLTDL)
libsysdb_la_SOURCES = \
utils/unixsock.c include/utils/unixsock.h
libsysdb_la_CFLAGS = $(AM_CFLAGS)
libsysdb_la_CPPFLAGS = $(AM_CPPFLAGS) $(LTDLINCL)
-libsysdb_la_LDFLAGS = -version-info 0:0:0 -pthread
+libsysdb_la_LDFLAGS = $(AM_LDFLAGS) -version-info 0:0:0 -pthread
libsysdb_la_LIBADD = $(LIBLTDL) -lrt liboconfig/liboconfig.la
libsysdb_la_DEPENDENCIES = liboconfig/liboconfig.la
if BUILD_PLUGIN_COLLECTD
pkgbackendcollectdlib_LTLIBRARIES += backend/collectd/unixsock.la
backend_collectd_unixsock_la_SOURCES = backend/collectd/unixsock.c
-backend_collectd_unixsock_la_LDFLAGS = -module -avoid-version
+backend_collectd_unixsock_la_LDFLAGS = $(AM_LDFLAGS) -module -avoid-version
libsysdb_la_LIBADD += -dlopen backend/collectd/unixsock.la
libsysdb_la_DEPENDENCIES += backend/collectd/unixsock.la
endif
if BUILD_PLUGIN_MKLIVESTATUS
pkgbackendlib_LTLIBRARIES += backend/mk-livestatus.la
backend_mk_livestatus_la_SOURCES = backend/mk-livestatus.c
-backend_mk_livestatus_la_LDFLAGS = -module -avoid-version
+backend_mk_livestatus_la_LDFLAGS = $(AM_LDFLAGS) -module -avoid-version
libsysdb_la_LIBADD += -dlopen backend/mk-livestatus.la
libsysdb_la_DEPENDENCIES += backend/mk-livestatus.la
endif
if BUILD_PLUGIN_PUPPETSTORECONFIGS
pkgbackendpuppetlib_LTLIBRARIES += backend/puppet/store-configs.la
backend_puppet_store_configs_la_SOURCES = backend/puppet/store-configs.c
-backend_puppet_store_configs_la_LDFLAGS = -module -avoid-version
+backend_puppet_store_configs_la_LDFLAGS = $(AM_LDFLAGS) -module -avoid-version
libsysdb_la_LIBADD += -dlopen backend/puppet/store-configs.la
libsysdb_la_DEPENDENCIES += backend/puppet/store-configs.la
endif
if BUILD_PLUGIN_SYSLOG
pkglib_LTLIBRARIES += plugins/syslog.la
plugins_syslog_la_SOURCE = plugins/syslog.c
-plugins_syslog_la_LDFLAGS = -module -avoid-version
+plugins_syslog_la_LDFLAGS = $(AM_LDFLAGS) -module -avoid-version
libsysdb_la_LIBADD += -dlopen plugins/syslog.la
libsysdb_la_DEPENDENCIES += plugins/syslog.la
endif
if BUILD_PLUGIN_CNAMEDNS
pkgcnamelib_LTLIBRARIES += plugins/cname/dns.la
plugins_cname_dns_la_SOURCE = plugins/cname/dns.c
-plugins_cname_dns_la_LDFLAGS = -module -avoid-version
+plugins_cname_dns_la_LDFLAGS = $(AM_LDFLAGS) -module -avoid-version
libsysdb_la_LIBADD += -dlopen plugins/cname/dns.la
libsysdb_la_DEPENDENCIES += plugins/cname/dns.la
endif