]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
* libltdl/config/ltmain.m4sh (extracted_archives)
authorRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Sun, 5 Feb 2006 11:06:31 +0000 (11:06 +0000)
committerRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Sun, 5 Feb 2006 11:06:31 +0000 (11:06 +0000)
(extracted_serial): New globals.
(func_extract_archives): Use them to rename extraction archives
for linking against multiple convenience libraries with the same
name.
* tests/duplicate_conv.at: New tests.
* Makefile.am: Adjusted.
Reported by Carlo Contavalli <ccontavalli@commedia.it>.

ChangeLog
Makefile.am
libltdl/config/ltmain.m4sh
tests/duplicate_conv.at [new file with mode: 0644]

index a140c542568ada2cdb2b1c7cb2dc88356201bae0..404f6db504e8e6c8610d9eaf6bbf0ead6a259b10 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 2006-02-05  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
 
+       * libltdl/config/ltmain.m4sh (extracted_archives)
+       (extracted_serial): New globals.
+       (func_extract_archives): Use them to rename extraction archives
+       for linking against multiple convenience libraries with the same
+       name.
+       * tests/duplicate_conv.at: New tests.
+       * Makefile.am: Adjusted.
+       Reported by Carlo Contavalli <ccontavalli@commedia.it>.
+
        * libltdl/config/ltmain.m4sh (func_mode_link) < test_compile >:
        Fix a couple of instances where `test .. -ne ..' would possibly
        compare non-numbers.  Clean up a bit.
index 3ee92e40f8250433dc96f4db9a92a8846ecb9783..6fb921b6b86afb3415a72de2b66e07ae451fc2c3 100644 (file)
@@ -384,6 +384,7 @@ TESTSUITE   = tests/testsuite
 TESTSUITE_AT   = tests/testsuite.at \
                  tests/libtoolize.at \
                  tests/duplicate_members.at \
+                 tests/duplicate_conv.at \
                  tests/inherited_flags.at \
                  tests/convenience.at \
                  tests/link-order.at \
index f80a7db3c7451914fce0ac27e901214c4c3e650c..dc0fdc6284190568d42776819217b99d20541280 100644 (file)
@@ -116,6 +116,8 @@ execute_dlfiles=
 preserve_args=
 lo2o="s/\\.lo\$/.${objext}/"
 o2lo="s/\\.${objext}\$/.lo/"
+extracted_archives=
+extracted_serial=0
 
 opt_dry_run=false
 opt_duplicate_deps=false
@@ -1058,7 +1060,17 @@ func_extract_archives ()
       esac
       func_basename "$my_xlib"
       my_xlib="$func_basename_result"
-      my_xdir="$my_gentop/$my_xlib"
+      my_xlib_u=$my_xlib
+      while :; do
+        case " $extracted_archives " in
+       *" $my_xlib_u "*)
+         extracted_serial=`expr $extracted_serial + 1`
+         my_xlib_u=lt$extracted_serial-$my_xlib ;;
+       *) break ;;
+       esac
+      done
+      extracted_archives="$extracted_archives $my_xlib_u"
+      my_xdir="$my_gentop/$my_xlib_u"
 
       func_mkdir_p "$my_xdir"
 
diff --git a/tests/duplicate_conv.at b/tests/duplicate_conv.at
new file mode 100644 (file)
index 0000000..d2bd915
--- /dev/null
@@ -0,0 +1,81 @@
+# 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.
+
+AT_SETUP([duplicate convenience archive names])
+AT_KEYWORDS([libtool])
+
+# 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 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 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 main.$OBJEXT ./libcee.la],
+        [0], [ignore], [ignore])
+LT_AT_EXEC_CHECK([./main],[0],[ignore],[ignore])
+$LIBTOOL --mode=clean rm -f libcee.la
+
+# 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 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