diff options
| author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2026-04-09 17:34:06 +0900 |
|---|---|---|
| committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2026-04-09 17:34:06 +0900 |
| commit | 03757030d5b1663e68b4f6e6348a7a71b16ed6c8 (patch) | |
| tree | 6421fdcf064a8b379c680e7be50572214e7bf2d8 | |
| parent | b94a7ec7c3c190db613bce3d9ae1a8b26822357e (diff) | |
mkmf: check for C++ compiler
It may be set to "false" if usable compiler is not found.
| -rw-r--r-- | lib/mkmf.rb | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/mkmf.rb b/lib/mkmf.rb index 39ba4030cc..37ee4a70d9 100644 --- a/lib/mkmf.rb +++ b/lib/mkmf.rb @@ -3030,14 +3030,16 @@ realclean: distclean def cc_command(opt="") conf = cc_config(opt) + cxx_command(opt, conf) RbConfig::expand("$(CXX) #$INCFLAGS #$CPPFLAGS #$CXXFLAGS #$ARCH_FLAG #{opt} -c #{CONFTEST_CXX}", conf) end def cpp_command(outfile, opt="") conf = cpp_config(opt) + cxx = cxx_command(opt, conf) cpp = conf['CPP'].sub(/(\A|\s)#{Regexp.quote(conf['CC'])}(?=\z|\s)/) { - "#$1#{conf['CXX']}" + "#$1#{cxx}" } RbConfig::expand("#{cpp} #$INCFLAGS #$CPPFLAGS #$CXXFLAGS #{opt} #{CONFTEST_CXX} #{outfile}", conf) @@ -3048,6 +3050,12 @@ realclean: distclean RbConfig::expand(TRY_LINK_CXX.dup, conf) end + def cxx_command(opt="", conf = cc_config(opt)) + cxx = conf['CXX'] + raise Errno::ENOENT, "C++ compiler not found" if !cxx or cxx == 'false' + cxx + end + # :startdoc: end |
