Revert Automake license to GPLv2+.
[platform/upstream/automake.git] / tests / pr307.test
1 #! /bin/sh
2 # Copyright (C) 2002, 2004  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 for PR 307: depcomp with depmode=dashmstdout libtool race condition
18 # Report from Laurent Morichetti.
19 # (Also exercises check_LTLIBRARIES.)
20
21 required='libtoolize gcc'
22 . ./defs || Exit 1
23
24 cat >> configure.in << 'END'
25 AC_PROG_CC
26 AC_PROG_LIBTOOL
27 AC_OUTPUT
28 END
29
30 cat > Makefile.am << 'END'
31 check_LTLIBRARIES = librace.la
32 librace_la_SOURCES = a.c b.c c.c d.c e.c f.c g.c h.c
33
34 # Make sure the dependencies are updated.
35 check-local:
36         for i in $(librace_la_SOURCES:.c=.Plo); do \
37           echo checking ./$(DEPDIR)/$$i; \
38           grep foo.h ./$(DEPDIR)/$$i >tst || exit 1; \
39           test `wc -l <tst` -eq 2 || exit 1; \
40         done
41 END
42
43 : >foo.h
44
45 for i in a b c d e f g h; do
46   cat >$i.c <<EOF
47 #include "foo.h"
48 int $i() { return 0; }
49 EOF
50 done
51
52 set -e
53
54 libtoolize --force
55 $ACLOCAL
56 $AUTOCONF
57 $AUTOMAKE -a
58
59 # Sanity check: make sure the variable we are attempting to force
60 # is used by configure
61 grep am_cv_CC_dependencies_compiler_type configure
62
63 ./configure am_cv_CC_dependencies_compiler_type=dashmstdout
64 $MAKE
65 test -f librace.la && Exit 1
66 $MAKE check
67
68 # The failure we check usually occurs during the above build,
69 # with an output such as
70 #
71 # mv -f .libs/f.lo f.lo
72 # mv: cannot stat `.libs/f.lo': No such file or directory
73 #
74 # (This may happen on `f' or on some other files.)
75
76 test -f librace.la
77 test -f tst # a proof that check-local was run