OSDN Git Service

Follow links from the gdb the user ran to the actual executable, so
authorjingham <jingham>
Mon, 3 Apr 2000 19:34:38 +0000 (19:34 +0000)
committerjingham <jingham>
Mon, 3 Apr 2000 19:34:38 +0000 (19:34 +0000)
that you can still find all the Tcl support files.

gdb/gdbtk/library/util.tcl
libgui/src/paths.c
tcl/generic/tclInitScript.h

index f2e0f6e..558dbbf 100644 (file)
@@ -244,6 +244,13 @@ proc find_iwidgets_library {} {
 
     set exec_name [info nameofexecutable]
     set curdir [pwd] 
+    if {[string compare [file type $exec_name] "link"] == 0} {
+      set exec_name [file readlink $exec_name]
+      if {[string compare [file pathtype $exec_name] "relative"] == 0} {
+       set exec_name [file join [pwd] $exec_name]
+      }
+    }
+    
     cd [file dirname $exec_name]
     set exec_name [pwd]
     cd $curdir
index 5fdd392..3304d1f 100644 (file)
@@ -59,7 +59,14 @@ proc initialize_paths {} {\n\
     lappend guidirs $env(CYGNUS_GUI_LIBRARY)\n\
   }\n\
   set here [pwd]\n\
-  cd [file dirname [info nameofexecutable]]\n\
+  set exec_name [info nameofexecutable]\n\
+  if {[string compare [file type $exec_name] \"link\"] == 0} {\n\
+    set exec_name [file readlink $exec_name]\n\
+    if {[string compare [file pathtype $exec_name] \"relative\"] == 0} {\n\
+        set exec_name [file join [pwd] $exec_name]\n\
+    }\n\
+  }\n\
+  cd [file dirname $exec_name]\n\
   # Handle build with --exec-prefix and build without.\n\
   set d [file join [file dirname [pwd]] share]\n\
   lappend prefdirs $d\n\
@@ -165,7 +172,14 @@ proc initialize_paths {} {\n\
   rename initialize_paths {}\n\
   set guidirs {}\n\
   set here [pwd]\n\
-  cd [file dirname [info nameofexecutable]]\n\
+  set exec_name [info nameofexecutable]\n\
+  if {[string compare [file type $exec_name] \"link\"] == 0} {\n\
+    set exec_name [file readlink $exec_name]\n\
+    if {[string compare [file pathtype $exec_name] \"relative\"] == 0} {\n\
+      set execName [file join [pwd] $exec_name]\n\
+    }\n\
+  }\n\
+  cd [file dirname $exe_name]\n\
   set d [file join [file dirname [pwd]] share]\n\
   lappend guidirs [file join $d cygnus gui]\n\
   set d [file join [file dirname [file dirname [pwd]]] share]\n\
index 975edea..7c199c5 100644 (file)
@@ -76,10 +76,21 @@ static char initScript[] = "if {[info proc tclInit]==\"\"} {\n\
        if {[info exists env(TCL_LIBRARY)]} {\n\
            lappend dirs $env(TCL_LIBRARY)\n\
        }\n\
-        # CYGNUS LOCAL: I've changed this alot.  Basically we only care about two cases,\n\
+        # CYGNUS LOCAL: I've changed this alot.  \n\
+        # Basically we only care about two cases,\n\
         # if we are installed, and if we are in the devo tree...\n\
         # The next few are for if we are installed:\n\
-       set parentDir [file dirname [file dirname [info nameofexecutable]]]\n\
+        # NB. We also want this to work if the user is actually\n\
+        # running a link and not the actual program.  So look for a\n\
+        # link and chase it down to its source.\n\
+        set execName [info nameofexecutable]\n\
+        if {[string compare [file type $execName] \"link\"] == 0} {\n\
+            set execName [file readlink $execName]\n\
+            if {[string compare [file pathtype $execName] \"relative\"] == 0} {\n\
+              set execName [file join [pwd] $execName]\n\
+            }\n\
+        }\n\
+       set parentDir [file dirname [file dirname $execName]]\n\
         lappend dirs [file join $parentDir share tcl$tcl_version]\n\
        lappend dirs [file join [file dirname $parentDir] share tcl$tcl_version]\n\
         # NOW, let's try to find it in the build tree...\n\
@@ -92,7 +103,7 @@ static char initScript[] = "if {[info proc tclInit]==\"\"} {\n\
         lappend configDirs [file join [file dirname $parentDir] tcl$tcl_version $tcl_platform(platform)]\n\
         lappend configDirs [file join [file dirname $parentDir] tcl             $tcl_platform(platform)]\n\
         # This one gets tclsh...\n\
-        lappend configDirs [info nameofexecutable]\n\
+        lappend configDirs $execName \n\
         # This one is for gdb, and any other app which has its executible in the top directory.\n\
         lappend configDirs [file join $parentDir tcl$tcl_version $tcl_platform(platform)]\n\
         lappend configDirs [file join $parentDir tcl             $tcl_platform(platform)]\n\