From 8f133e2c4d27b877f83d5e14821220989c605750 Mon Sep 17 00:00:00 2001 From: Marcelo Fernandez Date: Tue, 12 Sep 2017 12:00:14 -0300 Subject: Added check_c_headers to SCons env to check for the existence of headers --- SConstruct | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'SConstruct') diff --git a/SConstruct b/SConstruct index 9a3ee03ed5..60692474c7 100644 --- a/SConstruct +++ b/SConstruct @@ -289,7 +289,9 @@ if selected_platform in platform_list: if (env["warnings"] == 'yes'): print("WARNING: warnings=yes is deprecated; assuming warnings=all") + env.msvc = 0 if (os.name == "nt" and os.getenv("VCINSTALLDIR") and (platform_arg == "windows" or platform_arg == "uwp")): # MSVC, needs to stand out of course + env.msvc = 1 disable_nonessential_warnings = ['/wd4267', '/wd4244', '/wd4305', '/wd4800'] # Truncations, narrowing conversions... if (env["warnings"] == 'extra'): env.Append(CCFLAGS=['/Wall']) # Implies /W4 @@ -412,6 +414,16 @@ if selected_platform in platform_list: if (env['vsproj']) == "yes": methods.generate_vs_project(env, GetOption("num_jobs")) + # Check for the existence of headers + conf = Configure(env) + if ("check_c_headers" in env): + for header in env["check_c_headers"]: + if (conf.CheckCHeader(header[0])): + if (env.msvc): + env.Append(CCFLAGS=['/D' + header[1]]) + else: + env.Append(CCFLAGS=['-D' + header[1]]) + else: print("No valid target platform selected.") -- cgit v1.2.3