Merge branch 'msvc' into maint
[platform/upstream/automake.git] / tests / subobj11a.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 sister "grepping" test `subobj11b.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 AC_OUTPUT
37 END
38
39 cat > Makefile.am << 'END'
40 AUTOMAKE_OPTIONS = subdir-objects
41 bin_PROGRAMS = foo
42 ## the `.//' is meant
43 foo_SOURCES = .//src/foo.c
44 END
45
46 mkdir src
47
48 cat > src/foo.c << 'END'
49 int main(void)
50 {
51   return 0;
52 }
53 END
54
55 $ACLOCAL
56 $AUTOCONF
57 $AUTOMAKE -a
58
59 ./configure --enable-dependency-tracking
60
61 depdir=`sed -n 's/^ *DEPDIR *= *//p' Makefile`
62 if test x"$depdir" != x; then
63   depdir=src/$depdir
64 else
65   echo "$me: cannot extract value of DEPDIR from Makefile" >&2
66   Exit 1
67 fi
68
69 ls -l "$depdir"
70 test -f "$depdir"/foo.Po
71
72 echo 'quux:; echo "z@rd@z" >$@' >> "$depdir"/foo.Po
73
74 $MAKE quux
75 $FGREP "z@rd@z" quux
76
77 $MAKE
78
79 DISTCHECK_CONFIGURE_FLAGS='--enable-dependency-tracking' $MAKE distcheck
80 DISTCHECK_CONFIGURE_FLAGS='--disable-dependency-tracking' $MAKE distcheck
81
82 :