Fix bfd detection on systems missing -liberty
Ubuntu 14.04 is an example of a system where bfd detection failed, because
-liberty was unconditionally included on the linker command line. The current
approach will always find the smallest subset of libraries required to link
with bfd, although it might have to run *a lot* of tests to accomplish that.
As it turns out, on many somewhat modern systems -lbfd is enough. However, I
left the possibility for systems requiring -liberty too.
While already at it, I grabbed the possibility to
- move bfd detection to its own file :-)
- add more descriptive error message on failure, distinguish between
"header not found" and "cannot link to library"
- cache the result of the test to speed up further configure runs. This
obviously works only if a cache file was specified on the command line...
38 files changed: