----Next_Part(Thu_May__6_23:48:32_2010_080)--
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

From: Luis Lavena <luislavena / gmail.com>
Subject: [ruby-core:30055] Re: [Bug #3248] extension 'tk' is finding tclConfig.sh and tkConfig.sh incorrectly
Date: Thu, 6 May 2010 21:39:22 +0900
Message-ID: <o2p71166b3b1005060538weedd118bxc80544e6f5084538 / mail.gmail.com>
> Yes, I can temporary disable it, but I see that will not solve the
> issue for average user in the long run.

From: Jon Forums <redmine / ruby-lang.org>
Subject: [ruby-core:30056] [Bug #3248] extension 'tk' is finding tclConfig.sh and tkConfig.sh incorrectly
Date: Thu, 6 May 2010 22:22:16 +0900
Message-ID: <4be2c285cc7f_999cc10bb8136541 / redmine.ruby-lang.org>
> My current "fix" is to remove <GIT_INSTALL>\cmd from my PATH and use a non-preferred shell (development irritant) which is not really a fix at all given that I do not have tk or tcl installed on my system.

I see. Can the attached patch fix your problem?
-- 
Hidetoshi NAGAI (nagai / ai.kyutech.ac.jp)

----Next_Part(Thu_May__6_23:48:32_2010_080)--
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="extconf.rb.patch"

--- extconf.rb~	2010-05-05 18:48:17.000000000 +0900
+++ extconf.rb	2010-05-06 23:35:23.000000000 +0900
@@ -84,8 +84,8 @@
 if update_flag
   puts "Configure options for Ruby/Tk may be updated."
   puts "So, delete files which depend on old configs."
-  File.delete(*Dir.glob("*.#{CONFIG['DLEXT']}"))
-  File.delete(*Dir.glob("*.#{$OBJEXT}"))
+  File.delete(*Dir.glob("*.#{CONFIG['DLEXT']}", File::FNM_CASEFOLD))
+  File.delete(*Dir.glob("*.#{$OBJEXT}", File::FNM_CASEFOLD))
   File.delete('Makefile') rescue nil
 
 else
@@ -177,7 +177,7 @@
   path_dirs  ]
 
   if TkLib_Config["ActiveTcl"].kind_of?(String)  # glob path
-    path_dirs.concat Dir.glob(TkLib_Config["ActiveTcl"]).sort.reverse
+    path_dirs.concat Dir.glob(TkLib_Config["ActiveTcl"], File::FNM_CASEFOLD).sort.reverse
   end
 
   if is_win32?
@@ -199,17 +199,17 @@
       next unless File.directory?(dir)
 
       path_dirs << "#{dir}/lib"
-      path_dirs << "#{dir}" unless Dir.glob("#{dir}/lib*.*").empty?
+      path_dirs << "#{dir}" unless Dir.glob("#{dir}/lib*.*", File::FNM_CASEFOLD).empty?
 
       dirnames  ]
       if TkLib_Config["ActiveTcl"]
-        dirnames.concat ["ActiveTcl","activeTcl","Activetcl","activetcl"]
+        dirnames.concat ["ActiveTcl"]
       end
-      dirnames.concat ["TclTk","Tcl_Tk","Tcl-Tk","tcltk","tcl_tk","tcl-tk"]
+      dirnames.concat ["TclTk","Tcl_Tk","Tcl-Tk"]
 
       dirnames.each{|name|
         path_dirs << "#{dir}/#{name}" if File.directory?("#{dir}/#{name}")
-        path_head << "#{dir}/#{name}" unless Dir.glob("#{dir}/#{name}[-89_]*").empty?
+        path_head << "#{dir}/#{name}" unless Dir.glob("#{dir}/#{name}[-89_]*", File::FNM_CASEFOLD).empty?
       }
     }
   end
