tests: make 'lzip.test' executable
[automake.git] / tests / depcomp9.test
blob9972c3da81302c2a5589f1ccc350152c31917ea6
1 #! /bin/sh
2 # Copyright (C) 2011 Free Software Foundation, Inc.
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.
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.
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/>.
17 # makedepend should work in VPATH mode.
19 # Here's the bug: makedepend will prefix VPATH to the object file name,
20 # thus the second make will invoke depcomp with object='../../src/foo.o',
21 # causing errors such as:
22 # touch: cannot touch `../../src/.deps/foo.TPo': No such file or directory
23 # makedepend: error: cannot open "../../src/.deps/foo.TPo"
24 # ../../depcomp: line 560: ../../src/.deps/foo.TPo: No such file or directory
26 # We include subfoo only to be sure that we don't remove too much
27 # from the object file name.
29 required='makedepend'
30 . ./defs || Exit 1
32 mkdir src src/sub build
34 cat >> configure.in << 'END'
35 AC_PROG_CC
36 AM_PROG_CC_C_O
37 AC_CONFIG_FILES([src/Makefile])
38 AC_OUTPUT
39 END
41 cat > Makefile.am << 'END'
42 SUBDIRS = src
43 END
45 cat > src/Makefile.am << 'END'
46 AUTOMAKE_OPTIONS = subdir-objects
47 bin_PROGRAMS = foo
48 foo_SOURCES = foo.c foo.h sub/subfoo.c
49 END
51 cat > src/foo.h <<EOF
52 extern int subfoo (void);
53 EOF
55 cat >src/foo.c <<EOF
56 #include "foo.h"
57 int main (void)
59 return subfoo ();
61 EOF
63 cat >src/sub/subfoo.c <<EOF
64 #include "foo.h"
65 int subfoo (void)
67 return 0;
69 EOF
71 $ACLOCAL
72 $AUTOCONF
73 $AUTOMAKE -a
75 cd build
76 ../configure am_cv_CC_dependencies_compiler_type=makedepend
78 # Do not error out with the first make, as the forced 'makedepend'
79 # depmode might not actually work, but we have overridden the
80 # _AM_DEPENDENCIES tests.
81 $MAKE || Exit 77
83 # We must clean and rebuild, as the actual error only happens the second
84 # time the objects are built because 'makedepend' has silently messed up
85 # the .Po files the first time.
86 $MAKE clean
88 $MAKE >out 2>&1 || { cat out; Exit 1; }
89 cat out
90 grep 'src/[._]deps' out && Exit 1