]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
meson: add static analysis detection
authorPavel Hrdina <phrdina@redhat.com>
Tue, 30 Jun 2020 17:27:33 +0000 (19:27 +0200)
committerPavel Hrdina <phrdina@redhat.com>
Mon, 3 Aug 2020 07:26:57 +0000 (09:26 +0200)
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
configure.ac
meson.build

index d5b3a653dceee022409c7ab93af68e55acb4e334..f006b7dbe0946f019984044bbf63d1b22352edd2 100644 (file)
@@ -720,21 +720,6 @@ if test "$want_ifconfig" = "yes"; then
      AC_DEFINE_UNQUOTED([IFCONFIG_PATH], "$IFCONFIG_PATH", [path to ifconfig binary])
 fi
 
-# Detect when running under the clang static analyzer's scan-build driver
-# or Coverity-prevent's cov-build.  Define STATIC_ANALYSIS accordingly.
-AC_CACHE_CHECK([whether this build is done by a static analysis tool],
-  [lv_cv_static_analysis], [
-    lv_cv_static_analysis=no
-    if test -n "${CCC_ANALYZER_ANALYSIS+set}" || \
-       test -n "$COVERITY_BUILD_COMMAND$COVERITY_LD_PRELOAD"; then
-      lv_cv_static_analysis=yes
-    fi
-  ])
-t=0
-test "x$lv_cv_static_analysis" = xyes && t=1
-AC_DEFINE_UNQUOTED([STATIC_ANALYSIS], [$t],
-  [Define to 1 when performing static analysis.])
-
 GNUmakefile=GNUmakefile
 m4_if(m4_version_compare([2.61a.100],
         m4_defn([m4_PACKAGE_VERSION])), [1], [],
index ff4fcd31663a6471c48cc2cdd54d11b7dbad9677..530ac720baba4f71c043f2483990d133d415812f 100644 (file)
@@ -146,6 +146,20 @@ if get_option('test_coverage')
 endif
 
 
+# Detect when running under the clang static analyzer's scan-build driver
+# or Coverity-prevent's cov-build. Define STATIC_ANALYSIS accordingly.
+
+rc = run_command(
+  'sh', '-c',
+  'test -n "${CCC_ANALYZER_HTML}"' +
+    ' -o -n "${CCC_ANALYZER_ANALYSIS+set}"' +
+    ' -o -n "$COVERITY_BUILD_COMMAND$COVERITY_LD_PRELOAD"',
+)
+if rc.returncode() == 0
+  conf.set('STATIC_ANALYSIS', 1)
+endif
+
+
 # figure out libvirt version strings
 
 arr_version = meson.project_version().split('.')