From d8f1a57876cbb5b363e739333576ca666f13ef20 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Sun, 24 Nov 2013 15:49:34 +0100 Subject: build: make waf append pkgconfig flags as-is waf apparently only appends a pkgconfig flag if it doesn't already exist in the lib storage. Since our configure often checks for multiple libraries in one call we want to keep the flags as is. This is especially important to always keep stuff like -lm in the right place. --- waftools/checks/generic.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'waftools/checks/generic.py') diff --git a/waftools/checks/generic.py b/waftools/checks/generic.py index 46813aed01..5abc740bb7 100644 --- a/waftools/checks/generic.py +++ b/waftools/checks/generic.py @@ -1,5 +1,6 @@ import os from inflectors import DependencyInflector +from waflib.ConfigSet import ConfigSet __all__ = [ "check_pkg_config", "check_cc", "check_statement", "check_libs", @@ -66,12 +67,22 @@ def check_pkg_config(*args, **kw_ext): 'package': " ".join(packages), 'args': sargs + pkgc_args } opts = __merge_options__(dependency_identifier, defaults, kw_ext, kw) - if ctx.check_cfg(**opts): - return True - else: + + # Warning! Megahack incoming: when parsing flags in `parse_flags` waf + # uses append_unique. This appends the flags only if they aren't + # already present in the list. This causes breakage if one checks for + # multiple pkg-config packages in a single call as stuff like -lm is + # added only at its first occurrence. + original_append_unique = ConfigSet.append_unique + ConfigSet.append_unique = ConfigSet.append_value + result = bool(ctx.check_cfg(**opts)) + ConfigSet.append_unique = original_append_unique + + if not result: defkey = DependencyInflector(dependency_identifier).define_key() ctx.undefine(defkey) return False + return result return fn def check_headers(*headers): -- cgit v1.2.3