Revert Automake license to GPLv2+.
[automake.git] / tests / aclocal7.test
blobe123a3fd871c7c2bf11a686513ce649fee222e5b
1 #! /bin/sh
2 # Copyright (C) 2003, 2006 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 set -e
24 cat >> configure.in << 'END'
25 SOME_DEFS
26 AC_CONFIG_FILES([sub/Makefile])
27 END
29 mkdir sub
30 : > sub/Makefile.am
32 cat >> Makefile.am << 'END'
33 SUBDIRS = sub
34 include fragment.inc
35 END
37 : > fragment.inc
39 mkdir m4
40 echo 'AC_DEFUN([SOME_DEFS], [])' > m4/somedefs.m4
42 $sleep
44 $ACLOCAL -I m4
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
50 $AUTOMAKE --no-force
52 $sleep
54 touch foo
55 $ACLOCAL -I m4
56 $AUTOMAKE --no-force
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
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
72 touch m4/somedefs.m4
73 $sleep
74 touch foo
75 $sleep
76 $ACLOCAL -I m4
77 $sleep
78 $AUTOMAKE --no-force
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
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
96 grep README Makefile.in && Exit 1
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
107 grep README Makefile.in
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