Merge pull request #3923 from lightmare/sconf-fixup-messages
scons configure cleanup
This commit is contained in:
commit
c81a40d9eb
1 changed files with 78 additions and 92 deletions
170
SConstruct
170
SConstruct
|
@ -256,13 +256,6 @@ def create_uninstall_target(env, path, is_glob=False):
|
||||||
])
|
])
|
||||||
env.Alias("uninstall", "uninstall-"+path)
|
env.Alias("uninstall", "uninstall-"+path)
|
||||||
|
|
||||||
def shortest_name(libs):
|
|
||||||
name = '-'*200
|
|
||||||
for lib in libs:
|
|
||||||
if len(name) > len(lib):
|
|
||||||
name = lib
|
|
||||||
return name
|
|
||||||
|
|
||||||
def rm_path(item,set,_env):
|
def rm_path(item,set,_env):
|
||||||
for i in _env[set]:
|
for i in _env[set]:
|
||||||
if i.startswith(item):
|
if i.startswith(item):
|
||||||
|
@ -559,6 +552,12 @@ for opt in opts.options:
|
||||||
if opt.key not in pickle_store:
|
if opt.key not in pickle_store:
|
||||||
pickle_store.append(opt.key)
|
pickle_store.append(opt.key)
|
||||||
|
|
||||||
|
def rollback_option(env, variable):
|
||||||
|
global opts
|
||||||
|
for item in opts.options:
|
||||||
|
if item.key == variable:
|
||||||
|
env[variable] = item.default
|
||||||
|
|
||||||
# Method of adding configure behavior to Scons adapted from:
|
# Method of adding configure behavior to Scons adapted from:
|
||||||
# http://freeorion.svn.sourceforge.net/svnroot/freeorion/trunk/FreeOrion/SConstruct
|
# http://freeorion.svn.sourceforge.net/svnroot/freeorion/trunk/FreeOrion/SConstruct
|
||||||
preconfigured = False
|
preconfigured = False
|
||||||
|
@ -702,7 +701,7 @@ def parse_config(context, config, checks='--libs --cflags'):
|
||||||
# optional deps...
|
# optional deps...
|
||||||
if tool not in env['SKIPPED_DEPS']:
|
if tool not in env['SKIPPED_DEPS']:
|
||||||
env['SKIPPED_DEPS'].append(tool)
|
env['SKIPPED_DEPS'].append(tool)
|
||||||
conf.rollback_option(config)
|
rollback_option(env, config)
|
||||||
else: # freetype and libxml2, not optional
|
else: # freetype and libxml2, not optional
|
||||||
if tool not in env['MISSING_DEPS']:
|
if tool not in env['MISSING_DEPS']:
|
||||||
env['MISSING_DEPS'].append(tool)
|
env['MISSING_DEPS'].append(tool)
|
||||||
|
@ -751,7 +750,7 @@ def parse_pg_config(context, config):
|
||||||
env.Append(LIBS = lpq)
|
env.Append(LIBS = lpq)
|
||||||
else:
|
else:
|
||||||
env['SKIPPED_DEPS'].append(tool)
|
env['SKIPPED_DEPS'].append(tool)
|
||||||
conf.rollback_option(config)
|
rollback_option(env, config)
|
||||||
context.Result( ret )
|
context.Result( ret )
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
|
@ -768,13 +767,6 @@ def ogr_enabled(context):
|
||||||
context.Result( ret )
|
context.Result( ret )
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
def rollback_option(context,variable):
|
|
||||||
global opts
|
|
||||||
env = context.env
|
|
||||||
for item in opts.options:
|
|
||||||
if item.key == variable:
|
|
||||||
env[variable] = item.default
|
|
||||||
|
|
||||||
def FindBoost(context, prefixes, thread_flag):
|
def FindBoost(context, prefixes, thread_flag):
|
||||||
"""Routine to auto-find boost header dir, lib dir, and library naming structure.
|
"""Routine to auto-find boost header dir, lib dir, and library naming structure.
|
||||||
|
|
||||||
|
@ -800,7 +792,7 @@ def FindBoost(context, prefixes, thread_flag):
|
||||||
if len(libItems) >= 1 and len(incItems) >= 1:
|
if len(libItems) >= 1 and len(incItems) >= 1:
|
||||||
BOOST_LIB_DIR = os.path.dirname(libItems[0])
|
BOOST_LIB_DIR = os.path.dirname(libItems[0])
|
||||||
BOOST_INCLUDE_DIR = incItems[0].rstrip('boost/')
|
BOOST_INCLUDE_DIR = incItems[0].rstrip('boost/')
|
||||||
shortest_lib_name = shortest_name(libItems)
|
shortest_lib_name = min(libItems, key=len)
|
||||||
match = re.search(r'%s(.*)\..*' % search_lib, shortest_lib_name)
|
match = re.search(r'%s(.*)\..*' % search_lib, shortest_lib_name)
|
||||||
if hasattr(match,'groups'):
|
if hasattr(match,'groups'):
|
||||||
BOOST_APPEND = match.groups()[0]
|
BOOST_APPEND = match.groups()[0]
|
||||||
|
@ -885,7 +877,7 @@ def CheckIcuData(context, silent=False):
|
||||||
|
|
||||||
if not silent:
|
if not silent:
|
||||||
context.Message('Checking for ICU data directory...')
|
context.Message('Checking for ICU data directory...')
|
||||||
ret = context.TryRun("""
|
ret, out = context.TryRun("""
|
||||||
|
|
||||||
#include <unicode/putil.h>
|
#include <unicode/putil.h>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
@ -902,9 +894,10 @@ int main() {
|
||||||
""", '.cpp')
|
""", '.cpp')
|
||||||
if silent:
|
if silent:
|
||||||
context.did_show_result=1
|
context.did_show_result=1
|
||||||
if ret[0]:
|
if ret:
|
||||||
context.Result('u_getDataDirectory returned %s' % ret[1])
|
value = out.strip()
|
||||||
return ret[1].strip()
|
context.Result('u_getDataDirectory returned %s' % value)
|
||||||
|
return value
|
||||||
else:
|
else:
|
||||||
ret, value = config_command('icu-config --icudatadir')
|
ret, value = config_command('icu-config --icudatadir')
|
||||||
if ret:
|
if ret:
|
||||||
|
@ -918,8 +911,8 @@ int main() {
|
||||||
def CheckGdalData(context, silent=False):
|
def CheckGdalData(context, silent=False):
|
||||||
|
|
||||||
if not silent:
|
if not silent:
|
||||||
context.Message('Checking for GDAL data directory...')
|
context.Message('Checking for GDAL data directory... ')
|
||||||
ret = context.TryRun("""
|
ret, out = context.TryRun("""
|
||||||
|
|
||||||
#include "cpl_config.h"
|
#include "cpl_config.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
@ -930,19 +923,20 @@ int main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
""", '.cpp')
|
""", '.cpp')
|
||||||
|
value = out.strip()
|
||||||
if silent:
|
if silent:
|
||||||
context.did_show_result=1
|
context.did_show_result=1
|
||||||
if ret[0]:
|
if ret:
|
||||||
context.Result('GDAL_PREFIX returned %s' % ret[1])
|
context.Result('GDAL_PREFIX returned %s' % value)
|
||||||
else:
|
else:
|
||||||
context.Result('Failed to detect (mapnik-config will have null value)')
|
context.Result('Failed to detect (mapnik-config will have null value)')
|
||||||
return ret[1].strip()
|
return value
|
||||||
|
|
||||||
def CheckProjData(context, silent=False):
|
def CheckProjData(context, silent=False):
|
||||||
|
|
||||||
if not silent:
|
if not silent:
|
||||||
context.Message('Checking for PROJ_LIB directory...')
|
context.Message('Checking for PROJ_LIB directory...')
|
||||||
ret = context.TryRun("""
|
ret, out = context.TryRun("""
|
||||||
|
|
||||||
// This is narly, could eventually be replaced using https://github.com/OSGeo/proj.4/pull/551]
|
// This is narly, could eventually be replaced using https://github.com/OSGeo/proj.4/pull/551]
|
||||||
#include <proj_api.h>
|
#include <proj_api.h>
|
||||||
|
@ -992,20 +986,21 @@ int main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
""", '.cpp')
|
""", '.cpp')
|
||||||
|
value = out.strip()
|
||||||
if silent:
|
if silent:
|
||||||
context.did_show_result=1
|
context.did_show_result=1
|
||||||
if ret[0]:
|
if ret:
|
||||||
context.Result('pj_open_lib returned %s' % ret[1])
|
context.Result('pj_open_lib returned %s' % value)
|
||||||
else:
|
else:
|
||||||
context.Result('Failed to detect (mapnik-config will have null value)')
|
context.Result('Failed to detect (mapnik-config will have null value)')
|
||||||
return ret[1].strip()
|
return value
|
||||||
|
|
||||||
def CheckCairoHasFreetype(context, silent=False):
|
def CheckCairoHasFreetype(context, silent=False):
|
||||||
if not silent:
|
if not silent:
|
||||||
context.Message('Checking for cairo freetype font support ... ')
|
context.Message('Checking for cairo freetype font support ... ')
|
||||||
context.env.AppendUnique(CPPPATH=copy(env['CAIRO_CPPPATHS']))
|
context.env.AppendUnique(CPPPATH=copy(env['CAIRO_CPPPATHS']))
|
||||||
|
|
||||||
ret = context.TryRun("""
|
ret, out = context.TryRun("""
|
||||||
|
|
||||||
#include <cairo-features.h>
|
#include <cairo-features.h>
|
||||||
|
|
||||||
|
@ -1018,7 +1013,7 @@ int main()
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
""", '.cpp')[0]
|
""", '.cpp')
|
||||||
if silent:
|
if silent:
|
||||||
context.did_show_result=1
|
context.did_show_result=1
|
||||||
context.Result(ret)
|
context.Result(ret)
|
||||||
|
@ -1045,7 +1040,7 @@ int main()
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
def GetBoostLibVersion(context):
|
def GetBoostLibVersion(context):
|
||||||
ret = context.TryRun("""
|
ret, out = context.TryRun("""
|
||||||
|
|
||||||
#include <boost/version.hpp>
|
#include <boost/version.hpp>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
@ -1060,8 +1055,8 @@ return 0;
|
||||||
""", '.cpp')
|
""", '.cpp')
|
||||||
# hack to avoid printed output
|
# hack to avoid printed output
|
||||||
context.did_show_result=1
|
context.did_show_result=1
|
||||||
context.Result(ret[0])
|
context.Result(ret)
|
||||||
return ret[1].strip()
|
return out.strip()
|
||||||
|
|
||||||
def CheckBoostScopedEnum(context, silent=False):
|
def CheckBoostScopedEnum(context, silent=False):
|
||||||
if not silent:
|
if not silent:
|
||||||
|
@ -1081,8 +1076,9 @@ int main()
|
||||||
context.Result(ret)
|
context.Result(ret)
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
def icu_at_least_four_two(context):
|
def icu_at_least(context, min_version_str):
|
||||||
ret = context.TryRun("""
|
context.Message('Checking for ICU version >= %s... ' % min_version_str)
|
||||||
|
ret, out = context.TryRun("""
|
||||||
|
|
||||||
#include <unicode/uversion.h>
|
#include <unicode/uversion.h>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
@ -1094,28 +1090,32 @@ int main()
|
||||||
}
|
}
|
||||||
|
|
||||||
""", '.cpp')
|
""", '.cpp')
|
||||||
# hack to avoid printed output
|
try:
|
||||||
context.Message('Checking for ICU version >= 4.2... ')
|
found_version_str = out.strip()
|
||||||
context.did_show_result=1
|
found_version = tuple(map(int, found_version_str.split('.')))
|
||||||
result = ret[1].strip()
|
min_version = tuple(map(int, min_version_str.split('.')))
|
||||||
if not result:
|
except:
|
||||||
context.Result('error, could not get major and minor version from unicode/uversion.h')
|
context.Result('error (could not get version from unicode/uversion.h)')
|
||||||
return False
|
return False
|
||||||
|
|
||||||
major, minor = map(int,result.split('.'))
|
if found_version >= min_version:
|
||||||
if major >= 4 and minor >= 0:
|
context.Result('yes (found ICU %s)' % found_version_str)
|
||||||
color_print(4,'found: icu %s' % result)
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
color_print(1,'\nFound insufficient icu version... %s' % result)
|
context.Result('no (found ICU %s)' % found_version_str)
|
||||||
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;
|
||||||
|
@ -1123,24 +1123,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>
|
||||||
|
@ -1151,11 +1147,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':
|
||||||
|
@ -1164,7 +1157,8 @@ def boost_regex_has_icu(context):
|
||||||
if lib_name in context.env['LIBS']:
|
if lib_name in context.env['LIBS']:
|
||||||
context.env['LIBS'].remove(lib_name)
|
context.env['LIBS'].remove(lib_name)
|
||||||
context.env.Append(LIBS=lib_name)
|
context.env.Append(LIBS=lib_name)
|
||||||
ret = context.TryRun("""
|
context.Message('Checking if boost_regex was built with ICU unicode support... ')
|
||||||
|
ret, out = context.TryRun("""
|
||||||
|
|
||||||
#include <boost/regex/icu.hpp>
|
#include <boost/regex/icu.hpp>
|
||||||
#include <unicode/unistr.h>
|
#include <unicode/unistr.h>
|
||||||
|
@ -1184,11 +1178,8 @@ int main()
|
||||||
}
|
}
|
||||||
|
|
||||||
""", '.cpp')
|
""", '.cpp')
|
||||||
context.Message('Checking if boost_regex was built with ICU unicode support... ')
|
context.Result(ret)
|
||||||
context.Result(ret[0])
|
return ret
|
||||||
if ret[0]:
|
|
||||||
return True
|
|
||||||
return False
|
|
||||||
|
|
||||||
def sqlite_has_rtree(context, silent=False):
|
def sqlite_has_rtree(context, silent=False):
|
||||||
""" check an sqlite3 install has rtree support.
|
""" check an sqlite3 install has rtree support.
|
||||||
|
@ -1197,7 +1188,9 @@ def sqlite_has_rtree(context, silent=False):
|
||||||
http://www.sqlite.org/c3ref/compileoption_get.html
|
http://www.sqlite.org/c3ref/compileoption_get.html
|
||||||
"""
|
"""
|
||||||
|
|
||||||
ret = context.TryRun("""
|
if not silent:
|
||||||
|
context.Message('Checking if SQLite supports RTREE... ')
|
||||||
|
ret, out = context.TryRun("""
|
||||||
|
|
||||||
#include <sqlite3.h>
|
#include <sqlite3.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -1229,17 +1222,15 @@ int main()
|
||||||
}
|
}
|
||||||
|
|
||||||
""", '.c')
|
""", '.c')
|
||||||
if not silent:
|
|
||||||
context.Message('Checking if SQLite supports RTREE... ')
|
|
||||||
if silent:
|
if silent:
|
||||||
context.did_show_result=1
|
context.did_show_result=1
|
||||||
context.Result(ret[0])
|
context.Result(ret)
|
||||||
if ret[0]:
|
return ret
|
||||||
return True
|
|
||||||
return False
|
|
||||||
|
|
||||||
def supports_cxx14(context,silent=False):
|
def supports_cxx14(context,silent=False):
|
||||||
ret = context.TryRun("""
|
if not silent:
|
||||||
|
context.Message('Checking if compiler (%s) supports -std=c++14 flag... ' % context.env.get('CXX','CXX'))
|
||||||
|
ret, out = context.TryRun("""
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
|
@ -1251,14 +1242,10 @@ int main()
|
||||||
}
|
}
|
||||||
|
|
||||||
""", '.cpp')
|
""", '.cpp')
|
||||||
if not silent:
|
|
||||||
context.Message('Checking if compiler (%s) supports -std=c++14 flag... ' % context.env.get('CXX','CXX'))
|
|
||||||
if silent:
|
if silent:
|
||||||
context.did_show_result=1
|
context.did_show_result=1
|
||||||
context.Result(ret[0])
|
context.Result(ret)
|
||||||
if ret[0]:
|
return ret
|
||||||
return True
|
|
||||||
return False
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1278,8 +1265,7 @@ conf_tests = { 'prioritize_paths' : prioritize_paths,
|
||||||
'parse_pg_config' : parse_pg_config,
|
'parse_pg_config' : parse_pg_config,
|
||||||
'ogr_enabled' : ogr_enabled,
|
'ogr_enabled' : ogr_enabled,
|
||||||
'get_pkg_lib' : get_pkg_lib,
|
'get_pkg_lib' : get_pkg_lib,
|
||||||
'rollback_option' : rollback_option,
|
'icu_at_least' : icu_at_least,
|
||||||
'icu_at_least_four_two' : icu_at_least_four_two,
|
|
||||||
'harfbuzz_version' : harfbuzz_version,
|
'harfbuzz_version' : harfbuzz_version,
|
||||||
'harfbuzz_with_freetype_support': harfbuzz_with_freetype_support,
|
'harfbuzz_with_freetype_support': harfbuzz_with_freetype_support,
|
||||||
'boost_regex_has_icu' : boost_regex_has_icu,
|
'boost_regex_has_icu' : boost_regex_has_icu,
|
||||||
|
@ -1601,7 +1587,7 @@ if not preconfigured:
|
||||||
else:
|
else:
|
||||||
if libname == env['ICU_LIB_NAME']:
|
if libname == env['ICU_LIB_NAME']:
|
||||||
if env['ICU_LIB_NAME'] not in env['MISSING_DEPS']:
|
if env['ICU_LIB_NAME'] not in env['MISSING_DEPS']:
|
||||||
if not conf.icu_at_least_four_two():
|
if not conf.icu_at_least("4.0"):
|
||||||
# expression_string.cpp and map.cpp use fromUTF* function only available in >= ICU 4.2
|
# expression_string.cpp and map.cpp use fromUTF* function only available in >= ICU 4.2
|
||||||
env['MISSING_DEPS'].append(env['ICU_LIB_NAME'])
|
env['MISSING_DEPS'].append(env['ICU_LIB_NAME'])
|
||||||
elif libname == 'harfbuzz':
|
elif libname == 'harfbuzz':
|
||||||
|
|
Loading…
Reference in a new issue