How do I link a shared library with --as-needed using Automake? When I tried adding the flag to LDFLAGS, I saw libtool called as so:
/bin/bash ../../libtool --mode=link ... -Wl,--as-needed ... dependencies
Which results in a call to GCC like so:
gcc -shared ... dependencies ... -Wl,--as-needed ...
But that's the wrong order.
Is there a way to do this with Libtool?
Or is there a nice way to build shared libraries using Automake but without Libtool? (I've been frustrated at Libtool for various other reasons in the past...)
It seems the Debian folks ran into this problem too (bug report) but I'd like to be able to fix this for my project rather than messing with my system (unless I misunderstand the fix).