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.
24 echo AC_OUTPUT >> configure.ac
26 cat > Makefile.am <<'END'
29 am__backslash = \\ # foo
32 @printf '%s\n' $(am__backslash)
35 cat > foo.test <<'END'
41 am__SHELL=$SHELL; export am__SHELL
42 am__PERL=$PERL; export am__PERL
44 cat > my-shell <<'END'
51 am__shell_command=; unset am__shell_command
52 while test $# -gt 0; do
54 # If the shell is invoked by make e.g. as "sh -ec" (seen on
55 # GNU make in POSIX mode) or "sh -ce" (seen on Solaris make).
57 flg=`echo x"$1" | sed -e 's/^x-//' -e 's/c//g'`
58 if test x"$flg" != x; then
59 am__shell_flags="$am__shell_flags -$flg"
65 am__shell_flags="$am__shell_flags $1"
73 if test x${am__shell_command+"set"} != x"set"; then
74 # Some make implementations, like *BSD's, pass the recipes to the shell
75 # through its standard input. Trying to run our extra checks in this
76 # case would be too tricky, so we just skip them.
77 exec $am__SHELL $am__shell_flags ${1+"$@"}
79 am__tweaked_shell_command=`printf '%s\n' "$am__shell_command" \
81 case ${am__tweaked_shell_command-} in
83 echo "my-shell: recipe ends with backslash character" >&2
84 printf '%s\n' "=== BEGIN recipe" >&2
85 printf '%s\n' "${am__shell_command-}" >&2
86 printf '%s\n' "=== END recipe" >&2
90 exec $am__SHELL $am__shell_flags -c "$am__shell_command" ${1+"$@"}
97 CONFIG_SHELL=$(pwd)/my-shell; export CONFIG_SHELL
103 ./configure CONFIG_SHELL="$CONFIG_SHELL"
106 $MAKE bad-recipe 2>stderr && st=1
108 $FGREP "my-shell: recipe ends with backslash character" stderr || st=1
109 test $st -eq 0 || skip_ "can't catch trailing backslashes in make recipes"