91722bd0a57be7119b1b2020e7c083415a666945
[platform/upstream/automake.git] / tests / extradep2.test
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 EXTRA_*_DEPENDENCIES, libtool version; see extradep.test.
18
19 required='cc libtoolize'
20 . ./defs || Exit 1
21
22 cat >> configure.ac << 'END'
23 AC_PROG_CC
24 AM_PROG_AR
25 AC_PROG_LIBTOOL
26 AC_SUBST([deps], [bardep])
27 AC_OUTPUT
28 END
29
30 cat > Makefile.am << 'END'
31 noinst_LTLIBRARIES = libfoo.la
32 EXTRA_libfoo_la_DEPENDENCIES = libfoodep
33 libfoodep:
34         @echo making $@
35         @: > $@
36 CLEANFILES = libfoodep
37
38 bin_PROGRAMS = bar
39 bar_LDADD = libfoo.la
40 EXTRA_bar_DEPENDENCIES = $(deps)
41
42 EXTRA_DIST = bardep
43
44 .PHONY: bar-has-been-updated
45 bar-has-been-updated:
46         stat older bar$(EXEEXT) libfoo.la || : For debugging.
47         test `ls -t bar$(EXEEXT) older | sed q` = bar$(EXEEXT)
48 END
49
50 cat >libfoo.c <<'END'
51 int libfoo () { return 0; }
52 END
53
54 cat >bar.c <<'END'
55 extern int libfoo ();
56 int main () { return libfoo (); }
57 END
58
59 libtoolize
60 $ACLOCAL
61 $AUTOMAKE --add-missing
62 $AUTOCONF
63
64 ./configure
65
66 # Hypothesis: EXTRA_*_DEPENDENCIES are honored.
67
68 : >foodep
69 : >foodep2
70 : >bardep
71 $MAKE >stdout || { cat stdout; Exit 1; }
72 cat stdout
73 grep 'making libfoodep' stdout
74
75 rm -f bardep
76 $MAKE && Exit 1
77 : >bardep
78
79 $MAKE
80 : > older
81 $sleep
82 touch libfoo.la
83 $MAKE
84 $MAKE bar-has-been-updated
85
86 $MAKE distcheck
87
88 :