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

ruby-changes:31228

From: nobu <ko1@a...>
Date: Wed, 16 Oct 2013 22:50:33 +0900 (JST)
Subject: [ruby-changes:31228] nobu:r43307 (trunk): win32/setup.mak: check psapi.h

nobu	2013-10-16 22:50:29 +0900 (Wed, 16 Oct 2013)

  New Revision: 43307

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

  Log:
    win32/setup.mak: check psapi.h
    
    * win32/setup.mak (check-psapi.h): check if psapi.h is available.
    
    * win32/win32.c (CHECK_CONSOLE_EMULATOR): enable console emulator DLL
      check only when psapi.h is available.

  Modified files:
    trunk/win32/Makefile.sub
    trunk/win32/setup.mak
    trunk/win32/win32.c
Index: win32/win32.c
===================================================================
--- win32/win32.c	(revision 43306)
+++ win32/win32.c	(revision 43307)
@@ -39,7 +39,12 @@ https://github.com/ruby/ruby/blob/trunk/win32/win32.c#L39
 #include <share.h>
 #include <shlobj.h>
 #include <mbstring.h>
+#ifdef HAVE_PSAPI_H
 #include <psapi.h>
+# define CHECK_CONSOLE_EMULATOR 1
+#else
+# define CHECK_CONSOLE_EMULATOR 0
+#endif
 #include <shlwapi.h>
 #if _MSC_VER >= 1400
 #include <crtdbg.h>
@@ -606,7 +611,11 @@ static CRITICAL_SECTION select_mutex; https://github.com/ruby/ruby/blob/trunk/win32/win32.c#L611
 static int NtSocketsInitialized = 0;
 static st_table *socklist = NULL;
 static st_table *conlist = NULL;
+#if CHECK_CONSOLE_EMULATOR
 #define conlist_disabled ((st_table *)-1)
+#else
+#define conlist_disabled ((st_table *)NULL)
+#endif
 static char *envarea;
 static char *uenvarea;
 
@@ -5834,6 +5843,7 @@ rb_w32_pipe(int fds[2]) https://github.com/ruby/ruby/blob/trunk/win32/win32.c#L5843
     return 0;
 }
 
+#if CHECK_CONSOLE_EMULATOR
 /* License: Ruby's */
 static int
 console_emulator_p(void)
@@ -5860,6 +5870,9 @@ console_emulator_p(void) https://github.com/ruby/ruby/blob/trunk/win32/win32.c#L5870
 
     return 0;
 }
+#else
+#define console_emulator_p() 0
+#endif
 
 /* License: Ruby's */
 static struct constat *
Index: win32/Makefile.sub
===================================================================
--- win32/Makefile.sub	(revision 43306)
+++ win32/Makefile.sub	(revision 43307)
@@ -678,6 +678,9 @@ $(CONFIG_H): $(MKFILES) $(srcdir)/win32/ https://github.com/ruby/ruby/blob/trunk/win32/Makefile.sub#L678
 #define HAVE_DAYLIGHT 1
 #define HAVE_GMTIME_R 1
 #define HAVE_TYPE_NET_LUID 1
+!if defined(HAVE_PSAPI_H) && $(HAVE_PSAPI_H)
+#define HAVE_PSAPI_H 1
+!endif
 #define SETPGRP_VOID 1
 #define RSHIFT(x,y) ((x)>>(int)y)
 #define HAVE_RB_FD_INIT 1
Index: win32/setup.mak
===================================================================
--- win32/setup.mak	(revision 43306)
+++ win32/setup.mak	(revision 43307)
@@ -70,11 +70,11 @@ USE_RUBYGEMS = $(USE_RUBYGEMS) https://github.com/ruby/ruby/blob/trunk/win32/setup.mak#L70
 	@echo !endif>> $(MAKEFILE)
 !endif
 
--system-vars-: -osname- -runtime-
+-system-vars-: -osname- -runtime- -headers-
 
--system-vars32-: -osname32- -runtime-
+-system-vars32-: -osname32- -runtime- -headers-
 
--system-vars64-: -osname64- -runtime-
+-system-vars64-: -osname64- -runtime- -headers-
 
 -osname32-: nul
 	@echo TARGET_OS = mswin32>>$(MAKEFILE)
@@ -100,6 +100,15 @@ int main(void) {FILE *volatile f = stdin https://github.com/ruby/ruby/blob/trunk/win32/setup.mak#L100
 	@$(WIN32DIR:/=\)\rtname conftest.exe >>$(MAKEFILE)
 	@$(WIN32DIR:/=\)\rm.bat conftest.*
 
+-headers-: check-psapi.h
+
+check-psapi.h: nul
+	($(CC) -MD <<conftest.c psapi.lib -link && echo>>$(MAKEFILE) HAVE_PSAPI_H=1) & $(WIN32DIR:/=\)\rm.bat conftest.*
+#include <windows.h>
+#include <psapi.h>
+int main(void) {return (EnumProcesses(NULL,0,NULL) ? 0 : 1);}
+<<
+
 -version-: nul
 	@$(APPEND)
 	@$(CPP) -I$(srcdir) -I$(srcdir)/include <<"Creating $(MAKEFILE)" | findstr "=" >>$(MAKEFILE)

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

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