tests: avoid a spurious failure on MSYS
[platform/upstream/automake.git] / t / remake-renamed-m4-macro.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 the name of an m4 macro change.  Try both with
18 # and without indirection.
19
20 . test-init.sh
21
22 cat >> configure.ac <<'END'
23 MY_MACRO
24 AC_OUTPUT
25 END
26
27 cat > Makefile.am <<'END'
28 ACLOCAL_AMFLAGS = -I m4
29 .PHONY: test
30 test:
31         test '$(the_answer)' -eq 42
32 END
33
34 mkdir m4
35
36 cat > m4/macros.m4 <<'END'
37 AC_DEFUN([MY_MACRO], [FOO_1])
38 END
39
40 cat > m4/foo.m4 <<'END'
41 AC_DEFUN([FOO_1], [the_answer=42
42                    AC_SUBST([the_answer])])
43 END
44
45 $ACLOCAL -I m4
46 $AUTOCONF
47 $AUTOMAKE
48
49 ./configure
50 $MAKE test
51
52 $sleep
53
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
58
59 using_gmake || $MAKE Makefile
60 $MAKE test
61
62 $sleep
63
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
68
69 using_gmake || $MAKE Makefile
70 $MAKE test
71
72 :