[前][次][番号順一覧][スレッド一覧]

ruby-changes:27205

From: akr <ko1@a...>
Date: Sat, 16 Feb 2013 00:21:48 +0900 (JST)
Subject: [ruby-changes:27205] akr:r39256 (trunk): * ext/socket/extconf.rb: use all all tested available headers for

akr	2013-02-16 00:20:34 +0900 (Sat, 16 Feb 2013)

  New Revision: 39256

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=39256

  Log:
    * ext/socket/extconf.rb: use all all tested available headers for
      have_func.

  Modified files:
    trunk/ChangeLog
    trunk/ext/socket/extconf.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 39255)
+++ ChangeLog	(revision 39256)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sat Feb 16 00:19:20 2013  Tanaka Akira  <akr@f...>
+
+	* ext/socket/extconf.rb: use all all tested available headers for
+	  have_func.
+
 Fri Feb 15 22:21:37 2013  Akinori MUSHA  <knu@i...>
 
 	* configure.in: Fix a bug introduced in r38342 that the cflagspat
Index: ext/socket/extconf.rb
===================================================================
--- ext/socket/extconf.rb	(revision 39255)
+++ ext/socket/extconf.rb	(revision 39256)
@@ -23,36 +23,32 @@ else https://github.com/ruby/ruby/blob/trunk/ext/socket/extconf.rb#L23
   have_library("socket", "socket") # SunOS
 end
 
+headers = []
 unless $mswin or $bccwin or $mingw
   headers = %w<sys/types.h netdb.h string.h sys/socket.h netinet/in.h>
 end
-if /solaris/ =~ RUBY_PLATFORM and !try_compile("")
-  # bug of gcc 3.0 on Solaris 8 ?
-  headers << "sys/feature_tests.h"
-end
-if have_header("arpa/inet.h")
-  headers << "arpa/inet.h"
-end
-
-have_header("netinet/tcp.h") if /cygwin/ !~ RUBY_PLATFORM # for cygwin 1.1.5
-have_header("netinet/udp.h")
-
-have_header("arpa/nameser.h")
-have_header("resolv.h")
-
-have_header("ifaddrs.h")
 
-have_header("sys/ioctl.h")
-have_header("sys/sockio.h")
-have_header("net/if.h", headers)
-
-have_header("sys/param.h", headers)
-have_header("sys/ucred.h", headers)
-
-have_header("sys/un.h")
-have_header("sys/uio.h")
-
-have_header("ucred.h", headers)
+%w[
+  sys/feature_tests.h
+  arpa/inet.h
+  netinet/tcp.h
+  netinet/udp.h
+  arpa/nameser.h
+  resolv.h
+  ifaddrs.h
+  sys/ioctl.h
+  sys/sockio.h
+  net/if.h
+  sys/param.h
+  sys/ucred.h
+  sys/un.h
+  sys/uio.h
+  ucred.h
+].each {|h|
+  if have_header(h, headers)
+    headers << h
+  end
+}
 
 have_type("struct sockaddr_storage", headers)
 
@@ -89,18 +85,18 @@ if (doug[] or https://github.com/ruby/ruby/blob/trunk/ext/socket/extconf.rb#L85
   doug[] or with_cppflags($CPPFLAGS + " -Dss_len=__ss_len", &doug)
 end
 
-have_struct_member('struct msghdr', 'msg_control', ['sys/types.h', 'sys/socket.h'])
-have_struct_member('struct msghdr', 'msg_accrights', ['sys/types.h', 'sys/socket.h'])
+have_struct_member('struct msghdr', 'msg_control', headers)
+have_struct_member('struct msghdr', 'msg_accrights', headers)
 
-if have_func(test_func)
+if have_func(test_func, headers)
 
-  have_func("sendmsg")
-  have_func("recvmsg")
+  have_func("sendmsg", headers)
+  have_func("recvmsg", headers)
 
-  have_func("freehostent")
-  have_func("freeaddrinfo")
+  have_func("freehostent", headers)
+  have_func("freeaddrinfo", headers)
 
-  if /haiku/ !~ RUBY_PLATFORM and have_func("gai_strerror")
+  if /haiku/ !~ RUBY_PLATFORM and have_func("gai_strerror", headers)
     if checking_for("gai_strerror() returns const pointer") {!try_compile(<<EOF)}
 #{cpp_include(headers)}
 #include <stdlib.h>
@@ -114,29 +110,29 @@ EOF https://github.com/ruby/ruby/blob/trunk/ext/socket/extconf.rb#L110
     end
   end
 
-  have_func("accept4")
+  have_func("accept4", headers)
 
-  have_func('inet_ntop(0, (const void *)0, (char *)0, 0)') or
-    have_func("inet_ntoa(*(struct in_addr *)NULL)")
-  have_func('inet_pton(0, "", (void *)0)') or have_func('inet_aton("", (struct in_addr *)0)')
-  have_func('getservbyport(0, "")')
-  have_func("getifaddrs")
+  have_func('inet_ntop(0, (const void *)0, (char *)0, 0)', headers) or
+    have_func("inet_ntoa(*(struct in_addr *)NULL)", headers)
+  have_func('inet_pton(0, "", (void *)0)', headers) or have_func('inet_aton("", (struct in_addr *)0)', headers)
+  have_func('getservbyport(0, "")', headers)
+  have_func("getifaddrs", headers)
 
-  have_func("getpeereid")
+  have_func("getpeereid", headers)
 
-  have_func("getpeerucred")
+  have_func("getpeerucred", headers)
 
-  have_func("if_indextoname")
+  have_func("if_indextoname", headers)
 
-  have_func("hsterror")
-  have_func("getipnodebyname")
-  have_func("gethostbyname2")
-  if !have_func("socketpair(0, 0, 0, 0)") and have_func("rb_w32_socketpair(0, 0, 0, 0)")
+  have_func("hsterror", headers)
+  have_func("getipnodebyname", headers)
+  have_func("gethostbyname2", headers)
+  if !have_func("socketpair(0, 0, 0, 0)", headers) and have_func("rb_w32_socketpair(0, 0, 0, 0)", headers)
     $defs << "-Dsocketpair(a,b,c,d)=rb_w32_socketpair((a),(b),(c),(d))"
     $defs << "-DHAVE_SOCKETPAIR"
   end
-  unless have_func("gethostname((char *)0, 0)")
-    have_func("uname")
+  unless have_func("gethostname((char *)0, 0)", headers)
+    have_func("uname", headers)
   end
 
   ipv6 = false

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]