about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorThomas E. Dickey <dickey@invisible-island.net>2002-12-02 02:37:01 -0500
committerThomas E. Dickey <dickey@invisible-island.net>2002-12-02 02:37:01 -0500
commitf6e997b7f73d01db84665bc924ba2d065e314e43 (patch)
treee5a6682d03360506ad1db6b3d1f5934a5911db50
parent0cb11571ef3a2820a888b47eaa0ea3083e3b9b0f (diff)
downloadlynx-snapshots-f6e997b7f73d01db84665bc924ba2d065e314e43.tar.gz
snapshot of project "lynx", label v2-8-5dev_11
-rw-r--r--CHANGES91
-rw-r--r--INSTALLATION66
-rw-r--r--WWW/Library/Implementation/HTAABrow.c3
-rw-r--r--WWW/Library/Implementation/HTAccess.c3
-rw-r--r--WWW/Library/Implementation/HTAccess.h5
-rw-r--r--WWW/Library/Implementation/HTAnchor.c273
-rw-r--r--WWW/Library/Implementation/HTAnchor.h23
-rw-r--r--WWW/Library/Implementation/HTBTree.c648
-rw-r--r--WWW/Library/Implementation/HTBTree.h14
-rw-r--r--WWW/Library/Implementation/HTChunk.c4
-rw-r--r--WWW/Library/Implementation/HTFTP.c3
-rw-r--r--WWW/Library/Implementation/HTFile.c179
-rw-r--r--WWW/Library/Implementation/HTFile.h48
-rw-r--r--WWW/Library/Implementation/HTFormat.c11
-rw-r--r--WWW/Library/Implementation/HTFormat.h3
-rw-r--r--WWW/Library/Implementation/HTList.c6
-rw-r--r--WWW/Library/Implementation/HTMIME.c37
-rw-r--r--WWW/Library/Implementation/HTNews.c6
-rw-r--r--WWW/Library/Implementation/HTParse.c50
-rw-r--r--WWW/Library/Implementation/HTPlain.c3
-rw-r--r--WWW/Library/Implementation/HTTCP.c21
-rw-r--r--WWW/Library/Implementation/HTTP.c10
-rw-r--r--WWW/Library/Implementation/HTTP.h7
-rw-r--r--WWW/Library/Implementation/HTTelnet.c57
-rw-r--r--WWW/Library/Implementation/HTUtils.h7
-rw-r--r--WWW/Library/Implementation/SGML.c413
-rw-r--r--WWW/Library/Implementation/SGML.h18
-rw-r--r--WWW/Library/Implementation/www_tcp.h4
-rw-r--r--aclocal.m4389
-rwxr-xr-xconfig.guess18
-rw-r--r--config.hin4
-rwxr-xr-xconfig.sub16
-rwxr-xr-xconfigure2770
-rw-r--r--configure.in37
-rw-r--r--lynx.cfg31
-rw-r--r--makefile.in3
-rw-r--r--samples/mailcap4
-rwxr-xr-xsamples/mailto-form.pl2
-rwxr-xr-xscripts/install-cfg.sh72
-rw-r--r--src/GridText.c545
-rw-r--r--src/GridText.h5
-rw-r--r--src/HTAlert.c31
-rw-r--r--src/HTFWriter.c30
-rw-r--r--src/HTML.c129
-rw-r--r--src/LYBookmark.c51
-rw-r--r--src/LYCharSets.c7
-rw-r--r--src/LYCharSets.h4
-rw-r--r--src/LYCharUtils.c5
-rw-r--r--src/LYCookie.c13
-rw-r--r--src/LYCurses.c2
-rw-r--r--src/LYDownload.h6
-rw-r--r--src/LYGetFile.c6
-rw-r--r--src/LYGlobalDefs.h8
-rw-r--r--src/LYList.c10
-rw-r--r--src/LYLocal.c395
-rw-r--r--src/LYMail.c94
-rw-r--r--src/LYMain.c19
-rw-r--r--src/LYMainLoop.c89
-rw-r--r--src/LYMainLoop.h2
-rw-r--r--src/LYOptions.c25
-rw-r--r--src/LYReadCFG.c41
-rw-r--r--src/LYStrings.c13
-rw-r--r--src/LYStrings.h2
-rw-r--r--src/LYStructs.h6
-rw-r--r--src/LYUtils.c79
-rw-r--r--src/LYrcFile.h19
-rw-r--r--src/UCdomap.c6
-rw-r--r--src/UCdomap.h7
-rw-r--r--userdefs.h8
69 files changed, 4083 insertions, 2933 deletions
diff --git a/CHANGES b/CHANGES
index c45437b8..7459d000 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,95 @@
 Changes since Lynx 2.8 release
 ===============================================================================
 
+2002-12-01 (2.8.5dev.11)
+* fix a typo in changelog date -TD
+* add project version & date to lynx.cfg -TD
+* document xxx_PATH variables in lynx.cfg -TD
+
+2002-11-11 (2.8.5dev.10)
+* modify file-upload to provide content-type based on file-suffix.  This is
+  needed to validate local html files with current the W3C validation service
+  webpage -TD
+* modify file-upload to warn but permit the filename or file contents to be
+  missing (report by Clemens Fisher) -TD
+* workaround for compiler bug in fix_httplike_urls() -BL
+* change enumShowColor so SHOW_COLOR_NEVER is zero as in 2.8.3, which makes the
+  result from LYChoosePopup() match the enum values.  This fixes a bug which
+  would make the slang configuration toggle back to color when accepting an
+  options screen (report by Sean McGuire <smcguire@soc.lib.md.us> and Carlton
+  Anderson) -TD
+* add a null-pointer check in content_is_compressed() -TD
+* in partial mode, load document with #fragment on the fly. Long awaited fix.
+  LYMainLoop_pageDisplay() now returns BOOL -LP
+* calculate WWW_SOURCE once, it is now a constant, not a define -LP
+* use malloc instead of calloc in several places, particularly in HTList
+  operations (each field initialized explicitely) -LP
+* fix a few typos in samples/mailcap (Carlton Anderson
+  <canderson1776@yahoo.com>).
+* ifdef'd default_fg and default_bg for PDCURSES to be 15, since that agrees
+  with lynx's use of color names, and works around a bug exposed by the
+  ASSUMED_COLORS change from 2.8.5dev.9 (report by DK) -TD
+* simplify pretty-source code in SGML.c using PUTS(), put_pretty_entity() and
+  put_pretty_number() -TD
+* refine S_attr test in SGML.c to make pretty-source code handle the case where
+  a blank precedes the '='.  The misplaced markers made lynx omit newlines from
+  the pretty-source view (report by LP) -TD
+* rewrote HTStat() to ensure that it does stat() for files on Windows -TD
+* HTTCP.c patch to make djgpp/Watt-32 non-blocking connect in HTDoConnect().
+  This allows pressing 'z' to abort connections.  Removed extra _HTProgress()
+  for INET6; it overwrote previous progress message -GV, DK
+* in SGML.c, element stack now use a pool of 10 elements to avoid most of
+  malloc/free calls -LP
+* in HTParse(), use single alloca instead of three malloc/free pairs -LP
+* in HTParse.c, avoid most strcasecomp calls in scan() - LP
+* modify GridText.c to store lines, anchors, and forms in the same HText memory
+  pool as styles.  This will optimize memory allocation/deallocation by 8Kb
+  units.  The down side:  lines in TRST mode will be stored twice.  Some
+  structs are made a bit more compact -LP
+* add DJGPP to SINGLE_USER_UNIX special cases -DK
+* modify configure script to not strip the -g option from $CFLAGS if it was
+  present in the user's environment rather than autoconf adding it (report by
+  DK) -TD
+* add --with-curses-dir configure script option -TD
+* in SGMLFindTag, we translate string uppercase in-place and launch case
+  insensitive search, add SGMLFindUprTag() to cover the cases where the string
+  is readonly - LP, TD
+* DJGPP build restored.  MV_PATH was undefined long ago by mistake.  Fix recent
+  DJGPP changes in HTTCP.c:  move _resolve_hook few lines below, it will not
+  compile otherwise.  Remove minor warnings -LP
+* optimize parsing html with many relative links, href="#fragment" -
+  HTAnchor_findChildAndLink() and HTML_start_element(), case HTML_A:  now avoid
+  significant overhead when link == HTInternalLink (e.g., resolving against
+  base, lots of reallocations, parent lookup, etc., all are useless).  Two
+  functions affected.  [HTAnchor.c, HTML.c].  The code works both with and
+  without DONT_TRACK_INTERNAL_LINKS symbol -LP
+* optimize parsing of large html files - with thousands of anchors - LP
+  + remove quadratic complexity from split_line() usage [GridText.c].
+    Because of some work with anchors on the last(=split) line,
+    the anchors list was traversed from the beginning for each output line.
+    Now we store last_anchor_before_split  explicitly.
+    With my 800Kb test file (13000 output lines, 3100 anchors) this shows
+    25% speedup: split_line() weight decreased from 26% down to 1%
+  + remove quadratic complexity from HTAnchor_findChild() usage [HTAnchor.c].
+    HTParentAnchor::children list was traversed zillion times, now we
+    split it into a tree (named anchors <a name=...>, fast search required)
+    and a list (just a storage for the rest anchors, no search required).
+    This one gives 11% speedup for 3100 anchors html on my system.
+  + remove quadratic complexity when generating a 'l'ist page,
+    now traverse anchors list only once [LYList.c, GridText.c].
+    Not too much savings but trivial.
+* add a search method to HTBTree implementation. - LP
+* amend check for refresh-URL to avoid adding a link if the retrieved page is
+  compressed, since the link would be added to the compressed file, corrupting
+  it (reported by Michel SUCH and Karl-Heinz Weirich <weirich@de.ibm.com>) -TD
+* correct misspelled $LYNX_LOCALEDIR variable in LYMain.c (reported by Michel
+  Such)
+* change the install procedure for lynx.cfg to attempt to update the file with
+  the user's customizations if any, and to save the old configuration
+  information in a series, e.g., lynx.cfg-1, lynx.cfg-2, etc. -TD
+* re-fix the problem with config.cache not being removed at the beginning of
+  the configure script - see 2.8.5dev.3 (report by Clemens Fisher) -TD
+
 2002-10-06 (2.8.5dev.9)
 * improve ETA data shown in experimental read-progress (from Debian #117476)
 * modify -dump, -source and related options which set dump mode to also set
@@ -457,7 +546,7 @@ Changes since Lynx 2.8 release
 * modify LYtouchline() to avoid using wredrawln() for ncurses, since the
   LYwin variable may be a pad much wider than the screen, which is not handled
   properly (report by Karl Eichwalder <keichwa@gmx.net>) -TD
-* correct beginning configure script, which was supposed to remove
+* correct beginning of configure script, which was supposed to remove
   config.cache, but did not, due to a misplaced line when it was added
   1998-06-04 (prompted by a report by Fr3dY <fr3dy@retemail.es> that the
   checks for srand/rand did not work) -TD
diff --git a/INSTALLATION b/INSTALLATION
index a1785f74..559c6b9a 100644
--- a/INSTALLATION
+++ b/INSTALLATION
@@ -345,6 +345,8 @@ II. Compile instructions -- UNIX
         Note that this flag is ignored if the CFLAGS environment
         variable is set, in that case "-g" (or whatever) has to
         be included in the CFLAGS value to get debugging.
+	Autoconf normally adds -g and -O options to CFLAGS if CFLAGS
+	was not set, and if the compiler supports those options.
 
   --enable-default-colors		(define USE_DEFAULT_COLORS)
   	Enable use of default-color background (ncurses/slang).  Either
@@ -467,6 +469,10 @@ II. Compile instructions -- UNIX
  	Limit the number of charsets that are compiled-in to the specified
 	list of comma-separated MIME names.
 
+  --with-curses-dir
+	Specify directory under which curses/ncurses is installed.  This
+	assumes a standard install, e.g., with an include and lib subdirectory.
+
   --with-dbmalloc
 	use Conor Cahill's dbmalloc library
 
@@ -770,32 +776,32 @@ Visual C++:
 
 V. Compile instructions -- 386 DOS
 
-    Compiling for DOS with DJGPP has traditionally been a multistep     
-    procedure. Now, if you have a full installation of DJGPP you can    
-    also install using the configure script, just as in the UNIX        
-    section. This needs to be done under a BASH shell. Use a shell      
-    script to run configure as in the example at the end of this        
-    section. Otherwise you can follow the below instructions. The       
-    multistep procedure for DOS may not be supported in the future      
-    and use of the configure script is recommended. The information     
-    about required libraries and unpacking applies to both methods of   
-    compiling.                                                          
+    Compiling for DOS with DJGPP has traditionally been a multistep
+    procedure. Now, if you have a full installation of DJGPP you can
+    also install using the configure script, just as in the UNIX
+    section. This needs to be done under a BASH shell. Use a shell
+    script to run configure as in the example at the end of this
+    section. Otherwise you can follow the below instructions. The
+    multistep procedure for DOS may not be supported in the future
+    and use of the configure script is recommended. The information
+    about required libraries and unpacking applies to both methods of
+    compiling.
 
     First install the C compiler and its libraries (see readme.1st from
     DJGPP distribution).
 
-    Originally, lynx makefiles come with the initial -O2 optimization   
-    level. If you experience compilation process too slow due to paging 
-    to the disk (DPMI server provide virtual memory, when in lack of    
-    RAM), you may change optimization to -O1 or turn the optimization   
-    off entirely.                                                       
-
-    If using optimization level -O2 or -O3 with older versions of DJGPP   
-    and GCC, you may need to "stubedit" your "cc1.exe" file to enlarge    
-    compiler stack size. For instance, if using DJGPP 2.02 and GCC 2.8.1, 
-    to compile with -O3 optimization, the stub needs to be edited to give 
-    a larger stack. To do this go into djgpp\lib\gcc-lib\djgpp\2.81 and   
-    either type the command:                                              
+    Originally, lynx makefiles come with the initial -O2 optimization
+    level. If you experience compilation process too slow due to paging
+    to the disk (DPMI server provide virtual memory, when in lack of
+    RAM), you may change optimization to -O1 or turn the optimization
+    off entirely.
+
+    If using optimization level -O2 or -O3 with older versions of DJGPP
+    and GCC, you may need to "stubedit" your "cc1.exe" file to enlarge
+    compiler stack size. For instance, if using DJGPP 2.02 and GCC 2.8.1,
+    to compile with -O3 optimization, the stub needs to be edited to give
+    a larger stack. To do this go into djgpp\lib\gcc-lib\djgpp\2.81 and
+    either type the command:
    	 "stubedit cc1.exe bufsize=63k minstack=2M",
     or edit interactively with: "stubedit cc1.exe". Current versions of
     DJGPP and GCC generally work with the standard stack.
@@ -812,7 +818,7 @@ V. Compile instructions -- 386 DOS
 
     If you wish to compile with "USE_ZLIB" (recommended), you must have the
     zlib library.  Get the source from
-	    http://www.gzip.org/zlib/ 
+	    http://www.gzip.org/zlib/
     and compile it.  Put libz.a in the lib subdirectory of DJGPP, and put
     zlib.h and zconf.h in the include subdirectory.
 
@@ -846,12 +852,12 @@ V. Compile instructions -- 386 DOS
      	setcbrk(setting);
      # else
 
-    If you wish to compile with SSL enabled, you need to get and          
-    compile openssl. The DJGPP port has been successfully compiled with   
-    openssl-0.9.6b. After obtaining the source file, unpack it with       
-    DJTARX, then apply the patch for DOS before compiling. This will      
-    create a file "install.djgpp" which gives further details. The patch  
-    can be obtained from the openssl-dev archives at:                     
+    If you wish to compile with SSL enabled, you need to get and
+    compile openssl. The DJGPP port has been successfully compiled with
+    openssl-0.9.6b. After obtaining the source file, unpack it with
+    DJTARX, then apply the patch for DOS before compiling. This will
+    create a file "install.djgpp" which gives further details. The patch
+    can be obtained from the openssl-dev archives at:
     "http://www.mail-archive.com/openssl-dev@openssl.org/msg09104/096b.pch.gz"
 
     In order for lynx to be able to break out of a stuck nameserver
@@ -863,7 +869,7 @@ V. Compile instructions -- 386 DOS
     @@ -74,6 +74,11 @@
           longjmp (sig_jmp, 1);
      }
-     
+
     +void sig_handler_watt (int sig)
     +{
     +   sig_handler (sig);
diff --git a/WWW/Library/Implementation/HTAABrow.c b/WWW/Library/Implementation/HTAABrow.c
index 02db254c..dde97869 100644
--- a/WWW/Library/Implementation/HTAABrow.c
+++ b/WWW/Library/Implementation/HTAABrow.c
@@ -57,13 +57,12 @@
 #include <HTAlert.h>		/* HTConfirm(), HTPrompt()	*/
 #include <HTAAUtil.h>		/* AA common to both sides	*/
 #include <HTAssoc.h>		/* Assoc list			*/
+#include <HTAccess.h>		/* Are we using an HTTP gateway? */
 #include <HTAABrow.h>		/* Implemented here		*/
 #include <HTUU.h>		/* Uuencoding and uudecoding	*/
 
 #include <LYLeaks.h>
 
-extern BOOL using_proxy;	/* Are we using an HTTP gateway? */
-
 /*
 **  Local datatype definitions
 **
diff --git a/WWW/Library/Implementation/HTAccess.c b/WWW/Library/Implementation/HTAccess.c
index 0fe6bc34..64ddf380 100644
--- a/WWW/Library/Implementation/HTAccess.c
+++ b/WWW/Library/Implementation/HTAccess.c
@@ -590,9 +590,6 @@ PRIVATE int get_physical ARGS2(
  *  I want the "pop" to occur as soon as possible after loading
  *  has finished. - kw @@@
  */
-
-extern char*UCAssume_MIMEcharset;
-
 PUBLIC void LYUCPushAssumed ARGS1(
     HTParentAnchor *,	anchor)
 {
diff --git a/WWW/Library/Implementation/HTAccess.h b/WWW/Library/Implementation/HTAccess.h
index 0c763051..ab833272 100644
--- a/WWW/Library/Implementation/HTAccess.h
+++ b/WWW/Library/Implementation/HTAccess.h
@@ -310,7 +310,6 @@ extern void LYUCPushAssumed PARAMS((
     HTParentAnchor *	anchor));
 extern int LYUCPopAssumed NOPARAMS;
 
-#endif /* HTACCESS_H */
-/*
+extern BOOL using_proxy;
 
-   end of HTAccess  */
+#endif /* HTACCESS_H */
diff --git a/WWW/Library/Implementation/HTAnchor.c b/WWW/Library/Implementation/HTAnchor.c
index a489c4c0..20360edc 100644
--- a/WWW/Library/Implementation/HTAnchor.c
+++ b/WWW/Library/Implementation/HTAnchor.c
@@ -70,34 +70,14 @@ PRIVATE HTParentAnchor * HTParentAnchor_new NOARGS
     HTParentAnchor *newAnchor = typecalloc(HTParentAnchor);
     if (newAnchor == NULL)
 	outofmem(__FILE__, "HTParentAnchor_new");
+    /* calloc: all pointers initialized to NULL */
+
     newAnchor->parent = newAnchor;
-    newAnchor->bookmark = NULL;		/* Bookmark filename. - FM */
     newAnchor->isISMAPScript = FALSE;	/* Lynx appends ?0,0 if TRUE. - FM */
     newAnchor->isHEAD = FALSE;		/* HEAD request if TRUE. - FM */
     newAnchor->safe = FALSE;		/* Safe. - FM */
-#ifdef SOURCE_CACHE
-    newAnchor->source_cache_file = NULL;
-    newAnchor->source_cache_chunk = NULL;
-#endif
-    newAnchor->FileCache = NULL;	/* Path to a disk-cached copy. - FM */
-    newAnchor->SugFname = NULL;		/* Suggested filename. - FM */
-    newAnchor->RevTitle = NULL;		/* TITLE for a LINK with REV. - FM */
-    newAnchor->citehost = NULL;		/* LINK REL=citehost - RDC */
-    newAnchor->cache_control = NULL;	/* Cache-Control. - FM */
     newAnchor->no_cache = FALSE;	/* no-cache? - FM */
-    newAnchor->content_type = NULL;	/* Content-Type. - FM */
-    newAnchor->content_language = NULL; /* Content-Language. - FM */
-    newAnchor->content_encoding = NULL; /* Compression algorithm. - FM */
-    newAnchor->content_base = NULL;	/* Content-Base. - FM */
-    newAnchor->content_disposition = NULL; /* Content-Disposition. - FM */
-    newAnchor->content_location = NULL; /* Content-Location. - FM */
-    newAnchor->content_md5 = NULL;	/* Content-MD5. - FM */
     newAnchor->content_length = 0;	/* Content-Length. - FM */
-    newAnchor->date = NULL;		/* Date. - FM */
-    newAnchor->expires = NULL;		/* Expires. - FM */
-    newAnchor->last_modified = NULL;	/* Last-Modified. - FM */
-    newAnchor->ETag = NULL;		/* ETag (HTTP/1.1 cache validator) */
-    newAnchor->server = NULL;		/* Server. - FM */
     return(newAnchor);
 }
 
@@ -154,12 +134,6 @@ PRIVATE BOOL HTIdentical ARGS2(
 	CONST char *,	t)
 {
     if (s && t) {  /* Make sure they point to something */
-#ifdef SH_EX	/* 1998/04/28 (Tue) 22:02:58 */
-	if (*s == 'P' || *t == 'P') {
-	    if (strcmp(s + 1, "Name") == 0 || strcmp(t + 1, "Name") == 0)
-		return NO;
-	}
-#endif
 	for (; *s && *t; s++, t++) {
 	    if (*s != *t) {
 		return(NO);
@@ -172,11 +146,40 @@ PRIVATE BOOL HTIdentical ARGS2(
 }
 #endif /* CASE_INSENSITIVE_ANCHORS */
 
+/*
+ *  Three-way compare function
+ */
+PRIVATE int compare ARGS2(
+	void *, l,
+	void *, r)
+{
+    CONST char* a = ((HTChildAnchor *)l)->tag;
+    CONST char* b = ((HTChildAnchor *)r)->tag;
+
+    if (a && b) {  /* Make sure they point to something */
+#ifdef CASE_INSENSITIVE_ANCHORS
+	return strcasecomp(a, b); /* Case insensitive */
+#else
+	return strcmp(a, b);      /* Case sensitive - FM */
+#endif /* CASE_INSENSITIVE_ANCHORS */
+    } else {
+	/*  bring up an order when one or both strings are nulls */
+	if (a) {
+	    return 1;
+	} else if (b) {
+	    return -1;
+	} else {
+	    /* both nulls - assume equivalent */
+	    return 0;
+	}
+    }
+}
+
 
 /*	Create new or find old sub-anchor
 **	---------------------------------
 **
-**	Me one is for a new anchor being edited into an existing
+**	This one is for a new anchor being edited into an existing
 **	document.  The parent anchor must already exist.
 */
 PUBLIC HTChildAnchor * HTAnchor_findChild ARGS2(
@@ -184,32 +187,33 @@ PUBLIC HTChildAnchor * HTAnchor_findChild ARGS2(
 	CONST char *,		tag)
 {
     HTChildAnchor *child;
-    HTList *kids;
 
     if (!parent) {
 	CTRACE((tfp, "HTAnchor_findChild called with NULL parent.\n"));
 	return(NULL);
     }
-    if ((kids = parent->children) != 0) {
-	/*
-	**  Parent has children.  Search them.
-	*/
-	if (tag && *tag) {		/* TBL */
-	    while (NULL != (child=(HTChildAnchor *)HTList_nextObject(kids))) {
-#ifdef CASE_INSENSITIVE_ANCHORS
-		if (HTEquivalent(child->tag, tag)) /* Case insensitive */
-#else
-		if (HTIdentical(child->tag, tag)) /* Case sensitive - FM */
-#endif /* CASE_INSENSITIVE_ANCHORS */
-		{
-		    CTRACE((tfp, "Child anchor %p of parent %p with name `%s' already exists.\n",
-				(void *)child, (void *)parent, tag));
-		    return(child);
-		}
+
+    if (tag && *tag) {	       /* TBL */
+	if (parent->children) {
+	   /*
+	   **  Parent has children.  Search them.
+	   */
+	   HTChildAnchor sample;
+	   sample.tag = (char*)tag;    /* for compare() only */
+
+	   child = (HTChildAnchor *)HTBTree_search(parent->children, &sample);
+	   if (child != NULL) {
+	       CTRACE((tfp, "Child anchor %p of parent %p with name `%s' already exists.\n",
+		       (void *)child, (void *)parent, tag));
+	       return(child);
 	    }
-	}  /*  end if tag is void */
-    } else {  /* parent doesn't have any children yet : create family */
-	parent->children = HTList_new();
+	} else {  /* parent doesn't have any children yet : create family */
+	   parent->children = HTBTree_new(compare);
+	}
+    } else { /*  if tag is void */
+	if (!parent->children_notag)
+	   /* create a family of this kind */
+	   parent->children_notag = HTList_new();
     }
 
     child = HTChildAnchor_new();
@@ -217,13 +221,24 @@ PUBLIC HTChildAnchor * HTAnchor_findChild ARGS2(
 		(void *)child,
 		NonNull(tag),
 		(void *)parent)); /* int for apollo */
-    HTList_addObject (parent->children, child);
     child->parent = parent;
-    StrAllocCopy(child->tag, tag);
+
+    if (tag && *tag) {
+	StrAllocCopy(child->tag, tag);   /* should be set before HTBTree_add */
+	HTBTree_add(parent->children, child);
+    } else {
+	child->tag = 0;
+	HTList_addObject(parent->children_notag, child);
+    }
+
     return(child);
 }
 
 
+PRIVATE HTParentAnchor * HTAnchor_findAddress_nofragment PARAMS((
+	CONST DocAddress *	newdoc));
+
+
 /*	Create or find a child anchor with a possible link
 **	--------------------------------------------------
 **
@@ -239,30 +254,45 @@ PUBLIC HTChildAnchor * HTAnchor_findChildAndLink ARGS4(
 {
     HTChildAnchor * child = HTAnchor_findChild(parent, tag);
 
-    CTRACE((tfp,"Entered HTAnchor_findChildAndLink\n"));
+    CTRACE((tfp,"Entered HTAnchor_findChildAndLink:  tag=`%s',%s href=`%s'\n",
+	       NonNull(tag),
+	       (ltype == HTInternalLink) ? " (internal link)" : "",
+	       NonNull(href) ));
 
     if (href && *href) {
-	char *relative_to = HTAnchor_address((HTAnchor *)parent);
+	CONST char *fragment = NULL;
 	DocAddress parsed_doc;
-	HTAnchor * dest;
-
-	parsed_doc.address = HTParse(href, relative_to, PARSE_ALL);
-#ifndef DONT_TRACK_INTERNAL_LINKS
-	if (ltype && parent->post_data && ltype == LINK_INTERNAL) {
-	    /* for internal links, find a destination with the same
-	       post data if the source of the link has post data. - kw */
-	    parsed_doc.post_data = parent->post_data;
-	    parsed_doc.post_content_type = parent->post_content_type;
-	} else
-#endif
-	{
+	HTParentAnchor * dest;
+
+	if (*href == '#' && ltype == HTInternalLink) {
+	    dest = parent;
+	    fragment = href+1;
+	} else {
+	    char *relative_to = HTAnchor_address((HTAnchor *)parent);
+	   /* hmm, it seems HTML.c always resolve href to absolute url??? */
+	    parsed_doc.address = HTParse(href, relative_to,
+	       PARSE_ACCESS | PARSE_HOST | PARSE_PATH | PARSE_PUNCTUATION);
 	    parsed_doc.post_data = NULL;
 	    parsed_doc.post_content_type = NULL;
+	    parsed_doc.bookmark = NULL;
+	    parsed_doc.isHEAD = FALSE;
+	    parsed_doc.safe = FALSE;
+	    dest = HTAnchor_findAddress_nofragment(&parsed_doc);
+	    FREE(relative_to);
+	    FREE(parsed_doc.address);
+	    fragment = HTParse(href, "", PARSE_ANCHOR);
 	}
-	parsed_doc.bookmark = NULL;
-	parsed_doc.isHEAD = FALSE;
-	parsed_doc.safe = FALSE;
-	dest = HTAnchor_findAddress(&parsed_doc);
+
+	/*
+	** [comment from HTAnchor_findAddress()]
+	** If the address represents a sub-anchor, we load its parent,
+	** then we create a child anchor within that document.
+	*/
+	if (*fragment)
+	    dest = (HTParentAnchor *)HTAnchor_findChild(dest, fragment);
+
+	if (!(*href == '#' && ltype == HTInternalLink))
+	    FREE(fragment);
 
 #define DUPLICATE_ANCHOR_NAME_WORKAROUND
 
@@ -276,7 +306,7 @@ PUBLIC HTChildAnchor * HTAnchor_findChildAndLink ARGS4(
 		CTRACE((tfp,
 		       "*** Duplicate ChildAnchor %p named `%s' with %d links",
 		       child, tag, child_links));
-		if (dest == testdest1 && ltype == child->mainLink.type) {
+		if ((HTAnchor *)dest == testdest1 && ltype == child->mainLink.type) {
 		    CTRACE((tfp,", same dest %p and type, keeping it\n",
 			   testdest1));
 		} else {
@@ -287,9 +317,7 @@ PUBLIC HTChildAnchor * HTAnchor_findChildAndLink ARGS4(
 	    }
 	}
 #endif
-	HTAnchor_link((HTAnchor *)child, dest, ltype);
-	FREE(parsed_doc.address);
-	FREE(relative_to);
+	HTAnchor_link((HTAnchor *)child, (HTAnchor *)dest, ltype);
     }
     return(child);
 }
@@ -366,14 +394,22 @@ PUBLIC HTAnchor * HTAnchor_findAddress ARGS1(
 	parsed_doc.isHEAD = newdoc->isHEAD;
 	parsed_doc.safe = newdoc->safe;
 
-	foundParent = (HTParentAnchor *)HTAnchor_findAddress(&parsed_doc);
+	foundParent = HTAnchor_findAddress_nofragment(&parsed_doc);
 	foundAnchor = HTAnchor_findChild (foundParent, tag);
 	FREE(parsed_doc.address);
 	FREE(tag);
 	return (HTAnchor *)foundAnchor;
-    } else {
+    }
+    FREE(tag);
+    return (HTAnchor *)HTAnchor_findAddress_nofragment(newdoc);
+}
+
+/*  The address has no anchor tag for sure.
+ */
+PRIVATE HTParentAnchor * HTAnchor_findAddress_nofragment ARGS1(
+	CONST DocAddress *,	newdoc)
+{
 	/*
-	**  If the address has no anchor tag,
 	**  check whether we have this node.
 	*/
 	int hash;
@@ -381,8 +417,6 @@ PUBLIC HTAnchor * HTAnchor_findAddress ARGS1(
 	HTList *grownups;
 	HTParentAnchor * foundAnchor;
 
-	FREE(tag);
-
 	/*
 	**  Select list from hash table,
 	*/
@@ -417,8 +451,8 @@ PUBLIC HTAnchor * HTAnchor_findAddress ARGS1(
 	    {
 		CTRACE((tfp, "Anchor %p with address `%s' already exists.\n",
 			    (void *)foundAnchor, newdoc->address));
-		 return (HTAnchor *)foundAnchor;
-	     }
+		return foundAnchor;
+	    }
 	}
 
 	/*
@@ -438,13 +472,14 @@ PUBLIC HTAnchor * HTAnchor_findAddress ARGS1(
 	foundAnchor->isHEAD = newdoc->isHEAD;
 	foundAnchor->safe = newdoc->safe;
 	HTList_addObject (adults, foundAnchor);
-	return (HTAnchor *)foundAnchor;
-    }
+
+	return foundAnchor;
 }
+
 /*	Create new or find old named anchor - simple form
 **	-------------------------------------------------
 **
-**	Like the previous one, but simpler to use for simple cases.
+**     Like HTAnchor_findAddress, but simpler to use for simple cases.
 **	No post data etc. can be supplied. - kw
 */
 PUBLIC HTAnchor * HTAnchor_findSimpleAddress ARGS1(
@@ -628,6 +663,7 @@ PUBLIC BOOL HTAnchor_delete ARGS1(
      * 05-27-94 Lynx 2-3-1 Garrett Arch Blythe
      */
     HTList *cur;
+    HTBTElement *ele;
     HTChildAnchor *child;
 
     /*
@@ -668,12 +704,18 @@ PUBLIC BOOL HTAnchor_delete ARGS1(
 	 *  Delete all outgoing links from children, do not
 	 *  delete the children, though.
 	 */
-	if (!HTList_isEmpty(me->children)) {
-	    cur = me->children;
+	if (!HTList_isEmpty(me->children_notag)) {
+	    cur = me->children_notag;
 	    while ((child = (HTChildAnchor *)HTList_nextObject(cur)) != 0) {
-		if (child != NULL) {
-		    deleteLinks((HTAnchor *)child);
-		}
+		deleteLinks((HTAnchor *)child);
+	    }
+	}
+	if (me->children) {
+	    ele = HTBTree_next(me->children, NULL);
+	    while (ele != NULL) {
+		child = (HTChildAnchor *)HTBTree_object(ele);
+		deleteLinks((HTAnchor *)child);
+		ele = HTBTree_next(me->children, ele);
 	    }
 	}
 	me->underway = FALSE;
@@ -688,26 +730,33 @@ PUBLIC BOOL HTAnchor_delete ARGS1(
      *	No more incoming links : kill everything
      *	First, recursively delete children and their links.
      */
-    if (!HTList_isEmpty(me->children)) {
+    if (me->children) {
+	ele = HTBTree_next(me->children, NULL);
+	while (ele != NULL) {
+	    child = (HTChildAnchor *)HTBTree_object(ele);
+	    deleteLinks((HTAnchor *)child);
+	    FREE(child->tag);
+	    ele = HTBTree_next(me->children, ele);
+	}
+	HTBTreeAndObject_free(me->children);
+	me->children = NULL;
+    }
+    /* ...and this kind of children */
+    if (!HTList_isEmpty(me->children_notag)) {
 	while ((child = (HTChildAnchor *)HTList_removeLastObject(
-							me->children)) != 0) {
-	    if (child) {
-		deleteLinks((HTAnchor *)child);
-		if (child->tag) {
-		    FREE(child->tag);
-		}
-		FREE(child);
-	    }
+						       me->children_notag)) != 0) {
+	   deleteLinks((HTAnchor *)child);
+	   FREE(child);
 	}
     }
     me->underway = FALSE;
 
     /*
-     *	Delete our empty list of children.
+     * Delete our empty list of children_notag.
      */
-    if (me->children) {
-	HTList_delete(me->children);
-	me->children = NULL;
+    if (me->children_notag) {
+	HTList_delete(me->children_notag);
+	me->children_notag = NULL;
     }
 
     /*
@@ -811,22 +860,6 @@ PUBLIC BOOL HTAnchor_delete ARGS1(
 }
 
 
-/*		Move an anchor to the head of the list of its siblings
-**		------------------------------------------------------
-**
-**	This is to ensure that an anchor which might have already existed
-**	is put in the correct order as we load the document.
-*/
-PUBLIC void HTAnchor_makeLastChild ARGS1(
-	HTChildAnchor *,	me)
-{
-    if (me->parent != (HTParentAnchor *)me) {  /* Make sure it's a child */
-	HTList * siblings = me->parent->children;
-	HTList_removeObject (siblings, me);
-	HTList_addObject (siblings, me);
-    }
-}
-
 /*	Data access functions
 **	---------------------
 */
@@ -916,12 +949,6 @@ PUBLIC BOOL HTAnchor_isISMAPScript ARGS1(
     return( me ? me->parent->isISMAPScript : NO);
 }
 
-PUBLIC BOOL HTAnchor_hasChildren ARGS1(
-	HTParentAnchor *,	me)
-{
-    return (BOOL) ( me ? ! HTList_isEmpty(me->children) : NO);
-}
-
 #if defined(USE_COLOR_STYLE)
 /*	Style handling.
 */
diff --git a/WWW/Library/Implementation/HTAnchor.h b/WWW/Library/Implementation/HTAnchor.h
index 89a7f88f..b72cb1de 100644
--- a/WWW/Library/Implementation/HTAnchor.h
+++ b/WWW/Library/Implementation/HTAnchor.h
@@ -15,6 +15,7 @@
 /* Version 1 of 24-Oct-1991 (JFG), written in C, browser-independent */
 
 #include <HTList.h>
+#include <HTBTree.h>
 #include <HTChunk.h>
 #include <HTAtom.h>
 #include <UCDefs.h>
@@ -52,7 +53,8 @@ struct _HTParentAnchor {
   HTParentAnchor * parent;	/* Parent of this anchor (self) */
 
   /* ParentAnchor-specific information */
-  HTList *	children;	/* Subanchors of this, if any */
+  HTList *     children_notag; /* Subanchors <a href=...>, tag is NULL */
+  HTBTree *    children;       /* Subanchors <a name="tag">, sorted by tag */
   HTList *	sources;	/* List of anchors pointing to this, if any */
   HyperDoc *	document;	/* The document within which this is an anchor */
   char *	address;	/* Absolute address of this node */
@@ -129,11 +131,8 @@ typedef struct _DocAddress {
     BOOL   safe;
 } DocAddress;
 
-/* "internal" means "within the same document, with certainty".
-   It includes a space so it cannot conflict with any (valid) "TYPE"
-   attributes on A elements. [According to which DTD, anyway??] - kw */
-
-#define LINK_INTERNAL HTAtom_for("internal link")
+/* "internal" means "within the same document, with certainty". */
+extern HTLinkType * HTInternalLink;
 
 /*	Create new or find old sub-anchor
 **	---------------------------------
@@ -195,15 +194,6 @@ extern void HTAnchor_clearSourceCache PARAMS((
 	HTParentAnchor *	me));
 #endif
 
-/*		Move an anchor to the head of the list of its siblings
-**		------------------------------------------------------
-**
-**	This is to ensure that an anchor which might have already existed
-**	is put in the correct order as we load the document.
-*/
-extern void HTAnchor_makeLastChild PARAMS((
-	HTChildAnchor *		me));
-
 /*	Data access functions
 **	---------------------
 */
@@ -244,9 +234,6 @@ extern BOOL HTAnchor_isIndex PARAMS((
 extern BOOL HTAnchor_isISMAPScript PARAMS((
 	HTAnchor *		me));
 
-extern BOOL HTAnchor_hasChildren PARAMS((
-	HTParentAnchor *	me));
-
 #if defined(USE_COLOR_STYLE)
 extern CONST char * HTAnchor_style PARAMS((
 	HTParentAnchor *	me));
diff --git a/WWW/Library/Implementation/HTBTree.c b/WWW/Library/Implementation/HTBTree.c
index db3b50db..ca03df51 100644
--- a/WWW/Library/Implementation/HTBTree.c
+++ b/WWW/Library/Implementation/HTBTree.c
@@ -20,7 +20,7 @@ PUBLIC HTBTree * HTBTree_new ARGS1(HTComparer, comp)
     ** for it when given a mean to compare things
     */
 {
-    HTBTree * tree = (HTBTree *)malloc(sizeof(HTBTree));
+    HTBTree * tree = typeMalloc(HTBTree);
     if (tree==NULL) outofmem(__FILE__, "HTBTree_new");
 
     tree->compare = comp;
@@ -38,7 +38,7 @@ PRIVATE void HTBTElement_free ARGS1(HTBTElement*, element)
     */
 {
     if (element) {
-        if (element->left != NULL)
+	if (element->left != NULL)
 	    HTBTElement_free(element->left);
 	if (element->right != NULL)
 	    HTBTElement_free(element->right);
@@ -64,7 +64,7 @@ PRIVATE void HTBTElementAndObject_free ARGS1(HTBTElement*, element)
     */
 {
     if (element) {     /* Just in case nothing was in the tree anyway */
-        if (element->left != NULL)
+	if (element->left != NULL)
 	    HTBTElementAndObject_free(element->left);
 	if (element->right != NULL)
 	    HTBTElementAndObject_free(element->right);
@@ -83,6 +83,30 @@ PUBLIC void HTBTreeAndObject_free ARGS1(HTBTree*, tree)
 }
 
 
+PUBLIC void * HTBTree_search ARGS2(
+		   HTBTree*,  tree,
+		   void*,     object)
+    /**********************************************************************
+    ** Returns a pointer to equivalent object in a tree or NULL if none.
+    */
+{
+    HTBTElement * cur = tree->top;
+    int res;
+
+    while (cur != NULL)
+    {
+	res = tree->compare(object, cur->object);
+
+	if (res == 0)
+	    return cur->object;
+	else if (res < 0)
+	    cur = cur->left;
+	else if (res > 0)
+	    cur = cur->right;
+    }
+    return NULL;
+}
+
 
 
 PUBLIC void HTBTree_add ARGS2(
@@ -91,7 +115,7 @@ PUBLIC void HTBTree_add ARGS2(
     /**********************************************************************
     ** This void is the core of HTBTree.c . It will
     **       1/ add a new element to the tree at the right place
-    **          so that the tree remains sorted
+    **		so that the tree remains sorted
     **       2/ balance the tree to be as fast as possible when reading it
     */
 {
@@ -101,27 +125,27 @@ PUBLIC void HTBTree_add ARGS2(
     HTBTElement * father_of_forefather;
     BOOL father_found,top_found;
     int depth,depth2,corrections;
-        /* father_of_element is a pointer to the structure that is the father of the
-        ** new object "object".
-        ** added_element is a pointer to the structure that contains or will contain
-        ** the new object "object".
-        ** father_of_forefather and forefather_of_element are pointers that are used
-        ** to modify the depths of upper elements, when needed.
-        **
-        ** father_found indicates by a value NO when the future father of "object"
-        ** is found.
-        ** top_found indicates by a value NO when, in case of a difference of depths
-        **  < 2, the top of the tree is encountered and forbids any further try to
-        ** balance the tree.
-        ** corrections is an integer used to avoid infinite loops in cases
-        ** such as:
-        **
-        **             3                        3
-        **          4                              4
-        **           5                            5
-        **
-        ** 3 is used here to show that it need not be the top of the tree.
-        */
+	/* father_of_element is a pointer to the structure that is the father of the
+	** new object "object".
+	** added_element is a pointer to the structure that contains or will contain
+	** the new object "object".
+	** father_of_forefather and forefather_of_element are pointers that are used
+	** to modify the depths of upper elements, when needed.
+	**
+	** father_found indicates by a value NO when the future father of "object"
+	** is found.
+	** top_found indicates by a value NO when, in case of a difference of depths
+	**  < 2, the top of the tree is encountered and forbids any further try to
+	** balance the tree.
+	** corrections is an integer used to avoid infinite loops in cases
+	** such as:
+	**
+	**             3                        3
+	**          4                              4
+	**           5                            5
+	**
+	** 3 is used here to show that it need not be the top of the tree.
+	*/
 
     /*
     ** 1/ Adding of the element to the binary tree
@@ -129,124 +153,124 @@ PUBLIC void HTBTree_add ARGS2(
 
     if (tree->top == NULL)
     {
-        tree->top = (HTBTElement *)malloc(sizeof(HTBTElement));
-        if (tree->top == NULL) outofmem(__FILE__, "HTBTree_add");
-        tree->top->up = NULL;
-        tree->top->object = object;
-        tree->top->left = NULL;
-        tree->top->left_depth = 0;
-        tree->top->right = NULL;
-        tree->top->right_depth = 0;
+	tree->top = typeMalloc(HTBTElement);
+	if (tree->top == NULL) outofmem(__FILE__, "HTBTree_add");
+	tree->top->up = NULL;
+	tree->top->object = object;
+	tree->top->left = NULL;
+	tree->top->left_depth = 0;
+	tree->top->right = NULL;
+	tree->top->right_depth = 0;
     }
     else
     {
-        father_found = YES;
-        father_of_element = tree->top;
-        added_element = NULL;
-        father_of_forefather = NULL;
-        forefather_of_element = NULL;
-        while (father_found)
-        {
-            if (tree->compare(object,father_of_element->object)<0)
+	father_found = YES;
+	father_of_element = tree->top;
+	added_element = NULL;
+	father_of_forefather = NULL;
+	forefather_of_element = NULL;
+	while (father_found)
+	{
+	    int res = tree->compare(object,father_of_element->object);
+	    if (res < 0)
 	    {
-                if (father_of_element->left != NULL)
-                    father_of_element = father_of_element->left;
-                else
-	        {
-                    father_found = NO;
-                    father_of_element->left =
-                        (HTBTElement *)malloc(sizeof(HTBTElement));
-                    if (father_of_element->left==NULL)
-                        outofmem(__FILE__, "HTBTree_add");
-                    added_element = father_of_element->left;
-                    added_element->up = father_of_element;
-                    added_element->object = object;
-                    added_element->left = NULL;
-                    added_element->left_depth = 0;
-                    added_element->right = NULL;
-                    added_element->right_depth = 0;
-                }
-   	    }
-            if (tree->compare(object,father_of_element->object)>=0)
-            {
-                if (father_of_element->right != NULL)
-                    father_of_element = father_of_element->right;
-                else
-                {
-                    father_found = NO;
-                    father_of_element->right =
-                        (HTBTElement *)malloc(sizeof(HTBTElement));
-                    if (father_of_element->right==NULL)
-                        outofmem(__FILE__, "HTBTree_add");
-                    added_element = father_of_element->right;
-                    added_element->up = father_of_element;
-                    added_element->object = object;
-                    added_element->left = NULL;
-                    added_element->left_depth = 0;
-                    added_element->right = NULL;
-                    added_element->right_depth = 0;
-    	        }
-            }
+		if (father_of_element->left != NULL)
+		    father_of_element = father_of_element->left;
+		else
+		{
+		    father_found = NO;
+		    father_of_element->left = typeMalloc(HTBTElement);
+		    if (father_of_element->left==NULL)
+			outofmem(__FILE__, "HTBTree_add");
+		    added_element = father_of_element->left;
+		    added_element->up = father_of_element;
+		    added_element->object = object;
+		    added_element->left = NULL;
+		    added_element->left_depth = 0;
+		    added_element->right = NULL;
+		    added_element->right_depth = 0;
+		}
+	    }
+	    else /* res >= 0 */
+	   {
+		if (father_of_element->right != NULL)
+		    father_of_element = father_of_element->right;
+		else
+		{
+		    father_found = NO;
+		    father_of_element->right = typeMalloc(HTBTElement);
+		    if (father_of_element->right==NULL)
+			outofmem(__FILE__, "HTBTree_add");
+		    added_element = father_of_element->right;
+		    added_element->up = father_of_element;
+		    added_element->object = object;
+		    added_element->left = NULL;
+		    added_element->left_depth = 0;
+		    added_element->right = NULL;
+		    added_element->right_depth = 0;
+		}
+	    }
 	}
-            /*
-            ** Changing of all depths that need to be changed
-            */
-        father_of_forefather = father_of_element;
-        forefather_of_element = added_element;
-        do
-        {
-            if (father_of_forefather->left == forefather_of_element)
-            {
-                depth = father_of_forefather->left_depth;
-                father_of_forefather->left_depth = 1
-                            + MAXIMUM(forefather_of_element->right_depth,
-                                  forefather_of_element->left_depth);
-                depth2 = father_of_forefather->left_depth;
-            }
-            else
+
+	/*
+	** Changing of all depths that need to be changed
+	*/
+	father_of_forefather = father_of_element;
+	forefather_of_element = added_element;
+	do
+	{
+	    if (father_of_forefather->left == forefather_of_element)
 	    {
-                depth = father_of_forefather->right_depth;
-                father_of_forefather->right_depth = 1
-                            + MAXIMUM(forefather_of_element->right_depth,
-                                  forefather_of_element->left_depth);
-                depth2 = father_of_forefather->right_depth;
-            }
-            forefather_of_element = father_of_forefather;
-            father_of_forefather = father_of_forefather->up;
-        } while ((depth != depth2) && (father_of_forefather != NULL));
-
-
-
-            /*
-            ** 2/ Balancing the binary tree, if necessary
-            */
-        top_found = YES;
-        corrections = 0;
-        while ((top_found) && (corrections < 7))
-        {
-            if ((abs(father_of_element->left_depth
-                      - father_of_element->right_depth)) < 2)
+		depth = father_of_forefather->left_depth;
+		father_of_forefather->left_depth = 1
+			    + MAXIMUM(forefather_of_element->right_depth,
+				  forefather_of_element->left_depth);
+		depth2 = father_of_forefather->left_depth;
+	    }
+	    else
+	    {
+		depth = father_of_forefather->right_depth;
+		father_of_forefather->right_depth = 1
+			    + MAXIMUM(forefather_of_element->right_depth,
+				  forefather_of_element->left_depth);
+		depth2 = father_of_forefather->right_depth;
+	    }
+	    forefather_of_element = father_of_forefather;
+	    father_of_forefather = father_of_forefather->up;
+	} while ((depth != depth2) && (father_of_forefather != NULL));
+
+
+
+	    /*
+	    ** 2/ Balancing the binary tree, if necessary
+	    */
+	top_found = YES;
+	corrections = 0;
+	while ((top_found) && (corrections < 7))
+	{
+	    if ((abs(father_of_element->left_depth
+		      - father_of_element->right_depth)) < 2)
 	    {
-                if (father_of_element->up != NULL)
-                    father_of_element = father_of_element->up;
-                else top_found = NO;
+		if (father_of_element->up != NULL)
+		    father_of_element = father_of_element->up;
+		else top_found = NO;
 	    }
-            else
- 	    {                /* We start the process of balancing */
-
-                corrections = corrections + 1;
-                    /*
-                    ** corrections is an integer used to avoid infinite
-                    ** loops in cases such as:
-                    **
-                    **             3                        3
-                    **          4                              4
-                    **           5                            5
-                    **
-                    ** 3 is used to show that it need not be the top of the tree
-		    ** But let's avoid these two exceptions anyhow
-		    ** with the two following conditions (4 March 94 - AS)
-                    */
+	    else
+	    {		     /* We start the process of balancing */
+
+		corrections = corrections + 1;
+		   /*
+		   ** corrections is an integer used to avoid infinite
+		   ** loops in cases such as:
+		   **
+		   **             3                        3
+		   **          4                              4
+		   **           5                            5
+		   **
+		   ** 3 is used to show that it need not be the top of the tree
+		   ** But let's avoid these two exceptions anyhow
+		   ** with the two following conditions (4 March 94 - AS)
+		   */
 
 		if ((father_of_element->left == NULL)
 		    && (father_of_element->right->right == NULL)
@@ -261,26 +285,26 @@ PUBLIC void HTBTree_add ARGS2(
 		    corrections = 7;
 
 
-                if (father_of_element->left_depth > father_of_element->right_depth)
-	        {
-                    added_element = father_of_element->left;
-                    father_of_element->left_depth = added_element->right_depth;
-                    added_element->right_depth = 1
-                                    + MAXIMUM(father_of_element->right_depth,
-                                          father_of_element->left_depth);
-                    if (father_of_element->up != NULL)
+		if (father_of_element->left_depth > father_of_element->right_depth)
+		{
+		    added_element = father_of_element->left;
+		    father_of_element->left_depth = added_element->right_depth;
+		    added_element->right_depth = 1
+				    + MAXIMUM(father_of_element->right_depth,
+					  father_of_element->left_depth);
+		    if (father_of_element->up != NULL)
 		    {
 			/* Bug fixed in March 94  -  AS */
 			BOOL first_time;
 
-                        father_of_forefather = father_of_element->up;
-                        forefather_of_element = added_element;
+			father_of_forefather = father_of_element->up;
+			forefather_of_element = added_element;
 			first_time = YES;
-                        do
-                        {
-                            if (father_of_forefather->left
-                                 == forefather_of_element->up)
-                              {
+			do
+			{
+			    if (father_of_forefather->left
+				 == forefather_of_element->up)
+			      {
 				  depth = father_of_forefather->left_depth;
 				  if (first_time)
 				  {
@@ -294,11 +318,11 @@ PUBLIC void HTBTree_add ARGS2(
 					   + MAXIMUM(forefather_of_element->up->left_depth,
 					      forefather_of_element->up->right_depth);
 
-                                depth2 = father_of_forefather->left_depth;
+				depth2 = father_of_forefather->left_depth;
 			    }
-                            else
+			    else
 			    {
-                                depth = father_of_forefather->right_depth;
+				depth = father_of_forefather->right_depth;
 				if (first_time)
 				{
 				    father_of_forefather->right_depth = 1
@@ -310,100 +334,100 @@ PUBLIC void HTBTree_add ARGS2(
 				    father_of_forefather->right_depth = 1
 				      + MAXIMUM(forefather_of_element->up->left_depth,
 					   forefather_of_element->up->right_depth);
-                                depth2 = father_of_forefather->right_depth;
+				depth2 = father_of_forefather->right_depth;
 			    }
-                            forefather_of_element = forefather_of_element->up;
-                            father_of_forefather = father_of_forefather->up;
+			    forefather_of_element = forefather_of_element->up;
+			    father_of_forefather = father_of_forefather->up;
 			} while ((depth != depth2) &&
 				 (father_of_forefather != NULL));
-                        father_of_forefather = father_of_element->up;
-                        if (father_of_forefather->left == father_of_element)
-	                {
-                            /*
-                            **                   3                       3
-                            **               4                       5
-                            ** When tree   5   6        becomes    7    4
-                            **            7 8                          8 6
-                            **
-                            ** 3 is used to show that it may not be the top of the
-                            ** tree.
-                            */
-                            father_of_forefather->left = added_element;
-                            father_of_element->left = added_element->right;
-                            added_element->right = father_of_element;
-                        }
-                        if (father_of_forefather->right == father_of_element)
-		        {
-                            /*
-                            **          3                       3
-                            **               4                       5
-                            ** When tree   5   6        becomes    7    4
-                            **            7 8                          8 6
-                            **
-                            ** 3 is used to show that it may not be the top of the
-                            ** tree
-                            */
-                            father_of_forefather->right = added_element;
-                            father_of_element->left = added_element->right;
-                            added_element->right = father_of_element;
-                        }
-                        added_element->up = father_of_forefather;
+			father_of_forefather = father_of_element->up;
+			if (father_of_forefather->left == father_of_element)
+			{
+			    /*
+			    **                   3                       3
+			    **               4                       5
+			    ** When tree   5   6        becomes    7    4
+			    **            7 8                          8 6
+			    **
+			    ** 3 is used to show that it may not be the top of the
+			    ** tree.
+			    */
+			    father_of_forefather->left = added_element;
+			    father_of_element->left = added_element->right;
+			    added_element->right = father_of_element;
+			}
+			if (father_of_forefather->right == father_of_element)
+			{
+			    /*
+			    **          3                       3
+			    **               4                       5
+			    ** When tree   5   6        becomes    7    4
+			    **            7 8                          8 6
+			    **
+			    ** 3 is used to show that it may not be the top of the
+			    ** tree
+			    */
+			    father_of_forefather->right = added_element;
+			    father_of_element->left = added_element->right;
+			    added_element->right = father_of_element;
+			}
+			added_element->up = father_of_forefather;
 		    }
-                    else
+		    else
 		    {
-                        /*
-                        **
-                        **               1                       2
-                        ** When tree   2   3        becomes    4    1
-                        **            4 5                          5 3
-                        **
-                        ** 1 is used to show that it is the top of the tree
-                        */
-                        added_element->up = NULL;
-                        father_of_element->left = added_element->right;
-                        added_element->right = father_of_element;
+			/*
+			**
+			**               1                       2
+			** When tree   2   3        becomes    4    1
+			**            4 5                          5 3
+			**
+			** 1 is used to show that it is the top of the tree
+			*/
+			added_element->up = NULL;
+			father_of_element->left = added_element->right;
+			added_element->right = father_of_element;
 		    }
-                    father_of_element->up = added_element;
-                    if (father_of_element->left != NULL)
-                        father_of_element->left->up = father_of_element;
-	        }
-                else
-	        {
-                    added_element = father_of_element->right;
-                    father_of_element->right_depth = added_element->left_depth;
-                    added_element->left_depth = 1 +
-                            MAXIMUM(father_of_element->right_depth,
-                                father_of_element->left_depth);
-                    if (father_of_element->up != NULL)
+		    father_of_element->up = added_element;
+		    if (father_of_element->left != NULL)
+			father_of_element->left->up = father_of_element;
+		}
+		else
+		{
+		    added_element = father_of_element->right;
+		    father_of_element->right_depth = added_element->left_depth;
+		    added_element->left_depth = 1 +
+			    MAXIMUM(father_of_element->right_depth,
+				father_of_element->left_depth);
+		    if (father_of_element->up != NULL)
 			/* Bug fixed in March 94  -  AS */
 		    {
 			BOOL first_time;
 
-                        father_of_forefather = father_of_element->up;
-                        forefather_of_element = added_element;
+			father_of_forefather = father_of_element->up;
+			forefather_of_element = added_element;
 			first_time = YES;
-                        do
-                        {
-                            if (father_of_forefather->left
+			do
+			{
+			    if (father_of_forefather->left
 				== forefather_of_element->up)
-                            {
-                                depth = father_of_forefather->left_depth;
-                                if (first_time)
+			    {
+				depth = father_of_forefather->left_depth;
+				if (first_time)
 				{
 				    father_of_forefather->left_depth = 1
 				       + MAXIMUM(forefather_of_element->left_depth,
 					       forefather_of_element->right_depth);
 				    first_time = NO;
 				}
-                                else
+				else
 				    father_of_forefather->left_depth = 1
 				      + MAXIMUM(forefather_of_element->up->left_depth,
-				       	  forefather_of_element->up->right_depth);
+					  forefather_of_element->up->right_depth);
 				depth2 = father_of_forefather->left_depth;
 			    }
-                            else
+			    else
 			    {
-                                depth = father_of_forefather->right_depth;
+				depth = father_of_forefather->right_depth;
 				if (first_time)
 				{
 				    father_of_forefather->right_depth = 1
@@ -415,78 +439,78 @@ PUBLIC void HTBTree_add ARGS2(
 				    father_of_forefather->right_depth = 1
 				      + MAXIMUM(forefather_of_element->up->left_depth,
 					   forefather_of_element->up->right_depth);
-                                depth2 = father_of_forefather->right_depth;
+				depth2 = father_of_forefather->right_depth;
 			    }
-                            father_of_forefather = father_of_forefather->up;
-                            forefather_of_element = forefather_of_element->up;
+			    father_of_forefather = father_of_forefather->up;
+			    forefather_of_element = forefather_of_element->up;
 			} while ((depth != depth2) &&
 				 (father_of_forefather != NULL));
-                        father_of_forefather = father_of_element->up;
-                        if (father_of_forefather->left == father_of_element)
-		        {
-                            /*
-                            **                    3                       3
-                            **               4                       6
-                            ** When tree   5   6        becomes    4    8
-                            **                7 8                 5 7
-                            **
-                            ** 3 is used to show that it may not be the top of the
-                            ** tree.
-                            */
-                            father_of_forefather->left = added_element;
-                            father_of_element->right = added_element->left;
-                            added_element->left = father_of_element;
-                        }
-                        if (father_of_forefather->right == father_of_element)
-		        {
-                            /*
-                            **           3                      3
-                            **               4                       6
-                            ** When tree   5   6        becomes    4    8
-                            **                7 8                 5 7
-                            **
-                            ** 3 is used to show that it may not be the top of the
-                            ** tree
-                            */
-                            father_of_forefather->right = added_element;
-                            father_of_element->right = added_element->left;
-                            added_element->left = father_of_element;
-                        }
-                        added_element->up = father_of_forefather;
+			father_of_forefather = father_of_element->up;
+			if (father_of_forefather->left == father_of_element)
+			{
+			    /*
+			    **                    3                       3
+			    **               4                       6
+			    ** When tree   5   6        becomes    4    8
+			    **                7 8                 5 7
+			    **
+			    ** 3 is used to show that it may not be the top of the
+			    ** tree.
+			    */
+			    father_of_forefather->left = added_element;
+			    father_of_element->right = added_element->left;
+			    added_element->left = father_of_element;
+			}
+			if (father_of_forefather->right == father_of_element)
+			{
+			    /*
+			    **           3                      3
+			    **               4                       6
+			    ** When tree   5   6        becomes    4    8
+			    **                7 8                 5 7
+			    **
+			    ** 3 is used to show that it may not be the top of the
+			    ** tree
+			    */
+			    father_of_forefather->right = added_element;
+			    father_of_element->right = added_element->left;
+			    added_element->left = father_of_element;
+			}
+			added_element->up = father_of_forefather;
 		    }
-                    else
-                    {
-                        /*
-                        **
-                        **               1                       3
-                        ** When tree   2   3        becomes    1    5
-                        **                4 5                 2 4
-                        **
-                        ** 1 is used to show that it is the top of the tree.
-                        */
-                        added_element->up = NULL;
-                        father_of_element->right = added_element->left;
-                        added_element->left = father_of_element;
+		    else
+		    {
+			/*
+			**
+			**               1                       3
+			** When tree   2   3        becomes    1    5
+			**                4 5                 2 4
+			**
+			** 1 is used to show that it is the top of the tree.
+			*/
+			added_element->up = NULL;
+			father_of_element->right = added_element->left;
+			added_element->left = father_of_element;
 		    }
-                    father_of_element->up = added_element;
-                    if (father_of_element->right != NULL)
-		        father_of_element->right->up = father_of_element;
+		    father_of_element->up = added_element;
+		    if (father_of_element->right != NULL)
+			father_of_element->right->up = father_of_element;
 		}
 	    }
-        }
-        while (father_of_element->up != NULL)
+	}
+	while (father_of_element->up != NULL)
 	{
-            father_of_element = father_of_element->up;
-        }
-        tree->top = father_of_element;
+	    father_of_element = father_of_element->up;
+	}
+	tree->top = father_of_element;
     }
 }
 
 
 
 PUBLIC HTBTElement * HTBTree_next ARGS2(
-                               HTBTree*,       tree,
-                               HTBTElement*,   ele)
+			       HTBTree*,       tree,
+			       HTBTElement*,   ele)
     /**************************************************************************
     ** this function returns a pointer to the leftmost element if ele is NULL,
     ** and to the next object to the right otherwise.
@@ -498,30 +522,30 @@ PUBLIC HTBTElement * HTBTree_next ARGS2(
 
     if (ele == NULL)
     {
-        father_of_element = tree->top;
-        if (father_of_element != NULL)
-            while (father_of_element->left != NULL)
-                father_of_element = father_of_element->left;
+	father_of_element = tree->top;
+	if (father_of_element != NULL)
+	    while (father_of_element->left != NULL)
+		father_of_element = father_of_element->left;
     }
     else
     {
-        father_of_element = ele;
-        if (father_of_element->right != NULL)
+	father_of_element = ele;
+	if (father_of_element->right != NULL)
 	{
-            father_of_element = father_of_element->right;
-            while (father_of_element->left != NULL)
-                father_of_element = father_of_element->left;
+	    father_of_element = father_of_element->right;
+	    while (father_of_element->left != NULL)
+		father_of_element = father_of_element->left;
 	}
-        else
+	else
 	{
-            father_of_forefather = father_of_element->up;
-	        while (father_of_forefather &&
+	    father_of_forefather = father_of_element->up;
+		while (father_of_forefather &&
 		       (father_of_forefather->right == father_of_element))
-      	        {
-                    father_of_element = father_of_forefather;
+		{
+		    father_of_element = father_of_forefather;
 		    father_of_forefather = father_of_element->up;
 		}
-            father_of_element = father_of_forefather;
+	    father_of_element = father_of_forefather;
 	}
     }
 #ifdef BTREE_TRACE
@@ -530,22 +554,22 @@ PUBLIC HTBTElement * HTBTree_next ARGS2(
     */
     if (father_of_element != NULL)
     {
-        printf("\nObject = %s\t",(char *)father_of_element->object);
-        if (father_of_element->up != NULL)
-            printf("Objet du pere = %s\n",
+	printf("\nObject = %s\t",(char *)father_of_element->object);
+	if (father_of_element->up != NULL)
+	    printf("Objet du pere = %s\n",
 		   (char *)father_of_element->up->object);
-        else printf("Pas de Pere\n");
-        if (father_of_element->left != NULL)
-            printf("Objet du fils gauche = %s\t",
+	else printf("Pas de Pere\n");
+	if (father_of_element->left != NULL)
+	    printf("Objet du fils gauche = %s\t",
 		   (char *)father_of_element->left->object);
-        else printf("Pas de fils gauche\t");
-        if (father_of_element->right != NULL)
-            printf("Objet du fils droit = %s\n",
+	else printf("Pas de fils gauche\t");
+	if (father_of_element->right != NULL)
+	    printf("Objet du fils droit = %s\n",
 		   (char *)father_of_element->right->object);
-        else printf("Pas de fils droit\n");
-        printf("Profondeur gauche = %d\t",father_of_element->left_depth);
-        printf("Profondeur droite = %d\n",father_of_element->right_depth);
-        printf("      **************\n");
+	else printf("Pas de fils droit\n");
+	printf("Profondeur gauche = %d\t",father_of_element->left_depth);
+	printf("Profondeur droite = %d\n",father_of_element->right_depth);
+	printf("      **************\n");
     }
 #endif
     return father_of_element;
@@ -702,9 +726,9 @@ main ()
     while (next_element != NULL)
     {
 #ifndef BTREE_TRACE
-        printf("The next element is %s\n",next_element->object);
+	printf("The next element is %s\n",next_element->object);
 #endif
-        next_element = HTBTree_next(tree,next_element);
+	next_element = HTBTree_next(tree,next_element);
     }
     HTBTree_free(tree);
 }
diff --git a/WWW/Library/Implementation/HTBTree.h b/WWW/Library/Implementation/HTBTree.h
index d4b2ac08..cbbfad43 100644
--- a/WWW/Library/Implementation/HTBTree.h
+++ b/WWW/Library/Implementation/HTBTree.h
@@ -15,7 +15,7 @@
 #ifndef HTUTILS_H
 #include <HTUtils.h>
 #endif
- 
+
 /*
 
 Data structures
@@ -76,6 +76,16 @@ extern void HTBTree_add PARAMS((HTBTree* tree, void * object));
 
 /*
 
+Search an object in a binary tree
+
+  returns          Pointer to equivalent object in a tree or NULL if none.
+ */
+
+extern void * HTBTree_search PARAMS((HTBTree* tree, void * object));
+
+
+/*
+
 Find user object for element
 
  */
@@ -91,7 +101,7 @@ Find next element in depth-first order
   ele                    if NULL, start with leftmost element. if != 0 give next object to
                          the right.
 
-  returns                Pointer to element ot NULL if none left.
+  returns                Pointer to element or NULL if none left.
 
  */
 extern HTBTElement * HTBTree_next PARAMS((HTBTree* tree, HTBTElement * ele));
diff --git a/WWW/Library/Implementation/HTChunk.c b/WWW/Library/Implementation/HTChunk.c
index 05a5da61..6c2d1687 100644
--- a/WWW/Library/Implementation/HTChunk.c
+++ b/WWW/Library/Implementation/HTChunk.c
@@ -61,7 +61,7 @@ PUBLIC HTChunk * HTChunkCreate2 ARGS2 (int,grow, size_t, needed)
 	ch->allocated = needed-1 - ((needed-1) % ch->growby)
 	    + ch->growby; /* Round up */
 	CTRACE((tfp, "HTChunkCreate2: requested %d, allocate %d\n",
-	       needed, ch->allocated));
+	       (int) needed, ch->allocated));
 	ch->data = typecallocn(char, ch->allocated);
 	if (!ch->data)
 	    outofmem(__FILE__, "HTChunkCreate2 data");
@@ -249,7 +249,7 @@ PUBLIC void HTChunkTerminate ARGS1 (HTChunk *,ch)
 PUBLIC void HTChunkPuts ARGS2 (HTChunk *,ch, CONST char *,s)
 {
     CONST char * p;
-    for (p=s; *p; p++) {
+    for (p = s; *p; p++) {
 	HTChunkPutc(ch, *p);
 	if (ch->allocated == 0)
 	    return;		/* must have been allocation failure - kw */
diff --git a/WWW/Library/Implementation/HTFTP.c b/WWW/Library/Implementation/HTFTP.c
index 39cfd1c9..3c884e63 100644
--- a/WWW/Library/Implementation/HTFTP.c
+++ b/WWW/Library/Implementation/HTFTP.c
@@ -63,6 +63,7 @@ BUGS:	@@@	Limit connection cache size!
 
 #include <HTFTP.h>	/* Implemented here */
 #include <HTTCP.h>
+#include <HTTP.h>
 #include <HTFont.h>
 
 #define REPEAT_PORT	/* Give the port number for each file */
@@ -2746,8 +2747,6 @@ AgainForMultiNet:
 	    BytesReceived += chunk->size;
 	    if (BytesReceived > BytesReported + 1024) {
 #ifdef _WINDOWS
-		extern int ws_read_per_sec;
-
 		sprintf(NumBytes,gettext("Transferred %d bytes (%5d)"),
 				BytesReceived, ws_read_per_sec);
 #else
diff --git a/WWW/Library/Implementation/HTFile.c b/WWW/Library/Implementation/HTFile.c
index 3a90e3b2..e9d5e231 100644
--- a/WWW/Library/Implementation/HTFile.c
+++ b/WWW/Library/Implementation/HTFile.c
@@ -129,8 +129,6 @@ PUBLIC int HTDirReadme = HT_DIR_README_NONE;
 PUBLIC int HTDirReadme = HT_DIR_README_TOP;
 #endif /* DIRED_SUPPORT */
 
-extern BOOL HTPassEightBitRaw;
-
 PRIVATE char *HTMountRoot = "/Net/";		/* Where to find mounts */
 #ifdef VMS
 PRIVATE char *HTCacheRoot = "/WWW$SCRATCH";	/* Where to cache things */
@@ -2035,30 +2033,26 @@ PUBLIC int HTStat ARGS2(
 	struct stat *,	data)
 {
     int result = -1;
-    char *temp_name = NULL;
     size_t len = strlen(filename);
 
     if (len != 0 && LYIsPathSep(filename[len-1])) {
+	char *temp_name = NULL;
 	HTSprintf0(&temp_name, "%s.", filename);
+	result = HTStat(temp_name, data);
+	FREE(temp_name);
     } else {
-	temp_name = (char *)filename;
-    }
+	result = stat(filename, data);
 #ifdef _WINDOWS
-    /*
-     * Someone claims that stat() doesn't give the proper result for a
-     * directory on Windows.
-     */
-    if (access(temp_name, 0) == 0) {
-	if (stat(temp_name, data) == -1)
+	/*
+	 * Someone claims that stat() doesn't give the proper result for a
+	 * directory on Windows.
+	 */
+	if (result == -1
+	 && access(filename, 0) == 0) {
 	    data->st_mode = S_IFDIR;
-	result = 0;
-    }
-#else
-    result = stat(temp_name, data);
+	    result = 0;
+	}
 #endif
-
-    if (temp_name != filename) {
-	FREE(temp_name);
     }
     return result;
 }
@@ -2754,6 +2748,155 @@ PUBLIC int HTLoadFile ARGS4(
     }
 }
 
+static CONST char *program_paths[pp_Last];
+
+/*
+ * Given a program number, return its path
+ */
+PUBLIC CONST char * HTGetProgramPath ARGS1(
+	ProgramPaths,	code)
+{
+    CONST char *result = NULL;
+    if (code > ppUnknown && code < pp_Last)
+	result = program_paths[code];
+    return result;
+}
+
+/*
+ * Store a program's path
+ */
+PUBLIC void HTSetProgramPath ARGS2(
+	ProgramPaths,	code,
+	CONST char *,	path)
+{
+    if (code > ppUnknown && code < pp_Last) {
+	program_paths[code] = isEmpty(path) ? 0 : path;
+    }
+}
+
+/*
+ * Reset the list of known program paths to the ones that are compiled-in
+ */
+PUBLIC void HTInitProgramPaths NOARGS
+{
+    ProgramPaths code;
+    CONST char *path;
+    CONST char *test;
+
+    for (code = ppUnknown + 1; code < pp_Last; ++code) {
+	switch (code) {
+#ifdef BZIP2_PATH
+	case ppBZIP2:
+	    path = BZIP2_PATH;
+	    break;
+#endif
+#ifdef CHMOD_PATH
+	case ppCHMOD:
+	    path = CHMOD_PATH;
+	    break;
+#endif
+#ifdef COMPRESS_PATH
+	case ppCOMPRESS:
+	    path = COMPRESS_PATH;
+	    break;
+#endif
+#ifdef COPY_PATH
+	case ppCOPY:
+	    path = COPY_PATH;
+	    break;
+#endif
+#ifdef CSWING_PATH
+	case ppCSWING:
+	    path = CSWING_PATH;
+	    break;
+#endif
+#ifdef GZIP_PATH
+	case ppGZIP:
+	    path = GZIP_PATH;
+	    break;
+#endif
+#ifdef INSTALL_PATH
+	case ppINSTALL:
+	    path = INSTALL_PATH;
+	    break;
+#endif
+#ifdef MKDIR_PATH
+	case ppMKDIR:
+	    path = MKDIR_PATH;
+	    break;
+#endif
+#ifdef MV_PATH
+	case ppMV:
+	    path = MV_PATH;
+	    break;
+#endif
+#ifdef RLOGIN_PATH
+	case ppRLOGIN:
+	    path = RLOGIN_PATH;
+	    break;
+#endif
+#ifdef RM_PATH
+	case ppRM:
+	    path = RM_PATH;
+	    break;
+#endif
+#ifdef TAR_PATH
+	case ppTAR:
+	    path = TAR_PATH;
+	    break;
+#endif
+#ifdef TELNET_PATH
+	case ppTELNET:
+	    path = TELNET_PATH;
+	    break;
+#endif
+#ifdef TN3270_PATH
+	case ppTN3270:
+	    path = TN3270_PATH;
+	    break;
+#endif
+#ifdef TOUCH_PATH
+	case ppTOUCH:
+	    path = TOUCH_PATH;
+	    break;
+#endif
+#ifdef UNCOMPRESS_PATH
+	case ppUNCOMPRESS:
+	    path = UNCOMPRESS_PATH;
+	    break;
+#endif
+#ifdef UNZIP_PATH
+	case ppUNZIP:
+	    path = UNZIP_PATH;
+	    break;
+#endif
+#ifdef UUDECODE_PATH
+	case ppUUDECODE:
+	    path = UUDECODE_PATH;
+	    break;
+#endif
+#ifdef ZCAT_PATH
+	case ppZCAT:
+	    path = ZCAT_PATH;
+	    break;
+#endif
+#ifdef ZIP_PATH
+	case ppZIP:
+	    path = ZIP_PATH;
+	    break;
+#endif
+	default:
+	    path = NULL;
+	    break;
+	}
+	test = HTGetProgramPath(code);
+	if (test != NULL && test != path) {
+	    free((char *)test);
+	}
+	HTSetProgramPath(code, path);
+    }
+}
+
 /*
 **	Protocol descriptors
 */
diff --git a/WWW/Library/Implementation/HTFile.h b/WWW/Library/Implementation/HTFile.h
index bd0a90ee..258c30f5 100644
--- a/WWW/Library/Implementation/HTFile.h
+++ b/WWW/Library/Implementation/HTFile.h
@@ -276,6 +276,54 @@ extern CONST char * HTFileSuffix PARAMS((
                 CONST char* enc));
 
 /*
+ * Enumerate external programs that lynx may assume exists.  Unlike those
+ * given in download scripts, etc., lynx would really like to know their
+ * absolute paths, for better security.
+ */
+typedef enum {
+    ppUnknown = 0
+    ,ppBZIP2
+    ,ppCHMOD
+    ,ppCOMPRESS
+    ,ppCOPY
+    ,ppCSWING
+    ,ppGZIP
+    ,ppINSTALL
+    ,ppMKDIR
+    ,ppMV
+    ,ppRLOGIN
+    ,ppRM
+    ,ppTAR
+    ,ppTELNET
+    ,ppTN3270
+    ,ppTOUCH
+    ,ppUNCOMPRESS
+    ,ppUNZIP
+    ,ppUUDECODE
+    ,ppZCAT
+    ,ppZIP
+    ,pp_Last
+} ProgramPaths;
+
+/*
+ * Given a program number, return its path
+ */
+extern CONST char * HTGetProgramPath PARAMS((
+		ProgramPaths code));
+
+/*
+ * Store a program's path 
+ */
+extern void HTSetProgramPath PARAMS((
+		ProgramPaths code,
+		CONST char *path));
+
+/*
+ * Reset the list of known program paths to the ones that are compiled-in
+ */
+extern void HTInitProgramPaths NOPARAMS;
+
+/*
 **  The Protocols
 */
 #ifdef GLOBALREF_IS_MACRO
diff --git a/WWW/Library/Implementation/HTFormat.c b/WWW/Library/Implementation/HTFormat.c
index 70184064..4a8e1778 100644
--- a/WWW/Library/Implementation/HTFormat.c
+++ b/WWW/Library/Implementation/HTFormat.c
@@ -55,7 +55,6 @@ PUBLIC long int HTMaxBytes  = 0;	/* No effective limit */
 #endif
 
 PUBLIC	BOOL HTOutputSource = NO;	/* Flag: shortcut parser to stdout */
-/* extern  BOOL interactive; LJM */
 
 #ifdef ORIGINAL
 struct _HTStream {
@@ -627,8 +626,8 @@ PUBLIC void HTDisplayPartial NOARGS
 		 * If partial_threshold <= 0, then it's a full page
 		 */
 	) {
-	    NumOfLines_partial = HText_getNumOfLines();
-	    LYMainLoop_pageDisplay(Newline_partial);
+	    if (LYMainLoop_pageDisplay(Newline_partial))
+		NumOfLines_partial = HText_getNumOfLines();
 	}
     }
 #else /* nothing */
@@ -688,12 +687,6 @@ PUBLIC int HTCopy ARGS4(
     BOOL suppress_readprogress = NO;
     int bytes;
     int rv = 0;
-#ifdef _WINDOWS	/* 1997/11/11 (Tue) 15:18:16 */
-    long file_length;
-    extern int bytes_already_read;
-
-    file_length = anchor->content_length;
-#endif
 
     /*	Push the data down the stream
     */
diff --git a/WWW/Library/Implementation/HTFormat.h b/WWW/Library/Implementation/HTFormat.h
index 63c96f5b..13daca35 100644
--- a/WWW/Library/Implementation/HTFormat.h
+++ b/WWW/Library/Implementation/HTFormat.h
@@ -38,7 +38,8 @@ typedef HTAtom * HTFormat;
 
  */
                         /* Internal ones */
-#define WWW_SOURCE HTAtom_for("www/source")     /* Whatever it was originally*/
+/* #define WWW_SOURCE HTAtom_for("www/source") */    /* Whatever it was originally*/
+extern HTAtom * WWW_SOURCE;     /* calculated once, heavy used */
 
 /*
 
diff --git a/WWW/Library/Implementation/HTList.c b/WWW/Library/Implementation/HTList.c
index 90871f90..cc46beda 100644
--- a/WWW/Library/Implementation/HTList.c
+++ b/WWW/Library/Implementation/HTList.c
@@ -17,7 +17,7 @@ PUBLIC HTList * HTList_new NOARGS
 {
     HTList *newList;
 
-    if ((newList = typecalloc(HTList)) == NULL)
+    if ((newList = typeMalloc(HTList)) == NULL)
 	outofmem(__FILE__, "HTList_new");
 
     newList->object = NULL;
@@ -96,7 +96,7 @@ PUBLIC void HTList_addObject ARGS2(
     HTList *newNode;
 
     if (me) {
-	if ((newNode = typecalloc(HTList)) == NULL)
+	if ((newNode = typeMalloc(HTList)) == NULL)
 	    outofmem(__FILE__, "HTList_addObject");
 	newNode->object = newObject;
 	newNode->next = me->next;
@@ -157,7 +157,7 @@ PUBLIC void HTList_insertObjectAt ARGS3(
     prevNode = temp;
     while ((temp = temp->next)) {
 	if (Pos == 0) {
-	    if ((newNode = typecalloc(HTList)) == NULL)
+	    if ((newNode = typeMalloc(HTList)) == NULL)
 		outofmem(__FILE__, "HTList_addObjectAt");
 	    newNode->object = newObject;
 	    newNode->next = temp;
diff --git a/WWW/Library/Implementation/HTMIME.c b/WWW/Library/Implementation/HTMIME.c
index 1750a5e3..0838a9a9 100644
--- a/WWW/Library/Implementation/HTMIME.c
+++ b/WWW/Library/Implementation/HTMIME.c
@@ -26,8 +26,6 @@
 #include <LYUtils.h>
 #include <LYLeaks.h>
 
-extern BOOL HTPassEightBitRaw;
-
 /*		MIME Object
 **		-----------
 */
@@ -200,6 +198,16 @@ PRIVATE char *parse_parameter ARGS2(
     return result;
 }
 
+PRIVATE BOOL content_is_compressed ARGS1(HTStream *, me)
+{
+    char *encoding = me->anchor->content_encoding;
+
+    return encoding != 0
+        && strcmp(encoding, "8bit") != 0
+	&& strcmp(encoding, "7bit") != 0
+	&& strcmp(encoding, "binary") != 0;
+}
+
 PRIVATE int pumpData ARGS1(HTStream *, me)
 {
     if (strchr(HTAtom_name(me->format), ';') != NULL) {
@@ -467,9 +475,11 @@ PRIVATE int pumpData ARGS1(HTStream *, me)
     } else {
 	me->state = MIME_IGNORE;	/* What else to do? */
     }
-    if (me->refresh_url != NULL) {
+    if (me->refresh_url != NULL && !content_is_compressed(me)) {
 	char *url = parse_parameter(me->refresh_url, "URL");
 	char *txt = NULL;
+	char *arg = NULL;
+	char *base = "";	/* FIXME: refresh_url may be relative to doc */
 	int num = 0;
 
 	if (url != NULL) {
@@ -479,7 +489,10 @@ PRIVATE int pumpData ARGS1(HTStream *, me)
 	    HTSprintf0(&txt, gettext("Refresh: "));
 	    if (num != 0)
 		HTSprintf(&txt, gettext("%.*s seconds "), num, me->refresh_url);
-	    HTSprintf(&txt, "<a href=\"%s\">%s</a><br>", url, url);
+	    if ((arg = strchr(url, '?')) != NULL)
+		*arg = '\0';
+	    HTSprintf(&txt, "<a href=\"%s%s\">%s</a><br>", base, url, url);
+	    CTRACE((tfp, "URL %s%s\n", base, url));
 	    (me->isa->put_string)(me, txt);
 	    free(url);
 	    free(txt);
@@ -658,20 +671,18 @@ PRIVATE int dispatchField ARGS1(HTStream *, me)
 	LYLowerCase(me->value);
 	StrAllocCopy(me->anchor->content_encoding, me->value);
 	FREE(me->compression_encoding);
-	if (!strcmp(me->value, "8bit") ||
-	    !strcmp(me->value, "7bit") ||
-	    !strcmp(me->value, "binary")) {
-	    /*
-	    **	Some server indicated "8bit", "7bit" or "binary"
-	    **	inappropriately.  We'll ignore it. - FM
-	    */
-	    CTRACE((tfp, "                Ignoring it!\n"));
-	} else {
+	if (content_is_compressed(me)) {
 	    /*
 	    **	Save it to use as a flag for setting
 	    **	up a "www/compressed" target. - FM
 	    */
 	    StrAllocCopy(me->compression_encoding, me->value);
+	} else {
+	    /*
+	    **	Some server indicated "8bit", "7bit" or "binary"
+	    **	inappropriately.  We'll ignore it. - FM
+	    */
+	    CTRACE((tfp, "                Ignoring it!\n"));
 	}
 	break;
     case miCONTENT_FEATURES:
diff --git a/WWW/Library/Implementation/HTNews.c b/WWW/Library/Implementation/HTNews.c
index ce7c16df..72ae27de 100644
--- a/WWW/Library/Implementation/HTNews.c
+++ b/WWW/Library/Implementation/HTNews.c
@@ -17,6 +17,7 @@
 #include <HTCJK.h>
 #include <HTMIME.h>
 #include <HTFont.h>
+#include <HTFormat.h>
 #include <HTTCP.h>
 #include <LYUtils.h>
 #include <LYStrings.h>
@@ -73,11 +74,6 @@ struct _HTStream
 
 #define LINE_LENGTH 512			/* Maximum length of line of ARTICLE etc */
 #define GROUP_NAME_LENGTH	256	/* Maximum length of group name */
-extern BOOLEAN scan_for_buried_news_references;
-extern BOOLEAN LYListNewsNumbers;
-extern BOOLEAN LYListNewsDates;
-extern int interrupted_in_htgetcharacter;
-extern BOOL keep_mime_headers;	 /* Include mime headers and force raw text */
 extern BOOL using_proxy;	/* Are we using an NNTP proxy? */
 
 /*
diff --git a/WWW/Library/Implementation/HTParse.c b/WWW/Library/Implementation/HTParse.c
index 4b09e64a..35a0ad38 100644
--- a/WWW/Library/Implementation/HTParse.c
+++ b/WWW/Library/Implementation/HTParse.c
@@ -8,6 +8,10 @@
 #include <LYUtils.h>
 #include <LYLeaks.h>
 
+#ifdef HAVE_ALLOCA_H
+#include <alloca.h>
+#endif
+
 #define HEX_ESCAPE '%'
 
 struct struct_parts {
@@ -131,7 +135,8 @@ PRIVATE void scan ARGS2(
     /*
     **	Check schemes that commonly have unescaped hashes.
     */
-    if (parts->access && parts->anchor) {
+    if (parts->access && parts->anchor &&
+		/* optimize */ strchr("lnsdLNSD", *parts->access) != NULL) {
 	if ((!parts->host && strcasecomp(parts->access, "lynxcgi")) ||
 	    !strcasecomp(parts->access, "nntp") ||
 	    !strcasecomp(parts->access, "snews") ||
@@ -154,6 +159,14 @@ PRIVATE void scan ARGS2(
 } /*scan */
 
 
+#if defined(HAVE_ALLOCA) && !defined(LY_FIND_LEAKS)
+#define LYalloca(x)        alloca(x)
+#define LYalloca_free(x)   x = 0 /*avoid warning*/
+#else
+#define LYalloca(x)        malloc(x)
+#define LYalloca_free(x)   free(x)
+#endif
+
 /*	Parse a Name relative to another name.			HTParse()
 **	--------------------------------------
 **
@@ -166,7 +179,7 @@ PRIVATE void scan ARGS2(
 **	wanted		A mask for the bits which are wanted.
 **
 ** On exit,
-**	returns		A pointer to a calloc'd string which MUST BE FREED
+**     returns         A pointer to a malloc'd string which MUST BE FREED
 */
 PUBLIC char * HTParse ARGS3(
 	CONST char *,	aName,
@@ -175,7 +188,7 @@ PUBLIC char * HTParse ARGS3(
 {
     char * result = NULL;
     char * return_value = NULL;
-    int len;
+    int len, len1, len2;
     char * name = NULL;
     char * rel = NULL;
     char * p;
@@ -193,19 +206,25 @@ PUBLIC char * HTParse ARGS3(
 	    wanted &= ~(PARSE_STRICTPATH | PARSE_QUERY); /* ignore details */
     }
     /*
-    **	Allocate the output string.
+    ** Allocate the temporary string. Optimized.
     */
-    len = strlen(aName) + strlen(relatedName) + 10;
-    result = typecallocn(char, len);	/* Lots of space: more than enough */
+    len1 = strlen(aName) + 1;
+    len2 = strlen(relatedName) + 1;
+    len = len1 + len2 + 8;     /* Lots of space: more than enough */
+
+    result = (char*)LYalloca(len + len1 + len2);
     if (result == NULL) {
 	outofmem(__FILE__, "HTParse");
     }
+    *result = '\0';
+    name = result + len;
+    rel = name + len1;
 
     /*
     **	Make working copies of the input strings to cut up.
     */
-    StrAllocCopy(name, aName);
-    StrAllocCopy(rel, relatedName);
+    memcpy(name, aName, len1);
+    memcpy(rel, relatedName, len2);
 
     /*
     **	Cut up the strings into URL fields.
@@ -309,10 +328,10 @@ PUBLIC char * HTParse ARGS3(
 		    *p2 = '\0'; /* It is the default: ignore it */
 		}
 		if (p2 == NULL) {
-		    int len2 = strlen(tail);
+		    int len3 = strlen(tail);
 
-		    if (len2 > 0) {
-			h = tail + len2 - 1;	/* last char of hostname */
+		    if (len3 > 0) {
+			h = tail + len3 - 1;	/* last char of hostname */
 			if (*h == '.')
 			    *h = '\0';		/* chop final . */
 		    }
@@ -448,15 +467,14 @@ PUBLIC char * HTParse ARGS3(
 			     given.anchor : related.anchor);
 	}
     CTRACE((tfp, "HTParse:      result:%s\n", result));
-    FREE(rel);
-    FREE(name);
 
     StrAllocCopy(return_value, result);
-    FREE(result);
+    LYalloca_free(result);
 
     return return_value;		/* exactly the right length */
 }
 
+
 /*	Simplify a filename.				HTSimplify()
 **	--------------------
 **
@@ -550,7 +568,7 @@ PUBLIC void HTSimplify ARGS1(
 		    q = p;
 		    q1 = (p + 2);
 		    while (*q1 != '\0')
-		       *q++ = *q1++;
+			*q++ = *q1++;
 		    *q = '\0';		/* terminate */
 		    p--;
 		} else if (p[1] == '.' && p[2] == '?') {
@@ -560,7 +578,7 @@ PUBLIC void HTSimplify ARGS1(
 		    q = (p + 1);
 		    q1 = (p + 2);
 		    while (*q1 != '\0')
-		       *q++ = *q1++;
+			*q++ = *q1++;
 		    *q = '\0';		/* terminate */
 		    p--;
 		} else if (p[1] == '.' && p[2] == '\0') {
diff --git a/WWW/Library/Implementation/HTPlain.c b/WWW/Library/Implementation/HTPlain.c
index 1ef4ca57..74c50f48 100644
--- a/WWW/Library/Implementation/HTPlain.c
+++ b/WWW/Library/Implementation/HTPlain.c
@@ -30,9 +30,6 @@
 #include <LYCharSets.h>
 #include <LYLeaks.h>
 
-extern BOOL HTPassEightBitRaw;
-extern BOOL HTPassHighCtrlRaw;
-
 PUBLIC int HTPlain_lastraw = -1;
 PRIVATE int HTPlain_bs_pending = 0; /* 1:bs 2:underline 3:underline+bs - kw */
 
diff --git a/WWW/Library/Implementation/HTTCP.c b/WWW/Library/Implementation/HTTCP.c
index d753edc8..0863dacb 100644
--- a/WWW/Library/Implementation/HTTCP.c
+++ b/WWW/Library/Implementation/HTTCP.c
@@ -649,10 +649,6 @@ PUBLIC struct hostent * LYGetHostByName ARGS1(
     char *host = str;
 #endif
 
-#ifdef __DJGPP__
-    _resolve_hook = ResolveYield;
-#endif
-
 #ifdef NSL_FORK
     /* for transfer of result between from child to parent: */
     static AlignedHOSTENT aligned_full_rehostent;
@@ -686,6 +682,10 @@ PUBLIC struct hostent * LYGetHostByName ARGS1(
 
     struct hostent *result_phost = NULL;
 
+#ifdef __DJGPP__
+    _resolve_hook = ResolveYield;
+#endif
+
     if (!str) {
 	CTRACE((tfp, "LYGetHostByName: Can't parse `NULL'.\n"));
 	lynx_nsl_status = HT_INTERNAL;
@@ -1565,7 +1565,6 @@ PUBLIC int HTDoConnect ARGS4(
     _HTProgress (line);
 #ifdef INET6
     /* HTParseInet() is useless! */
-    _HTProgress(host);
     res0 = HTGetAddrInfo(host, default_port);
     if (res0 == NULL) {
 	HTSprintf0 (&line, gettext("Unable to locate remote host %s."), host);
@@ -1627,7 +1626,7 @@ PUBLIC int HTDoConnect ARGS4(
     }
 #endif /* INET6 */
 
-#ifndef DOSPATH
+#if !defined(DOSPATH) || defined(__DJGPP__)
 #if !defined(NO_IOCTL) || defined(USE_FCNTL)
     /*
     **	Make the socket non-blocking, so the connect can be canceled.
@@ -1645,7 +1644,7 @@ PUBLIC int HTDoConnect ARGS4(
 	    _HTProgress(gettext("Could not make connection non-blocking."));
     }
 #endif /* !NO_IOCTL || USE_FCNTL */
-#endif /* !DOSPATH */
+#endif /* !DOSPATH || __DJGPP__ */
 
     /*
     **	Issue the connect.  Since the server can't do an instantaneous
@@ -1671,7 +1670,7 @@ PUBLIC int HTDoConnect ARGS4(
 #else
     status = connect(*s, (struct sockaddr*)&soc_address, sizeof(soc_address));
 #endif /* INET6 */
-#ifndef __DJGPP__
+
     /*
     **	According to the Sun man page for connect:
     **	   EINPROGRESS	       The socket is non-blocking and the  con-
@@ -1878,7 +1877,7 @@ PUBLIC int HTDoConnect ARGS4(
 	break;
     }
 #endif /* INET6 */
-#endif /* !__DJGPP__ */
+
 #ifdef INET6
     if (*s < 0)
 #else
@@ -1891,7 +1890,7 @@ PUBLIC int HTDoConnect ARGS4(
 	*/
 	NETCLOSE(*s);
     }
-#ifndef DOSPATH
+#if !defined(DOSPATH) || defined(__DJGPP__)
 #if !defined(NO_IOCTL) || defined(USE_FCNTL)
     else {
 	/*
@@ -1907,7 +1906,7 @@ PUBLIC int HTDoConnect ARGS4(
 	    _HTProgress(gettext("Could not restore socket to blocking."));
     }
 #endif /* !NO_IOCTL || USE_FCNTL */
-#endif /* !DOSPATH */
+#endif /* !DOSPATH || __DJGPP__ */
 
 #ifdef INET6
     FREE(line);
diff --git a/WWW/Library/Implementation/HTTP.c b/WWW/Library/Implementation/HTTP.c
index 3dfad753..9270209d 100644
--- a/WWW/Library/Implementation/HTTP.c
+++ b/WWW/Library/Implementation/HTTP.c
@@ -33,6 +33,7 @@
 #include <HTML.h>
 #include <HTInit.h>
 #include <HTAABrow.h>
+#include <HTAccess.h>		/* Are we using an HTTP gateway? */
 
 #include <LYCookie.h>
 #include <LYGlobalDefs.h>
@@ -47,14 +48,7 @@ struct _HTStream
 
 extern char * HTAppName;	/* Application name: please supply */
 extern char * HTAppVersion;	/* Application version: please supply */
-extern char * personal_mail_address;	/* User's name/email address */
-extern char * LYUserAgent;	/* Lynx User-Agent string */
-extern BOOL LYNoRefererHeader;	/* Never send Referer header? */
-extern BOOL LYNoRefererForThis; /* No Referer header for this URL? */
-extern BOOL LYNoFromHeader;	/* Never send From header? */
-extern BOOL LYSetCookies;	/* Act on Set-Cookie headers? */
-
-extern BOOL using_proxy;	/* Are we using an HTTP gateway? */
+
 PUBLIC BOOL reloading = FALSE;	/* Reloading => send no-cache pragma to proxy */
 PUBLIC char * redirecting_url = NULL;	    /* Location: value. */
 PUBLIC BOOL permanent_redirection = FALSE;  /* Got 301 status? */
diff --git a/WWW/Library/Implementation/HTTP.h b/WWW/Library/Implementation/HTTP.h
index b8212a98..971305f9 100644
--- a/WWW/Library/Implementation/HTTP.h
+++ b/WWW/Library/Implementation/HTTP.h
@@ -19,6 +19,7 @@ GLOBALREF HTProtocol HTTPS;
 #define URL_POST_METHOD 2
 #define URL_MAIL_METHOD 3
 
+extern int ws_read_per_sec;
 extern BOOL reloading;
 extern char * redirecting_url;
 extern BOOL permanent_redirection;
@@ -29,9 +30,3 @@ extern SSL * SSL_handle;
 #endif
 
 #endif /* HTTP_H */
-
-/*
-
-   end of HTTP module definition
-
- */
diff --git a/WWW/Library/Implementation/HTTelnet.c b/WWW/Library/Implementation/HTTelnet.c
index e5182b90..5ff87b49 100644
--- a/WWW/Library/Implementation/HTTelnet.c
+++ b/WWW/Library/Implementation/HTTelnet.c
@@ -36,7 +36,7 @@
 
 PRIVATE void do_system ARGS1(char *, command)
 {
-    if (command != 0) {
+    if (!isEmpty(command)) {
 	CTRACE((tfp, "HTTelnet: Command is: %s\n\n", command));
 	LYSystem(command);
 	FREE(command);
@@ -48,6 +48,7 @@ PRIVATE void do_system ARGS1(char *, command)
 */
 PRIVATE int remote_session ARGS2(char *, acc_method, char *, host)
 {
+    CONST char *program;
 	char * user = host;
 	char * password = NULL;
 	char * cp;
@@ -155,14 +156,14 @@ PRIVATE int remote_session ARGS2(char *, acc_method, char *, host)
 #if	!defined(TELNET_DONE) && (defined(NeXT) && defined(NeXTSTEP) && NeXTSTEP<=20100)
 #define FMT_TELNET "%s%s%s %s %s"
 
-#ifdef TELNET_PATH
-	HTAddParam(&command, FMT_TELNET, 1, TELNET_PATH);
-	HTOptParam(&command, FMT_TELNET, 2, user ? " -l " : "");
-	HTAddParam(&command, FMT_TELNET, 3, user);
-	HTAddParam(&command, FMT_TELNET, 4, hostname);
-	HTAddParam(&command, FMT_TELNET, 5, port);
-	HTEndParam(&command, FMT_TELNET, 5);
-#endif
+	if ((program = HTGetProgramPath(ppTELNET)) != NULL) {
+	    HTAddParam(&command, FMT_TELNET, 1, program);
+	    HTOptParam(&command, FMT_TELNET, 2, user ? " -l " : "");
+	    HTAddParam(&command, FMT_TELNET, 3, user);
+	    HTAddParam(&command, FMT_TELNET, 4, hostname);
+	    HTAddParam(&command, FMT_TELNET, 5, port);
+	    HTEndParam(&command, FMT_TELNET, 5);
+	}
 	do_system(command);
 #define TELNET_DONE
 #endif
@@ -176,31 +177,31 @@ PRIVATE int remote_session ARGS2(char *, acc_method, char *, host)
 
 	switch (login_protocol) {
 	case rlogin:
-#ifdef RLOGIN_PATH
-	    HTAddParam(&command, FMT_RLOGIN, 1, RLOGIN_PATH);
-	    HTAddParam(&command, FMT_RLOGIN, 2, hostname);
-	    HTOptParam(&command, FMT_RLOGIN, 3, user ? " -l " : "");
-	    HTAddParam(&command, FMT_RLOGIN, 4, user);
-	    HTEndParam(&command, FMT_RLOGIN, 4);
-#endif
+	    if ((program = HTGetProgramPath(ppRLOGIN)) != NULL) {
+		HTAddParam(&command, FMT_RLOGIN, 1, program);
+		HTAddParam(&command, FMT_RLOGIN, 2, hostname);
+		HTOptParam(&command, FMT_RLOGIN, 3, user ? " -l " : "");
+		HTAddParam(&command, FMT_RLOGIN, 4, user);
+		HTEndParam(&command, FMT_RLOGIN, 4);
+	    }
 	    break;
 
 	case tn3270:
-#ifdef TN3270_PATH
-	    HTAddParam(&command, FMT_TN3270, 1, TN3270_PATH);
-	    HTAddParam(&command, FMT_TN3270, 2, hostname);
-	    HTAddParam(&command, FMT_TN3270, 3, port);
-	    HTEndParam(&command, FMT_TN3270, 3);
-#endif
+	    if ((program = HTGetProgramPath(ppTN3270)) != NULL) {
+		HTAddParam(&command, FMT_TN3270, 1, program);
+		HTAddParam(&command, FMT_TN3270, 2, hostname);
+		HTAddParam(&command, FMT_TN3270, 3, port);
+		HTEndParam(&command, FMT_TN3270, 3);
+	    }
 	    break;
 
 	case telnet:
-#ifdef TELNET_PATH
-	    HTAddParam(&command, FMT_TELNET, 1, TELNET_PATH);
-	    HTAddParam(&command, FMT_TELNET, 2, hostname);
-	    HTAddParam(&command, FMT_TELNET, 3, port);
-	    HTEndParam(&command, FMT_TELNET, 3);
-#endif
+	    if ((program = HTGetProgramPath(ppTELNET)) != NULL) {
+		HTAddParam(&command, FMT_TELNET, 1, program);
+		HTAddParam(&command, FMT_TELNET, 2, hostname);
+		HTAddParam(&command, FMT_TELNET, 3, port);
+		HTEndParam(&command, FMT_TELNET, 3);
+	    }
 	    break;
 	}
 
diff --git a/WWW/Library/Implementation/HTUtils.h b/WWW/Library/Implementation/HTUtils.h
index 8b097216..a5038dc3 100644
--- a/WWW/Library/Implementation/HTUtils.h
+++ b/WWW/Library/Implementation/HTUtils.h
@@ -180,7 +180,7 @@ typedef unsigned short mode_t;
 #endif
 
 #if defined(UNIX)
-#  if (defined(__BEOS__) || defined(__CYGWIN__) || defined(__EMX__))
+#  if (defined(__BEOS__) || defined(__CYGWIN__) || defined(__DJGPP__) || defined(__EMX__))
 #    define SINGLE_USER_UNIX	/* well, at least they try */
 #  else
 #    define MULTI_USER_UNIX
@@ -323,6 +323,8 @@ Macros for declarations
 #define NULL ((void *)0)
 #endif
 
+#define isEmpty(s)   ((s) == 0 || *(s) == 0)
+
 #define NonNull(s) (((s) != 0) ? s : "")
 #define NONNULL(s) (((s) != 0) ? s : "(null)")
 
@@ -332,6 +334,9 @@ Macros for declarations
 #define	typecalloc(cast)		(cast *)calloc(1,sizeof(cast))
 #define	typecallocn(cast,ntypes)	(cast *)calloc(ntypes,sizeof(cast))
 
+#define typeMalloc(cast)                (cast *)malloc(sizeof(cast))
+#define typeMallocn(cast,ntypes)        (cast *)malloc(ntypes*sizeof(cast))
+
 /*
 
 OFTEN USED INTEGER MACROS
diff --git a/WWW/Library/Implementation/SGML.c b/WWW/Library/Implementation/SGML.c
index a11532c2..023aeb8d 100644
--- a/WWW/Library/Implementation/SGML.c
+++ b/WWW/Library/Implementation/SGML.c
@@ -29,6 +29,7 @@
 
 #include <LYCharSets.h>
 #include <LYCharVals.h>	 /* S/390 -- gil -- 0635 */
+#include <LYGlobalDefs.h>
 #include <LYStrings.h>
 #include <LYLeaks.h>
 
@@ -43,11 +44,6 @@
 
 #ifdef USE_PRETTYSRC
 
-#  define PSRC(x) if (psrc_view) { x };
-#  define NPSRC(x) if (!psrc_view) { x };
-#  define IFDEFPSRC(x) x
-#  define IFNDEFPSRC(x)
-
 char* entity_string; /* this is used for printing entity name.
     Unconditionally added since redundant assigments don't hurt much*/
 
@@ -62,11 +58,6 @@ PRIVATE void fake_put_character ARGS2(
 
 #define PUTS_TR(x) psrc_convert_string = TRUE; PUTS(x)
 
-#else
-#  define PSRC(x)
-#  define NPSRC(x)
-#  define IFDEFPSRC(x)
-#  define IFNDEFPSRC(x) x
 #endif
 
  /* will use an inlined version */
@@ -77,14 +68,16 @@ PRIVATE void fake_put_character ARGS2(
 	ch->allocated = ch->allocated + ch->growby;\
 	ch->data = ch->data ? (char *)realloc(ch->data, ch->allocated)\
 			    : typecallocn(char, ch->allocated);\
-      if (!ch->data)\
-	  outofmem(__FILE__, "HTChunkPutc");\
+	if (!ch->data)\
+	    outofmem(__FILE__, "HTChunkPutc");\
     }\
     ch->data[ch->size++] = c;
 #endif
 
 #define PUTS(str) ((*context->actions->put_string)(context->target, str))
-
+#define PUTC(ch)  ((*context->actions->put_character)(context->target, ch))
+#define PUTUTF8(code) (UCPutUtf8_charstring((HTStream *)context->target, \
+		      (putc_func_t*)(context->actions->put_character), code))
 
 #define OPT 1
 
@@ -98,8 +91,6 @@ PUBLIC BOOL HTPassEightBitNum = FALSE;	/* Pass ^ numeric entities raw. */
 PUBLIC BOOL HTPassHighCtrlRaw = FALSE;	/* Pass 127-160,173,&#127; raw. */
 PUBLIC BOOL HTPassHighCtrlNum = FALSE;	/* Pass &#128;-&#159; raw.	*/
 
-/*  extern int LYlowest_eightbit[];  for completeness here  */
-
 /*	The State (context) of the parser
 **
 **	This is passed with each call to make the parser reentrant
@@ -281,6 +272,27 @@ PRIVATE char *state_name ARGS1(sgml_state, n)
 }
 #endif
 
+/* storage for Element Stack */
+#define DEPTH 10
+static HTElement pool[DEPTH];
+static int depth = 0;
+
+PRIVATE HTElement* pool_get NOARGS
+{
+    depth++;
+    if (depth > DEPTH)
+	return (HTElement*) malloc(sizeof(HTElement));
+    return (pool + depth - 1);
+}
+
+PRIVATE void pool_free ARGS1(HTElement*, e)
+{
+    if (depth > DEPTH)
+	FREE(e);
+    depth--;
+    return;
+}
+
 #ifdef USE_PRETTYSRC
 
 PRIVATE void HTMLSRC_apply_markup ARGS3(
@@ -319,10 +331,10 @@ PRIVATE void HTMLSRC_apply_markup ARGS3(
 
 #if ANSI_PREPRO
 #  define PSRCSTART(x)	HTMLSRC_apply_markup(context,HTL_##x,START)
-#  define PSRCSTOP(x)  HTMLSRC_apply_markup(context,HTL_##x,STOP)
+#  define PSRCSTOP(x)   HTMLSRC_apply_markup(context,HTL_##x,STOP)
 #else
 #  define PSRCSTART(x)	HTMLSRC_apply_markup(context,HTL_/**/x,START)
-#  define PSRCSTOP(x)  HTMLSRC_apply_markup(context,HTL_/**/x,STOP)
+#  define PSRCSTOP(x)   HTMLSRC_apply_markup(context,HTL_/**/x,STOP)
 #endif
 
 #define attr_is_href context->cur_attr_is_href
@@ -431,17 +443,9 @@ PRIVATE void change_chartrans_handling ARGS1(
     }
 }
 
-#define PUTC(ch) ((*context->actions->put_character)(context->target, ch))
-#define PUTUTF8(code) (UCPutUtf8_charstring((HTStream *)context->target, \
-		      (putc_func_t*)(context->actions->put_character), code))
-
-extern BOOL historical_comments;
-extern BOOL minimal_comments;
-extern BOOL soft_dquotes;
-
 #ifdef USE_COLOR_STYLE
 #include <AttrList.h>
-static int current_is_class=0;
+static int current_is_class = 0;
 #endif
 
 /*	Handle Attribute
@@ -453,7 +457,6 @@ PRIVATE void handle_attribute_name ARGS2(
 	HTStream *,	context,
 	CONST char *,	s)
 {
-
     HTTag * tag = context->current_tag;
     attr * attributes = tag->attributes;
     int high, low, i, diff;
@@ -486,25 +489,23 @@ PRIVATE void handle_attribute_name ARGS2(
 	if (diff == 0) {		/* success: found it */
 	    context->current_attribute_number = i;
 #ifdef USE_PRETTYSRC
-	    if (!psrc_view) {
+	    if (psrc_view) {
+		attr_is_name = (BOOL) (attributes[i].type == HTMLA_ANAME);
+		attr_is_href = (BOOL) (attributes[i].type == HTMLA_HREF);
+	    } else
 #endif
+	    {
 	    context->present[i] = YES;
 	    FREE(context->value[i]);
 #ifdef USE_COLOR_STYLE
-#  ifdef USE_PRETTYSRC
+#   ifdef USE_PRETTYSRC
 	    current_is_class = IS_C(attributes[i]);
 #   else
 	    current_is_class = (!strcasecomp("class", s));
 #   endif
 	    CTRACE((tfp, "SGML: found attribute %s, %d\n", s, current_is_class));
 #endif
-
-#ifdef USE_PRETTYSRC
-	    } else {
-		 attr_is_name = (BOOL) (attributes[i].type == HTMLA_ANAME);
-		 attr_is_href = (BOOL) (attributes[i].type == HTMLA_HREF);
 	    }
-#endif
 	    return;
 	} /* if */
 
@@ -623,6 +624,27 @@ PRIVATE BOOL put_special_unicodes ARGS2(
     return YES;
 }
 
+#ifdef USE_PRETTYSRC
+PRIVATE void put_pretty_entity ARGS2(HTStream *, context, int, term)
+{
+    PSRCSTART(entity);
+    PUTC('&');
+    PUTS(entity_string);
+    if (term)
+	PUTC(term);
+    PSRCSTOP(entity);
+}
+
+PRIVATE void put_pretty_number ARGS1(HTStream *, context)
+{
+    PSRCSTART(entity);
+    PUTS( (context->isHex ? "&#x" : "&#") );
+    PUTS(entity_string);
+    PUTC(';');
+    PSRCSTOP(entity);
+}
+#endif /* USE_PRETTYSRC */
+
 /*	Handle entity
 **	-------------
 **
@@ -646,10 +668,8 @@ PRIVATE void handle_entity ARGS2(
 {
     UCode_t code;
     long uck = -1;
-    CONST char *p;
     CONST char *s = context->string->data;
 
-
     /*
     **	Handle all entities normally. - FM
     */
@@ -662,12 +682,7 @@ PRIVATE void handle_entity ARGS2(
 	if (put_special_unicodes(context, code)) {
 #ifdef USE_PRETTYSRC
 	    if (psrc_view) {
-		HTMLSRC_apply_markup(context,HTL_entity,START);
-		PUTC('&');
-		PUTS(entity_string);
-		if (term)
-		    PUTC(term);
-		HTMLSRC_apply_markup(context,HTL_entity,STOP);
+		put_pretty_entity(context, term);
 	    }
 #endif
 	    FoundEntity = TRUE;
@@ -683,9 +698,7 @@ PRIVATE void handle_entity ARGS2(
 	     uck >= LYlowest_eightbit[context->outUCLYhndl])) {
 #ifdef USE_PRETTYSRC
 	    if (psrc_view) {
-		HTMLSRC_apply_markup(context,HTL_entity,START);
-		PUTC('&'); PUTS(entity_string); if (term) PUTC(term);
-		HTMLSRC_apply_markup(context,HTL_entity,STOP);
+		put_pretty_entity(context, term);
 	    } else
 #endif
 	    PUTC(FROMASCII((char)uck));
@@ -701,16 +714,10 @@ PRIVATE void handle_entity ARGS2(
 					    context->outUCLYhndl, 0) >= 0)) {
 #ifdef USE_PRETTYSRC
 	    if (psrc_view) {
-		HTMLSRC_apply_markup(context,HTL_entity,START);
-		PUTC('&');
-		PUTS(entity_string);
-		if (term)
-		    PUTC(term);
-		HTMLSRC_apply_markup(context,HTL_entity,STOP);
+		put_pretty_entity(context, term);
 	    } else
 #endif
-	    for (p = replace_buf; *p; p++)
-		PUTC(*p);
+	    PUTS(replace_buf);
 	    FoundEntity = TRUE;
 	    return;
 	}
@@ -728,9 +735,7 @@ PRIVATE void handle_entity ARGS2(
 	      (putc_func_t*)(fake_put_character), code)): PUTUTF8(code) ) ) {
 
 	    if (psrc_view) {
-		HTMLSRC_apply_markup(context,HTL_entity,START);
-		PUTC('&'); PUTS(entity_string); if (term) PUTC(term);
-		HTMLSRC_apply_markup(context,HTL_entity,STOP);
+		put_pretty_entity(context, term);
 	    }
 
 	    FoundEntity = TRUE;
@@ -743,12 +748,7 @@ PRIVATE void handle_entity ARGS2(
 	if (code >= 32 && code < 127) {
 #ifdef USE_PRETTYSRC
 	    if (psrc_view) {
-		HTMLSRC_apply_markup(context,HTL_entity,START);
-		PUTC('&');
-		PUTS(entity_string);
-		if (term)
-		    PUTC(term);
-		HTMLSRC_apply_markup(context,HTL_entity,STOP);
+		put_pretty_entity(context, term);
 	    } else
 #endif
 
@@ -767,12 +767,7 @@ PRIVATE void handle_entity ARGS2(
 	    CTRACE((tfp, "handle_entity: Ignoring '%s'.\n", s));
 #ifdef USE_PRETTYSRC
 	    if (psrc_view) {
-		HTMLSRC_apply_markup(context,HTL_entity,START);
-		PUTC('&');
-		PUTS(entity_string);
-		if (term)
-		    PUTC(term);
-		HTMLSRC_apply_markup(context,HTL_entity,STOP);
+		put_pretty_entity(context, term);
 	    }
 #endif
 	    FoundEntity = TRUE;
@@ -786,12 +781,7 @@ PRIVATE void handle_entity ARGS2(
 	    CTRACE((tfp, "handle_entity: Ignoring '%s'.\n", s));
 #ifdef USE_PRETTYSRC
 	    if (psrc_view) {
-		HTMLSRC_apply_markup(context,HTL_entity,START);
-		PUTC('&');
-		PUTS(entity_string);
-		if (term)
-		    PUTC(term);
-		HTMLSRC_apply_markup(context,HTL_entity,STOP);
+		put_pretty_entity(context, term);
 	    }
 #endif
 	    FoundEntity = TRUE;
@@ -808,9 +798,7 @@ PRIVATE void handle_entity ARGS2(
 #endif
     CTRACE((tfp, "SGML: Unknown entity '%s' %ld %ld\n", s, (long)code, uck)); /* S/390 -- gil -- 0695 */
     PUTC('&');
-    for (p = s; *p; p++) {
-	PUTC(*p);
-    }
+    PUTS(s);
     if (term != '\0')
 	PUTC(term);
 #ifdef USE_PRETTYSRC
@@ -992,8 +980,6 @@ PRIVATE BOOL element_valid_within ARGS3(
 		(stacked_tag->tagclass & usecontained));
 }
 
-extern BOOL Old_DTD;
-
 typedef enum {
     close_NO	= 0,
     close_error = 1,
@@ -1034,7 +1020,7 @@ PRIVATE void do_close_stacked ARGS1(
 	e,
 	(char **)&context->include);
     context->element_stack = stacked->next;
-    FREE(stacked);
+    pool_free(stacked);
     context->no_lynx_specialcodes = context->element_stack ?
 	(context->element_stack->tag->flags & Tgf_nolyspcl) : NO;
 }
@@ -1179,7 +1165,7 @@ PRIVATE void end_element ARGS2(
 	    context->element_stack->tag = ALT_TAGP_OF_TAGNUM(e);
 	} else {
 	    context->element_stack = N->next;		/* Remove from stack */
-	    FREE(N);
+	    pool_free(N);
 	}
 	context->no_lynx_specialcodes = context->element_stack ?
 	    (context->element_stack->tag->flags & Tgf_nolyspcl) : NO;
@@ -1321,7 +1307,7 @@ PRIVATE void start_element ARGS1(
 		*/
 		CTRACE((tfp, "SGML: ***Faking SELECT end tag before <%s> start tag.\n",
 			    new_tag->name));
-		end_element(context, SGMLFindTag(context->dtd, "SELECT"));
+		end_element(context, SGMLFindUprTag(context->dtd, "SELECT"));
 	    } else {
 		/*
 		**  Ignore the start tag. - FM
@@ -1346,7 +1332,7 @@ PRIVATE void start_element ARGS1(
     if (status == HT_PARSER_OTHER_CONTENT)
 	new_tag = ALT_TAGP(new_tag);	/* this is only returned for OBJECT */
     if (new_tag->contents != SGML_EMPTY) {		/* i.e., tag not empty */
-	HTElement * N = (HTElement *)malloc(sizeof(HTElement));
+	HTElement * N = pool_get();
 	if (N == NULL)
 	    outofmem(__FILE__, "start_element");
 	N->next = context->element_stack;
@@ -1368,14 +1354,14 @@ PRIVATE void start_element ARGS1(
 **
 ** On entry,
 **	dtd	points to dtd structure including valid tag list
-**	string	points to name of tag in question
+**	string	points to name of uppercased tag in question
 **
 ** On exit,
 **	returns:
 **		NULL		tag not found
 **		else		address of tag structure in dtd
 */
-PUBLIC HTTag * SGMLFindTag ARGS2(
+PUBLIC HTTag * SGMLFindUprTag ARGS2(
 	CONST SGML_dtd*,	dtd,
 	CONST char *,		string)
 {
@@ -1385,7 +1371,7 @@ PUBLIC HTTag * SGMLFindTag ARGS2(
 	 high > low;
 	 diff < 0 ? (low = i+1) : (high = i)) {	 /* Binary search */
 	i = (low + (high-low)/2);
-	diff = AS_casecomp(dtd->tags[i].name, string);	/* Case insensitive */
+	diff = AS_cmp(dtd->tags[i].name, string);	/* Case sensitive */
 	if (diff == 0) {		/* success: found it */
 	    return &dtd->tags[i];
 	}
@@ -1399,6 +1385,28 @@ PUBLIC HTTag * SGMLFindTag ARGS2(
     return NULL;
 }
 
+/*		Find Tag in DTD tag list
+**		------------------------
+**
+** On entry,
+**	dtd	points to dtd structure including valid tag list
+**	string	points to name of tag in question
+**
+** On exit,
+**	returns:
+**		NULL		tag not found
+**		else		address of tag structure in dtd
+*/
+PUBLIC HTTag * SGMLFindTag ARGS2(
+	CONST SGML_dtd*,	dtd,
+	char *,			string)
+{
+    char * p = string;
+    for ( ; *p; p++)
+	*p = TOUPPER(*p);
+    return SGMLFindUprTag(dtd, string);
+}
+
 /*________________________________________________________________________
 **			Public Methods
 */
@@ -1430,7 +1438,7 @@ PRIVATE void SGML_free ARGS1(
 	cur = context->element_stack;
 	t = cur->tag;
 	context->element_stack = cur->next;	/* Remove from stack */
-	FREE(cur);
+	pool_free(cur);
 #ifdef USE_PRETTYSRC
 	if (!psrc_view) /* Don't actually call on target if viewing psrc - kw */
 #endif
@@ -1454,7 +1462,7 @@ PRIVATE void SGML_free ARGS1(
     FREE(context);
 
 #ifdef USE_PRETTYSRC
-    sgml_in_psrc_was_initialized =FALSE;
+    sgml_in_psrc_was_initialized = FALSE;
 #endif
 }
 
@@ -1485,7 +1493,7 @@ PRIVATE void SGML_abort ARGS2(
     while (context->element_stack) {
 	cur = context->element_stack;
 	context->element_stack = cur->next;	/* Remove from stack */
-	FREE(cur);
+	pool_free(cur);
     }
 
     /*
@@ -1497,9 +1505,8 @@ PRIVATE void SGML_abort ARGS2(
     FREE(context);
 
 #ifdef USE_PRETTYSRC
-    sgml_in_psrc_was_initialized =FALSE;
+    sgml_in_psrc_was_initialized = FALSE;
 #endif
-
 }
 
 
@@ -1533,7 +1540,6 @@ PRIVATE void SGML_character ARGS2(
     CONST SGML_dtd *dtd =	context->dtd;
     HTChunk	*string =	context->string;
     CONST char * EntityName;
-    char * p;
     HTTag * testtag = NULL;
     BOOLEAN chk;	/* Helps (?) walk through all the else ifs... */
     UCode_t clong, uck = 0; /* Enough bits for UCS4 ... */
@@ -1697,8 +1703,7 @@ PRIVATE void SGML_character ARGS2(
 	    c = replace_buf[0];
 	    if (c && replace_buf[1]) {
 		if (context->state == S_text) {
-		    for (p = replace_buf; *p; p++)
-			PUTC(*p);
+		    PUTS(replace_buf);
 		    return;
 		}
 		StrAllocCat(context->recover, replace_buf + 1);
@@ -1803,7 +1808,7 @@ top1:
     /*
     **	Handle character based on context->state.
     */
-    CTRACE2(TRACE_SGML, (tfp, "SGML before %s|%.*s|%c\n",
+    CTRACE2(TRACE_SGML, (tfp, "SGML before %s|%.*s|%c|\n",
 	    state_name(context->state),
 	    string->size,
 	    NonNull(string->data),
@@ -1897,7 +1902,7 @@ top1:
 	    if (testtag && testtag->contents == SGML_PCDATA) {
 		context->state = S_pcdata;
 	    } else if (testtag && (testtag->contents == SGML_LITTERAL
-	    			|| testtag->contents == SGML_CDATA)) {
+				|| testtag->contents == SGML_CDATA)) {
 		context->state = S_litteral;
 	    } else if (testtag && (testtag->contents == SGML_SCRIPT)) {
 		context->state = S_script;
@@ -2026,8 +2031,7 @@ top1:
 	    **	No further tests for validity - assume that whoever
 	    **	defined replacement strings knew what she was doing. - KW
 	    */
-	    for (p = replace_buf; *p; p++)
-		PUTC(*p);
+	    PUTS(replace_buf);
 	/*
 	**  If we're displaying UTF-8, try that now. - FM
 	*/
@@ -2050,15 +2054,13 @@ top1:
 	} else if (unsign_c > 160 && unsign_c < 256 &&
 		   !(PASSHI8BIT || HTCJK != NOCJK) &&
 		   !IncludesLatin1Enc) {
-	    int i;
 #ifdef USE_PRETTYSRC
 	    int psrc_view_backup = 0;
 #endif
 
 	    string->size = 0;
 	    EntityName = HTMLGetEntityName((int)(unsign_c - 160));
-	    for (i = 0; EntityName[i]; i++)
-		HTChunkPutc(string, EntityName[i]);
+	    HTChunkPuts(string, EntityName);
 	    HTChunkTerminate(string);
 #ifdef USE_PRETTYSRC
 	    /* we need to disable it temporary*/
@@ -2090,8 +2092,7 @@ top1:
 	**  already, but what the heck, try again. - FM
 	*/
 	} else if (context->T.output_utf8 && *context->utf_buf) {
-	    for (p = context->utf_buf; *p; p++)
-		PUTC(*p);
+	    PUTS(context->utf_buf);
 	    context->utf_buf_p = context->utf_buf;
 	    *(context->utf_buf_p) = '\0';
 #ifdef NOTDEFINED
@@ -2115,47 +2116,6 @@ top1:
 	} else if (TOASCII(UCH(c)) <	 /* S/390 -- gil -- 0997 */
 			LYlowest_eightbit[context->outUCLYhndl] ||
 		   (context->T.trans_from_uni && !HTPassEightBitRaw)) {
-#ifdef NOTUSED_FOTEMODS
-	    /*
-	    **	If we do not have the "7-bit approximations" as our
-	    **	output character set (in which case we did it already)
-	    **	seek a translation for that.  Otherwise, or if the
-	    **	translation fails, use UHHH notation. - FM
-	    */
-	    if ((chk = (context->outUCLYhndl !=
-			UCGetLYhndl_byMIME("us-ascii"))) &&
-		(uck = UCTransUniChar(unsign_c,
-				      UCGetLYhndl_byMIME("us-ascii")))
-				      >= ' ' && TOASCII(uck) < 127) {  /* S/390 -- gil -- 1008 */
-		/*
-		**  Got an ASCII character (yippey). - FM
-		*/
-		PUTC(((char)FROMASCII(TOASCII(uck) & 0xff)));
-	    } else if ((chk && uck == -4) &&
-		       (uck = UCTransUniCharStr(replace_buf,
-						60, clong,
-						UCGetLYhndl_byMIME("us-ascii"),
-						0) >= 0)) {
-		/*
-		**  Got a replacement string (yippey). - FM
-		*/
-		for (p = replace_buf; *p; p++)
-		    PUTC(*p);
-	    } else {
-#endif /* NOTUSED_FOTEMODS */
-		/*
-		**  Out of luck, so use the UHHH notation (ugh). - FM
-		*/
-			/* S/390 -- gil -- 1018 */
-			/* do not print UHHH for now
-		sprintf(replace_buf, "U%.2lX", TOASCII(unsign_c));
-		for (p = replace_buf; *p; p++) {
-		    PUTC(*p);
-		}
-			 */
-#ifdef NOTUSED_FOTEMODS
-	    }
-#endif /* NOTUSED_FOTEMODS */
 	/*
 	**  If we get to here, pass the character. - FM
 	*/
@@ -2188,7 +2148,9 @@ top1:
 			"SGML: Found PI in PCDATA, junking it until '>'\n"));
 #ifdef USE_PRETTYSRC
 		if (psrc_view) {
-		    PSRCSTART(abracket);PUTS("<?");PSRCSTOP(abracket);
+		    PSRCSTART(abracket);
+		    PUTS("<?");
+		    PSRCSTOP(abracket);
 		    context->seen_nonwhite_in_junk_tag = TRUE; /* show all */
 		}
 #endif
@@ -2248,7 +2210,9 @@ top1:
 		string->size > 1 && !testtag->name[string->size-2]) {
 #ifdef USE_PRETTYSRC
 		if (psrc_view) {
-		    PSRCSTART(abracket);PUTC('<');PUTC('/');PSRCSTOP(abracket);
+		    PSRCSTART(abracket);
+		    PUTS("</");
+		    PSRCSTOP(abracket);
 		    PSRCSTART(tag);
 		    strcpy(string->data,context->current_tag->name);
 		    if (tagname_transform != 1) {
@@ -2259,7 +2223,9 @@ top1:
 		    }
 		    PUTS(string->data);
 		    PSRCSTOP(tag);
-		    PSRCSTART(abracket);PUTC('>');PSRCSTOP(abracket);
+		    PSRCSTART(abracket);
+		    PUTC('>');
+		    PSRCSTOP(abracket);
 
 		    context->current_tag = NULL;
 		    string->size = 0;
@@ -2398,9 +2364,9 @@ top1:
 	    */
 #ifdef USE_PRETTYSRC
 	    if (psrc_view && FoundEntity && c == ';') {
-		HTMLSRC_apply_markup(context,HTL_entity, START);
+		PSRCSTART(entity);
 		PUTC(c);
-		HTMLSRC_apply_markup(context,HTL_entity, STOP);
+		PSRCSTOP(entity);
 	    }
 #endif
 	    if (!FoundEntity || c != ';')
@@ -2464,9 +2430,7 @@ top1:
 	    if (psrc_view)
 		PSRCSTART(badseq);
 #endif
-	    PUTC('&');
-	    PUTC('#');
-	    PUTC('x');
+	    PUTS("&#x");
 #ifdef USE_PRETTYSRC
 	    if (psrc_view)
 		PSRCSTOP(badseq);
@@ -2695,11 +2659,7 @@ top1:
 		    PUTC(FROMASCII((char)uck));
 #ifdef USE_PRETTYSRC
 		    } else {
-			PSRCSTART(entity);
-			PUTS( (context->isHex ? "&#x" : "&#") );
-			PUTS(entity_string);
-			PUTC(';');
-			PSRCSTOP(entity);
+			put_pretty_number(context);
 		    }
 #endif
 		} else if ((uck == -4 ||
@@ -2713,68 +2673,15 @@ top1:
 						    0) >= 0)) {
 #ifdef USE_PRETTYSRC
 		    if (psrc_view) {
-			PSRCSTART(entity);
-			PUTS( (context->isHex ? "&#x" : "&#") );
-			PUTS(entity_string);
-			PUTC(';');
-			PSRCSTOP(entity);
+			put_pretty_number(context);
 		    } else
 #endif
-		    for (p = replace_buf; *p; p++) {
-			PUTC(*p);
-		    }
+		    PUTS(replace_buf);
 		/*
 		**  If we're displaying UTF-8, try that now. - FM
 		*/
 		} else if (context->T.output_utf8 && PUTUTF8(code)) {
 		    ;  /* do nothing more */
-#ifdef NOTUSED_FOTEMODS
-		/*
-		**  If the value is greater than 255 and we do not
-		**  have the "7-bit approximations" as our output
-		**  character set (in which case we did it already)
-		**  seek a translation for that. - FM
-		*/
-		} else if ((chk = ((code > 255) &&
-				   context->outUCLYhndl !=
-				   UCGetLYhndl_byMIME("us-ascii"))) &&
-			   (uck = UCTransUniChar(code,
-				   UCGetLYhndl_byMIME("us-ascii")))
-				  >= ' ' && uck < 127) {
-		    /*
-		    **	Got an ASCII character (yippey). - FM
-		    */
-#ifdef USE_PRETTYSRC
-		    if (psrc_view) {
-			PSRCSTART(entity);
-			PUTS( (context->isHex ? "&#x" : "&#") );
-			PUTS(entity_string);
-			PUTC(';');
-			PSRCSTOP(entity);
-		    } else
-#endif
-		    PUTC(((char)FROMASCII(uck & 0xff)));
-/* =============== work in ASCII above here ===============  S/390 -- gil -- 1118 */
-		} else if ((chk && uck == -4) &&
-			   (uck = UCTransUniCharStr(replace_buf,
-						    60, code,
-						UCGetLYhndl_byMIME("us-ascii"),
-						    0) >= 0)) {
-		    /*
-		    **	Got a replacement string (yippey). - FM
-		    */
-#ifdef USE_PRETTYSRC
-		    if (psrc_view) {
-			PSRCSTART(entity);
-			PUTS( (context->isHex ? "&#x" : "&#") );
-			PUTS(entity_string);
-			PUTC(';');
-			PSRCSTOP(entity);
-		    } else
-#endif
-		    for (p = replace_buf; *p; p++)
-			PUTC(*p);
-#endif /* NOTUSED_FOTEMODS */
 		/*
 		**  Ignore 8205 (zwj),
 		**  8206 (lrm), and 8207 (rln), if we get to here. - FM
@@ -2839,11 +2746,11 @@ top1:
 			    PSRCSTART(badseq);
 			}
 #endif
-			PUTC('&');
-			PUTC('#');
 			if (context->isHex) {
-			    PUTC('x');
+			    PUTS("&#x");
 			    context->isHex = FALSE;
+			} else {
+			    PUTS("&#");
 			}
 			string->size--;
 			for (i = 0; i < string->size; i++)	/* recover */
@@ -2865,11 +2772,7 @@ top1:
 		    */
 #ifdef USE_PRETTYSRC
 		    if (psrc_view) {
-			PSRCSTART(entity);
-			PUTS( (context->isHex ? "&#x" : "&#") );
-			PUTS(entity_string);
-			PUTC(';');
-			PSRCSTOP(entity);
+			put_pretty_number(context);
 		    } else
 #endif
 		    PUTC(FROMASCII((char)code));
@@ -2881,8 +2784,7 @@ top1:
 		    EntityName = HTMLGetEntityName(code);
 		    if (EntityName && EntityName[0] != '\0') {
 			string->size = 0;
-			for (i = 0; EntityName[i]; i++)
-			    HTChunkPutc(string, EntityName[i]);
+			HTChunkPuts(string, EntityName);
 			HTChunkTerminate(string);
 			handle_entity(context, '\0');
 			/*
@@ -2901,11 +2803,11 @@ top1:
 			if (psrc_view)
 			    PSRCSTART(badseq);
 #endif
-			PUTC('&');
-			PUTC('#');
 			if (context->isHex) {
-			    PUTC('x');
+			    PUTS("&#x");
 			    context->isHex = FALSE;
+			} else {
+			    PUTS("&#");
 			}
 			string->size--;
 			for (i = 0; i < string->size; i++)	/* recover */
@@ -2947,16 +2849,16 @@ top1:
 		if (psrc_view)
 		    PSRCSTART(badseq);
 #endif
-		PUTC('&');
-		PUTC('#');
+		if (context->isHex) {
+		    PUTS("&#x");
+		    context->isHex = FALSE;
+		} else {
+		    PUTS("&#");
+		}
 #ifdef USE_PRETTYSRC
 		if (psrc_view)
 		    PSRCSTOP(badseq);
 #endif
-		if (context->isHex) {
-		    PUTC('x');
-		    context->isHex = FALSE;
-		}
 		if (context->recover == NULL) {
 		    StrAllocCopy(context->recover, string->data);
 		    context->recover_index = 0;
@@ -3068,7 +2970,9 @@ top1:
 		    CTRACE((tfp, "SGML: Found PI, junking it until '>'\n"));
 #ifdef USE_PRETTYSRC
 		    if (psrc_view) {
-			PSRCSTART(abracket);PUTS("<?");PSRCSTOP(abracket);
+			PSRCSTART(abracket);
+			PUTS("<?");
+			PSRCSTOP(abracket);
 			context->seen_nonwhite_in_junk_tag = TRUE; /*show all*/
 		    }
 #endif
@@ -3080,7 +2984,9 @@ top1:
 
 #ifdef USE_PRETTYSRC
 		if (psrc_view) {
-		    PSRCSTART(abracket);PUTC('<');PSRCSTOP(abracket);
+		    PSRCSTART(abracket);
+		    PUTC('<');
+		    PSRCSTOP(abracket);
 		    PSRCSTART(badtag);
 		    if (tagname_transform != 1) {
 			if (tagname_transform == 0)
@@ -3091,7 +2997,9 @@ top1:
 		    PUTS(string->data);
 		    if (c == '>' ) {
 			PSRCSTOP(badtag);
-			PSRCSTART(abracket);PUTC('>');PSRCSTOP(abracket);
+			PSRCSTART(abracket);
+			PUTC('>');
+			PSRCSTOP(abracket);
 		    } else {
 			PUTC(c);
 		    }
@@ -3112,7 +3020,9 @@ top1:
 
 #ifdef USE_PRETTYSRC
 	    if (psrc_view) {
-		PSRCSTART(abracket);PUTC('<');PSRCSTOP(abracket);
+		PSRCSTART(abracket);
+		PUTC('<');
+		PSRCSTOP(abracket);
 		if (t != context->unknown_tag)
 		    PSRCSTART(tag);
 		else
@@ -3591,10 +3501,12 @@ top1:
 		}
 		PUTS(string->data);
 		if (c == '=' ) PUTC('=');
-		if (context->current_attribute_number == INVALID)
-		    PSRCSTOP(badattr);
-		else
-		    PSRCSTOP(attrib);
+		if (c == '=' || c == '>') {
+		    if (context->current_attribute_number == INVALID)
+			PSRCSTOP(badattr);
+		    else
+			PSRCSTOP(attrib);
+		}
 		if (c == '>') {
 		    PSRCSTART(abracket);
 		    PUTC('>');
@@ -3778,7 +3690,7 @@ top1:
 	    if (psrc_view) {
 		/*PSRCSTART(attrval);*/
 		if (attr_is_name) {
-		    HTStartAnchor(context->target,string->data,NULL);
+		    HTStartAnchor(context->target,string->data, NULL);
 		    (*context->actions->end_element)(
 			context->target,
 			HTML_A,
@@ -3842,7 +3754,7 @@ top1:
 	    if (psrc_view) {
 		/*PSRCSTART(attrval);*/
 		if (attr_is_name) {
-		    HTStartAnchor(context->target,string->data,NULL);
+		    HTStartAnchor(context->target,string->data, NULL);
 		    (*context->actions->end_element)(
 			context->target,
 			HTML_A,
@@ -3922,8 +3834,7 @@ top1:
 #ifdef USE_PRETTYSRC
 		if (psrc_view) {
 		    PSRCSTART(abracket);
-		    PUTC('<');
-		    PUTC('/');
+		    PUTS("</");
 		    PSRCSTOP(abracket);
 		    PSRCSTART(badtag);
 		    if (tagname_transform != 1) {
@@ -3937,7 +3848,9 @@ top1:
 			PUTC(c);
 		    } else {
 			PSRCSTOP(badtag);
-			PSRCSTART(abracket); PUTC('>'); PSRCSTOP(abracket);
+			PSRCSTART(abracket);
+			PUTC('>');
+			PSRCSTOP(abracket);
 		    }
 		    psrc_tagname_processed=TRUE;
 		}
@@ -4062,7 +3975,7 @@ top1:
 			    CTRACE((tfp, "SGML: ***Faking SELECT end tag before </%s> end tag.\n",
 					string->data));
 			    end_element(context,
-					SGMLFindTag(context->dtd, "SELECT"));
+					SGMLFindUprTag(context->dtd, "SELECT"));
 			    CTRACE((tfp, "SGML: End </%s>\n", string->data));
 
 #ifdef USE_PRETTYSRC
@@ -4121,8 +4034,7 @@ top1:
 #ifdef USE_PRETTYSRC
 	    if (psrc_view && !psrc_tagname_processed) {
 		PSRCSTART(abracket);
-		PUTC('<');
-		PUTC('/');
+		PUTS("</");
 		PSRCSTOP(abracket);
 		PSRCSTART(tag);
 		if (tagname_transform != 1) {
@@ -4131,7 +4043,8 @@ top1:
 		    else
 			LYUpperCase(string->data);
 		}
-		PUTS(string->data); PSRCSTOP(tag);
+		PUTS(string->data);
+		PSRCSTOP(tag);
 		if ( c != '>' ) {
 		    PSRCSTART(badtag);
 		    PUTC(c);
@@ -4331,7 +4244,7 @@ top1:
 #endif
 
     } /* switch on context->state */
-    CTRACE2(TRACE_SGML, (tfp, "SGML after  %s|%.*s|%c\n",
+    CTRACE2(TRACE_SGML, (tfp, "SGML after  %s|%.*s|%c|\n",
 	    state_name(context->state),
 	    string->size,
 	    NonNull(string->data),
diff --git a/WWW/Library/Implementation/SGML.h b/WWW/Library/Implementation/SGML.h
index 315b5ee1..9e84cf9f 100644
--- a/WWW/Library/Implementation/SGML.h
+++ b/WWW/Library/Implementation/SGML.h
@@ -250,13 +250,25 @@ Find a Tag by Name
    Returns a pointer to the tag within the DTD.
 
  */
-extern HTTag * SGMLFindTag PARAMS((
+extern HTTag * SGMLFindUprTag PARAMS((
 	CONST SGML_dtd *	dtd,
 	CONST char *		string));
 
 
 /*
 
+Find a Tag by Name
+
+   Returns a pointer to the tag within the DTD.
+
+ */
+extern HTTag * SGMLFindTag PARAMS((
+	CONST SGML_dtd *	dtd,
+	char *			string));
+
+
+/*
+
 Create an SGML parser
 
  */
@@ -276,7 +288,3 @@ extern HTStream * SGML_new PARAMS((
 extern CONST HTStreamClass SGMLParser;
 
 #endif	/* SGML_H */
-
-/*
-
-    */
diff --git a/WWW/Library/Implementation/www_tcp.h b/WWW/Library/Implementation/www_tcp.h
index b2aafd2b..11a4398f 100644
--- a/WWW/Library/Implementation/www_tcp.h
+++ b/WWW/Library/Implementation/www_tcp.h
@@ -549,11 +549,13 @@ extern int errno;
 #ifdef __DJGPP__
 #undef SELECT
 #define TCP_INCLUDES_DONE
-#define NO_IOCTL
+#undef  IOCTL
+#define IOCTL(s,cmd,arg) ioctlsocket(s,cmd,(char*)(arg))
 #define DECL_ERRNO
 #include <errno.h>
 #include <sys/types.h>
 #include <io.h>
+#include <sys/ioctl.h>
 #include <sys/socket.h>
 #include <arpa/inet.h>
 #include <tcp.h>
diff --git a/aclocal.m4 b/aclocal.m4
index be6997e8..0423b66a 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -4,9 +4,9 @@ dnl and Jim Spath <jspath@mail.bcpl.lib.md.us>
 dnl and Philippe De Muyter <phdm@macqel.be>
 dnl
 dnl Created: 1997/1/28
-dnl Updated: 2002/9/22
+dnl Updated: 2002/11/12
 dnl
-dnl The autoconf used in Lynx development is GNU autoconf, patched
+dnl The autoconf used in Lynx development is GNU autoconf 2.13, patched
 dnl by Tom Dickey.  See your local GNU archives, and this URL:
 dnl http://invisible-island.net/autoconf/autoconf.html
 dnl
@@ -37,7 +37,7 @@ strdup strtoul tsearch __argz_count __argz_stringify __argz_next])
    AM_ICONV
    AM_LANGINFO_CODESET
    AM_LC_MESSAGES
-   AM_WITH_NLS([$1],[$2],[$3])
+   AM_WITH_NLS([$1],[$2],[$3],[$4])
 
    if test "x$CATOBJEXT" != "x"; then
      if test "x$ALL_LINGUAS" = "x"; then
@@ -87,16 +87,15 @@ strdup strtoul tsearch __argz_count __argz_stringify __argz_next])
    dnl Enable libtool support if the surrounding package wishes it.
    INTL_LIBTOOL_SUFFIX_PREFIX=ifelse([$1], use-libtool, [l], [])
    AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX)
-  ])
+])dnl
 dnl ---------------------------------------------------------------------------
 dnl Inserted as requested by gettext 0.10.40
 dnl File from /usr/share/aclocal
 dnl iconv.m4
 dnl ====================
-#serial AM2
-
+dnl serial AM2
+dnl
 dnl From Bruno Haible.
-
 AC_DEFUN([AM_ICONV],
 [
   dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
@@ -161,16 +160,15 @@ size_t iconv();
     LIBICONV="-liconv"
   fi
   AC_SUBST(LIBICONV)
-])
+])dnl
 dnl ---------------------------------------------------------------------------
 dnl Inserted as requested by gettext 0.10.40
 dnl File from /usr/share/aclocal
 dnl codeset.m4
 dnl ====================
-#serial AM1
-
+dnl serial AM1
+dnl
 dnl From Bruno Haible.
-
 AC_DEFUN([AM_LANGINFO_CODESET],
 [
   AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset,
@@ -183,26 +181,26 @@ AC_DEFUN([AM_LANGINFO_CODESET],
     AC_DEFINE(HAVE_LANGINFO_CODESET, 1,
       [Define if you have <langinfo.h> and nl_langinfo(CODESET).])
   fi
-])
+])dnl
 dnl ---------------------------------------------------------------------------
 dnl Inserted as requested by gettext 0.10.40
 dnl File from /usr/share/aclocal
 dnl lcmessage.m4
 dnl ====================
-# Check whether LC_MESSAGES is available in <locale.h>.
-# Ulrich Drepper <drepper@cygnus.com>, 1995.
-#
-# This file can be copied and used freely without restrictions.  It can
-# be used in projects which are not available under the GNU General Public
-# License or the GNU Library General Public License but which still want
-# to provide support for the GNU gettext functionality.
-# Please note that the actual code of the GNU gettext library is covered
-# by the GNU Library General Public License, and the rest of the GNU
-# gettext package package is covered by the GNU General Public License.
-# They are *not* in the public domain.
-
-# serial 2
-
+dnl Check whether LC_MESSAGES is available in <locale.h>.
+dnl Ulrich Drepper <drepper@cygnus.com>, 1995.
+dnl
+dnl This file can be copied and used freely without restrictions.  It can
+dnl be used in projects which are not available under the GNU General Public
+dnl License or the GNU Library General Public License but which still want
+dnl to provide support for the GNU gettext functionality.
+dnl Please note that the actual code of the GNU gettext library is covered
+dnl by the GNU Library General Public License, and the rest of the GNU
+dnl gettext package package is covered by the GNU General Public License.
+dnl They are *not* in the public domain.
+dnl
+dnl serial 2
+dnl
 AC_DEFUN([AM_LC_MESSAGES],
   [if test $ac_cv_header_locale_h = yes; then
     AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
@@ -212,26 +210,26 @@ AC_DEFUN([AM_LC_MESSAGES],
       AC_DEFINE(HAVE_LC_MESSAGES, 1,
         [Define if your <locale.h> file defines LC_MESSAGES.])
     fi
-  fi])
+  fi])dnl
 dnl ---------------------------------------------------------------------------
 dnl Inserted as requested by gettext 0.10.40
 dnl File from /usr/share/aclocal
 dnl progtest.m4
 dnl ====================
-# Search path for a program which passes the given test.
-# Ulrich Drepper <drepper@cygnus.com>, 1996.
-#
-# This file can be copied and used freely without restrictions.  It can
-# be used in projects which are not available under the GNU General Public
-# License or the GNU Library General Public License but which still want
-# to provide support for the GNU gettext functionality.
-# Please note that the actual code of the GNU gettext library is covered
-# by the GNU Library General Public License, and the rest of the GNU
-# gettext package package is covered by the GNU General Public License.
-# They are *not* in the public domain.
-
-# serial 2
-
+dnl Search path for a program which passes the given test.
+dnl Ulrich Drepper <drepper@cygnus.com>, 1996.
+dnl
+dnl This file can be copied and used freely without restrictions.  It can
+dnl be used in projects which are not available under the GNU General Public
+dnl License or the GNU Library General Public License but which still want
+dnl to provide support for the GNU gettext functionality.
+dnl Please note that the actual code of the GNU gettext library is covered
+dnl by the GNU Library General Public License, and the rest of the GNU
+dnl gettext package package is covered by the GNU General Public License.
+dnl They are *not* in the public domain.
+dnl
+dnl serial 2
+dnl
 dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
 dnl   TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
 AC_DEFUN([AM_PATH_PROG_WITH_TEST],
@@ -269,27 +267,27 @@ else
   AC_MSG_RESULT(no)
 fi
 AC_SUBST($1)dnl
-])
+])dnl
 dnl ---------------------------------------------------------------------------
 dnl Inserted as requested by gettext 0.10.40
 dnl File from /usr/share/aclocal
 dnl gettext.m4
 dnl ====================
-# Macro to add for using GNU gettext.
-# Ulrich Drepper <drepper@cygnus.com>, 1995.
-#
-# This file can be copied and used freely without restrictions.  It can
-# be used in projects which are not available under the GNU General Public
-# License or the GNU Library General Public License but which still want
-# to provide support for the GNU gettext functionality.
-# Please note that the actual code of the GNU gettext library is covered
-# by the GNU Library General Public License, and the rest of the GNU
-# gettext package package is covered by the GNU General Public License.
-# They are *not* in the public domain.
-
-# serial 10
-
-dnl Usage: AM_WITH_NLS([TOOLSYMBOL], [NEEDSYMBOL], [LIBDIR]).
+dnl Macro to add for using GNU gettext.
+dnl Ulrich Drepper <drepper@cygnus.com>, 1995.
+dnl
+dnl This file can be copied and used freely without restrictions.  It can
+dnl be used in projects which are not available under the GNU General Public
+dnl License or the GNU Library General Public License but which still want
+dnl to provide support for the GNU gettext functionality.
+dnl Please note that the actual code of the GNU gettext library is covered
+dnl by the GNU Library General Public License, and the rest of the GNU
+dnl gettext package package is covered by the GNU General Public License.
+dnl They are *not* in the public domain.
+dnl
+dnl serial 10
+dnl
+dnl Usage: AM_WITH_NLS([TOOLSYMBOL], [NEEDSYMBOL], [LIBDIR], [ENABLED]).
 dnl If TOOLSYMBOL is specified and is 'use-libtool', then a libtool library
 dnl    $(top_builddir)/intl/libintl.la will be created (shared and/or static,
 dnl    depending on --{enable,disable}-{shared,static} and on the presence of
@@ -300,6 +298,8 @@ dnl    implementations (in libc or libintl) without the ngettext() function
 dnl    will be ignored.
 dnl LIBDIR is used to find the intl libraries.  If empty,
 dnl    the value `$(top_builddir)/intl/' is used.
+dnl ENABLED is used to control the default for the related --enable-nls, since
+dnl    not all application developers want this feature by default, e.g., lynx.
 dnl
 dnl The result of the configuration is one of three cases:
 dnl 1) GNU gettext, as included in the intl subdirectory, will be compiled
@@ -320,9 +320,13 @@ dnl
 AC_DEFUN([AM_WITH_NLS],
   [AC_MSG_CHECKING([whether NLS is requested])
     dnl Default is enabled NLS
+    ifelse([$4],,[
+    AC_ARG_ENABLE(nls,
+      [  --disable-nls           do not use Native Language Support],
+      USE_NLS=$enableval, USE_NLS=yes)],[
     AC_ARG_ENABLE(nls,
       [  --enable-nls            use Native Language Support],
-      USE_NLS=$enableval, USE_NLS=no)
+      USE_NLS=$enableval, USE_NLS=no)])
     AC_MSG_RESULT($USE_NLS)
     AC_SUBST(USE_NLS)
 
@@ -570,7 +574,7 @@ changequote([,])dnl
     dnl For backward compatibility. Some Makefiles may be using this.
     GENCAT=gencat
     AC_SUBST(GENCAT)
-  ])
+  ])dnl
 dnl ---------------------------------------------------------------------------
 dnl Copy non-preprocessor flags to $CFLAGS, preprocessor flags to $CPPFLAGS
 dnl The second parameter if given makes this macro verbose.
@@ -752,6 +756,7 @@ dnl Top-level macro for configuring an application with a bundled copy of
 dnl the intl and po directories for gettext.
 dnl
 dnl $1 specifies either Makefile or makefile, defaulting to the former.
+dnl $2 if nonempty sets the option to --enable-nls rather than to --disable-nls
 AC_DEFUN([CF_BUNDLED_INTL],[
 cf_makefile=ifelse($1,,Makefile,$1)
 
@@ -760,7 +765,7 @@ dnl setting $LINGUAS overrides $ALL_LINGUAS.  Some environments set $LINGUAS
 dnl rather than $LC_ALL
 test -z "$ALL_LINGUAS" && ALL_LINGUAS=`test -d $srcdir/po && cd $srcdir/po && echo *.po|sed -e 's/\.po//g' -e 's/*//'`
 
-AM_GNU_GETTEXT
+AM_GNU_GETTEXT(,,,[$2])
 
 INTLDIR_MAKE=
 MSG_DIR_MAKE=
@@ -1037,7 +1042,7 @@ if test $cf_cv_color_curses = yes ; then
 	AC_DEFINE(COLOR_CURSES)
 	test ".$cf_cv_ncurses_broken" != .yes && AC_DEFINE(HAVE_GETBKGD)
 fi
-])
+])dnl
 dnl ---------------------------------------------------------------------------
 dnl Look for the curses headers.
 AC_DEFUN([CF_CURSES_CPPFLAGS],[
@@ -1079,7 +1084,7 @@ fi
 # cheat, to get the right #define's for HAVE_NCURSES_H, etc.
 AC_CHECK_HEADERS($cf_cv_ncurses_header)
 
-])
+])dnl
 dnl ---------------------------------------------------------------------------
 dnl Curses-functions are a little complicated, since a lot of them are macros.
 AC_DEFUN([CF_CURSES_FUNCS],
@@ -1222,7 +1227,7 @@ if test ".$ac_cv_func_initscr" != .yes ; then
 fi
 fi
 
-])
+])dnl
 dnl ---------------------------------------------------------------------------
 dnl Solaris 2.x curses provides a "performance" tradeoff according to whether
 dnl CURS_PERFORMANCE is defined.  If defined, the implementation defines macros
@@ -1294,7 +1299,7 @@ AC_CACHE_VAL(cf_cv_$2,[
 	])
 AC_MSG_RESULT($cf_cv_$2)
 AC_DEFINE_UNQUOTED($2,"$cf_cv_$2")
-])
+])dnl
 dnl ---------------------------------------------------------------------------
 dnl "dirname" is not portable, so we fake it with a shell script.
 AC_DEFUN([CF_DIRNAME],[$1=`echo $2 | sed -e 's:/[[^/]]*$::'`])dnl
@@ -1353,7 +1358,7 @@ AC_CACHE_VAL(cf_cv_fancy_curses,[
 	])
 AC_MSG_RESULT($cf_cv_fancy_curses)
 test $cf_cv_fancy_curses = yes && AC_DEFINE(FANCY_CURSES)
-])
+])dnl
 dnl ---------------------------------------------------------------------------
 dnl Based on the IPV6 stack type, look for the corresponding library.
 AC_DEFUN([CF_FIND_IPV6_LIBS],[
@@ -1362,7 +1367,7 @@ AC_REQUIRE([CF_FIND_IPV6_TYPE])
 cf_ipv6lib=none
 cf_ipv6dir=none
 
-AC_MSG_CHECKING(for ipv6 library if required)
+AC_MSG_CHECKING(for IPv6 library if required)
 case $cf_cv_ipv6type in #(vi
 solaris) #(vi
 	;;
@@ -1428,7 +1433,7 @@ if test "$cf_ipv6lib" != "none"; then
 	if test $cf_found_library = no ; then
 		AC_MSG_ERROR(
 [No $cf_ipv6lib library found, cannot continue.  You must fetch lib$cf_ipv6lib.a
-from an appropriate ipv6 kit and compile beforehand.])
+from an appropriate IPv6 kit and compile beforehand.])
 	fi
 fi
 
@@ -1909,32 +1914,21 @@ test "$cf_cv_gnu_source" = yes && CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
 dnl ---------------------------------------------------------------------------
 dnl Construct a search-list for a nonstandard header-file
 AC_DEFUN([CF_HEADER_PATH],
-[$1=""
-
-test "$prefix" != /usr/local && \
-test -d /usr/local && \
-$1="[$]$1 /usr/local/include /usr/local/include/$2 /usr/local/$2/include"
-
+[CF_SUBDIR_PATH($1,$2,include)
 test "$includedir" != NONE && \
-test -d "$includedir" && \
-$1="[$]$1 $includedir $includedir/$2"
+test "$includedir" != "/usr/include" && \
+test -d "$includedir" && {
+	test -d $includedir &&    $1="[$]$1 $includedir"
+	test -d $includedir/$2 && $1="[$]$1 $includedir/$2"
+}
 
 test "$oldincludedir" != NONE && \
-test -d "$oldincludedir" && \
-$1="[$]$1 $oldincludedir $oldincludedir/$2"
-
-test "$prefix" != NONE && \
-test -d "$prefix" && \
-$1="[$]$1 $prefix/include $prefix/include/$2 $prefix/$2/include"
-
-test "$prefix" != /usr && \
-$1="[$]$1 /usr/include /usr/include/$2 /usr/$2/include"
-
-test "$prefix" != /opt && \
-test -d /opt && \
-$1="[$]$1 /opt/include /opt/include/$2 /opt/$2/include"
+test "$oldincludedir" != "/usr/include" && \
+test -d "$oldincludedir" && {
+	test -d $oldincludedir    && $1="[$]$1 $oldincludedir"
+	test -d $oldincludedir/$2 && $1="[$]$1 $oldincludedir/$2"
+}
 
-$1="[$]$1 [$]HOME/include [$]HOME/include/$2 [$]HOME/$2/include"
 ])dnl
 dnl ---------------------------------------------------------------------------
 dnl Insert text into the help-message, for readability, from AC_ARG_WITH.
@@ -2017,42 +2011,11 @@ AC_TRY_COMPILE([
 	fi])
 ])
 test $cf_cv_path_lastlog != no && AC_DEFINE(USE_LASTLOG)
-]
-)dnl
+])dnl
 dnl ---------------------------------------------------------------------------
 dnl Construct a search-list for a nonstandard library-file
 AC_DEFUN([CF_LIBRARY_PATH],
-[$1=""
-
-test "$prefix" != /usr/local && \
-test -d /usr/local && \
-$1="[$]$1 /usr/local/lib /usr/local/lib/$2 /usr/local/$2/lib"
-
-test "$libdir" != NONE && \
-test -d $libdir && \
-$1="[$]$1 $libdir $libdir/$2"
-
-test "$exec_prefix" != NONE && \
-test -d $exec_prefix && \
-$1="[$]$1 $exec_prefix/lib $exec_prefix/lib/$2"
-
-test "$prefix" != NONE && \
-test "$prefix" != "$exec_prefix" && \
-test -d $prefix && \
-$1="[$]$1 $prefix/lib $prefix/lib/$2 $prefix/$2/lib"
-
-test "$prefix" != /usr && \
-$1="[$]$1 /usr/lib /usr/lib/$2 /usr/$2/lib"
-
-test "$prefix" != / && \
-$1="[$]$1 /lib /lib/$2 /$2/lib"
-
-test "$prefix" != /opt && \
-test -d /opt && \
-$1="[$]$1 /opt/lib /opt/lib/$2 /opt/$2/lib"
-
-$1="[$]$1 [$]HOME/lib [$]HOME/lib/$2 [$]HOME/$2/lib"
-])dnl
+[CF_SUBDIR_PATH($1,$2,lib)])dnl
 dnl ---------------------------------------------------------------------------
 dnl Check if we've got setlocale() and its header, <locale.h>
 AC_DEFUN([CF_LOCALE],
@@ -2066,7 +2029,7 @@ AC_TRY_LINK([#include <locale.h>],
 	])
 AC_MSG_RESULT($cf_cv_locale)
 test $cf_cv_locale = yes && AC_DEFINE(LOCALE)
-])
+])dnl
 dnl ---------------------------------------------------------------------------
 dnl Write a debug message to config.log, along with the line number in the
 dnl configure script.
@@ -2121,11 +2084,17 @@ dnl The optional parameter gives the root name of the library, in case it is
 dnl not installed as the default curses library.  That is how the
 dnl wide-character version of ncurses is installed.
 AC_DEFUN([CF_NCURSES_CPPFLAGS],
-[
+[AC_REQUIRE([CF_WITH_CURSES_DIR])
+
 cf_ncuhdr_root=ifelse($1,,ncurses,$1)
+
+test -n "$cf_cv_curses_dir" && \
+test "$cf_cv_curses_dir" != "no" && \
+CPPFLAGS="-I$cf_cv_curses_dir/include -I$cf_cv_curses_dir/include/$cf_ncuhdr_root $CPPFLAGS"
+
 AC_CACHE_CHECK(for $cf_ncuhdr_root header in include-path, cf_cv_ncurses_h,[
 	cf_header_list="$cf_ncuhdr_root/curses.h $cf_ncuhdr_root/ncurses.h"
-	test "$cf_ncuhdr_root" = ncurses && cf_header_list="curses.h ncurses.h $cf_header_list"
+	( test "$cf_ncuhdr_root" = ncurses || test "$cf_ncuhdr_root" = ncursesw ) && cf_header_list="curses.h ncurses.h $cf_header_list"
 	for cf_header in $cf_header_list
 	do
 	AC_TRY_COMPILE([#include <$cf_header>],[
@@ -2148,8 +2117,9 @@ if test "$cf_cv_ncurses_h" != no ; then
 	cf_cv_ncurses_header=$cf_cv_ncurses_h
 else
 AC_CACHE_CHECK(for $cf_ncuhdr_root include-path, cf_cv_ncurses_h2,[
-	CF_HEADER_PATH(cf_search,$cf_ncuhdr_root)
 	test -n "$verbose" && echo
+	CF_HEADER_PATH(cf_search,$cf_ncuhdr_root)
+	test -n "$verbose" && echo search path $cf_search
 	for cf_incdir in $cf_search
 	do
 		for cf_header in \
@@ -2171,8 +2141,8 @@ AC_CACHE_CHECK(for $cf_ncuhdr_root include-path, cf_cv_ncurses_h2,[
 	CF_DIRNAME(cf_1st_incdir,$cf_cv_ncurses_h2)
 	CF_DIRNAME(cf_2nd_incdir,$cf_1st_incdir)
 	cf_cv_ncurses_header=`basename $cf_cv_ncurses_h2`
-	echo cf_1st_include=$cf_1st_incdir
-	echo cf_2nd_include=$cf_2nd_incdir
+	test -n "$verbose" && echo cf_1st_include=$cf_1st_incdir
+	test -n "$verbose" && echo cf_2nd_include=$cf_2nd_incdir
 	if test `basename $cf_1st_incdir` = $cf_ncuhdr_root ; then
 		cf_cv_ncurses_header=$cf_ncuhdr_root/$cf_cv_ncurses_header
 		CF_ADD_INCDIR($cf_2nd_incdir)
@@ -2235,10 +2205,17 @@ freebsd*)
 esac
 
 LIBS="$cf_ncurses_LIBS $LIBS"
-CF_FIND_LIBRARY($cf_nculib_root,$cf_nculib_root,
-	[#include <${cf_cv_ncurses_header-curses.h}>],
-	[initscr()],
-	initscr)
+
+
+if ( test -n "$cf_cv_curses_dir" && test "$cf_cv_curses_dir" != "no" )
+then
+	LIBS="-L$cf_cv_curses_dir/lib -l$cf_nculib_root $LIBS"
+else
+	CF_FIND_LIBRARY($cf_nculib_root,$cf_nculib_root,
+		[#include <${cf_cv_ncurses_header-curses.h}>],
+		[initscr()],
+		initscr)
+fi
 
 if test -n "$cf_ncurses_LIBS" ; then
 	AC_MSG_CHECKING(if we can link $cf_nculib_root without $cf_ncurses_LIBS)
@@ -2314,7 +2291,7 @@ EOF
 	rm -f $cf_tempfile
 ])
 test "$cf_cv_ncurses_version" = no || AC_DEFINE(NCURSES)
-])
+])dnl
 dnl ---------------------------------------------------------------------------
 dnl After checking for functions in the default $LIBS, make a further check
 dnl for the functions that are netlib-related (these aren't always in the
@@ -2522,7 +2499,7 @@ if test $cf_cv_lib_XCurses = yes ; then
 else
 	AC_ERROR(Cannot link with XCurses)
 fi
-])
+])dnl
 dnl ---------------------------------------------------------------------------
 dnl Re-check on a function to see if we can pick it up by adding a library.
 dnl	$1 = function to check
@@ -3022,6 +2999,60 @@ if test "$ac_cv_header_termios_h" = yes ; then
 fi
 ])dnl
 dnl ---------------------------------------------------------------------------
+dnl Construct a search-list for a nonstandard header/lib-file
+dnl	$1 = the variable to return as result
+dnl	$2 = the package name
+dnl	$3 = the subdirectory, e.g., bin, include or lib
+AC_DEFUN([CF_SUBDIR_PATH],
+[$1=""
+
+test -d [$]HOME && {
+	test -n "$verbose" && echo "	... testing $3-directories under [$]HOME"
+	test -d [$]HOME/$3 &&    $1="[$]$1 [$]HOME/$3"
+	test -d [$]HOME/$3/$2 && $1="[$]$1 [$]HOME/$3/$2"
+}
+
+# For other stuff under the home directory, it should be sufficient to put
+# a symbolic link for $HOME/$2 to the actual package location:
+test -d [$]HOME/$2 && {
+	test -n "$verbose" && echo "	... testing $3-directories under [$]HOME/$2"
+	test -d [$]HOME/$2/$3 &&    $1="[$]$1 [$]HOME/$2/$3"
+	test -d [$]HOME/$2/$3/$2 && $1="[$]$1 [$]HOME/$2/$3/$2"
+}
+
+test "$prefix" != /usr/local && \
+test -d /usr/local && {
+	test -n "$verbose" && echo "	... testing $3-directories under /usr/local"
+	test -d /usr/local/$3 &&    $1="[$]$1 /usr/local/$3"
+	test -d /usr/local/$3/$2 && $1="[$]$1 /usr/local/$3/$2"
+	test -d /usr/local/$2/$3 && $1="[$]$1 /usr/local/$2/$3"
+}
+
+test "$prefix" != NONE && \
+test -d $prefix && {
+	test -n "$verbose" && echo "	... testing $3-directories under $prefix"
+	test -d $prefix/$3 &&    $1="[$]$1 $prefix/$3"
+	test -d $prefix/$3/$2 && $1="[$]$1 $prefix/$3/$2"
+	test -d $prefix/$2/$3 && $1="[$]$1 $prefix/$2/$3"
+}
+
+test "$prefix" != /opt && \
+test -d /opt && {
+	test -n "$verbose" && echo "	... testing $3-directories under /opt"
+	test -d /opt/$3 &&    $1="[$]$1 /opt/$3"
+	test -d /opt/$3/$2 && $1="[$]$1 /opt/$3/$2"
+	test -d /opt/$2/$3 && $1="[$]$1 /opt/$2/$3"
+}
+
+test "$prefix" != /usr && \
+test -d /usr && {
+	test -n "$verbose" && echo "	... testing $3-directories under /usr"
+	test -d /usr/$3 &&    $1="[$]$1 /usr/$3"
+	test -d /usr/$3/$2 && $1="[$]$1 /usr/$3/$2"
+	test -d /usr/$2/$3 && $1="[$]$1 /usr/$2/$3"
+}
+])dnl
+dnl ---------------------------------------------------------------------------
 AC_DEFUN([CF_SYSTEM_MAIL_FLAGS],
 [
 AC_MSG_CHECKING([system mail flags])
@@ -3173,7 +3204,7 @@ AC_CACHE_VAL(cf_cv_have_ttytype,[
 	])
 AC_MSG_RESULT($cf_cv_have_ttytype)
 test $cf_cv_have_ttytype = yes && AC_DEFINE(HAVE_TTYTYPE)
-])
+])dnl
 dnl ---------------------------------------------------------------------------
 dnl Check to see if the BSD-style union wait is declared.  Some platforms may
 dnl use this, though it is deprecated in favor of the 'int' type in Posix.
@@ -3287,7 +3318,7 @@ if test $cf_cv_have_utmp != no ; then
 	CF_UTMP_UT_SESSION
 	CF_SYSV_UTMP
 fi
-])
+])dnl
 dnl ---------------------------------------------------------------------------
 dnl Check if UTMP/UTMPX struct defines ut_host member
 AC_DEFUN([CF_UTMP_UT_HOST],
@@ -3305,7 +3336,7 @@ AC_CACHE_VAL(cf_cv_have_utmp_ut_host,[
 AC_MSG_RESULT($cf_cv_have_utmp_ut_host)
 test $cf_cv_have_utmp_ut_host != no && AC_DEFINE(HAVE_UTMP_UT_HOST)
 fi
-])
+])dnl
 dnl ---------------------------------------------------------------------------
 dnl Check if UTMP/UTMPX struct defines ut_name member
 AC_DEFUN([CF_UTMP_UT_NAME],
@@ -3340,7 +3371,7 @@ ut_user)
 	;;
 esac
 fi
-])
+])dnl
 dnl ---------------------------------------------------------------------------
 dnl Check if UTMP/UTMPX struct defines ut_session member
 AC_DEFUN([CF_UTMP_UT_SESSION],
@@ -3358,7 +3389,7 @@ if test $cf_cv_have_utmp_ut_session != no ; then
 	AC_DEFINE(HAVE_UTMP_UT_SESSION)
 fi
 fi
-])
+])dnl
 dnl ---------------------------------------------------------------------------
 dnl Check for known variants on the UTMP/UTMPX struct's exit-status as reported
 dnl by various people:
@@ -3421,7 +3452,7 @@ if test $cf_cv_have_utmp_ut_xtime != no ; then
 	fi
 fi
 fi
-])
+])dnl
 dnl ---------------------------------------------------------------------------
 dnl Check for ANSI stdarg.h vs varargs.h.  Note that some systems include
 dnl <varargs.h> within <stdarg.h>.
@@ -3526,6 +3557,16 @@ fi
 fi
 ])dnl
 dnl ---------------------------------------------------------------------------
+dnl Wrapper for AC_ARG_WITH to specify directory under which to look for curses
+dnl libraries.
+AC_DEFUN([CF_WITH_CURSES_DIR],[
+AC_ARG_WITH(curses-dir,
+	[  --with-curses-dir=DIR   directory in which (n)curses is installed],
+	[CF_PATH_SYNTAX(withval)
+	 cf_cv_curses_dir=$withval],
+	[cf_cv_curses_dir=no])
+])dnl
+dnl ---------------------------------------------------------------------------
 dnl Wrapper for AC_ARG_WITH to ensure that user supplies a pathname, not just
 dnl defaulting to yes/no.
 dnl
@@ -3559,7 +3600,7 @@ AC_TRY_LINK([
 #include <${cf_cv_ncurses_header-curses.h}>],[
 	long x = winnstr(stdscr, "", 0)],
 	[cf_cv_need_xopen_extension=yes],
-	[cf_cv_need_xopen_extension=no])])])
+	[cf_cv_need_xopen_extension=unknown])])])
 test $cf_cv_need_xopen_extension = yes && CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE_EXTENDED"
 ])dnl
 dnl ---------------------------------------------------------------------------
@@ -3581,19 +3622,28 @@ AC_ARG_WITH(neXtaw,
 AC_CHECK_LIB(Xext,XextCreateExtension,
 	[LIBS="-lXext $LIBS"])
 
-cf_x_athena_include=""
 cf_x_athena_lib=""
 
+CF_X_ATHENA_CPPFLAGS($cf_x_athena)
+CF_X_ATHENA_LIBS($cf_x_athena)
+])dnl
+dnl ---------------------------------------------------------------------------
+dnl Normally invoked by CF_X_ATHENA, with $1 set to the appropriate flavor of
+dnl the Athena widgets, e.g., Xaw, Xaw3d, neXtaw.
+AC_DEFUN([CF_X_ATHENA_CPPFLAGS],
+[
+cf_x_athena_root=ifelse($1,,Xaw,$1)
+cf_x_athena_include=""
+
 for cf_path in default \
 	/usr/contrib/X11R6 \
 	/usr/contrib/X11R5 \
 	/usr/lib/X11R5 \
 	/usr/local
 do
-
 	if test -z "$cf_x_athena_include" ; then
 		cf_save="$CPPFLAGS"
-		cf_test=X11/$cf_x_athena/SimpleMenu.h
+		cf_test=X11/$cf_x_athena_root/SimpleMenu.h
 		if test $cf_path != default ; then
 			CPPFLAGS="-I$cf_path/include $cf_save"
 			AC_MSG_CHECKING(for $cf_test in $cf_path)
@@ -3608,12 +3658,38 @@ do
 		AC_MSG_RESULT($cf_result)
 		if test "$cf_result" = yes ; then
 			cf_x_athena_include=$cf_path
+			break
 		else
 			CPPFLAGS="$cf_save"
 		fi
 	fi
+done
 
-	for cf_lib in "-l$cf_x_athena -lXmu" "-l${cf_x_athena}_s -lXmu_s"
+if test -z "$cf_x_athena_include" ; then
+	AC_MSG_WARN(
+[Unable to successfully find Athena header files with test program])
+elif test "$cf_x_athena_include" != default ; then
+	CPPFLAGS="$CPPFLAGS -I$cf_x_athena_include"
+fi
+])
+dnl ---------------------------------------------------------------------------
+dnl Normally invoked by CF_X_ATHENA, with $1 set to the appropriate flavor of
+dnl the Athena widgets, e.g., Xaw, Xaw3d, neXtaw.
+AC_DEFUN([CF_X_ATHENA_LIBS],
+[AC_REQUIRE([CF_X_TOOLKIT])
+cf_x_athena_root=ifelse($1,,Xaw,$1)
+cf_x_athena_lib=""
+
+for cf_path in default \
+	/usr/contrib/X11R6 \
+	/usr/contrib/X11R5 \
+	/usr/lib/X11R5 \
+	/usr/local
+do
+	for cf_lib in \
+		"-l$cf_x_athena_root -lXmu" \
+		"-l$cf_x_athena_root -lXpm -lXmu" \
+		"-l${cf_x_athena_root}_s -lXmu_s"
 	do
 		if test -z "$cf_x_athena_lib" ; then
 			cf_save="$LIBS"
@@ -3632,6 +3708,7 @@ do
 			AC_MSG_RESULT($cf_result)
 			if test "$cf_result" = yes ; then
 				cf_x_athena_lib="$cf_lib"
+				break
 			else
 				LIBS="$cf_save"
 			fi
@@ -3639,19 +3716,14 @@ do
 	done
 done
 
-if test -z "$cf_x_athena_include" ; then
-	AC_MSG_WARN(
-[Unable to successfully find Athena header files with test program])
-fi
-
 if test -z "$cf_x_athena_lib" ; then
 	AC_ERROR(
-[Unable to successfully link Athena library (-l$cf_x_athena) with test program])
+[Unable to successfully link Athena library (-l$cf_x_athena_root) with test program])
 fi
 
-CF_UPPER(CF_X_ATHENA_LIBS,HAVE_LIB_$cf_x_athena)
-AC_DEFINE_UNQUOTED($CF_X_ATHENA_LIBS)
-])dnl
+CF_UPPER(cf_x_athena_LIBS,HAVE_LIB_$cf_x_athena)
+AC_DEFINE_UNQUOTED($cf_x_athena_LIBS)
+])
 dnl ---------------------------------------------------------------------------
 dnl Check for X Toolkit libraries
 dnl
@@ -3717,11 +3789,10 @@ dnl Inserted as requested by gettext 0.10.40
 dnl File from /usr/share/aclocal
 dnl glibc21.m4
 dnl ====================
-#serial 2
-
-# Test for the GNU C Library, version 2.1 or newer.
-# From Bruno Haible.
-
+dnl serial 2
+dnl
+dnl Test for the GNU C Library, version 2.1 or newer.
+dnl From Bruno Haible.
 AC_DEFUN([jm_GLIBC21],
   [
     AC_CACHE_CHECK(whether we are using the GNU C Library 2.1 or newer,
diff --git a/config.guess b/config.guess
index 9f4e5a6d..5145e357 100755
--- a/config.guess
+++ b/config.guess
@@ -3,7 +3,7 @@
 #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
 #   2000, 2001, 2002 Free Software Foundation, Inc.
 
-timestamp='2002-08-23'
+timestamp='2002-10-21'
 
 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
@@ -109,7 +109,7 @@ trap '"'"'rm -f $files; rmdir $tmpdir; exit 1'"'"' 1 2 15 ;
 case $CC_FOR_BUILD,$HOST_CC,$CC in
  ,,)    echo "int x;" > $dummy.c ;
 	for c in cc gcc c89 c99 ; do
-	  if ($c $dummy.c -c -o $dummy.o) >/dev/null 2>&1 ; then
+	  if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
 	     CC_FOR_BUILD="$c"; break ;
 	  fi ;
 	done ;
@@ -257,7 +257,7 @@ main:
 	jsr \$26,exit
 	.end main
 EOF
-	$CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null
+	$CC_FOR_BUILD -o $dummy $dummy.s 2>/dev/null
 	if test "$?" = 0 ; then
 		case `$dummy` in
 			0-0)
@@ -437,7 +437,7 @@ EOF
 	  exit (-1);
 	}
 EOF
-	$CC_FOR_BUILD $dummy.c -o $dummy \
+	$CC_FOR_BUILD -o $dummy $dummy.c \
 	  && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
 	  && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0
 	rm -f $dummy.c $dummy && rmdir $tmpdir
@@ -524,7 +524,7 @@ EOF
 			exit(0);
 			}
 EOF
-		$CC_FOR_BUILD $dummy.c -o $dummy && $dummy && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0
+		$CC_FOR_BUILD -o $dummy $dummy.c && $dummy && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0
 		rm -f $dummy.c $dummy && rmdir $tmpdir
 		echo rs6000-ibm-aix3.2.5
 	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
@@ -623,7 +623,7 @@ EOF
                   exit (0);
               }
 EOF
-		    (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null) && HP_ARCH=`$dummy`
+		    (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
 		    if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi
 		    rm -f $dummy.c $dummy && rmdir $tmpdir
 		fi ;;
@@ -661,7 +661,7 @@ EOF
 	  exit (0);
 	}
 EOF
-	$CC_FOR_BUILD $dummy.c -o $dummy && $dummy && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0
+	$CC_FOR_BUILD -o $dummy $dummy.c && $dummy && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0
 	rm -f $dummy.c $dummy && rmdir $tmpdir
 	echo unknown-hitachi-hiuxwe2
 	exit 0 ;;
@@ -1111,7 +1111,7 @@ EOF
     *:QNX:*:4*)
 	echo i386-pc-qnx
 	exit 0 ;;
-    NSR-[GKLNPTVW]:NONSTOP_KERNEL:*:*)
+    NSR-[DGKLNPTVW]:NONSTOP_KERNEL:*:*)
 	echo nsr-tandem-nsk${UNAME_RELEASE}
 	exit 0 ;;
     *:NonStop-UX:*:*)
@@ -1283,7 +1283,7 @@ main ()
 }
 EOF
 
-$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && $dummy && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0
+$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && $dummy && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0
 rm -f $dummy.c $dummy && rmdir $tmpdir
 
 # Apollos put the system type in the environment.
diff --git a/config.hin b/config.hin
index 86e48e50..f246de0a 100644
--- a/config.hin
+++ b/config.hin
@@ -50,8 +50,8 @@
 #undef GCC_UNUSED		/* CF_GCC_ATTRIBUTES */
 #undef GETGROUPS_T		/* AC_TYPE_GETGROUPS */
 #undef GZIP_PATH		/* CF_PATH_PROG(gzip) */
-#undef HAVE_ALLOCA		/* AM_GNU_GETTEXT */
-#undef HAVE_ALLOCA_H		/* AM_GNU_GETTEXT */
+#undef HAVE_ALLOCA		/* AM_GNU_GETTEXT/AC_FUNC_ALLOCA */
+#undef HAVE_ALLOCA_H		/* AM_GNU_GETTEXT/AC_FUNC_ALLOCA */
 #undef HAVE_ARGZ_H		/* AM_GNU_GETTEXT */
 #undef HAVE_ARPA_INET_H
 #undef HAVE_ASSUME_DEFAULT_COLORS /* ncurses extension */
diff --git a/config.sub b/config.sub
index b0222f7e..6f84d0e8 100755
--- a/config.sub
+++ b/config.sub
@@ -3,7 +3,7 @@
 #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
 #   2000, 2001, 2002 Free Software Foundation, Inc.
 
-timestamp='2002-08-22'
+timestamp='2002-09-05'
 
 # This file is (in principle) common to ALL GNU software.
 # The presence of a machine in this file suggests that SOME GNU software
@@ -229,7 +229,7 @@ case $basic_machine in
 	| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
 	| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
 	| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
-	| c4x | clipper \
+	| clipper \
 	| d10v | d30v | dlx | dsp16xx \
 	| fr30 | frv \
 	| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
@@ -294,7 +294,7 @@ case $basic_machine in
 	| arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
 	| avr-* \
 	| bs2000-* \
-	| c[123]* | c30-* | [cjt]90-* | c54x-* \
+	| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* \
 	| clipper-* | cydra-* \
 	| d10v-* | d30v-* | dlx-* \
 	| elxsi-* \
@@ -329,7 +329,7 @@ case $basic_machine in
 	| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
 	| sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \
 	| sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
-	| tahoe-* | thumb-* | tic30-* | tic54x-* | tic80-* | tron-* \
+	| tahoe-* | thumb-* | tic30-* | tic4x-* | tic54x-* | tic80-* | tron-* \
 	| v850-* | v850e-* | vax-* \
 	| we32k-* \
 	| x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \
@@ -913,6 +913,10 @@ case $basic_machine in
 		basic_machine=t90-cray
 		os=-unicos
 		;;
+	tic4x | c4x*)
+		basic_machine=tic4x-unknown
+		os=-coff
+		;;
 	tic54x | c54x*)
 		basic_machine=tic54x-unknown
 		os=-coff
@@ -1047,10 +1051,6 @@ case $basic_machine in
 	pmac | pmac-mpw)
 		basic_machine=powerpc-apple
 		;;
-	c4x*)
-		basic_machine=c4x-none
-		os=-coff
-		;;
 	*-unknown)
 		# Make sure to match an already-canonicalized machine name.
 		;;
diff --git a/configure b/configure
index faaa624f..541447d0 100755
--- a/configure
+++ b/configure
@@ -1,5 +1,20 @@
 #! /bin/sh
 
+# From configure.in none
+
+# Save the original $CFLAGS so we can distinguish whether the user set those
+# in the environment, or whether autoconf added -O and -g options:
+ORIGINAL_CFLAGS="$CFLAGS"
+
+# For autoconf 2.13, make sure we have no cache file at the beginning of this
+# script.  That fixes problems with tests whose cached values change from one
+# run to the next, as well as with tests that are order-dependent.
+rm -f config.cache
+
+
+
+
+
 # Guess values for system-dependent variables and create Makefiles.
 # Generated automatically using autoconf version 2.13.20020210 
 # Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
@@ -207,13 +222,14 @@ cat <<EOF
   --with-socks5[=path]    link with socks5 library if available
   --with-screen=XXX       select screen type
                           (XXX is curses (default), ncurses or slang)
+  --with-curses-dir=DIR   directory in which (n)curses is installed
   --with-charsets=list    limit charsets to given list of MIME names
 Experimental Options:
   --disable-bibp-urls     disable support for bibp: URLs
   --disable-config-info   disable browsable configuration-info
-  --disable-forms-options disable experimental forms-based options
 EOF
 cat <<EOF
+  --disable-forms-options disable experimental forms-based options
   --disable-menu-options  disable old-style option menu
   --enable-addrlist-page  use experimental address-list page
   --enable-charset-choice use experimental charset-selection logic
@@ -225,9 +241,9 @@ cat <<EOF
   --enable-ipv6           use experimental ipv6 (with ipv4) support
   --enable-justify-elts   use experimental element-justification logic
   --enable-kbd-layout     use experimental keyboard-layout support
-  --enable-libjs          use experimental JavaScript support (Mozilla libjs)
 EOF
 cat <<EOF
+  --enable-libjs          use experimental JavaScript support (Mozilla libjs)
   --enable-nested-tables  use experimental nested-table support
   --enable-prettysrc      colorize HTML source
   --enable-read-eta       experimental read-progress message shows ETA
@@ -239,9 +255,9 @@ Miscellaneous Options:
   --disable-partial       use partial-display logic
   --enable-externs        use external commands
   --enable-font-switch    use Linux setfont for character-translation
-  --enable-cgi-links      support cgi links w/o a http daemon
 EOF
 cat <<EOF
+  --enable-cgi-links      support cgi links w/o a http daemon
   --enable-change-exec    allow users to change exec options
   --enable-exec-links     allow lynx to execute programs accessed via a link
   --enable-exec-scripts   allow lynx to execute programs inferred from a link
@@ -253,9 +269,9 @@ cat <<EOF
   --enable-gzip-help      install gzip'ed help files
   --with-zlib             use zlib for decompression of some gzip files
   --disable-finger        disable FINGER logic
-  --disable-gopher        disable GOPHER logic
 EOF
 cat <<EOF
+  --disable-gopher        disable GOPHER logic
   --disable-news          disable NEWS logic
   --disable-ftp           disable FTP logic
 Directory Editor Options:
@@ -267,9 +283,9 @@ Directory Editor Options:
   --disable-dired-tar     disable "tar" command
   --disable-dired-uudecode disable "uudecode" command
   --disable-dired-zip     disable "zip", "unzip"  commands
-  --disable-dired-gzip    disable "gzip", "gunzip" commands
 EOF
 cat <<EOF
+  --disable-dired-gzip    disable "gzip", "gunzip" commands
   --disable-long-list     disable long "ls -l" directory listings
   --disable-parent-dir-refs
                           disable "Up-to" links in directory listings
@@ -653,7 +669,7 @@ else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
 fi
 
 echo $ac_n "checking host system type""... $ac_c" 1>&6
-echo "configure:657: checking host system type" >&5
+echo "configure:673: checking host system type" >&5
 
 host_alias=$host
 case "$host_alias" in
@@ -723,7 +739,7 @@ esac
 # Extract the first word of "gcc", so it can be a program name with args.
 set dummy gcc; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:727: checking for $ac_word" >&5
+echo "configure:743: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -753,7 +769,7 @@ if test -z "$CC"; then
   # Extract the first word of "cc", so it can be a program name with args.
 set dummy cc; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:757: checking for $ac_word" >&5
+echo "configure:773: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -804,7 +820,7 @@ fi
       # Extract the first word of "cl", so it can be a program name with args.
 set dummy cl; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:808: checking for $ac_word" >&5
+echo "configure:824: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -836,7 +852,7 @@ fi
 fi
 
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:840: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:856: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
 
 ac_ext=c
 # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
@@ -847,12 +863,12 @@ cross_compiling=$ac_cv_prog_cc_cross
 
 cat > conftest.$ac_ext << EOF
 
-#line 851 "configure"
+#line 867 "configure"
 #include "confdefs.h"
 
 main(){return(0);}
 EOF
-if { (eval echo configure:856: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:872: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   ac_cv_prog_cc_works=yes
   # If we can't run a trivial program, we are probably using a cross compiler.
   if (./conftest; exit) 2>/dev/null; then
@@ -878,12 +894,12 @@ if test $ac_cv_prog_cc_works = no; then
   { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
 fi
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:882: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:898: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
 cross_compiling=$ac_cv_prog_cc_cross
 
 echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:887: checking whether we are using GNU C" >&5
+echo "configure:903: checking whether we are using GNU C" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -892,7 +908,7 @@ else
   yes;
 #endif
 EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:896: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:912: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
   ac_cv_prog_gcc=yes
 else
   ac_cv_prog_gcc=no
@@ -911,7 +927,7 @@ ac_test_CFLAGS="${CFLAGS+set}"
 ac_save_CFLAGS="$CFLAGS"
 CFLAGS=
 echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:915: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:931: checking whether ${CC-cc} accepts -g" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -943,7 +959,7 @@ else
 fi
 
 echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:947: checking how to run the C preprocessor" >&5
+echo "configure:963: checking how to run the C preprocessor" >&5
 # On Suns, sometimes $CPP names a directory.
 if test -n "$CPP" && test -d "$CPP"; then
   CPP=
@@ -958,13 +974,13 @@ else
   # On the NeXT, cc -E runs the code through the compiler's parser,
   # not just through cpp.
   cat > conftest.$ac_ext <<EOF
-#line 962 "configure"
+#line 978 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:968: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:984: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   :
@@ -975,13 +991,13 @@ else
   rm -rf conftest*
   CPP="${CC-cc} -E -traditional-cpp"
   cat > conftest.$ac_ext <<EOF
-#line 979 "configure"
+#line 995 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:985: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1001: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   :
@@ -992,13 +1008,13 @@ else
   rm -rf conftest*
   CPP="${CC-cc} -nologo -E"
   cat > conftest.$ac_ext <<EOF
-#line 996 "configure"
+#line 1012 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1002: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1018: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   :
@@ -1023,7 +1039,7 @@ fi
 echo "$ac_t""$CPP" 1>&6
 
 echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6
-echo "configure:1027: checking whether ln -s works" >&5
+echo "configure:1043: checking whether ln -s works" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1046,7 +1062,7 @@ fi
 # Extract the first word of "ranlib", so it can be a program name with args.
 set dummy ranlib; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1050: checking for $ac_word" >&5
+echo "configure:1066: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1074,7 +1090,7 @@ else
 fi
 
 echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
-echo "configure:1078: checking whether ${MAKE-make} sets \${MAKE}" >&5
+echo "configure:1094: checking whether ${MAKE-make} sets \${MAKE}" >&5
 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1112,7 +1128,7 @@ fi
 # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
 # ./install, which can be erroneously created by make from ./install.sh.
 echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:1116: checking for a BSD compatible install" >&5
+echo "configure:1132: checking for a BSD compatible install" >&5
 if test -z "$INSTALL"; then
 if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1169,7 +1185,7 @@ do
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1173: checking for $ac_word" >&5
+echo "configure:1189: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_LINT'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1200,9 +1216,9 @@ done
 
 
 echo $ac_n "checking for AIX""... $ac_c" 1>&6
-echo "configure:1204: checking for AIX" >&5
+echo "configure:1220: checking for AIX" >&5
 cat > conftest.$ac_ext <<EOF
-#line 1206 "configure"
+#line 1222 "configure"
 #include "confdefs.h"
 #ifdef _AIX
   yes
@@ -1224,7 +1240,7 @@ rm -f conftest*
 
 
 echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&6
-echo "configure:1228: checking for POSIXized ISC" >&5
+echo "configure:1244: checking for POSIXized ISC" >&5
 if test -d /etc/conf/kconfig.d &&
   grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1
 then
@@ -1250,7 +1266,7 @@ fi
 
 
 echo $ac_n "checking if you want to see long compiling messages""... $ac_c" 1>&6
-echo "configure:1254: checking if you want to see long compiling messages" >&5
+echo "configure:1270: checking if you want to see long compiling messages" >&5
 
 # Check whether --enable-echo or --disable-echo was given.
 if test "${enable_echo+set}" = set; then
@@ -1298,7 +1314,7 @@ fi
 
 
 echo $ac_n "checking if you want to check memory-leaks""... $ac_c" 1>&6
-echo "configure:1302: checking if you want to check memory-leaks" >&5
+echo "configure:1318: checking if you want to check memory-leaks" >&5
 
 # Check whether --enable-find-leaks or --disable-find-leaks was given.
 if test "${enable_find_leaks+set}" = set; then
@@ -1321,8 +1337,11 @@ test "$with_leak_checks" = "yes" && cat >> confdefs.h <<\EOF
 EOF
 
 
+# The comment about adding -g to $CFLAGS is unclear.  Autoconf tries to add
+# a -g flag; we remove it if the user's $CFLAGS was not set and debugging is
+# disabled.
 echo $ac_n "checking if you want to enable debug-code""... $ac_c" 1>&6
-echo "configure:1326: checking if you want to enable debug-code" >&5
+echo "configure:1345: checking if you want to enable debug-code" >&5
 
 # Check whether --enable-debug or --disable-debug was given.
 if test "${enable_debug+set}" = set; then
@@ -1343,7 +1362,7 @@ echo "$ac_t""$with_debug" 1>&6
 if test "$with_debug" = "yes" ; then
 	case $host_os in
 	ultrix*|osf*)
-		
+		test -z "$ORIGINAL_CFLAGS" && 
 CFLAGS=`echo ${CFLAGS} | sed -e 's/-O[1-9]\? //' -e 's/-O[1-9]\?$//'`
 
 		if test -z "$GCC" ; then
@@ -1355,16 +1374,16 @@ else
 	case $host_os in
 	osf*) #(vi
 		test -z "$GCC" && CFLAGS="$CFLAGS -std1"
-		CFLAGS=`echo ${CFLAGS} | sed -e 's/-g //' -e 's/-g$//'`
+		test -z "$ORIGINAL_CFLAGS" && CFLAGS=`echo ${CFLAGS} | sed -e 's/-g //' -e 's/-g$//'`
 		;;
 	*)
-		CFLAGS=`echo ${CFLAGS} | sed -e 's/-g //' -e 's/-g$//'`
+		test -z "$ORIGINAL_CFLAGS" && CFLAGS=`echo ${CFLAGS} | sed -e 's/-g //' -e 's/-g$//'`
 		;;
 	esac
 fi
 
 echo $ac_n "checking if you want to enable lynx trace code *recommended* ""... $ac_c" 1>&6
-echo "configure:1368: checking if you want to enable lynx trace code *recommended* " >&5
+echo "configure:1387: checking if you want to enable lynx trace code *recommended* " >&5
 
 # Check whether --enable-trace or --disable-trace was given.
 if test "${enable_trace+set}" = set; then
@@ -1388,7 +1407,7 @@ EOF
 
 
 echo $ac_n "checking if you want verbose trace code""... $ac_c" 1>&6
-echo "configure:1392: checking if you want verbose trace code" >&5
+echo "configure:1411: checking if you want verbose trace code" >&5
 
 # Check whether --enable-vertrace or --disable-vertrace was given.
 if test "${enable_vertrace+set}" = set; then
@@ -1414,7 +1433,7 @@ EOF
 if test -n "$GCC"
 then
 echo $ac_n "checking if you want to turn on gcc warnings""... $ac_c" 1>&6
-echo "configure:1418: checking if you want to turn on gcc warnings" >&5
+echo "configure:1437: checking if you want to turn on gcc warnings" >&5
 
 # Check whether --enable-warnings or --disable-warnings was given.
 if test "${enable_warnings+set}" = set; then
@@ -1454,9 +1473,9 @@ EOF
 if test "$GCC" = yes
 then
 	echo "checking for $CC __attribute__ directives" 1>&6
-echo "configure:1458: checking for $CC __attribute__ directives" >&5
+echo "configure:1477: checking for $CC __attribute__ directives" >&5
 cat > conftest.$ac_ext <<EOF
-#line 1460 "configure"
+#line 1479 "configure"
 #include "confdefs.h"
 #include "conftest.h"
 #include "conftest.i"
@@ -1494,7 +1513,7 @@ EOF
 EOF
 			;;
 		esac
-		if { (eval echo configure:1498: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+		if { (eval echo configure:1517: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
 			test -n "$verbose" && echo "$ac_t""... $cf_attribute" 1>&6
 			cat conftest.h >>confdefs.h
 #		else
@@ -1511,11 +1530,11 @@ fi
 if test "$GCC" = yes
 then
 	cat > conftest.$ac_ext <<EOF
-#line 1515 "configure"
+#line 1534 "configure"
 int main(int argc, char *argv[]) { return (argv[argc-1] == 0) ; }
 EOF
 	echo "checking for $CC warning options" 1>&6
-echo "configure:1519: checking for $CC warning options" >&5
+echo "configure:1538: checking for $CC warning options" >&5
 	cf_save_CFLAGS="$CFLAGS"
 	EXTRA_CFLAGS="-W -Wall"
 	cf_warn_CONST=""
@@ -1534,7 +1553,7 @@ echo "configure:1519: checking for $CC warning options" >&5
 		Wundef $cf_warn_CONST
 	do
 		CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt"
-		if { (eval echo configure:1538: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+		if { (eval echo configure:1557: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
 			test -n "$verbose" && echo "$ac_t""... -$cf_opt" 1>&6
 			EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt"
 			test "$cf_opt" = Wcast-qual && EXTRA_CFLAGS="$EXTRA_CFLAGS -DXTSTRINGDEFINES"
@@ -1549,7 +1568,7 @@ fi
 fi
 
 echo $ac_n "checking if you want to link with dbmalloc for testing""... $ac_c" 1>&6
-echo "configure:1553: checking if you want to link with dbmalloc for testing" >&5
+echo "configure:1572: checking if you want to link with dbmalloc for testing" >&5
 
 # Check whether --with-dbmalloc or --without-dbmalloc was given.
 if test "${with_dbmalloc+set}" = set; then
@@ -1562,7 +1581,7 @@ fi
 echo "$ac_t""$with_dbmalloc" 1>&6
 if test $with_dbmalloc = yes ; then
 	echo $ac_n "checking for debug_malloc in -ldbmalloc""... $ac_c" 1>&6
-echo "configure:1566: checking for debug_malloc in -ldbmalloc" >&5
+echo "configure:1585: checking for debug_malloc in -ldbmalloc" >&5
 ac_lib_var=`echo dbmalloc'_'debug_malloc | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1570,7 +1589,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-ldbmalloc  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1574 "configure"
+#line 1593 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -1581,7 +1600,7 @@ int main() {
 debug_malloc()
 ; return 0; }
 EOF
-if { (eval echo configure:1585: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1604: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -1611,7 +1630,7 @@ fi
 fi
 
 echo $ac_n "checking if you want to link with dmalloc for testing""... $ac_c" 1>&6
-echo "configure:1615: checking if you want to link with dmalloc for testing" >&5
+echo "configure:1634: checking if you want to link with dmalloc for testing" >&5
 
 # Check whether --with-dmalloc or --without-dmalloc was given.
 if test "${with_dmalloc+set}" = set; then
@@ -1624,7 +1643,7 @@ fi
 echo "$ac_t""$with_dmalloc" 1>&6
 if test $with_dmalloc = yes ; then
 	echo $ac_n "checking for dmalloc_debug in -ldmalloc""... $ac_c" 1>&6
-echo "configure:1628: checking for dmalloc_debug in -ldmalloc" >&5
+echo "configure:1647: checking for dmalloc_debug in -ldmalloc" >&5
 ac_lib_var=`echo dmalloc'_'dmalloc_debug | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1632,7 +1651,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-ldmalloc  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1636 "configure"
+#line 1655 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -1643,7 +1662,7 @@ int main() {
 dmalloc_debug()
 ; return 0; }
 EOF
-if { (eval echo configure:1647: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1666: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -1679,12 +1698,12 @@ EOF
 
 
 echo $ac_n "checking for working const""... $ac_c" 1>&6
-echo "configure:1683: checking for working const" >&5
+echo "configure:1702: checking for working const" >&5
 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1688 "configure"
+#line 1707 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -1733,7 +1752,7 @@ ccp = (char const *const *) p;
 
 ; return 0; }
 EOF
-if { (eval echo configure:1737: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1756: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_const=yes
 else
@@ -1775,7 +1794,7 @@ clix*)
 	# contributed by Alex Matulich (matuli_a@marlin.navsea.navy.mil) also
 	# references -lmalloc and -lbsd.
 	echo $ac_n "checking for strcmp in -lc_s""... $ac_c" 1>&6
-echo "configure:1779: checking for strcmp in -lc_s" >&5
+echo "configure:1798: checking for strcmp in -lc_s" >&5
 ac_lib_var=`echo c_s'_'strcmp | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1783,7 +1802,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lc_s  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1787 "configure"
+#line 1806 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -1794,7 +1813,7 @@ int main() {
 strcmp()
 ; return 0; }
 EOF
-if { (eval echo configure:1798: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1817: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -1892,7 +1911,7 @@ do
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1896: checking for $ac_word" >&5
+echo "configure:1915: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1937,17 +1956,17 @@ sony-newsos*)
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:1941: checking for $ac_hdr" >&5
+echo "configure:1960: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1946 "configure"
+#line 1965 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1951: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1970: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -1991,17 +2010,17 @@ ultrix*)
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:1995: checking for $ac_hdr" >&5
+echo "configure:2014: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2000 "configure"
+#line 2019 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2005: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2024: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -2038,7 +2057,7 @@ esac
 if test -z "$GCC" ; then
 	
 echo $ac_n "checking for ${CC-cc} option to accept ANSI C""... $ac_c" 1>&6
-echo "configure:2042: checking for ${CC-cc} option to accept ANSI C" >&5
+echo "configure:2061: checking for ${CC-cc} option to accept ANSI C" >&5
 if eval "test \"`echo '$''{'cf_cv_ansi_cc'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2094,7 +2113,7 @@ fi
 
 
 	cat > conftest.$ac_ext <<EOF
-#line 2098 "configure"
+#line 2117 "configure"
 #include "confdefs.h"
 
 #ifndef CC_HAS_PROTOS
@@ -2110,7 +2129,7 @@ int main() {
 	struct s2 {int (*f) (double a);};
 ; return 0; }
 EOF
-if { (eval echo configure:2114: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2133: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cf_cv_ansi_cc="$cf_arg"; break
 else
@@ -2174,12 +2193,12 @@ fi
 
 
 echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:2178: checking for ANSI C header files" >&5
+echo "configure:2197: checking for ANSI C header files" >&5
 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2183 "configure"
+#line 2202 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 #include <stdarg.h>
@@ -2187,7 +2206,7 @@ else
 #include <float.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2191: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2210: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -2204,7 +2223,7 @@ rm -f conftest*
 if test $ac_cv_header_stdc = yes; then
   # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
 cat > conftest.$ac_ext <<EOF
-#line 2208 "configure"
+#line 2227 "configure"
 #include "confdefs.h"
 #include <string.h>
 EOF
@@ -2222,7 +2241,7 @@ fi
 if test $ac_cv_header_stdc = yes; then
   # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
 cat > conftest.$ac_ext <<EOF
-#line 2226 "configure"
+#line 2245 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 EOF
@@ -2243,7 +2262,7 @@ if test "$cross_compiling" = yes; then
   :
 else
   cat > conftest.$ac_ext <<EOF
-#line 2247 "configure"
+#line 2266 "configure"
 #include "confdefs.h"
 #include <ctype.h>
 #define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@@ -2254,7 +2273,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
 exit (0); }
 
 EOF
-if { (eval echo configure:2258: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2277: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   :
 else
@@ -2278,21 +2297,21 @@ EOF
 fi
 
 echo $ac_n "checking for inline""... $ac_c" 1>&6
-echo "configure:2282: checking for inline" >&5
+echo "configure:2301: checking for inline" >&5
 if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   ac_cv_c_inline=no
 for ac_kw in inline __inline__ __inline; do
   cat > conftest.$ac_ext <<EOF
-#line 2289 "configure"
+#line 2308 "configure"
 #include "confdefs.h"
 
 int main() {
 } $ac_kw foo() {
 ; return 0; }
 EOF
-if { (eval echo configure:2296: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2315: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_inline=$ac_kw; break
 else
@@ -2318,12 +2337,12 @@ EOF
 esac
 
 echo $ac_n "checking for off_t""... $ac_c" 1>&6
-echo "configure:2322: checking for off_t" >&5
+echo "configure:2341: checking for off_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2327 "configure"
+#line 2346 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -2351,12 +2370,12 @@ EOF
 fi
 
 echo $ac_n "checking for size_t""... $ac_c" 1>&6
-echo "configure:2355: checking for size_t" >&5
+echo "configure:2374: checking for size_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2360 "configure"
+#line 2379 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -2386,19 +2405,19 @@ fi
 # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
 # for constant arguments.  Useless!
 echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6
-echo "configure:2390: checking for working alloca.h" >&5
+echo "configure:2409: checking for working alloca.h" >&5
 if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2395 "configure"
+#line 2414 "configure"
 #include "confdefs.h"
 #include <alloca.h>
 int main() {
 char *p = alloca(2 * sizeof(int));
 ; return 0; }
 EOF
-if { (eval echo configure:2402: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2421: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ac_cv_header_alloca_h=yes
 else
@@ -2419,12 +2438,12 @@ EOF
 fi
 
 echo $ac_n "checking for alloca""... $ac_c" 1>&6
-echo "configure:2423: checking for alloca" >&5
+echo "configure:2442: checking for alloca" >&5
 if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2428 "configure"
+#line 2447 "configure"
 #include "confdefs.h"
 
 #ifdef __GNUC__
@@ -2452,7 +2471,7 @@ int main() {
 char *p = (char *) alloca(1);
 ; return 0; }
 EOF
-if { (eval echo configure:2456: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2475: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ac_cv_func_alloca_works=yes
 else
@@ -2484,12 +2503,12 @@ EOF
 
 
 echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6
-echo "configure:2488: checking whether alloca needs Cray hooks" >&5
+echo "configure:2507: checking whether alloca needs Cray hooks" >&5
 if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2493 "configure"
+#line 2512 "configure"
 #include "confdefs.h"
 #if defined(CRAY) && ! defined(CRAY2)
 webecray
@@ -2514,12 +2533,12 @@ echo "$ac_t""$ac_cv_os_cray" 1>&6
 if test $ac_cv_os_cray = yes; then
 for ac_func in _getb67 GETB67 getb67; do
   echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2518: checking for $ac_func" >&5
+echo "configure:2537: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2523 "configure"
+#line 2542 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -2542,7 +2561,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:2546: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2565: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -2569,7 +2588,7 @@ done
 fi
 
 echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6
-echo "configure:2573: checking stack direction for C alloca" >&5
+echo "configure:2592: checking stack direction for C alloca" >&5
 if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2577,7 +2596,7 @@ else
   ac_cv_c_stack_direction=0
 else
   cat > conftest.$ac_ext <<EOF
-#line 2581 "configure"
+#line 2600 "configure"
 #include "confdefs.h"
 find_stack_direction ()
 {
@@ -2596,7 +2615,7 @@ main ()
   exit (find_stack_direction() < 0);
 }
 EOF
-if { (eval echo configure:2600: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2619: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ac_cv_c_stack_direction=1
 else
@@ -2621,17 +2640,17 @@ for ac_hdr in unistd.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:2625: checking for $ac_hdr" >&5
+echo "configure:2644: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2630 "configure"
+#line 2649 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2635: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2654: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -2660,12 +2679,12 @@ done
 for ac_func in getpagesize
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2664: checking for $ac_func" >&5
+echo "configure:2683: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2669 "configure"
+#line 2688 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -2688,7 +2707,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:2692: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2711: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -2713,7 +2732,7 @@ fi
 done
 
 echo $ac_n "checking for working mmap""... $ac_c" 1>&6
-echo "configure:2717: checking for working mmap" >&5
+echo "configure:2736: checking for working mmap" >&5
 if eval "test \"`echo '$''{'ac_cv_func_mmap_fixed_mapped'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2721,7 +2740,7 @@ else
   ac_cv_func_mmap_fixed_mapped=no
 else
   cat > conftest.$ac_ext <<EOF
-#line 2725 "configure"
+#line 2744 "configure"
 #include "confdefs.h"
 
 /* Thanks to Mike Haertel and Jim Avera for this test.
@@ -2861,7 +2880,7 @@ main()
 }
 
 EOF
-if { (eval echo configure:2865: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2884: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ac_cv_func_mmap_fixed_mapped=yes
 else
@@ -2885,12 +2904,12 @@ fi
 
 
     echo $ac_n "checking whether we are using the GNU C Library 2.1 or newer""... $ac_c" 1>&6
-echo "configure:2889: checking whether we are using the GNU C Library 2.1 or newer" >&5
+echo "configure:2908: checking whether we are using the GNU C Library 2.1 or newer" >&5
 if eval "test \"`echo '$''{'ac_cv_gnu_library_2_1'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2894 "configure"
+#line 2913 "configure"
 #include "confdefs.h"
 
 #include <features.h>
@@ -2939,17 +2958,17 @@ stdlib.h string.h unistd.h sys/param.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:2943: checking for $ac_hdr" >&5
+echo "configure:2962: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2948 "configure"
+#line 2967 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2953: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2972: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -2980,12 +2999,12 @@ getgid getuid mempcpy munmap putenv setenv setlocale stpcpy strchr strcasecmp \
 strdup strtoul tsearch __argz_count __argz_stringify __argz_next
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2984: checking for $ac_func" >&5
+echo "configure:3003: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2989 "configure"
+#line 3008 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -3008,7 +3027,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:3012: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3031: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -3049,7 +3068,7 @@ fi
 
 
   echo $ac_n "checking for iconv""... $ac_c" 1>&6
-echo "configure:3053: checking for iconv" >&5
+echo "configure:3072: checking for iconv" >&5
 if eval "test \"`echo '$''{'am_cv_func_iconv'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3057,7 +3076,7 @@ else
     am_cv_func_iconv="no, consider installing GNU libiconv"
     am_cv_lib_iconv=no
     cat > conftest.$ac_ext <<EOF
-#line 3061 "configure"
+#line 3080 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 #include <iconv.h>
@@ -3067,7 +3086,7 @@ iconv_t cd = iconv_open("","");
        iconv_close(cd);
 ; return 0; }
 EOF
-if { (eval echo configure:3071: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3090: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   am_cv_func_iconv=yes
 else
@@ -3079,7 +3098,7 @@ rm -f conftest*
       am_save_LIBS="$LIBS"
       LIBS="$LIBS -liconv"
       cat > conftest.$ac_ext <<EOF
-#line 3083 "configure"
+#line 3102 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 #include <iconv.h>
@@ -3089,7 +3108,7 @@ iconv_t cd = iconv_open("","");
          iconv_close(cd);
 ; return 0; }
 EOF
-if { (eval echo configure:3093: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3112: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   am_cv_lib_iconv=yes
         am_cv_func_iconv=yes
@@ -3110,13 +3129,13 @@ echo "$ac_t""$am_cv_func_iconv" 1>&6
 EOF
 
     echo $ac_n "checking for iconv declaration""... $ac_c" 1>&6
-echo "configure:3114: checking for iconv declaration" >&5
+echo "configure:3133: checking for iconv declaration" >&5
     if eval "test \"`echo '$''{'am_cv_proto_iconv'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
       cat > conftest.$ac_ext <<EOF
-#line 3120 "configure"
+#line 3139 "configure"
 #include "confdefs.h"
 
 #include <stdlib.h>
@@ -3135,7 +3154,7 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:3139: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3158: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   am_cv_proto_iconv_arg1=""
 else
@@ -3164,19 +3183,19 @@ EOF
 
    
   echo $ac_n "checking for nl_langinfo and CODESET""... $ac_c" 1>&6
-echo "configure:3168: checking for nl_langinfo and CODESET" >&5
+echo "configure:3187: checking for nl_langinfo and CODESET" >&5
 if eval "test \"`echo '$''{'am_cv_langinfo_codeset'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3173 "configure"
+#line 3192 "configure"
 #include "confdefs.h"
 #include <langinfo.h>
 int main() {
 char* cs = nl_langinfo(CODESET);
 ; return 0; }
 EOF
-if { (eval echo configure:3180: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3199: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   am_cv_langinfo_codeset=yes
 else
@@ -3199,19 +3218,19 @@ EOF
 
    if test $ac_cv_header_locale_h = yes; then
     echo $ac_n "checking for LC_MESSAGES""... $ac_c" 1>&6
-echo "configure:3203: checking for LC_MESSAGES" >&5
+echo "configure:3222: checking for LC_MESSAGES" >&5
 if eval "test \"`echo '$''{'am_cv_val_LC_MESSAGES'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3208 "configure"
+#line 3227 "configure"
 #include "confdefs.h"
 #include <locale.h>
 int main() {
 return LC_MESSAGES
 ; return 0; }
 EOF
-if { (eval echo configure:3215: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3234: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   am_cv_val_LC_MESSAGES=yes
 else
@@ -3232,8 +3251,9 @@ EOF
     fi
   fi
    echo $ac_n "checking whether NLS is requested""... $ac_c" 1>&6
-echo "configure:3236: checking whether NLS is requested" >&5
+echo "configure:3255: checking whether NLS is requested" >&5
         
+    
 # Check whether --enable-nls or --disable-nls was given.
 if test "${enable_nls+set}" = set; then
   enableval="$enable_nls"
@@ -3255,7 +3275,7 @@ fi
 EOF
 
       echo $ac_n "checking whether included gettext is requested""... $ac_c" 1>&6
-echo "configure:3259: checking whether included gettext is requested" >&5
+echo "configure:3279: checking whether included gettext is requested" >&5
       
 # Check whether --with-included-gettext or --without-included-gettext was given.
 if test "${with_included_gettext+set}" = set; then
@@ -3276,17 +3296,17 @@ fi
 
 	ac_safe=`echo "libintl.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for libintl.h""... $ac_c" 1>&6
-echo "configure:3280: checking for libintl.h" >&5
+echo "configure:3300: checking for libintl.h" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3285 "configure"
+#line 3305 "configure"
 #include "confdefs.h"
 #include <libintl.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3290: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3310: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -3303,12 +3323,12 @@ fi
 if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
   echo "$ac_t""yes" 1>&6
   echo $ac_n "checking for GNU gettext in libc""... $ac_c" 1>&6
-echo "configure:3307: checking for GNU gettext in libc" >&5
+echo "configure:3327: checking for GNU gettext in libc" >&5
 if eval "test \"`echo '$''{'gt_cv_func_gnugettext1_libc'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3312 "configure"
+#line 3332 "configure"
 #include "confdefs.h"
 #include <libintl.h>
 extern int _nl_msg_cat_cntr;
@@ -3317,7 +3337,7 @@ bindtextdomain ("", "");
 return (int) gettext ("") + _nl_msg_cat_cntr
 ; return 0; }
 EOF
-if { (eval echo configure:3321: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3341: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   gt_cv_func_gnugettext1_libc=yes
 else
@@ -3333,14 +3353,14 @@ echo "$ac_t""$gt_cv_func_gnugettext1_libc" 1>&6
 
 	   if test "$gt_cv_func_gnugettext1_libc" != "yes"; then
 	     echo $ac_n "checking for GNU gettext in libintl""... $ac_c" 1>&6
-echo "configure:3337: checking for GNU gettext in libintl" >&5
+echo "configure:3357: checking for GNU gettext in libintl" >&5
 if eval "test \"`echo '$''{'gt_cv_func_gnugettext1_libintl'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   gt_save_LIBS="$LIBS"
 		LIBS="$LIBS -lintl $LIBICONV"
 		cat > conftest.$ac_ext <<EOF
-#line 3344 "configure"
+#line 3364 "configure"
 #include "confdefs.h"
 #include <libintl.h>
 extern int _nl_msg_cat_cntr;
@@ -3349,7 +3369,7 @@ bindtextdomain ("", "");
 return (int) gettext ("") + _nl_msg_cat_cntr
 ; return 0; }
 EOF
-if { (eval echo configure:3353: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3373: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   gt_cv_func_gnugettext1_libintl=yes
 else
@@ -3382,12 +3402,12 @@ EOF
 	     for ac_func in dcgettext
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3386: checking for $ac_func" >&5
+echo "configure:3406: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3391 "configure"
+#line 3411 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -3410,7 +3430,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:3414: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3434: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -3440,7 +3460,7 @@ done
 
 set dummy msgfmt; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3444: checking for $ac_word" >&5
+echo "configure:3464: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_MSGFMT'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3474,7 +3494,7 @@ fi
 	     # Extract the first word of "gmsgfmt", so it can be a program name with args.
 set dummy gmsgfmt; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3478: checking for $ac_word" >&5
+echo "configure:3498: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3512,7 +3532,7 @@ fi
 
 set dummy xgettext; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3516: checking for $ac_word" >&5
+echo "configure:3536: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3563,7 +3583,7 @@ fi
 
 set dummy msgfmt; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3567: checking for $ac_word" >&5
+echo "configure:3587: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_MSGFMT'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3597,7 +3617,7 @@ fi
         # Extract the first word of "gmsgfmt", so it can be a program name with args.
 set dummy gmsgfmt; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3601: checking for $ac_word" >&5
+echo "configure:3621: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3634,7 +3654,7 @@ fi
 
 set dummy xgettext; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3638: checking for $ac_word" >&5
+echo "configure:3658: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3706,7 +3726,7 @@ do
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3710: checking for $ac_word" >&5
+echo "configure:3730: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_INTLBISON'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3739,7 +3759,7 @@ done
       ac_verc_fail=yes
     else
             echo $ac_n "checking version of bison""... $ac_c" 1>&6
-echo "configure:3743: checking version of bison" >&5
+echo "configure:3763: checking version of bison" >&5
       ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'`
       case $ac_prog_version in
         '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
@@ -3786,7 +3806,7 @@ echo "configure:3743: checking version of bison" >&5
        LINGUAS=
      else
        echo $ac_n "checking for catalogs to be installed""... $ac_c" 1>&6
-echo "configure:3790: checking for catalogs to be installed" >&5
+echo "configure:3810: checking for catalogs to be installed" >&5
        NEW_LINGUAS=
        for presentlang in $ALL_LINGUAS; do
          useit=no
@@ -3824,7 +3844,7 @@ echo "configure:3790: checking for catalogs to be installed" >&5
 
       INTL_LIBTOOL_SUFFIX_PREFIX=
    
-  
+
 
 INTLDIR_MAKE=
 MSG_DIR_MAKE=
@@ -3834,7 +3854,7 @@ use_our_messages=no
 if test "$USE_NLS" = yes ; then
 if test -d $srcdir/po ; then
 echo $ac_n "checking if we should use included message-library""... $ac_c" 1>&6
-echo "configure:3838: checking if we should use included message-library" >&5
+echo "configure:3858: checking if we should use included message-library" >&5
 	
 # Check whether --enable-included-msgs or --disable-included-msgs was given.
 if test "${enable_included_msgs+set}" = set; then
@@ -3878,17 +3898,17 @@ elif test "$USE_NLS" = yes ; then
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:3882: checking for $ac_hdr" >&5
+echo "configure:3902: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3887 "configure"
+#line 3907 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3892: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3912: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -4010,7 +4030,7 @@ eval NLS_DATADIR="$withval"
 
 
 echo $ac_n "checking if you want full utility pathnames""... $ac_c" 1>&6
-echo "configure:4014: checking if you want full utility pathnames" >&5
+echo "configure:4034: checking if you want full utility pathnames" >&5
 
 # Check whether --enable-full-paths or --disable-full-paths was given.
 if test "${enable_full_paths+set}" = set; then
@@ -4035,7 +4055,7 @@ EOF
 
 
 echo $ac_n "checking for system mailer""... $ac_c" 1>&6
-echo "configure:4039: checking for system mailer" >&5
+echo "configure:4059: checking for system mailer" >&5
 if eval "test \"`echo '$''{'cf_cv_SYSTEM_MAIL'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4062,7 +4082,7 @@ EOF
 
 
 echo $ac_n "checking system mail flags""... $ac_c" 1>&6
-echo "configure:4066: checking system mail flags" >&5
+echo "configure:4086: checking system mail flags" >&5
 if eval "test \"`echo '$''{'cf_cv_system_mail_flags'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4089,13 +4109,13 @@ fi
 
 
 echo $ac_n "checking if we must define _GNU_SOURCE""... $ac_c" 1>&6
-echo "configure:4093: checking if we must define _GNU_SOURCE" >&5
+echo "configure:4113: checking if we must define _GNU_SOURCE" >&5
 if eval "test \"`echo '$''{'cf_cv_gnu_source'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
 cat > conftest.$ac_ext <<EOF
-#line 4099 "configure"
+#line 4119 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 int main() {
@@ -4105,7 +4125,7 @@ make an error
 #endif
 ; return 0; }
 EOF
-if { (eval echo configure:4109: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4129: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cf_cv_gnu_source=no
 else
@@ -4115,7 +4135,7 @@ else
   cf_save="$CPPFLAGS"
 	 CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
 	 cat > conftest.$ac_ext <<EOF
-#line 4119 "configure"
+#line 4139 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 int main() {
@@ -4125,7 +4145,7 @@ make an error
 #endif
 ; return 0; }
 EOF
-if { (eval echo configure:4129: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4149: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cf_cv_gnu_source=no
 else
@@ -4188,14 +4208,14 @@ fi
 
 if test "$cf_check_cflags" != "$CFLAGS" ; then
 cat > conftest.$ac_ext <<EOF
-#line 4192 "configure"
+#line 4212 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 int main() {
 printf("Hello world");
 ; return 0; }
 EOF
-if { (eval echo configure:4199: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4219: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   :
 else
   echo "configure: failed program was:" >&5
@@ -4218,7 +4238,7 @@ fi
 ### Look for network libraries first, since some functions (such as gethostname)
 ### are used in a lot of places.
 echo $ac_n "checking if you want ssl library""... $ac_c" 1>&6
-echo "configure:4222: checking if you want ssl library" >&5
+echo "configure:4242: checking if you want ssl library" >&5
 if eval "test \"`echo '$''{'cf_cv_use_libssl'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4238,7 +4258,7 @@ fi
 echo "$ac_t""$cf_cv_use_libssl" 1>&6
 
 echo $ac_n "checking if you want socks library""... $ac_c" 1>&6
-echo "configure:4242: checking if you want socks library" >&5
+echo "configure:4262: checking if you want socks library" >&5
 if eval "test \"`echo '$''{'cf_cv_use_libsocks'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4258,7 +4278,7 @@ fi
 echo "$ac_t""$cf_cv_use_libsocks" 1>&6
 
 echo $ac_n "checking if you want socks5 library""... $ac_c" 1>&6
-echo "configure:4262: checking if you want socks5 library" >&5
+echo "configure:4282: checking if you want socks5 library" >&5
 if eval "test \"`echo '$''{'cf_cv_use_libsocks5'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4334,7 +4354,7 @@ cat >> confdefs.h <<\EOF
 EOF
 
 cat > conftest.$ac_ext <<EOF
-#line 4338 "configure"
+#line 4358 "configure"
 #include "confdefs.h"
 
 #include <stdio.h>
@@ -4343,7 +4363,7 @@ int main() {
 	accept((char *)0)
 ; return 0; }
 EOF
-if { (eval echo configure:4347: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4367: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   :
 else
   echo "configure: failed program was:" >&5
@@ -4382,10 +4402,10 @@ cat >> confdefs.h <<\EOF
 EOF
 
 echo $ac_n "checking if the socks library uses socks4 prefix""... $ac_c" 1>&6
-echo "configure:4386: checking if the socks library uses socks4 prefix" >&5
+echo "configure:4406: checking if the socks library uses socks4 prefix" >&5
 cf_use_socks4=error
 cat > conftest.$ac_ext <<EOF
-#line 4389 "configure"
+#line 4409 "configure"
 #include "confdefs.h"
 
 #include <socks.h>
@@ -4394,7 +4414,7 @@ int main() {
 	Rinit((char *)0)
 ; return 0; }
 EOF
-if { (eval echo configure:4398: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4418: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   cat >> confdefs.h <<\EOF
 #define USE_SOCKS4_PREFIX 1
@@ -4406,14 +4426,14 @@ else
   cat conftest.$ac_ext >&5
   rm -rf conftest*
   cat > conftest.$ac_ext <<EOF
-#line 4410 "configure"
+#line 4430 "configure"
 #include "confdefs.h"
 #include <socks.h>
 int main() {
 SOCKSinit((char *)0)
 ; return 0; }
 EOF
-if { (eval echo configure:4417: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4437: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   cf_use_socks4=no
 else
@@ -4478,9 +4498,9 @@ EOF
 
 fi
 echo $ac_n "checking if socks5p.h is available""... $ac_c" 1>&6
-echo "configure:4482: checking if socks5p.h is available" >&5
+echo "configure:4502: checking if socks5p.h is available" >&5
 cat > conftest.$ac_ext <<EOF
-#line 4484 "configure"
+#line 4504 "configure"
 #include "confdefs.h"
 
 #define INCLUDE_PROTOTYPES
@@ -4490,7 +4510,7 @@ int main() {
 	init((char *)0)
 ; return 0; }
 EOF
-if { (eval echo configure:4494: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4514: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cf_use_socks5p_h=yes
 else
@@ -4510,7 +4530,7 @@ else
 	
 cf_test_netlibs=no
 echo $ac_n "checking for network libraries""... $ac_c" 1>&6
-echo "configure:4514: checking for network libraries" >&5
+echo "configure:4534: checking for network libraries" >&5
 if eval "test \"`echo '$''{'cf_cv_netlibs'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4521,12 +4541,12 @@ cf_test_netlibs=yes
 for ac_func in gethostname
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:4525: checking for $ac_func" >&5
+echo "configure:4545: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4530 "configure"
+#line 4550 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -4549,7 +4569,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:4553: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4573: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -4572,7 +4592,7 @@ else
   echo "$ac_t""no" 1>&6
 
 echo $ac_n "checking for gethostname in -lnsl""... $ac_c" 1>&6
-echo "configure:4576: checking for gethostname in -lnsl" >&5
+echo "configure:4596: checking for gethostname in -lnsl" >&5
 ac_lib_var=`echo nsl'_'gethostname | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -4580,7 +4600,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lnsl $cf_cv_netlibs $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 4584 "configure"
+#line 4604 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -4591,7 +4611,7 @@ int main() {
 gethostname()
 ; return 0; }
 EOF
-if { (eval echo configure:4595: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4615: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -4624,7 +4644,7 @@ else
 	
 		
 echo $ac_n "checking for gethostname in -lsocket""... $ac_c" 1>&6
-echo "configure:4628: checking for gethostname in -lsocket" >&5
+echo "configure:4648: checking for gethostname in -lsocket" >&5
 ac_lib_var=`echo socket'_'gethostname | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -4632,7 +4652,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lsocket $cf_cv_netlibs $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 4636 "configure"
+#line 4656 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -4643,7 +4663,7 @@ int main() {
 gethostname()
 ; return 0; }
 EOF
-if { (eval echo configure:4647: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4667: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -4688,7 +4708,7 @@ done
 # I don't know the entrypoints - 97/7/22 TD
 # AC_HAVE_LIBRARY(inet,cf_cv_netlibs="-linet $cf_cv_netlibs")
 echo $ac_n "checking for main in -linet""... $ac_c" 1>&6
-echo "configure:4692: checking for main in -linet" >&5
+echo "configure:4712: checking for main in -linet" >&5
 ac_lib_var=`echo inet'_'main | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -4696,14 +4716,14 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-linet  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 4700 "configure"
+#line 4720 "configure"
 #include "confdefs.h"
 
 int main() {
 main()
 ; return 0; }
 EOF
-if { (eval echo configure:4707: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4727: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -4728,12 +4748,12 @@ if test "$ac_cv_func_lsocket" != no ; then
 for ac_func in socket
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:4732: checking for $ac_func" >&5
+echo "configure:4752: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4737 "configure"
+#line 4757 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -4756,7 +4776,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:4760: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4780: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -4779,7 +4799,7 @@ else
   echo "$ac_t""no" 1>&6
 
 echo $ac_n "checking for socket in -lsocket""... $ac_c" 1>&6
-echo "configure:4783: checking for socket in -lsocket" >&5
+echo "configure:4803: checking for socket in -lsocket" >&5
 ac_lib_var=`echo socket'_'socket | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -4787,7 +4807,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lsocket $cf_cv_netlibs $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 4791 "configure"
+#line 4811 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -4798,7 +4818,7 @@ int main() {
 socket()
 ; return 0; }
 EOF
-if { (eval echo configure:4802: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4822: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -4831,7 +4851,7 @@ else
 	
 		
 echo $ac_n "checking for socket in -lbsd""... $ac_c" 1>&6
-echo "configure:4835: checking for socket in -lbsd" >&5
+echo "configure:4855: checking for socket in -lbsd" >&5
 ac_lib_var=`echo bsd'_'socket | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -4839,7 +4859,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lbsd $cf_cv_netlibs $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 4843 "configure"
+#line 4863 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -4850,7 +4870,7 @@ int main() {
 socket()
 ; return 0; }
 EOF
-if { (eval echo configure:4854: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4874: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -4895,12 +4915,12 @@ fi
 for ac_func in gethostbyname
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:4899: checking for $ac_func" >&5
+echo "configure:4919: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4904 "configure"
+#line 4924 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -4923,7 +4943,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:4927: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4947: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -4946,7 +4966,7 @@ else
   echo "$ac_t""no" 1>&6
 
 echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6
-echo "configure:4950: checking for gethostbyname in -lnsl" >&5
+echo "configure:4970: checking for gethostbyname in -lnsl" >&5
 ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -4954,7 +4974,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lnsl $cf_cv_netlibs $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 4958 "configure"
+#line 4978 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -4965,7 +4985,7 @@ int main() {
 gethostbyname()
 ; return 0; }
 EOF
-if { (eval echo configure:4969: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4989: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -5006,12 +5026,12 @@ done
 for ac_func in strcasecmp
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:5010: checking for $ac_func" >&5
+echo "configure:5030: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5015 "configure"
+#line 5035 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -5034,7 +5054,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:5038: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5058: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -5057,7 +5077,7 @@ else
   echo "$ac_t""no" 1>&6
 
 echo $ac_n "checking for strcasecmp in -lresolv""... $ac_c" 1>&6
-echo "configure:5061: checking for strcasecmp in -lresolv" >&5
+echo "configure:5081: checking for strcasecmp in -lresolv" >&5
 ac_lib_var=`echo resolv'_'strcasecmp | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -5065,7 +5085,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lresolv $cf_cv_netlibs $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 5069 "configure"
+#line 5089 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -5076,7 +5096,7 @@ int main() {
 strcasecmp()
 ; return 0; }
 EOF
-if { (eval echo configure:5080: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5100: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -5122,13 +5142,13 @@ test $cf_test_netlibs = no && echo "$cf_cv_netlibs" >&6
 fi
 
 echo $ac_n "checking for inet_aton function""... $ac_c" 1>&6
-echo "configure:5126: checking for inet_aton function" >&5
+echo "configure:5146: checking for inet_aton function" >&5
 if eval "test \"`echo '$''{'cf_cv_have_inet_aton'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
 cat > conftest.$ac_ext <<EOF
-#line 5132 "configure"
+#line 5152 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/socket.h>
@@ -5139,7 +5159,7 @@ int main() {
 inet_aton(0, (struct in_addr *)0)
 ; return 0; }
 EOF
-if { (eval echo configure:5143: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5163: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   cf_cv_have_inet_aton=yes
 else
@@ -5159,13 +5179,13 @@ EOF
 
 else
     echo $ac_n "checking for inet_addr function""... $ac_c" 1>&6
-echo "configure:5163: checking for inet_addr function" >&5
+echo "configure:5183: checking for inet_addr function" >&5
 if eval "test \"`echo '$''{'cf_cv_have_inet_addr'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
     cat > conftest.$ac_ext <<EOF
-#line 5169 "configure"
+#line 5189 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/socket.h>
@@ -5176,7 +5196,7 @@ int main() {
 inet_addr(0)
 ; return 0; }
 EOF
-if { (eval echo configure:5180: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5200: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   cf_cv_have_inet_addr=yes
 else
@@ -5191,7 +5211,7 @@ fi
 echo "$ac_t""$cf_cv_have_inet_addr" 1>&6
     if test "$cf_cv_have_inet_addr" = no ; then
 	echo $ac_n "checking for library with inet_addr""... $ac_c" 1>&6
-echo "configure:5195: checking for library with inet_addr" >&5
+echo "configure:5215: checking for library with inet_addr" >&5
 if eval "test \"`echo '$''{'cf_cv_lib_inet_addr'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -5201,7 +5221,7 @@ else
 	    do
 		LIBS="$cf_save_LIBS $cf_inetlib"
 		cat > conftest.$ac_ext <<EOF
-#line 5205 "configure"
+#line 5225 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/socket.h>
@@ -5212,7 +5232,7 @@ int main() {
 inet_addr(0)
 ; return 0; }
 EOF
-if { (eval echo configure:5216: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5236: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   cf_cv_lib_inet_addr=$cf_inetlib
 else
@@ -5245,7 +5265,7 @@ no) #(vi
   ;;
 yes) #(vi
   echo $ac_n "checking for SSL_get_version in -lssl""... $ac_c" 1>&6
-echo "configure:5249: checking for SSL_get_version in -lssl" >&5
+echo "configure:5269: checking for SSL_get_version in -lssl" >&5
 ac_lib_var=`echo ssl'_'SSL_get_version | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -5253,7 +5273,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lssl -lcrypto $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 5257 "configure"
+#line 5277 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -5264,7 +5284,7 @@ int main() {
 SSL_get_version()
 ; return 0; }
 EOF
-if { (eval echo configure:5268: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5288: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -5319,9 +5339,9 @@ esac
 LIBS="$cf_ssl_library $LIBS"
 
 echo $ac_n "checking for openssl include directory""... $ac_c" 1>&6
-echo "configure:5323: checking for openssl include directory" >&5
+echo "configure:5343: checking for openssl include directory" >&5
 cat > conftest.$ac_ext <<EOF
-#line 5325 "configure"
+#line 5345 "configure"
 #include "confdefs.h"
 
 #include <stdio.h>
@@ -5330,7 +5350,7 @@ int main() {
 SSL_shutdown((SSL *)0)
 ; return 0; }
 EOF
-if { (eval echo configure:5334: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5354: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cf_openssl_incl=yes
 else
@@ -5347,9 +5367,9 @@ EOF
 
 
 echo $ac_n "checking if we can link to ssl library""... $ac_c" 1>&6
-echo "configure:5351: checking if we can link to ssl library" >&5
+echo "configure:5371: checking if we can link to ssl library" >&5
 cat > conftest.$ac_ext <<EOF
-#line 5353 "configure"
+#line 5373 "configure"
 #include "confdefs.h"
 
 #include <stdio.h>
@@ -5363,7 +5383,7 @@ int main() {
 SSL_shutdown((SSL *)0)
 ; return 0; }
 EOF
-if { (eval echo configure:5367: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5387: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   cf_ssl_library=yes
 else
@@ -5386,7 +5406,7 @@ fi
 fi
 
 echo $ac_n "checking for screen type""... $ac_c" 1>&6
-echo "configure:5390: checking for screen type" >&5
+echo "configure:5410: checking for screen type" >&5
 if eval "test \"`echo '$''{'cf_cv_screen'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -5412,16 +5432,43 @@ fi
 echo "$ac_t""$cf_cv_screen" 1>&6
 
 case $cf_cv_screen in
-ncurses|ncursesw|slang)
-	;;
-pdcurses)
-	cf_cv_ncurses_header=xcurses.h
+curses|ncurses*)
+	
+
+# Check whether --with-curses-dir or --without-curses-dir was given.
+if test "${with_curses_dir+set}" = set; then
+  withval="$with_curses_dir"
+  
+case ".$withval" in #(vi
+.\$\(*\)*|.\'*\'*) #(vi
+  ;;
+..|./*|.\\*) #(vi
+  ;;
+.[a-zA-Z]:[\\/]*) #(vi OS/2 EMX
+  ;;
+.\${*prefix}*) #(vi
+  eval withval="$withval"
+  case ".$withval" in #(vi
+  .NONE/*)
+    withval=`echo $withval | sed -e s%NONE%$ac_default_prefix%`
+    ;;
+  esac
+  ;; #(vi
+.NONE/*)
+  withval=`echo $withval | sed -e s%NONE%$ac_default_prefix%`
+  ;;
+*)
+  { echo "configure: error: expected a pathname, not \"$withval\"" 1>&2; exit 1; }
+  ;;
+esac
+
+	 cf_cv_curses_dir=$withval
+else
+  cf_cv_curses_dir=no
+fi
+
+
 	;;
-#curses)
-#	if eval "test \"`echo '$''{'cf_cv_ncurses_header'+set}'`\" != set"; then
-#		cf_cv_ncurses_header=curses.h
-#	fi
-#	;;
 esac
 
 case $cf_cv_screen in
@@ -5429,7 +5476,7 @@ curses)
 	
 
 echo $ac_n "checking for extra include directories""... $ac_c" 1>&6
-echo "configure:5433: checking for extra include directories" >&5
+echo "configure:5480: checking for extra include directories" >&5
 if eval "test \"`echo '$''{'cf_cv_curses_incdir'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -5453,7 +5500,7 @@ echo "$ac_t""$cf_cv_curses_incdir" 1>&6
 test "$cf_cv_curses_incdir" != no && CPPFLAGS="$CPPFLAGS $cf_cv_curses_incdir"
 
 echo $ac_n "checking if we have identified curses headers""... $ac_c" 1>&6
-echo "configure:5457: checking if we have identified curses headers" >&5
+echo "configure:5504: checking if we have identified curses headers" >&5
 if eval "test \"`echo '$''{'cf_cv_ncurses_header'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -5466,14 +5513,14 @@ for cf_header in \
 	ncurses/ncurses.h
 do
 cat > conftest.$ac_ext <<EOF
-#line 5470 "configure"
+#line 5517 "configure"
 #include "confdefs.h"
 #include <${cf_header}>
 int main() {
 initscr(); tgoto("?", 0,0)
 ; return 0; }
 EOF
-if { (eval echo configure:5477: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5524: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cf_cv_ncurses_header=$cf_header; break
 else
@@ -5496,17 +5543,17 @@ for ac_hdr in $cf_cv_ncurses_header
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:5500: checking for $ac_hdr" >&5
+echo "configure:5547: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5505 "configure"
+#line 5552 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5510: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5557: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -5536,7 +5583,7 @@ done
 
 	
 echo $ac_n "checking for ncurses version""... $ac_c" 1>&6
-echo "configure:5540: checking for ncurses version" >&5
+echo "configure:5587: checking for ncurses version" >&5
 if eval "test \"`echo '$''{'cf_cv_ncurses_version'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -5562,7 +5609,7 @@ Autoconf "old"
 #endif
 EOF
 	cf_try="$ac_cpp conftest.$ac_ext 2>&5 | grep '^Autoconf ' >conftest.out"
-	{ (eval echo configure:5566: \"$cf_try\") 1>&5; (eval $cf_try) 2>&5; }
+	{ (eval echo configure:5613: \"$cf_try\") 1>&5; (eval $cf_try) 2>&5; }
 	if test -f conftest.out ; then
 		cf_out=`cat conftest.out | sed -e 's%^Autoconf %%' -e 's%^[^"]*"%%' -e 's%".*%%'`
 		test -n "$cf_out" && cf_cv_ncurses_version="$cf_out"
@@ -5571,7 +5618,7 @@ EOF
 
 else
   cat > conftest.$ac_ext <<EOF
-#line 5575 "configure"
+#line 5622 "configure"
 #include "confdefs.h"
 
 #include <${cf_cv_ncurses_header-curses.h}>
@@ -5595,7 +5642,7 @@ int main()
 	exit(0);
 }
 EOF
-if { (eval echo configure:5599: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:5646: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   
 	cf_cv_ncurses_version=`cat $cf_tempfile`
@@ -5619,16 +5666,16 @@ EOF
 	
 
 echo $ac_n "checking if we have identified curses libraries""... $ac_c" 1>&6
-echo "configure:5623: checking if we have identified curses libraries" >&5
+echo "configure:5670: checking if we have identified curses libraries" >&5
 cat > conftest.$ac_ext <<EOF
-#line 5625 "configure"
+#line 5672 "configure"
 #include "confdefs.h"
 #include <${cf_cv_ncurses_header-curses.h}>
 int main() {
 initscr(); tgoto("?", 0,0)
 ; return 0; }
 EOF
-if { (eval echo configure:5632: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5679: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   cf_result=yes
 else
@@ -5644,7 +5691,7 @@ if test "$cf_result" = no ; then
 case $host_os in #(vi
 freebsd*) #(vi
 	echo $ac_n "checking for tgoto in -lmytinfo""... $ac_c" 1>&6
-echo "configure:5648: checking for tgoto in -lmytinfo" >&5
+echo "configure:5695: checking for tgoto in -lmytinfo" >&5
 ac_lib_var=`echo mytinfo'_'tgoto | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -5652,7 +5699,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lmytinfo  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 5656 "configure"
+#line 5703 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -5663,7 +5710,7 @@ int main() {
 tgoto()
 ; return 0; }
 EOF
-if { (eval echo configure:5667: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5714: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -5686,7 +5733,7 @@ fi
 	;;
 hpux10.*|hpux11.*) #(vi
 	echo $ac_n "checking for initscr in -lcur_colr""... $ac_c" 1>&6
-echo "configure:5690: checking for initscr in -lcur_colr" >&5
+echo "configure:5737: checking for initscr in -lcur_colr" >&5
 ac_lib_var=`echo cur_colr'_'initscr | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -5694,7 +5741,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lcur_colr  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 5698 "configure"
+#line 5745 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -5705,7 +5752,7 @@ int main() {
 initscr()
 ; return 0; }
 EOF
-if { (eval echo configure:5709: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5756: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -5728,7 +5775,7 @@ else
   echo "$ac_t""no" 1>&6
 
 	echo $ac_n "checking for initscr in -lHcurses""... $ac_c" 1>&6
-echo "configure:5732: checking for initscr in -lHcurses" >&5
+echo "configure:5779: checking for initscr in -lHcurses" >&5
 ac_lib_var=`echo Hcurses'_'initscr | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -5736,7 +5783,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lHcurses  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 5740 "configure"
+#line 5787 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -5747,7 +5794,7 @@ int main() {
 initscr()
 ; return 0; }
 EOF
-if { (eval echo configure:5751: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5798: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -5800,12 +5847,12 @@ if test ".$ac_cv_func_initscr" != .yes ; then
 	# Check for library containing tgoto.  Do this before curses library
 	# because it may be needed to link the test-case for initscr.
 	echo $ac_n "checking for tgoto""... $ac_c" 1>&6
-echo "configure:5804: checking for tgoto" >&5
+echo "configure:5851: checking for tgoto" >&5
 if eval "test \"`echo '$''{'ac_cv_func_tgoto'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5809 "configure"
+#line 5856 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char tgoto(); below.  */
@@ -5828,7 +5875,7 @@ tgoto();
 
 ; return 0; }
 EOF
-if { (eval echo configure:5832: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5879: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_tgoto=yes"
 else
@@ -5849,7 +5896,7 @@ else
 		for cf_term_lib in $cf_check_list termcap termlib unknown
 		do
 			echo $ac_n "checking for tgoto in -l$cf_term_lib""... $ac_c" 1>&6
-echo "configure:5853: checking for tgoto in -l$cf_term_lib" >&5
+echo "configure:5900: checking for tgoto in -l$cf_term_lib" >&5
 ac_lib_var=`echo $cf_term_lib'_'tgoto | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -5857,7 +5904,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-l$cf_term_lib  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 5861 "configure"
+#line 5908 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -5868,7 +5915,7 @@ int main() {
 tgoto()
 ; return 0; }
 EOF
-if { (eval echo configure:5872: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5919: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -5898,7 +5945,7 @@ fi
 	for cf_curs_lib in $cf_check_list xcurses jcurses unknown
 	do
 		echo $ac_n "checking for initscr in -l$cf_curs_lib""... $ac_c" 1>&6
-echo "configure:5902: checking for initscr in -l$cf_curs_lib" >&5
+echo "configure:5949: checking for initscr in -l$cf_curs_lib" >&5
 ac_lib_var=`echo $cf_curs_lib'_'initscr | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -5906,7 +5953,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-l$cf_curs_lib  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 5910 "configure"
+#line 5957 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -5917,7 +5964,7 @@ int main() {
 initscr()
 ; return 0; }
 EOF
-if { (eval echo configure:5921: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5968: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -5943,16 +5990,16 @@ fi
 	LIBS="-l$cf_curs_lib $cf_save_LIBS"
 	if test "$cf_term_lib" = unknown ; then
 		echo $ac_n "checking if we can link with $cf_curs_lib library""... $ac_c" 1>&6
-echo "configure:5947: checking if we can link with $cf_curs_lib library" >&5
+echo "configure:5994: checking if we can link with $cf_curs_lib library" >&5
 		cat > conftest.$ac_ext <<EOF
-#line 5949 "configure"
+#line 5996 "configure"
 #include "confdefs.h"
 #include <${cf_cv_ncurses_header-curses.h}>
 int main() {
 initscr()
 ; return 0; }
 EOF
-if { (eval echo configure:5956: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6003: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   cf_result=yes
 else
@@ -5968,16 +6015,16 @@ rm -f conftest*
 		:
 	elif test "$cf_term_lib" != predefined ; then
 		echo $ac_n "checking if we need both $cf_curs_lib and $cf_term_lib libraries""... $ac_c" 1>&6
-echo "configure:5972: checking if we need both $cf_curs_lib and $cf_term_lib libraries" >&5
+echo "configure:6019: checking if we need both $cf_curs_lib and $cf_term_lib libraries" >&5
 		cat > conftest.$ac_ext <<EOF
-#line 5974 "configure"
+#line 6021 "configure"
 #include "confdefs.h"
 #include <${cf_cv_ncurses_header-curses.h}>
 int main() {
 initscr(); tgoto((char *)0, 0, 0);
 ; return 0; }
 EOF
-if { (eval echo configure:5981: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6028: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   cf_result=no
 else
@@ -5987,14 +6034,14 @@ else
   
 			LIBS="-l$cf_curs_lib -l$cf_term_lib $cf_save_LIBS"
 			cat > conftest.$ac_ext <<EOF
-#line 5991 "configure"
+#line 6038 "configure"
 #include "confdefs.h"
 #include <${cf_cv_ncurses_header-curses.h}>
 int main() {
 initscr()
 ; return 0; }
 EOF
-if { (eval echo configure:5998: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6045: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   cf_result=yes
 else
@@ -6015,14 +6062,14 @@ fi
 
 	
 echo $ac_n "checking for curses performance tradeoff""... $ac_c" 1>&6
-echo "configure:6019: checking for curses performance tradeoff" >&5
+echo "configure:6066: checking for curses performance tradeoff" >&5
 if eval "test \"`echo '$''{'cf_cv_curs_performance'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
     cf_cv_curs_performance=no
     cat > conftest.$ac_ext <<EOF
-#line 6026 "configure"
+#line 6073 "configure"
 #include "confdefs.h"
 
 #include <${cf_cv_ncurses_header-curses.h}>
@@ -6036,11 +6083,11 @@ int main() {
 	
 ; return 0; }
 EOF
-if { (eval echo configure:6040: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6087: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   
 	cat > conftest.$ac_ext <<EOF
-#line 6044 "configure"
+#line 6091 "configure"
 #include "confdefs.h"
 
 #define CURS_PERFORMANCE
@@ -6055,7 +6102,7 @@ int main() {
 	
 ; return 0; }
 EOF
-if { (eval echo configure:6059: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6106: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cf_cv_curs_performance=yes
 else
@@ -6078,13 +6125,13 @@ EOF
 
 	
 echo $ac_n "checking for curses touchline function""... $ac_c" 1>&6
-echo "configure:6082: checking for curses touchline function" >&5
+echo "configure:6129: checking for curses touchline function" >&5
 if eval "test \"`echo '$''{'cf_cv_curs_touchline'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
 	cat > conftest.$ac_ext <<EOF
-#line 6088 "configure"
+#line 6135 "configure"
 #include "confdefs.h"
 
 #include <${cf_cv_ncurses_header-curses.h}>
@@ -6092,7 +6139,7 @@ int main() {
 touchline(stdscr, 1,2,3);
 ; return 0; }
 EOF
-if { (eval echo configure:6096: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6143: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   cf_cv_curs_touchline=bsd
 else
@@ -6100,7 +6147,7 @@ else
   cat conftest.$ac_ext >&5
   rm -rf conftest*
   cat > conftest.$ac_ext <<EOF
-#line 6104 "configure"
+#line 6151 "configure"
 #include "confdefs.h"
 
 #include <${cf_cv_ncurses_header-curses.h}>
@@ -6108,7 +6155,7 @@ int main() {
 touchline(stdscr, 1,2);
 ; return 0; }
 EOF
-if { (eval echo configure:6112: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6159: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   cf_cv_curs_touchline=sysv
 else
@@ -6141,19 +6188,25 @@ esac
 	;;
 ncurses)
 	
+
 cf_ncuhdr_root=ncurses
+
+test -n "$cf_cv_curses_dir" && \
+test "$cf_cv_curses_dir" != "no" && \
+CPPFLAGS="-I$cf_cv_curses_dir/include -I$cf_cv_curses_dir/include/$cf_ncuhdr_root $CPPFLAGS"
+
 echo $ac_n "checking for $cf_ncuhdr_root header in include-path""... $ac_c" 1>&6
-echo "configure:6147: checking for $cf_ncuhdr_root header in include-path" >&5
+echo "configure:6200: checking for $cf_ncuhdr_root header in include-path" >&5
 if eval "test \"`echo '$''{'cf_cv_ncurses_h'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
 	cf_header_list="$cf_ncuhdr_root/curses.h $cf_ncuhdr_root/ncurses.h"
-	test "$cf_ncuhdr_root" = ncurses && cf_header_list="curses.h ncurses.h $cf_header_list"
+	( test "$cf_ncuhdr_root" = ncurses || test "$cf_ncuhdr_root" = ncursesw ) && cf_header_list="curses.h ncurses.h $cf_header_list"
 	for cf_header in $cf_header_list
 	do
 	cat > conftest.$ac_ext <<EOF
-#line 6157 "configure"
+#line 6210 "configure"
 #include "confdefs.h"
 #include <$cf_header>
 int main() {
@@ -6171,7 +6224,7 @@ make an error
 	
 ; return 0; }
 EOF
-if { (eval echo configure:6175: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6228: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cf_cv_ncurses_h=$cf_header; break
 	
@@ -6192,39 +6245,76 @@ if test "$cf_cv_ncurses_h" != no ; then
 	cf_cv_ncurses_header=$cf_cv_ncurses_h
 else
 echo $ac_n "checking for $cf_ncuhdr_root include-path""... $ac_c" 1>&6
-echo "configure:6196: checking for $cf_ncuhdr_root include-path" >&5
+echo "configure:6249: checking for $cf_ncuhdr_root include-path" >&5
 if eval "test \"`echo '$''{'cf_cv_ncurses_h2'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
+	test -n "$verbose" && echo
 	cf_search=""
 
-test "$prefix" != /usr/local && \
-test -d /usr/local && \
-cf_search="$cf_search /usr/local/include /usr/local/include/$cf_ncuhdr_root /usr/local/$cf_ncuhdr_root/include"
+test -d $HOME && {
+	test -n "$verbose" && echo "	... testing include-directories under $HOME"
+	test -d $HOME/include &&    cf_search="$cf_search $HOME/include"
+	test -d $HOME/include/$cf_ncuhdr_root && cf_search="$cf_search $HOME/include/$cf_ncuhdr_root"
+}
 
-test "$includedir" != NONE && \
-test -d "$includedir" && \
-cf_search="$cf_search $includedir $includedir/$cf_ncuhdr_root"
+# For other stuff under the home directory, it should be sufficient to put
+# a symbolic link for $HOME/$cf_ncuhdr_root to the actual package location:
+test -d $HOME/$cf_ncuhdr_root && {
+	test -n "$verbose" && echo "	... testing include-directories under $HOME/$cf_ncuhdr_root"
+	test -d $HOME/$cf_ncuhdr_root/include &&    cf_search="$cf_search $HOME/$cf_ncuhdr_root/include"
+	test -d $HOME/$cf_ncuhdr_root/include/$cf_ncuhdr_root && cf_search="$cf_search $HOME/$cf_ncuhdr_root/include/$cf_ncuhdr_root"
+}
 
-test "$oldincludedir" != NONE && \
-test -d "$oldincludedir" && \
-cf_search="$cf_search $oldincludedir $oldincludedir/$cf_ncuhdr_root"
+test "$prefix" != /usr/local && \
+test -d /usr/local && {
+	test -n "$verbose" && echo "	... testing include-directories under /usr/local"
+	test -d /usr/local/include &&    cf_search="$cf_search /usr/local/include"
+	test -d /usr/local/include/$cf_ncuhdr_root && cf_search="$cf_search /usr/local/include/$cf_ncuhdr_root"
+	test -d /usr/local/$cf_ncuhdr_root/include && cf_search="$cf_search /usr/local/$cf_ncuhdr_root/include"
+}
 
 test "$prefix" != NONE && \
-test -d "$prefix" && \
-cf_search="$cf_search $prefix/include $prefix/include/$cf_ncuhdr_root $prefix/$cf_ncuhdr_root/include"
+test -d $prefix && {
+	test -n "$verbose" && echo "	... testing include-directories under $prefix"
+	test -d $prefix/include &&    cf_search="$cf_search $prefix/include"
+	test -d $prefix/include/$cf_ncuhdr_root && cf_search="$cf_search $prefix/include/$cf_ncuhdr_root"
+	test -d $prefix/$cf_ncuhdr_root/include && cf_search="$cf_search $prefix/$cf_ncuhdr_root/include"
+}
+
+test "$prefix" != /opt && \
+test -d /opt && {
+	test -n "$verbose" && echo "	... testing include-directories under /opt"
+	test -d /opt/include &&    cf_search="$cf_search /opt/include"
+	test -d /opt/include/$cf_ncuhdr_root && cf_search="$cf_search /opt/include/$cf_ncuhdr_root"
+	test -d /opt/$cf_ncuhdr_root/include && cf_search="$cf_search /opt/$cf_ncuhdr_root/include"
+}
 
 test "$prefix" != /usr && \
-cf_search="$cf_search /usr/include /usr/include/$cf_ncuhdr_root /usr/$cf_ncuhdr_root/include"
+test -d /usr && {
+	test -n "$verbose" && echo "	... testing include-directories under /usr"
+	test -d /usr/include &&    cf_search="$cf_search /usr/include"
+	test -d /usr/include/$cf_ncuhdr_root && cf_search="$cf_search /usr/include/$cf_ncuhdr_root"
+	test -d /usr/$cf_ncuhdr_root/include && cf_search="$cf_search /usr/$cf_ncuhdr_root/include"
+}
 
-test "$prefix" != /opt && \
-test -d /opt && \
-cf_search="$cf_search /opt/include /opt/include/$cf_ncuhdr_root /opt/$cf_ncuhdr_root/include"
+test "$includedir" != NONE && \
+test "$includedir" != "/usr/include" && \
+test -d "$includedir" && {
+	test -d $includedir &&    cf_search="$cf_search $includedir"
+	test -d $includedir/$cf_ncuhdr_root && cf_search="$cf_search $includedir/$cf_ncuhdr_root"
+}
 
-cf_search="$cf_search $HOME/include $HOME/include/$cf_ncuhdr_root $HOME/$cf_ncuhdr_root/include"
+test "$oldincludedir" != NONE && \
+test "$oldincludedir" != "/usr/include" && \
+test -d "$oldincludedir" && {
+	test -d $oldincludedir    && cf_search="$cf_search $oldincludedir"
+	test -d $oldincludedir/$cf_ncuhdr_root && cf_search="$cf_search $oldincludedir/$cf_ncuhdr_root"
+}
 
-	test -n "$verbose" && echo
+
+	test -n "$verbose" && echo search path $cf_search
 	for cf_incdir in $cf_search
 	do
 		for cf_header in \
@@ -6249,8 +6339,8 @@ echo "$ac_t""$cf_cv_ncurses_h2" 1>&6
 	cf_1st_incdir=`echo $cf_cv_ncurses_h2 | sed -e 's:/[^/]*$::'`
 	cf_2nd_incdir=`echo $cf_1st_incdir | sed -e 's:/[^/]*$::'`
 	cf_cv_ncurses_header=`basename $cf_cv_ncurses_h2`
-	echo cf_1st_include=$cf_1st_incdir
-	echo cf_2nd_include=$cf_2nd_incdir
+	test -n "$verbose" && echo cf_1st_include=$cf_1st_incdir
+	test -n "$verbose" && echo cf_2nd_include=$cf_2nd_incdir
 	if test `basename $cf_1st_incdir` = $cf_ncuhdr_root ; then
 		cf_cv_ncurses_header=$cf_ncuhdr_root/$cf_cv_ncurses_header
 		
@@ -6325,7 +6415,7 @@ esac
 
 
 echo $ac_n "checking for ncurses version""... $ac_c" 1>&6
-echo "configure:6329: checking for ncurses version" >&5
+echo "configure:6419: checking for ncurses version" >&5
 if eval "test \"`echo '$''{'cf_cv_ncurses_version'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -6351,7 +6441,7 @@ Autoconf "old"
 #endif
 EOF
 	cf_try="$ac_cpp conftest.$ac_ext 2>&5 | grep '^Autoconf ' >conftest.out"
-	{ (eval echo configure:6355: \"$cf_try\") 1>&5; (eval $cf_try) 2>&5; }
+	{ (eval echo configure:6445: \"$cf_try\") 1>&5; (eval $cf_try) 2>&5; }
 	if test -f conftest.out ; then
 		cf_out=`cat conftest.out | sed -e 's%^Autoconf %%' -e 's%^[^"]*"%%' -e 's%".*%%'`
 		test -n "$cf_out" && cf_cv_ncurses_version="$cf_out"
@@ -6360,7 +6450,7 @@ EOF
 
 else
   cat > conftest.$ac_ext <<EOF
-#line 6364 "configure"
+#line 6454 "configure"
 #include "confdefs.h"
 
 #include <${cf_cv_ncurses_header-curses.h}>
@@ -6384,7 +6474,7 @@ int main()
 	exit(0);
 }
 EOF
-if { (eval echo configure:6388: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:6478: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   
 	cf_cv_ncurses_version=`cat $cf_tempfile`
@@ -6415,7 +6505,7 @@ cf_nculib_root=ncurses
 cf_ncurses_LIBS=""
 cf_ncurses_SAVE="$LIBS"
 echo $ac_n "checking for Gpm_Open in -lgpm""... $ac_c" 1>&6
-echo "configure:6419: checking for Gpm_Open in -lgpm" >&5
+echo "configure:6509: checking for Gpm_Open in -lgpm" >&5
 ac_lib_var=`echo gpm'_'Gpm_Open | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -6423,7 +6513,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lgpm  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 6427 "configure"
+#line 6517 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -6434,7 +6524,7 @@ int main() {
 Gpm_Open()
 ; return 0; }
 EOF
-if { (eval echo configure:6438: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6528: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -6450,7 +6540,7 @@ fi
 if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
   echo "$ac_t""yes" 1>&6
   echo $ac_n "checking for initscr in -lgpm""... $ac_c" 1>&6
-echo "configure:6454: checking for initscr in -lgpm" >&5
+echo "configure:6544: checking for initscr in -lgpm" >&5
 ac_lib_var=`echo gpm'_'initscr | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -6458,7 +6548,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lgpm  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 6462 "configure"
+#line 6552 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -6469,7 +6559,7 @@ int main() {
 initscr()
 ; return 0; }
 EOF
-if { (eval echo configure:6473: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6563: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -6500,7 +6590,7 @@ freebsd*)
 	# This is only necessary if you are linking against an obsolete
 	# version of ncurses (but it should do no harm, since it's static).
 	echo $ac_n "checking for tgoto in -lmytinfo""... $ac_c" 1>&6
-echo "configure:6504: checking for tgoto in -lmytinfo" >&5
+echo "configure:6594: checking for tgoto in -lmytinfo" >&5
 ac_lib_var=`echo mytinfo'_'tgoto | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -6508,7 +6598,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lmytinfo  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 6512 "configure"
+#line 6602 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -6519,7 +6609,7 @@ int main() {
 tgoto()
 ; return 0; }
 EOF
-if { (eval echo configure:6523: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6613: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -6544,15 +6634,21 @@ esac
 
 LIBS="$cf_ncurses_LIBS $LIBS"
 
+
+if ( test -n "$cf_cv_curses_dir" && test "$cf_cv_curses_dir" != "no" )
+then
+	LIBS="-L$cf_cv_curses_dir/lib -l$cf_nculib_root $LIBS"
+else
+	
 	eval 'cf_cv_have_lib_'$cf_nculib_root'=no'
 	cf_libdir=""
 	echo $ac_n "checking for initscr""... $ac_c" 1>&6
-echo "configure:6551: checking for initscr" >&5
+echo "configure:6647: checking for initscr" >&5
 if eval "test \"`echo '$''{'ac_cv_func_initscr'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 6556 "configure"
+#line 6652 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char initscr(); below.  */
@@ -6575,7 +6671,7 @@ initscr();
 
 ; return 0; }
 EOF
-if { (eval echo configure:6579: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6675: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_initscr=yes"
 else
@@ -6595,17 +6691,17 @@ else
 
 		cf_save_LIBS="$LIBS"
 		echo $ac_n "checking for initscr in -l$cf_nculib_root""... $ac_c" 1>&6
-echo "configure:6599: checking for initscr in -l$cf_nculib_root" >&5
+echo "configure:6695: checking for initscr in -l$cf_nculib_root" >&5
 		LIBS="-l$cf_nculib_root $LIBS"
 		cat > conftest.$ac_ext <<EOF
-#line 6602 "configure"
+#line 6698 "configure"
 #include "confdefs.h"
 #include <${cf_cv_ncurses_header-curses.h}>
 int main() {
 initscr()
 ; return 0; }
 EOF
-if { (eval echo configure:6609: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6705: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   echo "$ac_t""yes" 1>&6
 			 eval 'cf_cv_have_lib_'$cf_nculib_root'=yes'
@@ -6617,49 +6713,66 @@ else
   echo "$ac_t""no" 1>&6
 			cf_search=""
 
-test "$prefix" != /usr/local && \
-test -d /usr/local && \
-cf_search="$cf_search /usr/local/lib /usr/local/lib/$cf_nculib_root /usr/local/$cf_nculib_root/lib"
+test -d $HOME && {
+	test -n "$verbose" && echo "	... testing lib-directories under $HOME"
+	test -d $HOME/lib &&    cf_search="$cf_search $HOME/lib"
+	test -d $HOME/lib/$cf_nculib_root && cf_search="$cf_search $HOME/lib/$cf_nculib_root"
+}
 
-test "$libdir" != NONE && \
-test -d $libdir && \
-cf_search="$cf_search $libdir $libdir/$cf_nculib_root"
+# For other stuff under the home directory, it should be sufficient to put
+# a symbolic link for $HOME/$cf_nculib_root to the actual package location:
+test -d $HOME/$cf_nculib_root && {
+	test -n "$verbose" && echo "	... testing lib-directories under $HOME/$cf_nculib_root"
+	test -d $HOME/$cf_nculib_root/lib &&    cf_search="$cf_search $HOME/$cf_nculib_root/lib"
+	test -d $HOME/$cf_nculib_root/lib/$cf_nculib_root && cf_search="$cf_search $HOME/$cf_nculib_root/lib/$cf_nculib_root"
+}
 
-test "$exec_prefix" != NONE && \
-test -d $exec_prefix && \
-cf_search="$cf_search $exec_prefix/lib $exec_prefix/lib/$cf_nculib_root"
+test "$prefix" != /usr/local && \
+test -d /usr/local && {
+	test -n "$verbose" && echo "	... testing lib-directories under /usr/local"
+	test -d /usr/local/lib &&    cf_search="$cf_search /usr/local/lib"
+	test -d /usr/local/lib/$cf_nculib_root && cf_search="$cf_search /usr/local/lib/$cf_nculib_root"
+	test -d /usr/local/$cf_nculib_root/lib && cf_search="$cf_search /usr/local/$cf_nculib_root/lib"
+}
 
 test "$prefix" != NONE && \
-test "$prefix" != "$exec_prefix" && \
-test -d $prefix && \
-cf_search="$cf_search $prefix/lib $prefix/lib/$cf_nculib_root $prefix/$cf_nculib_root/lib"
-
-test "$prefix" != /usr && \
-cf_search="$cf_search /usr/lib /usr/lib/$cf_nculib_root /usr/$cf_nculib_root/lib"
-
-test "$prefix" != / && \
-cf_search="$cf_search /lib /lib/$cf_nculib_root /$cf_nculib_root/lib"
+test -d $prefix && {
+	test -n "$verbose" && echo "	... testing lib-directories under $prefix"
+	test -d $prefix/lib &&    cf_search="$cf_search $prefix/lib"
+	test -d $prefix/lib/$cf_nculib_root && cf_search="$cf_search $prefix/lib/$cf_nculib_root"
+	test -d $prefix/$cf_nculib_root/lib && cf_search="$cf_search $prefix/$cf_nculib_root/lib"
+}
 
 test "$prefix" != /opt && \
-test -d /opt && \
-cf_search="$cf_search /opt/lib /opt/lib/$cf_nculib_root /opt/$cf_nculib_root/lib"
+test -d /opt && {
+	test -n "$verbose" && echo "	... testing lib-directories under /opt"
+	test -d /opt/lib &&    cf_search="$cf_search /opt/lib"
+	test -d /opt/lib/$cf_nculib_root && cf_search="$cf_search /opt/lib/$cf_nculib_root"
+	test -d /opt/$cf_nculib_root/lib && cf_search="$cf_search /opt/$cf_nculib_root/lib"
+}
 
-cf_search="$cf_search $HOME/lib $HOME/lib/$cf_nculib_root $HOME/$cf_nculib_root/lib"
+test "$prefix" != /usr && \
+test -d /usr && {
+	test -n "$verbose" && echo "	... testing lib-directories under /usr"
+	test -d /usr/lib &&    cf_search="$cf_search /usr/lib"
+	test -d /usr/lib/$cf_nculib_root && cf_search="$cf_search /usr/lib/$cf_nculib_root"
+	test -d /usr/$cf_nculib_root/lib && cf_search="$cf_search /usr/$cf_nculib_root/lib"
+}
 
 			for cf_libdir in $cf_search
 			do
 				echo $ac_n "checking for -l$cf_nculib_root in $cf_libdir""... $ac_c" 1>&6
-echo "configure:6653: checking for -l$cf_nculib_root in $cf_libdir" >&5
+echo "configure:6766: checking for -l$cf_nculib_root in $cf_libdir" >&5
 				LIBS="-L$cf_libdir -l$cf_nculib_root $cf_save_LIBS"
 				cat > conftest.$ac_ext <<EOF
-#line 6656 "configure"
+#line 6769 "configure"
 #include "confdefs.h"
 #include <${cf_cv_ncurses_header-curses.h}>
 int main() {
 initscr()
 ; return 0; }
 EOF
-if { (eval echo configure:6663: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6776: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   echo "$ac_t""yes" 1>&6
 			 		 eval 'cf_cv_have_lib_'$cf_nculib_root'=yes'
@@ -6686,10 +6799,11 @@ if test $cf_found_library = no ; then
 fi
 
 
+fi
 
 if test -n "$cf_ncurses_LIBS" ; then
 	echo $ac_n "checking if we can link $cf_nculib_root without $cf_ncurses_LIBS""... $ac_c" 1>&6
-echo "configure:6693: checking if we can link $cf_nculib_root without $cf_ncurses_LIBS" >&5
+echo "configure:6807: checking if we can link $cf_nculib_root without $cf_ncurses_LIBS" >&5
 	cf_ncurses_SAVE="$LIBS"
 	for p in $cf_ncurses_LIBS ; do
 		q=`echo $LIBS | sed -e 's/'$p' //' -e 's/'$p'$//'`
@@ -6698,14 +6812,14 @@ echo "configure:6693: checking if we can link $cf_nculib_root without $cf_ncurse
 		fi
 	done
 	cat > conftest.$ac_ext <<EOF
-#line 6702 "configure"
+#line 6816 "configure"
 #include "confdefs.h"
 #include <${cf_cv_ncurses_header-curses.h}>
 int main() {
 initscr(); mousemask(0,0); tgoto((char *)0, 0, 0);
 ; return 0; }
 EOF
-if { (eval echo configure:6709: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6823: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   echo "$ac_t""yes" 1>&6
 else
@@ -6720,7 +6834,7 @@ fi
 
 	
 echo $ac_n "checking for ncurses version""... $ac_c" 1>&6
-echo "configure:6724: checking for ncurses version" >&5
+echo "configure:6838: checking for ncurses version" >&5
 if eval "test \"`echo '$''{'cf_cv_ncurses_version'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -6746,7 +6860,7 @@ Autoconf "old"
 #endif
 EOF
 	cf_try="$ac_cpp conftest.$ac_ext 2>&5 | grep '^Autoconf ' >conftest.out"
-	{ (eval echo configure:6750: \"$cf_try\") 1>&5; (eval $cf_try) 2>&5; }
+	{ (eval echo configure:6864: \"$cf_try\") 1>&5; (eval $cf_try) 2>&5; }
 	if test -f conftest.out ; then
 		cf_out=`cat conftest.out | sed -e 's%^Autoconf %%' -e 's%^[^"]*"%%' -e 's%".*%%'`
 		test -n "$cf_out" && cf_cv_ncurses_version="$cf_out"
@@ -6755,7 +6869,7 @@ EOF
 
 else
   cat > conftest.$ac_ext <<EOF
-#line 6759 "configure"
+#line 6873 "configure"
 #include "confdefs.h"
 
 #include <${cf_cv_ncurses_header-curses.h}>
@@ -6779,7 +6893,7 @@ int main()
 	exit(0);
 }
 EOF
-if { (eval echo configure:6783: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:6897: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   
 	cf_cv_ncurses_version=`cat $cf_tempfile`
@@ -6804,13 +6918,13 @@ EOF
 ncursesw)
 	
 echo $ac_n "checking for multibyte character support""... $ac_c" 1>&6
-echo "configure:6808: checking for multibyte character support" >&5
+echo "configure:6922: checking for multibyte character support" >&5
 if eval "test \"`echo '$''{'cf_cv_utf8_lib'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
 cat > conftest.$ac_ext <<EOF
-#line 6814 "configure"
+#line 6928 "configure"
 #include "confdefs.h"
 
 #include <stdlib.h>
@@ -6818,7 +6932,7 @@ int main() {
 putwc(0,0);
 ; return 0; }
 EOF
-if { (eval echo configure:6822: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6936: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   cf_cv_utf8_lib=yes
 else
@@ -6829,7 +6943,7 @@ else
 cf_save_LIBS="$LIBS"
 LIBS="-lutf8 $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 6833 "configure"
+#line 6947 "configure"
 #include "confdefs.h"
 
 #include <libutf8.h>
@@ -6837,7 +6951,7 @@ int main() {
 putwc(0,0);
 ; return 0; }
 EOF
-if { (eval echo configure:6841: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6955: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   cf_cv_utf8_lib=add-on
 else
@@ -6861,19 +6975,25 @@ EOF
 
 
 	
+
 cf_ncuhdr_root=ncursesw
+
+test -n "$cf_cv_curses_dir" && \
+test "$cf_cv_curses_dir" != "no" && \
+CPPFLAGS="-I$cf_cv_curses_dir/include -I$cf_cv_curses_dir/include/$cf_ncuhdr_root $CPPFLAGS"
+
 echo $ac_n "checking for $cf_ncuhdr_root header in include-path""... $ac_c" 1>&6
-echo "configure:6867: checking for $cf_ncuhdr_root header in include-path" >&5
+echo "configure:6987: checking for $cf_ncuhdr_root header in include-path" >&5
 if eval "test \"`echo '$''{'cf_cv_ncurses_h'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
 	cf_header_list="$cf_ncuhdr_root/curses.h $cf_ncuhdr_root/ncurses.h"
-	test "$cf_ncuhdr_root" = ncurses && cf_header_list="curses.h ncurses.h $cf_header_list"
+	( test "$cf_ncuhdr_root" = ncurses || test "$cf_ncuhdr_root" = ncursesw ) && cf_header_list="curses.h ncurses.h $cf_header_list"
 	for cf_header in $cf_header_list
 	do
 	cat > conftest.$ac_ext <<EOF
-#line 6877 "configure"
+#line 6997 "configure"
 #include "confdefs.h"
 #include <$cf_header>
 int main() {
@@ -6891,7 +7011,7 @@ make an error
 	
 ; return 0; }
 EOF
-if { (eval echo configure:6895: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7015: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cf_cv_ncurses_h=$cf_header; break
 	
@@ -6912,39 +7032,76 @@ if test "$cf_cv_ncurses_h" != no ; then
 	cf_cv_ncurses_header=$cf_cv_ncurses_h
 else
 echo $ac_n "checking for $cf_ncuhdr_root include-path""... $ac_c" 1>&6
-echo "configure:6916: checking for $cf_ncuhdr_root include-path" >&5
+echo "configure:7036: checking for $cf_ncuhdr_root include-path" >&5
 if eval "test \"`echo '$''{'cf_cv_ncurses_h2'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
+	test -n "$verbose" && echo
 	cf_search=""
 
-test "$prefix" != /usr/local && \
-test -d /usr/local && \
-cf_search="$cf_search /usr/local/include /usr/local/include/$cf_ncuhdr_root /usr/local/$cf_ncuhdr_root/include"
+test -d $HOME && {
+	test -n "$verbose" && echo "	... testing include-directories under $HOME"
+	test -d $HOME/include &&    cf_search="$cf_search $HOME/include"
+	test -d $HOME/include/$cf_ncuhdr_root && cf_search="$cf_search $HOME/include/$cf_ncuhdr_root"
+}
 
-test "$includedir" != NONE && \
-test -d "$includedir" && \
-cf_search="$cf_search $includedir $includedir/$cf_ncuhdr_root"
+# For other stuff under the home directory, it should be sufficient to put
+# a symbolic link for $HOME/$cf_ncuhdr_root to the actual package location:
+test -d $HOME/$cf_ncuhdr_root && {
+	test -n "$verbose" && echo "	... testing include-directories under $HOME/$cf_ncuhdr_root"
+	test -d $HOME/$cf_ncuhdr_root/include &&    cf_search="$cf_search $HOME/$cf_ncuhdr_root/include"
+	test -d $HOME/$cf_ncuhdr_root/include/$cf_ncuhdr_root && cf_search="$cf_search $HOME/$cf_ncuhdr_root/include/$cf_ncuhdr_root"
+}
 
-test "$oldincludedir" != NONE && \
-test -d "$oldincludedir" && \
-cf_search="$cf_search $oldincludedir $oldincludedir/$cf_ncuhdr_root"
+test "$prefix" != /usr/local && \
+test -d /usr/local && {
+	test -n "$verbose" && echo "	... testing include-directories under /usr/local"
+	test -d /usr/local/include &&    cf_search="$cf_search /usr/local/include"
+	test -d /usr/local/include/$cf_ncuhdr_root && cf_search="$cf_search /usr/local/include/$cf_ncuhdr_root"
+	test -d /usr/local/$cf_ncuhdr_root/include && cf_search="$cf_search /usr/local/$cf_ncuhdr_root/include"
+}
 
 test "$prefix" != NONE && \
-test -d "$prefix" && \
-cf_search="$cf_search $prefix/include $prefix/include/$cf_ncuhdr_root $prefix/$cf_ncuhdr_root/include"
+test -d $prefix && {
+	test -n "$verbose" && echo "	... testing include-directories under $prefix"
+	test -d $prefix/include &&    cf_search="$cf_search $prefix/include"
+	test -d $prefix/include/$cf_ncuhdr_root && cf_search="$cf_search $prefix/include/$cf_ncuhdr_root"
+	test -d $prefix/$cf_ncuhdr_root/include && cf_search="$cf_search $prefix/$cf_ncuhdr_root/include"
+}
+
+test "$prefix" != /opt && \
+test -d /opt && {
+	test -n "$verbose" && echo "	... testing include-directories under /opt"
+	test -d /opt/include &&    cf_search="$cf_search /opt/include"
+	test -d /opt/include/$cf_ncuhdr_root && cf_search="$cf_search /opt/include/$cf_ncuhdr_root"
+	test -d /opt/$cf_ncuhdr_root/include && cf_search="$cf_search /opt/$cf_ncuhdr_root/include"
+}
 
 test "$prefix" != /usr && \
-cf_search="$cf_search /usr/include /usr/include/$cf_ncuhdr_root /usr/$cf_ncuhdr_root/include"
+test -d /usr && {
+	test -n "$verbose" && echo "	... testing include-directories under /usr"
+	test -d /usr/include &&    cf_search="$cf_search /usr/include"
+	test -d /usr/include/$cf_ncuhdr_root && cf_search="$cf_search /usr/include/$cf_ncuhdr_root"
+	test -d /usr/$cf_ncuhdr_root/include && cf_search="$cf_search /usr/$cf_ncuhdr_root/include"
+}
 
-test "$prefix" != /opt && \
-test -d /opt && \
-cf_search="$cf_search /opt/include /opt/include/$cf_ncuhdr_root /opt/$cf_ncuhdr_root/include"
+test "$includedir" != NONE && \
+test "$includedir" != "/usr/include" && \
+test -d "$includedir" && {
+	test -d $includedir &&    cf_search="$cf_search $includedir"
+	test -d $includedir/$cf_ncuhdr_root && cf_search="$cf_search $includedir/$cf_ncuhdr_root"
+}
 
-cf_search="$cf_search $HOME/include $HOME/include/$cf_ncuhdr_root $HOME/$cf_ncuhdr_root/include"
+test "$oldincludedir" != NONE && \
+test "$oldincludedir" != "/usr/include" && \
+test -d "$oldincludedir" && {
+	test -d $oldincludedir    && cf_search="$cf_search $oldincludedir"
+	test -d $oldincludedir/$cf_ncuhdr_root && cf_search="$cf_search $oldincludedir/$cf_ncuhdr_root"
+}
 
-	test -n "$verbose" && echo
+
+	test -n "$verbose" && echo search path $cf_search
 	for cf_incdir in $cf_search
 	do
 		for cf_header in \
@@ -6969,8 +7126,8 @@ echo "$ac_t""$cf_cv_ncurses_h2" 1>&6
 	cf_1st_incdir=`echo $cf_cv_ncurses_h2 | sed -e 's:/[^/]*$::'`
 	cf_2nd_incdir=`echo $cf_1st_incdir | sed -e 's:/[^/]*$::'`
 	cf_cv_ncurses_header=`basename $cf_cv_ncurses_h2`
-	echo cf_1st_include=$cf_1st_incdir
-	echo cf_2nd_include=$cf_2nd_incdir
+	test -n "$verbose" && echo cf_1st_include=$cf_1st_incdir
+	test -n "$verbose" && echo cf_2nd_include=$cf_2nd_incdir
 	if test `basename $cf_1st_incdir` = $cf_ncuhdr_root ; then
 		cf_cv_ncurses_header=$cf_ncuhdr_root/$cf_cv_ncurses_header
 		
@@ -7045,7 +7202,7 @@ esac
 
 
 echo $ac_n "checking for ncurses version""... $ac_c" 1>&6
-echo "configure:7049: checking for ncurses version" >&5
+echo "configure:7206: checking for ncurses version" >&5
 if eval "test \"`echo '$''{'cf_cv_ncurses_version'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -7071,7 +7228,7 @@ Autoconf "old"
 #endif
 EOF
 	cf_try="$ac_cpp conftest.$ac_ext 2>&5 | grep '^Autoconf ' >conftest.out"
-	{ (eval echo configure:7075: \"$cf_try\") 1>&5; (eval $cf_try) 2>&5; }
+	{ (eval echo configure:7232: \"$cf_try\") 1>&5; (eval $cf_try) 2>&5; }
 	if test -f conftest.out ; then
 		cf_out=`cat conftest.out | sed -e 's%^Autoconf %%' -e 's%^[^"]*"%%' -e 's%".*%%'`
 		test -n "$cf_out" && cf_cv_ncurses_version="$cf_out"
@@ -7080,7 +7237,7 @@ EOF
 
 else
   cat > conftest.$ac_ext <<EOF
-#line 7084 "configure"
+#line 7241 "configure"
 #include "confdefs.h"
 
 #include <${cf_cv_ncurses_header-curses.h}>
@@ -7104,7 +7261,7 @@ int main()
 	exit(0);
 }
 EOF
-if { (eval echo configure:7108: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:7265: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   
 	cf_cv_ncurses_version=`cat $cf_tempfile`
@@ -7135,7 +7292,7 @@ cf_nculib_root=ncursesw
 cf_ncurses_LIBS=""
 cf_ncurses_SAVE="$LIBS"
 echo $ac_n "checking for Gpm_Open in -lgpm""... $ac_c" 1>&6
-echo "configure:7139: checking for Gpm_Open in -lgpm" >&5
+echo "configure:7296: checking for Gpm_Open in -lgpm" >&5
 ac_lib_var=`echo gpm'_'Gpm_Open | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -7143,7 +7300,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lgpm  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 7147 "configure"
+#line 7304 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -7154,7 +7311,7 @@ int main() {
 Gpm_Open()
 ; return 0; }
 EOF
-if { (eval echo configure:7158: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7315: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -7170,7 +7327,7 @@ fi
 if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
   echo "$ac_t""yes" 1>&6
   echo $ac_n "checking for initscr in -lgpm""... $ac_c" 1>&6
-echo "configure:7174: checking for initscr in -lgpm" >&5
+echo "configure:7331: checking for initscr in -lgpm" >&5
 ac_lib_var=`echo gpm'_'initscr | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -7178,7 +7335,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lgpm  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 7182 "configure"
+#line 7339 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -7189,7 +7346,7 @@ int main() {
 initscr()
 ; return 0; }
 EOF
-if { (eval echo configure:7193: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7350: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -7220,7 +7377,7 @@ freebsd*)
 	# This is only necessary if you are linking against an obsolete
 	# version of ncurses (but it should do no harm, since it's static).
 	echo $ac_n "checking for tgoto in -lmytinfo""... $ac_c" 1>&6
-echo "configure:7224: checking for tgoto in -lmytinfo" >&5
+echo "configure:7381: checking for tgoto in -lmytinfo" >&5
 ac_lib_var=`echo mytinfo'_'tgoto | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -7228,7 +7385,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lmytinfo  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 7232 "configure"
+#line 7389 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -7239,7 +7396,7 @@ int main() {
 tgoto()
 ; return 0; }
 EOF
-if { (eval echo configure:7243: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7400: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -7264,15 +7421,21 @@ esac
 
 LIBS="$cf_ncurses_LIBS $LIBS"
 
+
+if ( test -n "$cf_cv_curses_dir" && test "$cf_cv_curses_dir" != "no" )
+then
+	LIBS="-L$cf_cv_curses_dir/lib -l$cf_nculib_root $LIBS"
+else
+	
 	eval 'cf_cv_have_lib_'$cf_nculib_root'=no'
 	cf_libdir=""
 	echo $ac_n "checking for initscr""... $ac_c" 1>&6
-echo "configure:7271: checking for initscr" >&5
+echo "configure:7434: checking for initscr" >&5
 if eval "test \"`echo '$''{'ac_cv_func_initscr'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 7276 "configure"
+#line 7439 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char initscr(); below.  */
@@ -7295,7 +7458,7 @@ initscr();
 
 ; return 0; }
 EOF
-if { (eval echo configure:7299: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7462: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_initscr=yes"
 else
@@ -7315,17 +7478,17 @@ else
 
 		cf_save_LIBS="$LIBS"
 		echo $ac_n "checking for initscr in -l$cf_nculib_root""... $ac_c" 1>&6
-echo "configure:7319: checking for initscr in -l$cf_nculib_root" >&5
+echo "configure:7482: checking for initscr in -l$cf_nculib_root" >&5
 		LIBS="-l$cf_nculib_root $LIBS"
 		cat > conftest.$ac_ext <<EOF
-#line 7322 "configure"
+#line 7485 "configure"
 #include "confdefs.h"
 #include <${cf_cv_ncurses_header-curses.h}>
 int main() {
 initscr()
 ; return 0; }
 EOF
-if { (eval echo configure:7329: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7492: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   echo "$ac_t""yes" 1>&6
 			 eval 'cf_cv_have_lib_'$cf_nculib_root'=yes'
@@ -7337,49 +7500,66 @@ else
   echo "$ac_t""no" 1>&6
 			cf_search=""
 
-test "$prefix" != /usr/local && \
-test -d /usr/local && \
-cf_search="$cf_search /usr/local/lib /usr/local/lib/$cf_nculib_root /usr/local/$cf_nculib_root/lib"
+test -d $HOME && {
+	test -n "$verbose" && echo "	... testing lib-directories under $HOME"
+	test -d $HOME/lib &&    cf_search="$cf_search $HOME/lib"
+	test -d $HOME/lib/$cf_nculib_root && cf_search="$cf_search $HOME/lib/$cf_nculib_root"
+}
 
-test "$libdir" != NONE && \
-test -d $libdir && \
-cf_search="$cf_search $libdir $libdir/$cf_nculib_root"
+# For other stuff under the home directory, it should be sufficient to put
+# a symbolic link for $HOME/$cf_nculib_root to the actual package location:
+test -d $HOME/$cf_nculib_root && {
+	test -n "$verbose" && echo "	... testing lib-directories under $HOME/$cf_nculib_root"
+	test -d $HOME/$cf_nculib_root/lib &&    cf_search="$cf_search $HOME/$cf_nculib_root/lib"
+	test -d $HOME/$cf_nculib_root/lib/$cf_nculib_root && cf_search="$cf_search $HOME/$cf_nculib_root/lib/$cf_nculib_root"
+}
 
-test "$exec_prefix" != NONE && \
-test -d $exec_prefix && \
-cf_search="$cf_search $exec_prefix/lib $exec_prefix/lib/$cf_nculib_root"
+test "$prefix" != /usr/local && \
+test -d /usr/local && {
+	test -n "$verbose" && echo "	... testing lib-directories under /usr/local"
+	test -d /usr/local/lib &&    cf_search="$cf_search /usr/local/lib"
+	test -d /usr/local/lib/$cf_nculib_root && cf_search="$cf_search /usr/local/lib/$cf_nculib_root"
+	test -d /usr/local/$cf_nculib_root/lib && cf_search="$cf_search /usr/local/$cf_nculib_root/lib"
+}
 
 test "$prefix" != NONE && \
-test "$prefix" != "$exec_prefix" && \
-test -d $prefix && \
-cf_search="$cf_search $prefix/lib $prefix/lib/$cf_nculib_root $prefix/$cf_nculib_root/lib"
-
-test "$prefix" != /usr && \
-cf_search="$cf_search /usr/lib /usr/lib/$cf_nculib_root /usr/$cf_nculib_root/lib"
-
-test "$prefix" != / && \
-cf_search="$cf_search /lib /lib/$cf_nculib_root /$cf_nculib_root/lib"
+test -d $prefix && {
+	test -n "$verbose" && echo "	... testing lib-directories under $prefix"
+	test -d $prefix/lib &&    cf_search="$cf_search $prefix/lib"
+	test -d $prefix/lib/$cf_nculib_root && cf_search="$cf_search $prefix/lib/$cf_nculib_root"
+	test -d $prefix/$cf_nculib_root/lib && cf_search="$cf_search $prefix/$cf_nculib_root/lib"
+}
 
 test "$prefix" != /opt && \
-test -d /opt && \
-cf_search="$cf_search /opt/lib /opt/lib/$cf_nculib_root /opt/$cf_nculib_root/lib"
+test -d /opt && {
+	test -n "$verbose" && echo "	... testing lib-directories under /opt"
+	test -d /opt/lib &&    cf_search="$cf_search /opt/lib"
+	test -d /opt/lib/$cf_nculib_root && cf_search="$cf_search /opt/lib/$cf_nculib_root"
+	test -d /opt/$cf_nculib_root/lib && cf_search="$cf_search /opt/$cf_nculib_root/lib"
+}
 
-cf_search="$cf_search $HOME/lib $HOME/lib/$cf_nculib_root $HOME/$cf_nculib_root/lib"
+test "$prefix" != /usr && \
+test -d /usr && {
+	test -n "$verbose" && echo "	... testing lib-directories under /usr"
+	test -d /usr/lib &&    cf_search="$cf_search /usr/lib"
+	test -d /usr/lib/$cf_nculib_root && cf_search="$cf_search /usr/lib/$cf_nculib_root"
+	test -d /usr/$cf_nculib_root/lib && cf_search="$cf_search /usr/$cf_nculib_root/lib"
+}
 
 			for cf_libdir in $cf_search
 			do
 				echo $ac_n "checking for -l$cf_nculib_root in $cf_libdir""... $ac_c" 1>&6
-echo "configure:7373: checking for -l$cf_nculib_root in $cf_libdir" >&5
+echo "configure:7553: checking for -l$cf_nculib_root in $cf_libdir" >&5
 				LIBS="-L$cf_libdir -l$cf_nculib_root $cf_save_LIBS"
 				cat > conftest.$ac_ext <<EOF
-#line 7376 "configure"
+#line 7556 "configure"
 #include "confdefs.h"
 #include <${cf_cv_ncurses_header-curses.h}>
 int main() {
 initscr()
 ; return 0; }
 EOF
-if { (eval echo configure:7383: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7563: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   echo "$ac_t""yes" 1>&6
 			 		 eval 'cf_cv_have_lib_'$cf_nculib_root'=yes'
@@ -7406,10 +7586,11 @@ if test $cf_found_library = no ; then
 fi
 
 
+fi
 
 if test -n "$cf_ncurses_LIBS" ; then
 	echo $ac_n "checking if we can link $cf_nculib_root without $cf_ncurses_LIBS""... $ac_c" 1>&6
-echo "configure:7413: checking if we can link $cf_nculib_root without $cf_ncurses_LIBS" >&5
+echo "configure:7594: checking if we can link $cf_nculib_root without $cf_ncurses_LIBS" >&5
 	cf_ncurses_SAVE="$LIBS"
 	for p in $cf_ncurses_LIBS ; do
 		q=`echo $LIBS | sed -e 's/'$p' //' -e 's/'$p'$//'`
@@ -7418,14 +7599,14 @@ echo "configure:7413: checking if we can link $cf_nculib_root without $cf_ncurse
 		fi
 	done
 	cat > conftest.$ac_ext <<EOF
-#line 7422 "configure"
+#line 7603 "configure"
 #include "confdefs.h"
 #include <${cf_cv_ncurses_header-curses.h}>
 int main() {
 initscr(); mousemask(0,0); tgoto((char *)0, 0, 0);
 ; return 0; }
 EOF
-if { (eval echo configure:7429: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7610: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   echo "$ac_t""yes" 1>&6
 else
@@ -7440,7 +7621,7 @@ fi
 
 	
 echo $ac_n "checking for ncurses version""... $ac_c" 1>&6
-echo "configure:7444: checking for ncurses version" >&5
+echo "configure:7625: checking for ncurses version" >&5
 if eval "test \"`echo '$''{'cf_cv_ncurses_version'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -7466,7 +7647,7 @@ Autoconf "old"
 #endif
 EOF
 	cf_try="$ac_cpp conftest.$ac_ext 2>&5 | grep '^Autoconf ' >conftest.out"
-	{ (eval echo configure:7470: \"$cf_try\") 1>&5; (eval $cf_try) 2>&5; }
+	{ (eval echo configure:7651: \"$cf_try\") 1>&5; (eval $cf_try) 2>&5; }
 	if test -f conftest.out ; then
 		cf_out=`cat conftest.out | sed -e 's%^Autoconf %%' -e 's%^[^"]*"%%' -e 's%".*%%'`
 		test -n "$cf_out" && cf_cv_ncurses_version="$cf_out"
@@ -7475,7 +7656,7 @@ EOF
 
 else
   cat > conftest.$ac_ext <<EOF
-#line 7479 "configure"
+#line 7660 "configure"
 #include "confdefs.h"
 
 #include <${cf_cv_ncurses_header-curses.h}>
@@ -7499,7 +7680,7 @@ int main()
 	exit(0);
 }
 EOF
-if { (eval echo configure:7503: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:7684: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   
 	cf_cv_ncurses_version=`cat $cf_tempfile`
@@ -7522,25 +7703,26 @@ EOF
 
 	;;
 pdcurses)
+	cf_cv_ncurses_header=xcurses.h
 	# do this last, since it changes definition of main: CF_PDCURSES_X11
 	;;
 slang)
 	
 echo $ac_n "checking for slang header file""... $ac_c" 1>&6
-echo "configure:7531: checking for slang header file" >&5
+echo "configure:7713: checking for slang header file" >&5
 if eval "test \"`echo '$''{'cf_cv_slang_header'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
 	cat > conftest.$ac_ext <<EOF
-#line 7537 "configure"
+#line 7719 "configure"
 #include "confdefs.h"
 #include <slang.h>
 int main() {
 printf("%s\n", SLANG_VERSION)
 ; return 0; }
 EOF
-if { (eval echo configure:7544: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7726: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cf_cv_slang_header=predefined
 else
@@ -7550,30 +7732,66 @@ else
   
 	cf_search=""
 
-test "$prefix" != /usr/local && \
-test -d /usr/local && \
-cf_search="$cf_search /usr/local/include /usr/local/include/slang /usr/local/slang/include"
+test -d $HOME && {
+	test -n "$verbose" && echo "	... testing include-directories under $HOME"
+	test -d $HOME/include &&    cf_search="$cf_search $HOME/include"
+	test -d $HOME/include/slang && cf_search="$cf_search $HOME/include/slang"
+}
 
-test "$includedir" != NONE && \
-test -d "$includedir" && \
-cf_search="$cf_search $includedir $includedir/slang"
+# For other stuff under the home directory, it should be sufficient to put
+# a symbolic link for $HOME/slang to the actual package location:
+test -d $HOME/slang && {
+	test -n "$verbose" && echo "	... testing include-directories under $HOME/slang"
+	test -d $HOME/slang/include &&    cf_search="$cf_search $HOME/slang/include"
+	test -d $HOME/slang/include/slang && cf_search="$cf_search $HOME/slang/include/slang"
+}
 
-test "$oldincludedir" != NONE && \
-test -d "$oldincludedir" && \
-cf_search="$cf_search $oldincludedir $oldincludedir/slang"
+test "$prefix" != /usr/local && \
+test -d /usr/local && {
+	test -n "$verbose" && echo "	... testing include-directories under /usr/local"
+	test -d /usr/local/include &&    cf_search="$cf_search /usr/local/include"
+	test -d /usr/local/include/slang && cf_search="$cf_search /usr/local/include/slang"
+	test -d /usr/local/slang/include && cf_search="$cf_search /usr/local/slang/include"
+}
 
 test "$prefix" != NONE && \
-test -d "$prefix" && \
-cf_search="$cf_search $prefix/include $prefix/include/slang $prefix/slang/include"
+test -d $prefix && {
+	test -n "$verbose" && echo "	... testing include-directories under $prefix"
+	test -d $prefix/include &&    cf_search="$cf_search $prefix/include"
+	test -d $prefix/include/slang && cf_search="$cf_search $prefix/include/slang"
+	test -d $prefix/slang/include && cf_search="$cf_search $prefix/slang/include"
+}
+
+test "$prefix" != /opt && \
+test -d /opt && {
+	test -n "$verbose" && echo "	... testing include-directories under /opt"
+	test -d /opt/include &&    cf_search="$cf_search /opt/include"
+	test -d /opt/include/slang && cf_search="$cf_search /opt/include/slang"
+	test -d /opt/slang/include && cf_search="$cf_search /opt/slang/include"
+}
 
 test "$prefix" != /usr && \
-cf_search="$cf_search /usr/include /usr/include/slang /usr/slang/include"
+test -d /usr && {
+	test -n "$verbose" && echo "	... testing include-directories under /usr"
+	test -d /usr/include &&    cf_search="$cf_search /usr/include"
+	test -d /usr/include/slang && cf_search="$cf_search /usr/include/slang"
+	test -d /usr/slang/include && cf_search="$cf_search /usr/slang/include"
+}
 
-test "$prefix" != /opt && \
-test -d /opt && \
-cf_search="$cf_search /opt/include /opt/include/slang /opt/slang/include"
+test "$includedir" != NONE && \
+test "$includedir" != "/usr/include" && \
+test -d "$includedir" && {
+	test -d $includedir &&    cf_search="$cf_search $includedir"
+	test -d $includedir/slang && cf_search="$cf_search $includedir/slang"
+}
+
+test "$oldincludedir" != NONE && \
+test "$oldincludedir" != "/usr/include" && \
+test -d "$oldincludedir" && {
+	test -d $oldincludedir    && cf_search="$cf_search $oldincludedir"
+	test -d $oldincludedir/slang && cf_search="$cf_search $oldincludedir/slang"
+}
 
-cf_search="$cf_search $HOME/include $HOME/include/slang $HOME/slang/include"
 
 	for cf_incdir in $cf_search
 	do
@@ -7636,24 +7854,24 @@ else
   
 cf_cv_termlib=none
 cat > conftest.$ac_ext <<EOF
-#line 7640 "configure"
+#line 7858 "configure"
 #include "confdefs.h"
 
 int main() {
 char *x=(char*)tgoto("",0,0)
 ; return 0; }
 EOF
-if { (eval echo configure:7647: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7865: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   cat > conftest.$ac_ext <<EOF
-#line 7650 "configure"
+#line 7868 "configure"
 #include "confdefs.h"
 
 int main() {
 int x=tigetstr("")
 ; return 0; }
 EOF
-if { (eval echo configure:7657: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7875: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   cf_cv_termlib=terminfo
 else
@@ -7682,16 +7900,16 @@ if test "$cf_cv_termlib" = none; then
 	for cf_func in tigetstr tgetstr
 	do
 		echo $ac_n "checking for $cf_func in -l$cf_lib""... $ac_c" 1>&6
-echo "configure:7686: checking for $cf_func in -l$cf_lib" >&5
+echo "configure:7904: checking for $cf_func in -l$cf_lib" >&5
 		cat > conftest.$ac_ext <<EOF
-#line 7688 "configure"
+#line 7906 "configure"
 #include "confdefs.h"
 
 int main() {
 int x=$cf_func("")
 ; return 0; }
 EOF
-if { (eval echo configure:7695: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7913: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   cf_result=yes
 else
@@ -7718,7 +7936,7 @@ fi
 if test "$cf_cv_termlib" = none; then
 	# allow curses library for broken AIX system.
 	echo $ac_n "checking for initscr in -lcurses""... $ac_c" 1>&6
-echo "configure:7722: checking for initscr in -lcurses" >&5
+echo "configure:7940: checking for initscr in -lcurses" >&5
 ac_lib_var=`echo curses'_'initscr | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -7726,7 +7944,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lcurses  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 7730 "configure"
+#line 7948 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -7737,7 +7955,7 @@ int main() {
 initscr()
 ; return 0; }
 EOF
-if { (eval echo configure:7741: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7959: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -7758,7 +7976,7 @@ else
 fi
 
 	echo $ac_n "checking for tgoto in -ltermcap""... $ac_c" 1>&6
-echo "configure:7762: checking for tgoto in -ltermcap" >&5
+echo "configure:7980: checking for tgoto in -ltermcap" >&5
 ac_lib_var=`echo termcap'_'tgoto | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -7766,7 +7984,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-ltermcap  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 7770 "configure"
+#line 7988 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -7777,7 +7995,7 @@ int main() {
 tgoto()
 ; return 0; }
 EOF
-if { (eval echo configure:7781: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7999: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -7809,12 +8027,12 @@ fi
 
 cf_slang_LIBS2="$LIBS"
 echo $ac_n "checking for acos""... $ac_c" 1>&6
-echo "configure:7813: checking for acos" >&5
+echo "configure:8031: checking for acos" >&5
 if eval "test \"`echo '$''{'ac_cv_func_acos'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 7818 "configure"
+#line 8036 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char acos(); below.  */
@@ -7837,7 +8055,7 @@ acos();
 
 ; return 0; }
 EOF
-if { (eval echo configure:7841: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:8059: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_acos=yes"
 else
@@ -7856,7 +8074,7 @@ else
   echo "$ac_t""no" 1>&6
 
 echo $ac_n "checking for acos in -lm""... $ac_c" 1>&6
-echo "configure:7860: checking for acos in -lm" >&5
+echo "configure:8078: checking for acos in -lm" >&5
 ac_lib_var=`echo m'_'acos | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -7864,7 +8082,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lm $LIBS $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 7868 "configure"
+#line 8086 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -7875,7 +8093,7 @@ int main() {
 acos()
 ; return 0; }
 EOF
-if { (eval echo configure:7879: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:8097: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -7917,12 +8135,12 @@ os2*)
 	eval 'cf_cv_have_lib_'video'=no'
 	cf_libdir=""
 	echo $ac_n "checking for v_init""... $ac_c" 1>&6
-echo "configure:7921: checking for v_init" >&5
+echo "configure:8139: checking for v_init" >&5
 if eval "test \"`echo '$''{'ac_cv_func_v_init'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 7926 "configure"
+#line 8144 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char v_init(); below.  */
@@ -7945,7 +8163,7 @@ v_init();
 
 ; return 0; }
 EOF
-if { (eval echo configure:7949: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:8167: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_v_init=yes"
 else
@@ -7965,17 +8183,17 @@ else
 
 		cf_save_LIBS="$LIBS"
 		echo $ac_n "checking for v_init in -lvideo""... $ac_c" 1>&6
-echo "configure:7969: checking for v_init in -lvideo" >&5
+echo "configure:8187: checking for v_init in -lvideo" >&5
 		LIBS="-lvideo $LIBS"
 		cat > conftest.$ac_ext <<EOF
-#line 7972 "configure"
+#line 8190 "configure"
 #include "confdefs.h"
 #include <sys/video.h>
 int main() {
 v_init()
 ; return 0; }
 EOF
-if { (eval echo configure:7979: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:8197: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   echo "$ac_t""yes" 1>&6
 			 eval 'cf_cv_have_lib_'video'=yes'
@@ -7987,49 +8205,66 @@ else
   echo "$ac_t""no" 1>&6
 			cf_search=""
 
-test "$prefix" != /usr/local && \
-test -d /usr/local && \
-cf_search="$cf_search /usr/local/lib /usr/local/lib/video /usr/local/video/lib"
+test -d $HOME && {
+	test -n "$verbose" && echo "	... testing lib-directories under $HOME"
+	test -d $HOME/lib &&    cf_search="$cf_search $HOME/lib"
+	test -d $HOME/lib/video && cf_search="$cf_search $HOME/lib/video"
+}
 
-test "$libdir" != NONE && \
-test -d $libdir && \
-cf_search="$cf_search $libdir $libdir/video"
+# For other stuff under the home directory, it should be sufficient to put
+# a symbolic link for $HOME/video to the actual package location:
+test -d $HOME/video && {
+	test -n "$verbose" && echo "	... testing lib-directories under $HOME/video"
+	test -d $HOME/video/lib &&    cf_search="$cf_search $HOME/video/lib"
+	test -d $HOME/video/lib/video && cf_search="$cf_search $HOME/video/lib/video"
+}
 
-test "$exec_prefix" != NONE && \
-test -d $exec_prefix && \
-cf_search="$cf_search $exec_prefix/lib $exec_prefix/lib/video"
+test "$prefix" != /usr/local && \
+test -d /usr/local && {
+	test -n "$verbose" && echo "	... testing lib-directories under /usr/local"
+	test -d /usr/local/lib &&    cf_search="$cf_search /usr/local/lib"
+	test -d /usr/local/lib/video && cf_search="$cf_search /usr/local/lib/video"
+	test -d /usr/local/video/lib && cf_search="$cf_search /usr/local/video/lib"
+}
 
 test "$prefix" != NONE && \
-test "$prefix" != "$exec_prefix" && \
-test -d $prefix && \
-cf_search="$cf_search $prefix/lib $prefix/lib/video $prefix/video/lib"
-
-test "$prefix" != /usr && \
-cf_search="$cf_search /usr/lib /usr/lib/video /usr/video/lib"
-
-test "$prefix" != / && \
-cf_search="$cf_search /lib /lib/video /video/lib"
+test -d $prefix && {
+	test -n "$verbose" && echo "	... testing lib-directories under $prefix"
+	test -d $prefix/lib &&    cf_search="$cf_search $prefix/lib"
+	test -d $prefix/lib/video && cf_search="$cf_search $prefix/lib/video"
+	test -d $prefix/video/lib && cf_search="$cf_search $prefix/video/lib"
+}
 
 test "$prefix" != /opt && \
-test -d /opt && \
-cf_search="$cf_search /opt/lib /opt/lib/video /opt/video/lib"
+test -d /opt && {
+	test -n "$verbose" && echo "	... testing lib-directories under /opt"
+	test -d /opt/lib &&    cf_search="$cf_search /opt/lib"
+	test -d /opt/lib/video && cf_search="$cf_search /opt/lib/video"
+	test -d /opt/video/lib && cf_search="$cf_search /opt/video/lib"
+}
 
-cf_search="$cf_search $HOME/lib $HOME/lib/video $HOME/video/lib"
+test "$prefix" != /usr && \
+test -d /usr && {
+	test -n "$verbose" && echo "	... testing lib-directories under /usr"
+	test -d /usr/lib &&    cf_search="$cf_search /usr/lib"
+	test -d /usr/lib/video && cf_search="$cf_search /usr/lib/video"
+	test -d /usr/video/lib && cf_search="$cf_search /usr/video/lib"
+}
 
 			for cf_libdir in $cf_search
 			do
 				echo $ac_n "checking for -lvideo in $cf_libdir""... $ac_c" 1>&6
-echo "configure:8023: checking for -lvideo in $cf_libdir" >&5
+echo "configure:8258: checking for -lvideo in $cf_libdir" >&5
 				LIBS="-L$cf_libdir -lvideo $cf_save_LIBS"
 				cat > conftest.$ac_ext <<EOF
-#line 8026 "configure"
+#line 8261 "configure"
 #include "confdefs.h"
 #include <sys/video.h>
 int main() {
 v_init()
 ; return 0; }
 EOF
-if { (eval echo configure:8033: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:8268: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   echo "$ac_t""yes" 1>&6
 			 		 eval 'cf_cv_have_lib_'video'=yes'
@@ -8062,12 +8297,12 @@ esac
 	eval 'cf_cv_have_lib_'slang'=no'
 	cf_libdir=""
 	echo $ac_n "checking for SLtt_get_screen_size""... $ac_c" 1>&6
-echo "configure:8066: checking for SLtt_get_screen_size" >&5
+echo "configure:8301: checking for SLtt_get_screen_size" >&5
 if eval "test \"`echo '$''{'ac_cv_func_SLtt_get_screen_size'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 8071 "configure"
+#line 8306 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char SLtt_get_screen_size(); below.  */
@@ -8090,7 +8325,7 @@ SLtt_get_screen_size();
 
 ; return 0; }
 EOF
-if { (eval echo configure:8094: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:8329: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_SLtt_get_screen_size=yes"
 else
@@ -8110,17 +8345,17 @@ else
 
 		cf_save_LIBS="$LIBS"
 		echo $ac_n "checking for SLtt_get_screen_size in -lslang""... $ac_c" 1>&6
-echo "configure:8114: checking for SLtt_get_screen_size in -lslang" >&5
+echo "configure:8349: checking for SLtt_get_screen_size in -lslang" >&5
 		LIBS="-lslang $LIBS"
 		cat > conftest.$ac_ext <<EOF
-#line 8117 "configure"
+#line 8352 "configure"
 #include "confdefs.h"
 #include <slang.h>
 int main() {
 SLtt_get_screen_size()
 ; return 0; }
 EOF
-if { (eval echo configure:8124: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:8359: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   echo "$ac_t""yes" 1>&6
 			 eval 'cf_cv_have_lib_'slang'=yes'
@@ -8132,49 +8367,66 @@ else
   echo "$ac_t""no" 1>&6
 			cf_search=""
 
-test "$prefix" != /usr/local && \
-test -d /usr/local && \
-cf_search="$cf_search /usr/local/lib /usr/local/lib/slang /usr/local/slang/lib"
+test -d $HOME && {
+	test -n "$verbose" && echo "	... testing lib-directories under $HOME"
+	test -d $HOME/lib &&    cf_search="$cf_search $HOME/lib"
+	test -d $HOME/lib/slang && cf_search="$cf_search $HOME/lib/slang"
+}
 
-test "$libdir" != NONE && \
-test -d $libdir && \
-cf_search="$cf_search $libdir $libdir/slang"
+# For other stuff under the home directory, it should be sufficient to put
+# a symbolic link for $HOME/slang to the actual package location:
+test -d $HOME/slang && {
+	test -n "$verbose" && echo "	... testing lib-directories under $HOME/slang"
+	test -d $HOME/slang/lib &&    cf_search="$cf_search $HOME/slang/lib"
+	test -d $HOME/slang/lib/slang && cf_search="$cf_search $HOME/slang/lib/slang"
+}
 
-test "$exec_prefix" != NONE && \
-test -d $exec_prefix && \
-cf_search="$cf_search $exec_prefix/lib $exec_prefix/lib/slang"
+test "$prefix" != /usr/local && \
+test -d /usr/local && {
+	test -n "$verbose" && echo "	... testing lib-directories under /usr/local"
+	test -d /usr/local/lib &&    cf_search="$cf_search /usr/local/lib"
+	test -d /usr/local/lib/slang && cf_search="$cf_search /usr/local/lib/slang"
+	test -d /usr/local/slang/lib && cf_search="$cf_search /usr/local/slang/lib"
+}
 
 test "$prefix" != NONE && \
-test "$prefix" != "$exec_prefix" && \
-test -d $prefix && \
-cf_search="$cf_search $prefix/lib $prefix/lib/slang $prefix/slang/lib"
-
-test "$prefix" != /usr && \
-cf_search="$cf_search /usr/lib /usr/lib/slang /usr/slang/lib"
-
-test "$prefix" != / && \
-cf_search="$cf_search /lib /lib/slang /slang/lib"
+test -d $prefix && {
+	test -n "$verbose" && echo "	... testing lib-directories under $prefix"
+	test -d $prefix/lib &&    cf_search="$cf_search $prefix/lib"
+	test -d $prefix/lib/slang && cf_search="$cf_search $prefix/lib/slang"
+	test -d $prefix/slang/lib && cf_search="$cf_search $prefix/slang/lib"
+}
 
 test "$prefix" != /opt && \
-test -d /opt && \
-cf_search="$cf_search /opt/lib /opt/lib/slang /opt/slang/lib"
+test -d /opt && {
+	test -n "$verbose" && echo "	... testing lib-directories under /opt"
+	test -d /opt/lib &&    cf_search="$cf_search /opt/lib"
+	test -d /opt/lib/slang && cf_search="$cf_search /opt/lib/slang"
+	test -d /opt/slang/lib && cf_search="$cf_search /opt/slang/lib"
+}
 
-cf_search="$cf_search $HOME/lib $HOME/lib/slang $HOME/slang/lib"
+test "$prefix" != /usr && \
+test -d /usr && {
+	test -n "$verbose" && echo "	... testing lib-directories under /usr"
+	test -d /usr/lib &&    cf_search="$cf_search /usr/lib"
+	test -d /usr/lib/slang && cf_search="$cf_search /usr/lib/slang"
+	test -d /usr/slang/lib && cf_search="$cf_search /usr/slang/lib"
+}
 
 			for cf_libdir in $cf_search
 			do
 				echo $ac_n "checking for -lslang in $cf_libdir""... $ac_c" 1>&6
-echo "configure:8168: checking for -lslang in $cf_libdir" >&5
+echo "configure:8420: checking for -lslang in $cf_libdir" >&5
 				LIBS="-L$cf_libdir -lslang $cf_save_LIBS"
 				cat > conftest.$ac_ext <<EOF
-#line 8171 "configure"
+#line 8423 "configure"
 #include "confdefs.h"
 #include <slang.h>
 int main() {
 SLtt_get_screen_size()
 ; return 0; }
 EOF
-if { (eval echo configure:8178: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:8430: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   echo "$ac_t""yes" 1>&6
 			 		 eval 'cf_cv_have_lib_'slang'=yes'
@@ -8203,7 +8455,7 @@ fi
 
 cf_slang_LIBS3="$LIBS"
 echo $ac_n "checking if we can link slang without termcap""... $ac_c" 1>&6
-echo "configure:8207: checking if we can link slang without termcap" >&5
+echo "configure:8459: checking if we can link slang without termcap" >&5
 if test -n "`echo $cf_slang_LIBS1 | sed -e 's/ //g'`" ; then
 	cf_exclude=`echo ".$cf_slang_LIBS2" | sed -e "s%$cf_slang_LIBS1%%" -e 's%^.%%'`
 else
@@ -8211,14 +8463,14 @@ else
 fi
 LIBS=`echo ".$cf_slang_LIBS3" | sed -e "s%$cf_exclude%%" -e 's%^.%%'`
 cat > conftest.$ac_ext <<EOF
-#line 8215 "configure"
+#line 8467 "configure"
 #include "confdefs.h"
 #include <slang.h>
 int main() {
 SLtt_get_screen_size()
 ; return 0; }
 EOF
-if { (eval echo configure:8222: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:8474: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   cf_result=yes
 else
@@ -8235,13 +8487,13 @@ test $cf_result = no && LIBS="$cf_slang_LIBS3"
 
 
 echo $ac_n "checking if we must tell slang this is UNIX""... $ac_c" 1>&6
-echo "configure:8239: checking if we must tell slang this is UNIX" >&5
+echo "configure:8491: checking if we must tell slang this is UNIX" >&5
 if eval "test \"`echo '$''{'cf_cv_slang_unix'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
 cat > conftest.$ac_ext <<EOF
-#line 8245 "configure"
+#line 8497 "configure"
 #include "confdefs.h"
 #include <slang.h>
 int main() {
@@ -8255,7 +8507,7 @@ SLang_TT_Baud_Rate = 1
 
 ; return 0; }
 EOF
-if { (eval echo configure:8259: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:8511: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   cf_cv_slang_unix=yes
 else
@@ -8281,7 +8533,7 @@ eval cf_libdir=$libdir
 cf_libdir=`echo $cf_libdir | sed -e s%'^NONE/'%$prefix/% -e s%'^NONE/'%$ac_default_prefix/%`
 
 echo $ac_n "checking for location of config-file""... $ac_c" 1>&6
-echo "configure:8285: checking for location of config-file" >&5
+echo "configure:8537: checking for location of config-file" >&5
 LYNX_CFG_FILE=$cf_libdir/lynx.cfg
 cat >> confdefs.h <<EOF
 #define LYNX_CFG_FILE "$LYNX_CFG_FILE"
@@ -8293,7 +8545,7 @@ CHARSET_DEFS=
 
 
 echo $ac_n "checking if you want only a few charsets""... $ac_c" 1>&6
-echo "configure:8297: checking if you want only a few charsets" >&5
+echo "configure:8549: checking if you want only a few charsets" >&5
 
 # Check whether --with-charsets or --without-charsets was given.
 if test "${with_charsets+set}" = set; then
@@ -8354,12 +8606,12 @@ fi
 
 
 echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:8358: checking for ANSI C header files" >&5
+echo "configure:8610: checking for ANSI C header files" >&5
 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 8363 "configure"
+#line 8615 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 #include <stdarg.h>
@@ -8367,7 +8619,7 @@ else
 #include <float.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:8371: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:8623: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -8384,7 +8636,7 @@ rm -f conftest*
 if test $ac_cv_header_stdc = yes; then
   # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
 cat > conftest.$ac_ext <<EOF
-#line 8388 "configure"
+#line 8640 "configure"
 #include "confdefs.h"
 #include <string.h>
 EOF
@@ -8402,7 +8654,7 @@ fi
 if test $ac_cv_header_stdc = yes; then
   # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
 cat > conftest.$ac_ext <<EOF
-#line 8406 "configure"
+#line 8658 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 EOF
@@ -8423,7 +8675,7 @@ if test "$cross_compiling" = yes; then
   :
 else
   cat > conftest.$ac_ext <<EOF
-#line 8427 "configure"
+#line 8679 "configure"
 #include "confdefs.h"
 #include <ctype.h>
 #define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@@ -8434,7 +8686,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
 exit (0); }
 
 EOF
-if { (eval echo configure:8438: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:8690: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   :
 else
@@ -8458,12 +8710,12 @@ EOF
 fi
 
 echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6
-echo "configure:8462: checking whether time.h and sys/time.h may both be included" >&5
+echo "configure:8714: checking whether time.h and sys/time.h may both be included" >&5
 if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 8467 "configure"
+#line 8719 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/time.h>
@@ -8472,7 +8724,7 @@ int main() {
 struct tm *tp;
 ; return 0; }
 EOF
-if { (eval echo configure:8476: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:8728: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_header_time=yes
 else
@@ -8497,12 +8749,12 @@ for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6
-echo "configure:8501: checking for $ac_hdr that defines DIR" >&5
+echo "configure:8753: checking for $ac_hdr that defines DIR" >&5
 if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 8506 "configure"
+#line 8758 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <$ac_hdr>
@@ -8510,7 +8762,7 @@ int main() {
 DIR *dirp = 0;
 ; return 0; }
 EOF
-if { (eval echo configure:8514: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:8766: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   eval "ac_cv_header_dirent_$ac_safe=yes"
 else
@@ -8535,7 +8787,7 @@ done
 # Two versions of opendir et al. are in -ldir and -lx on SCO Xenix.
 if test $ac_header_dirent = dirent.h; then
 echo $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6
-echo "configure:8539: checking for opendir in -ldir" >&5
+echo "configure:8791: checking for opendir in -ldir" >&5
 ac_lib_var=`echo dir'_'opendir | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -8543,7 +8795,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-ldir  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 8547 "configure"
+#line 8799 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -8554,7 +8806,7 @@ int main() {
 opendir()
 ; return 0; }
 EOF
-if { (eval echo configure:8558: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:8810: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -8576,7 +8828,7 @@ fi
 
 else
 echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6
-echo "configure:8580: checking for opendir in -lx" >&5
+echo "configure:8832: checking for opendir in -lx" >&5
 ac_lib_var=`echo x'_'opendir | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -8584,7 +8836,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lx  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 8588 "configure"
+#line 8840 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -8595,7 +8847,7 @@ int main() {
 opendir()
 ; return 0; }
 EOF
-if { (eval echo configure:8599: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:8851: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -8638,17 +8890,17 @@ for ac_hdr in \
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:8642: checking for $ac_hdr" >&5
+echo "configure:8894: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 8647 "configure"
+#line 8899 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:8652: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:8904: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -8676,13 +8928,13 @@ done
 
 
 echo $ac_n "checking termio.h and termios.h""... $ac_c" 1>&6
-echo "configure:8680: checking termio.h and termios.h" >&5
+echo "configure:8932: checking termio.h and termios.h" >&5
 if eval "test \"`echo '$''{'cf_cv_termio_and_termios'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
     cat > conftest.$ac_ext <<EOF
-#line 8686 "configure"
+#line 8938 "configure"
 #include "confdefs.h"
 
 #if HAVE_TERMIO_H
@@ -8695,7 +8947,7 @@ int main() {
 putchar (0x0a)
 ; return 0; }
 EOF
-if { (eval echo configure:8699: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:8951: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cf_cv_termio_and_termios=yes
 else
@@ -8715,13 +8967,13 @@ EOF
 
 
 echo $ac_n "checking for sigaction and structs""... $ac_c" 1>&6
-echo "configure:8719: checking for sigaction and structs" >&5
+echo "configure:8971: checking for sigaction and structs" >&5
 if eval "test \"`echo '$''{'cf_cv_func_sigaction'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
 cat > conftest.$ac_ext <<EOF
-#line 8725 "configure"
+#line 8977 "configure"
 #include "confdefs.h"
 
 #include <sys/types.h>
@@ -8736,7 +8988,7 @@ struct sigaction act;
 	
 ; return 0; }
 EOF
-if { (eval echo configure:8740: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:8992: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   cf_cv_func_sigaction=yes
 else
@@ -8760,17 +9012,17 @@ for ac_hdr in sys/wait.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:8764: checking for $ac_hdr" >&5
+echo "configure:9016: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 8769 "configure"
+#line 9021 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:8774: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:9026: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -8807,17 +9059,17 @@ for ac_hdr in wait.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:8811: checking for $ac_hdr" >&5
+echo "configure:9063: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 8816 "configure"
+#line 9068 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:8821: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:9073: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -8847,17 +9099,17 @@ for ac_hdr in waitstatus.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:8851: checking for $ac_hdr" >&5
+echo "configure:9103: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 8856 "configure"
+#line 9108 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:8861: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:9113: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -8898,13 +9150,13 @@ fi
 
 
 echo $ac_n "checking for union wait""... $ac_c" 1>&6
-echo "configure:8902: checking for union wait" >&5
+echo "configure:9154: checking for union wait" >&5
 if eval "test \"`echo '$''{'cf_cv_type_unionwait'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
 	cat > conftest.$ac_ext <<EOF
-#line 8908 "configure"
+#line 9160 "configure"
 #include "confdefs.h"
 $cf_wait_headers
 int main() {
@@ -8915,7 +9167,7 @@ int x;
 	
 ; return 0; }
 EOF
-if { (eval echo configure:8919: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:9171: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   cf_cv_type_unionwait=no
 	 echo compiles ok w/o union wait 1>&5
@@ -8926,7 +9178,7 @@ else
   rm -rf conftest*
   
 	cat > conftest.$ac_ext <<EOF
-#line 8930 "configure"
+#line 9182 "configure"
 #include "confdefs.h"
 $cf_wait_headers
 int main() {
@@ -8941,7 +9193,7 @@ union wait x;
 	
 ; return 0; }
 EOF
-if { (eval echo configure:8945: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:9197: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   cf_cv_type_unionwait=yes
 	 echo compiles ok with union wait and possibly macros too 1>&5
@@ -8968,20 +9220,20 @@ EOF
 if test $cf_cv_type_unionwait = yes; then
 
 	echo $ac_n "checking if union wait can be used as wait-arg""... $ac_c" 1>&6
-echo "configure:8972: checking if union wait can be used as wait-arg" >&5
+echo "configure:9224: checking if union wait can be used as wait-arg" >&5
 	if eval "test \"`echo '$''{'cf_cv_arg_union_wait'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
 		cat > conftest.$ac_ext <<EOF
-#line 8978 "configure"
+#line 9230 "configure"
 #include "confdefs.h"
 $cf_wait_headers
 int main() {
 union wait x; wait(&x)
 ; return 0; }
 EOF
-if { (eval echo configure:8985: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:9237: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cf_cv_arg_union_wait=yes
 else
@@ -9001,20 +9253,20 @@ EOF
 
 
 	echo $ac_n "checking if union wait can be used as waitpid-arg""... $ac_c" 1>&6
-echo "configure:9005: checking if union wait can be used as waitpid-arg" >&5
+echo "configure:9257: checking if union wait can be used as waitpid-arg" >&5
 	if eval "test \"`echo '$''{'cf_cv_arg_union_waitpid'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
 		cat > conftest.$ac_ext <<EOF
-#line 9011 "configure"
+#line 9263 "configure"
 #include "confdefs.h"
 $cf_wait_headers
 int main() {
 union wait x; waitpid(0, &x, 0)
 ; return 0; }
 EOF
-if { (eval echo configure:9018: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:9270: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cf_cv_arg_union_waitpid=yes
 else
@@ -9040,17 +9292,17 @@ for ac_hdr in stdarg.h varargs.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:9044: checking for $ac_hdr" >&5
+echo "configure:9296: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 9049 "configure"
+#line 9301 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:9054: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:9306: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -9077,13 +9329,13 @@ fi
 done
 
 echo $ac_n "checking for standard varargs""... $ac_c" 1>&6
-echo "configure:9081: checking for standard varargs" >&5
+echo "configure:9333: checking for standard varargs" >&5
 if eval "test \"`echo '$''{'cf_cv_ansi_varargs'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
 	cat > conftest.$ac_ext <<EOF
-#line 9087 "configure"
+#line 9339 "configure"
 #include "confdefs.h"
 
 #if HAVE_STDARG_H
@@ -9098,7 +9350,7 @@ int main() {
 return 0;} int foo(char *fmt,...){va_list args;va_start(args,fmt);va_end(args)
 ; return 0; }
 EOF
-if { (eval echo configure:9102: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:9354: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cf_cv_ansi_varargs=yes
 else
@@ -9118,12 +9370,12 @@ EOF
 
 
 echo $ac_n "checking for uid_t in sys/types.h""... $ac_c" 1>&6
-echo "configure:9122: checking for uid_t in sys/types.h" >&5
+echo "configure:9374: checking for uid_t in sys/types.h" >&5
 if eval "test \"`echo '$''{'ac_cv_type_uid_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 9127 "configure"
+#line 9379 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 EOF
@@ -9152,7 +9404,7 @@ EOF
 fi
 
 echo $ac_n "checking type of array argument to getgroups""... $ac_c" 1>&6
-echo "configure:9156: checking type of array argument to getgroups" >&5
+echo "configure:9408: checking type of array argument to getgroups" >&5
 if eval "test \"`echo '$''{'ac_cv_type_getgroups'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -9160,7 +9412,7 @@ else
   ac_cv_type_getgroups=cross
 else
   cat > conftest.$ac_ext <<EOF
-#line 9164 "configure"
+#line 9416 "configure"
 #include "confdefs.h"
 
 /* Thanks to Mike Rendell for this test.  */
@@ -9185,7 +9437,7 @@ main()
 }
 
 EOF
-if { (eval echo configure:9189: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:9441: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
     ac_cv_type_getgroups=gid_t
 else
@@ -9199,7 +9451,7 @@ fi
 
 if test $ac_cv_type_getgroups = cross; then
         cat > conftest.$ac_ext <<EOF
-#line 9203 "configure"
+#line 9455 "configure"
 #include "confdefs.h"
 #include <unistd.h>
 EOF
@@ -9223,12 +9475,12 @@ EOF
 
 
 echo $ac_n "checking for pid_t""... $ac_c" 1>&6
-echo "configure:9227: checking for pid_t" >&5
+echo "configure:9479: checking for pid_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 9232 "configure"
+#line 9484 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -9256,12 +9508,12 @@ EOF
 fi
 
 echo $ac_n "checking for uid_t in sys/types.h""... $ac_c" 1>&6
-echo "configure:9260: checking for uid_t in sys/types.h" >&5
+echo "configure:9512: checking for uid_t in sys/types.h" >&5
 if eval "test \"`echo '$''{'ac_cv_type_uid_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 9265 "configure"
+#line 9517 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 EOF
@@ -9290,12 +9542,12 @@ EOF
 fi
 
 echo $ac_n "checking for mode_t""... $ac_c" 1>&6
-echo "configure:9294: checking for mode_t" >&5
+echo "configure:9546: checking for mode_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_mode_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 9299 "configure"
+#line 9551 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -9324,19 +9576,253 @@ fi
 
 
 
+# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
+# for constant arguments.  Useless!
+echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6
+echo "configure:9583: checking for working alloca.h" >&5
+if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 9588 "configure"
+#include "confdefs.h"
+#include <alloca.h>
+int main() {
+char *p = alloca(2 * sizeof(int));
+; return 0; }
+EOF
+if { (eval echo configure:9595: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  ac_cv_header_alloca_h=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_header_alloca_h=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_header_alloca_h" 1>&6
+if test $ac_cv_header_alloca_h = yes; then
+  cat >> confdefs.h <<\EOF
+#define HAVE_ALLOCA_H 1
+EOF
+
+fi
+
+echo $ac_n "checking for alloca""... $ac_c" 1>&6
+echo "configure:9616: checking for alloca" >&5
+if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 9621 "configure"
+#include "confdefs.h"
+
+#ifdef __GNUC__
+# define alloca __builtin_alloca
+#else
+# ifdef _MSC_VER
+#  include <malloc.h>
+#  define alloca _alloca
+# else
+#  if HAVE_ALLOCA_H
+#   include <alloca.h>
+#  else
+#   ifdef _AIX
+ #pragma alloca
+#   else
+#    ifndef alloca /* predefined by HP cc +Olibcalls */
+char *alloca ();
+#    endif
+#   endif
+#  endif
+# endif
+#endif
+
+int main() {
+char *p = (char *) alloca(1);
+; return 0; }
+EOF
+if { (eval echo configure:9649: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  ac_cv_func_alloca_works=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_func_alloca_works=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_func_alloca_works" 1>&6
+if test $ac_cv_func_alloca_works = yes; then
+  cat >> confdefs.h <<\EOF
+#define HAVE_ALLOCA 1
+EOF
+
+fi
+
+if test $ac_cv_func_alloca_works = no; then
+  # The SVR3 libPW and SVR4 libucb both contain incompatible functions
+  # that cause trouble.  Some versions do not even contain alloca or
+  # contain a buggy version.  If you still want to use their alloca,
+  # use ar to extract alloca.o from them instead of compiling alloca.c.
+  ALLOCA=alloca.${ac_objext}
+  cat >> confdefs.h <<\EOF
+#define C_ALLOCA 1
+EOF
+
+
+echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6
+echo "configure:9681: checking whether alloca needs Cray hooks" >&5
+if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 9686 "configure"
+#include "confdefs.h"
+#if defined(CRAY) && ! defined(CRAY2)
+webecray
+#else
+wenotbecray
+#endif
+
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "webecray" >/dev/null 2>&1; then
+  rm -rf conftest*
+  ac_cv_os_cray=yes
+else
+  rm -rf conftest*
+  ac_cv_os_cray=no
+fi
+rm -f conftest*
+
+fi
+
+echo "$ac_t""$ac_cv_os_cray" 1>&6
+if test $ac_cv_os_cray = yes; then
+for ac_func in _getb67 GETB67 getb67; do
+  echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:9711: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 9716 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:9739: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define CRAY_STACKSEG_END $ac_func
+EOF
+
+  break
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+done
+fi
+
+echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6
+echo "configure:9766: checking stack direction for C alloca" >&5
+if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test "$cross_compiling" = yes; then
+  ac_cv_c_stack_direction=0
+else
+  cat > conftest.$ac_ext <<EOF
+#line 9774 "configure"
+#include "confdefs.h"
+find_stack_direction ()
+{
+  static char *addr = 0;
+  auto char dummy;
+  if (addr == 0)
+    {
+      addr = &dummy;
+      return find_stack_direction ();
+    }
+  else
+    return (&dummy > addr) ? 1 : -1;
+}
+main ()
+{
+  exit (find_stack_direction() < 0);
+}
+EOF
+if { (eval echo configure:9793: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
+  ac_cv_c_stack_direction=1
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -fr conftest*
+  ac_cv_c_stack_direction=-1
+fi
+rm -fr conftest*
+fi
+
+fi
+
+echo "$ac_t""$ac_cv_c_stack_direction" 1>&6
+cat >> confdefs.h <<EOF
+#define STACK_DIRECTION $ac_cv_c_stack_direction
+EOF
+
+fi
+
 ac_safe=`echo "vfork.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for vfork.h""... $ac_c" 1>&6
-echo "configure:9330: checking for vfork.h" >&5
+echo "configure:9816: checking for vfork.h" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 9335 "configure"
+#line 9821 "configure"
 #include "confdefs.h"
 #include <vfork.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:9340: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:9826: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -9361,18 +9847,18 @@ else
 fi
 
 echo $ac_n "checking for working vfork""... $ac_c" 1>&6
-echo "configure:9365: checking for working vfork" >&5
+echo "configure:9851: checking for working vfork" >&5
 if eval "test \"`echo '$''{'ac_cv_func_vfork_works'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test "$cross_compiling" = yes; then
   echo $ac_n "checking for vfork""... $ac_c" 1>&6
-echo "configure:9371: checking for vfork" >&5
+echo "configure:9857: checking for vfork" >&5
 if eval "test \"`echo '$''{'ac_cv_func_vfork'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 9376 "configure"
+#line 9862 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char vfork(); below.  */
@@ -9395,7 +9881,7 @@ vfork();
 
 ; return 0; }
 EOF
-if { (eval echo configure:9399: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:9885: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_vfork=yes"
 else
@@ -9417,7 +9903,7 @@ fi
 ac_cv_func_vfork_works=$ac_cv_func_vfork
 else
   cat > conftest.$ac_ext <<EOF
-#line 9421 "configure"
+#line 9907 "configure"
 #include "confdefs.h"
 /* Thanks to Paul Eggert for this test.  */
 #include <stdio.h>
@@ -9512,7 +9998,7 @@ main() {
   }
 }
 EOF
-if { (eval echo configure:9516: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:10002: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ac_cv_func_vfork_works=yes
 else
@@ -9536,13 +10022,13 @@ fi
 
 
 echo $ac_n "checking if we should use fcntl or ioctl""... $ac_c" 1>&6
-echo "configure:9540: checking if we should use fcntl or ioctl" >&5
+echo "configure:10026: checking if we should use fcntl or ioctl" >&5
 if eval "test \"`echo '$''{'cf_cv_fionbio'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
 cat > conftest.$ac_ext <<EOF
-#line 9546 "configure"
+#line 10032 "configure"
 #include "confdefs.h"
 
 #include <sys/types.h>
@@ -9554,7 +10040,7 @@ int main() {
 	
 ; return 0; }
 EOF
-if { (eval echo configure:9558: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:10044: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   cf_cv_fionbio=ioctl
 else
@@ -9563,7 +10049,7 @@ else
   rm -rf conftest*
   
 cat > conftest.$ac_ext <<EOF
-#line 9567 "configure"
+#line 10053 "configure"
 #include "confdefs.h"
 
 #include <sys/types.h>
@@ -9580,7 +10066,7 @@ int main() {
 	
 ; return 0; }
 EOF
-if { (eval echo configure:9584: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:10070: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   cf_cv_fionbio=fcntl
 else
@@ -9603,20 +10089,20 @@ EOF
 
 
 echo $ac_n "checking for broken/missing definition of remove""... $ac_c" 1>&6
-echo "configure:9607: checking for broken/missing definition of remove" >&5
+echo "configure:10093: checking for broken/missing definition of remove" >&5
 if eval "test \"`echo '$''{'cf_cv_baddef_remove'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
 cat > conftest.$ac_ext <<EOF
-#line 9613 "configure"
+#line 10099 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 int main() {
 remove("dummy")
 ; return 0; }
 EOF
-if { (eval echo configure:9620: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:10106: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   cf_cv_baddef_remove=no
 else
@@ -9624,7 +10110,7 @@ else
   cat conftest.$ac_ext >&5
   rm -rf conftest*
   cat > conftest.$ac_ext <<EOF
-#line 9628 "configure"
+#line 10114 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 		int __unlink(name) { return unlink(name); } 
@@ -9632,7 +10118,7 @@ int main() {
 remove("dummy")
 ; return 0; }
 EOF
-if { (eval echo configure:9636: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:10122: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   cf_cv_baddef_remove=yes
 else
@@ -9656,13 +10142,13 @@ EOF
 
 
 echo $ac_n "checking for lstat""... $ac_c" 1>&6
-echo "configure:9660: checking for lstat" >&5
+echo "configure:10146: checking for lstat" >&5
 if eval "test \"`echo '$''{'ac_cv_func_lstat'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
 cat > conftest.$ac_ext <<EOF
-#line 9666 "configure"
+#line 10152 "configure"
 #include "confdefs.h"
 
 #include <sys/types.h>
@@ -9671,7 +10157,7 @@ int main() {
 lstat(".", (struct stat *)0)
 ; return 0; }
 EOF
-if { (eval echo configure:9675: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:10161: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ac_cv_func_lstat=yes
 else
@@ -9714,12 +10200,12 @@ for ac_func in \
 
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:9718: checking for $ac_func" >&5
+echo "configure:10204: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 9723 "configure"
+#line 10209 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -9742,7 +10228,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:9746: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:10232: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -9772,12 +10258,12 @@ for ac_func in \
 
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:9776: checking for $ac_func" >&5
+echo "configure:10262: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 9781 "configure"
+#line 10267 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -9800,7 +10286,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:9804: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:10290: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -9829,7 +10315,7 @@ done
 
 
 echo $ac_n "checking for random-integer functions""... $ac_c" 1>&6
-echo "configure:9833: checking for random-integer functions" >&5
+echo "configure:10319: checking for random-integer functions" >&5
 if eval "test \"`echo '$''{'cf_cv_srand_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -9840,7 +10326,7 @@ do
 	cf_srand_func=`echo $cf_func | sed -e 's%/.*%%'`
 	cf_rand_func=`echo  $cf_func | sed -e 's%.*/%%'`
 cat > conftest.$ac_ext <<EOF
-#line 9844 "configure"
+#line 10330 "configure"
 #include "confdefs.h"
 
 #ifdef HAVE_STDLIB_H
@@ -9854,7 +10340,7 @@ int main() {
 long seed = 1; $cf_srand_func(seed); seed = $cf_rand_func()
 ; return 0; }
 EOF
-if { (eval echo configure:9858: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:10344: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   cf_cv_srand_func=$cf_func
  break
@@ -9870,7 +10356,7 @@ fi
 echo "$ac_t""$cf_cv_srand_func" 1>&6
 if test "$cf_cv_srand_func" != unknown ; then
 	echo $ac_n "checking for range of random-integers""... $ac_c" 1>&6
-echo "configure:9874: checking for range of random-integers" >&5
+echo "configure:10360: checking for range of random-integers" >&5
 if eval "test \"`echo '$''{'cf_cv_rand_max'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -9886,7 +10372,7 @@ else
 			;;
 		esac
 		cat > conftest.$ac_ext <<EOF
-#line 9890 "configure"
+#line 10376 "configure"
 #include "confdefs.h"
 
 #ifdef HAVE_STDLIB_H
@@ -9900,7 +10386,7 @@ int main() {
 long x = $cf_cv_rand_max
 ; return 0; }
 EOF
-if { (eval echo configure:9904: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:10390: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   :
 else
   echo "configure: failed program was:" >&5
@@ -9936,12 +10422,12 @@ for ac_func in strstr
 do
 
 echo $ac_n "checking for $ac_func declaration""... $ac_c" 1>&6
-echo "configure:9940: checking for $ac_func declaration" >&5
+echo "configure:10426: checking for $ac_func declaration" >&5
 if eval "test \"`echo '$''{'ac_cv_func_decl_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 9945 "configure"
+#line 10431 "configure"
 #include "confdefs.h"
 #include <string.h>
 int main() {
@@ -9950,11 +10436,11 @@ extern	int	${ac_func}();
 #endif
 ; return 0; }
 EOF
-if { (eval echo configure:9954: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:10440: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   
 cat > conftest.$ac_ext <<EOF
-#line 9958 "configure"
+#line 10444 "configure"
 #include "confdefs.h"
 #include <string.h>
 int main() {
@@ -9963,7 +10449,7 @@ int	(*p)() = ${ac_func};
 #endif
 ; return 0; }
 EOF
-if { (eval echo configure:9967: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:10453: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   
 eval "ac_cv_func_decl_$ac_func=yes"
@@ -10005,12 +10491,12 @@ for ac_func in getgrgid getgrnam
 do
 
 echo $ac_n "checking for $ac_func declaration""... $ac_c" 1>&6
-echo "configure:10009: checking for $ac_func declaration" >&5
+echo "configure:10495: checking for $ac_func declaration" >&5
 if eval "test \"`echo '$''{'ac_cv_func_decl_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 10014 "configure"
+#line 10500 "configure"
 #include "confdefs.h"
 
 #include <stdio.h>
@@ -10021,11 +10507,11 @@ extern	int	${ac_func}();
 #endif
 ; return 0; }
 EOF
-if { (eval echo configure:10025: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:10511: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   
 cat > conftest.$ac_ext <<EOF
-#line 10029 "configure"
+#line 10515 "configure"
 #include "confdefs.h"
 
 #include <stdio.h>
@@ -10036,7 +10522,7 @@ int	(*p)() = ${ac_func};
 #endif
 ; return 0; }
 EOF
-if { (eval echo configure:10040: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:10526: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   
 eval "ac_cv_func_decl_$ac_func=yes"
@@ -10078,13 +10564,13 @@ done
 
 
 echo $ac_n "checking if TRUE/FALSE are defined""... $ac_c" 1>&6
-echo "configure:10082: checking if TRUE/FALSE are defined" >&5
+echo "configure:10568: checking if TRUE/FALSE are defined" >&5
 if eval "test \"`echo '$''{'cf_cv_bool_defs'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
 cat > conftest.$ac_ext <<EOF
-#line 10088 "configure"
+#line 10574 "configure"
 #include "confdefs.h"
 
 #include <${cf_cv_ncurses_header-curses.h}>
@@ -10093,7 +10579,7 @@ int main() {
 int x = TRUE, y = FALSE
 ; return 0; }
 EOF
-if { (eval echo configure:10097: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:10583: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cf_cv_bool_defs=yes
 else
@@ -10120,13 +10606,13 @@ fi
 
 
 echo $ac_n "checking if external errno is declared""... $ac_c" 1>&6
-echo "configure:10124: checking if external errno is declared" >&5
+echo "configure:10610: checking if external errno is declared" >&5
 if eval "test \"`echo '$''{'cf_cv_dcl_errno'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
     cat > conftest.$ac_ext <<EOF
-#line 10130 "configure"
+#line 10616 "configure"
 #include "confdefs.h"
 
 #ifdef HAVE_STDLIB_H
@@ -10139,7 +10625,7 @@ int main() {
 long x = (long) errno
 ; return 0; }
 EOF
-if { (eval echo configure:10143: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:10629: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cf_cv_dcl_errno=yes
 else
@@ -10167,13 +10653,13 @@ fi
 # It's possible (for near-UNIX clones) that the data doesn't exist
 
 echo $ac_n "checking if external errno exists""... $ac_c" 1>&6
-echo "configure:10171: checking if external errno exists" >&5
+echo "configure:10657: checking if external errno exists" >&5
 if eval "test \"`echo '$''{'cf_cv_have_errno'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
     cat > conftest.$ac_ext <<EOF
-#line 10177 "configure"
+#line 10663 "configure"
 #include "confdefs.h"
 
 #undef errno
@@ -10183,7 +10669,7 @@ int main() {
 errno = 2
 ; return 0; }
 EOF
-if { (eval echo configure:10187: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:10673: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   cf_cv_have_errno=yes
 else
@@ -10213,21 +10699,21 @@ fi
 
 
 echo $ac_n "checking if we can set errno""... $ac_c" 1>&6
-echo "configure:10217: checking if we can set errno" >&5
+echo "configure:10703: checking if we can set errno" >&5
 if eval "test \"`echo '$''{'cf_cv_set_errno'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
 if test "$cross_compiling" = yes; then
   cat > conftest.$ac_ext <<EOF
-#line 10224 "configure"
+#line 10710 "configure"
 #include "confdefs.h"
 #include <errno.h>
 int main() {
 errno = 255
 ; return 0; }
 EOF
-if { (eval echo configure:10231: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:10717: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   cf_cv_set_errno=maybe
 else
@@ -10239,7 +10725,7 @@ fi
 rm -f conftest*
 else
   cat > conftest.$ac_ext <<EOF
-#line 10243 "configure"
+#line 10729 "configure"
 #include "confdefs.h"
 
 #include <errno.h>
@@ -10249,7 +10735,7 @@ int main()
 	exit(errno != 255);
 }
 EOF
-if { (eval echo configure:10253: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:10739: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   cf_cv_set_errno=yes
 else
@@ -10272,20 +10758,20 @@ EOF
 
 
 echo $ac_n "checking for setlocale()""... $ac_c" 1>&6
-echo "configure:10276: checking for setlocale()" >&5
+echo "configure:10762: checking for setlocale()" >&5
 if eval "test \"`echo '$''{'cf_cv_locale'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
 cat > conftest.$ac_ext <<EOF
-#line 10282 "configure"
+#line 10768 "configure"
 #include "confdefs.h"
 #include <locale.h>
 int main() {
 setlocale(LC_ALL, "")
 ; return 0; }
 EOF
-if { (eval echo configure:10289: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:10775: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   cf_cv_locale=yes
 else
@@ -10306,13 +10792,13 @@ EOF
 
 
 echo $ac_n "checking if NGROUPS is defined""... $ac_c" 1>&6
-echo "configure:10310: checking if NGROUPS is defined" >&5
+echo "configure:10796: checking if NGROUPS is defined" >&5
 if eval "test \"`echo '$''{'cf_cv_ngroups'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
 cat > conftest.$ac_ext <<EOF
-#line 10316 "configure"
+#line 10802 "configure"
 #include "confdefs.h"
 
 #if HAVE_SYS_PARAM_H
@@ -10326,7 +10812,7 @@ int main() {
 int x = NGROUPS
 ; return 0; }
 EOF
-if { (eval echo configure:10330: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:10816: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cf_cv_ngroups=yes
 else
@@ -10334,7 +10820,7 @@ else
   cat conftest.$ac_ext >&5
   rm -rf conftest*
   cat > conftest.$ac_ext <<EOF
-#line 10338 "configure"
+#line 10824 "configure"
 #include "confdefs.h"
 
 #if HAVE_SYS_PARAM_H
@@ -10348,7 +10834,7 @@ int main() {
 int x = NGROUPS_MAX
 ; return 0; }
 EOF
-if { (eval echo configure:10352: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:10838: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cf_cv_ngroups=NGROUPS_MAX
 else
@@ -10380,13 +10866,13 @@ fi
 
     
 echo $ac_n "checking if external sys_nerr is declared""... $ac_c" 1>&6
-echo "configure:10384: checking if external sys_nerr is declared" >&5
+echo "configure:10870: checking if external sys_nerr is declared" >&5
 if eval "test \"`echo '$''{'cf_cv_dcl_sys_nerr'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
     cat > conftest.$ac_ext <<EOF
-#line 10390 "configure"
+#line 10876 "configure"
 #include "confdefs.h"
 
 #ifdef HAVE_STDLIB_H
@@ -10399,7 +10885,7 @@ int main() {
 long x = (long) sys_nerr
 ; return 0; }
 EOF
-if { (eval echo configure:10403: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:10889: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cf_cv_dcl_sys_nerr=yes
 else
@@ -10427,13 +10913,13 @@ fi
 # It's possible (for near-UNIX clones) that the data doesn't exist
 
 echo $ac_n "checking if external sys_nerr exists""... $ac_c" 1>&6
-echo "configure:10431: checking if external sys_nerr exists" >&5
+echo "configure:10917: checking if external sys_nerr exists" >&5
 if eval "test \"`echo '$''{'cf_cv_have_sys_nerr'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
     cat > conftest.$ac_ext <<EOF
-#line 10437 "configure"
+#line 10923 "configure"
 #include "confdefs.h"
 
 #undef sys_nerr
@@ -10443,7 +10929,7 @@ int main() {
 sys_nerr = 2
 ; return 0; }
 EOF
-if { (eval echo configure:10447: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:10933: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   cf_cv_have_sys_nerr=yes
 else
@@ -10472,13 +10958,13 @@ fi
 
     
 echo $ac_n "checking if external sys_errlist is declared""... $ac_c" 1>&6
-echo "configure:10476: checking if external sys_errlist is declared" >&5
+echo "configure:10962: checking if external sys_errlist is declared" >&5
 if eval "test \"`echo '$''{'cf_cv_dcl_sys_errlist'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
     cat > conftest.$ac_ext <<EOF
-#line 10482 "configure"
+#line 10968 "configure"
 #include "confdefs.h"
 
 #ifdef HAVE_STDLIB_H
@@ -10491,7 +10977,7 @@ int main() {
 long x = (long) sys_errlist
 ; return 0; }
 EOF
-if { (eval echo configure:10495: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:10981: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cf_cv_dcl_sys_errlist=yes
 else
@@ -10519,13 +11005,13 @@ fi
 # It's possible (for near-UNIX clones) that the data doesn't exist
 
 echo $ac_n "checking if external sys_errlist exists""... $ac_c" 1>&6
-echo "configure:10523: checking if external sys_errlist exists" >&5
+echo "configure:11009: checking if external sys_errlist exists" >&5
 if eval "test \"`echo '$''{'cf_cv_have_sys_errlist'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
     cat > conftest.$ac_ext <<EOF
-#line 10529 "configure"
+#line 11015 "configure"
 #include "confdefs.h"
 
 #undef sys_errlist
@@ -10535,7 +11021,7 @@ int main() {
 sys_errlist = 2
 ; return 0; }
 EOF
-if { (eval echo configure:10539: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:11025: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   cf_cv_have_sys_errlist=yes
 else
@@ -10568,17 +11054,17 @@ for ac_hdr in lastlog.h paths.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:10572: checking for $ac_hdr" >&5
+echo "configure:11058: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 10577 "configure"
+#line 11063 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:10582: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:11068: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -10605,13 +11091,13 @@ fi
 done
 
 echo $ac_n "checking for lastlog path""... $ac_c" 1>&6
-echo "configure:10609: checking for lastlog path" >&5
+echo "configure:11095: checking for lastlog path" >&5
 if eval "test \"`echo '$''{'cf_cv_path_lastlog'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
 cat > conftest.$ac_ext <<EOF
-#line 10615 "configure"
+#line 11101 "configure"
 #include "confdefs.h"
 
 #include <sys/types.h>
@@ -10626,7 +11112,7 @@ int main() {
 char *path = _PATH_LASTLOG
 ; return 0; }
 EOF
-if { (eval echo configure:10630: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:11116: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cf_cv_path_lastlog="_PATH_LASTLOG"
 else
@@ -10652,9 +11138,8 @@ EOF
 
 
 
-
 echo $ac_n "checking for utmp implementation""... $ac_c" 1>&6
-echo "configure:10658: checking for utmp implementation" >&5
+echo "configure:11143: checking for utmp implementation" >&5
 if eval "test \"`echo '$''{'cf_cv_have_utmp'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -10670,7 +11155,7 @@ cf_utmp_includes="
 #endif
 "
 	cat > conftest.$ac_ext <<EOF
-#line 10674 "configure"
+#line 11159 "configure"
 #include "confdefs.h"
 $cf_utmp_includes
 int main() {
@@ -10679,7 +11164,7 @@ struct $cf_header x;
 	
 ; return 0; }
 EOF
-if { (eval echo configure:10683: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:11168: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cf_cv_have_utmp=$cf_header
 	 break
@@ -10689,7 +11174,7 @@ else
   rm -rf conftest*
   
 	cat > conftest.$ac_ext <<EOF
-#line 10693 "configure"
+#line 11178 "configure"
 #include "confdefs.h"
 $cf_utmp_includes
 int main() {
@@ -10698,7 +11183,7 @@ struct $cf_header x;
 	
 ; return 0; }
 EOF
-if { (eval echo configure:10702: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:11187: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cf_cv_have_utmp=$cf_header
 	 break
@@ -10728,13 +11213,13 @@ EOF
 	
 if test $cf_cv_have_utmp != no ; then
 echo $ac_n "checking if utmp.ut_host is declared""... $ac_c" 1>&6
-echo "configure:10732: checking if utmp.ut_host is declared" >&5
+echo "configure:11217: checking if utmp.ut_host is declared" >&5
 if eval "test \"`echo '$''{'cf_cv_have_utmp_ut_host'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
 	cat > conftest.$ac_ext <<EOF
-#line 10738 "configure"
+#line 11223 "configure"
 #include "confdefs.h"
 
 #include <sys/types.h>
@@ -10743,7 +11228,7 @@ int main() {
 struct $cf_cv_have_utmp x; char *y = &x.ut_host[0]
 ; return 0; }
 EOF
-if { (eval echo configure:10747: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:11232: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cf_cv_have_utmp_ut_host=yes
 else
@@ -10766,7 +11251,7 @@ fi
 	
 if test $cf_cv_have_utmp != no ; then
 echo $ac_n "checking if utmp.ut_name is declared""... $ac_c" 1>&6
-echo "configure:10770: checking if utmp.ut_name is declared" >&5
+echo "configure:11255: checking if utmp.ut_name is declared" >&5
 if eval "test \"`echo '$''{'cf_cv_have_utmp_ut_name'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -10782,7 +11267,7 @@ cf_utmp_includes="
 "
 for cf_header in ut_name ut_user ; do
 	cat > conftest.$ac_ext <<EOF
-#line 10786 "configure"
+#line 11271 "configure"
 #include "confdefs.h"
 $cf_utmp_includes
 int main() {
@@ -10791,7 +11276,7 @@ struct $cf_cv_have_utmp x;
 	
 ; return 0; }
 EOF
-if { (eval echo configure:10795: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:11280: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cf_cv_have_utmp_ut_name=$cf_header
 	 break
@@ -10822,7 +11307,7 @@ fi
 	
 if test $cf_cv_have_utmp != no ; then
 echo $ac_n "checking for exit-status in $cf_cv_have_utmp""... $ac_c" 1>&6
-echo "configure:10826: checking for exit-status in $cf_cv_have_utmp" >&5
+echo "configure:11311: checking for exit-status in $cf_cv_have_utmp" >&5
 if eval "test \"`echo '$''{'cf_cv_have_utmp_ut_xstatus'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -10834,7 +11319,7 @@ for cf_result in \
 	ut_exit.ut_exit
 do
 cat > conftest.$ac_ext <<EOF
-#line 10838 "configure"
+#line 11323 "configure"
 #include "confdefs.h"
 
 #include <sys/types.h>
@@ -10843,7 +11328,7 @@ int main() {
 struct $cf_cv_have_utmp x; long y = x.$cf_result = 0
 ; return 0; }
 EOF
-if { (eval echo configure:10847: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:11332: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cf_cv_have_utmp_ut_xstatus=$cf_result
 	 break
@@ -10874,13 +11359,13 @@ fi
 	
 if test $cf_cv_have_utmp != no ; then
 echo $ac_n "checking if utmp.ut_xtime is declared""... $ac_c" 1>&6
-echo "configure:10878: checking if utmp.ut_xtime is declared" >&5
+echo "configure:11363: checking if utmp.ut_xtime is declared" >&5
 if eval "test \"`echo '$''{'cf_cv_have_utmp_ut_xtime'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
 	cat > conftest.$ac_ext <<EOF
-#line 10884 "configure"
+#line 11369 "configure"
 #include "confdefs.h"
 
 #include <sys/types.h>
@@ -10889,7 +11374,7 @@ int main() {
 struct $cf_cv_have_utmp x; long y = x.ut_xtime = 0
 ; return 0; }
 EOF
-if { (eval echo configure:10893: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:11378: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cf_cv_have_utmp_ut_xtime=yes
 else
@@ -10897,7 +11382,7 @@ else
   cat conftest.$ac_ext >&5
   rm -rf conftest*
   cat > conftest.$ac_ext <<EOF
-#line 10901 "configure"
+#line 11386 "configure"
 #include "confdefs.h"
 
 #include <sys/types.h>
@@ -10906,7 +11391,7 @@ int main() {
 struct $cf_cv_have_utmp x; long y = x.ut_tv.tv_sec
 ; return 0; }
 EOF
-if { (eval echo configure:10910: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:11395: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cf_cv_have_utmp_ut_xtime=define
 else
@@ -10940,13 +11425,13 @@ fi
 	
 if test $cf_cv_have_utmp != no ; then
 echo $ac_n "checking if utmp.ut_session is declared""... $ac_c" 1>&6
-echo "configure:10944: checking if utmp.ut_session is declared" >&5
+echo "configure:11429: checking if utmp.ut_session is declared" >&5
 if eval "test \"`echo '$''{'cf_cv_have_utmp_ut_session'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
 	cat > conftest.$ac_ext <<EOF
-#line 10950 "configure"
+#line 11435 "configure"
 #include "confdefs.h"
 
 #include <sys/types.h>
@@ -10955,7 +11440,7 @@ int main() {
 struct $cf_cv_have_utmp x; long y = x.ut_session
 ; return 0; }
 EOF
-if { (eval echo configure:10959: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:11444: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cf_cv_have_utmp_ut_session=yes
 else
@@ -10979,14 +11464,14 @@ fi
 
 	
 echo $ac_n "checking if $cf_cv_have_utmp is SYSV flavor""... $ac_c" 1>&6
-echo "configure:10983: checking if $cf_cv_have_utmp is SYSV flavor" >&5
+echo "configure:11468: checking if $cf_cv_have_utmp is SYSV flavor" >&5
 if eval "test \"`echo '$''{'cf_cv_sysv_utmp'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
 test "$cf_cv_have_utmp" = "utmp" && cf_prefix="ut" || cf_prefix="utx"
 cat > conftest.$ac_ext <<EOF
-#line 10990 "configure"
+#line 11475 "configure"
 #include "confdefs.h"
 
 #include <sys/types.h>
@@ -11000,7 +11485,7 @@ struct $cf_cv_have_utmp x;
 	end${cf_prefix}ent();
 ; return 0; }
 EOF
-if { (eval echo configure:11004: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:11489: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   cf_cv_sysv_utmp=yes
 else
@@ -11023,13 +11508,13 @@ fi
 
 
 echo $ac_n "checking if external h_errno exists""... $ac_c" 1>&6
-echo "configure:11027: checking if external h_errno exists" >&5
+echo "configure:11512: checking if external h_errno exists" >&5
 if eval "test \"`echo '$''{'cf_cv_have_h_errno'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
     cat > conftest.$ac_ext <<EOF
-#line 11033 "configure"
+#line 11518 "configure"
 #include "confdefs.h"
 
 #undef h_errno
@@ -11039,7 +11524,7 @@ int main() {
 h_errno = 2
 ; return 0; }
 EOF
-if { (eval echo configure:11043: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:11528: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   cf_cv_have_h_errno=yes
 else
@@ -11070,7 +11555,7 @@ fi
 
 
 echo $ac_n "checking if bibp: URLs should be supported""... $ac_c" 1>&6
-echo "configure:11074: checking if bibp: URLs should be supported" >&5
+echo "configure:11559: checking if bibp: URLs should be supported" >&5
 
 # Check whether --enable-bibp-urls or --disable-bibp-urls was given.
 if test "${enable_bibp_urls+set}" = set; then
@@ -11094,7 +11579,7 @@ EOF
 
 
 echo $ac_n "checking if configuration info should be browsable""... $ac_c" 1>&6
-echo "configure:11098: checking if configuration info should be browsable" >&5
+echo "configure:11583: checking if configuration info should be browsable" >&5
 
 # Check whether --enable-config-info or --disable-config-info was given.
 if test "${enable_config_info+set}" = set; then
@@ -11118,7 +11603,7 @@ EOF
 
 
 echo $ac_n "checking if new-style forms-based options screen should be used""... $ac_c" 1>&6
-echo "configure:11122: checking if new-style forms-based options screen should be used" >&5
+echo "configure:11607: checking if new-style forms-based options screen should be used" >&5
 
 # Check whether --enable-forms-options or --disable-forms-options was given.
 if test "${enable_forms_options+set}" = set; then
@@ -11142,7 +11627,7 @@ EOF
 
 
 echo $ac_n "checking if old-style options menu should be used""... $ac_c" 1>&6
-echo "configure:11146: checking if old-style options menu should be used" >&5
+echo "configure:11631: checking if old-style options menu should be used" >&5
 
 # Check whether --enable-menu-options or --disable-menu-options was given.
 if test "${enable_menu_options+set}" = set; then
@@ -11166,7 +11651,7 @@ EOF
 
 
 echo $ac_n "checking if experimental address-list page should be used""... $ac_c" 1>&6
-echo "configure:11170: checking if experimental address-list page should be used" >&5
+echo "configure:11655: checking if experimental address-list page should be used" >&5
 
 # Check whether --enable-addrlist-page or --disable-addrlist-page was given.
 if test "${enable_addrlist_page+set}" = set; then
@@ -11190,7 +11675,7 @@ EOF
 
 
 echo $ac_n "checking if experimental charset-selection logic should be used""... $ac_c" 1>&6
-echo "configure:11194: checking if experimental charset-selection logic should be used" >&5
+echo "configure:11679: checking if experimental charset-selection logic should be used" >&5
 
 # Check whether --enable-charset-choice or --disable-charset-choice was given.
 if test "${enable_charset_choice+set}" = set; then
@@ -11214,7 +11699,7 @@ EOF
 
 
 echo $ac_n "checking if experimental CJK logic should be used""... $ac_c" 1>&6
-echo "configure:11218: checking if experimental CJK logic should be used" >&5
+echo "configure:11703: checking if experimental CJK logic should be used" >&5
 
 # Check whether --enable-cjk or --disable-cjk was given.
 if test "${enable_cjk+set}" = set; then
@@ -11238,7 +11723,7 @@ EOF
 
 
 echo $ac_n "checking if color-style code should be used""... $ac_c" 1>&6
-echo "configure:11242: checking if color-style code should be used" >&5
+echo "configure:11727: checking if color-style code should be used" >&5
 
 # Check whether --enable-color-style or --disable-color-style was given.
 if test "${enable_color_style+set}" = set; then
@@ -11269,7 +11754,7 @@ EOF
 	echo "$ac_t""yes" 1>&6
 
 	echo $ac_n "checking for location of style-sheet file""... $ac_c" 1>&6
-echo "configure:11273: checking for location of style-sheet file" >&5
+echo "configure:11758: checking for location of style-sheet file" >&5
 	LYNX_LSS_FILE=$cf_libdir/lynx.lss
 	cat >> confdefs.h <<EOF
 #define LYNX_LSS_FILE "$LYNX_LSS_FILE"
@@ -11290,7 +11775,7 @@ esac
 
 if test "$use_dft_colors" != no ; then
 echo $ac_n "checking if you want to use default-colors""... $ac_c" 1>&6
-echo "configure:11294: checking if you want to use default-colors" >&5
+echo "configure:11779: checking if you want to use default-colors" >&5
 
 # Check whether --enable-default-colors or --disable-default-colors was given.
 if test "${enable_default_colors+set}" = set; then
@@ -11315,7 +11800,7 @@ EOF
 fi
 
 echo $ac_n "checking if experimental file-upload logic should be used""... $ac_c" 1>&6
-echo "configure:11319: checking if experimental file-upload logic should be used" >&5
+echo "configure:11804: checking if experimental file-upload logic should be used" >&5
 
 # Check whether --enable-file-upload or --disable-file-upload was given.
 if test "${enable_file_upload+set}" = set; then
@@ -11339,7 +11824,7 @@ EOF
 
 
 echo $ac_n "checking if experimental htmlized lynx.cfg should be built""... $ac_c" 1>&6
-echo "configure:11343: checking if experimental htmlized lynx.cfg should be built" >&5
+echo "configure:11828: checking if experimental htmlized lynx.cfg should be built" >&5
 
 # Check whether --enable-htmlized-cfg or --disable-htmlized-cfg was given.
 if test "${enable_htmlized_cfg+set}" = set; then
@@ -11369,7 +11854,7 @@ fi
 
 ### check for ipv6 support
 echo $ac_n "checking whether to enable ipv6""... $ac_c" 1>&6
-echo "configure:11373: checking whether to enable ipv6" >&5
+echo "configure:11858: checking whether to enable ipv6" >&5
 
 # Check whether --enable-ipv6 or --disable-ipv6 was given.
 if test "${enable_ipv6+set}" = set; then
@@ -11390,7 +11875,7 @@ if test "$enableval" = "yes"; then
 	
 
 echo $ac_n "checking ipv6 stack type""... $ac_c" 1>&6
-echo "configure:11394: checking ipv6 stack type" >&5
+echo "configure:11879: checking ipv6 stack type" >&5
 if eval "test \"`echo '$''{'cf_cv_ipv6type'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -11410,7 +11895,7 @@ do
 		;;
 	inria) #(vi
 				cat > conftest.$ac_ext <<EOF
-#line 11414 "configure"
+#line 11899 "configure"
 #include "confdefs.h"
 
 #include <netinet/in.h>
@@ -11428,7 +11913,7 @@ rm -f conftest*
 		;;
 	kame) #(vi
 				cat > conftest.$ac_ext <<EOF
-#line 11432 "configure"
+#line 11917 "configure"
 #include "confdefs.h"
 
 #include <netinet/in.h>
@@ -11446,7 +11931,7 @@ rm -f conftest*
 		;;
 	linux-glibc) #(vi
 				cat > conftest.$ac_ext <<EOF
-#line 11450 "configure"
+#line 11935 "configure"
 #include "confdefs.h"
 
 #include <features.h>
@@ -11473,7 +11958,7 @@ rm -f conftest*
 		;;
 	toshiba) #(vi
 		cat > conftest.$ac_ext <<EOF
-#line 11477 "configure"
+#line 11962 "configure"
 #include "confdefs.h"
 
 #include <sys/param.h>
@@ -11491,7 +11976,7 @@ rm -f conftest*
 		;;
 	v6d) #(vi
 		cat > conftest.$ac_ext <<EOF
-#line 11495 "configure"
+#line 11980 "configure"
 #include "confdefs.h"
 
 #include </usr/local/v6/include/sys/v6config.h>
@@ -11509,7 +11994,7 @@ rm -f conftest*
 		;;
 	zeta)
 		cat > conftest.$ac_ext <<EOF
-#line 11513 "configure"
+#line 11998 "configure"
 #include "confdefs.h"
 
 #include <sys/param.h>
@@ -11541,8 +12026,8 @@ echo "$ac_t""$cf_cv_ipv6type" 1>&6
 cf_ipv6lib=none
 cf_ipv6dir=none
 
-echo $ac_n "checking for ipv6 library if required""... $ac_c" 1>&6
-echo "configure:11546: checking for ipv6 library if required" >&5
+echo $ac_n "checking for IPv6 library if required""... $ac_c" 1>&6
+echo "configure:12031: checking for IPv6 library if required" >&5
 case $cf_cv_ipv6type in #(vi
 solaris) #(vi
 	;;
@@ -11576,7 +12061,7 @@ echo "$ac_t""$cf_ipv6lib" 1>&6
 if test "$cf_ipv6lib" != "none"; then
 
 	cat > conftest.$ac_ext <<EOF
-#line 11580 "configure"
+#line 12065 "configure"
 #include "confdefs.h"
 
 #include <sys/types.h>
@@ -11587,7 +12072,7 @@ int main() {
 getaddrinfo(0, 0, 0, 0)
 ; return 0; }
 EOF
-if { (eval echo configure:11591: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:12076: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   :
 else
   echo "configure: failed program was:" >&5
@@ -11596,30 +12081,66 @@ else
   
 	cf_search=""
 
-test "$prefix" != /usr/local && \
-test -d /usr/local && \
-cf_search="$cf_search /usr/local/include /usr/local/include/$cf_ipv6dir /usr/local/$cf_ipv6dir/include"
+test -d $HOME && {
+	test -n "$verbose" && echo "	... testing include-directories under $HOME"
+	test -d $HOME/include &&    cf_search="$cf_search $HOME/include"
+	test -d $HOME/include/$cf_ipv6dir && cf_search="$cf_search $HOME/include/$cf_ipv6dir"
+}
 
-test "$includedir" != NONE && \
-test -d "$includedir" && \
-cf_search="$cf_search $includedir $includedir/$cf_ipv6dir"
+# For other stuff under the home directory, it should be sufficient to put
+# a symbolic link for $HOME/$cf_ipv6dir to the actual package location:
+test -d $HOME/$cf_ipv6dir && {
+	test -n "$verbose" && echo "	... testing include-directories under $HOME/$cf_ipv6dir"
+	test -d $HOME/$cf_ipv6dir/include &&    cf_search="$cf_search $HOME/$cf_ipv6dir/include"
+	test -d $HOME/$cf_ipv6dir/include/$cf_ipv6dir && cf_search="$cf_search $HOME/$cf_ipv6dir/include/$cf_ipv6dir"
+}
 
-test "$oldincludedir" != NONE && \
-test -d "$oldincludedir" && \
-cf_search="$cf_search $oldincludedir $oldincludedir/$cf_ipv6dir"
+test "$prefix" != /usr/local && \
+test -d /usr/local && {
+	test -n "$verbose" && echo "	... testing include-directories under /usr/local"
+	test -d /usr/local/include &&    cf_search="$cf_search /usr/local/include"
+	test -d /usr/local/include/$cf_ipv6dir && cf_search="$cf_search /usr/local/include/$cf_ipv6dir"
+	test -d /usr/local/$cf_ipv6dir/include && cf_search="$cf_search /usr/local/$cf_ipv6dir/include"
+}
 
 test "$prefix" != NONE && \
-test -d "$prefix" && \
-cf_search="$cf_search $prefix/include $prefix/include/$cf_ipv6dir $prefix/$cf_ipv6dir/include"
+test -d $prefix && {
+	test -n "$verbose" && echo "	... testing include-directories under $prefix"
+	test -d $prefix/include &&    cf_search="$cf_search $prefix/include"
+	test -d $prefix/include/$cf_ipv6dir && cf_search="$cf_search $prefix/include/$cf_ipv6dir"
+	test -d $prefix/$cf_ipv6dir/include && cf_search="$cf_search $prefix/$cf_ipv6dir/include"
+}
+
+test "$prefix" != /opt && \
+test -d /opt && {
+	test -n "$verbose" && echo "	... testing include-directories under /opt"
+	test -d /opt/include &&    cf_search="$cf_search /opt/include"
+	test -d /opt/include/$cf_ipv6dir && cf_search="$cf_search /opt/include/$cf_ipv6dir"
+	test -d /opt/$cf_ipv6dir/include && cf_search="$cf_search /opt/$cf_ipv6dir/include"
+}
 
 test "$prefix" != /usr && \
-cf_search="$cf_search /usr/include /usr/include/$cf_ipv6dir /usr/$cf_ipv6dir/include"
+test -d /usr && {
+	test -n "$verbose" && echo "	... testing include-directories under /usr"
+	test -d /usr/include &&    cf_search="$cf_search /usr/include"
+	test -d /usr/include/$cf_ipv6dir && cf_search="$cf_search /usr/include/$cf_ipv6dir"
+	test -d /usr/$cf_ipv6dir/include && cf_search="$cf_search /usr/$cf_ipv6dir/include"
+}
 
-test "$prefix" != /opt && \
-test -d /opt && \
-cf_search="$cf_search /opt/include /opt/include/$cf_ipv6dir /opt/$cf_ipv6dir/include"
+test "$includedir" != NONE && \
+test "$includedir" != "/usr/include" && \
+test -d "$includedir" && {
+	test -d $includedir &&    cf_search="$cf_search $includedir"
+	test -d $includedir/$cf_ipv6dir && cf_search="$cf_search $includedir/$cf_ipv6dir"
+}
+
+test "$oldincludedir" != NONE && \
+test "$oldincludedir" != "/usr/include" && \
+test -d "$oldincludedir" && {
+	test -d $oldincludedir    && cf_search="$cf_search $oldincludedir"
+	test -d $oldincludedir/$cf_ipv6dir && cf_search="$cf_search $oldincludedir/$cf_ipv6dir"
+}
 
-cf_search="$cf_search $HOME/include $HOME/include/$cf_ipv6dir $HOME/$cf_ipv6dir/include"
 
 	for cf_incdir in $cf_search
 	do
@@ -11640,12 +12161,12 @@ rm -f conftest*
 	eval 'cf_cv_have_lib_'$cf_ipv6lib'=no'
 	cf_libdir=""
 	echo $ac_n "checking for getaddrinfo""... $ac_c" 1>&6
-echo "configure:11644: checking for getaddrinfo" >&5
+echo "configure:12165: checking for getaddrinfo" >&5
 if eval "test \"`echo '$''{'ac_cv_func_getaddrinfo'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 11649 "configure"
+#line 12170 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char getaddrinfo(); below.  */
@@ -11668,7 +12189,7 @@ getaddrinfo();
 
 ; return 0; }
 EOF
-if { (eval echo configure:11672: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:12193: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_getaddrinfo=yes"
 else
@@ -11688,10 +12209,10 @@ else
 
 		cf_save_LIBS="$LIBS"
 		echo $ac_n "checking for getaddrinfo in -l$cf_ipv6lib""... $ac_c" 1>&6
-echo "configure:11692: checking for getaddrinfo in -l$cf_ipv6lib" >&5
+echo "configure:12213: checking for getaddrinfo in -l$cf_ipv6lib" >&5
 		LIBS="-l$cf_ipv6lib $LIBS"
 		cat > conftest.$ac_ext <<EOF
-#line 11695 "configure"
+#line 12216 "configure"
 #include "confdefs.h"
 
 #include <sys/types.h>
@@ -11702,7 +12223,7 @@ int main() {
 getaddrinfo(0, 0, 0, 0)
 ; return 0; }
 EOF
-if { (eval echo configure:11706: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:12227: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   echo "$ac_t""yes" 1>&6
 			 eval 'cf_cv_have_lib_'$cf_ipv6lib'=yes'
@@ -11714,42 +12235,59 @@ else
   echo "$ac_t""no" 1>&6
 			cf_search=""
 
-test "$prefix" != /usr/local && \
-test -d /usr/local && \
-cf_search="$cf_search /usr/local/lib /usr/local/lib/$cf_ipv6dir /usr/local/$cf_ipv6dir/lib"
+test -d $HOME && {
+	test -n "$verbose" && echo "	... testing lib-directories under $HOME"
+	test -d $HOME/lib &&    cf_search="$cf_search $HOME/lib"
+	test -d $HOME/lib/$cf_ipv6dir && cf_search="$cf_search $HOME/lib/$cf_ipv6dir"
+}
 
-test "$libdir" != NONE && \
-test -d $libdir && \
-cf_search="$cf_search $libdir $libdir/$cf_ipv6dir"
+# For other stuff under the home directory, it should be sufficient to put
+# a symbolic link for $HOME/$cf_ipv6dir to the actual package location:
+test -d $HOME/$cf_ipv6dir && {
+	test -n "$verbose" && echo "	... testing lib-directories under $HOME/$cf_ipv6dir"
+	test -d $HOME/$cf_ipv6dir/lib &&    cf_search="$cf_search $HOME/$cf_ipv6dir/lib"
+	test -d $HOME/$cf_ipv6dir/lib/$cf_ipv6dir && cf_search="$cf_search $HOME/$cf_ipv6dir/lib/$cf_ipv6dir"
+}
 
-test "$exec_prefix" != NONE && \
-test -d $exec_prefix && \
-cf_search="$cf_search $exec_prefix/lib $exec_prefix/lib/$cf_ipv6dir"
+test "$prefix" != /usr/local && \
+test -d /usr/local && {
+	test -n "$verbose" && echo "	... testing lib-directories under /usr/local"
+	test -d /usr/local/lib &&    cf_search="$cf_search /usr/local/lib"
+	test -d /usr/local/lib/$cf_ipv6dir && cf_search="$cf_search /usr/local/lib/$cf_ipv6dir"
+	test -d /usr/local/$cf_ipv6dir/lib && cf_search="$cf_search /usr/local/$cf_ipv6dir/lib"
+}
 
 test "$prefix" != NONE && \
-test "$prefix" != "$exec_prefix" && \
-test -d $prefix && \
-cf_search="$cf_search $prefix/lib $prefix/lib/$cf_ipv6dir $prefix/$cf_ipv6dir/lib"
-
-test "$prefix" != /usr && \
-cf_search="$cf_search /usr/lib /usr/lib/$cf_ipv6dir /usr/$cf_ipv6dir/lib"
-
-test "$prefix" != / && \
-cf_search="$cf_search /lib /lib/$cf_ipv6dir /$cf_ipv6dir/lib"
+test -d $prefix && {
+	test -n "$verbose" && echo "	... testing lib-directories under $prefix"
+	test -d $prefix/lib &&    cf_search="$cf_search $prefix/lib"
+	test -d $prefix/lib/$cf_ipv6dir && cf_search="$cf_search $prefix/lib/$cf_ipv6dir"
+	test -d $prefix/$cf_ipv6dir/lib && cf_search="$cf_search $prefix/$cf_ipv6dir/lib"
+}
 
 test "$prefix" != /opt && \
-test -d /opt && \
-cf_search="$cf_search /opt/lib /opt/lib/$cf_ipv6dir /opt/$cf_ipv6dir/lib"
+test -d /opt && {
+	test -n "$verbose" && echo "	... testing lib-directories under /opt"
+	test -d /opt/lib &&    cf_search="$cf_search /opt/lib"
+	test -d /opt/lib/$cf_ipv6dir && cf_search="$cf_search /opt/lib/$cf_ipv6dir"
+	test -d /opt/$cf_ipv6dir/lib && cf_search="$cf_search /opt/$cf_ipv6dir/lib"
+}
 
-cf_search="$cf_search $HOME/lib $HOME/lib/$cf_ipv6dir $HOME/$cf_ipv6dir/lib"
+test "$prefix" != /usr && \
+test -d /usr && {
+	test -n "$verbose" && echo "	... testing lib-directories under /usr"
+	test -d /usr/lib &&    cf_search="$cf_search /usr/lib"
+	test -d /usr/lib/$cf_ipv6dir && cf_search="$cf_search /usr/lib/$cf_ipv6dir"
+	test -d /usr/$cf_ipv6dir/lib && cf_search="$cf_search /usr/$cf_ipv6dir/lib"
+}
 
 			for cf_libdir in $cf_search
 			do
 				echo $ac_n "checking for -l$cf_ipv6lib in $cf_libdir""... $ac_c" 1>&6
-echo "configure:11750: checking for -l$cf_ipv6lib in $cf_libdir" >&5
+echo "configure:12288: checking for -l$cf_ipv6lib in $cf_libdir" >&5
 				LIBS="-L$cf_libdir -l$cf_ipv6lib $cf_save_LIBS"
 				cat > conftest.$ac_ext <<EOF
-#line 11753 "configure"
+#line 12291 "configure"
 #include "confdefs.h"
 
 #include <sys/types.h>
@@ -11760,7 +12298,7 @@ int main() {
 getaddrinfo(0, 0, 0, 0)
 ; return 0; }
 EOF
-if { (eval echo configure:11764: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:12302: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   echo "$ac_t""yes" 1>&6
 			 		 eval 'cf_cv_have_lib_'$cf_ipv6lib'=yes'
@@ -11785,7 +12323,7 @@ eval 'cf_found_library=$cf_cv_have_lib_'$cf_ipv6lib
 
 	if test $cf_found_library = no ; then
 		{ echo "configure: error: No $cf_ipv6lib library found, cannot continue.  You must fetch lib$cf_ipv6lib.a
-from an appropriate ipv6 kit and compile beforehand." 1>&2; exit 1; }
+from an appropriate IPv6 kit and compile beforehand." 1>&2; exit 1; }
 	fi
 fi
 
@@ -11793,7 +12331,7 @@ fi
 
 
 echo $ac_n "checking working getaddrinfo""... $ac_c" 1>&6
-echo "configure:11797: checking working getaddrinfo" >&5
+echo "configure:12335: checking working getaddrinfo" >&5
 if eval "test \"`echo '$''{'cf_cv_getaddrinfo'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -11802,7 +12340,7 @@ if test "$cross_compiling" = yes; then
   cf_cv_getaddrinfo=unknown
 else
   cat > conftest.$ac_ext <<EOF
-#line 11806 "configure"
+#line 12344 "configure"
 #include "confdefs.h"
 
 #include <sys/types.h>
@@ -11881,7 +12419,7 @@ int main()
 }
 
 EOF
-if { (eval echo configure:11885: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:12423: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   cf_cv_getaddrinfo=yes
 else
@@ -11924,7 +12462,7 @@ fi
 fi
 
 echo $ac_n "checking if experimental element-justification logic should be used""... $ac_c" 1>&6
-echo "configure:11928: checking if experimental element-justification logic should be used" >&5
+echo "configure:12466: checking if experimental element-justification logic should be used" >&5
 
 # Check whether --enable-justify-elts or --disable-justify-elts was given.
 if test "${enable_justify_elts+set}" = set; then
@@ -11948,7 +12486,7 @@ EOF
 
 
 echo $ac_n "checking if experimental keyboard-layout logic should be used""... $ac_c" 1>&6
-echo "configure:11952: checking if experimental keyboard-layout logic should be used" >&5
+echo "configure:12490: checking if experimental keyboard-layout logic should be used" >&5
 
 # Check whether --enable-kbd-layout or --disable-kbd-layout was given.
 if test "${enable_kbd_layout+set}" = set; then
@@ -11972,7 +12510,7 @@ EOF
 
 
 echo $ac_n "checking if experimental JavaScript support should be used""... $ac_c" 1>&6
-echo "configure:11976: checking if experimental JavaScript support should be used" >&5
+echo "configure:12514: checking if experimental JavaScript support should be used" >&5
 
 # Check whether --enable-libjs or --disable-libjs was given.
 if test "${enable_libjs+set}" = set; then
@@ -11996,7 +12534,7 @@ EOF
 
 
 echo $ac_n "checking if experimental nested-table logic should be used""... $ac_c" 1>&6
-echo "configure:12000: checking if experimental nested-table logic should be used" >&5
+echo "configure:12538: checking if experimental nested-table logic should be used" >&5
 
 # Check whether --enable-nested-tables or --disable-nested-tables was given.
 if test "${enable_nested_tables+set}" = set; then
@@ -12020,7 +12558,7 @@ EOF
 
 
 echo $ac_n "checking if html source should be colorized""... $ac_c" 1>&6
-echo "configure:12024: checking if html source should be colorized" >&5
+echo "configure:12562: checking if html source should be colorized" >&5
 
 # Check whether --enable-prettysrc or --disable-prettysrc was given.
 if test "${enable_prettysrc+set}" = set; then
@@ -12044,7 +12582,7 @@ EOF
 
 
 echo $ac_n "checking if read-progress message should show ETA""... $ac_c" 1>&6
-echo "configure:12048: checking if read-progress message should show ETA" >&5
+echo "configure:12586: checking if read-progress message should show ETA" >&5
 
 # Check whether --enable-read-eta or --disable-read-eta was given.
 if test "${enable_read_eta+set}" = set; then
@@ -12068,7 +12606,7 @@ EOF
 
 
 echo $ac_n "checking if scrollbar code should be used""... $ac_c" 1>&6
-echo "configure:12072: checking if scrollbar code should be used" >&5
+echo "configure:12610: checking if scrollbar code should be used" >&5
 
 # Check whether --enable-scrollbar or --disable-scrollbar was given.
 if test "${enable_scrollbar+set}" = set; then
@@ -12088,7 +12626,7 @@ fi
 echo "$ac_t""$use_scrollbar" 1>&6
 
 echo $ac_n "checking if source caching should be used""... $ac_c" 1>&6
-echo "configure:12092: checking if source caching should be used" >&5
+echo "configure:12630: checking if source caching should be used" >&5
 
 # Check whether --enable-source-cache or --disable-source-cache was given.
 if test "${enable_source_cache+set}" = set; then
@@ -12115,7 +12653,7 @@ EOF
 
 
 echo $ac_n "checking if alternative line-edit bindings should be used""... $ac_c" 1>&6
-echo "configure:12119: checking if alternative line-edit bindings should be used" >&5
+echo "configure:12657: checking if alternative line-edit bindings should be used" >&5
 
 # Check whether --enable-alt-bindings or --disable-alt-bindings was given.
 if test "${enable_alt_bindings+set}" = set; then
@@ -12139,7 +12677,7 @@ EOF
 
 
 echo $ac_n "checking if you want to use extended HTML DTD logic""... $ac_c" 1>&6
-echo "configure:12143: checking if you want to use extended HTML DTD logic" >&5
+echo "configure:12681: checking if you want to use extended HTML DTD logic" >&5
 
 # Check whether --enable-extended-dtd or --disable-extended-dtd was given.
 if test "${enable_extended_dtd+set}" = set; then
@@ -12163,7 +12701,7 @@ EOF
 
 
 echo $ac_n "checking if partial-display should be used""... $ac_c" 1>&6
-echo "configure:12167: checking if partial-display should be used" >&5
+echo "configure:12705: checking if partial-display should be used" >&5
 
 # Check whether --enable-partial or --disable-partial was given.
 if test "${enable_partial+set}" = set; then
@@ -12187,7 +12725,7 @@ EOF
 
 
 echo $ac_n "checking if you want to use external commands""... $ac_c" 1>&6
-echo "configure:12191: checking if you want to use external commands" >&5
+echo "configure:12729: checking if you want to use external commands" >&5
 
 # Check whether --enable-externs or --disable-externs was given.
 if test "${enable_externs+set}" = set; then
@@ -12214,7 +12752,7 @@ EOF
 fi
 
 echo $ac_n "checking if you want to use setfont support""... $ac_c" 1>&6
-echo "configure:12218: checking if you want to use setfont support" >&5
+echo "configure:12756: checking if you want to use setfont support" >&5
 
 # Check whether --enable-font-switch or --disable-font-switch was given.
 if test "${enable_font_switch+set}" = set; then
@@ -12238,7 +12776,7 @@ EOF
 
 
 echo $ac_n "checking if you want cgi-link support""... $ac_c" 1>&6
-echo "configure:12242: checking if you want cgi-link support" >&5
+echo "configure:12780: checking if you want cgi-link support" >&5
 
 # Check whether --enable-cgi-links or --disable-cgi-links was given.
 if test "${enable_cgi_links+set}" = set; then
@@ -12257,7 +12795,7 @@ fi
 echo "$ac_t""$enableval" 1>&6
 
 echo $ac_n "checking if you want change-exec support""... $ac_c" 1>&6
-echo "configure:12261: checking if you want change-exec support" >&5
+echo "configure:12799: checking if you want change-exec support" >&5
 
 # Check whether --enable-change-exec or --disable-change-exec was given.
 if test "${enable_change_exec+set}" = set; then
@@ -12281,7 +12819,7 @@ EOF
 
 
 echo $ac_n "checking if you want exec-links support""... $ac_c" 1>&6
-echo "configure:12285: checking if you want exec-links support" >&5
+echo "configure:12823: checking if you want exec-links support" >&5
 
 # Check whether --enable-exec-links or --disable-exec-links was given.
 if test "${enable_exec_links+set}" = set; then
@@ -12305,7 +12843,7 @@ EOF
 
 
 echo $ac_n "checking if you want exec-scripts support""... $ac_c" 1>&6
-echo "configure:12309: checking if you want exec-scripts support" >&5
+echo "configure:12847: checking if you want exec-scripts support" >&5
 
 # Check whether --enable-exec-scripts or --disable-exec-scripts was given.
 if test "${enable_exec_scripts+set}" = set; then
@@ -12329,7 +12867,7 @@ EOF
 
 
 echo $ac_n "checking if you want internal-links feature""... $ac_c" 1>&6
-echo "configure:12333: checking if you want internal-links feature" >&5
+echo "configure:12871: checking if you want internal-links feature" >&5
 
 # Check whether --enable-internal-links or --disable-internal-links was given.
 if test "${enable_internal_links+set}" = set; then
@@ -12353,7 +12891,7 @@ EOF
 
 
 echo $ac_n "checking if you want to fork NSL requests""... $ac_c" 1>&6
-echo "configure:12357: checking if you want to fork NSL requests" >&5
+echo "configure:12895: checking if you want to fork NSL requests" >&5
 
 # Check whether --enable-nsl-fork or --disable-nsl-fork was given.
 if test "${enable_nsl_fork+set}" = set; then
@@ -12377,7 +12915,7 @@ EOF
 
 
 echo $ac_n "checking if you want to log URL requests via syslog""... $ac_c" 1>&6
-echo "configure:12381: checking if you want to log URL requests via syslog" >&5
+echo "configure:12919: checking if you want to log URL requests via syslog" >&5
 
 # Check whether --enable-syslog or --disable-syslog was given.
 if test "${enable_syslog+set}" = set; then
@@ -12401,7 +12939,7 @@ EOF
 
 
 echo $ac_n "checking if persistent-cookie logic should be used""... $ac_c" 1>&6
-echo "configure:12405: checking if persistent-cookie logic should be used" >&5
+echo "configure:12943: checking if persistent-cookie logic should be used" >&5
 
 # Check whether --enable-persistent-cookies or --disable-persistent-cookies was given.
 if test "${enable_persistent_cookies+set}" = set; then
@@ -12425,7 +12963,7 @@ EOF
 
 
 echo $ac_n "checking if you want to underline links""... $ac_c" 1>&6
-echo "configure:12429: checking if you want to underline links" >&5
+echo "configure:12967: checking if you want to underline links" >&5
 
 # Check whether --enable-underlines or --disable-underlines was given.
 if test "${enable_underlines+set}" = set; then
@@ -12449,7 +12987,7 @@ EOF
 
 
 echo $ac_n "checking if help files should be gzip'ed""... $ac_c" 1>&6
-echo "configure:12453: checking if help files should be gzip'ed" >&5
+echo "configure:12991: checking if help files should be gzip'ed" >&5
 
 # Check whether --enable-gzip-help or --disable-gzip-help was given.
 if test "${enable_gzip_help+set}" = set; then
@@ -12469,7 +13007,7 @@ fi
 echo "$ac_t""$use_gzip_help" 1>&6
 
 echo $ac_n "checking if you want to use zlib for decompression of some gzip files""... $ac_c" 1>&6
-echo "configure:12473: checking if you want to use zlib for decompression of some gzip files" >&5
+echo "configure:13011: checking if you want to use zlib for decompression of some gzip files" >&5
 
 # Check whether --with-zlib or --without-zlib was given.
 if test "${with_zlib+set}" = set; then
@@ -12483,16 +13021,16 @@ echo "$ac_t""$use_zlib" 1>&6
 
 if test ".$use_zlib" != ".no" ; then
 	echo $ac_n "checking if we need to add -I option to get zlib.h""... $ac_c" 1>&6
-echo "configure:12487: checking if we need to add -I option to get zlib.h" >&5
+echo "configure:13025: checking if we need to add -I option to get zlib.h" >&5
 	cat > conftest.$ac_ext <<EOF
-#line 12489 "configure"
+#line 13027 "configure"
 #include "confdefs.h"
 #include <zlib.h>
 int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:12496: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:13034: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   echo "$ac_t""no" 1>&6
 else
@@ -12503,30 +13041,66 @@ else
 	echo "$ac_t""yes" 1>&6
 	cf_search=""
 
-test "$prefix" != /usr/local && \
-test -d /usr/local && \
-cf_search="$cf_search /usr/local/include /usr/local/include/zlib /usr/local/zlib/include"
+test -d $HOME && {
+	test -n "$verbose" && echo "	... testing include-directories under $HOME"
+	test -d $HOME/include &&    cf_search="$cf_search $HOME/include"
+	test -d $HOME/include/zlib && cf_search="$cf_search $HOME/include/zlib"
+}
 
-test "$includedir" != NONE && \
-test -d "$includedir" && \
-cf_search="$cf_search $includedir $includedir/zlib"
+# For other stuff under the home directory, it should be sufficient to put
+# a symbolic link for $HOME/zlib to the actual package location:
+test -d $HOME/zlib && {
+	test -n "$verbose" && echo "	... testing include-directories under $HOME/zlib"
+	test -d $HOME/zlib/include &&    cf_search="$cf_search $HOME/zlib/include"
+	test -d $HOME/zlib/include/zlib && cf_search="$cf_search $HOME/zlib/include/zlib"
+}
 
-test "$oldincludedir" != NONE && \
-test -d "$oldincludedir" && \
-cf_search="$cf_search $oldincludedir $oldincludedir/zlib"
+test "$prefix" != /usr/local && \
+test -d /usr/local && {
+	test -n "$verbose" && echo "	... testing include-directories under /usr/local"
+	test -d /usr/local/include &&    cf_search="$cf_search /usr/local/include"
+	test -d /usr/local/include/zlib && cf_search="$cf_search /usr/local/include/zlib"
+	test -d /usr/local/zlib/include && cf_search="$cf_search /usr/local/zlib/include"
+}
 
 test "$prefix" != NONE && \
-test -d "$prefix" && \
-cf_search="$cf_search $prefix/include $prefix/include/zlib $prefix/zlib/include"
+test -d $prefix && {
+	test -n "$verbose" && echo "	... testing include-directories under $prefix"
+	test -d $prefix/include &&    cf_search="$cf_search $prefix/include"
+	test -d $prefix/include/zlib && cf_search="$cf_search $prefix/include/zlib"
+	test -d $prefix/zlib/include && cf_search="$cf_search $prefix/zlib/include"
+}
+
+test "$prefix" != /opt && \
+test -d /opt && {
+	test -n "$verbose" && echo "	... testing include-directories under /opt"
+	test -d /opt/include &&    cf_search="$cf_search /opt/include"
+	test -d /opt/include/zlib && cf_search="$cf_search /opt/include/zlib"
+	test -d /opt/zlib/include && cf_search="$cf_search /opt/zlib/include"
+}
 
 test "$prefix" != /usr && \
-cf_search="$cf_search /usr/include /usr/include/zlib /usr/zlib/include"
+test -d /usr && {
+	test -n "$verbose" && echo "	... testing include-directories under /usr"
+	test -d /usr/include &&    cf_search="$cf_search /usr/include"
+	test -d /usr/include/zlib && cf_search="$cf_search /usr/include/zlib"
+	test -d /usr/zlib/include && cf_search="$cf_search /usr/zlib/include"
+}
 
-test "$prefix" != /opt && \
-test -d /opt && \
-cf_search="$cf_search /opt/include /opt/include/zlib /opt/zlib/include"
+test "$includedir" != NONE && \
+test "$includedir" != "/usr/include" && \
+test -d "$includedir" && {
+	test -d $includedir &&    cf_search="$cf_search $includedir"
+	test -d $includedir/zlib && cf_search="$cf_search $includedir/zlib"
+}
+
+test "$oldincludedir" != NONE && \
+test "$oldincludedir" != "/usr/include" && \
+test -d "$oldincludedir" && {
+	test -d $oldincludedir    && cf_search="$cf_search $oldincludedir"
+	test -d $oldincludedir/zlib && cf_search="$cf_search $oldincludedir/zlib"
+}
 
-cf_search="$cf_search $HOME/include $HOME/include/zlib $HOME/zlib/include"
 
 	for cf_incdir in $cf_search
 	do
@@ -12577,12 +13151,12 @@ rm -f conftest*
 	eval 'cf_cv_have_lib_'z'=no'
 	cf_libdir=""
 	echo $ac_n "checking for gzopen""... $ac_c" 1>&6
-echo "configure:12581: checking for gzopen" >&5
+echo "configure:13155: checking for gzopen" >&5
 if eval "test \"`echo '$''{'ac_cv_func_gzopen'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 12586 "configure"
+#line 13160 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char gzopen(); below.  */
@@ -12605,7 +13179,7 @@ gzopen();
 
 ; return 0; }
 EOF
-if { (eval echo configure:12609: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:13183: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_gzopen=yes"
 else
@@ -12625,17 +13199,17 @@ else
 
 		cf_save_LIBS="$LIBS"
 		echo $ac_n "checking for gzopen in -lz""... $ac_c" 1>&6
-echo "configure:12629: checking for gzopen in -lz" >&5
+echo "configure:13203: checking for gzopen in -lz" >&5
 		LIBS="-lz $LIBS"
 		cat > conftest.$ac_ext <<EOF
-#line 12632 "configure"
+#line 13206 "configure"
 #include "confdefs.h"
 #include <zlib.h>
 int main() {
 gzopen("name","mode")
 ; return 0; }
 EOF
-if { (eval echo configure:12639: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:13213: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   echo "$ac_t""yes" 1>&6
 			 eval 'cf_cv_have_lib_'z'=yes'
@@ -12647,49 +13221,66 @@ else
   echo "$ac_t""no" 1>&6
 			cf_search=""
 
-test "$prefix" != /usr/local && \
-test -d /usr/local && \
-cf_search="$cf_search /usr/local/lib /usr/local/lib/z /usr/local/z/lib"
+test -d $HOME && {
+	test -n "$verbose" && echo "	... testing lib-directories under $HOME"
+	test -d $HOME/lib &&    cf_search="$cf_search $HOME/lib"
+	test -d $HOME/lib/z && cf_search="$cf_search $HOME/lib/z"
+}
 
-test "$libdir" != NONE && \
-test -d $libdir && \
-cf_search="$cf_search $libdir $libdir/z"
+# For other stuff under the home directory, it should be sufficient to put
+# a symbolic link for $HOME/z to the actual package location:
+test -d $HOME/z && {
+	test -n "$verbose" && echo "	... testing lib-directories under $HOME/z"
+	test -d $HOME/z/lib &&    cf_search="$cf_search $HOME/z/lib"
+	test -d $HOME/z/lib/z && cf_search="$cf_search $HOME/z/lib/z"
+}
 
-test "$exec_prefix" != NONE && \
-test -d $exec_prefix && \
-cf_search="$cf_search $exec_prefix/lib $exec_prefix/lib/z"
+test "$prefix" != /usr/local && \
+test -d /usr/local && {
+	test -n "$verbose" && echo "	... testing lib-directories under /usr/local"
+	test -d /usr/local/lib &&    cf_search="$cf_search /usr/local/lib"
+	test -d /usr/local/lib/z && cf_search="$cf_search /usr/local/lib/z"
+	test -d /usr/local/z/lib && cf_search="$cf_search /usr/local/z/lib"
+}
 
 test "$prefix" != NONE && \
-test "$prefix" != "$exec_prefix" && \
-test -d $prefix && \
-cf_search="$cf_search $prefix/lib $prefix/lib/z $prefix/z/lib"
-
-test "$prefix" != /usr && \
-cf_search="$cf_search /usr/lib /usr/lib/z /usr/z/lib"
-
-test "$prefix" != / && \
-cf_search="$cf_search /lib /lib/z /z/lib"
+test -d $prefix && {
+	test -n "$verbose" && echo "	... testing lib-directories under $prefix"
+	test -d $prefix/lib &&    cf_search="$cf_search $prefix/lib"
+	test -d $prefix/lib/z && cf_search="$cf_search $prefix/lib/z"
+	test -d $prefix/z/lib && cf_search="$cf_search $prefix/z/lib"
+}
 
 test "$prefix" != /opt && \
-test -d /opt && \
-cf_search="$cf_search /opt/lib /opt/lib/z /opt/z/lib"
+test -d /opt && {
+	test -n "$verbose" && echo "	... testing lib-directories under /opt"
+	test -d /opt/lib &&    cf_search="$cf_search /opt/lib"
+	test -d /opt/lib/z && cf_search="$cf_search /opt/lib/z"
+	test -d /opt/z/lib && cf_search="$cf_search /opt/z/lib"
+}
 
-cf_search="$cf_search $HOME/lib $HOME/lib/z $HOME/z/lib"
+test "$prefix" != /usr && \
+test -d /usr && {
+	test -n "$verbose" && echo "	... testing lib-directories under /usr"
+	test -d /usr/lib &&    cf_search="$cf_search /usr/lib"
+	test -d /usr/lib/z && cf_search="$cf_search /usr/lib/z"
+	test -d /usr/z/lib && cf_search="$cf_search /usr/z/lib"
+}
 
 			for cf_libdir in $cf_search
 			do
 				echo $ac_n "checking for -lz in $cf_libdir""... $ac_c" 1>&6
-echo "configure:12683: checking for -lz in $cf_libdir" >&5
+echo "configure:13274: checking for -lz in $cf_libdir" >&5
 				LIBS="-L$cf_libdir -lz $cf_save_LIBS"
 				cat > conftest.$ac_ext <<EOF
-#line 12686 "configure"
+#line 13277 "configure"
 #include "confdefs.h"
 #include <zlib.h>
 int main() {
 gzopen("name","mode")
 ; return 0; }
 EOF
-if { (eval echo configure:12693: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:13284: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   echo "$ac_t""yes" 1>&6
 			 		 eval 'cf_cv_have_lib_'z'=yes'
@@ -12723,7 +13314,7 @@ EOF
 fi
 
 echo $ac_n "checking if you want to exclude FINGER code""... $ac_c" 1>&6
-echo "configure:12727: checking if you want to exclude FINGER code" >&5
+echo "configure:13318: checking if you want to exclude FINGER code" >&5
 
 # Check whether --enable-finger or --disable-finger was given.
 if test "${enable_finger+set}" = set; then
@@ -12747,7 +13338,7 @@ EOF
 
 
 echo $ac_n "checking if you want to exclude GOPHER code""... $ac_c" 1>&6
-echo "configure:12751: checking if you want to exclude GOPHER code" >&5
+echo "configure:13342: checking if you want to exclude GOPHER code" >&5
 
 # Check whether --enable-gopher or --disable-gopher was given.
 if test "${enable_gopher+set}" = set; then
@@ -12771,7 +13362,7 @@ EOF
 
 
 echo $ac_n "checking if you want to exclude NEWS code""... $ac_c" 1>&6
-echo "configure:12775: checking if you want to exclude NEWS code" >&5
+echo "configure:13366: checking if you want to exclude NEWS code" >&5
 
 # Check whether --enable-news or --disable-news was given.
 if test "${enable_news+set}" = set; then
@@ -12795,7 +13386,7 @@ EOF
 
 
 echo $ac_n "checking if you want to exclude FTP code""... $ac_c" 1>&6
-echo "configure:12799: checking if you want to exclude FTP code" >&5
+echo "configure:13390: checking if you want to exclude FTP code" >&5
 
 # Check whether --enable-ftp or --disable-ftp was given.
 if test "${enable_ftp+set}" = set; then
@@ -12824,7 +13415,7 @@ EOF
 # All DirEd functions that were enabled on compilation can be disabled
 # or modified at run time via DIRED_MENU symbols in lynx.cfg.
 echo $ac_n "checking if directory-editor code should be used""... $ac_c" 1>&6
-echo "configure:12828: checking if directory-editor code should be used" >&5
+echo "configure:13419: checking if directory-editor code should be used" >&5
 
 # Check whether --enable-dired or --disable-dired was given.
 if test "${enable_dired+set}" = set; then
@@ -12851,7 +13442,7 @@ EOF
 
 
 	echo $ac_n "checking if you wish to allow extracting from archives via DirEd""... $ac_c" 1>&6
-echo "configure:12855: checking if you wish to allow extracting from archives via DirEd" >&5
+echo "configure:13446: checking if you wish to allow extracting from archives via DirEd" >&5
 	
 # Check whether --enable-dired-dearchive or --disable-dired-dearchive was given.
 if test "${enable_dired_dearchive+set}" = set; then
@@ -12870,7 +13461,7 @@ fi
 	echo "$ac_t""$enableval" 1>&6
 
 	echo $ac_n "checking if DirEd mode should override keys""... $ac_c" 1>&6
-echo "configure:12874: checking if DirEd mode should override keys" >&5
+echo "configure:13465: checking if DirEd mode should override keys" >&5
 	
 # Check whether --enable-dired-override or --disable-dired-override was given.
 if test "${enable_dired_override+set}" = set; then
@@ -12896,7 +13487,7 @@ fi
 	echo "$ac_t""$enableval" 1>&6
 
 	echo $ac_n "checking if you wish to allow permissions commands via DirEd""... $ac_c" 1>&6
-echo "configure:12900: checking if you wish to allow permissions commands via DirEd" >&5
+echo "configure:13491: checking if you wish to allow permissions commands via DirEd" >&5
 	
 # Check whether --enable-dired-permit or --disable-dired-permit was given.
 if test "${enable_dired_permit+set}" = set; then
@@ -12922,7 +13513,7 @@ fi
 	echo "$ac_t""$enableval" 1>&6
 
 	echo $ac_n "checking if you wish to allow executable-permission commands via DirEd""... $ac_c" 1>&6
-echo "configure:12926: checking if you wish to allow executable-permission commands via DirEd" >&5
+echo "configure:13517: checking if you wish to allow executable-permission commands via DirEd" >&5
 	
 # Check whether --enable-dired-xpermit or --disable-dired-xpermit was given.
 if test "${enable_dired_xpermit+set}" = set; then
@@ -12941,7 +13532,7 @@ fi
 	echo "$ac_t""$enableval" 1>&6
 
 	echo $ac_n "checking if you wish to allow "tar" commands from DirEd""... $ac_c" 1>&6
-echo "configure:12945: checking if you wish to allow "tar" commands from DirEd" >&5
+echo "configure:13536: checking if you wish to allow "tar" commands from DirEd" >&5
 	
 # Check whether --enable-dired-tar or --disable-dired-tar was given.
 if test "${enable_dired_tar+set}" = set; then
@@ -12967,7 +13558,7 @@ fi
 	echo "$ac_t""$enableval" 1>&6
 
 	echo $ac_n "checking if you wish to allow "uudecode" commands from DirEd""... $ac_c" 1>&6
-echo "configure:12971: checking if you wish to allow "uudecode" commands from DirEd" >&5
+echo "configure:13562: checking if you wish to allow "uudecode" commands from DirEd" >&5
 	
 # Check whether --enable-dired-uudecode or --disable-dired-uudecode was given.
 if test "${enable_dired_uudecode+set}" = set; then
@@ -12993,7 +13584,7 @@ fi
 	echo "$ac_t""$enableval" 1>&6
 
 	echo $ac_n "checking if you wish to allow "zip" and "unzip" commands from DirEd""... $ac_c" 1>&6
-echo "configure:12997: checking if you wish to allow "zip" and "unzip" commands from DirEd" >&5
+echo "configure:13588: checking if you wish to allow "zip" and "unzip" commands from DirEd" >&5
 	
 # Check whether --enable-dired-zip or --disable-dired-zip was given.
 if test "${enable_dired_zip+set}" = set; then
@@ -13019,7 +13610,7 @@ fi
 	echo "$ac_t""$enableval" 1>&6
 
 	echo $ac_n "checking if you wish to allow "gzip" and "gunzip" commands from DirEd""... $ac_c" 1>&6
-echo "configure:13023: checking if you wish to allow "gzip" and "gunzip" commands from DirEd" >&5
+echo "configure:13614: checking if you wish to allow "gzip" and "gunzip" commands from DirEd" >&5
 	
 # Check whether --enable-dired-gzip or --disable-dired-gzip was given.
 if test "${enable_dired_gzip+set}" = set; then
@@ -13046,7 +13637,7 @@ fi
 fi
 
 echo $ac_n "checking if you want long-directory listings""... $ac_c" 1>&6
-echo "configure:13050: checking if you want long-directory listings" >&5
+echo "configure:13641: checking if you want long-directory listings" >&5
 
 # Check whether --enable-long-list or --disable-long-list was given.
 if test "${enable_long_list+set}" = set; then
@@ -13072,7 +13663,7 @@ fi
 echo "$ac_t""$enableval" 1>&6
 
 echo $ac_n "checking if parent-directory references are permitted""... $ac_c" 1>&6
-echo "configure:13076: checking if parent-directory references are permitted" >&5
+echo "configure:13667: checking if parent-directory references are permitted" >&5
 
 # Check whether --enable-parent-dir-refs or --disable-parent-dir-refs was given.
 if test "${enable_parent_dir_refs+set}" = set; then
@@ -13095,7 +13686,7 @@ test -z "$TELNET" && TELNET=telnet
 # Extract the first word of "telnet", so it can be a program name with args.
 set dummy telnet; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:13099: checking for $ac_word" >&5
+echo "configure:13690: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_TELNET'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -13183,7 +13774,7 @@ IFS="$cf_save_ifs"
 
 if test -n "$cf_path_prog" ; then
 	
-echo "(line 13187) testing defining path for ${cf_path_prog} ..." 1>&5
+echo "(line 13778) testing defining path for ${cf_path_prog} ..." 1>&5
 
 	cat >> confdefs.h <<EOF
 #define TELNET_PATH "$cf_path_prog"
@@ -13200,7 +13791,7 @@ test -z "$TN3270" && TN3270=tn3270
 # Extract the first word of "tn3270", so it can be a program name with args.
 set dummy tn3270; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:13204: checking for $ac_word" >&5
+echo "configure:13795: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_TN3270'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -13288,7 +13879,7 @@ IFS="$cf_save_ifs"
 
 if test -n "$cf_path_prog" ; then
 	
-echo "(line 13292) testing defining path for ${cf_path_prog} ..." 1>&5
+echo "(line 13883) testing defining path for ${cf_path_prog} ..." 1>&5
 
 	cat >> confdefs.h <<EOF
 #define TN3270_PATH "$cf_path_prog"
@@ -13305,7 +13896,7 @@ test -z "$RLOGIN" && RLOGIN=rlogin
 # Extract the first word of "rlogin", so it can be a program name with args.
 set dummy rlogin; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:13309: checking for $ac_word" >&5
+echo "configure:13900: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_RLOGIN'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -13393,7 +13984,7 @@ IFS="$cf_save_ifs"
 
 if test -n "$cf_path_prog" ; then
 	
-echo "(line 13397) testing defining path for ${cf_path_prog} ..." 1>&5
+echo "(line 13988) testing defining path for ${cf_path_prog} ..." 1>&5
 
 	cat >> confdefs.h <<EOF
 #define RLOGIN_PATH "$cf_path_prog"
@@ -13411,7 +14002,7 @@ test -z "$MV" && MV=mv
 # Extract the first word of "mv", so it can be a program name with args.
 set dummy mv; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:13415: checking for $ac_word" >&5
+echo "configure:14006: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_MV'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -13499,7 +14090,7 @@ IFS="$cf_save_ifs"
 
 if test -n "$cf_path_prog" ; then
 	
-echo "(line 13503) testing defining path for ${cf_path_prog} ..." 1>&5
+echo "(line 14094) testing defining path for ${cf_path_prog} ..." 1>&5
 
 	cat >> confdefs.h <<EOF
 #define MV_PATH "$cf_path_prog"
@@ -13517,7 +14108,7 @@ test -z "$GZIP" && GZIP=gzip
 # Extract the first word of "gzip", so it can be a program name with args.
 set dummy gzip; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:13521: checking for $ac_word" >&5
+echo "configure:14112: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_GZIP'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -13605,7 +14196,7 @@ IFS="$cf_save_ifs"
 
 if test -n "$cf_path_prog" ; then
 	
-echo "(line 13609) testing defining path for ${cf_path_prog} ..." 1>&5
+echo "(line 14200) testing defining path for ${cf_path_prog} ..." 1>&5
 
 	cat >> confdefs.h <<EOF
 #define GZIP_PATH "$cf_path_prog"
@@ -13622,7 +14213,7 @@ test -z "$UNCOMPRESS" && UNCOMPRESS=gunzip
 # Extract the first word of "gunzip", so it can be a program name with args.
 set dummy gunzip; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:13626: checking for $ac_word" >&5
+echo "configure:14217: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_UNCOMPRESS'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -13710,7 +14301,7 @@ IFS="$cf_save_ifs"
 
 if test -n "$cf_path_prog" ; then
 	
-echo "(line 13714) testing defining path for ${cf_path_prog} ..." 1>&5
+echo "(line 14305) testing defining path for ${cf_path_prog} ..." 1>&5
 
 	cat >> confdefs.h <<EOF
 #define UNCOMPRESS_PATH "$cf_path_prog"
@@ -13727,7 +14318,7 @@ test -z "$UNZIP" && UNZIP=unzip
 # Extract the first word of "unzip", so it can be a program name with args.
 set dummy unzip; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:13731: checking for $ac_word" >&5
+echo "configure:14322: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_UNZIP'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -13815,7 +14406,7 @@ IFS="$cf_save_ifs"
 
 if test -n "$cf_path_prog" ; then
 	
-echo "(line 13819) testing defining path for ${cf_path_prog} ..." 1>&5
+echo "(line 14410) testing defining path for ${cf_path_prog} ..." 1>&5
 
 	cat >> confdefs.h <<EOF
 #define UNZIP_PATH "$cf_path_prog"
@@ -13832,7 +14423,7 @@ test -z "$BZIP2" && BZIP2=bzip2
 # Extract the first word of "bzip2", so it can be a program name with args.
 set dummy bzip2; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:13836: checking for $ac_word" >&5
+echo "configure:14427: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_BZIP2'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -13920,7 +14511,7 @@ IFS="$cf_save_ifs"
 
 if test -n "$cf_path_prog" ; then
 	
-echo "(line 13924) testing defining path for ${cf_path_prog} ..." 1>&5
+echo "(line 14515) testing defining path for ${cf_path_prog} ..." 1>&5
 
 	cat >> confdefs.h <<EOF
 #define BZIP2_PATH "$cf_path_prog"
@@ -13940,7 +14531,7 @@ test -z "$COMPRESS" && COMPRESS=compress
 # Extract the first word of "compress", so it can be a program name with args.
 set dummy compress; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:13944: checking for $ac_word" >&5
+echo "configure:14535: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_COMPRESS'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -14028,7 +14619,7 @@ IFS="$cf_save_ifs"
 
 if test -n "$cf_path_prog" ; then
 	
-echo "(line 14032) testing defining path for ${cf_path_prog} ..." 1>&5
+echo "(line 14623) testing defining path for ${cf_path_prog} ..." 1>&5
 
 	cat >> confdefs.h <<EOF
 #define COMPRESS_PATH "$cf_path_prog"
@@ -14045,7 +14636,7 @@ test -z "$RM" && RM=rm
 # Extract the first word of "rm", so it can be a program name with args.
 set dummy rm; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:14049: checking for $ac_word" >&5
+echo "configure:14640: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_RM'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -14133,7 +14724,7 @@ IFS="$cf_save_ifs"
 
 if test -n "$cf_path_prog" ; then
 	
-echo "(line 14137) testing defining path for ${cf_path_prog} ..." 1>&5
+echo "(line 14728) testing defining path for ${cf_path_prog} ..." 1>&5
 
 	cat >> confdefs.h <<EOF
 #define RM_PATH "$cf_path_prog"
@@ -14150,7 +14741,7 @@ test -z "$TAR" && TAR=tar
 # Extract the first word of "tar", so it can be a program name with args.
 set dummy tar; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:14154: checking for $ac_word" >&5
+echo "configure:14745: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_TAR'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -14238,7 +14829,7 @@ IFS="$cf_save_ifs"
 
 if test -n "$cf_path_prog" ; then
 	
-echo "(line 14242) testing defining path for ${cf_path_prog} ..." 1>&5
+echo "(line 14833) testing defining path for ${cf_path_prog} ..." 1>&5
 
 	cat >> confdefs.h <<EOF
 #define TAR_PATH "$cf_path_prog"
@@ -14255,7 +14846,7 @@ test -z "$UUDECODE" && UUDECODE=uudecode
 # Extract the first word of "uudecode", so it can be a program name with args.
 set dummy uudecode; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:14259: checking for $ac_word" >&5
+echo "configure:14850: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_UUDECODE'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -14343,7 +14934,7 @@ IFS="$cf_save_ifs"
 
 if test -n "$cf_path_prog" ; then
 	
-echo "(line 14347) testing defining path for ${cf_path_prog} ..." 1>&5
+echo "(line 14938) testing defining path for ${cf_path_prog} ..." 1>&5
 
 	cat >> confdefs.h <<EOF
 #define UUDECODE_PATH "$cf_path_prog"
@@ -14360,7 +14951,7 @@ test -z "$ZCAT" && ZCAT=zcat
 # Extract the first word of "zcat", so it can be a program name with args.
 set dummy zcat; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:14364: checking for $ac_word" >&5
+echo "configure:14955: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_ZCAT'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -14448,7 +15039,7 @@ IFS="$cf_save_ifs"
 
 if test -n "$cf_path_prog" ; then
 	
-echo "(line 14452) testing defining path for ${cf_path_prog} ..." 1>&5
+echo "(line 15043) testing defining path for ${cf_path_prog} ..." 1>&5
 
 	cat >> confdefs.h <<EOF
 #define ZCAT_PATH "$cf_path_prog"
@@ -14465,7 +15056,7 @@ test -z "$ZIP" && ZIP=zip
 # Extract the first word of "zip", so it can be a program name with args.
 set dummy zip; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:14469: checking for $ac_word" >&5
+echo "configure:15060: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_ZIP'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -14553,7 +15144,7 @@ IFS="$cf_save_ifs"
 
 if test -n "$cf_path_prog" ; then
 	
-echo "(line 14557) testing defining path for ${cf_path_prog} ..." 1>&5
+echo "(line 15148) testing defining path for ${cf_path_prog} ..." 1>&5
 
 	cat >> confdefs.h <<EOF
 #define ZIP_PATH "$cf_path_prog"
@@ -14581,7 +15172,7 @@ test -z "$INSTALL" && INSTALL=install
 # Extract the first word of "install", so it can be a program name with args.
 set dummy install; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:14585: checking for $ac_word" >&5
+echo "configure:15176: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_INSTALL'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -14669,7 +15260,7 @@ IFS="$cf_save_ifs"
 
 if test -n "$cf_path_prog" ; then
 	
-echo "(line 14673) testing defining path for ${cf_path_prog} ..." 1>&5
+echo "(line 15264) testing defining path for ${cf_path_prog} ..." 1>&5
 
 	cat >> confdefs.h <<EOF
 #define INSTALL_PATH "$cf_path_prog"
@@ -14702,7 +15293,7 @@ if test $cf_cv_screen = pdcurses ; then
 # Uses ac_ vars as temps to allow command line to override cache and checks.
 # --without-x overrides everything else, but does not touch the cache.
 echo $ac_n "checking for X""... $ac_c" 1>&6
-echo "configure:14706: checking for X" >&5
+echo "configure:15297: checking for X" >&5
 
 
 # Check whether --with-x or --without-x was given.
@@ -14765,12 +15356,12 @@ if test "$ac_x_includes" = NO; then
 
   # First, try using that file with no special directory specified.
 cat > conftest.$ac_ext <<EOF
-#line 14769 "configure"
+#line 15360 "configure"
 #include "confdefs.h"
 #include <$x_direct_test_include>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:14774: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:15365: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -14839,14 +15430,14 @@ if test "$ac_x_libraries" = NO; then
   ac_save_LIBS="$LIBS"
   LIBS="-l$x_direct_test_library $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 14843 "configure"
+#line 15434 "configure"
 #include "confdefs.h"
 
 int main() {
 ${x_direct_test_function}()
 ; return 0; }
 EOF
-if { (eval echo configure:14850: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:15441: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   LIBS="$ac_save_LIBS"
 # We can link X programs with no special library path.
@@ -14946,7 +15537,7 @@ clix*)
 	# FIXME: modify the library lookup in autoconf to
 	# allow _s.a suffix ahead of .a
 	echo $ac_n "checking for open in -lc_s""... $ac_c" 1>&6
-echo "configure:14950: checking for open in -lc_s" >&5
+echo "configure:15541: checking for open in -lc_s" >&5
 ac_lib_var=`echo c_s'_'open | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -14954,7 +15545,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lc_s  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 14958 "configure"
+#line 15549 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -14965,7 +15556,7 @@ int main() {
 open()
 ; return 0; }
 EOF
-if { (eval echo configure:14969: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:15560: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -14982,7 +15573,7 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
   echo "$ac_t""yes" 1>&6
   LIBS="-lc_s $LIBS"
 	echo $ac_n "checking for gethostname in -lbsd""... $ac_c" 1>&6
-echo "configure:14986: checking for gethostname in -lbsd" >&5
+echo "configure:15577: checking for gethostname in -lbsd" >&5
 ac_lib_var=`echo bsd'_'gethostname | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -14990,7 +15581,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lbsd  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 14994 "configure"
+#line 15585 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -15001,7 +15592,7 @@ int main() {
 gethostname()
 ; return 0; }
 EOF
-if { (eval echo configure:15005: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:15596: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -15018,7 +15609,7 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
   echo "$ac_t""yes" 1>&6
   LIBS="-lbsd $LIBS"
 	echo $ac_n "checking for gethostname in -lnsl_s""... $ac_c" 1>&6
-echo "configure:15022: checking for gethostname in -lnsl_s" >&5
+echo "configure:15613: checking for gethostname in -lnsl_s" >&5
 ac_lib_var=`echo nsl_s'_'gethostname | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -15026,7 +15617,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lnsl_s  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 15030 "configure"
+#line 15621 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -15037,7 +15628,7 @@ int main() {
 gethostname()
 ; return 0; }
 EOF
-if { (eval echo configure:15041: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:15632: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -15054,7 +15645,7 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
   echo "$ac_t""yes" 1>&6
   LIBS="-lnsl_s $LIBS"
 	echo $ac_n "checking for XOpenDisplay in -lX11_s""... $ac_c" 1>&6
-echo "configure:15058: checking for XOpenDisplay in -lX11_s" >&5
+echo "configure:15649: checking for XOpenDisplay in -lX11_s" >&5
 ac_lib_var=`echo X11_s'_'XOpenDisplay | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -15062,7 +15653,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lX11_s  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 15066 "configure"
+#line 15657 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -15073,7 +15664,7 @@ int main() {
 XOpenDisplay()
 ; return 0; }
 EOF
-if { (eval echo configure:15077: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:15668: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -15090,7 +15681,7 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
   echo "$ac_t""yes" 1>&6
   LIBS="-lX11_s $LIBS"
 	echo $ac_n "checking for XtAppInitialize in -lXt_s""... $ac_c" 1>&6
-echo "configure:15094: checking for XtAppInitialize in -lXt_s" >&5
+echo "configure:15685: checking for XtAppInitialize in -lXt_s" >&5
 ac_lib_var=`echo Xt_s'_'XtAppInitialize | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -15098,7 +15689,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lXt_s  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 15102 "configure"
+#line 15693 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -15109,7 +15700,7 @@ int main() {
 XtAppInitialize()
 ; return 0; }
 EOF
-if { (eval echo configure:15113: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:15704: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -15150,7 +15741,7 @@ fi
 	;;
 *)
 	echo $ac_n "checking for socket in -lsocket""... $ac_c" 1>&6
-echo "configure:15154: checking for socket in -lsocket" >&5
+echo "configure:15745: checking for socket in -lsocket" >&5
 ac_lib_var=`echo socket'_'socket | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -15158,7 +15749,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lsocket  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 15162 "configure"
+#line 15753 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -15169,7 +15760,7 @@ int main() {
 socket()
 ; return 0; }
 EOF
-if { (eval echo configure:15173: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:15764: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -15197,7 +15788,7 @@ else
 fi
 
 	echo $ac_n "checking for gethostname in -lnsl""... $ac_c" 1>&6
-echo "configure:15201: checking for gethostname in -lnsl" >&5
+echo "configure:15792: checking for gethostname in -lnsl" >&5
 ac_lib_var=`echo nsl'_'gethostname | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -15205,7 +15796,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lnsl  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 15209 "configure"
+#line 15800 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -15216,7 +15807,7 @@ int main() {
 gethostname()
 ; return 0; }
 EOF
-if { (eval echo configure:15220: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:15811: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -15267,17 +15858,17 @@ else
     case "`(uname -sr) 2>/dev/null`" in
     "SunOS 5"*)
       echo $ac_n "checking whether -R must be followed by a space""... $ac_c" 1>&6
-echo "configure:15271: checking whether -R must be followed by a space" >&5
+echo "configure:15862: checking whether -R must be followed by a space" >&5
       ac_xsave_LIBS="$LIBS"; LIBS="$LIBS -R$x_libraries"
       cat > conftest.$ac_ext <<EOF
-#line 15274 "configure"
+#line 15865 "configure"
 #include "confdefs.h"
 
 int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:15281: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:15872: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ac_R_nospace=yes
 else
@@ -15293,14 +15884,14 @@ rm -f conftest*
       else
 	LIBS="$ac_xsave_LIBS -R $x_libraries"
 	cat > conftest.$ac_ext <<EOF
-#line 15297 "configure"
+#line 15888 "configure"
 #include "confdefs.h"
 
 int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:15304: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:15895: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ac_R_space=yes
 else
@@ -15332,7 +15923,7 @@ rm -f conftest*
     # libraries were built with DECnet support.  And karl@cs.umb.edu says
     # the Alpha needs dnet_stub (dnet does not exist).
     echo $ac_n "checking for dnet_ntoa in -ldnet""... $ac_c" 1>&6
-echo "configure:15336: checking for dnet_ntoa in -ldnet" >&5
+echo "configure:15927: checking for dnet_ntoa in -ldnet" >&5
 ac_lib_var=`echo dnet'_'dnet_ntoa | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -15340,7 +15931,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-ldnet  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 15344 "configure"
+#line 15935 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -15351,7 +15942,7 @@ int main() {
 dnet_ntoa()
 ; return 0; }
 EOF
-if { (eval echo configure:15355: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:15946: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -15373,7 +15964,7 @@ fi
 
     if test $ac_cv_lib_dnet_dnet_ntoa = no; then
       echo $ac_n "checking for dnet_ntoa in -ldnet_stub""... $ac_c" 1>&6
-echo "configure:15377: checking for dnet_ntoa in -ldnet_stub" >&5
+echo "configure:15968: checking for dnet_ntoa in -ldnet_stub" >&5
 ac_lib_var=`echo dnet_stub'_'dnet_ntoa | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -15381,7 +15972,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-ldnet_stub  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 15385 "configure"
+#line 15976 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -15392,7 +15983,7 @@ int main() {
 dnet_ntoa()
 ; return 0; }
 EOF
-if { (eval echo configure:15396: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:15987: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -15421,12 +16012,12 @@ fi
     # The nsl library prevents programs from opening the X display
     # on Irix 5.2, according to dickey@clark.net.
     echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6
-echo "configure:15425: checking for gethostbyname" >&5
+echo "configure:16016: checking for gethostbyname" >&5
 if eval "test \"`echo '$''{'ac_cv_func_gethostbyname'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 15430 "configure"
+#line 16021 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char gethostbyname(); below.  */
@@ -15449,7 +16040,7 @@ gethostbyname();
 
 ; return 0; }
 EOF
-if { (eval echo configure:15453: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:16044: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_gethostbyname=yes"
 else
@@ -15470,7 +16061,7 @@ fi
 
     if test $ac_cv_func_gethostbyname = no; then
       echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6
-echo "configure:15474: checking for gethostbyname in -lnsl" >&5
+echo "configure:16065: checking for gethostbyname in -lnsl" >&5
 ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -15478,7 +16069,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lnsl  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 15482 "configure"
+#line 16073 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -15489,7 +16080,7 @@ int main() {
 gethostbyname()
 ; return 0; }
 EOF
-if { (eval echo configure:15493: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:16084: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -15519,12 +16110,12 @@ fi
     # -lsocket must be given before -lnsl if both are needed.
     # We assume that if connect needs -lnsl, so does gethostbyname.
     echo $ac_n "checking for connect""... $ac_c" 1>&6
-echo "configure:15523: checking for connect" >&5
+echo "configure:16114: checking for connect" >&5
 if eval "test \"`echo '$''{'ac_cv_func_connect'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 15528 "configure"
+#line 16119 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char connect(); below.  */
@@ -15547,7 +16138,7 @@ connect();
 
 ; return 0; }
 EOF
-if { (eval echo configure:15551: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:16142: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_connect=yes"
 else
@@ -15568,7 +16159,7 @@ fi
 
     if test $ac_cv_func_connect = no; then
       echo $ac_n "checking for connect in -lsocket""... $ac_c" 1>&6
-echo "configure:15572: checking for connect in -lsocket" >&5
+echo "configure:16163: checking for connect in -lsocket" >&5
 ac_lib_var=`echo socket'_'connect | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -15576,7 +16167,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lsocket $X_EXTRA_LIBS $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 15580 "configure"
+#line 16171 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -15587,7 +16178,7 @@ int main() {
 connect()
 ; return 0; }
 EOF
-if { (eval echo configure:15591: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:16182: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -15611,12 +16202,12 @@ fi
 
     # gomez@mi.uni-erlangen.de says -lposix is necessary on A/UX.
     echo $ac_n "checking for remove""... $ac_c" 1>&6
-echo "configure:15615: checking for remove" >&5
+echo "configure:16206: checking for remove" >&5
 if eval "test \"`echo '$''{'ac_cv_func_remove'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 15620 "configure"
+#line 16211 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char remove(); below.  */
@@ -15639,7 +16230,7 @@ remove();
 
 ; return 0; }
 EOF
-if { (eval echo configure:15643: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:16234: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_remove=yes"
 else
@@ -15660,7 +16251,7 @@ fi
 
     if test $ac_cv_func_remove = no; then
       echo $ac_n "checking for remove in -lposix""... $ac_c" 1>&6
-echo "configure:15664: checking for remove in -lposix" >&5
+echo "configure:16255: checking for remove in -lposix" >&5
 ac_lib_var=`echo posix'_'remove | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -15668,7 +16259,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lposix  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 15672 "configure"
+#line 16263 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -15679,7 +16270,7 @@ int main() {
 remove()
 ; return 0; }
 EOF
-if { (eval echo configure:15683: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:16274: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -15703,12 +16294,12 @@ fi
 
     # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay.
     echo $ac_n "checking for shmat""... $ac_c" 1>&6
-echo "configure:15707: checking for shmat" >&5
+echo "configure:16298: checking for shmat" >&5
 if eval "test \"`echo '$''{'ac_cv_func_shmat'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 15712 "configure"
+#line 16303 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char shmat(); below.  */
@@ -15731,7 +16322,7 @@ shmat();
 
 ; return 0; }
 EOF
-if { (eval echo configure:15735: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:16326: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_shmat=yes"
 else
@@ -15752,7 +16343,7 @@ fi
 
     if test $ac_cv_func_shmat = no; then
       echo $ac_n "checking for shmat in -lipc""... $ac_c" 1>&6
-echo "configure:15756: checking for shmat in -lipc" >&5
+echo "configure:16347: checking for shmat in -lipc" >&5
 ac_lib_var=`echo ipc'_'shmat | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -15760,7 +16351,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lipc  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 15764 "configure"
+#line 16355 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -15771,7 +16362,7 @@ int main() {
 shmat()
 ; return 0; }
 EOF
-if { (eval echo configure:15775: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:16366: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -15804,7 +16395,7 @@ fi
   # libraries we check for below, so use a different variable.
   #  --interran@uluru.Stanford.EDU, kb@cs.umb.edu.
   echo $ac_n "checking for IceConnectionNumber in -lICE""... $ac_c" 1>&6
-echo "configure:15808: checking for IceConnectionNumber in -lICE" >&5
+echo "configure:16399: checking for IceConnectionNumber in -lICE" >&5
 ac_lib_var=`echo ICE'_'IceConnectionNumber | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -15812,7 +16403,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lICE $X_EXTRA_LIBS $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 15816 "configure"
+#line 16407 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -15823,7 +16414,7 @@ int main() {
 IceConnectionNumber()
 ; return 0; }
 EOF
-if { (eval echo configure:15827: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:16418: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -15889,14 +16480,14 @@ fi
 
 if test "$cf_check_cflags" != "$CFLAGS" ; then
 cat > conftest.$ac_ext <<EOF
-#line 15893 "configure"
+#line 16484 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 int main() {
 printf("Hello world");
 ; return 0; }
 EOF
-if { (eval echo configure:15900: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:16491: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   :
 else
   echo "configure: failed program was:" >&5
@@ -15914,7 +16505,7 @@ rm -f conftest*
 fi
 
 	echo $ac_n "checking for XOpenDisplay in -lX11""... $ac_c" 1>&6
-echo "configure:15918: checking for XOpenDisplay in -lX11" >&5
+echo "configure:16509: checking for XOpenDisplay in -lX11" >&5
 ac_lib_var=`echo X11'_'XOpenDisplay | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -15922,7 +16513,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lX11 $X_PRE_LIBS $LIBS $X_EXTRA_LIBS $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 15926 "configure"
+#line 16517 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -15933,7 +16524,7 @@ int main() {
 XOpenDisplay()
 ; return 0; }
 EOF
-if { (eval echo configure:15937: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:16528: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -15954,7 +16545,7 @@ else
 fi
 
 	echo $ac_n "checking for XtAppInitialize in -lXt""... $ac_c" 1>&6
-echo "configure:15958: checking for XtAppInitialize in -lXt" >&5
+echo "configure:16549: checking for XtAppInitialize in -lXt" >&5
 ac_lib_var=`echo Xt'_'XtAppInitialize | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -15962,7 +16553,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lXt $X_PRE_LIBS $LIBS $X_EXTRA_LIBS $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 15966 "configure"
+#line 16557 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -15973,7 +16564,7 @@ int main() {
 XtAppInitialize()
 ; return 0; }
 EOF
-if { (eval echo configure:15977: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:16568: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -16041,14 +16632,14 @@ fi
 
 if test "$cf_check_cflags" != "$CFLAGS" ; then
 cat > conftest.$ac_ext <<EOF
-#line 16045 "configure"
+#line 16636 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 int main() {
 printf("Hello world");
 ; return 0; }
 EOF
-if { (eval echo configure:16052: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:16643: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   :
 else
   echo "configure: failed program was:" >&5
@@ -16094,7 +16685,7 @@ fi
 
 
 echo $ac_n "checking for XextCreateExtension in -lXext""... $ac_c" 1>&6
-echo "configure:16098: checking for XextCreateExtension in -lXext" >&5
+echo "configure:16689: checking for XextCreateExtension in -lXext" >&5
 ac_lib_var=`echo Xext'_'XextCreateExtension | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -16102,7 +16693,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lXext  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 16106 "configure"
+#line 16697 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -16113,7 +16704,7 @@ int main() {
 XextCreateExtension()
 ; return 0; }
 EOF
-if { (eval echo configure:16117: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:16708: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -16134,29 +16725,31 @@ else
 fi
 
 
-cf_x_athena_include=""
 cf_x_athena_lib=""
 
+
+cf_x_athena_root=$cf_x_athena
+cf_x_athena_include=""
+
 for cf_path in default \
 	/usr/contrib/X11R6 \
 	/usr/contrib/X11R5 \
 	/usr/lib/X11R5 \
 	/usr/local
 do
-
 	if test -z "$cf_x_athena_include" ; then
 		cf_save="$CPPFLAGS"
-		cf_test=X11/$cf_x_athena/SimpleMenu.h
+		cf_test=X11/$cf_x_athena_root/SimpleMenu.h
 		if test $cf_path != default ; then
 			CPPFLAGS="-I$cf_path/include $cf_save"
 			echo $ac_n "checking for $cf_test in $cf_path""... $ac_c" 1>&6
-echo "configure:16154: checking for $cf_test in $cf_path" >&5
+echo "configure:16747: checking for $cf_test in $cf_path" >&5
 		else
 			echo $ac_n "checking for $cf_test""... $ac_c" 1>&6
-echo "configure:16157: checking for $cf_test" >&5
+echo "configure:16750: checking for $cf_test" >&5
 		fi
 		cat > conftest.$ac_ext <<EOF
-#line 16160 "configure"
+#line 16753 "configure"
 #include "confdefs.h"
 
 #include <X11/Intrinsic.h>
@@ -16165,7 +16758,7 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:16169: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:16762: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cf_result=yes
 else
@@ -16178,12 +16771,33 @@ rm -f conftest*
 		echo "$ac_t""$cf_result" 1>&6
 		if test "$cf_result" = yes ; then
 			cf_x_athena_include=$cf_path
+			break
 		else
 			CPPFLAGS="$cf_save"
 		fi
 	fi
+done
+
+if test -z "$cf_x_athena_include" ; then
+	echo "configure: warning: Unable to successfully find Athena header files with test program" 1>&2
+elif test "$cf_x_athena_include" != default ; then
+	CPPFLAGS="$CPPFLAGS -I$cf_x_athena_include"
+fi
+
 
-	for cf_lib in "-l$cf_x_athena -lXmu" "-l${cf_x_athena}_s -lXmu_s"
+cf_x_athena_root=$cf_x_athena
+cf_x_athena_lib=""
+
+for cf_path in default \
+	/usr/contrib/X11R6 \
+	/usr/contrib/X11R5 \
+	/usr/lib/X11R5 \
+	/usr/local
+do
+	for cf_lib in \
+		"-l$cf_x_athena_root -lXmu" \
+		"-l$cf_x_athena_root -lXpm -lXmu" \
+		"-l${cf_x_athena_root}_s -lXmu_s"
 	do
 		if test -z "$cf_x_athena_lib" ; then
 			cf_save="$LIBS"
@@ -16191,21 +16805,21 @@ rm -f conftest*
 			if test $cf_path != default ; then
 				LIBS="-L$cf_path/lib $cf_lib $LIBS"
 				echo $ac_n "checking for $cf_lib in $cf_path""... $ac_c" 1>&6
-echo "configure:16195: checking for $cf_lib in $cf_path" >&5
+echo "configure:16809: checking for $cf_lib in $cf_path" >&5
 			else
 				LIBS="$cf_lib $LIBS"
 				echo $ac_n "checking for $cf_test in $cf_lib""... $ac_c" 1>&6
-echo "configure:16199: checking for $cf_test in $cf_lib" >&5
+echo "configure:16813: checking for $cf_test in $cf_lib" >&5
 			fi
 			cat > conftest.$ac_ext <<EOF
-#line 16202 "configure"
+#line 16816 "configure"
 #include "confdefs.h"
 
 int main() {
 $cf_test()
 ; return 0; }
 EOF
-if { (eval echo configure:16209: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:16823: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   cf_result=yes
 else
@@ -16218,6 +16832,7 @@ rm -f conftest*
 			echo "$ac_t""$cf_result" 1>&6
 			if test "$cf_result" = yes ; then
 				cf_x_athena_lib="$cf_lib"
+				break
 			else
 				LIBS="$cf_save"
 			fi
@@ -16225,24 +16840,21 @@ rm -f conftest*
 	done
 done
 
-if test -z "$cf_x_athena_include" ; then
-	echo "configure: warning: Unable to successfully find Athena header files with test program" 1>&2
-fi
-
 if test -z "$cf_x_athena_lib" ; then
-	{ echo "configure: error: Unable to successfully link Athena library (-l$cf_x_athena) with test program" 1>&2; exit 1; }
+	{ echo "configure: error: Unable to successfully link Athena library (-l$cf_x_athena_root) with test program" 1>&2; exit 1; }
 fi
 
 
-CF_X_ATHENA_LIBS=`echo "HAVE_LIB_$cf_x_athena" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
+cf_x_athena_LIBS=`echo "HAVE_LIB_$cf_x_athena" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
 
 cat >> confdefs.h <<EOF
-#define $CF_X_ATHENA_LIBS 1
+#define $cf_x_athena_LIBS 1
 EOF
 
 
 
 
+
 LDFLAGS="$LDFLAGS $X_LIBS"
 
 test -n "$verbose" && echo "	checking additions to CFLAGS" 1>&6
@@ -16285,14 +16897,14 @@ fi
 
 if test "$cf_check_cflags" != "$CFLAGS" ; then
 cat > conftest.$ac_ext <<EOF
-#line 16289 "configure"
+#line 16901 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 int main() {
 printf("Hello world");
 ; return 0; }
 EOF
-if { (eval echo configure:16296: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:16908: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   :
 else
   echo "configure: failed program was:" >&5
@@ -16310,7 +16922,7 @@ rm -f conftest*
 fi
 
 echo $ac_n "checking for XOpenDisplay in -lX11""... $ac_c" 1>&6
-echo "configure:16314: checking for XOpenDisplay in -lX11" >&5
+echo "configure:16926: checking for XOpenDisplay in -lX11" >&5
 ac_lib_var=`echo X11'_'XOpenDisplay | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -16318,7 +16930,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lX11 $X_PRE_LIBS $LIBS $X_EXTRA_LIBS $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 16322 "configure"
+#line 16934 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -16329,7 +16941,7 @@ int main() {
 XOpenDisplay()
 ; return 0; }
 EOF
-if { (eval echo configure:16333: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:16945: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -16350,14 +16962,14 @@ else
 fi
 
 echo $ac_n "checking for XCurses library""... $ac_c" 1>&6
-echo "configure:16354: checking for XCurses library" >&5
+echo "configure:16966: checking for XCurses library" >&5
 if eval "test \"`echo '$''{'cf_cv_lib_XCurses'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
 LIBS="-lXCurses $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 16361 "configure"
+#line 16973 "configure"
 #include "confdefs.h"
 
 #include <xcurses.h>
@@ -16367,7 +16979,7 @@ int main() {
 XCursesExit();
 ; return 0; }
 EOF
-if { (eval echo configure:16371: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:16983: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   cf_cv_lib_XCurses=yes
 else
@@ -16401,7 +17013,7 @@ fi
 else
 	
 echo $ac_n "checking if we can include termio.h with curses""... $ac_c" 1>&6
-echo "configure:16405: checking if we can include termio.h with curses" >&5
+echo "configure:17017: checking if we can include termio.h with curses" >&5
 if eval "test \"`echo '$''{'cf_cv_termio_and_curses'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -16410,7 +17022,7 @@ else
     CPPFLAGS="$CPPFLAGS -DHAVE_CONFIG_H -I. -I${srcdir-.} -I${srcdir-.}/src -I${srcdir-.}/WWW/Library/Implementation"
     touch lynx_cfg.h
     cat > conftest.$ac_ext <<EOF
-#line 16414 "configure"
+#line 17026 "configure"
 #include "confdefs.h"
 
 #include <LYCurses.h>
@@ -16419,7 +17031,7 @@ int main() {
 putchar(0x0a)
 ; return 0; }
 EOF
-if { (eval echo configure:16423: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:17035: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cf_cv_termio_and_curses=yes
 else
@@ -16449,17 +17061,17 @@ if test $cf_cv_screen != slang ; then
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:16453: checking for $ac_hdr" >&5
+echo "configure:17065: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 16458 "configure"
+#line 17070 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:16463: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:17075: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -16487,7 +17099,7 @@ done
 
 	
 echo $ac_n "checking if curses supports alternate-character set""... $ac_c" 1>&6
-echo "configure:16491: checking if curses supports alternate-character set" >&5
+echo "configure:17103: checking if curses supports alternate-character set" >&5
 if eval "test \"`echo '$''{'cf_cv_alt_char_set'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -16495,7 +17107,7 @@ else
 for mapname in acs_map _acs_map
 do
 	cat > conftest.$ac_ext <<EOF
-#line 16499 "configure"
+#line 17111 "configure"
 #include "confdefs.h"
 
 #include <${cf_cv_ncurses_header-curses.h}>
@@ -16504,7 +17116,7 @@ int main() {
 chtype x = $mapname['l']; $mapname['m'] = 0
 ; return 0; }
 EOF
-if { (eval echo configure:16508: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:17120: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   cf_cv_alt_char_set=$mapname
 	 break
@@ -16527,13 +17139,13 @@ EOF
 
 	
 echo $ac_n "checking if curses supports fancy attributes""... $ac_c" 1>&6
-echo "configure:16531: checking if curses supports fancy attributes" >&5
+echo "configure:17143: checking if curses supports fancy attributes" >&5
 if eval "test \"`echo '$''{'cf_cv_fancy_curses'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
 	cat > conftest.$ac_ext <<EOF
-#line 16537 "configure"
+#line 17149 "configure"
 #include "confdefs.h"
 
 #include <${cf_cv_ncurses_header-curses.h}>
@@ -16546,7 +17158,7 @@ attrset(A_UNDERLINE|A_BOLD|A_REVERSE);
 	
 ; return 0; }
 EOF
-if { (eval echo configure:16550: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:17162: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   cf_cv_fancy_curses=yes
 else
@@ -16569,13 +17181,13 @@ EOF
 
 if test "$cf_cv_ncurses_version" != no ; then
 echo $ac_n "checking for obsolete/broken version of ncurses""... $ac_c" 1>&6
-echo "configure:16573: checking for obsolete/broken version of ncurses" >&5
+echo "configure:17185: checking for obsolete/broken version of ncurses" >&5
 if eval "test \"`echo '$''{'cf_cv_ncurses_broken'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
 cat > conftest.$ac_ext <<EOF
-#line 16579 "configure"
+#line 17191 "configure"
 #include "confdefs.h"
 
 #include <${cf_cv_ncurses_header-curses.h}>
@@ -16589,7 +17201,7 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:16593: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:17205: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cf_cv_ncurses_broken=no
 else
@@ -16614,13 +17226,13 @@ fi
 
 	
 echo $ac_n "checking if curses supports color attributes""... $ac_c" 1>&6
-echo "configure:16618: checking if curses supports color attributes" >&5
+echo "configure:17230: checking if curses supports color attributes" >&5
 if eval "test \"`echo '$''{'cf_cv_color_curses'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
 	cat > conftest.$ac_ext <<EOF
-#line 16624 "configure"
+#line 17236 "configure"
 #include "confdefs.h"
 
 #include <${cf_cv_ncurses_header-curses.h}>
@@ -16635,7 +17247,7 @@ chtype x = COLOR_BLUE;
 	
 ; return 0; }
 EOF
-if { (eval echo configure:16639: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:17251: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   cf_cv_color_curses=yes
 else
@@ -16669,17 +17281,17 @@ unistd.h \
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:16673: checking for $ac_hdr" >&5
+echo "configure:17285: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 16678 "configure"
+#line 17290 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:16683: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:17295: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -16710,17 +17322,17 @@ if test "$ISC" = yes ; then
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:16714: checking for $ac_hdr" >&5
+echo "configure:17326: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 16719 "configure"
+#line 17331 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:16724: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:17336: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -16755,16 +17367,16 @@ if test "$ac_cv_header_termios_h" = yes ; then
 	esac
 	if test "$termios_bad" = maybe ; then
 	echo $ac_n "checking whether termios.h needs _POSIX_SOURCE""... $ac_c" 1>&6
-echo "configure:16759: checking whether termios.h needs _POSIX_SOURCE" >&5
+echo "configure:17371: checking whether termios.h needs _POSIX_SOURCE" >&5
 	cat > conftest.$ac_ext <<EOF
-#line 16761 "configure"
+#line 17373 "configure"
 #include "confdefs.h"
 #include <termios.h>
 int main() {
 struct termios foo; int x = foo.c_iflag
 ; return 0; }
 EOF
-if { (eval echo configure:16768: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:17380: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   termios_bad=no
 else
@@ -16773,7 +17385,7 @@ else
   rm -rf conftest*
   
 		cat > conftest.$ac_ext <<EOF
-#line 16777 "configure"
+#line 17389 "configure"
 #include "confdefs.h"
 
 #define _POSIX_SOURCE
@@ -16782,7 +17394,7 @@ int main() {
 struct termios foo; int x = foo.c_iflag
 ; return 0; }
 EOF
-if { (eval echo configure:16786: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:17398: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   termios_bad=unknown
 else
@@ -16805,7 +17417,7 @@ fi
 
 
 echo $ac_n "checking declaration of size-change""... $ac_c" 1>&6
-echo "configure:16809: checking declaration of size-change" >&5
+echo "configure:17421: checking declaration of size-change" >&5
 if eval "test \"`echo '$''{'cf_cv_sizechange'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -16819,7 +17431,7 @@ do
     CPPFLAGS="$cf_save_CPPFLAGS"
     test -n "$cf_opts" && CPPFLAGS="$CPPFLAGS -D$cf_opts"
     cat > conftest.$ac_ext <<EOF
-#line 16823 "configure"
+#line 17435 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #ifdef HAVE_TERMIOS_H
@@ -16858,7 +17470,7 @@ int main() {
 	
 ; return 0; }
 EOF
-if { (eval echo configure:16862: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:17474: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cf_cv_sizechange=yes
 else
@@ -16897,20 +17509,20 @@ fi
 
 	
 echo $ac_n "checking if ttytype is declared in curses library""... $ac_c" 1>&6
-echo "configure:16901: checking if ttytype is declared in curses library" >&5
+echo "configure:17513: checking if ttytype is declared in curses library" >&5
 if eval "test \"`echo '$''{'cf_cv_have_ttytype'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
 	cat > conftest.$ac_ext <<EOF
-#line 16907 "configure"
+#line 17519 "configure"
 #include "confdefs.h"
 #include <${cf_cv_ncurses_header-curses.h}>
 int main() {
 char *x = &ttytype[1]; *x = 1
 ; return 0; }
 EOF
-if { (eval echo configure:16914: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:17526: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   cf_cv_have_ttytype=yes
 else
@@ -16931,13 +17543,13 @@ EOF
 
 	
 echo $ac_n "checking if curses supports wide characters""... $ac_c" 1>&6
-echo "configure:16935: checking if curses supports wide characters" >&5
+echo "configure:17547: checking if curses supports wide characters" >&5
 if eval "test \"`echo '$''{'cf_cv_widec_curses'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
 cat > conftest.$ac_ext <<EOF
-#line 16941 "configure"
+#line 17553 "configure"
 #include "confdefs.h"
 
 #include <stdlib.h>
@@ -16951,7 +17563,7 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:16955: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:17567: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   cf_cv_widec_curses=yes
 else
@@ -16974,13 +17586,13 @@ EOF
 
 	# This is needed on Tru64 5.0 to declare mbstate_t
 	echo $ac_n "checking if we must include wchar.h to declare mbstate_t""... $ac_c" 1>&6
-echo "configure:16978: checking if we must include wchar.h to declare mbstate_t" >&5
+echo "configure:17590: checking if we must include wchar.h to declare mbstate_t" >&5
 if eval "test \"`echo '$''{'cf_cv_widec_mbstate'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
 	cat > conftest.$ac_ext <<EOF
-#line 16984 "configure"
+#line 17596 "configure"
 #include "confdefs.h"
 
 #include <stdlib.h>
@@ -16989,7 +17601,7 @@ int main() {
 mbstate_t state
 ; return 0; }
 EOF
-if { (eval echo configure:16993: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:17605: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cf_cv_widec_mbstate=no
 else
@@ -16997,7 +17609,7 @@ else
   cat conftest.$ac_ext >&5
   rm -rf conftest*
   cat > conftest.$ac_ext <<EOF
-#line 17001 "configure"
+#line 17613 "configure"
 #include "confdefs.h"
 
 #include <stdlib.h>
@@ -17007,7 +17619,7 @@ int main() {
 mbstate_t state
 ; return 0; }
 EOF
-if { (eval echo configure:17011: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:17623: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cf_cv_widec_mbstate=yes
 else
@@ -17041,13 +17653,13 @@ fi
 
 	
 echo $ac_n "checking if we must define _XOPEN_SOURCE_EXTENDED""... $ac_c" 1>&6
-echo "configure:17045: checking if we must define _XOPEN_SOURCE_EXTENDED" >&5
+echo "configure:17657: checking if we must define _XOPEN_SOURCE_EXTENDED" >&5
 if eval "test \"`echo '$''{'cf_cv_need_xopen_extension'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
 cat > conftest.$ac_ext <<EOF
-#line 17051 "configure"
+#line 17663 "configure"
 #include "confdefs.h"
 
 #include <stdlib.h>
@@ -17057,7 +17669,7 @@ int main() {
 	long x = winnstr(stdscr, "", 0)
 ; return 0; }
 EOF
-if { (eval echo configure:17061: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:17673: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   cf_cv_need_xopen_extension=no
 else
@@ -17065,7 +17677,7 @@ else
   cat conftest.$ac_ext >&5
   rm -rf conftest*
   cat > conftest.$ac_ext <<EOF
-#line 17069 "configure"
+#line 17681 "configure"
 #include "confdefs.h"
 
 #define _XOPEN_SOURCE_EXTENDED
@@ -17076,14 +17688,14 @@ int main() {
 	long x = winnstr(stdscr, "", 0)
 ; return 0; }
 EOF
-if { (eval echo configure:17080: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:17692: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   cf_cv_need_xopen_extension=yes
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  cf_cv_need_xopen_extension=no
+  cf_cv_need_xopen_extension=unknown
 fi
 rm -f conftest*
 fi
@@ -17119,9 +17731,9 @@ do
 cf_tr_func=`echo "$cf_func" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
 
 	echo $ac_n "checking for ${cf_func}""... $ac_c" 1>&6
-echo "configure:17123: checking for ${cf_func}" >&5
+echo "configure:17735: checking for ${cf_func}" >&5
 	
-echo "(line 17125) testing ${cf_func} ..." 1>&5
+echo "(line 17737) testing ${cf_func} ..." 1>&5
 
 	if eval "test \"`echo '$''{'cf_cv_func_$cf_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -17130,7 +17742,7 @@ else
 		eval cf_result='$ac_cv_func_'$cf_func
 		if test ".$cf_result" != ".no"; then
 			cat > conftest.$ac_ext <<EOF
-#line 17134 "configure"
+#line 17746 "configure"
 #include "confdefs.h"
 
 #ifdef HAVE_XCURSES
@@ -17155,7 +17767,7 @@ exit(foo == 0);
 			
 ; return 0; }
 EOF
-if { (eval echo configure:17159: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:17771: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   cf_result=yes
 else
diff --git a/configure.in b/configure.in
index c9b07099..250a74b6 100644
--- a/configure.in
+++ b/configure.in
@@ -2,6 +2,19 @@ dnl Process this file with autoconf to produce a configure script.
 dnl written jan/1997
 dnl by T.E.Dickey <dickey@invisible-island.net>
 dnl and Jim Spath <jspath@mail.bcpl.lib.md.us>
+dnl
+dnl ask PRCS to plug-in the project-version for the configure-script.
+dnl $Format: AC_REVISION($ProjectVersion: 2.8.5dev.11 $\""$)
+AC_REVISION(none)
+
+# Save the original $CFLAGS so we can distinguish whether the user set those
+# in the environment, or whether autoconf added -O and -g options:
+ORIGINAL_CFLAGS="$CFLAGS"
+
+# For autoconf 2.13, make sure we have no cache file at the beginning of this
+# script.  That fixes problems with tests whose cached values change from one
+# run to the next, as well as with tests that are order-dependent.
+rm -f config.cache
 
 AC_PREREQ(2.13.20020210)
 AC_INIT(userdefs.h)
@@ -79,6 +92,9 @@ CF_ARG_ENABLE(find-leaks,
 AC_MSG_RESULT($with_leak_checks)
 test "$with_leak_checks" = "yes" && AC_DEFINE(LY_FIND_LEAKS)
 
+# The comment about adding -g to $CFLAGS is unclear.  Autoconf tries to add
+# a -g flag; we remove it if the user's $CFLAGS was not set and debugging is
+# disabled.
 AC_MSG_CHECKING(if you want to enable debug-code)
 CF_ARG_ENABLE(debug,
 	[  --enable-debug          compile w/ debugging (if \$CFLAGS is set, add -g there, too)],
@@ -88,7 +104,7 @@ AC_MSG_RESULT($with_debug)
 if test "$with_debug" = "yes" ; then
 	case $host_os in
 	ultrix*|osf*)
-		CF_STRIP_O_OPT(CFLAGS)
+		test -z "$ORIGINAL_CFLAGS" && CF_STRIP_O_OPT(CFLAGS)
 		if test -z "$GCC" ; then
 			CFLAGS="$CFLAGS -g3"
 		fi
@@ -98,10 +114,10 @@ else
 	case $host_os in
 	osf*) #(vi
 		test -z "$GCC" && CFLAGS="$CFLAGS -std1"
-		CF_STRIP_G_OPT(CFLAGS)
+		test -z "$ORIGINAL_CFLAGS" && CF_STRIP_G_OPT(CFLAGS)
 		;;
 	*)
-		CF_STRIP_G_OPT(CFLAGS)
+		test -z "$ORIGINAL_CFLAGS" && CF_STRIP_G_OPT(CFLAGS)
 		;;
 	esac
 fi
@@ -299,7 +315,7 @@ CF_HELP_MESSAGE(
 Basic Configuration Options:)
 
 dnl internationalization macros
-CF_BUNDLED_INTL(makefile)
+CF_BUNDLED_INTL(makefile,disable)
 
 INTLDIR_CPPFLAGS="#"
 if test -z "$INTLDIR_MAKE" ; then
@@ -394,16 +410,9 @@ esac],
 	[cf_cv_screen=curses])])
 
 case $cf_cv_screen in
-ncurses|ncursesw|slang)
-	;;
-pdcurses)
-	cf_cv_ncurses_header=xcurses.h
+curses|ncurses*)
+	CF_WITH_CURSES_DIR
 	;;
-#curses)
-#	if eval "test \"`echo '$''{'cf_cv_ncurses_header'+set}'`\" != set"; then
-#		cf_cv_ncurses_header=curses.h
-#	fi
-#	;;
 esac
 
 case $cf_cv_screen in
@@ -426,6 +435,7 @@ ncursesw)
 	CF_NCURSES_VERSION
 	;;
 pdcurses)
+	cf_cv_ncurses_header=xcurses.h
 	# do this last, since it changes definition of main: CF_PDCURSES_X11
 	;;
 slang)
@@ -536,6 +546,7 @@ dnl --------------------------------------------------------------------------
 dnl Checks for library units
 dnl --------------------------------------------------------------------------
 
+AC_FUNC_ALLOCA
 AC_FUNC_VFORK
 CF_FIONBIO
 CF_REMOVE_BROKEN
diff --git a/lynx.cfg b/lynx.cfg
index f1c23ea2..d2769985 100644
--- a/lynx.cfg
+++ b/lynx.cfg
@@ -3,10 +3,10 @@
 #                                     or Lynx_Dir:lynx.cfg (VMS)
 #
 # $Format: "#PRCS LYNX_VERSION \"$ProjectVersion$\""$
-#PRCS LYNX_VERSION "2.8.5dev.9"
+#PRCS LYNX_VERSION "2.8.5dev.11"
 #
 # $Format: "#PRCS LYNX_DATE \"$ProjectDate$\""$
-#PRCS LYNX_DATE "Sun, 06 Oct 2002 17:43:28 -0700"
+#PRCS LYNX_DATE "Sun, 01 Dec 2002 18:19:26 -0800"
 #
 # Definition pairs are of the form  VARIABLE:DEFINITION
 # NO spaces are allowed between the pair items.
@@ -561,7 +561,7 @@ DEFAULT_INDEX_FILE:http://www.ncsa.uiuc.edu/SDG/Software/Mosaic/MetaIndex.html
 .h2 CHARSETS_DIRECTORY
 # CHARSETS_DIRECTORY specifies the directory with the fonts (glyph data)
 # used by Lynx to switch the display-font to a font best suited for the
-# given document.  The font should be in a format understood by the 
+# given document.  The font should be in a format understood by the
 # platforms TTY-display-font-switching API.  Currently supported on OS/2 only.
 #
 # Lynx expects the glyphs for the charset CHARSET with character cell
@@ -3245,3 +3245,28 @@ COLOR:6:brightred:black
 #ENABLE_LYNXRC:vi_keys:ON
 #ENABLE_LYNXRC:visited_links:ON
 .fi
+
+.h1 External Programs
+# Any of the compiled-in pathnames of external programs can be overridden
+# by specifying the corresponding xxx_PATH variable.  If the variable is
+# given as an empty string, lynx will not use the program.  For a few cases,
+# there are internal functions (such as mkdir) which can be used instead.
+#BZIP2_PATH:
+#CHMOD_PATH:
+#COMPRESS_PATH:
+#COPY_PATH:
+#GZIP_PATH:
+#INSTALL_PATH:
+#MKDIR_PATH:
+#MV_PATH:
+#RLOGIN_PATH:
+#RM_PATH:
+#TAR_PATH:
+#TELNET_PATH:
+#TN3270_PATH:
+#TOUCH_PATH:
+#UNCOMPRESS_PATH:
+#UNZIP_PATH:
+#UUDECODE_PATH:
+#ZCAT_PATH:
+#ZIP_PATH:
diff --git a/makefile.in b/makefile.in
index 53ed4bde..e3e380bd 100644
--- a/makefile.in
+++ b/makefile.in
@@ -387,8 +387,7 @@ cfg_defs.h : $(srcdir)/cfg_defs.sh $(srcdir)/cfg_edit.sh config.cache lynx_cfg.h
 	$(SHELL) -c '$(srcdir)/cfg_defs.sh $(srcdir)'
 
 install-cfg : $(LIBDIR)
-	-mv -f $(LIBDIR)/lynx.cfg $(LIBDIR)/lynx.oldcfg
-	$(INSTALL_DATA) $(srcdir)/lynx.cfg $(LIBDIR)/lynx.cfg
+	@$(SHELL) -c '$(srcdir)/scripts/install-cfg.sh "$(INSTALL_DATA)" $(srcdir)/lynx.cfg $(LIBDIR)/lynx.cfg'
 
 install-lss : $(LIBDIR)
 	-mv -f $(LIBDIR)/lynx.lss $(LIBDIR)/lynx.oldlss
diff --git a/samples/mailcap b/samples/mailcap
index 9dd36ccf..8f473381 100644
--- a/samples/mailcap
+++ b/samples/mailcap
@@ -26,8 +26,8 @@
 #        configuration file for Lynx
 
 # In the samples given   test=test -n "$DISPLAY"   is used to
-# determine if the current session is X capible by checking
-# for the existance of a DISPLAY environment variable.
+# determine if the current session is X capable by checking
+# for the existence of a DISPLAY environment variable.
 # Lynx actually uses a getenv() call for DISPLAY (DECW$DISPLAY
 # on VMS) when it encounters   test=test -n "$DISPLAY"  or
 # test=test -z "$DISPLAY"  in a viewer assignment, instead of
diff --git a/samples/mailto-form.pl b/samples/mailto-form.pl
index 41174d93..5afffc86 100755
--- a/samples/mailto-form.pl
+++ b/samples/mailto-form.pl
@@ -105,7 +105,7 @@ $|=1;
 ##    s/^./\U$1/;
 ##}
 
-# If there are mutiple occurrences of the same thing, how to join them
+# If there are multiple occurrences of the same thing, how to join them
 # into one string
 %joiner = (from => ', ',
 	   to => ', ',
diff --git a/scripts/install-cfg.sh b/scripts/install-cfg.sh
new file mode 100755
index 00000000..a3734a00
--- /dev/null
+++ b/scripts/install-cfg.sh
@@ -0,0 +1,72 @@
+#!/bin/sh
+# install lynx.cfg, ensuring the old config-file is saved to a unique file,
+# and prepending customizations to the newly-installed file.
+#
+# $1 = install program
+# $2 = file to install
+# $3 = where to install it
+PRG="$1"
+SRC=$2
+DST=$3
+
+if test -f "$DST" ; then
+	echo "** checking if you have customized $DST"
+	OLD=lynx-cfg.old
+	NEW=lynx-cfg.new
+	TST=lynx-cfg.tst
+	TMP=lynx-cfg.tmp
+	trap "rm -f $OLD $NEW $TST $TMP; exit 9" 1 2 5 15
+	rm -f $OLD $NEW $TST $TMP
+
+	# Make a list of the settings which are in the original lynx.cfg
+	# Do not keep the user's HELPFILE setting since we modify that in
+	# a different makefile rule.
+	egrep '^[ 	]*[A-Za-z]' $SRC |sed -e 's/^[ 	]*HELPFILE:.*/HELPFILE:/' >$TMP
+	egrep '^[ 	]*[A-Za-z]' $SRC |fgrep -v -f $TMP >$OLD
+	egrep '^[ 	]*[A-Za-z]' $DST |fgrep -v -f $TMP >$TST
+
+	if test -s $TST ; then
+		cat >$TMP <<EOF
+## The following lines were saved from your previous configuration.
+
+EOF
+		cat $TST >>$TMP
+		cat $SRC >$NEW
+		cat $TMP >>$NEW
+
+		# See if we have saved this information before (ignoring the
+		# HELPFILE line).
+		if cmp -s $NEW $OLD
+		then
+			echo "... installed $DST would not be changed"
+		else
+			NUM=1
+			while test -f ${DST}-${NUM}
+			do
+				if cmp -s $NEW ${DST}-${NUM}
+				then
+					break
+				fi
+				NUM=`expr $NUM + 1`
+			done
+			if test ! -f ${DST}-${NUM}
+			then
+				echo "... saving old config as ${DST}-${NUM}"
+				mv $DST ${DST}-${NUM} || exit 1
+			fi
+			echo "** installing $NEW as $DST"
+			eval $PRG $NEW $DST || exit 1
+		fi
+	else
+		echo "... no customizations found"
+		echo "** installing $SRC as $DST"
+		eval $PRG $SRC $DST || exit 1
+	fi
+	rm -f $SKIP $OLD $NEW $TST $TMP
+elif cmp -s $SRC $DST
+then
+	echo "... installed $DST would not be changed"
+else
+	echo "** installing $SRC as $DST"
+	eval $PRG $SRC $DST || exit 1
+fi
diff --git a/src/GridText.c b/src/GridText.c
index a76c7faa..54bd8ebd 100644
--- a/src/GridText.c
+++ b/src/GridText.c
@@ -104,8 +104,6 @@ struct _HTStream {			/* only know it as object */
 #define UTF8_XNEGLEN(c) (c&0xC0? 0 :c&32? 1 :c&16? 2 :c&8? 3 :c&4? 4 :c&2? 5:0)
 #define UTF_XLEN(c) UTF8_XNEGLEN(((char)~(c)))
 
-extern BOOL HTPassHighCtrlRaw;
-
 #ifdef KANJI_CODE_OVERRIDE
 PUBLIC HTkcode last_kcode = NOKANJI;	/* 1997/11/14 (Fri) 09:09:26 */
 #endif
@@ -151,8 +149,9 @@ PUBLIC int LYsb_begin = -1;
 PUBLIC int LYsb_end = -1;
 #endif
 
-#if defined(USE_COLOR_STYLE)
-#define MAX_STYLES_ON_LINE 64
+#ifndef CHAR_BIT
+#define CHAR_BIT 8
+#endif
 
     /*try to fit in 2 shorts*/
 typedef struct {
@@ -161,49 +160,39 @@ typedef struct {
 	    /* horizontal position of this change */
 	unsigned short	style;		/* which style to change to */
 } HTStyleChange;
-#endif
 
-typedef struct _line {
-	struct _line	*next;
-	struct _line	*prev;
-	unsigned	offset;		/* Implicit initial spaces */
-	unsigned	size;		/* Number of characters */
 #if defined(USE_COLOR_STYLE)
-	HTStyleChange* styles;
-	int	numstyles;
+#define MAX_STYLES_ON_LINE   64
+  /* buffers used when current line is being aggregated, in split_line() */
+static HTStyleChange stylechanges_buffers[2][MAX_STYLES_ON_LINE];
 #endif
-	char	data[1];		/* Space for terminator at least! */
-} HTLine;
 
-#if defined(USE_COLOR_STYLE)
-typedef struct _HTStyleChangePool {
-	HTStyleChange	data[4092];
-	struct _HTStyleChangePool* next;
-	int free_items;
-} HTStyleChangePool;
-
-/*these are used when current line is being aggregated. */
-HTStyleChange stylechanges_buffers[2][MAX_STYLES_ON_LINE];
-int stylechanges_buffers_free;/*this is an index of the free buffer.
-    Can be 0 or 1*/
-
-/* These are generic macros for any pools (provided those structures have the
-same members as HTStyleChangePool).  Pools are used for allocation of groups of
+#define POOL_SIZE (8192 - 4*sizeof(void*) - sizeof(struct _HTPool*) + sizeof(int)) / sizeof(HTStyleChange)
+
+typedef struct _HTPool {
+    HTStyleChange   data[POOL_SIZE];
+    struct _HTPool* prev;
+    int used;
+} HTPool;
+
+/************************************************************************
+These are generic macros for any pools (provided those structures have the
+same members as HTPool).  Pools are used for allocation of groups of
 objects of the same type T.  Pools are represented as a list of structures of
 type P (called pool chunks here).  Structure P has an array of N objects of
 type T named 'data' (the number N in the array can be chosen arbitrary),
-pointer to the next pool chunk named 'pool', and the number of free items in
-that pool chunk named 'free_items'.  Here is a definition of the structure P:
+pointer to the previous pool chunk named 'prev', and the number of used items
+in that pool chunk named 'used'.  Here is a definition of the structure P:
 	struct P
 	{
 	    T data[N];
-	    struct P* next;
-	    int free_items;
+	    struct P* prev;
+	    int used;
 	};
  It's recommended that sizeof(P) be memory page size minus 32 in order malloc'd
 chunks to fit in machine page size.
- Allocation of 'n' items in the pool is implemented by decrementing member
-'free_items' by 'n' if 'free_items' >= 'n', or allocating a new pool chunk and
+ Allocation of 'n' items in the pool is implemented by incrementing member
+'used' by 'n' if (used+n <= N), or malloc a new pool chunk and
 allocating 'n' items in that new chunk.  It's the task of the programmer to
 assert that 'n' is <= N.  Only entire pool may be freed - this limitation makes
 allocation algorithms trivial and fast - so the use of pools is limited to
@@ -214,6 +203,9 @@ speed due to the simple algorithms used.  Due to the fact that memory is
 'allocated' in array, alignment overhead is minimal.  Allocating strings in a
 pool provided their length will never exceed N and is much smaller than N seems
 to be very efficient.
+ [Several types of memory-hungry objects are stored in the pool now:  styles,
+lines, anchors, and FormInfo. Arrays of HTStyleChange are stored as is,
+other objects are aligned to sizeof(void*) bytes and stored using a cast.]
 
  Pool are referenced by pointer to the chunk that contains free slots. Macros
 that allocate memory in pools update that pointer if needed.
@@ -222,7 +214,7 @@ ALLOC_IN_POOL.
  Here is a description of those macros as C++ functions (with names mentioned
 above and with use of C++ references)
 
-void ALLOC_IN_POOL( P*& pool, pool_type, int toalloc, T*& ptr)
+void ALLOC_IN_POOL( P*& pool, pool_type, int toalloc, T*& ptr, int align=1)
     - allocates 'toalloc' items in the pool of type 'pool_type' pointed by
     'pool', sets the pointer 'ptr' to the "allocated" memory and updates 'pool'
     if necessary. Sets 'ptr' to NULL if fails.
@@ -231,67 +223,104 @@ void POOL_NEW( pool_type  , P*& ptr)
     Initializes a pool of type 'pool_type' pointed by 'ptr', updating 'ptr'.
     Sets 'ptr' to NULL if fails.
 
-void POOL_FREE( pool_type , P* ptr)
-    Frees a pool of type 'pool_type' pointed by ptr.
+void POOL_FREE( pool_type , P*& ptr)
+    Frees a pool of type 'pool_type' pointed by ptr. Sets ptr to NULL.
 
-      - VH */
+      - VH
 
+*************************************************************************/
 /*
-void ALLOC_IN_POOL( P*& pool, pool_type, int toalloc, T*& ptr)
-    - allocates 'toalloc' items in the pool of type 'pool_type' pointed by
-    'pool', sets the pointer 'ptr' to the "allocated" memory and updates 'pool'
-    if necessary. Sets 'ptr' to NULL if fails.
-*/
-#define ALLOC_IN_POOL(pool,pool_type,toalloc,ptr)     \
-if (!pool)  \
-    ptr = NULL; \
-else { \
-    if ((pool)->free_items > toalloc) { \
-	(pool)->free_items -= toalloc; \
-	ptr = (pool)->data + (pool)->free_items; \
-    } else { \
-	pool_type* newpool = (pool_type*)malloc(sizeof(pool_type)); \
-	if (!newpool) { \
-	    ptr = NULL; \
-	} else { \
-	    newpool->next = pool; \
-	    newpool->free_items = sizeof newpool->data/ \
-		    sizeof newpool->data[0] - toalloc; \
-	    pool = newpool; \
-	    ptr = newpool->data + sizeof newpool->data/sizeof newpool->data[0] - toalloc; \
-	} \
-    } \
-}
-/*
-void POOL_NEW( pool_type  , P*& ptr)
-    Initializes a pool of type 'pool_type' pointed by 'ptr', updating 'ptr'.
-    Sets 'ptr' to NULL if fails.
-*/
-#define POOL_NEW(pool_type,ptr) \
-    { \
-	pool_type* newpool = (pool_type*)malloc(sizeof(pool_type)); \
-	if (!newpool) { \
-	    ptr = NULL; \
-	} else { \
-	    newpool->next = NULL; \
-	    newpool->free_items = sizeof newpool->data/sizeof newpool->data[0]; \
-	    ptr = newpool; \
-	} \
+ * void ALLOC_IN_POOL( P*& pool, pool_type, int toalloc, T*& ptr, int align=1)
+ *     - allocates 'toalloc' items in the pool of type 'pool_type' pointed by
+ *     'pool', sets the pointer 'ptr' to the "allocated" memory and updates
+ *     'pool' if necessary.  Sets 'ptr' to NULL if fails.
+ */
+#define ALLOC_IN_POOL(pool,pool_type,toalloc,ptr,align) \
+    if (!pool) {					\
+	ptr = NULL;					\
+    } else {						\
+	if (align)					\
+	    pool->used += (pool->used % align);		\
+	if (POOL_SIZE - pool->used >= toalloc) { 	\
+	    ptr = pool->data + pool->used;		\
+	    pool->used += toalloc;			\
+	} else {					\
+	    pool_type* newpool = (pool_type*)LY_CALLOC(1, sizeof(pool_type)); \
+	    if (!newpool) {				\
+		ptr = NULL;				\
+	    } else {					\
+		newpool->prev = pool;			\
+		newpool->used = toalloc;		\
+		ptr = newpool->data;			\
+		pool = newpool;				\
+	   }						\
+	}						\
     }
 /*
-void POOL_FREE( pool_type , P* ptr)
-    Frees a pool of type 'pool_type' pointed by ptr.
-*/
-#define POOL_FREE(pool_type,xptr) \
-    { \
-	pool_type* ptr = xptr; \
-	do { \
-	    pool_type* prevpool = ptr; \
-	    ptr = ptr->next; \
-	    FREE(prevpool); \
-	} while (ptr); \
+ * void POOL_NEW( pool_type  , P*& ptr)
+ *     Initializes a pool of type 'pool_type' pointed by 'ptr', updating 'ptr'.
+ *     Sets 'ptr' to NULL if fails.
+ */
+#define POOL_NEW(pool_type,ptr)				\
+    {							\
+	ptr = (pool_type*)LY_CALLOC(1, sizeof(pool_type)); \
+	if (ptr) {					\
+	    ptr->prev = NULL;				\
+	    ptr->used = 0;				\
+	}						\
     }
+/*
+ * void POOL_FREE( pool_type, P*& ptr)
+ *     Frees a pool of type 'pool_type' pointed by ptr. Sets ptr to NULL.
+ */
+#define POOL_FREE(pool_type,ptr)			\
+    {							\
+	pool_type* cur = ptr;				\
+	pool_type* prev;				\
+	while (cur) {					\
+	    prev = cur->prev;				\
+	    FREE(cur);					\
+	    cur = prev;					\
+	}						\
+	ptr = NULL;					\
+    }
+/**************************************************************************/
+
+#define _sz_        sizeof(HTStyleChange)      /* 4 */
+#define _align_     (sizeof(void*)/_sz_)       /*64bit OS!*/
+#define _round_(x)  (x%_sz_ ? x/_sz_ + 1: x/_sz_)
+
+#define POOLallocstyles(ptr, N)     ALLOC_IN_POOL(HTMainText->pool,HTPool,\
+					N,				\
+					ptr,				\
+					1)
+#define POOLallocHTLine(ptr, size)  { HTStyleChange* _tmp_;		\
+				      ALLOC_IN_POOL(HTMainText->pool,HTPool,\
+					_round_(LINE_SIZE(size)),	\
+					_tmp_,				\
+					_align_);			\
+				      ptr = (HTLine*)_tmp_;		\
+				    }
+#define POOLtypecalloc(T,ptr)	    { HTStyleChange* _tmp_;		\
+				      ALLOC_IN_POOL(HTMainText->pool,HTPool,\
+					_round_(sizeof(T)),		\
+					_tmp_,				\
+					_align_);			\
+				      ptr = (T*)_tmp_;			\
+				    }
+
+typedef struct _line {
+	struct _line    *next;
+	struct _line    *prev;
+	unsigned short	offset;	/* Implicit initial spaces */
+	unsigned short	size;	/* Number of characters */
+#if defined(USE_COLOR_STYLE)
+	HTStyleChange*  styles;
+	unsigned short  numstyles;
 #endif
+	char	data[1];	/* Space for terminator at least! */
+} HTLine;
+
 
 #define LINE_SIZE(l) (sizeof(HTLine)+(l))	/* Allow for terminator */
 #define allocHTLine(l) (HTLine *)calloc(1, LINE_SIZE(l))
@@ -300,15 +329,16 @@ typedef struct _TextAnchor {
 	struct _TextAnchor *	next;
 	struct _TextAnchor *	prev;		/* www_user_search only! */
 	int			number;		/* For user interface */
-	int			line_pos;	/* Bytes/chars - extent too */
-	int			extent;		/* (see HText_trimHightext) */
 	int			line_num;	/* Place in document */
-	HiliteList		lites;
-	int			link_type;	/* Normal, internal, or form? */
-	FormInfo *		input_field;	/* Info for form links */
+	short			line_pos;	/* Bytes/chars - extent too */
+	short			extent;		/* (see HText_trimHightext) */
 	BOOL			show_anchor;	/* Show the anchor? */
 	BOOL			inUnderline;	/* context is underlined */
 	BOOL			expansion_anch; /* TEXTAREA edit new anchor */
+	char			link_type;	/* Normal, internal, or form? */
+	FormInfo *		input_field;	/* Info for form links */
+	HiliteList		lites;
+
 	HTChildAnchor *		anchor;
 } TextAnchor;
 
@@ -325,27 +355,13 @@ typedef struct {
 */
 struct _HText {
 	HTParentAnchor *	node_anchor;
-#ifdef SOURCE_CACHE
-	/*
-	 * Parse settings when this HText was generated.
-	 */
-	BOOLEAN			clickable_images;
-	BOOLEAN			pseudo_inline_alts;
-	BOOLEAN			verbose_img;
-	BOOLEAN			raw_mode;
-	BOOLEAN			historical_comments;
-	BOOLEAN			minimal_comments;
-	BOOLEAN			soft_dquotes;
-	int			old_dtd;
-	int			keypad_mode;
-	int			disp_lines;	/* Screen size */
-	int			disp_cols;	/* Used for reports only */
-#endif
+
 	HTLine *		last_line;
 	int			Lines;		/* Number of them */
-	TextAnchor *		first_anchor;	/* Singly linked list */
+	TextAnchor *		first_anchor;	/* double-linked on demand */
 	TextAnchor *		last_anchor;
 	TextAnchor *		last_anchor_before_stbl;
+	TextAnchor *		last_anchor_before_split;
 	HTList *		forms;		/* also linked internally */
 	int			last_anchor_number;	/* user number */
 	BOOL			source;		/* Is the text source? */
@@ -389,20 +405,36 @@ struct _HText {
 	enum grid_state       { S_text, S_esc, S_dollar, S_paren,
 				S_nonascii_text, S_dollar_paren,
 				S_jisx0201_text }
-				state;			/* Escape sequence? */
-	int			kanji_buf;		/* Lead multibyte */
-	int			in_sjis;		/* SJIS flag */
-	int			halted;			/* emergency halt */
-
-	BOOL			have_8bit_chars;   /* Any non-ASCII chars? */
-	LYUCcharset *		UCI;		   /* node_anchor UCInfo */
-	int			UCLYhndl;	   /* charset we are fed */
+				state;		/* Escape sequence? */
+	int			kanji_buf;	/* Lead multibyte */
+	int			in_sjis;	/* SJIS flag */
+	int			halted;		/* emergency halt */
+
+	BOOL			have_8bit_chars; /* Any non-ASCII chars? */
+	LYUCcharset *		UCI;		/* node_anchor UCInfo */
+	int			UCLYhndl;	/* charset we are fed */
 	UCTransParams		T;
 
-	HTStream *		target;			/* Output stream */
-	HTStreamClass		targetClass;		/* Output routines */
-#if defined(USE_COLOR_STYLE)
-	HTStyleChangePool*	styles_pool;
+	HTStream *		target;		/* Output stream */
+	HTStreamClass		targetClass;	/* Output routines */
+
+	HTPool*			pool;		/* this HText memory pool */
+
+#ifdef SOURCE_CACHE
+	/*
+	* Parse settings when this HText was generated.
+	*/
+	BOOL			clickable_images;
+	BOOL			pseudo_inline_alts;
+	BOOL			verbose_img;
+	BOOL			raw_mode;
+	BOOL			historical_comments;
+	BOOL			minimal_comments;
+	BOOL			soft_dquotes;
+	short			old_dtd;
+	short			keypad_mode;
+	short			disp_lines;	/* Screen size */
+	short			disp_cols;	/* Used for reports only */
 #endif
 };
 
@@ -560,9 +592,9 @@ PRIVATE void LYAddHiText ARGS3(
     unsigned want = ++(a->lites.hl_len) * sizeof(HiliteInfo);
 
     if (have != NULL) {
-	have = realloc(have, want);
+	have = (HiliteInfo *) realloc(have, want);
     } else {
-	have = malloc(want);
+	have = (HiliteInfo *) malloc(want);
     }
     a->lites.hl_info = have;
 
@@ -696,7 +728,7 @@ PRIVATE void * LY_check_calloc ARGS2(
     }
     n = HTList_count(loaded_texts);
     for (i = n - 1; i > 0; i--) {
-	HText * t = HTList_objectAt(loaded_texts, i);
+	HText * t = (HText *) HTList_objectAt(loaded_texts, i);
 	if (t == HTMainText)
 	    t = NULL;		/* shouldn't happen */
 	{
@@ -853,6 +885,9 @@ PUBLIC HText *	HText_new ARGS1(
 #endif /* VMS && VAXC && !__DECC */
     }
 
+    POOL_NEW(HTPool, self->pool);
+    if (!self->pool)
+	outofmem(__FILE__, "HText_New");
     line = self->last_line = allocHTLine(MAX_LINE);
     if (line == NULL)
 	outofmem(__FILE__, "HText_New");
@@ -860,14 +895,11 @@ PUBLIC HText *	HText_new ARGS1(
     line->offset = line->size = 0;
 #ifdef USE_COLOR_STYLE
     line->numstyles = 0;
-    POOL_NEW(HTStyleChangePool,self->styles_pool);
-    if (!self->styles_pool)
-	outofmem(__FILE__, "HText_New");
-    stylechanges_buffers_free = 0;
     line->styles = stylechanges_buffers[0];
 #endif
     self->Lines = 0;
     self->first_anchor = self->last_anchor = NULL;
+    self->last_anchor_before_split = NULL;
     self->style = &default_style;
     self->top_of_screen = 0;
     self->node_anchor = anchor;
@@ -1033,26 +1065,6 @@ PUBLIC void HText_free ARGS1(
 	return;
 
     HTAnchor_setDocument(self->node_anchor, (HyperDoc *)0);
-#if defined(USE_COLOR_STYLE)
-    POOL_FREE(HTStyleChangePool,self->styles_pool);
-#endif
-    while (YES) {	/* Free off line array */
-	HTLine * l = self->last_line;
-	if (l) {
-	    l->next->prev = l->prev;
-	    l->prev->next = l->next;	/* Unlink l */
-	    self->last_line = l->prev;
-	    if (l != self->last_line) {
-		FREE(l);
-	    } else {
-		free(l);
-	    }
-	}
-	if (l == self->last_line) {	/* empty */
-	    l = self->last_line = NULL;
-	    break;
-	}
-    }
 
     while (self->first_anchor) {		/* Free off anchor array */
 	TextAnchor * l = self->first_anchor;
@@ -1102,13 +1114,9 @@ PUBLIC void HText_free ARGS1(
 	    FREE(l->input_field->submit_title);
 
 	    FREE(l->input_field->accept_cs);
-
-	    FREE(l->input_field);
 	}
 
 	LYSetHiText(l, NULL, 0);
-
-	FREE(l);
     }
     FormList_delete(self->forms);
 
@@ -1166,6 +1174,7 @@ PUBLIC void HText_free ARGS1(
 	    HTMainAnchor = NULL;
     }
 
+    POOL_FREE(HTPool, self->pool);
     FREE(self);
 }
 
@@ -1769,19 +1778,6 @@ PRIVATE void display_scrollbar ARGS1(
 #define display_scrollbar(text) /*nothing*/
 #endif /* USE_SCROLLBAR */
 
-/*
- * Utility to let us use for-loops on the anchor-pointers.
- */
-PRIVATE TextAnchor * next_anchor ARGS2(
-	HText *,	text,
-	TextAnchor *,	anchor_ptr)
-{
-    if (anchor_ptr == text->last_anchor)
-	anchor_ptr = NULL;
-    else
-	anchor_ptr = anchor_ptr->next;
-    return anchor_ptr;
-}
 
 /*	Output a page
 **	-------------
@@ -1846,6 +1842,7 @@ PRIVATE void display_page ARGS3(
 	 *  an xterm is temporarily made very small. - kw */
 	return;
     }
+
     last_screen = text->Lines - (display_lines - 2);
     line = text->last_line->prev;
 
@@ -2123,7 +2120,7 @@ PRIVATE void display_page ARGS3(
     nlinks = 0;
     for (Anchor_ptr = text->first_anchor;
 	 Anchor_ptr != NULL && Anchor_ptr->line_num <= stop_before_for_anchors;
-	 Anchor_ptr = next_anchor(text, Anchor_ptr)) {
+	 Anchor_ptr = Anchor_ptr->next) {
 
 	if (Anchor_ptr->line_num >= line_number
 	 && Anchor_ptr->line_num < stop_before_for_anchors) {
@@ -2167,7 +2164,7 @@ PRIVATE void display_page ARGS3(
 #ifndef DONT_TRACK_INTERNAL_LINKS
 			if (Anchor_ptr->link_type == INTERNAL_LINK_ANCHOR) {
 			    link_dest_intl = HTAnchor_followTypedLink(
-				(HTAnchor *)Anchor_ptr->anchor, LINK_INTERNAL);
+				(HTAnchor *)Anchor_ptr->anchor, HTInternalLink);
 			    if (link_dest_intl && link_dest_intl != link_dest) {
 
 				CTRACE((tfp,
@@ -2430,20 +2427,19 @@ PRIVATE void move_anchors_in_region ARGS7(
     int,		shift)		/* Likewise */
 {
     /*
-     *  Update anchor positions for anchors that start on this line.
-     *  Note: we rely on a->line_pos counting bytes, not
-     *  characters.  That's one reason why HText_trimHightext
-     *  has to be prevented from acting on these anchors in
-     *  partial display mode before we get a chance to
-     *  deal with them here.
+     * Update anchor positions for anchors that start on this line.  Note:  we
+     * rely on a->line_pos counting bytes, not characters.  That's one reason
+     * why HText_trimHightext has to be prevented from acting on these anchors
+     * in partial display mode before we get a chance to deal with them here.
      */
     TextAnchor *a;
     int head_processed = *prev_head_processed;
 
-    /* We need to know whether (*prev_anchor)->line_pos is "in new
-       coordinates" or in old ones.  If prev_anchor' head was touched
-       on the previous iteraction, we set head_processed.  The tail
-       may need to be treated now. */
+    /*
+     * We need to know whether (*prev_anchor)->line_pos is "in new coordinates"
+     * or in old ones.  If prev_anchor' head was touched on the previous
+     * iteration, we set head_processed.  The tail may need to be treated now.
+     */
     for (a = *prev_anchor;
 	 a && a->line_num <= line_number;
 	 a = a->next, head_processed = 0) {
@@ -2492,7 +2488,7 @@ PRIVATE void move_anchors_in_region ARGS7(
  *  Some necessary changes for anchors starting on this line are also done
  *  here if needed.
  *  Returns a newly allocated HTLine* if changes were made
- *    (caller has to free the old one).
+ *    (lines allocated in pool, caller should not free the old one).
  *  Returns NULL if no changes needed.  (Remove-spaces code may be buggy...)
  * - kw
  */
@@ -2536,7 +2532,7 @@ PRIVATE HTLine * insert_blanks_in_line ARGS7(
     if (!prev_anchor)
 	prev_anchor = text->first_anchor;
     head_processed = (prev_anchor && prev_anchor->line_num < line_number);
-    memcpy(mod_line, line, LINE_SIZE(1));
+    memcpy(mod_line, line, LINE_SIZE(0));
     t = newdata = mod_line->data;
     ip = 0;
     while (ip <= ninserts) {
@@ -2637,7 +2633,6 @@ PRIVATE void split_line ARGS2(
 	unsigned,	split)
 {
     HTStyle * style = text->style;
-    HTLine * temp;
     int spare;
     int indent = text->in_line_1 ?
 	  text->style->indent1st : text->style->leftIndent;
@@ -2657,10 +2652,12 @@ PRIVATE void split_line ARGS2(
     HTLine * line = (HTLine *)LY_CALLOC(1, LINE_SIZE(MAX_LINE)+2);
 
     /*
-     *  Make new line.
+     *  Set new line.
      */
     if (line == NULL)
 	outofmem(__FILE__, "split_line_1");
+    memset(line, 0, LINE_SIZE(0));
+
     ctrl_chars_on_this_line = 0; /*reset since we are going to a new line*/
     utfxtra_on_this_line = 0;	/*reset too, we'll count them*/
     text->LastChar = ' ';
@@ -2852,7 +2849,10 @@ PRIVATE void split_line ARGS2(
 #endif
 
 #if defined(USE_COLOR_STYLE)
-    line->styles = stylechanges_buffers[stylechanges_buffers_free = (stylechanges_buffers_free + 1) &1];
+    if (previous->styles == stylechanges_buffers[0])
+	line->styles = stylechanges_buffers[1];
+    else
+	line->styles = stylechanges_buffers[0];
     line->numstyles = 0;
     {
 	HTStyleChange *from = previous->styles + previous->numstyles - 1;
@@ -2946,18 +2946,20 @@ PRIVATE void split_line ARGS2(
     }
 #endif /*USE_COLOR_STYLE*/
 
-    temp = (HTLine *)LY_CALLOC(1, LINE_SIZE(previous->size));
-    if (temp == NULL)
+    {
+    HTLine* temp;
+    POOLallocHTLine(temp, previous->size);
+    if (!temp)
 	outofmem(__FILE__, "split_line_2");
     memcpy(temp, previous, LINE_SIZE(previous->size));
 #if defined(USE_COLOR_STYLE)
-    ALLOC_IN_POOL((text->styles_pool),HTStyleChangePool,previous->numstyles,temp->styles);
-    memcpy(temp->styles, previous->styles, sizeof(HTStyleChange)*previous->numstyles);
+    POOLallocstyles(temp->styles, previous->numstyles);
     if (!temp->styles)
 	outofmem(__FILE__, "split_line_2");
+    memcpy(temp->styles, previous->styles, sizeof(HTStyleChange)*previous->numstyles);
 #endif
-    FREE(previous);
     previous = temp;
+    }
 
     previous->prev->next = previous;	/* Link in new line */
     previous->next->prev = previous;	/* Could be same node of course */
@@ -3085,7 +3087,6 @@ PRIVATE void split_line ARGS2(
      */
 
     if (s > 0) {			/* if not completely empty */
-	TextAnchor * prev_a = NULL;
 	int moved = 0;
 
 	/* In the algorithm below we move or not move anchors between
@@ -3097,11 +3098,16 @@ PRIVATE void split_line ARGS2(
 	 */
 	/* Our operations can make a non-empty all-whitespace link
 	   empty.  So what? */
-	for (a = text->first_anchor; a; prev_a = a, a = a->next) {
+	if ((a = text->last_anchor_before_split) == 0)
+	    a = text->first_anchor;
+
+	for ( ; a; a = a->next) {
 	    if (a->line_num == CurLine) {
 		int len = a->extent, n = a->number, start = a->line_pos;
 		int end = start + len;
 
+		text->last_anchor_before_split = a;
+
 		/* Which anchors do we leave on the previous line?
 		   a) empty finished (We need a cut-off value.
 		      "Just because": those before s;
@@ -3236,8 +3242,6 @@ PRIVATE void split_line ARGS2(
 	    previous->next->prev = jline;
 	    previous->prev->next = jline;
 
-	    FREE(previous);
-
 	    previous = jline;
 	}
 	{ /* (ht_num_runs==1) */
@@ -3252,11 +3256,10 @@ PRIVATE void split_line ARGS2(
 	    if (!a2)
 		a2 = text->first_anchor;
 	    else
-		a2 = next_anchor(text, a2); /* 1st anchor on line we justify */
+		a2 = a2->next; /* 1st anchor on line we justify */
 
-	    if (a2)
-		for (; a2 && a2->line_num <= text->Lines-1;
-		    last_anchor_of_previous_line = a2, a2 = a2->next);
+	    for (; a2 && a2->line_num <= text->Lines-1;
+		last_anchor_of_previous_line = a2, a2 = a2->next);
 	}
     } else {
 	if (REALLY_CAN_JUSTIFY(text) ) {
@@ -4122,8 +4125,8 @@ check_WrapSource:
      *  Check for end of line.
      */
     actual = ((indent + (int)line->offset + (int)line->size) +
-       ((line->size > 0) &&
-	(int)(line->data[line->size-1] == LY_SOFT_HYPHEN ? 1 : 0)));
+	      ((line->size > 0) &&
+	       (int)(line->data[line->size-1] == LY_SOFT_HYPHEN ? 1 : 0)));
 
     if (text->T.output_utf8) {
 	actual += (UTFXTRA_ON_THIS_LINE - ctrl_chars_on_this_line + UTF_XLEN(ch));
@@ -4516,7 +4519,6 @@ PRIVATE int HText_insertBlanksInStblLines ARGS2(
 	    lines_changed++;
 	    if (line == first_line)
 		first_line = mod_line;
-	    free(line);
 	    line = mod_line;
 #ifdef DISP_PARTIAL
 	    /*
@@ -4902,8 +4904,9 @@ PUBLIC int HText_beginAnchor ARGS3(
 	BOOL,			underline,
 	HTChildAnchor *,	anc)
 {
-    TextAnchor * a = typecalloc(TextAnchor);
+    TextAnchor * a;
 
+    POOLtypecalloc(TextAnchor, a);
     if (a == NULL)
 	outofmem(__FILE__, "HText_beginAnchor");
     a->inUnderline = underline;
@@ -4922,7 +4925,7 @@ PUBLIC int HText_beginAnchor ARGS3(
     text->last_anchor = a;
 
 #ifndef DONT_TRACK_INTERNAL_LINKS
-    if (HTAnchor_followTypedLink((HTAnchor*)anc, LINK_INTERNAL)) {
+    if (HTAnchor_followTypedLink((HTAnchor*)anc, HTInternalLink)) {
 	a->number = ++(text->last_anchor_number);
 	a->link_type = INTERNAL_LINK_ANCHOR;
     } else
@@ -5526,7 +5529,6 @@ PUBLIC void HText_endAppend ARGS1(
 	 */
 	next_to_the_last_line->next = line_ptr;
 	line_ptr->prev = next_to_the_last_line;
-	FREE(text->last_line);
 	text->last_line = next_to_the_last_line;
 	text->Lines--;
 	CTRACE((tfp, "GridText: New bottom line: `%s'\n",
@@ -5607,7 +5609,7 @@ PRIVATE void HText_trimHightext ARGS3(
      */
     for (anchor_ptr = text->first_anchor;
 	anchor_ptr != NULL;
-	prev_a = anchor_ptr, anchor_ptr = next_anchor(text, anchor_ptr)) {
+	prev_a = anchor_ptr, anchor_ptr = anchor_ptr->next) {
 	int have_soft_newline_in_1st_line = 0;
 re_parse:
 	/*
@@ -5817,23 +5819,33 @@ PUBLIC HTParentAnchor * HText_nodeAnchor ARGS1(
 /*				GridText specials
 **				=================
 */
+
 /*
- *  HTChildAnchor() returns the anchor with index N.
- *  The index corresponds to the [number] we print for the anchor.
+ *  HText_childNextNumber() returns the anchor with index [number],
+ *  using a pointer from the previous number (=optimization) or NULL.
  */
-PUBLIC HTChildAnchor * HText_childNumber ARGS1(
-	int,		number)
+PUBLIC HTChildAnchor * HText_childNextNumber ARGS2(
+	int,		number,
+	void**,		prev)
 {
-    TextAnchor * a;
+    /* Sorry, TextAnchor is not declared outside this file, use a cast. */
+    TextAnchor * a = *prev;
 
-    if (!(HTMainText && HTMainText->first_anchor) || number <= 0)
+    if (!HTMainText || number <= 0)
 	return (HTChildAnchor *)0;	/* Fail */
+    if (number == 1 || !a)
+	a = HTMainText->first_anchor;
 
-    for (a = HTMainText->first_anchor; a; a = a->next) {
-	if (a->number == number)
-	    return(a->anchor);
-    }
-    return (HTChildAnchor *)0;	/* Fail */
+    /* a strange thing:  positive a->number's are sorted,
+     * and between them several a->number's may be 0 -- skip them
+     */
+    for( ; a && a->number != number; a = a->next)
+	;
+
+    if (!a)
+	return (HTChildAnchor *)0;	/* Fail */
+    *prev = (void*)a;
+    return a->anchor;
 }
 
 /*
@@ -6122,7 +6134,7 @@ PUBLIC int HTGetLinkInfo ARGS6(
 #ifndef DONT_TRACK_INTERNAL_LINKS
 			if (a->link_type == INTERNAL_LINK_ANCHOR) {
 			    link_dest_intl = HTAnchor_followTypedLink(
-				(HTAnchor *)a->anchor, LINK_INTERNAL);
+				(HTAnchor *)a->anchor, HTInternalLink);
 			    if (link_dest_intl && link_dest_intl != link_dest) {
 
 				CTRACE((tfp, "HTGetLinkInfo: unexpected typed link to %s!\n",
@@ -6224,7 +6236,7 @@ PUBLIC BOOL HText_TAHasMoreLines ARGS2(
 	}
 	return NO;
     } else {
-	for (a = HTMainText->first_anchor; a; a = next_anchor(HTMainText, a)) {
+	for (a = HTMainText->first_anchor; a; a = a->next) {
 	    if (a->link_type == INPUT_ANCHOR &&
 		links[curlink].l_form == a->input_field) {
 		return same_anchors(a, a->next, TRUE);
@@ -6469,11 +6481,12 @@ PUBLIC BOOL HText_getFirstTargetInLine ARGS7(
      *  Make sure we have an HText structure, that line_num is
      *  in its range, and that we have a target string. -FM
      */
-    if (!(text
-       && line_num >= 0
-       && line_num <= text->Lines
-       && non_empty(target)))
+    if (!(text &&
+	line_num >= 0 &&
+	line_num <= text->Lines &&
+	non_empty(target))) {
 	return(FALSE);
+    }
 
     /*
      *  Find the line and set up its data and offset -FM
@@ -6834,8 +6847,8 @@ PUBLIC int HText_LinksInLines ARGS3(
 	return total;
 
     for (Anchor_ptr = text->first_anchor;
-		Anchor_ptr != NULL && Anchor_ptr->line_num <= end;
-			Anchor_ptr = next_anchor(text, Anchor_ptr)) {
+	 Anchor_ptr != NULL && Anchor_ptr->line_num <= end;
+	 Anchor_ptr = Anchor_ptr->next) {
 	if (Anchor_ptr->line_num >= start &&
 	    Anchor_ptr->line_num < end &&
 	    Anchor_ptr->show_anchor &&
@@ -7012,7 +7025,7 @@ PUBLIC BOOL HText_POSTReplyLoaded ARGS1(
 }
 
 PUBLIC BOOL HTFindPoundSelector ARGS1(
-	char *,		selector)
+	CONST char *,		selector)
 {
     TextAnchor * a;
 
@@ -7748,7 +7761,7 @@ PRIVATE BOOL anchor_has_target ARGS2(
 		return TRUE;
 	    }
 	    FREE(stars);
-       } else if (a->input_field->type == F_OPTION_LIST_TYPE) {
+	} else if (a->input_field->type == F_OPTION_LIST_TYPE) {
 	    /*
 	     *  Search the option strings that are displayed
 	     *  when the popup is invoked. -FM
@@ -8503,18 +8516,15 @@ PUBLIC void HText_RemovePreviousLine ARGS1(
 	HText *,	text)
 {
     HTLine *line, *previous;
-    char *data;
 
     if (!(text && text->Lines > 1))
 	return;
 
     line = text->last_line->prev;
-    data = line->data;
     previous = line->prev;
     previous->next = text->last_line;
     text->last_line->prev = previous;
     text->Lines--;
-    FREE(line);
 }
 
 /*
@@ -8797,7 +8807,7 @@ PUBLIC void HText_endForm ARGS1(
 	/*
 	 *  Go through list of anchors and get our input field. -FM
 	 */
-	for (a = text->first_anchor; a != NULL; a = next_anchor(text, a)) {
+	for (a = text->first_anchor; a != NULL; a = a->next) {
 	    if (a->link_type == INPUT_ANCHOR &&
 		a->input_field->number == HTFormNumber &&
 		a->input_field->type == F_TEXT_TYPE) {
@@ -9249,8 +9259,8 @@ PUBLIC int HText_beginInput ARGS3(
 	BOOL,			underline,
 	InputFieldData *,	I)
 {
-    TextAnchor * a = typecalloc(TextAnchor);
-    FormInfo * f = typecalloc(FormInfo);
+    TextAnchor * a;
+    FormInfo * f;
     CONST char *cp_option = NULL;
     char *IValue = NULL;
     unsigned char *tmp = NULL;
@@ -9261,6 +9271,8 @@ PUBLIC int HText_beginInput ARGS3(
 
     CTRACE((tfp, "GridText: Entering HText_beginInput\n"));
 
+    POOLtypecalloc(TextAnchor, a);
+    POOLtypecalloc(FormInfo, f);
     if (a == NULL || f == NULL)
 	outofmem(__FILE__, "HText_beginInput");
 
@@ -9287,7 +9299,7 @@ PUBLIC int HText_beginInput ARGS3(
 	} else {
 	    TextAnchor * b;
 	    int i2 = 0;
-	    for (b = text->first_anchor; b != NULL; b = next_anchor(text, b)) {
+	    for (b = text->first_anchor; b != NULL; b = b->next) {
 		if (b->link_type == INPUT_ANCHOR &&
 		    b->input_field->type == F_RADIO_TYPE &&
 		    b->input_field->number == HTFormNumber) {
@@ -9474,8 +9486,6 @@ PUBLIC int HText_beginInput ARGS3(
 	     */
 	    CTRACE((tfp,
 		  "GridText: No name present in input field; not displaying\n"));
-	    FREE(a);
-	    FREE(f);
 	    FREE(IValue);
 	    return(0);
 	}
@@ -9957,6 +9967,16 @@ PRIVATE unsigned check_form_specialchars ARGS1(
     return result;
 }
 
+PRIVATE CONST char *guess_content_type ARGS1(CONST char *, filename)
+{
+    HTAtom *encoding;
+    CONST char *desc;
+    HTFormat format = HTFileFormat (filename, &encoding, &desc);
+    return (format != 0 && non_empty(format->name))
+	    ? format->name
+	    : "text/plain";
+}
+
 /*
  *  HText_SubmitForm - generate submit data from form fields.
  *  For mailto forms, send the data.
@@ -10111,7 +10131,7 @@ PUBLIC int HText_SubmitForm ARGS4(
      */
     for (anchor_ptr = HTMainText->first_anchor;
 	 anchor_ptr != NULL;
-	 anchor_ptr = next_anchor(HTMainText, anchor_ptr)) {
+	 anchor_ptr = anchor_ptr->next) {
 
 	if (anchor_ptr->link_type != INPUT_ANCHOR)
 	    continue;
@@ -10263,7 +10283,7 @@ PUBLIC int HText_SubmitForm ARGS4(
      */
     for (anchor_ptr = HTMainText->first_anchor;
 	 anchor_ptr != NULL;
-	 anchor_ptr = next_anchor(HTMainText, anchor_ptr)) {
+	 anchor_ptr = anchor_ptr->next) {
 
 	if (anchor_ptr->link_type != INPUT_ANCHOR)
 	    continue;
@@ -10373,7 +10393,7 @@ PUBLIC int HText_SubmitForm ARGS4(
 		    out_csname = LYCharSet_UC[out_cs].MIMEname;
 		if (Boundary) {
 		    StrAllocCopy(MultipartContentType,
-				 "\r\nContent-Type: text/plain");
+				 "\r\nContent-Type: %s");
 		    if (!success && form_ptr->value_cs < 0) {
 			/*  This is weird. */
 			out_csname = "UNKNOWN-8BIT";
@@ -10482,8 +10502,9 @@ PUBLIC int HText_SubmitForm ARGS4(
 						  SemiColon,
 						  PlainText,
 						  Boundary);
-		if ((escaped2 = load_a_file(&use_mime, val_used)) == NULL)
-		    goto exit_disgracefully;
+		if ((escaped2 = load_a_file(&use_mime, val_used)) == NULL) {
+		    StrAllocCopy(escaped2, "");
+		}
 
 		/* FIXME: we need to modify the mime-type here - rp */
 		/* Note: could use LYGetFileInfo for that and for
@@ -10496,7 +10517,7 @@ PUBLIC int HText_SubmitForm ARGS4(
 		    HTSprintf(&escaped1, "; name=\"%s\"", name_used);
 		    HTSprintf(&escaped1, "; filename=\"%s\"", val_used);
 		    if (MultipartContentType) {
-			StrAllocCat(escaped1, MultipartContentType);
+			HTSprintf(&escaped1, MultipartContentType, guess_content_type(val_used));
 			if (use_mime)
 			    StrAllocCat(escaped1, "\r\nContent-Transfer-Encoding: base64");
 		    }
@@ -10545,7 +10566,7 @@ PUBLIC int HText_SubmitForm ARGS4(
 			StrAllocCopy(escaped1, "Content-Disposition: form-data");
 			HTSprintf(&escaped1, "; name=\"%s\"", name_used);
 			if (MultipartContentType)
-			    StrAllocCat(escaped1, MultipartContentType);
+			    HTSprintf(&escaped1, MultipartContentType, "text/plain");
 			StrAllocCat(escaped1, "\r\n\r\n");
 		    } else {
 			escaped1 = HTEscapeSP(name_used, URL_XALPHAS);
@@ -10617,7 +10638,7 @@ PUBLIC int HText_SubmitForm ARGS4(
 			StrAllocCopy(escaped1, "Content-Disposition: form-data");
 			HTSprintf(&escaped1, "; name=\"%s\"", name_used);
 			if (MultipartContentType)
-			    StrAllocCat(escaped1, MultipartContentType);
+			    HTSprintf(&escaped1, MultipartContentType, "text/plain");
 			StrAllocCat(escaped1, "\r\n\r\n");
 		    } else {
 			escaped1 = HTEscapeSP(name_used, URL_XALPHAS);
@@ -10674,7 +10695,7 @@ PUBLIC int HText_SubmitForm ARGS4(
 			StrAllocCopy(escaped1, "Content-Disposition: form-data");
 			HTSprintf(&escaped1, "; name=\"%s\"", name_used);
 			if (MultipartContentType)
-			    StrAllocCat(escaped1, MultipartContentType);
+			    HTSprintf(&escaped1, MultipartContentType, "text/plain");
 			StrAllocCat(escaped1, "\r\n\r\n");
 		    } else {
 			escaped1 = HTEscapeSP(name_used, URL_XALPHAS);
@@ -10732,7 +10753,7 @@ PUBLIC int HText_SubmitForm ARGS4(
 		    StrAllocCopy(escaped1, "Content-Disposition: form-data");
 		    HTSprintf(&escaped1, "; name=\"%s\"", name_used);
 		    if (MultipartContentType)
-			StrAllocCat(escaped1, MultipartContentType);
+			HTSprintf(&escaped1, MultipartContentType, "text/plain");
 		    StrAllocCat(escaped1, "\r\n\r\n");
 		} else {
 		    escaped1 = HTEscapeSP(name_used, URL_XALPHAS);
@@ -10773,7 +10794,7 @@ PUBLIC int HText_SubmitForm ARGS4(
     }
     FREE(previous_blanks);
 
-    CTRACE((tfp, "QUERY (%d) >> \n%s\n", strlen(query), query));
+    CTRACE((tfp, "QUERY (%d) >> \n%s\n", (int) strlen(query), query));
 
     if (submit_item->submit_method == URL_MAIL_METHOD) {
 	HTUserMsg2(gettext("Submitting %s"), submit_item->submit_action);
@@ -10815,18 +10836,6 @@ PUBLIC int HText_SubmitForm ARGS4(
 	FREE(query);
 	return 1;
     }
-#ifdef EXP_FILE_UPLOAD
-exit_disgracefully:
-    FREE(escaped1);
-    FREE(escaped2);
-    FREE(previous_blanks);
-    FREE(copied_name_used);
-    FREE(copied_val_used);
-    FREE(MultipartContentType);
-    FREE(query);
-    FREE(content_type_out);
-    return 0;
-#endif
 }
 
 PUBLIC void HText_DisableCurrentForm NOARGS
@@ -10842,7 +10851,7 @@ PUBLIC void HText_DisableCurrentForm NOARGS
      */
     for (anchor_ptr = HTMainText->first_anchor;
 	 anchor_ptr != NULL;
-	 anchor_ptr = next_anchor(HTMainText, anchor_ptr)) {
+	 anchor_ptr = anchor_ptr->next) {
 	if (anchor_ptr->link_type == INPUT_ANCHOR &&
 	    anchor_ptr->input_field->number == HTFormNumber) {
 
@@ -10867,7 +10876,7 @@ PUBLIC void HText_ResetForm ARGS1(
      */
     for (anchor_ptr = HTMainText->first_anchor;
 	 anchor_ptr != NULL;
-	 anchor_ptr = next_anchor(HTMainText, anchor_ptr)) {
+	 anchor_ptr = anchor_ptr->next) {
 	if (anchor_ptr->link_type == INPUT_ANCHOR) {
 	    if (anchor_ptr->input_field->number == form->number) {
 
@@ -10916,7 +10925,7 @@ PUBLIC BOOLEAN HText_HaveUserChangedForms NOARGS
      */
     for (anchor_ptr = HTMainText->first_anchor;
 	 anchor_ptr != NULL;
-	 anchor_ptr = next_anchor(HTMainText, anchor_ptr)) {
+	 anchor_ptr = anchor_ptr->next) {
 	if (anchor_ptr->link_type == INPUT_ANCHOR) {
 
 	    if (anchor_ptr->input_field->type == F_RADIO_TYPE ||
@@ -10957,7 +10966,7 @@ PUBLIC void HText_activateRadioButton ARGS1(
 	return;
     for (anchor_ptr = HTMainText->first_anchor;
 	 anchor_ptr != NULL;
-	 anchor_ptr = next_anchor(HTMainText, anchor_ptr)) {
+	 anchor_ptr = anchor_ptr->next) {
 	if (anchor_ptr->link_type == INPUT_ANCHOR &&
 		anchor_ptr->input_field->type == F_RADIO_TYPE) {
 
@@ -11703,9 +11712,10 @@ PRIVATE void insert_new_textarea_anchor ARGS2(
      *  Clone and initialize the struct's needed to add a new TEXTAREA
      *  anchor.
      */
-    if (((a = typecalloc(TextAnchor)) == 0) ||
-	((f = typecalloc(FormInfo)) == 0) ||
-	((l = allocHTLine(MAX_LINE)) == 0))
+    POOLallocHTLine(l, MAX_LINE);
+    POOLtypecalloc(TextAnchor, a);
+    POOLtypecalloc(FormInfo, f);
+    if (a == NULL || l == NULL || f == NULL)
 	outofmem(__FILE__, "insert_new_textarea_anchor");
 
     /*  Init all the fields in the new TextAnchor.                 */
@@ -12526,9 +12536,10 @@ PUBLIC int HText_InsertFile ARGS1(
 	    break;
     }
 
-    if (((a = typecalloc(TextAnchor)) == 0) ||
-	((f = typecalloc(FormInfo)) == 0) ||
-	((l = allocHTLine(MAX_LINE)) == 0))
+    POOLallocHTLine(l, MAX_LINE);
+    POOLtypecalloc(TextAnchor, a);
+    POOLtypecalloc(FormInfo, f);
+    if (a == NULL || l == NULL || f == NULL)
 	outofmem(__FILE__, "HText_InsertFile");
 
     /*  Init all the fields in the new TextAnchor.                 */
diff --git a/src/GridText.h b/src/GridText.h
index 760d88ae..7f2ce6af 100644
--- a/src/GridText.h
+++ b/src/GridText.h
@@ -64,7 +64,8 @@ extern HTParentAnchor * HTMainAnchor;	/* Anchor for HTMainText */
 #if defined(VMS) && defined(VAXC) && !defined(__DECC)
 extern int HTVirtualMemorySize;
 #endif /* VMS && VAXC && !__DECC */
-extern HTChildAnchor * HText_childNumber PARAMS((int n));
+
+extern HTChildAnchor * HText_childNextNumber PARAMS((int n, void** prev));
 extern void HText_FormDescNumber PARAMS((int n, char **desc));
 
 /*	Is there any file left?
@@ -111,7 +112,7 @@ extern void HText_setMainTextOwner PARAMS((CONST char * owner));
 extern void print_wwwfile_to_fd PARAMS((FILE * fp, BOOLEAN is_reply));
 extern BOOL HText_select PARAMS((HText *text));
 extern BOOL HText_POSTReplyLoaded PARAMS((DocInfo *doc));
-extern BOOL HTFindPoundSelector PARAMS((char *selector));
+extern BOOL HTFindPoundSelector PARAMS((CONST char *selector));
 extern int HTGetRelLinkNum PARAMS((int num, int rel, int cur));
 extern int HTGetLinkInfo PARAMS((
 	int		number,
diff --git a/src/HTAlert.c b/src/HTAlert.c
index 90d65ed0..a8049e04 100644
--- a/src/HTAlert.c
+++ b/src/HTAlert.c
@@ -180,15 +180,15 @@ PRIVATE char *sprint_bytes ARGS3(
 #ifdef EXP_READPROGRESS
 #define TIME_HMS_LENGTH (16)
 PRIVATE char *sprint_tbuf ARGS2(
-       char *,         s,
-       long,           t)
+	char *,	       s,
+	long,	       t)
 {
     if (t > 3600)
-       sprintf (s, "%ldh%ldm%lds", t / 3600, (t / 60) % 60, t % 60);
+	sprintf (s, "%ldh%ldm%lds", t / 3600, (t / 60) % 60, t % 60);
     else if (t > 60)
-       sprintf (s, "%ldm%lds", t / 60, t % 60);
+	sprintf (s, "%ldm%lds", t / 60, t % 60);
     else
-       sprintf (s, "%ld sec", t);
+	sprintf (s, "%ld sec", t);
     return s;
 }
 #endif /* EXP_READPROGRESS */
@@ -244,15 +244,18 @@ PUBLIC void HTReadProgress ARGS2(
 	total_last = total;
 
 	/*
-	 * Optimal refresh time:  every 0.2 sec, use interpolation.  Transfer
-	 * rate is not constant when we have partial content in a proxy, so
-	 * interpolation lies - will check every second at least for sure.
+	 * Optimal refresh time:  every 0.2 sec
 	 */
-#ifdef HAVE_GETTIMEOFDAY
+#if defined(HAVE_GETTIMEOFDAY) || (defined(HAVE_FTIME) && defined(HAVE_SYS_TIMEB_H))
 	if (now >= last + 0.2)
 	    renew = 1;
 #else
-	if (((bytes - bytes_last) > (transfer_rate / 5)) || (now != last)) {
+	/*
+	 * Use interpolation.  (The transfer rate may be not constant
+	 * when we have partial content in a proxy.  We adjust transfer_rate
+	 * once a second to minimize interpolation error below.)
+	 */
+	if ((now != last) || ((bytes - bytes_last) > (transfer_rate / 5))) {
 	    renew = 1;
 	    bytes_last += (transfer_rate / 5);	/* until we got next second */
 	}
@@ -263,7 +266,7 @@ PUBLIC void HTReadProgress ARGS2(
 		if (bytes_last != bytes)
 		    last_active = now;
 		bytes_last = bytes;
-		transfer_rate = (long)(bytes / (now - first)); /* more accurate here */
+		transfer_rate = (long)(bytes / (now - first)); /* more accurate value */
 	    }
 
 	    if (total > 0)
@@ -286,13 +289,13 @@ PUBLIC void HTReadProgress ARGS2(
 #ifdef EXP_READPROGRESS
 	    if (LYTransferRate == rateEtaBYTES
 	     || LYTransferRate == rateEtaKB) {
-                char tbuf[TIME_HMS_LENGTH];
+		char tbuf[TIME_HMS_LENGTH];
 		if (now - last_active >= 5)
-                    HTSprintf (&line,
+		    HTSprintf (&line,
 			       gettext(" (stalled for %s)"),
 			       sprint_tbuf (tbuf, (long)(now - last_active)));
 		if (total > 0 && transfer_rate)
-                    HTSprintf (&line,
+		    HTSprintf (&line,
 			       gettext(", ETA %s"),
 			       sprint_tbuf (tbuf, (long)((total - bytes)/transfer_rate)));
 	    }
diff --git a/src/HTFWriter.c b/src/HTFWriter.c
index 819c25b9..ea0c61c2 100644
--- a/src/HTFWriter.c
+++ b/src/HTFWriter.c
@@ -190,11 +190,9 @@ PRIVATE void HTFWriter_free ARGS1(HTStream *, me)
 			path[len-3] = '\0';
 			remove(path);
 		    }
-#ifdef BZIP2_PATH
 		} else if (len > 4 && !strcasecomp(&path[len-3], "bz2")) {
 		    path[len-4] = '\0';
 		    remove(path);
-#endif /* BZIP2_PATH */
 		} else if (len > 2 && !strcasecomp(&path[len-1], "Z")) {
 		    path[len-2] = '\0';
 		    remove(path);
@@ -1020,6 +1018,7 @@ PUBLIC HTStream* HTCompressed ARGS3(
     BOOL can_present = FALSE;
     char fnam[LY_MAXPATH];
     char temp[LY_MAXPATH];	/* actually stores just a suffix */
+    CONST char *program;
     CONST char *suffix;
     char *uncompress_mask = NULL;
     char *compress_suffix = "";
@@ -1048,39 +1047,36 @@ PUBLIC HTStream* HTCompressed ARGS3(
 	     *	We have a presentation mapping for it. - FM
 	     */
 	    can_present = TRUE;
-#ifdef GZIP_PATH
-	    if (!strcasecomp(anchor->content_encoding, "x-gzip") ||
-		!strcasecomp(anchor->content_encoding, "gzip")) {
+	    if ((!strcasecomp(anchor->content_encoding, "x-gzip") ||
+		 !strcasecomp(anchor->content_encoding, "gzip")) &&
+		 (program = HTGetProgramPath(ppGZIP)) != NULL) {
 		/*
 		 *  It's compressed with the modern gzip. - FM
 		 */
-		StrAllocCopy(uncompress_mask, GZIP_PATH);
+		StrAllocCopy(uncompress_mask, program);
 		StrAllocCat(uncompress_mask, " -d --no-name %s");
 		compress_suffix = "gz";
 		break;
 	    }
-#endif /* GZIP_PATH */
-#ifdef BZIP2_PATH
-	    if (!strcasecomp(anchor->content_encoding, "x-bzip2") ||
-		!strcasecomp(anchor->content_encoding, "bzip2")) {
-		StrAllocCopy(uncompress_mask, BZIP2_PATH);
+	    if ((!strcasecomp(anchor->content_encoding, "x-bzip2") ||
+		 !strcasecomp(anchor->content_encoding, "bzip2")) &&
+		(program = HTGetProgramPath(ppBZIP2)) != NULL) {
+		StrAllocCopy(uncompress_mask, program);
 		StrAllocCat(uncompress_mask, " -d %s");
 		compress_suffix = "bz2";
 		break;
 	    }
-#endif /* BZIP2_PATH */
-#ifdef UNCOMPRESS_PATH
-	    if (!strcasecomp(anchor->content_encoding, "x-compress") ||
-		       !strcasecomp(anchor->content_encoding, "compress")) {
+	    if ((!strcasecomp(anchor->content_encoding, "x-compress") ||
+		 !strcasecomp(anchor->content_encoding, "compress")) &&
+		(program = HTGetProgramPath(ppUNCOMPRESS)) != NULL) {
 		/*
 		 *  It's compressed the old fashioned Unix way. - FM
 		 */
-		StrAllocCopy(uncompress_mask, UNCOMPRESS_PATH);
+		StrAllocCopy(uncompress_mask, program);
 		StrAllocCat(uncompress_mask, " %s");
 		compress_suffix = "Z";
 		break;
 	    }
-#endif /* UNCOMPRESS_PATH */
 	    break;
 	}
     }
diff --git a/src/HTML.c b/src/HTML.c
index 7bae9995..9698e568 100644
--- a/src/HTML.c
+++ b/src/HTML.c
@@ -77,6 +77,7 @@
 #include <HTAccess.h>
 #endif
 
+#include <LYCurses.h>
 #include <LYJustify.h>
 
 #include <LYexit.h>
@@ -84,13 +85,6 @@
 
 #define STACKLEVEL(me) ((me->stack + MAX_NESTING - 1) - me->sp)
 
-extern BOOL HTPassEightBitRaw;
-
-extern BOOLEAN HT_Is_Gopher_URL;
-
-/* from Curses.h */
-extern int LYcols;
-
 struct _HTStream {
     CONST HTStreamClass *	isa;
 #ifdef SOURCE_CACHE
@@ -661,7 +655,6 @@ PUBLIC void HTML_write ARGS3(HTStructured *, me, CONST char*, s, int, l)
  *  context an internal link makes no sense (e.g., IMG SRC=).
  */
 
-#ifndef DONT_TRACK_INTERNAL_LINKS
 /* A flag is used to keep track of whether an "URL reference" encountered
    had a real "URL" or not.  In the latter case, it will be marked as
    "internal".	The flag is set before we start messing around with the
@@ -672,14 +665,8 @@ PUBLIC void HTML_write ARGS3(HTStructured *, me, CONST char*, s, int, l)
 
 /* Last argument to pass to HTAnchor_findChildAndLink() calls,
    just an abbreviation. - kw */
-#define INTERN_LT (HTLinkType *)(intern_flag ? LINK_INTERNAL : NULL)
+#define INTERN_LT (HTLinkType *)(intern_flag ? HTInternalLink : NULL)
 
-#else  /* !DONT_TRACK_INTERNAL_LINKS */
-
-#define CHECK_FOR_INTERN(flag,s)  /* do nothing */ ;
-#define INTERN_LT (HTLinkType *)NULL
-
-#endif /* DONT_TRACK_INTERNAL_LINKS */
 
 #ifdef USE_COLOR_STYLE
 # if !OPT_SCN
@@ -3020,82 +3007,87 @@ PRIVATE int HTML_start_element ARGS6(
 		   value[HTML_A_NAME] && *value[HTML_A_NAME]) {
 	    StrAllocCopy(id_string, value[HTML_A_NAME]);
 	}
-	if (id_string) {
+	if (id_string)
 	    TRANSLATE_AND_UNESCAPE_TO_STD(&id_string);
-	    if (*id_string == '\0') {
-		FREE(id_string);
-	    }
-	}
 
 	/*
 	 *  Handle the reference. - FM
 	 */
 	if (present && present[HTML_A_HREF]) {
-#ifndef DONT_TRACK_INTERNAL_LINKS
-	    if (present[HTML_A_ISMAP])
-		intern_flag = FALSE;
-	    else
-		CHECK_FOR_INTERN(intern_flag,value[HTML_A_HREF]);
-#endif
 	    /*
-	     *	Prepare to do housekeeping on the reference. - FM
+	     * Set to know we are making the content bold.
 	     */
-	    if (!value[HTML_A_HREF] || *value[HTML_A_HREF] == '\0') {
-		StrAllocCopy(href, me->node_anchor->address);
-	    } else if (*value[HTML_A_HREF] == '#') {
-		StrAllocCopy(href, me->node_anchor->address);
-		if (strlen(value[HTML_A_HREF]) > 1) {
-		    StrAllocCat(href, value[HTML_A_HREF]);
-		}
-	    } else {
+	    me->inBoldA = TRUE;
+
+	    CHECK_FOR_INTERN(intern_flag,value[HTML_A_HREF]);
+	    if (present[HTML_A_ISMAP]) /*???*/
+		intern_flag = FALSE;
+
+	    if (intern_flag) {
+		/*** FAST WAY: ***/
 		StrAllocCopy(href, value[HTML_A_HREF]);
-	    }
-	    url_type = LYLegitimizeHREF(me, &href, TRUE, TRUE);
+		if (href && *href)
+		    TRANSLATE_AND_UNESCAPE_TO_STD(&href);
+		if (!href || !*href)
+		    StrAllocCopy(href, "#"); /*extreme case*/
 
-	    /*
-	     *	Deal with our ftp gateway kludge. - FM
-	     */
-	    if (!url_type && !strncmp(href, "/foo/..", 7) &&
-		(isFTP_URL(me->node_anchor->address) ||
-		 isFILE_URL(me->node_anchor->address))) {
-		for (i = 0; (href[i] = href[i+7]) != 0; i++)
-		    ;
-	    }
+	    } else {
+		/*
+		 * Prepare to do housekeeping on the reference.	 - FM
+		 */
+		if (!value[HTML_A_HREF] || *value[HTML_A_HREF] == '\0') {
+		    StrAllocCopy(href, me->node_anchor->address);
+		} else if (*value[HTML_A_HREF] == '#') {
+		    StrAllocCopy(href, me->node_anchor->address);
+		    if (strlen(value[HTML_A_HREF]) > 1) {
+			StrAllocCat(href, value[HTML_A_HREF]);
+		    }
+		} else {
+		    StrAllocCopy(href, value[HTML_A_HREF]);
+		}
+		url_type = LYLegitimizeHREF(me, &href, TRUE, TRUE);
 
-	    /*
-	     *	Set to know we are making the content bold.
-	     */
-	    me->inBoldA = TRUE;
+		/*
+		 * Deal with our ftp gateway kludge.  - FM
+		 */
+		if (!url_type && !strncmp(href, "/foo/..", 7) &&
+		      (isFTP_URL(me->node_anchor->address) ||
+		       isFILE_URL(me->node_anchor->address))) {
+		    for (i = 0; (href[i] = href[i+7]) != 0; i++)
+			;
+		}
 
-	    /*
-	     *	Check whether a base tag is in effect. - FM
-	     */
-	    if ((me->inBASE && *href != '\0' && *href != '#') &&
-		(temp = HTParse(href, me->base_href, PARSE_ALL)) &&
-		*temp != '\0')
 		/*
-		 *  Use reference related to the base.
+		 * Check whether a base tag is in effect.  - FM
 		 */
-		StrAllocCopy(href, temp);
-	    FREE(temp);
+		if ((me->inBASE && *href != '\0' && *href != '#') &&
+		     (temp = HTParse(href, me->base_href, PARSE_ALL)) &&
+		      *temp != '\0')
+		    /*
+		     * Use reference related to the base.
+		     */
+		    StrAllocCopy(href, temp);
+		FREE(temp);
 
-	    /*
-	     *	Check whether to fill in localhost. - FM
-	     */
-	    LYFillLocalFileURL(&href,
-			       ((*href != '\0' && *href != '#' &&
-				 me->inBASE) ?
-			       me->base_href : me->node_anchor->address));
+	        /*
+		 * Check whether to fill in localhost.  - FM
+		 */
+		 LYFillLocalFileURL(&href,
+				    ((*href != '\0' && *href != '#' &&
+				     me->inBASE)
+				     ? me->base_href
+				     : me->node_anchor->address));
+	    }
 	} else {
 	    if (bold_name_anchors == TRUE) {
 		me->inBoldA = TRUE;
 	    }
 	}
-#ifndef DONT_TRACK_INTERNAL_LINKS
+
 	if (present && present[HTML_A_TYPE] && value[HTML_A_TYPE]) {
 	    StrAllocCopy(temp, value[HTML_A_TYPE]);
 	    if (!intern_flag && href &&
-		!strcasecomp(value[HTML_A_TYPE], HTAtom_name(LINK_INTERNAL)) &&
+		!strcasecomp(value[HTML_A_TYPE], HTAtom_name(HTInternalLink)) &&
 		!LYIsUIPage3(me->node_anchor->address, UIP_LIST_PAGE, 0) &&
 		!LYIsUIPage3(me->node_anchor->address, UIP_ADDRLIST_PAGE, 0) &&
 		!isLYNXIMGMAP(me->node_anchor->address)) {
@@ -3108,7 +3100,6 @@ PRIVATE int HTML_start_element ARGS6(
 		FREE(temp);
 	    }
 	}
-#endif /* DONT_TRACK_INTERNAL_LINKS */
 
 	me->CurrentA = HTAnchor_findChildAndLink(
 			me->node_anchor,			/* Parent */
diff --git a/src/LYBookmark.c b/src/LYBookmark.c
index bdab256b..baa40d80 100644
--- a/src/LYBookmark.c
+++ b/src/LYBookmark.c
@@ -1,5 +1,6 @@
 #include <HTUtils.h>
 #include <HTAlert.h>
+#include <HTFile.h>
 #include <LYUtils.h>
 #include <LYStrings.h>
 #include <LYBookmark.h>
@@ -264,15 +265,18 @@ PUBLIC void save_bookmark_link ARGS2(
      *	If the link will be added to the same
      *	bookmark file, get confirmation. - FM
      */
-    if (LYMultiBookmarks != MBM_OFF &&
-	strstr(HTLoadedDocumentURL(),
-	       (*BookmarkPage == '.' ?
-		    (BookmarkPage+1) : BookmarkPage)) != NULL) {
-	LYMBM_statusline(MULTIBOOKMARKS_SELF);
-	c = LYgetch_single();
-	if (c != 'L') {
-	    FREE(bookmark_URL);
-	    return;
+    if (LYMultiBookmarks != MBM_OFF) {
+	CONST char *url = HTLoadedDocumentURL();
+	CONST char *page = (*BookmarkPage == '.')
+			    ? (BookmarkPage + 1)
+			    : BookmarkPage;
+	if (strstr(url, page) != NULL) {
+	    LYMBM_statusline(MULTIBOOKMARKS_SELF);
+	    c = LYgetch_single();
+	    if (c != 'L') {
+		FREE(bookmark_URL);
+		return;
+	    }
 	}
     }
 
@@ -634,22 +638,25 @@ PUBLIC void remove_bookmark_link ARGS2(
 	if (errno == EXDEV) {
 	    static CONST char MV_FMT[] = "%s %s %s";
 	    char *buffer = 0;
-	    HTAddParam(&buffer, MV_FMT, 1, MV_PATH);
-	    HTAddParam(&buffer, MV_FMT, 2, newfile);
-	    HTAddParam(&buffer, MV_FMT, 3, filename_buffer);
-	    HTEndParam(&buffer, MV_FMT, 3);
-	    if (LYSystem(buffer) == 0) {
+	    CONST char *program;
+
+	    if ((program = HTGetProgramPath(ppMV)) != NULL) {
+		HTAddParam(&buffer, MV_FMT, 1, program);
+		HTAddParam(&buffer, MV_FMT, 2, newfile);
+		HTAddParam(&buffer, MV_FMT, 3, filename_buffer);
+		HTEndParam(&buffer, MV_FMT, 3);
+		if (LYSystem(buffer) == 0) {
 #ifdef MULTI_USER_UNIX
-		if (regular)
-		    chmod(filename_buffer, stat_buf.st_mode & 07777);
+		    if (regular)
+			chmod(filename_buffer, stat_buf.st_mode & 07777);
 #endif
-		FREE(buffer);
-		return;
-	    } else {
-		FREE(buffer);
-		keep_tempfile = TRUE;
-		goto failure;
+		    FREE(buffer);
+		    return;
+		}
 	    }
+	    FREE(buffer);
+	    keep_tempfile = TRUE;
+	    goto failure;
 	}
 	CTRACE((tfp, "rename(): %s", LYStrerror(errno)));
 #endif /* _WINDOWS */
diff --git a/src/LYCharSets.c b/src/LYCharSets.c
index e13b156b..a9ccbf54 100644
--- a/src/LYCharSets.c
+++ b/src/LYCharSets.c
@@ -4,6 +4,7 @@
 
 #include <LYGlobalDefs.h>
 #include <UCMap.h>
+#include <UCdomap.h>
 #include <UCDefs.h>
 #include <LYCharSets.h>
 #include <GridText.h>
@@ -12,17 +13,11 @@
 
 #include <LYLeaks.h>
 
-extern BOOL HTPassEightBitRaw;
-extern BOOL HTPassEightBitNum;
-extern BOOL HTPassHighCtrlRaw;
-extern BOOL HTPassHighCtrlNum;
 PUBLIC HTkcode kanji_code = NOKANJI;
 PUBLIC BOOLEAN LYHaveCJKCharacterSet = FALSE;
 PUBLIC BOOLEAN DisplayCharsetMatchLocale = TRUE;
 PUBLIC BOOL force_old_UCLYhndl_on_reload = FALSE;
 PUBLIC int forced_UCLYhdnl;
-extern void UCInit NOARGS;
-extern int UCInitialized;
 PUBLIC int LYNumCharsets = 0;  /* Will be initialized later by UC_Register. */
 PUBLIC int current_char_set = -1; /* will be intitialized later in LYMain.c */
 PUBLIC CONST char** p_entity_values = NULL; /* Pointer, for HTML_put_entity()*/
diff --git a/src/LYCharSets.h b/src/LYCharSets.h
index e1c03d7f..051e9c90 100644
--- a/src/LYCharSets.h
+++ b/src/LYCharSets.h
@@ -11,6 +11,10 @@
 #include <UCMap.h>
 #endif /* !UCMAP_H */
 
+extern BOOL HTPassEightBitRaw;
+extern BOOL HTPassEightBitNum;
+extern BOOL HTPassHighCtrlRaw;
+extern BOOL HTPassHighCtrlNum;
 extern BOOLEAN LYHaveCJKCharacterSet;
 extern BOOLEAN DisplayCharsetMatchLocale;
 
diff --git a/src/LYCharUtils.c b/src/LYCharUtils.c
index 9f0a66a0..752934d5 100644
--- a/src/LYCharUtils.c
+++ b/src/LYCharUtils.c
@@ -38,11 +38,6 @@
 #include <LYexit.h>
 #include <LYLeaks.h>
 
-extern BOOL HTPassEightBitRaw;
-extern BOOL HTPassEightBitNum;
-extern BOOL HTPassHighCtrlRaw;
-extern BOOL HTPassHighCtrlNum;
-
 /*
  *  Used for nested lists. - FM
  */
diff --git a/src/LYCookie.c b/src/LYCookie.c
index 34d6b967..d5cf0f38 100644
--- a/src/LYCookie.c
+++ b/src/LYCookie.c
@@ -1931,8 +1931,8 @@ PUBLIC void LYLoadCookies ARGS1 (
 	tok_ptr = buf;
 	tok_out = LYstrsep(&tok_ptr, "\t");
 	for (tok_loop = 0; tok_out && tok_values[tok_loop].s; tok_loop++) {
-	    CTRACE((tfp, "\t%d:%p:%p:[%s]\n",
-		tok_loop, tok_values[tok_loop].s, tok_out, tok_out));
+	    CTRACE((tfp, "\t%d:[%03d]:[%s]\n",
+		tok_loop, tok_out - buf, tok_out));
 	    LYstrncpy(tok_values[tok_loop].s, tok_out, tok_values[tok_loop].n);
 	    /*
 	     * It looks like strtok ignores a leading delimiter,
@@ -2066,7 +2066,8 @@ PUBLIC void LYStoreCookies ARGS1 (
 	    if ((co = (cookie *)cl->object) == NULL)
 		continue;
 
-	    CTRACE((tfp, "LYStoreCookies: %ld cf %ld ", (long) now, (long) co->expires));
+	    CTRACE((tfp, "LYStoreCookies: %ld cf %ld ",
+		   (long) now, (long) co->expires));
 
 	    if ((co->flags & COOKIE_FLAG_DISCARD)) {
 		CTRACE((tfp, "not stored - DISCARD\n"));
@@ -2080,11 +2081,11 @@ PUBLIC void LYStoreCookies ARGS1 (
 	    }
 
 	    fprintf(cookie_handle, "%s\t%s\t%s\t%s\t%ld\t%s\t%s%s%s\n",
-		de->domain,
+		    de->domain,
 		    (de->domain[0] == '.') ? "TRUE" : "FALSE",
 		    co->path,
-		co->flags & COOKIE_FLAG_SECURE ? "TRUE" : "FALSE",
-		(long) co->expires, co->name,
+		    co->flags & COOKIE_FLAG_SECURE ? "TRUE" : "FALSE",
+		    (long) co->expires, co->name,
 		    (co->quoted ? "\"" : ""),
 		    NonNull(co->value),
 		    (co->quoted ? "\"" : ""));
diff --git a/src/LYCurses.c b/src/LYCurses.c
index d3a1cff7..7fe777f4 100644
--- a/src/LYCurses.c
+++ b/src/LYCurses.c
@@ -1963,7 +1963,6 @@ TRACEBACK if it can be captured, and any other relevant information.\n"));
  */
 PUBLIC int ttopen NOARGS
 {
-	extern	void cleanup_sig();
 	int	iosb[2];
 	int	status;
 	static unsigned long condition;
@@ -2281,7 +2280,6 @@ PUBLIC int DCLsystem ARGS1(
 	char *,		command)
 {
      int status;
-     extern void controlc();
 
      VMSsignal(SIGINT, SIG_IGN);
      status = spawn_DCLprocess(command);
diff --git a/src/LYDownload.h b/src/LYDownload.h
index aeed2b19..b7d75ae7 100644
--- a/src/LYDownload.h
+++ b/src/LYDownload.h
@@ -1,4 +1,3 @@
-
 #ifndef LYDOWNLOAD_H
 #define LYDOWNLOAD_H
 
@@ -9,5 +8,8 @@
 extern void LYDownload PARAMS((char *line));
 extern int LYdownload_options PARAMS((char **newfile, char *data_file));
 
-#endif /* LYDOWNLOAD_H */
+#ifdef VMS
+extern BOOLEAN LYDidRename;
+#endif
 
+#endif /* LYDOWNLOAD_H */
diff --git a/src/LYGetFile.c b/src/LYGetFile.c
index 2cf6c794..e8aeb252 100644
--- a/src/LYGetFile.c
+++ b/src/LYGetFile.c
@@ -36,10 +36,6 @@
 PRIVATE int fix_httplike_urls PARAMS((DocInfo *doc, UrlTypes type));
 
 #ifdef VMS
-extern BOOLEAN LYDidRename;
-#endif /* VMS */
-
-#ifdef VMS
 #define STRNADDRCOMP strncasecomp
 #else
 #define STRNADDRCOMP strncmp
@@ -1581,7 +1577,7 @@ PRIVATE int fix_httplike_urls ARGS2(
 	}
 	if (type == HTTP_URL_TYPE ||
 	    type == HTTPS_URL_TYPE) {
-	    if ((slash-2) - strchr(doc->address, ':')) {
+	    if ((slash-2) != strchr(doc->address, ':')) {
 		/*
 		 *  Turns out we were not looking at the right slash after all,
 		 *  there must have been more than one "://" which is valid
diff --git a/src/LYGlobalDefs.h b/src/LYGlobalDefs.h
index 3cd16f87..821e9f94 100644
--- a/src/LYGlobalDefs.h
+++ b/src/LYGlobalDefs.h
@@ -57,10 +57,6 @@ extern BOOLEAN UseFixedRecords; /* convert binary files to FIXED 512 records */
 extern char *list_format;
 #endif /* !VMS */
 
-#ifdef VMS
-extern char *LYCSwingPath;
-#endif /* VMS */
-
 #ifdef DIRED_SUPPORT
 
 typedef enum {
@@ -144,8 +140,8 @@ extern char star_string[MAX_LINE + 1]; /* from GridText.c */
  ((n) >= MAX_LINE ? star_string : &star_string[(MAX_LINE-1)] - (n))
 
 typedef enum {
-    SHOW_COLOR_UNKNOWN = 0
-    , SHOW_COLOR_NEVER
+    SHOW_COLOR_UNKNOWN = -1
+    , SHOW_COLOR_NEVER = 0	/* positive numbers are index in LYOptions.c */
     , SHOW_COLOR_OFF
     , SHOW_COLOR_ON
     , SHOW_COLOR_ALWAYS
diff --git a/src/LYList.c b/src/LYList.c
index 20c28d8d..e9777988 100644
--- a/src/LYList.c
+++ b/src/LYList.c
@@ -48,6 +48,7 @@ PUBLIC int showlist ARGS2(
     char *LinkTitle = NULL;  /* Rel stored as property of link, not of dest */
     BOOLEAN intern_w_post = FALSE;
     char *desc = "unknown field or link";
+    void* helper;
 
     refs = HText_sourceAnchors(HTMainText);
     hidden_links = HText_HiddenLinkCount(HTMainText);
@@ -102,8 +103,9 @@ PUBLIC int showlist ARGS2(
 	if (LYHiddenLinks == HIDDENLINKS_IGNORE)
 	    hidden_links = 0;
     }
+    helper = NULL; /* init */
     for (cnt = 1; cnt <= refs; cnt++) {
-	HTChildAnchor *child = HText_childNumber(cnt);
+	HTChildAnchor *child = HText_childNextNumber(cnt, &helper);
 	HTAnchor *dest_intl = NULL;
 	HTAnchor *dest;
 	HTParentAnchor *parent;
@@ -134,7 +136,7 @@ PUBLIC int showlist ARGS2(
 	}
 #ifndef DONT_TRACK_INTERNAL_LINKS
 	dest_intl = HTAnchor_followTypedLink((HTAnchor *)child,
-						       LINK_INTERNAL);
+						       HTInternalLink);
 #endif
 	dest = dest_intl ?
 	    dest_intl : HTAnchor_followMainLink((HTAnchor *)child);
@@ -256,6 +258,7 @@ PUBLIC void printlist ARGS2(
     int refs, hidden_links;
     char *address = NULL;
     char *desc = gettext("unknown field or link");
+    void* helper;
 
     refs = HText_sourceAnchors(HTMainText);
     if (refs <= 0 && LYHiddenLinks != HIDDENLINKS_SEPARATE)
@@ -270,8 +273,9 @@ PUBLIC void printlist ARGS2(
 	    if (LYHiddenLinks == HIDDENLINKS_IGNORE)
 		hidden_links = 0;
 	}
+       helper = NULL; /* init */
 	for (cnt = 1; cnt <= refs; cnt++) {
-	    HTChildAnchor *child = HText_childNumber(cnt);
+	    HTChildAnchor *child = HText_childNextNumber(cnt, &helper);
 	    HTAnchor *dest;
 	    HTParentAnchor *parent;
 	    CONST char *title;
diff --git a/src/LYLocal.c b/src/LYLocal.c
index c627315c..db733817 100644
--- a/src/LYLocal.c
+++ b/src/LYLocal.c
@@ -326,7 +326,7 @@ PRIVATE BOOLEAN ok_localname ARGS2(char*, dst, CONST char*, src)
  *  Execute DIRED command, return -1 or 0 on failure, 1 success.
  */
 PRIVATE int LYExecv ARGS3(
-	char *,		path,
+	CONST char *,	path,
 	char **,	argv,
 	char *,		msg)
 {
@@ -425,104 +425,112 @@ PRIVATE int LYExecv ARGS3(
 PRIVATE int make_directory ARGS1(char *, path)
 {
     int code;
-#ifdef MKDIR_PATH
-    char *args[5];
-    char *msg = 0;
-
-    HTSprintf0(&msg,"make directory %s", path);
-    args[0] = "mkdir";
-    args[1] = path;
-    args[2] = (char *) 0;
-    code = (LYExecv(MKDIR_PATH, args, msg) <= 0) ? -1 : 1;
-    FREE(msg);
-#else
+    CONST char *program;
+
+    if ((program = HTGetProgramPath(ppMKDIR)) != NULL) {
+	char *args[5];
+	char *msg = 0;
+
+	HTSprintf0(&msg,"make directory %s", path);
+	args[0] = "mkdir";
+	args[1] = path;
+	args[2] = (char *) 0;
+	code = (LYExecv(program, args, msg) <= 0) ? -1 : 1;
+	FREE(msg);
+    } else {
 #ifdef _WINDOWS
-    code = mkdir(path) ? -1 : 1;
+	code = mkdir(path) ? -1 : 1;
 #else
-    code = mkdir(path, 0777) ? -1 : 1;
-#endif
+	code = mkdir(path, 0777) ? -1 : 1;
 #endif
+    }
     return (code);
 }
 
 PRIVATE int remove_file ARGS1(char *, path)
 {
     int code;
-#ifdef RM_PATH
-    char *args[5];
-    char *tmpbuf = NULL;
-
-    args[0] = "rm";
-    args[1] = "-rf";
-    args[2] = path;
-    args[3] = (char *) 0;
-    HTSprintf0(&tmpbuf, gettext("remove %s"), path);
-    code = LYExecv(RM_PATH, args, tmpbuf);
-    FREE(tmpbuf);
-#else
-    code = remove(path) ? -1 : 1;
-#endif
+    CONST char *program;
+
+    if ((program = HTGetProgramPath(ppRM)) != NULL) {
+	char *args[5];
+	char *tmpbuf = NULL;
+
+	args[0] = "rm";
+	args[1] = "-rf";
+	args[2] = path;
+	args[3] = (char *) 0;
+	HTSprintf0(&tmpbuf, gettext("remove %s"), path);
+	code = LYExecv(program, args, tmpbuf);
+	FREE(tmpbuf);
+    } else {
+	code = remove(path) ? -1 : 1;
+    }
     return (code);
 }
 
 PRIVATE int touch_file ARGS1(char *, path)
 {
     int code;
-#ifdef TOUCH_PATH
-    char *args[5];
-    char *msg = NULL;
-
-    HTSprintf0(&msg, gettext("touch %s"), path);
-    args[0] = "touch";
-    args[1] = path;
-    args[2] = (char *) 0;
-    code = (LYExecv(TOUCH_PATH, args, msg) <= 0) ? -1 : 1;
-    FREE(msg);
-#else
-    FILE *fp;
-    if ((fp = fopen(path, "w")) != 0) {
-	fclose(fp);
-	code = 1;
+    CONST char *program;
+
+    if ((program = HTGetProgramPath(ppTOUCH)) != NULL) {
+	char *args[5];
+	char *msg = NULL;
+
+	HTSprintf0(&msg, gettext("touch %s"), path);
+	args[0] = "touch";
+	args[1] = path;
+	args[2] = (char *) 0;
+	code = (LYExecv(program, args, msg) <= 0) ? -1 : 1;
+	FREE(msg);
     } else {
-	code = -1;
+	FILE *fp;
+	if ((fp = fopen(path, "w")) != 0) {
+	    fclose(fp);
+	    code = 1;
+	} else {
+	    code = -1;
+	}
     }
-#endif
     return (code);
 }
 
 PRIVATE int move_file ARGS2(char *, source, char *, target)
 {
     int code;
-#ifdef MV_PATH
-    char *msg = 0;
-    char *args[5];
-
-    HTSprintf0(&msg, gettext("move %s to %s"), source, target);
-    args[0] = "mv";
-    args[1] = source;
-    args[2] = target;
-    args[3] = (char *) 0;
-    code = (LYExecv(MV_PATH, args, msg) <= 0) ? -1 : 1;
-    FREE(msg);
-#else
-    struct stat sb;
-    char *actual = 0;
-    /* the caller sets up a target directory; we need a file path */
-    if (stat(target, &sb) == 0
-     && S_ISDIR(sb.st_mode)) {
-	HTSprintf0(&actual, "%s/%s", target, LYPathLeaf(source));
-	CTRACE((tfp, "move_file source=%s, target=%s\n", source, target));
-	target = actual;
-    }
-    if ((code = rename(source, target)) != 0)
-	if ((code = LYCopyFile(source, target)) >= 0)
-	    code = remove(source);
-    if (code == 0)
-	code = 1;
-    if (actual != target) {
-    	FREE(actual);
+    CONST char *program;
+
+    if ((program = HTGetProgramPath(ppMV)) != NULL) {
+	char *msg = 0;
+	char *args[5];
+
+	HTSprintf0(&msg, gettext("move %s to %s"), source, target);
+	args[0] = "mv";
+	args[1] = source;
+	args[2] = target;
+	args[3] = (char *) 0;
+	code = (LYExecv(program, args, msg) <= 0) ? -1 : 1;
+	FREE(msg);
+    } else {
+	struct stat sb;
+	char *actual = 0;
+	/* the caller sets up a target directory; we need a file path */
+	if (stat(target, &sb) == 0
+	 && S_ISDIR(sb.st_mode)) {
+	    HTSprintf0(&actual, "%s/%s", target, LYPathLeaf(source));
+	    CTRACE((tfp, "move_file source=%s, target=%s\n", source, target));
+	    target = actual;
+	}
+	if ((code = rename(source, target)) != 0)
+	    if ((code = LYCopyFile(source, target)) >= 0)
+		code = remove(source);
+	if (code == 0)
+	    code = 1;
+	if (actual != target) {
+	    FREE(actual);
+	}
     }
-#endif
     return code;
 }
 
@@ -856,12 +864,12 @@ PRIVATE int modify_location ARGS1(
      *	Change the location of the file or directory.
      */
     if (S_ISDIR(dir_info.st_mode)) {
-#ifndef MV_PATH
-	HTAlert(COULD_NOT_ACCESS_DIR);
-	return 0;
-#else
-	cp = gettext("Enter new location for directory: ");
-#endif
+	if (HTGetProgramPath(ppMV) != NULL) {
+	    cp = gettext("Enter new location for directory: ");
+	} else {
+	    HTAlert(COULD_NOT_ACCESS_DIR);
+	    return 0;
+	}
     } else if (S_ISREG(dir_info.st_mode)) {
 	cp = gettext("Enter new location for file: ");
     } else {
@@ -1244,6 +1252,7 @@ PRIVATE int permit_location ARGS3(
     char *cp;
     char tmpdst[LY_MAXPATH];
     struct stat dir_info;
+    CONST char *program;
 
     if (srcpath) {
 	/*
@@ -1451,11 +1460,10 @@ PRIVATE int permit_location ARGS3(
 	    cp = cr;
 	}
 
-#ifdef CHMOD_PATH
 	/*
 	 *  Call chmod().
 	 */
-	{
+	if ((program = HTGetProgramPath(ppCHMOD)) != NULL) {
 	    char *args[5];
 	    char amode[10];
 	    char *tmpbuf = NULL;
@@ -1466,16 +1474,15 @@ PRIVATE int permit_location ARGS3(
 	    args[1] = amode;
 	    args[2] = destpath;
 	    args[3] = (char *) 0;
-	    if (LYExecv(CHMOD_PATH, args, tmpbuf) <= 0) {
+	    if (LYExecv(program, args, tmpbuf) <= 0) {
 		FREE(tmpbuf);
 		return (-1);
 	    }
 	    FREE(tmpbuf);
+	} else {
+	    if (chmod(destpath, new_mode) < 0)
+		return (-1);
 	}
-#else
-	if (chmod(destpath, new_mode) < 0)
-	    return (-1);
-#endif /* UNIX */
 	LYforce_no_cache = TRUE;	/* Force update of dired listing. */
 	return 1;
     }
@@ -1615,121 +1622,135 @@ PRIVATE char *build_command ARGS3(
 	char *,		arg)
 {
     char *buffer = NULL;
+    CONST char *program;
+    CONST char *tar_path = HTGetProgramPath(ppTAR);
 
-#ifdef UNCOMPRESS_PATH
     if ((arg = match_op("DECOMPRESS", line)) != 0) {
 #define FMT_UNCOMPRESS "%s %s"
-	HTAddParam(&buffer, FMT_UNCOMPRESS, 1, UNCOMPRESS_PATH);
-	HTAddParam(&buffer, FMT_UNCOMPRESS, 2, arg);
-	HTEndParam(&buffer, FMT_UNCOMPRESS, 2);
+	if ((program = HTGetProgramPath(ppUNCOMPRESS)) != NULL) {
+	    HTAddParam(&buffer, FMT_UNCOMPRESS, 1, program);
+	    HTAddParam(&buffer, FMT_UNCOMPRESS, 2, arg);
+	    HTEndParam(&buffer, FMT_UNCOMPRESS, 2);
+	}
 	return buffer;
     }
-#endif /* UNCOMPRESS_PATH */
 
 #if defined(OK_UUDECODE) && !defined(ARCHIVE_ONLY)
     if ((arg = match_op("UUDECODE", line)) != 0) {
 #define FMT_UUDECODE "%s %s"
-	HTAddParam(&buffer, FMT_UUDECODE, 1, UUDECODE_PATH);
-	HTAddParam(&buffer, FMT_UUDECODE, 2, arg);
-	HTEndParam(&buffer, FMT_UUDECODE, 2);
-	HTAlert(gettext("Warning!  UUDecoded file will exist in the directory you started Lynx."));
+	if ((program = HTGetProgramPath(ppUUDECODE)) != NULL) {
+	    HTAddParam(&buffer, FMT_UUDECODE, 1, program);
+	    HTAddParam(&buffer, FMT_UUDECODE, 2, arg);
+	    HTEndParam(&buffer, FMT_UUDECODE, 2);
+	    HTAlert(gettext("Warning!  UUDecoded file will exist in the directory you started Lynx."));
+	}
 	return buffer;
     }
 #endif /* OK_UUDECODE && !ARCHIVE_ONLY */
 
 #ifdef OK_TAR
+    if (tar_path != NULL) {
 # ifndef ARCHIVE_ONLY
 #  ifdef OK_GZIP
-    if ((arg = match_op("UNTAR_GZ", line)) != 0) {
+	if ((arg = match_op("UNTAR_GZ", line)) != 0) {
 #define FMT_UNTAR_GZ "cd %s; %s -qdc %s |  %s -xf -"
-	dirname = DirectoryOf(arg);
-	HTAddParam(&buffer, FMT_UNTAR_GZ, 1, dirname);
-	HTAddParam(&buffer, FMT_UNTAR_GZ, 2, GZIP_PATH);
-	HTAddParam(&buffer, FMT_UNTAR_GZ, 3, arg);
-	HTAddParam(&buffer, FMT_UNTAR_GZ, 4, TAR_PATH);
-	HTEndParam(&buffer, FMT_UNTAR_GZ, 4);
-	return buffer;
-    }
+	    if ((program = HTGetProgramPath(ppGZIP)) != NULL) {
+		dirname = DirectoryOf(arg);
+		HTAddParam(&buffer, FMT_UNTAR_GZ, 1, dirname);
+		HTAddParam(&buffer, FMT_UNTAR_GZ, 2, program);
+		HTAddParam(&buffer, FMT_UNTAR_GZ, 3, arg);
+		HTAddParam(&buffer, FMT_UNTAR_GZ, 4, tar_path);
+		HTEndParam(&buffer, FMT_UNTAR_GZ, 4);
+	    }
+	    return buffer;
+	}
 #  endif /* OK_GZIP */
-#  ifdef ZCAT_PATH
-    if ((arg = match_op("UNTAR_Z", line)) != 0) {
+	if ((arg = match_op("UNTAR_Z", line)) != 0) {
 #define FMT_UNTAR_Z "cd %s; %s %s |  %s -xf -"
-	dirname = DirectoryOf(arg);
-	HTAddParam(&buffer, FMT_UNTAR_Z, 1, dirname);
-	HTAddParam(&buffer, FMT_UNTAR_Z, 2, ZCAT_PATH);
-	HTAddParam(&buffer, FMT_UNTAR_Z, 3, arg);
-	HTAddParam(&buffer, FMT_UNTAR_Z, 4, TAR_PATH);
-	HTEndParam(&buffer, FMT_UNTAR_Z, 4);
-	return buffer;
-    }
-#   endif /* ZCAT_PATH */
-    if ((arg = match_op("UNTAR", line)) != 0) {
+	    if ((program = HTGetProgramPath(ppZCAT)) != NULL) {
+		dirname = DirectoryOf(arg);
+		HTAddParam(&buffer, FMT_UNTAR_Z, 1, dirname);
+		HTAddParam(&buffer, FMT_UNTAR_Z, 2, program);
+		HTAddParam(&buffer, FMT_UNTAR_Z, 3, arg);
+		HTAddParam(&buffer, FMT_UNTAR_Z, 4, tar_path);
+		HTEndParam(&buffer, FMT_UNTAR_Z, 4);
+	    }
+	    return buffer;
+	}
+	if ((arg = match_op("UNTAR", line)) != 0) {
 #define FMT_UNTAR "cd %s; %s -xf %s"
-	dirname = DirectoryOf(arg);
-	HTAddParam(&buffer, FMT_UNTAR, 1, dirname);
-	HTAddParam(&buffer, FMT_UNTAR, 2, TAR_PATH);
-	HTAddParam(&buffer, FMT_UNTAR, 3, arg);
-	HTEndParam(&buffer, FMT_UNTAR, 3);
-	return buffer;
-    }
+	    dirname = DirectoryOf(arg);
+	    HTAddParam(&buffer, FMT_UNTAR, 1, dirname);
+	    HTAddParam(&buffer, FMT_UNTAR, 2, tar_path);
+	    HTAddParam(&buffer, FMT_UNTAR, 3, arg);
+	    HTEndParam(&buffer, FMT_UNTAR, 3);
+	    return buffer;
+	}
 # endif /* !ARCHIVE_ONLY */
 
 # ifdef OK_GZIP
-    if ((arg = match_op("TAR_GZ", line)) != 0) {
+	if ((arg = match_op("TAR_GZ", line)) != 0) {
 #define FMT_TAR_GZ "cd %s; %s -cf - %s | %s -qc >%s%s"
-	dirname = DirectoryOf(arg);
-	HTAddParam(&buffer, FMT_TAR_GZ, 1, dirname);
-	HTAddParam(&buffer, FMT_TAR_GZ, 2, TAR_PATH);
-	HTAddParam(&buffer, FMT_TAR_GZ, 3, LYPathLeaf(arg));
-	HTAddParam(&buffer, FMT_TAR_GZ, 4, GZIP_PATH);
-	HTAddParam(&buffer, FMT_TAR_GZ, 5, LYonedot(LYPathLeaf(arg)));
-	HTAddParam(&buffer, FMT_TAR_GZ, 6, EXT_TAR_GZ);
-	HTEndParam(&buffer, FMT_TAR_GZ, 6);
-	return buffer;
-    }
+	    if ((program = HTGetProgramPath(ppGZIP)) != NULL) {
+		dirname = DirectoryOf(arg);
+		HTAddParam(&buffer, FMT_TAR_GZ, 1, dirname);
+		HTAddParam(&buffer, FMT_TAR_GZ, 2, tar_path);
+		HTAddParam(&buffer, FMT_TAR_GZ, 3, LYPathLeaf(arg));
+		HTAddParam(&buffer, FMT_TAR_GZ, 4, program);
+		HTAddParam(&buffer, FMT_TAR_GZ, 5, LYonedot(LYPathLeaf(arg)));
+		HTAddParam(&buffer, FMT_TAR_GZ, 6, EXT_TAR_GZ);
+		HTEndParam(&buffer, FMT_TAR_GZ, 6);
+	    }
+	    return buffer;
+	}
 # endif /* OK_GZIP */
 
-# ifdef COMPRESS_PATH
-    if ((arg = match_op("TAR_Z", line)) != 0) {
+	if ((arg = match_op("TAR_Z", line)) != 0) {
 #define FMT_TAR_Z "cd %s; %s -cf - %s | %s >%s%s"
-	dirname = DirectoryOf(arg);
-	HTAddParam(&buffer, FMT_TAR_Z, 1, dirname);
-	HTAddParam(&buffer, FMT_TAR_Z, 2, TAR_PATH);
-	HTAddParam(&buffer, FMT_TAR_Z, 3, LYPathLeaf(arg));
-	HTAddParam(&buffer, FMT_TAR_Z, 4, COMPRESS_PATH);
-	HTAddParam(&buffer, FMT_TAR_Z, 5, LYonedot(LYPathLeaf(arg)));
-	HTAddParam(&buffer, FMT_TAR_Z, 6, EXT_TAR_Z);
-	HTEndParam(&buffer, FMT_TAR_Z, 6);
-	return buffer;
-    }
-# endif /* COMPRESS_PATH */
+	    if ((program = HTGetProgramPath(ppCOMPRESS)) != NULL) {
+		dirname = DirectoryOf(arg);
+		HTAddParam(&buffer, FMT_TAR_Z, 1, dirname);
+		HTAddParam(&buffer, FMT_TAR_Z, 2, tar_path);
+		HTAddParam(&buffer, FMT_TAR_Z, 3, LYPathLeaf(arg));
+		HTAddParam(&buffer, FMT_TAR_Z, 4, program);
+		HTAddParam(&buffer, FMT_TAR_Z, 5, LYonedot(LYPathLeaf(arg)));
+		HTAddParam(&buffer, FMT_TAR_Z, 6, EXT_TAR_Z);
+		HTEndParam(&buffer, FMT_TAR_Z, 6);
+	    }
+	    return buffer;
+	}
 
-    if ((arg = match_op("TAR", line)) != 0) {
+	if ((arg = match_op("TAR", line)) != 0) {
 #define FMT_TAR "cd %s; %s -cf %s.tar %s"
-	dirname = DirectoryOf(arg);
-	HTAddParam(&buffer, FMT_TAR, 1, dirname);
-	HTAddParam(&buffer, FMT_TAR, 2, TAR_PATH);
-	HTAddParam(&buffer, FMT_TAR, 3, LYonedot(LYPathLeaf(arg)));
-	HTAddParam(&buffer, FMT_TAR, 4, LYPathLeaf(arg));
-	HTEndParam(&buffer, FMT_TAR, 4);
-	return buffer;
+	    dirname = DirectoryOf(arg);
+	    HTAddParam(&buffer, FMT_TAR, 1, dirname);
+	    HTAddParam(&buffer, FMT_TAR, 2, tar_path);
+	    HTAddParam(&buffer, FMT_TAR, 3, LYonedot(LYPathLeaf(arg)));
+	    HTAddParam(&buffer, FMT_TAR, 4, LYPathLeaf(arg));
+	    HTEndParam(&buffer, FMT_TAR, 4);
+	    return buffer;
+	}
     }
 #endif /* OK_TAR */
 
 #ifdef OK_GZIP
     if ((arg = match_op("GZIP", line)) != 0) {
 #define FMT_GZIP "%s -q %s"
-	HTAddParam(&buffer, FMT_GZIP, 1, GZIP_PATH);
-	HTAddParam(&buffer, FMT_GZIP, 2, arg);
-	HTEndParam(&buffer, FMT_GZIP, 2);
+	if ((program = HTGetProgramPath(ppGZIP)) != NULL) {
+	    HTAddParam(&buffer, FMT_GZIP, 1, program);
+	    HTAddParam(&buffer, FMT_GZIP, 2, arg);
+	    HTEndParam(&buffer, FMT_GZIP, 2);
+	}
 	return buffer;
     }
 #ifndef ARCHIVE_ONLY
     if ((arg = match_op("UNGZIP", line)) != 0) {
 #define FMT_UNGZIP "%s -d %s"
-	HTAddParam(&buffer, FMT_UNGZIP, 1, GZIP_PATH);
-	HTAddParam(&buffer, FMT_UNGZIP, 2, arg);
-	HTEndParam(&buffer, FMT_UNGZIP, 2);
+	if ((program = HTGetProgramPath(ppGZIP)) != NULL) {
+	    HTAddParam(&buffer, FMT_UNGZIP, 1, program);
+	    HTAddParam(&buffer, FMT_UNGZIP, 2, arg);
+	    HTEndParam(&buffer, FMT_UNGZIP, 2);
+	}
 	return buffer;
     }
 #endif /* !ARCHIVE_ONLY */
@@ -1738,36 +1759,40 @@ PRIVATE char *build_command ARGS3(
 #ifdef OK_ZIP
     if ((arg = match_op("ZIP", line)) != 0) {
 #define FMT_ZIP "cd %s; %s -rq %s.zip %s"
-	dirname = DirectoryOf(arg);
-	HTAddParam(&buffer, FMT_ZIP, 1, dirname);
-	HTAddParam(&buffer, FMT_ZIP, 2, ZIP_PATH);
-	HTAddParam(&buffer, FMT_ZIP, 3, LYonedot(LYPathLeaf(arg)));
-	HTAddParam(&buffer, FMT_ZIP, 4, LYPathLeaf(arg));
-	HTEndParam(&buffer, FMT_ZIP, 4);
+	if ((program = HTGetProgramPath(ppZIP)) != NULL) {
+	    dirname = DirectoryOf(arg);
+	    HTAddParam(&buffer, FMT_ZIP, 1, dirname);
+	    HTAddParam(&buffer, FMT_ZIP, 2, program);
+	    HTAddParam(&buffer, FMT_ZIP, 3, LYonedot(LYPathLeaf(arg)));
+	    HTAddParam(&buffer, FMT_ZIP, 4, LYPathLeaf(arg));
+	    HTEndParam(&buffer, FMT_ZIP, 4);
+	}
 	return buffer;
     }
-#if !defined(ARCHIVE_ONLY) && defined(UNZIP_PATH)
+#if !defined(ARCHIVE_ONLY)
     if ((arg = match_op("UNZIP", line)) != 0) {
 #define FMT_UNZIP "cd %s; %s -q %s"
-	dirname = DirectoryOf(arg);
-	HTAddParam(&buffer, FMT_UNZIP, 1, dirname);
-	HTAddParam(&buffer, FMT_UNZIP, 2, UNZIP_PATH);
-	HTAddParam(&buffer, FMT_UNZIP, 3, arg);
-	HTEndParam(&buffer, FMT_UNZIP, 3);
+	if ((program = HTGetProgramPath(ppUNZIP)) != NULL) {
+	    dirname = DirectoryOf(arg);
+	    HTAddParam(&buffer, FMT_UNZIP, 1, dirname);
+	    HTAddParam(&buffer, FMT_UNZIP, 2, program);
+	    HTAddParam(&buffer, FMT_UNZIP, 3, arg);
+	    HTEndParam(&buffer, FMT_UNZIP, 3);
+	}
 	return buffer;
     }
 # endif /* !ARCHIVE_ONLY */
 #endif /* OK_ZIP */
 
-#ifdef COMPRESS_PATH
     if ((arg = match_op("COMPRESS", line)) != 0) {
 #define FMT_COMPRESS "%s %s"
-	HTAddParam(&buffer, FMT_COMPRESS, 1, COMPRESS_PATH);
-	HTAddParam(&buffer, FMT_COMPRESS, 2, arg);
-	HTEndParam(&buffer, FMT_COMPRESS, 2);
+	if ((program = HTGetProgramPath(ppCOMPRESS)) != NULL) {
+	    HTAddParam(&buffer, FMT_COMPRESS, 1, program);
+	    HTAddParam(&buffer, FMT_COMPRESS, 2, arg);
+	    HTEndParam(&buffer, FMT_COMPRESS, 2);
+	}
 	return buffer;
     }
-#endif /* COMPRESS_PATH */
 
     return NULL;
 }
@@ -2185,6 +2210,12 @@ PUBLIC BOOLEAN local_install ARGS3(
     int count = 0;
     int n = 0;		/* indices into 'args[]' */
     static int src = -1;
+    CONST char *program;
+
+    if ((program = HTGetProgramPath(ppINSTALL)) == NULL) {
+	HTAlert(gettext("Install in the selected directory not permitted."));
+	return 0;
+    }
 
     /*
      *	Determine the status of the selected item.
@@ -2291,7 +2322,7 @@ PUBLIC BOOLEAN local_install ARGS3(
 	}
 	args[src] = savepath;
 	HTSprintf0(&tmpbuf, "install %s in %s", savepath, destpath);
-	if (LYExecv(INSTALL_PATH, args, tmpbuf) <= 0) {
+	if (LYExecv(program, args, tmpbuf) <= 0) {
 	    FREE(tmpbuf);
 	    FREE(tmpdest);
 	    return (-1);
@@ -2318,7 +2349,7 @@ PUBLIC BOOLEAN local_install ARGS3(
 		FREE(args[src]);
 		continue;	/* skip this source file */
 	    }
-	    err = (LYExecv(INSTALL_PATH, args, tmpbuf) <= 0);
+	    err = (LYExecv(program, args, tmpbuf) <= 0);
 	    FREE(args[src]);
 	    if (err) {
 		FREE(tmpbuf);
diff --git a/src/LYMail.c b/src/LYMail.c
index 5a0f3eac..7e8731cb 100644
--- a/src/LYMail.c
+++ b/src/LYMail.c
@@ -15,8 +15,6 @@
 #include <LYLeaks.h>
 
 #define MAX_SUBJECT 70
-#define EMPTY(s) ((s) == 0 || *(s) == 0)
-#define NIL_OK(s) (((s) != 0) ? (s) : "<nil>")
 
 BOOLEAN term_letter;	/* Global variable for async i/o. */
 
@@ -76,7 +74,7 @@ PRIVATE void comma_append ARGS2(
 	while (*src == ',' || isspace(UCH(*src)))
 	    src++;
 	if (*src) {
-	    if (EMPTY(*dst)) {
+	    if (isEmpty(*dst)) {
 		StrAllocCopy(*dst, src);
 	    } else {
 		StrAllocCat(*dst, ",");
@@ -113,7 +111,7 @@ PRIVATE void extract_field ARGS3(
 	}
 	cp++;
     }
-    CTRACE((tfp, "extract_field(%s) = '%s'\n", keyword, NIL_OK(*dst)));
+    CTRACE((tfp, "extract_field(%s) = '%s'\n", keyword, NONNULL(*dst)));
 }
 
 /*
@@ -149,7 +147,7 @@ PRIVATE void extract_subject ARGS2(
 	    cp1 = NULL;
 	}
     }
-    CTRACE((tfp, "extract_subject(%s) = '%s'\n", keyword, NIL_OK(dst)));
+    CTRACE((tfp, "extract_subject(%s) = '%s'\n", keyword, NONNULL(dst)));
 }
 
 /*
@@ -219,7 +217,7 @@ PRIVATE void extract_body ARGS2(
 	}
 	cp++;
     }
-    CTRACE((tfp, "extract_body(%s) = '%s'\n", keyword, NIL_OK(*dst)));
+    CTRACE((tfp, "extract_body(%s) = '%s'\n", keyword, NONNULL(*dst)));
 }
 
 /*
@@ -376,10 +374,10 @@ PRIVATE char *blat_cmd(
     fprintf(fp, "-t\n%s\n", address);
     if (subject)
 	fprintf(fp, "-s\n%s\n", subject);
-    if (!EMPTY(mail_addr)) {
+    if (!isEmpty(mail_addr)) {
 	fprintf(fp, "-f\n%s\n", mail_addr);
     }
-    if (!EMPTY(ccaddr)) {
+    if (!isEmpty(ccaddr)) {
 	fprintf(fp, "-c\n%s\n", ccaddr);
     }
     LYCloseOutput(fp);
@@ -570,10 +568,10 @@ PUBLIC void mailform ARGS4(
 #endif
 
     CTRACE((tfp, "mailform(\"%s\", \"%s\", \"%s\", \"%s\")\n",
-	NIL_OK(mailto_address),
-	NIL_OK(mailto_subject),
-	NIL_OK(mailto_content),
-	NIL_OK(mailto_type)));
+	NONNULL(mailto_address),
+	NONNULL(mailto_subject),
+	NONNULL(mailto_content),
+	NONNULL(mailto_type)));
 
     if (!mailto_address || !mailto_content) {
 	HTAlert(BAD_FORM_MAILTO);
@@ -650,8 +648,8 @@ PUBLIC void mailform ARGS4(
     /*
      *	Allow user to edit the default Subject - FM
      */
-    if (EMPTY(subject)) {
-	if (!EMPTY(mailto_subject)) {
+    if (isEmpty(subject)) {
+	if (!isEmpty(mailto_subject)) {
 	    LYstrncpy(subject, mailto_subject, MAX_SUBJECT);
 	} else {
 	    sprintf(subject, "mailto:%.63s", address);
@@ -672,7 +670,7 @@ PUBLIC void mailform ARGS4(
      */
     if (!LYNoCc) {
 	sprintf(self, "%.*s", MAX_SUBJECT,
-		EMPTY(personal_mail_address) ? "" : personal_mail_address);
+		isEmpty(personal_mail_address) ? "" : personal_mail_address);
 	_statusline("Cc: ");
 	if ((ch = LYgetstr(self, VISIBLE, MAX_SUBJECT, NORECALL)) < 0) {
 	    /*
@@ -696,17 +694,17 @@ PUBLIC void mailform ARGS4(
 	goto cleanup;
     }
 
-    if (!EMPTY(mailto_type)) {
+    if (!isEmpty(mailto_type)) {
 	fprintf(fd, "Mime-Version: 1.0\n");
 	fprintf(fd, "Content-Type: %s\n", mailto_type);
     }
     fprintf(fd, "To: %s\n", address);
-    if (!EMPTY(personal_mail_address))
+    if (!isEmpty(personal_mail_address))
 	fprintf(fd, "From: %s\n", personal_mail_address);
-    if (!EMPTY(ccaddr))
+    if (!isEmpty(ccaddr))
 	fprintf(fd, "Cc: %s\n", ccaddr);
     fprintf(fd, "Subject: %s\n\n", subject);
-    if (!EMPTY(keywords))
+    if (!isEmpty(keywords))
 	fprintf(fd, "Keywords: %s\n", keywords);
     _statusline(SENDING_FORM_CONTENT);
 #else	/* e.g., VMS, DOS */
@@ -722,17 +720,17 @@ PUBLIC void mailform ARGS4(
 	    LYCloseTempFP(fd);
 	    goto cleanup;
 	}
-	if (!EMPTY(mailto_type)) {
+	if (!isEmpty(mailto_type)) {
 	    fprintf(hfd, "Mime-Version: 1.0\n");
 	    fprintf(hfd, "Content-Type: %s\n", mailto_type);
-	    if (!EMPTY(personal_mail_address))
+	    if (!isEmpty(personal_mail_address))
 		fprintf(hfd, "From: %s\n", personal_mail_address);
 	}
 	/*
 	 *  For PMDF, put any keywords and the subject
 	 *  in the header file and close it. - FM
 	 */
-	if (!EMPTY(keywords)) {
+	if (!isEmpty(keywords)) {
 	    fprintf(hfd, "Keywords: %s\n", keywords);
 	}
 	fprintf(hfd, "Subject: %s\n\n", subject);
@@ -754,12 +752,12 @@ PUBLIC void mailform ARGS4(
     } else
 #endif
     {
-	if (!EMPTY(mailto_type)) {
+	if (!isEmpty(mailto_type)) {
 	    fprintf(fd, "Mime-Version: 1.0\n");
 	    fprintf(fd, "Content-Type: %s\n", mailto_type);
 	}
 	fprintf(fd,"To: %s\n", address);
-	if (!EMPTY(personal_mail_address))
+	if (!isEmpty(personal_mail_address))
 	    fprintf(fd,"From: %s\n", personal_mail_address);
 	fprintf(fd,"Subject: %.70s\n\n", subject);
     }
@@ -835,7 +833,7 @@ PUBLIC void mailform ARGS4(
     StrAllocCopy(command, cmd);
 
     vms_append_addrs(&command, address, "");
-    if (!EMPTY(ccaddr)) {
+    if (!isEmpty(ccaddr)) {
 	vms_append_addrs(&command, ccaddr, "/CC");
     }
 
@@ -894,9 +892,9 @@ PUBLIC void mailmsg ARGS4(
     char *command = NULL;
 
     CTRACE((tfp, "mailmsg(%d, \"%s\", \"%s\", \"%s\")\n", cur,
-	NIL_OK(owner_address),
-	NIL_OK(filename),
-	NIL_OK(linkname)));
+	NONNULL(owner_address),
+	NONNULL(filename),
+	NONNULL(linkname)));
 
 #endif /* VMS */
 
@@ -975,7 +973,7 @@ PUBLIC void mailmsg ARGS4(
 
     fprintf(fd, "To: %s\n", address);
     fprintf(fd, "Subject: Lynx Error in %s\n", filename);
-    if (!EMPTY(personal_mail_address)) {
+    if (!isEmpty(personal_mail_address)) {
 	fprintf(fd, "Cc: %s\n", personal_mail_address);
     }
     fprintf(fd, "X-URL: %s\n", filename);
@@ -997,7 +995,7 @@ PUBLIC void mailmsg ARGS4(
 	    return;
 	}
 
-	if (!EMPTY(personal_mail_address)) {
+	if (!isEmpty(personal_mail_address)) {
 	    fprintf(fd, "Cc: %s\n", personal_mail_address);
 	}
 	fprintf(fd, "X-URL: %s\n", filename);
@@ -1122,9 +1120,9 @@ PUBLIC void reply_by_mail ARGS4(
     int i;
     int c = 0;	/* user input */
     char my_tmpfile[LY_MAXPATH];
-    char *command = NULL;
     char default_subject[MAX_SUBJECT + 10];
 #if USE_VMS_MAILER
+    char *command = NULL;
     BOOLEAN isPMDF = LYMailPMDF();
     char hdrfile[LY_MAXPATH];
     FILE *hfd = 0;
@@ -1138,14 +1136,14 @@ PUBLIC void reply_by_mail ARGS4(
 #endif /* USE_VMS_MAILER */
 
     CTRACE((tfp, "reply_by_mail(\"%s\", \"%s\", \"%s\", \"%s\")\n",
-	NIL_OK(mail_address),
-	NIL_OK(filename),
-	NIL_OK(title),
-	NIL_OK(refid)));
+	NONNULL(mail_address),
+	NONNULL(filename),
+	NONNULL(title),
+	NONNULL(refid)));
 
     term_letter = FALSE;
 
-    if (EMPTY(mail_address)) {
+    if (isEmpty(mail_address)) {
 	HTAlert(NO_ADDRESS_IN_MAILTO_URL);
 	return;
     }
@@ -1234,7 +1232,7 @@ PUBLIC void reply_by_mail ARGS4(
     /*
      *	Set the default subject. - FM
      */
-    if (EMPTY(default_subject) && !EMPTY(title)) {
+    if (isEmpty(default_subject) && !isEmpty(title)) {
 	strncpy(default_subject, title, MAX_SUBJECT);
 	default_subject[MAX_SUBJECT] = '\0';
     }
@@ -1253,8 +1251,8 @@ PUBLIC void reply_by_mail ARGS4(
 	 */
 	fprintf((isPMDF ? hfd : fd),
 		"X-URL: %s%s\n",
-		EMPTY(filename) ? STR_MAILTO_URL : filename,
-		EMPTY(filename) ? to_address : "");
+		isEmpty(filename) ? STR_MAILTO_URL : filename,
+		isEmpty(filename) ? to_address : "");
 	fprintf((isPMDF ? hfd : fd),
 		"X-Mailer: %s, Version %s\n", LYNX_NAME, LYNX_VERSION);
 #ifdef NO_ANONYMOUS_EMAIL
@@ -1297,14 +1295,14 @@ PUBLIC void reply_by_mail ARGS4(
     /*
      *	Put the X-URL and X-Mailer lines in the header.
      */
-    if (!EMPTY(filename)) {
+    if (!isEmpty(filename)) {
 	HTSprintf(&header, "X-URL: %s\n", filename);
     } else {
 	HTSprintf(&header, "X-URL: mailto:%s\n", to_address);
     }
     HTSprintf(&header, "X-Mailer: %s, Version %s\n", LYNX_NAME, LYNX_VERSION);
 
-    if (!EMPTY(refid)) {
+    if (!isEmpty(refid)) {
 	HTSprintf(&header, "In-Reply-To: <%s>\n", refid);
     }
 #endif /* VMS */
@@ -1405,7 +1403,7 @@ PUBLIC void reply_by_mail ARGS4(
     label = "Subject";
     if (*default_subject) {
 	StrAllocCopy(the_subject, default_subject);
-    } else if (!EMPTY(filename)) {
+    } else if (!isEmpty(filename)) {
 	HTSprintf(&the_subject, "%s", filename);
     } else {
 	HTSprintf(&the_subject, "mailto:%s", to_address);
@@ -1439,14 +1437,14 @@ PUBLIC void reply_by_mail ARGS4(
     /*
     **	Add the Cc: header. - FM
     */
-    if (!EMPTY(ccaddr)) {
+    if (!isEmpty(ccaddr)) {
 	HTSprintf(&header, "Cc: %s\n", ccaddr);
     }
 
     /*
     **	Add the Keywords: header. - FM
     */
-    if (!EMPTY(keywords)) {
+    if (!isEmpty(keywords)) {
 	HTSprintf(&header, "Keywords: %s\n", keywords);
     }
 
@@ -1457,7 +1455,7 @@ PUBLIC void reply_by_mail ARGS4(
     CTRACE((tfp,"**header==\n%s",header));
 #endif /* !VMS */
 
-    if (!no_editor && !EMPTY(editor)) {
+    if (!no_editor && !isEmpty(editor)) {
 
 	if (body) {
 	    cp1 = body;
@@ -1609,7 +1607,7 @@ PUBLIC void reply_by_mail ARGS4(
 	 *  For PMDF, put any keywords and the subject
 	 *  in the header file and close it. - FM
 	 */
-	if (!EMPTY(keywords)) {
+	if (!isEmpty(keywords)) {
 	    fprintf(hfd, "Keywords: %s\n", keywords);
 	}
 	fprintf(hfd, "Subject: %s\n\n", the_subject);
@@ -1638,7 +1636,7 @@ PUBLIC void reply_by_mail ARGS4(
     }
 
     vms_append_addrs(&command, to_address, "");
-    if (!EMPTY(ccaddr)) {
+    if (!isEmpty(ccaddr)) {
 	vms_append_addrs(&command, ccaddr, "/CC");
     }
 
@@ -1658,7 +1656,6 @@ PUBLIC void reply_by_mail ARGS4(
     if ((fp = LYPipeToMailer()) == 0) {
 	HTInfoMsg(CANCELLED);
     }
-    FREE(command);
 #else
     if ((fp = LYOpenTemp(tmpfile2, ".txt", "w")) == NULL) {
 	HTAlert(MAILTO_URL_TEMPOPEN_FAILED);
@@ -1713,7 +1710,6 @@ cleanup:
     term_letter = FALSE;
 
 #if USE_VMS_MAILER
-    FREE(command);
     while (LYRemoveTemp(my_tmpfile) == 0)
 	;		 /* Delete the tmpfile(s). */
     if (isPMDF) {
diff --git a/src/LYMain.c b/src/LYMain.c
index 5dfa4cb3..d59787ed 100644
--- a/src/LYMain.c
+++ b/src/LYMain.c
@@ -96,10 +96,6 @@ PUBLIC char *syslog_txt = NULL;		/* syslog arb text for session */
 #endif /* SYSLOG_REQUESTED_URLS */
 #endif /* !VMS */
 
-#ifdef VMS
-PUBLIC char *LYCSwingPath = NULL;
-#endif /* VMS */
-
 #ifdef DIRED_SUPPORT
 PUBLIC BOOLEAN lynx_edit_mode = FALSE;
 PUBLIC BOOLEAN no_dired_support = FALSE;
@@ -530,8 +526,7 @@ PUBLIC int LYNoZapKey = 0; /* 0: off (do z checking), 1: full, 2: initially */
 #endif
 
 #ifndef DISABLE_NEWS
-extern int HTNewsChunkSize; /* Number of news articles per chunk (HTNews.c) */
-extern int HTNewsMaxChunk;  /* Max news articles before chunking (HTNews.c) */
+#include <HTNews.h>
 #endif
 
 PUBLIC BOOLEAN FileInitAlreadyDone = FALSE;
@@ -633,8 +628,10 @@ PRIVATE void free_lynx_globals NOARGS
 
 #ifdef VMS
     Define_VMSLogical("LYNX_VERSION", "");
-    FREE(LYCSwingPath);
 #endif /* VMS */
+#ifndef VMS
+    FREE(lynx_version_putenv_command);
+#endif
 
 #if USE_VMS_MAILER
     FREE(mail_adrs);
@@ -1013,7 +1010,7 @@ PUBLIC int main ARGS2(
     /* Set the text message domain.  */
 #if defined(HAVE_LIBINTL_H) || defined(HAVE_LIBGETTEXT_H)
 #ifndef __DJGPP__
-    if ((cp = LYGetEnv("LYNX_LOCALDIR")) == 0)
+    if ((cp = LYGetEnv("LYNX_LOCALEDIR")) == 0)
 	cp = LOCALEDIR;
     bindtextdomain ("lynx", cp);
 #endif /* !__DJGPP__ */
@@ -1169,12 +1166,6 @@ PUBLIC int main ARGS2(
 	exit_immediately(EXIT_FAILURE);
     }
 
-#ifdef VMS
-#ifdef CSWING_PATH
-    StrAllocCopy(LYCSwingPath, CSWING_PATH);
-#endif /* CSWING_PATH */
-#endif /* VMS */
-
 #if USE_VMS_MAILER
 #ifndef MAIL_ADRS
 #define MAIL_ADRS "\"IN%%\"\"%s\"\"\""
diff --git a/src/LYMainLoop.c b/src/LYMainLoop.c
index 6e75a691..95054600 100644
--- a/src/LYMainLoop.c
+++ b/src/LYMainLoop.c
@@ -158,6 +158,9 @@ PRIVATE int str_n_cmp(const char *p, const char *q, int n)
 #include <LYexit.h>
 #include <LYLeaks.h>
 
+/* two constants: */
+PUBLIC HTLinkType * HTInternalLink = 0;
+PUBLIC HTAtom * WWW_SOURCE = 0;
 
 #ifndef DONT_TRACK_INTERNAL_LINKS
 #define NO_INTERNAL_OR_DIFFERENT(c,n) TRUE
@@ -471,13 +474,22 @@ PRIVATE void move_address ARGS2(
 /*
  * This is for traversal call from within partial mode in LYUtils.c
  * and HTFormat.c  It simply calls HText_pageDisplay() but utilizes
- * LYMainLoop.c PRIVATE variables.
- * Perhaps, this could adhere more logic from mainloop(), in the future.
+ * LYMainLoop.c PRIVATE variables to manage proper newline position
+ * in case of #fragment
  */
-PUBLIC void LYMainLoop_pageDisplay ARGS1(
+PUBLIC BOOL LYMainLoop_pageDisplay ARGS1(
 	int,		line_num)
 {
 #ifdef DISP_PARTIAL
+    CONST char * pound;
+    int prev_newline = Newline;
+
+    /*
+     *  Override Newline with a new value if user
+     *  scrolled the document while loading (in LYUtils.c).
+     */
+    Newline = line_num;
+
 #ifdef SOURCE_CACHE
     /*
      * reparse_document() acts on 'curdoc' which always on top of the
@@ -487,29 +499,30 @@ PUBLIC void LYMainLoop_pageDisplay ARGS1(
      */
     if (!from_source_cache)
 #endif
-    /*
-     * Disable display_partial if requested URL has #fragment and we are not
-     * popped from the history stack so can't calculate correct newline
-     * position for fragment.  Otherwise user got the new document from the
-     * first page and was moved to #fragment later after download completed,
-     * but only if s/he did not mess screen up by scrolling before...  So fall
-     * down to old behavior here ... until we rewrite HTFindPoundSelector()
-     */
-    if (display_partial
-     && newdoc.line == 1
-     && findPoundSelector(newdoc.address)) {
-	display_partial = FALSE; /* restrict for this document */
-	return;			/* no repaint */
-    }
-
-    /*
-     *  Override Newline with a new value if user
-     *  scrolled the document while loading (in LYUtils.c).
-     */
+	/*
+	 * If the requested URL has the #fragment, and we are not popped
+	 * from the history stack, and have not scrolled the document yet -
+	 * we should calculate correct newline position for the fragment.
+	 * (This is a bit suboptimal since HTFindPoundSelector() traverse
+	 * anchors list each time, so we have a quadratic complexity
+	 * and may load CPU in a worst case).
+	 */
+	if (display_partial
+	    && newdoc.line == 1 && line_num == 1 && prev_newline == 1
+	    && (pound = findPoundSelector(newdoc.address))
+	    && *pound && *(pound+1)) {
+	    if (HTFindPoundSelector(pound+1)) {
+		/* HTFindPoundSelector will initialize www_search_result */
+		Newline = www_search_result;
+	    } else {
+		Newline = prev_newline; /* restore ??? */
+		return NO;	/* no repaint */
+	    }
+	}
 #endif /* DISP_PARTIAL */
-    Newline = line_num;
 
     HText_pageDisplay(Newline, prev_target);
+    return YES;
 }
 
 
@@ -1848,18 +1861,19 @@ PRIVATE void handle_LYK_DIRED_MENU ARGS3(
 {
 #ifdef VMS
     char *cp, *temp = 0;
+    char *test = HTGetProgramPath(ppCSWING);
 
     /*
      *	Check if the CSwing Directory/File Manager is available.
-     *	Will be disabled if LYCSwingPath is NULL, zero-length,
+     *	Will be disabled if CSWING path is NULL, zero-length,
      *	or "none" (case insensitive), if no_file_url was set via
      *	the file_url restriction, if no_goto_file was set for
      *	the anonymous account, or if HTDirAccess was set to
      *	HT_DIR_FORBID or HT_DIR_SELECTIVE via the -nobrowse
      *	or -selective switches. - FM
      */
-    if (!(LYCSwingPath && *LYCSwingPath) ||
-	!strcasecomp(LYCSwingPath, "none") ||
+    if (isEmpty(test) ||
+	!strcasecomp(test, "none") ||
 	no_file_url || no_goto_file ||
 	HTDirAccess == HT_DIR_FORBID ||
 	HTDirAccess == HT_DIR_SELECTIVE) {
@@ -1893,7 +1907,7 @@ PRIVATE void handle_LYK_DIRED_MENU ARGS3(
 	if (HTStat(cp, &stat_info) == -1) {
 	    CTRACE((tfp, "mainloop: Can't stat %s\n", cp));
 	    FREE(cp);
-	    HTSprintf0(&temp, "%s []", LYCSwingPath);
+	    HTSprintf0(&temp, "%s []", HTGetProgramPath(ppCSWING));
 	    *refresh_screen = TRUE;  /* redisplay */
 	} else {
 	    char *VMSdir = NULL;
@@ -1921,7 +1935,7 @@ PRIVATE void handle_LYK_DIRED_MENU ARGS3(
 		    cp == NULL;
 		}
 	    }
-	    HTSprintf0(&temp, "%s %s", LYCSwingPath, VMSdir);
+	    HTSprintf0(&temp, "%s %s", HTGetProgramPath(ppCSWING), VMSdir);
 	    FREE(VMSdir);
 	    /*
 	     *	Uncache the current document in case we
@@ -1944,7 +1958,7 @@ PRIVATE void handle_LYK_DIRED_MENU ARGS3(
 	 *  an argument and don't uncache the current
 	 *  document. - FM
 	 */
-	HTSprintf0(&temp, "%s []", LYCSwingPath);
+	HTSprintf0(&temp, "%s []", HTGetProgramPath(ppCSWING));
 	*refresh_screen = TRUE;	/* redisplay */
     }
     stop_curses();
@@ -5234,6 +5248,16 @@ int mainloop NOARGS
     int i;
     int follow_col = -1, key_count = 0, last_key = 0;
 
+/*  "internal" means "within the same document, with certainty".
+ *  It includes a space so it cannot conflict with any (valid) "TYPE"
+ *  attributes on A elements. [According to which DTD, anyway??] - kw
+ */
+    HTInternalLink = HTAtom_for("internal link");  /* init, used as const */
+
+#ifndef WWW_SOURCE
+    WWW_SOURCE = HTAtom_for("www/source");  /* init, used as const */
+#endif
+
 /*
  *  curdoc.address contains the name of the file that is currently open.
  *  newdoc.address contains the name of the file that will soon be
@@ -6051,10 +6075,17 @@ try_again:
 	    resizeterm(LYlines, LYcols);
 	    wresize(LYwin, LYlines, LYcols);
 #else
+#if 0 /* defined(PDCURSES) && defined(HAVE_XCURSES) */
+	    resize_term(LYlines, LYcols);
+	    if (LYwin != 0)
+		LYwin = resize_window(LYwin, LYlines, LYcols);
+	    refresh();
+#else
 	    stop_curses();
 	    start_curses();
 	    LYclear();
 #endif
+#endif
 	    refresh_screen = TRUE; /* to force a redraw */
 	    if (HTMainText)	/* to REALLY force it... - kw */
 		HText_setStale(HTMainText);
diff --git a/src/LYMainLoop.h b/src/LYMainLoop.h
index 31804315..c74e875a 100644
--- a/src/LYMainLoop.h
+++ b/src/LYMainLoop.h
@@ -10,7 +10,7 @@ extern int LYGetNewline NOPARAMS;
 extern int mainloop NOPARAMS;
 extern void HTAddGotoURL PARAMS((char *url));
 extern void LYCloseTracelog NOPARAMS;
-extern void LYMainLoop_pageDisplay PARAMS((int line_num));
+extern BOOL LYMainLoop_pageDisplay PARAMS((int line_num));
 extern void LYSetNewline PARAMS((int value));
 extern void handle_LYK_TRACE_TOGGLE NOPARAMS;
 extern void handle_LYK_WHEREIS PARAMS((int cmd, BOOLEAN *refresh_screen));
diff --git a/src/LYOptions.c b/src/LYOptions.c
index 90648290..8f763e1b 100644
--- a/src/LYOptions.c
+++ b/src/LYOptions.c
@@ -36,7 +36,7 @@ PRIVATE void terminate_options	PARAMS((int sig));
 #endif
 
 #if defined(USE_SLANG) || defined(COLOR_CURSES)
-PRIVATE BOOLEAN can_do_colors = 0;
+PRIVATE BOOLEAN can_do_colors = FALSE;
 #endif
 
 PUBLIC BOOLEAN LYCheckUserAgent NOARGS
@@ -55,7 +55,7 @@ PUBLIC BOOLEAN LYCheckUserAgent NOARGS
 PRIVATE void SetupChosenShowColor NOARGS
 {
 #if defined(USE_SLANG) || defined(COLOR_CURSES)
-    can_do_colors = 1;
+    can_do_colors = TRUE;
 #if defined(COLOR_CURSES)
     if (LYCursesON)	/* could crash if called before initialization */
 	can_do_colors = (BOOL) has_colors();
@@ -1212,7 +1212,7 @@ draw_options:
 						  choices, 4, FALSE, FALSE);
 			}
 #if defined(COLOR_CURSES)
-			again = (BOOL) (chosen == 2 && !has_colors());
+			again = (BOOL) (chosen == SHOW_COLOR_ON && !has_colors());
 			if (again) {
 			    char * terminal = LYGetEnv("TERM");
 			    if (terminal)
@@ -1246,7 +1246,7 @@ draw_options:
 		}
 		CurrentShowColor = LYShowColor;
 #ifdef USE_SLANG
-		SLtt_Use_Ansi_Colors = (LYShowColor > 1 ? 1 : 0);
+		SLtt_Use_Ansi_Colors = (LYShowColor > SHOW_COLOR_OFF ? TRUE : FALSE);
 #endif
 		response = ' ';
 		if (LYSelectPopups && !no_option_save) {
@@ -2086,7 +2086,6 @@ PUBLIC int popup_choice ARGS7(
  */
 #define SELECTED(flag) (flag) ? selected_string : ""
 #define DISABLED(flag) (flag) ? disabled_string : ""
-#define NOTEMPTY(text) (text && text[0]) ? text : ""
 
 typedef struct {
     int value;
@@ -2691,7 +2690,7 @@ PUBLIC int postoptions ARGS1(
 	    }
 	    CurrentShowColor = LYShowColor;
 #ifdef USE_SLANG
-	    SLtt_Use_Ansi_Colors = (LYShowColor > 1 ? 1 : 0);
+	    SLtt_Use_Ansi_Colors = (LYShowColor > SHOW_COLOR_OFF ? TRUE : FALSE);
 #endif
 	}
 #endif /* USE_SLANG || COLOR_CURSES */
@@ -3254,7 +3253,7 @@ PRIVATE int gen_options ARGS1(
 
     /* Editor: INPUT */
     PutLabel(fp0, gettext("Editor"), editor_string);
-    PutTextInput(fp0, editor_string, NOTEMPTY(editor), text_len,
+    PutTextInput(fp0, editor_string, NonNull(editor), text_len,
 		      DISABLED(no_editor || system_editor));
 
     /* Search Type: SELECT */
@@ -3390,7 +3389,7 @@ PRIVATE int gen_options ARGS1(
 
     /* X Display: INPUT */
     PutLabel(fp0, gettext("X Display"),	x_display_string);
-    PutTextInput(fp0, x_display_string, NOTEMPTY(x_display), text_len, "");
+    PutTextInput(fp0, x_display_string, NonNull(x_display), text_len, "");
 
     /*
      * Document Appearance
@@ -3479,23 +3478,23 @@ PRIVATE int gen_options ARGS1(
     /* Mail Address: INPUT */
     PutLabel(fp0, gettext("Personal mail address"), mail_address_string);
     PutTextInput(fp0, mail_address_string,
-		      NOTEMPTY(personal_mail_address), text_len, "");
+		      NonNull(personal_mail_address), text_len, "");
 
     /* Preferred Document Character Set: INPUT */
     PutLabel(fp0, gettext("Preferred document character set"), preferred_doc_char_string);
     PutTextInput(fp0, preferred_doc_char_string,
-		      NOTEMPTY(pref_charset), cset_len+2, "");
+		      NonNull(pref_charset), cset_len+2, "");
 
     /* Preferred Document Language: INPUT */
     PutLabel(fp0, gettext("Preferred document language"), preferred_doc_lang_string);
     PutTextInput(fp0, preferred_doc_lang_string,
-		      NOTEMPTY(language), cset_len+2, "");
+		      NonNull(language), cset_len+2, "");
 
     /* User Agent: INPUT */
     if (!no_useragent) {
 	PutLabel(fp0, gettext("User-Agent header"), user_agent_string);
 	PutTextInput(fp0, user_agent_string,
-			  NOTEMPTY(LYUserAgent), text_len, "");
+			  NonNull(LYUserAgent), text_len, "");
     }
 
     /*
@@ -3583,7 +3582,7 @@ PRIVATE int gen_options ARGS1(
     } else {
 	PutLabel(fp0, gettext("Bookmarks file"), single_bookmark_string);
 	PutTextInput(fp0, single_bookmark_string,
-			 NOTEMPTY(bookmark_page), text_len, "");
+			 NonNull(bookmark_page), text_len, "");
     }
 
     /* Visited Pages: SELECT */
diff --git a/src/LYReadCFG.c b/src/LYReadCFG.c
index fda43d69..0c96100b 100644
--- a/src/LYReadCFG.c
+++ b/src/LYReadCFG.c
@@ -36,8 +36,7 @@
 #include <LYLeaks.h>
 
 #ifndef DISABLE_NEWS
-extern int HTNewsMaxChunk;  /* Max news articles before chunking (HTNews.c) */
-extern int HTNewsChunkSize; /* Number of news articles per chunk (HTNews.c) */
+#include <HTNews.h>
 #endif
 
 PUBLIC BOOLEAN have_read_cfg = FALSE;
@@ -240,9 +239,14 @@ PUBLIC int match_item_by_name ARGS3(
 int default_fg = DEFAULT_COLOR;
 int default_bg = DEFAULT_COLOR;
 #else
+#ifdef PDCURSES
+int default_fg = 15;
+int default_bg = COLOR_BLACK;
+#else
 int default_fg = COLOR_WHITE;
 int default_bg = COLOR_BLACK;
 #endif
+#endif
 
 PRIVATE CONST char *Color_Strings[16] =
 {
@@ -418,6 +422,7 @@ static Config_Enum tbl_abort_source_cache[] = {
 #define PARSE_INT(n,v)   {n, CONF_INT,         UNION_INT(v), 0}
 #define PARSE_TIM(n,v)   {n, CONF_TIME,        UNION_INT(v), 0}
 #define PARSE_STR(n,v)   {n, CONF_STR,         UNION_STR(v), 0}
+#define PARSE_PRG(n,v)   {n, CONF_PRG,         UNION_DEF(v), 0}
 #define PARSE_Env(n,v)   {n, CONF_ENV,         UNION_ENV(v), 0}
 #define PARSE_ENV(n,v)   {n, CONF_ENV2,        UNION_ENV(v), 0}
 #define PARSE_FUN(n,v)   {n, CONF_FUN,         UNION_FUN(v), 0}
@@ -433,6 +438,7 @@ typedef enum {
     ,CONF_ENUM
     ,CONF_INT
     ,CONF_STR
+    ,CONF_PRG
     ,CONF_ENV			/* from environment variable */
     ,CONF_ENV2			/* from environment VARIABLE */
     ,CONF_INCLUDE		/* include file-- handle special */
@@ -1236,6 +1242,7 @@ PRIVATE Config_Type Config_Table [] =
      PARSE_SET(RC_BOLD_H1,              bold_H1),
      PARSE_SET(RC_BOLD_HEADERS,         bold_headers),
      PARSE_SET(RC_BOLD_NAME_ANCHORS,    bold_name_anchors),
+     PARSE_PRG(RC_BZIP2_PATH,           ppBZIP2),
      PARSE_SET(RC_CASE_SENSITIVE_ALWAYS_ON, case_sensitive),
      PARSE_FUN(RC_CHARACTER_SET,        character_set_fun),
 #ifdef CAN_SWITCH_DISPLAY_CHARSET
@@ -1243,10 +1250,13 @@ PRIVATE Config_Type Config_Table [] =
      PARSE_STR(RC_CHARSETS_DIRECTORY,   charsets_directory),
 #endif
      PARSE_SET(RC_CHECKMAIL,            check_mail),
+     PARSE_PRG(RC_CHMOD_PATH,           ppCHMOD),
      PARSE_SET(RC_COLLAPSE_BR_TAGS,     LYCollapseBRs),
 #ifdef USE_COLOR_TABLE
      PARSE_FUN(RC_COLOR,                color_fun),
 #endif
+     PARSE_PRG(RC_COMPRESS_PATH,        ppCOMPRESS),
+     PARSE_PRG(RC_COPY_PATH,            ppCOPY),
 #ifndef __DJGPP__
      PARSE_INT(RC_CONNECT_TIMEOUT,      connect_timeout),
 #endif
@@ -1263,7 +1273,7 @@ PRIVATE Config_Type Config_Table [] =
      PARSE_STR(RC_COOKIE_STRICT_INVALID_DOMAIN, LYCookieSStrictCheckDomains),
      PARSE_Env(RC_CSO_PROXY, 0 ),
 #ifdef VMS
-     PARSE_STR(RC_CSWING_PATH,          LYCSwingPath),
+     PARSE_PRG(RC_CSWING_PATH,          ppCSWING),
 #endif
      PARSE_FUN(RC_DEFAULT_BOOKMARK_FILE, default_bookmark_file_fun),
      PARSE_FUN(RC_DEFAULT_CACHE_SIZE,   default_cache_size_fun),
@@ -1304,6 +1314,7 @@ PRIVATE Config_Type Config_Table [] =
      PARSE_STR(RC_GLOBAL_MAILCAP,       global_type_map),
      PARSE_Env(RC_GOPHER_PROXY,         0 ),
      PARSE_SET(RC_GOTOBUFFER,           goto_buffer),
+     PARSE_PRG(RC_GZIP_PATH,            ppGZIP),
      PARSE_STR(RC_HELPFILE,             helpfile),
 #ifdef MARK_HIDDEN_LINKS
      PARSE_STR(RC_HIDDEN_LINK_MARKER,   hidden_link_marker),
@@ -1317,6 +1328,7 @@ PRIVATE Config_Type Config_Table [] =
      PARSE_Env(RC_HTTPS_PROXY,          0 ),
      PARSE_REQ(RC_INCLUDE,              0),
      PARSE_TIM(RC_INFOSECS,             InfoSecs),
+     PARSE_PRG(RC_INSTALL_PATH,         ppINSTALL),
      PARSE_STR(RC_JUMP_PROMPT,          jumpprompt),
      PARSE_SET(RC_JUMPBUFFER,           jump_buffer),
      PARSE_FUN(RC_JUMPFILE,             jumpfile_fun),
@@ -1358,7 +1370,9 @@ PRIVATE Config_Type Config_Table [] =
      PARSE_SET(RC_MAKE_PSEUDO_ALTS_FOR_INLINES, pseudo_inline_alts),
      PARSE_TIM(RC_MESSAGESECS,          MessageSecs),
      PARSE_SET(RC_MINIMAL_COMMENTS,     minimal_comments),
+     PARSE_PRG(RC_MKDIR_PATH,           ppMKDIR),
      PARSE_ENU(RC_MULTI_BOOKMARK_SUPPORT, LYMultiBookmarks, tbl_multi_bookmarks),
+     PARSE_PRG(RC_MV_PATH,              ppMV),
      PARSE_SET(RC_NCR_IN_BOOKMARKS,     UCSaveBookmarksInUnicode),
 #ifndef DISABLE_NEWS
      PARSE_FUN(RC_NEWS_CHUNK_SIZE,      news_chunk_size_fun),
@@ -1411,6 +1425,8 @@ PRIVATE Config_Type Config_Table [] =
      PARSE_TIM(RC_REPLAYSECS,           ReplaySecs),
 #endif
      PARSE_SET(RC_REUSE_TEMPFILES,      LYReuseTempfiles),
+     PARSE_PRG(RC_RLOGIN_PATH,          ppRLOGIN),
+     PARSE_PRG(RC_RM_PATH,              ppRM),
 #ifndef NO_RULES
      PARSE_FUN(RC_RULE,                 HTSetConfiguration),
      PARSE_FUN(RC_RULESFILE,            cern_rulesfile_fun),
@@ -1443,19 +1459,25 @@ PRIVATE Config_Type Config_Table [] =
      PARSE_STR(RC_SYSTEM_MAIL,          system_mail),
      PARSE_STR(RC_SYSTEM_MAIL_FLAGS,    system_mail_flags),
      PARSE_FUN(RC_TAGSOUP,              get_tagsoup),
+     PARSE_PRG(RC_TAR_PATH,             ppTAR),
+     PARSE_PRG(RC_TELNET_PATH,          ppTELNET),
 #ifdef TEXTFIELDS_MAY_NEED_ACTIVATION
      PARSE_SET(RC_TEXTFIELDS_NEED_ACTIVATION, textfields_activation_option),
 #endif
+     PARSE_PRG(RC_TN3270_PATH,          ppTN3270),
 #if defined(_WINDOWS)
      PARSE_INT(RC_TIMEOUT,              lynx_timeout),
 #endif
-     PARSE_SET(RC_TRIM_INPUT_FIELDS,  LYtrimInputFields),
+     PARSE_PRG(RC_TOUCH_PATH,           ppTOUCH),
+     PARSE_SET(RC_TRIM_INPUT_FIELDS,    LYtrimInputFields),
 #ifdef EXEC_LINKS
      PARSE_DEF(RC_TRUSTED_EXEC,         EXEC_PATH),
 #endif
 #ifdef LYNXCGI_LINKS
      PARSE_DEF(RC_TRUSTED_LYNXCGI,      CGI_PATH),
 #endif
+     PARSE_PRG(RC_UNCOMPRESS_PATH,      ppUNCOMPRESS),
+     PARSE_PRG(RC_UNZIP_PATH,           ppUNZIP),
 #ifdef DIRED_SUPPORT
      PARSE_ADD(RC_UPLOADER,             uploaders),
 #endif
@@ -1468,11 +1490,14 @@ PRIVATE Config_Type Config_Table [] =
      PARSE_SET(RC_USE_MOUSE,            LYUseMouse),
 #endif
      PARSE_SET(RC_USE_SELECT_POPUPS,    LYSelectPopups),
+     PARSE_PRG(RC_UUDECODE_PATH,        ppUUDECODE),
      PARSE_SET(RC_VERBOSE_IMAGES,       verbose_img),
      PARSE_SET(RC_VI_KEYS_ALWAYS_ON,    vi_keys),
      PARSE_FUN(RC_VIEWER,               viewer_fun),
      PARSE_Env(RC_WAIS_PROXY,           0 ),
      PARSE_STR(RC_XLOADIMAGE_COMMAND,   XLoadImageCommand),
+     PARSE_PRG(RC_ZCAT_PATH,            ppZCAT),
+     PARSE_PRG(RC_ZIP_PATH,             ppZIP),
 
      PARSE_NIL
 };
@@ -1624,6 +1649,7 @@ PUBLIC void LYSetConfigValue ARGS2(
 {
     Config_Type *tbl = lookup_config(name);
     ParseUnionPtr q = ParseUnionOf(tbl);
+    char *temp;
 
     switch (tbl->type) {
     case CONF_BOOL:
@@ -1692,6 +1718,12 @@ PUBLIC void LYSetConfigValue ARGS2(
 	add_trusted (value, q->def_value);
 	break;
 #endif
+
+    case CONF_PRG:
+	if (StrAllocCopy(temp, value))
+	    HTSetProgramPath(q->def_value, temp);
+	break;
+
     default:
 	break;
     }
@@ -1997,6 +2029,7 @@ PUBLIC void read_cfg ARGS4(
 	int,	nesting_level,
 	FILE *,	fp0)
 {
+    HTInitProgramPaths();
     do_read_cfg(cfg_filename, parent_filename, nesting_level, fp0, NULL);
 }
 
diff --git a/src/LYStrings.c b/src/LYStrings.c
index 1af7339f..02615488 100644
--- a/src/LYStrings.c
+++ b/src/LYStrings.c
@@ -41,8 +41,6 @@
 #include <LYShowInfo.h>
 #include <LYLeaks.h>
 
-extern BOOL HTPassHighCtrlRaw;
-
 #if defined(WIN_EX)
 #undef  BUTTON_CTRL
 #define BUTTON_CTRL	0	/* Quick hack */
@@ -328,7 +326,7 @@ PRIVATE void LYAddToCloset ARGS2(RecallType, recall, char*, str)
 	LYRemoveFromCloset(list);
 }
 
-
+#ifdef USE_MOUSE
 PRIVATE int XYdist ARGS5(
     int,	x1,
     int,	y1,
@@ -552,6 +550,7 @@ PRIVATE int set_clicked_link ARGS4(
     }
     return c;
 }
+#endif /* USE_MOUSE */
 
 /*
  *  LYstrncpy() terminates strings with a null byte.
@@ -813,7 +812,7 @@ PRIVATE int sl_read_mouse_event ARGS1(
 	if (button == 0)  /* left */
 	  return set_clicked_link (mouse_x, mouse_y, FOR_PANEL, 1);
 
-        if (button == 1)  /* middle */
+	if (button == 1)  /* middle */
 	  return LYReverseKeymap (LYK_VIEW_BOOKMARK);
 
 	if (button == 2)   /* right */
@@ -5448,9 +5447,9 @@ PUBLIC char * SNACopy ARGS3(
 {
     FREE(*dest);
     if (src) {
-	*dest = typecallocn(char, n + 1);
+	*dest = typeMallocn(char, n + 1);
 	if (*dest == NULL) {
-	    CTRACE((tfp, "Tried to calloc %d bytes\n", n));
+	    CTRACE((tfp, "Tried to malloc %d bytes\n", n));
 	    outofmem(__FILE__, "SNACopy");
 	}
 	strncpy (*dest, src, n);
@@ -5476,7 +5475,7 @@ PUBLIC char * SNACat ARGS3(
 	    strncpy(*dest + length, src, n);
 	    *(*dest + length + n) = '\0'; /* terminate */
 	} else {
-	    *dest = typecallocn(char, n + 1);
+	    *dest = typeMallocn(char, n + 1);
 	    if (*dest == NULL)
 		outofmem(__FILE__, "SNACat");
 	    memcpy(*dest, src, n);
diff --git a/src/LYStrings.h b/src/LYStrings.h
index 45ef8594..3fcb443e 100644
--- a/src/LYStrings.h
+++ b/src/LYStrings.h
@@ -78,7 +78,7 @@ extern char * LYno_attr_mbcs_case_strstr PARAMS((
 	int *		nstartp,
 	int *		nendp));
 
-#define non_empty(s) ((s) != NULL && *(s) != '\0')
+#define non_empty(s) !isEmpty(s)
 
 #define LYno_attr_mb_strstr(chptr, tarptr, utf_flag, count_gcells, nstartp, nendp) \
 	(case_sensitive \
diff --git a/src/LYStructs.h b/src/LYStructs.h
index 4920ce63..def68923 100644
--- a/src/LYStructs.h
+++ b/src/LYStructs.h
@@ -6,14 +6,14 @@
 #endif /* HTANCHOR_H */
 
 typedef struct {
-    int hl_x;
     char *hl_text;
+    short hl_x;
 } HiliteInfo;
 
 typedef struct {
-    int hl_len;		/* number of strings in this struct */
-    HiliteInfo hl_base;
     HiliteInfo *hl_info;
+    HiliteInfo hl_base;
+    short hl_len;              /* number of strings in this struct */
 } HiliteList;
 
 typedef struct {
diff --git a/src/LYUtils.c b/src/LYUtils.c
index 8f3458c5..599577de 100644
--- a/src/LYUtils.c
+++ b/src/LYUtils.c
@@ -139,10 +139,9 @@ extern int BSDselect PARAMS((int nfds, fd_set * readfds, fd_set * writefds,
 
 #define COPY_COMMAND "%s %s %s"
 
-extern BOOLEAN LYHaveCJKCharacterSet;
-
 PRIVATE HTList * localhost_aliases = NULL;	/* Hosts to treat as local */
 PRIVATE char *HomeDir = NULL;			/* HOME directory */
+
 PUBLIC	HTList * sug_filenames = NULL;		/* Suggested filenames	 */
 
 /*
@@ -392,7 +391,7 @@ PRIVATE BOOL show_whereis_targets ARGS6(
 					       utf_flag, YES,
 					       &HitOffset,
 					       &LenNeeded)) != NULL)
-	         && (offset + LenNeeded) < LYcols) {
+		 && (offset + LenNeeded) < LYcols) {
 		    Data = cp;
 		    Offset = (offset + HitOffset);
 		} else {
@@ -1356,8 +1355,10 @@ PUBLIC void statusline ARGS1(
 #else
 	/* draw the status bar in the STATUS style */
 	{
-		int a=(strncmp(buffer, ALERT_FORMAT, ALERT_PREFIX_LEN) ||
-		       !hashStyles[s_alert].name) ? s_status : s_alert;
+		int a = (strncmp(buffer, ALERT_FORMAT, ALERT_PREFIX_LEN)
+			|| !hashStyles[s_alert].name)
+			? s_status
+			: s_alert;
 		LynxChangeStyle (a, STACK_ON);
 		LYaddstr(buffer);
 		wbkgdset(LYwin,
@@ -1731,8 +1732,8 @@ PUBLIC int HTCheckForInterrupt NOARGS
 	    } /* end switch */
 	    if (Newline_partial < 1)
 		Newline_partial = 1;
-	    NumOfLines_partial = HText_getNumOfLines();
-	    LYMainLoop_pageDisplay(Newline_partial);
+	    if (LYMainLoop_pageDisplay(Newline_partial))
+		NumOfLines_partial = HText_getNumOfLines();
 	}
 #endif /* DISP_PARTIAL */
 	break;
@@ -3710,7 +3711,7 @@ PUBLIC void LYConvertToURL ARGS2(
 	for(; *cp_url != '\0'; cp_url++)
 	    if (*cp_url == '\\')
 		*cp_url = '/';
-	    cp_url--;
+	cp_url--;
 	if (LYIsDosDrive(*AllocatedString) && *cp_url == ':')
 	    LYAddPathSep(AllocatedString);
     }
@@ -4851,7 +4852,7 @@ PRIVATE char *HomeEnv NOARGS
     }
 #endif
 
-    return result; 
+    return result;
 }
 
 PUBLIC CONST char * Home_Dir NOARGS
@@ -6759,45 +6760,43 @@ PUBLIC int LYCopyFile ARGS2(
 	char *,		dst)
 {
     int code;
+    CONST char *program;
 
-#if !defined(COPY_PATH)
+    if ((program = HTGetProgramPath(ppCOPY)) != NULL) {
+	char *the_command = 0;
 
-#define BUF_SIZE	1024
+	HTAddParam(&the_command, COPY_COMMAND, 1, program);
+	HTAddParam(&the_command, COPY_COMMAND, 2, src);
+	HTAddParam(&the_command, COPY_COMMAND, 3, dst);
+	HTEndParam(&the_command, COPY_COMMAND, 3);
 
-    FILE *fin, *fout;
-    unsigned char buff[BUF_SIZE];
-    int len;
+	CTRACE((tfp, "command: %s\n", the_command));
+	stop_curses();
+	code = LYSystem(the_command);
+	start_curses();
 
-    code = EOF;
-    if ((fin = fopen(src, BIN_R)) != 0) {
-	if ((fout = fopen(dst, BIN_W)) != 0) {
-	    code = 0;
-	    while ((len = fread(buff, 1, BUF_SIZE, fin)) > 0) {
-		fwrite(buff, 1, len, fout);
-		if (ferror(fout)) {
-		    code = EOF;
-		    break;
+	FREE(the_command);
+    } else {
+	FILE *fin, *fout;
+	unsigned char buff[BUFSIZ];
+	int len;
+
+	code = EOF;
+	if ((fin = fopen(src, BIN_R)) != 0) {
+	    if ((fout = fopen(dst, BIN_W)) != 0) {
+		code = 0;
+		while ((len = fread(buff, 1, sizeof(buff), fin)) > 0) {
+		    fwrite(buff, 1, len, fout);
+		    if (ferror(fout)) {
+			code = EOF;
+			break;
+		    }
 		}
+		LYCloseOutput(fout);
 	    }
-	    LYCloseOutput(fout);
+	    LYCloseInput(fin);
 	}
-	LYCloseInput(fin);
     }
-#else
-    char *the_command = 0;
-
-    HTAddParam(&the_command, COPY_COMMAND, 1, COPY_PATH);
-    HTAddParam(&the_command, COPY_COMMAND, 2, src);
-    HTAddParam(&the_command, COPY_COMMAND, 3, dst);
-    HTEndParam(&the_command, COPY_COMMAND, 3);
-
-    CTRACE((tfp, "command: %s\n", the_command));
-    stop_curses();
-    code = LYSystem(the_command);
-    start_curses();
-
-    FREE(the_command);
-#endif
 
     if (code) {
 	HTAlert(CANNOT_WRITE_TO_FILE);
diff --git a/src/LYrcFile.h b/src/LYrcFile.h
index b7144243..590436ce 100644
--- a/src/LYrcFile.h
+++ b/src/LYrcFile.h
@@ -23,14 +23,17 @@
 #define RC_BOLD_HEADERS                 "bold_headers"
 #define RC_BOLD_NAME_ANCHORS            "bold_name_anchors"
 #define RC_BOOKMARK_FILE                "bookmark_file"
+#define RC_BZIP2_PATH                   "bzip2_path"
 #define RC_CASE_SENSITIVE_ALWAYS_ON     "case_sensitive_always_on"
 #define RC_CASE_SENSITIVE_SEARCHING     "case_sensitive_searching"
 #define RC_CHARACTER_SET                "character_set"
 #define RC_CHARSETS_DIRECTORY           "charsets_directory"
 #define RC_CHARSET_SWITCH_RULES         "charset_switch_rules"
 #define RC_CHECKMAIL                    "checkmail"
+#define RC_CHMOD_PATH                   "chmod_path"
 #define RC_COLLAPSE_BR_TAGS             "collapse_br_tags"
 #define RC_COLOR                        "color"
+#define RC_COMPRESS_PATH                "compress_path"
 #define RC_CONNECT_TIMEOUT              "connect_timeout"
 #define RC_COOKIE_ACCEPT_DOMAINS        "cookie_accept_domains"
 #define RC_COOKIE_FILE                  "cookie_file"
@@ -39,6 +42,7 @@
 #define RC_COOKIE_REJECT_DOMAINS        "cookie_reject_domains"
 #define RC_COOKIE_SAVE_FILE             "cookie_save_file"
 #define RC_COOKIE_STRICT_INVALID_DOMAIN "cookie_strict_invalid_domains"
+#define RC_COPY_PATH                    "copy_path"
 #define RC_CSO_PROXY                    "cso_proxy"
 #define RC_CSWING_PATH                  "cswing_path"
 #define RC_DEFAULT_BOOKMARK_FILE        "default_bookmark_file"
@@ -75,6 +79,7 @@
 #define RC_GLOBAL_MAILCAP               "global_mailcap"
 #define RC_GOPHER_PROXY                 "gopher_proxy"
 #define RC_GOTOBUFFER                   "gotobuffer"
+#define RC_GZIP_PATH                    "gzip_path"
 #define RC_HELPFILE                     "helpfile"
 #define RC_HIDDEN_LINK_MARKER           "hidden_link_marker"
 #define RC_HISTORICAL_COMMENTS          "historical_comments"
@@ -84,6 +89,7 @@
 #define RC_HTTP_PROXY                   "http_proxy"
 #define RC_INCLUDE                      "include"
 #define RC_INFOSECS                     "infosecs"
+#define RC_INSTALL_PATH                 "install_path"
 #define RC_JUMPBUFFER                   "jumpbuffer"
 #define RC_JUMPFILE                     "jumpfile"
 #define RC_JUMP_PROMPT                  "jump_prompt"
@@ -112,8 +118,10 @@
 #define RC_MAKE_PSEUDO_ALTS_FOR_INLINES "make_pseudo_alts_for_inlines"
 #define RC_MESSAGESECS                  "messagesecs"
 #define RC_MINIMAL_COMMENTS             "minimal_comments"
+#define RC_MKDIR_PATH                   "mkdir_path"
 #define RC_MULTI_BOOKMARK               "multi_bookmark"
 #define RC_MULTI_BOOKMARK_SUPPORT       "multi_bookmark_support"
+#define RC_MV_PATH                      "mv_path"
 #define RC_NCR_IN_BOOKMARKS             "ncr_in_bookmarks"
 #define RC_NEWSPOST_PROXY               "newspost_proxy"
 #define RC_NEWSREPLY_PROXY              "newsreply_proxy"
@@ -154,6 +162,8 @@
 #define RC_REFERER_WITH_QUERY           "referer_with_query"
 #define RC_REPLAYSECS                   "replaysecs"
 #define RC_REUSE_TEMPFILES              "reuse_tempfiles"
+#define RC_RLOGIN_PATH                  "rlogin_path"
+#define RC_RM_PATH                      "rm_path"
 #define RC_RULE                         "rule"
 #define RC_RULESFILE                    "rulesfile"
 #define RC_RUN_ALL_EXECUTION_LINKS      "run_all_execution_links"
@@ -186,11 +196,17 @@
 #define RC_SYSTEM_MAIL                  "system_mail"
 #define RC_SYSTEM_MAIL_FLAGS            "system_mail_flags"
 #define RC_TAGSOUP                      "tagsoup"
+#define RC_TAR_PATH                     "tar_path"
+#define RC_TELNET_PATH                  "telnet_path"
 #define RC_TEXTFIELDS_NEED_ACTIVATION   "textfields_need_activation"
 #define RC_TIMEOUT                      "timeout"
+#define RC_TN3270_PATH                  "tn3270_path"
+#define RC_TOUCH_PATH                   "touch_path"
 #define RC_TRIM_INPUT_FIELDS            "trim_input_fields"
 #define RC_TRUSTED_EXEC                 "trusted_exec"
 #define RC_TRUSTED_LYNXCGI              "trusted_lynxcgi"
+#define RC_UNCOMPRESS_PATH              "uncompress_path"
+#define RC_UNZIP_PATH                   "unzip_path"
 #define RC_UPLOADER                     "uploader"
 #define RC_URL_DOMAIN_PREFIXES          "url_domain_prefixes"
 #define RC_URL_DOMAIN_SUFFIXES          "url_domain_suffixes"
@@ -199,6 +215,7 @@
 #define RC_USE_FIXED_RECORDS            "use_fixed_records"
 #define RC_USE_MOUSE                    "use_mouse"
 #define RC_USE_SELECT_POPUPS            "use_select_popups"
+#define RC_UUDECODE_PATH                "uudecode_path"
 #define RC_VERBOSE_IMAGES               "verbose_images"
 #define RC_VIEWER                       "viewer"
 #define RC_VISITED_LINKS                "visited_links"
@@ -206,6 +223,8 @@
 #define RC_VI_KEYS_ALWAYS_ON            "vi_keys_always_on"
 #define RC_WAIS_PROXY                   "wais_proxy"
 #define RC_XLOADIMAGE_COMMAND           "xloadimage_command"
+#define RC_ZCAT_PATH                    "zcat_path"
+#define RC_ZIP_PATH                     "zip_path"
 
 extern Config_Enum tbl_DTD_recovery[];
 extern Config_Enum tbl_keypad_mode[];
diff --git a/src/UCdomap.c b/src/UCdomap.c
index 4e97d837..34ee8b35 100644
--- a/src/UCdomap.c
+++ b/src/UCdomap.c
@@ -74,6 +74,11 @@
 int auto_display_charset = -1;
 #endif
 
+CONST char *UC_GNsetMIMEnames[4] =
+	{"iso-8859-1", "x-dec-graphics", "cp437", "x-transparent"};
+
+int UC_GNhandles[4] = {-1, -1, -1, -1};
+
 /*
  *  Some of the code below, and some of the comments, are left in for
  *  historical reasons.  Not all those tables below are currently
@@ -831,6 +836,7 @@ PRIVATE int conv_uni_to_str ARGS4(
 }
 
 PUBLIC int UCInitialized = 0;
+
 /*
  *  [ original comment: - KW ]
  * This is called at sys_setup time, after memory and the console are
diff --git a/src/UCdomap.h b/src/UCdomap.h
index 71cbc696..3a494252 100644
--- a/src/UCdomap.h
+++ b/src/UCdomap.h
@@ -39,11 +39,6 @@ extern void UC_Charset_Setup PARAMS((
 	int			UC_rawuni,
 	int			codepage));
 
-CONST char *UC_GNsetMIMEnames[4] =
-	{"iso-8859-1", "x-dec-graphics", "cp437", "x-transparent"};
-
-int UC_GNhandles[4] = {-1, -1, -1, -1};
-
 struct UC_charset {
 	CONST char *MIMEname;
 	CONST char *LYNXname;
@@ -60,10 +55,10 @@ struct UC_charset {
 };
 
 extern int UCNumCharsets;
+extern int UCInitialized;
 
 extern void UCInit NOARGS;
 
-
 /*
  *  INSTRUCTIONS for adding new character sets which do not have
  *              Unicode tables.
diff --git a/userdefs.h b/userdefs.h
index 6320cec5..4b5df08c 100644
--- a/userdefs.h
+++ b/userdefs.h
@@ -1347,11 +1347,11 @@
  * the version definition with the Project Version on checkout.  Just
  * ignore it. - kw */
 /* $Format: "#define LYNX_VERSION \"$ProjectVersion$\""$ */
-#define LYNX_VERSION "2.8.5dev.9"
+#define LYNX_VERSION "2.8.5dev.11"
 #define LYNX_WWW_HOME "http://lynx.browser.org/"
 #define LYNX_WWW_DIST "http://lynx.isc.org/current/"
 /* $Format: "#define LYNX_DATE \"$ProjectDate$\""$ */
-#define LYNX_DATE "Sun, 06 Oct 2002 17:43:28 -0700"
+#define LYNX_DATE "Sun, 01 Dec 2002 18:19:26 -0800"
 #define LYNX_DATE_OFF 5		/* truncate the automatically-generated date */
 #define LYNX_DATE_LEN 11	/* truncate the automatically-generated date */
 
@@ -1438,6 +1438,7 @@
 #define ZCAT_PATH       "zcat"
 #define GZIP_PATH       "gzip"
 #define BZIP2_PATH      "bzip2"
+#define MV_PATH         "mv"
 #define INSTALL_PATH    "install"
 #define TAR_PATH        "tar"
 #define ZIP_PATH        "zip"
@@ -1447,11 +1448,10 @@
 #define TN3270_PATH     "tn3270"
 #define RLOGIN_PATH     "rlogin"
 /*
- * These are implemented directly:
+ * These are not used:
  * #define COPY_PATH       "cp"
  * #define CHMOD_PATH      "chmod"
  * #define MKDIR_PATH      "mkdir"
- * #define MV_PATH         "mv"
  * #define TOUCH_PATH      "touch"
  */
 #endif /* HAVE_CONFIG_H */