diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2006-05-25 23:44:08 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2006-05-25 23:44:08 +0000 |
commit | 65937b5eb9e35cd4b76261ac7bb3b3c3809cbe38 (patch) | |
tree | 5e2b99484f0b00685b8d05c07e88a3a56ff483e6 /ext/socket | |
parent | 155c33c1d164987a5f872e410c506187f26869fd (diff) |
* ruby.h, lib/mkmf.rb (create_header): clear command line options for
macros moved to extconf.h.
* ext/extmk.rb (extract_makefile, extmk): made RUBY_EXTCONF_H and
EXTSTATIC permanent.
* ext/{dbm,digest/*,socket,zlib}/extconf.rb: used $defs and $INCFLAGS.
* {bcc32,win32,wince}/Makefile.sub (COMPILE_C, COMPILE_CXX): added
$(INCFLAGS).
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@10193 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/socket')
-rw-r--r-- | ext/socket/extconf.rb | 97 | ||||
-rw-r--r-- | ext/socket/socket.c | 2 |
2 files changed, 35 insertions, 64 deletions
diff --git a/ext/socket/extconf.rb b/ext/socket/extconf.rb index 28f38140b4..5ee30a2228 100644 --- a/ext/socket/extconf.rb +++ b/ext/socket/extconf.rb @@ -30,7 +30,7 @@ if /solaris/ =~ RUBY_PLATFORM and !try_compile("") headers << "sys/feature_tests.h" end -$ipv6 = false +ipv6 = false default_ipv6 = /cygwin/ !~ RUBY_PLATFORM if enable_config("ipv6", default_ipv6) if checking_for("ipv6") {try_link(<<EOF)} @@ -41,74 +41,45 @@ main() socket(AF_INET6, SOCK_STREAM, 0); } EOF - $CFLAGS+=" -DENABLE_IPV6" - $ipv6 = true + $defs << "-DENABLE_IPV6" << "-DINET6" + ipv6 = true end end -$ipv6type = nil -$ipv6lib = nil -$ipv6libdir = nil -$ipv6trylibc = nil -if $ipv6 - if macro_defined?("IPV6_INRIA_VERSION", <<EOF) -#include <netinet/in.h> -EOF - $ipv6type = "inria" - $CFLAGS="-DINET6 "+$CFLAGS - elsif macro_defined?("__KAME__", <<EOF) -#include <netinet/in.h> -EOF - $ipv6type = "kame" - $ipv6lib="inet6" - $ipv6libdir="/usr/local/v6/lib" - $ipv6trylibc=true - $CFLAGS="-DINET6 "+$CFLAGS - elsif File.directory? "/usr/inet6" - $ipv6type = "linux" - $ipv6lib="inet6" - $ipv6libdir="/usr/inet6/lib" - $CFLAGS="-DINET6 -I/usr/inet6/include "+$CFLAGS - elsif macro_defined?("_TOSHIBA_INET6", <<EOF) -#include <sys/param.h> -EOF - $ipv6type = "toshiba" - $ipv6lib="inet6" - $ipv6libdir="/usr/local/v6/lib" - $CFLAGS="-DINET6 "+$CFLAGS - elsif macro_defined?("__V6D__", <<EOF) -#include </usr/local/v6/include/sys/v6config.h> -EOF - $ipv6type = "v6d" - $ipv6lib="v6" - $ipv6libdir="/usr/local/v6/lib" - $CFLAGS="-DINET6 -I/usr/local/v6/include "+$CFLAGS - elsif macro_defined?("_ZETA_MINAMI_INET6", <<EOF) -#include <sys/param.h> -EOF - $ipv6type = "zeta" - $ipv6lib="inet6" - $ipv6libdir="/usr/local/v6/lib" - $CFLAGS="-DINET6 "+$CFLAGS - else - $ipv6lib=with_config("ipv6-lib", nil) - $ipv6libdir=with_config("ipv6-libdir", nil) - $CFLAGS="-DINET6 "+$CFLAGS +if ipv6 + ipv6lib = nil + class << (fmt = "unknown") + def %(s) s || self end end - - if $ipv6lib - if File.directory? $ipv6libdir and File.exist? "#{$ipv6libdir}/lib#{$ipv6lib}.a" - $LOCAL_LIBS = " -L#$ipv6libdir -l#$ipv6lib" - elsif !$ipv6trylibc - print <<EOS + idirs, ldirs = dir_config("inet6", %w[/usr/inet6 /usr/local/v6].find {|d| File.directory?(d)}) + checking_for("ipv6 type", fmt) do + if have_macro("IPV6_INRIA_VERSION", "netinet/in.h") + "inria" + elsif have_macro("__KAME__", "netinet/in.h") + have_library(ipv6lib = "inet6") + "kame" + elsif have_macro("_TOSHIBA_INET6", "sys/param.h") + have_library(ipv6lib = "inet6") and "toshiba" + elsif have_macro("__V6D__", "sys/v6config.h") + have_library(ipv6lib = "v6") and "v6d" + elsif have_macro("_ZETA_MINAMI_INET6", "sys/param.h") + have_library(ipv6lib = "inet6") and "zeta" + elsif ipv6lib = with_config("ipv6-lib") + warn <<EOS +--with-ipv6-lib and --with-ipv6-libdir option will be obsolete, use +--with-inet6lib and --with-inet6-{include,lib} options instead. +EOS + find_library(ipv6lib, nil, with_config("ipv6-libdir", ldirs)) and + ipv6lib + elsif have_library("inet6") + "inet6" + end + end or not ipv6lib or abort <<EOS -Fatal: no #$ipv6lib library found. cannot continue. -You need to fetch lib#{$ipv6lib}.a from appropriate +Fatal: no #{ipv6lib} library found. cannot continue. +You need to fetch lib#{ipv6lib}.a from appropriate ipv6 kit and compile beforehand. EOS - exit - end - end end if have_struct_member("struct sockaddr_in", "sin_len", headers) @@ -241,7 +212,7 @@ main() } EOF end -if $ipv6 and not getaddr_info_ok +if ipv6 and not getaddr_info_ok abort <<EOS Fatal: --enable-ipv6 is specified, and your OS seems to support IPv6 feature. diff --git a/ext/socket/socket.c b/ext/socket/socket.c index 6619dab857..1eca32f750 100644 --- a/ext/socket/socket.c +++ b/ext/socket/socket.c @@ -2035,7 +2035,7 @@ static VALUE sock_s_socketpair(klass, domain, type, protocol) VALUE klass, domain, type, protocol; { -#if !defined(_WIN32) && !defined(__BEOS__) && !defined(__EMX__) && !defined(__QNXNTO__) && !defined(__VMS) +#if defined HAVE_SOCKETPAIR int d, t, sp[2]; setup_domain_and_type(domain, &d, type, &t); |