2 # Copyright (C) 2003-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 # If the last line of a automake-rewritten definition is made only of
18 # @substitutions@, automake should take care of appending an empty
19 # variable to make sure that line cannot end up substituted as a blank
20 # line (that would confuse HP-UX Make).
21 # These checks have been introduced in commit 'Release-1-9-254-g9d0eaef'
22 # into the former test 'subst2.test'.
26 # These are deliberately quite long, so that the xxx_PROGRAMS definition
27 # in Makefile.am below will be split on multiple lines, with the last
28 # line containing only @substituted@ stuff that expands to empty (this is
29 # required to expose the bug we are testing).
30 v1=ABCDEFGHIJKLMNOPQRSTUVWX
31 v2=ABCDEFGHIJKLMNOPQRSTUVWXY
32 v3=ABCDEFGHIJKLMNOPQRSTUVWXYZ
34 # Literal backslash for use by grep.
37 cat >> configure.ac <<END
45 cat >Makefile.am <<END
46 AUTOMAKE_OPTIONS = no-dependencies
50 ## The "x" and "zardoz" strings and the use of '+=' are there to ensure
51 ## that these variables get rewritten by Automake.
52 noinst_PROGRAMS = x @$v1@ @$v2@ @$v3@
54 bin_PROGRAMS += @$v1@ @$v2@ @$v3@
55 check_PROGRAMS = zardoz \$(noinst_PROGRAMS)
57 ## Required whenever there are @substituted@ values in the
58 ## PROGRAMS primary, otherwise automake will complain.
62 @echo BEG1: \$(noinst_PROGRAMS) :END1
63 @echo BEG2: \$(bin_PROGRAMS) :END2
64 @echo BEG3: \$(check_PROGRAMS) :END3
71 $EGREP -n 'ABCD|am__empty' Makefile.in
73 test $($EGREP -c "^[ $tab]*@$v2@ @$v3@[ $tab]*$bs?$" Makefile.in) -eq 3
77 sed -n '/^noinst_PROGRAMS *=/,/[^\\]$/p' Makefile
78 sed -n '/^bin_PROGRAMS *=/,/[^\\]$/p' Makefile
79 sed -n '/^check_PROGRAMS *=/,/[^\\]$/p' Makefile
80 sed -n '/^am__EXEEXT.*=/,/[^\\]$/p' Makefile
83 grep '^ *$' t-programs && Exit 1
85 $MAKE print-programs >stdout || { cat stdout; Exit 1; }
87 grep '^BEG1: x :END1$' stdout
88 grep '^BEG2: :END2$' stdout
89 grep '^BEG3: zardoz x :END3$' stdout
91 am__empty=X $MAKE -e print-programs >stdout || { cat stdout; Exit 1; }
93 grep '^BEG1: x X :END1$' stdout
94 grep '^BEG2: X :END2$' stdout
95 grep '^BEG3: zardoz x X :END3$' stdout