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