summaryrefslogtreecommitdiff
path: root/tool/mkconfig.rb
diff options
context:
space:
mode:
Diffstat (limited to 'tool/mkconfig.rb')
-rwxr-xr-xtool/mkconfig.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/tool/mkconfig.rb b/tool/mkconfig.rb
index 74736540cd..edfdda203b 100755
--- a/tool/mkconfig.rb
+++ b/tool/mkconfig.rb
@@ -201,6 +201,12 @@ IO.foreach(File.join(srcdir, "version.h")) do |l|
break if versions.size == 4
next
end
+ m = /^\s*#\s*define\s+RUBY_VERSION_(\w+)\s+(-?\d+)/.match(l)
+ if m
+ versions[m[1]] = m[2]
+ break if versions.size == 4
+ next
+ end
m = /^\s*#\s*define\s+RUBY_VERSION\s+\W?([.\d]+)/.match(l)
if m
versions['MAJOR'], versions['MINOR'], versions['TEENY'] = m[1].split('.')
@@ -208,6 +214,16 @@ IO.foreach(File.join(srcdir, "version.h")) do |l|
next
end
end
+if versions.size != 4
+ IO.foreach(File.join(srcdir, "include/ruby/version.h")) do |l|
+ m = /^\s*#\s*define\s+RUBY_API_VERSION_(\w+)\s+(-?\d+)/.match(l)
+ if m
+ versions[m[1]] ||= m[2]
+ break if versions.size == 4
+ next
+ end
+ end
+end
%w[MAJOR MINOR TEENY PATCHLEVEL].each do |v|
print " CONFIG[#{v.dump}] = #{(versions[v]||vars[v]).dump}\n"
end