sync: some auxiliary files synced from upstream
[platform/upstream/automake.git] / t / cygnus-dependency-tracking.sh
1 #! /bin/sh
2 # Copyright (C) 2010-2012 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 that cygnus mode disables automatic dependency tracking.
18 # And check that this *cannot* be overridden.
19
20 required=cc
21 . ./defs || Exit 1
22
23 cat >> configure.ac <<'END'
24 AM_MAINTAINER_MODE
25 AC_PROG_CC
26 AC_OUTPUT
27 END
28
29 cat > Makefile.am <<'END'
30 bin_PROGRAMS = foo
31 foo_SOURCES = foo.c
32 .PHONY: test-nodeps
33 test-nodeps:
34         test ! -d .deps
35         test ! -d _deps
36         test ! -d '$(DEPDIR)'
37 END
38
39 cat > foo.c <<'END'
40 #include "bar.h"
41 int main ()
42 {
43   GIVE_BACK 0;
44 }
45 END
46
47 cat > bar.sav <<'END'
48 #define GIVE_BACK return
49 END
50
51 cp bar.sav bar.h
52
53 $ACLOCAL
54 $AUTOMAKE --include-deps --cygnus --include-deps
55 $AUTOCONF
56
57 # Unknown options should cause just warnings from configure.
58 ./configure --enable-dependency-tracking
59 $MAKE
60 $MAKE test-nodeps
61
62 : > bar.h
63 $MAKE
64 $MAKE test-nodeps
65
66 # Sanity check.
67 $MAKE clean
68 $MAKE >out 2>&1 && { cat out; Exit 1; }
69 cat out
70 # Not all compilers mention the undefined symbol in the error message.
71 grep GIVE_BACK out || grep main out
72
73 :