Check g++ version also if it is dependency generation command

The purpose is to pass -std=c++0x instead of -std=c++11 to g++ if it
is older than 4.7.