Merge branch 'msvc'
[platform/upstream/automake.git] / tests / acloca18.test
1 #! /bin/sh
2 # Copyright (C) 2005, 2006, 2008, 2010 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 # Test for --install with #serial numbers.
18
19 . ./defs || Exit 1
20
21 set -e
22
23 cat >> configure.in << 'END'
24 AM_MACRO1
25 AM_MACRO2
26 END
27
28 mkdir 1 2 3 4 5 6
29
30 cat >1/m1.m4 <<EOF
31 #serial 1.8.1230.9
32 AC_DEFUN([AM_MACRO1], [echo macro11 >> foo])
33 AC_DEFUN([AM_MACRO2], [echo macro21 >> foo])
34 EOF
35
36 cat >2/m1.m4 <<EOF
37 #serial 1.8.1231.9
38 AC_DEFUN([AM_MACRO1], [echo macro12 >> foo])
39 EOF
40
41 cat >3/m2.m4 <<EOF
42 #serial 13
43 AC_DEFUN([AM_MACRO2], [echo macro23 >> foo])
44 EOF
45
46 cat >3/m1.m4 <<EOF
47 #serial 1.8.1230.1
48 AC_DEFUN([AM_MACRO1], [echo macro13 >> foo])
49 EOF
50
51 cat >4/mumble.m4 <<EOF
52 #serial 0
53 AC_DEFUN([AM_MACRO1], [echo macro14 >> foo])
54 EOF
55
56 cat >5/ill-formed.m4 <<EOF
57 #serial bla
58 #serial .2
59 #serial
60 AC_DEFUN([AM_MACRO1], [echo macro15 >> foo])
61 EOF
62
63 cat >6/after-def.m4 <<EOF
64 AC_DEFUN([AM_MACRO1], [echo macro16 >> foo])
65 #serial 1
66 EOF
67
68 ACLOCAL_TESTSUITE_FLAGS='-I 1 -I 2 -I 3 -I 4'
69
70 $ACLOCAL
71 $AUTOCONF
72 ./configure
73 grep macro11 foo
74 grep macro21 foo
75
76 rm -f foo
77 $ACLOCAL --install
78 $AUTOCONF
79 ./configure
80 grep macro12 foo
81 grep macro23 foo
82
83 ACLOCAL_TESTSUITE_FLAGS='-I 4 -I 1 -I 2 -I 3'
84 rm -f foo
85 $ACLOCAL --install --dry-run
86 $AUTOCONF
87 ./configure
88 grep macro12 foo
89 grep macro23 foo
90
91 rm -f foo
92 $ACLOCAL --install
93 $AUTOCONF
94 ./configure
95 grep macro14 foo
96 grep macro23 foo
97
98 ACLOCAL_TESTSUITE_FLAGS='-I 4 -I 1 -I 2'
99 rm -f foo
100 $ACLOCAL --install 2>stderr && { cat stderr >&2; Exit 1; }
101 cat stderr >&2
102 grep 'macro.*AM_MACRO2.*not found' stderr
103
104 ACLOCAL_TESTSUITE_FLAGS='-I 4 -I 1'
105 rm -f foo
106 $ACLOCAL --install
107 $AUTOCONF
108 ./configure
109 grep macro14 foo
110 grep macro21 foo
111
112
113 mkdir dirlist-test
114 cat >dirlist-test/m1.m4 <<EOF
115 #serial 456
116 AC_DEFUN([AM_MACRO1], [echo macro1d >> foo])
117 AC_DEFUN([AM_MACRO2], [echo macro2d >> foo])
118 EOF
119 rm -f foo
120 $ACLOCAL --diff=diff >stdout 2>stderr || {
121   cat stderr >&2
122   cat stdout
123   Exit 1
124 }
125 cat stderr >&2
126 cat stdout
127 grep '#serial 456' stdout
128 test ! -f 4/m1.m4
129 grep 'installing.*4/m1\.m4' stderr
130
131 $ACLOCAL -I 5 2>stderr && { cat stderr >&2; Exit 1; }
132 cat stderr >&2
133 test `grep -c 'ill-formed serial' stderr` -eq 3
134
135 $ACLOCAL -I 6 2>stderr && { cat stderr >&2; Exit 1; }
136 cat stderr >&2
137 grep 'serial.*before any macro definition' stderr
138
139 :