build: make vdpau and dxva2 checks nicer

Using check_statement() with an empty statement just to check for the
header is quite a hack. Fix check_headers() (so it takes a "use"
parameter), and use it for the checks instead.

(cherry picked from commit dfa562b5db)
This commit is contained in:
wm4 2015-03-06 11:01:53 +01:00 committed by Diogo Franco (Kovensky)
parent c77f076ae4
commit cac071dc23
2 changed files with 4 additions and 4 deletions

View File

@ -109,7 +109,7 @@ def check_pkg_config(*args, **kw_ext):
return result
return fn
def check_headers(*headers):
def check_headers(*headers, **kw_ext):
def undef_others(ctx, headers, found):
not_found_hs = set(headers) - set([found])
for not_found_h in not_found_hs:
@ -119,7 +119,7 @@ def check_headers(*headers):
def fn(ctx, dependency_identifier):
for header in headers:
defaults = {'header_name': header, 'features': 'c cprogram'}
options = __merge_options__(dependency_identifier, defaults)
options = __merge_options__(dependency_identifier, defaults, kw_ext)
if ctx.check(**options):
undef_others(ctx, headers, header)
defkey = DependencyInflector(dependency_identifier).define_key()

View File

@ -691,7 +691,7 @@ hwaccel_features = [
'name': '--vaapi-hwaccel',
'desc': 'libavcodec VAAPI hwaccel',
'deps': [ 'vaapi' ],
'func': check_statement('libavcodec/vaapi.h', '', use='libav'),
'func': check_headers('libavcodec/vaapi.h', use='libav'),
} , {
'name': '--vda-hwaccel',
'desc': 'libavcodec VDA hwaccel',
@ -717,7 +717,7 @@ hwaccel_features = [
'name': '--dxva2-hwaccel',
'desc': 'libavcodec DXVA2 hwaccel',
'deps': [ 'gdi' ],
'func': check_statement('libavcodec/dxva2.h', '', use='libav'),
'func': check_headers('libavcodec/dxva2.h', use='libav'),
}
]