* Ralf Wildenhues wrote on Mon, Apr 18, 2005 at 07:08:13PM CEST:
> We need a test for convenience archives: multiple archives, objects not
> pulled in through dependencies. This has hit us more than once now.
Since this test has done some good, I decided to do it thoroughly.
The patch below contains a convenience test for C, CXX, F77 and GCJ.
Please excuse my total ignorance of java for any errors I introduced
in that test.
Also contained is a rather comprehensive update on the new testsuite
with some new macros: LT_AT_EXEC_CHECK to isolate cross compilation
semantics, LT_AT_TAG to check for TAGs we have active and skip tests
accordingly.
I also decided to make use of the autotest keywords feature and reorder
the tests for some more logic (and have stresstest last). Can you tell
I'm starting to like autotest?
Futher some bugfixes in the suite:
- consistent use of $CFLAGS etc.
- wildcards/regexes in -export-symbols files are not portable.
- relying on either one of obj.o or .libs/obj.o to exist is not ok.
- link-order had C symbols with dollars in their names and was broken
in several ways. I think it's still broken, in a different way.
- LT_AT_BOOTSTRAP is too lenient (it's still after my patch) and
causes false PASSes of the am-subdir tests (even after my patch).
- disable AT_TESTED invocation because it makes the suite unusable
on systems without the autotools.
And then I decided to just apply this, because I knew you'd love
(ignore) it anyways. :-)
Seriously: if there are any issues with the patch, I'd be happy
to discuss/back out.
Regards,
Ralf
* tests/convenience.at: New. Test convenience archives.
* Makefile.am, tests/testsuite.at: Adjust.
* tests/testsuite.at: Reorder tests. Suspend AT_TESTED.
(PREPARE_TESTS): Define EGREP, host, build, LIBTOOL.
(LT_AT_BOOTSTRAP): Fail if autoreconf fails.
(LT_AT_EXEC_CHECK): New macro for execution of $build binaries.
(LT_AT_TAG): New macro to test tag availability or skip test.
* tests/am-subdir.at, tests/duplicate_members.at,
tests/inherited_flags.at,
tests/link-order.at, tests/stresstest.at, tests/template.at:
Adjust. Use LT_AT_TAG, LT_AT_EXEC_CHECK, AT_KEYWORDS.
Use compiler/linker flags consistently.
* tests/link-order.at: Fix use of AT_DATA, bogus redirection
inside AT_CHECK.
* tests/stresstest.at: Do not use wildcards/regex in symbol files,
they are not portable. Use -no-undefined on win32. Fix to ignore
compile/link warnings.
* tests/convenience.at: New. Test convenience archives.
* Makefile.am, tests/testsuite.at: Adjust.
* tests/testsuite.at: Reorder tests. Suspend AT_TESTED.
(PREPARE_TESTS): Define EGREP, host, build, LIBTOOL.
(LT_AT_BOOTSTRAP): Fail if autoreconf fails.
(LT_AT_EXEC_CHECK): New macro for execution of $build binaries.
(LT_AT_TAG): New macro to test tag availability or skip test.
* tests/am-subdir.at, tests/duplicate_members.at,
tests/inherited_flags.at,
tests/link-order.at, tests/stresstest.at, tests/template.at:
Adjust. Use LT_AT_TAG, LT_AT_EXEC_CHECK, AT_KEYWORDS.
Use compiler/linker flags consistently.
* tests/link-order.at: Fix use of AT_DATA, bogus redirection
inside AT_CHECK.
* tests/stresstest.at: Do not use wildcards/regex in symbol files,
they are not portable. Use -no-undefined on win32. Fix to ignore
compile/link warnings.
Index: tests/testsuite.at
===================================================================
RCS file: /cvsroot/libtool/libtool/tests/testsuite.at,v
retrieving revision 1.13
diff -u -r1.13 testsuite.at
--- tests/testsuite.at 22 Apr 2005 10:10:30 -0000 1.13
+++ tests/testsuite.at 27 Apr 2005 17:52:58 -0000
@@ -20,7 +20,10 @@
m4_divert_push([PREPARE_TESTS])dnl
: ${LIBTOOLIZE="${abs_top_builddir}/libtoolize"}
-export LIBTOOLIZE
+: ${LIBTOOL="${abs_top_builddir}/libtool"}
+export LIBTOOLIZE LIBTOOL
+eval `$LIBTOOL --config | grep ^EGREP=`
+eval `$LIBTOOL --config | $EGREP '(host|build)='`
m4_divert_pop([PREPARE_TESTS])dnl
# LT_AT_LIBTOOLIZE([ARGS])
@@ -43,16 +46,36 @@
m4_define([LT_AT_BOOTSTRAP],
[
test -f ./ltmain.sh || LT_AT_LIBTOOLIZE([--copy])
-test -f ./configure || _lt_pkgvdatadir="$abs_top_srcdir" autoreconf --force
--verbose --install
+test -f ./configure || _lt_pkgvdatadir="$abs_top_srcdir" autoreconf --force
--verbose --install || exit 1
test -f ./configure || exit 1
./configure
])
+
+# LT_AT_EXEC_CHECK(EXECUTABLE, [STATUS = 0], [STDOUT], [STDERR])
+# --------------------------------------------------------------
+m4_define([LT_AT_EXEC_CHECK],
+[AT_CHECK([if $1; then :;
+ elif test "X$host" != "X$build" && \
+ { test -x "$1" || test -x "$1"$EXEEXT; }
+ then (exit 77); fi],[$2],[$3],[$4])
+])
+
+
+# LT_AT_TAG(TAG)
+# --------------
+m4_define([LT_AT_TAG],
+[AT_KEYWORDS([$1])
+eval `$LIBTOOL --tag=$1 --config | sed -n '/^CC=/ { s/CC/$1/; p;}'`
+AT_CHECK([test -n "[$]$1" || (exit 77)])
+])
+
+
# We use `dnl' in zillions of places...
m4_pattern_allow([^dnl$])
# We exercise these tools.
-AT_TESTED([grep autoreconf autom4te automake])
+dnl AT_TESTED([grep autoreconf autom4te automake])
## ----------- ##
## The suite. ##
@@ -60,18 +83,19 @@
AT_INIT
-# Torturing subdir-objects builds
-m4_include([am-subdir.at])
+# libtoolize tests
+m4_include([libtoolize.at])
# Testing func_extract_archives
m4_include([duplicate_members.at])
# Test that inherited_linker_flags in the .la actually gets used.
m4_include([inherited_flags.at])
-# stress test
-m4_include([stresstest.at])
-# C++ templates tests
-m4_include([template.at])
-# libtoolize tests
-m4_include([libtoolize.at])
+# convenience archives test
+m4_include([convenience.at])
# link order test
m4_include([link-order.at])
-
+# Torturing subdir-objects builds
+m4_include([am-subdir.at])
+# C++ templates tests
+m4_include([template.at])
+# stress test
+m4_include([stresstest.at])
Index: Makefile.am
===================================================================
RCS file: /cvsroot/libtool/libtool/Makefile.am,v
retrieving revision 1.150
diff -u -r1.150 Makefile.am
--- Makefile.am 22 Apr 2005 10:20:46 -0000 1.150
+++ Makefile.am 27 Apr 2005 17:52:58 -0000
@@ -309,6 +309,7 @@
tests/libtoolize.at \
tests/stresstest.at \
tests/link-order.at \
+ tests/convenience.at \
tests/template.at
EXTRA_DIST += $(TESTSUITE) $(TESTSUITE_AT) tests/package.m4
@@ -319,7 +320,8 @@
LIBS="$(LIBS)" LN_S="$(LN_S)" NM="$(NM)" RANLIB="$(RANLIB)" \
OBJEXT="$(OBJEXT)" EXEEXT="$(EXEEXT)" CONFIG_SHELL="$(SHELL)" \
CXX="$(CXX)" CXXFLAGS="$(CXXFLAGS)" CXXCPP="$(CXXCPP)" \
- F77="$(F77)" FFLAGS="$(FFLAGS)"
+ F77="$(F77)" FFLAGS="$(FFLAGS)" \
+ GCJ="$(GCJ)" GCJFLAGS="$(GCJFLAGS)"
check-recursive: $(srcdir)/$(TESTSUITE)
Index: tests/am-subdir.at
===================================================================
RCS file: /cvsroot/libtool/libtool/tests/am-subdir.at,v
retrieving revision 1.4
diff -u -r1.4 am-subdir.at
--- tests/am-subdir.at 22 Apr 2005 10:10:30 -0000 1.4
+++ tests/am-subdir.at 27 Apr 2005 17:52:58 -0000
@@ -25,6 +25,7 @@
## ----------- ##
AT_SETUP([C subdir-objects])
+AT_KEYWORDS([autoconf automake])
AT_DATA([[configure.ac]],
[[AC_INIT([subdir-demo], ]]AT_PACKAGE_VERSION[[, ]]AT_PACKAGE_BUGREPORT[[)
@@ -74,7 +75,7 @@
LT_AT_BOOTSTRAP
"${MAKE-make}"
-AT_CHECK([subdir/subdemo], 0, expout)
+LT_AT_EXEC_CHECK([subdir/subdemo], 0, expout)
AT_CLEANUP
@@ -84,6 +85,8 @@
## ------------- ##
AT_SETUP([C++ subdir-objects])
+AT_KEYWORDS([autoconf automake])
+LT_AT_TAG([CXX])
AT_DATA([[configure.ac]],
[[AC_INIT([subdir-demo], ]]AT_PACKAGE_VERSION[[, ]]AT_PACKAGE_BUGREPORT[[)
@@ -157,6 +160,6 @@
LT_AT_BOOTSTRAP
"${MAKE-make}"
-AT_CHECK([subdir/subdemo], 0, expout)
+LT_AT_EXEC_CHECK([subdir/subdemo], 0, expout)
AT_CLEANUP
Index: tests/duplicate_members.at
===================================================================
RCS file: /cvsroot/libtool/libtool/tests/duplicate_members.at,v
retrieving revision 1.2
diff -u -r1.2 duplicate_members.at
--- tests/duplicate_members.at 22 Apr 2005 10:10:30 -0000 1.2
+++ tests/duplicate_members.at 27 Apr 2005 17:52:58 -0000
@@ -19,18 +19,12 @@
AT_BANNER([Testing libtool functions])
AT_SETUP([duplicate members in archive tests])
-
-LIBTOOL=${abs_top_builddir}/libtool
-
# we don't want to use whole_archive_flag_spec, even if available
sed -e 's|^whole_archive_flag_spec=.*|whole_archive_flag_spec=|g' < $LIBTOOL >
libtool
chmod +x ./libtool
LIBTOOL=./libtool
-eval `$LIBTOOL --config | grep ^EGREP=`
-eval `$LIBTOOL --config | $EGREP '(host|build)='`
-
AT_DATA(bar.c,
[[int bar() {
int result=foo1() +foo2() +foo3() +foo4() +foo5() +foo6();
@@ -68,8 +62,6 @@
$LIBTOOL --mode=compile --tag=CC $CC -c $CFLAGS -o main.lo main.c
$LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o main main.lo ./libbar.la
-AT_CHECK([./main],[0],[ignore],[ignore],[AT_CHECK(if
- ((test "X$host" != "X$build") &&
- ( test -x ./main)); then exit 77; fi)])
+LT_AT_EXEC_CHECK([./main],[0],[ignore],[ignore])
AT_CLEANUP
Index: tests/inherited_flags.at
===================================================================
RCS file: /cvsroot/libtool/libtool/tests/inherited_flags.at,v
retrieving revision 1.2
diff -u -r1.2 inherited_flags.at
--- tests/inherited_flags.at 22 Apr 2005 10:10:30 -0000 1.2
+++ tests/inherited_flags.at 27 Apr 2005 17:52:58 -0000
@@ -19,8 +19,6 @@
AT_SETUP([inherited_linker_flags])
-: ${LIBTOOL=$abs_top_builddir/libtool}
-
AT_DATA([foo.c],
[
int foo() { return 1;}
@@ -41,14 +39,12 @@
int main() { return 0;}
])
-eval `$LIBTOOL --config | grep ^CC`
-
-${LIBTOOL} --mode=compile --tag=CC $CC -c -o foo.lo foo.c
-${LIBTOOL} --mode=compile --tag=CC $CC -c -o bar.lo bar.c
-${LIBTOOL} --mode=compile --tag=CC $CC -c -o baz.lo baz.c
-${LIBTOOL} --mode=compile --tag=CC $CC -c -o main.lo main.c
-${LIBTOOL} --mode=link --tag=CC $CC -o libfoo.la foo.lo -rpath /usr/local/lib
-${LIBTOOL} --mode=link --tag=CC $CC -o libbar.la bar.lo -rpath /usr/local/lib
+${LIBTOOL} --mode=compile --tag=CC $CC $CFLAGS -c -o foo.lo foo.c
+${LIBTOOL} --mode=compile --tag=CC $CC $CFLAGS -c -o bar.lo bar.c
+${LIBTOOL} --mode=compile --tag=CC $CC $CFLAGS -c -o baz.lo baz.c
+${LIBTOOL} --mode=compile --tag=CC $CC $CFLAGS -c -o main.lo main.c
+${LIBTOOL} --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o libfoo.la foo.lo
-rpath /usr/local/lib
+${LIBTOOL} --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o libbar.la bar.lo
-rpath /usr/local/lib
mv libfoo.la libfoo.la.bak
@@ -59,7 +55,7 @@
sed -e
's/^inherited_linker_flags.*/inherited_linker_flags=-llt_unlikely_existing_lib/g'
< libbar.la.bak > libbar.la
rm libbar.la.bak
-AT_CHECK([${LIBTOOL} --mode=link --tag=CC $CC -o libbaz.la baz.lo -rpath
/usr/local/lib ./libfoo.la ./libbar.la | grep
'llt_[[ui]]nlikely_existing_lib.*llt_[[ui]]nlikely_existing_lib'],[0],[ignore],[ignore])
-AT_CHECK([${LIBTOOL} --mode=link --tag=CC $CC -o main main.lo -rpath
/usr/local/lib ./libfoo.la ./libbar.la | grep
'llt_[[ui]]nlikely_existing_lib.*llt_[[ui]]nlikely_existing_lib'],[0],[ignore],[ignore])
+AT_CHECK([${LIBTOOL} --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o libbaz.la
baz.lo -rpath /usr/local/lib ./libfoo.la ./libbar.la | grep
'llt_[[ui]]nlikely_existing_lib.*llt_[[ui]]nlikely_existing_lib'],[0],[ignore],[ignore])
+AT_CHECK([${LIBTOOL} --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o main main.lo
-rpath /usr/local/lib ./libfoo.la ./libbar.la | grep
'llt_[[ui]]nlikely_existing_lib.*llt_[[ui]]nlikely_existing_lib'],[0],[ignore],[ignore])
AT_CLEANUP
Index: tests/link-order.at
===================================================================
RCS file: /cvsroot/libtool/libtool/tests/link-order.at,v
retrieving revision 1.2
diff -u -r1.2 link-order.at
--- tests/link-order.at 22 Apr 2005 10:10:30 -0000 1.2
+++ tests/link-order.at 27 Apr 2005 17:52:58 -0000
@@ -18,10 +18,7 @@
# link-order.test - make sure that library linking order matches
-AT_BANNER([Libtool link order test.])
AT_SETUP([Link order test.])
-: ${LIBTOOL=${abs_top_builddir}/libtool}
-: ${EGREP='grep -E'}
eval `$LIBTOOL --config | grep ECHO=`
prefix_old=`pwd`/old
@@ -40,16 +37,16 @@
rm -rf src
mkdir src
- AT_DATA(src/a_$i.c,
-[[extern int c;
+ cat >src/a_$i.c <<EOF
+extern int c;
extern int b_$i();
int a_$i() { return c + b_$i(); }
-]])
+EOF
- AT_DATA(src/b_$i.c,
-[[extern int c;
+ cat >src/b_$i.c <<EOF
+extern int c;
int b_$i() { return 1 + c; }
-]])
+EOF
prefix=`eval echo \\$prefix_$i`
$LIBTOOL --mode=compile $CC $CFLAGS -c src/a_$i.c -o src/a.lo
@@ -59,30 +56,26 @@
$LIBTOOL --mode=link $CC $CFLAGS -o src/liba.la src/a.lo \
src/libb.la -L$prefix_old/lib -lcee -rpath $prefix/lib
$LIBTOOL --mode=install cp src/libb.la $prefix/lib/libb.la
- $LIBTOOL --mode=install cp src/liba.la $prefix/lib/liba.la
+ AT_CHECK([$LIBTOOL --mode=install cp src/liba.la $prefix/lib/liba.la],
+ [0], [stdout], [stderr])
done
# Do not error if we do not relink (e.g. static-only systems)
-AT_CHECK([$LIBTOOL --mode=install cp src/liba.la $prefix/lib/liba.la >mylog
2>&1;
- if $EGREP relinking mylog; then
- $EGREP ' -L.*\/new\/lib -lb -L.*\/old\/lib -lcee' mylog
- else :;
- fi], [0], [ignore], [ignore], [echo "wrong link order"])
-
+AT_CHECK([if $EGREP relinking stderr; then
+ $EGREP ' -L.*\/new\/lib -lb -L.*\/old\/lib -lcee' stdout
+ else :; fi], [0], [ignore], [], [echo "wrong link order"])
for i in old new; do
- AT_DATA(src/main_$i.c,
-[[extern int a_$i();
+ cat >src/main_$i.c <<EOF
+extern int a_$i();
int main(void) { return a_$i() != 3; }
-]])
+EOF
prefix=`eval echo \\$prefix_$i`
$LIBTOOL --mode=compile $CC $CFLAGS -c src/main_$i.c -o src/main_$i.lo
AT_CHECK($LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o src/main_$i
src/main_$i.lo -L$prefix/lib -la,
[0], [ignore], [ignore])
-
- AT_CHECK(src/main_$i, [0],,,
- [AT_CHECK(if test "X$host" != "X$build"; then exit 77; fi)])
+ LT_AT_EXEC_CHECK([src/main_$i])
done
AT_CLEANUP
Index: tests/stresstest.at
===================================================================
RCS file: /cvsroot/libtool/libtool/tests/stresstest.at,v
retrieving revision 1.3
diff -u -r1.3 stresstest.at
--- tests/stresstest.at 22 Apr 2005 10:10:30 -0000 1.3
+++ tests/stresstest.at 27 Apr 2005 17:52:58 -0000
@@ -22,12 +22,8 @@
# Note: This test is experimental, and might be too strict for some systems.
AT_BANNER([Libtool stress test.])
-
AT_SETUP([Link option thorough search test])
-
-: ${LIBTOOL=${abs_top_builddir}/libtool}
-
-eval `$LIBTOOL --config | grep ^CC=`
+eval `$LIBTOOL --config | $EGREP '^(CC|objdir)='`
mkdir sub sub2 sub3 2>/dev/null
@@ -52,6 +48,23 @@
large v15 = { { 1 } };
]])
+AT_DATA(asyms,
+[[v1
+v3
+v4
+v5
+v6
+v7
+v8
+v9
+v10
+v11
+v12
+v13
+v14
+v15
+]])
+
AT_DATA(b.c,
[[int b = 42;
int b3 = 1;
@@ -142,38 +155,47 @@
w6
w7
w8$
-^w9*
-w1*
-b.*
+w9
+w10
+w11
+w12
+w13
+w14
+w15
]])
-AT_CHECK([$LIBTOOL --mode=compile $CC -c a.c -o sub/a.lo],[0],[ignore],[])
-AT_CHECK([$LIBTOOL --mode=compile $CC -c b.c -o sub/b.o],[0],[ignore],[])
-AT_CHECK([$LIBTOOL --mode=compile $CC -c main.c],[0],[ignore],[])
-AT_CHECK([$LIBTOOL --mode=compile $CC -c dlself.c -o
sub3/dlself.lo],[0],[ignore],[])
+AT_CHECK([$LIBTOOL --mode=compile $CC $CFLAGS -c a.c -o
sub/a.lo],[0],[ignore],[ignore])
+AT_CHECK([$LIBTOOL --mode=compile $CC $CFLAGS -c b.c -o
sub/b.lo],[0],[ignore],[ignore])
+AT_CHECK([$LIBTOOL --mode=compile $CC $CFLAGS -c main.c],[0],[ignore],[ignore])
+AT_CHECK([$LIBTOOL --mode=compile $CC $CFLAGS -c dlself.c -o
sub3/dlself.lo],[0],[ignore],[ignore])
+
+case $host in
+ cygwin* | mingw* | pw32*) undef_opts=-no-undefined ;;
+ *) undef_opts='"" -no-undefined' ;;
+esac
-for l1 in '' '-no-undefined'
+for l1 in $undef_opts
do
- for l2 in '' '-export-symbols-regex v.*'
+ for l2 in '' '-export-symbols-regex v.*' '-export-symbols asyms'
do
for l3 in '' '-rpath /nonexistent'
do
linkargs="$l1 $l2 $l3"
for rel in '' ./ `pwd`/
do
- AT_CHECK([$LIBTOOL --mode=link $CC -o "$rel"sub2/liba.la "$rel"sub/a.lo
$linkargs],
- [0],[ignore],[])
+ AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o
"$rel"sub2/liba.la "$rel"sub/a.lo $linkargs],
+ [0],[ignore],[ignore])
for st in '' '-static'
do
- AT_CHECK([$LIBTOOL --mode=link $CC $st -o "$rel"main "$rel"main.lo
"$rel"sub2/liba.la],
- [0],[ignore],[])
- AT_CHECK([./main],[0])
+ AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS $st -o "$rel"main
"$rel"main.lo "$rel"sub2/liba.la],
+ [0],[ignore],[ignore])
+ LT_AT_EXEC_CHECK([./main],[0])
for l10 in '' '-export-symbols dlselfsyms'
do
- AT_CHECK([$LIBTOOL --mode=link $CC $st -o "$rel"sub3/dlself
"$rel"sub3/dlself.lo "$rel"sub2/liba.la sub/b.o -dlopen self $l10],
- [0],[ignore],[])
- AT_CHECK([./sub3/dlself],[0])
+ AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS $st -o
"$rel"sub3/dlself "$rel"sub3/dlself.lo "$rel"sub2/liba.la sub/b.lo -dlopen self
$l10],
+ [0],[ignore],[ignore])
+ LT_AT_EXEC_CHECK([./sub3/dlself],[0])
done
done
done
Index: tests/template.at
===================================================================
RCS file: /cvsroot/libtool/libtool/tests/template.at,v
retrieving revision 1.2
diff -u -r1.2 template.at
--- tests/template.at 22 Apr 2005 10:10:30 -0000 1.2
+++ tests/template.at 27 Apr 2005 17:52:58 -0000
@@ -21,10 +21,7 @@
AT_BANNER([C++ template tests.])
AT_SETUP([simple template test])
-
-: ${LIBTOOL=${abs_top_builddir}/libtool}
-eval `$LIBTOOL --tag=CXX --config | grep ^CC=`
-CXX=$CC
+LT_AT_TAG([CXX])
AT_DATA(aclib.h,
[[int cf(int);
@@ -80,7 +77,6 @@
}
]])
-
AT_CHECK($LIBTOOL --tag=CXX --mode=compile $CXX -I. $CPPFLAGS $CXXFLAGS -c -o
alib.lo alib.cc, [0], [ignore], [ignore])
AT_CHECK($LIBTOOL --tag=CXX --mode=compile $CXX -I. $CPPFLAGS $CXXFLAGS -c -o
aclib.lo aclib.cc, [0], [ignore], [ignore])
AT_CHECK($LIBTOOL --tag=CXX --mode=link $CXX $CPPFLAGS $CXXFLAGS -o
libaclib.la aclib.lo, [0], [ignore], [ignore])
@@ -88,7 +84,7 @@
AT_CHECK($CXX -I. $CPPFLAGS $CXXFLAGS -c -o prog.o prog.cc, [0], [ignore],
[ignore])
AT_CHECK($LIBTOOL --tag=CXX --mode=link $CXX $CPPFLAGS $CXXFLAGS -o prog
prog.o libalib.la, [0], [ignore], [ignore])
-AT_CHECK([./prog$EXEEXT], [0], [a sample prog
+LT_AT_EXEC_CHECK([./prog], [0], [a sample prog
f(3) = 6
cf(3) = 9
], [ignore])
@@ -98,6 +94,7 @@
dnl AT_DATA(configure.ac,
dnl [[AC_INIT([template_1], ]]AT_PACKAGE_VERSION[[, ]]AT_PACKAGE_BUGREPORT[[)
+dnl AC_CONFIG_HEADERS([config.h:config-h.in])
dnl AC_CONFIG_MACRO_DIR([m4])
dnl AC_CONFIG_AUX_DIR([config])
dnl AM_INIT_AUTOMAKE([foreign])
@@ -124,13 +121,9 @@
AT_CLEANUP
-
AT_SETUP([template test with subdirs])
-
-: ${LIBTOOL=${abs_top_builddir}/libtool}
-eval `$LIBTOOL --tag=CXX --config | grep ^CC=`
-CXX=$CC
-CPPFLAGS="-I../src/lib -I../src/lib2"
+LT_AT_TAG([CXX])
+CPPFLAGS="$CPPFLAGS -I../src/lib -I../src/lib2"
mkdir src obj
( cd src; mkdir lib lib2 sub )
@@ -213,30 +206,30 @@
AT_CHECK($LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS -o lib/liba.la
lib/a.lo, [0], [ignore], [ignore])
AT_CHECK($LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS -o lib2/libb.la
lib2/b.lo, [0], [ignore], [ignore])
AT_CHECK($LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS -o sub/main sub/main.o
lib2/libb.la lib/liba.la, [0], [ignore], [ignore])
-AT_CHECK([./sub/main$EXEEXT], [ignore])
+LT_AT_EXEC_CHECK([./sub/main], [ignore])
# lib convenience
AT_CHECK($LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS -o lib2/libb.la
lib2/b.lo -rpath /foo, [0], [ignore], [ignore])
AT_CHECK($LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS -o sub/main sub/main.o
lib2/libb.la lib/liba.la, [0], [ignore], [ignore])
-AT_CHECK([./sub/main$EXEEXT])
+LT_AT_EXEC_CHECK([./sub/main])
# both installed
AT_CHECK($LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS -o lib/liba.la lib/a.lo
-rpath /foo, [0], [ignore], [ignore])
AT_CHECK($LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS -o lib2/libb.la
lib2/b.lo -rpath /bar, [0], [ignore], [ignore])
AT_CHECK($LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS -o sub/main sub/main.o
lib2/libb.la lib/liba.la, [0], [ignore], [ignore])
-AT_CHECK([./sub/main$EXEEXT])
+LT_AT_EXEC_CHECK([./sub/main])
# both convenience, libb depending on liba
AT_CHECK($LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS -o lib/liba.la
lib/a.lo, [0], [ignore], [ignore])
AT_CHECK($LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS -o lib2/libb.la
lib2/b.lo lib/liba.la, [0], [ignore], [ignore])
AT_CHECK($LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS -o sub/main sub/main.o
lib2/libb.la, [0], [ignore], [ignore])
-AT_CHECK([./sub/main$EXEEXT])
+LT_AT_EXEC_CHECK([./sub/main])
# lib convenience
AT_CHECK($LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS -o lib2/libb.la
lib2/b.lo lib/liba.la -rpath /foo, [0], [ignore], [ignore])
AT_CHECK($LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS -o sub/main sub/main.o
lib2/libb.la, [0], [ignore], [ignore])
-AT_CHECK([./sub/main$EXEEXT])
+LT_AT_EXEC_CHECK([./sub/main])
# both installed
AT_CHECK($LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS -o lib/liba.la lib/a.lo
-rpath /foo, [0], [ignore], [ignore])
AT_CHECK($LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS -o lib2/libb.la
lib2/b.lo lib/liba.la -rpath /bar, [0], [ignore], [ignore])
AT_CHECK($LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS -o sub/main sub/main.o
lib2/libb.la, [0], [ignore], [ignore])
-AT_CHECK([./sub/main$EXEEXT])
+LT_AT_EXEC_CHECK([./sub/main])
cd ..
@@ -244,6 +237,7 @@
dnl
dnl AT_DATA(src/configure.ac,
dnl [[AC_INIT([template_2], ]]AT_PACKAGE_VERSION[[, ]]AT_PACKAGE_BUGREPORT[[)
+dnl AC_CONFIG_HEADERS([config.h:config-h.in])
dnl AC_CONFIG_MACRO_DIR([m4])
dnl AC_CONFIG_AUX_DIR([config])
dnl AM_INIT_AUTOMAKE([foreign subdir-objects])
--- /dev/null 2005-04-20 12:19:39.420719856 +0200
+++ tests/convenience.at 2005-04-27 18:15:56.000000000 +0200
@@ -0,0 +1,158 @@
+# Hand crafted tests for GNU Libtool. -*- Autotest -*-
+# Copyright 2005 Free Software Foundation, Inc.
+
+# This program 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, or (at your option)
+# any later version.
+
+# This program 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 this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+# Test that convenience archives work.
+
+AT_SETUP([C convenience archives])
+
+echo 'int a(void) { return 1; }' > a.c
+echo 'int b(void) { return 2; }' > b.c
+echo 'int c(void) { return 3; }' > c.c
+AT_DATA(main.c,
+[[extern int a(void), b(void), c(void);
+int main(void) { return a() + b() + c() != 6; }
+]])
+
+$LIBTOOL --mode=compile $CC $CFLAGS -c a.c
+$LIBTOOL --mode=compile $CC $CFLAGS -c b.c
+$LIBTOOL --mode=compile $CC $CFLAGS -c c.c
+$LIBTOOL --mode=compile $CC $CFLAGS -c main.c
+$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o liba.la a.lo
+$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o libb.la b.lo
+$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o libcee.la c.lo liba.la libb.la
-rpath /notexist
+AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -static -o main_static
main.lo libcee.la],
+ [0],[ignore],[ignore])
+AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o main main.lo libcee.la],
+ [0],[ignore],[ignore])
+LT_AT_EXEC_CHECK([./main_static])
+LT_AT_EXEC_CHECK([./main])
+AT_CLEANUP
+
+
+AT_SETUP([C++ convenience archives])
+LT_AT_TAG([CXX])
+
+echo 'int a(void) { return 1; }' > a.cc
+echo 'int b(void) { return 2; }' > b.cc
+echo 'int c(void) { return 3; }' > c.cc
+AT_DATA(main.cc,
+[[extern int a(void), b(void), c(void);
+int main(void) { return a() + b() + c() != 6; }
+]])
+
+$LIBTOOL --tag=CXX --mode=compile $CXX $CXXFLAGS -c a.cc
+$LIBTOOL --tag=CXX --mode=compile $CXX $CXXFLAGS -c b.cc
+$LIBTOOL --tag=CXX --mode=compile $CXX $CXXFLAGS -c c.cc
+$LIBTOOL --tag=CXX --mode=compile $CXX $CXXFLAGS -c main.cc
+$LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS $LDFLAGS -o liba.la a.lo
+$LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS $LDFLAGS -o libb.la b.lo
+$LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS $LDFLAGS -o libcee.la c.lo
liba.la libb.la -rpath /notexist
+AT_CHECK([$LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS $LDFLAGS -static -o
main_static main.lo libcee.la],
+ [0],[ignore],[ignore])
+AT_CHECK([$LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS $LDFLAGS -o main
main.lo libcee.la],
+ [0],[ignore],[ignore])
+LT_AT_EXEC_CHECK([./main_static])
+LT_AT_EXEC_CHECK([./main])
+AT_CLEANUP
+
+
+AT_SETUP([F77 convenience archives])
+LT_AT_TAG([F77])
+
+AT_DATA([a.f],
+[[ subroutine a
+ return
+ end
+]])
+AT_DATA([b.f],
+[[ subroutine b
+ return
+ end
+]])
+AT_DATA([c.f],
+[[ subroutine c
+ return
+ end
+]])
+AT_DATA(main.f,
+[[ program main
+ call a
+ call b
+ call c
+ end
+]])
+
+$LIBTOOL --tag=F77 --mode=compile $F77 $FFLAGS -c a.f
+$LIBTOOL --tag=F77 --mode=compile $F77 $FFLAGS -c b.f
+$LIBTOOL --tag=F77 --mode=compile $F77 $FFLAGS -c c.f
+$LIBTOOL --tag=F77 --mode=compile $F77 $FFLAGS -c main.f
+$LIBTOOL --tag=F77 --mode=link $F77 $FFLAGS $LDFLAGS -o liba.la a.lo
+$LIBTOOL --tag=F77 --mode=link $F77 $FFLAGS $LDFLAGS -o libb.la b.lo
+$LIBTOOL --tag=F77 --mode=link $F77 $FFLAGS $LDFLAGS -o libcee.la c.lo liba.la
libb.la -rpath /notexist
+AT_CHECK([$LIBTOOL --tag=F77 --mode=link $F77 $FFLAGS $LDFLAGS -static -o
main_static main.lo libcee.la],
+ [0],[ignore],[ignore])
+AT_CHECK([$LIBTOOL --tag=F77 --mode=link $F77 $FFLAGS $LDFLAGS -o main main.lo
libcee.la],
+ [0],[ignore],[ignore])
+LT_AT_EXEC_CHECK([./main_static])
+LT_AT_EXEC_CHECK([./main])
+AT_CLEANUP
+
+
+AT_SETUP([Java convenience archives])
+LT_AT_TAG([GCJ])
+
+AT_DATA([A.java],
+[[public class A {
+ private int a;
+ public void A () { a = 0; }
+};
+]])
+AT_DATA([B.java],
+[[public class B {
+ private int b;
+ public void B () { b = 0; }
+};
+]])
+AT_DATA([C.java],
+[[public class C {
+ private int c;
+ public void C () { c = 0; }
+};
+]])
+AT_DATA(foo.java,
+[[public class foo {
+ public static void main(String[] argv) {
+ A a = new A(); B b = new B(); C c = new C();
+ }
+}
+]])
+
+$LIBTOOL --tag=GCJ --mode=compile $GCJ $GCJFLAGS -c A.java
+$LIBTOOL --tag=GCJ --mode=compile $GCJ $GCJFLAGS -c B.java
+$LIBTOOL --tag=GCJ --mode=compile $GCJ $GCJFLAGS -c C.java
+$LIBTOOL --tag=GCJ --mode=compile $GCJ $GCJFLAGS -c foo.java
+$LIBTOOL --tag=GCJ --mode=link $GCJ $GCJFLAGS $LDFLAGS -o liba.la A.lo
+$LIBTOOL --tag=GCJ --mode=link $GCJ $GCJFLAGS $LDFLAGS -o libb.la B.lo
+$LIBTOOL --tag=GCJ --mode=link $GCJ $GCJFLAGS $LDFLAGS -o libcee.la C.lo
liba.la libb.la -rpath /notexist
+AT_CHECK([$LIBTOOL --tag=GCJ --mode=link $GCJ $GCJFLAGS $LDFLAGS -static
--main=foo -o main_static foo.lo libcee.la],
+ [0],[ignore],[ignore])
+AT_CHECK([$LIBTOOL --tag=GCJ --mode=link $GCJ $GCJFLAGS $LDFLAGS --main=foo -o
main foo.lo libcee.la],
+ [0],[ignore],[ignore])
+LT_AT_EXEC_CHECK([./main_static])
+LT_AT_EXEC_CHECK([./main])
+AT_CLEANUP