gui: Fix warnings.
[pspp-builds.git] / tests / valgrind-wrapper.in
1 #! /bin/sh
2
3 program=`basename "$0"`
4
5 new_PATH=
6 save_IFS=$IFS
7 IFS=:
8 found=no
9 for dir in $PATH; do
10     IFS=$save_IFS
11     if test "X$dir" = X; then
12         dir=.
13     fi
14     if test -x "$dir/$program"; then
15         if test $found = no; then
16             found=yes
17             continue
18         else
19             if test "X$next_program" = X; then
20                 next_program=$dir/$program
21             fi
22         fi
23     fi
24 done
25 IFS=$save_IFS
26
27 if test $found = no; then
28     echo "$0: $program not found in PATH ($PATH)" >&2
29     exit 1
30 elif test "X$next_program" = X; then
31     echo "$0: $program found only once in PATH ($PATH)" >&2
32     exit 1
33 fi
34
35 : ${VALGRIND:=libtool --mode=execute valgrind --log-file=valgrind.%p --leak-check=full --num-callers=20}
36 exec $VALGRIND $next_program "$@"
37 echo "$0: $VALGRIND $wrap_program $* failed" >&2
38 exit 1