2 # Copyright (C) 2003-2012 Free Software Foundation, Inc.
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)
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.
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/>.
17 # Check multilib support.
18 # Based on a test case from Ralf Corsepius.
19 # FIXME: the features tested by this script has been moved in contrib.
20 # FIXME: We should move this script accordingly.
22 required='gcc GNUmake'
25 mldir=$top_testsrcdir/contrib/multilib
27 cp "$mldir"/config-ml.in "$mldir"/symlink-tree .
28 cp "$mldir"/multi.m4 m4
30 ACLOCAL_PATH=${ACLOCAL_PATH+"$ACLOCAL_PATH:"}`pwd`/m4
33 cat >configure.in <<'END'
34 AC_INIT([multlib], [1.0])
35 AC_CONFIG_SRCDIR(libfoo/foo.c)
38 AC_CONFIG_FILES([Makefile])
39 AC_CONFIG_SUBDIRS(libfoo)
40 AC_CONFIG_SUBDIRS(libbar)
56 PATH=`pwd`$PATH_SEPARATOR$PATH
58 cat >Makefile.am <<'EOF'
60 EXTRA_DIST = config-ml.in symlink-tree
62 test -f debug/libfoo/libfoo.a
63 test -f debug/libbar/libbar.a
64 test -f libfoo/libfoo.a
65 test -f libbar/libbar.a
68 # libfoo tests multilib supports when there are no subdirectories
69 # libbar tests multilib supports when there are subdirectories
72 cp "$mldir"/multilib.am libfoo/
74 cat >libfoo/configure.in <<'END'
76 AC_INIT(libfoo, 0.1, nobody@localhost)
77 AC_CONFIG_SRCDIR(foo.c)
78 # Apparently it doesn't work to have auxdir=.. when
79 # multilib uses symlinked trees.
85 AM_ENABLE_MULTILIB(Makefile,[..])
86 AC_CONFIG_FILES([Makefile])
90 cat >libfoo/Makefile.am <<'END'
91 noinst_LIBRARIES = libfoo.a
92 libfoo_a_SOURCES = foo.c
93 include $(top_srcdir)/multilib.am
99 cp "$mldir"/multilib.am libbar/
101 cat >libbar/configure.in <<'END'
103 AC_INIT(libbar, 0.1, nobody@localhost)
104 # Apparently it doesn't work to have auxdir=.. when
105 # multilib uses symlinked trees.
111 AM_ENABLE_MULTILIB(Makefile,[..])
112 AC_CONFIG_FILES([Makefile sub/Makefile])
116 cat >libbar/Makefile.am <<'END'
118 noinst_LIBRARIES = libbar.a
119 libbar_a_SOURCES = bar.c
120 include $(top_srcdir)/multilib.am
124 echo 'include $(top_srcdir)/multilib.am' >libbar/sub/Makefile.am
129 $AUTOMAKE --add-missing
134 $AUTOMAKE --add-missing
140 $AUTOMAKE --add-missing
146 ../configure --enable-multilib CC=mycc
148 test -f debug/libfoo/libfoo.a
149 test -f debug/libbar/libbar.a
150 test -f libfoo/libfoo.a
151 test -f libbar/libbar.a
155 # Check standard builds.
157 # Why to I have to specify --with-target-subdir?
158 ./configure --enable-multilib --with-target-subdir=. CC=mycc
160 DISTCHECK_CONFIGURE_FLAGS='--enable-multilib CC=mycc' $MAKE distcheck