Merge branch 'msvc' into maint
[platform/upstream/automake.git] / tests / subobj11b.test
1 #! /bin/sh
2 # Copyright (C) 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 that automake works around a bug of Solaris Make. The bug is the
18 # following.  If we have a Makefile containg a file inclusion like this:
19 #   include .//foo.mk
20 # Solaris make fails with a message like:
21 #   make: ... can't find `/foo.mk': No such file or directory
22 #   make: fatal error ... read of include file `/foo.mk' failed
23 # (even if the file `foo.mk' exists). The error disappear by collapsing
24 # the repeated slash `/' characters into a single one.
25 #
26 # See also "semantic" sister test `subobj11a.test', and related test
27 # `subobj11c.test'.
28
29 . ./defs || Exit 1
30
31 set -e
32
33 cat >> configure.in << 'END'
34 AC_PROG_CC
35 AM_PROG_CC_C_O
36 END
37
38 cat > Makefile.am << 'END'
39 AUTOMAKE_OPTIONS = subdir-objects
40 bin_PROGRAMS = foo
41 ## The `zardoz' sources should activate a code paths in Automake that
42 ## cannot be sensibly tested by sister test `subobj11a.test'.  The other
43 ## sources provide some sort of stress testing.
44 foo_SOURCES = \
45   //server/zardoz0.c \
46   //server//zardoz1.c \
47   //server/path/to/zardoz2.c \
48   //server/another//path///to////zardoz3.c \
49   /foobar0.c \
50   ///foobar1.c \
51   ////foobar2.c \
52   /sub///foobar3.c \
53   ///sub/foobar4.c \
54   .//foobar5.c \
55   .//sub/foobar6.c \
56   ./sub//foobar7.c \
57   .//sub//foobar8.c \
58   sub/sub//sub///sub////foobar9.c
59 END
60
61 $ACLOCAL
62 $AUTOMAKE -a
63
64 # Be lax in the regexp, to account for automake conditionals, the
65 # use of @am__include@, and similar stuff.
66 grep 'include.*//.*foobar' Makefile.in && Exit 1
67
68 # These checks depend on automake internals, but presently this is
69 # the only way to test the code path we are interested in.
70 # Please update these checks when (and if) the relevant automake
71 # internals are changed.
72 for x in zardoz0 zardoz1 path/to/zardoz2 another/path/to/zardoz3; do
73   case $x in
74    */*) d=`echo $x | sed 's,[^/]*$,,'`; b=`echo $x | sed 's,^.*/,,'`;;
75      *) d=''; b=$x;;
76   esac
77   # Be a little lax in the regexp, to account for automake conditionals,
78   # quoting, and similar stuff.
79   grep "^[^/]*am__include[^/]*//server/$d\\\$(DEPDIR)/$b\\.[^/]*$" Makefile.in
80 done
81
82 # Sanity checks.
83 for i in 0 1 2 3 4 5 6 7 8 9; do
84   grep "am__include.*/foobar$i\\." Makefile.in
85 done
86
87 :