giscanner: Be more thorough about applying -Wl,--no-as-needed option
Some Linux distributions routinely build all executables and libraries with -Wl,--as-needed, either by adding it to LDFLAGS or by making it the compiler or linker default.
For installed executables and libraries this is a desirable way to drop unnecessary transitive dependencies, minimizing the number of rebuilds required if a lower-level library breaks ABI, but for our dump executable it's counterproductive and can prevent us from finding the SONAMEs of libraries that were passed as explicit -l arguments, especially if we use a ldd replacement that is not recursive (like the one in #482).
We already had a special case to add -Wl,--no-as-needed to the linker arguments, but only for "internal" libraries and only when not using libtool. Extend that to cover "external" libraries and libtool as well, and filter out any -Wl,--as-needed from LDFLAGS to avoid it from being defeated.
Resolves: #505