Support more C++ file extensions for MSVC in the compile script.
[platform/upstream/automake.git] / tests / depcomp7.test
1 #! /bin/sh
2 # Copyright (C) 2006, 2007  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 # Check dependency generation (libtool case).
18
19 required='libtoolize'
20 . ./defs || Exit 1
21
22 set -e
23
24 cat >> configure.in << 'END'
25 AC_PROG_CC
26 AM_PROG_CC_C_O
27 AM_PROG_LIBTOOL
28 AC_CONFIG_FILES(sub2/Makefile)
29 AC_OUTPUT
30 END
31
32 mkdir sub sub2 sub2/sub3
33
34 cat >Makefile.am <<'END'
35 SUBDIRS = sub2
36 bin_PROGRAMS = foo
37 foo_SOURCES = foo.c sub/bar.c foo.h sub/bar.h
38 foo_LDADD = sub2/libbaz.la
39 END
40
41 cat >sub2/Makefile.am <<'END'
42 AUTOMAKE_OPTIONS = subdir-objects
43 noinst_LTLIBRARIES = libbaz.la
44 libbaz_la_SOURCES = baz.c sub3/ba3.c baz.h sub3/ba3.h
45 END
46
47 cat >foo.c <<'END'
48 #include "foo.h"
49 #include "sub2/baz.h"
50 #include <stdlib.h>
51 int main() { printf("foo"); return bar() + baz(); }
52 END
53
54 cat >foo.h <<'END'
55 #include <stdio.h>
56 #include "sub/bar.h"
57 END
58
59 cat >sub/bar.c <<'END'
60 #include "sub/bar.h"
61 int bar() { return 0; }
62 END
63
64 echo 'extern int x;' > sub2/sub3/ba3.h
65
66 cat >sub/bar.h <<'END'
67 #include <stdio.h>
68 extern int bar();
69 END
70
71 cat >sub2/baz.c <<'END'
72 #include "baz.h"
73 int baz() { return 0; }
74 END
75
76 cat >sub2/baz.h <<'END'
77 extern int baz();
78 END
79
80 cat >sub2/sub3/ba3.c <<'END'
81 #include "ba3.h"
82 int ba3() { return 0; }
83 END
84
85 libtoolize
86 $ACLOCAL
87 $AUTOCONF
88 $AUTOMAKE -a
89
90 for staticshared in --disable-shared "" --disable-static; do
91   ./configure --enable-dependency-tracking $staticshared
92   $MAKE 
93
94   # check that dependency tracking works
95   if grep 'depmode=none' Makefile; then :
96   else
97     cd sub2
98     $sleep
99     echo 'choke me' > sub3/ba3.h
100     if $MAKE; then Exit 1; fi
101     cd ..
102   fi
103
104   $MAKE distclean
105   test ! -f sub2/sub3/ba3.u
106   test ! -f sub2/sub3/ba3.d
107
108   echo 'extern int x;' > sub2/sub3/ba3.h
109 done