implement ConfigureOp#check_cxx_header

This commit is contained in:
josh committed 2018-11-07 21:44:04 -05:00
1 parent 6bb0a55a55
commit 85b0111a6e
6 files changed
+61

No files matched your search

+5
View File
@@ -99,6 +99,11 @@ module Rscons
co.check_c_header(*cch)
end
end
if cchs = @script.check_cxx_headers
cchs.each do |cch|
co.check_cxx_header(*cch)
end
end
rescue ConfigureOp::ConfigureFailure
rv = 1
end
+21
View File
@@ -119,6 +119,27 @@ module Rscons
common_config_checks(status, options)
end
# Check for a C++ header.
def check_cxx_header(header_name, options = {})
$stdout.write("Checking for C++ header '#{header_name}'... ")
File.open("#{@work_dir}/cfgtest.cxx", "wb") do |fh|
fh.puts <<-EOF
#include "#{header_name}"
int main(int argc, char * argv[]) {
return 0;
}
EOF
end
vars = {
"LD" => "${CXX}",
"_SOURCES" => "#{@work_dir}/cfgtest.cxx",
"_TARGET" => "#{@work_dir}/cfgtest.exe",
}
command = @env.build_command("${LDCMD}", vars)
_, _, status = log_and_test_command(command)
common_config_checks(status, options)
end
private
# Test a C compiler.