diff --git a/configure.ac b/configure.ac index 1468f4f..405b508 100644 --- a/configure.ac +++ b/configure.ac @@ -87,6 +87,22 @@ AC_CANONICAL_HOST ############################################################################# +# Check for --enable-coverage option +############################################################################# +AC_MSG_CHECKING(whether to build ctools for code coverage measure) +AC_ARG_ENABLE([coverage], + AS_HELP_STRING([--enable-coverage], + [turn on code coverage measure [default=no]]), + [enable_coverage="$enableval"], + [enable_coverage="no"]) +if test "x$enable_coverage" = "xyes"; then + AC_MSG_RESULT(yes) +else + AC_MSG_RESULT(no) +fi + + +############################################################################# # Check for valid C++ compiler. This has to come before the check for # # header files, otherwise we won't detect if the C++ compiler is missing. # # # @@ -140,11 +156,23 @@ else fi AM_CONDITIONAL(IS_ELCAPITAN, test "x$osx_el_capitan" = "xyes") +# If coverage is selected then save current C++ options +if test "x$enable_coverage" = "xyes"; then + SAVED_CXXFLAGS=$CXXFLAGS + SAVED_CFLAGS=$CFLAGS +fi + # Our language is C++ AC_LANG(C++) AC_PROG_CXX($cxx_list) AC_PROG_CC($cc_list) +# If coverage is selected then restore former C++ options +if test "x$enable_coverage" = "xyes"; then + CXXFLAGS=$SAVED_CXXFLAGS + CFLAGS=$SAVED_CFLAGS +fi + ############################################################################# # Darwin option: Determine architecture of universal library to be built # @@ -760,13 +788,7 @@ fi PYTHON_COVERAGE= COVERAGE_CXXFLAGS= -# Check for coverage option -AC_MSG_CHECKING(whether to build ctools for code coverage measure) -AC_ARG_ENABLE([coverage], - AS_HELP_STRING([--enable-coverage], - [turn on code coverage measure [default=no]]), - [enable_coverage="$enableval"], - [enable_coverage="no"]) +# If coverage option has been selected then set some variables if test "x$enable_coverage" = "xyes"; then CXXFLAGS="--coverage $CXXFLAGS" COVERAGE_CXXFLAGS="--coverage" diff --git a/src/ctbin/main.cpp b/src/ctbin/main.cpp index 813984e..4e1da8c 100644 --- a/src/ctbin/main.cpp +++ b/src/ctbin/main.cpp @@ -76,4 +76,4 @@ int main (int argc, char *argv[]) // Return return rc; -} // GCOV_EXCL_LINE +}