@@ -379,34 +379,26 @@
         dirs << TkLib_Config["ActiveTcl"]
       end
       dirs.concat [
-        "c:/ActiveTcl*/lib", "c:/Activetcl*/lib", 
-        "c:/activeTcl*/lib", "c:/activetcl*/lib", 
-        "c:/Tcl*/lib", "c:/tcl*/lib", 
-        "c:/Program Files/ActiveTcl*/lib", "c:/Program Files/Activetcl*/lib",
-        "c:/Program Files/activeTcl*/lib", "c:/Program Files/activetcl*/lib",
-        "c:/Program Files/Tcl*/lib", "c:/Program Files/tcl*/lib",
-        "/ActiveTcl*/lib", "/Activetcl*/lib", 
-        "/activeTcl*/lib", "/activetcl*/lib", 
-        "/Tcl*/lib", "/tcl*/lib", 
-        "/Program Files/ActiveTcl*/lib", "/Program Files/Activetcl*/lib",
-        "/Program Files/activeTcl*/lib", "/Program Files/activetcl*/lib",
-        "/Program Files/Tcl*/lib", "/Program Files/tcl*/lib"
+        "c:/ActiveTcl*/lib", "c:/Tcl*/lib",
+        "c:/Program Files/ActiveTcl*/lib", "c:/Program Files/Tcl*/lib",
+        "/ActiveTcl*/lib", "/Tcl*/lib",
+        "/Program Files/ActiveTcl*/lib", "/Program Files/Tcl*/lib"
       ]
     else
       dirs  
-        "c:/Tcl*/lib", "c:/tcl*/lib", 
-        "c:/Program Files/Tcl*/lib", "c:/Program Files/tcl*/lib",
-        "/Tcl*/lib", "/tcl*/lib", 
-        "/Program Files/Tcl*/lib", "/Program Files/tcl*/lib"
+        "c:/Tcl*/lib", "c:/Program Files/Tcl*/lib",
+        "/Tcl*/lib", "/Program Files/Tcl*/lib"
       ]
     end
-    dirs.collect{|d| Dir.glob(d)}.flatten!
+    dirs.collect{|d| Dir.glob(d, File::FNM_CASEFOLD)}.flatten!
     dirs | irs
 
