Merge branch 'msvc' into maint
[platform/upstream/automake.git] / tests / depcomp10.test
1 #! /bin/sh
2 # Copyright (C) 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 # hp depmode should work with GNU make in VPATH mode (bug similar to
18 # depcomp9.test).
19 # For automake bug#8473.
20
21 # Here's the bug: hp depmode will prefix VPATH to the object file name,
22 # thus the second gmake will invoke depcomp with object='../../src/foo.o',
23 # causing errors such as (broken on multiple lines for clarity):
24 #   cpp: "", line 0: error 4066: Cannot create
25 #        "../../gllib/.deps/nonblocking.TPo" file for
26 #        "-M../../gllib/.deps/nonblocking.TPo" option.
27 #        (No such file or directory[errno=2])
28
29 required=GNUmake
30 . ./defs || Exit 1
31
32 mkdir src src/sub build
33
34 cat >> configure.in << 'END'
35 AC_PROG_CC
36 AM_PROG_CC_C_O
37 AC_CONFIG_FILES([src/Makefile])
38 AC_OUTPUT
39 END
40
41 cat > Makefile.am << 'END'
42 SUBDIRS = src
43 END
44
45 cat > src/Makefile.am << 'END'
46 AUTOMAKE_OPTIONS = subdir-objects
47 bin_PROGRAMS = foo
48 foo_SOURCES = foo.c foo.h sub/subfoo.c
49 END
50
51 cat > src/foo.h <<EOF
52 extern int subfoo (void);
53 EOF
54
55 cat >src/foo.c <<EOF
56 #include "foo.h"
57 int main (void)
58 {
59   return subfoo ();
60 }
61 EOF
62
63 cat >src/sub/subfoo.c <<EOF
64 #include "foo.h"
65 int subfoo (void)
66 {
67   return 0;
68 }
69 EOF
70
71 $ACLOCAL
72 $AUTOCONF
73 $AUTOMAKE -a
74
75 cd build
76 ../configure am_cv_CC_dependencies_compiler_type=hp
77 # Do not error out with the first make, as the forced 'hp' depmode might
78 # not actually work, but we have overridden the _AM_DEPENDENCIES tests.
79 $MAKE || Exit 77
80
81 # We must clean and rebuild, as the actual error only happens the second
82 # time the objects are built because 'depcomp' has silently messed up the
83 # .Po files the first time.
84 $MAKE clean
85
86 $MAKE >out 2>&1 || { cat out; Exit 1; }
87 cat out
88 grep 'src/[._]deps' out && Exit 1
89
90 :