# convenience.at -- testing C convenience archives -*- Autotest -*-
# Copyright (C) 2005, 2007-2019, 2021-2024 Free Software Foundation,
# Inc.
# Written by Ralf Wildenhues, 2005
#
# 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. If not, see .
####
# Test that convenience archives work.
# for each TAG, test:
# - adding one or multiple convenience archives
# - with or without additional objects on the cmdline
AT_SETUP([C convenience archives])
AT_KEYWORDS([libtool])
cat >main1.c <main2.c <main3.c < a$i.c
$LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c main$i.c
$LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c a$i.c
$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o liba$i.la a$i.lo
done
AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o liba12.la liba1.la liba2.la -rpath /notexist],
[0],[ignore],[ignore])
AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o liba123.la a3.lo liba1.la liba2.la -rpath /notexist],
[0],[ignore],[ignore])
conv=
for i in 1 2 3; do
conv=$conv$i
AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -static -o main_static$EXEEXT main$i.lo liba$conv.la],
[0],[ignore],[ignore])
AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o main$EXEEXT main$i.lo liba$conv.la],
[0],[ignore],[ignore])
LT_AT_EXEC_CHECK([./main_static])
LT_AT_EXEC_CHECK([./main])
done
AT_CLEANUP
AT_SETUP([C++ convenience archives])
LT_AT_TAG([CXX])
AT_KEYWORDS([libtool])
cat >main1.cpp <main2.cpp <main3.cpp < a$i.cpp
$LIBTOOL --tag=CXX --mode=compile $CXX $CXXFLAGS -c main$i.cpp
$LIBTOOL --tag=CXX --mode=compile $CXX $CXXFLAGS -c a$i.cpp
$LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS $LDFLAGS -o liba$i.la a$i.lo
done
AT_CHECK([$LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS $LDFLAGS -o liba12.la liba1.la liba2.la -rpath /notexist],
[0],[ignore],[ignore])
AT_CHECK([$LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS $LDFLAGS -o liba123.la a3.lo liba1.la liba2.la -rpath /notexist],
[0],[ignore],[ignore])
conv=
for i in 1 2 3; do
conv=$conv$i
AT_CHECK([$LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS $LDFLAGS -static -o main_static$EXEEXT main$i.lo liba$conv.la],
[0],[ignore],[ignore])
AT_CHECK([$LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS $LDFLAGS -o main$EXEEXT main$i.lo liba$conv.la],
[0],[ignore],[ignore])
LT_AT_EXEC_CHECK([./main_static])
LT_AT_EXEC_CHECK([./main])
done
AT_CLEANUP
AT_SETUP([F77 convenience archives])
LT_AT_TAG([F77])
AT_KEYWORDS([libtool])
cat >main1.f <main2.f <main3.f <a$i.f <main1.f <main2.f <main3.f <a$i.f <foo1.java <foo2.java <foo3.java <A$i.java <