tests: cosmetic changes in t/extra-sources.sh
[platform/upstream/automake.git] / t / libtool3.sh
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 # 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='cc libtoolize'
21 . test-init.sh
22
23 cat >> configure.ac << 'END'
24 AC_PROG_CC
25 AM_PROG_AR
26 AM_PROG_LIBTOOL
27 AC_OUTPUT
28 END
29
30 cat > Makefile.am << 'END'
31 # FIXME: stop disabling the warnings in the 'unsupported' category
32 # FIXME: once the 'subdir-objects' option has been mandatory.
33 AUTOMAKE_OPTIONS = -Wno-unsupported
34
35 lib_LTLIBRARIES = lib0.la liba/liba.la
36 lib0_la_SOURCES = 0.c
37 liba_liba_la_SOURCES = liba/a.c
38
39 bin_PROGRAMS = 1
40 1_SOURCES = sub/1.c
41 1_LDADD = lib0.la liba/liba.la
42 END
43
44 mkdir liba sub
45
46 cat > 0.c << 'END'
47 int
48 zero (void)
49 {
50    return 0;
51 }
52 END
53
54 cat > sub/1.c << 'END'
55 int zero ();
56
57 int
58 main (void)
59 {
60    return zero ();
61 }
62 END
63
64 cat > liba/a.c << 'END'
65 int
66 a (void)
67 {
68    return 'a';
69 }
70 END
71
72 # Use --copy to workaround a bug in Cygwin's 'cp -p' during distcheck.
73 # (This bug is already exhibited by subobj9.sh.)  In brief: Cygwin's
74 # 'cp -p' tries to preserve group and owner of the source and fails
75 # to do so under normal accounts.  With --copy we ensure we own all files.
76
77 libtoolize --force --copy
78 $ACLOCAL
79 $AUTOCONF
80 $AUTOMAKE --add-missing --copy
81
82 # We need explicit rules to build 1.o and a.lo.  Make sure
83 # Automake did not output additional rules for 1.lo and and a.lo.
84 $FGREP '1.o:' Makefile.in
85 $FGREP '1.lo:' Makefile.in && exit 1
86 $FGREP 'a.o:' Makefile.in && exit 1
87 $FGREP 'a.lo:' Makefile.in
88
89 ./configure
90
91 $MAKE
92 $MAKE distcheck
93
94 :