1 #! @AM_TEST_RUNNER_SHELL@
2 # Copyright (C) 2012-2013 Free Software Foundation, Inc.
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2, or (at your option)
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
17 # A "shell" that chokes on '-c' commands having a trailing '\' character
18 # (possibly followed by whitespace only). This is to emulate problems
19 # seen in older bash versions (e.g., bash 2.05b).
20 # See also automake bug#10436.
25 am_SHELL=${AM_TESTSUITE_SHELL-'@SHELL@'}
31 am_shell_command=; unset am_shell_command
32 while test $# -gt 0; do
34 # If the shell is invoked by make e.g. as "sh -ec" (seen on
35 # GNU make in POSIX mode) or "sh -ce" (seen on Solaris make).
37 am_flg=$(printf '%s\n' "$1" | sed -e 's/^-//' -e 's/c//g')
38 if test x"$am_flg" != x; then
39 am_shell_flags="$am_shell_flags -$am_flg"
44 am_shell_flags="$am_shell_flags $1";;
51 if test x${am_shell_command+"set"} != x"set"; then
52 # Some make implementations, like *BSD's, pass the recipes to the shell
53 # through its standard input. Trying to run our extra checks in this
54 # case would be too tricky, so we just skip them.
55 exec $am_SHELL $am_shell_flags ${1+"$@"}
58 case $am_shell_command in
60 am_tweaked_shell_command=$(printf '%s\n' "$am_shell_command" \
63 am_tweaked_shell_command=$am_shell_command;;
66 case $am_tweaked_shell_command in
68 printf '%s\n' "$0: recipe ends with backslash character" >&2
69 printf '%s\n' "=== BEGIN recipe" >&2
70 printf '%s\n' "${am_shell_command-}" >&2
71 printf '%s\n' "=== END recipe" >&2
76 exec $am_SHELL $am_shell_flags -c "$am_shell_command" ${1+"$@"}