From: Hidetoshi NAGAI Date: 2004-05-23T14:00:27+09:00 Subject: [ruby-dev:23575] Re: try_run in ext/tcltklib/extconf.rb 永井@知能.九工大です. From: WATANABE Hirofumi Subject: [ruby-dev:23566] try_run in ext/tcltklib/extconf.rb Date: Sat, 22 May 2004 23:23:18 +0900 Message-ID: <20040522232317.831743.eban@os.rim.or.jp> > たぶん例のthreadが有効かどうかの判断のために使われているん > だと思いますが、別の方法はありませんか? 添付パッチのような感じではいかがでしょうか. これでも try_run の問題に引っ掛かるでしょうか. # OK なら,これで commit します. Index: extconf.rb =================================================================== RCS file: /src/ruby/ext/tcltklib/extconf.rb,v retrieving revision 1.16 diff -u -r1.16 extconf.rb --- extconf.rb 1 May 2004 16:08:58 -0000 1.16 +++ extconf.rb 23 May 2004 04:57:00 -0000 @@ -49,24 +49,97 @@ end end -if have_header("tcl.h") && have_header("tk.h") && - (is_win32 || find_library("X11", "XOpenDisplay", - "/usr/X11/lib", "/usr/lib/X11", "/usr/X11R6/lib", "/usr/openwin/lib")) && - find_tcl(tcllib, stubs) && - find_tk(tklib, stubs) - $CPPFLAGS += ' -DUSE_TCL_STUBS -DUSE_TK_STUBS' if stubs - $CPPFLAGS += ' -D_WIN32' if /cygwin/ =~ RUBY_PLATFORM - +def pthread_check() pthread_enabled = macro_defined?('HAVE_LIBPTHREAD', '#include "ruby.h"') - if try_run(< static Tcl_ThreadDataKey dataKey; int main() { exit((Tcl_GetThreadData(&dataKey, 1) == dataKey)? 1: 0); } EOF - tcl_enable_thread = true - else - tcl_enable_thread = false + tcl_enable_thread = true + else + tcl_enable_thread = false + end end unless pthread_enabled @@ -88,9 +161,10 @@ ** ***************************************************************************** ') + return false else # ruby -> disable && tcl -> disable - create_makefile("tcltklib") + return true end else unless tcl_enable_thread @@ -110,13 +184,26 @@ ** If you want change the status of pthread support, please recompile ** Ruby without "--enable-pthread" configure option or recompile Tcl/Tk ** with "--enable-threads" configure option (if your Tcl/Tk is later -** than Tcl/Tk8.1). +** than or equal to Tcl/Tk8.1). ** ***************************************************************************** ') end # ruby -> enable && tcl -> enable/disable + return true + end +end + +if have_header("tcl.h") && have_header("tk.h") && + (is_win32 || find_library("X11", "XOpenDisplay", + "/usr/X11/lib", "/usr/lib/X11", "/usr/X11R6/lib", "/usr/openwin/lib")) && + find_tcl(tcllib, stubs) && + find_tk(tklib, stubs) + $CPPFLAGS += ' -DUSE_TCL_STUBS -DUSE_TK_STUBS' if stubs + $CPPFLAGS += ' -D_WIN32' if /cygwin/ =~ RUBY_PLATFORM + + if pthread_check() create_makefile("tcltklib") end end -- 永井 秀利 (九工大 知能情報) nagai@ai.kyutech.ac.jp