Merge branch 'fix-pr14560' into micro
[platform/upstream/automake.git] / t / depcomp8a.sh
1 #! /bin/sh
2 # Copyright (C) 2010-2013 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.sh', which checks the
20 # same thing for libtool objects.
21
22 required=cc
23 . test-init.sh
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 (void);
41   return bar ();
42 }
43 END
44 cat > sub/bar.c << 'END'
45 int bar (void)
46 {
47   return 0;
48 }
49 END
50
51 $ACLOCAL
52 $AUTOMAKE -a
53 grep include Makefile.in # For debugging.
54 grep 'include.*\./\$(DEPDIR)/foo\.P' Makefile.in
55 grep 'include.*\./\$(DEPDIR)/bar\.P' Makefile.in
56 grep 'include.*/\./\$(DEPDIR)' Makefile.in && exit 1
57
58 $AUTOCONF
59 # Don't reject slower dependency extractors, for better coverage.
60 ./configure --enable-dependency-tracking
61 $MAKE
62 cross_compiling || ./zardoz
63 DISTCHECK_CONFIGURE_FLAGS='--enable-dependency-tracking' $MAKE distcheck
64
65 # Try again with subdir-objects option.
66
67 sed 's/#x //' configure.ac >configure.tmp
68 mv -f configure.tmp configure.ac
69 echo AUTOMAKE_OPTIONS = subdir-objects >> Makefile.am
70
71 $ACLOCAL
72 $AUTOMAKE -a
73 grep include Makefile.in # For debugging.
74 grep 'include.*\./\$(DEPDIR)/foo\.P' Makefile.in
75 grep 'include.*[^a-zA-Z0-9_/]sub/\$(DEPDIR)/bar\.P' Makefile.in
76 $EGREP 'include.*/(\.|sub)/\$\(DEPDIR\)' Makefile.in && exit 1
77
78 $AUTOCONF
79 # Don't reject slower dependency extractors, for better coverage.
80 ./configure --enable-dependency-tracking
81 $MAKE
82 cross_compiling || ./zardoz
83 DISTCHECK_CONFIGURE_FLAGS='--enable-dependency-tracking' $MAKE distcheck
84
85 :