sync: update files from upstream with "make fetch"
[automake.git] / t / aclocal7.sh
blobc050b07d1f1859691e14d9fae6bf3a940b905809
1 #! /bin/sh
2 # Copyright (C) 2003-2012 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 # Make sure aclocal does not overwrite aclocal.m4 needlessly.
18 # Also make sure automake --no-force does not overwrite Makefile.in needlessly.
20 . ./defs || exit 1
22 cat >> configure.ac << 'END'
23 SOME_DEFS
24 AC_CONFIG_FILES([sub/Makefile])
25 END
27 mkdir sub
28 : > sub/Makefile.am
30 cat >> Makefile.am << 'END'
31 SUBDIRS = sub
32 include fragment.inc
33 END
35 : > fragment.inc
37 mkdir m4
38 echo 'AC_DEFUN([SOME_DEFS], [])' > m4/somedefs.m4
40 # Automake will take aclocal.m4 to be newer if it has the same timestamp
41 # as Makefile.in. Avoid the confusing by sleeping.
42 AUTOMAKE_after_aclocal ()
44 $sleep
45 $AUTOMAKE --no-force
48 # aclocal will rewrite aclocal.m4 unless the input files are all older than the
49 # existing aclocal.m4 -- sleep to ensure somedefs.m4 has an older timestamp
50 # than the aclocal.m4 that the next aclocal call will generate.
51 $sleep
53 $ACLOCAL -I m4
54 AUTOMAKE_after_aclocal
56 touch foo
57 $sleep
58 $ACLOCAL -I m4
59 AUTOMAKE_after_aclocal
60 # aclocal.m4 and Makefile.in should not have been updated, so 'foo'
61 # should be younger
62 is_newest foo aclocal.m4 Makefile.in sub/Makefile.in
64 $sleep
65 $ACLOCAL -I m4 --force
66 is_newest aclocal.m4 foo
67 # We still use --no-force for automake, but since aclocal.m4 has
68 # changed all Makefile.ins should be updated.
69 AUTOMAKE_after_aclocal
70 is_newest Makefile.in aclocal.m4 foo
71 is_newest sub/Makefile.in aclocal.m4 foo
73 $sleep
74 touch m4/somedefs.m4
75 $sleep
76 $ACLOCAL -I m4
77 AUTOMAKE_after_aclocal
78 # aclocal.m4 should have been updated, although its contents haven't
79 # changed.
80 is_newest aclocal.m4 m4/somedefs.m4
81 is_newest Makefile.in m4/somedefs.m4
82 is_newest sub/Makefile.in m4/somedefs.m4
84 $sleep
85 touch fragment.inc
86 $sleep
87 $ACLOCAL -I m4
88 AUTOMAKE_after_aclocal
89 # Only ./Makefile.in should change.
90 is_newest Makefile.in fragment.inc
91 is_newest fragment.inc aclocal.m4
92 is_newest fragment.inc sub/Makefile.in
94 grep README Makefile.in && exit 1
96 $sleep
97 : > README
98 $sleep
99 $AUTOMAKE --no-force
100 # Even if no dependency change, the content changed.
101 is_newest Makefile.in README
102 is_newest README sub/Makefile.in
104 grep README Makefile.in
106 : > sub/Makefile.in
107 $sleep
108 touch foo
109 $sleep
110 $ACLOCAL -I m4
111 $AUTOMAKE --no-force
112 # Only sub/Makefile.in should change.
113 is_newest foo aclocal.m4
114 is_newest foo Makefile.in
115 is_newest sub/Makefile.in foo