tests: rename 'tests/' => 't/', '*.test' => '*.sh'
[platform/upstream/automake.git] / t / depcomp8a.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 # Test for regressions in computation of names of .Po files for
18 # automatic dependency tracking.
19 # Keep this in sync with sister test 'depcomp8b.test', which checks the
20 # same thing for libtool objects.
21
22 required=cc
23 . ./defs || Exit 1
24
25 cat >> configure.ac << 'END'
26 AC_PROG_CC
27 #x AM_PROG_CC_C_O
28 AC_OUTPUT
29 END
30
31 cat > Makefile.am << 'END'
32 bin_PROGRAMS = zardoz
33 zardoz_SOURCES = foo.c sub/bar.c
34 END
35
36 mkdir sub
37 cat > foo.c << 'END'
38 int main (void)
39 {
40   extern int bar;
41   return bar;
42 }
43 END
44 cat > sub/bar.c << 'END'
45 extern int bar = 0;
46 END
47
48 $ACLOCAL
49 $AUTOMAKE -a
50 grep include Makefile.in # For debugging.
51 grep 'include.*\./\$(DEPDIR)/foo\.P' Makefile.in
52 grep 'include.*\./\$(DEPDIR)/bar\.P' Makefile.in
53 grep 'include.*/\./\$(DEPDIR)' Makefile.in && Exit 1
54
55 $AUTOCONF
56 # Don't reject slower dependency extractors, for better coverage.
57 ./configure --enable-dependency-tracking
58 $MAKE
59 cross_compiling || ./zardoz
60 DISTCHECK_CONFIGURE_FLAGS='--enable-dependency-tracking' $MAKE distcheck
61
62 # Try again with subdir-objects option.
63
64 sed 's/#x //' configure.ac >configure.int
65 mv -f configure.int configure.ac
66 echo AUTOMAKE_OPTIONS = subdir-objects >> Makefile.am
67
68 $ACLOCAL
69 $AUTOMAKE -a
70 grep include Makefile.in # For debugging.
71 grep 'include.*\./\$(DEPDIR)/foo\.P' Makefile.in
72 grep 'include.*[^a-zA-Z0-9_/]sub/\$(DEPDIR)/bar\.P' Makefile.in
73 $EGREP 'include.*/(\.|sub)/\$\(DEPDIR\)' Makefile.in && Exit 1
74
75 $AUTOCONF
76 # Don't reject slower dependency extractors, for better coverage.
77 ./configure --enable-dependency-tracking
78 $MAKE
79 cross_compiling || ./zardoz
80 DISTCHECK_CONFIGURE_FLAGS='--enable-dependency-tracking' $MAKE distcheck
81
82 :