diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 1999-08-13 05:45:20 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 1999-08-13 05:45:20 +0000 |
commit | 07bb9f21f56b0d066c44c62b0e6be35eb0e0fd51 (patch) | |
tree | 082bb7d5568f3b2e36e3fe166e9f3039394fcf44 /mkconfig.rb | |
parent | f746453a4ae16f643b2ae8c0d6ec77a2e63b4eb1 (diff) | |
download | ruby-07bb9f21f56b0d066c44c62b0e6be35eb0e0fd51.tar.gz ruby-07bb9f21f56b0d066c44c62b0e6be35eb0e0fd51.tar.xz ruby-07bb9f21f56b0d066c44c62b0e6be35eb0e0fd51.zip |
1.4.0
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@520 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'mkconfig.rb')
-rw-r--r-- | mkconfig.rb | 41 |
1 files changed, 28 insertions, 13 deletions
diff --git a/mkconfig.rb b/mkconfig.rb index 903cddad3..093d02344 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: |