scons: disable cairo support at configure time unless cairo reports freetype support - closes #1842

This commit is contained in:
Dane Springmeyer 2013-05-16 08:28:38 -07:00
parent 4775428dc0
commit 5ff69781c8

View file

@ -799,6 +799,28 @@ int main()
context.Result(ret) context.Result(ret)
return ret return ret
def CheckCairoHasFreetype(context, silent=False):
if not silent:
context.Message('Checking that Cairo was built with freetype font support ... ')
ret = context.TryRun("""
#include <cairo/features.h>
int main()
{
#ifdef CAIRO_HAS_FT_FONT
return 0;
#else
return 1;
#endif
}
""", '.cpp')[0]
if silent:
context.did_show_result=1
context.Result(ret)
return ret
def GetBoostLibVersion(context): def GetBoostLibVersion(context):
ret = context.TryRun(""" ret = context.TryRun("""
@ -946,6 +968,7 @@ conf_tests = { 'prioritize_paths' : prioritize_paths,
'CheckPKGVersion' : CheckPKGVersion, 'CheckPKGVersion' : CheckPKGVersion,
'FindBoost' : FindBoost, 'FindBoost' : FindBoost,
'CheckBoost' : CheckBoost, 'CheckBoost' : CheckBoost,
'CheckCairoHasFreetype' : CheckCairoHasFreetype,
'GetBoostLibVersion' : GetBoostLibVersion, 'GetBoostLibVersion' : GetBoostLibVersion,
'GetMapnikLibVersion' : GetMapnikLibVersion, 'GetMapnikLibVersion' : GetMapnikLibVersion,
'parse_config' : parse_config, 'parse_config' : parse_config,
@ -1411,6 +1434,11 @@ if not preconfigured:
else: else:
color_print(4,'Not building with cairo support, pass CAIRO=True to enable') color_print(4,'Not building with cairo support, pass CAIRO=True to enable')
if not env['HOST'] and env['HAS_CAIRO']:
if not conf.CheckCairoHasFreetype():
env['SKIPPED_DEPS'].append('cairo')
env['HAS_CAIRO'] = False
if 'python' in env['BINDINGS'] or 'python' in env['REQUESTED_PLUGINS']: if 'python' in env['BINDINGS'] or 'python' in env['REQUESTED_PLUGINS']:
if not os.access(env['PYTHON'], os.X_OK): if not os.access(env['PYTHON'], os.X_OK):
color_print(1,"Cannot run python interpreter at '%s', make sure that you have the permissions to execute it." % env['PYTHON']) color_print(1,"Cannot run python interpreter at '%s', make sure that you have the permissions to execute it." % env['PYTHON'])