By default, libtool creates two versions of the library - static and dynamic, as well as what I need. I also need my library, no matter what type it is static or dynamic, to be statically linked with some dependencies (several .a archives - lib1.a, lib2.a and lib3.a). I tried the option --whole-archive
in the _LDFLAGS
following way:
mylib_la_LDFLAGS=...-Wl,--whole-archive, -llib1 -llib2 -llib3 --no-whole-archive ....
but after creating the Makefile, these flags move at the end of the command, so no effect is taken:
...-llib1 -llib2 -lib3.... -Wl,--whole-archive, --no-whole-arvhive,...
I also tried providing the flag --static
in the _LDADD
following way:
mylib_la_LDFLAGS=...--static -llib1 -llib2 -llib3 ....
and this flag is omitted when libtool creates a dynamic library (static library is ok).
How can this be achieved?