mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
extconf.rb: have_header
* ext/tk/extconf.rb (find_tcltk_header): use have_header instead of try_cpp, which is incredibly slow with VC. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38760 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
42eadff3a1
commit
a5ddc2e196
2 changed files with 39 additions and 12 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
Thu Jan 10 16:47:18 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* ext/tk/extconf.rb (find_tcltk_header): use have_header instead of
|
||||||
|
try_cpp, which is incredibly slow with VC.
|
||||||
|
|
||||||
Thu Jan 10 15:55:28 2013 Shugo Maeda <shugo@ruby-lang.org>
|
Thu Jan 10 15:55:28 2013 Shugo Maeda <shugo@ruby-lang.org>
|
||||||
|
|
||||||
* numeric.c (do_coerce): remove an unused variable.
|
* numeric.c (do_coerce): remove an unused variable.
|
||||||
|
|
|
@ -1358,10 +1358,15 @@ def find_tcltk_header(tclver, tkver)
|
||||||
print(".") # progress
|
print(".") # progress
|
||||||
if major && minor
|
if major && minor
|
||||||
# version check on tcl.h
|
# version check on tcl.h
|
||||||
have_tcl_h = try_cpp("#include <tcl.h>\n#if TCL_MAJOR_VERSION != #{major} || TCL_MINOR_VERSION != #{minor}\n#error VERSION does not match\n#endif")
|
version_check = proc {|code|
|
||||||
|
code << ("#if TCL_MAJOR_VERSION != #{major} || TCL_MINOR_VERSION != #{minor}\n" \
|
||||||
|
"#error VERSION does not match\n" \
|
||||||
|
"#endif")
|
||||||
|
}
|
||||||
else
|
else
|
||||||
have_tcl_h = have_header('tcl.h')
|
version_check = nil
|
||||||
end
|
end
|
||||||
|
have_tcl_h = have_header('tcl.h', &version_check)
|
||||||
unless have_tcl_h
|
unless have_tcl_h
|
||||||
if tclver && ! tclver.empty?
|
if tclver && ! tclver.empty?
|
||||||
versions = [tclver]
|
versions = [tclver]
|
||||||
|
@ -1383,13 +1388,19 @@ def find_tcltk_header(tclver, tkver)
|
||||||
(File.directory?(dir))? File.expand_path(dir): nil
|
(File.directory?(dir))? File.expand_path(dir): nil
|
||||||
}.compact.uniq
|
}.compact.uniq
|
||||||
|
|
||||||
code = "#include <tcl.h>\n"
|
if major || minor
|
||||||
code << "#if TCL_MAJOR_VERSION != #{major}\n#error MAJOR_VERSION does not match\n#endif\n" if major
|
version_check = proc {|code|
|
||||||
code << "#if TCL_MINOR_VERSION != #{minor}\n#error MINOR_VERSION does not match\n#endif\n" if minor
|
code << "#if TCL_MAJOR_VERSION != #{major}\n#error MAJOR_VERSION does not match\n#endif\n" if major
|
||||||
|
code << "#if TCL_MINOR_VERSION != #{minor}\n#error MINOR_VERSION does not match\n#endif\n" if minor
|
||||||
|
code
|
||||||
|
}
|
||||||
|
else
|
||||||
|
version_check = nil
|
||||||
|
end
|
||||||
have_tcl_h = paths.find{|path|
|
have_tcl_h = paths.find{|path|
|
||||||
print(".") # progress
|
print(".") # progress
|
||||||
inc_opt = " -I#{path.quote}"
|
inc_opt = " -I#{path.quote}"
|
||||||
if try_cpp(code, inc_opt)
|
if try_header("tcl", inc_opt, &version_check)
|
||||||
($INCFLAGS ||= "") << inc_opt
|
($INCFLAGS ||= "") << inc_opt
|
||||||
true
|
true
|
||||||
else
|
else
|
||||||
|
@ -1414,10 +1425,15 @@ def find_tcltk_header(tclver, tkver)
|
||||||
print(".") # progress
|
print(".") # progress
|
||||||
if major && minor
|
if major && minor
|
||||||
# version check on tk.h
|
# version check on tk.h
|
||||||
have_tk_h = try_cpp("#include <tk.h>\n#if TK_MAJOR_VERSION != #{major} || TK_MINOR_VERSION != #{minor}\n#error VERSION does not match\n#endif")
|
version_check = proc {|code|
|
||||||
|
code << ("#if TK_MAJOR_VERSION != #{major} || TK_MINOR_VERSION != #{minor}\n" \
|
||||||
|
"#error VERSION does not match\n" \
|
||||||
|
"#endif")
|
||||||
|
}
|
||||||
else
|
else
|
||||||
have_tk_h = have_header('tk.h')
|
version_check = nil
|
||||||
end
|
end
|
||||||
|
have_tk_h = have_header('tk.h')
|
||||||
unless have_tk_h
|
unless have_tk_h
|
||||||
if tkver && ! tkver.empty?
|
if tkver && ! tkver.empty?
|
||||||
versions = [tkver]
|
versions = [tkver]
|
||||||
|
@ -1439,13 +1455,19 @@ def find_tcltk_header(tclver, tkver)
|
||||||
(File.directory?(dir))? File.expand_path(dir): nil
|
(File.directory?(dir))? File.expand_path(dir): nil
|
||||||
}.compact.uniq
|
}.compact.uniq
|
||||||
|
|
||||||
code = "#include <tcl.h>\n#include <tk.h>\n"
|
if major || minor
|
||||||
code << "#if TK_MAJOR_VERSION != #{major}\n#error MAJOR_VERSION does not match\n#endif\n" if major
|
version_check = proc {|code|
|
||||||
code << "#if TK_MINOR_VERSION != #{minor}\n#error MINOR_VERSION does not match\n#endif\n" if minor
|
code << "#if TK_MAJOR_VERSION != #{major}\n#error MAJOR_VERSION does not match\n#endif\n" if major
|
||||||
|
code << "#if TK_MINOR_VERSION != #{minor}\n#error MINOR_VERSION does not match\n#endif\n" if minor
|
||||||
|
code
|
||||||
|
}
|
||||||
|
else
|
||||||
|
version_check = nil
|
||||||
|
end
|
||||||
have_tk_h = paths.find{|path|
|
have_tk_h = paths.find{|path|
|
||||||
print(".") # progress
|
print(".") # progress
|
||||||
inc_opt = " -I#{path.quote}"
|
inc_opt = " -I#{path.quote}"
|
||||||
if try_cpp(code, inc_opt)
|
if try_header(%w'tcl.h tk.h', inc_opt, &version_check)
|
||||||
($INCFLAGS ||= "") << inc_opt
|
($INCFLAGS ||= "") << inc_opt
|
||||||
true
|
true
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue