Index: /trunk/Ohana/Configure.in
===================================================================
--- /trunk/Ohana/Configure.in	(revision 5996)
+++ /trunk/Ohana/Configure.in	(revision 5997)
@@ -22,5 +22,6 @@
 # seem to be ok on most linux distributions)
 XINC    = XINCDIR
-XLIB    = -LXLIBDIR
+XLIB    = XLIBDIR
+TLIB    = TLIBFLAG
 
 # prefered C compiler
Index: /trunk/Ohana/configure
===================================================================
--- /trunk/Ohana/configure	(revision 5996)
+++ /trunk/Ohana/configure	(revision 5997)
@@ -92,5 +92,5 @@
    endif
    # XXX old solaris needed termcap for readline
-   set archlib = "libsocket libnsl libtermcap"
+   set archlib = "libsocket libnsl"
    breaksw;
  case Linux:
@@ -118,9 +118,14 @@
 set inc = $prefix/include/$arch
 set lib = $prefix/lib/$arch
+if ($?LD_LIBRARY_PATH) then 
+  set libpath = `echo $LD_LIBRARY_PATH | tr ':' ' '`
+else
+  set libpath = ""
+endif
 
 # check for basic libraries
 set fail = 0
 foreach f ( libpng libz libjpeg libreadline $archlib )
-    foreach g ( /usr/lib $lib )
+    foreach g ( /usr/lib $lib $libpath )
 	set name = "$g/$f.a"
 	if (-e $name) then
@@ -140,4 +145,29 @@
 end
 
+# check for termcap, curses, etc
+set tlibflag = ""
+foreach f ( libncurses libcurses libtermcap )
+      foreach g ( /usr/lib $lib $libpath )
+	set name = "$g/$f.a"
+	if (-e $name) then
+	    echo "found $name"
+	    set tlibflag = "-l$f"
+	    goto got_curses;
+	endif
+	set name = "$g/$f.so"
+	if (-e $name) then
+	    echo "found $name"
+	    set tlibflag = "-l$f"
+	    goto got_curses;
+	endif
+    end
+end
+if ("$tlibflag" == "") then
+  echo "missing a valid curses library"
+  set fail = 1
+endif
+
+got_curses:
+
 if ($fail) then
   echo "your installation is missing some important libraries"
@@ -149,5 +179,5 @@
 set fail = 0
 foreach f ( libX11.a )
-    foreach g ( /usr/lib $lib /usr/X11R6/lib /usr/openwin/lib )
+    foreach g ( /usr/lib $lib $libpath /usr/X11R6/lib /usr/openwin/lib )
 	set name = "$g/$f"
 	if (-e $name) then 
@@ -271,5 +301,6 @@
 mv Configure.tmp Configure.in.tmp
 
-cat Configure.in.tmp | sed "s|ROOTDIR|$root|" | sed "s|XINCDIR|$xinc|" | sed "s|XLIBDIR|$xlib|" | sed "s|OPTFLAGS|$optflags $pedantic|" > Configure
+cat Configure.in.tmp | sed "s|ROOTDIR|$root|" | sed "s|XINCDIR|$xinc|" | sed "s|XLIBDIR|$xlib|" | sed "s|TLIBFLAG|$tlibflag|" | sed "s|OPTFLAGS|$optflags $pedantic|" > Configure
+rm -f Configure.in.tmp Configure.tmp
 
 echo ""
