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

ruby-changes:27145

From: akr <ko1@a...>
Date: Sun, 10 Feb 2013 23:43:11 +0900 (JST)
Subject: [ruby-changes:27145] akr:r39197 (trunk): * ext/socket/extconf.rb: test structure members just after types test.

akr	2013-02-10 23:43:00 +0900 (Sun, 10 Feb 2013)

  New Revision: 39197

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

  Log:
    * ext/socket/extconf.rb: test structure members just after types test.

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

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 39196)
+++ ChangeLog	(revision 39197)
@@ -1,3 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sun Feb 10 23:42:26 2013  Tanaka Akira  <akr@f...>
+
+	* ext/socket/extconf.rb: test structure members just after types test.
+
 Sun Feb 10 20:58:17 2013  Tanaka Akira  <akr@f...>
 
 	* ext/socket/extconf.rb: test types just after headers test.
Index: ext/socket/extconf.rb
===================================================================
--- ext/socket/extconf.rb	(revision 39196)
+++ ext/socket/extconf.rb	(revision 39197)
@@ -76,6 +76,26 @@ have_type("struct ip_mreq", headers) # 4 https://github.com/ruby/ruby/blob/trunk/ext/socket/extconf.rb#L76
 have_type("struct ip_mreqn", headers) # Linux 2.4
 have_type("struct ipv6_mreq", headers) # RFC 3493
 
+if have_struct_member("struct sockaddr_in", "sin_len", headers)
+  $defs[-1] = "-DHAVE_SIN_LEN" # change from -DHAVE_ST_SIN_LEN.
+end
+
+#   doug's fix, NOW add -Dss_family... only if required!
+doug = proc {have_struct_member("struct sockaddr_storage", "ss_family", headers)}
+if (doug[] or
+    with_cppflags($CPPFLAGS + " -Dss_family=__ss_family", &doug))
+  $defs[-1] = "-DHAVE_SOCKADDR_STORAGE" # change from -DHAVE_ST_SS_FAMILY.
+  doug = proc {have_struct_member("struct sockaddr_storage", "ss_len", headers)}
+  doug[] or with_cppflags($CPPFLAGS + " -Dss_len=__ss_len", &doug)
+end
+
+if have_struct_member("struct sockaddr", "sa_len", headers)
+  $defs[-1] = "-DHAVE_SA_LEN " # change from -DHAVE_ST_SA_LEN.
+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'])
+
 ipv6 = false
 default_ipv6 = /cygwin|beos|haiku/ !~ RUBY_PLATFORM
 if enable_config("ipv6", default_ipv6)
@@ -135,33 +155,14 @@ ipv6 kit and compile beforehand. https://github.com/ruby/ruby/blob/trunk/ext/socket/extconf.rb#L155
 EOS
 end
 
-if have_struct_member("struct sockaddr_in", "sin_len", headers)
-  $defs[-1] = "-DHAVE_SIN_LEN" # change from -DHAVE_ST_SIN_LEN.
-end
-
-#   doug's fix, NOW add -Dss_family... only if required!
-doug = proc {have_struct_member("struct sockaddr_storage", "ss_family", headers)}
-if (doug[] or
-    with_cppflags($CPPFLAGS + " -Dss_family=__ss_family", &doug))
-  $defs[-1] = "-DHAVE_SOCKADDR_STORAGE" # change from -DHAVE_ST_SS_FAMILY.
-  doug = proc {have_struct_member("struct sockaddr_storage", "ss_len", headers)}
-  doug[] or with_cppflags($CPPFLAGS + " -Dss_len=__ss_len", &doug)
-end
-
-if have_struct_member("struct sockaddr", "sa_len", headers)
-  $defs[-1] = "-DHAVE_SA_LEN " # change from -DHAVE_ST_SA_LEN.
-end
-
 if !have_macro("IPPROTO_IPV6", headers) && have_const("IPPROTO_IPV6", headers)
   IO.read(File.join(File.dirname(__FILE__), "mkconstants.rb")).sub(/\A.*^__END__$/m, '').split(/\r?\n/).grep(/\AIPPROTO_\w*/){$&}.each {|name|
     have_const(name, headers) unless $defs.include?("-DHAVE_CONST_#{name.upcase}")
   }
 end
 
-if have_func("sendmsg") | have_func("recvmsg")
-  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'])
-end
+have_func("sendmsg")
+have_func("recvmsg")
 
 if checking_for("recvmsg() with MSG_PEEK allocate file descriptors") {try_run(cpp_include(headers) + <<'EOF')}
 #include <stdlib.h>

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

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