maint: Document how to handle assignment exemption
[automake.git] / t / remake-moved-m4-file.sh
blob629efa0c420e3869b70efe9782a9fc7b384914d9
1 #! /bin/sh
2 # Copyright (C) 2011-2017 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 # Test remake rules when m4 files get moved among different "include
18 # dirs" (i.e. those passed to aclocal with '-I' option).
20 . test-init.sh
22 cat >> configure.ac <<'END'
23 MY_MACRO
24 AC_OUTPUT
25 END
27 cat > Makefile.am <<'END'
28 ACLOCAL_AMFLAGS = -I d1 -I d2 -I d3
29 .PHONY: test
30 test:
31 test '$(the_answer)' -eq 42
32 END
34 mkdir d1 d2 d3
36 cat > d1/macros.m4 <<'END'
37 AC_DEFUN([MY_MACRO], [FOO])
38 END
40 cat > d1/foo.m4 <<'END'
41 AC_DEFUN([FOO], [the_answer=42; AC_SUBST([the_answer])])
42 END
44 $ACLOCAL -I d1
45 $AUTOCONF
46 $AUTOMAKE
48 ./configure
49 $MAKE test
51 # Move one file.
52 mv d1/foo.m4 d2/foo.m4
53 using_gmake || $MAKE Makefile
54 $MAKE test
55 $MAKE distdir
56 ls -l $distdir $distdir/*
57 test -f $distdir/d2/foo.m4
58 test ! -e $distdir/d1/foo.m4
59 test -f $distdir/d1/macros.m4
60 test ! -e $distdir/d2/macros.m4
62 # Move both files at once.
63 mv d1/macros.m4 d3/macros.m4
64 mv d2/foo.m4 d3/foo.m4
65 using_gmake || $MAKE Makefile
66 $MAKE test
67 $MAKE distdir
68 ls -l $distdir $distdir/*
69 test -f $distdir/d3/foo.m4
70 test -f $distdir/d3/macros.m4
71 test ! -e $distdir/d1/foo.m4
72 test ! -e $distdir/d2/foo.m4
73 test ! -e $distdir/d1/macros.m4
74 test ! -e $distdir/d2/macros.m4