]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
build: set STATIC_ANALYSIS when running via clang or coverity
authorJim Meyering <meyering@redhat.com>
Wed, 7 Apr 2010 15:02:25 +0000 (17:02 +0200)
committerJim Meyering <meyering@redhat.com>
Wed, 14 Apr 2010 18:10:18 +0000 (20:10 +0200)
* configure.ac (STATIC_ANALYSIS): Define when run via clang's
scan-build or coverity-prevent's cov-build.
Use the CLANG_CC and COVERITY_BUILD_COMMAND envvars as witnesses.

configure.ac

index 3505b4ae5c97c11fb42c67a478732b4cc55045f0..42c09b42a0256034a94b845c6a39ca836492803f 100644 (file)
@@ -2000,6 +2000,12 @@ AM_CONDITIONAL([WITH_MACVTAP], [test "$with_macvtap" = "yes"])
 test "x$srcdir" = x. && ! test -f COPYING &&
 cp -f COPYING.LIB COPYING
 
+# Detect when running under the clang static analyzer's scan-build driver
+# or Coverity-prevent's cov-build.  Define STATIC_ANALYSIS accordingly.
+test -n "$CCC_ANALYZER_ANALYSIS$COVERITY_BUILD_COMMAND" && t=1 || t=0
+AC_DEFINE_UNQUOTED([STATIC_ANALYSIS], [$t],
+  [Define to 1 when performing static analysis.])
+
 AC_OUTPUT(Makefile src/Makefile include/Makefile docs/Makefile \
          docs/schemas/Makefile \
          gnulib/lib/Makefile \