title: libtool doesn't provide library dependencies to link
body: <p>I am using libtool 2.2.6b on ubuntu lucid, and libtool 2.4.2 on ubuntu precise.  On lucid my project will link properly. On precise it fails to link.  Here's example code that demonstrates my problem;</p>
  
  <p>configure.ac</p>
  
  <pre><code>AC_INIT([ltp], [0.0.1], [someone])
  AM_INIT_AUTOMAKE
  AC_CONFIG_HEADERS([config.h])
  AC_CONFIG_MACRO_DIR([.m4])
  AC_CONFIG_FILES([Makefile foo/Makefile bar/Makefile wah/Makefile])
  AC_PROG_CXX
  AC_PROG_LIBTOOL
  AM_SANITY_CHECK
  AC_LANG_CPLUSPLUS
  AC_OUTPUT
  </code></pre>
  
  <p>Makefile.am</p>
  
  <pre><code>SUBDIRS = foo bar wah
  ACLOCAL_AMFLAGS = -I .m4
  </code></pre>
  
  <p>foo/Foo.h</p>
  
  <pre><code>#ifndef FOO_FOO_H_
  #define FOO_FOO_H_
  namespace Foo
  {
    class Foo
    {
    public:
      Foo(long l);
    private:
      long l;
    };
  }
  #endif
  </code></pre>
  
  <p>foo/Foo.cpp</p>
  
  <pre><code>#include "foo/Foo.h"
  namespace Foo
  {
    Foo::Foo(long l) : l(l) {}
  }
  </code></pre>
  
  <p>foo/Makefile.am</p>
  
  <pre><code>lib_LTLIBRARIES = libfoo.la
  libfoo_la_SOURCES = Foo.cpp
  libfoo_la_CPPFLAGS =
  libfoo_la_LDFLAGS = -release 0.0.1
  libfoo_la_LIBADD =
  </code></pre>
  
  <p>bar/Bar.h</p>
  
  <pre><code>#ifndef BAR_BAR_H_
  #define BAR_BAR_H_
  #include "foo/Foo.h"
  namespace Bar
  {
    class Bar
    {
    public:
      Bar(const Foo::Foo &amp; f);
    private:
      Foo::Foo f;
    };
  }
  #endif
  </code></pre>
  
  <p>bar/Bar.cpp</p>
  
  <pre><code>#include "bar/Bar.h"
  namespace Bar
  {
    Bar::Bar(const Foo::Foo &amp; f) : f(f) { }
  }
  </code></pre>
  
  <p>bar/Makefile.am</p>
  
  <pre><code>lib_LTLIBRARIES = libbar.la
  libbar_la_SOURCES = Bar.cpp
  libbar_la_CPPFLAGS =
  libbar_la_LDFLAGS = -release 0.0.1
  libbar_la_LIBADD = -L../foo -lfoo
  </code></pre>
  
  <p>wah/main.cpp</p>
  
  <pre><code>#include "bar/Bar.h"
  int main(int argc, char * argv[])
  {
    Bar::Bar( 5 );
    return 0;
  }
  </code></pre>
  
  <p>wah/Makefile.am</p>
  
  <pre><code>bin_PROGRAMS = wah
  wah_SOURCES = main.cpp
  wah_CPPFLAGS =
  wah_LDADD = -L../bar -lbar
  </code></pre>
  
  <p>On Lucid, wah links, on Precise, it fails with:</p>
  
  <pre><code>wah/main.cpp:5 undefined reference to `Foo::Foo::Foo(long)'
  </code></pre>
  
  <p>I can fix this by adding <code>-L../foo -lfoo</code> to <code>wah_LDADD</code>, but really, isn't libtool supposed to do that for me automagically?  The libtool manual section on `Linking executables' seems to indicate that is exactly what it should do.</p>