source: trunk/essentials/sys-devel/automake-1.10/tests/libtool9.test

Last change on this file was 3147, checked in by bird, 18 years ago

automake 1.10

File size: 2.5 KB
Line 
1#! /bin/sh
2# Copyright (C) 2005 Free Software Foundation, Inc.
3#
4# This file is part of GNU Automake.
5#
6# GNU Automake is free software; you can redistribute it and/or modify
7# it under the terms of the GNU General Public License as published by
8# the Free Software Foundation; either version 2, or (at your option)
9# any later version.
10#
11# GNU Automake is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14# GNU General Public License for more details.
15#
16# You should have received a copy of the GNU General Public License
17# along with Automake; see the file COPYING. If not, write to
18# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19# Boston, MA 02110-1301, USA.
20
21# Make sure xxx_LINK is defined for each target that requires specific
22# flags.
23# Quite similar to libtool7.test, using AM_LDFLAGS in addition to xxx_LDFLAGS.
24
25required='libtoolize gcc'
26. ./defs || exit 1
27
28set -e
29
30cat >> configure.in << 'END'
31AC_PROG_CC
32AM_PROG_CC_C_O
33AC_LIBTOOL_DLOPEN
34AM_PROG_LIBTOOL
35AC_OUTPUT
36END
37
38cat > Makefile.am << 'END'
39AM_LDFLAGS = -module
40lib_LTLIBRARIES = libmod1.la mod2.la
41libmod1_la_SOURCES = mod1.c
42libmod1_la_LDFLAGS =
43libmod1_la_LIBADD = -dlopen mod2.la
44mod2_la_SOURCES = mod2.c
45
46bin_PROGRAMS = prg prg2
47prg_SOURCES = prg.c
48prg_LDADD = -dlopen libmod1.la -dlpreopen mod2.la
49prg_CPPFLAGS = -DXYZ=1
50prg2_SOURCES = prg.c
51prg2_CFLAGS =
52
53print:
54 @echo 1BEG: $(prg_DEPENDENCIES) :END1
55 @echo 2BEG: $(libmod1_la_DEPENDENCIES) :END2
56 @echo 3BEG: $(libmod1_la_LINK) :END3
57 @echo 4BEG: $(mod2_la_LINK) :END4
58 @echo 5BEG: $(prg_LINK) :END5
59 @echo 6BEG: $(prg2_LINK) :END6
60
61END
62
63mkdir liba
64
65cat > mod1.c << 'END'
66int
67mod1 ()
68{
69 return 1;
70}
71END
72
73cat > mod2.c << 'END'
74int
75mod2 ()
76{
77 return 2;
78}
79END
80
81cat > prg.c << 'END'
82int
83main ()
84{
85 return 0;
86}
87END
88
89libtoolize --force --copy
90$ACLOCAL
91$AUTOCONF
92$AUTOMAKE --add-missing --copy
93
94./configure
95env LDFLAGS=ldflags AM_LDFLAGS=am_ldflags libmod1_la_LDFLAGS=lm1_la_ldflags \
96 CFLAGS=cflags AM_CFLAGS=am_cflags prg2_CFLAGS=prg2_cflags \
97 $MAKE -e print >output 2>&1
98cat output
99grep '1BEG: libmod1.la mod2.la :END1' output
100grep '2BEG: mod2.la :END2' output
101grep '3BEG:.* am_cflags cflags .*lm1_la_ldflags ldflags.* :END3' output
102grep '3BEG: .*am_ldflags.* :END3' output && exit 1
103grep '4BEG: :END4' output
104grep '5BEG: :END5' output
105grep '6BEG:.* prg2_cflags cflags .*am_ldflags ldflags.* :END6' output
106grep '6BEG: .*am_cflags.* :END6' output && exit 1
107$MAKE
Note: See TracBrowser for help on using the repository browser.