2 # Copyright (C) 2011-2018 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)
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 an m4 file gets renamed and *simultaneously*
18 # an m4 macro in it gets renamed. Kudos to Bruno Haible for thinking
19 # about this situation. See also related test 'aclocal-deleted-header.sh'.
23 cat >> configure.ac
<<'END'
28 cat > Makefile.am
<<'END'
29 ACLOCAL_AMFLAGS = -I m4
32 test '$(the_answer)' -eq 42
37 cat > m
4/macros.
m4 <<'END'
38 AC_DEFUN([MY_MACRO], [FOO_MACRO])
41 cat > m
4/foo.
m4 <<'END'
42 AC_DEFUN([FOO_MACRO], [the_answer=42; AC_SUBST([the_answer])])
52 # Rename only one file and one macro.
55 sed -e 's/FOO_MACRO/BAR_MACRO/' m
4/foo.
m4 > m
4/bar.
m4
57 sed -e 's/FOO_MACRO/BAR_MACRO/' m
4/macros.
m4 > t
59 using_gmake ||
$MAKE Makefile
62 ls -l $distdir $distdir/*
63 test -f $distdir/m
4/bar.
m4
64 test -f $distdir/m
4/macros.
m4
65 test ! -e $distdir/m
4/foo.
m4
67 # Rename both at once.
70 sed -e 's/BAR_MACRO/QUUX_MACRO/' \
71 m
4/bar.
m4 > m
4/quux.
m4
72 sed -e 's/BAR_MACRO/QUUX_MACRO/' -e 's/MY_MACRO/A_MACRO/' \
73 m
4/macros.
m4 > m
4/defs.
m4
74 rm -f m
4/macros.
m4 m
4/bar.
m4
75 sed -e 's/BAR_MACRO/QUUX_MACRO/' -e 's/MY_MACRO/A_MACRO/' configure.ac
> t
77 using_gmake ||
$MAKE Makefile
80 ls -l $distdir $distdir/*
81 test -f $distdir/m
4/quux.
m4
82 test -f $distdir/m
4/defs.
m4
83 test ! -e $distdir/m
4/bar.
m4
84 test ! -e $distdir/m
4/macros.
m4