summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
Diffstat (limited to 'ext')
-rw-r--r--ext/tcltklib/.cvsignore3
-rw-r--r--ext/tcltklib/depend2
-rw-r--r--ext/tcltklib/extconf.rb267
-rw-r--r--ext/tk/.cvsignore2
-rw-r--r--ext/tk/MANUAL_tcltklib.eng (renamed from ext/tcltklib/MANUAL.eng)0
-rw-r--r--ext/tk/MANUAL_tcltklib.eucj (renamed from ext/tcltklib/MANUAL.euc)0
-rw-r--r--ext/tk/README.1st28
-rw-r--r--ext/tk/README.ActiveTcl (renamed from ext/tcltklib/README.ActiveTcl)0
-rw-r--r--ext/tk/README.tcltklib (renamed from ext/tcltklib/README.1st)0
-rw-r--r--ext/tk/depend2
-rw-r--r--ext/tk/extconf.rb346
-rw-r--r--ext/tk/lib/tcltk.rb (renamed from ext/tcltklib/lib/tcltk.rb)0
-rw-r--r--ext/tk/old-README.tcltklib.eucj (renamed from ext/tcltklib/README.euc)0
-rw-r--r--ext/tk/sample/tcltklib/batsu.gif (renamed from ext/tcltklib/sample/batsu.gif)bin538 -> 538 bytes
-rw-r--r--ext/tk/sample/tcltklib/lines0.tcl (renamed from ext/tcltklib/demo/lines0.tcl)0
-rw-r--r--ext/tk/sample/tcltklib/lines1.rb (renamed from ext/tcltklib/demo/lines2.rb)0
-rw-r--r--ext/tk/sample/tcltklib/lines2.rb (renamed from ext/tcltklib/demo/lines1.rb)0
-rw-r--r--ext/tk/sample/tcltklib/lines3.rb (renamed from ext/tcltklib/demo/lines3.rb)0
-rw-r--r--ext/tk/sample/tcltklib/lines4.rb (renamed from ext/tcltklib/demo/lines4.rb)0
-rw-r--r--ext/tk/sample/tcltklib/maru.gif (renamed from ext/tcltklib/sample/maru.gif)bin481 -> 481 bytes
-rw-r--r--ext/tk/sample/tcltklib/safeTk.rb (renamed from ext/tcltklib/demo/safeTk.rb)0
-rw-r--r--ext/tk/sample/tcltklib/sample0.rb (renamed from ext/tcltklib/sample/sample0.rb)0
-rw-r--r--ext/tk/sample/tcltklib/sample1.rb (renamed from ext/tcltklib/sample/sample1.rb)0
-rw-r--r--ext/tk/sample/tcltklib/sample2.rb (renamed from ext/tcltklib/sample/sample2.rb)12
-rw-r--r--ext/tk/stubs.c (renamed from ext/tcltklib/stubs.c)0
-rw-r--r--ext/tk/tcltklib.c (renamed from ext/tcltklib/tcltklib.c)0
26 files changed, 365 insertions, 297 deletions
diff --git a/ext/tcltklib/.cvsignore b/ext/tcltklib/.cvsignore
deleted file mode 100644
index 90c83ed9b1..0000000000
--- a/ext/tcltklib/.cvsignore
+++ /dev/null
@@ -1,3 +0,0 @@
-Makefile
-*.log
-*.def
diff --git a/ext/tcltklib/depend b/ext/tcltklib/depend
deleted file mode 100644
index 2cd9c400f7..0000000000
--- a/ext/tcltklib/depend
+++ /dev/null
@@ -1,2 +0,0 @@
-tcltklib.o: tcltklib.c $(hdrdir)/ruby.h $(topdir)/config.h $(hdrdir)/defines.h
-stubs.o: stubs.c $(hdrdir)/ruby.h $(topdir)/config.h $(hdrdir)/defines.h
diff --git a/ext/tcltklib/extconf.rb b/ext/tcltklib/extconf.rb
deleted file mode 100644
index 00aa2ca620..0000000000
--- a/ext/tcltklib/extconf.rb
+++ /dev/null
@@ -1,267 +0,0 @@
-# extconf.rb for tcltklib
-
-require 'mkmf'
-
-is_win32 = (/mswin32|mingw|cygwin|bccwin32/ =~ RUBY_PLATFORM)
-is_macosx = (/darwin/ =~ RUBY_PLATFORM)
-
-mac_need_framework =
- is_macosx &&
- enable_config("mac-tcltk-framework", false) &&
- FileTest.directory?("/Library/Frameworks/Tcl.framework/") &&
- FileTest.directory?("/Library/Frameworks/Tk.framework/")
-
-unless is_win32
- have_library("nsl", "t_open")
- have_library("socket", "socket")
- have_library("dl", "dlopen")
- have_library("m", "log")
-end
-
-dir_config("tk")
-dir_config("tcl")
-dir_config("X11")
-
-tklib = with_config("tklib")
-tcllib = with_config("tcllib")
-stubs = enable_config("tcltk_stubs") || with_config("tcltk_stubs")
-
-def find_tcl(tcllib, stubs)
- paths = ["/usr/local/lib", "/usr/pkg/lib", "/usr/lib"]
- if stubs
- func = "Tcl_InitStubs"
- lib = "tclstub"
- else
- func = "Tcl_FindExecutable"
- lib = "tcl"
- end
- if tcllib
- find_library(tcllib, func, *paths)
- elsif find_library(lib, func, *paths)
- true
- else
- %w[8.5 8.4 8.3 8.2 8.1 8.0 7.6].find { |ver|
- find_library("#{lib}#{ver}", func, *paths) or
- find_library("#{lib}#{ver.delete('.')}", func, *paths) or
- find_library("tcl#{ver}", func, *paths) or
- find_library("tcl#{ver.delete('.')}", func, *paths)
- }
- end
-end
-
-def find_tk(tklib, stubs)
- paths = ["/usr/local/lib", "/usr/pkg/lib", "/usr/lib"]
- if stubs
- func = "Tk_InitStubs"
- lib = "tkstub"
- else
- func = "Tk_Init"
- lib = "tk"
- end
- if tklib
- find_library(tklib, func, *paths)
- elsif find_library(lib, func, *paths)
- true
- else
- %w[8.5 8.4 8.3 8.2 8.1 8.0 4.2].find { |ver|
- find_library("#{lib}#{ver}", func, *paths) or
- find_library("#{lib}#{ver.delete('.')}", func, *paths) or
- find_library("tk#{ver}", func, *paths) or
- find_library("tk#{ver.delete('.')}", func, *paths)
- }
- end
-end
-
-def pthread_check()
- tcl_major_ver = nil
- tcl_minor_ver = nil
-
- # Is tcl-thread given by user ?
- case enable_config("tcl-thread")
- when true
- tcl_enable_thread = true
- when false
- tcl_enable_thread = false
- else
- tcl_enable_thread = nil
- end
-
- if (tclConfig = with_config("tclConfig-file"))
- if tcl_enable_thread == true
- puts("Warning: --with-tclConfig-file option is ignored, because --enable-tcl-thread option is given.")
- elsif tcl_enable_thread == false
- puts("Warning: --with-tclConfig-file option is ignored, because --disable-tcl-thread option is given.")
- else
- # tcl-thread is unknown and tclConfig.sh is given
- begin
- open(tclConfig, "r") do |cfg|
- while line = cfg.gets()
- if line =~ /^\s*TCL_THREADS=(0|1)/
- tcl_enable_thread = ($1 == "1")
- break
- end
-
- if line =~ /^\s*TCL_MAJOR_VERSION=("|')(\d+)\1/
- tcl_major_ver = $2
- if tcl_major_ver =~ /^[1-7]$/
- tcl_enable_thread = false
- break
- end
- if tcl_major_ver == "8" && tcl_minor_ver == "0"
- tcl_enable_thread = false
- break
- end
- end
-
- if line =~ /^\s*TCL_MINOR_VERSION=("|')(\d+)\1/
- tcl_minor_ver = $2
- if tcl_major_ver == "8" && tcl_minor_ver == "0"
- tcl_enable_thread = false
- break
- end
- end
- end
- end
-
- if tcl_enable_thread == nil
- # not find definition
- if tcl_major_ver
- puts("Warning: '#{tclConfig}' doesn't include TCL_THREADS definition.")
- else
- puts("Warning: '#{tclConfig}' may not be a tclConfig file.")
- end
- tclConfig = false
- end
- rescue Exception
- puts("Warning: fail to read '#{tclConfig}'!! --> ignore the file")
- tclConfig = false
- end
- end
- end
-
- if tcl_enable_thread == nil && !tclConfig
- # tcl-thread is unknown and tclConfig is unavailable
- begin
- try_run_available = try_run("int main() { exit(0); }")
- rescue Exception
- # cannot try_run. Is CROSS-COMPILE environment?
- puts(%Q'\
-*****************************************************************************
-**
-** PTHREAD SUPPORT CHECK WARNING:
-**
-** We cannot check the consistency of pthread support between Ruby
-** and Tcl/Tk library on your environment (do coss-compile?). If the
-** consistency is not kept, some memory troubles (e.g. "Hang-up" or
-** "Segmentation Fault") may bother you. We strongly you to check the
-** consistency by your own hand.
-**
-*****************************************************************************
-')
- return true
- end
- end
-
- if tcl_enable_thread == nil
- # tcl-thread is unknown
- if try_run(<<EOF)
-#include <tcl.h>
-int main() {
- Tcl_Interp *ip;
- ip = Tcl_CreateInterp();
- exit((Tcl_Eval(ip, "set tcl_platform(threaded)") == TCL_OK)? 0: 1);
-}
-EOF
- tcl_enable_thread = true
- elsif try_run(<<EOF)
-#include <tcl.h>
-static Tcl_ThreadDataKey dataKey;
-int main() { exit((Tcl_GetThreadData(&dataKey, 1) == dataKey)? 1: 0); }
-EOF
- tcl_enable_thread = true
- else
- tcl_enable_thread = false
- end
- end
-
- # check pthread mode
- if (macro_defined?('HAVE_LIBPTHREAD', '#include "ruby.h"'))
- # ruby -> enable
- unless tcl_enable_thread
- # ruby -> enable && tcl -> disable
- puts(%Q'\
-*****************************************************************************
-**
-** PTHREAD SUPPORT MODE WARNING:
-**
-** Ruby is compiled with --enable-pthread, but your Tcl/Tk libraries
-** seems to be compiled without "pthread support". Although You can
-** create tcltklib library, this combination may cause memory trouble
-** (e.g. "Hang-up" or "Segmentation Fault"). If you have no reason you
-** must have to keep current pthread support status, we recommend you
-** to make both or neither libraries to support pthread.
-**
-** 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 or equal to Tcl/Tk8.1).
-**
-*****************************************************************************
-')
- end
-
- # ruby -> enable && tcl -> enable/disable
- if tcl_enable_thread
- $CPPFLAGS += ' -DWITH_TCL_ENABLE_THREAD=1'
- else
- $CPPFLAGS += ' -DWITH_TCL_ENABLE_THREAD=0'
- end
-
- return true
-
- else
- # ruby -> disable
- if tcl_enable_thread
- # ruby -> disable && tcl -> enable
- puts(%Q'\
-*****************************************************************************
-**
-** PTHREAD SUPPORT MODE ERRROR:
-**
-** Ruby is not compiled with --enable-pthread, but your Tcl/Tk
-** libararies seems to be compiled with "pthread support". This
-** combination possibly cause "Hang-up" or "Segmentation Fault"
-** frequently when Ruby/Tk is working. We NEVER recommend you to
-** create the library under such combination of pthread support.
-**
-** Please recompile Ruby with "--enable-pthread" configure option
-** or recompile Tcl/Tk with "--disable-threads" configure option.
-**
-*****************************************************************************
-')
- $CPPFLAGS += ' -DWITH_TCL_ENABLE_THREAD=1'
- return false
- else
- # ruby -> disable && tcl -> disable
- $CPPFLAGS += ' -DWITH_TCL_ENABLE_THREAD=0'
- return true
- end
- end
-end
-
-if mac_need_framework ||
- (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 mac_need_framework
- $CPPFLAGS += ' -I/Library/Frameworks/Tcl.framework/headers -I/Library/Frameworks/Tk.framework/Headers'
- $LDFLAGS += ' -framework Tk -framework Tcl'
- end
-
- create_makefile("tcltklib") if stubs or pthread_check
-end
diff --git a/ext/tk/.cvsignore b/ext/tk/.cvsignore
index 44e7f262dc..90c83ed9b1 100644
--- a/ext/tk/.cvsignore
+++ b/ext/tk/.cvsignore
@@ -1,3 +1,3 @@
Makefile
-mkmf.log
*.log
+*.def
diff --git a/ext/tcltklib/MANUAL.eng b/ext/tk/MANUAL_tcltklib.eng
index d3417f5dff..d3417f5dff 100644
--- a/ext/tcltklib/MANUAL.eng
+++ b/ext/tk/MANUAL_tcltklib.eng
diff --git a/ext/tcltklib/MANUAL.euc b/ext/tk/MANUAL_tcltklib.eucj
index a0d7e42307..a0d7e42307 100644
--- a/ext/tcltklib/MANUAL.euc
+++ b/ext/tk/MANUAL_tcltklib.eucj
diff --git a/ext/tk/README.1st b/ext/tk/README.1st
index 038528e553..fce5b0242b 100644
--- a/ext/tk/README.1st
+++ b/ext/tk/README.1st
@@ -1,23 +1,19 @@
-If you want to use Ruby/Tk (tk.rb and so on), you must have
-tcltklib.so which is working collectry. If you fail to call
-'require "tcltklib"', you may not have tcltklib.so.
-( see also README files of tcltklib )
-Even if there is a tcltklib.so on your Ruby library directry,
-it will not work without Tcl/Tk libraries (e.g. libtcl8.4.so)
-on your environment. You must also check that your Tcl/Tk is
-installed properly.
+If you want to use Ruby/Tk (tk.rb and so on), you must have tcltklib.so
+which is working correctly. When you have some troubles on compiling,
+please read README.tcltklib and README.ActiveTcl.
+Even if there is a tcltklib.so on your Ruby library directry, it will not
+work without Tcl/Tk libraries (e.g. libtcl8.4.so) on your environment.
+You must also check that your Tcl/Tk is installed properly.
--------------------------------------------
( the following is written in EUC-JP )
-Ruby/Tk (tk.rb など) を使いたい場合には,tcltklib.so が正しく
-動いていなければなりません.もし require "tcltklib" に失敗する
-ようなら,tcltklib.so が存在していないのかもしれません.
-( tcltklib の README ファイルも見てください )
-たとえ Ruby のライブラリディレクトリに tcltklib.so が存在して
-いたとしても,実行環境に Tcl/Tk ライブラリ (libtcl8.4.so など)
-がなければ機能しません.Tcl/Tk が正しくインストールされているか
-どうかもチェックしてください.
+Ruby/Tk (tk.rb など) を使いたい場合には,tcltklib.so が正しく動いていな
+ければなりません.コンパイル時に何か問題が生じた場合は,README.tcltklib
+や README.ActiveTcl を見てください.
+たとえ Ruby のライブラリディレクトリに tcltklib.so が存在していたとして
+も,実行環境に Tcl/Tk ライブラリ (libtcl8.4.so など) がなければ機能しま
+せん.Tcl/Tk が正しくインストールされているかもチェックしてください.
==========================================================
Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tcltklib/README.ActiveTcl b/ext/tk/README.ActiveTcl
index 3afb3f4cf6..3afb3f4cf6 100644
--- a/ext/tcltklib/README.ActiveTcl
+++ b/ext/tk/README.ActiveTcl
diff --git a/ext/tcltklib/README.1st b/ext/tk/README.tcltklib
index 4d5cd93283..4d5cd93283 100644
--- a/ext/tcltklib/README.1st
+++ b/ext/tk/README.tcltklib
diff --git a/ext/tk/depend b/ext/tk/depend
index fd63e230f0..95d5527e61 100644
--- a/ext/tk/depend
+++ b/ext/tk/depend
@@ -1 +1,3 @@
+tcltklib.o: tcltklib.c $(hdrdir)/ruby.h $(topdir)/config.h $(hdrdir)/defines.h
+stubs.o: stubs.c $(hdrdir)/ruby.h $(topdir)/config.h $(hdrdir)/defines.h
tkutil.o: tkutil.c $(hdrdir)/ruby.h $(topdir)/config.h $(hdrdir)/defines.h
diff --git a/ext/tk/extconf.rb b/ext/tk/extconf.rb
index 8b10353d1a..48c777e0d5 100644
--- a/ext/tk/extconf.rb
+++ b/ext/tk/extconf.rb
@@ -1,4 +1,344 @@
+# extconf.rb for tcltklib
+
require 'mkmf'
-$preload = ["tcltklib"]
-($INSTALLFILES||=[]) << ["lib/tkextlib/SUPPORT_STATUS", "$(RUBYLIBDIR)", "lib"]
-create_makefile("tkutil")
+
+is_win32 = (/mswin32|mingw|cygwin|bccwin32/ =~ RUBY_PLATFORM)
+is_macosx = (/darwin/ =~ RUBY_PLATFORM)
+
+mac_need_framework =
+ is_macosx &&
+ enable_config("mac-tcltk-framework", false) &&
+ FileTest.directory?("/Library/Frameworks/Tcl.framework/") &&
+ FileTest.directory?("/Library/Frameworks/Tk.framework/")
+
+unless is_win32
+ have_library("nsl", "t_open")
+ have_library("socket", "socket")
+ have_library("dl", "dlopen")
+ have_library("m", "log")
+end
+
+dir_config("tk")
+dir_config("tcl")
+dir_config("X11")
+
+tklib = with_config("tklib")
+tcllib = with_config("tcllib")
+stubs = enable_config("tcltk_stubs") || with_config("tcltk_stubs")
+
+def find_tcl(tcllib, stubs)
+ paths = ["/usr/local/lib", "/usr/pkg/lib", "/usr/lib"]
+ if stubs
+ func = "Tcl_InitStubs"
+ lib = "tclstub"
+ else
+ func = "Tcl_FindExecutable"
+ lib = "tcl"
+ end
+ if tcllib
+ find_library(tcllib, func, *paths)
+ elsif find_library(lib, func, *paths)
+ true
+ else
+ %w[8.5 8.4 8.3 8.2 8.1 8.0 7.6].find { |ver|
+ find_library("#{lib}#{ver}", func, *paths) or
+ find_library("#{lib}#{ver.delete('.')}", func, *paths) or
+ find_library("tcl#{ver}", func, *paths) or
+ find_library("tcl#{ver.delete('.')}", func, *paths)
+ }
+ end
+end
+
+def find_tk(tklib, stubs)
+ paths = ["/usr/local/lib", "/usr/pkg/lib", "/usr/lib"]
+ if stubs
+ func = "Tk_InitStubs"
+ lib = "tkstub"
+ else
+ func = "Tk_Init"
+ lib = "tk"
+ end
+ if tklib
+ find_library(tklib, func, *paths)
+ elsif find_library(lib, func, *paths)
+ true
+ else
+ %w[8.5 8.4 8.3 8.2 8.1 8.0 4.2].find { |ver|
+ find_library("#{lib}#{ver}", func, *paths) or
+ find_library("#{lib}#{ver.delete('.')}", func, *paths) or
+ find_library("tk#{ver}", func, *paths) or
+ find_library("tk#{ver.delete('.')}", func, *paths)
+ }
+ end
+end
+
+def pthread_check()
+ tcl_major_ver = nil
+ tcl_minor_ver = nil
+
+ # Is tcl-thread given by user ?
+ case enable_config("tcl-thread")
+ when true
+ $CPPFLAGS += ' -DFORCE_TCL_THREAD=1'
+ tcl_enable_thread = true
+ when false
+ $CPPFLAGS += ' -DFORCE_TCL_THREAD=1'
+ tcl_enable_thread = false
+ else
+ tcl_enable_thread = nil
+ end
+
+ if (tclConfig = with_config("tclConfig-file"))
+ if tcl_enable_thread == true
+ puts("Warning: --with-tclConfig-file option is ignored, because --enable-tcl-thread option is given.")
+ elsif tcl_enable_thread == false
+ puts("Warning: --with-tclConfig-file option is ignored, because --disable-tcl-thread option is given.")
+ else
+ # tcl-thread is unknown and tclConfig.sh is given
+ begin
+ open(tclConfig, "r") do |cfg|
+ while line = cfg.gets()
+ if line =~ /^\s*TCL_THREADS=(0|1)/
+ tcl_enable_thread = ($1 == "1")
+ break
+ end
+
+ if line =~ /^\s*TCL_MAJOR_VERSION=("|')(\d+)\1/
+ tcl_major_ver = $2
+ if tcl_major_ver =~ /^[1-7]$/
+ tcl_enable_thread = false
+ break
+ end
+ if tcl_major_ver == "8" && tcl_minor_ver == "0"
+ tcl_enable_thread = false
+ break
+ end
+ end
+
+ if line =~ /^\s*TCL_MINOR_VERSION=("|')(\d+)\1/
+ tcl_minor_ver = $2
+ if tcl_major_ver == "8" && tcl_minor_ver == "0"
+ tcl_enable_thread = false
+ break
+ end
+ end
+ end
+ end
+
+ if tcl_enable_thread == nil
+ # not find definition
+ if tcl_major_ver
+ puts("Warning: '#{tclConfig}' doesn't include TCL_THREADS definition.")
+ else
+ puts("Warning: '#{tclConfig}' may not be a tclConfig file.")
+ end
+ tclConfig = false
+ end
+ rescue Exception
+ puts("Warning: fail to read '#{tclConfig}'!! --> ignore the file")
+ tclConfig = false
+ end
+ end
+ end
+
+ if tcl_enable_thread == nil && !tclConfig
+ # tcl-thread is unknown and tclConfig is unavailable
+ begin
+ try_run_available = try_run("int main() { exit(0); }")
+ rescue Exception
+ # cannot try_run. Is CROSS-COMPILE environment?
+ puts(%Q'\
+*****************************************************************************
+**
+** PTHREAD SUPPORT CHECK WARNING:
+**
+** We cannot check the consistency of pthread support between Ruby
+** and Tcl/Tk library on your environment (do coss-compile?). If the
+** consistency is not kept, some memory troubles (e.g. "Hang-up" or
+** "Segmentation Fault") may bother you. We strongly recommend you to
+** check the consistency by your own hand.
+**
+*****************************************************************************
+')
+ return true
+ end
+ end
+
+ if tcl_enable_thread == nil
+ # tcl-thread is unknown
+ if try_run(<<EOF)
+#include <tcl.h>
+int main() {
+ Tcl_Interp *ip;
+ ip = Tcl_CreateInterp();
+ exit((Tcl_Eval(ip, "set tcl_platform(threaded)") == TCL_OK)? 0: 1);
+}
+EOF
+ tcl_enable_thread = true
+ elsif try_run(<<EOF)
+#include <tcl.h>
+static Tcl_ThreadDataKey dataKey;
+int main() { exit((Tcl_GetThreadData(&dataKey, 1) == dataKey)? 1: 0); }
+EOF
+ tcl_enable_thread = true
+ else
+ tcl_enable_thread = false
+ end
+ end
+
+ # check pthread mode
+ if (macro_defined?('HAVE_LIBPTHREAD', '#include "ruby.h"'))
+ # ruby -> enable
+ unless tcl_enable_thread
+ # ruby -> enable && tcl -> disable
+ puts(%Q'\
+*****************************************************************************
+**
+** PTHREAD SUPPORT MODE WARNING:
+**
+** Ruby is compiled with --enable-pthread, but your Tcl/Tk libraries
+** seems to be compiled without "pthread support". Although You can
+** create tcltklib library, this combination may cause memory trouble
+** (e.g. "Hang-up" or "Segmentation Fault"). If you have no reason you
+** must have to keep current pthread support status, we recommend you
+** to make both or neither libraries to support pthread.
+**
+** 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 or equal to Tcl/Tk8.1).
+**
+*****************************************************************************
+')
+ end
+
+ # ruby -> enable && tcl -> enable/disable
+ if tcl_enable_thread
+ $CPPFLAGS += ' -DWITH_TCL_ENABLE_THREAD=1'
+ else
+ $CPPFLAGS += ' -DWITH_TCL_ENABLE_THREAD=0'
+ end
+
+ return true
+
+ else
+ # ruby -> disable
+ if tcl_enable_thread
+ # ruby -> disable && tcl -> enable
+ puts(%Q'\
+*****************************************************************************
+**
+** PTHREAD SUPPORT MODE ERRROR:
+**
+** Ruby is not compiled with --enable-pthread, but your Tcl/Tk
+** libararies seems to be compiled with "pthread support". This
+** combination possibly cause "Hang-up" or "Segmentation Fault"
+** frequently when Ruby/Tk is working. We NEVER recommend you to
+** create the library under such combination of pthread support.
+**
+** Please recompile Ruby with "--enable-pthread" configure option
+** or recompile Tcl/Tk with "--disable-threads" configure option.
+**
+*****************************************************************************
+')
+ $CPPFLAGS += ' -DWITH_TCL_ENABLE_THREAD=1'
+ return false
+ else
+ # ruby -> disable && tcl -> disable
+ $CPPFLAGS += ' -DWITH_TCL_ENABLE_THREAD=0'
+ return true
+ end
+ end
+end
+
+if mac_need_framework ||
+ (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 mac_need_framework
+ $CPPFLAGS += ' -I/Library/Frameworks/Tcl.framework/headers -I/Library/Frameworks/Tk.framework/Headers'
+ $LDFLAGS += ' -framework Tk -framework Tcl'
+ end
+
+ if stubs or pthread_check
+ # create Makefile
+
+ # backup
+ if $INSTALLFILES
+ installfiles_bup = $INSTALLFILES.dup
+ else
+ installfiles_bup = nil
+ $INSTALLFILES = []
+ end
+
+ cleanings_bup = CLEANINGS.dup
+
+ if $objs
+ objs_bup = $objs.dup
+ else
+ objs_bup = nil
+ $objs = []
+ end
+
+ # for SUPPORT_STATUS
+ $INSTALLFILES << ["lib/tkextlib/SUPPORT_STATUS", "$(RUBYLIBDIR)", "lib"]
+
+ # for tcltklib.so
+ $objs << "stubs.o" << "tcltklib.o"
+
+ # for tkutil.so
+ mk_tkutil = "\n\n"
+ mk_tkutil << "OBJS2 = tkutil.#{$OBJEXT}\n"
+ mk_tkutil << "TARGET2 = tkutil\n"
+ mk_tkutil << "DLLIB2 = $(TARGET2).#{CONFIG['DLEXT']}\n"
+ mk_tkutil << "STATIC_LIB2 = $(TARGET2).#{$LIBEXT}\n"
+ mk_tkutil << "\n"
+ mk_tkutil << 'CLEANLIBS2 = "$(TARGET2).{lib,exp,il?,tds,map}" $(DLLIB2)'
+ mk_tkutil << "\n\n"
+ mk_tkutil << "all: $(DLLIB2)\n"
+ mk_tkutil << "static: $(STATIC_LIB2)\n"
+ mk_tkutil << "\n"
+
+ mk_tkutil << CLEANINGS.sub(/\$\(CLEANLIBS\)/, "$(CLEANLIBS) $(CLEANLIBS2)")
+ mk_tkutil << "\n\n"
+
+ mk_tkutil << "$(DLLIB2): $(OBJS2)\n\t"
+ mk_tkutil << "@-$(RM) $@\n\t"
+ mk_tkutil << "@-$(RM) $(TARGET2).lib\n\t" if $mswin
+
+ LINK_SO2 = if CONFIG["DLEXT"] == $OBJEXT
+ "ld $(DLDFLAGS) -r -o $(DLLIB2) $(OBJS2)\n"
+ else
+ "$(LDSHARED) $(DLDFLAGS) $(LIBPATH) #{OUTFLAG}$(DLLIB2) " \
+ "$(OBJS2) $(LOCAL_LIBS) $(LIBS)"
+ end
+ mk_tkutil << LINK_SO2
+
+ mk_tkutil << "\n\n"
+ mk_tkutil << "$(STATIC_LIB2): $(OBJS2)\n\t"
+ mk_tkutil << "$(AR) #{config_string('ARFLAGS') || 'cru '}$@ $(OBJS2)"
+ if ranlib = config_string('RANLIB')
+ mk_tkutil << "\n\t@-#{ranlib} $(DLLIB2) 2> /dev/null || true"
+ end
+ mk_tkutil << "\n\n\n"
+
+ mk_tkutil << "install: $(RUBYARCHDIR)/$(DLLIB2)\n"
+ mk_tkutil << "$(RUBYARCHDIR)/$(DLLIB2): $(DLLIB2) $(RUBYARCHDIR)\n"
+ mk_tkutil << "\t@$(INSTALL_PROG) $(DLLIB2) $(RUBYARCHDIR)\n"
+
+ CLEANINGS.replace(mk_tkutil)
+
+ # create
+ create_makefile("tcltklib")
+
+ # reset
+ $INSTALLFILES = installfiles_bup
+ CLEANINGS.replace(cleanings_bup)
+ $objs = objs_bup
+ end
+end
diff --git a/ext/tcltklib/lib/tcltk.rb b/ext/tk/lib/tcltk.rb
index 1a6694dbff..1a6694dbff 100644
--- a/ext/tcltklib/lib/tcltk.rb
+++ b/ext/tk/lib/tcltk.rb
diff --git a/ext/tcltklib/README.euc b/ext/tk/old-README.tcltklib.eucj
index fd75202c18..fd75202c18 100644
--- a/ext/tcltklib/README.euc
+++ b/ext/tk/old-README.tcltklib.eucj
diff --git a/ext/tcltklib/sample/batsu.gif b/ext/tk/sample/tcltklib/batsu.gif
index 880cc73e09..880cc73e09 100644
--- a/ext/tcltklib/sample/batsu.gif
+++ b/ext/tk/sample/tcltklib/batsu.gif
Binary files differ
diff --git a/ext/tcltklib/demo/lines0.tcl b/ext/tk/sample/tcltklib/lines0.tcl
index 8ed3c5e1c1..8ed3c5e1c1 100644
--- a/ext/tcltklib/demo/lines0.tcl
+++ b/ext/tk/sample/tcltklib/lines0.tcl
diff --git a/ext/tcltklib/demo/lines2.rb b/ext/tk/sample/tcltklib/lines1.rb
index 9f21ae6377..9f21ae6377 100644
--- a/ext/tcltklib/demo/lines2.rb
+++ b/ext/tk/sample/tcltklib/lines1.rb
diff --git a/ext/tcltklib/demo/lines1.rb b/ext/tk/sample/tcltklib/lines2.rb
index e459589f50..e459589f50 100644
--- a/ext/tcltklib/demo/lines1.rb
+++ b/ext/tk/sample/tcltklib/lines2.rb
diff --git a/ext/tcltklib/demo/lines3.rb b/ext/tk/sample/tcltklib/lines3.rb
index caa50f92e7..caa50f92e7 100644
--- a/ext/tcltklib/demo/lines3.rb
+++ b/ext/tk/sample/tcltklib/lines3.rb
diff --git a/ext/tcltklib/demo/lines4.rb b/ext/tk/sample/tcltklib/lines4.rb
index 7a1175bce0..7a1175bce0 100644
--- a/ext/tcltklib/demo/lines4.rb
+++ b/ext/tk/sample/tcltklib/lines4.rb
diff --git a/ext/tcltklib/sample/maru.gif b/ext/tk/sample/tcltklib/maru.gif
index 2c0202892e..2c0202892e 100644
--- a/ext/tcltklib/sample/maru.gif
+++ b/ext/tk/sample/tcltklib/maru.gif
Binary files differ
diff --git a/ext/tcltklib/demo/safeTk.rb b/ext/tk/sample/tcltklib/safeTk.rb
index 5d2c60e700..5d2c60e700 100644
--- a/ext/tcltklib/demo/safeTk.rb
+++ b/ext/tk/sample/tcltklib/safeTk.rb
diff --git a/ext/tcltklib/sample/sample0.rb b/ext/tk/sample/tcltklib/sample0.rb
index cd4c8069b4..cd4c8069b4 100644
--- a/ext/tcltklib/sample/sample0.rb
+++ b/ext/tk/sample/tcltklib/sample0.rb
diff --git a/ext/tcltklib/sample/sample1.rb b/ext/tk/sample/tcltklib/sample1.rb
index 13df440751..13df440751 100644
--- a/ext/tcltklib/sample/sample1.rb
+++ b/ext/tk/sample/tcltklib/sample1.rb
diff --git a/ext/tcltklib/sample/sample2.rb b/ext/tk/sample/tcltklib/sample2.rb
index 5d43470de3..444bb1eef7 100644
--- a/ext/tcltklib/sample/sample2.rb
+++ b/ext/tk/sample/tcltklib/sample2.rb
@@ -19,7 +19,7 @@ require "tcltk"
$ip = TclTkInterpreter.new()
$root = $ip.rootwidget()
$button, $canvas, $checkbutton, $frame, $label, $pack, $update, $wm =
- $ip.commands().indexes(
+ $ip.commands().values_at(
"button", "canvas", "checkbutton", "frame", "label", "pack", "update", "wm")
class Othello
@@ -196,10 +196,12 @@ class Othello
def initialize(view, row, col)
@view = view
- @id = @view.e("create rectangle", *view.tk_rect(view.left + col,
- view.top + row,
- view.left + col + 1,
- view.top + row + 1))
+ @id = @view.e("create rectangle",
+ *(view.tk_rect(view.left + col,
+ view.top + row,
+ view.left + col + 1,
+ view.top + row + 1) \
+ << "-fill #{BACK_GROUND_COLOR}") )
@row = row
@col = col
@view.e("itemconfigure", @id,
diff --git a/ext/tcltklib/stubs.c b/ext/tk/stubs.c
index 3913abb570..3913abb570 100644
--- a/ext/tcltklib/stubs.c
+++ b/ext/tk/stubs.c
diff --git a/ext/tcltklib/tcltklib.c b/ext/tk/tcltklib.c
index c9a72ed4bd..c9a72ed4bd 100644
--- a/ext/tcltklib/tcltklib.c
+++ b/ext/tk/tcltklib.c