2 # Copyright (C) 2012 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 # Check that the new testsuite harness do not generate recipes that can
18 # have a trailing '\', since that can cause spurious syntax errors with
19 # older bash versions (e.g., bash 2.05b).
20 # See automake bug#10436.
25 echo AC_OUTPUT >> configure.ac
27 cat > Makefile.am <<'END'
30 am__backslash = \\ # foo
33 @printf '%s\n' $(am__backslash)
36 cat > foo.test <<'END'
42 am__SHELL=$SHELL; export am__SHELL
43 am__PERL=$PERL; export am__PERL
45 cat > my-shell <<'END'
52 am__shell_command=; unset am__shell_command
53 while test $# -gt 0; do
55 # If the shell is invoked by make e.g. as "sh -ec" (seen on
56 # GNU make in POSIX mode) or "sh -ce" (seen on Solaris make).
58 flg=`echo x"$1" | sed -e 's/^x-//' -e 's/c//g'`
59 if test x"$flg" != x; then
60 am__shell_flags="$am__shell_flags -$flg"
66 am__shell_flags="$am__shell_flags $1"
74 if test x${am__shell_command+"set"} != x"set"; then
75 # Some make implementations, like *BSD's, pass the recipes to the shell
76 # through its standard input. Trying to run our extra checks in this
77 # case would be too tricky, so we just skip them.
78 exec $am__SHELL $am__shell_flags ${1+"$@"}
80 am__tweaked_shell_command=`printf '%s\n' "$am__shell_command" \
82 case ${am__tweaked_shell_command-} in
84 echo "my-shell: recipe ends with backslash character" >&2
85 printf '%s\n' "=== BEGIN recipe" >&2
86 printf '%s\n' "${am__shell_command-}" >&2
87 printf '%s\n' "=== END recipe" >&2
91 exec $am__SHELL $am__shell_flags -c "$am__shell_command" ${1+"$@"}
98 CONFIG_SHELL=`pwd`/my-shell; export CONFIG_SHELL
104 ./configure CONFIG_SHELL="$CONFIG_SHELL"
107 $MAKE bad-recipe 2>stderr && st=1
109 $FGREP "my-shell: recipe ends with backslash character" stderr || st=1
110 test $st -eq 0 || skip_ "can't catch trailing backslashes in make recipes"