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