Merge branch 'master' into test-protocols
[platform/upstream/automake.git] / tests / aclocal7.test
1 #! /bin/sh
2 # Copyright (C) 2003, 2006, 2011 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 # Make sure aclocal does not overwrite aclocal.m4 needlessly.
18 # Also make sure automake --no-force does not overwrite Makefile.in needlessly.
19
20 . ./defs || Exit 1
21
22 cat >> configure.in << 'END'
23 SOME_DEFS
24 AC_CONFIG_FILES([sub/Makefile])
25 END
26
27 mkdir sub
28 : > sub/Makefile.am
29
30 cat >> Makefile.am << 'END'
31 SUBDIRS = sub
32 include fragment.inc
33 END
34
35 : > fragment.inc
36
37 mkdir m4
38 echo 'AC_DEFUN([SOME_DEFS], [])' > m4/somedefs.m4
39
40 $sleep
41
42 $ACLOCAL -I m4
43
44 # Automake will take aclocal.m4 to be newer if it has the same timestamp
45 # as Makefile.in.  Avoid the confusing by sleeping.
46 $sleep
47
48 $AUTOMAKE --no-force
49
50 $sleep
51
52 touch foo
53 $ACLOCAL -I m4
54 $AUTOMAKE --no-force
55
56 # aclocal.m4 and Makefile.in should not have been updated, so `foo'
57 # should be younger
58 test `ls -1t aclocal.m4 Makefile.in sub/Makefile.in foo | sed 1q` = foo
59
60 $sleep
61 $ACLOCAL -I m4 --force
62 test `ls -1t aclocal.m4 foo | sed 1q` = aclocal.m4
63 # We still use --no-force for automake, but since aclocal.m4 has
64 # changed all Makefile.ins should be updated.
65 $sleep
66 $AUTOMAKE --no-force
67 test `ls -1t Makefile.in foo | sed 1q` = Makefile.in
68 test `ls -1t sub/Makefile.in foo | sed 1q` = sub/Makefile.in
69
70 touch m4/somedefs.m4
71 $sleep
72 touch foo
73 $sleep
74 $ACLOCAL -I m4
75 $sleep
76 $AUTOMAKE --no-force
77
78 # aclocal.m4 should have been updated, although its contents haven't changed.
79 test `ls -1t aclocal.m4 foo | sed 1q` = aclocal.m4
80 test `ls -1t Makefile.in foo | sed 1q` = Makefile.in
81 test `ls -1t sub/Makefile.in foo | sed 1q` = sub/Makefile.in
82
83 touch fragment.inc
84 $sleep
85 touch foo
86 $sleep
87 $ACLOCAL -I m4
88 $AUTOMAKE --no-force
89 # Only ./Makefile.in should change.
90 test `ls -1t aclocal.m4 foo | sed 1q` = foo
91 test `ls -1t Makefile.in foo | sed 1q` = Makefile.in
92 test `ls -1t sub/Makefile.in foo | sed 1q` = foo
93
94 grep README Makefile.in && Exit 1
95
96 : > README
97 $sleep
98 touch foo
99 $sleep
100 $AUTOMAKE --no-force
101 # Even if no dependency change, the content changed.
102 test `ls -1t Makefile.in foo | sed 1q` = Makefile.in
103 test `ls -1t sub/Makefile.in foo | sed 1q` = foo
104
105 grep README Makefile.in
106
107 : > sub/Makefile.in
108 $sleep
109 touch foo
110 $sleep
111 $ACLOCAL -I m4
112 $AUTOMAKE --no-force
113 # Only sub/Makefile.in should change.
114 test `ls -1t aclocal.m4 foo | sed 1q` = foo
115 test `ls -1t Makefile.in foo | sed 1q` = foo
116 test `ls -1t sub/Makefile.in foo | sed 1q` = sub/Makefile.in