ruby-changes:7476
From: nobu <ko1@a...>
Date: Sun, 31 Aug 2008 18:22:27 +0900 (JST)
Subject: [ruby-changes:7476] Ruby:r18995 (ruby_1_8, trunk): * lib/mkmf.rb (have_devel?): checks if the compiler works.
nobu 2008-08-31 18:22:06 +0900 (Sun, 31 Aug 2008) New Revision: 18995 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=18995 Log: * lib/mkmf.rb (have_devel?): checks if the compiler works. Modified files: branches/ruby_1_8/ChangeLog branches/ruby_1_8/lib/mkmf.rb trunk/ChangeLog trunk/lib/mkmf.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 18994) +++ ChangeLog (revision 18995) @@ -1,3 +1,7 @@ +Sun Aug 31 18:22:04 2008 Nobuyoshi Nakada <nobu@r...> + + * lib/mkmf.rb (have_devel?): checks if the compiler works. + Sun Aug 31 18:02:41 2008 Yuki Sonoda (Yugui) <yugui@y...> * Temporarily uses git://github.com/yugui/rubyspec.git Index: lib/mkmf.rb =================================================================== --- lib/mkmf.rb (revision 18994) +++ lib/mkmf.rb (revision 18995) @@ -340,7 +340,21 @@ src end +def have_devel? + unless defined? $have_devel + $have_devel = true + $have_devel = try_link(MAIN_DOES_NOTHING) + end + $have_devel +end + def try_do(src, command, &b) + unless have_devel? + raise <<MSG +The complier failed to generate an executable file. +You have to install development tools first. +MSG + end src = create_tmpsrc(src, &b) xsystem(command) ensure @@ -448,7 +462,6 @@ def try_static_assert(expr, headers = nil, opt = "", &b) headers = cpp_include(headers) try_compile(<<SRC, opt, &b) -#{COMMON_HEADERS} #{headers} /*top*/ int conftest_const[(#{expr}) ? 1 : -1]; @@ -487,8 +500,7 @@ upper = -upper if neg return upper else - src = %{#{COMMON_HEADERS} -#{includes} + src = %{#{includes} #include <stdio.h> /*top*/ int conftest_const = (int)(#{const}); @@ -506,7 +518,6 @@ def try_func(func, libs, headers = nil, &b) headers = cpp_include(headers) try_link(<<"SRC", libs, &b) or try_link(<<"SRC", libs, &b) -#{COMMON_HEADERS} #{headers} /*top*/ #{MAIN_DOES_NOTHING} @@ -522,7 +533,6 @@ def try_var(var, headers = nil, &b) headers = cpp_include(headers) try_compile(<<"SRC", &b) -#{COMMON_HEADERS} #{headers} /*top*/ #{MAIN_DOES_NOTHING} @@ -840,7 +850,6 @@ def have_struct_member(type, member, headers = nil, &b) checking_for checking_message("#{type}.#{member}", headers) do if try_compile(<<"SRC", &b) -#{COMMON_HEADERS} #{cpp_include(headers)} /*top*/ #{MAIN_DOES_NOTHING} @@ -857,7 +866,6 @@ def try_type(type, headers = nil, opt = "", &b) if try_compile(<<"SRC", opt, &b) -#{COMMON_HEADERS} #{cpp_include(headers)} /*top*/ typedef #{type} conftest_type; @@ -912,7 +920,6 @@ def try_const(const, headers = nil, opt = "", &b) const, type = *const if try_compile(<<"SRC", opt, &b) -#{COMMON_HEADERS} #{cpp_include(headers)} /*top*/ typedef #{type || 'int'} conftest_type; @@ -977,7 +984,6 @@ # pointer. def scalar_ptr_type?(type, member = nil, headers = nil, &b) try_compile(<<"SRC", &b) # pointer -#{COMMON_HEADERS} #{cpp_include(headers)} /*top*/ volatile #{type} conftestval; @@ -990,7 +996,6 @@ # pointer. def scalar_type?(type, member = nil, headers = nil, &b) try_compile(<<"SRC", &b) # pointer -#{COMMON_HEADERS} #{cpp_include(headers)} /*top*/ volatile #{type} conftestval; Index: ruby_1_8/ChangeLog =================================================================== --- ruby_1_8/ChangeLog (revision 18994) +++ ruby_1_8/ChangeLog (revision 18995) @@ -1,3 +1,7 @@ +Sun Aug 31 18:22:04 2008 Nobuyoshi Nakada <nobu@r...> + + * lib/mkmf.rb (have_devel?): checks if the compiler works. + Sun Aug 31 17:52:45 2008 Nobuyoshi Nakada <nobu@r...> * lib/mkmf.rb (try_func, try_var, have_struct_member), Index: ruby_1_8/lib/mkmf.rb =================================================================== --- ruby_1_8/lib/mkmf.rb (revision 18994) +++ ruby_1_8/lib/mkmf.rb (revision 18995) @@ -303,7 +303,21 @@ src end +def have_devel? + unless defined? $have_devel + $have_devel = true + $have_devel = try_link(MAIN_DOES_NOTHING) + end + $have_devel +end + def try_do(src, command, &b) + unless have_devel? + raise <<MSG +The complier failed to generate an executable file. +You have to install development tools first. +MSG + end src = create_tmpsrc(src, &b) xsystem(command) ensure @@ -405,7 +419,6 @@ def try_static_assert(expr, headers = nil, opt = "", &b) headers = cpp_include(headers) try_compile(<<SRC, opt, &b) -#{COMMON_HEADERS} #{headers} /*top*/ int conftest_const[(#{expr}) ? 1 : -1]; @@ -444,8 +457,7 @@ upper = -upper if neg return upper else - src = %{#{COMMON_HEADERS} -#{includes} + src = %{#{includes} #include <stdio.h> /*top*/ int conftest_const = (int)(#{const}); @@ -463,7 +475,6 @@ def try_func(func, libs, headers = nil, &b) headers = cpp_include(headers) try_link(<<"SRC", libs, &b) or try_link(<<"SRC", libs, &b) -#{COMMON_HEADERS} #{headers} /*top*/ #{MAIN_DOES_NOTHING} @@ -479,7 +490,6 @@ def try_var(var, headers = nil, &b) headers = cpp_include(headers) try_compile(<<"SRC", &b) -#{COMMON_HEADERS} #{headers} /*top*/ #{MAIN_DOES_NOTHING} @@ -794,7 +804,6 @@ def have_struct_member(type, member, headers = nil, &b) checking_for checking_message("#{type}.#{member}", headers) do if try_compile(<<"SRC", &b) -#{COMMON_HEADERS} #{cpp_include(headers)} /*top*/ #{MAIN_DOES_NOTHING} @@ -810,7 +819,6 @@ def try_type(type, headers = nil, opt = "", &b) if try_compile(<<"SRC", opt, &b) -#{COMMON_HEADERS} #{cpp_include(headers)} /*top*/ typedef #{type} conftest_type; @@ -865,7 +873,6 @@ def try_const(const, headers = nil, opt = "", &b) const, type = *const if try_compile(<<"SRC", opt, &b) -#{COMMON_HEADERS} #{cpp_include(headers)} /*top*/ typedef #{type || 'int'} conftest_type; @@ -930,7 +937,6 @@ # pointer. def scalar_ptr_type?(type, member = nil, headers = nil, &b) try_compile(<<"SRC", &b) # pointer -#{COMMON_HEADERS} #{cpp_include(headers)} /*top*/ volatile #{type} conftestval; @@ -943,7 +949,6 @@ # pointer. def scalar_type?(type, member = nil, headers = nil, &b) try_compile(<<"SRC", &b) # pointer -#{COMMON_HEADERS} #{cpp_include(headers)} /*top*/ volatile #{type} conftestval; -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/