am-ft: make the environment available earlier
[platform/upstream/automake.git] / t / remake-renamed-m4-file.sh
1 #! /bin/sh
2 # Copyright (C) 2011-2013 Free Software Foundation, Inc.
3 #
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.
8 #
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.
13 #
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/>.
16
17 # Test remake rules when m4 files get renamed.
18
19 . test-init.sh
20
21 cat >> configure.ac <<'END'
22 MY_MACRO
23 AC_OUTPUT
24 END
25
26 cat > Makefile.am <<'END'
27 ACLOCAL_AMFLAGS = -I m4
28 .PHONY: test
29 test:
30         test '$(the_answer)' -eq 42
31 END
32
33 mkdir m4
34
35 cat > m4/macros.m4 <<'END'
36 AC_DEFUN([MY_MACRO], [FOO])
37 END
38
39 cat > m4/foo.m4 <<'END'
40 AC_DEFUN([FOO], [the_answer=42; AC_SUBST([the_answer])])
41 END
42
43 $ACLOCAL -I m4
44 $AUTOCONF
45 $AUTOMAKE
46
47 ./configure
48 $MAKE test
49
50 # Rename one file at the time.
51
52 mv m4/foo.m4 m4/bar.m4
53 using_gmake || $MAKE Makefile
54 $MAKE test
55 $MAKE distdir
56 ls -l $distdir $distdir/*
57 test -f $distdir/m4/bar.m4
58 test ! -e $distdir/m4/foo.m4
59
60 mv m4/macros.m4 m4/defs.m4
61 using_gmake || $MAKE Makefile
62 $MAKE test
63 $MAKE distdir
64 ls -l $distdir $distdir/*
65 test -f $distdir/m4/defs.m4
66 test ! -e $distdir/m4/macros.m4
67
68 # Rename both files at once.
69
70 mv m4/bar.m4 m4/quux.m4
71 mv m4/defs.m4 acinclude.m4
72 using_gmake || $MAKE Makefile
73 $MAKE test
74 $MAKE distdir
75 ls -l $distdir $distdir/*
76 test -f $distdir/m4/quux.m4
77 test -f $distdir/acinclude.m4
78 test ! -e $distdir/m4/foo.m4
79 test ! -e $distdir/m4/bar.m4
80 test ! -e $distdir/m4/macros.m4
81 test ! -e $distdir/m4/defs.m4
82
83 :