@@ -20,7 +20,7 @@ AC_PATH_TOOL(STRIP, strip)
2020AX_PROG_CC_FOR_BUILD
2121
2222if test "x$CFLAGS" = "x"; then
23- CFLAGS="-O3 - g"
23+ CFLAGS="-g"
2424fi
2525
2626AM_PROG_CC_C_O
@@ -89,6 +89,11 @@ AC_ARG_ENABLE(benchmark,
8989 [ use_benchmark=$enableval] ,
9090 [ use_benchmark=no] )
9191
92+ AC_ARG_ENABLE ( coverage ,
93+ AS_HELP_STRING ( [ --enable-coverage] ,[ enable compiler flags to support kcov coverage analysis] ) ,
94+ [ enable_coverage=$enableval] ,
95+ [ enable_coverage=no] )
96+
9297AC_ARG_ENABLE ( tests ,
9398 AS_HELP_STRING ( [ --enable-tests] ,[ compile tests (default is yes)] ) ,
9499 [ use_tests=$enableval] ,
@@ -154,6 +159,14 @@ AC_COMPILE_IFELSE([AC_LANG_SOURCE([[void myfunc() {__builtin_expect(0,0);}]])],
154159 [ AC_MSG_RESULT ( [ no] )
155160 ] )
156161
162+ if test x"$enable_coverage" = x"yes"; then
163+ AC_DEFINE ( COVERAGE , 1 , [ Define this symbol to compile out all VERIFY code] )
164+ CFLAGS="$CFLAGS -O0 --coverage"
165+ LDFLAGS="--coverage"
166+ else
167+ CFLAGS="$CFLAGS -O3"
168+ fi
169+
157170if test x"$use_ecmult_static_precomputation" != x"no"; then
158171 save_cross_compiling=$cross_compiling
159172 cross_compiling=no
@@ -434,6 +447,7 @@ AC_MSG_NOTICE([Using field implementation: $set_field])
434447AC_MSG_NOTICE ( [ Using bignum implementation: $set_bignum] )
435448AC_MSG_NOTICE ( [ Using scalar implementation: $set_scalar] )
436449AC_MSG_NOTICE ( [ Using endomorphism optimizations: $use_endomorphism] )
450+ AC_MSG_NOTICE ( [ Building for coverage analysis: $enable_coverage] )
437451AC_MSG_NOTICE ( [ Building ECDH module: $enable_module_ecdh] )
438452AC_MSG_NOTICE ( [ Building ECDSA pubkey recovery module: $enable_module_recovery] )
439453AC_MSG_NOTICE ( [ Using jni: $use_jni] )
@@ -460,6 +474,7 @@ AC_SUBST(SECP_INCLUDES)
460474AC_SUBST ( SECP_LIBS )
461475AC_SUBST ( SECP_TEST_LIBS )
462476AC_SUBST ( SECP_TEST_INCLUDES )
477+ AM_CONDITIONAL([ ENABLE_COVERAGE] , [ test x"$enable_coverage" = x"yes"] )
463478AM_CONDITIONAL([ USE_TESTS] , [ test x"$use_tests" != x"no"] )
464479AM_CONDITIONAL([ USE_EXHAUSTIVE_TESTS] , [ test x"$use_exhaustive_tests" != x"no"] )
465480AM_CONDITIONAL([ USE_BENCHMARK] , [ test x"$use_benchmark" = x"yes"] )
0 commit comments