File: nut_check_cppcheck.m4

package info (click to toggle)
nut 2.8.4%2Breally-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 25,720 kB
  • sloc: ansic: 132,030; sh: 17,256; cpp: 12,566; makefile: 5,646; python: 1,114; perl: 856; xml: 47
file content (34 lines) | stat: -rw-r--r-- 1,156 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
dnl Check for "cppcheck" analysis tools

AC_DEFUN([NUT_CHECK_CPPCHECK],
[
if test -z "${nut_have_cppcheck_seen}"; then
	dnl NOTE: Did not really investigate suitable CPPCHECK_MIN_VERSION
	dnl values, just using current available as the baseline; maybe
	dnl older releases are also okay (if someone proves so).
	dnl The oldest available on the NUT CI build farm was 1.6 that worked.
	nut_have_cppcheck_seen=yes
	CPPCHECK_MIN_VERSION="1.0"

	AC_PATH_PROGS([CPPCHECK], [cppcheck])
	if test -n "${CPPCHECK}"; then
		AC_MSG_CHECKING([for cppcheck version])
		CPPCHECK_VERSION="`${CPPCHECK} --version 2>/dev/null`"
		dnl strip 'cppcheck ' from version string
		CPPCHECK_VERSION="${CPPCHECK_VERSION##* }"
		AC_MSG_RESULT(${CPPCHECK_VERSION} found)
	fi

	AC_MSG_CHECKING([if cppcheck version is okay (minimum required ${CPPCHECK_MIN_VERSION})])
	AX_COMPARE_VERSION([${CPPCHECK_VERSION}], [ge], [${CPPCHECK_MIN_VERSION}], [
		AC_MSG_RESULT(yes)
		nut_have_cppcheck="yes"
	], [
		AC_MSG_RESULT(no)
		nut_have_cppcheck="no"
	])

	dnl Notes: we also keep HAVE_CPPCHECK for implicit targets
	AM_CONDITIONAL([HAVE_CPPCHECK], [test "${nut_have_cppcheck}" = "yes"])
fi
])