mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* lib/mkmf.rb (String#tr_cpp): make preprocessor identifiers.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13955 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
5c19fbacec
commit
16dc06014c
3 changed files with 17 additions and 10 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
Sun Nov 18 09:09:48 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* lib/mkmf.rb (String#tr_cpp): make preprocessor identifiers.
|
||||||
|
|
||||||
Sun Nov 18 05:19:46 2007 Tanaka Akira <akr@fsij.org>
|
Sun Nov 18 05:19:46 2007 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
* lib/mkmf.rb (have_struct_member): define HAVE_type_member.
|
* lib/mkmf.rb (have_struct_member): define HAVE_type_member.
|
||||||
|
|
17
lib/mkmf.rb
17
lib/mkmf.rb
|
@ -158,6 +158,9 @@ class String
|
||||||
def quote
|
def quote
|
||||||
/\s/ =~ self ? "\"#{self}\"" : "#{self}"
|
/\s/ =~ self ? "\"#{self}\"" : "#{self}"
|
||||||
end
|
end
|
||||||
|
def tr_cpp
|
||||||
|
strip.upcase.tr_s("^A-Z0-9_", "_")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
class Array
|
class Array
|
||||||
def quote
|
def quote
|
||||||
|
@ -688,7 +691,7 @@ end
|
||||||
def have_func(func, headers = nil, &b)
|
def have_func(func, headers = nil, &b)
|
||||||
checking_for checking_message("#{func}()", headers) do
|
checking_for checking_message("#{func}()", headers) do
|
||||||
if try_func(func, $libs, headers, &b)
|
if try_func(func, $libs, headers, &b)
|
||||||
$defs.push(format("-DHAVE_%s", func.upcase))
|
$defs.push(format("-DHAVE_%s", func.tr_cpp))
|
||||||
true
|
true
|
||||||
else
|
else
|
||||||
false
|
false
|
||||||
|
@ -707,7 +710,7 @@ end
|
||||||
def have_var(var, headers = nil, &b)
|
def have_var(var, headers = nil, &b)
|
||||||
checking_for checking_message(var, headers) do
|
checking_for checking_message(var, headers) do
|
||||||
if try_var(var, headers, &b)
|
if try_var(var, headers, &b)
|
||||||
$defs.push(format("-DHAVE_%s", var.upcase))
|
$defs.push(format("-DHAVE_%s", var.tr_cpp))
|
||||||
true
|
true
|
||||||
else
|
else
|
||||||
false
|
false
|
||||||
|
@ -782,8 +785,8 @@ def have_struct_member(type, member, headers = nil, &b)
|
||||||
int main() { return 0; }
|
int main() { return 0; }
|
||||||
int s = (char *)&((#{type}*)0)->#{member} - (char *)0;
|
int s = (char *)&((#{type}*)0)->#{member} - (char *)0;
|
||||||
SRC
|
SRC
|
||||||
$defs.push(format("-DHAVE_%s_%s", type.strip.upcase.tr_s("^A-Z0-9_", "_"), member.upcase))
|
$defs.push(format("-DHAVE_%s_%s", type.tr_cpp, member.tr_cpp))
|
||||||
$defs.push(format("-DHAVE_ST_%s", member.upcase)) # backward compatibility
|
$defs.push(format("-DHAVE_ST_%s", member.tr_cpp)) # backward compatibility
|
||||||
true
|
true
|
||||||
else
|
else
|
||||||
false
|
false
|
||||||
|
@ -799,7 +802,7 @@ def try_type(type, headers = nil, opt = "", &b)
|
||||||
typedef #{type} conftest_type;
|
typedef #{type} conftest_type;
|
||||||
int conftestval[sizeof(conftest_type)?1:-1];
|
int conftestval[sizeof(conftest_type)?1:-1];
|
||||||
SRC
|
SRC
|
||||||
$defs.push(format("-DHAVE_TYPE_%s", type.strip.upcase.tr_s("^A-Z0-9_", "_")))
|
$defs.push(format("-DHAVE_TYPE_%s", type.tr_cpp))
|
||||||
true
|
true
|
||||||
else
|
else
|
||||||
false
|
false
|
||||||
|
@ -854,7 +857,7 @@ def try_const(const, headers = nil, opt = "", &b)
|
||||||
typedef #{type || 'int'} conftest_type;
|
typedef #{type || 'int'} conftest_type;
|
||||||
conftest_type conftestval = #{type ? '' : '(int)'}#{const};
|
conftest_type conftestval = #{type ? '' : '(int)'}#{const};
|
||||||
SRC
|
SRC
|
||||||
$defs.push(format("-DHAVE_CONST_%s", const.strip.upcase.tr_s("^A-Z0-9_", "_")))
|
$defs.push(format("-DHAVE_CONST_%s", const.tr_cpp))
|
||||||
true
|
true
|
||||||
else
|
else
|
||||||
false
|
false
|
||||||
|
@ -901,7 +904,7 @@ def check_sizeof(type, headers = nil, &b)
|
||||||
end
|
end
|
||||||
checking_for checking_message("size of #{type}", headers), fmt do
|
checking_for checking_message("size of #{type}", headers), fmt do
|
||||||
if size = try_constant(expr, headers, &b)
|
if size = try_constant(expr, headers, &b)
|
||||||
$defs.push(format("-DSIZEOF_%s=%d", type.upcase.tr_s("^A-Z0-9_", "_"), size))
|
$defs.push(format("-DSIZEOF_%s=%d", type.tr_cpp, size))
|
||||||
size
|
size
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#define RUBY_VERSION "1.9.0"
|
#define RUBY_VERSION "1.9.0"
|
||||||
#define RUBY_RELEASE_DATE "2007-11-17"
|
#define RUBY_RELEASE_DATE "2007-11-18"
|
||||||
#define RUBY_VERSION_CODE 190
|
#define RUBY_VERSION_CODE 190
|
||||||
#define RUBY_RELEASE_CODE 20071117
|
#define RUBY_RELEASE_CODE 20071118
|
||||||
#define RUBY_PATCHLEVEL 0
|
#define RUBY_PATCHLEVEL 0
|
||||||
|
|
||||||
#define RUBY_VERSION_MAJOR 1
|
#define RUBY_VERSION_MAJOR 1
|
||||||
|
@ -9,7 +9,7 @@
|
||||||
#define RUBY_VERSION_TEENY 0
|
#define RUBY_VERSION_TEENY 0
|
||||||
#define RUBY_RELEASE_YEAR 2007
|
#define RUBY_RELEASE_YEAR 2007
|
||||||
#define RUBY_RELEASE_MONTH 11
|
#define RUBY_RELEASE_MONTH 11
|
||||||
#define RUBY_RELEASE_DAY 17
|
#define RUBY_RELEASE_DAY 18
|
||||||
|
|
||||||
#ifdef RUBY_EXTERN
|
#ifdef RUBY_EXTERN
|
||||||
RUBY_EXTERN const char ruby_version[];
|
RUBY_EXTERN const char ruby_version[];
|
||||||
|
|
Loading…
Reference in a new issue