-    ENV['PATH'].split(';').each{|dir|
+    ENV['PATH'].split(File::PATH_SEPARATOR).each{|dir|
+      dir.tr!(File::ALT_SEPARATOR, File::SEPARATOR) if File::ALT_SEPARATOR
+      next if Dir.glob(File.join(dir, '{tclsh,wish}*'), File::FNM_CASEFOLD).empty?
       dirs << File.expand_path(File.join(dir, '..', 'lib'))
       dirs << dir
-      dirs << File.expand_path(File.join(dir, '..'))
+      # dirs << File.expand_path(File.join(dir, '..'))
     }
 
     unless TkLib_Config["space-on-tk-libpath"]
@@ -421,7 +413,7 @@
   else
     if activeTcl  kLib_Config['ActiveTcl']
       # check latest version at first
-      config_dir.concat(Dir.glob(activeTcl).sort.reverse)
+      config_dir.concat(Dir.glob(activeTcl, File::FNM_CASEFOLD).sort.reverse)
     end
 
     config_dir.concat [
@@ -438,25 +430,27 @@
       '/usr/local/opt', '/usr/local/pkg', '/usr/local/share', '/usr/local',
       '/usr/opt', '/usr/pkg', '/usr/share', '/usr/contrib', '/usr'
     ].map{|dir|
-      Dir.glob(dir + '/{TclTk,tcltk,Tcl,tcl,Tk,tk}[87]*/lib')
-      Dir.glob(dir + '/{TclTk,tcltk,Tcl,tcl,Tk,tk}[87]*')
-      Dir.glob(dir + '/{TclTk,tcltk,Tcl,tcl,Tk,tk}/lib')
-      Dir.glob(dir + '/{TclTk,tcltk,Tcl,tcl,Tk,tk}')
+      Dir.glob(dir + '/{tcltk,tcl,tk}[87]*/lib', File::FNM_CASEFOLD)
+      Dir.glob(dir + '/{tcltk,tcl,tk}[87]*', File::FNM_CASEFOLD)
+      Dir.glob(dir + '/{tcltk,tcl,tk}/lib', File::FNM_CASEFOLD)
+      Dir.glob(dir + '/{tcltk,tcl,tk}', File::FNM_CASEFOLD)
     }.flatten!
 
-    ENV['PATH'].split(':').each{|dir|
+    ENV['PATH'].split(File::PATH_SEPARATOR).each{|dir|
+      dir.tr!(File::ALT_SEPARATOR, File::SEPARATOR) if File::ALT_SEPARATOR
+      next if Dir.glob(File.join(dir, '{tclsh,wish}*'), File::FNM_CASEFOLD).empty?
       config_dir << File.expand_path(File.join(dir, '..', 'lib'))
     }
 
     # for MacOS X
     #config_dir << "~/Library/Tcl"
-    #config_dir.concat(Dir.glob("~/Library/Tcl/*").sort.reverse)
+    #config_dir.concat(Dir.glob("~/Library/Tcl/*", File::FNM_CASEFOLD).sort.reverse)
     config_dir << "/Library/Tcl"
-    config_dir.concat(Dir.glob("/Library/Tcl/*").sort.reverse)
+    config_dir.concat(Dir.glob("/Library/Tcl/*", File::FNM_CASEFOLD).sort.reverse)
     config_dir << "/Network/Library/Tcl"
-    config_dir.concat(Dir.glob("/Network/Library/Tcl/*").sort.reverse)
+    config_dir.concat(Dir.glob("/Network/Library/Tcl/*", File::FNM_CASEFOLD).sort.reverse)
     config_dir << "/System/Library/Tcl"
-    config_dir.concat(Dir.glob("/System/Library/Tcl/*").sort.reverse)
+    config_dir.concat(Dir.glob("/System/Library/Tcl/*", File::FNM_CASEFOLD).sort.reverse)
     [
       #"~/Library/Frameworks", 
       "/Library/Frameworks",
@@ -483,7 +477,7 @@
       if path.kind_of?(Array)
         config_dir << path
       else
-        dirs  ir.glob(path)
+        dirs  ir.glob(path, File::FNM_CASEFOLD)
         config_dir.concat(dirs.zip(dirs))
       end
     }
@@ -554,7 +548,7 @@
       libpath  LIBPATH
       tcllibs  il
       begin
-        tcllib_ok  ir.glob(File.join(dir, "*tcl#{stub}#{tclconf['TCL_MAJOR_VERSION']}{.,}#{tclconf['TCL_MINOR_VERSION']}*.*")).find{|file|
+        tcllib_ok  ir.glob(File.join(dir, "*tcl#{stub}#{tclconf['TCL_MAJOR_VERSION']}{.,}#{tclconf['TCL_MINOR_VERSION']}*.*"), File::FNM_CASEFOLD).find{|file|
           if file /^.*(tcl#{stub}#{tclconf['TCL_MAJOR_VERSION']}(\.|)#{tclconf['TCL_MINOR_VERSION']}.*)\.[^.]*$/
             #puts "check #{file} #{$1} #{tclfunc} #{dir}"
             #find_library($1, tclfunc, dir)
@@ -563,7 +557,7 @@
             try_func(tclfunc, tcllibs)
           end
         }
-        tklib_ok  ir.glob(File.join(dir, "*tk#{stub}#{tkconf['TK_MAJOR_VERSION']}{.,}#{tkconf['TK_MINOR_VERSION']}*.*")).find{|file|
+        tklib_ok  ir.glob(File.join(dir, "*tk#{stub}#{tkconf['TK_MAJOR_VERSION']}{.,}#{tkconf['TK_MINOR_VERSION']}*.*"), File::FNM_CASEFOLD).find{|file|
           if file /^.*(tk#{stub}#{tkconf['TK_MAJOR_VERSION']}(\.|)#{tkconf['TK_MINOR_VERSION']}.*)\.[^.]*$/
             #puts "check #{file} #{$1} #{tkfunc} #{dir}"
             # find_library($1, tkfunc, dir)
@@ -675,10 +669,10 @@
     path_list  ]
 
     #if TkLib_Config["ActiveTcl"]
-    #  path_list.concat Dir.glob(TkLib_Config["ActiveTcl"]).sort.reverse
+    #  path_list.concat Dir.glob(TkLib_Config["ActiveTcl"], File::FNM_CASEFOLD).sort.reverse
     #end
     if TkLib_Config["ActiveTcl"].kind_of?(String)  # glob path
-      path_list.concat Dir.glob(TkLib_Config["ActiveTcl"]).sort.reverse
+      path_list.concat Dir.glob(TkLib_Config["ActiveTcl"], File::FNM_CASEFOLD).sort.reverse
     end
 
     vers  et_shlib_versions
@@ -691,16 +685,16 @@
         else
           dirs  ]
 
-          if !Dir.glob(head + "-*").empty?
-            dirs << head + "-#{ver}/lib" if !Dir.glob(head + "-[89].*").empty?
-            dirs << head + "-#{ver.delete('.')}/lib" if !Dir.glob(head + "-[89][0-9]*").empty?
+          if !Dir.glob(head + "-*", File::FNM_CASEFOLD).empty?
+            dirs << head + "-#{ver}/lib" if !Dir.glob(head + "-[89].*", File::FNM_CASEFOLD).empty?
+            dirs << head + "-#{ver.delete('.')}/lib" if !Dir.glob(head + "-[89][0-9]*", File::FNM_CASEFOLD).empty?
           end
 
-          if !Dir.glob(head + "[_-]*").empty?
-            dirs << head + "_#{ver}/lib" if !Dir.glob(head + "_[89].*").empty?
-            dirs << head + "-#{ver}/lib" if !Dir.glob(head + "-[89].*").empty?
-            dirs << head + "_#{ver.delete('.')}/lib" if !Dir.glob(head + "_[89][0-9]*").empty?
-            dirs << head + "-#{ver.delete('.')}/lib" if !Dir.glob(head + "-[89][0-9]*").empty?
+          if !Dir.glob(head + "[_-]*", File::FNM_CASEFOLD).empty?
+            dirs << head + "_#{ver}/lib" if !Dir.glob(head + "_[89].*", File::FNM_CASEFOLD).empty?
+            dirs << head + "-#{ver}/lib" if !Dir.glob(head + "-[89].*", File::FNM_CASEFOLD).empty?
+            dirs << head + "_#{ver.delete('.')}/lib" if !Dir.glob(head + "_[89][0-9]*", File::FNM_CASEFOLD).empty?
+            dirs << head + "-#{ver.delete('.')}/lib" if !Dir.glob(head + "-[89][0-9]*", File::FNM_CASEFOLD).empty?
           end
 
           dirs
@@ -735,7 +729,7 @@
   end
   exts << ",dll,lib" if is_win32?
   exts << ",bundle,dylib" if is_macosx? || /nextstep|openstep|rhapsody/ RUBY_PLATFORM
-  files  ir.glob(File.join(path, "*{#{heads.join(',')}}*.{#{exts}}"))
+  files  ir.glob(File.join(path, "*{#{heads.join(',')}}*.{#{exts}}"), File::FNM_CASEFOLD)
   vers.find_all{|ver| files.find{|f| f /(#{ver}|#{ver.delete('.')})/} }
 end
 
@@ -1029,9 +1023,10 @@
     TkConfig_Info['TK_INCLUDE_SPEC']  -I#{File.join(TkLib_Config['tcltk-framework'], 'Tk.framework', 'Headers')} "
   else
     dir  ir.glob(File.join(TkLib_Config["tcltk-framework"], 
-                             'Tcl.framework', '*', 'Headers'))
+                             'Tcl.framework', '*', 'Headers'),
+                   File::FNM_CASEFOLD)
     TclConfig_Info['TCL_INCLUDE_SPEC']  -I#{dir[0]} " unless dir.empty?
-    TkConfig_Info['TK_INCLUDE_SPEC']  -I#{Dir.glob(File.join(TkLib_Config['tcltk-framework'], 'Tk.framework', '*', 'Headers'))[0]} "
+    TkConfig_Info['TK_INCLUDE_SPEC']  -I#{Dir.glob(File.join(TkLib_Config['tcltk-framework'], 'Tk.framework', '*', 'Headers'), File::FNM_CASEFOLD)[0]} "
   end
 
   $LDFLAGS << ' -framework Tk -framework Tcl'
@@ -1050,8 +1045,8 @@
   defaults /usr/X11*/lib", "/usr/lib/X11*", "/usr/local/X11*", "/usr/openwin/lib" ]
   paths  ]
-  opt_paths.compact.each{|path| paths.concat(Dir.glob(path.strip.chomp('/')))}
-  defaults.compact.each{|path| paths.concat(Dir.glob(path.strip.chomp('/')))}
+  opt_paths.compact.each{|path| paths.concat(Dir.glob(path.strip.chomp('/'), File::FNM_CASEFOLD))}
+  defaults.compact.each{|path| paths.concat(Dir.glob(path.strip.chomp('/'), File::FNM_CASEFOLD))}
   st  ind_library("X11", "XOpenDisplay", *paths)
   unless st
     puts("Warning:: cannot find X11 library. tcltklib will not be compiled (tcltklib is disabled on your Ruby Ruby/Tk will not work). Please check configure options. If your Tcl/Tk don't require X11, please try --without-X11.")

----Next_Part(Thu_May__6_23:48:32_2010_080)----