From 242a9e626cb6efee738d71849023f804dc6b5bde Mon Sep 17 00:00:00 2001 From: "craig.schlenter@chromium.org" Date: Tue, 3 Nov 2009 17:32:10 +0000 Subject: Linux: Autodetect and change build flags when using gcc 4.4. This runs g++ -dumpversion (or $CXX) to establish the compiler version and set the gyp gcc_version variable automatically. BUG=25209 Review URL: http://codereview.chromium.org/339046 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30824 0039d316-1c4b-4281-b951-d872f2087c98 --- build/common.gypi | 3 +++ build/compiler_version.py | 50 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100755 build/compiler_version.py (limited to 'build') diff --git a/build/common.gypi b/build/common.gypi index 05c8de9d..52ce4d2 100644 --- a/build/common.gypi +++ b/build/common.gypi @@ -182,6 +182,9 @@ 'conditions': [ ['OS=="linux"', { + # This will set gcc_version to XY if you are running gcc X.Y.*. + # This is used to tweak build flags for gcc 4.4. + 'gcc_version%': '> sys.stderr, "compiler_version.py failed to execute:", compiler + print >> sys.stderr, e + return "" + +def main(): + # Check if CXX environment variable exists and + # if it does use that compiler. + cxx = os.getenv("CXX", None) + if cxx: + cxxversion = GetVersion(cxx) + if cxxversion != "": + print cxxversion + return 0 + else: + # Otherwise we check the g++ version. + gccversion = GetVersion("g++") + if gccversion != "": + print gccversion + return 0 + + return 1 + +if __name__ == "__main__": + sys.exit(main()) -- cgit v1.1