summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRalf Wildenhues <Ralf.Wildenhues@gmx.de>2006-10-24 20:30:05 +0000
committerRalf Wildenhues <Ralf.Wildenhues@gmx.de>2006-10-24 20:30:05 +0000
commitaa546b46c06cfc3fec6cb9923c2d5623f6f9d708 (patch)
treefa90b4f7dd26f8f9d9a6de38d45ce6e6163981f6
parent33755ffbf58e1607bd7b3e99ab2647ad14144a19 (diff)
downloadlibtool-aa546b46c06cfc3fec6cb9923c2d5623f6f9d708.tar.gz
* tests/link-order2.at: New test to show one case where ordering
of depdepls on the command line matters. * Makefile.am: Adjust.
-rw-r--r--ChangeLog4
-rw-r--r--Makefile.am1
-rw-r--r--tests/link-order2.at69
3 files changed, 74 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 9838109d..219af191 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
2006-10-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+ * tests/link-order2.at: New test to show one case where ordering
+ of depdepls on the command line matters.
+ * Makefile.am: Adjust.
+
* tests/tagtrace.test: SKIP if `autoconf --trace' exits 63 or 1,
for various possible (valid) error cases. Also output stderr,
to help with analysis.
diff --git a/Makefile.am b/Makefile.am
index 2f316fa5..698e18a5 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -403,6 +403,7 @@ TESTSUITE_AT = tests/testsuite.at \
tests/inherited_flags.at \
tests/convenience.at \
tests/link-order.at \
+ tests/link-order2.at \
tests/fail.at \
tests/shlibpath.at \
tests/static.at \
diff --git a/tests/link-order2.at b/tests/link-order2.at
new file mode 100644
index 00000000..74c8aefa
--- /dev/null
+++ b/tests/link-order2.at
@@ -0,0 +1,69 @@
+# Hand crafted tests for GNU Libtool. -*- Autotest -*-
+# Copyright 2006 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., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA.
+
+# link-order2.test: make sure that depdepls are added right after
+# the libs that pull them in: necessary at least for static linking
+# and on systems where libraries do not link against other libraries,
+# in order to do this: override a commonly used symbol in a commonly
+# used library.
+
+AT_SETUP([Link order of deplibs.])
+AT_KEYWORDS([libtool])
+LDFLAGS="$LDFLAGS -no-undefined"
+libdir=`pwd`/inst/lib
+mkdir inst inst/bin inst/lib
+
+cat >a.c <<\EOF
+/* pretend we have a better sine function */
+double sin (double x) { return 0.0; }
+EOF
+
+cat >b.c <<\EOF
+extern double sin (double);
+double b (double x) { return sin (x); }
+EOF
+
+cat >main.c <<\EOF
+#include <math.h>
+extern double b (double);
+int main (void)
+{
+ return fabs (b (3.1415 / 2.)) < 0.01 && fabs (sqrt (4.) - 2.) < 0.01;
+}
+EOF
+
+$LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c a.c
+$LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c b.c
+$CC $CPPFLAGS $CFLAGS -c main.c
+for static in '' -static; do
+ $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS $static -o liba.la a.lo -rpath $libdir
+ $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS $static -o libb.la b.lo liba.la -rpath $libdir
+ $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o main main.$OBJEXT libb.la -lm
+ LT_AT_EXEC_CHECK([./main])
+ $LIBTOOL --mode=install cp liba.la $libdir/liba.la
+ $LIBTOOL --mode=install cp libb.la $libdir/libb.la
+ $LIBTOOL --mode=install cp main $bindir/main
+ $LIBTOOL --mode=clean rm -f liba.la libb.la
+ LT_AT_EXEC_CHECK([$bindir/main])
+done
+
+
+# Now the converse: if both the program and the library need libm, then
+# it needs to be sorted last. (TODO)
+
+AT_CLEANUP