doc: typos in test file.
[automake.git] / t / remake-renamed-m4-macro.sh
blob367637c3882d819a3b95e03b0cf33273d03924fc
1 #! /bin/sh
2 # Copyright (C) 2011-2024 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 <https://www.gnu.org/licenses/>.
17 # Test remake rules when the name of an m4 macro change. Try both with
18 # and without indirection.
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 m4
29 .PHONY: test
30 test:
31 test '$(the_answer)' -eq 42
32 END
34 mkdir m4
36 cat > m4/macros.m4 <<'END'
37 AC_DEFUN([MY_MACRO], [FOO_1])
38 END
40 cat > m4/foo.m4 <<'END'
41 AC_DEFUN([FOO_1], [the_answer=42
42 AC_SUBST([the_answer])])
43 END
45 $ACLOCAL -I m4
46 $AUTOCONF
47 $AUTOMAKE
49 ./configure
50 $MAKE test
52 $sleep
54 for x in macros foo; do
55 sed -e 's/FOO_1/FOO_2/' m4/$x.m4 > t
56 mv -f t m4/$x.m4
57 done
59 using_gmake || $MAKE Makefile
60 $MAKE test
62 $sleep
64 for f in m4/macros.m4 configure.ac; do
65 sed -e 's/MY_MACRO/YOUR_MACRO/' $f > t
66 mv -f t $f
67 done
69 using_gmake || $MAKE Makefile
70 $MAKE test