summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1999-05-06 08:31:50 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1999-05-06 08:31:50 +0000
commite8505b64725b10f92e828d289ad0995bb23c1c8a (patch)
tree5c256f0d6b5f496ef0b348c4d3ebdb2988ba7e2b /ext
parentcae09e71e575608c039212d8b1273bd14695f88c (diff)
small fixes
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_3@457 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-rw-r--r--ext/Setup1
-rw-r--r--ext/curses/curses.c7
-rw-r--r--ext/extmk.rb.in81
-rw-r--r--ext/extmk.rb.nt500
-rw-r--r--ext/readline/extconf.rb1
-rw-r--r--ext/socket/addrinfo.h8
-rw-r--r--ext/socket/extconf.rb5
-rw-r--r--ext/socket/getaddrinfo.c27
-rw-r--r--ext/socket/getnameinfo.c17
-rw-r--r--ext/socket/socket.c176
-rw-r--r--ext/socket/sockport.h4
-rw-r--r--ext/tcltklib/extconf.rb4
12 files changed, 488 insertions, 343 deletions
diff --git a/ext/Setup b/ext/Setup
index 9e3a2474c3a..6373af370db 100644
--- a/ext/Setup
+++ b/ext/Setup
@@ -7,6 +7,7 @@
#fcntl
#kconv
#md5
+#pty
#socket
#tkutil
#tcltklib
diff --git a/ext/curses/curses.c b/ext/curses/curses.c
index 49fa07bd5cf..5a515275bc4 100644
--- a/ext/curses/curses.c
+++ b/ext/curses/curses.c
@@ -10,10 +10,11 @@
#else
# ifdef HAVE_NCURSES_CURSES_H
# include <ncurses/curses.h>
-# else
-#ifdef __hpux
-#include <curses_colr/curses.h>
#else
+# ifdef HAVE_CURSES_COLR_CURSES_H
+# include <varargs.h>
+# include <curses_colr/curses.h>
+# else
# include <curses.h>
# if (defined(__bsdi__) || defined(__NetBSD__)) && !defined(_maxx)
# define _maxx maxx
diff --git a/ext/extmk.rb.in b/ext/extmk.rb.in
index 19e94a8ae38..32e9bb2b2bd 100644
--- a/ext/extmk.rb.in
+++ b/ext/extmk.rb.in
@@ -1,6 +1,6 @@
#! /usr/local/bin/ruby
-$".push 'mkmf.rb' #"
+$".push 'mkmf.rb'
if ARGV[0] == 'static'
$force_static = TRUE
@@ -25,11 +25,8 @@ if $top_srcdir !~ "^/"
# get absolute path
$top_srcdir = File.expand_path($top_srcdir)
end
-$topdir = ".."
-if $topdir !~ "^/"
- # get absolute path
- $topdir = File.expand_path($topdir)
-end
+# get absolute path
+$topdir = File.expand_path("..")
$ruby_inc = $top_srcdir
load "#{$top_srcdir}/lib/find.rb"
@@ -58,15 +55,15 @@ end
def older(file1, file2)
if !File.exist?(file1) then
- return TRUE
+ return true
end
if !File.exist?(file2) then
- return FALSE
+ return false
end
if File.mtime(file1) < File.mtime(file2)
- return TRUE
+ return true
end
- return FALSE
+ return false
end
if PLATFORM == "m68k-human"
@@ -97,12 +94,18 @@ def xsystem command
return r
end
-def try_link(src, opt="")
+def try_link0(src, opt="")
cfile = open("conftest.c", "w")
cfile.print src
cfile.close
+ xsystem(format(LINK, $CFLAGS, $LDFLAGS, opt))
+end
+
+def try_link(src, opt="")
begin
- xsystem(format(LINK, $CFLAGS, $LDFLAGS, opt))
+ try_link0(src, opt)
+ ensure
+ system "rm -f conftest*"
end
end
@@ -110,19 +113,27 @@ def try_cpp(src, opt=$CFLAGS)
cfile = open("conftest.c", "w")
cfile.print src
cfile.close
- xsystem(format(CPP, opt))
+ begin
+ xsystem(format(CPP, opt))
+ ensure
+ system "rm -f conftest*"
+ end
end
def egrep_cpp(pat, src, opt=$CFLAGS)
cfile = open("conftest.c", "w")
cfile.print src
cfile.close
- xsystem(format(CPP+"|egrep #{pat}", opt))
+ begin
+ xsystem(format(CPP+"|egrep #{pat}", opt))
+ ensure
+ system "rm -f conftest*"
+ end
end
def try_run(src, opt="")
begin
- if try_link(src, opt)
+ if try_link0(src, opt)
if xsystem("./conftest")
true
else
@@ -131,6 +142,8 @@ def try_run(src, opt="")
else
nil
end
+ ensure
+ system "rm -f conftest*"
end
end
@@ -160,9 +173,9 @@ def have_library(lib, func="main")
else
$libs = "-l" + lib
end
- return TRUE
+ return true
else
- return FALSE
+ return false
end
end
@@ -177,8 +190,8 @@ int main() { return 0; }
int t() { #{func}(); return 0; }
SRC
$lib_cache[lib] = 'no'
- $cache_mod = TRUE
- return FALSE
+ $cache_mod = true
+ return false
end
else
if $libs
@@ -190,17 +203,17 @@ SRC
$libs = libs
$lib_cache[lib] = 'yes'
- $cache_mod = TRUE
- return TRUE
+ $cache_mod = true
+ return true
end
def have_func(func)
if $func_cache[func]
if $func_cache[func] == "yes"
$defs.push(format("-DHAVE_%s", func.upcase))
- return TRUE
+ return true
else
- return FALSE
+ return false
end
end
@@ -213,13 +226,13 @@ int main() { return 0; }
int t() { #{func}(); return 0; }
SRC
$func_cache[func] = 'no'
- $cache_mod = TRUE
- return FALSE
+ $cache_mod = true
+ return false
end
$defs.push(format("-DHAVE_%s", func.upcase))
$func_cache[func] = 'yes'
- $cache_mod = TRUE
- return TRUE
+ $cache_mod = true
+ return true
end
def have_header(header)
@@ -227,9 +240,9 @@ def have_header(header)
if $hdr_cache[header] == "yes"
header.tr!("a-z./\055", "A-Z___")
$defs.push(format("-DHAVE_%s", header))
- return TRUE
+ return true
else
- return FALSE
+ return false
end
end
@@ -237,14 +250,14 @@ def have_header(header)
#include <#{header}>
SRC
$hdr_cache[header] = 'no'
- $cache_mod = TRUE
- return FALSE
+ $cache_mod = true
+ return false
end
$hdr_cache[header] = 'yes'
header.tr!("a-z./\055", "A-Z___")
$defs.push(format("-DHAVE_%s", header))
- $cache_mod = TRUE
- return TRUE
+ $cache_mod = true
+ return true
end
def arg_config(config, default=nil)
@@ -291,7 +304,7 @@ def create_header()
end
def create_makefile(target)
-
+ system "rm -f conftest*"
if $libs and "@DLEXT@" == "o"
libs = $libs.split
for lib in libs
diff --git a/ext/extmk.rb.nt b/ext/extmk.rb.nt
index dd979a45a36..1b7c88f5ddf 100644
--- a/ext/extmk.rb.nt
+++ b/ext/extmk.rb.nt
@@ -1,12 +1,13 @@
#! /usr/local/bin/ruby
-$".push 'mkmf.rb' #"
+$".push 'mkmf.rb'
if ARGV[0] == 'static'
$force_static = TRUE
ARGV.shift
elsif ARGV[0] == 'install'
$install = TRUE
+ $destdir = ARGV[1] || ''
ARGV.shift
elsif ARGV[0] == 'clean'
$clean = TRUE
@@ -19,15 +20,22 @@ $cache_mod = FALSE;
$lib_cache = {}
$func_cache = {}
$hdr_cache = {}
+$top_srcdir = ".."
+if $top_srcdir !~ "^/"
+ # get absolute path
+ $top_srcdir = File.expand_path($top_srcdir)
+end
+$topdir = File.expand_path("..")
+$topdir = File.expand_path($topdir)
+$ruby_inc = $top_srcdir
-#$dllopt = '-MD'
-$dllopt = ''
+load "#{$top_srcdir}/lib/find.rb"
if File.exist?("config.cache") then
f = open("config.cache", "r")
while f.gets
case $_
- when /^lib: ([\w_]+) (yes|no)/
+ when /^lib: (.+) (yes|no)/
$lib_cache[$1] = $2
when /^func: ([\w_]+) (yes|no)/
$func_cache[$1] = $2
@@ -40,40 +48,98 @@ end
def older(file1, file2)
if !File.exist?(file1) then
- return TRUE
+ return true
end
if !File.exist?(file2) then
- return FALSE
+ return false
end
if File.mtime(file1) < File.mtime(file2)
- return TRUE
+ return true
+ end
+ return false
+end
+
+CFLAGS = "-g -O2"
+LINK = "gcc -o conftest -I#$topdir -I#$top_srcdir -I${prefix}/include #{CFLAGS} %s %s conftest.c -ldl -lcrypt -lm %s"
+CPP = "gcc -E -I#$topdir -I#$top_srcdir -I${prefix}/include #{CFLAGS} %s conftest.c"
+
+$null = open("nul", "w")
+$orgerr = $stderr.dup
+$orgout = $stdout.dup
+def xsystem command
+ if $DEBUG
+ return system(command)
end
- return FALSE
+ $stderr.reopen($null)
+ $stdout.reopen($null)
+ r = system(command)
+ $stderr.reopen($orgerr)
+ $stdout.reopen($orgout)
+ return r
end
-#LINK = "cl -o conftest.exe -I../.. -Zi -O -I. %s conftest.c %s > nul"
-LINK = "cl -o conftest.exe -Zi -O %s conftest.c %s > nul"
-CPP = "cl -E -I../.. -I../../missing -I../../win32 -I. -Zi -O %s conftest.c > nul"
+def try_link(src, opt="")
+ cfile = open("conftest.c", "w")
+ cfile.print src
+ cfile.close
+ begin
+ xsystem(format(LINK, $CFLAGS, $LDFLAGS, opt))
+ end
+end
-def try_link(libs)
- #print(format("try #{LINK}", $CFLAGS, $LDFLAGS, libs))
- #system(format(LINK, $CFLAGS, $LDFLAGS, libs))
- print(format("try #{LINK}\n", $CFLAGS, libs))
- system(format(LINK, $CFLAGS, libs))
+def try_cpp(src, opt=$CFLAGS)
+ cfile = open("conftest.c", "w")
+ cfile.print src
+ cfile.close
+ xsystem(format(CPP, opt))
end
-def try_cpp
- system(format(CPP, $CFLAGS))
+def egrep_cpp(pat, src, opt=$CFLAGS)
+ cfile = open("conftest.c", "w")
+ cfile.print src
+ cfile.close
+ xsystem(format(CPP+"|egrep #{pat}", opt))
end
-def have_library(lib, func)
- #print format("have_library(%s, %s)\n", lib, func)
+def try_run(src, opt="")
+ begin
+ if try_link(src, opt)
+ if xsystem("./conftest")
+ true
+ else
+ false
+ end
+ else
+ nil
+ end
+ end
+end
+
+def install_rb(mfile)
+ path = []
+ dir = []
+ Find.find("lib") do |f|
+ next unless /\.rb$/ =~ f
+ f = f[4..-1]
+ path.push f
+ dir |= File.dirname(f)
+ end
+ for f in dir
+ next if f == "."
+ mfile.printf "\t@test -d $(DESTDIR)$(pkglibdir)/%s || mkdir $(DESTDIR)$(pkglibdir)/%s\n", f, f
+ end
+ for f in path
+ mfile.printf "\t$(INSTALL_DATA) lib/%s $(DESTDIR)$(pkglibdir)/%s\n", f, f
+ end
+end
+
+def have_library(lib, func="main")
if $lib_cache[lib]
if $lib_cache[lib] == "yes"
- if $libs#
- $libs = lib + ".lib " + $libs
+ if $libs
+ $libs = "-l" + lib + " " + $libs
else
- $libs = lib + ".lib "
+ $libs = "-l" + lib
end
return TRUE
else
@@ -81,30 +147,26 @@ def have_library(lib, func)
end
end
- cfile = open("conftest.c", "w")
- cfile.printf "\
-#include <windows.h>
-#include <winsock.h>
-int main() { return 0; }
-int t() { %s(); return 0; }
-", func
- cfile.close
-
- begin
+ if func && func != ""
if $libs
- libs = lib + ".lib " + $libs
+ libs = "-l" + lib + " " + $libs
else
- libs = lib + ".lib"
+ libs = "-l" + lib
end
- #print "libs=#{libs}\n"
- unless try_link(libs)
- #print "fail : #{libs}\n"
+ unless try_link(<<"SRC", libs)
+int main() { return 0; }
+int t() { #{func}(); return 0; }
+SRC
$lib_cache[lib] = 'no'
$cache_mod = TRUE
return FALSE
end
- ensure
- system "rm -f conftest*"
+ else
+ if $libs
+ libs = "-l" + lib + " " + $libs
+ else
+ libs = "-l" + lib
+ end
end
$libs = libs
@@ -123,28 +185,17 @@ def have_func(func)
end
end
- cfile = open("conftest.c", "w")
- cfile.printf "\
-#include <windows.h>
-#include <winsock.h>
-//char %s();
-int main() { return 0; }
-int t() { %s(); return 0; }
-", func, func
- cfile.close
-
libs = $libs
libs = "" if libs == nil
- begin
- #print "libs=#{libs}\n"
- unless try_link(libs)
- $func_cache[func] = 'no'
- $cache_mod = TRUE
- return FALSE
- end
- ensure
- system "rm -f conftest*"
+ unless try_link(<<"SRC", libs)
+char #{func}();
+int main() { return 0; }
+int t() { #{func}(); return 0; }
+SRC
+ $func_cache[func] = 'no'
+ $cache_mod = TRUE
+ return FALSE
end
$defs.push(format("-DHAVE_%s", func.upcase))
$func_cache[func] = 'yes'
@@ -163,20 +214,12 @@ def have_header(header)
end
end
- cfile = open("conftest.c", "w")
- cfile.printf "\
-#include <%s>
-", header
- cfile.close
-
- begin
- unless try_cpp
- $hdr_cache[header] = 'no'
- $cache_mod = TRUE
- return FALSE
- end
- ensure
- system "rm -f conftest*"
+ unless try_cpp(<<"SRC")
+#include <#{header}>
+SRC
+ $hdr_cache[header] = 'no'
+ $cache_mod = TRUE
+ return FALSE
end
$hdr_cache[header] = 'yes'
header.tr!("a-z./\055", "A-Z___")
@@ -185,6 +228,38 @@ def have_header(header)
return TRUE
end
+def arg_config(config, default=nil)
+ unless defined? $configure_args
+ $configure_args = {}
+ for arg in " --prefix=/usr --with-dbm-include=/usr/include/db1".split
+ next unless /^--/ =~ arg
+ if /=/ =~ arg
+ $configure_args[$`] = $'
+ else
+ $configure_args[arg] = default
+ end
+ end
+ end
+ $configure_args.fetch(config, default)
+end
+
+def with_config(config, default=nil)
+ unless /^--with-/ =~ config
+ config = '--with-' + config
+ end
+ arg_config(config, default)
+end
+
+def enable_config(config, default=nil)
+ if arg_config("--enable-"+config, true)
+ true
+ elsif arg_config("--disable-"+config, false)
+ false
+ else
+ default
+ end
+end
+
def create_header()
if $defs.length > 0
hfile = open("extconf.h", "w")
@@ -198,103 +273,121 @@ end
def create_makefile(target)
- if $libs and "obj" == "obj"
+ if $libs and "so" == "o"
libs = $libs.split
for lib in libs
- lib.sub!(/(.*)/, '"\1.lib"') if /.lib$/ !~ lib
+ lib.sub!(/-l(.*)/, '"lib\1.a"')
end
$defs.push(format("-DEXTLIB='%s'", libs.join(",")))
end
- $libs = "" unless $libs
+ $DLDFLAGS = ''
+
+ if PLATFORM =~ /beos/
+ if $libs
+ $libs = $libs + " -lruby"
+ else
+ $libs = "-lruby"
+ end
+ $DLDFLAGS = $DLDFLAGS + " -L" + $topdir
+ end
+
+ $srcdir = $top_srcdir + "/ext/" + $mdir
mfile = open("Makefile", "w")
mfile.printf "\
-SHELL = $(COMPSEC)
+SHELL = /bin/sh
#### Start of system configuration section. ####
-srcdir = .
-VPATH = .
-
-CC = cl
+srcdir = #{$srcdir}
-CFLAGS = %s -I../.. -I../../missing -I../../win32 -I. -O -DNT %s #$CFLAGS %s
+hdrdir = #{$topdir}
-RUBYLIB = ../../ruby.lib
-DLDFLAGS = /DLL
-LDSHARED =
-", if $static then "" else "-fpic" end, $dllopt, $defs.join(" ")
+CC = gcc
- if $force_static
- print "static\n"
- else
- print "non static\n"
- end
+prefix = /usr
+CFLAGS = %s -I#{$topdir} -I#{$top_srcdir} -I${prefix}/include #{CFLAGS} #$CFLAGS %s
+DLDFLAGS = #$DLDFLAGS #$LDFLAGS
+LDSHARED = gcc -shared
+", if $static then "" else "-fPIC" end, $defs.join(" ")
mfile.printf "\
-libdir = /usr/local/lib/ruby/i386-mswin32
+RUBY_INSTALL_NAME = ruby
+
+prefix = /usr
+exec_prefix = ${prefix}
+libdir = ${exec_prefix}/lib
+pkglibdir = $(libdir)/ruby/1.3
+archdir = $(pkglibdir)/i586-linux
+ruby_inc = #{$ruby_inc}
#### End of system configuration section. ####
+
"
- mfile.printf "LOCAL_LIBS = %s\n", $local_libs if $local_libs
+ mfile.printf "LOCAL_LIBS = %s\n", $local_libs unless $local_libs == ""
mfile.printf "LIBS = %s\n", $libs
mfile.printf "OBJS = "
if !$objs then
- $objs = Dir["*.c"]
- for f in $objs
- f.sub!(/\.c$/, ".obj")
+ $objs = []
+ for f in Dir["#{$top_srcdir}/ext/#{$mdir}/*.{c,cc}"]
+ f = File.basename(f)
+ f.sub!(/\.(c|cc)$/, ".o")
+ $objs.push f
end
end
mfile.printf $objs.join(" ")
mfile.printf "\n"
- dots = if "ginstall -c" =~ /^\// then "" else "../" end
- mfile.printf "\
-TARGET = %s.%s
+ mfile.printf <<EOS
+TARGET = #{target}
+DLLIB = $(TARGET).#{$static ? "a" : "so"}
-INSTALL = %sginstall -c
+INSTALL = /usr/bin/install -c
+INSTALL_DATA = ${INSTALL} -m 644
-DEFFILE = %s.def
+binsuffix =
-all: $(TARGET)
+all: $(DLLIB)
-clean:; @rm -f *.obj *.lib *.exp vc*.pdb *.bak *.def
+clean:; @rm -f *.o *.a *.so *.sl
@rm -f Makefile extconf.h conftest.*
+ @rm -f core ruby$(binsuffix) *~
+
+realclean: clean
+EOS
-realclean: clean
-", target,
- if $force_static then "lib" else "dll" end, dots, target
+ mfile.printf <<EOS
+install:
+ @test -d $(DESTDIR)$(libdir) || mkdir $(DESTDIR)$(libdir)
+ @test -d $(DESTDIR)$(pkglibdir) || mkdir $(DESTDIR)$(pkglibdir)
+ @test -d $(DESTDIR)$(archdir) || mkdir $(DESTDIR)$(archdir)
+EOS
if !$static
mfile.printf "\
-
-install: $(libdir)/$(TARGET)
-
-$(libdir)/$(TARGET): $(TARGET)
- @test -d $(libdir) || mkdir $(libdir)
- $(INSTALL) $(TARGET) $(libdir)/$(TARGET)
-"
- else
- mfile.printf "\
-
-install:;
+ $(INSTALL) $(DLLIB) $(DESTDIR)$(archdir)/$(DLLIB)
"
end
+ install_rb(mfile)
+ mfile.printf "\n"
- if $force_static
- mfile.printf "\
-$(TARGET): $(OBJS)
- lib /OUT:$(TARGET) $(OBJS)
+ if $static
+ mfile.printf "\
+$(DLLIB): $(OBJS)
+ ar cru $(DLLIB) $(OBJS)
+ @-ranlib $(DLLIB) 2> /dev/null || true
"
else
mfile.printf "\
-$(DEFFILE):
- echo $(DEFFILE)
-
-$(TARGET): $(OBJS) $(DEFFILE)
- cl -DLL -o$(TARGET) $(OBJS) $(RUBYLIB) -link /DEF:$(DEFFILE)
+$(DLLIB): $(OBJS)
+ $(LDSHARED) $(DLDFLAGS) -o $(DLLIB) $(OBJS) $(LIBS) $(LOCAL_LIBS)
+"
+ elsif not File.exist?(target + ".c") and not File.exist?(target + ".cc")
+ mfile.printf "\
+$(DLLIB): $(OBJS)
+ ld $(DLDFLAGS) -r -o $(DLLIB) $(OBJS)
"
end
@@ -307,27 +400,7 @@ $(TARGET): $(OBJS) $(DEFFILE)
dfile.close
end
mfile.close
- if $static
- #printf format("push %s,%s\n", $static, target); ##debug print##
- $extlist.push [$static,target]
- end
-end
-
-#template of .def file.
-def create_def(basename)
- defname = sprintf("%s.def", basename)
- f = open(defname, "w")
- f.printf "\
-LIBRARY %s.dll
-CODE LOADONCALL
-DATA LOADONCALL
-DESCRIPTION 'win32 %s.dll'
-EXPORTS
-
- Init_%s
-", basename, basename, basename
- f.close
-
+
end
def extmake(target)
@@ -339,88 +412,87 @@ def extmake(target)
return if $nodynamic and not $static
- $local_libs = nil
- $libs = nil
$objs = nil
- $CFLAGS = nil
- $LDFLAGS = nil
+ $libs = "-lc"
+ $local_libs = "" # to be assigned in extconf.rb
+ $CFLAGS = ""
+ $LDFLAGS = ""
begin
+ system "mkdir", target unless File.directory?(target)
Dir.chdir target
+ $mdir = target
if $static_ext.size > 0 ||
!File.exist?("./Makefile") ||
- older("./Makefile", "../Setup") ||
+ older("./Makefile", "#{$top_srcdir}/ext/Setup") ||
older("./Makefile", "../extmk.rb") ||
- older("./Makefile", "./extconf.rb")
+ older("./Makefile", "#{$top_srcdir}/ext/#{target}/extconf.rb")
then
$defs = []
- if File.exist?("extconf.rb")
- load "extconf.rb"
+ if File.exist?("#{$top_srcdir}/ext/#{target}/extconf.rb")
+ load "#{$top_srcdir}/ext/#{target}/extconf.rb"
else
create_makefile(target);
end
end
-
- if !File.exist?("#{target}.def")
- create_def(target)
- end
-
if File.exist?("./Makefile")
+ if $static
+ $extlist.push [$static,target]
+ end
if $install
- system "nmake install"
- if File.directory? "./lib"
- for i in Dir["./lib/*.rb"]
- system "ginstall -c #{i} /usr/local/lib/ruby/i386-mswin32"
- end
- end
+ system "make install DESTDIR=#{$destdir}"
elsif $clean
- system "nmake clean"
+ system "make clean"
else
- #print "!!!make!!!\n"
- system "nmake all"
+ system "make all" or exit
end
end
if $static
- $extlibs = " "
- $extlibs += " " + $LDFLAGS if $LDFLAGS
- $extlibs += " " + $local_libs if $local_libs
+ $extlibs ||= ""
+ $extlibs += " " + $LDFLAGS unless $LDFLAGS == ""
$extlibs += " " + $libs if $libs
+ $extlibs += " " + $local_libs unless $local_libs == ""
end
ensure
+ system "rm -f conftest*"
Dir.chdir ".."
end
end
# get static-link modules
$static_ext = {}
-if File.file? "./Setup"
- f = open("./Setup")
- while f.gets()
- $_.chop!
- sub!(/#.*$/, '')
- next if /^\s*$/
- #print $_, "\n"
-
- if /^option +nodynamic/
- $nodynamic = TRUE
- next
+for setup in ["Setup", "#{$top_srcdir}/ext/Setup"]
+ if File.file? setup
+ f = open(setup)
+ while f.gets()
+ $_.chomp!
+ sub!(/#.*$/, '')
+ next if /^\s*$/
+ if /^option +nodynamic/
+ $nodynamic = TRUE
+ next
+ end
+ $static_ext[$_.split[0]] = TRUE
end
- $static_ext[$_.split[0]] = TRUE
+ f.close
+ break
end
- f.close
end
-for d in Dir["*"]
+for d in Dir["#{$top_srcdir}/ext/*"]
File.directory?(d) || next
File.file?(d + "/MANIFEST") || next
- d = $1 if d =~ /\/([\/]*)$/
+ d = File.basename(d)
if $install
print "installing ", d, "\n"
elsif $clean
print "cleaning ", d, "\n"
else
print "compiling ", d, "\n"
+ if PLATFORM =~ /-aix/ and older("../ruby.imp", "../miniruby")
+ load "#{$top_srcdir}/ext/aix_mksym.rb"
+ end
end
extmake(d)
end
@@ -440,62 +512,64 @@ if $cache_mod
end
exit if $install or $clean
-$extinit = " " unless $extinit
-$extobjs = ""
+$extinit = "" unless $extinit
+
+ruby = "ruby"
+miniruby = "miniruby"
+
if $extlist.size > 0
for s,t in $extlist
- #for s,t in $static_ext
- #f = format("%s/%s.obj", s, t)
- #f = format("%s/%s.obj", s, s)
- l = format("%s/%s.lib", s, s)
- if File.exist?(l)
+ f = format("%s/%s.a", s, t)
+ if File.exist?(f)
$extinit += format("\
\tInit_%s();\n\
\trb_provide(\"%s.so\");\n\
-", s, s)
+", t, t)
+ $extobjs = "" unless $extobjs
$extobjs += "ext/"
- #$extobjs += f # *.obj
- $extobjs += l # *.lib
+ $extobjs += f
$extobjs += " "
else
FALSE
end
end
- if older("extinit.c", "Setup")
+ if older("extinit.c", "#{$top_srcdir}/ext/Setup")
f = open("extinit.c", "w")
f.printf "void Init_ext() {\n"
f.printf $extinit
f.printf "}\n"
f.close
end
- if older("extinit.obj", "extinit.c")
- cmd = "cl -Zi -O -I. -c extinit.c"
+ if older("extinit.o", "extinit.c")
+ cmd = "gcc " + CFLAGS + " -c extinit.c"
print cmd, "\n"
system cmd or exit 1
end
Dir.chdir ".."
- if older("ruby.exe", "ext/Setup") or older("ruby.exe", "miniruby.exe")
- `rm -f ruby.exe`
+ if older(ruby, "#{$top_srcdir}/ext/Setup") or older(ruby, miniruby)
+ system("rm -f #{ruby}")
end
- $extobjs = "ext/extinit.obj " + $extobjs
- #$extlibs = ""
- #print "EXTLIBS=#{$extlibs}\n"
- $extlibs.gsub!("-L/usr/local/lib", "") if $extlibs
- $extlibs.gsub!(" +", " ") if $extlibs
- #print "EXTLIBS=#{$extlibs}\n"
-
- system format('nmake ruby.exe EXTOBJS="%s" EXTLIBS="%s"', $extobjs, $extlibs)
+ if $extobjs
+ $extobjs = "ext/extinit.o " + $extobjs
+ else
+ $extobjs = "ext/extinit.o "
+ end
+ if PLATFORM =~ /m68k-human|beos/
+ $extlibs.gsub!("-L/usr/local/lib", "") if $extlibs
+ end
+ system format(%[make #{ruby} EXTOBJS="%s" EXTLIBS="%s"], $extobjs, $extlibs)
else
Dir.chdir ".."
- if older("ruby.exe", "miniruby.exe")
- `rm -f ruby.exe`
- `cp miniruby.exe ruby.exe`
+ if older(ruby, miniruby)
+ system("rm -f #{ruby}")
+ system("make #{ruby}")
end
end
+
#Local variables:
# mode: ruby
#end:
diff --git a/ext/readline/extconf.rb b/ext/readline/extconf.rb
index 1cf55bb4d97..0bd11bb946e 100644
--- a/ext/readline/extconf.rb
+++ b/ext/readline/extconf.rb
@@ -17,6 +17,7 @@ if readline_dir
end
have_library("termcap", "tgetnum")
+have_library("curses", "tgetnum")
if have_header("readline/readline.h") and
have_header("readline/history.h") and
have_library("readline", "readline")
diff --git a/ext/socket/addrinfo.h b/ext/socket/addrinfo.h
index 83cc6c6a7bd..1236437897b 100644
--- a/ext/socket/addrinfo.h
+++ b/ext/socket/addrinfo.h
@@ -65,6 +65,14 @@
#define freehostent freehostent__compat
#define freeaddrinfo freeaddrinfo__compat
+#ifndef __P
+# ifdef HAVE_PROTOTYPES 1
+# define __P(args) args
+# else
+# define __P(args)
+# endif
+#endif
+
/* special compatibility hack -- end*/
diff --git a/ext/socket/extconf.rb b/ext/socket/extconf.rb
index 0ad85c5380f..28a96f4b382 100644
--- a/ext/socket/extconf.rb
+++ b/ext/socket/extconf.rb
@@ -149,6 +149,8 @@ EOF
$CFLAGS="-DHAVE_SA_LEN "+$CFLAGS
end
+have_header("sys/sysctl.h")
+
$getaddr_info_ok = false
if try_run(<<EOF)
#include <sys/types.h>
@@ -270,6 +272,8 @@ else
$CFLAGS="-I. "+$CFLAGS
$objs += "getaddrinfo.o"
$objs += "getnameinfo.o"
+ have_func("inet_ntop")
+ have_func("inet_pton")
end
if sockaddr_storage
@@ -277,6 +281,7 @@ if sockaddr_storage
end
have_header("sys/un.h")
+
if have_func(test_func)
have_func("hsterror")
unless have_func("gethostname")
diff --git a/ext/socket/getaddrinfo.c b/ext/socket/getaddrinfo.c
index 45657b6a963..fc3f654ceee 100644
--- a/ext/socket/getaddrinfo.c
+++ b/ext/socket/getaddrinfo.c
@@ -40,7 +40,9 @@
#include <sys/types.h>
#include <sys/param.h>
+#ifdef HAVE_SYSCTL_H
#include <sys/sysctl.h>
+#endif
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
@@ -48,11 +50,13 @@
#include <netdb.h>
#include <resolv.h>
#include <string.h>
+#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <ctype.h>
#include <unistd.h>
+#include "config.h"
#include "addrinfo.h"
#include "sockport.h"
@@ -160,7 +164,7 @@ if (pai->ai_flags & AI_CANONNAME) {\
memcpy(ai, pai, sizeof(struct addrinfo));\
(ai)->ai_addr = (struct sockaddr *)((ai) + 1);\
memset((ai)->ai_addr, 0, (afd)->a_socklen);\
- SET_SA_LEN(*(ai)->ai_addr, (ai)->ai_addrlen = (afd)->a_socklen);\
+ SET_SA_LEN((ai)->ai_addr, (ai)->ai_addrlen = (afd)->a_socklen);\
(ai)->ai_addr->sa_family = (ai)->ai_family = (afd)->a_af;\
((struct sockinet *)(ai)->ai_addr)->si_port = port;\
p = (char *)((ai)->ai_addr);\
@@ -206,6 +210,27 @@ str_isnumber(p)
return YES;
}
+#ifndef HAVE_INET_PTON
+
+#ifndef INADDR_NONE
+# define INADDR_NONE 0xffffffff
+#endif
+
+static int
+inet_pton(af, hostname, pton)
+ int af;
+ const char *hostname;
+ char *pton;
+{
+ struct in_addr in;
+ in.s_addr = inet_addr(hostname);
+ if (in.s_addr == INADDR_NONE)
+ return 0;
+ memcpy(pton, &in, sizeof(in));
+ return 1;
+}
+#endif
+
int
getaddrinfo(hostname, servname, hints, res)
const char *hostname, *servname;
diff --git a/ext/socket/getnameinfo.c b/ext/socket/getnameinfo.c
index 99404b157a2..e217b508959 100644
--- a/ext/socket/getnameinfo.c
+++ b/ext/socket/getnameinfo.c
@@ -44,6 +44,7 @@
#include <string.h>
#include <stddef.h>
+#include "config.h"
#include "addrinfo.h"
#include "sockport.h"
@@ -81,6 +82,21 @@ struct sockinet {
#define ENI_FAMILY 5
#define ENI_SALEN 6
+#ifndef HAVE_INET_NTOP
+static char *
+inet_ntop(af, addr, numaddr, numaddr_len)
+ int af;
+ char *addr;
+ char *numaddr;
+ int numaddr_len;
+{
+ struct in_addr in;
+ memcpy(&in.s_addr, addr, sizeof(in.s_addr));
+ strcpy(numaddr, inet_ntoa(in));
+ return numaddr;
+}
+#endif
+
int
getnameinfo(sa, salen, host, hostlen, serv, servlen, flags)
const struct sockaddr *sa;
@@ -102,6 +118,7 @@ getnameinfo(sa, salen, host, hostlen, serv, servlen, flags)
int h_error;
char numserv[512];
char numaddr[512];
+ extern int h_errno;
if (sa == NULL)
return ENI_NOSOCKET;
diff --git a/ext/socket/socket.c b/ext/socket/socket.c
index 7fb51f7bc90..b0f108a2c15 100644
--- a/ext/socket/socket.c
+++ b/ext/socket/socket.c
@@ -1042,7 +1042,7 @@ udp_connect(sock, host, port)
GetOpenFile(sock, fptr);
res0 = udp_addrsetup(fptr, host, port);
- for (res0 = res; res; res = res->ai_next) {
+ for (res = res0; res; res = res->ai_next) {
retry:
if (connect(fileno(fptr->f), res->ai_addr, res->ai_addrlen) >= 0) {
freeaddrinfo(res0);
@@ -1804,7 +1804,7 @@ gotsap:
static VALUE mConst;
static void
-sock_rb_define_const(name, value)
+sock_define_const(name, value)
char *name;
int value;
{
@@ -1904,248 +1904,248 @@ Init_socket()
/* constants */
mConst = rb_define_module_under(rb_cSocket, "Constants");
- sock_rb_define_const("SOCK_STREAM", SOCK_STREAM);
- sock_rb_define_const("SOCK_DGRAM", SOCK_DGRAM);
+ sock_define_const("SOCK_STREAM", SOCK_STREAM);
+ sock_define_const("SOCK_DGRAM", SOCK_DGRAM);
#ifdef SOCK_RAW
- sock_rb_define_const("SOCK_RAW", SOCK_RAW);
+ sock_define_const("SOCK_RAW", SOCK_RAW);
#endif
#ifdef SOCK_RDM
- sock_rb_define_const("SOCK_RDM", SOCK_RDM);
+ sock_define_const("SOCK_RDM", SOCK_RDM);
#endif
#ifdef SOCK_SEQPACKET
- sock_rb_define_const("SOCK_SEQPACKET", SOCK_SEQPACKET);
+ sock_define_const("SOCK_SEQPACKET", SOCK_SEQPACKET);
#endif
#ifdef SOCK_PACKET
- sock_rb_define_const("SOCK_PACKET", SOCK_PACKET);
+ sock_define_const("SOCK_PACKET", SOCK_PACKET);
#endif
- sock_rb_define_const("AF_INET", AF_INET);
+ sock_define_const("AF_INET", AF_INET);
#ifdef PF_INET
- sock_rb_define_const("PF_INET", PF_INET);
+ sock_define_const("PF_INET", PF_INET);
#endif
#ifdef AF_UNIX
- sock_rb_define_const("AF_UNIX", AF_UNIX);
- sock_rb_define_const("PF_UNIX", PF_UNIX);
+ sock_define_const("AF_UNIX", AF_UNIX);
+ sock_define_const("PF_UNIX", PF_UNIX);
#endif
#ifdef AF_AX25
- sock_rb_define_const("AF_AX25", AF_AX25);
- sock_rb_define_const("PF_AX25", PF_AX25);
+ sock_define_const("AF_AX25", AF_AX25);
+ sock_define_const("PF_AX25", PF_AX25);
#endif
#ifdef AF_IPX
- sock_rb_define_const("AF_IPX", AF_IPX);
- sock_rb_define_const("PF_IPX", PF_IPX);
+ sock_define_const("AF_IPX", AF_IPX);
+ sock_define_const("PF_IPX", PF_IPX);
#endif
#ifdef AF_APPLETALK
- sock_rb_define_const("AF_APPLETALK", AF_APPLETALK);
- sock_rb_define_const("PF_APPLETALK", PF_APPLETALK);
+ sock_define_const("AF_APPLETALK", AF_APPLETALK);
+ sock_define_const("PF_APPLETALK", PF_APPLETALK);
#endif
#ifdef AF_UNSPEC
- sock_rb_define_const("AF_UNSPEC", AF_UNSPEC);
- sock_rb_define_const("PF_UNSPEC", PF_UNSPEC);
+ sock_define_const("AF_UNSPEC", AF_UNSPEC);
+ sock_define_const("PF_UNSPEC", PF_UNSPEC);
#endif
#ifdef AF_INET6
- sock_rb_define_const("AF_INET6", AF_INET6);
- sock_rb_define_const("PF_INET6", PF_INET6);
+ sock_define_const("AF_INET6", AF_INET6);
+ sock_define_const("PF_INET6", PF_INET6);
#endif
- sock_rb_define_const("MSG_OOB", MSG_OOB);
+ sock_define_const("MSG_OOB", MSG_OOB);
#ifdef MSG_PEEK
- sock_rb_define_const("MSG_PEEK", MSG_PEEK);
+ sock_define_const("MSG_PEEK", MSG_PEEK);
#endif
#ifdef MSG_DONTROUTE
- sock_rb_define_const("MSG_DONTROUTE", MSG_DONTROUTE);
+ sock_define_const("MSG_DONTROUTE", MSG_DONTROUTE);
#endif
- sock_rb_define_const("SOL_SOCKET", SOL_SOCKET);
+ sock_define_const("SOL_SOCKET", SOL_SOCKET);
#ifdef SOL_IP
- sock_rb_define_const("SOL_IP", SOL_IP);
+ sock_define_const("SOL_IP", SOL_IP);
#endif
#ifdef SOL_IPX
- sock_rb_define_const("SOL_IPX", SOL_IPX);
+ sock_define_const("SOL_IPX", SOL_IPX);
#endif
#ifdef SOL_AX25
- sock_rb_define_const("SOL_AX25", SOL_AX25);
+ sock_define_const("SOL_AX25", SOL_AX25);
#endif
#ifdef SOL_ATALK
- sock_rb_define_const("SOL_ATALK", SOL_ATALK);
+ sock_define_const("SOL_ATALK", SOL_ATALK);
#endif
#ifdef SOL_TCP
- sock_rb_define_const("SOL_TCP", SOL_TCP);
+ sock_define_const("SOL_TCP", SOL_TCP);
#endif
#ifdef SOL_UDP
- sock_rb_define_const("SOL_UDP", SOL_UDP);
+ sock_define_const("SOL_UDP", SOL_UDP);
#endif
#ifdef SO_DEBUG
- sock_rb_define_const("SO_DEBUG", SO_DEBUG);
+ sock_define_const("SO_DEBUG", SO_DEBUG);
#endif
- sock_rb_define_const("SO_REUSEADDR", SO_REUSEADDR);
+ sock_define_const("SO_REUSEADDR", SO_REUSEADDR);
#ifdef SO_TYPE
- sock_rb_define_const("SO_TYPE", SO_TYPE);
+ sock_define_const("SO_TYPE", SO_TYPE);
#endif
#ifdef SO_ERROR
- sock_rb_define_const("SO_ERROR", SO_ERROR);
+ sock_define_const("SO_ERROR", SO_ERROR);
#endif
#ifdef SO_DONTROUTE
- sock_rb_define_const("SO_DONTROUTE", SO_DONTROUTE);
+ sock_define_const("SO_DONTROUTE", SO_DONTROUTE);
#endif
#ifdef SO_BROADCAST
- sock_rb_define_const("SO_BROADCAST", SO_BROADCAST);
+ sock_define_const("SO_BROADCAST", SO_BROADCAST);
#endif
#ifdef SO_SNDBUF
- sock_rb_define_const("SO_SNDBUF", SO_SNDBUF);
+ sock_define_const("SO_SNDBUF", SO_SNDBUF);
#endif
#ifdef SO_RCVBUF
- sock_rb_define_const("SO_RCVBUF", SO_RCVBUF);
+ sock_define_const("SO_RCVBUF", SO_RCVBUF);
#endif
#ifdef SO_KEEPALIVE
- sock_rb_define_const("SO_KEEPALIVE", SO_KEEPALIVE);
+ sock_define_const("SO_KEEPALIVE", SO_KEEPALIVE);
#endif
#ifdef SO_OOBINLINE
- sock_rb_define_const("SO_OOBINLINE", SO_OOBINLINE);
+ sock_define_const("SO_OOBINLINE", SO_OOBINLINE);
#endif
#ifdef SO_NO_CHECK
- sock_rb_define_const("SO_NO_CHECK", SO_NO_CHECK);
+ sock_define_const("SO_NO_CHECK", SO_NO_CHECK);
#endif
#ifdef SO_PRIORITY
- sock_rb_define_const("SO_PRIORITY", SO_PRIORITY);
+ sock_define_const("SO_PRIORITY", SO_PRIORITY);
#endif
#ifdef SO_LINGER
- sock_rb_define_const("SO_LINGER", SO_LINGER);
+ sock_define_const("SO_LINGER", SO_LINGER);
#endif
#ifdef SOPRI_INTERACTIVE
- sock_rb_define_const("SOPRI_INTERACTIVE", SOPRI_INTERACTIVE);
+ sock_define_const("SOPRI_INTERACTIVE", SOPRI_INTERACTIVE);
#endif
#ifdef SOPRI_NORMAL
- sock_rb_define_const("SOPRI_NORMAL", SOPRI_NORMAL);
+ sock_define_const("SOPRI_NORMAL", SOPRI_NORMAL);
#endif
#ifdef SOPRI_BACKGROUND
- sock_rb_define_const("SOPRI_BACKGROUND", SOPRI_BACKGROUND);
+ sock_define_const("SOPRI_BACKGROUND", SOPRI_BACKGROUND);
#endif
#ifdef IP_MULTICAST_IF
- sock_rb_define_const("IP_MULTICAST_IF", IP_MULTICAST_IF);
+ sock_define_const("IP_MULTICAST_IF", IP_MULTICAST_IF);
#endif
#ifdef IP_MULTICAST_TTL
- sock_rb_define_const("IP_MULTICAST_TTL", IP_MULTICAST_TTL);
+ sock_define_const("IP_MULTICAST_TTL", IP_MULTICAST_TTL);
#endif
#ifdef IP_MULTICAST_LOOP
- sock_rb_define_const("IP_MULTICAST_LOOP", IP_MULTICAST_LOOP);
+ sock_define_const("IP_MULTICAST_LOOP", IP_MULTICAST_LOOP);
#endif
#ifdef IP_ADD_MEMBERSHIP
- sock_rb_define_const("IP_ADD_MEMBERSHIP", IP_ADD_MEMBERSHIP);
+ sock_define_const("IP_ADD_MEMBERSHIP", IP_ADD_MEMBERSHIP);
#endif
#ifdef IP_DEFAULT_MULTICAST_TTL
- sock_rb_define_const("IP_DEFAULT_MULTICAST_TTL", IP_DEFAULT_MULTICAST_TTL);
+ sock_define_const("IP_DEFAULT_MULTICAST_TTL", IP_DEFAULT_MULTICAST_TTL);
#endif
#ifdef IP_DEFAULT_MULTICAST_LOOP
- sock_rb_define_const("IP_DEFAULT_MULTICAST_LOOP", IP_DEFAULT_MULTICAST_LOOP);
+ sock_define_const("IP_DEFAULT_MULTICAST_LOOP", IP_DEFAULT_MULTICAST_LOOP);
#endif
#ifdef IP_MAX_MEMBERSHIPS
- sock_rb_define_const("IP_MAX_MEMBERSHIPS", IP_MAX_MEMBERSHIPS);
+ sock_define_const("IP_MAX_MEMBERSHIPS", IP_MAX_MEMBERSHIPS);
#endif
#ifdef IPX_TYPE
- sock_rb_define_const("IPX_TYPE", IPX_TYPE);
+ sock_define_const("IPX_TYPE", IPX_TYPE);
#endif
#ifdef TCP_NODELAY
- sock_rb_define_const("TCP_NODELAY", TCP_NODELAY);
+ sock_define_const("TCP_NODELAY", TCP_NODELAY);
#endif
#ifdef TCP_MAXSEG
- sock_rb_define_const("TCP_MAXSEG", TCP_MAXSEG);
+ sock_define_const("TCP_MAXSEG", TCP_MAXSEG);
#endif
#ifdef EAI_ADDRFAMILY
- sock_rb_define_const("EAI_ADDRFAMILY", EAI_ADDRFAMILY);
+ sock_define_const("EAI_ADDRFAMILY", EAI_ADDRFAMILY);
#endif
#ifdef EAI_AGAIN
- sock_rb_define_const("EAI_AGAIN", EAI_AGAIN);
+ sock_define_const("EAI_AGAIN", EAI_AGAIN);
#endif
#ifdef EAI_BADFLAGS
- sock_rb_define_const("EAI_BADFLAGS", EAI_BADFLAGS);
+ sock_define_const("EAI_BADFLAGS", EAI_BADFLAGS);
#endif
#ifdef EAI_FAIL
- sock_rb_define_const("EAI_FAIL", EAI_FAIL);
+ sock_define_const("EAI_FAIL", EAI_FAIL);
#endif
#ifdef EAI_FAMILY
- sock_rb_define_const("EAI_FAMILY", EAI_FAMILY);
+ sock_define_const("EAI_FAMILY", EAI_FAMILY);
#endif
#ifdef EAI_MEMORY
- sock_rb_define_const("EAI_MEMORY", EAI_MEMORY);
+ sock_define_const("EAI_MEMORY", EAI_MEMORY);
#endif
#ifdef EAI_NODATA
- sock_rb_define_const("EAI_NODATA", EAI_NODATA);
+ sock_define_const("EAI_NODATA", EAI_NODATA);
#endif
#ifdef EAI_NONAME
- sock_rb_define_const("EAI_NONAME", EAI_NONAME);
+ sock_define_const("EAI_NONAME", EAI_NONAME);
#endif
#ifdef EAI_SERVICE
- sock_rb_define_const("EAI_SERVICE", EAI_SERVICE);
+ sock_define_const("EAI_SERVICE", EAI_SERVICE);
#endif
#ifdef EAI_SOCKTYPE
- sock_rb_define_const("EAI_SOCKTYPE", EAI_SOCKTYPE);
+ sock_define_const("EAI_SOCKTYPE", EAI_SOCKTYPE);
#endif
#ifdef EAI_SYSTEM
- sock_rb_define_const("EAI_SYSTEM", EAI_SYSTEM);
+ sock_define_const("EAI_SYSTEM", EAI_SYSTEM);
#endif
#ifdef EAI_BADHINTS
- sock_rb_define_const("EAI_BADHINTS", EAI_BADHINTS);
+ sock_define_const("EAI_BADHINTS", EAI_BADHINTS);
#endif
#ifdef EAI_PROTOCOL
- sock_rb_define_const("EAI_PROTOCOL", EAI_PROTOCOL);
+ sock_define_const("EAI_PROTOCOL", EAI_PROTOCOL);
#endif
#ifdef EAI_MAX
- sock_rb_define_const("EAI_MAX", EAI_MAX);
+ sock_define_const("EAI_MAX", EAI_MAX);
#endif
#ifdef AI_PASSIVE
- sock_rb_define_const("AI_PASSIVE", AI_PASSIVE);
+ sock_define_const("AI_PASSIVE", AI_PASSIVE);
#endif
#ifdef AI_CANONNAME
- sock_rb_define_const("AI_CANONNAME", AI_CANONNAME);
+ sock_define_const("AI_CANONNAME", AI_CANONNAME);
#endif
#ifdef AI_NUMERICHOST
- sock_rb_define_const("AI_NUMERICHOST", AI_NUMERICHOST);
+ sock_define_const("AI_NUMERICHOST", AI_NUMERICHOST);
#endif
#ifdef AI_MASK
- sock_rb_define_const("AI_MASK", AI_MASK);
+ sock_define_const("AI_MASK", AI_MASK);
#endif
#ifdef AI_ALL
- sock_rb_define_const("AI_ALL", AI_ALL);
+ sock_define_const("AI_ALL", AI_ALL);
#endif
#ifdef AI_V4MAPPED_CFG
- sock_rb_define_const("AI_V4MAPPED_CFG", AI_V4MAPPED_CFG);
+ sock_define_const("AI_V4MAPPED_CFG", AI_V4MAPPED_CFG);
#endif
#ifdef AI_ADDRCONFIG
- sock_rb_define_const("AI_ADDRCONFIG", AI_ADDRCONFIG);
+ sock_define_const("AI_ADDRCONFIG", AI_ADDRCONFIG);
#endif
#ifdef AI_V4MAPPED
- sock_rb_define_const("AI_V4MAPPED", AI_V4MAPPED);
+ sock_define_const("AI_V4MAPPED", AI_V4MAPPED);
#endif
#ifdef AI_DEFAULT
- sock_rb_define_const("AI_DEFAULT", AI_DEFAULT);
+ sock_define_const("AI_DEFAULT", AI_DEFAULT);
#endif
#ifdef NI_MAXHOST
- sock_rb_define_const("NI_MAXHOST", NI_MAXHOST);
+ sock_define_const("NI_MAXHOST", NI_MAXHOST);
#endif
#ifdef NI_MAXSERV
- sock_rb_define_const("NI_MAXSERV", NI_MAXSERV);
+ sock_define_const("NI_MAXSERV", NI_MAXSERV);
#endif
#ifdef NI_NOFQDN
- sock_rb_define_const("NI_NOFQDN", NI_NOFQDN);
+ sock_define_const("NI_NOFQDN", NI_NOFQDN);
#endif
#ifdef NI_NUMERICHOST
- sock_rb_define_const("NI_NUMERICHOST", NI_NUMERICHOST);
+ sock_define_const("NI_NUMERICHOST", NI_NUMERICHOST);
#endif
#ifdef NI_NAMEREQD
- sock_rb_define_const("NI_NAMEREQD", NI_NAMEREQD);
+ sock_define_const("NI_NAMEREQD", NI_NAMEREQD);
#endif
#ifdef NI_NUMERICSERV
- sock_rb_define_const("NI_NUMERICSERV", NI_NUMERICSERV);
+ sock_define_const("NI_NUMERICSERV", NI_NUMERICSERV);
#endif
#ifdef NI_DGRAM
- sock_rb_define_const("NI_DGRAM", NI_DGRAM);
+ sock_define_const("NI_DGRAM", NI_DGRAM);
#endif
}
diff --git a/ext/socket/sockport.h b/ext/socket/sockport.h
index bb3b371670a..3a2007362f7 100644
--- a/ext/socket/sockport.h
+++ b/ext/socket/sockport.h
@@ -13,7 +13,7 @@
#ifndef SA_LEN
# ifdef HAVE_SA_LEN
-# define SA_LEN(sa) (sa)->sin_len
+# define SA_LEN(sa) (sa)->sa_len
# else
# ifdef INET6
# define SA_LEN(sa) \
@@ -27,7 +27,7 @@
#endif
#ifdef HAVE_SA_LEN
-# define SET_SA_LEN(sa, len) (sa)->sin_len = (len)
+# define SET_SA_LEN(sa, len) (sa)->sa_len = (len)
#else
# define SET_SA_LEN(sa, len) (len)
#endif
diff --git a/ext/tcltklib/extconf.rb b/ext/tcltklib/extconf.rb
index e34e549ca0c..7a568edd103 100644
--- a/ext/tcltklib/extconf.rb
+++ b/ext/tcltklib/extconf.rb
@@ -59,7 +59,7 @@ def search_lib(file, func, *path)
for lib in files.sort!.reverse!
lib = File::basename(lib)
lib.sub!(/^lib/, '')
- lib.sub!(/\.(a|so)$/, '')
+ lib.sub!(/\.(a|so(.[0-9.]+)?)$/, '')
if have_library(lib, func)
unless $libraries.include? path
$libraries << path
@@ -74,7 +74,7 @@ def search_lib(file, func, *path)
end
if have_header("tcl.h") && have_header("tk.h") &&
- search_lib("libX11.{so,a}", "XOpenDisplay",
+ search_lib("libX11.{so*,a}", "XOpenDisplay",
"/usr/lib", "/usr/openwin/lib", "/usr/X11*/lib") &&
search_lib("libtcl{8*,7*,}.{so,a}", "Tcl_FindExecutable",
"/usr/lib", "/usr/local/lib") &&