Index: trunk/psconfig/pschecklibs
===================================================================
--- trunk/psconfig/pschecklibs	(revision 12142)
+++ trunk/psconfig/pschecklibs	(revision 12496)
@@ -167,5 +167,5 @@
 set nonomatch
 foreach f ( $needlibs )
-    foreach g ( $syslibpath $libdir $libpath )
+    foreach g ( $libdir $libpath $syslibpath )
         if (! -e $g) continue
 	set name = $g/lib$f.a
@@ -184,5 +184,5 @@
 # check for termcap, curses, etc
 foreach f ( ncurses curses termcap )
-    foreach g ( $syslibpath $libdir $libpath )
+    foreach g ( $libdir $libpath $syslibpath )
 	set name = $g/lib$f.a
 	if (-e $name[1]) goto got_curses;
@@ -207,4 +207,11 @@
 endif    
 
+# add the CPATH
+if ($?CPATH) then 
+  set incpath = `echo $CPATH | tr ':' ' '`
+else
+  set incpath = ""
+endif
+
 # check for headers
 echo ""
@@ -213,5 +220,5 @@
 set incdirs = ""
 foreach f ( $needincs )
-  foreach g ( $sysincpath $incdir )
+  foreach g ( $incdir $incpath $sysincpath )
     set name = "$g/$f"
     if (-e $name) goto got_inc;
