diff --git a/Tools/ardupilotwaf/boards.py b/Tools/ardupilotwaf/boards.py index a1fbd2dc05..40dfdd0316 100644 --- a/Tools/ardupilotwaf/boards.py +++ b/Tools/ardupilotwaf/boards.py @@ -156,6 +156,13 @@ class Board: cfg.msg("CXX Compiler", "%s %s" % (cfg.env.COMPILER_CXX, ".".join(cfg.env.CC_VERSION))) + if cfg.options.assert_cc_version: + cfg.msg("Checking compiler", "%s %s" % (cfg.options.assert_cc_version, ".".join(cfg.env.CC_VERSION))) + have_version = cfg.env.COMPILER_CXX+"-"+'.'.join(list(cfg.env.CC_VERSION)) + want_version = cfg.options.assert_cc_version + if have_version != want_version: + cfg.fatal("cc version mismatch: %s should be %s" % (have_version, want_version)) + if 'clang' in cfg.env.COMPILER_CC: env.CFLAGS += [ '-fcolor-diagnostics', diff --git a/wscript b/wscript index 008734c95a..d5aadebd28 100644 --- a/wscript +++ b/wscript @@ -286,6 +286,10 @@ configuration in order to save typing. default=None, help='Extra hwdef.dat file for custom build.') + g.add_option('--assert-cc-version', + default=None, + help='fail configure if not using the specified gcc version') + def _collect_autoconfig_files(cfg): for m in sys.modules.values(): paths = []