Merge branch 'msvc' into maint
[platform/upstream/automake.git] / tests / stdlib2.test
1 #! /bin/sh
2 # Copyright (C) 2003, 2004  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 # Check for AM_LDFLAGS = -module
18 # Report from Kevin P. Fleming.
19 required=libtool
20 . ./defs || Exit 1
21
22 set -e
23
24 : > README
25 : > NEWS
26 : > AUTHORS
27 : > ChangeLog
28 : > ltconfig
29 : > ltmain.sh
30 : > config.guess
31 : > config.sub
32
33 cat >> configure.in << 'END'
34 AC_PROG_CC
35 AM_PROG_AR
36 AC_PROG_LIBTOOL
37 AC_OUTPUT
38 END
39
40 : > Makefile.inc
41
42 cat > Makefile.am << 'END'
43 include Makefile.inc
44 lib_LTLIBRARIES = nonstandard.la
45 nonstandard_la_SOURCES = foo.c
46 FOO = -module
47 END
48
49 $ACLOCAL
50 AUTOMAKE_fails --add-missing --gnu
51 grep 'Makefile.am:2:.*nonstandard.la.*standard libtool library name' stderr
52 grep 'Makefile.am:2:.*libnonstandard.la' stderr
53
54 # We will use -Wno-gnu to disable the warning about setting LDFLAGS (below)
55 # Make sure nonstandard names are diagnosed anyway.
56 AUTOMAKE_fails --add-missing --gnu -Wno-gnu
57 grep 'Makefile.am:2:.*nonstandard.la.*standard libtool library name' stderr
58 grep 'Makefile.am:2:.*libnonstandard.la' stderr
59
60 # Make sure nonstandard_la_LDFLAGS is read even if LDFLAGS is used.
61 cat >Makefile.inc <<'EOF'
62 LDFLAGS = -lfoo
63 nonstandard_la_LDFLAGS = $(FOO)
64 EOF
65 $AUTOMAKE -Wno-gnu
66
67 # Make sure LDFLAGS is read even if nonstandard_la_LDFLAGS is used.
68 cat >Makefile.inc <<'EOF'
69 LDFLAGS = $(FOO)
70 nonstandard_la_LDFLAGS = -lfoo
71 EOF
72 $AUTOMAKE -Wno-gnu
73
74 # Make sure AM_LDFLAGS is not read if foo_LDFLAGS is used.
75 cat >Makefile.inc <<'EOF'
76 nonstandard_la_LDFLAGS = -lfoo
77 AM_LDFLAGS = -module
78 EOF
79 AUTOMAKE_fails
80 grep 'Makefile.am:2:.*nonstandard.la.*standard libtool library name' stderr
81 grep 'Makefile.am:2:.*libnonstandard.la' stderr
82
83 echo 'AM_LDFLAGS = -module' > Makefile.inc
84 $AUTOMAKE
85
86 # For module, Automake should not suggest the lib prefix.
87 cat > Makefile.am << 'END'
88 include Makefile.inc
89 lib_LTLIBRARIES = nonstandard
90 nonstandard_SOURCES = foo.c
91 FOO = -module
92 END
93
94 AUTOMAKE_fails
95 grep "Makefile.am:2:.*nonstandard'.*standard libtool module name" stderr
96 grep 'Makefile.am:2:.*`nonstandard.la' stderr