summaryrefslogtreecommitdiff
path: root/mkconfig.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-10-21 14:17:44 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-10-21 14:17:44 +0000
commitb9ecdfaa3d8bb6c318c2299f020a0583bcdfe88c (patch)
tree256f7ef575c3c57ea4cde2e539f7c38d21bdb9ea /mkconfig.rb
parent8209f4fb71cb1ec86f9e24b3aa7a2e54b3d215bc (diff)
* configure.in (XCFLAGS): CFLAGS to comile ruby itself.
* configure.in (LIBEXT): suffix for static libraries. * configure.in (LIBPATHFLAG): switch template to specify library path. * configure.in (LINK_SO): command to link shared objects. * configure.in (DEFFILE, ARCHFILE): miscellaneous system dependent files. * configure.in (EXPORT_PREFIX): prefix to exported symbols on Windows. * configure.in (COMMON_LIBS, COMMON_MACROS, COMMON_HEADERS): libraries, macros and headers used in common. * configure.in (RUBYW_INSTALL_NAME, rubyw_install_name): GUI mode excutable name. * Makefile.in (CFLAGS): append XCFLAGS. * Makefile.in (PREP): miscellaneous system dependent files. * Makefile.in (ruby.imp, ext/extinit.o): moved from ext/extmk.rb. * Makefile.in (fake.rb): CROSS_COMPILING keeps building platform. * Makefile.in (MAKEFILES): depend on *.in and config.status. * Makefile.in (parse.c): replace "y.tab.c" with actual name for byacc. * ext/extmk.rb, lib/mkmf.rb: integrated. * ext/extmk.rb: propagate MFLAGS. * ext/extmk.rb (extmake): make dummy Makefile to clean even if no Makefile is made. * lib/mkmf.rb (older): accept multiple file names and Time objects. * lib/mkmf.rb (xsystem): split and qoute. * lib/mkmf.rb (cpp_include): make include directives. * lib/mkmf.rb (try_func): try wheather specified function is available. * lib/mkmf.rb (install_files): default to site-install. * lib/mkmf.rb (checking_for): added. * lib/mkmf.rb (find_executable0): just find executable file with no message. * lib/mkmf.rb (create_header): output header file is variable. * lib/mkmf.rb (create_makefile): separate sections. * lib/mkmf.rb (init_mkmf): initialize global variables. * win32/Makefile.sub, bcc32/Makefile.sub (CPP, AR): added. * bcc32/Makefile.sub (ARCH): fixed to i386. * win32/Makefile.sub, bcc32/Makefile.sub (miniruby): should not link EXTOBJS. * ext/dl/extconf.rb: use try_cpp to cross compile. * ext/dl/extconf.rb: not modify files in source directory. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2977 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'mkconfig.rb')
-rw-r--r--mkconfig.rb49
1 files changed, 32 insertions, 17 deletions
diff --git a/mkconfig.rb b/mkconfig.rb
index b23e6b0..0109f09 100644
--- a/mkconfig.rb
+++ b/mkconfig.rb
@@ -3,7 +3,7 @@
require File.dirname($0)+"/lib/ftools"
rbconfig_rb = ARGV[0] || 'rbconfig.rb'
-srcdir = $srcdir if $srcdir
+srcdir = $srcdir || '.'
File.makedirs(File.dirname(rbconfig_rb), true)
version = RUBY_VERSION
@@ -23,10 +23,8 @@ module Config
# made to this file will be lost the next time ruby is built.
]
-print " DESTDIR = '' if not defined? DESTDIR\n CONFIG = {}\n"
v_fast = []
v_others = []
-has_srcdir = false
has_version = false
File.foreach "config.status" do |line|
next if /^#/ =~ line
@@ -49,19 +47,33 @@ File.foreach "config.status" do |line|
end
has_version = true if name == "MAJOR"
elsif /^(?:ac_given_)?srcdir=(.*)/ =~ line
- v_fast << " CONFIG[\"srcdir\"] = \"" + File.expand_path($1) + "\"\n"
- has_srcdir = true
+ srcdir = $1
elsif /^ac_given_INSTALL=(.*)/ =~ line
v_fast << " CONFIG[\"INSTALL\"] = " + $1 + "\n"
end
# break if /^CEOF/
end
-if not has_srcdir
- v_fast << " CONFIG[\"srcdir\"] = \"" + File.expand_path(srcdir || '.') + "\"\n"
+srcdir = File.expand_path(srcdir)
+v_fast.unshift(" CONFIG[\"srcdir\"] = \"" + srcdir + "\"\n")
+
+v_fast.collect! do |x|
+ if /"prefix"/ === x
+ x.sub(/= (.*)/, '= (TOPDIR || DESTDIR + \1)')
+ else
+ x
+ end
end
-if not has_version
+drive = File::PATH_SEPARATOR == ';'
+
+prefix = Regexp.quote('/lib/ruby/' + RUBY_VERSION.sub(/\.\d+$/, '') + '/' + RUBY_PLATFORM)
+print " TOPDIR = File.dirname(__FILE__).sub!(%r'#{prefix}\\Z', '')\n"
+print " DESTDIR = ", (drive ? "TOPDIR && TOPDIR[/\\A[a-z]:/i] || " : ""), "'' unless defined? DESTDIR\n"
+print " CONFIG = {}\n"
+print " CONFIG[\"DESTDIR\"] = DESTDIR\n"
+
+unless has_version
RUBY_VERSION.scan(/(\d+)\.(\d+)\.(\d+)/) {
print " CONFIG[\"MAJOR\"] = \"" + $1 + "\"\n"
print " CONFIG[\"MINOR\"] = \"" + $2 + "\"\n"
@@ -69,11 +81,10 @@ if not has_version
}
end
-v_fast.collect! do |x|
- if /"prefix"/ === x
- prefix = Regexp.quote('/lib/ruby/' + RUBY_VERSION.sub(/\.\d+$/, '') + '/' + RUBY_PLATFORM)
- puts " TOPDIR = File.dirname(__FILE__).sub!(%r'#{prefix}\\Z', '')"
- x.sub(/= (.*)/, '= (TOPDIR || DESTDIR + \1)')
+dest = drive ? /= \"(?!\$[\(\{])(?:[a-z]:)?/i : /= \"(?!\$[\(\{])/
+v_others.collect! do |x|
+ if /^\s*CONFIG\["(?!abs_|old)[a-z]+(?:_prefix|dir)"]/ === x
+ x.sub(dest, '= "$(DESTDIR)')
else
x
end
@@ -97,10 +108,14 @@ print <<EOS
CONFIG["compile_dir"] = "#{Dir.pwd}"
MAKEFILE_CONFIG = {}
CONFIG.each{|k,v| MAKEFILE_CONFIG[k] = v.dup}
- def Config::expand(val)
- val.gsub!(/\\$\\(([^()]+)\\)|\\$\\{([^{}]+)\\}/) do |var|
- if key = CONFIG[$1 || $2]
- Config::expand(key)
+ def Config::expand(val, config = CONFIG)
+ val.gsub!(/\\$\\$|\\$\\(([^()]+)\\)|\\$\\{([^{}]+)\\}/) do |var|
+ if !(v = $1 || $2)
+ '$'
+ elsif key = config[v]
+ config[v] = false
+ Config::expand(key, config)
+ config[v] = key
else
var
end