Hello Mihai,
* Dizzy wrote on Fri, Feb 02, 2007 at 11:49:10AM CET:
On Thursday 01 February 2007 19:40, Ralf Wildenhues wrote:
>
> If you want your libfoo and libbar to not be convenience archives, but
> installable libraries, then for the EXTRA* stuff I think you need to put
> "-rpath $(libdir)" yourself in libfoo_la_LDFLAGS etc.
I don't want libfoo/libbar to be installable libraries, I want them to be
convenience libraries that should be build only if at make time there is a
dependency on them (thus they are EXTRA but I cannot use
EXTRA_noinst_LTLIBRARIES because it says some error about some noinstdir
variable not declared). And I also want to have installable libraries be made
by incorporating code form libfoo/libbar convenience libraries.
Ah, yes. This is where your questions are answered:
<http://sources.redhat.com/automake/automake.html#Conditional-Libtool-Librar
ies>
Something like this should work:
Makefile.am:
noinst_LTLIBRARIES = liba1.la @SUB1@
lib_LTLIBRARIES = libb1.la @SUB2@
EXTRA_LTLIBRARIES = liba2.la libb2.la
libb2_la_LDFLAGS = -rpath $(libdir)
configure.ac:
# ...
AC_SUBST([SUB1], [liba2.la])
AC_SUBST([SUB2], [libb2.la])
and so on.
And then I want to link some installable executables (sbin_PROGRAMS) and
installable libraries (lib_LTLIBRARIES) with a set of those convenience
libraries (I know what dependency a final target like an installable
executable/library has and I express those dependencies listing as
LDADD/LIBADD the convenience libraries I know they directly need but
sometimes those convenience libraries themselves had a dependency on some
listed convenience libraries and this creates problems for lib_LTLIBRARIES
when eventually it gets to link duplicate convenience libraries). Now what I
noticed is that while there are no problems with linking duplicate
convenience libraries into executables, there are problems (those multiple
definitions linking errors) linking duplicate convenience libraries into an
installable library.
Well. Neither is completely 100% portable; IIRC not even linking a
convenience library into a program is (but that is a Libtool limitation
that could be overcome, AFAIK). I don't see a way around you making
sure you only incorporate each convenience library into an output at
most once.
Hope that helps.
Cheers,
Ralf