* lib/mkmf.rb (have_devel?): checks if the compiler works.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18995 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
1ca7943e11
commit
fea2b2538d
@ -1,3 +1,7 @@
|
|||||||
|
Sun Aug 31 18:22:04 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* lib/mkmf.rb (have_devel?): checks if the compiler works.
|
||||||
|
|
||||||
Sun Aug 31 18:02:41 2008 Yuki Sonoda (Yugui) <yugui@yugui.jp>
|
Sun Aug 31 18:02:41 2008 Yuki Sonoda (Yugui) <yugui@yugui.jp>
|
||||||
|
|
||||||
* Temporarily uses git://github.com/yugui/rubyspec.git
|
* Temporarily uses git://github.com/yugui/rubyspec.git
|
||||||
|
25
lib/mkmf.rb
25
lib/mkmf.rb
@ -340,7 +340,21 @@ def create_tmpsrc(src)
|
|||||||
src
|
src
|
||||||
end
|
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)
|
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)
|
src = create_tmpsrc(src, &b)
|
||||||
xsystem(command)
|
xsystem(command)
|
||||||
ensure
|
ensure
|
||||||
@ -448,7 +462,6 @@ end
|
|||||||
def try_static_assert(expr, headers = nil, opt = "", &b)
|
def try_static_assert(expr, headers = nil, opt = "", &b)
|
||||||
headers = cpp_include(headers)
|
headers = cpp_include(headers)
|
||||||
try_compile(<<SRC, opt, &b)
|
try_compile(<<SRC, opt, &b)
|
||||||
#{COMMON_HEADERS}
|
|
||||||
#{headers}
|
#{headers}
|
||||||
/*top*/
|
/*top*/
|
||||||
int conftest_const[(#{expr}) ? 1 : -1];
|
int conftest_const[(#{expr}) ? 1 : -1];
|
||||||
@ -487,8 +500,7 @@ def try_constant(const, headers = nil, opt = "", &b)
|
|||||||
upper = -upper if neg
|
upper = -upper if neg
|
||||||
return upper
|
return upper
|
||||||
else
|
else
|
||||||
src = %{#{COMMON_HEADERS}
|
src = %{#{includes}
|
||||||
#{includes}
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
/*top*/
|
/*top*/
|
||||||
int conftest_const = (int)(#{const});
|
int conftest_const = (int)(#{const});
|
||||||
@ -506,7 +518,6 @@ end
|
|||||||
def try_func(func, libs, headers = nil, &b)
|
def try_func(func, libs, headers = nil, &b)
|
||||||
headers = cpp_include(headers)
|
headers = cpp_include(headers)
|
||||||
try_link(<<"SRC", libs, &b) or try_link(<<"SRC", libs, &b)
|
try_link(<<"SRC", libs, &b) or try_link(<<"SRC", libs, &b)
|
||||||
#{COMMON_HEADERS}
|
|
||||||
#{headers}
|
#{headers}
|
||||||
/*top*/
|
/*top*/
|
||||||
#{MAIN_DOES_NOTHING}
|
#{MAIN_DOES_NOTHING}
|
||||||
@ -522,7 +533,6 @@ end
|
|||||||
def try_var(var, headers = nil, &b)
|
def try_var(var, headers = nil, &b)
|
||||||
headers = cpp_include(headers)
|
headers = cpp_include(headers)
|
||||||
try_compile(<<"SRC", &b)
|
try_compile(<<"SRC", &b)
|
||||||
#{COMMON_HEADERS}
|
|
||||||
#{headers}
|
#{headers}
|
||||||
/*top*/
|
/*top*/
|
||||||
#{MAIN_DOES_NOTHING}
|
#{MAIN_DOES_NOTHING}
|
||||||
@ -840,7 +850,6 @@ end
|
|||||||
def have_struct_member(type, member, headers = nil, &b)
|
def have_struct_member(type, member, headers = nil, &b)
|
||||||
checking_for checking_message("#{type}.#{member}", headers) do
|
checking_for checking_message("#{type}.#{member}", headers) do
|
||||||
if try_compile(<<"SRC", &b)
|
if try_compile(<<"SRC", &b)
|
||||||
#{COMMON_HEADERS}
|
|
||||||
#{cpp_include(headers)}
|
#{cpp_include(headers)}
|
||||||
/*top*/
|
/*top*/
|
||||||
#{MAIN_DOES_NOTHING}
|
#{MAIN_DOES_NOTHING}
|
||||||
@ -857,7 +866,6 @@ end
|
|||||||
|
|
||||||
def try_type(type, headers = nil, opt = "", &b)
|
def try_type(type, headers = nil, opt = "", &b)
|
||||||
if try_compile(<<"SRC", opt, &b)
|
if try_compile(<<"SRC", opt, &b)
|
||||||
#{COMMON_HEADERS}
|
|
||||||
#{cpp_include(headers)}
|
#{cpp_include(headers)}
|
||||||
/*top*/
|
/*top*/
|
||||||
typedef #{type} conftest_type;
|
typedef #{type} conftest_type;
|
||||||
@ -912,7 +920,6 @@ end
|
|||||||
def try_const(const, headers = nil, opt = "", &b)
|
def try_const(const, headers = nil, opt = "", &b)
|
||||||
const, type = *const
|
const, type = *const
|
||||||
if try_compile(<<"SRC", opt, &b)
|
if try_compile(<<"SRC", opt, &b)
|
||||||
#{COMMON_HEADERS}
|
|
||||||
#{cpp_include(headers)}
|
#{cpp_include(headers)}
|
||||||
/*top*/
|
/*top*/
|
||||||
typedef #{type || 'int'} conftest_type;
|
typedef #{type || 'int'} conftest_type;
|
||||||
@ -977,7 +984,6 @@ end
|
|||||||
# pointer.
|
# pointer.
|
||||||
def scalar_ptr_type?(type, member = nil, headers = nil, &b)
|
def scalar_ptr_type?(type, member = nil, headers = nil, &b)
|
||||||
try_compile(<<"SRC", &b) # pointer
|
try_compile(<<"SRC", &b) # pointer
|
||||||
#{COMMON_HEADERS}
|
|
||||||
#{cpp_include(headers)}
|
#{cpp_include(headers)}
|
||||||
/*top*/
|
/*top*/
|
||||||
volatile #{type} conftestval;
|
volatile #{type} conftestval;
|
||||||
@ -990,7 +996,6 @@ end
|
|||||||
# pointer.
|
# pointer.
|
||||||
def scalar_type?(type, member = nil, headers = nil, &b)
|
def scalar_type?(type, member = nil, headers = nil, &b)
|
||||||
try_compile(<<"SRC", &b) # pointer
|
try_compile(<<"SRC", &b) # pointer
|
||||||
#{COMMON_HEADERS}
|
|
||||||
#{cpp_include(headers)}
|
#{cpp_include(headers)}
|
||||||
/*top*/
|
/*top*/
|
||||||
volatile #{type} conftestval;
|
volatile #{type} conftestval;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user