# Try to find a nice place where to install.
# It seems (end 2008) that distributions tend to remove /usr/lib from
# auto_path, leaving only things like /usr/lib/tcl /usr/lib/tcl8.x
# /usr/share/tcl
# We look at the auto_path, and try to find the best place, ideally
# the equivalent of $prefix/lib[64]/tcl because like this we don't
# need a reinstall at each tcl version change, else $prefix/lib else
# .../tcl8.x, else whatever is at the beginning of the auto_path
set usrlibtcl {}
set usrlib {}
set usrlibtclxy {}
#test set auto_path {/usr/lib/tcl8.4 /usr/lib/tcl /usr/share/tcl}
foreach d $auto_path {
if {[regexp {lib.*/tcl$} $d]} {
set usrlibtcl $d
}
if {[regexp {lib.*/tcl8\.[0-9]+$} $d]} {
set usrlibtclxy $d
}
if {[regexp {lib$} $d]} {
set usrlib $d
}
if {[regexp {lib64$} $d]} {
set usrlib $d
}
}
if {[string compare $usrlibtcl {}]} {
puts stdout $usrlibtcl
exit 0
}
if {[string compare $usrlib {}]} {
puts stdout $usrlib
exit 0
}
if {[string compare $usrlibtclxy {}]} {
puts stdout $usrlibtclxy
exit 0
}
puts [lindex $auto_path 0]