1 #! @AM_TEST_RUNNER_SHELL@
2 # Copyright (C) 2012-2017 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 <https://www.gnu.org/licenses/>.
17 # A "shell" that chokes on '-c' commands and/or shell scripts having
18 # a trailing '\' character (possibly followed by whitespace only).
19 # This is to emulate problems seen in older bash versions (e.g., bash
20 # 2.05b). See also automake bug#10436.
24 am_SHELL=${AM_TESTSUITE_SHELL-'@SHELL@'}
28 shell_command=; unset shell_command
29 shell_script=; unset shell_script
30 while test $# -gt 0; do
32 # The shell might be invoked by make e.g. as "sh -ec" or "sh -ce".
33 # Be liberal (in the spirit of defensive programming) and accept
35 -*c*) shell_command=$2; shift;;
42 if test x${shell_command+"set"} != x"set"; then
43 if test $# -gt 0; then
45 shell_command=$(cat <"$shell_script")
47 # Some make implementations, like *BSD's, pass the recipes to the
48 # shell through its standard input. Trying to run our extra checks
49 # in this case would be too tricky, so we just skip them.
53 original_shell_command=$shell_command
58 case "$shell_command" in
60 shell_command=$(printf '%s\n' "$shell_command" | tr -d " $tab$nl");;
63 case "$shell_command" in
66 printf '%s\n' "$0: recipe/script ends with backslash character"
67 printf '%s\n' "=== BEGIN recipe/script"
68 if test x${shell_script+"set"} = x"set"; then
71 printf '%s\n' "$original_shell_command"
73 printf '%s\n' "=== END recipe/script"
80 if test $? -gt 0; then
81 # Some of our scripts or makefile recipes had invalid contents.
85 exec ${AM_TESTSUITE_SHELL-'@SHELL@'} ${1+"$@"}