* configure.ac, NEWS: Bump version to 1.10.
[automake.git] / tests / libtool9.test
blob740b17c909b2096467d157a80065eb9516310023
1 #! /bin/sh
2 # Copyright (C) 2005 Free Software Foundation, Inc.
4 # This file is part of GNU Automake.
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.
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.
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.
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.
25 required='libtoolize gcc'
26 . ./defs || exit 1
28 set -e
30 cat >> configure.in << 'END'
31 AC_PROG_CC
32 AM_PROG_CC_C_O
33 AC_LIBTOOL_DLOPEN
34 AM_PROG_LIBTOOL
35 AC_OUTPUT
36 END
38 cat > Makefile.am << 'END'
39 AM_LDFLAGS = -module
40 lib_LTLIBRARIES = libmod1.la mod2.la
41 libmod1_la_SOURCES = mod1.c
42 libmod1_la_LDFLAGS =
43 libmod1_la_LIBADD = -dlopen mod2.la
44 mod2_la_SOURCES = mod2.c
46 bin_PROGRAMS = prg prg2
47 prg_SOURCES = prg.c
48 prg_LDADD = -dlopen libmod1.la -dlpreopen mod2.la
49 prg_CPPFLAGS = -DXYZ=1
50 prg2_SOURCES = prg.c
51 prg2_CFLAGS =
53 print:
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
61 END
63 mkdir liba
65 cat > mod1.c << 'END'
66 int
67 mod1 ()
69 return 1;
71 END
73 cat > mod2.c << 'END'
74 int
75 mod2 ()
77 return 2;
79 END
81 cat > prg.c << 'END'
82 int
83 main ()
85 return 0;
87 END
89 libtoolize --force --copy
90 $ACLOCAL
91 $AUTOCONF
92 $AUTOMAKE --add-missing --copy
94 ./configure
95 env 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
98 cat output
99 grep '1BEG: libmod1.la mod2.la :END1' output
100 grep '2BEG: mod2.la :END2' output
101 grep '3BEG:.* am_cflags cflags .*lm1_la_ldflags ldflags.* :END3' output
102 grep '3BEG: .*am_ldflags.* :END3' output && exit 1
103 grep '4BEG: :END4' output
104 grep '5BEG: :END5' output
105 grep '6BEG:.* prg2_cflags cflags .*am_ldflags ldflags.* :END6' output
106 grep '6BEG: .*am_cflags.* :END6' output && exit 1
107 $MAKE