Revert Automake license to GPLv2+.
[platform/upstream/automake.git] / tests / libtool3.test
1 #! /bin/sh
2 # Copyright (C) 2002, 2004, 2009  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 # Try to build and package a program linked to a Libtool library.
18 # Also make sure we do not bloat the Makefile with unneeded rules.
19
20 required='libtoolize gcc'
21 . ./defs || Exit 1
22
23 set -e
24
25 cat >> configure.in << 'END'
26 AC_PROG_CC
27 AM_PROG_LIBTOOL
28 AC_OUTPUT
29 END
30
31 cat > Makefile.am << 'END'
32 lib_LTLIBRARIES = lib0.la liba/liba.la
33 lib0_la_SOURCES = 0.c
34 liba_liba_la_SOURCES = liba/a.c
35
36 bin_PROGRAMS = 1
37 1_SOURCES = sub/1.c
38 1_LDADD = lib0.la liba/liba.la
39 END
40
41 mkdir liba sub
42
43 cat > 0.c << 'END'
44 int
45 zero (void)
46 {
47    return 0;
48 }
49 END
50
51 cat > sub/1.c << 'END'
52 int zero ();
53
54 int
55 main ()
56 {
57    return zero ();
58 }
59 END
60
61 cat > liba/a.c << 'END'
62 int
63 a (void)
64 {
65    return 'a';
66 }
67 END
68
69 # Use --copy to workaround a bug in Cygwin's `cp -p' during distcheck.
70 # (This bug is already exhibited by subobj9.test.)  In brief: Cygwin's
71 # `cp -p' tries to preserve group and owner of the source and fails
72 # to do so under normal accounts.  With --copy we ensure we own all files.
73
74 libtoolize --force --copy
75 $ACLOCAL
76 $AUTOCONF
77 $AUTOMAKE --add-missing --copy
78
79 # We need explicit rules to build 1.o and a.lo.  Make sure
80 # Automake did not output additional rules for 1.lo and and a.lo.
81 $FGREP '1.o:' Makefile.in
82 $FGREP '1.lo:' Makefile.in && Exit 1
83 $FGREP 'a.o:' Makefile.in && Exit 1
84 $FGREP 'a.lo:' Makefile.in
85
86 ./configure
87
88 $MAKE
89 $MAKE distcheck