]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
Fix -rpath arguments for nobase_*_LTLIBRARIES.
authorRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Sat, 20 Sep 2008 10:12:42 +0000 (12:12 +0200)
committerRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Sat, 20 Sep 2008 10:12:42 +0000 (12:12 +0200)
* automake.in (handle_ltlibraries): New hash %instsubdirs to
track the dirname of nobase ltlibraries, and tack it onto the
end of the -rpath argument.  Also, fix the warning about ltlibs
installed in multiple locations to fit a bit better.
* tests/pr300-ltlib.test: Expose this bug here.
* tests/ltinstloc.test: New test.
* tests/Makefile.am: Update.
* NEWS: Update.

Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
ChangeLog
NEWS
automake.in
tests/Makefile.am
tests/Makefile.in
tests/ltinstloc.test [new file with mode: 0755]
tests/pr300-ltlib.test

index f481274709a836b3ca58a0105f6893321166b56c..ba25fcdca1df0e47f57b1747767cf866abd2dc09 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
 2008-09-20  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
 
+       Fix -rpath arguments for nobase_*_LTLIBRARIES.
+       * automake.in (handle_ltlibraries): New hash %instsubdirs to
+       track the dirname of nobase ltlibraries, and tack it onto the
+       end of the -rpath argument.  Also, fix the warning about ltlibs
+       installed in multiple locations to fit a bit better.
+       * tests/pr300-ltlib.test: Expose this bug here.
+       * tests/ltinstloc.test: New test.
+       * tests/Makefile.am: Update.
+       * NEWS: Update.
+
        Man pages for automake and aclocal.
        * configure.ac (HELP2MAN): New substitution.
        * doc/Makefile.am (dist_man1_MANS, MAINTAINERCLEANFILES)
diff --git a/NEWS b/NEWS
index dac6a9ec2818cbe16f79542842c0d253100d18f6..9c4dc91d720fb8be02e615664fbbb68c47f1857b 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -81,6 +81,9 @@ Bugs fixed in 1.10a:
 
   - Fix aix dependency tracking for libtool objects.
 
+  - For nobase_*_LTLIBRARIES with nonempty directory components, the
+    correct `-rpath' argument is used now.
+
 * Bugs introduced by 1.10:
 
   - Fix output of dummy dependency files in presence of post-processed
index baaac964b92b3d2933018cf2515c6818b9785587..54f68657bf7742a88d93b0d798cb7ebbdb83e544 100755 (executable)
@@ -2626,13 +2626,20 @@ sub handle_ltlibraries
     }
 
   my %instdirs = ();
+  my %instsubdirs = ();
   my %instconds = ();
   my %liblocations = ();       # Location (in Makefile.am) of each library.
 
   foreach my $key (@prefix)
     {
       # Get the installation directory of each library.
-      (my $dir = $key) =~ s/^nobase_//;
+      my $dir = $key;
+      my $strip_subdir = 1;
+      if ($dir =~ /^nobase_/)
+        {
+         $dir =~ s/^nobase_//;
+         $strip_subdir = 0;
+       }
       my $var = rvar ($key . '_LTLIBRARIES');
 
       # We reject libraries which are installed in several places
@@ -2644,6 +2651,9 @@ sub handle_ltlibraries
           my ($var, $val, $cond, $full_cond) = @_;
           my $hcond = $full_cond->human;
           my $where = $var->rdef ($cond)->location;
+          my $ldir = '';
+          $ldir = '/' . dirname ($val)
+            if (!$strip_subdir);
           # A library cannot be installed in different directory
           # in overlapping conditions.
           if (exists $instconds{$val})
@@ -2654,8 +2664,7 @@ sub handle_ltlibraries
               if ($msg)
                 {
                   error ($where, $msg, partial => 1);
-
-                  my $dirtxt = "installed in `$dir'";
+                  my $dirtxt = "installed " . ($strip_subdir ? "in" : "below") . " `$dir'";
                   $dirtxt = "built for `$dir'"
                     if $dir eq 'EXTRA' || $dir eq 'noinst' || $dir eq 'check';
                   my $dircond =
@@ -2686,6 +2695,7 @@ sub handle_ltlibraries
               $instconds{$val} = new Automake::DisjConditions;
             }
           $instdirs{$val}{$full_cond} = $dir;
