summaryrefslogtreecommitdiff
path: root/lang/ruby18-base/patches/patch-cq
blob: 062b93a838c9441ed639e320bf0b2ce5ab4b2dd5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
$NetBSD: patch-cq,v 1.1 2010/09/10 03:29:00 taca Exp $

* r26209: rename {addr,name}info functions to ensure those are used on darwin.

--- ext/socket/extconf.rb.orig	2009-02-25 06:06:08.000000000 +0000
+++ ext/socket/extconf.rb
@@ -119,8 +119,8 @@ if have_func("sendmsg") | have_func("rec
   have_struct_member('struct msghdr', 'msg_accrights', ['sys/types.h', 'sys/socket.h'])
 end
 
-getaddr_info_ok = enable_config("wide-getaddrinfo") do
-  checking_for("wide getaddrinfo") {try_run(<<EOF)}
+getaddr_info_ok = (enable_config("wide-getaddrinfo") && :wide) ||
+  (checking_for("wide getaddrinfo") {try_run(<<EOF)} && :os)
 #{cpp_include(headers)}
 #include <stdlib.h>
 
@@ -222,7 +222,6 @@ main()
   exit(EXIT_FAILURE);
 }
 EOF
-end
 if ipv6 and not getaddr_info_ok
   abort <<EOS
 
@@ -247,11 +246,32 @@ Fatal: invalid value for --with-lookup-o
 EOS
 end
 
+have_type("struct addrinfo", headers)
+have_func("freehostent")
+have_func("freeaddrinfo")
+if have_func("gai_strerror")
+  if checking_for("gai_strerror() returns const pointer") {!try_compile(<<EOF)}
+#{cpp_include(headers)}
+#include <stdlib.h>
+void
+conftest_gai_strerror_is_const()
+{
+    *gai_strerror(0) = 0;
+}
+EOF
+    $defs << "-DGAI_STRERROR_CONST"
+  end
+end
+
 $objs = ["socket.#{$OBJEXT}"]
 
-unless getaddr_info_ok and have_func("getnameinfo", "netdb.h") and have_func("getaddrinfo", "netdb.h")
+if getaddr_info_ok == :wide or
+    !have_func("getnameinfo", headers) or !have_func("getaddrinfo", headers)
   if have_struct_member("struct in6_addr", "s6_addr8", headers)
-    $defs[-1] = "-DHAVE_ADDR8"
+    $defs[-1] = "s6_addr=s6_addr8"
+  end
+  if ipv6 == "kame" && have_struct_member("struct in6_addr", "s6_addr32", headers)
+    $defs[-1] = "-DFAITH"
   end
   $CPPFLAGS="-I. "+$CPPFLAGS
   $objs += ["getaddrinfo.#{$OBJEXT}"]
@@ -259,19 +279,6 @@ unless getaddr_info_ok and have_func("ge
   have_func("inet_ntop") or have_func("inet_ntoa")
   have_func("inet_pton") or have_func("inet_aton")
   have_func("getservbyport")
-  if have_func("gai_strerror")
-    unless checking_for("gai_strerror() returns const pointer") {!try_compile(<<EOF)}
-#{cpp_include(headers)}
-#include <stdlib.h>
-void
-conftest_gai_strerror_is_const()
-{
-    *gai_strerror(0) = 0;
-}
-EOF
-      $defs << "-DGAI_STRERROR_CONST"
-    end
-  end
   have_header("arpa/nameser.h")
   have_header("resolv.h")
 end