[gdb/build] Check if libsource-highlight is usable
When building gdb with g++ 4.8.5, I ran into:
...
ld: source-cache.o: in function `source_cache::ensure(symtab*)':
source-cache.c:207: undefined reference to \
srchilite::SourceHighlight::SourceHighlight(std::string const&)
...
[ I configured gdb without explicit settings related to source-highlight, so
we're excercising the enable_source_highlight=auto scenario. ]
The problem is that:
- the source-highlight library is build with system compiler
g++ 7.5.0 which uses the new libstdc++ library abi (see
https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dual_abi.html )
- gdb is build using g++ 4.8.5 which uses the old abi.
[ There's a compatibility macro _GLIBCXX_USE_CXX11_ABI, but that doesn't work
for this case. Instead, it enables the opposite case where the
source-highlight library is build with g++ 4.8.5 and gdb is build with
g++ 7.5.0. ]
Fix this by checking whether the source-highlight library is usable during
configuration.
In the enable_source_highlight=auto scenario, this allows the build to skip
the unusable library and finish successfully.
In the enable_source_highlight=yes scenario, this allows the build to error
out earlier.
Tested on x86_64-linux.