Check{Compiler,Linker}Flag: Factor out common implementation
CheckLinkerFlag: rely now on internal implementation.
This internal implementation share the configuration with CheckCompilerFlag.
This refactoring is done in preparation of a fix for #23053 (closed).