tests: expose automake bug#14560
[platform/upstream/automake.git] / t / suffix10.tap
1 #! /bin/sh
2 # Copyright (C) 2002-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 # Make sure that derivations work with .lo too.
18 # (related to PR/37)
19
20 required='cc libtoolize yacc'
21 . test-init.sh
22
23 plan_ 7
24
25 cat >>configure.ac <<EOF
26 AC_PROG_CC
27 AC_PROG_YACC
28 AM_PROG_AR
29 AC_PROG_LIBTOOL
30 AC_OUTPUT
31 EOF
32
33 cat >Makefile.am << 'END'
34 lib_LTLIBRARIES = libfoo.la
35 libfoo_la_SOURCES = foo.x_
36 .x_.y:
37         rm -f $@ $@-t
38 ## The leading ':;' works around a bug in bash <= 3.2.
39         :; { echo '/* autogenerated */' \
40           && echo '%{' \
41           && echo 'int yylex () {return 0;}' \
42           && echo 'void yyerror (char *s) {}' \
43           && echo '%}' \
44           && echo '%%' \
45           && echo "foobar : 'f' 'o' 'o' 'b' 'a' 'r' {};" \
46           && echo '%%' \
47 ## Account for VPATH issues on weaker make implementations.
48           && cat `test -f '$<' || echo $(srcdir)/`$<; \
49         } > $@-t
50         mv -f $@-t $@
51 .PHONY: test
52 test:
53         echo $(libfoo_la_OBJECTS) | grep '^foo\.lo$$'
54 END
55
56 cat > foo.x_ << 'END'
57 int foo (void) { return yyparse(); }
58 END
59
60 # We must protect the TAP driver from the output of configure, since
61 # that might output a stray "ok" on a line of its own (due to a
62 # libtool bug on Mac OS X), thus causing a spurious test result to
63 # be seen.  See automake bug#11897.
64 run_configure ()
65 {
66   st=0; ./configure >output 2>&1 || st=1
67   sed 's/^/  /' output
68   test $st -eq 0
69 }
70
71 command_ok_ "libtoolize" libtoolize --force
72 command_ok_ "aclocal"    $ACLOCAL
73 command_ok_ "autoconf"   $AUTOCONF
74 command_ok_ "automake"   $AUTOMAKE --add-missing
75 command_ok_ "configure"  run_configure
76 command_ok_ "make test"  $MAKE test
77
78 directive=''; make_can_chain_suffix_rules || directive=TODO
79 command_ok_ "make all" -D "$directive" -r "suffix rules not chained" \
80             $MAKE all
81
82 :