diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2002-03-29 07:42:20 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2002-03-29 07:42:20 +0000 |
commit | 09651f04313f679e9eaa604c64d7e62a6ce58eab (patch) | |
tree | 68312744c6252a544a65bbb961322fc80690d1db | |
parent | 8e565c612d6b6d6c3e1ece97554f910c9576d100 (diff) | |
download | ruby-09651f04313f679e9eaa604c64d7e62a6ce58eab.tar.gz |
* lib/mkmf.rb (arg_config): should use Shellwords::shellwords like
ext/extmk.rb.in.
* lib/mkmf.rb (enable_config): default had priority over command
line options and configure_args.
* lib/mkmf.rb: support autoconf 2.53 style variables from
environment.
* lib/mkmf.rb: add directory options.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2303 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 14 | ||||
-rw-r--r-- | lib/mkmf.rb | 52 |
2 files changed, 49 insertions, 17 deletions
@@ -1,3 +1,17 @@ +Fri Mar 29 16:36:52 2002 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp> + + * lib/mkmf.rb (arg_config): should use Shellwords::shellwords like + ext/extmk.rb.in. + + * lib/mkmf.rb (enable_config): default had priority over command + line options and configure_args. + + * lib/mkmf.rb: support autoconf 2.53 style variables from + environment. + + * lib/mkmf.rb: add directory options. + + Fri Mar 29 15:49:29 2002 Usaku Nakamura <usa@ruby-lang.org> * win32/README.win32: follow recent changes. diff --git a/lib/mkmf.rb b/lib/mkmf.rb index 8b8363af82..f0a846a25d 100644 --- a/lib/mkmf.rb +++ b/lib/mkmf.rb @@ -3,13 +3,33 @@ require 'rbconfig' require 'find' +require 'shellwords' CONFIG = Config::MAKEFILE_CONFIG ORIG_LIBPATH = ENV['LIB'] SRC_EXT = ["c", "cc", "m", "cxx", "cpp", "C"] -$config_cache = CONFIG["compile_dir"]+"/ext/config.cache" +unless defined? $configure_args + $configure_args = {} + for arg in Shellwords.shellwords(CONFIG["configure_args"]) + arg, val = arg.split('=', 2) + if arg.sub!(/^(?!--)/, '--') + val or next + arg.downcase! + end + next if /^--(?:top|topsrc|src|cur)dir$/ =~ arg + $configure_args[arg] = val || true + end + for arg in ARGV + arg, val = arg.split('=', 2) + if arg.sub!(/^(?!--)/, '--') + val or next + arg.downcase! + end + $configure_args[arg] = val || true + end +end $srcdir = CONFIG["srcdir"] $libdir = CONFIG["libdir"] @@ -295,14 +315,6 @@ SRC end def arg_config(config, default=nil) - unless defined? $configure_args - $configure_args = {} - for arg in CONFIG["configure_args"].split + ARGV - next unless /^--/ =~ arg - arg, val = arg.split('=', 2) - $configure_args[arg] = val || true - end - end $configure_args.fetch(config, default) end @@ -314,9 +326,9 @@ def with_config(config, default=nil) end def enable_config(config, default=nil) - if arg_config("--enable-"+config, default) + if arg_config("--enable-"+config) true - elsif arg_config("--disable-"+config, false) + elsif arg_config("--disable-"+config) false else default @@ -361,7 +373,7 @@ def with_destdir(dir) /^\$[\(\{]/ =~ dir ? dir : "$(DESTDIR)"+dir end -def create_makefile(target, srcdir = File.dirname($0)) +def create_makefile(target, srcdir = $srcdir) save_libs = $libs.dup save_libpath = $LIBPATH.dup print "creating Makefile\n" @@ -386,6 +398,7 @@ def create_makefile(target, srcdir = File.dirname($0)) $configure_args['--enable-shared'] or $LIBPATH |= [$topdir] $LIBPATH |= [CONFIG["libdir"]] + srcdir ||= '.' defflag = '' if RUBY_PLATFORM =~ /cygwin|mingw/ deffile = target + '.def' @@ -413,7 +426,7 @@ def create_makefile(target, srcdir = File.dirname($0)) unless $objs then $objs = [] - for f in Dir[File.join(srcdir || ".", "*.{#{SRC_EXT.join(%q{,})}}")] + for f in Dir[File.join(srcdir, "*.{#{SRC_EXT.join(%q{,})}}")] f = File.basename(f) f.sub!(/(#{SRC_EXT.join(%q{|})})$/, $OBJEXT) $objs.push f @@ -432,7 +445,7 @@ SHELL = /bin/sh #### Start of system configuration section. #### -srcdir = #{srcdir || $srcdir} +srcdir = #{srcdir} topdir = #{$topdir} hdrdir = #{$hdrdir} VPATH = $(srcdir) @@ -604,9 +617,14 @@ $defs = [] $make = with_config("make-prog", ENV["MAKE"] || "make") -$CFLAGS = with_config("cflags", "") -$CPPFLAGS = with_config("cppflags", "") -$LDFLAGS = with_config("ldflags", "") +$CFLAGS = with_config("cflags", arg_config("CFLAGS")) +$CPPFLAGS = with_config("cppflags", arg_config("CPPFLAGS")) +$LDFLAGS = with_config("ldflags", arg_config("LDFLAGS")) $LIBPATH = [] dir_config("opt") + +$srcdir = arg_config("--srcdir", File.dirname($0)) +$configure_args["--topsrcdir"] ||= $srcdir +$curdir = arg_config("--curdir", Dir.pwd) +$configure_args["--topdir"] ||= $curdir |