test harness: improve catching of usage errors in script 'test-driver'
[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 AC_OUTPUT
28 END
29
30 cat > Makefile.am << 'END'
31 bin_PROGRAMS = zardoz
32 zardoz_SOURCES = foo.c sub/bar.c
33 END
34
35 mkdir sub
36 cat > foo.c << 'END'
37 int main (void)
38 {
39   extern int bar (void);
40   return bar ();
41 }
42 END
43 cat > sub/bar.c << 'END'
44 int bar (void)
45 {
46   return 0;
47 }
48 END
49
50 $ACLOCAL
51 # FIXME: stop disabling the warnings in the 'unsupported' category
52 # FIXME: once the 'subdir-objects' option has been mandatory.
53 $AUTOMAKE -a -Wno-unsupported
54 grep include Makefile.in # For debugging.
55 grep 'include.*\./\$(DEPDIR)/foo\.P' Makefile.in
56 grep 'include.*\./\$(DEPDIR)/bar\.P' Makefile.in
57 grep 'include.*/\./\$(DEPDIR)' Makefile.in && exit 1
58
59 $AUTOCONF
60 # Don't reject slower dependency extractors, for better coverage.
61 ./configure --enable-dependency-tracking
62 $MAKE
63 cross_compiling || ./zardoz
64 DISTCHECK_CONFIGURE_FLAGS='--enable-dependency-tracking' $MAKE distcheck
65
66 # Try again with subdir-objects option.
67
68 echo AUTOMAKE_OPTIONS = subdir-objects >> Makefile.am
69
70 $AUTOMAKE
71 grep include Makefile.in # For debugging.
72 grep 'include.*\./\$(DEPDIR)/foo\.P' Makefile.in
73 grep 'include.*[^a-zA-Z0-9_/]sub/\$(DEPDIR)/bar\.P' Makefile.in
74 $EGREP 'include.*/(\.|sub)/\$\(DEPDIR\)' Makefile.in && exit 1
75
76 $AUTOCONF
77 # Don't reject slower dependency extractors, for better coverage.
78 ./configure --enable-dependency-tracking
79 $MAKE
80 cross_compiling || ./zardoz
81 DISTCHECK_CONFIGURE_FLAGS='--enable-dependency-tracking' $MAKE distcheck
82
83 :