diff options
author | David Robillard <d@drobilla.net> | 2011-10-19 02:06:46 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2011-10-19 02:06:46 +0000 |
commit | 25eba1b66b9a68fbaaef6718d05d0a2d764f2c37 (patch) | |
tree | 7e02c11eb5ef11700cd7f1cb83ddcf87ee5e8771 | |
parent | 1d5f97c63c68e77547136214db4da744953a34a8 (diff) | |
download | autowaf-25eba1b66b9a68fbaaef6718d05d0a2d764f2c37.tar.gz autowaf-25eba1b66b9a68fbaaef6718d05d0a2d764f2c37.tar.bz2 autowaf-25eba1b66b9a68fbaaef6718d05d0a2d764f2c37.zip |
Fix autowaf.check_pkg when a mandatory check follows an optional check
git-svn-id: http://svn.drobilla.net/autowaf@57 e2e4594f-ea7b-45dc-bc5a-5f5301e603aa
-rw-r--r-- | autowaf.py | 13 |
1 files changed, 12 insertions, 1 deletions
@@ -114,18 +114,29 @@ def define(conf, var_name, value): def check_pkg(conf, name, **args): "Check for a package iff it hasn't been checked for yet" + class CheckType: + OPTIONAL=1 + MANDATORY=2 var_name = 'CHECKED_' + nameify(args['uselib_store']) check = not var_name in conf.env - conf.env[var_name] = True + mandatory = not 'mandatory' in args or args['mandatory'] if not check and 'atleast_version' in args: # Re-check if version is newer than previous check checked_version = conf.env['VERSION_' + name] if checked_version and checked_version < args['atleast_version']: check = True; + if not check and mandatory and conf.env[var_name] == CheckType.OPTIONAL: + # Re-check if previous check was optional but this one is mandatory + check = True; if check: conf.check_cfg(package=name, args="--cflags --libs", **args) if 'atleast_version' in args: conf.env['VERSION_' + name] = args['atleast_version'] + if mandatory: + conf.env[var_name] = CheckType.MANDATORY + else: + conf.env[var_name] = CheckType.OPTIONAL + def normpath(path): if sys.platform == 'win32': |