File: sanity_check.m4

package info (click to toggle)
llvm 2.6-9.1
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 57,604 kB
  • ctags: 44,336
  • sloc: cpp: 344,766; sh: 12,407; ansic: 10,617; ada: 3,070; ml: 2,505; perl: 2,496; makefile: 1,426; pascal: 1,163; exp: 389; asm: 307; python: 298; objc: 260; lisp: 182; csh: 117; xml: 38; f90: 36; tcl: 20
file content (31 lines) | stat: -rw-r--r-- 1,016 bytes parent folder | download | duplicates (22)
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
dnl Check a program for version sanity. The test runs a program, passes it an
dnl argument to make it print out some identification string, and filters that 
dnl output with a regular expression. If the output is non-empty, the program
dnl passes the sanity check.
dnl   $1 - Name or full path of the program to run
dnl   $2 - Argument to pass to print out identification string
dnl   $3 - grep RE to match identification string
dnl   $4 - set to 1 to make errors only a warning
AC_DEFUN([CHECK_PROGRAM_SANITY],
[
AC_MSG_CHECKING([sanity for program ]$1)
sanity="0"
sanity_path=`which $1 2>/dev/null`
if test "$?" -eq 0 -a -x "$sanity_path" ; then
  sanity=`$1 $2 2>&1 | grep "$3"`
  if test -z "$sanity" ; then
    AC_MSG_RESULT([no])
    sanity="0"
    if test "$4" -eq 1 ; then
      AC_MSG_WARN([Program ]$1[ failed to pass sanity check.])
    else
      AC_MSG_ERROR([Program ]$1[ failed to pass sanity check.])
    fi
  else
    AC_MSG_RESULT([yes])
    sanity="1"
  fi
else
  AC_MSG_RESULT([not found])
fi
])