diff options
-rw-r--r-- | ChangeLog | 12 | ||||
-rw-r--r-- | configure.in | 15 | ||||
-rw-r--r-- | ext/socket/extconf.rb | 2 | ||||
-rw-r--r-- | win32/Makefile.sub | 6 |
4 files changed, 29 insertions, 6 deletions
@@ -1,7 +1,17 @@ +Wed Jun 7 11:34:38 2006 NAKAMURA Usaku <usa@ruby-lang.org> + + * configure.in: add new configure option `--with-winsock2' for mingw. + + * win32/Makefile.sub (config.h): define USE_WINSOCK2 in config.h + instead of in CPPFLAGS. + + * ext/socket/extconf.rb: determine whether to use winsock2 or not + by using with_config. + Wed Jun 7 10:45:10 2006 NAKAMURA Usaku <usa@ruby-lang.org> * win32/{configure.bat, setup.mak, Makefile.sub, win32.h}: add - support new configure option `--with-winsock2'. + new configure option `--with-winsock2'. * win32/win32.c (StartSockets): ditto. diff --git a/configure.in b/configure.in index e70d861414..1ceacbb5c5 100644 --- a/configure.in +++ b/configure.in @@ -187,6 +187,15 @@ cygwin*|mingw*) sed -n '/^[[ ]]*dll name: \(msvc.*\)\.dll$/{s//\1/p;q;}'`], [rb_cv_msvcrt=msvcrt])]) test "$rb_cv_msvcrt" = "" && AC_MSG_ERROR([must be linked to DLL]) + AC_ARG_WITH(winsock2, + [ --with-winsock2 link winsock2 (MinGW only)], [ + case $withval in + yes) with_winsock2=yes;; + *) with_winsock2=no;; + esac], [with_winsock2=no]) + if test "$with_winsock2" = yes; then + AC_DEFINE(USE_WINSOCK2) + fi esac : ${enable_shared=yes} ;; @@ -328,7 +337,11 @@ cygwin*) rb_cv_have_daylight=no ac_cv_func__setjmp=no ac_cv_func_setitimer=no ;; -mingw*) LIBS="-lwsock32 $LIBS" +mingw*) if test "$with_winsock2" = yes; then + LIBS="-lws2_32 $LIBS" + else + LIBS="-lwsock32 $LIBS" + fi ac_cv_header_a_out_h=no ac_cv_header_pwd_h=no ac_cv_header_utime_h=no diff --git a/ext/socket/extconf.rb b/ext/socket/extconf.rb index 6469535ca3..41b715e0af 100644 --- a/ext/socket/extconf.rb +++ b/ext/socket/extconf.rb @@ -6,7 +6,7 @@ when /bccwin32/ have_library("ws2_32", "WSACleanup") when /mswin32|mingw/ test_func = "WSACleanup" - if /USE_WINSOCK2/ =~ $CPPFLAGS + if with_config("winsock2") have_library("ws2_32", "WSACleanup") else have_library("wsock32", "WSACleanup") diff --git a/win32/Makefile.sub b/win32/Makefile.sub index fa8e3dbfd7..975ef49899 100644 --- a/win32/Makefile.sub +++ b/win32/Makefile.sub @@ -142,9 +142,6 @@ CC = $(CC) -nologo LD = $(CC) LDSHARED = $(LD) -LD XCFLAGS = -DRUBY_EXPORT -I. -I$(srcdir) -I$(srcdir)/missing -!if defined(USE_WINSOCK2) -CPPFLAGS = $(CPPFLAGS) -DUSE_WINSOCK2 -!endif !if $(MSC_VER) >= 1400 # Prevents VC++ 2005 (cl ver 14) warnings CPPFLAGS = $(CPPFLAGS) -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE @@ -208,6 +205,9 @@ $(CONFIG_H): $(MKFILES) $(srcdir)/win32/Makefile.sub #if _MSC_VER != $(MSC_VER) #error MSC version unmatch #endif +!if defined(USE_WINSOCK2) +#define USE_WINSOCK2 1 +!endif #define STDC_HEADERS 1 #define HAVE_SYS_TYPES_H 1 #define HAVE_SYS_STAT_H 1 |