SConstruct: fixup HarfBuzz configure checks

- call .Message before .TryRun
- don't silence .Result
- report found version even if it's really old and doesn't even define
  HB_VERSION_ATLEAST macro
This commit is contained in:
Mickey Rose 2018-06-27 22:45:58 +02:00
parent 42d3f2d0d3
commit a2af3a53fa

View file

@ -1038,11 +1038,16 @@ int main()
return False return False
def harfbuzz_version(context): def harfbuzz_version(context):
ret = context.TryRun(""" context.Message('Checking for HarfBuzz version >= %s... ' % HARFBUZZ_MIN_VERSION_STRING)
ret, out = context.TryRun("""
#include "harfbuzz/hb.h" #include "harfbuzz/hb.h"
#include <iostream> #include <iostream>
#ifndef HB_VERSION_ATLEAST
#define HB_VERSION_ATLEAST(...) 0
#endif
int main() int main()
{ {
std::cout << HB_VERSION_ATLEAST(%s, %s, %s) << ";" << HB_VERSION_STRING; std::cout << HB_VERSION_ATLEAST(%s, %s, %s) << ";" << HB_VERSION_STRING;
@ -1050,24 +1055,20 @@ int main()
} }
""" % HARFBUZZ_MIN_VERSION, '.cpp') """ % HARFBUZZ_MIN_VERSION, '.cpp')
# hack to avoid printed output if not ret:
context.Message('Checking for HarfBuzz version >= %s... ' % HARFBUZZ_MIN_VERSION_STRING) context.Result('error (could not get version from hb.h)')
context.did_show_result=1 else:
result = ret[1].strip() ok_str, found_version_str = out.strip().split(';', 1)
if not result: ret = int(ok_str)
context.Result('error, could not get version from hb.h') if ret:
return False context.Result('yes (found HarfBuzz %s)' % found_version_str)
else:
items = result.split(';') context.Result('no (found HarfBuzz %s)' % found_version_str)
if items[0] == '1': return ret
color_print(4,'found: HarfBuzz %s' % items[1])
return True
color_print(1,'\nHarfbuzz >= %s required but found ... %s' % (HARFBUZZ_MIN_VERSION_STRING,items[1]))
return False
def harfbuzz_with_freetype_support(context): def harfbuzz_with_freetype_support(context):
ret = context.TryRun(""" context.Message('Checking for HarfBuzz with freetype support... ')
ret, out = context.TryRun("""
#include "harfbuzz/hb-ft.h" #include "harfbuzz/hb-ft.h"
#include <iostream> #include <iostream>
@ -1078,11 +1079,8 @@ int main()
} }
""", '.cpp') """, '.cpp')
context.Message('Checking for HarfBuzz with freetype support\n') context.Result(ret)
context.Result(ret[0]) return ret
if ret[0]:
return True
return False
def boost_regex_has_icu(context): def boost_regex_has_icu(context):
if env['RUNTIME_LINK'] == 'static': if env['RUNTIME_LINK'] == 'static':