libtool
[Top][All Lists]
Advanced

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

Conflict between autoconf and libtool way of handling libraries


From: Carlo Wood
Subject: Conflict between autoconf and libtool way of handling libraries
Date: Thu, 26 Oct 2000 15:31:04 +0200
User-agent: Mutt/1.1i

autoconf handles libraries as if libtool doesn't exist:
./configure figures out which libraries are needed and
LIBS is set accordingly in *all* generated Makefiles.

The idea of this is that libraries that are needed are
needed everywhere, also when compiling tests.

[ Meaning: if libfoo needs libbfd, then libfoo is
  compiled with -lbfd, and tests are compiled with
  -lfoo -lbfd. ]

However, when building a library yourself with libtool
that uses libraries on its own then the libraries needed
by the library that is being build should not be passed
on to the tests that link with the built library.

For example, in my case:
1) I build libcwd.la (which depends on -lbfd -liberty)
2) I build libcw.la which depends on ../libcwd/libcwd.la

next I want to compile a test program that depends on
libcw.la and it gets linked with ../libcwd/libcwd.la too
because LIBS was set to `../libcwd/libcwd.la' during the
configuration of libcw!

That does not only fail because the relative path is nonsense
in the test directory, it is also essentially wrong because
the dependency on libcwd is supposed to be passed by libtool,
not by autoconf (by means of "passing on" the LIBS environment
variable).

[ I get:

~/c++/libcw-objdir/src/libcw/io/tests>make burst_tst
g++ -DHAVE_CONFIG_H -I- -I../../include 
-I../../../../../libcw/src/libcw/io/tests/../../include    -DDEBUG -g 
-fno-exceptions -pipe -Wall -Woverloaded-virtual -Wundef -Wpointer-arith 
-Winline -Wwrite-strings -Werror -c 
../../../../../libcw/src/libcw/io/tests/burst_tst.cc
/bin/sh ../../libtool --mode=link g++  -DDEBUG -g -fno-exceptions -pipe -Wall 
-Woverloaded-virtual -Wundef -Wpointer-arith -Winline -Wwrite-strings -Werror  
-o burst_tst  burst_tst.o ../../libcw.la ../libcwd/libcwd.la 
mkdir .libs
libtool: link: cannot find the library `../libcwd/libcwd.la'

Where "../libcwd/libcwd.la" shouldn't be there at all
(it is the LIBS that was needed to build libcw in
 ~/c++/libcw-objdir/src/libcw).
]

The only work-around seems to be to put a new configure.in file in every
test directory I have, and thus a lot more files :/.  This is hardly
acceptable because that would increase the size of the tarball dramatically
(a `configure' script is LARGE).

There must be better way, I hope.

-- 
Carlo Wood <address@hidden>                        -=- Jesus Loves you -=-



reply via email to

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