news: describe recently-fixed bug in vala support
[platform/upstream/automake.git] / tests / multlib.test
1 #! /bin/sh
2 # Copyright (C) 2003, 2004, 2007, 2010, 2012 Free Software Foundation,
3 # Inc.
4 #
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2, or (at your option)
8 # any later version.
9 #
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
18 # Check multilib support.
19 # Based on a test case from Ralf Corsepius.
20
21 required='gcc GNUmake'
22 . ./defs || Exit 1
23
24 set -e
25
26 # Multilib support has been deprecated in the Automake core.
27
28 cat >>configure.in <<'END'
29 AM_ENABLE_MULTILIB([Makefile], [.])
30 END
31
32 $ACLOCAL
33 $AUTOCONF -Wall -Werror 2>stderr && { cat stderr >&2; Exit 1; }
34 cat stderr >&2
35 grep '^configure\.in:4:.*AM_ENABLE_MULTILIB.* removed.* soon' stderr
36 grep '"multilib".*feature' stderr
37 grep 'contrib.* in the Automake distribution' stderr
38
39 rm -rf autom4te*.cache aclocal.m4 configure
40
41 # Functional tests now.
42
43 cat >configure.in <<'END'
44 AC_INIT([multlib], [1.0])
45 AC_CONFIG_SRCDIR(libfoo/foo.c)
46 AC_CONFIG_AUX_DIR(.)
47 AM_INIT_AUTOMAKE
48 AC_CONFIG_FILES([Makefile])
49 AC_CONFIG_SUBDIRS(libfoo)
50 AC_CONFIG_SUBDIRS(libbar)
51 AC_OUTPUT
52 END
53
54 cat >mycc <<'END'
55 #! /bin/sh
56 case ${1+"$@"} in
57  *-print-multi-lib*)
58   echo ".;"
59   echo "debug;@g"
60   exit 0 ;;
61 esac
62 gcc ${1+"$@"}
63 END
64
65 chmod +x mycc
66 PATH=`pwd`$PATH_SEPARATOR$PATH
67
68 cat >Makefile.am <<'EOF'
69 SUBDIRS = @subdirs@
70 EXTRA_DIST = config-ml.in symlink-tree
71 EOF
72
73 # libfoo tests multilib supports when there are no subdirectories
74 # libbar tests multilib supports when there are subdirectories
75
76 mkdir libfoo
77
78 cat >libfoo/configure.in <<'END'
79 AC_PREREQ(2.57)
80 AC_INIT(libfoo, 0.1, nobody@localhost)
81 AC_CONFIG_SRCDIR(foo.c)
82 # Apparently it doesn't work to have auxdir=.. when
83 # multilib uses symlinked trees.
84 AC_CONFIG_AUX_DIR(.)
85 AM_INIT_AUTOMAKE
86 AC_PROG_CC
87 AC_PROG_RANLIB
88 AM_ENABLE_MULTILIB(Makefile,[..])
89 AC_CONFIG_FILES([Makefile])
90 AC_OUTPUT
91 END
92
93 cat >libfoo/Makefile.am <<'END'
94 noinst_LIBRARIES = libfoo.a
95 libfoo_a_SOURCES = foo.c
96 END
97
98 : > libfoo/foo.c
99
100 mkdir libbar
101
102 cat >libbar/configure.in <<'END'
103 AC_PREREQ(2.57)
104 AC_INIT(libbar, 0.1, nobody@localhost)
105 # Apparently it doesn't work to have auxdir=.. when
106 # multilib uses symlinked trees.
107 AC_CONFIG_AUX_DIR(.)
108 AM_INIT_AUTOMAKE
109 AC_PROG_CC
110 AC_PROG_RANLIB
111 AM_ENABLE_MULTILIB(Makefile,[..])
112 AC_CONFIG_FILES([Makefile sub/Makefile])
113 AC_OUTPUT
114 END
115
116 cat >libbar/Makefile.am <<'END'
117 SUBDIRS = sub
118 noinst_LIBRARIES = libbar.a
119 libbar_a_SOURCES = bar.c
120 END
121
122 mkdir libbar/sub
123
124 : >libbar/sub/Makefile.am
125
126 : > libbar/bar.c
127
128 cp "$testsrcdir/../lib/config-ml.in" .
129 cp "$testsrcdir/../lib/symlink-tree" .
130
131 $ACLOCAL -Wno-obsolete
132 $AUTOCONF -Werror -Wall -Wno-obsolete
133 $AUTOMAKE --add-missing
134 cd libfoo
135 $ACLOCAL
136 $AUTOCONF -Werror -Wall -Wno-obsolete
137 $AUTOMAKE --add-missing
138 cd ../libbar
139 $ACLOCAL
140 $AUTOCONF -Werror -Wall -Wno-obsolete
141 $AUTOMAKE --add-missing
142 cd ..
143
144
145 # Check VPATH builds
146 mkdir build
147 cd build
148 ../configure --enable-multilib CC=mycc
149 $MAKE
150 $MAKE install
151 $MAKE distcleancheck
152
153 # Check standard builds.
154 cd ..
155 # Why to I have to specify --with-target-subdir?
156 ./configure --enable-multilib --with-target-subdir=. CC=mycc
157 $MAKE