libtool-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

detect identical deplibs


From: Ralf Wildenhues
Subject: detect identical deplibs
Date: Fri, 30 Sep 2005 15:13:43 +0200
User-agent: Mutt/1.5.11

Current libtool (both branch-1-5 and CVS HEAD) does not detect identical
deplibs in all cases:
  sub/liba.la
  ../sub/liba.la
  ../../sub/liba.la
  $top_builddir/sub/liba.la
  $abs_top_builddir/sub/liba.la
  -Lsub -la
  /sub/.libs/liba.a

or even referenced through symlinks, may all refer to the same library.
I'm not certain that we're required to detect all of these cases.  We
not not recommend to use the last two for in-tree deplibs and in fact,
we recommend using relative paths in all cases, but they can still break
down (I believe one of them is converted to absolute and the other is
not, while comparing).

The patch below does not change libtool behavior but adds a test
exposing the issue.  Fixing the actual failure may be a bit hairy, and
I'm not sure we should fix the `-Lsub -la' case, so I'm not going for it
right away.

OK to apply?

Cheers,
Ralf

        * tests/deplibs-ident.at: New file with XFAIL test to expose
        wrong multiple listing of a deplib on the command line.
        * Makefile.am, tests/testsuite.at: Updated.
        Reported by Brian Barrett <address@hidden>.

--- /dev/null   2005-08-03 12:45:51.659987528 +0200
+++ tests/deplibs-ident.at      2005-09-30 12:02:25.000000000 +0200
@@ -0,0 +1,93 @@
+# 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., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA.
+
+
+AT_BANNER([Detecting identical deplibs.])
+
+
+## ----------------------------------------------- ##
+## Different relative paths within the build tree. ##
+## ----------------------------------------------- ##
+
+AT_SETUP([build tree relpaths])
+
+mkdir a a/b c
+
+AT_DATA([configure.ac],
+[[AC_INIT([multiple-refs], ]]AT_PACKAGE_VERSION[[, ]]AT_PACKAGE_BUGREPORT[[)
+AM_INIT_AUTOMAKE([foreign])
+AC_PROG_CC
+AM_PROG_LIBTOOL
+AC_CONFIG_FILES([Makefile a/Makefile a/b/Makefile c/Makefile])
+AC_OUTPUT
+]])
+
+AT_DATA([Makefile.am],
+[[SUBDIRS = c a
+]])
+
+AT_DATA([a/Makefile.am],
+[[SUBDIRS = . b
+lib_LTLIBRARIES = liba1.la liba2.la liba3.la liba4.la
+liba1_la_LIBADD = ../c/libcee.la
+liba2_la_LIBADD = $(top_builddir)/c/libcee.la
+liba3_la_LIBADD = $(abs_top_builddir)/c/libcee.la
+liba4_la_LIBADD = -L../c -lcee
+]])
+
+AT_DATA([a/b/Makefile.am],
+[[bin_PROGRAMS = b
+LDADD = ../liba1.la ../liba2.la ../liba3.la ../liba4.la ../../c/libcee.la
+]])
+
+AT_DATA([c/Makefile.am],
+[[lib_LTLIBRARIES = libcee.la
+]])
+
+AT_DATA([a/liba1.c],
+[[extern int c(void);
+int a1() { return c(); }
+]])
+
+for i in 2 3 4; do
+  sed "s,1,$i,g" < a/liba1.c > a/liba$i.c
+done
+
+AT_DATA([a/b/b.c],
+[[extern int a1(void), a2(void), a3(void), a4(void), c(void);
+int main() { return a1() + a2() + a3() + a4() + c(); }
+]])
+
+AT_DATA([c/libcee.c],
+[[int c() { return 0; }
+]])
+
+LT_AT_LIBTOOLIZE
+$ACLOCAL -I ${macrodir} || exit 1
+$AUTOMAKE -a || exit 1
+$AUTOCONF || exit 1
+./configure
+${MAKE}
+(
+  cd a/b
+  rm b
+  AT_CHECK([$MAKE b | $EGREP 'cee.*cee'], 1, [ignore], [ignore])
+)
+AT_XFAIL_IF(:) dnl This is currently broken in libtool
+
+AT_CLEANUP
Index: Makefile.am
===================================================================
RCS file: /cvsroot/libtool/libtool/Makefile.am,v
retrieving revision 1.167
diff -u -r1.167 Makefile.am
--- Makefile.am 30 Sep 2005 00:46:52 -0000      1.167
+++ Makefile.am 30 Sep 2005 10:11:15 -0000
@@ -472,6 +483,7 @@
                  tests/libtoolize.at \
                  tests/old-m4-iface.at \
                  tests/standalone.at \
+                 tests/deplibs-ident.at \
                  tests/stresstest.at \
                  tests/link-order.at \
                  tests/convenience.at \
Index: tests/testsuite.at
===================================================================
RCS file: /cvsroot/libtool/libtool/tests/testsuite.at,v
retrieving revision 1.21
diff -u -r1.21 testsuite.at
--- tests/testsuite.at  30 Sep 2005 00:46:52 -0000      1.21
+++ tests/testsuite.at  30 Sep 2005 10:11:16 -0000
@@ -24,13 +24,16 @@
 : ${ACLOCAL=aclocal}
 : ${AUTOHEADER=autoheader}
 : ${AUTOCONF=autoconf}
+: ${AUTOMAKE=automake}
 : ${AUTORECONF=autoreconf}
-export LIBTOOLIZE LIBTOOL ACLOCAL AUTOHEADER AUTOCONF AUTORECONF
+export LIBTOOLIZE LIBTOOL ACLOCAL AUTOHEADER AUTOCONF AUTOMAKE AUTORECONF
 macrodir="$abs_top_srcdir/libltdl/m4"
 eval `$LIBTOOL --config | grep ^EGREP=`
 eval `$LIBTOOL --config | $EGREP '^(host|host_os|build)='`
 m4_divert_pop([PREPARE_TESTS])dnl
 
+
 # LT_AT_LIBTOOLIZE([ARGS])
 # ------------------------
 m4_define([LT_AT_LIBTOOLIZE],
@@ -108,5 +121,7 @@
 m4_include([template.at])
 # Behaviour of LT_OUTPUT
 m4_include([early-libtool.at])
+# identical deplibs
+m4_include([deplibs-ident.at])
 # stress test
 m4_include([stresstest.at])




reply via email to

[Prev in Thread] Current Thread [Next in Thread]