Hi All,
For our project we use automake/libtool
automake (GNU automake) 1.14.1
libtool (GNU libtool) 2.4.2
autoconf (GNU Autoconf) 2.69
We have,
platform/targetA/Makefile.am
platform/targetB/Makefile.am
example/*/Makefile.am
We wanted to link an external lib wrapped around --whole-archive/--no-whole-archive with the example application as given below,
platform/targetA/Makefile.am
LIBS += -Wl,--whole-archive
LIBS += -lmyextlib
LIBS += -Wl,--no-whole-archive
Problem is, platform linker command doesn't have --whole-archive/--no-whole-archive around the lib. Instead it comes later in the command line.
gcc:
-Wl,--whole-archive -lmyextlib -ldl -Wl,--no-whole-archive
libtool link:
-lrt -lcrypto -lmyextlib -ldl -pthread -O2 -pthread -Wl,--whole-archive -Wl,--no-whole-archive
example/*/Makefile.am
When compiling the example app, linker command line just has -lmyextlib and doesn't have --whole-archive/--no-whole-archive at all.
How to propogate the --whole-archive/--no-whole-archive all the way down to example app linking?. Importantly, it should be around the -lmyextlib. I can make changes only at platform/targetA/Makefile.am as example/* is common across all other platforms.
Note: Tried libtool's suggestion of -Wl,'-whole-archive -lfoo -no-whole-archive' as mentioned in
Am I missing something here? What I am trying to achieve is completely wrong?
Thanks,
Venkatesh.