From 5fc50bf9ae2ee8a1faf90a9c8890182d1f192c20 Mon Sep 17 00:00:00 2001 From: Jyrki Vesterinen Date: Thu, 22 Dec 2016 22:27:30 +0200 Subject: [PATCH] SCons version of commit 7968f7ba --- SConstruct | 10 +++++++++- scons/ieee_754.py | 10 ++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 scons/ieee_754.py diff --git a/SConstruct b/SConstruct index 2525839969c9..e77c01b45cdf 100755 --- a/SConstruct +++ b/SConstruct @@ -306,7 +306,7 @@ def Warning(message): from metasconf import init_metasconf configure_args = dict( - custom_tests = init_metasconf(env, ["cplusplus", "python_devel", "sdl", "boost", "pango", "pkgconfig", "gettext", "lua"]), + custom_tests = init_metasconf(env, ["ieee_754", "cplusplus", "python_devel", "sdl", "boost", "pango", "pkgconfig", "gettext", "lua"]), config_h = "$build_dir/config.h", log_file="$build_dir/config.log", conf_dir="$build_dir/sconf_temp") @@ -331,6 +331,13 @@ if env["prereqs"]: conf.CheckLib("m") conf.CheckFunc("round") + def CheckIEEE754(conf): + if not env["host"]: + return conf.CheckIEEE754() + else: + Warning("You are cross-compiling. Skipping IEEE 754 test.") + return True + def CheckAsio(conf): if env["PLATFORM"] == 'win32': conf.env.Append(LIBS = ["libws2_32"]) @@ -349,6 +356,7 @@ if env["prereqs"]: conf.CheckSDL("SDL2_image", header_file = "SDL_image") have_server_prereqs = (\ + CheckIEEE754(conf) & \ conf.CheckCPlusPlus(gcc_version = "4.8") & \ conf.CheckBoost("iostreams", require_version = boost_version) & \ conf.CheckBoostIostreamsGZip() & \ diff --git a/scons/ieee_754.py b/scons/ieee_754.py new file mode 100644 index 000000000000..80dd8677d7c2 --- /dev/null +++ b/scons/ieee_754.py @@ -0,0 +1,10 @@ +import os.path + +def CheckIEEE754(context): + context.Message("Checking if floating point numbers are in the IEEE 754 format... ") + test_file = open(os.path.join("src", "compile_time_tests", "ieee_754.cpp")) + ret, _ = context.TryRun(test_file.read(), ".cpp") + context.Result(ret) + return ret + +config_checks = { "CheckIEEE754" : CheckIEEE754 }