build: use `--coverage` for gcov

libtool does not understand `-coverage` with a single dash.  Official
gcc docs also say `--coverage` rather than `-coverage`.  (clang lists
both.)

Also, for correct linking, libtool needs `--coverage` in LDFLAGS as
opposed to `-lgcov` (with the latter you get library ordering/deps
issues)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
This commit is contained in:
David Lamparter 2021-07-21 11:23:23 +02:00
parent 63116a7008
commit 81aff2127f
1 changed files with 2 additions and 2 deletions

View File

@ -264,11 +264,11 @@ AC_C_FLAG([-std=gnu11], [CC="$ac_cc"], [CC="$CC -std=gnu11"])
dnl if the user has specified any CFLAGS, override our settings
if test "$enable_gcov" = "yes"; then
if test "$orig_cflags" = ""; then
AC_C_FLAG([-coverage])
AC_C_FLAG([--coverage])
AC_C_FLAG([-O0])
fi
AC_LDFLAGS="${AC_LDFLAGS} -lgcov"
AC_LDFLAGS="${AC_LDFLAGS} --coverage"
fi
if test "$enable_clang_coverage" = "yes"; then