mirror of
https://github.com/ruby/ruby.git
synced 2025-09-16 17:14:01 +02:00
* lib/mkmf.rb (find_type): new method.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@12868 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
7fe9ebc2d8
commit
c28c4a79b7
2 changed files with 39 additions and 14 deletions
|
@ -1,9 +1,11 @@
|
||||||
Fri Aug 3 06:40:04 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Fri Aug 3 07:09:05 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* lib/mkmf.rb: more verbose message. [ruby-Bugs-12766]
|
* lib/mkmf.rb: more verbose message. [ruby-Bugs-12766]
|
||||||
|
|
||||||
* lib/mkmf.rb (have_type): suppress a warning with -Wall.
|
* lib/mkmf.rb (have_type): suppress a warning with -Wall.
|
||||||
|
|
||||||
|
* lib/mkmf.rb (find_type): new method.
|
||||||
|
|
||||||
Thu Aug 2 13:46:39 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Thu Aug 2 13:46:39 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* sprintf.c (rb_f_sprintf): should not check positional number as
|
* sprintf.c (rb_f_sprintf): should not check positional number as
|
||||||
|
|
49
lib/mkmf.rb
49
lib/mkmf.rb
|
@ -754,6 +754,21 @@ SRC
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def try_type(type, headers = nil, opt = "", &b)
|
||||||
|
if try_compile(<<"SRC", opt, &b)
|
||||||
|
#{COMMON_HEADERS}
|
||||||
|
#{cpp_include(headers)}
|
||||||
|
/*top*/
|
||||||
|
typedef #{type} conftest_type;
|
||||||
|
int conftestval[sizeof(conftest_type)?1:-1];
|
||||||
|
SRC
|
||||||
|
$defs.push(format("-DHAVE_TYPE_%s", type.strip.upcase.tr_s("^A-Z0-9_", "_")))
|
||||||
|
true
|
||||||
|
else
|
||||||
|
false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
# Returns whether or not the static type +type+ is defined. You may
|
# Returns whether or not the static type +type+ is defined. You may
|
||||||
# optionally pass additional +headers+ to check against in addition to the
|
# optionally pass additional +headers+ to check against in addition to the
|
||||||
# common header files.
|
# common header files.
|
||||||
|
@ -769,18 +784,26 @@ end
|
||||||
#
|
#
|
||||||
def have_type(type, headers = nil, opt = "", &b)
|
def have_type(type, headers = nil, opt = "", &b)
|
||||||
checking_for checking_message(type, headers, opt) do
|
checking_for checking_message(type, headers, opt) do
|
||||||
headers = cpp_include(headers)
|
try_type(type, headers, opt, &b)
|
||||||
if try_compile(<<"SRC", opt, &b)
|
end
|
||||||
#{COMMON_HEADERS}
|
end
|
||||||
#{headers}
|
|
||||||
/*top*/
|
# Returns where the static type +type+ is defined.
|
||||||
typedef #{type} conftest_type;
|
#
|
||||||
int conftestval[sizeof(conftest_type)?1:-1];
|
# You may also pass additional flags to +opt+ which are then passed along to
|
||||||
SRC
|
# the compiler.
|
||||||
$defs.push(format("-DHAVE_TYPE_%s", type.strip.upcase.tr_s("^A-Z0-9_", "_")))
|
#
|
||||||
true
|
# See also +have_type+.
|
||||||
else
|
#
|
||||||
false
|
def find_type(type, opt, *headers, &b)
|
||||||
|
opt ||= ""
|
||||||
|
fmt = "not found"
|
||||||
|
def fmt.%(x)
|
||||||
|
x ? x.respond_to?(:join) ? x.join(",") : x : self
|
||||||
|
end
|
||||||
|
checking_for checking_message(type, nil, opt), fmt do
|
||||||
|
headers.find do |h|
|
||||||
|
try_type(type, h, opt, &b)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -1386,7 +1409,7 @@ site-install-rb: install-rb
|
||||||
end
|
end
|
||||||
while line = dfile.gets()
|
while line = dfile.gets()
|
||||||
line.gsub!(/\.o\b/, ".#{$OBJEXT}")
|
line.gsub!(/\.o\b/, ".#{$OBJEXT}")
|
||||||
line.gsub!(/\$\(hdrdir\)\/config.h/, $config_h) if $config_h
|
line.gsub!(/\$\((?:hdr|top)dir\)\/config.h/, $config_h) if $config_h
|
||||||
if /(?:^|[^\\])(?:\\\\)*\\$/ =~ line
|
if /(?:^|[^\\])(?:\\\\)*\\$/ =~ line
|
||||||
(cont ||= []) << line
|
(cont ||= []) << line
|
||||||
next
|
next
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue