Skip to content

Commit 0375703

Browse files
committed
mkmf: check for C++ compiler
It may be set to "false" if usable compiler is not found.
1 parent b94a7ec commit 0375703

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

lib/mkmf.rb

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3030,14 +3030,16 @@ def conftest_source
30303030

30313031
def cc_command(opt="")
30323032
conf = cc_config(opt)
3033+
cxx_command(opt, conf)
30333034
RbConfig::expand("$(CXX) #$INCFLAGS #$CPPFLAGS #$CXXFLAGS #$ARCH_FLAG #{opt} -c #{CONFTEST_CXX}",
30343035
conf)
30353036
end
30363037

30373038
def cpp_command(outfile, opt="")
30383039
conf = cpp_config(opt)
3040+
cxx = cxx_command(opt, conf)
30393041
cpp = conf['CPP'].sub(/(\A|\s)#{Regexp.quote(conf['CC'])}(?=\z|\s)/) {
3040-
"#$1#{conf['CXX']}"
3042+
"#$1#{cxx}"
30413043
}
30423044
RbConfig::expand("#{cpp} #$INCFLAGS #$CPPFLAGS #$CXXFLAGS #{opt} #{CONFTEST_CXX} #{outfile}",
30433045
conf)
@@ -3048,6 +3050,12 @@ def link_command(ldflags, *opts)
30483050
RbConfig::expand(TRY_LINK_CXX.dup, conf)
30493051
end
30503052

3053+
def cxx_command(opt="", conf = cc_config(opt))
3054+
cxx = conf['CXX']
3055+
raise Errno::ENOENT, "C++ compiler not found" if !cxx or cxx == 'false'
3056+
cxx
3057+
end
3058+
30513059
# :startdoc:
30523060
end
30533061

0 commit comments

Comments
 (0)