tests: never source test-defs.sh directly, source test-lib.sh instead
[automake.git] / t / colon2.sh
blobb59ad495f2dfe76a7b1d7b67f5bfbb150ae8b571
1 #! /bin/sh
2 # Copyright (C) 1996-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)
7 # any later version.
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 # Make sure ":" works with files automake generates.
18 # See also sister test 'colon3.test'.
20 . ./defs || exit 1
22 cat > configure.ac <<END
23 AC_INIT([$me], [1.0])
24 AM_INIT_AUTOMAKE
25 AC_CONFIG_FILES([Makefile:zardoz.in])
26 AC_OUTPUT
27 END
29 cat > zardoz.am <<END
30 .PHONY: dummy
31 dummy:
32 END
34 $ACLOCAL
35 $AUTOMAKE
37 # Automake should have created zardoz.in.
38 test -f zardoz.in
40 # The generated file should refer to zardoz.in and zardoz.am, but
41 # never just "zardoz".
42 $FGREP 'zardoz.am' zardoz.in
43 $FGREP 'zardoz.in' zardoz.in
44 sed -e 's|zardoz\.am|zrdz.am|g' \
45 -e 's|zardoz\.in|zrdz.in|g' \
46 <zardoz.in | $FGREP 'zardoz' && exit 1
48 # The configure-generated Makefile should depend on zardoz.in, two.in and
49 # three.in. The automake-generated zardoz.in should depend on zardoz.am.
50 # Let's do this check the right way by running configure and make.
52 str='%% ZaR DoZ %%'
54 $AUTOCONF
55 ./configure
56 test -f Makefile # Sanity check.
58 $MAKE dummy
59 # Again, make sure that the generated Makefile do not unduly
60 # refer to 'zardoz' .
61 $MAKE -n zardoz && exit 1
63 $sleep
64 cat >> zardoz.am <<END
65 check-local: testam testin testmk
66 .PHONY: testam testin testmk
67 testam:
68 grep '$str' \$(srcdir)/zardoz.am
69 testin:
70 grep '$str' \$(srcdir)/zardoz.in
71 testmk:
72 grep '$str' Makefile
73 END
74 $MAKE Makefile # For non-GNU make.
75 $MAKE testam testin testmk
77 $MAKE distcheck