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 wanted to link an external lib wrapped around --whole-archive/--no-whole-archive with the example application as given below,
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.
-Wl,--whole-archive -lmyextlib -ldl -Wl,--no-whole-archive
-lrt -lcrypto -lmyextlib -ldl -pthread -O2 -pthread -Wl,--whole-archive -Wl,--no-whole-archive
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?