aboutsummaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorBen Pfaff <blp@nicira.com>2009-07-27 16:42:51 -0700
committerBen Pfaff <blp@nicira.com>2009-07-29 12:33:32 -0700
commitc2b070214097fa40dc78252882d96babe7fab4b4 (patch)
treeba992f3264d556f3e376a1248d26fc800116590a /m4
parent1b233b95b5907a242ee453cbea3ad4bc4cd4fec2 (diff)
Add support for code coverage analysis with gcov and lcov.
Diffstat (limited to 'm4')
-rw-r--r--m4/openvswitch.m425
1 files changed, 25 insertions, 0 deletions
diff --git a/m4/openvswitch.m4 b/m4/openvswitch.m4
index ce55311a..3fe053b0 100644
--- a/m4/openvswitch.m4
+++ b/m4/openvswitch.m4
@@ -14,6 +14,31 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+dnl Checks for --enable-coverage and updates CFLAGS and LDFLAGS appropriately.
+AC_DEFUN([OVS_CHECK_COVERAGE],
+ [AC_REQUIRE([AC_PROG_CC])
+ AC_ARG_ENABLE(
+ [coverage],
+ [AC_HELP_STRING([--enable-coverage],
+ [Enable gcov coverage tool.])],
+ [case "${enableval}" in
+ (lcov) coverage=true lcov=true ;;
+ (yes) coverage=true lcov=false ;;
+ (no) coverage=false lcov=false ;;
+ (*) AC_MSG_ERROR([bad value ${enableval} for --enable-coverage]) ;;
+ esac],
+ [coverage=false lcov=false])
+ if $coverage; then
+ CFLAGS="$CFLAGS -O0 --coverage"
+ LDFLAGS="$LDFLAGS --coverage"
+ fi
+ if $lcov; then
+ if lcov --version >/dev/null 2>&1; then :; else
+ AC_MSG_ERROR([--enable-coverage=lcov was specified but lcov is not in \$PATH])
+ fi
+ fi
+ AC_SUBST([LCOV], [$lcov])])
+
dnl Checks for --enable-ndebug and defines NDEBUG if it is specified.
AC_DEFUN([OVS_CHECK_NDEBUG],
[AC_ARG_ENABLE(