121925
diff --git a/ext/tk/extconf.rb b/ext/tk/extconf.rb
121925
index 709e4d2..fa1bc80 100644
121925
--- a/ext/tk/extconf.rb
121925
+++ b/ext/tk/extconf.rb
121925
@@ -623,7 +623,7 @@ def libcheck_for_tclConfig(tcldir, tkdir, tclconf, tkconf)
121925
           $INCFLAGS << " -I" << File.join(File.dirname(File.dirname(file)),"include") if is_win32?
121925
         else
121925
           tcllibs = append_library($libs, libname)
121925
-          tcllibs = "-L#{tcldir.quote} -Wl,-R#{tcldir.quote} " + tcllibs
121925
+          tcllibs = "#{libpathflag(tcldir)} #{tcllibs}"
121925
 
121925
           # FIX ME: avoid pathname trouble (fail to find) on MinGW.
121925
           $INCFLAGS << " -I" << File.join(File.dirname(tcldir),"include") if is_win32?
121925
@@ -665,7 +665,7 @@ def libcheck_for_tclConfig(tcldir, tkdir, tclconf, tkconf)
121925
         else
121925
           tklibs = append_library("", libname)
121925
           #tklibs = append_library("", $1)
121925
-          tklibs = "-L#{tkdir.quote} -Wl,-R#{tkdir.quote} " + tklibs
121925
+          tklibs = "#{libpathflag(tkdir)} #{tklibs}"
121925
 
121925
           # FIX ME: avoid pathname trouble (fail to find) on MinGW.
121925
           $INCFLAGS << " -I" << File.join(File.dirname(tcldir),"include") if is_win32?
121925
@@ -1161,7 +1161,7 @@ def find_tcl(tcllib, stubs, version, *opt_paths)
121925
                   tcllibs = libs_param + " -DSTATIC_BUILD " + fname.quote
121925
                 else
121925
                   tcllibs = append_library($libs, lib_w_sufx)
121925
-                  tcllibs = "-L#{path.quote} -Wl,-R#{path.quote} " + tcllibs
121925
+                  tcllibs = "#{libpathflag(path)} #{tcllibs}"
121925
                 end
121925
                 if try_func(func, tcllibs, ["tcl.h"])
121925
                   return [true, path, nil, tcllibs, *inc]
121925
@@ -1300,7 +1300,7 @@ def find_tk(tklib, stubs, version, *opt_paths)
121925
                   tklibs = libs_param + " -DSTATIC_BUILD " + fname.quote
121925
                 else
121925
                   tklibs = append_library($libs, lib_w_sufx)
121925
-                  tklibs = "-L#{path.quote} -Wl,-R#{path.quote} " + tklibs
121925
+                  tklibs = "#{libpathflag(path)} #{tklibs}"
121925
                 end
121925
                 if try_func(func, tklibs, ["tcl.h", "tk.h"])
121925
                   return [true, path, nil, tklibs, *inc]
121925
@@ -2013,7 +2013,7 @@ $defs += collect_tcltk_defs(TclConfig_Info['TCL_DEFS'], TkConfig_Info['TK_DEFS']
121925
 # MacOS X Frameworks?
121925
 if TkLib_Config["tcltk-framework"]
121925
   puts("Use MacOS X Frameworks.")
121925
-  ($LDFLAGS ||= "") << " -L#{TkLib_Config["tcl-build-dir"].quote} -Wl,-R#{TkLib_Config["tcl-build-dir"].quote}" if TkLib_Config["tcl-build-dir"]
121925
+  ($LDFLAGS ||= "") << " " << libpathflag(TkLib_Config["tcl-build-dir"]) if TkLib_Config["tcl-build-dir"]
121925
 
121925
   libs = ''
121925
   if tcl_cfg_dir
121925
@@ -2039,7 +2039,7 @@ if TkLib_Config["tcltk-framework"]
121925
     end
121925
   end
121925
 
121925
-  libs << " -L#{TkLib_Config["tk-build-dir"].quote} -Wl,-R#{TkLib_Config["tk-build-dir"].quote}" if TkLib_Config["tk-build-dir"]
121925
+  libs << " " << libpathflag(TkLib_Config["tk-build-dir"]) if TkLib_Config["tk-build-dir"]
121925
 
121925
   if tk_cfg_dir
121925
     TkConfig_Info['TK_LIBS'] ||= ""
121925
-- 
121925
1.8.5.2
121925