Merge branch 'msvc' into maint
[platform/upstream/automake.git] / tests / fn99subdir.test
1 #! /bin/sh
2 # Copyright (C) 2006, 2008, 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 # PR 507: Check the filename-length-max=99 option
18 # in conjunction with AC_CONFIG_SUBDIRS.
19
20 . ./defs || Exit 1
21
22 set -e
23
24 # The name is so that 99 is exactly hit (including final \0).
25 subdirname='cnfsubdir'
26
27 cat >>configure.in <<END
28 AC_CONFIG_SUBDIRS([${subdirname}])
29 AC_OUTPUT
30 END
31
32 cat >Makefile.am <<END
33 AUTOMAKE_OPTIONS = filename-length-max=99
34 SUBDIRS = ${subdirname}
35 END
36
37 mkdir ${subdirname} || Exit 1
38
39 cat >> ${subdirname}/configure.in <<EOF
40 AC_INIT([${subdirname}], [1.0])
41 AM_INIT_AUTOMAKE
42 AC_CONFIG_FILES([Makefile])
43 AC_OUTPUT
44 EOF
45
46 cat >${subdirname}/Makefile.am <<'END'
47 AUTOMAKE_OPTIONS = filename-length-max=99
48 EXTRA_DIST = 12345678
49 END
50
51 (cd ${subdirname}; for i in 1 2 3 4 5 6 7 8
52 do
53   mkdir -p 12345678 || Exit 77
54   cd 12345678
55   touch x
56 done)
57
58 # AIX 5.3 `cp -R' is too buggy for `make dist'.
59 cp -R ${subdirname} t || Exit 77
60
61 for init_dir in ${subdirname} .; do
62         (
63                 cd ${init_dir} || Exit 1
64                 $ACLOCAL
65                 $AUTOCONF
66                 $AUTOMAKE
67         ) || Exit 1
68 done
69 ./configure
70 $MAKE distcheck
71
72 (cd ${subdirname}; for i in 1 2 3 4 5 6 7 8 9
73 do
74   mkdir -p 12345678 || Exit 77
75   cd 12345678
76   touch x
77 done)
78
79 $MAKE dist 2>stderr && { cat stderr >&2; Exit 1; }
80 cat stderr >&2
81 grep 'filenames are too long' stderr
82 test 1 = `grep 12345678 stderr | wc -l`
83 :