summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1999-05-10 08:22:50 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1999-05-10 08:22:50 +0000
commit27e948fd458b06c3a018d46f04599a874f43fd92 (patch)
treee369ed2a78f4d5393074804b71f136c84e9dfca5 /lib
parent192463c7a5525008a7bf95065261877eff79cf74 (diff)
regexp,range,squeeze
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_3@463 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/jcode.rb5
-rw-r--r--lib/mkmf.rb48
2 files changed, 37 insertions, 16 deletions
diff --git a/lib/jcode.rb b/lib/jcode.rb
index 50b7bee..1ed8232 100644
--- a/lib/jcode.rb
+++ b/lib/jcode.rb
@@ -172,8 +172,11 @@ class String
self.gsub!(/(.|\n)/) do |c|
if comp
unless afrom.include?(c)
- ato[-1]
+ c = ato[-1]
+ next if c == last
+ last = c
else
+ last = nil
c
end
elsif i = afrom.index(c)
diff --git a/lib/mkmf.rb b/lib/mkmf.rb
index c697ade..7ebef9f 100644
--- a/lib/mkmf.rb
+++ b/lib/mkmf.rb
@@ -59,8 +59,8 @@ if /win32|djgpp|mingw32|m68k-human|i386-os2_emx/i =~ PLATFORM
else
$null = open("/dev/null", "w")
end
-LINK = "#{CONFIG['CC']} -o conftest -I#{$hdrdir} -I#{CONFIG['includedir']} #{CFLAGS} %s #{CONFIG['LDFLAGS']} %s conftest.c #{CONFIG['LIBS']} %s"
-CPP = "#{CONFIG['CPP']} -E -I#{$hdrdir} -I#{CONFIG['includedir']} #{CFLAGS} %s conftest.c"
+LINK = "#{CONFIG['CC']} -o conftest -I#{$hdrdir} -I#{CONFIG['includedir']} #{CFLAGS} %s #{CONFIG['LDFLAGS']} %s conftest.c %s %s #{CONFIG['LIBS']}"
+CPP = "#{CONFIG['CPP']} -E -I#{$hdrdir} -I#{CONFIG['includedir']} #{CFLAGS} %s %s conftest.c"
$orgerr = $stderr.dup
$orgout = $stdout.dup
@@ -81,7 +81,7 @@ def try_link0(src, opt="")
cfile = open("conftest.c", "w")
cfile.print src
cfile.close
- xsystem(format(LINK, $CFLAGS, $LDFLAGS, opt))
+ xsystem(format(LINK, $CFLAGS, $LDFLAGS, opt, $LOCAL_LIBS))
end
def try_link(src, opt="")
@@ -92,23 +92,41 @@ def try_link(src, opt="")
end
end
-def try_cpp(src, opt=$CFLAGS)
+def try_cpp(src, opt="")
cfile = open("conftest.c", "w")
cfile.print src
cfile.close
- xsystem(format(CPP, opt))
+ begin
+ xsystem(format(CPP, $CFLAGS, opt))
+ ensure
+ system "rm -f conftest*"
+ end
end
-def egrep_cpp(pat, src, opt=$CFLAGS)
+def egrep_cpp(pat, src, opt="")
cfile = open("conftest.c", "w")
cfile.print src
cfile.close
- xsystem(format(CPP+"|egrep #{pat}", opt))
+ begin
+ xsystem(format(CPP+"|egrep #{pat}", $CFLAGS, opt))
+ ensure
+ system "rm -f conftest*"
+ end
end
def try_run(src, opt="")
- if try_link0(src, opt)
- xsystem("./conftest")
+ begin
+ if try_link0(src, opt)
+ if xsystem("./conftest")
+ true
+ else
+ false
+ end
+ else
+ nil
+ end
+ ensure
+ system "rm -f conftest*"
end
end
@@ -250,7 +268,7 @@ SRC
return TRUE
end
-def arg_config(config, default="yes")
+def arg_config(config, default=nil)
unless defined? $configure_args
$configure_args = {}
for arg in CONFIG["configure_args"].split + ARGV
@@ -258,14 +276,14 @@ def arg_config(config, default="yes")
if /=/ =~ arg
$configure_args[$`] = $'
else
- $configure_args[arg] = default
+ $configure_args[arg] = true
end
end
end
$configure_args.fetch(config, default)
end
-def with_config(config, default="yes")
+def with_config(config, default=nil)
unless /^--with-/ =~ config
config = '--with-' + config
end
@@ -273,7 +291,7 @@ def with_config(config, default="yes")
end
def enable_config(config, default=nil)
- if arg_config("--enable-"+config, true)
+ if arg_config("--enable-"+config, default)
true
elsif arg_config("--disable-"+config, false)
false
@@ -346,7 +364,7 @@ ruby_inc = #{$ruby_inc}
#### End of system configuration section. ####
-LOCAL_LIBS = #{$local_libs}
+LOCAL_LIBS = #{$LOCAL_LIBS}
LIBS = #{$libs}
OBJS = #{$objs}
@@ -440,7 +458,7 @@ end
$libs = PLATFORM =~ /cygwin32|beos/ ? nil : "-lc"
$objs = nil
-$local_libs = ""
+$LOCAL_LIBS = ""
$CFLAGS = ""
$LDFLAGS = ""
$defs = []