[Top][All Lists]

[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 (which depends on -lbfd -liberty)
2) I build which depends on ../libcwd/

next I want to compile a test program that depends on and it gets linked with ../libcwd/ too
because LIBS was set to `../libcwd/' 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

[ 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 
/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 ../../ ../libcwd/ 
mkdir .libs
libtool: link: cannot find the library `../libcwd/'

Where "../libcwd/" shouldn't be there at all
(it is the LIBS that was needed to build libcw in

The only work-around seems to be to put a new 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]