Make the ninja backend transitively check for C++ sources to use the C++ compiler for linking
Make the ninja backend transitively check for C++ sources to use the C++ compiler for linking

If you have a shared library that has no sources, but links a static library that contains C++ sources, the ninja backend will use the C compiler to link and the link will fail.

This seems to have bitten chromium as well in the past:
https://codereview.chromium.org/872493004

I don't know if a similar fix would be needed for other backends.

R=mark@chromium.org
BUG=

Review URL: https://codereview.chromium.org/2219123002 .

Patch from Ted Mielczarek <ted.mielczarek@gmail.com>.

turbulenz/gyp,turbulenz/gyp,Phuehvk/gyp,bnoordhuis/gyp,turbulenz/gyp,chromium/gyp,msc-/gyp,adblockplus/gyp,Phuehvk/gyp,Phuehvk/gyp,adblockplus/gyp,bnoordhuis/gyp,adblockplus/gyp,turbulenz/gyp,bnoordhuis/gyp,bnoordhuis/gyp,bnoordhuis/gyp,chromium/gyp,msc-/gyp,chromium/gyp,chromium/gyp,adblockplus/gyp,adblockplus/gyp,msc-/gyp,msc-/gyp,turbulenz/gyp,msc-/gyp,chromium/gyp,Phuehvk/gyp,Phuehvk/gyp