By default, libtool creates two versions of library - static one and dynamic one and that's what I need. I also need that my library, no matter what type is it - static or dynamic, will be linked statically against certain dependencies (several .a archives - lib1.a, lib2.a and lib3.a). I tried --whole-archive
option in _LDFLAGS
like this:
mylib_la_LDFLAGS=...-Wl,--whole-archive, -llib1 -llib2 -llib3 --no-whole-archive ....
but after Makefile generation, these flags are moved at the end of command, thus no effect is taken:
...-llib1 -llib2 -lib3.... -Wl,--whole-archive, --no-whole-arvhive,...
I also tried to provide --static
flag in _LDADD
like this:
mylib_la_LDFLAGS=...--static -llib1 -llib2 -llib3 ....
and this flag is omitted when libtool creates dynamic library (static library is fine).
How one should achieve this?