summaryrefslogtreecommitdiff
path: root/mkconfig.rb
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1999-08-13 05:45:20 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1999-08-13 05:45:20 +0000
commit65a5162550f58047974793cdc8067a970b2435c0 (patch)
tree082bb7d5568f3b2e36e3fe166e9f3039394fcf44 /mkconfig.rb
parentfcd020c83028f5610d382e85a2df00223e12bd7e (diff)
1.4.0
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@520 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'mkconfig.rb')
-rw-r--r--mkconfig.rb41
1 files changed, 28 insertions, 13 deletions
diff --git a/mkconfig.rb b/mkconfig.rb
index 903cdda..093d023 100644
--- a/mkconfig.rb
+++ b/mkconfig.rb
@@ -9,7 +9,7 @@ version = VERSION
config = open(rbconfig_rb, "w")
$stdout.reopen(config)
-fast = {'prefix'=>TRUE, 'INSTALL'=>TRUE, 'binsuffix'=>TRUE}
+fast = {'prefix'=>TRUE, 'INSTALL'=>TRUE, 'EXEEXT'=>TRUE}
print %[
module Config
@@ -23,6 +23,7 @@ module Config
print " CONFIG = {}\n"
v_fast = []
v_others = []
+has_version = false
File.foreach "config.status" do |$_|
next if /^#/
if /^s%@program_transform_name@%s,(.*)%g$/
@@ -33,7 +34,7 @@ File.foreach "config.status" do |$_|
val = $2 || ""
next if name =~ /^(INSTALL|DEFS|configure_input|srcdir|top_srcdir)$/
v = " CONFIG[\"" + name + "\"] = " +
- val.sub(/^\s*(.*)\s*$/, '"\1"').gsub(/\$[{(]?([^})]+)[})]?/) {
+ val.sub(/^\s*(.*)\s*$/, '"\1"').gsub(/\$\{?([^(){}]+)\}?/) {
"\#{CONFIG[\\\"#{$1}\\\"]}"
} + "\n"
if fast[name]
@@ -41,6 +42,7 @@ File.foreach "config.status" do |$_|
else
v_others << v
end
+ has_version = true if name == "MAJOR"
if /DEFS/
val.split(/\s*-D/).each do |i|
if i =~ /(.*)=(\\")?([^\\]*)(\\")?/
@@ -55,23 +57,36 @@ File.foreach "config.status" do |$_|
end
end
elsif /^ac_given_srcdir=(.*)/
- path = $1
- cwd = Dir.pwd
- begin
- Dir.chdir path
- v_fast << " CONFIG[\"srcdir\"] = \"" + Dir.pwd + "\"\n"
- ensure
- Dir.chdir cwd
- end
+ v_fast << " CONFIG[\"srcdir\"] = \"" + File.expand_path($1) + "\"\n"
elsif /^ac_given_INSTALL=(.*)/
v_fast << " CONFIG[\"INSTALL\"] = " + $1 + "\n"
end
# break if /^CEOF/
end
+if not has_version
+ VERSION.scan(/(\d+)\.(\d+)\.(\d+)/) {
+ print " CONFIG[\"MAJOR\"] = \"" + $1 + "\"\n"
+ print " CONFIG[\"MINOR\"] = \"" + $2 + "\"\n"
+ print " CONFIG[\"TEENY\"] = \"" + $3 + "\"\n"
+ }
+end
+
print v_fast, v_others
-Dir.chdir File.dirname($0)
-print " CONFIG[\"compile_dir\"] = \"#{Dir.pwd}\"\n"
-print "end\n"
+print <<EOS
+ CONFIG["compile_dir"] = "#{Dir.pwd}"
+ CONFIG.each_value do |val|
+ val.gsub!(/\\$\\(([^()]+)\\)/) do |var|
+ key = $1
+ if CONFIG.key? key
+ "\#{CONFIG[\\\"\#{key}\\\"]}"
+ else
+ var
+ end
+ end
+ end
+end
+EOS
config.close
+
# vi:set sw=2: