1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* configure.in, win32/Makefile.sub (LIBS, COMMON_HEADERS): use

winsock2 on mswin32/mingw.

* ext/socket/extconf.rb: ditto.

* win32/win32.c (StartSockets): ditto.

* win32/win32.h: ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7942 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
usa 2005-02-10 04:55:34 +00:00
parent 0de2877326
commit a32bc08d36
6 changed files with 22 additions and 20 deletions

View file

@ -1,3 +1,14 @@
Thu Feb 10 13:52:42 2005 NAKAMURA Usaku <usa@ruby-lang.org>
* configure.in, win32/Makefile.sub (LIBS, COMMON_HEADERS): use
winsock2 on mswin32/mingw.
* ext/socket/extconf.rb: ditto.
* win32/win32.c (StartSockets): ditto.
* win32/win32.h: ditto.
Thu Feb 10 12:09:16 2005 Nobuyoshi Nakada <nobu@ruby-lang.org> Thu Feb 10 12:09:16 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
* ext/extmk.rb (extract_makefile): default to true if not compiled * ext/extmk.rb (extract_makefile): default to true if not compiled

View file

@ -286,7 +286,7 @@ cygwin*) rb_cv_have_daylight=no
ac_cv_func__setjmp=no ac_cv_func__setjmp=no
ac_cv_func_setitimer=no ac_cv_func_setitimer=no
;; ;;
mingw*) LIBS="-lshell32 -lwsock32 $LIBS" mingw*) LIBS="-lshell32 -lws2_32 $LIBS"
ac_cv_header_a_out_h=no ac_cv_header_a_out_h=no
ac_cv_header_pwd_h=no ac_cv_header_pwd_h=no
ac_cv_header_utime_h=no ac_cv_header_utime_h=no
@ -1299,7 +1299,7 @@ case "$target_os" in
AC_LIBOBJ([win32]) AC_LIBOBJ([win32])
COMMON_LIBS=m COMMON_LIBS=m
COMMON_MACROS="WIN32_LEAN_AND_MEAN=" COMMON_MACROS="WIN32_LEAN_AND_MEAN="
COMMON_HEADERS="windows.h winsock.h" COMMON_HEADERS="winsock2.h windows.h"
;; ;;
esac esac
XCFLAGS="$XCFLAGS" XCFLAGS="$XCFLAGS"

View file

@ -1,14 +1,10 @@
require 'mkmf' require 'mkmf'
case RUBY_PLATFORM case RUBY_PLATFORM
when /bccwin32/ when /(ms|bcc)win32|mingw/
test_func = "WSACleanup" test_func = "WSACleanup"
have_library("ws2_32", "WSACleanup") have_library("ws2_32", "WSACleanup")
have_func("closesocket") have_func("closesocket")
when /mswin32|mingw/
test_func = "WSACleanup"
have_library("wsock32", "WSACleanup")
have_func("closesocket")
when /cygwin/ when /cygwin/
test_func = "socket" test_func = "socket"
when /beos/ when /beos/
@ -108,8 +104,7 @@ end
# doug's fix, NOW add -Dss_family... only if required! # doug's fix, NOW add -Dss_family... only if required!
doug = proc {have_struct_member("struct sockaddr_storage", "ss_family", headers)} doug = proc {have_struct_member("struct sockaddr_storage", "ss_family", headers)}
if /mswin32|mingw/ !~ RUBY_PLATFORM and if (doug[] or
(doug[] or
with_cppflags($CPPFLAGS + " -Dss_family=__ss_family -Dss_len=__ss_len", &doug)) with_cppflags($CPPFLAGS + " -Dss_family=__ss_family -Dss_len=__ss_len", &doug))
$defs[-1] = "-DHAVE_SOCKADDR_STORAGE" $defs[-1] = "-DHAVE_SOCKADDR_STORAGE"
end end

View file

@ -126,7 +126,7 @@ RFLAGS = -r
!if !defined(EXTLIBS) !if !defined(EXTLIBS)
EXTLIBS = EXTLIBS =
!endif !endif
LIBS = oldnames.lib user32.lib advapi32.lib shell32.lib wsock32.lib $(EXTLIBS) LIBS = oldnames.lib user32.lib advapi32.lib shell32.lib ws2_32.lib $(EXTLIBS)
MISSING = acosh.obj crypt.obj erf.obj win32.obj MISSING = acosh.obj crypt.obj erf.obj win32.obj
ARFLAGS = -machine:$(MACHINE) -out: ARFLAGS = -machine:$(MACHINE) -out:

View file

@ -1972,21 +1972,17 @@ StartSockets(void)
{ {
WORD version; WORD version;
WSADATA retdata; WSADATA retdata;
int ret;
int iSockOpt; int iSockOpt;
// //
// initalize the winsock interface and insure that it's // initalize the winsock interface and insure that it's
// cleaned up at exit. // cleaned up at exit.
// //
version = MAKEWORD(1, 1); version = MAKEWORD(2, 0);
if (ret = WSAStartup(version, &retdata)) if (WSAStartup(version, &retdata))
rb_fatal ("Unable to locate winsock library!\n"); rb_fatal ("Unable to locate winsock library!\n");
if (LOBYTE(retdata.wVersion) != 1) if (LOBYTE(retdata.wVersion) != 2)
rb_fatal("could not find version 1 of winsock dll\n"); rb_fatal("could not find version 2 of winsock dll\n");
if (HIBYTE(retdata.wVersion) != 1)
rb_fatal("could not find version 1 of winsock dll\n");
atexit((void (*)(void)) WSACleanup); atexit((void (*)(void)) WSACleanup);
@ -3658,7 +3654,7 @@ rb_w32_fopen(const char *path, const char *mode)
} }
FILE * FILE *
rb_w32_fdopen(int handle, char *type) rb_w32_fdopen(int handle, const char *type)
{ {
FILE *f = (errno = 0, _fdopen(handle, type)); FILE *f = (errno = 0, _fdopen(handle, type));
if (f == NULL && errno == 0) { if (f == NULL && errno == 0) {

View file

@ -22,8 +22,8 @@
// There is function-name conflitct, so we rename it // There is function-name conflitct, so we rename it
#if !defined(IN) && !defined(FLOAT) #if !defined(IN) && !defined(FLOAT)
#define OpenFile WINAPI_OpenFile #define OpenFile WINAPI_OpenFile
#include <winsock2.h>
#include <windows.h> #include <windows.h>
#include <winsock.h>
#undef OpenFile #undef OpenFile
#endif #endif