configure.ac: add a toggle to enable the special coverity options
authorPeter Hutterer <peter.hutterer@who-t.net>
Wed, 12 Feb 2020 22:06:33 +0000 (08:06 +1000)
committerPeter Hutterer <peter.hutterer@who-t.net>
Wed, 12 Feb 2020 22:12:03 +0000 (22:12 +0000)
Coverity tries to supply system headers and fails badly at it. A bunch of
_Float... sizes are pulled in by math.h but not provided anywhere. So as a
workaround, let's add an option to explicitly enable coverity support that
simply #defines those types to ones we do know about and let's go on hoping
it'll eventually work.

See the equivalent addition to libinput in commit 8178339b5baa717.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
configure.ac

index b284acb..d4cc1a8 100644 (file)
@@ -126,6 +126,26 @@ AC_SUBST([GCOV_CFLAGS])
 AC_SUBST([GCOV_LDFLAGS])
 AC_MSG_RESULT([$enable_gcov])
 
+AC_MSG_CHECKING([whether to build with coverity support])
+AC_ARG_ENABLE([coverity],
+             [AS_HELP_STRING([--enable-coverity],
+                             [Whether to build with coverity support (default: disabled)])],
+             [],
+             [enable_coverity=no],
+             )
+AS_IF([test "x$enable_coverity" != "xno"],
+      [
+       AC_DEFINE([_Float128], [__uint128_t], [Override for coverity])
+       AC_DEFINE([_Float32], [int], [Override for coverity])
+       AC_DEFINE([_Float32x], [int], [Override for coverity])
+       AC_DEFINE([_Float64], [long], [Override for coverity])
+       AC_DEFINE([_Float64x], [long], [Override for coverity])
+       enable_coverity=yes
+       ],
+)
+AC_MSG_RESULT([$enable_coverity])
+
+
 AM_PATH_PYTHON([2.6])
 
 # nm to check for leaking symbols in the static library
@@ -163,5 +183,6 @@ AC_MSG_RESULT([
               Build documentation              ${have_doxygen}
               Enable unit-tests                ${HAVE_CHECK}
               Enable profiling                 ${enable_gcov}
+              Enable coverity support          ${enable_coverity}
               Static library symbol check      ${static_symbol_leaks_test}
               ])