mirror of
git://git.savannah.gnu.org/libtool.git
synced 2025-02-11 15:00:08 +08:00
To safely use a non-literal first argument to `test', you must always prepend a literal non-`-' character, but often the second operand is a constant that doesn't begin with a `-' already, so always use `test a = "$b"' instead of noisy `test "X$b" = Xa'. * cfg.mk (sc_prohibit_test_const_follows_var): New syntax-check rule to ensure we don't reintroduce noisy test operands. * bootstrap, build-aux/extract-trace, build-aux/general.m4sh, build-aux/ltmain.m4sh, doc/libtool.texi, libtoolize.m4sh, m4/argz.m4, m4/libtool.m4, m4/ltdl.m4, tests/bindir.at, tests/defs.m4sh, tests/demo-relink.test, tests/demo/configure.ac, tests/depdemo-relink.test, tests/destdir.at, tests/duplicate_conv.at, tests/fail.at, tests/getopt-m4sh.at, tests/help.at, tests/libtoolize.at, tests/link-2.test, tests/link-order2.at, tests/lt_dlopenext.at, tests/mdemo/configure.ac, tests/mdemo2/configure.ac, tests/need_lib_prefix.at, tests/nocase.at, tests/pdemo/configure.ac, tests/pic_flag.at, tests/search-path.at, tests/shlibpath.at, tests/static.at, tests/sysroot.at, tests/tagtrace.test, tests/testsuite.at, tests/with-pic.at: Swap operands to avoid useless noise. Signed-off-by: Gary V. Vaughan <gary@gnu.org>
92 lines
3.9 KiB
Plaintext
92 lines
3.9 KiB
Plaintext
# duplicate_conv.at -- duplicate convenience archive names -*- Autotest -*-
|
|
|
|
# Copyright (C) 2006, 2008 Free Software Foundation, Inc.
|
|
# Written by Ralf Wildenhues, 2006
|
|
#
|
|
# This file is part of GNU Libtool.
|
|
#
|
|
# GNU Libtool is free software; you can redistribute it and/or
|
|
# modify it under the terms of the GNU General Public License as
|
|
# published by the Free Software Foundation; either version 2 of
|
|
# the License, or (at your option) any later version.
|
|
#
|
|
# GNU Libtool is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with GNU Libtool; see the file COPYING. If not, a copy
|
|
# can be downloaded from http://www.gnu.org/licenses/gpl.html,
|
|
# or obtained by writing to the Free Software Foundation, Inc.,
|
|
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
####
|
|
|
|
AT_SETUP([duplicate convenience archive names])
|
|
AT_KEYWORDS([libtool])
|
|
|
|
eval `$LIBTOOL --config | sed -n '/^reload_cmds=/,/^$/p'`
|
|
|
|
# We create two convenience archives with the same name, and _also_
|
|
# containing an object with the same name. This is necessary to detect
|
|
# the failure with both 1.5.22 and HEAD, since the latter does not (did
|
|
# not?) remove the temporary output directory, thus masking the failure
|
|
# when all objects have distinct names.
|
|
|
|
mkdir a b c
|
|
|
|
echo 'int a () { return 0; }' > a/a.c
|
|
echo 'int a2() { return 0; }' > b/a.c
|
|
echo 'int b () { return 0; }' > b/b.c
|
|
echo 'extern int a(), a2(), b(); int c() { return a() + a2() + b(); }' > c.c
|
|
echo 'extern int c(); int main() { return c(); }' > main.c
|
|
|
|
$LIBTOOL --mode=compile --tag=CC $CC $CPPFLAGS $CFLAGS -c a/a.c -o a/a.lo
|
|
$LIBTOOL --mode=compile --tag=CC $CC $CPPFLAGS $CFLAGS -c b/a.c -o b/a.lo
|
|
$LIBTOOL --mode=compile --tag=CC $CC $CPPFLAGS $CFLAGS -c b/b.c -o b/b.lo
|
|
$LIBTOOL --mode=compile --tag=CC $CC $CPPFLAGS $CFLAGS -c c.c
|
|
$CC $CPPFLAGS $CFLAGS -c main.c
|
|
$LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o a/liba.la a/a.lo
|
|
$LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o b/liba.la b/a.lo b/b.lo
|
|
|
|
# Fold into convenience archive.
|
|
AT_CHECK([$LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o libcee.la c.lo a/liba.la b/liba.la],
|
|
[0], [ignore], [ignore])
|
|
AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o main$EXEEXT main.$OBJEXT ./libcee.la],
|
|
[0], [ignore], [ignore])
|
|
LT_AT_EXEC_CHECK([./main],[0],[ignore],[ignore])
|
|
$LIBTOOL --mode=clean rm -f libcee.la
|
|
|
|
|
|
# FIXME: For this test, we may want to zero out whole_archive_flag_spec;
|
|
# OTOH, we'd like to test the other situation, too.
|
|
|
|
# Fold into static library.
|
|
AT_CHECK([$LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -rpath /foo -static -o libcee.la c.lo a/liba.la b/liba.la],
|
|
[0], [ignore], [ignore])
|
|
AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o main$EXEEXT main.$OBJEXT ./libcee.la],
|
|
[0], [ignore], [ignore])
|
|
LT_AT_EXEC_CHECK([./main],[0],[ignore],[ignore])
|
|
$LIBTOOL --mode=clean rm -f libcee.la
|
|
|
|
# Fold into library.
|
|
AT_CHECK([$LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -rpath /foo -o libcee.la c.lo a/liba.la b/liba.la],
|
|
[0], [ignore], [ignore])
|
|
AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o main$EXEEXT main.$OBJEXT ./libcee.la],
|
|
[0], [ignore], [ignore])
|
|
LT_AT_EXEC_CHECK([./main],[0],[ignore],[ignore])
|
|
$LIBTOOL --mode=clean rm -f libcee.la
|
|
|
|
AT_CHECK([test false = "$reload_cmds" && exit 77], [1])
|
|
|
|
# Test whether this works with reloadable objects as well.
|
|
AT_CHECK([$LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o cee.$OBJEXT c.lo a/liba.la b/liba.la],
|
|
[0], [ignore], [ignore])
|
|
AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o main$EXEEXT main.$OBJEXT cee.$OBJEXT],
|
|
[0], [ignore], [ignore])
|
|
LT_AT_EXEC_CHECK([./main],[0],[ignore],[ignore])
|
|
|
|
# TODO: test dlpreloading of duplicates (when it is implemented)
|
|
|
|
AT_CLEANUP
|