$NetBSD: patch-aa,v 1.1.1.1 2005/02/20 16:18:41 minskim Exp $

--- configure.orig	2004-03-02 13:09:53.000000000 -0600
+++ configure
@@ -26,6 +26,9 @@ tclsh=tclsh;
 ##  done; \
 ## done
 
+# Read tclConfig.sh \
+. ${TCLCONFIG_SH}; export TCL_LIBS
+
 # Now execute this script using the best tclsh version found:
 # The backslash at the end of this line is needed: \
 exec $tclsh "$0" ${1+"$@"}
@@ -105,14 +108,8 @@ proc findTclTkPaths {} {
 
     # headerPath: List of possible locations for tcl.h and tk.h
     set headerPath {
-        /usr/include
-        /usr/local/tcl/include
-        /usr/local/include
-        /usr/X11/include
-        /usr/X11R6/include
-        /usr/local/X11/include
-        /opt/tcltk/include
-        /usr/X11R/include
+        @TCLPREFIX@/include
+        @TKPREFIX@/include
     }
     lappend headerPath "/usr/local/include/tcl${tclv}"
     lappend headerPath "/usr/local/include/tk${tclv}"
@@ -125,11 +122,8 @@ proc findTclTkPaths {} {
 
     # libraryPath: List of possible locations of Tcl/Tk library.
     set libraryPath {
-        /usr/lib
-        /usr/local/tcl/lib
-        /usr/local/lib
-        /usr/X11R6/lib
-        /opt/tcltk/lib
+        @TCLPREFIX@/lib
+        @TKPREFIX@/lib
     }
     lappend libraryPath "/usr/lib/tcl${tclv}"
     lappend libraryPath "/usr/lib/tk${tclv}"
@@ -242,7 +236,8 @@ proc findTclTkPaths {} {
             }
         }
         if {! [info exists var(TCL_LIBRARY)]} {
-            set var(TCL_LIBRARY) "-L$opt(tcl_lib) -l$opt(tcl_lib_file) -ldl"
+	    global env
+            set var(TCL_LIBRARY) "-L$env(LDFLAGS) -l$opt(tcl_lib_file) @LIBDL@ $env(TCL_LIBS)"
         }
         if {! [info exists var(TK_LIBRARY)]} {
             set var(TK_LIBRARY) {$(TCL_LIBRARY)}