+          $instsubdirs{$val}{$full_cond} = $ldir;
           $liblocations{$val}{$full_cond} = $where;
           $instconds{$val} = $instconds{$val}->merge ($full_cond);
         },
@@ -2789,6 +2799,8 @@ sub handle_ltlibraries
          else
            {
              $val = ('-rpath $(' . $instdirs{$onelib}{$rcond} . 'dir)');
+             $val .= $instsubdirs{$onelib}{$rcond}
+               if defined $instsubdirs{$onelib}{$rcond};
            }
          if ($rcond->true)
            {
index 71467700bd147d141955c6f20ccb74f7c1fc8351..4445c4036f2cbdfb196b19bc0e3f06cf3d301e22 100644 (file)
@@ -376,6 +376,7 @@ ltcond.test \
 ltcond2.test \
 ltconv.test \
 ltdeps.test \
+ltinstloc.test \
 ltlibobjs.test \
 ltlibsrc.test \
 lzma.test \
index 1d9053616f2e9ca9bd9bf0688de6b2e16080d268..4cd51e78553212e6c37ca83f26801cad0a0ee7f3 100644 (file)
@@ -528,6 +528,7 @@ ltcond.test \
 ltcond2.test \
 ltconv.test \
 ltdeps.test \
+ltinstloc.test \
 ltlibobjs.test \
 ltlibsrc.test \
 lzma.test \
diff --git a/tests/ltinstloc.test b/tests/ltinstloc.test
new file mode 100755 (executable)
index 0000000..d6122fd
--- /dev/null
@@ -0,0 +1,65 @@
+#!/bin/sh
+# Copyright (C) 2008  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 3, 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, see <http://www.gnu.org/licenses/>.
+
+# Test for libtool errors for multiple install locations, esp. with nobase.
+
+
+required='libtoolize'
+. ./defs || Exit 1
+
+set -e
+
+cat >>configure.in <<'END'
+AC_PROG_CC
+AC_PROG_LIBTOOL
+AM_CONDITIONAL([COND], [:])
+AC_OUTPUT
+END
+
+cat >Makefile.am <<'END'
+if COND
+lib_LTLIBRARIES = liba1.la sub/liba2.la
+#else
+pkglib_LTLIBRARIES = liba1.la
+nobase_lib_LTLIBRARIES = sub/liba2.la
+endif
+END
+
+libtoolize
+$ACLOCAL
+$AUTOCONF
+AUTOMAKE_fails --add-missing
+
+cat >expected <<'END'
+configure.in:5: installing `./config.guess'
+configure.in:5: installing `./config.sub'
+Makefile.am:5: sub/liba2.la multiply defined in condition COND
+Makefile.am:5: `sub/liba2.la' should be installed below `lib' in condition COND ...
+Makefile.am:2: ... and should also be installed in `lib' in condition COND.
+Makefile.am:4: liba1.la multiply defined in condition COND
+Makefile.am:4: `liba1.la' should be installed in `pkglib' in condition COND ...
+Makefile.am:2: ... and should also be installed in `lib' in condition COND.
+Makefile.am:2: Libtool libraries can be built for only one destination.
+END
+
+diff stderr expected
+
+sed 's/#//' < Makefile.am > t
+mv -f t Makefile.am
+
+$AUTOMAKE
+grep ' -rpath \$(libdir)/sub' Makefile.in
+:
index c864d44a7a4a03ac3d963cfcd5f312e2de59372c..99c03da2a000000512cfb7809527589cf22261e8 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2002, 2007  Free Software Foundation, Inc.
+# Copyright (C) 2002, 2007, 2008  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
@@ -48,12 +48,19 @@ $ACLOCAL
 $AUTOCONF
 $AUTOMAKE --copy --add-missing
 ./configure --prefix "`pwd`/inst"
-$MAKE
+$MAKE >stdout
+cat stdout
+
+grep 'liba.la .*-rpath .*lib' stdout
+grep 'liba.la .*-rpath .*lib/subdir' stdout && Exit 1
+grep 'libb.la .*-rpath .*lib/subdir' stdout
 
 test -f subdir/liba.la
 test -f subdir/libb.la
 
-$MAKE install
+$MAKE install 2>stderr
+cat stderr >&2
+grep 'remember.*--finish' stderr && Exit 1
 
 test -f inst/lib/liba.la
 test -f inst/lib/subdir/libb.la