Add configure options for instrumentation: --enable-coverage & --enable-profiling

This commit is contained in:
Brian Cox 2017-08-28 22:28:30 -07:00
parent 7310422053
commit 78b09e081f
2 changed files with 44 additions and 0 deletions

28
configure vendored
View File

@ -750,6 +750,8 @@ enable_silent_rules
enable_extrawarnings
enable_static
enable_debug
enable_coverage
enable_profiling
enable_dependency_tracking
enable_commoncrypto
enable_iconv
@ -1395,6 +1397,8 @@ Optional Features:
—-disable-extrawarnings do not compile with -Wextra warnings enabled
--enable-static compile static binaries
--enable-debug compile with debuging enabled
--enable-coverage enable code coverage
--enable-profiling enable profiling
--enable-dependency-tracking
do not reject slow dependency extractors
--disable-dependency-tracking
@ -3497,6 +3501,30 @@ $as_echo "#define NDEBUG 1" >>confdefs.h
fi
# Check whether --enable-coverage was given.
if test "${enable_coverage+set}" = set; then :
enableval=$enable_coverage;
fi
if test "x$enable_coverage" = xyes
then
CFLAGS="${CFLAGS} --coverage"
CXXFLAGS="${CXXFLAGS} --coverage"
LDFLAGS="${LDFLAGS} --coverage"
fi
# Check whether --enable-profiling was given.
if test "${enable_profiling+set}" = set; then :
enableval=$enable_profiling;
fi
if test "x$enable_profiling" = xyes
then
CFLAGS="${CFLAGS} -pg"
CXXFLAGS="${CXXFLAGS} -pg"
LDFLAGS="${LDFLAGS} -pg"
fi
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'

View File

@ -44,6 +44,22 @@ else
AC_DEFINE(NDEBUG, 1, [Compile without debug code])
fi
AC_ARG_ENABLE(coverage, [ --enable-coverage enable code coverage])
if test "x$enable_coverage" = xyes
then
CFLAGS="${CFLAGS} --coverage"
CXXFLAGS="${CXXFLAGS} --coverage"
LDFLAGS="${LDFLAGS} --coverage"
fi
AC_ARG_ENABLE(profiling, [ --enable-profiling enable profiling])
if test "x$enable_profiling" = xyes
then
CFLAGS="${CFLAGS} -pg"
CXXFLAGS="${CXXFLAGS} -pg"
LDFLAGS="${LDFLAGS} -pg"
fi
dnl ###################
dnl Checks for programs
dnl ###################