changeset 14:946da5994c01

updated for version 7.0006
author vimboss
date Mon, 05 Jul 2004 15:58:32 +0000
parents 24d5189d3956
children 631143ac4a01
files Filelist runtime/doc/editing.txt runtime/doc/eval.txt runtime/doc/help.txt runtime/doc/if_mzsch.txt runtime/doc/index.txt runtime/doc/insert.txt runtime/doc/options.txt runtime/doc/quickref.txt runtime/doc/tags runtime/doc/todo.txt runtime/doc/various.txt runtime/doc/version7.txt runtime/optwin.vim runtime/print/prolog.ps src/Make_ming.mak src/Make_mvc.mak src/Makefile src/auto/configure src/buffer.c src/config.h.in src/config.mk.in src/configure.in src/eval.c src/ex_cmds.c src/ex_cmds.h src/ex_cmds2.c src/ex_docmd.c src/feature.h src/if_mzsch.c src/if_mzsch.h src/main.c src/misc1.c src/option.c src/option.h src/os_unix.c src/os_win32.c src/proto.h src/proto/if_mzsch.pro src/search.c src/structs.h src/version.c src/vim.h src/window.c
diffstat 44 files changed, 3961 insertions(+), 610 deletions(-) [+]
line wrap: on
line diff
--- a/Filelist
+++ b/Filelist
@@ -197,12 +197,15 @@ SRC_UNIX =	\
 SRC_DOS_UNIX =	\
 		src/if_cscope.c \
 		src/if_cscope.h \
+		src/if_mzsch.c \
+		src/if_mzsch.h \
 		src/if_perl.xs \
 		src/if_perlsfio.c \
 		src/if_python.c \
 		src/if_ruby.c \
 		src/if_tcl.c \
 		src/proto/if_cscope.pro \
+		src/proto/if_mzsch.pro \
 		src/proto/if_perl.pro \
 		src/proto/if_perlsfio.pro \
 		src/proto/if_python.pro \
--- a/runtime/doc/editing.txt
+++ b/runtime/doc/editing.txt
@@ -1,4 +1,4 @@
-*editing.txt*   For Vim version 7.0aa.  Last change: 2004 Jun 17
+*editing.txt*   For Vim version 7.0aa.  Last change: 2004 Jul 04
 
 
 		  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -48,6 +48,9 @@ CTRL-G		or				*CTRL-G* *:f* *:fi* *:file
 			make this message shorter.  {Vi does not include
 			column number}
 
+:f[ile]!		like |:file|, but don't truncate the name even when
+			'shortmess' indicates this.
+
 {count}CTRL-G		Like CTRL-G, but prints the current file name with
 			full path.  If the count is higher than 1 the current
 			buffer number is also given.  {not in Vi}
@@ -69,7 +72,12 @@ g CTRL-G		Prints the current position of
 			{not in VI}
 
 							*:file_f*
-:f[ile] {name}		Sets the current file name to {name}.
+:f[ile][!] {name}	Sets the current file name to {name}.  The optional !
+			avoids truncating the message, as with |:file|.
+
+:0f[ile][!]		Remove the name of the current buffer.  The optional !
+			avoids truncating the message, as with |:file|.  {not
+			in Vi}
 
 :buffers
 :files
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -1,4 +1,4 @@
-*eval.txt*      For Vim version 7.0aa.  Last change: 2004 Jun 30
+*eval.txt*      For Vim version 7.0aa.  Last change: 2004 Jul 05
 
 
 		  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -2808,6 +2808,7 @@ mouse_xterm		Compiled with support for x
 multi_byte		Compiled with support for editing Korean et al.
 multi_byte_ime		Compiled with support for IME input method.
 multi_lang		Compiled with support for multiple languages.
+mzscheme		Compiled with MzScheme interface |mzscheme|.
 netbeans_intg		Compiled with support for |netbeans|.
 ole			Compiled with OLE automation support for Win32.
 os2			OS/2 version of Vim.
--- a/runtime/doc/help.txt
+++ b/runtime/doc/help.txt
@@ -1,4 +1,4 @@
-*help.txt*	For Vim version 7.0aa.  Last change: 2004 May 04
+*help.txt*	For Vim version 7.0aa.  Last change: 2004 Jul 05
 
 			VIM - main help file
 									 k
@@ -148,7 +148,8 @@ GUI ~
 |gui_x11.txt|	X11 GUI
 
 Interfaces ~
-|if_cscop.txt|	using cscope with Vim
+|if_cscop.txt|	using Cscope with Vim
+|if_mzsch.txt|	MzScheme interface
 |if_perl.txt|	Perl interface
 |if_pyth.txt|	Python interface
 |if_sniff.txt|	SNiFF+ interface
@@ -187,6 +188,12 @@ Standard plugins ~
 |pi_expl.txt|	File explorer
 
 LOCAL ADDITIONS:				*local-additions*
+|engspchk.txt|	English Spelling Checker   (v57)	May 25, 2004
+|example.txt|	Example for a locally added help file
+|matchit.txt|   Extended "%" matching
+|test.txt|	Testing the hélp cömmånd nôw
+|typecorr.txt|	Plugin for correcting typing mistakes
+|helpp.txt|	Dummy line to avoid an error message
 
 ------------------------------------------------------------------------------
 *bars*		Bars example
new file mode 100644
--- /dev/null
+++ b/runtime/doc/if_mzsch.txt
@@ -0,0 +1,219 @@
+*if_mzsch.txt*  For Vim version 7.0aa.  Last change: 2004 Jul 05
+
+
+		  VIM REFERENCE MANUAL    by Sergey Khorev
+
+
+The MzScheme Interface to Vim				*mzscheme* *MzScheme*
+
+1. Commands				|mzscheme-commands|
+2. Examples				|mzscheme-examples|
+3. Threads				|mzscheme-threads|
+4. The Vim access procedures		|mzscheme-vim|
+
+{Vi does not have any of these commands}
+
+The MzScheme interface is available only if Vim was compiled with the
+|+mzscheme| feature.
+
+Based on the work of Brent Fulgham.
+
+For downloading MzScheme and other info:
+	http://www.plt-scheme.org/software/mzscheme/
+
+==============================================================================
+1. Commands						*mzscheme-commands*
+
+							*:mzscheme* *:mz*
+:[range]mz[scheme] {stmt}
+			Execute MzScheme statement {stmt}.  {not in Vi}
+
+:[range]mz[scheme] << {endmarker}
+{script}
+{endmarker}
+			Execute inlined MzScheme script {script}.
+			Note: This command doesn't work if the MzScheme
+			feature wasn't compiled in.  To avoid errors, see
+			|script-here|.
+
+							*:mzfile* *:mzf*
+:[range]mzf[ile] {file}	Execute the MzScheme script in {file}.  {not in Vi}
+			All statements are executed in the namespace of the
+                        buffer that was current during :mzfile start.
+			If you want to access other namespaces, use
+			'parameterize'.
+
+All of these commands do essentially the same thing - they execute a piece of
+MzScheme code, with the "current range" set to the given line
+range.
+
+In the case of :mzscheme, the code to execute is in the command-line.
+In the case of :mzfile, the code to execute is the contents of the given file.
+
+Each buffer has its own MzScheme namespace. Global namespace is bound to
+the `global-namespace' value from the 'vimext' module.
+MzScheme interface defines exception exn:vim, derived from exn.
+It is raised for various Vim errors.
+
+During compilation, the MzScheme interface will remember the current MzScheme
+collection path. If you want to specify additional paths use the
+'current-library-collection-paths' parameter. E.g., to cons the user-local
+MzScheme collection path: >
+    :mz << EOF
+    (current-library-collection-paths
+	(cons
+	    (build-path (find-system-path 'addon-dir) (version) "collects")
+	    (current-library-collection-paths)))
+    EOF
+<
+
+All functionality is provided through module vimext.
+
+The exn:vim is available without explicit import.
+
+To avoid clashes with MzScheme, consider using prefix when requiring module,
+e.g.: >
+	:mzscheme (require (prefix vim- vimext))
+<
+All the examples below assume this naming scheme.  Note that you need to do
+this again for every buffer.
+
+The auto-instantiation can be achieved with autocommands, e.g. you can put
+something like this in your .vimrc: >
+    au VimEnter,BufNew,BufNewFile,BufAdd,BufReadPre *
+	\:mz (require (prefix vim- vimext)
+<
+
+The global namespace just instantiated this module with the prefix "vimext:".
+
+==============================================================================
+2. Examples						*mzscheme-examples*
+>
+	:mzscheme (display "Hello")
+	:mzscheme (vim-set-buff-line 10 "This is line #10")
+<
+Inline script usage: >
+	function! <SID>SetFirstLine()
+	    :mz << EOF
+	    (display "!!!")
+	    (vim-set-buff-line 1 "This is line #1")
+	    (vim-beep)
+	    EOF
+	endfunction
+
+	nmap <F9> :call <SID>SetFirstLine() <CR>
+<
+File execution: >
+	:mzfile supascript.scm
+<
+Accessing the current buffer namespace from an MzScheme program running in
+another buffer within |:mzfile|-executed script : >
+	; Move to the window below
+	(vim-command "wincmd j")
+	; execute in the context of buffer, to which window belongs
+	; assume that buffer has 'textstring' defined
+	(parameterize ((current-namespace
+			(vim-get-buff-namespace (vim-curr-buff))))
+	 (eval '(vim-set-buff-line 1 textstring)))
+<
+
+==============================================================================
+3. Threads						*mzscheme-threads*
+
+The MzScheme interface supports threads. They are independent from OS threads,
+thus scheduling is required. The option 'mzquantum' determines how often
+Vim should poll for available MzScheme threads.
+NOTE
+Thread scheduling in the console version of Vim is less reliable than in the
+GUI version.
+
+==============================================================================
+5. VIM Functions					*mzscheme-vim*
+
+							*mzscheme-vimext*
+The 'vimext' module provides access to procedures defined in the MzScheme
+interface.
+
+Common
+------
+    (command {command-string})	    Perform the vim ":Ex" style command.
+    (eval {expr-string})	    Evaluate the vim command string.
+				    NOTE clashes with MzScheme eval
+    (range-start)		    Start/End of the range passed with
+    (range-end)			    the Scheme command.
+    (beep)			    beep
+    (get-option {option-name} [buffer-or-window]) Get Vim option value (either
+				    local or global, see set-option).
+    (set-option {string} [buffer-or-window])
+				    Set a Vim option. String must have option
+				    setting form (like optname=optval, or
+				    optname+=optval, etc.) When called with
+				    {buffer} or {window} the local option will
+				    be set. The symbol 'global can be passed
+				    as {buffer-or-window}. Then |:setglobal|
+				    will be used.
+    global-namespace		    The MzScheme main namespace.
+
+Buffers							 *mzscheme-buffer*
+-------
+    (buff? {object})		    Is object a buffer?
+    (buff-valid? {object})	    Is object a valid buffer? (i.e.
+				    corresponds to the real Vim buffer)
+    (get-buff-line {linenr} [buffer])
+				    Get line from a buffer.
+    (set-buff-line {linenr} {string} [buffer])
+				    Set a line in a buffer. If {string} is #f,
+				    the line gets deleted.  The [buffer]
+                                    argument is optional. If omitted, the
+                                    current buffer will be used.
+    (get-buff-line-list {start} {end} [buffer])
+				    Get a list of lines in a buffer. {Start}
+				    and {end} are 1-based. {Start} is
+				    inclusive, {end} - exclusive.
+    (set-buff-line-list {start} {end} {string-list} [buffer])
+				    Set a list of lines in a buffer. If
+				    string-list is #f or null, the lines get
+				    deleted. If a list is shorter than
+				    {end}-{start} the remaining lines will
+				    be deleted.
+    (get-buff-name [buffer])	    Get a buffer's text name.
+    (get-buff-num [buffer])	    Get a buffer's number.
+    (get-buff-size [buffer])	    Get buffer line count.
+    (insert-buff-line-list {linenr} {string/string-list} [buffer])
+				    Insert a list of lines into a buffer after
+				    {linenr}. If {linenr} is 0, lines will be
+				    inserted at start.
+    (curr-buff)			    Get the current buffer. Use procedures
+				    from `vimcmd' module to change it.
+    (buff-count)		    Get count of total buffers in the editor.
+    (get-next-buff [buffer])	    Get next buffer.
+    (get-prev-buff [buffer])	    Get previous buffer. Return #f when there
+				    are no more buffers.
+    (open-buff {filename})	    Open a new buffer (for file "name")
+    (get-buff-by-name {buffername}) Get a buffer by its filename or #f
+					if there is no such buffer.
+    (get-buff-by-num {buffernum})   Get a buffer by its number (return #f if
+				    there is no buffer with this number).
+    (get-buff-namespace [buffer])   Get buffer namespace.
+
+Windows							    *mzscheme-window*
+------
+    (win? {object})		    Is object a window?
+    (win-valid? {object})	    Is object a valid window (i.e. corresponds
+				    to the real Vim window)?
+    (curr-win)			    Get the current window.
+    (win-count)			    Get count of windows.
+    (get-win-num [window])	    Get window number.
+    (get-win-by-num {windownum})    Get window by its number.
+    (get-win-buffer	[window])   Get the buffer for a given window.
+    (get-win-height [window])
+    (set-win-height {height} [window])  Get/Set height of window.
+    (get-win-width [window])
+    (set-win-width {width} [window])Get/Set width of window.
+    (get-win-list [buffer])	    Get list of windows for a buffer.
+    (get-cursor [window])	    Get cursor position in a window as
+				    a pair (linenr . column).
+    (set-cursor (line . col) [window])  Set cursor position.
+
+======================================================================
+  vim:tw=78:ts=8:sts=4:ft=help:norl:
--- a/runtime/doc/index.txt
+++ b/runtime/doc/index.txt
@@ -1,4 +1,4 @@
-*index.txt*     For Vim version 7.0aa.  Last change: 2004 Jul 02
+*index.txt*     For Vim version 7.0aa.  Last change: 2004 Jul 04
 
 
 		  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -1352,6 +1352,7 @@ The commands are sorted on the non-optio
 |:stop|		:st[op]		suspend the editor or escape to a shell
 |:stag|		:sta[g]		split window and jump to a tag
 |:startinsert|	:star[tinsert]	start Insert mode
+|:startreplace|	:startr[eplace]	start Replace mode
 |:stopinsert||	:stopi[nsert]	stop Insert mode
 |:stjump|	:stj[ump]	do ":tjump" and split window
 |:stselect|	:sts[elect]	do ":tselect" and split window
--- a/runtime/doc/insert.txt
+++ b/runtime/doc/insert.txt
@@ -1,4 +1,4 @@
-*insert.txt*    For Vim version 7.0aa.  Last change: 2004 Jul 02
+*insert.txt*    For Vim version 7.0aa.  Last change: 2004 Jul 04
 
 
 		  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -991,6 +991,19 @@ NOTE: ":append" and ":insert" don't work
 			typing <Esc> in Insert mode.
 			Can be used in an autocommand, example: >
 				:au BufEnter scratch stopinsert
+<
+					*replacing-ex* *:startreplace*
+:startr[eplace][!]	Start Replace mode just after executing this command.
+			Works just like typing "R" in Normal mode.  When the
+			! is included it acts just like "$R" had been typed
+			(ie. begin replace mode at the end-of-line).  Other-
+			wise replacement begins at the cursor position.
+			Note that when using this command in a function or
+			script that the replacement will only start after
+			the function or script is finished.
+			{not in Vi}
+			{not available when compiled without the +ex_extra
+			feature}
 
 ==============================================================================
 10. Inserting a file					*inserting-file*
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@ -1,4 +1,4 @@
-*options.txt*	For Vim version 7.0aa.  Last change: 2004 Jul 03
+*options.txt*	For Vim version 7.0aa.  Last change: 2004 Jul 05
 
 
 		  VIM REFERENCE MANUAL	  by Bram Moolenaar
@@ -1558,7 +1558,7 @@ A jump table for the options with a shor
 	part before the "\|" matches the base, the part after it is used
 	when there is no match.  The "\2" in the replacement is empty if the
 	part before the "\|" does not match.
-	
+
 				*'confirm'* *'cf'* *'noconfirm'* *'nocf'*
 'confirm' 'cf'		boolean (default off)
 			global
@@ -4235,6 +4235,15 @@ A jump table for the options with a shor
 	time in msec between two mouse clicks for the second click to be
 	recognized as a multi click.
 
+						    *'mzquantum'* *'mzq'*
+'mzquantum' 'mzq'	number	(default 100)
+			global
+			{not in Vi}
+			{not available when compiled without the |+mzscheme|
+			feature}
+	The number of milliseconds between polls for MzScheme threads.
+	Negative or zero value means no thread scheduling.
+
 							*'nrformats'* *'nf'*
 'nrformats' 'nf'	string	(default "octal,hex")
 			local to buffer
@@ -4269,6 +4278,9 @@ A jump table for the options with a shor
 						*'numberwidth'* *'nuw'*
 'numberwidth' 'nuw'	number	(Vim default: 4  Vi default: 8)
 			local to window
+			{not in Vi}
+			{only available when compiled with the |+linebreak|
+			feature}
 	Minimal number of columns to use for the line number.  Only relevant
 	when the 'number' option is set.
 	Since one space is always between the number and the text, there is
--- a/runtime/doc/quickref.txt
+++ b/runtime/doc/quickref.txt
@@ -1,4 +1,4 @@
-*quickref.txt*  For Vim version 7.0aa.  Last change: 2004 Jul 03
+*quickref.txt*  For Vim version 7.0aa.  Last change: 2004 Jul 04
 
 
 		  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -255,6 +255,7 @@ These only work when 'wrap' is off:
 |o|	N  o	open a new line below the current line, append text (N times)
 |O|	N  O	open a new line above the current line, append text (N times)
 |:startinsert|  :star[tinsert][!]  start Insert mode, append when [!] used
+|:startreplace| :startr[eplace][!]  start Replace mode, at EOL when [!] used
 
 in Visual block mode:
 |v_b_I|    I	insert the same text in front of all the selected lines
@@ -762,6 +763,7 @@ Short explanation of each option:		*opti
 |'mousemodel'|	  |'mousem'| changes meaning of mouse buttons
 |'mouseshape'|	  |'mouses'| shape of the mouse pointer in different modes
 |'mousetime'|	  |'mouset'| max time between mouse double-click
+|'mzquantum'|	  |'mzq'|    the interval between polls for MzScheme threads
 |'nrformats'|	  |'nf'|     number formats recognized for CTRL-A command
 |'number'|	  |'nu'|     print the line number in front of each line
 |'numberwidth'|	  |'nuw'|    number of columns used for the line number
--- a/runtime/doc/tags
+++ b/runtime/doc/tags
@@ -377,6 +377,8 @@
 'mousetime'	options.txt	/*'mousetime'*
 'mp'	options.txt	/*'mp'*
 'mps'	options.txt	/*'mps'*
+'mzq'	options.txt	/*'mzq'*
+'mzquantum'	options.txt	/*'mzquantum'*
 'nf'	options.txt	/*'nf'*
 'noacd'	options.txt	/*'noacd'*
 'noai'	options.txt	/*'noai'*
@@ -1038,6 +1040,7 @@
 +multi_byte	various.txt	/*+multi_byte*
 +multi_byte_ime	various.txt	/*+multi_byte_ime*
 +multi_lang	various.txt	/*+multi_lang*
++mzscheme	various.txt	/*+mzscheme*
 +netbeans_intg	various.txt	/*+netbeans_intg*
 +ole	various.txt	/*+ole*
 +osfiletype	various.txt	/*+osfiletype*
@@ -2076,6 +2079,10 @@ 90.5	usr_90.txt	/*90.5*
 :mod	term.txt	/*:mod*
 :mode	term.txt	/*:mode*
 :move	change.txt	/*:move*
+:mz	if_mzsch.txt	/*:mz*
+:mzf	if_mzsch.txt	/*:mzf*
+:mzfile	if_mzsch.txt	/*:mzfile*
+:mzscheme	if_mzsch.txt	/*:mzscheme*
 :n	editing.txt	/*:n*
 :ne	editing.txt	/*:ne*
 :new	windows.txt	/*:new*
@@ -2338,6 +2345,7 @@ 90.5	usr_90.txt	/*90.5*
 :star	repeat.txt	/*:star*
 :start	insert.txt	/*:start*
 :startinsert	insert.txt	/*:startinsert*
+:startreplace	insert.txt	/*:startreplace*
 :stj	tagsrch.txt	/*:stj*
 :stjump	tagsrch.txt	/*:stjump*
 :stop	starting.txt	/*:stop*
@@ -3617,6 +3625,7 @@ Mark	motion.txt	/*Mark*
 MiNT	os_mint.txt	/*MiNT*
 MorphOS	os_amiga.txt	/*MorphOS*
 Motif	gui_x11.txt	/*Motif*
+MzScheme	if_mzsch.txt	/*MzScheme*
 N	pattern.txt	/*N*
 N%	motion.txt	/*N%*
 N:	cmdline.txt	/*N:*
@@ -5080,6 +5089,7 @@ iconize	starting.txt	/*iconize*
 iconv()	eval.txt	/*iconv()*
 ident-search	tips.txt	/*ident-search*
 if_cscop.txt	if_cscop.txt	/*if_cscop.txt*
+if_mzsch.txt	if_mzsch.txt	/*if_mzsch.txt*
 if_ole.txt	if_ole.txt	/*if_ole.txt*
 if_perl.txt	if_perl.txt	/*if_perl.txt*
 if_pyth.txt	if_pyth.txt	/*if_pyth.txt*
@@ -5371,6 +5381,14 @@ myscriptsfile	syntax.txt	/*myscriptsfile
 mysyntaxfile	syntax.txt	/*mysyntaxfile*
 mysyntaxfile-add	syntax.txt	/*mysyntaxfile-add*
 mysyntaxfile-replace	syntax.txt	/*mysyntaxfile-replace*
+mzscheme	if_mzsch.txt	/*mzscheme*
+mzscheme-buffer	if_mzsch.txt	/*mzscheme-buffer*
+mzscheme-commands	if_mzsch.txt	/*mzscheme-commands*
+mzscheme-examples	if_mzsch.txt	/*mzscheme-examples*
+mzscheme-threads	if_mzsch.txt	/*mzscheme-threads*
+mzscheme-vim	if_mzsch.txt	/*mzscheme-vim*
+mzscheme-vimext	if_mzsch.txt	/*mzscheme-vimext*
+mzscheme-window	if_mzsch.txt	/*mzscheme-window*
 n	pattern.txt	/*n*
 nasm-syntax	syntax.txt	/*nasm-syntax*
 nasm.vim	syntax.txt	/*nasm.vim*
@@ -5746,6 +5764,7 @@ rename-files	tips.txt	/*rename-files*
 repeat.txt	repeat.txt	/*repeat.txt*
 repeating	repeat.txt	/*repeating*
 replacing	change.txt	/*replacing*
+replacing-ex	insert.txt	/*replacing-ex*
 resolve()	eval.txt	/*resolve()*
 restore-position	tips.txt	/*restore-position*
 restricted-mode	starting.txt	/*restricted-mode*
--- a/runtime/doc/todo.txt
+++ b/runtime/doc/todo.txt
@@ -1,4 +1,4 @@
-*todo.txt*      For Vim version 7.0aa.  Last change: 2004 Jul 03
+*todo.txt*      For Vim version 7.0aa.  Last change: 2004 Jul 05
 
 
 		  VIM REFERENCE MANUAL	  by Bram Moolenaar
@@ -30,31 +30,9 @@ be worked on, but only if you sponsor Vi
 							*known-bugs*
 -------------------- Known bugs and current work -----------------------
 
-Docs for 'numberwidth'.  index.  optwin.vim
-
 For version 7.0:
 -   Include many PATCHES:
-    7   Be able to call a function while passing on a variable number of
-	arguments:
-	    :function Foo(abc, ...)
-	    :  call Bar(a:abc, a:*)
-	Charles Campbell has a patch for this
-	He lost the patch himself.
-    7   Make ":startinsert" command work directly for functions and scripts?
-	Also make it possible to append (it's difficult at end of line).
-	And add ":startreplace" (patch by Charles Campbell, 2004 Jan 9,
-	http://www.erols.com/astronaut/vim/index.html#Patch)
-	Update 2004 June 18
-    8   Add patch from Charles Campbell to have ":0file!" remove the name of
-	the current buffer. (2003 June 17)
-	Lost the patch himself.
-    8   Make it possible to delete marks.  Charles Campbell has a patch that
-	does this with the markclear() function (2004 Jan 9).  And the
-	":delmark" command (2004 Feb 9)
-	Update 2004 June 18
     8   ":hardcopy":
-	- Patch to append CTRL-D to PostScript output (Mike Williams, 2004 Jun
-	  14)
 	- support printing multi-byte characters.  Patch from Motonobu
 	  Ichimura.  New (better) patch from Mike Williams (2004 Jan 20)
 	  Updated patch: http://www.eandem.co.uk/mrw/vim/special/index.html
@@ -88,6 +66,13 @@ For version 7.0:
 			Update 2004 Jun 17
 			Missing docs.  Search in 'runtimepath'?
 			How to get the messages into the .po files?
+    8   Make it possible to delete marks.  Charles Campbell has a patch that
+	does this with the markclear() function (2004 Jan 9).
+	And the ":delmark" command (2004 Feb 9)
+	http://mysite.verizon.net/astronaut/vim/index.html#Patch
+	~/tmp/ptch.delmark.bz2
+	~/tmp/ptch.markclear
+	Implement setmark(markname, lnum, col [, filename]) instead?
     --- responses above --
     7   Make "5dd" on last-but-one-line not delete anything (Vi compatible).
 	Add flag in 'cpoptions' for this.  When not present, "2dd" in the last
@@ -206,6 +191,7 @@ For version 7.0:
 -   In the kvim/KDE source files fix the formatting.
 -   KDE version is called "kvim".  Make it "gvim", like the others?
 -   Better configure check for KDE include files from Dan Sharp.
+-   KDE Input method patch. (Yasuhiro Matsumoto)
 -   Change ga_room into ga_maxlen, so that it doesn't need to be
     incremented/decremented each time.
 -   For string variables, use length instead of NUL termination.
@@ -274,8 +260,6 @@ 8   Support four composing characters, n
 -   Mac: Unicode input and display (Eckehard Berns, June 27)
 8   Add patch from Muraoka Taro (Mar 16) to support input method on Mac?
     New patch 2004 Jun 16
-7   Add the MzScheme interface?  New patch 2004 Jul 2. (Sergey Khorev)
-    Also fix a few Lisp problems.
 9   Add cursor-column highlighting.  Enable it with 'cursorcolumn' option,
     set highlighting with "CursorColumn" group.  Useful for aligning text.
     Also cursor-row highlighting.  Patch from Yasuhiro Matsumoto for
@@ -283,6 +267,8 @@ 9   Add cursor-column highlighting.  Ena
     instead.
     Alternative: when 'number' is set highlight the number of the current
     line.
+7   Make ":startinsert" command work directly for functions and scripts?
+    Also make it possible to append (it's difficult at end of line).
 
 Vi incompatibility:
 8   With undo/redo only marks in the changed lines should be changed.  Other
--- a/runtime/doc/various.txt
+++ b/runtime/doc/various.txt
@@ -306,6 +306,7 @@ N  *+mouse_xterm*	Unix only: xterm mouse
 B  *+multi_byte*	Korean and other languages |multibyte|
    *+multi_byte_ime*	Win32 input method for multibyte chars |multibyte-ime|
 N  *+multi_lang*	non-English language support |multi-lang|
+m  *+mzscheme*		Mzscheme interface |mzscheme|
 m  *+netbeans_intg*	|netbeans|
 m  *+ole*		Win32 GUI only: |ole-interface|
    *+osfiletype*	Support for the 'osfiletype' option and filetype
--- a/runtime/doc/version7.txt
+++ b/runtime/doc/version7.txt
@@ -1,4 +1,4 @@
-*version7.txt*  For Vim version 7.0aa.  Last change: 2004 Jul 03
+*version7.txt*  For Vim version 7.0aa.  Last change: 2004 Jul 05
 
 
 		  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -18,6 +18,7 @@ INCOMPATIBLE CHANGES			|incompatible-7|
 NEW FEATURES				|new-7|
 
 New data types				|new-data-types|
+KDE support				|new-KDE|
 Various new items			|new-items-7|
 
 IMPROVEMENTS				|improvements-7|
@@ -64,13 +65,21 @@ Many functions and commands have been ad
 NOT IMPLEMENTED YET!
 
 
-KDE support						*new-kde*
+KDE support						*new-KDE*
 -----------
 
 Kvim is the KDE version of Vim.  It uses the Qt toolkit.  See |KVim|.
 (Thomas Capricelli, Philippe Fremy, Mickael Marchand, Mark Westcott, et al.)
 
 
+MzScheme interface					*new-MzScheme*
+------------------
+
+The MzScheme interpreter is supported. |MzScheme|
+The |:mzscheme| command can be used to execute MzScheme commands.
+The |:mzfile| command can be used to execute an MzScheme script file.
+
+
 Various new items					*new-items-7*
 -----------------
 
@@ -88,11 +97,17 @@ Options: ~
 			Used for the a", a' and a` text objects. |a'|
 'numberwidth'		Minimal width of the space used for the 'number'
 			option. (Emmanuel Renieris)
+'mzquantum'		Time in msec to schedule MzScheme threads.
+
 
 Ex commands: ~
 
 Win32: The ":winpos" command now also works in the console. (Vipin Aravind)
 
+:startreplace		Start Replace mode. (Charles Campbell)
+
+:0file			Removes the name of the buffer. (Charles Campbell)
+
 
 New functions: ~
 
@@ -139,6 +154,11 @@ it. (Johannes Zellner)
 
 Added "nbsp" in 'listchars'. (David Blanchet)
 
+For lisp indenting and matching parenthesis: (Sergey Khorev)
+- square brackets are recognized properly
+- #\(, #\), #\[ and #\] are recognized as character literals
+- Lisp line comments (delimited by semicolon) are recognized
+
 ==============================================================================
 COMPILE TIME CHANGES					*compile-changes-7*
 
@@ -196,4 +216,7 @@ fields. (Walter Briscoe)
 On Sinix SYS_NMLN isn't always defined.  Define it ourselves. (Cristiano De
 Michele)
 
+Printing with PostScript may keep the printer waiting for more.  Append a
+CTRL-D to the printer output. (Mike Williams)
+
  vim:tw=78:ts=8:ft=help:norl:
--- a/runtime/optwin.vim
+++ b/runtime/optwin.vim
@@ -1147,6 +1147,10 @@ call append("$", "\t(local to buffer)")
 call <SID>BinOptionL("bl")
 call append("$", "debug\tset to \"msg\" to see all error messages")
 call append("$", " \tset debug=" . &debug)
+if has("mzscheme")
+  call append("$", "mzquantum\tinterval in milliseconds between polls for MzScheme threads")
+  call append("$", " \tset mzq=" . &mzq)
+endif
 
 set cpo&vim
 
--- a/runtime/print/prolog.ps
+++ b/runtime/print/prolog.ps
@@ -1,6 +1,6 @@
 %!PS-Adobe-3.0 Resource-ProcSet
 %%Title: VIM-Prolog
-%%Version: 1.3 1
+%%Version: 1.4 1
 %%EndComments
 % Editing of this file is NOT RECOMMENDED.  You run a very good risk of causing
 % all PostScript printing from VIM failing if you do.  PostScript is not called
@@ -36,5 +36,6 @@ 3 -1 roll put}{pop}ifelse NFD dup/FontTy
 ifelse 2 copy known{2 copy get dup maxlength dict copy[/questiondown/space]{2
 copy known{2 copy get 2 index/.notdef 3 -1 roll put pop exit}if pop}forall put
 }{pop pop}ifelse dup NFD/FontName 3 -1 roll put NFD definefont pop end}bd
+(\004)cvn{}bd
 % vim:ff=unix:
 %%EOF
--- a/src/Make_ming.mak
+++ b/src/Make_ming.mak
@@ -106,6 +106,21 @@ PERLLIB=$(PERL)/lib
 PERLLIBS=$(PERLLIB)/Core
 endif
 
+# uncomment 'MZSCHEME' if you want a MzScheme-enabled version
+#MZSCHEME=d:/plt
+ifdef MZSCHEME
+ifndef MZSCHEME_VER
+MZSCHEME_VER=205_000
+endif
+# the modern MinGW can dynamically link to dlls directly
+# point MZSCHEME_LIBDIR to where you put libmzschXXXXXXX.dll and libgcXXXXXXX.dll
+# c:/windows/system32 isn't a good idea, use some other dir;
+# to build you can put them in temp dir)
+ifndef MZSCHEME_LIBDIR
+MZSCHEME_LIBDIR=$(MZSCHEME)
+endif
+endif
+
 # Python support -- works with the ActiveState python 2.0 release (and others
 # too, probably)
 #
@@ -252,6 +267,10 @@ CFLAGS += -DDYNAMIC_PERL -DDYNAMIC_PERL_
 endif
 endif
 
+ifdef MZSCHEME
+CFLAGS += -I$(MZSCHEME)/include -DFEAT_MZSCHEME -DMZSCHEME_COLLECTS=\"$(MZSCHEME)/collects\"
+endif
+
 ifdef RUBY
 CFLAGS += -DFEAT_RUBY $(RUBYINC)
 ifeq (yes, $(DYNAMIC_RUBY))
@@ -372,6 +391,10 @@ OBJ = \
 ifdef PERL
 OBJ += $(OUTDIR)/if_perl.o
 endif
+ifdef MZSCHEME
+OBJ += $(OUTDIR)/if_mzsch.o
+MZSCHEME_INCL = if_mzsch.h
+endif
 ifdef PYTHON
 OBJ += $(OUTDIR)/if_python.o
 endif
@@ -401,15 +424,19 @@ endif
 endif
 
 
+ifdef MZSCHEME
+MZSCHEME_SUFFIX = Z
+endif
+
 ifeq ($(GUI),yes)
 TARGET := gvim$(DEBUG_SUFFIX).exe
 DEFINES += $(DEF_GUI)
 OBJ += $(GUIOBJ)
 LFLAGS += -mwindows
-OUTDIR = gobj$(DEBUG_SUFFIX)
+OUTDIR = gobj$(DEBUG_SUFFIX)$(MZSCHEME_SUFFIX)
 else
 TARGET := vim$(DEBUG_SUFFIX).exe
-OUTDIR = obj$(DEBUG_SUFFIX)
+OUTDIR = obj$(DEBUG_SUFFIX)$(MZSCHEME_SUFFIX)
 endif
 
 ifdef GETTEXT
@@ -432,6 +459,10 @@ LIB += -lperl$(PERL_VER)
 endif
 endif
 
+ifdef MZSCHEME
+MZSCHEME_LIB = -lmzsch$(MZSCHEME_VER) -lmzgc$(MZSCHEME_VER)
+endif
+
 ifdef TCL
 LIB += -L$(TCL)/lib
 ifeq (yes, $(DYNAMIC_TCL))
@@ -479,7 +510,7 @@ uninstal.exe: uninstal.c
 	$(CC) $(CFLAGS) -o uninstal.exe uninstal.c $(LIB)
 
 $(TARGET): $(OUTDIR) $(OBJ)
-	$(CC) $(CFLAGS) $(LFLAGS) -o $@ $(OBJ) $(LIB) -lole32 -luuid $(PYTHONLIB) $(RUBYLIB)
+	$(CC) $(CFLAGS) $(LFLAGS) -o $@ $(OBJ) $(LIB) -lole32 -luuid -L $(MZSCHEME_LIBDIR) $(MZSCHEME_LIB) $(PYTHONLIB) $(RUBYLIB)
 
 upx: exes
 	upx gvim.exe
--- a/src/Make_mvc.mak
+++ b/src/Make_mvc.mak
@@ -19,6 +19,7 @@
 #	  DYNAMIC_IME=[yes or no]  (to load the imm32.dll dynamically, default
 #	  is yes)
 #	Global IME support: GIME=yes (requires GUI=yes)
+#	MzScheme interface: MZSCHEME=[Path to MzScheme directory], MZSCHEME_VER=[version, 205_000, ...]
 #	Perl interface:
 #	  PERL=[Path to Perl directory]
 #	  DYNAMIC_PERL=yes (to load the Perl DLL dynamically)
@@ -116,6 +117,9 @@ OBJDIR = .\ObjC
 !if "$(OLE)" == "yes"
 OBJDIR = $(OBJDIR)O
 !endif
+!ifdef MZSCHEME
+OBJDIR = $(OBJDIR)Z
+!endif
 !if "$(DEBUG)" == "yes"
 OBJDIR = $(OBJDIR)d
 !endif
@@ -487,6 +491,17 @@ PYTHON_LIB = $(PYTHON)\libs\python$(PYTH
 !endif
 !endif
 
+# MzScheme interface
+!ifdef MZSCHEME
+!message MzScheme requested - root dir is "$(MZSCHEME)"
+!ifndef MZSCHEME_VER
+MZSCHEME_VER = 205_000
+!endif
+CFLAGS = $(CFLAGS) -DFEAT_MZSCHEME -I $(MZSCHEME)\include
+MZSCHEME_OBJ = $(OUTDIR)\if_mzsch.obj
+MZSCHEME_LIB = $(MZSCHEME)\lib\msvc\libmzgc$(MZSCHEME_VER).lib $(MZSCHEME)\lib\msvc\libmzsch$(MZSCHEME_VER).lib
+!endif
+
 # Perl interface
 !ifdef PERL
 !ifndef PERL_VER
@@ -607,15 +622,15 @@ conflags = $(conflags) /map /mapinfo:lin
 
 LINKARGS1 = $(linkdebug) $(conflags) /nodefaultlib:libc
 LINKARGS2 = $(CON_LIB) $(GUI_LIB) $(LIBC) $(OLE_LIB)  user32.lib $(SNIFF_LIB) \
-		$(PERL_LIB) $(PYTHON_LIB) $(RUBY_LIB) $(TCL_LIB) \
+		$(MZSCHEME_LIB) $(PERL_LIB) $(PYTHON_LIB) $(RUBY_LIB) $(TCL_LIB) \
 		$(NETBEANS_LIB) $(XPM_LIB) $(LINK_PDB)
 
 all:	$(VIM) vimrun.exe install.exe uninstal.exe xxd/xxd.exe GvimExt/gvimext.dll
 
-$(VIM): $(OUTDIR) $(OBJ) $(GUI_OBJ) $(OLE_OBJ) $(OLE_IDL) $(PERL_OBJ) $(PYTHON_OBJ) $(RUBY_OBJ) $(TCL_OBJ) $(SNIFF_OBJ) $(CSCOPE_OBJ) $(NETBEANS_OBJ) $(XPM_OBJ) version.c version.h
+$(VIM): $(OUTDIR) $(OBJ) $(GUI_OBJ) $(OLE_OBJ) $(OLE_IDL) $(MZSCHEME_OBJ) $(PERL_OBJ) $(PYTHON_OBJ) $(RUBY_OBJ) $(TCL_OBJ) $(SNIFF_OBJ) $(CSCOPE_OBJ) $(NETBEANS_OBJ) $(XPM_OBJ) version.c version.h
 	$(CC) $(CFLAGS)  version.c /Fo$(OUTDIR)/version.obj $(PDB)
 	$(link) $(LINKARGS1) -out:$*.exe $(OBJ) $(GUI_OBJ) $(OLE_OBJ) \
-		$(PERL_OBJ) $(PYTHON_OBJ) $(RUBY_OBJ) $(TCL_OBJ) $(SNIFF_OBJ) \
+		$(MZSCHEME_OBJ) $(PERL_OBJ) $(PYTHON_OBJ) $(RUBY_OBJ) $(TCL_OBJ) $(SNIFF_OBJ) \
 		$(CSCOPE_OBJ) $(NETBEANS_OBJ) $(XPM_OBJ) \
 		$(OUTDIR)\version.obj $(LINKARGS2)
 
@@ -747,6 +762,9 @@ if_perl.c : if_perl.xs typemap
 $(OUTDIR)/if_perlsfio.obj: $(OUTDIR) if_perlsfio.c  $(INCL)
 	$(CC) $(CFLAGS) $(PERL_INC) if_perlsfio.c /Fo$(OUTDIR)/if_perlsfio.obj $(PDB)
 
+$(OUTDIR)/if_mzsch.obj: $(OUTDIR) if_mzsch.c  $(INCL)
+	$(CC) $(CFLAGS) $(PERL_INC) if_mzsch.c /Fo$(OUTDIR)/if_mzsch.obj $(PDB) -DMZSCHEME_COLLECTS=\"$(MZSCHEME:\=\\)\\collects\"
+
 $(OUTDIR)/if_python.obj: $(OUTDIR) if_python.c  $(INCL)
 	$(CC) $(CFLAGS) $(PYTHON_INC) if_python.c /Fo$(OUTDIR)/if_python.obj $(PDB)
 
@@ -840,7 +858,7 @@ auto/pathdef.c: auto
 	@echo #include "vim.h" >> auto\pathdef.c
 	@echo char_u *default_vim_dir = (char_u *)"$(VIMRCLOC:\=\\)"; >> auto\pathdef.c
 	@echo char_u *default_vimruntime_dir = (char_u *)"$(VIMRUNTIMEDIR:\=\\)"; >> auto\pathdef.c
-	@echo char_u *all_cflags = (char_u *)"$(CC:\=\\) $(CFLAGS)"; >> auto\pathdef.c
+	@echo char_u *all_cflags = (char_u *)"$(CC:\=\\) $(CFLAGS:\=\\)"; >> auto\pathdef.c
 	@echo char_u *all_lflags = (char_u *)"$(link:\=\\) $(LINKARGS1:\=\\) $(LINKARGS2:\=\\)"; >> auto\pathdef.c
 	@echo char_u *compiled_user = (char_u *)"$(USERNAME)"; >> auto\pathdef.c
 	@echo char_u *compiled_sys = (char_u *)"$(USERDOMAIN)"; >> auto\pathdef.c
--- a/src/Makefile
+++ b/src/Makefile
@@ -354,7 +354,7 @@ CClink = $(CC)
 # Darwin.  None of the Mac specific options or files will be used.
 #CONF_OPT_DARWIN = --disable-darwin
 
-# PERL - For creating Vim with Perl interface
+# PERL
 # Uncomment this when you want to include the Perl interface.
 # The Perl option sometimes causes problems, because it adds extra flags
 # to the command line.	If you see strange flags during compilation, check in
@@ -365,19 +365,27 @@ CClink = $(CC)
 # This requires at least "small" features, "tiny" doesn't work.
 #CONF_OPT_PERL = --enable-perlinterp
 
-# PYTHON - For creating Vim with Python interface
+# PYTHON
 # Uncomment this when you want to include the Python interface.
 #CONF_OPT_PYTHON = --enable-pythoninterp
 
-# TCL - For creating Vim with Tcl interface
+# TCL
 # Uncomment this when you want to include the Tcl interface.
 #CONF_OPT_TCL = --enable-tclinterp
 
-# RUBY - For creating Vim with Ruby interface
+# RUBY
 # Uncomment this when you want to include the Ruby interface.
 #CONF_OPT_RUBY = --enable-rubyinterp
 
-# CSCOPE - For creating Vim with Cscope interface
+# MZSCHEME
+# Uncomment this when you want to include the MzScheme interface.
+#CONF_OPT_MZSCHEME = --enable-mzschemeinterp
+# PLT/mrscheme/drscheme Home dir; the PLTHOME environment variable also works
+#CONF_OPT_PLTHOME  = --with-plthome=/usr/local/plt
+#CONF_OPT_PLTHOME  = --with-plthome=/usr/local/drscheme
+#CONF_OPT_PLTHOME  = --with-plthome=/home/me/mz
+
+# CSCOPE
 # Uncomment this when you want to include the Cscope interface.
 #CONF_OPT_CSCOPE = --enable-cscope
 
@@ -1047,7 +1055,7 @@ KDE_DIR		= $(KDE_PREFIX)
 KDE_INCL	= gui.h
 KDE_SRC		= gui.c pty.c gui_kde.cc gui_kde_x11.cc gui_kde_widget.cc gui_kde_widget_moc.cc kvim_iface_skel.cc
 KDE_OBJ		= objects/gui.o objects/pty.o objects/gui_kde.o objects/gui_kde_x11.o \
-	   		objects/gui_kde_widget.o objects/gui_kde_widget_moc.o \
+			objects/gui_kde_widget.o objects/gui_kde_widget_moc.o \
 			objects/kvim_iface_skel.o
 KDE_DEFS	= -DFEAT_GUI_KDE $(NARROW_PROTO)
 KDE_IPATH	= $(GUI_INC_LOC)
@@ -1245,7 +1253,7 @@ SHELL = /bin/sh
 .SUFFIXES: .cc .c .o .pro
 
 PRE_DEFS = -Iproto $(DEFS) $(GUI_DEFS) $(GUI_IPATH) $(CPPFLAGS) $(EXTRA_IPATHS)
-POST_DEFS = $(X_CFLAGS) $(PERL_CFLAGS) $(PYTHON_CFLAGS) $(TCL_CFLAGS) $(RUBY_CFLAGS) $(EXTRA_DEFS)
+POST_DEFS = $(X_CFLAGS) $(MZSCHEME_CFLAGS) $(PERL_CFLAGS) $(PYTHON_CFLAGS) $(TCL_CFLAGS) $(RUBY_CFLAGS) $(EXTRA_DEFS)
 
 ALL_CFLAGS = $(PRE_DEFS) $(CFLAGS) $(PROFILE_CFLAGS) $(POST_DEFS)
 
@@ -1256,7 +1264,7 @@ DEPEND_CFLAGS = -DPROTO -DDEPEND -DFEAT_
 PFLAGS = $(PROTO_FLAGS) -DPROTO $(LINT_CFLAGS)
 
 ALL_LIB_DIRS = $(GUI_LIBS_DIR) $(X_LIBS_DIR)
-ALL_LIBS = $(GUI_LIBS1) $(GUI_X_LIBS) $(GUI_LIBS2) $(X_PRE_LIBS) $(X_LIBS) $(X_EXTRA_LIBS) $(LIBS) $(EXTRA_LIBS) $(PERL_LIBS) $(PYTHON_LIBS) $(TCL_LIBS) $(RUBY_LIBS) $(PROFILE_LIBS)
+ALL_LIBS = $(GUI_LIBS1) $(GUI_X_LIBS) $(GUI_LIBS2) $(X_PRE_LIBS) $(X_LIBS) $(X_EXTRA_LIBS) $(LIBS) $(EXTRA_LIBS) $(MZSCHEME_LIBS) $(PERL_LIBS) $(PYTHON_LIBS) $(TCL_LIBS) $(RUBY_LIBS) $(PROFILE_LIBS)
 
 # abbreviations
 DEST_BIN = $(DESTDIR)$(BINDIR)
@@ -1334,14 +1342,15 @@ BASIC_SRC = \
 	window.c \
 	$(OS_EXTRA_SRC)
 
-SRC =	$(BASIC_SRC) $(GUI_SRC) $(HANGULIN_SRC) $(PERL_SRC) $(PYTHON_SRC) \
-	$(TCL_SRC) $(RUBY_SRC) $(SNIFF_SRC) $(WORKSHOP_SRC) $(WSDEBUG_SRC)
+SRC =	$(BASIC_SRC) $(GUI_SRC) $(HANGULIN_SRC) $(MZSCHEME_SRC) \
+	$(PERL_SRC) $(PYTHON_SRC) $(TCL_SRC) $(RUBY_SRC) \
+	$(SNIFF_SRC) $(WORKSHOP_SRC) $(WSDEBUG_SRC)
 
 TAGS_SRC = *.c *.cpp *.cc if_perl.xs
 
-EXTRA_SRC = hangulin.c auto/if_perl.c if_perlsfio.c if_python.c if_tcl.c \
-		if_ruby.c if_sniff.c gui_beval.c \
-		workshop.c wsdebug.c integration.c netbeans.c
+EXTRA_SRC = hangulin.c if_mzsch.c auto/if_perl.c if_perlsfio.c \
+	    if_python.c if_tcl.c if_ruby.c if_sniff.c gui_beval.c \
+	    workshop.c wsdebug.c integration.c netbeans.c
 
 # All sources, also the ones that are not configured
 ALL_SRC = $(BASIC_SRC) $(ALL_GUI_SRC) $(EXTRA_SRC)
@@ -1399,6 +1408,7 @@ OBJ = \
 	objects/undo.o \
 	objects/window.o \
 	$(GUI_OBJ) \
+	$(MZSCHEME_OBJ) \
 	$(PERL_OBJ) \
 	$(PYTHON_OBJ) \
 	$(TCL_OBJ) \
@@ -1488,7 +1498,7 @@ config auto/config.mk: auto/configure co
 		$(CONF_OPT_OUTPUT) $(CONF_OPT_GPM) $(CONF_OPT_WORKSHOP) \
 		$(CONF_OPT_SNIFF) $(CONF_OPT_FEAT) $(CONF_TERM_LIB) \
 		$(CONF_OPT_COMPBY) $(CONF_OPT_ACL)  $(CONF_OPT_NETBEANS) \
-		$(CONF_ARGS)
+		$(CONF_ARGS) $(CONF_OPT_MZSCHEME) $(CONF_OPT_PLTHOME)
 
 # Use "make reconfig" to rerun configure without cached values.
 # When config.h changes, most things will be recompiled automatically.
@@ -2281,6 +2291,9 @@ objects/if_cscope.o: if_cscope.c
 objects/if_xcmdsrv.o: if_xcmdsrv.c
 	$(CCC) -o $@ if_xcmdsrv.c
 
+objects/if_mzsch.o: if_mzsch.c
+	$(CCC) -o $@ if_mzsch.c
+
 objects/if_perl.o: auto/if_perl.c
 	$(CCC) -o $@ auto/if_perl.c
 
@@ -2757,6 +2770,10 @@ objects/hangulin.o: hangulin.c vim.h aut
  auto/osdef.h ascii.h keymap.h term.h macros.h structs.h regexp.h \
  gui.h gui_beval.h proto/gui_beval.pro option.h ex_cmds.h proto.h \
  globals.h farsi.h arabic.h
+objects/if_mzsch.o: if_mzsch.c vim.h auto/config.h feature.h os_unix.h \
+ auto/osdef.h ascii.h keymap.h term.h macros.h structs.h regexp.h \
+ gui.h gui_beval.h proto/gui_beval.pro option.h ex_cmds.h proto.h \
+ globals.h farsi.h arabic.h
 objects/if_perl.o: auto/if_perl.c vim.h auto/config.h feature.h os_unix.h \
  auto/osdef.h ascii.h keymap.h term.h macros.h structs.h regexp.h \
  gui.h gui_beval.h proto/gui_beval.pro option.h ex_cmds.h proto.h \
--- a/src/auto/configure
+++ b/src/auto/configure
@@ -32,6 +32,10 @@ ac_help="$ac_help
 ac_help="$ac_help
   --disable-xsmp-interact Disable XSMP interaction"
 ac_help="$ac_help
+  --enable-mzschemeinterp   Include MzScheme interpreter."
+ac_help="$ac_help
+  --with-plthome=PLTHOME   Use PLTHOME."
+ac_help="$ac_help
   --enable-perlinterp     Include Perl interpreter."
 ac_help="$ac_help
   --enable-pythoninterp   Include Python interpreter."
@@ -636,7 +640,7 @@ cat >> confdefs.h <<\EOF
 EOF
 
 echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
-echo "configure:640: checking whether ${MAKE-make} sets \${MAKE}" >&5
+echo "configure:644: 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
@@ -666,7 +670,7 @@ fi
 # 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:670: checking for $ac_word" >&5
+echo "configure:674: 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
@@ -696,7 +700,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:700: checking for $ac_word" >&5
+echo "configure:704: 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
@@ -747,7 +751,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:751: checking for $ac_word" >&5
+echo "configure:755: 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
@@ -779,7 +783,7 @@ fi
 fi
 
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:783: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:787: 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.
@@ -790,12 +794,12 @@ cross_compiling=$ac_cv_prog_cc_cross
 
 cat > conftest.$ac_ext << EOF
 
-#line 794 "configure"
+#line 798 "configure"
 #include "confdefs.h"
 
 main(){return(0);}
 EOF
-if { (eval echo configure:799: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:803: \"$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
@@ -821,12 +825,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:825: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:829: 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:830: checking whether we are using GNU C" >&5
+echo "configure:834: 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
@@ -835,7 +839,7 @@ else
   yes;
 #endif
 EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:839: \"$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:843: \"$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
@@ -854,7 +858,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:858: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:862: 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
@@ -885,7 +889,7 @@ else
   fi
 fi
 	echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:889: checking how to run the C preprocessor" >&5
+echo "configure:893: checking how to run the C preprocessor" >&5
 # On Suns, sometimes $CPP names a directory.
 if test -n "$CPP" && test -d "$CPP"; then
   CPP=
@@ -900,13 +904,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 904 "configure"
+#line 908 "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:910: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:914: \"$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
   :
@@ -917,13 +921,13 @@ else
   rm -rf conftest*
   CPP="${CC-cc} -E -traditional-cpp"
   cat > conftest.$ac_ext <<EOF
-#line 921 "configure"
+#line 925 "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:927: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:931: \"$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
   :
@@ -934,13 +938,13 @@ else
   rm -rf conftest*
   CPP="${CC-cc} -nologo -E"
   cat > conftest.$ac_ext <<EOF
-#line 938 "configure"
+#line 942 "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:944: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:948: \"$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
   :
@@ -964,7 +968,7 @@ else
 fi
 echo "$ac_t""$CPP" 1>&6
 	cat > conftest.$ac_ext <<EOF
-#line 968 "configure"
+#line 972 "configure"
 #include "confdefs.h"
 
 EOF
@@ -974,7 +978,7 @@ if (eval "$ac_cpp conftest.$ac_ext") 2>&
 fi
 rm -f conftest*
  echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&6
-echo "configure:978: checking for POSIXized ISC" >&5
+echo "configure:982: 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
@@ -998,7 +1002,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:1002: checking for $ac_word" >&5
+echo "configure:1006: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_AWK'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1030,7 +1034,7 @@ done
 # Extract the first word of "strip", so it can be a program name with args.
 set dummy strip; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1034: checking for $ac_word" >&5
+echo "configure:1038: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1059,12 +1063,12 @@ fi
 
 
 echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6
-echo "configure:1063: checking for Cygwin environment" >&5
+echo "configure:1067: checking for Cygwin environment" >&5
 if eval "test \"`echo '$''{'ac_cv_cygwin'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1068 "configure"
+#line 1072 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -1075,7 +1079,7 @@ int main() {
 return __CYGWIN__;
 ; return 0; }
 EOF
-if { (eval echo configure:1079: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1083: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_cygwin=yes
 else
@@ -1092,19 +1096,19 @@ echo "$ac_t""$ac_cv_cygwin" 1>&6
 CYGWIN=
 test "$ac_cv_cygwin" = yes && CYGWIN=yes
 echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6
-echo "configure:1096: checking for mingw32 environment" >&5
+echo "configure:1100: checking for mingw32 environment" >&5
 if eval "test \"`echo '$''{'ac_cv_mingw32'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1101 "configure"
+#line 1105 "configure"
 #include "confdefs.h"
 
 int main() {
 return __MINGW32__;
 ; return 0; }
 EOF
-if { (eval echo configure:1108: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1112: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_mingw32=yes
 else
@@ -1123,7 +1127,7 @@ test "$ac_cv_mingw32" = yes && MINGW32=y
 
 
 echo $ac_n "checking for executable suffix""... $ac_c" 1>&6
-echo "configure:1127: checking for executable suffix" >&5
+echo "configure:1131: checking for executable suffix" >&5
 if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1133,7 +1137,7 @@ else
   rm -f conftest*
   echo 'int main () { return 0; }' > conftest.$ac_ext
   ac_cv_exeext=
-  if { (eval echo configure:1137: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+  if { (eval echo configure:1141: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
     for file in conftest.*; do
       case $file in
       *.c | *.o | *.obj) ;;
@@ -1180,14 +1184,14 @@ test "$GCC" = yes && CPP_MM=M;
 
 if test -f ./toolcheck; then
   echo "checking for buggy tools" 1>&6
-echo "configure:1184: checking for buggy tools" >&5
+echo "configure:1188: checking for buggy tools" >&5
   sh ./toolcheck 1>&6
 fi
 
 OS_EXTRA_SRC=""; OS_EXTRA_OBJ=""
 
 echo $ac_n "checking for BeOS""... $ac_c" 1>&6
-echo "configure:1191: checking for BeOS" >&5
+echo "configure:1195: checking for BeOS" >&5
 case `uname` in
     BeOS)	OS_EXTRA_SRC=os_beos.c; OS_EXTRA_OBJ=objects/os_beos.o
 		BEOS=yes; echo "$ac_t""yes" 1>&6;;
@@ -1195,7 +1199,7 @@ case `uname` in
 esac
 
 echo $ac_n "checking for QNX""... $ac_c" 1>&6
-echo "configure:1199: checking for QNX" >&5
+echo "configure:1203: checking for QNX" >&5
 case `uname` in
     QNX)	OS_EXTRA_SRC=os_qnx.c; OS_EXTRA_OBJ=objects/os_qnx.o
 		test -z "$with_x" && with_x=no
@@ -1205,12 +1209,12 @@ esac
 
 DEFAULT_VIMNAME=vim
 echo $ac_n "checking for Darwin (Mac OS X)""... $ac_c" 1>&6
-echo "configure:1209: checking for Darwin (Mac OS X)" >&5
+echo "configure:1213: checking for Darwin (Mac OS X)" >&5
 if test "`(uname) 2>/dev/null`" = Darwin; then
   echo "$ac_t""yes" 1>&6
 
   echo $ac_n "checking --disable-darwin argument""... $ac_c" 1>&6
-echo "configure:1214: checking --disable-darwin argument" >&5
+echo "configure:1218: checking --disable-darwin argument" >&5
   # Check whether --enable-darwin or --disable-darwin was given.
 if test "${enable_darwin+set}" = set; then
   enableval="$enable_darwin"
@@ -1222,7 +1226,7 @@ fi
   if test "$enable_darwin" = "yes"; then
     echo "$ac_t""no" 1>&6
     echo $ac_n "checking if Darwin files are there""... $ac_c" 1>&6
-echo "configure:1226: checking if Darwin files are there" >&5
+echo "configure:1230: checking if Darwin files are there" >&5
     if test -f os_macosx.c; then
       echo "$ac_t""yes" 1>&6
     else
@@ -1241,17 +1245,17 @@ echo "configure:1226: checking if Darwin
 
             ac_safe=`echo "Carbon/Carbon.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for Carbon/Carbon.h""... $ac_c" 1>&6
-echo "configure:1245: checking for Carbon/Carbon.h" >&5
+echo "configure:1249: checking for Carbon/Carbon.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 1250 "configure"
+#line 1254 "configure"
 #include "confdefs.h"
 #include <Carbon/Carbon.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1255: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1259: \"$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*
@@ -1308,7 +1312,7 @@ if test -z "$have_local_include" -a -d /
 fi
 
 echo $ac_n "checking --with-vim-name argument""... $ac_c" 1>&6
-echo "configure:1312: checking --with-vim-name argument" >&5
+echo "configure:1316: checking --with-vim-name argument" >&5
 # Check whether --with-vim-name or --without-vim-name was given.
 if test "${with_vim_name+set}" = set; then
   withval="$with_vim_name"
@@ -1319,7 +1323,7 @@ fi
 
 
 echo $ac_n "checking --with-ex-name argument""... $ac_c" 1>&6
-echo "configure:1323: checking --with-ex-name argument" >&5
+echo "configure:1327: checking --with-ex-name argument" >&5
 # Check whether --with-ex-name or --without-ex-name was given.
 if test "${with_ex_name+set}" = set; then
   withval="$with_ex_name"
@@ -1330,7 +1334,7 @@ fi
 
 
 echo $ac_n "checking --with-view-name argument""... $ac_c" 1>&6
-echo "configure:1334: checking --with-view-name argument" >&5
+echo "configure:1338: checking --with-view-name argument" >&5
 # Check whether --with-view-name or --without-view-name was given.
 if test "${with_view_name+set}" = set; then
   withval="$with_view_name"
@@ -1342,7 +1346,7 @@ fi
 
 
 echo $ac_n "checking --with-global-runtime argument""... $ac_c" 1>&6
-echo "configure:1346: checking --with-global-runtime argument" >&5
+echo "configure:1350: checking --with-global-runtime argument" >&5
 # Check whether --with-global-runtime or --without-global-runtime was given.
 if test "${with_global_runtime+set}" = set; then
   withval="$with_global_runtime"
@@ -1356,7 +1360,7 @@ fi
 
 
 echo $ac_n "checking --with-modified-by argument""... $ac_c" 1>&6
-echo "configure:1360: checking --with-modified-by argument" >&5
+echo "configure:1364: checking --with-modified-by argument" >&5
 # Check whether --with-modified-by or --without-modified-by was given.
 if test "${with_modified_by+set}" = set; then
   withval="$with_modified_by"
@@ -1370,9 +1374,9 @@ fi
 
 
 echo $ac_n "checking if character set is EBCDIC""... $ac_c" 1>&6
-echo "configure:1374: checking if character set is EBCDIC" >&5
+echo "configure:1378: checking if character set is EBCDIC" >&5
 cat > conftest.$ac_ext <<EOF
-#line 1376 "configure"
+#line 1380 "configure"
 #include "confdefs.h"
  
 int main() {
@@ -1385,7 +1389,7 @@ make an error "Character set is not EBCD
 #endif 
 ; return 0; }
 EOF
-if { (eval echo configure:1389: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1393: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
    # TryCompile action if true
 cf_cv_ebcdic=yes 
@@ -1413,7 +1417,7 @@ esac
 
 if test "$cf_cv_ebcdic" = "yes"; then
 echo $ac_n "checking for OS/390 Unix""... $ac_c" 1>&6
-echo "configure:1417: checking for OS/390 Unix" >&5
+echo "configure:1421: checking for OS/390 Unix" >&5
 case `uname` in
     OS/390)	OS390Unix="yes";
 										if test "$CC" = "cc"; then
@@ -1450,7 +1454,7 @@ fi
 
 
 echo $ac_n "checking --with-features argument""... $ac_c" 1>&6
-echo "configure:1454: checking --with-features argument" >&5
+echo "configure:1458: checking --with-features argument" >&5
 # Check whether --with-features or --without-features was given.
 if test "${with_features+set}" = set; then
   withval="$with_features"
@@ -1493,7 +1497,7 @@ esac
 
 
 echo $ac_n "checking --with-compiledby argument""... $ac_c" 1>&6
-echo "configure:1497: checking --with-compiledby argument" >&5
+echo "configure:1501: checking --with-compiledby argument" >&5
 # Check whether --with-compiledby or --without-compiledby was given.
 if test "${with_compiledby+set}" = set; then
   withval="$with_compiledby"
@@ -1505,7 +1509,7 @@ fi
 
 
 echo $ac_n "checking --disable-xsmp argument""... $ac_c" 1>&6
-echo "configure:1509: checking --disable-xsmp argument" >&5
+echo "configure:1513: checking --disable-xsmp argument" >&5
 # Check whether --enable-xsmp or --disable-xsmp was given.
 if test "${enable_xsmp+set}" = set; then
   enableval="$enable_xsmp"
@@ -1518,7 +1522,7 @@ fi
 if test "$enable_xsmp" = "yes"; then
   echo "$ac_t""no" 1>&6
   echo $ac_n "checking --disable-xsmp-interact argument""... $ac_c" 1>&6
-echo "configure:1522: checking --disable-xsmp-interact argument" >&5
+echo "configure:1526: checking --disable-xsmp-interact argument" >&5
   # Check whether --enable-xsmp-interact or --disable-xsmp-interact was given.
 if test "${enable_xsmp_interact+set}" = set; then
   enableval="$enable_xsmp_interact"
@@ -1540,8 +1544,142 @@ else
   echo "$ac_t""yes" 1>&6
 fi
 
+echo $ac_n "checking --enable-mzschemeinterp argument""... $ac_c" 1>&6
+echo "configure:1549: checking --enable-mzschemeinterp argument" >&5
+# Check whether --enable-mzschemeinterp or --disable-mzschemeinterp was given.
+if test "${enable_mzschemeinterp+set}" = set; then
+  enableval="$enable_mzschemeinterp"
+  :
+else
+  enable_mzschemeinterp="no"
+fi
+
+echo "$ac_t""$enable_mzschemeinterp" 1>&6
+
+if test "$enable_mzschemeinterp" = "yes"; then
+    
+
+  echo $ac_n "checking --with-plthome argument""... $ac_c" 1>&6
+echo "configure:1564: checking --with-plthome argument" >&5
+  # Check whether --with-plthome or --without-plthome was given.
+if test "${with_plthome+set}" = set; then
+  withval="$with_plthome"
+  with_plthome="$withval"; echo "$ac_t""$with_plthome" 1>&6
+else
+  with_plthome="";echo "$ac_t"""no"" 1>&6
+fi
+
+
+  if test "X$with_plthome" != "X"; then
+       vi_cv_path_mzscheme_pfx="$with_plthome"
+  else
+    echo $ac_n "checking PLTHOME environment var""... $ac_c" 1>&6
+echo "configure:1578: checking PLTHOME environment var" >&5
+    if test "X$PLTHOME" != "X"; then
+	echo "$ac_t"""$PLTHOME"" 1>&6
+        vi_cv_path_mzscheme_pfx="$PLTHOME"
+    else
+	echo "$ac_t"""not set"" 1>&6
+	        # Extract the first word of "mzscheme", so it can be a program name with args.
+set dummy mzscheme; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:1587: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_path_vi_cv_path_mzscheme'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  case "$vi_cv_path_mzscheme" in
+  /*)
+  ac_cv_path_vi_cv_path_mzscheme="$vi_cv_path_mzscheme" # Let the user override the test with a path.
+  ;;
+  ?:/*)			 
+  ac_cv_path_vi_cv_path_mzscheme="$vi_cv_path_mzscheme" # Let the user override the test with a dos path.
+  ;;
+  *)
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do 
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_path_vi_cv_path_mzscheme="$ac_dir/$ac_word"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+  ;;
+esac
+fi
+vi_cv_path_mzscheme="$ac_cv_path_vi_cv_path_mzscheme"
+if test -n "$vi_cv_path_mzscheme"; then
+  echo "$ac_t""$vi_cv_path_mzscheme" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+		        if test "X$vi_cv_path_mzscheme" != "X"; then
+	  lsout=`ls -l $vi_cv_path_mzscheme`
+	  if echo "$lsout" | grep -e '->' >/dev/null 2>/dev/null; then
+	    vi_cv_path_mzscheme=`echo "$lsout" | sed 's/.*-> \(.*\)/\1/'`
+	  fi
+	fi
+
+        if test "X$vi_cv_path_mzscheme" != "X"; then
+                        echo $ac_n "checking MzScheme install prefix""... $ac_c" 1>&6
+echo "configure:1629: checking MzScheme install prefix" >&5
+if eval "test \"`echo '$''{'vi_cv_path_mzscheme_pfx'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+   vi_cv_path_mzscheme_pfx=`
+      	    ${vi_cv_path_mzscheme} -evm \
+            "(display (simplify-path		\
+              (build-path (call-with-values	\
+      	        (lambda () (split-path (find-system-path (quote exec-file)))) \
+      	        (lambda (base name must-be-dir?) base)) (quote up))))"` 
+fi
+
+echo "$ac_t""$vi_cv_path_mzscheme_pfx" 1>&6
+	    	    vi_cv_path_mzscheme_pfx=`echo "$vi_cv_path_mzscheme_pfx" | sed 's+/$++'`
+        fi
+    fi
+  fi
+
+  if test "X$vi_cv_path_mzscheme_pfx" != "X"; then
+    echo $ac_n "checking if scheme.h can be found in $vi_cv_path_mzscheme_pfx/include""... $ac_c" 1>&6
+echo "configure:1649: checking if scheme.h can be found in $vi_cv_path_mzscheme_pfx/include" >&5
+    if test -f $vi_cv_path_mzscheme_pfx/include/scheme.h; then
+      echo "$ac_t"""yes"" 1>&6
+    else
+      echo "$ac_t"""no"" 1>&6
+      vi_cv_path_mzscheme_pfx=
+    fi
+  fi
+
+  if test "X$vi_cv_path_mzscheme_pfx" != "X"; then
+    if test -f "${vi_cv_path_mzscheme_pfx}/lib/libmzgc.a"; then
+      MZSCHEME_LIBS="${vi_cv_path_mzscheme_pfx}/lib/libmzgc.a ${vi_cv_path_mzscheme_pfx}/lib/libmzscheme.a"
+    else
+      MZSCHEME_LIBS="-L${vi_cv_path_mzscheme_pfx}/lib -lmzgc -lmzscheme"
+    fi
+    MZSCHEME_CFLAGS="-I${vi_cv_path_mzscheme_pfx}/include   \
+      -DMZSCHEME_COLLECTS='\"${vi_cv_path_mzscheme_pfx}/collects\"'"
+    MZSCHEME_SRC="if_mzsch.c"
+    MZSCHEME_OBJ="objects/if_mzsch.o"
+    MZSCHEME_PRO="if_mzsch.pro"
+    cat >> confdefs.h <<\EOF
+#define FEAT_MZSCHEME 1
+EOF
+
+  fi
+  
+  
+  
+  
+  
+fi
+
+
 echo $ac_n "checking --enable-perlinterp argument""... $ac_c" 1>&6
-echo "configure:1545: checking --enable-perlinterp argument" >&5
+echo "configure:1683: checking --enable-perlinterp argument" >&5
 # Check whether --enable-perlinterp or --disable-perlinterp was given.
 if test "${enable_perlinterp+set}" = set; then
   enableval="$enable_perlinterp"
@@ -1556,7 +1694,7 @@ if test "$enable_perlinterp" = "yes"; th
   # Extract the first word of "perl", so it can be a program name with args.
 set dummy perl; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1560: checking for $ac_word" >&5
+echo "configure:1698: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_vi_cv_path_perl'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1590,7 +1728,7 @@ fi
 
   if test "X$vi_cv_path_perl" != "X"; then
     echo $ac_n "checking Perl version""... $ac_c" 1>&6
-echo "configure:1594: checking Perl version" >&5
+echo "configure:1732: checking Perl version" >&5
     if $vi_cv_path_perl -e 'require 5.003_01' >/dev/null 2>/dev/null; then
      eval `$vi_cv_path_perl -V:usethreads`
      if test "X$usethreads" = "XUNKNOWN" -o "X$usethreads" = "Xundef"; then
@@ -1626,7 +1764,7 @@ echo "configure:1594: checking Perl vers
 		-e 'ccdlflags' | sed -e 's/-bE:perl.exp//'`
 
                   echo $ac_n "checking if compile and link flags for Perl are sane""... $ac_c" 1>&6
-echo "configure:1630: checking if compile and link flags for Perl are sane" >&5
+echo "configure:1768: checking if compile and link flags for Perl are sane" >&5
       cflags_save=$CFLAGS
       libs_save=$LIBS
       ldflags_save=$LDFLAGS
@@ -1634,14 +1772,14 @@ echo "configure:1630: checking if compil
       LIBS="$LIBS $perllibs"
       LDFLAGS="$perlldflags $LDFLAGS"
       cat > conftest.$ac_ext <<EOF
-#line 1638 "configure"
+#line 1776 "configure"
 #include "confdefs.h"
 
 int main() {
  
 ; return 0; }
 EOF
-if { (eval echo configure:1645: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1783: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   echo "$ac_t""yes" 1>&6; perl_ok=yes
 else
@@ -1704,7 +1842,7 @@ fi
 
 
 echo $ac_n "checking --enable-pythoninterp argument""... $ac_c" 1>&6
-echo "configure:1708: checking --enable-pythoninterp argument" >&5
+echo "configure:1846: checking --enable-pythoninterp argument" >&5
 # Check whether --enable-pythoninterp or --disable-pythoninterp was given.
 if test "${enable_pythoninterp+set}" = set; then
   enableval="$enable_pythoninterp"
@@ -1718,7 +1856,7 @@ if test "$enable_pythoninterp" = "yes"; 
     # Extract the first word of "python", so it can be a program name with args.
 set dummy python; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1722: checking for $ac_word" >&5
+echo "configure:1860: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_vi_cv_path_python'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1753,7 +1891,7 @@ fi
   if test "X$vi_cv_path_python" != "X"; then
 
         echo $ac_n "checking Python version""... $ac_c" 1>&6
-echo "configure:1757: checking Python version" >&5
+echo "configure:1895: checking Python version" >&5
 if eval "test \"`echo '$''{'vi_cv_var_python_version'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1765,14 +1903,14 @@ fi
 echo "$ac_t""$vi_cv_var_python_version" 1>&6
 
         echo $ac_n "checking Python is 1.4 or better""... $ac_c" 1>&6
-echo "configure:1769: checking Python is 1.4 or better" >&5
+echo "configure:1907: checking Python is 1.4 or better" >&5
     if ${vi_cv_path_python} -c \
 	"import sys; sys.exit(${vi_cv_var_python_version} < 1.4)"
     then
       echo "$ac_t""yep" 1>&6
 
             echo $ac_n "checking Python's install prefix""... $ac_c" 1>&6
-echo "configure:1776: checking Python's install prefix" >&5
+echo "configure:1914: checking Python's install prefix" >&5
 if eval "test \"`echo '$''{'vi_cv_path_python_pfx'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1784,7 +1922,7 @@ fi
 echo "$ac_t""$vi_cv_path_python_pfx" 1>&6
 
             echo $ac_n "checking Python's execution prefix""... $ac_c" 1>&6
-echo "configure:1788: checking Python's execution prefix" >&5
+echo "configure:1926: checking Python's execution prefix" >&5
 if eval "test \"`echo '$''{'vi_cv_path_python_epfx'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1815,7 +1953,7 @@ fi
 
 
       echo $ac_n "checking Python's configuration directory""... $ac_c" 1>&6
-echo "configure:1819: checking Python's configuration directory" >&5
+echo "configure:1957: checking Python's configuration directory" >&5
 if eval "test \"`echo '$''{'vi_cv_path_python_conf'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1888,7 +2026,7 @@ fi
 	PYTHON_GETPATH_CFLAGS="-DPYTHONPATH='\"${vi_cv_path_pythonpath}\"' -DPREFIX='\"${vi_cv_path_python_pfx}\"' -DEXEC_PREFIX='\"${vi_cv_path_python_epfx}\"'"
 
 								echo $ac_n "checking if -pthread should be used""... $ac_c" 1>&6
-echo "configure:1892: checking if -pthread should be used" >&5
+echo "configure:2030: checking if -pthread should be used" >&5
 	threadsafe_flag=
 	thread_lib=
 	if test "x$MACOSX" != "xyes"; then
@@ -1904,14 +2042,14 @@ echo "configure:1892: checking if -pthre
 	  CFLAGS="$CFLAGS $threadsafe_flag"
 	  LIBS="$LIBS $thread_lib"
 	  cat > conftest.$ac_ext <<EOF
-#line 1908 "configure"
+#line 2046 "configure"
 #include "confdefs.h"
 
 int main() {
  
 ; return 0; }
 EOF
-if { (eval echo configure:1915: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2053: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   echo "$ac_t""yes" 1>&6; PYTHON_CFLAGS="$PYTHON_CFLAGS $threadsafe_flag"
 else
@@ -1928,20 +2066,20 @@ rm -f conftest*
 	fi
 
 			echo $ac_n "checking if compile and link flags for Python are sane""... $ac_c" 1>&6
-echo "configure:1932: checking if compile and link flags for Python are sane" >&5
+echo "configure:2070: checking if compile and link flags for Python are sane" >&5
 	cflags_save=$CFLAGS
 	libs_save=$LIBS
 	CFLAGS="$CFLAGS $PYTHON_CFLAGS"
 	LIBS="$LIBS $PYTHON_LIBS"
 	cat > conftest.$ac_ext <<EOF
-#line 1938 "configure"
+#line 2076 "configure"
 #include "confdefs.h"
 
 int main() {
  
 ; return 0; }
 EOF
-if { (eval echo configure:1945: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2083: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   echo "$ac_t""yes" 1>&6; python_ok=yes
 else
@@ -1980,7 +2118,7 @@ fi
 
 
 echo $ac_n "checking --enable-tclinterp argument""... $ac_c" 1>&6
-echo "configure:1984: checking --enable-tclinterp argument" >&5
+echo "configure:2122: checking --enable-tclinterp argument" >&5
 # Check whether --enable-tclinterp or --disable-tclinterp was given.
 if test "${enable_tclinterp+set}" = set; then
   enableval="$enable_tclinterp"
@@ -1994,7 +2132,7 @@ echo "$ac_t""$enable_tclinterp" 1>&6
 if test "$enable_tclinterp" = "yes"; then
 
     echo $ac_n "checking --with-tclsh argument""... $ac_c" 1>&6
-echo "configure:1998: checking --with-tclsh argument" >&5
+echo "configure:2136: checking --with-tclsh argument" >&5
   # Check whether --with-tclsh or --without-tclsh was given.
 if test "${with_tclsh+set}" = set; then
   withval="$with_tclsh"
@@ -2006,7 +2144,7 @@ fi
   # Extract the first word of "$tclsh_name", so it can be a program name with args.
 set dummy $tclsh_name; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2010: checking for $ac_word" >&5
+echo "configure:2148: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_vi_cv_path_tcl'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2045,7 +2183,7 @@ fi
     # Extract the first word of "$tclsh_name", so it can be a program name with args.
 set dummy $tclsh_name; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2049: checking for $ac_word" >&5
+echo "configure:2187: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_vi_cv_path_tcl'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2083,7 +2221,7 @@ fi
     # Extract the first word of "$tclsh_name", so it can be a program name with args.
 set dummy $tclsh_name; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2087: checking for $ac_word" >&5
+echo "configure:2225: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_vi_cv_path_tcl'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2118,14 +2256,14 @@ fi
   fi
   if test "X$vi_cv_path_tcl" != "X"; then
     echo $ac_n "checking Tcl version""... $ac_c" 1>&6
-echo "configure:2122: checking Tcl version" >&5
+echo "configure:2260: checking Tcl version" >&5
     if echo 'exit [expr [info tclversion] < 8.0]' | $vi_cv_path_tcl - ; then
       tclver=`echo 'puts [info tclversion]' | $vi_cv_path_tcl -`
       echo "$ac_t""$tclver - OK" 1>&6;
       tclloc=`echo 'set l [info library];set i [string last lib $l];incr i -2;puts [string range $l 0 $i]' | $vi_cv_path_tcl -`
 
       echo $ac_n "checking for location of Tcl include""... $ac_c" 1>&6
-echo "configure:2129: checking for location of Tcl include" >&5
+echo "configure:2267: checking for location of Tcl include" >&5
       if test "x$MACOSX" != "xyes"; then
 	tclinc="$tclloc/include $tclloc/include/tcl $tclloc/include/tcl$tclver /usr/local/include"
       else
@@ -2144,7 +2282,7 @@ echo "configure:2129: checking for locat
       fi
       if test -z "$SKIP_TCL"; then
 	echo $ac_n "checking for location of tclConfig.sh script""... $ac_c" 1>&6
-echo "configure:2148: checking for location of tclConfig.sh script" >&5
+echo "configure:2286: checking for location of tclConfig.sh script" >&5
 	if test "x$MACOSX" != "xyes"; then
 	  tclcnf=`echo $tclinc | sed s/include/lib/g`
 	else
@@ -2162,7 +2300,7 @@ echo "configure:2148: checking for locat
 	if test -z "$TCL_LIBS"; then
 	  echo "$ac_t""<not found>" 1>&6
 	  echo $ac_n "checking for Tcl library by myself""... $ac_c" 1>&6
-echo "configure:2166: checking for Tcl library by myself" >&5
+echo "configure:2304: checking for Tcl library by myself" >&5
 	  tcllib=`echo $tclinc | sed s/include/lib/g`
 	  for ext in .so .a ; do
 	    for ver in "" $tclver ; do
@@ -2208,7 +2346,7 @@ fi
 
 
 echo $ac_n "checking --enable-rubyinterp argument""... $ac_c" 1>&6
-echo "configure:2212: checking --enable-rubyinterp argument" >&5
+echo "configure:2350: checking --enable-rubyinterp argument" >&5
 # Check whether --enable-rubyinterp or --disable-rubyinterp was given.
 if test "${enable_rubyinterp+set}" = set; then
   enableval="$enable_rubyinterp"
@@ -2223,7 +2361,7 @@ if test "$enable_rubyinterp" = "yes"; th
   # Extract the first word of "ruby", so it can be a program name with args.
 set dummy ruby; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2227: checking for $ac_word" >&5
+echo "configure:2365: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_vi_cv_path_ruby'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2257,11 +2395,11 @@ fi
 
   if test "X$vi_cv_path_ruby" != "X"; then
     echo $ac_n "checking Ruby version""... $ac_c" 1>&6
-echo "configure:2261: checking Ruby version" >&5
+echo "configure:2399: checking Ruby version" >&5
     if $vi_cv_path_ruby -e 'VERSION >= "1.6.0" or exit 1' >/dev/null 2>/dev/null; then
       echo "$ac_t""OK" 1>&6
       echo $ac_n "checking Ruby header files""... $ac_c" 1>&6
-echo "configure:2265: checking Ruby header files" >&5
+echo "configure:2403: checking Ruby header files" >&5
       rubyhdrdir=`$vi_cv_path_ruby -r mkmf -e 'print Config::CONFIG["archdir"] || $hdrdir' 2>/dev/null`
       if test "X$rubyhdrdir" != "X"; then
 	echo "$ac_t""$rubyhdrdir" 1>&6
@@ -2313,7 +2451,7 @@ fi
 
 
 echo $ac_n "checking --enable-cscope argument""... $ac_c" 1>&6
-echo "configure:2317: checking --enable-cscope argument" >&5
+echo "configure:2455: checking --enable-cscope argument" >&5
 # Check whether --enable-cscope or --disable-cscope was given.
 if test "${enable_cscope+set}" = set; then
   enableval="$enable_cscope"
@@ -2331,7 +2469,7 @@ EOF
 fi
 
 echo $ac_n "checking --enable-workshop argument""... $ac_c" 1>&6
-echo "configure:2335: checking --enable-workshop argument" >&5
+echo "configure:2473: checking --enable-workshop argument" >&5
 # Check whether --enable-workshop or --disable-workshop was given.
 if test "${enable_workshop+set}" = set; then
   enableval="$enable_workshop"
@@ -2356,7 +2494,7 @@ EOF
 fi
 
 echo $ac_n "checking --disable-netbeans argument""... $ac_c" 1>&6
-echo "configure:2360: checking --disable-netbeans argument" >&5
+echo "configure:2498: checking --disable-netbeans argument" >&5
 # Check whether --enable-netbeans or --disable-netbeans was given.
 if test "${enable_netbeans+set}" = set; then
   enableval="$enable_netbeans"
@@ -2368,7 +2506,7 @@ fi
 if test "$enable_netbeans" = "yes"; then
   echo "$ac_t""no" 1>&6
     echo $ac_n "checking for socket in -lsocket""... $ac_c" 1>&6
-echo "configure:2372: checking for socket in -lsocket" >&5
+echo "configure:2510: 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
@@ -2376,7 +2514,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lsocket  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2380 "configure"
+#line 2518 "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
@@ -2387,7 +2525,7 @@ int main() {
 socket()
 ; return 0; }
 EOF
-if { (eval echo configure:2391: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2529: \"$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
@@ -2415,7 +2553,7 @@ else
 fi
 
   echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6
-echo "configure:2419: checking for gethostbyname in -lnsl" >&5
+echo "configure:2557: 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
@@ -2423,7 +2561,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lnsl  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2427 "configure"
+#line 2565 "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
@@ -2434,7 +2572,7 @@ int main() {
 gethostbyname()
 ; return 0; }
 EOF
-if { (eval echo configure:2438: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2576: \"$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
@@ -2462,9 +2600,9 @@ else
 fi
 
   echo $ac_n "checking whether compiling netbeans integration is possible""... $ac_c" 1>&6
-echo "configure:2466: checking whether compiling netbeans integration is possible" >&5
+echo "configure:2604: checking whether compiling netbeans integration is possible" >&5
   cat > conftest.$ac_ext <<EOF
-#line 2468 "configure"
+#line 2606 "configure"
 #include "confdefs.h"
 
 #include <stdio.h>
@@ -2494,7 +2632,7 @@ int main() {
 	    
 ; return 0; }
 EOF
-if { (eval echo configure:2498: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2636: \"$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
@@ -2519,7 +2657,7 @@ EOF
 fi
 
 echo $ac_n "checking --enable-sniff argument""... $ac_c" 1>&6
-echo "configure:2523: checking --enable-sniff argument" >&5
+echo "configure:2661: checking --enable-sniff argument" >&5
 # Check whether --enable-sniff or --disable-sniff was given.
 if test "${enable_sniff+set}" = set; then
   enableval="$enable_sniff"
@@ -2541,7 +2679,7 @@ EOF
 fi
 
 echo $ac_n "checking --enable-multibyte argument""... $ac_c" 1>&6
-echo "configure:2545: checking --enable-multibyte argument" >&5
+echo "configure:2683: checking --enable-multibyte argument" >&5
 # Check whether --enable-multibyte or --disable-multibyte was given.
 if test "${enable_multibyte+set}" = set; then
   enableval="$enable_multibyte"
@@ -2559,7 +2697,7 @@ EOF
 fi
 
 echo $ac_n "checking --enable-hangulinput argument""... $ac_c" 1>&6
-echo "configure:2563: checking --enable-hangulinput argument" >&5
+echo "configure:2701: checking --enable-hangulinput argument" >&5
 # Check whether --enable-hangulinput or --disable-hangulinput was given.
 if test "${enable_hangulinput+set}" = set; then
   enableval="$enable_hangulinput"
@@ -2571,7 +2709,7 @@ fi
 echo "$ac_t""$enable_hangulinput" 1>&6
 
 echo $ac_n "checking --enable-xim argument""... $ac_c" 1>&6
-echo "configure:2575: checking --enable-xim argument" >&5
+echo "configure:2713: checking --enable-xim argument" >&5
 # Check whether --enable-xim or --disable-xim was given.
 if test "${enable_xim+set}" = set; then
   enableval="$enable_xim"
@@ -2582,7 +2720,7 @@ fi
 
 
 echo $ac_n "checking --enable-fontset argument""... $ac_c" 1>&6
-echo "configure:2586: checking --enable-fontset argument" >&5
+echo "configure:2724: checking --enable-fontset argument" >&5
 # Check whether --enable-fontset or --disable-fontset was given.
 if test "${enable_fontset+set}" = set; then
   enableval="$enable_fontset"
@@ -2602,7 +2740,7 @@ else
   # Extract the first word of "xmkmf", so it can be a program name with args.
 set dummy xmkmf; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2606: checking for $ac_word" >&5
+echo "configure:2744: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_xmkmfpath'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2640,7 +2778,7 @@ fi
 # 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:2644: checking for X" >&5
+echo "configure:2782: checking for X" >&5
 
 # Check whether --with-x or --without-x was given.
 if test "${with_x+set}" = set; then
@@ -2702,12 +2840,12 @@ if test "$ac_x_includes" = NO; then
 
   # First, try using that file with no special directory specified.
 cat > conftest.$ac_ext <<EOF
-#line 2706 "configure"
+#line 2844 "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:2711: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2849: \"$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*
@@ -2776,14 +2914,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 2780 "configure"
+#line 2918 "configure"
 #include "confdefs.h"
 
 int main() {
 ${x_direct_test_function}()
 ; return 0; }
 EOF
-if { (eval echo configure:2787: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2925: \"$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.
@@ -2889,17 +3027,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:2893: checking whether -R must be followed by a space" >&5
+echo "configure:3031: 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 2896 "configure"
+#line 3034 "configure"
 #include "confdefs.h"
 
 int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:2903: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3041: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ac_R_nospace=yes
 else
@@ -2915,14 +3053,14 @@ rm -f conftest*
       else
 	LIBS="$ac_xsave_LIBS -R $x_libraries"
 	cat > conftest.$ac_ext <<EOF
-#line 2919 "configure"
+#line 3057 "configure"
 #include "confdefs.h"
 
 int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:2926: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3064: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ac_R_space=yes
 else
@@ -2954,7 +3092,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:2958: checking for dnet_ntoa in -ldnet" >&5
+echo "configure:3096: 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
@@ -2962,7 +3100,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-ldnet  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2966 "configure"
+#line 3104 "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
@@ -2973,7 +3111,7 @@ int main() {
 dnet_ntoa()
 ; return 0; }
 EOF
-if { (eval echo configure:2977: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3115: \"$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
@@ -2995,7 +3133,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:2999: checking for dnet_ntoa in -ldnet_stub" >&5
+echo "configure:3137: 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
@@ -3003,7 +3141,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-ldnet_stub  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3007 "configure"
+#line 3145 "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
@@ -3014,7 +3152,7 @@ int main() {
 dnet_ntoa()
 ; return 0; }
 EOF
-if { (eval echo configure:3018: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3156: \"$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
@@ -3043,12 +3181,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:3047: checking for gethostbyname" >&5
+echo "configure:3185: 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 3052 "configure"
+#line 3190 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char gethostbyname(); below.  */
@@ -3071,7 +3209,7 @@ gethostbyname();
 
 ; return 0; }
 EOF
-if { (eval echo configure:3075: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3213: \"$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
@@ -3092,7 +3230,7 @@ fi
 
     if test $ac_cv_func_gethostbyname = no; then
       echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6
-echo "configure:3096: checking for gethostbyname in -lnsl" >&5
+echo "configure:3234: 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
@@ -3100,7 +3238,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lnsl  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3104 "configure"
+#line 3242 "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
@@ -3111,7 +3249,7 @@ int main() {
 gethostbyname()
 ; return 0; }
 EOF
-if { (eval echo configure:3115: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3253: \"$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
@@ -3141,12 +3279,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:3145: checking for connect" >&5
+echo "configure:3283: 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 3150 "configure"
+#line 3288 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char connect(); below.  */
@@ -3169,7 +3307,7 @@ connect();
 
 ; return 0; }
 EOF
-if { (eval echo configure:3173: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3311: \"$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
@@ -3190,7 +3328,7 @@ fi
 
     if test $ac_cv_func_connect = no; then
       echo $ac_n "checking for connect in -lsocket""... $ac_c" 1>&6
-echo "configure:3194: checking for connect in -lsocket" >&5
+echo "configure:3332: 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
@@ -3198,7 +3336,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lsocket $X_EXTRA_LIBS $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3202 "configure"
+#line 3340 "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
@@ -3209,7 +3347,7 @@ int main() {
 connect()
 ; return 0; }
 EOF
-if { (eval echo configure:3213: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3351: \"$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
@@ -3233,12 +3371,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:3237: checking for remove" >&5
+echo "configure:3375: 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 3242 "configure"
+#line 3380 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char remove(); below.  */
@@ -3261,7 +3399,7 @@ remove();
 
 ; return 0; }
 EOF
-if { (eval echo configure:3265: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3403: \"$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
@@ -3282,7 +3420,7 @@ fi
 
     if test $ac_cv_func_remove = no; then
       echo $ac_n "checking for remove in -lposix""... $ac_c" 1>&6
-echo "configure:3286: checking for remove in -lposix" >&5
+echo "configure:3424: 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
@@ -3290,7 +3428,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lposix  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3294 "configure"
+#line 3432 "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
@@ -3301,7 +3439,7 @@ int main() {
 remove()
 ; return 0; }
 EOF
-if { (eval echo configure:3305: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3443: \"$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
@@ -3325,12 +3463,12 @@ fi
 
     # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay.
     echo $ac_n "checking for shmat""... $ac_c" 1>&6
-echo "configure:3329: checking for shmat" >&5
+echo "configure:3467: 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 3334 "configure"
+#line 3472 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char shmat(); below.  */
@@ -3353,7 +3491,7 @@ shmat();
 
 ; return 0; }
 EOF
-if { (eval echo configure:3357: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3495: \"$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
@@ -3374,7 +3512,7 @@ fi
 
     if test $ac_cv_func_shmat = no; then
       echo $ac_n "checking for shmat in -lipc""... $ac_c" 1>&6
-echo "configure:3378: checking for shmat in -lipc" >&5
+echo "configure:3516: 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
@@ -3382,7 +3520,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lipc  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3386 "configure"
+#line 3524 "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
@@ -3393,7 +3531,7 @@ int main() {
 shmat()
 ; return 0; }
 EOF
-if { (eval echo configure:3397: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3535: \"$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
@@ -3426,7 +3564,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:3430: checking for IceConnectionNumber in -lICE" >&5
+echo "configure:3568: 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
@@ -3434,7 +3572,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lICE $X_EXTRA_LIBS $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3438 "configure"
+#line 3576 "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
@@ -3445,7 +3583,7 @@ int main() {
 IceConnectionNumber()
 ; return 0; }
 EOF
-if { (eval echo configure:3449: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3587: \"$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
@@ -3499,18 +3637,18 @@ fi
 
 
       echo $ac_n "checking if X11 header files can be found""... $ac_c" 1>&6
-echo "configure:3503: checking if X11 header files can be found" >&5
+echo "configure:3641: checking if X11 header files can be found" >&5
   cflags_save=$CFLAGS
   CFLAGS="$CFLAGS $X_CFLAGS"
   cat > conftest.$ac_ext <<EOF
-#line 3507 "configure"
+#line 3645 "configure"
 #include "confdefs.h"
 #include <X11/Xlib.h>
 int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:3514: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3652: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   echo "$ac_t""yes" 1>&6
 else
@@ -3536,7 +3674,7 @@ EOF
     LDFLAGS="-L$x_libraries $LDFLAGS"
 
             echo $ac_n "checking for _XdmcpAuthDoIt in -lXdmcp""... $ac_c" 1>&6
-echo "configure:3540: checking for _XdmcpAuthDoIt in -lXdmcp" >&5
+echo "configure:3678: checking for _XdmcpAuthDoIt in -lXdmcp" >&5
 ac_lib_var=`echo Xdmcp'_'_XdmcpAuthDoIt | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -3544,7 +3682,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lXdmcp -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS -lXdmcp $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3548 "configure"
+#line 3686 "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
@@ -3555,7 +3693,7 @@ int main() {
 _XdmcpAuthDoIt()
 ; return 0; }
 EOF
-if { (eval echo configure:3559: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3697: \"$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
@@ -3577,7 +3715,7 @@ fi
 
 
                     echo $ac_n "checking for IceOpenConnection in -lICE""... $ac_c" 1>&6
-echo "configure:3581: checking for IceOpenConnection in -lICE" >&5
+echo "configure:3719: checking for IceOpenConnection in -lICE" >&5
 ac_lib_var=`echo ICE'_'IceOpenConnection | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -3585,7 +3723,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lICE $X_EXTRA_LIBS $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3589 "configure"
+#line 3727 "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
@@ -3596,7 +3734,7 @@ int main() {
 IceOpenConnection()
 ; return 0; }
 EOF
-if { (eval echo configure:3600: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3738: \"$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
@@ -3619,7 +3757,7 @@ fi
 
         LDFLAGS="$X_LIBS $ac_save_LDFLAGS"
     echo $ac_n "checking for XpmCreatePixmapFromData in -lXpm""... $ac_c" 1>&6
-echo "configure:3623: checking for XpmCreatePixmapFromData in -lXpm" >&5
+echo "configure:3761: checking for XpmCreatePixmapFromData in -lXpm" >&5
 ac_lib_var=`echo Xpm'_'XpmCreatePixmapFromData | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -3627,7 +3765,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lXpm -lXt $X_PRE_LIBS -lXpm -lX11 $X_EXTRA_LIBS $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3631 "configure"
+#line 3769 "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
@@ -3638,7 +3776,7 @@ int main() {
 XpmCreatePixmapFromData()
 ; return 0; }
 EOF
-if { (eval echo configure:3642: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3780: \"$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
@@ -3660,18 +3798,18 @@ fi
 
 
         echo $ac_n "checking if X11 header files implicitly declare return values""... $ac_c" 1>&6
-echo "configure:3664: checking if X11 header files implicitly declare return values" >&5
+echo "configure:3802: checking if X11 header files implicitly declare return values" >&5
     cflags_save=$CFLAGS
     CFLAGS="$CFLAGS $X_CFLAGS -Werror"
     cat > conftest.$ac_ext <<EOF
-#line 3668 "configure"
+#line 3806 "configure"
 #include "confdefs.h"
 #include <X11/Xlib.h>
 int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:3675: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3813: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   echo "$ac_t""no" 1>&6
 else
@@ -3680,14 +3818,14 @@ else
   rm -rf conftest*
   CFLAGS="$CFLAGS -Wno-implicit-int"
 	cat > conftest.$ac_ext <<EOF
-#line 3684 "configure"
+#line 3822 "configure"
 #include "confdefs.h"
 #include <X11/Xlib.h>
 int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:3691: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3829: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   echo "$ac_t""yes" 1>&6; cflags_save="$cflags_save -Wno-implicit-int"
 else
@@ -3711,7 +3849,7 @@ fi
 test "x$with_x" = xno -a "x$BEOS" != "xyes" -a "x$MACOSX" != "xyes" -a "x$QNX" != "xyes" && enable_gui=no
 
 echo $ac_n "checking --enable-gui argument""... $ac_c" 1>&6
-echo "configure:3715: checking --enable-gui argument" >&5
+echo "configure:3853: checking --enable-gui argument" >&5
 # Check whether --enable-gui or --disable-gui was given.
 if test "${enable_gui+set}" = set; then
   enableval="$enable_gui"
@@ -3811,7 +3949,7 @@ fi
 
 if test "x$SKIP_KDE" != "xYES" -a "$enable_gui_canon" != "kde"; then
     echo $ac_n "checking whether or not to look for KDE""... $ac_c" 1>&6
-echo "configure:3815: checking whether or not to look for KDE" >&5
+echo "configure:3953: checking whether or not to look for KDE" >&5
     # Check whether --enable-kde-check or --disable-kde-check was given.
 if test "${enable_kde_check+set}" = set; then
   enableval="$enable_kde_check"
@@ -3828,7 +3966,7 @@ fi
 
 if test "x$SKIP_GTK" != "xYES" -a "$enable_gui_canon" != "gtk" -a "$enable_gui_canon" != "gtk2"; then
   echo $ac_n "checking whether or not to look for GTK""... $ac_c" 1>&6
-echo "configure:3832: checking whether or not to look for GTK" >&5
+echo "configure:3970: checking whether or not to look for GTK" >&5
   # Check whether --enable-gtk-check or --disable-gtk-check was given.
 if test "${enable_gtk_check+set}" = set; then
   enableval="$enable_gtk_check"
@@ -3847,7 +3985,7 @@ fi
 if test "x$SKIP_GTK2" != "xYES" -a "$enable_gui_canon" != "gtk2" \
 				-a "$enable_gui_canon" != "gnome2"; then
   echo $ac_n "checking whether or not to look for GTK+ 2""... $ac_c" 1>&6
-echo "configure:3851: checking whether or not to look for GTK+ 2" >&5
+echo "configure:3989: checking whether or not to look for GTK+ 2" >&5
   # Check whether --enable-gtk2-check or --disable-gtk2-check was given.
 if test "${enable_gtk2_check+set}" = set; then
   enableval="$enable_gtk2_check"
@@ -3865,7 +4003,7 @@ fi
 if test "x$SKIP_GNOME" != "xYES" -a "$enable_gui_canon" != "gnome" \
 				 -a "$enable_gui_canon" != "gnome2"; then
   echo $ac_n "checking whether or not to look for GNOME""... $ac_c" 1>&6
-echo "configure:3869: checking whether or not to look for GNOME" >&5
+echo "configure:4007: checking whether or not to look for GNOME" >&5
   # Check whether --enable-gnome-check or --disable-gnome-check was given.
 if test "${enable_gnome_check+set}" = set; then
   enableval="$enable_gnome_check"
@@ -3882,7 +4020,7 @@ fi
 
 if test "x$SKIP_MOTIF" != "xYES" -a "$enable_gui_canon" != "motif"; then
   echo $ac_n "checking whether or not to look for Motif""... $ac_c" 1>&6
-echo "configure:3886: checking whether or not to look for Motif" >&5
+echo "configure:4024: checking whether or not to look for Motif" >&5
   # Check whether --enable-motif-check or --disable-motif-check was given.
 if test "${enable_motif_check+set}" = set; then
   enableval="$enable_motif_check"
@@ -3899,7 +4037,7 @@ fi
 
 if test "x$SKIP_ATHENA" != "xYES" -a "$enable_gui_canon" != "athena"; then
   echo $ac_n "checking whether or not to look for Athena""... $ac_c" 1>&6
-echo "configure:3903: checking whether or not to look for Athena" >&5
+echo "configure:4041: checking whether or not to look for Athena" >&5
   # Check whether --enable-athena-check or --disable-athena-check was given.
 if test "${enable_athena_check+set}" = set; then
   enableval="$enable_athena_check"
@@ -3916,7 +4054,7 @@ fi
 
 if test "x$SKIP_NEXTAW" != "xYES" -a "$enable_gui_canon" != "nextaw"; then
   echo $ac_n "checking whether or not to look for neXtaw""... $ac_c" 1>&6
-echo "configure:3920: checking whether or not to look for neXtaw" >&5
+echo "configure:4058: checking whether or not to look for neXtaw" >&5
   # Check whether --enable-nextaw-check or --disable-nextaw-check was given.
 if test "${enable_nextaw_check+set}" = set; then
   enableval="$enable_nextaw_check"
@@ -3933,7 +4071,7 @@ fi
 
 if test "x$SKIP_CARBON" != "xYES" -a "$enable_gui_canon" != "carbon"; then
   echo $ac_n "checking whether or not to look for Carbon""... $ac_c" 1>&6
-echo "configure:3937: checking whether or not to look for Carbon" >&5
+echo "configure:4075: checking whether or not to look for Carbon" >&5
   # Check whether --enable-carbon-check or --disable-carbon-check was given.
 if test "${enable_carbon_check+set}" = set; then
   enableval="$enable_carbon_check"
@@ -3963,11 +4101,11 @@ fi
 
 
 if test "x$ROOTQT" = "x"; then
-	if test -z "$QTDIR"; then
-	    	    	    # Extract the first word of "moc", so it can be a program name with args.
+  if test -z "$QTDIR"; then
+            # Extract the first word of "moc", so it can be a program name with args.
 set dummy moc; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3971: checking for $ac_word" >&5
+echo "configure:4109: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_MOC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4000,14 +4138,14 @@ else
   echo "$ac_t""no" 1>&6
 fi
 
-	    if text"x$MOC" = "x"; then
-		{ echo "configure: error: could not find Qt directory" 1>&2; exit 1; }
-	    else
-	      ROOTQT=`echo $MOC | sed 's+/bin/moc++'`
-	    fi
-	else
-		ROOTQT="$QTDIR"
-	fi
+    if test "x$MOC" = "xno"; then
+      { echo "configure: error: could not find Qt directory" 1>&2; exit 1; }
+    else
+      ROOTQT=`echo $MOC | sed 's+/bin/moc++'`
+    fi
+  else
+    ROOTQT="$QTDIR"
+  fi
 fi
 MOC="$ROOTQT"/bin/moc
 QT_INCLUDES="$ROOTQT"/include
@@ -4037,7 +4175,7 @@ if test "x$QT_INCLUDES" = "x" ; then
 fi
 
 echo $ac_n "checking whether or not to use a KDE Toolbar in KVim""... $ac_c" 1>&6
-echo "configure:4041: checking whether or not to use a KDE Toolbar in KVim" >&5
+echo "configure:4179: checking whether or not to use a KDE Toolbar in KVim" >&5
 # Check whether --enable-kde-toolbar or --disable-kde-toolbar was given.
 if test "${enable_kde_toolbar+set}" = set; then
   enableval="$enable_kde_toolbar"
@@ -4059,8 +4197,10 @@ fi
 if test -z "$SKIP_KDE"; then
 
 
+
+
 echo $ac_n "checking --disable-rpath argument""... $ac_c" 1>&6
-echo "configure:4064: checking --disable-rpath argument" >&5
+echo "configure:4204: checking --disable-rpath argument" >&5
 # Check whether --enable-rpath or --disable-rpath was given.
 if test "${enable_rpath+set}" = set; then
   enableval="$enable_rpath"
@@ -4076,7 +4216,7 @@ else
 fi
 
 echo $ac_n "checking --with-kde-prefix argument""... $ac_c" 1>&6
-echo "configure:4080: checking --with-kde-prefix argument" >&5
+echo "configure:4220: checking --with-kde-prefix argument" >&5
 # Check whether --with-kde-prefix or --without-kde-prefix was given.
 if test "${with_kde_prefix+set}" = set; then
   withval="$with_kde_prefix"
@@ -4104,7 +4244,7 @@ fi
 
 
 echo $ac_n "checking --disable-kdetest argument""... $ac_c" 1>&6
-echo "configure:4108: checking --disable-kdetest argument" >&5
+echo "configure:4248: checking --disable-kdetest argument" >&5
 # Check whether --enable-kdetest or --disable-kdetest was given.
 if test "${enable_kdetest+set}" = set; then
   enableval="$enable_kdetest"
@@ -4119,7 +4259,6 @@ else
 fi
 
 if test "x$kde_config_prefix" != "x" ; then
-	kde_config_args=""
 	KDE_CONFIG=$kde_config_prefix/bin/kde-config
 fi
 
@@ -4127,7 +4266,7 @@ if test "X$KDE_CONFIG" = "X"; then
 	# Extract the first word of "kde-config", so it can be a program name with args.
 set dummy kde-config; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4131: checking for $ac_word" >&5
+echo "configure:4270: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_KDE_CONFIG'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4169,12 +4308,12 @@ if test "X$KDE_CONFIG" != "X" ; then
 	if test "X$KDE_CONFIG" != "X"; then
 	  min_kde_version=2.0.0
 	  echo $ac_n "checking for KDE version >= $min_kde_version""... $ac_c" 1>&6
-echo "configure:4173: checking for KDE version >= $min_kde_version" >&5
+echo "configure:4312: checking for KDE version >= $min_kde_version" >&5
 	  no_kde=""
 	  if test "$KDE_CONFIG" = "no" ; then
 		no_kde=yes
 	  else
-		KDE_PREFIX=`$KDE_CONFIG $kde_config_args --prefix`
+		KDE_PREFIX=`$KDE_CONFIG --prefix`
 		if test "x$KDE_LIBS" = "x"; then
 		  KDE_LIBS="$KDE_PREFIX/lib"
 		fi
@@ -4188,12 +4327,12 @@ echo "configure:4173: checking for KDE v
 sed 's/KDE:\ //' | sed 's/\([0-9]*\).\([0-9]*.*\)/\1/'`
 		kde_minor_version=`$KDE_CONFIG --version | grep KDE | \
 sed 's/KDE:\ //' | sed 's/\([0-9]*\).\([0-9]*.*\)/\2/'`
-	
+
 		qt_major_version=`$KDE_CONFIG --version | grep Qt | sed -e \
 's/Qt:\ //' | sed 's/\([0-9]*\).\([0-9]*.*\)/\1/'`
 		qt_minor_version=`$KDE_CONFIG --version | grep Qt | sed -e \
 's/Qt:\ //' | sed 's/\([0-9]*\).\([0-9]*.*\)/\2/'`
-	
+
 								if test "x$enable-kdetest" = "xyes" ; then
 			ac_save_LIBS="$LIBS"
 			LIBS="$LIBS $KDE_LIBS"
@@ -4202,7 +4341,7 @@ sed 's/KDE:\ //' | sed 's/\([0-9]*\).\([
   echo $ac_n "cross compiling KDE ? ? how can i remove that ? :)"
 else
   cat > conftest.$ac_ext <<EOF
-#line 4206 "configure"
+#line 4345 "configure"
 #include "confdefs.h"
 
 #include <stdio.h>
@@ -4211,7 +4350,7 @@ main()
 { return 0; }
 			
 EOF
-if { (eval echo configure:4215: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4354: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   :
 else
@@ -4245,9 +4384,10 @@ fi
 
 
 
+
 	if test "x$KDE_PREFIX" != "x"; then
 		echo $ac_n "checking for QT version $qt_major_version.x""... $ac_c" 1>&6
-echo "configure:4251: checking for QT version $qt_major_version.x" >&5
+echo "configure:4391: checking for QT version $qt_major_version.x" >&5
 		if test "x$ROOTQT" != "x" ; then
 			GUI_INC_LOC="-I$QT_INCLUDES $GUI_INC_LOC"
 			if test $qt_major_version -lt 2; then
@@ -4279,6 +4419,117 @@ echo "configure:4251: checking for QT ve
 						GUI_INC_LOC="`echo $GUI_INC_LOC\ | sed 's%-I/usr/include %%'`"
 
 			echo "$ac_t""found $qt_major_version.$qt_minor_version in $ROOTQT" 1>&6
+
+                                                                     
+  qt_incdir=NO
+  for i in $QT_INCLUDES;
+    do
+      for j in qstyle.h;
+      do
+       echo "configure: 4430: $i/$j" >&5
+       if test -r "$i/$j"; then
+         echo "taking that" >&5
+         qt_incdir=$i
+         break 2
+       fi
+      done
+    done
+
+                       if test "x$qt_incdir" = "xNO"; then
+                               { echo "configure: error: Could not find Qt headers in $QT_INCLUDES" 1>&2; exit 1; }
+                       fi
+                       
+  kde_incdir=NO
+  for i in $KDE_INCLUDES;
+    do
+      for j in kapplication.h;
+      do
+       echo "configure: 4448: $i/$j" >&5
+       if test -r "$i/$j"; then
+         echo "taking that" >&5
+         kde_incdir=$i
+         break 2
+       fi
+      done
+    done
+
+                       if test "x$kde_incdir" = "xNO"; then
+                               { echo "configure: error: Could not find KDE headers in $KDE_INCLUDES" 1>&2; exit 1; }
+                       fi
+
+                       
+                       ac_ext=C
+# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cxx_cross
+
+                       ac_save_LIBS="$LIBS"
+                       LIBS="$GUI_LIB_LOC"
+                       ac_save_CXXFLAGS="$CXXFLAGS"
+                       CXXFLAGS="$CXXFLAGS $GUI_INC_LOC"
+                       echo $ac_n "checking whether Qt libraries are usable""... $ac_c" 1>&6
+echo "configure:4474: checking whether Qt libraries are usable" >&5
+                       cat > conftest.$ac_ext <<EOF
+#line 4476 "configure"
+#include "confdefs.h"
+#include <qapplication.h>
+int main() {
+
+                           int argc;
+                           char** argv;
+                           QApplication app(argc, argv);
+                           
+; return 0; }
+EOF
+if { (eval echo configure:4487: \"$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
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  echo "$ac_t""no" 1>&6;{ echo "configure: error: Qt fails to link a simple application" 1>&2; exit 1; }
+fi
+rm -f conftest*
+
+                       echo $ac_n "checking whether KDE libraries are usable""... $ac_c" 1>&6
+echo "configure:4499: checking whether KDE libraries are usable" >&5
+                       cat > conftest.$ac_ext <<EOF
+#line 4501 "configure"
+#include "confdefs.h"
+#include <kapplication.h>
+int main() {
+
+                           int argc;
+                           char** argv;
+                           KApplication app(argc, argv);
+                           
+; return 0; }
+EOF
+if { (eval echo configure:4512: \"$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
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  echo "$ac_t""no" 1>&6;{ echo "configure: error: KDE fails to link a simple application" 1>&2; exit 1; }
+fi
+rm -f conftest*
+
+                       LIBS="$ac_save_LIBS"
+                       CXXFLAGS="$ac_save_CXXFLAGS"
+                       ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+
+
 			SKIP_GTK=YES
 			SKIP_ATHENA=YES
 			SKIP_MOTIF=YES
@@ -4303,7 +4554,7 @@ fi
 
 if test "x$MACOSX" = "xyes" -a -z "$SKIP_CARBON" -a "x$CARBON" = "xyes"; then
   echo $ac_n "checking for Carbon GUI""... $ac_c" 1>&6
-echo "configure:4307: checking for Carbon GUI" >&5
+echo "configure:4558: checking for Carbon GUI" >&5
     echo "$ac_t""yes" 1>&6;
   GUITYPE=CARBONGUI
     SKIP_GTK=YES;
@@ -4328,7 +4579,7 @@ fi
 if test -z "$SKIP_GTK"; then
 
   echo $ac_n "checking --with-gtk-prefix argument""... $ac_c" 1>&6
-echo "configure:4332: checking --with-gtk-prefix argument" >&5
+echo "configure:4583: checking --with-gtk-prefix argument" >&5
   # Check whether --with-gtk-prefix or --without-gtk-prefix was given.
 if test "${with_gtk_prefix+set}" = set; then
   withval="$with_gtk_prefix"
@@ -4339,7 +4590,7 @@ fi
 
 
   echo $ac_n "checking --with-gtk-exec-prefix argument""... $ac_c" 1>&6
-echo "configure:4343: checking --with-gtk-exec-prefix argument" >&5
+echo "configure:4594: checking --with-gtk-exec-prefix argument" >&5
   # Check whether --with-gtk-exec-prefix or --without-gtk-exec-prefix was given.
 if test "${with_gtk_exec_prefix+set}" = set; then
   withval="$with_gtk_exec_prefix"
@@ -4350,7 +4601,7 @@ fi
 
 
   echo $ac_n "checking --disable-gtktest argument""... $ac_c" 1>&6
-echo "configure:4354: checking --disable-gtktest argument" >&5
+echo "configure:4605: checking --disable-gtktest argument" >&5
   # Check whether --enable-gtktest or --disable-gtktest was given.
 if test "${enable_gtktest+set}" = set; then
   enableval="$enable_gtktest"
@@ -4377,7 +4628,7 @@ fi
     # Extract the first word of "gtk-config", so it can be a program name with args.
 set dummy gtk-config; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4381: checking for $ac_word" >&5
+echo "configure:4632: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_GTK_CONFIG'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4414,7 +4665,7 @@ fi
             # Extract the first word of "gtk12-config", so it can be a program name with args.
 set dummy gtk12-config; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4418: checking for $ac_word" >&5
+echo "configure:4669: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_GTK12_CONFIG'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4456,7 +4707,7 @@ fi
     # Extract the first word of "pkg-config", so it can be a program name with args.
 set dummy pkg-config; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4460: checking for $ac_word" >&5
+echo "configure:4711: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_PKG_CONFIG'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4498,7 +4749,7 @@ fi
   {
     min_gtk_version=2.2.0
     echo $ac_n "checking for GTK - version >= $min_gtk_version""... $ac_c" 1>&6
-echo "configure:4502: checking for GTK - version >= $min_gtk_version" >&5
+echo "configure:4753: checking for GTK - version >= $min_gtk_version" >&5
     no_gtk=""
     if (test "X$SKIP_GTK2" != "XYES" -a "X$PKG_CONFIG" != "Xno") \
 	  && $PKG_CONFIG --exists gtk+-2.0; then
@@ -4539,7 +4790,7 @@ echo "configure:4502: checking for GTK -
   echo $ac_n "cross compiling; assumed OK... $ac_c"
 else
   cat > conftest.$ac_ext <<EOF
-#line 4543 "configure"
+#line 4794 "configure"
 #include "confdefs.h"
 
 #include <gtk/gtk.h>
@@ -4571,7 +4822,7 @@ return 1;
 }
 
 EOF
-if { (eval echo configure:4575: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4826: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   :
 else
@@ -4629,7 +4880,7 @@ fi
   {
     min_gtk_version=1.1.16
     echo $ac_n "checking for GTK - version >= $min_gtk_version""... $ac_c" 1>&6
-echo "configure:4633: checking for GTK - version >= $min_gtk_version" >&5
+echo "configure:4884: checking for GTK - version >= $min_gtk_version" >&5
     no_gtk=""
     if (test "X$SKIP_GTK2" != "XYES" -a "X$PKG_CONFIG" != "Xno") \
 	  && $PKG_CONFIG --exists gtk+-2.0; then
@@ -4670,7 +4921,7 @@ echo "configure:4633: checking for GTK -
   echo $ac_n "cross compiling; assumed OK... $ac_c"
 else
   cat > conftest.$ac_ext <<EOF
-#line 4674 "configure"
+#line 4925 "configure"
 #include "confdefs.h"
 
 #include <gtk/gtk.h>
@@ -4702,7 +4953,7 @@ return 1;
 }
 
 EOF
-if { (eval echo configure:4706: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4957: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   :
 else
@@ -4820,7 +5071,7 @@ fi
   if test "x$want_gnome" = xyes -a "0$gtk_major_version" -ge 2; then
   {
     echo $ac_n "checking for libgnomeui-2.0""... $ac_c" 1>&6
-echo "configure:4824: checking for libgnomeui-2.0" >&5
+echo "configure:5075: checking for libgnomeui-2.0" >&5
     if $PKG_CONFIG --exists libgnomeui-2.0; then
       echo "$ac_t""yes" 1>&6
       GNOME_LIBS=`$PKG_CONFIG --libs-only-l libgnomeui-2.0`
@@ -4839,7 +5090,7 @@ echo "configure:4824: checking for libgn
     # Extract the first word of "gnome-config", so it can be a program name with args.
 set dummy gnome-config; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4843: checking for $ac_word" >&5
+echo "configure:5094: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_GNOME_CONFIG'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4876,7 +5127,7 @@ fi
       no_gnome_config="yes"
     else
       echo $ac_n "checking if $GNOME_CONFIG works""... $ac_c" 1>&6
-echo "configure:4880: checking if $GNOME_CONFIG works" >&5
+echo "configure:5131: checking if $GNOME_CONFIG works" >&5
       if $GNOME_CONFIG --libs-only-l gnome >/dev/null 2>&1; then
 	echo "$ac_t""yes" 1>&6
 	GNOME_LIBS="`$GNOME_CONFIG --libs-only-l gnome gnomeui`"
@@ -4901,7 +5152,7 @@ echo "configure:4880: checking if $GNOME
 
     if test "$no_gnome_config" = "yes"; then
       echo $ac_n "checking for gnomeConf.sh file in $gnome_prefix""... $ac_c" 1>&6
-echo "configure:4905: checking for gnomeConf.sh file in $gnome_prefix" >&5
+echo "configure:5156: checking for gnomeConf.sh file in $gnome_prefix" >&5
       if test -f $gnome_prefix/gnomeConf.sh; then
 	echo "$ac_t""found" 1>&6
 	echo "loading gnome configuration from" \
@@ -4939,7 +5190,7 @@ if test -z "$SKIP_MOTIF"; then
     GUI_INC_LOC="`echo $GUI_INC_LOC|sed 's%-I%%g'`"
 
   echo $ac_n "checking for location of Motif GUI includes""... $ac_c" 1>&6
-echo "configure:4943: checking for location of Motif GUI includes" >&5
+echo "configure:5194: checking for location of Motif GUI includes" >&5
   gui_includes="`echo $x_includes|sed 's%/^/^/*$%%'` `echo "$gui_XXX" | sed s/XXX/include/g` $GUI_INC_LOC"
   GUI_INC_LOC=
   for try in $gui_includes; do
@@ -4963,7 +5214,7 @@ fi
 
 if test -z "$SKIP_MOTIF"; then
   echo $ac_n "checking --with-motif-lib argument""... $ac_c" 1>&6
-echo "configure:4967: checking --with-motif-lib argument" >&5
+echo "configure:5218: checking --with-motif-lib argument" >&5
   # Check whether --with-motif-lib or --without-motif-lib was given.
 if test "${with_motif_lib+set}" = set; then
   withval="$with_motif_lib"
@@ -4980,11 +5231,11 @@ fi
         GUI_LIB_LOC="`echo $GUI_LIB_LOC|sed 's%-L%%g'`"
 
     echo $ac_n "checking for location of Motif GUI libs""... $ac_c" 1>&6
-echo "configure:4984: checking for location of Motif GUI libs" >&5
+echo "configure:5235: checking for location of Motif GUI libs" >&5
     gui_libs="`echo $x_libraries|sed 's%/^/^/*$%%'` `echo "$gui_XXX" | sed s/XXX/lib/g` `echo "$GUI_INC_LOC" | sed s/include/lib/` $GUI_LIB_LOC"
     GUI_LIB_LOC=
     for try in $gui_libs; do
-      for libtry in "$try"/libXm.a "$try"/libXm.so* "$try"/libXm.sl; do
+      for libtry in "$try"/libXm.a "$try"/libXm.so* "$try"/libXm.sl "$try"/libXm.dylib; do
 	if test -f "$libtry"; then
 	  GUI_LIB_LOC=$try
 	fi
@@ -5023,11 +5274,11 @@ GUI_X_LIBS=
 
 if test -z "$SKIP_ATHENA"; then
   echo $ac_n "checking if Athena header files can be found""... $ac_c" 1>&6
-echo "configure:5027: checking if Athena header files can be found" >&5
+echo "configure:5278: checking if Athena header files can be found" >&5
   cflags_save=$CFLAGS
   CFLAGS="$CFLAGS $X_CFLAGS"
   cat > conftest.$ac_ext <<EOF
-#line 5031 "configure"
+#line 5282 "configure"
 #include "confdefs.h"
 
 #include <X11/Intrinsic.h>
@@ -5036,7 +5287,7 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:5040: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5291: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   echo "$ac_t""yes" 1>&6
 else
@@ -5055,11 +5306,11 @@ fi
 
 if test -z "$SKIP_NEXTAW"; then
   echo $ac_n "checking if neXtaw header files can be found""... $ac_c" 1>&6
-echo "configure:5059: checking if neXtaw header files can be found" >&5
+echo "configure:5310: checking if neXtaw header files can be found" >&5
   cflags_save=$CFLAGS
   CFLAGS="$CFLAGS $X_CFLAGS"
   cat > conftest.$ac_ext <<EOF
-#line 5063 "configure"
+#line 5314 "configure"
 #include "confdefs.h"
 
 #include <X11/Intrinsic.h>
@@ -5068,7 +5319,7 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:5072: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5323: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   echo "$ac_t""yes" 1>&6
 else
@@ -5096,7 +5347,7 @@ if test -z "$SKIP_ATHENA" -o -z "$SKIP_N
     ldflags_save=$LDFLAGS
   LDFLAGS="$X_LIBS $LDFLAGS"
   echo $ac_n "checking for XShapeQueryExtension in -lXext""... $ac_c" 1>&6
-echo "configure:5100: checking for XShapeQueryExtension in -lXext" >&5
+echo "configure:5351: checking for XShapeQueryExtension in -lXext" >&5
 ac_lib_var=`echo Xext'_'XShapeQueryExtension | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -5104,7 +5355,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lXext -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 5108 "configure"
+#line 5359 "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
@@ -5115,7 +5366,7 @@ int main() {
 XShapeQueryExtension()
 ; return 0; }
 EOF
-if { (eval echo configure:5119: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5370: \"$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
@@ -5136,7 +5387,7 @@ else
 fi
 
     echo $ac_n "checking for wslen in -lw""... $ac_c" 1>&6
-echo "configure:5140: checking for wslen in -lw" >&5
+echo "configure:5391: checking for wslen in -lw" >&5
 ac_lib_var=`echo w'_'wslen | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -5144,7 +5395,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lw $GUI_X_LIBS -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 5148 "configure"
+#line 5399 "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
@@ -5155,7 +5406,7 @@ int main() {
 wslen()
 ; return 0; }
 EOF
-if { (eval echo configure:5159: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5410: \"$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
@@ -5176,7 +5427,7 @@ else
 fi
 
   echo $ac_n "checking for dlsym in -ldl""... $ac_c" 1>&6
-echo "configure:5180: checking for dlsym in -ldl" >&5
+echo "configure:5431: checking for dlsym in -ldl" >&5
 ac_lib_var=`echo dl'_'dlsym | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -5184,7 +5435,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-ldl $GUI_X_LIBS -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 5188 "configure"
+#line 5439 "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
@@ -5195,7 +5446,7 @@ int main() {
 dlsym()
 ; return 0; }
 EOF
-if { (eval echo configure:5199: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5450: \"$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
@@ -5216,7 +5467,7 @@ else
 fi
 
   echo $ac_n "checking for XmuCreateStippledPixmap in -lXmu""... $ac_c" 1>&6
-echo "configure:5220: checking for XmuCreateStippledPixmap in -lXmu" >&5
+echo "configure:5471: checking for XmuCreateStippledPixmap in -lXmu" >&5
 ac_lib_var=`echo Xmu'_'XmuCreateStippledPixmap | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -5224,7 +5475,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lXmu $GUI_X_LIBS -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 5228 "configure"
+#line 5479 "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
@@ -5235,7 +5486,7 @@ int main() {
 XmuCreateStippledPixmap()
 ; return 0; }
 EOF
-if { (eval echo configure:5239: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5490: \"$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
@@ -5257,7 +5508,7 @@ fi
 
   if test -z "$SKIP_MOTIF"; then
     echo $ac_n "checking for XpEndJob in -lXp""... $ac_c" 1>&6
-echo "configure:5261: checking for XpEndJob in -lXp" >&5
+echo "configure:5512: checking for XpEndJob in -lXp" >&5
 ac_lib_var=`echo Xp'_'XpEndJob | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -5265,7 +5516,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lXp $GUI_X_LIBS -lXm -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 5269 "configure"
+#line 5520 "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
@@ -5276,7 +5527,7 @@ int main() {
 XpEndJob()
 ; return 0; }
 EOF
-if { (eval echo configure:5280: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5531: \"$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
@@ -5300,7 +5551,7 @@ fi
   LDFLAGS=$ldflags_save
 
     echo $ac_n "checking for extra X11 defines""... $ac_c" 1>&6
-echo "configure:5304: checking for extra X11 defines" >&5
+echo "configure:5555: checking for extra X11 defines" >&5
   NARROW_PROTO=
   rm -fr conftestdir
   if mkdir conftestdir; then
@@ -5330,17 +5581,17 @@ if test "$enable_xsmp" = "yes"; then
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:5334: checking for $ac_hdr" >&5
+echo "configure:5585: 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 5339 "configure"
+#line 5590 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5344: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5595: \"$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*
@@ -5377,17 +5628,17 @@ if test -z "$SKIP_ATHENA" -o -z "$SKIP_N
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:5381: checking for $ac_hdr" >&5
+echo "configure:5632: 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 5386 "configure"
+#line 5637 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5391: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5642: \"$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*
@@ -5416,9 +5667,9 @@ done
 
     if test ! "$enable_xim" = "no"; then
     echo $ac_n "checking for XIMText in X11/Xlib.h""... $ac_c" 1>&6
-echo "configure:5420: checking for XIMText in X11/Xlib.h" >&5
+echo "configure:5671: checking for XIMText in X11/Xlib.h" >&5
     cat > conftest.$ac_ext <<EOF
-#line 5422 "configure"
+#line 5673 "configure"
 #include "confdefs.h"
 #include <X11/Xlib.h>
 EOF
@@ -5449,17 +5700,17 @@ if test -z "$SKIP_ATHENA" -o -z "$SKIP_N
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:5453: checking for $ac_hdr" >&5
+echo "configure:5704: 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 5458 "configure"
+#line 5709 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5463: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5714: \"$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*
@@ -5495,17 +5746,17 @@ if test -z "$SKIP_MOTIF"; then
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:5499: checking for $ac_hdr" >&5
+echo "configure:5750: 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 5504 "configure"
+#line 5755 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5509: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5760: \"$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*
@@ -5598,17 +5849,17 @@ fi
 
 
 echo $ac_n "checking quality of toupper""... $ac_c" 1>&6
-echo "configure:5602: checking quality of toupper" >&5
+echo "configure:5853: checking quality of toupper" >&5
 if test "$cross_compiling" = yes; then
   { echo "configure: error: failed to compile test program" 1>&2; exit 1; }
 else
   cat > conftest.$ac_ext <<EOF
-#line 5607 "configure"
+#line 5858 "configure"
 #include "confdefs.h"
 #include <ctype.h>
 main() { exit(toupper('A') == 'A' && tolower('z') == 'z'); }
 EOF
-if { (eval echo configure:5612: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:5863: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   cat >> confdefs.h <<\EOF
 #define BROKEN_TOUPPER 1
@@ -5625,16 +5876,16 @@ fi
 
 
 echo $ac_n "checking whether __DATE__ and __TIME__ work""... $ac_c" 1>&6
-echo "configure:5629: checking whether __DATE__ and __TIME__ work" >&5
+echo "configure:5880: checking whether __DATE__ and __TIME__ work" >&5
 cat > conftest.$ac_ext <<EOF
-#line 5631 "configure"
+#line 5882 "configure"
 #include "confdefs.h"
 
 int main() {
 printf("(" __DATE__ " " __TIME__ ")");
 ; return 0; }
 EOF
-if { (eval echo configure:5638: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5889: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   echo "$ac_t""yes" 1>&6; cat >> confdefs.h <<\EOF
 #define HAVE_DATE_TIME 1
@@ -5650,17 +5901,17 @@ rm -f conftest*
 
 ac_safe=`echo "elf.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for elf.h""... $ac_c" 1>&6
-echo "configure:5654: checking for elf.h" >&5
+echo "configure:5905: checking for elf.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 5659 "configure"
+#line 5910 "configure"
 #include "confdefs.h"
 #include <elf.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5664: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5915: \"$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*
@@ -5683,7 +5934,7 @@ fi
 
 if test "$HAS_ELF" = 1; then
   echo $ac_n "checking for main in -lelf""... $ac_c" 1>&6
-echo "configure:5687: checking for main in -lelf" >&5
+echo "configure:5938: checking for main in -lelf" >&5
 ac_lib_var=`echo elf'_'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
@@ -5691,14 +5942,14 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lelf  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 5695 "configure"
+#line 5946 "configure"
 #include "confdefs.h"
 
 int main() {
 main()
 ; return 0; }
 EOF
-if { (eval echo configure:5702: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5953: \"$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
@@ -5732,12 +5983,12 @@ for ac_hdr in dirent.h sys/ndir.h sys/di
 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:5736: checking for $ac_hdr that defines DIR" >&5
+echo "configure:5987: 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 5741 "configure"
+#line 5992 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <$ac_hdr>
@@ -5745,7 +5996,7 @@ int main() {
 DIR *dirp = 0;
 ; return 0; }
 EOF
-if { (eval echo configure:5749: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6000: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   eval "ac_cv_header_dirent_$ac_safe=yes"
 else
@@ -5770,7 +6021,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:5774: checking for opendir in -ldir" >&5
+echo "configure:6025: 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
@@ -5778,7 +6029,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-ldir  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 5782 "configure"
+#line 6033 "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
@@ -5789,7 +6040,7 @@ int main() {
 opendir()
 ; return 0; }
 EOF
-if { (eval echo configure:5793: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6044: \"$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
@@ -5811,7 +6062,7 @@ fi
 
 else
 echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6
-echo "configure:5815: checking for opendir in -lx" >&5
+echo "configure:6066: 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
@@ -5819,7 +6070,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lx  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 5823 "configure"
+#line 6074 "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
@@ -5830,7 +6081,7 @@ int main() {
 opendir()
 ; return 0; }
 EOF
-if { (eval echo configure:5834: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6085: \"$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
@@ -5854,12 +6105,12 @@ fi
 
 
 echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:5858: checking for ANSI C header files" >&5
+echo "configure:6109: 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 5863 "configure"
+#line 6114 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 #include <stdarg.h>
@@ -5867,7 +6118,7 @@ else
 #include <float.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5871: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:6122: \"$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*
@@ -5884,7 +6135,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 5888 "configure"
+#line 6139 "configure"
 #include "confdefs.h"
 #include <string.h>
 EOF
@@ -5902,7 +6153,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 5906 "configure"
+#line 6157 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 EOF
@@ -5923,7 +6174,7 @@ if test "$cross_compiling" = yes; then
   :
 else
   cat > conftest.$ac_ext <<EOF
-#line 5927 "configure"
+#line 6178 "configure"
 #include "confdefs.h"
 #include <ctype.h>
 #define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@@ -5934,7 +6185,7 @@ if (XOR (islower (i), ISLOWER (i)) || to
 exit (0); }
 
 EOF
-if { (eval echo configure:5938: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:6189: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   :
 else
@@ -5958,12 +6209,12 @@ EOF
 fi
 
 echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6
-echo "configure:5962: checking for sys/wait.h that is POSIX.1 compatible" >&5
+echo "configure:6213: checking for sys/wait.h that is POSIX.1 compatible" >&5
 if eval "test \"`echo '$''{'ac_cv_header_sys_wait_h'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5967 "configure"
+#line 6218 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/wait.h>
@@ -5979,7 +6230,7 @@ wait (&s);
 s = WIFEXITED (s) ? WEXITSTATUS (s) : 1;
 ; return 0; }
 EOF
-if { (eval echo configure:5983: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6234: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_header_sys_wait_h=yes
 else
@@ -6002,16 +6253,16 @@ fi
 
 if test $ac_cv_header_sys_wait_h = no; then
   echo $ac_n "checking for sys/wait.h that defines union wait""... $ac_c" 1>&6
-echo "configure:6006: checking for sys/wait.h that defines union wait" >&5
+echo "configure:6257: checking for sys/wait.h that defines union wait" >&5
   cat > conftest.$ac_ext <<EOF
-#line 6008 "configure"
+#line 6259 "configure"
 #include "confdefs.h"
 #include <sys/wait.h>
 int main() {
 union wait xx, yy; xx = yy
 ; return 0; }
 EOF
-if { (eval echo configure:6015: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6266: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   echo "$ac_t""yes" 1>&6
 			cat >> confdefs.h <<\EOF
@@ -6042,17 +6293,17 @@ for ac_hdr in stdarg.h stdlib.h string.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:6046: checking for $ac_hdr" >&5
+echo "configure:6297: 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 6051 "configure"
+#line 6302 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:6056: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:6307: \"$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*
@@ -6084,17 +6335,17 @@ if test "x$MACOSX" != "xyes"; then
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:6088: checking for $ac_hdr" >&5
+echo "configure:6339: 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 6093 "configure"
+#line 6344 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:6098: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:6349: \"$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*
@@ -6123,11 +6374,11 @@ done
 fi
 
 echo $ac_n "checking if strings.h can be included after string.h""... $ac_c" 1>&6
-echo "configure:6127: checking if strings.h can be included after string.h" >&5
+echo "configure:6378: checking if strings.h can be included after string.h" >&5
 cppflags_save=$CPPFLAGS
 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
 cat > conftest.$ac_ext <<EOF
-#line 6131 "configure"
+#line 6382 "configure"
 #include "confdefs.h"
 
 #if defined(_AIX) && !defined(_AIX51) && !defined(_NO_PROTO)
@@ -6148,7 +6399,7 @@ int main() {
 int i; i = 0;
 ; return 0; }
 EOF
-if { (eval echo configure:6152: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6403: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   echo "$ac_t""yes" 1>&6
 else
@@ -6166,13 +6417,13 @@ CPPFLAGS=$cppflags_save
 
 if test $ac_cv_prog_gcc = yes; then
     echo $ac_n "checking whether ${CC-cc} needs -traditional""... $ac_c" 1>&6
-echo "configure:6170: checking whether ${CC-cc} needs -traditional" >&5
+echo "configure:6421: checking whether ${CC-cc} needs -traditional" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_gcc_traditional'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
     ac_pattern="Autoconf.*'x'"
   cat > conftest.$ac_ext <<EOF
-#line 6176 "configure"
+#line 6427 "configure"
 #include "confdefs.h"
 #include <sgtty.h>
 Autoconf TIOCGETP
@@ -6190,7 +6441,7 @@ rm -f conftest*
 
   if test $ac_cv_prog_gcc_traditional = no; then
     cat > conftest.$ac_ext <<EOF
-#line 6194 "configure"
+#line 6445 "configure"
 #include "confdefs.h"
 #include <termio.h>
 Autoconf TCGETA
@@ -6212,12 +6463,12 @@ echo "$ac_t""$ac_cv_prog_gcc_traditional
 fi
 
 echo $ac_n "checking for working const""... $ac_c" 1>&6
-echo "configure:6216: checking for working const" >&5
+echo "configure:6467: 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 6221 "configure"
+#line 6472 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -6266,7 +6517,7 @@ ccp = (char const *const *) p;
 
 ; return 0; }
 EOF
-if { (eval echo configure:6270: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6521: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_const=yes
 else
@@ -6287,12 +6538,12 @@ EOF
 fi
 
 echo $ac_n "checking for mode_t""... $ac_c" 1>&6
-echo "configure:6291: checking for mode_t" >&5
+echo "configure:6542: 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 6296 "configure"
+#line 6547 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -6320,12 +6571,12 @@ EOF
 fi
 
 echo $ac_n "checking for off_t""... $ac_c" 1>&6
-echo "configure:6324: checking for off_t" >&5
+echo "configure:6575: 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 6329 "configure"
+#line 6580 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -6353,12 +6604,12 @@ EOF
 fi
 
 echo $ac_n "checking for pid_t""... $ac_c" 1>&6
-echo "configure:6357: checking for pid_t" >&5
+echo "configure:6608: 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 6362 "configure"
+#line 6613 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -6386,12 +6637,12 @@ EOF
 fi
 
 echo $ac_n "checking for size_t""... $ac_c" 1>&6
-echo "configure:6390: checking for size_t" >&5
+echo "configure:6641: 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 6395 "configure"
+#line 6646 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -6419,12 +6670,12 @@ EOF
 fi
 
 echo $ac_n "checking for uid_t in sys/types.h""... $ac_c" 1>&6
-echo "configure:6423: checking for uid_t in sys/types.h" >&5
+echo "configure:6674: 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 6428 "configure"
+#line 6679 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 EOF
@@ -6453,12 +6704,12 @@ EOF
 fi
 
 echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6
-echo "configure:6457: checking whether time.h and sys/time.h may both be included" >&5
+echo "configure:6708: 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 6462 "configure"
+#line 6713 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/time.h>
@@ -6467,7 +6718,7 @@ int main() {
 struct tm *tp;
 ; return 0; }
 EOF
-if { (eval echo configure:6471: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6722: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_header_time=yes
 else
@@ -6488,12 +6739,12 @@ EOF
 fi
 
 echo $ac_n "checking for ino_t""... $ac_c" 1>&6
-echo "configure:6492: checking for ino_t" >&5
+echo "configure:6743: checking for ino_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_ino_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 6497 "configure"
+#line 6748 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -6521,12 +6772,12 @@ EOF
 fi
 
 echo $ac_n "checking for dev_t""... $ac_c" 1>&6
-echo "configure:6525: checking for dev_t" >&5
+echo "configure:6776: checking for dev_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_dev_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 6530 "configure"
+#line 6781 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -6555,12 +6806,12 @@ fi
 
 
 echo $ac_n "checking for rlim_t""... $ac_c" 1>&6
-echo "configure:6559: checking for rlim_t" >&5
+echo "configure:6810: checking for rlim_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_rlim_t'+set}'`\" = set"; then
   echo "$ac_t""(cached) $ac_cv_type_rlim_t" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 6564 "configure"
+#line 6815 "configure"
 #include "confdefs.h"
 
 #include <sys/types.h>
@@ -6592,12 +6843,12 @@ EOF
 fi
 
 echo $ac_n "checking for stack_t""... $ac_c" 1>&6
-echo "configure:6596: checking for stack_t" >&5
+echo "configure:6847: checking for stack_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_stack_t'+set}'`\" = set"; then
   echo "$ac_t""(cached) $ac_cv_type_stack_t" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 6601 "configure"
+#line 6852 "configure"
 #include "confdefs.h"
 
 #include <sys/types.h>
@@ -6627,9 +6878,9 @@ EOF
 fi
 
 echo $ac_n "checking whether stack_t has an ss_base field""... $ac_c" 1>&6
-echo "configure:6631: checking whether stack_t has an ss_base field" >&5
+echo "configure:6882: checking whether stack_t has an ss_base field" >&5
 cat > conftest.$ac_ext <<EOF
-#line 6633 "configure"
+#line 6884 "configure"
 #include "confdefs.h"
 
 #include <sys/types.h>
@@ -6644,7 +6895,7 @@ int main() {
 stack_t sigstk; sigstk.ss_base = 0; 
 ; return 0; }
 EOF
-if { (eval echo configure:6648: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6899: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   echo "$ac_t""yes" 1>&6; cat >> confdefs.h <<\EOF
 #define HAVE_SS_BASE 1
@@ -6660,7 +6911,7 @@ rm -f conftest*
 
 olibs="$LIBS"
 echo $ac_n "checking --with-tlib argument""... $ac_c" 1>&6
-echo "configure:6664: checking --with-tlib argument" >&5
+echo "configure:6915: checking --with-tlib argument" >&5
 # Check whether --with-tlib or --without-tlib was given.
 if test "${with_tlib+set}" = set; then
   withval="$with_tlib"
@@ -6678,7 +6929,7 @@ else
   esac
   for libname in $tlibs; do
     echo $ac_n "checking for tgetent in -l${libname}""... $ac_c" 1>&6
-echo "configure:6682: checking for tgetent in -l${libname}" >&5
+echo "configure:6933: checking for tgetent in -l${libname}" >&5
 ac_lib_var=`echo ${libname}'_'tgetent | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -6686,7 +6937,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-l${libname}  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 6690 "configure"
+#line 6941 "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
@@ -6697,7 +6948,7 @@ int main() {
 tgetent()
 ; return 0; }
 EOF
-if { (eval echo configure:6701: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6952: \"$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
@@ -6729,7 +6980,7 @@ fi
   res="FAIL"
 else
   cat > conftest.$ac_ext <<EOF
-#line 6733 "configure"
+#line 6984 "configure"
 #include "confdefs.h"
 
 #ifdef HAVE_TERMCAP_H
@@ -6737,7 +6988,7 @@ else
 #endif
 main() {char *s; s=(char *)tgoto("%p1%d", 0, 1); exit(0); }
 EOF
-if { (eval echo configure:6741: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:6992: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   res="OK"
 else
@@ -6759,12 +7010,12 @@ fi
 fi
 if test "x$olibs" != "x$LIBS"; then
   echo $ac_n "checking whether we talk terminfo""... $ac_c" 1>&6
-echo "configure:6763: checking whether we talk terminfo" >&5
+echo "configure:7014: checking whether we talk terminfo" >&5
   if test "$cross_compiling" = yes; then
   { echo "configure: error: failed to compile test program." 1>&2; exit 1; }
 else
   cat > conftest.$ac_ext <<EOF
-#line 6768 "configure"
+#line 7019 "configure"
 #include "confdefs.h"
 
 #ifdef HAVE_TERMCAP_H
@@ -6773,7 +7024,7 @@ else
 main()
 {char *s; s=(char *)tgoto("%p1%d", 0, 1); exit(!strcmp(s==0 ? "" : s, "1")); }
 EOF
-if { (eval echo configure:6777: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:7028: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   echo "$ac_t""no -- we are in termcap land" 1>&6
 else
@@ -6794,12 +7045,12 @@ fi
 
 if test "x$olibs" != "x$LIBS"; then
   echo $ac_n "checking what tgetent() returns for an unknown terminal""... $ac_c" 1>&6
-echo "configure:6798: checking what tgetent() returns for an unknown terminal" >&5
+echo "configure:7049: checking what tgetent() returns for an unknown terminal" >&5
   if test "$cross_compiling" = yes; then
   { echo "configure: error: failed to compile test program." 1>&2; exit 1; }
 else
   cat > conftest.$ac_ext <<EOF
-#line 6803 "configure"
+#line 7054 "configure"
 #include "confdefs.h"
 
 #ifdef HAVE_TERMCAP_H
@@ -6808,7 +7059,7 @@ else
 main()
 {char s[10000]; int res = tgetent(s, "thisterminaldoesnotexist"); exit(res != 0); }
 EOF
-if { (eval echo configure:6812: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:7063: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   echo "$ac_t""zero" 1>&6; cat >> confdefs.h <<\EOF
 #define TGETENT_ZERO_ERR 0
@@ -6826,9 +7077,9 @@ fi
 fi
 
 echo $ac_n "checking whether termcap.h contains ospeed""... $ac_c" 1>&6
-echo "configure:6830: checking whether termcap.h contains ospeed" >&5
+echo "configure:7081: checking whether termcap.h contains ospeed" >&5
 cat > conftest.$ac_ext <<EOF
-#line 6832 "configure"
+#line 7083 "configure"
 #include "confdefs.h"
 
 #ifdef HAVE_TERMCAP_H
@@ -6839,7 +7090,7 @@ int main() {
 ospeed = 20000
 ; return 0; }
 EOF
-if { (eval echo configure:6843: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7094: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   echo "$ac_t""yes" 1>&6; cat >> confdefs.h <<\EOF
 #define HAVE_OSPEED 1
@@ -6851,9 +7102,9 @@ else
   rm -rf conftest*
   echo "$ac_t""no" 1>&6
 	echo $ac_n "checking whether ospeed can be extern""... $ac_c" 1>&6
-echo "configure:6855: checking whether ospeed can be extern" >&5
+echo "configure:7106: checking whether ospeed can be extern" >&5
 	cat > conftest.$ac_ext <<EOF
-#line 6857 "configure"
+#line 7108 "configure"
 #include "confdefs.h"
 
 #ifdef HAVE_TERMCAP_H
@@ -6865,7 +7116,7 @@ int main() {
 ospeed = 20000
 ; return 0; }
 EOF
-if { (eval echo configure:6869: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7120: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   echo "$ac_t""yes" 1>&6; cat >> confdefs.h <<\EOF
 #define OSPEED_EXTERN 1
@@ -6883,9 +7134,9 @@ fi
 rm -f conftest*
 
 echo $ac_n "checking whether termcap.h contains UP, BC and PC""... $ac_c" 1>&6
-echo "configure:6887: checking whether termcap.h contains UP, BC and PC" >&5
+echo "configure:7138: checking whether termcap.h contains UP, BC and PC" >&5
 cat > conftest.$ac_ext <<EOF
-#line 6889 "configure"
+#line 7140 "configure"
 #include "confdefs.h"
 
 #ifdef HAVE_TERMCAP_H
@@ -6896,7 +7147,7 @@ int main() {
 if (UP == 0 && BC == 0) PC = 1
 ; return 0; }
 EOF
-if { (eval echo configure:6900: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7151: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   echo "$ac_t""yes" 1>&6; cat >> confdefs.h <<\EOF
 #define HAVE_UP_BC_PC 1
@@ -6908,9 +7159,9 @@ else
   rm -rf conftest*
   echo "$ac_t""no" 1>&6
 	echo $ac_n "checking whether UP, BC and PC can be extern""... $ac_c" 1>&6
-echo "configure:6912: checking whether UP, BC and PC can be extern" >&5
+echo "configure:7163: checking whether UP, BC and PC can be extern" >&5
 	cat > conftest.$ac_ext <<EOF
-#line 6914 "configure"
+#line 7165 "configure"
 #include "confdefs.h"
 
 #ifdef HAVE_TERMCAP_H
@@ -6922,7 +7173,7 @@ int main() {
 if (UP == 0 && BC == 0) PC = 1
 ; return 0; }
 EOF
-if { (eval echo configure:6926: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7177: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   echo "$ac_t""yes" 1>&6; cat >> confdefs.h <<\EOF
 #define UP_BC_PC_EXTERN 1
@@ -6940,9 +7191,9 @@ fi
 rm -f conftest*
 
 echo $ac_n "checking whether tputs() uses outfuntype""... $ac_c" 1>&6
-echo "configure:6944: checking whether tputs() uses outfuntype" >&5
+echo "configure:7195: checking whether tputs() uses outfuntype" >&5
 cat > conftest.$ac_ext <<EOF
-#line 6946 "configure"
+#line 7197 "configure"
 #include "confdefs.h"
 
 #ifdef HAVE_TERMCAP_H
@@ -6953,7 +7204,7 @@ int main() {
 extern int xx(); tputs("test", 1, (outfuntype)xx)
 ; return 0; }
 EOF
-if { (eval echo configure:6957: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7208: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   echo "$ac_t""yes" 1>&6; cat >> confdefs.h <<\EOF
 #define HAVE_OUTFUNTYPE 1
@@ -6968,9 +7219,9 @@ fi
 rm -f conftest*
 
 echo $ac_n "checking whether sys/select.h and sys/time.h may both be included""... $ac_c" 1>&6
-echo "configure:6972: checking whether sys/select.h and sys/time.h may both be included" >&5
+echo "configure:7223: checking whether sys/select.h and sys/time.h may both be included" >&5
 cat > conftest.$ac_ext <<EOF
-#line 6974 "configure"
+#line 7225 "configure"
 #include "confdefs.h"
 
 #include <sys/types.h>
@@ -6980,7 +7231,7 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:6984: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7235: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   echo "$ac_t""yes" 1>&6
 			cat >> confdefs.h <<\EOF
@@ -6997,7 +7248,7 @@ rm -f conftest*
 
 
 echo $ac_n "checking for /dev/ptc""... $ac_c" 1>&6
-echo "configure:7001: checking for /dev/ptc" >&5
+echo "configure:7252: checking for /dev/ptc" >&5
 if test -r /dev/ptc; then
   cat >> confdefs.h <<\EOF
 #define HAVE_DEV_PTC 1
@@ -7009,17 +7260,17 @@ else
 fi
 
 echo $ac_n "checking for SVR4 ptys""... $ac_c" 1>&6
-echo "configure:7013: checking for SVR4 ptys" >&5
+echo "configure:7264: checking for SVR4 ptys" >&5
 if test -c /dev/ptmx ; then
   cat > conftest.$ac_ext <<EOF
-#line 7016 "configure"
+#line 7267 "configure"
 #include "confdefs.h"
 
 int main() {
 ptsname(0);grantpt(0);unlockpt(0);
 ; return 0; }
 EOF
-if { (eval echo configure:7023: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7274: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   echo "$ac_t""yes" 1>&6; cat >> confdefs.h <<\EOF
 #define HAVE_SVR4_PTYS 1
@@ -7037,14 +7288,14 @@ else
 fi
 
 echo $ac_n "checking for ptyranges""... $ac_c" 1>&6
-echo "configure:7041: checking for ptyranges" >&5
+echo "configure:7292: checking for ptyranges" >&5
 if test -d /dev/ptym ; then
   pdir='/dev/ptym'
 else
   pdir='/dev'
 fi
 cat > conftest.$ac_ext <<EOF
-#line 7048 "configure"
+#line 7299 "configure"
 #include "confdefs.h"
 #ifdef M_UNIX
    yes;
@@ -7078,13 +7329,13 @@ else
 fi
 
 echo $ac_n "checking default tty permissions/group""... $ac_c" 1>&6
-echo "configure:7082: checking default tty permissions/group" >&5
+echo "configure:7333: checking default tty permissions/group" >&5
 rm -f conftest_grp
 if test "$cross_compiling" = yes; then
   { echo "configure: error: failed to compile test program" 1>&2; exit 1; }
 else
   cat > conftest.$ac_ext <<EOF
-#line 7088 "configure"
+#line 7339 "configure"
 #include "confdefs.h"
 
 #include <sys/types.h>
@@ -7116,7 +7367,7 @@ main()
 }
 
 EOF
-if { (eval echo configure:7120: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:7371: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   
     if test -f conftest_grp; then
@@ -7147,12 +7398,12 @@ rm -f conftest_grp
 
 
 echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6
-echo "configure:7151: checking return type of signal handlers" >&5
+echo "configure:7402: checking return type of signal handlers" >&5
 if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 7156 "configure"
+#line 7407 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <signal.h>
@@ -7169,7 +7420,7 @@ int main() {
 int i;
 ; return 0; }
 EOF
-if { (eval echo configure:7173: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7424: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_type_signal=void
 else
@@ -7201,9 +7452,9 @@ EOF
 fi
 
 echo $ac_n "checking for struct sigcontext""... $ac_c" 1>&6
-echo "configure:7205: checking for struct sigcontext" >&5
+echo "configure:7456: checking for struct sigcontext" >&5
 cat > conftest.$ac_ext <<EOF
-#line 7207 "configure"
+#line 7458 "configure"
 #include "confdefs.h"
 
 #include <signal.h>
@@ -7217,7 +7468,7 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:7221: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7472: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   echo "$ac_t""yes" 1>&6
 		cat >> confdefs.h <<\EOF
@@ -7233,12 +7484,12 @@ fi
 rm -f conftest*
 
 echo $ac_n "checking getcwd implementation""... $ac_c" 1>&6
-echo "configure:7237: checking getcwd implementation" >&5
+echo "configure:7488: checking getcwd implementation" >&5
 if test "$cross_compiling" = yes; then
   { echo "configure: error: failed to compile test program" 1>&2; exit 1; }
 else
   cat > conftest.$ac_ext <<EOF
-#line 7242 "configure"
+#line 7493 "configure"
 #include "confdefs.h"
 
 char *dagger[] = { "IFS=pwd", 0 };
@@ -7250,7 +7501,7 @@ main()
   return getcwd(buffer, 500) ? 0 : 1;
 }
 EOF
-if { (eval echo configure:7254: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:7505: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   echo "$ac_t""it is usable" 1>&6
 else
@@ -7275,12 +7526,12 @@ for ac_func in bcmp fchdir fchown fseeko
 	strnicmp strpbrk strtol tgetent towlower towupper usleep utime utimes
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:7279: checking for $ac_func" >&5
+echo "configure:7530: 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 7284 "configure"
+#line 7535 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -7303,7 +7554,7 @@ choke me
 
 ; return 0; }
 EOF
-if { (eval echo configure:7307: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7558: \"$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
@@ -7329,9 +7580,9 @@ done
 
 
 echo $ac_n "checking for st_blksize""... $ac_c" 1>&6
-echo "configure:7333: checking for st_blksize" >&5
+echo "configure:7584: checking for st_blksize" >&5
 cat > conftest.$ac_ext <<EOF
-#line 7335 "configure"
+#line 7586 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -7343,7 +7594,7 @@ int main() {
 	n = (int)st.st_blksize;
 ; return 0; }
 EOF
-if { (eval echo configure:7347: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7598: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   echo "$ac_t""yes" 1>&6; cat >> confdefs.h <<\EOF
 #define HAVE_ST_BLKSIZE 1
@@ -7358,18 +7609,18 @@ fi
 rm -f conftest*
 
 echo $ac_n "checking whether stat() ignores a trailing slash""... $ac_c" 1>&6
-echo "configure:7362: checking whether stat() ignores a trailing slash" >&5
+echo "configure:7613: checking whether stat() ignores a trailing slash" >&5
 if test "$cross_compiling" = yes; then
   { echo "configure: error: failed to compile test program" 1>&2; exit 1; }
 else
   cat > conftest.$ac_ext <<EOF
-#line 7367 "configure"
+#line 7618 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/stat.h>
 main() {struct stat st;  exit(stat("configure/", &st) != 0); }
 EOF
-if { (eval echo configure:7373: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:7624: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   echo "$ac_t""yes" 1>&6; cat >> confdefs.h <<\EOF
 #define STAT_IGNORES_SLASH 1
@@ -7386,11 +7637,11 @@ fi
 
 
 echo $ac_n "checking for iconv_open()""... $ac_c" 1>&6
-echo "configure:7390: checking for iconv_open()" >&5
+echo "configure:7641: checking for iconv_open()" >&5
 save_LIBS="$LIBS"
 LIBS="$LIBS -liconv"
 cat > conftest.$ac_ext <<EOF
-#line 7394 "configure"
+#line 7645 "configure"
 #include "confdefs.h"
 
 #ifdef HAVE_ICONV_H
@@ -7401,7 +7652,7 @@ int main() {
 iconv_open("fr", "to");
 ; return 0; }
 EOF
-if { (eval echo configure:7405: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7656: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   echo "$ac_t""yes; with -liconv" 1>&6; cat >> confdefs.h <<\EOF
 #define HAVE_ICONV 1
@@ -7413,7 +7664,7 @@ else
   rm -rf conftest*
   LIBS="$save_LIBS"
     cat > conftest.$ac_ext <<EOF
-#line 7417 "configure"
+#line 7668 "configure"
 #include "confdefs.h"
 
 #ifdef HAVE_ICONV_H
@@ -7424,7 +7675,7 @@ int main() {
 iconv_open("fr", "to");
 ; return 0; }
 EOF
-if { (eval echo configure:7428: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7679: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   echo "$ac_t""yes" 1>&6; cat >> confdefs.h <<\EOF
 #define HAVE_ICONV 1
@@ -7442,9 +7693,9 @@ rm -f conftest*
 
 
 echo $ac_n "checking for nl_langinfo(CODESET)""... $ac_c" 1>&6
-echo "configure:7446: checking for nl_langinfo(CODESET)" >&5
+echo "configure:7697: checking for nl_langinfo(CODESET)" >&5
 cat > conftest.$ac_ext <<EOF
-#line 7448 "configure"
+#line 7699 "configure"
 #include "confdefs.h"
 
 #ifdef HAVE_LANGINFO_H
@@ -7455,7 +7706,7 @@ int main() {
 char *cs = nl_langinfo(CODESET);
 ; return 0; }
 EOF
-if { (eval echo configure:7459: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7710: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   echo "$ac_t""yes" 1>&6; cat >> confdefs.h <<\EOF
 #define HAVE_NL_LANGINFO_CODESET 1
@@ -7470,7 +7721,7 @@ fi
 rm -f conftest*
 
 echo $ac_n "checking --disable-acl argument""... $ac_c" 1>&6
-echo "configure:7474: checking --disable-acl argument" >&5
+echo "configure:7725: checking --disable-acl argument" >&5
 # Check whether --enable-acl or --disable-acl was given.
 if test "${enable_acl+set}" = set; then
   enableval="$enable_acl"
@@ -7482,7 +7733,7 @@ fi
 if test "$enable_acl" = "yes"; then
 echo "$ac_t""no" 1>&6
 echo $ac_n "checking for acl_get_file in -lposix1e""... $ac_c" 1>&6
-echo "configure:7486: checking for acl_get_file in -lposix1e" >&5
+echo "configure:7737: checking for acl_get_file in -lposix1e" >&5
 ac_lib_var=`echo posix1e'_'acl_get_file | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -7490,7 +7741,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lposix1e  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 7494 "configure"
+#line 7745 "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
@@ -7501,7 +7752,7 @@ int main() {
 acl_get_file()
 ; return 0; }
 EOF
-if { (eval echo configure:7505: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7756: \"$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
@@ -7520,7 +7771,7 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_l
 else
   echo "$ac_t""no" 1>&6
 echo $ac_n "checking for acl_get_file in -lacl""... $ac_c" 1>&6
-echo "configure:7524: checking for acl_get_file in -lacl" >&5
+echo "configure:7775: checking for acl_get_file in -lacl" >&5
 ac_lib_var=`echo acl'_'acl_get_file | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -7528,7 +7779,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lacl  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 7532 "configure"
+#line 7783 "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
@@ -7539,7 +7790,7 @@ int main() {
 acl_get_file()
 ; return 0; }
 EOF
-if { (eval echo configure:7543: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7794: \"$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
@@ -7556,7 +7807,7 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_l
   echo "$ac_t""yes" 1>&6
   LIBS="$LIBS -lacl"
 		  echo $ac_n "checking for fgetxattr in -lattr""... $ac_c" 1>&6
-echo "configure:7560: checking for fgetxattr in -lattr" >&5
+echo "configure:7811: checking for fgetxattr in -lattr" >&5
 ac_lib_var=`echo attr'_'fgetxattr | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -7564,7 +7815,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lattr  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 7568 "configure"
+#line 7819 "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
@@ -7575,7 +7826,7 @@ int main() {
 fgetxattr()
 ; return 0; }
 EOF
-if { (eval echo configure:7579: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7830: \"$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
@@ -7603,9 +7854,9 @@ fi
 
 
 echo $ac_n "checking for POSIX ACL support""... $ac_c" 1>&6
-echo "configure:7607: checking for POSIX ACL support" >&5
+echo "configure:7858: checking for POSIX ACL support" >&5
 cat > conftest.$ac_ext <<EOF
-#line 7609 "configure"
+#line 7860 "configure"
 #include "confdefs.h"
 
 #include <sys/types.h>
@@ -7619,7 +7870,7 @@ acl = acl_get_file("foo", ACL_TYPE_ACCES
 	acl_free(acl);
 ; return 0; }
 EOF
-if { (eval echo configure:7623: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7874: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   echo "$ac_t""yes" 1>&6; cat >> confdefs.h <<\EOF
 #define HAVE_POSIX_ACL 1
@@ -7634,9 +7885,9 @@ fi
 rm -f conftest*
 
 echo $ac_n "checking for Solaris ACL support""... $ac_c" 1>&6
-echo "configure:7638: checking for Solaris ACL support" >&5
+echo "configure:7889: checking for Solaris ACL support" >&5
 cat > conftest.$ac_ext <<EOF
-#line 7640 "configure"
+#line 7891 "configure"
 #include "confdefs.h"
 
 #ifdef HAVE_SYS_ACL_H
@@ -7647,7 +7898,7 @@ acl("foo", GETACLCNT, 0, NULL);
 	
 ; return 0; }
 EOF
-if { (eval echo configure:7651: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7902: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   echo "$ac_t""yes" 1>&6; cat >> confdefs.h <<\EOF
 #define HAVE_SOLARIS_ACL 1
@@ -7662,9 +7913,9 @@ fi
 rm -f conftest*
 
 echo $ac_n "checking for AIX ACL support""... $ac_c" 1>&6
-echo "configure:7666: checking for AIX ACL support" >&5
+echo "configure:7917: checking for AIX ACL support" >&5
 cat > conftest.$ac_ext <<EOF
-#line 7668 "configure"
+#line 7919 "configure"
 #include "confdefs.h"
 
 #ifdef HAVE_SYS_ACL_H
@@ -7686,7 +7937,7 @@ aclsize = sizeof(struct acl);
 	
 ; return 0; }
 EOF
-if { (eval echo configure:7690: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7941: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   echo "$ac_t""yes" 1>&6; cat >> confdefs.h <<\EOF
 #define HAVE_AIX_ACL 1
@@ -7704,7 +7955,7 @@ else
 fi
 
 echo $ac_n "checking --disable-gpm argument""... $ac_c" 1>&6
-echo "configure:7708: checking --disable-gpm argument" >&5
+echo "configure:7959: checking --disable-gpm argument" >&5
 # Check whether --enable-gpm or --disable-gpm was given.
 if test "${enable_gpm+set}" = set; then
   enableval="$enable_gpm"
@@ -7717,13 +7968,13 @@ fi
 if test "$enable_gpm" = "yes"; then
   echo "$ac_t""no" 1>&6
     echo $ac_n "checking for gpm""... $ac_c" 1>&6
-echo "configure:7721: checking for gpm" >&5
+echo "configure:7972: checking for gpm" >&5
 if eval "test \"`echo '$''{'vi_cv_have_gpm'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   olibs="$LIBS" ; LIBS="-lgpm"
 	cat > conftest.$ac_ext <<EOF
-#line 7727 "configure"
+#line 7978 "configure"
 #include "confdefs.h"
 #include <gpm.h>
 	    #include <linux/keyboard.h>
@@ -7731,7 +7982,7 @@ int main() {
 Gpm_GetLibVersion(NULL);
 ; return 0; }
 EOF
-if { (eval echo configure:7735: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7986: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   	    	    vi_cv_have_gpm=yes
 else
@@ -7758,12 +8009,12 @@ else
 fi
 
 echo $ac_n "checking for vsnprintf()""... $ac_c" 1>&6
-echo "configure:7762: checking for vsnprintf()" >&5
+echo "configure:8013: checking for vsnprintf()" >&5
 if test "$cross_compiling" = yes; then
   { echo "configure: error: failed to compile test program" 1>&2; exit 1; }
 else
   cat > conftest.$ac_ext <<EOF
-#line 7767 "configure"
+#line 8018 "configure"
 #include "confdefs.h"
 
 #include <stdio.h>
@@ -7784,7 +8035,7 @@ else
 	}
 	    
 EOF
-if { (eval echo configure:7788: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:8039: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   cat >> confdefs.h <<\EOF
 #define HAVE_VSNPRINTF 1
@@ -7802,16 +8053,16 @@ fi
 
 
 echo $ac_n "checking for rename""... $ac_c" 1>&6
-echo "configure:7806: checking for rename" >&5
+echo "configure:8057: checking for rename" >&5
 cat > conftest.$ac_ext <<EOF
-#line 7808 "configure"
+#line 8059 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 int main() {
 rename("this", "that")
 ; return 0; }
 EOF
-if { (eval echo configure:7815: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:8066: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   echo "$ac_t""yes" 1>&6; cat >> confdefs.h <<\EOF
 #define HAVE_RENAME 1
@@ -7826,9 +8077,9 @@ fi
 rm -f conftest*
 
 echo $ac_n "checking for sysctl""... $ac_c" 1>&6
-echo "configure:7830: checking for sysctl" >&5
+echo "configure:8081: checking for sysctl" >&5
 cat > conftest.$ac_ext <<EOF
-#line 7832 "configure"
+#line 8083 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/sysctl.h>
@@ -7843,7 +8094,7 @@ int main() {
 	
 ; return 0; }
 EOF
-if { (eval echo configure:7847: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:8098: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   echo "$ac_t""yes" 1>&6; cat >> confdefs.h <<\EOF
 #define HAVE_SYSCTL 1
@@ -7858,9 +8109,9 @@ fi
 rm -f conftest*
 
 echo $ac_n "checking for sysinfo""... $ac_c" 1>&6
-echo "configure:7862: checking for sysinfo" >&5
+echo "configure:8113: checking for sysinfo" >&5
 cat > conftest.$ac_ext <<EOF
-#line 7864 "configure"
+#line 8115 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/sysinfo.h>
@@ -7873,7 +8124,7 @@ int main() {
 	
 ; return 0; }
 EOF
-if { (eval echo configure:7877: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:8128: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   echo "$ac_t""yes" 1>&6; cat >> confdefs.h <<\EOF
 #define HAVE_SYSINFO 1
@@ -7888,9 +8139,9 @@ fi
 rm -f conftest*
 
 echo $ac_n "checking for sysconf""... $ac_c" 1>&6
-echo "configure:7892: checking for sysconf" >&5
+echo "configure:8143: checking for sysconf" >&5
 cat > conftest.$ac_ext <<EOF
-#line 7894 "configure"
+#line 8145 "configure"
 #include "confdefs.h"
 #include <unistd.h>
 int main() {
@@ -7899,7 +8150,7 @@ int main() {
 	
 ; return 0; }
 EOF
-if { (eval echo configure:7903: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:8154: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   echo "$ac_t""yes" 1>&6; cat >> confdefs.h <<\EOF
 #define HAVE_SYSCONF 1
@@ -7915,7 +8166,7 @@ rm -f conftest*
 
 
 echo $ac_n "checking size of int""... $ac_c" 1>&6
-echo "configure:7919: checking size of int" >&5
+echo "configure:8170: checking size of int" >&5
 if eval "test \"`echo '$''{'ac_cv_sizeof_int'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -7923,7 +8174,7 @@ else
   { echo "configure: error: failed to compile test program" 1>&2; exit 1; }
 else
   cat > conftest.$ac_ext <<EOF
-#line 7927 "configure"
+#line 8178 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 		main()
@@ -7934,7 +8185,7 @@ else
 		  exit(0);
 		}
 EOF
-if { (eval echo configure:7938: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:8189: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ac_cv_sizeof_int=`cat conftestval`
 else
@@ -7955,7 +8206,7 @@ EOF
 
 
 echo $ac_n "checking whether memmove/bcopy/memcpy handle overlaps""... $ac_c" 1>&6
-echo "configure:7959: checking whether memmove/bcopy/memcpy handle overlaps" >&5
+echo "configure:8210: checking whether memmove/bcopy/memcpy handle overlaps" >&5
 bcopy_test_prog='
 main() {
   char buf[10];
@@ -7975,11 +8226,11 @@ if test "$cross_compiling" = yes; then
   { echo "configure: error: failed to compile test program" 1>&2; exit 1; }
 else
   cat > conftest.$ac_ext <<EOF
-#line 7979 "configure"
+#line 8230 "configure"
 #include "confdefs.h"
 #define mch_memmove(s,d,l) memmove(d,s,l) $bcopy_test_prog
 EOF
-if { (eval echo configure:7983: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:8234: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   cat >> confdefs.h <<\EOF
 #define USEMEMMOVE 1
@@ -7993,11 +8244,11 @@ else
   { echo "configure: error: failed to compile test program" 1>&2; exit 1; }
 else
   cat > conftest.$ac_ext <<EOF
-#line 7997 "configure"
+#line 8248 "configure"
 #include "confdefs.h"
 #define mch_memmove(s,d,l) bcopy(d,s,l) $bcopy_test_prog
 EOF
-if { (eval echo configure:8001: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:8252: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   cat >> confdefs.h <<\EOF
 #define USEBCOPY 1
@@ -8011,11 +8262,11 @@ else
   { echo "configure: error: failed to compile test program" 1>&2; exit 1; }
 else
   cat > conftest.$ac_ext <<EOF
-#line 8015 "configure"
+#line 8266 "configure"
 #include "confdefs.h"
 #define mch_memmove(s,d,l) memcpy(d,s,l) $bcopy_test_prog
 EOF
-if { (eval echo configure:8019: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:8270: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   cat >> confdefs.h <<\EOF
 #define USEMEMCPY 1
@@ -8047,19 +8298,19 @@ if test "$enable_multibyte" = "yes"; the
     CFLAGS="$CFLAGS -I$x_includes"
     LDFLAGS="$X_LIBS $LDFLAGS -lX11"
     echo $ac_n "checking whether X_LOCALE needed""... $ac_c" 1>&6
-echo "configure:8051: checking whether X_LOCALE needed" >&5
+echo "configure:8302: checking whether X_LOCALE needed" >&5
     cat > conftest.$ac_ext <<EOF
-#line 8053 "configure"
+#line 8304 "configure"
 #include "confdefs.h"
 #include <X11/Xlocale.h>
 int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:8060: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:8311: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cat > conftest.$ac_ext <<EOF
-#line 8063 "configure"
+#line 8314 "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
@@ -8070,7 +8321,7 @@ int main() {
 _Xsetlocale()
 ; return 0; }
 EOF
-if { (eval echo configure:8074: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:8325: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   echo "$ac_t""yes" 1>&6
 		cat >> confdefs.h <<\EOF
@@ -8097,7 +8348,7 @@ rm -f conftest*
 fi
 
 echo $ac_n "checking for _xpg4_setrunelocale in -lxpg4""... $ac_c" 1>&6
-echo "configure:8101: checking for _xpg4_setrunelocale in -lxpg4" >&5
+echo "configure:8352: checking for _xpg4_setrunelocale in -lxpg4" >&5
 ac_lib_var=`echo xpg4'_'_xpg4_setrunelocale | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -8105,7 +8356,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lxpg4  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 8109 "configure"
+#line 8360 "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
@@ -8116,7 +8367,7 @@ int main() {
 _xpg4_setrunelocale()
 ; return 0; }
 EOF
-if { (eval echo configure:8120: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:8371: \"$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
@@ -8138,7 +8389,7 @@ fi
 
 
 echo $ac_n "checking how to create tags""... $ac_c" 1>&6
-echo "configure:8142: checking how to create tags" >&5
+echo "configure:8393: checking how to create tags" >&5
 test -f tags && mv tags tags.save
 if (eval ctags --version /dev/null | grep Exuberant) < /dev/null 1>&5 2>&1; then
   TAGPRG="ctags"
@@ -8155,7 +8406,7 @@ test -f tags.save && mv tags.save tags
 echo "$ac_t""$TAGPRG" 1>&6 
 
 echo $ac_n "checking how to run man with a section nr""... $ac_c" 1>&6
-echo "configure:8159: checking how to run man with a section nr" >&5
+echo "configure:8410: checking how to run man with a section nr" >&5
 MANDEF="man"
 (eval man -s 2 read) < /dev/null > /dev/null 2>&5 && MANDEF="man -s"
 echo "$ac_t""$MANDEF" 1>&6
@@ -8167,7 +8418,7 @@ EOF
 fi
 
 echo $ac_n "checking --disable-nls argument""... $ac_c" 1>&6
-echo "configure:8171: checking --disable-nls argument" >&5
+echo "configure:8422: checking --disable-nls argument" >&5
 # Check whether --enable-nls or --disable-nls was given.
 if test "${enable_nls+set}" = set; then
   enableval="$enable_nls"
@@ -8182,7 +8433,7 @@ if test "$enable_nls" = "yes"; then
   # Extract the first word of "msgfmt", so it can be a program name with args.
 set dummy msgfmt; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:8186: checking for $ac_word" >&5
+echo "configure:8437: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_MSGFMT'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -8209,19 +8460,19 @@ else
 fi
 
   echo $ac_n "checking for NLS""... $ac_c" 1>&6
-echo "configure:8213: checking for NLS" >&5
+echo "configure:8464: checking for NLS" >&5
   if test -f po/Makefile; then
     have_gettext="no"
     if test -n "$MSGFMT"; then
       cat > conftest.$ac_ext <<EOF
-#line 8218 "configure"
+#line 8469 "configure"
 #include "confdefs.h"
 #include <libintl.h>
 int main() {
 gettext("Test");
 ; return 0; }
 EOF
-if { (eval echo configure:8225: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:8476: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   echo "$ac_t""gettext() works" 1>&6; have_gettext="yes"
 else
@@ -8231,14 +8482,14 @@ else
   olibs=$LIBS
 	  LIBS="$LIBS -lintl"
 	  cat > conftest.$ac_ext <<EOF
-#line 8235 "configure"
+#line 8486 "configure"
 #include "confdefs.h"
 #include <libintl.h>
 int main() {
 gettext("Test");
 ; return 0; }
 EOF
-if { (eval echo configure:8242: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:8493: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   echo "$ac_t""gettext() works with -lintl" 1>&6; have_gettext="yes"
 else
@@ -8264,12 +8515,12 @@ EOF
             for ac_func in bind_textdomain_codeset
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:8268: checking for $ac_func" >&5
+echo "configure:8519: 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 8273 "configure"
+#line 8524 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -8292,7 +8543,7 @@ choke me
 
 ; return 0; }
 EOF
-if { (eval echo configure:8296: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:8547: \"$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
@@ -8317,9 +8568,9 @@ fi
 done
 
             echo $ac_n "checking for _nl_msg_cat_cntr""... $ac_c" 1>&6
-echo "configure:8321: checking for _nl_msg_cat_cntr" >&5
+echo "configure:8572: checking for _nl_msg_cat_cntr" >&5
       cat > conftest.$ac_ext <<EOF
-#line 8323 "configure"
+#line 8574 "configure"
 #include "confdefs.h"
 #include <libintl.h>
 		extern int _nl_msg_cat_cntr;
@@ -8327,7 +8578,7 @@ int main() {
 ++_nl_msg_cat_cntr;
 ; return 0; }
 EOF
-if { (eval echo configure:8331: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:8582: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   echo "$ac_t""yes" 1>&6; cat >> confdefs.h <<\EOF
 #define HAVE_NL_MSG_CAT_CNTR 1
@@ -8350,17 +8601,17 @@ fi
 
 ac_safe=`echo "dlfcn.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for dlfcn.h""... $ac_c" 1>&6
-echo "configure:8354: checking for dlfcn.h" >&5
+echo "configure:8605: checking for dlfcn.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 8359 "configure"
+#line 8610 "configure"
 #include "confdefs.h"
 #include <dlfcn.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:8364: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:8615: \"$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*
@@ -8381,17 +8632,17 @@ else
   echo "$ac_t""no" 1>&6
 ac_safe=`echo "dl.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for dl.h""... $ac_c" 1>&6
-echo "configure:8385: checking for dl.h" >&5
+echo "configure:8636: checking for dl.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 8390 "configure"
+#line 8641 "configure"
 #include "confdefs.h"
 #include <dl.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:8395: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:8646: \"$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*
@@ -8420,9 +8671,9 @@ if test x${DLL} = xdlfcn.h; then
 EOF
 
   echo $ac_n "checking for dlopen()""... $ac_c" 1>&6
-echo "configure:8424: checking for dlopen()" >&5
+echo "configure:8675: checking for dlopen()" >&5
   cat > conftest.$ac_ext <<EOF
-#line 8426 "configure"
+#line 8677 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -8432,7 +8683,7 @@ int main() {
       
 ; return 0; }
 EOF
-if { (eval echo configure:8436: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:8687: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   echo "$ac_t""yes" 1>&6;
 	      cat >> confdefs.h <<\EOF
@@ -8445,11 +8696,11 @@ else
   rm -rf conftest*
   echo "$ac_t""no" 1>&6;
 	      echo $ac_n "checking for dlopen() in -ldl""... $ac_c" 1>&6
-echo "configure:8449: checking for dlopen() in -ldl" >&5
+echo "configure:8700: checking for dlopen() in -ldl" >&5
 	      olibs=$LIBS
 	      LIBS="$LIBS -ldl"
 	      cat > conftest.$ac_ext <<EOF
-#line 8453 "configure"
+#line 8704 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -8459,7 +8710,7 @@ int main() {
 		 
 ; return 0; }
 EOF
-if { (eval echo configure:8463: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:8714: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   echo "$ac_t""yes" 1>&6;
 			  cat >> confdefs.h <<\EOF
@@ -8477,9 +8728,9 @@ rm -f conftest*
 fi
 rm -f conftest*
       echo $ac_n "checking for dlsym()""... $ac_c" 1>&6
-echo "configure:8481: checking for dlsym()" >&5
+echo "configure:8732: checking for dlsym()" >&5
   cat > conftest.$ac_ext <<EOF
-#line 8483 "configure"
+#line 8734 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -8489,7 +8740,7 @@ int main() {
       
 ; return 0; }
 EOF
-if { (eval echo configure:8493: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:8744: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   echo "$ac_t""yes" 1>&6;
 	      cat >> confdefs.h <<\EOF
@@ -8502,11 +8753,11 @@ else
   rm -rf conftest*
   echo "$ac_t""no" 1>&6;
 	      echo $ac_n "checking for dlsym() in -ldl""... $ac_c" 1>&6
-echo "configure:8506: checking for dlsym() in -ldl" >&5
+echo "configure:8757: checking for dlsym() in -ldl" >&5
 	      olibs=$LIBS
 	      LIBS="$LIBS -ldl"
 	      cat > conftest.$ac_ext <<EOF
-#line 8510 "configure"
+#line 8761 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -8516,7 +8767,7 @@ int main() {
 		 
 ; return 0; }
 EOF
-if { (eval echo configure:8520: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:8771: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   echo "$ac_t""yes" 1>&6;
 			  cat >> confdefs.h <<\EOF
@@ -8539,9 +8790,9 @@ elif test x${DLL} = xdl.h; then
 EOF
 
   echo $ac_n "checking for shl_load()""... $ac_c" 1>&6
-echo "configure:8543: checking for shl_load()" >&5
+echo "configure:8794: checking for shl_load()" >&5
   cat > conftest.$ac_ext <<EOF
-#line 8545 "configure"
+#line 8796 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -8551,7 +8802,7 @@ int main() {
      
 ; return 0; }
 EOF
-if { (eval echo configure:8555: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:8806: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   echo "$ac_t""yes" 1>&6;
 	  cat >> confdefs.h <<\EOF
@@ -8564,11 +8815,11 @@ else
   rm -rf conftest*
   echo "$ac_t""no" 1>&6;
 	  echo $ac_n "checking for shl_load() in -ldld""... $ac_c" 1>&6
-echo "configure:8568: checking for shl_load() in -ldld" >&5
+echo "configure:8819: checking for shl_load() in -ldld" >&5
 	  olibs=$LIBS
 	  LIBS="$LIBS -ldld"
 	  cat > conftest.$ac_ext <<EOF
-#line 8572 "configure"
+#line 8823 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -8578,7 +8829,7 @@ int main() {
 	     
 ; return 0; }
 EOF
-if { (eval echo configure:8582: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:8833: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   echo "$ac_t""yes" 1>&6;
 		  cat >> confdefs.h <<\EOF
@@ -8600,17 +8851,17 @@ for ac_hdr in setjmp.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:8604: checking for $ac_hdr" >&5
+echo "configure:8855: 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 8609 "configure"
+#line 8860 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:8614: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:8865: \"$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*
@@ -8647,7 +8898,7 @@ fi
 if test "x$MACOSX" = "xyes" && test "x$CARBON" = "xyes" \
 	&& test "x$GUITYPE" != "xCARBONGUI"; then
   echo $ac_n "checking whether we need -framework Carbon""... $ac_c" 1>&6
-echo "configure:8651: checking whether we need -framework Carbon" >&5
+echo "configure:8902: checking whether we need -framework Carbon" >&5
     if test "x$enable_multibyte" = "xyes" || test "x$features" == "xbig" \
 	|| test "x$features" = "xhuge"; then
     LIBS="$LIBS -framework Carbon"
@@ -8806,6 +9057,12 @@ s%@line_break@%$line_break%g
 s%@dovimdiff@%$dovimdiff%g
 s%@dogvimdiff@%$dogvimdiff%g
 s%@compiledby@%$compiledby%g
+s%@vi_cv_path_mzscheme@%$vi_cv_path_mzscheme%g
+s%@MZSCHEME_SRC@%$MZSCHEME_SRC%g
+s%@MZSCHEME_OBJ@%$MZSCHEME_OBJ%g
+s%@MZSCHEME_PRO@%$MZSCHEME_PRO%g
+s%@MZSCHEME_LIBS@%$MZSCHEME_LIBS%g
+s%@MZSCHEME_CFLAGS@%$MZSCHEME_CFLAGS%g
 s%@vi_cv_path_perl@%$vi_cv_path_perl%g
 s%@vi_cv_perllib@%$vi_cv_perllib%g
 s%@shrpenv@%$shrpenv%g
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -575,6 +575,9 @@ free_buffer(buf)
     buf_T	*buf;
 {
     free_buffer_stuff(buf, TRUE);
+#ifdef FEAT_MZSCHEME
+    mzscheme_buffer_free(buf);
+#endif
 #ifdef FEAT_PERL
     perl_buf_free(buf);
 #endif
--- a/src/config.h.in
+++ b/src/config.h.in
@@ -271,6 +271,9 @@
 /* Define if you want huge features. */
 #undef FEAT_HUGE
 
+/* Define if you want to include the MzScheme interpreter. */
+#undef FEAT_MZSCHEME
+
 /* Define if you want to include the Perl interpreter. */
 #undef FEAT_PERL
 
--- a/src/config.mk.in
+++ b/src/config.mk.in
@@ -35,6 +35,12 @@ X_PRE_LIBS	= @X_PRE_LIBS@
 X_EXTRA_LIBS	= @X_EXTRA_LIBS@
 X_LIBS		= @X_LIB@
 
+MZSCHEME_LIBS	= @MZSCHEME_LIBS@
+MZSCHEME_SRC	= @MZSCHEME_SRC@
+MZSCHEME_OBJ	= @MZSCHEME_OBJ@
+MZSCHEME_CFLAGS	= @MZSCHEME_CFLAGS@
+MZSCHEME_PRO	= @MZSCHEME_PRO@
+
 PERL		= @vi_cv_path_perl@
 PERLLIB		= @vi_cv_perllib@
 PERL_LIBS	= @PERL_LIBS@
--- a/src/configure.in
+++ b/src/configure.in
@@ -20,7 +20,7 @@ AC_PROG_AWK	dnl required for "make html"
 dnl Don't strip if we don't have it
 AC_CHECK_PROG(STRIP, strip, strip, :)
 
-dnl Check for extention of executables
+dnl Check for extension of executables
 AC_EXEEXT
 
 dnl Set default value for CFLAGS if none is defined or it's empty
@@ -292,6 +292,90 @@ else
   AC_MSG_RESULT(yes)
 fi
 
+dnl Check for MzScheme feature.
+AC_MSG_CHECKING(--enable-mzschemeinterp argument)
+AC_ARG_ENABLE(mzschemeinterp,
+	[  --enable-mzschemeinterp   Include MzScheme interpreter.], ,
+	[enable_mzschemeinterp="no"])
+AC_MSG_RESULT($enable_mzschemeinterp)
+
+if test "$enable_mzschemeinterp" = "yes"; then
+  dnl -- find the mzscheme executable
+  AC_SUBST(vi_cv_path_mzscheme)
+
+  AC_MSG_CHECKING(--with-plthome argument)
+  AC_ARG_WITH(plthome,
+  	[  --with-plthome=PLTHOME   Use PLTHOME.],
+        with_plthome="$withval"; AC_MSG_RESULT($with_plthome),
+	with_plthome="";AC_MSG_RESULT("no"))
+
+  if test "X$with_plthome" != "X"; then
+       vi_cv_path_mzscheme_pfx="$with_plthome"
+  else
+    AC_MSG_CHECKING(PLTHOME environment var)
+    if test "X$PLTHOME" != "X"; then
+	AC_MSG_RESULT("$PLTHOME")
+        vi_cv_path_mzscheme_pfx="$PLTHOME"
+    else
+	AC_MSG_RESULT("not set")
+	dnl -- try to find MzScheme executable
+        AC_PATH_PROG(vi_cv_path_mzscheme, mzscheme)
+
+	dnl resolve symbolic link, the executable is often elsewhere and there
+	dnl are no links for the include files.
+        if test "X$vi_cv_path_mzscheme" != "X"; then
+	  lsout=`ls -l $vi_cv_path_mzscheme`
+	  if echo "$lsout" | grep -e '->' >/dev/null 2>/dev/null; then
+	    vi_cv_path_mzscheme=`echo "$lsout" | sed 's/.*-> \(.*\)/\1/'`
+	  fi
+	fi
+
+        if test "X$vi_cv_path_mzscheme" != "X"; then
+            dnl -- find where MzScheme thinks it was installed
+            AC_CACHE_CHECK(MzScheme install prefix,vi_cv_path_mzscheme_pfx,
+            [ vi_cv_path_mzscheme_pfx=`
+      	    ${vi_cv_path_mzscheme} -evm \
+            "(display (simplify-path		\
+              (build-path (call-with-values	\
+      	        (lambda () (split-path (find-system-path (quote exec-file)))) \
+      	        (lambda (base name must-be-dir?) base)) (quote up))))"` ])
+	    dnl Remove a trailing slash.
+	    vi_cv_path_mzscheme_pfx=`echo "$vi_cv_path_mzscheme_pfx" | sed 's+/$++'`
+        fi
+    fi
+  fi
+
+  if test "X$vi_cv_path_mzscheme_pfx" != "X"; then
+    AC_MSG_CHECKING(if scheme.h can be found in $vi_cv_path_mzscheme_pfx/include)
+    if test -f $vi_cv_path_mzscheme_pfx/include/scheme.h; then
+      AC_MSG_RESULT("yes")
+    else
+      AC_MSG_RESULT("no")
+      vi_cv_path_mzscheme_pfx=
+    fi
+  fi
+
+  if test "X$vi_cv_path_mzscheme_pfx" != "X"; then
+    if test -f "${vi_cv_path_mzscheme_pfx}/lib/libmzgc.a"; then
+      MZSCHEME_LIBS="${vi_cv_path_mzscheme_pfx}/lib/libmzgc.a ${vi_cv_path_mzscheme_pfx}/lib/libmzscheme.a"
+    else
+      MZSCHEME_LIBS="-L${vi_cv_path_mzscheme_pfx}/lib -lmzgc -lmzscheme"
+    fi
+    MZSCHEME_CFLAGS="-I${vi_cv_path_mzscheme_pfx}/include   \
+      -DMZSCHEME_COLLECTS='\"${vi_cv_path_mzscheme_pfx}/collects\"'"
+    MZSCHEME_SRC="if_mzsch.c"
+    MZSCHEME_OBJ="objects/if_mzsch.o"
+    MZSCHEME_PRO="if_mzsch.pro"
+    AC_DEFINE(FEAT_MZSCHEME)
+  fi
+  AC_SUBST(MZSCHEME_SRC)
+  AC_SUBST(MZSCHEME_OBJ)
+  AC_SUBST(MZSCHEME_PRO)
+  AC_SUBST(MZSCHEME_LIBS)
+  AC_SUBST(MZSCHEME_CFLAGS)
+fi
+
+
 AC_MSG_CHECKING(--enable-perlinterp argument)
 AC_ARG_ENABLE(perlinterp,
 	[  --enable-perlinterp     Include Perl interpreter.], ,
@@ -1187,18 +1271,18 @@ AC_ARG_WITH(qt-dir,
 						 ])
 
 if test "x$ROOTQT" = "x"; then
-	if test -z "$QTDIR"; then
-	    dnl Find the Qt directory by looking for the "moc" program.
-	    dnl It's better than nothing.
-	    AC_PATH_PROG(MOC, moc, no)
-	    if text"x$MOC" = "x"; then
-		AC_MSG_ERROR(could not find Qt directory)
-	    else
-	      ROOTQT=`echo $MOC | sed 's+/bin/moc++'`
-	    fi
-	else
-		ROOTQT="$QTDIR"
-	fi
+  if test -z "$QTDIR"; then
+    dnl Find the Qt directory by looking for the "moc" program.
+    dnl It's better than nothing.
+    AC_PATH_PROG(MOC, moc, no)
+    if test "x$MOC" = "xno"; then
+      AC_MSG_ERROR(could not find Qt directory)
+    else
+      ROOTQT=`echo $MOC | sed 's+/bin/moc++'`
+    fi
+  else
+    ROOTQT="$QTDIR"
+  fi
 fi
 MOC="$ROOTQT"/bin/moc
 QT_INCLUDES="$ROOTQT"/include
@@ -1238,6 +1322,23 @@ dnl so, first, look up at the kde-config
 dnl ------------------
 
 if test -z "$SKIP_KDE"; then
+AC_DEFUN([AC_FIND_FILE],
+[
+  $3=NO
+  for i in $2;
+    do
+      for j in $1;
+      do
+       echo "configure: __oline__: $i/$j" >&AC_FD_CC
+       if test -r "$i/$j"; then
+         echo "taking that" >&AC_FD_CC
+         $3=$i
+         break 2
+       fi
+      done
+    done
+])
+
 AC_DEFUN(AM_PATH_KDE,
 [
 	if test "X$KDE_CONFIG" != "X"; then
@@ -1247,7 +1348,7 @@ AC_DEFUN(AM_PATH_KDE,
 	  if test "$KDE_CONFIG" = "no" ; then
 		no_kde=yes
 	  else
-		KDE_PREFIX=`$KDE_CONFIG $kde_config_args --prefix`
+		KDE_PREFIX=`$KDE_CONFIG --prefix`
 		if test "x$KDE_LIBS" = "x"; then
 		  KDE_LIBS="$KDE_PREFIX/lib"
 		fi
@@ -1261,12 +1362,12 @@ AC_DEFUN(AM_PATH_KDE,
 sed 's/KDE:\ //' | sed 's/\([[0-9]]*\).\([[0-9]]*.*\)/\1/'`
 		kde_minor_version=`$KDE_CONFIG --version | grep KDE | \
 sed 's/KDE:\ //' | sed 's/\([[0-9]]*\).\([[0-9]]*.*\)/\2/'`
-	
+
 		qt_major_version=`$KDE_CONFIG --version | grep Qt | sed -e \
 's/Qt:\ //' | sed 's/\([[0-9]]*\).\([[0-9]]*.*\)/\1/'`
 		qt_minor_version=`$KDE_CONFIG --version | grep Qt | sed -e \
 's/Qt:\ //' | sed 's/\([[0-9]]*\).\([[0-9]]*.*\)/\2/'`
-	
+
 		dnl maybe in a near future we'll get these ones : QT_PREFIX, QT_LIBS,
 		dnl QT_INCLUDES
 		dnl but for now we need configure options to get them ...
@@ -1297,6 +1398,7 @@ else
   KDE_LIBS=""
   ifelse([$3], , :, [$3])
 fi
+
 AC_SUBST(KDE_LIBS)
 AC_SUBST(KDE_INCLUDES)
 AC_SUBST(KDE_PREFIX)
@@ -1339,7 +1441,6 @@ else
 fi
 
 if test "x$kde_config_prefix" != "x" ; then
-	kde_config_args=""
 	KDE_CONFIG=$kde_config_prefix/bin/kde-config
 fi
 
@@ -1391,6 +1492,47 @@ if test "X$KDE_CONFIG" != "X" ; then
 dnl			GUI_LIB_LOC="`echo $GUI_LIB_LOC\ | sed 's% -L/usr/lib%%'`"
 
 			AC_MSG_RESULT(found $qt_major_version.$qt_minor_version in $ROOTQT)
+
+                       dnl now check the results ...
+                       dnl find the Qt's headers ?
+                       AC_FIND_FILE(qstyle.h,$QT_INCLUDES,qt_incdir)
+                       if test "x$qt_incdir" = "xNO"; then
+                               AC_MSG_ERROR(Could not find Qt headers in $QT_INCLUDES)
+                       fi
+                       AC_FIND_FILE(kapplication.h,$KDE_INCLUDES,kde_incdir)
+                       if test "x$kde_incdir" = "xNO"; then
+                               AC_MSG_ERROR(Could not find KDE headers in $KDE_INCLUDES)
+                       fi
+
+                       AC_LANG_SAVE
+                       AC_LANG_CPLUSPLUS
+                       ac_save_LIBS="$LIBS"
+                       LIBS="$GUI_LIB_LOC"
+                       ac_save_CXXFLAGS="$CXXFLAGS"
+                       CXXFLAGS="$CXXFLAGS $GUI_INC_LOC"
+                       AC_MSG_CHECKING(whether Qt libraries are usable)
+                       AC_TRY_LINK(
+                           [#include <qapplication.h>],
+                           [
+                           int argc;
+                           char** argv;
+                           QApplication app(argc, argv);]
+                           ,AC_MSG_RESULT(yes),AC_MSG_RESULT(no);AC_MSG_ERROR(Qt fails to link a simple application, check your installation and settings))
+
+                       AC_MSG_CHECKING(whether KDE libraries are usable)
+                       AC_TRY_LINK(
+                           [#include <kapplication.h>],
+                           [
+                           int argc;
+                           char** argv;
+                           KApplication app(argc, argv);]
+                           ,AC_MSG_RESULT(yes),AC_MSG_RESULT(no);AC_MSG_ERROR(KDE fails to link a simple application, check your installation and settings))
+
+                       LIBS="$ac_save_LIBS"
+                       CXXFLAGS="$ac_save_CXXFLAGS"
+                       AC_LANG_RESTORE
+
+
 			SKIP_GTK=YES
 			SKIP_ATHENA=YES
 			SKIP_MOTIF=YES
@@ -1816,7 +1958,7 @@ if test -z "$SKIP_MOTIF"; then
     gui_libs="`echo $x_libraries|sed 's%/[^/][^/]*$%%'` `echo "$gui_XXX" | sed s/XXX/lib/g` `echo "$GUI_INC_LOC" | sed s/include/lib/` $GUI_LIB_LOC"
     GUI_LIB_LOC=
     for try in $gui_libs; do
-      for libtry in "$try"/libXm.a "$try"/libXm.so* "$try"/libXm.sl; do
+      for libtry in "$try"/libXm.a "$try"/libXm.so* "$try"/libXm.sl "$try"/libXm.dylib; do
 	if test -f "$libtry"; then
 	  GUI_LIB_LOC=$try
 	fi
--- a/src/eval.c
+++ b/src/eval.c
@@ -4987,6 +4987,9 @@ f_has(argvars, retvar)
 #ifdef FEAT_MULTI_LANG
 	"multi_lang",
 #endif
+#ifdef FEAT_MZSCHEME
+	"mzscheme",
+#endif
 #ifdef FEAT_OLE
 	"ole",
 #endif
@@ -9109,6 +9112,8 @@ ex_function(eap)
 				    && (!ASCII_ISALPHA(p[2]) || p[2] == 'l'))
 			|| (p[0] == 'r' && p[1] == 'u' && p[2] == 'b'
 				    && (!ASCII_ISALPHA(p[3]) || p[3] == 'y'))
+			|| (p[0] == 'm' && p[1] == 'z'
+				    && (!ASCII_ISALPHA(p[2]) || p[2] == 's'))
 			))
 	    {
 		/* ":python <<" continues until a dot, like ":append" */
--- a/src/ex_cmds.c
+++ b/src/ex_cmds.c
@@ -1998,7 +1998,18 @@ ex_file(eap)
     char_u	*fname, *sfname, *xfname;
     buf_T	*buf;
 
-    if (*eap->arg != NUL)
+    /* ":0file" removes the file name.  Check for illegal uses ":3file",
+     * "0file name", etc. */
+    if (eap->addr_count > 0
+	    && (*eap->arg != NUL
+		|| eap->line2 > 0
+		|| eap->addr_count > 1))
+    {
+	EMSG(_(e_invarg));
+	return;
+    }
+
+    if (*eap->arg != NUL || eap->addr_count == 1)
     {
 #ifdef FEAT_AUTOCMD
 	buf = curbuf;
--- a/src/ex_cmds.h
+++ b/src/ex_cmds.h
@@ -349,7 +349,7 @@ EX(CMD_execute,		"execute",	ex_execute,
 EX(CMD_exit,		"exit",		ex_exit,
 			RANGE|WHOLEFOLD|BANG|FILE1|ARGOPT|DFLALL|TRLBAR|CMDWIN),
 EX(CMD_file,		"file",		ex_file,
-			BANG|FILE1|TRLBAR),
+			RANGE|NOTADR|ZEROR|BANG|FILE1|TRLBAR),
 EX(CMD_files,		"files",	buflist_list,
 			BANG|TRLBAR|CMDWIN),
 EX(CMD_filetype,	"filetype",	ex_filetype,
@@ -512,6 +512,10 @@ EX(CMD_mkview,		"mkview",	ex_mkrc,
 			BANG|FILE1|TRLBAR),
 EX(CMD_mode,		"mode",		ex_mode,
 			WORD1|TRLBAR|CMDWIN),
+EX(CMD_mzscheme,	"mzscheme",	ex_mzscheme,
+			RANGE|EXTRA|DFLALL|NEEDARG|CMDWIN),
+EX(CMD_mzfile,		"mzfile",	ex_mzfile,
+			RANGE|FILE1|NEEDARG|CMDWIN),
 EX(CMD_next,		"next",		ex_next,
 			RANGE|NOTADR|BANG|FILES|EDITCMD|ARGOPT|TRLBAR),
 EX(CMD_new,		"new",		ex_splitview,
@@ -736,6 +740,8 @@ EX(CMD_stag,		"stag",		ex_stag,
 			RANGE|NOTADR|BANG|WORD1|TRLBAR|ZEROR),
 EX(CMD_startinsert,	"startinsert",	ex_startinsert,
 			BANG|TRLBAR|CMDWIN),
+EX(CMD_startreplace,	"startreplace",	ex_startinsert,
+			BANG|TRLBAR|CMDWIN),
 EX(CMD_stopinsert,	"stopinsert",	ex_stopinsert,
 			BANG|TRLBAR|CMDWIN),
 EX(CMD_stjump,		"stjump",	ex_stag,
--- a/src/ex_cmds2.c
+++ b/src/ex_cmds2.c
@@ -3811,8 +3811,9 @@ struct prt_ps_resource_S
  *
  * VIM      Prolog
  * 6.2      1.3
+ * 7.0      1.4
  */
-#define PRT_PROLOG_VERSION  ((char_u *)"1.3")
+#define PRT_PROLOG_VERSION  ((char_u *)"1.4")
 
 /* String versions of PS resource types - indexed by constants above so don't
  * re-order!
@@ -5116,6 +5117,10 @@ mch_print_end(psettings)
 
     prt_dsc_noarg("EOF");
 
+    /* Write CTRL-D to close serial communication link if used.
+     * NOTHING MUST BE WRITTEN AFTER THIS! */
+    prt_write_file(IF_EB("\004", "\067"));
+
     if (!prt_file_error && psettings->outfile == NULL
 					&& !got_int && !psettings->user_abort)
     {
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -128,7 +128,7 @@ static int	getargopt __ARGS((exarg_T *ea
 static int	check_more __ARGS((int, int));
 static linenr_T get_address __ARGS((char_u **, int skip, int to_other_file));
 #if !defined(FEAT_PERL) || !defined(FEAT_PYTHON) || !defined(FEAT_TCL) \
-	|| !defined(FEAT_RUBY)
+	|| !defined(FEAT_RUBY) || !defined(FEAT_MZSCHEME)
 static void	ex_script_ni __ARGS((exarg_T *eap));
 #endif
 static char_u	*invalid_range __ARGS((exarg_T *eap));
@@ -220,6 +220,10 @@ static void	ex_popup __ARGS((exarg_T *ea
 #ifndef FEAT_SYN_HL
 # define ex_syntax		ex_ni
 #endif
+#ifndef FEAT_MZSCHEME
+# define ex_mzscheme		ex_script_ni
+# define ex_mzfile		ex_ni
+#endif
 #ifndef FEAT_PERL
 # define ex_perl		ex_script_ni
 # define ex_perldo		ex_ni
@@ -2389,6 +2393,7 @@ do_one_cmd(cmdlinep, sourcing,
 	    case CMD_let:
 	    case CMD_lockmarks:
 	    case CMD_match:
+	    case CMD_mzscheme:
 	    case CMD_perl:
 	    case CMD_psearch:
 	    case CMD_python:
@@ -3807,7 +3812,7 @@ ex_ni(eap)
 }
 
 #if !defined(FEAT_PERL) || !defined(FEAT_PYTHON) || !defined(FEAT_TCL) \
-	|| !defined(FEAT_RUBY)
+	|| !defined(FEAT_RUBY) || !defined(FEAT_MZSCHEME)
 /*
  * Function called for script command which is Not Implemented.  NI!
  * Skips over ":perl <<EOF" constructs.
@@ -7980,7 +7985,7 @@ ex_normal(eap)
 }
 
 /*
- * ":startinsert"
+ * ":startinsert" and ":startreplace"
  */
     static void
 ex_startinsert(eap)
@@ -7991,11 +7996,17 @@ ex_startinsert(eap)
 	coladvance((colnr_T)MAXCOL);
 	curwin->w_curswant = MAXCOL;
 	curwin->w_set_curswant = FALSE;
-	restart_edit = 'a';
+	if (eap->cmdidx == CMD_startinsert)
+	    restart_edit = 'a';
+	else
+	    restart_edit = 'R';
     }
     else
     {
-	restart_edit = 'i';
+	if (eap->cmdidx == CMD_startinsert)
+	    restart_edit = 'i';
+	else
+	    restart_edit = 'R';
 	curwin->w_curswant = 0;	    /* avoid MAXCOL */
     }
 }
--- a/src/feature.h
+++ b/src/feature.h
@@ -1101,6 +1101,7 @@
 /*
  * These features can only be included by using a configure argument.  See the
  * Makefile for a line to uncomment.
+ * +mzscheme		MzScheme interface: "--enable-mzscheme"
  * +perl		Perl interface: "--enable-perlinterp"
  * +python		Python interface: "--enable-pythoninterp"
  * +tcl			TCL interface: "--enable-tclinterp"
new file mode 100644
--- /dev/null
+++ b/src/if_mzsch.c
@@ -0,0 +1,2244 @@
+/* vi:set ts=8 sts=4 sw=4:
+ *
+ * MzScheme interface by Sergey Khorev <khorev@softlab.ru>
+ * Original work by Brent Fulgham <bfulgham@debian.org>
+ * (Based on lots of help from Matthew Flatt)
+ *
+ * This consists of six parts:
+ * 1. MzScheme interpreter main program
+ * 2. Routines that handle the external interface between MzScheme and
+ *    Vim.
+ * 3. MzScheme input/output handlers: writes output via [e]msg().
+ * 4. Implementation of the Vim Features for MzScheme
+ * 5. Vim Window-related Manipulation Functions.
+ * 6. Vim Buffer-related Manipulation Functions
+ *
+ * NOTES
+ * 1. Memory, allocated with scheme_malloc*, need not to be freed explicitly,
+ *    garbage collector will do it self
+ * 2. Requires at least NORMAL features. I can't imagine why one may want
+ *    to build with SMALL or TINY features but with MzScheme interface.
+ * 3. I don't use K&R-style functions. Anyway, MzScheme headers are ANSI.
+ */
+
+/* TODO
+ * way to catch Vim errors (incl. verbose messages)
+ * libmzscheme.dll dynamic loading
+ * macros to pass modifiers (e.g. (browse edit))
+ * opportunity to use shared mzscheme libraries on Unix
+ * event on-change-mode
+ * Scheme-driven coloring
+ * global exn-handler
+ * embed Read-Eval-Print-Loop
+ */
+
+#include "vim.h"
+#include "if_mzsch.h"
+
+/* Base data structures */
+#define SCHEME_VIMBUFFERP(obj)  SAME_TYPE(SCHEME_TYPE(obj), mz_buffer_type)
+#define SCHEME_VIMWINDOWP(obj)  SAME_TYPE(SCHEME_TYPE(obj), mz_window_type)
+
+typedef struct
+{
+    Scheme_Type	    tag;
+    Scheme_Env	    *env;
+    buf_T	    *buf;
+    Scheme_Object   *text_objects;
+} vim_mz_buffer;
+
+#define INVALID_BUFFER_VALUE ((buf_T *)(-1))
+
+typedef struct
+{
+    Scheme_Type	    tag;
+    struct window   *win;
+} vim_mz_window;
+
+#define INVALID_WINDOW_VALUE ((win_T *)(-1))
+
+/*
+ * Prims that form MzScheme Vim interface
+ */
+typedef struct
+{
+    Scheme_Closed_Prim	*prim;
+    char	*name;
+    int		mina;	/* arity information */
+    int		maxa;
+} Vim_Prim;
+
+typedef struct
+{
+    char	    *name;
+    Scheme_Object   *port;
+} Port_Info;
+
+/* info for closed prim */
+/*
+ * data have different means:
+ * for do_eval it is char*
+ * for do_apply is Apply_Onfo*
+ * for do_load is Port_Info*
+ */
+typedef struct
+{
+    void	*data;
+    Scheme_Env	*env;
+} Cmd_Info;
+
+/* info for do_apply */
+typedef struct
+{
+    Scheme_Object   *proc;
+    int		    argc;
+    Scheme_Object   **argv;
+} Apply_Info;
+
+/*
+ *========================================================================
+ *  Vim-Control Commands
+ *========================================================================
+ */
+/*
+ *========================================================================
+ *  Utility functions for the vim/mzscheme interface
+ *========================================================================
+ */
+/*  Buffer-related commands */
+static Scheme_Object *buffer_new(buf_T *buf);
+static Scheme_Object *get_buffer_by_name(void *, int, Scheme_Object **);
+static Scheme_Object *get_buffer_by_num(void *, int, Scheme_Object **);
+static Scheme_Object *get_buffer_count(void *, int, Scheme_Object **);
+static Scheme_Object *get_buffer_line(void *, int, Scheme_Object **);
+static Scheme_Object *get_buffer_line_list(void *, int, Scheme_Object **);
+static Scheme_Object *get_buffer_name(void *, int, Scheme_Object **);
+static Scheme_Object *get_buffer_num(void *, int, Scheme_Object **);
+static Scheme_Object *get_buffer_size(void *, int, Scheme_Object **);
+static Scheme_Object *get_curr_buffer(void *, int, Scheme_Object **);
+static Scheme_Object *get_next_buffer(void *, int, Scheme_Object **);
+static Scheme_Object *get_prev_buffer(void *, int, Scheme_Object **);
+static Scheme_Object *mzscheme_open_buffer(void *, int, Scheme_Object **);
+static Scheme_Object *set_buffer_line(void *, int, Scheme_Object **);
+static Scheme_Object *set_buffer_line_list(void *, int, Scheme_Object **);
+static Scheme_Object *insert_buffer_line_list(void *, int, Scheme_Object **);
+static Scheme_Object *get_range_start(void *, int, Scheme_Object **);
+static Scheme_Object *get_range_end(void *, int, Scheme_Object **);
+static Scheme_Object *get_buffer_namespace(void *, int, Scheme_Object **);
+static vim_mz_buffer *get_vim_curr_buffer(void);
+
+/*  Window-related commands */
+static Scheme_Object *window_new(win_T *win);
+static Scheme_Object *get_curr_win(void *, int, Scheme_Object **);
+static Scheme_Object *get_window_count(void *, int, Scheme_Object **);
+static Scheme_Object *get_window_by_num(void *, int, Scheme_Object **);
+static Scheme_Object *get_window_num(void *, int, Scheme_Object **);
+static Scheme_Object *get_window_buffer(void *, int, Scheme_Object **);
+static Scheme_Object *get_window_height(void *, int, Scheme_Object **);
+static Scheme_Object *set_window_height(void *, int, Scheme_Object **);
+#ifdef FEAT_VERTSPLIT
+static Scheme_Object *get_window_width(void *, int, Scheme_Object **);
+static Scheme_Object *set_window_width(void *, int, Scheme_Object **);
+#endif
+static Scheme_Object *get_cursor(void *, int, Scheme_Object **);
+static Scheme_Object *set_cursor(void *, int, Scheme_Object **);
+static Scheme_Object *get_window_list(void *, int, Scheme_Object **);
+static vim_mz_window *get_vim_curr_window(void);
+
+/*  Vim-related commands */
+static Scheme_Object *mzscheme_beep(void *, int, Scheme_Object **);
+static Scheme_Object *get_option(void *, int, Scheme_Object **);
+static Scheme_Object *set_option(void *, int, Scheme_Object **);
+static Scheme_Object *vim_command(void *, int, Scheme_Object **);
+static Scheme_Object *vim_eval(void *, int, Scheme_Object **);
+static Scheme_Object *vim_bufferp(void *data, int, Scheme_Object **);
+static Scheme_Object *vim_windowp(void *data, int, Scheme_Object **);
+static Scheme_Object *vim_buffer_validp(void *data, int, Scheme_Object **);
+static Scheme_Object *vim_window_validp(void *data, int, Scheme_Object **);
+
+/*
+ *========================================================================
+ *  Internal Function Prototypes
+ *========================================================================
+ */
+static int vim_error_check(void);
+static int do_mzscheme_command(exarg_T *, void *, Scheme_Closed_Prim *what);
+static void startup_mzscheme(void);
+static char *string_to_line(Scheme_Object *obj);
+static int mzscheme_io_init(void);
+static void mzscheme_interface_init(vim_mz_buffer *self);
+static void do_output(char *mesg, long len);
+static void do_printf(char *format, ...);
+static void do_flush(void);
+static Scheme_Object *_apply_thunk_catch_exceptions(
+	Scheme_Object *, Scheme_Object **);
+static Scheme_Object *extract_exn_message(Scheme_Object *v);
+static Scheme_Object *do_eval(void *, int noargc, Scheme_Object **noargv);
+static Scheme_Object *do_load(void *, int noargc, Scheme_Object **noargv);
+static Scheme_Object *do_apply(void *, int noargc, Scheme_Object **noargv);
+static void register_vim_exn(Scheme_Env *env);
+static vim_mz_buffer *get_buffer_arg(const char *fname, int argnum,
+	int argc, Scheme_Object **argv);
+static vim_mz_window *get_window_arg(const char *fname, int argnum,
+	int argc, Scheme_Object **argv);
+static void add_vim_exn(Scheme_Env *env);
+static int line_in_range(linenr_T, buf_T *);
+static void check_line_range(linenr_T, buf_T *);
+static void mz_fix_cursor(int lo, int hi, int extra);
+
+static int eval_in_namespace(void *, Scheme_Closed_Prim *, Scheme_Env *,
+		Scheme_Object **ret);
+static void make_modules(Scheme_Env *);
+
+/*
+ *========================================================================
+ *  1. MzScheme interpreter startup
+ *========================================================================
+ */
+
+static Scheme_Type mz_buffer_type;
+static Scheme_Type mz_window_type;
+
+static int initialized = 0;
+
+/* global environment */
+static Scheme_Env    *environment = NULL;
+/* output/error handlers */
+static Scheme_Object *curout = NULL;
+static Scheme_Object *curerr = NULL;
+/* vim:exn exception */
+static Scheme_Object *exn_catching_apply = NULL;
+static Scheme_Object *exn_p = NULL;
+static Scheme_Object *exn_message = NULL;
+static Scheme_Object *vim_exn = NULL; /* Vim Error exception */
+ /* values for exn:vim - constructor, predicate, accessors etc */
+static Scheme_Object *vim_exn_names = NULL;
+static Scheme_Object *vim_exn_values = NULL;
+
+static long range_start;
+static long range_end;
+
+/* MzScheme threads scheduling stuff */
+static int mz_threads_allow = 0;
+#ifdef FEAT_GUI
+static void setup_timer(void);
+static void remove_timer(void);
+#endif
+
+#if defined(FEAT_GUI_W32)
+static void CALLBACK timer_proc(HWND, UINT, UINT, DWORD);
+static UINT timer_id = 0;
+#elif defined(FEAT_GUI_GTK)
+static gint timer_proc(gpointer);
+static guint timer_id = 0;
+#elif defined(FEAT_GUI_MOTIF) || defined(FEAT_GUI_ATHENA)
+static void timer_proc(XtPointer, XtIntervalId *);
+static XtIntervalId timer_id = (XtIntervalId)0;
+#elif defined(FEAT_GUI_MAC)
+pascal void timer_proc(EventLoopTimerRef, void *);
+static EventLoopTimerRef timer_id = NULL;
+static EventLoopTimerUPP timerUPP;
+#endif
+
+#ifndef FEAT_GUI_W32 /* Win32 console and Unix */
+    void
+mzvim_check_threads(void)
+{
+    /* Last time MzScheme threads were scheduled */
+    static time_t mz_last_time = 0;
+
+    if (mz_threads_allow && p_mzq > 0)
+    {
+	time_t now = time(NULL);
+
+	if ((now - mz_last_time) * 1000 > p_mzq)
+	{
+	    mz_last_time = now;
+	    scheme_check_threads();
+	}
+    }
+}
+#endif
+
+#ifdef FEAT_GUI
+/* timers are presented in GUI only */
+# if defined(FEAT_GUI_W32)
+    static void CALLBACK
+timer_proc(HWND hwnd, UINT uMsg, UINT idEvent, DWORD dwTime)
+# elif defined(FEAT_GUI_GTK)
+/*ARGSUSED*/
+    static gint
+timer_proc(gpointer data)
+# elif defined(FEAT_GUI_MOTIF) || defined(FEAT_GUI_ATHENA)
+/* ARGSUSED */
+    static void
+timer_proc(XtPointer timed_out, XtIntervalId *interval_id)
+# elif defined(FEAT_GUI_MAC)
+    pascal void
+timer_proc(EventLoopTimerRef theTimer, void *userData)
+# endif
+{
+    scheme_check_threads();
+# if defined(FEAT_GUI_GTK)
+    return TRUE; /* continue receiving notifications */
+# elif defined(FEAT_GUI_MOTIF) || defined(FEAT_GUI_ATHENA)
+    /* renew timeout */
+    if (mz_threads_allow && p_mzq > 0)
+	timer_id = XtAppAddTimeOut(app_context, p_mzq,
+		timer_proc, NULL);
+# endif
+}
+
+    static void
+setup_timer(void)
+{
+# if defined(FEAT_GUI_W32)
+    timer_id = SetTimer(NULL, 0, p_mzq, timer_proc);
+# elif defined(FEAT_GUI_GTK)
+    timer_id = gtk_timeout_add((guint32)p_mzq, (GtkFunction)timer_proc, NULL);
+# elif defined(FEAT_GUI_MOTIF) || defined(FEAT_GUI_ATHENA)
+    timer_id = XtAppAddTimeOut(app_context, p_mzq, timer_proc, NULL);
+# elif defined(FEAT_GUI_MAC)
+    timerUPP = NewEventLoopTimerUPP(timer_proc);
+    InstallEventLoopTimer(GetMainEventLoop(), p_mzq * kEventDurationMillisecond,
+		p_mzq * kEventDurationMillisecond, timerUPP, NULL, &timer_id);
+# endif
+}
+
+    static void
+remove_timer(void)
+{
+# if defined(FEAT_GUI_W32)
+    KillTimer(NULL, timer_id);
+# elif defined(FEAT_GUI_GTK)
+    gtk_timeout_remove(timer_id);
+# elif defined(FEAT_GUI_MOTIF) || defined(FEAT_GUI_ATHENA)
+    XtRemoveTimeOut(timer_id);
+# elif defined(FEAT_GUI_MAC)
+    RemoveEventLoopTimer(timer_id);
+    DisposeEventLoopTimerUPP(timerUPP);
+# endif
+    timer_id = 0;
+}
+
+    void
+mzvim_reset_timer(void)
+{
+    if (timer_id != 0)
+	remove_timer();
+    if (mz_threads_allow && p_mzq > 0 && gui.in_use)
+	setup_timer();
+}
+
+#endif
+
+    static void
+notify_multithread(int on)
+{
+    mz_threads_allow = on;
+#ifdef FEAT_GUI
+    if (on && timer_id == 0 && p_mzq > 0 && gui.in_use)
+	setup_timer();
+    if (!on && timer_id != 0)
+	remove_timer();
+#endif
+}
+
+    int
+mzscheme_enabled(int verbose)
+{
+    return initialized;
+}
+
+    void
+mzscheme_end(void)
+{
+}
+
+    static void
+startup_mzscheme(void)
+{
+    scheme_set_stack_base(NULL, 1);
+
+    MZ_REGISTER_STATIC(environment);
+    MZ_REGISTER_STATIC(curout);
+    MZ_REGISTER_STATIC(curerr);
+    MZ_REGISTER_STATIC(exn_catching_apply);
+    MZ_REGISTER_STATIC(exn_p);
+    MZ_REGISTER_STATIC(exn_message);
+    MZ_REGISTER_STATIC(vim_exn);
+    MZ_REGISTER_STATIC(vim_exn_names);
+    MZ_REGISTER_STATIC(vim_exn_values);
+
+    environment = scheme_basic_env();
+
+    /* redirect output */
+    scheme_console_output = do_output;
+    scheme_console_printf = do_printf;
+
+#ifdef MZSCHEME_COLLECTS
+    /* setup 'current-library-collection-paths' parameter */
+    scheme_set_param(scheme_config, MZCONFIG_COLLECTION_PATHS,
+	    scheme_make_pair(scheme_make_string(MZSCHEME_COLLECTS),
+		scheme_null));
+#endif
+
+    /* Create buffer and window types for use in Scheme code */
+    mz_buffer_type = scheme_make_type("<vim-buffer>");
+    mz_window_type = scheme_make_type("<vim-window>");
+
+    register_vim_exn(environment);
+    make_modules(environment);
+
+    /*
+     * setup callback to receive notifications
+     * whether thread scheduling is (or not) required
+     */
+    scheme_notify_multithread = notify_multithread;
+    initialized = 1;
+}
+
+/*
+ * This routine is called for each new invocation of MzScheme
+ * to make sure things are properly initialized.
+ */
+    static int
+mzscheme_init(void)
+{
+    int do_require = FALSE;
+
+    if (!initialized)
+    {
+	do_require = TRUE;
+        startup_mzscheme();
+
+	if (mzscheme_io_init())
+	    return -1;
+
+    }
+    /* recreate ports each call effectivelly clearing these ones */
+    curout = scheme_make_string_output_port();
+    curerr = scheme_make_string_output_port();
+    scheme_set_param(scheme_config, MZCONFIG_OUTPUT_PORT, curout);
+    scheme_set_param(scheme_config, MZCONFIG_ERROR_PORT, curerr);
+
+    if (do_require)
+    {
+	/* auto-instantiate in basic env */
+	eval_in_namespace("(require (prefix vimext: vimext))", do_eval,
+		environment, NULL);
+    }
+
+    return 0;
+}
+
+/*
+ * This routine fills the namespace with various important routines that can
+ * be used within MzScheme.
+ */
+    static void
+mzscheme_interface_init(vim_mz_buffer *mzbuff)
+{
+    Scheme_Object   *attach;
+
+    mzbuff->env = (Scheme_Env *)scheme_make_namespace(0, NULL);
+
+    /*
+     * attach instantiated modules from global namespace
+     * so they can be easily instantiated in the buffer namespace
+     */
+    attach = scheme_lookup_global(
+	    scheme_intern_symbol("namespace-attach-module"),
+	    environment);
+
+    if (attach != NULL)
+    {
+	Scheme_Object   *ret;
+	Scheme_Object	*args[2];
+
+	args[0] = (Scheme_Object *)environment;
+	args[1] = scheme_intern_symbol("vimext");
+
+	ret = (Scheme_Object *)mzvim_apply(attach, 2, args);
+    }
+
+    add_vim_exn(mzbuff->env);
+}
+
+/*
+ *========================================================================
+ *  2.  External Interface
+ *========================================================================
+ */
+
+/*
+ * Evaluate command in namespace with exception handling
+ */
+    static int
+eval_in_namespace(void *data, Scheme_Closed_Prim *what, Scheme_Env *env,
+		Scheme_Object **ret)
+{
+    Scheme_Object   *value;
+    Scheme_Object   *exn;
+    Cmd_Info	    info;   /* closure info */
+
+    info.data = data;
+    info.env = env;
+
+    scheme_set_param(scheme_config, MZCONFIG_ENV,
+	    (Scheme_Object *) env);
+    /*
+     * ensure all evaluations will be in current buffer namespace,
+     * the second argument to scheme_eval_string isn't enough!
+     */
+    value = _apply_thunk_catch_exceptions(
+	    scheme_make_closed_prim_w_arity(what, &info, "mzvim", 0, 0),
+	    &exn);
+
+    if (!value)
+    {
+	value = extract_exn_message(exn);
+        /* Got an exn? */
+	if (value)
+	{
+	    scheme_display(value, curerr);  /*  Send to stderr-vim */
+	    do_flush();
+	}
+	/* `raise' was called on some arbitrary value */
+	return FAIL;
+    }
+
+    if (ret != NULL)	/* if pointer to retval supported give it up */
+	*ret = value;
+    /* Print any result, as long as it's not a void */
+    else if (!SCHEME_VOIDP(value))
+	scheme_display(value, curout);  /* Send to stdout-vim */
+
+    do_flush();
+    return OK;
+}
+
+/* :mzscheme */
+    static int
+do_mzscheme_command(exarg_T *eap, void *data, Scheme_Closed_Prim *what)
+{
+    if (mzscheme_init())
+	return FAIL;
+
+    range_start = eap->line1;
+    range_end = eap->line2;
+
+    return eval_in_namespace(data, what, get_vim_curr_buffer()->env, NULL);
+}
+
+/*
+ * Routine called by VIM when deleting a buffer
+ */
+    void
+mzscheme_buffer_free(buf_T *buf)
+{
+    if (buf->mzscheme_ref)
+    {
+        vim_mz_buffer *bp;
+	bp = buf->mzscheme_ref;
+	bp->buf = INVALID_BUFFER_VALUE;
+	buf->mzscheme_ref = NULL;
+	scheme_gc_ptr_ok(bp);
+    }
+}
+
+/*
+ * Routine called by VIM when deleting a Window
+ */
+    void
+mzscheme_window_free(win_T *win)
+{
+    if (win->mzscheme_ref)
+    {
+	vim_mz_window *wp;
+	wp = win->mzscheme_ref;
+	wp->win = INVALID_WINDOW_VALUE;
+	win->mzscheme_ref = NULL;
+	scheme_gc_ptr_ok(wp);
+    }
+}
+
+/*
+ * ":mzscheme" (or ":mz")
+ */
+    void
+ex_mzscheme(exarg_T *eap)
+{
+    char_u	*script;
+
+    script = script_get(eap, eap->arg);
+    if (!eap->skip)
+    {
+	if (script == NULL)
+	    do_mzscheme_command(eap, eap->arg, do_eval);
+	else
+	{
+	    do_mzscheme_command(eap, script, do_eval);
+	    vim_free(script);
+	}
+    }
+}
+
+/* eval MzScheme string */
+    void *
+mzvim_eval_string(char_u *str)
+{
+    Scheme_Object *ret = NULL;
+    if (mzscheme_init())
+	return FAIL;
+
+    eval_in_namespace(str, do_eval, get_vim_curr_buffer()->env, &ret);
+    return ret;
+}
+
+/*
+ * apply MzScheme procedure with arguments,
+ * handling errors
+ */
+    Scheme_Object *
+mzvim_apply(Scheme_Object *proc, int argc, Scheme_Object **argv)
+{
+    Apply_Info	data;
+    Scheme_Object *ret = NULL;
+
+    if (mzscheme_init())
+	return FAIL;
+
+    data.proc = proc;
+    data.argc = argc;
+    data.argv = argv;
+
+    eval_in_namespace(&data, do_apply, get_vim_curr_buffer()->env, &ret);
+    return ret;
+}
+
+    static Scheme_Object *
+do_load(void *data, int noargc, Scheme_Object **noargv)
+{
+    Cmd_Info	    *info = (Cmd_Info *)data;
+    Scheme_Object   *result = scheme_void;
+    Scheme_Object   *expr;
+    char_u	    *file = scheme_malloc_fail_ok(
+					  scheme_malloc_atomic, MAXPATHL + 1);
+    Port_Info	    *pinfo = (Port_Info *)(info->data);
+
+    /* make Vim expansion */
+    expand_env((char_u *)pinfo->name, file, MAXPATHL);
+    /* scheme_load looks strange working with namespaces and error handling*/
+    pinfo->port = scheme_open_input_file(file, "mzfile");
+    scheme_count_lines(pinfo->port); /* to get accurate read error location*/
+
+    /* Like REPL but print only last result */
+    while (!SCHEME_EOFP(expr = scheme_read(pinfo->port)))
+	result = scheme_eval(expr, info->env);
+
+    /* errors will be caught in do_mzscheme_comamnd and ex_mzfile */
+    scheme_close_input_port(pinfo->port);
+    pinfo->port = NULL;
+    return result;
+}
+
+/* :mzfile */
+    void
+ex_mzfile(exarg_T *eap)
+{
+    Port_Info	pinfo;
+
+    pinfo.name = (char *)eap->arg;
+    pinfo.port = NULL;
+    if (do_mzscheme_command(eap, &pinfo, do_load) != OK
+	    && pinfo.port != NULL)	/* looks like port was not closed */
+	scheme_close_input_port(pinfo.port);
+}
+
+
+/*
+ *========================================================================
+ * Exception handling code -- cribbed form the MzScheme sources and
+ * Matthew Flatt's "Inside PLT MzScheme" document.
+ *========================================================================
+ */
+    static void
+init_exn_catching_apply(void)
+{
+    if (!exn_catching_apply)
+    {
+	char *e =
+	    "(lambda (thunk) "
+	        "(with-handlers ([void (lambda (exn) (cons #f exn))]) "
+		"(cons #t (thunk))))";
+
+        /* make sure we have a namespace with the standard syntax: */
+	Scheme_Env *env = (Scheme_Env *)scheme_make_namespace(0, NULL);
+	add_vim_exn(env);
+
+        exn_catching_apply = scheme_eval_string(e, env);
+	exn_p = scheme_lookup_global(scheme_intern_symbol("exn?"), env);
+        exn_message = scheme_lookup_global(
+		scheme_intern_symbol("exn-message"), env);
+    }
+}
+
+/*
+ * This function applies a thunk, returning the Scheme value if there's
+ * no exception, otherwise returning NULL and setting *exn to the raised
+ * value (usually an exn structure).
+ */
+    static Scheme_Object *
+_apply_thunk_catch_exceptions(Scheme_Object *f, Scheme_Object **exn)
+{
+    Scheme_Object *v;
+
+    init_exn_catching_apply();
+
+    v = _scheme_apply(exn_catching_apply, 1, &f);
+    /* v is a pair: (cons #t value) or (cons #f exn) */
+
+    if (SCHEME_TRUEP(SCHEME_CAR(v)))
+	return SCHEME_CDR(v);
+    else
+    {
+	*exn = SCHEME_CDR(v);
+	return NULL;
+    }
+}
+
+    static Scheme_Object *
+extract_exn_message(Scheme_Object *v)
+{
+    init_exn_catching_apply();
+
+    if (SCHEME_TRUEP(_scheme_apply(exn_p, 1, &v)))
+	return _scheme_apply(exn_message, 1, &v);
+    else
+	return NULL; /* Not an exn structure */
+}
+
+    static Scheme_Object *
+do_eval(void *s, int noargc, Scheme_Object **noargv)
+{
+    Cmd_Info	*info = (Cmd_Info *)s;
+
+    return scheme_eval_string_all((char *)(info->data), info->env, TRUE);
+}
+
+    static Scheme_Object *
+do_apply(void *a, int noargc, Scheme_Object **noargv)
+{
+    Apply_Info	*info = (Apply_Info *)(((Cmd_Info *)a)->data);
+
+    return scheme_apply(info->proc, info->argc, info->argv);
+}
+
+/*
+ *========================================================================
+ *  3.  MzScheme I/O Handlers
+ *========================================================================
+ */
+    static void
+do_intrnl_output(char *mesg, long len, int error)
+{
+    char *p, *prev;
+
+    prev = mesg;
+    p = strchr(prev, '\n');
+    while (p)
+    {
+	*p = '\0';
+	if (error)
+	    EMSG(prev);
+	else
+	    MSG(prev);
+	prev = p + 1;
+	p = strchr(prev, '\n');
+    }
+
+    if (error)
+	EMSG(prev);
+    else
+	MSG(prev);
+}
+
+    static void
+do_output(char *mesg, long len)
+{
+    do_intrnl_output(mesg, len, 0);
+}
+
+    static void
+do_err_output(char *mesg, long len)
+{
+    do_intrnl_output(mesg, len, 1);
+}
+
+    static void
+do_printf(char *format, ...)
+{
+    do_intrnl_output(format, STRLEN(format), 1);
+}
+
+    static void
+do_flush(void)
+{
+    char *buff;
+    long length;
+
+    buff = scheme_get_sized_string_output(curerr, &length);
+    if (length)
+    {
+	do_err_output(buff, length);
+	return;
+    }
+
+    buff = scheme_get_sized_string_output(curout, &length);
+    if (length)
+	do_output(buff, length);
+}
+
+    static int
+mzscheme_io_init(void)
+{
+    /* Nothing needed so far... */
+    return 0;
+}
+
+/*
+ *========================================================================
+ *  4. Implementation of the Vim Features for MzScheme
+ *========================================================================
+ */
+
+/* (command {command-string}) */
+    static Scheme_Object *
+vim_command(void *data, int argc, Scheme_Object **argv)
+{
+    Vim_Prim	*prim = (Vim_Prim *)data;
+    char	*cmd = SCHEME_STR_VAL(GUARANTEE_STRING(prim->name, 0));
+
+    /* may be use do_cmdline_cmd? */
+    do_cmdline((char_u *)cmd, NULL, NULL, DOCMD_NOWAIT|DOCMD_VERBOSE);
+    update_screen(VALID);
+
+    raise_if_error();
+    return scheme_void;
+}
+
+/* (eval {expr-string}) */
+    static Scheme_Object *
+vim_eval(void *data, int argc, Scheme_Object **argv)
+{
+#ifdef FEAT_EVAL
+    Vim_Prim	    *prim = (Vim_Prim *)data;
+    char	    *expr;
+    char	    *str;
+    Scheme_Object   *result;
+
+    expr = SCHEME_STR_VAL(GUARANTEE_STRING(prim->name, 0));
+
+    str = (char *)eval_to_string((char_u *)expr, NULL);
+
+    if (str == NULL)
+	raise_vim_exn(_("invalid expression"));
+
+    result = scheme_make_string(str);
+
+    vim_free(str);
+
+    return result;
+#else
+    raise_vim_exn(_("expressions disabled at compile time"));
+    /* unreachable */
+    return scheme_false;
+#endif
+}
+
+/* (range-start) */
+    static Scheme_Object *
+get_range_start(void *data, int argc, Scheme_Object **argv)
+{
+    return scheme_make_integer(range_start);
+}
+
+/* (range-end) */
+    static Scheme_Object *
+get_range_end(void *data, int argc, Scheme_Object **argv)
+{
+    return scheme_make_integer(range_end);
+}
+
+/* (beep) */
+    static Scheme_Object *
+mzscheme_beep(void *data, int argc, Scheme_Object **argv)
+{
+    vim_beep();
+    return scheme_void;
+}
+
+static Scheme_Object *M_global = NULL;
+
+/* (get-option {option-name}) [buffer/window] */
+    static Scheme_Object *
+get_option(void *data, int argc, Scheme_Object **argv)
+{
+    Vim_Prim	    *prim = (Vim_Prim *)data;
+    char_u	    *name;
+    long	    value;
+    char_u	    *strval;
+    int		    rc;
+    Scheme_Object   *rval;
+    int		    opt_flags = 0;
+    buf_T	    *save_curb = curbuf;
+    win_T	    *save_curw = curwin;
+
+    name = (char_u *)SCHEME_STR_VAL(GUARANTEE_STRING(prim->name, 0));
+
+    if (argc > 1)
+    {
+	if (M_global == NULL)
+	{
+	    MZ_REGISTER_STATIC(M_global);
+	    M_global = scheme_intern_symbol("global");
+	}
+
+	if (argv[1] == M_global)
+	    opt_flags = OPT_GLOBAL;
+	else if (SCHEME_VIMBUFFERP(argv[1]))
+	{
+	    curbuf = get_valid_buffer(argv[1]);
+	    opt_flags = OPT_LOCAL;
+	}
+	else if (SCHEME_VIMWINDOWP(argv[1]))
+	{
+	    win_T *win = get_valid_window(argv[1]);
+
+	    curwin = win;
+	    curbuf = win->w_buffer;
+	    opt_flags = OPT_LOCAL;
+	}
+	else
+	    scheme_wrong_type(prim->name, "vim-buffer/window", 1, argc, argv);
+    }
+
+    rc = get_option_value(name, &value, &strval, opt_flags);
+    curbuf = save_curb;
+    curwin = save_curw;
+
+    switch (rc)
+    {
+    case 1:
+	return scheme_make_integer_value(value);
+    case 0:
+        rval = scheme_make_string(strval);
+	vim_free(strval);
+	return rval;
+    case -1:
+    case -2:
+        raise_vim_exn(_("hidden option"));
+    case -3:
+        raise_vim_exn(_("unknown option"));
+    }
+    /* unreachable */
+    return scheme_void;
+}
+
+/* (set-option {option-changing-string} [buffer/window]) */
+    static Scheme_Object *
+set_option(void *data, int argc, Scheme_Object **argv)
+{
+    char_u	*cmd;
+    int		opt_flags = 0;
+    buf_T	*save_curb = curbuf;
+    win_T	*save_curw = curwin;
+    Vim_Prim	*prim = (Vim_Prim *)data;
+
+    GUARANTEE_STRING(prim->name, 0);
+    if (argc > 1)
+    {
+	if (M_global == NULL)
+	{
+	    MZ_REGISTER_STATIC(M_global);
+	    M_global = scheme_intern_symbol("global");
+	}
+
+	if (argv[1] == M_global)
+	    opt_flags = OPT_GLOBAL;
+	else if (SCHEME_VIMBUFFERP(argv[1]))
+	{
+	    curbuf = get_valid_buffer(argv[1]);
+	    opt_flags = OPT_LOCAL;
+	}
+	else if (SCHEME_VIMWINDOWP(argv[1]))
+	{
+	    win_T *win = get_valid_window(argv[1]);
+	    curwin = win;
+	    curbuf = win->w_buffer;
+	    opt_flags = OPT_LOCAL;
+	}
+	else
+	    scheme_wrong_type(prim->name, "vim-buffer/window", 1, argc, argv);
+    }
+
+    /* do_set can modify cmd, make copy */
+    cmd = vim_strsave((char_u *)SCHEME_STR_VAL(argv[0]));
+    do_set(cmd, opt_flags);
+    vim_free(cmd);
+    update_screen(NOT_VALID);
+    curbuf = save_curb;
+    curwin = save_curw;
+    raise_if_error();
+    return scheme_void;
+}
+
+/*
+ *===========================================================================
+ *  5. Vim Window-related Manipulation Functions
+ *===========================================================================
+ */
+
+/* (curr-win) */
+    static Scheme_Object *
+get_curr_win(void *data, int argc, Scheme_Object **argv)
+{
+    return (Scheme_Object *)get_vim_curr_window();
+}
+
+/* (win-count) */
+    static Scheme_Object *
+get_window_count(void *data, int argc, Scheme_Object **argv)
+{
+    win_T   *w;
+    int	    n = 0;
+
+    for (w = firstwin; w; w = w->w_next) ++n;
+    return scheme_make_integer(n);
+}
+
+/* (get-win-list [buffer]) */
+    static Scheme_Object *
+get_window_list(void *data, int argc, Scheme_Object **argv)
+{
+    Vim_Prim	    *prim = (Vim_Prim *)data;
+    vim_mz_buffer   *buf;
+    Scheme_Object   *list;
+    win_T	    *w;
+
+    buf = get_buffer_arg(prim->name, 0, argc, argv);
+    list = scheme_null;
+
+    for (w = firstwin; w; w = w->w_next)
+        if (w->w_buffer == buf->buf)
+	    list = scheme_make_pair(window_new(w), list);
+
+    return list;
+}
+
+    static Scheme_Object *
+window_new(win_T *win)
+{
+    vim_mz_window *self;
+
+    /* We need to handle deletion of windows underneath us.
+     * If we add a "mzscheme_ref" field to the win_T structure,
+     * then we can get at it in win_free() in vim.
+     *
+     * On a win_free() we set the Scheme object's win_T *field
+     * to an invalid value. We trap all uses of a window
+     * object, and reject them if the win_T *field is invalid.
+     */
+    if (win->mzscheme_ref)
+	return win->mzscheme_ref;
+
+    self = scheme_malloc_fail_ok(scheme_malloc, sizeof(vim_mz_window));
+
+    vim_memset(self, 0, sizeof(vim_mz_window));
+    scheme_dont_gc_ptr(self);	/* because win isn't visible to GC */
+    win->mzscheme_ref = self;
+    self->win = win;
+    self->tag = mz_window_type;
+
+    return (Scheme_Object *)(self);
+}
+
+/* (get-win-num [window]) */
+    static Scheme_Object *
+get_window_num(void *data, int argc, Scheme_Object **argv)
+{
+    Vim_Prim	*prim = (Vim_Prim *)data;
+    win_T	*win = get_window_arg(prim->name, 0, argc, argv)->win;
+    int		nr = 1;
+    win_T	*wp;
+
+    for (wp = firstwin; wp != win; wp = wp->w_next)
+	++nr;
+
+    return scheme_make_integer(nr);
+}
+
+/* (get-win-by-num {windownum}) */
+    static Scheme_Object *
+get_window_by_num(void *data, int argc, Scheme_Object **argv)
+{
+    Vim_Prim	*prim = (Vim_Prim *)data;
+    win_T	*win;
+    int		fnum;
+
+    fnum = SCHEME_INT_VAL(GUARANTEE_INTEGER(prim->name, 0));
+    if (fnum < 1)
+	scheme_signal_error(_("window index is out of range"));
+
+    for (win = firstwin; win; win = win->w_next, --fnum)
+        if (fnum == 1)	    /* to be 1-based */
+	    return window_new(win);
+
+    return scheme_false;
+}
+
+/* (get-win-buffer [window]) */
+    static Scheme_Object *
+get_window_buffer(void *data, int argc, Scheme_Object **argv)
+{
+    Vim_Prim	    *prim = (Vim_Prim *)data;
+    vim_mz_window   *win = get_window_arg(prim->name, 0, argc, argv);
+
+    return buffer_new(win->win->w_buffer);
+}
+
+/* (get-win-height [window]) */
+    static Scheme_Object *
+get_window_height(void *data, int argc, Scheme_Object **argv)
+{
+    Vim_Prim	    *prim = (Vim_Prim *)data;
+    vim_mz_window   *win = get_window_arg(prim->name, 0, argc, argv);
+
+    return scheme_make_integer(win->win->w_height);
+}
+
+/* (set-win-height {height} [window]) */
+    static Scheme_Object *
+set_window_height(void *data, int argc, Scheme_Object **argv)
+{
+    Vim_Prim	    *prim = (Vim_Prim *)data;
+    vim_mz_window   *win;
+    win_T	    *savewin;
+    int		    height;
+
+    win = get_window_arg(prim->name, 1, argc, argv);
+    height = SCHEME_INT_VAL(GUARANTEE_INTEGER(prim->name, 0));
+
+#ifdef FEAT_GUI
+    need_mouse_correct = TRUE;
+#endif
+
+    savewin = curwin;
+    curwin = win->win;
+    win_setheight(height);
+    curwin = savewin;
+
+    raise_if_error();
+    return scheme_void;
+}
+
+#ifdef FEAT_VERTSPLIT
+/* (get-win-width [window]) */
+    static Scheme_Object *
+get_window_width(void *data, int argc, Scheme_Object **argv)
+{
+    Vim_Prim	    *prim = (Vim_Prim *)data;
+    vim_mz_window   *win = get_window_arg(prim->name, 0, argc, argv);
+
+    return scheme_make_integer(W_WIDTH(win->win));
+}
+
+/* (set-win-width {width} [window]) */
+    static Scheme_Object *
+set_window_width(void *data, int argc, Scheme_Object **argv)
+{
+    Vim_Prim	    *prim = (Vim_Prim *)data;
+    vim_mz_window   *win;
+    win_T	    *savewin;
+    int		    width = 0;
+
+    win = get_window_arg(prim->name, 1, argc, argv);
+    width = SCHEME_INT_VAL(GUARANTEE_INTEGER(prim->name, 0));
+
+# ifdef FEAT_GUI
+    need_mouse_correct = TRUE;
+# endif
+
+    savewin = curwin;
+    curwin = win->win;
+    win_setwidth(width);
+    curwin = savewin;
+
+    raise_if_error();
+    return scheme_void;
+}
+#endif
+
+/* (get-cursor [window]) -> (line . col) */
+    static Scheme_Object *
+get_cursor(void *data, int argc, Scheme_Object **argv)
+{
+    Vim_Prim	    *prim = (Vim_Prim *)data;
+    vim_mz_window   *win;
+    pos_T	    pos;
+
+    win = get_window_arg(prim->name, 0, argc, argv);
+    pos = win->win->w_cursor;
+    return scheme_make_pair(scheme_make_integer_value((long)pos.lnum),
+		    scheme_make_integer_value((long)pos.col + 1));
+}
+
+/* (set-cursor (line . col) [window]) */
+    static Scheme_Object *
+set_cursor(void *data, int argc, Scheme_Object **argv)
+{
+    Vim_Prim	    *prim = (Vim_Prim *)data;
+    vim_mz_window   *win;
+    long	    lnum = 0;
+    long	    col = 0;
+
+    win = get_window_arg(prim->name, 1, argc, argv);
+    GUARANTEE_PAIR(prim->name, 0);
+
+    if (!SCHEME_INTP(SCHEME_CAR(argv[0]))
+	    || !SCHEME_INTP(SCHEME_CDR(argv[0])))
+	scheme_wrong_type(prim->name, "integer pair", 0, argc, argv);
+
+    lnum = SCHEME_INT_VAL(SCHEME_CAR(argv[0]));
+    col = SCHEME_INT_VAL(SCHEME_CDR(argv[0])) - 1;
+
+    check_line_range(lnum, win->win->w_buffer);
+    /* don't know how to catch invalid column value */
+
+    win->win->w_cursor.lnum = lnum;
+    win->win->w_cursor.col = col;
+    update_screen(VALID);
+
+    raise_if_error();
+    return scheme_void;
+}
+/*
+ *===========================================================================
+ *  6. Vim Buffer-related Manipulation Functions
+ *     Note that each buffer should have its own private namespace.
+ *===========================================================================
+ */
+
+/* (open-buff {filename}) */
+    static Scheme_Object *
+mzscheme_open_buffer(void *data, int argc, Scheme_Object **argv)
+{
+    Vim_Prim	    *prim = (Vim_Prim *)data;
+    char	    *fname;
+    int		    num = 0;
+    Scheme_Object   *onum;
+
+    fname = SCHEME_STR_VAL(GUARANTEE_STRING(prim->name, 0));
+    /* TODO make open existing file */
+    num = buflist_add(fname, BLN_LISTED | BLN_CURBUF);
+
+    if (num == 0)
+	raise_vim_exn(_("couldn't open buffer"));
+
+    onum = scheme_make_integer(num);
+    return get_buffer_by_num(data, 1, &onum);
+}
+
+/* (get-buff-by-num {buffernum}) */
+    static Scheme_Object *
+get_buffer_by_num(void *data, int argc, Scheme_Object **argv)
+{
+    Vim_Prim	*prim = (Vim_Prim *)data;
+    buf_T	*buf;
+    int		fnum;
+
+    fnum = SCHEME_INT_VAL(GUARANTEE_INTEGER(prim->name, 0));
+
+    for (buf = firstbuf; buf; buf = buf->b_next)
+        if (buf->b_fnum == fnum)
+	    return buffer_new(buf);
+
+    return scheme_false;
+}
+
+/* (get-buff-by-name {buffername}) */
+    static Scheme_Object *
+get_buffer_by_name(void *data, int argc, Scheme_Object **argv)
+{
+    Vim_Prim	*prim = (Vim_Prim *)data;
+    buf_T	*buf;
+    char_u	*fname;
+
+    fname = SCHEME_STR_VAL(GUARANTEE_STRING(prim->name, 0));
+
+    for (buf = firstbuf; buf; buf = buf->b_next)
+	if (buf->b_ffname == NULL || buf->b_sfname == NULL)
+	    /* empty string */
+	{
+	    if (fname[0] == NUL)
+		return buffer_new(buf);
+	}
+	else if (!fnamecmp(buf->b_ffname, fname)
+		|| !fnamecmp(buf->b_sfname, fname))
+	    /* either short or long filename matches */
+	    return buffer_new(buf);
+
+    return scheme_false;
+}
+
+/* (get-next-buff [buffer]) */
+    static Scheme_Object *
+get_next_buffer(void *data, int argc, Scheme_Object **argv)
+{
+    Vim_Prim	*prim = (Vim_Prim *)data;
+    buf_T	*buf = get_buffer_arg(prim->name, 0, argc, argv)->buf;
+
+    if (buf->b_next == NULL)
+	return scheme_false;
+    else
+	return buffer_new(buf->b_next);
+}
+
+/* (get-prev-buff [buffer]) */
+    static Scheme_Object *
+get_prev_buffer(void *data, int argc, Scheme_Object **argv)
+{
+    Vim_Prim	*prim = (Vim_Prim *)data;
+    buf_T	*buf = get_buffer_arg(prim->name, 0, argc, argv)->buf;
+
+    if (buf->b_prev == NULL)
+	return scheme_false;
+    else
+	return buffer_new(buf->b_prev);
+}
+
+/* (get-buff-num [buffer]) */
+    static Scheme_Object *
+get_buffer_num(void *data, int argc, Scheme_Object **argv)
+{
+    Vim_Prim	    *prim = (Vim_Prim *)data;
+    vim_mz_buffer   *buf = get_buffer_arg(prim->name, 0, argc, argv);
+
+    return scheme_make_integer(buf->buf->b_fnum);
+}
+
+/* (buff-count) */
+    static Scheme_Object *
+get_buffer_count(void *data, int argc, Scheme_Object **argv)
+{
+    buf_T   *b;
+    int	    n = 0;
+
+    for (b = firstbuf; b; b = b->b_next) ++n;
+    return scheme_make_integer(n);
+}
+
+/* (get-buff-name [buffer]) */
+    static Scheme_Object *
+get_buffer_name(void *data, int argc, Scheme_Object **argv)
+{
+    Vim_Prim	    *prim = (Vim_Prim *)data;
+    vim_mz_buffer   *buf = get_buffer_arg(prim->name, 0, argc, argv);
+
+    return scheme_make_string(buf->buf->b_ffname);
+}
+
+/* (curr-buff) */
+    static Scheme_Object *
+get_curr_buffer(void *data, int argc, Scheme_Object **argv)
+{
+    return (Scheme_Object *)get_vim_curr_buffer();
+}
+
+    static Scheme_Object *
+buffer_new(buf_T *buf)
+{
+    vim_mz_buffer *self;
+
+    /* We need to handle deletion of buffers underneath us.
+     * If we add a "mzscheme_buf" field to the buf_T structure,
+     * then we can get at it in buf_freeall() in vim.
+     */
+    if (buf->mzscheme_ref)
+        return buf->mzscheme_ref;
+
+    self = scheme_malloc_fail_ok(scheme_malloc, sizeof(vim_mz_buffer));
+
+    vim_memset(self, 0, sizeof(vim_mz_buffer));
+    scheme_dont_gc_ptr(self);	/* because buf isn't visible to GC */
+    buf->mzscheme_ref = self;
+    self->buf = buf;
+    self->tag = mz_buffer_type;
+
+    mzscheme_interface_init(self);	/* Set up namespace */
+
+    return (Scheme_Object *)(self);
+}
+
+/*
+ * (get-buff-size [buffer])
+ *
+ * Get the size (number of lines) in the current buffer.
+ */
+    static Scheme_Object *
+get_buffer_size(void *data, int argc, Scheme_Object **argv)
+{
+    Vim_Prim	    *prim = (Vim_Prim *)data;
+    vim_mz_buffer   *buf = get_buffer_arg(prim->name, 0, argc, argv);
+
+    return scheme_make_integer(buf->buf->b_ml.ml_line_count);
+}
+
+/*
+ * (get-buff-line {linenr} [buffer])
+ *
+ * Get a line from the specified buffer. The line number is
+ * in Vim format (1-based). The line is returned as a MzScheme
+ * string object.
+ */
+    static Scheme_Object *
+get_buffer_line(void *data, int argc, Scheme_Object **argv)
+{
+    Vim_Prim	    *prim = (Vim_Prim *)data;
+    vim_mz_buffer   *buf;
+    int		    linenr;
+    char	    *line;
+
+    buf = get_buffer_arg(prim->name, 1, argc, argv);
+    linenr = SCHEME_INT_VAL(GUARANTEE_INTEGER(prim->name, 0));
+    line = ml_get_buf(buf->buf, (linenr_T)linenr, FALSE);
+
+    raise_if_error();
+    return scheme_make_string(line);
+}
+
+
+/*
+ * (get-buff-line-list {start} {end} [buffer])
+ *
+ * Get a list of lines from the specified buffer. The line numbers
+ * are in Vim format (1-based). The range is from lo up to, but not
+ * including, hi. The list is returned as a list of string objects.
+ */
+    static Scheme_Object *
+get_buffer_line_list(void *data, int argc, Scheme_Object **argv)
+{
+    Vim_Prim	    *prim = (Vim_Prim *)data;
+    vim_mz_buffer   *buf;
+    int		    i, hi, lo, n;
+    Scheme_Object   *list;
+
+    buf = get_buffer_arg(prim->name, 2, argc, argv);
+    list = scheme_null;
+    hi = SCHEME_INT_VAL(GUARANTEE_INTEGER(prim->name, 1));
+    lo = SCHEME_INT_VAL(GUARANTEE_INTEGER(prim->name, 0));
+
+    /*
+     * Handle some error conditions
+     */
+    if (lo < 0)
+        lo = 0;
+
+    if (hi < 0)
+	hi = 0;
+    if (hi < lo)
+        hi = lo;
+
+    n = hi - lo;
+
+    for (i = n; i >= 0; --i)
+    {
+	Scheme_Object *str = scheme_make_string(
+		       (char *)ml_get_buf(buf->buf, (linenr_T)(lo+i), FALSE));
+	raise_if_error();
+
+	/* Set the list item */
+	list = scheme_make_pair(str, list);
+    }
+
+    return list;
+}
+
+/*
+ * (set-buff-line {linenr} {string/#f} [buffer])
+ *
+ * Replace a line in the specified buffer. The line number is
+ * in Vim format (1-based). The replacement line is given as
+ * an MzScheme string object. The object is checked for validity
+ * and correct format. An exception is thrown if the values are not
+ * the correct format.
+ *
+ * It returns a Scheme Object that indicates the length of the
+ * string changed.
+ */
+    static Scheme_Object *
+set_buffer_line(void *data, int argc, Scheme_Object **argv)
+{
+    /* First of all, we check the the of the supplied MzScheme object.
+     * There are three cases:
+     *	  1. #f - this is a deletion.
+     *	  2. A string	   - this is a replacement.
+     *	  3. Anything else - this is an error.
+     */
+    Vim_Prim	    *prim = (Vim_Prim *)data;
+    vim_mz_buffer   *buf;
+    Scheme_Object   *line;
+    char	    *save;
+    buf_T	    *savebuf;
+    int		    n;
+
+    n = SCHEME_INT_VAL(GUARANTEE_INTEGER(prim->name, 0));
+    if (!SCHEME_STRINGP(argv[1]) && !SCHEME_FALSEP(argv[1]))
+        scheme_wrong_type(prim->name, "string or #f", 1, argc, argv);
+    line = argv[1];
+    buf = get_buffer_arg(prim->name, 2, argc, argv);
+
+    check_line_range(n, buf->buf);
+
+    if (SCHEME_FALSEP(line))
+    {
+	savebuf = curbuf;
+	curbuf = buf->buf;
+
+	if (u_savedel((linenr_T)n, 1L) == FAIL)
+	{
+	    curbuf = savebuf;
+	    raise_vim_exn(_("cannot save undo information"));
+	}
+	else if (ml_delete((linenr_T)n, FALSE) == FAIL)
+	{
+	    curbuf = savebuf;
+	    raise_vim_exn(_("cannot delete line"));
+	}
+	deleted_lines_mark((linenr_T)n, 1L);
+	if (buf->buf == curwin->w_buffer)
+	    mz_fix_cursor(n, n + 1, -1);
+
+	curbuf = savebuf;
+
+	raise_if_error();
+	return scheme_void;
+    }
+
+    /* Otherwise it's a line */
+    save = string_to_line(line);
+    savebuf = curbuf;
+
+    curbuf = buf->buf;
+
+    if (u_savesub((linenr_T)n) == FAIL)
+    {
+	curbuf = savebuf;
+	raise_vim_exn(_("cannot save undo information"));
+    }
+    else if (ml_replace((linenr_T)n, (char_u *)save, TRUE) == FAIL)
+    {
+	curbuf = savebuf;
+	raise_vim_exn(_("cannot replace line"));
+    }
+    else
+	changed_bytes((linenr_T)n, 0);
+
+    curbuf = savebuf;
+
+    raise_if_error();
+    return scheme_void;
+}
+
+/*
+ * (set-buff-line-list {start} {end} {string-list/#f/null} [buffer])
+ *
+ * Replace a range of lines in the specified buffer. The line numbers are in
+ * Vim format (1-based). The range is from lo up to, but not including, hi.
+ * The replacement lines are given as a Scheme list of string objects. The
+ * list is checked for validity and correct format.
+ *
+ * Errors are returned as a value of FAIL. The return value is OK on success.
+ * If OK is returned and len_change is not NULL, *len_change is set to the
+ * change in the buffer length.
+ */
+    static Scheme_Object *
+set_buffer_line_list(void *data, int argc, Scheme_Object **argv)
+{
+    /* First of all, we check the type of the supplied MzScheme object.
+     * There are three cases:
+     *	  1. #f - this is a deletion.
+     *	  2. A list	   - this is a replacement.
+     *	  3. Anything else - this is an error.
+     */
+    Vim_Prim	    *prim = (Vim_Prim *)data;
+    vim_mz_buffer   *buf;
+    Scheme_Object   *line_list;
+    Scheme_Object   *line;
+    Scheme_Object   *rest;
+    char	    **array;
+    buf_T	    *savebuf;
+    int		    i, old_len, new_len, hi, lo;
+    long	    extra;
+
+    lo = SCHEME_INT_VAL(GUARANTEE_INTEGER(prim->name, 0));
+    hi = SCHEME_INT_VAL(GUARANTEE_INTEGER(prim->name, 1));
+    if (!SCHEME_PAIRP(argv[2])
+	    && !SCHEME_FALSEP(argv[2]) && !SCHEME_NULLP(argv[2]))
+	scheme_wrong_type(prim->name, "list or #f", 2, argc, argv);
+    line_list = argv[2];
+    buf = get_buffer_arg(prim->name, 3, argc, argv);
+    old_len = hi - lo;
+    if (old_len < 0) /* process inverse values wisely */
+    {
+	i = lo;
+	lo = hi;
+	hi = i;
+	old_len = -old_len;
+    }
+    extra = 0;
+
+    check_line_range(lo, buf->buf);	    /* inclusive */
+    check_line_range(hi - 1, buf->buf);  /* exclisive */
+
+    if (SCHEME_FALSEP(line_list) || SCHEME_NULLP(line_list))
+    {
+	savebuf = curbuf;
+	curbuf = buf->buf;
+
+	if (u_savedel((linenr_T)lo, (long)old_len) == FAIL)
+	{
+	    curbuf = savebuf;
+	    raise_vim_exn(_("cannot save undo information"));
+	}
+	else
+	{
+	    for (i = 0; i < old_len; i++)
+		if (ml_delete((linenr_T)lo, FALSE) == FAIL)
+		{
+		    curbuf = savebuf;
+		    raise_vim_exn(_("cannot delete line"));
+		}
+	    deleted_lines_mark((linenr_T)lo, (long)old_len);
+	    if (buf->buf == curwin->w_buffer)
+		mz_fix_cursor(lo, hi, -old_len);
+	}
+
+	curbuf = savebuf;
+
+	raise_if_error();
+	return scheme_void;
+    }
+
+    /* List */
+    new_len = scheme_proper_list_length(line_list);
+    if (new_len < 0)	/* improper or cyclic list */
+	scheme_wrong_type(prim->name, "proper list",
+		2, argc, argv);
+
+    /* Using MzScheme allocator, so we don't need to free this and
+     * can safely keep pointers to GC collected strings
+     */
+    array = (char **)scheme_malloc_fail_ok(scheme_malloc,
+		(unsigned)(new_len * sizeof(char *)));
+
+    rest = line_list;
+    for (i = 0; i < new_len; ++i)
+    {
+        line = SCHEME_CAR(rest);
+	rest = SCHEME_CDR(rest);
+	if (!SCHEME_STRINGP(line))
+	    scheme_wrong_type(prim->name, "string-list", 2, argc, argv);
+        array[i] = string_to_line(line);
+    }
+
+    savebuf = curbuf;
+    curbuf = buf->buf;
+
+    if (u_save((linenr_T)(lo-1), (linenr_T)hi) == FAIL)
+    {
+	curbuf = savebuf;
+        raise_vim_exn(_("cannot save undo information"));
+    }
+
+    /*
+     * If the size of the range is reducing (ie, new_len < old_len) we
+     * need to delete some old_len. We do this at the start, by
+     * repeatedly deleting line "lo".
+     */
+    for (i = 0; i < old_len - new_len; ++i)
+    {
+	if (ml_delete((linenr_T)lo, FALSE) == FAIL)
+	{
+	    curbuf = savebuf;
+	    raise_vim_exn(_("cannot delete line"));
+	}
+        extra--;
+    }
+
+    /*
+     * For as long as possible, replace the existing old_len with the
+     * new old_len. This is a more efficient operation, as it requires
+     * less memory allocation and freeing.
+     */
+    for (i = 0; i < old_len && i < new_len; i++)
+	if (ml_replace((linenr_T)(lo+i), (char_u *)array[i], TRUE) == FAIL)
+	{
+	    curbuf = savebuf;
+	    raise_vim_exn(_("cannot replace line"));
+	}
+
+    /*
+     * Now we may need to insert the remaining new_len.  We don't need to
+     * free the string passed back because MzScheme has control of that
+     * memory.
+     */
+    while (i < new_len)
+    {
+        if (ml_append((linenr_T)(lo + i - 1),
+		(char_u *)array[i], 0, FALSE) == FAIL)
+	{
+	    curbuf = savebuf;
+            raise_vim_exn(_("cannot insert line"));
+	}
+        ++i;
+        ++extra;
+    }
+
+    /*
+     * Adjust marks. Invalidate any which lie in the
+     * changed range, and move any in the remainder of the buffer.
+     */
+    mark_adjust((linenr_T)lo, (linenr_T)(hi - 1), (long)MAXLNUM, (long)extra);
+    changed_lines((linenr_T)lo, 0, (linenr_T)hi, (long)extra);
+
+    if (buf->buf == curwin->w_buffer)
+	mz_fix_cursor(lo, hi, extra);
+    curbuf = savebuf;
+
+    raise_if_error();
+    return scheme_void;
+}
+
+/*
+ * (insert-buff-line-list {linenr} {string/string-list} [buffer])
+ *
+ * Insert a number of lines into the specified buffer after the specifed line.
+ * The line number is in Vim format (1-based). The lines to be inserted are
+ * given as an MzScheme list of string objects or as a single string. The lines
+ * to be added are checked for validity and correct format. Errors are
+ * returned as a value of FAIL.  The return value is OK on success.
+ * If OK is returned and len_change is not NULL, *len_change
+ * is set to the change in the buffer length.
+ */
+    static Scheme_Object *
+insert_buffer_line_list(void *data, int argc, Scheme_Object **argv)
+{
+    Vim_Prim	    *prim = (Vim_Prim *)data;
+    vim_mz_buffer   *buf;
+    Scheme_Object   *list;
+    Scheme_Object   *line;
+    Scheme_Object   *rest;
+    char	    **array;
+    char	    *str;
+    buf_T	    *savebuf;
+    int		    i, n, size;
+
+    /*
+     * First of all, we check the type of the supplied MzScheme object.
+     * It must be a string or a list, or the call is in error.
+     */
+    n = SCHEME_INT_VAL(GUARANTEE_INTEGER(prim->name, 0));
+    list = argv[1];
+
+    if (!SCHEME_STRINGP(list) && !SCHEME_PAIRP(list))
+	scheme_wrong_type(prim->name, "string or list", 1, argc, argv);
+    buf = get_buffer_arg(prim->name, 2, argc, argv);
+
+    if (n != 0)	    /* 0 can be used in insert */
+        check_line_range(n, buf->buf);
+    if (SCHEME_STRINGP(list))
+    {
+	str = string_to_line(list);
+
+	savebuf = curbuf;
+	curbuf = buf->buf;
+
+	if (u_save((linenr_T)n, (linenr_T)(n+1)) == FAIL)
+	{
+	    curbuf = savebuf;
+	    raise_vim_exn(_("cannot save undo information"));
+	}
+	else if (ml_append((linenr_T)n, (char_u *)str, 0, FALSE) == FAIL)
+	{
+	    curbuf = savebuf;
+	    raise_vim_exn(_("cannot insert line"));
+	}
+	else
+	    appended_lines_mark((linenr_T)n, 1L);
+
+	curbuf = savebuf;
+	update_screen(VALID);
+
+	raise_if_error();
+	return scheme_void;
+    }
+
+    /* List */
+    size = scheme_proper_list_length(list);
+    if (size < 0)	/* improper or cyclic list */
+	scheme_wrong_type(prim->name, "proper list",
+		2, argc, argv);
+
+    /* Using MzScheme allocator, so we don't need to free this and
+     * can safely keep pointers to GC collected strings
+     */
+    array = (char **)scheme_malloc_fail_ok(
+	    scheme_malloc, (unsigned)(size * sizeof(char *)));
+
+    rest = list;
+    for (i = 0; i < size; ++i)
+    {
+        line = SCHEME_CAR(rest);
+        rest = SCHEME_CDR(rest);
+        array[i] = string_to_line(line);
+    }
+
+    savebuf = curbuf;
+    curbuf = buf->buf;
+
+    if (u_save((linenr_T)n, (linenr_T)(n + 1)) == FAIL)
+    {
+	curbuf = savebuf;
+        raise_vim_exn(_("cannot save undo information"));
+    }
+    else
+    {
+        for (i = 0; i < size; ++i)
+            if (ml_append((linenr_T)(n + i), (char_u *)array[i],
+			0, FALSE) == FAIL)
+	    {
+		curbuf = savebuf;
+	        raise_vim_exn(_("cannot insert line"));
+	    }
+
+        if (i > 0)
+            appended_lines_mark((linenr_T)n, (long)i);
+    }
+
+    curbuf = savebuf;
+    update_screen(VALID);
+
+    raise_if_error();
+    return scheme_void;
+}
+
+/* (get-buff-namespace [buffer]) */
+    static Scheme_Object *
+get_buffer_namespace(void *data, int argc, Scheme_Object **argv)
+{
+    Vim_Prim	*prim = (Vim_Prim *)data;
+
+    return (Scheme_Object *)get_buffer_arg(prim->name, 0, argc, argv)->env;
+}
+
+/*
+ * Predicates
+ */
+/* (buff? obj) */
+    static Scheme_Object *
+vim_bufferp(void *data, int argc, Scheme_Object **argv)
+{
+    if (SCHEME_VIMBUFFERP(argv[0]))
+	return scheme_true;
+    else
+	return scheme_false;
+}
+
+/* (win? obj) */
+    static Scheme_Object *
+vim_windowp(void *data, int argc, Scheme_Object **argv)
+{
+    if (SCHEME_VIMWINDOWP(argv[0]))
+	return scheme_true;
+    else
+	return scheme_false;
+}
+
+/* (buff-valid? obj) */
+    static Scheme_Object *
+vim_buffer_validp(void *data, int argc, Scheme_Object **argv)
+{
+    if (SCHEME_VIMBUFFERP(argv[0])
+	    && ((vim_mz_buffer *)argv[0])->buf != INVALID_BUFFER_VALUE)
+	return scheme_true;
+    else
+	return scheme_false;
+}
+
+/* (win-valid? obj) */
+    static Scheme_Object *
+vim_window_validp(void *data, int argc, Scheme_Object **argv)
+{
+    if (SCHEME_VIMWINDOWP(argv[0])
+	    && ((vim_mz_window *)argv[0])->win != INVALID_WINDOW_VALUE)
+	return scheme_true;
+    else
+	return scheme_false;
+}
+
+/*
+ *===========================================================================
+ * Utilities
+ *===========================================================================
+ */
+
+/*
+ * Convert an MzScheme string into a Vim line.
+ *
+ * The result is in allocated memory. All internal nulls are replaced by
+ * newline characters. It is an error for the string to contain newline
+ * characters.
+ *
+ */
+    static char *
+string_to_line(Scheme_Object *obj)
+{
+    char	*str;
+    long	len;
+    int		i;
+
+    str = scheme_display_to_string(obj, &len);
+
+    /* Error checking: String must not contain newlines, as we
+     * are replacing a single line, and we must replace it with
+     * a single line.
+     */
+    if (memchr(str, '\n', len))
+	scheme_signal_error(_("string cannot contain newlines"));
+
+    /* Create a copy of the string, with internal nulls replaced by
+     * newline characters, as is the vim convention.
+     */
+    for (i = 0; i < len; ++i)
+    {
+	if (str[i] == '\0')
+	    str[i] = '\n';
+    }
+
+    str[i] = '\0';
+
+    return str;
+}
+
+/*
+ * Check to see whether a Vim error has been reported, or a keyboard
+ * interrupt (from vim --> got_int) has been detected.
+ */
+    static int
+vim_error_check(void)
+{
+    return (got_int || did_emsg);
+}
+
+/*
+ * register Scheme exn:vim
+ */
+    static void
+register_vim_exn(Scheme_Env *env)
+{
+    Scheme_Object   *exn_name = scheme_intern_symbol("exn:vim");
+
+    if (vim_exn == NULL)
+	vim_exn = scheme_make_struct_type(exn_name,
+		scheme_builtin_value("struct:exn"), NULL, 0, 0, NULL, NULL
+#if MZSCHEME_VERSION_MAJOR >= 299
+		, NULL
+#endif
+		);
+
+    if (vim_exn_values == NULL)
+    {
+	int	nc = 0;
+
+	Scheme_Object   **exn_names = scheme_make_struct_names(
+		exn_name, scheme_null, 0, &nc);
+	Scheme_Object   **exn_values = scheme_make_struct_values(
+		vim_exn, exn_names, nc, 0);
+
+	vim_exn_names = scheme_make_vector(nc, scheme_false);
+	vim_exn_values = scheme_make_vector(nc, scheme_false);
+	/* remember names and values */
+	mch_memmove(SCHEME_VEC_ELS(vim_exn_names), exn_names,
+		nc * sizeof(Scheme_Object *));
+	mch_memmove(SCHEME_VEC_ELS(vim_exn_values), exn_values,
+		nc * sizeof(Scheme_Object *));
+    }
+
+    add_vim_exn(env);
+}
+
+/*
+ * Add stuff of exn:vim to env
+ */
+    static void
+add_vim_exn(Scheme_Env *env)
+{
+    int i;
+
+    for (i = 0; i < SCHEME_VEC_SIZE(vim_exn_values); i++)
+	scheme_add_global_symbol(SCHEME_VEC_ELS(vim_exn_names)[i],
+		SCHEME_VEC_ELS(vim_exn_values)[i], env);
+}
+
+/*
+ * raise exn:vim, may be with additional info string
+ */
+    void
+raise_vim_exn(const char *add_info)
+{
+    Scheme_Object   *argv[2];
+    char_u	    *fmt = _("Vim error: ~a");
+
+    if (add_info != NULL)
+    {
+	Scheme_Object   *info = scheme_make_string(add_info);
+	argv[0] = scheme_make_string(
+		scheme_format(fmt, strlen(fmt), 1, &info, NULL));
+    }
+    else
+	argv[0] = scheme_make_string(_("Vim error"));
+
+    argv[1] = scheme_current_continuation_marks();
+
+    scheme_raise(scheme_make_struct_instance(vim_exn, 2, argv));
+}
+
+    void
+raise_if_error(void)
+{
+    if (vim_error_check())
+	raise_vim_exn(NULL);
+}
+
+/* get buffer:
+ * either current
+ * or passed as argv[argnum] with checks
+ */
+    static vim_mz_buffer *
+get_buffer_arg(const char *fname, int argnum, int argc, Scheme_Object **argv)
+{
+    vim_mz_buffer *b;
+
+    if (argc < argnum + 1)
+	return get_vim_curr_buffer();
+    if (!SCHEME_VIMBUFFERP(argv[argnum]))
+	scheme_wrong_type(fname, "vim-buffer", argnum, argc, argv);
+    b = (vim_mz_buffer *)argv[argnum];
+    (void)get_valid_buffer(argv[argnum]);
+    return b;
+}
+
+/* get window:
+ * either current
+ * or passed as argv[argnum] with checks
+ */
+    static vim_mz_window *
+get_window_arg(const char *fname, int argnum, int argc, Scheme_Object **argv)
+{
+    vim_mz_window *w;
+
+    if (argc < argnum + 1)
+	return get_vim_curr_window();
+    w = (vim_mz_window *)argv[argnum];
+    if (!SCHEME_VIMWINDOWP(argv[argnum]))
+	scheme_wrong_type(fname, "vim-window", argnum, argc, argv);
+    (void)get_valid_window(argv[argnum]);
+    return w;
+}
+
+/* get valid Vim buffer from Scheme_Object* */
+buf_T *get_valid_buffer(void *obj)
+{
+    buf_T *buf = ((vim_mz_buffer *)obj)->buf;
+
+    if (buf == INVALID_BUFFER_VALUE)
+	scheme_signal_error(_("buffer is invalid"));
+    return buf;
+}
+
+/* get valid Vim window from Scheme_Object* */
+win_T *get_valid_window(void *obj)
+{
+    win_T *win = ((vim_mz_window *)obj)->win;
+    if (win == INVALID_WINDOW_VALUE)
+	scheme_signal_error(_("window is invalid"));
+    return win;
+}
+
+#if 0
+    int
+mzvim_bufferp(Scheme_Object *obj)
+{
+    return SCHEME_VIMBUFFERP(obj);
+}
+
+    int
+mzvim_windowp(Scheme_Object *obj)
+{
+    return SCHEME_VIMWINDOWP(obj);
+}
+#endif
+
+    int
+mzthreads_allowed(void)
+{
+    return mz_threads_allow;
+}
+
+    static int
+line_in_range(linenr_T lnum, buf_T *buf)
+{
+    return (lnum > 0 && lnum <= buf->b_ml.ml_line_count);
+}
+
+    static void
+check_line_range(linenr_T lnum, buf_T *buf)
+{
+    if (!line_in_range(lnum, buf))
+	scheme_signal_error(_("linenr out of range"));
+}
+
+/*
+ * Check if deleting lines made the cursor position invalid
+ * (or you'll get msg from Vim about invalid linenr).
+ * Changed the lines from "lo" to "hi" and added "extra" lines (negative if
+ * deleted). Got from if_python.c
+ */
+    static void
+mz_fix_cursor(int lo, int hi, int extra)
+{
+    if (curwin->w_cursor.lnum >= lo)
+    {
+	/* Adjust the cursor position if it's in/after the changed
+	 * lines. */
+	if (curwin->w_cursor.lnum >= hi)
+	{
+	    curwin->w_cursor.lnum += extra;
+	    check_cursor_col();
+	}
+	else if (extra < 0)
+	{
+	    curwin->w_cursor.lnum = lo;
+	    check_cursor();
+	}
+	changed_cline_bef_curs();
+    }
+    invalidate_botline();
+}
+
+static Vim_Prim prims[]=
+{
+    /*
+     * Buffer-related commands
+     */
+    {get_buffer_line, "get-buff-line", 1, 2},
+    {set_buffer_line, "set-buff-line", 2, 3},
+    {get_buffer_line_list, "get-buff-line-list", 2, 3},
+    {get_buffer_name, "get-buff-name", 0, 1},
+    {get_buffer_num, "get-buff-num", 0, 1},
+    {get_buffer_size, "get-buff-size", 0, 1},
+    {set_buffer_line_list, "set-buff-line-list", 3, 4},
+    {insert_buffer_line_list, "insert-buff-line-list", 2, 3},
+    {get_curr_buffer, "curr-buff", 0, 0},
+    {get_buffer_count, "buff-count", 0, 0},
+    {get_next_buffer, "get-next-buff", 0, 1},
+    {get_prev_buffer, "get-prev-buff", 0, 1},
+    {mzscheme_open_buffer, "open-buff", 1, 1},
+    {get_buffer_by_name, "get-buff-by-name", 1, 1},
+    {get_buffer_by_num, "get-buff-by-num", 1, 1},
+    {get_buffer_namespace, "get-buff-namespace", 0, 1},
+    /*
+     * Window-related commands
+     */
+    {get_curr_win, "curr-win", 0, 0},
+    {get_window_count, "win-count", 0, 0},
+    {get_window_by_num, "get-win-by-num", 1, 1},
+    {get_window_num, "get-win-num", 0, 1},
+    {get_window_buffer, "get-win-buffer", 0, 1},
+    {get_window_height, "get-win-height", 0, 1},
+    {set_window_height, "set-win-height", 1, 2},
+#ifdef FEAT_VERTSPLIT
+    {get_window_width, "get-win-width", 0, 1},
+    {set_window_width, "set-win-width", 1, 2},
+#endif
+    {get_cursor, "get-cursor", 0, 1},
+    {set_cursor, "set-cursor", 1, 2},
+    {get_window_list, "get-win-list", 0, 1},
+    /*
+     * Vim-related commands
+     */
+    {vim_command, "command", 1, 1},
+    {vim_eval, "eval", 1, 1},
+    {get_range_start, "range-start", 0, 0},
+    {get_range_end, "range-end", 0, 0},
+    {mzscheme_beep, "beep", 0, 0},
+    {get_option, "get-option", 1, 2},
+    {set_option, "set-option", 1, 2},
+    /*
+     * small utilities
+     */
+    {vim_bufferp, "buff?", 1, 1},
+    {vim_windowp, "win?", 1, 1},
+    {vim_buffer_validp, "buff-valid?", 1, 1},
+    {vim_window_validp, "win-valid?", 1, 1}
+};
+
+/* return MzScheme wrapper for curbuf */
+    static vim_mz_buffer *
+get_vim_curr_buffer(void)
+{
+    if (!curbuf->mzscheme_ref)
+	return (vim_mz_buffer *)buffer_new(curbuf);
+    else
+	return (vim_mz_buffer *)curbuf->mzscheme_ref;
+}
+
+/* return MzScheme wrapper for curwin */
+    static vim_mz_window *
+get_vim_curr_window(void)
+{
+    if (!curwin->mzscheme_ref)
+	return (vim_mz_window *)window_new(curwin);
+    else
+	return (vim_mz_window *)curwin->mzscheme_ref;
+}
+
+#if 0
+    char *
+mzscheme_version(void)
+{
+    return scheme_version();
+}
+#endif
+
+    static void
+make_modules(Scheme_Env *env)
+{
+    int		i;
+    Scheme_Env	*mod;
+
+    mod = scheme_primitive_module(scheme_intern_symbol("vimext"), env);
+    /* all prims made closed so they can access their own names */
+    for (i = 0; i < sizeof(prims)/sizeof(prims[0]); i++)
+    {
+	Vim_Prim *prim = prims + i;
+	scheme_add_global(prim->name,
+		scheme_make_closed_prim_w_arity(prim->prim, prim, prim->name,
+		    prim->mina, prim->maxa),
+		mod);
+    }
+    scheme_add_global("global-namespace", (Scheme_Object *)environment, mod);
+    scheme_finish_primitive_module(mod);
+}
new file mode 100644
--- /dev/null
+++ b/src/if_mzsch.h
@@ -0,0 +1,45 @@
+/* vi:set ts=8 sts=4 sw=4:
+ *
+ * MzScheme interface for Vim, wrapper around scheme.h
+ */
+#ifndef _IF_MZSCH_H_
+#define _IF_MZSCH_H_
+#ifdef __MINGW32__
+/* Hack to engage Cygwin-specific settings */
+# define __CYGWIN32__
+#endif
+
+#include <scheme.h>
+
+#ifdef __MINGW32__
+# undef __CYGWIN32__
+#endif
+
+#if MZSCHEME_VERSION_MAJOR >= 299
+/* macros to be compatible with 20x versions */
+# define scheme_config scheme_current_config()
+# define scheme_make_string scheme_make_byte_string
+# define scheme_make_string_output_port scheme_make_byte_string_output_port
+# define scheme_get_sized_string_output scheme_get_sized_byte_string_output
+# define scheme_write_string scheme_write_byte_string
+# define scheme_make_sized_string scheme_make_sized_byte_string
+
+# define SCHEME_STRINGP(obj) (SCHEME_BYTE_STRINGP(obj) || SCHEME_CHAR_STRINGP(obj))
+# define SCHEME_STR_VAL(obj) SCHEME_BYTE_STR_VAL(   \
+		(SCHEME_BYTE_STRINGP(obj) ? obj : scheme_char_string_to_byte_string(obj)))
+# define GUARANTEE_STRING(fname, argnum) GUARANTEE_TYPE(fname, argnum, SCHEME_STRINGP, "string")
+
+# ifdef scheme_format
+#  undef scheme_format
+# endif
+# define scheme_format scheme_format_utf8
+
+# define GET_BYTE_STRING(obj) (SCHEME_BYTE_STRINGP(obj) ? obj :   \
+	scheme_char_string_to_byte_string(obj))
+#else
+# define GET_BYTE_STRING(obj) (obj)
+# define SCHEME_BYTE_STRLEN_VAL SCHEME_STRLEN_VAL
+# define SCHEME_BYTE_STR_VAL SCHEME_STR_VAL
+#endif
+
+#endif /* _IF_MZSCH_H_ */
--- a/src/main.c
+++ b/src/main.c
@@ -2277,6 +2277,9 @@ getout(exitval)
 	windgoto((int)Rows - 1, 0);
 #endif
 
+#ifdef FEAT_MZSCHEME
+    mzscheme_end();
+#endif
 #ifdef FEAT_TCL
     tcl_end();
 #endif
--- a/src/misc1.c
+++ b/src/misc1.c
@@ -7377,11 +7377,13 @@ lisp_match(p)
  * - it doesn't know about comments starting with a semicolon
  * - it incorrectly interprets '(' as a character literal
  * All this messes up get_lisp_indent in some rare cases.
+ * Update from Sergey Khorev:
+ * I tried to fix the first two issues.
  */
     int
 get_lisp_indent()
 {
-    pos_T	*pos, realpos;
+    pos_T	*pos, realpos, paren;
     int		amount;
     char_u	*that;
     colnr_T	col;
@@ -7395,7 +7397,16 @@ get_lisp_indent()
     realpos = curwin->w_cursor;
     curwin->w_cursor.col = 0;
 
-    if ((pos = findmatch(NULL, '(')) != NULL)
+    if ((pos = findmatch(NULL, '(')) == NULL)
+	pos = findmatch(NULL, '[');
+    else
+    {
+	paren = *pos;
+	pos = findmatch(NULL, '[');
+	if (pos == NULL || ltp(pos, &paren))
+	    pos = &paren;
+    }
+    if (pos != NULL)
     {
 	/* Extra trick: Take the indent of the first previous non-white
 	 * line that is at the same () level. */
@@ -7426,9 +7437,9 @@ get_lisp_indent()
 		    while (*that && (*that != '"' || *(that - 1) == '\\'))
 			++that;
 		}
-		if (*that == '(')
+		if (*that == '(' || *that == '[')
 		    ++parencount;
-		else if (*that == ')')
+		else if (*that == ')' || *that == ']')
 		    --parencount;
 	    }
 	    if (parencount == 0)
@@ -7465,7 +7476,8 @@ get_lisp_indent()
 		 *   (...))	      of	   (...))
 		 */
 
-		if (!vi_lisp && *that == '(' && lisp_match(that + 1))
+		if (!vi_lisp && (*that == '(' || *that == '[')
+						      && lisp_match(that + 1))
 		    amount += 2;
 		else
 		{
@@ -7483,7 +7495,7 @@ get_lisp_indent()
 		    {
 			/* test *that != '(' to accomodate first let/do
 			 * argument if it is more than one line */
-			if (!vi_lisp && *that != '(')
+			if (!vi_lisp && *that != '(' && *that != '[')
 			    firsttry++;
 
 			parencount = 0;
@@ -7499,16 +7511,18 @@ get_lisp_indent()
 				    && (!vim_iswhite(*that)
 					|| quotecount
 					|| parencount)
-				    && (!(*that == '('
+				    && (!((*that == '(' || *that == '[')
 					    && !quotecount
 					    && !parencount
 					    && vi_lisp)))
 			    {
 				if (*that == '"')
 				    quotecount = !quotecount;
-				if (*that == '(' && !quotecount)
+				if ((*that == '(' || *that == '[')
+							       && !quotecount)
 				    ++parencount;
-				if (*that == ')' && !quotecount)
+				if ((*that == ')' || *that == ']')
+							       && !quotecount)
 				    --parencount;
 				if (*that == '\\' && *(that+1) != NUL)
 				    amount += lbr_chartabsize_adv(&that,
@@ -7530,7 +7544,7 @@ get_lisp_indent()
 	}
     }
     else
-	amount = 0;	/* no matching '(' found, use zero indent */
+	amount = 0;	/* no matching '(' or '[' found, use zero indent */
 
     curwin->w_cursor = realpos;
 
--- a/src/option.c
+++ b/src/option.c
@@ -1538,6 +1538,13 @@ static struct vimoption
     {"mousetime",   "mouset",	P_NUM|P_VI_DEF,
 			    (char_u *)&p_mouset, PV_NONE,
 			    {(char_u *)500L, (char_u *)0L}},
+    {"mzquantum",  "mzq",   P_NUM,
+#ifdef FEAT_MZSCHEME
+			    (char_u *)&p_mzq, PV_NONE,
+#else
+			    (char_u *)NULL, PV_NONE,
+#endif
+			    {(char_u *)100L, (char_u *)100L}},
     {"novice",	    NULL,   P_BOOL|P_VI_DEF,
 			    (char_u *)NULL, PV_NONE,
 			    {(char_u *)FALSE, (char_u *)0L}},
@@ -6807,6 +6814,10 @@ set_num_option(opt_idx, varp, value, err
 	if (p_uc && !old_value)
 	    ml_open_files();
     }
+#if defined(FEAT_MZSCHEME) && defined(FEAT_GUI)
+    else if (pp == &p_mzq)
+	mzvim_reset_timer();
+#endif
 
     /* sync undo before 'undolevels' changes */
     else if (pp == &p_ul)
@@ -7081,7 +7092,7 @@ findoption(arg)
     return opt_idx;
 }
 
-#if defined(FEAT_EVAL) || defined(FEAT_TCL)
+#if defined(FEAT_EVAL) || defined(FEAT_TCL) || defined(FEAT_MZSCHEME)
 /*
  * Get the value for an option.
  *
--- a/src/option.h
+++ b/src/option.h
@@ -572,6 +572,9 @@ EXTERN int	p_mh;		/* 'mousehide' */
 EXTERN char_u	*p_mousem;	/* 'mousemodel' */
 EXTERN long	p_mouset;	/* 'mousetime' */
 EXTERN int	p_more;		/* 'more' */
+#ifdef FEAT_MZSCHEME
+EXTERN long	p_mzq;		/* 'mzquantum */
+#endif
 EXTERN char_u	*p_para;	/* 'paragraphs' */
 EXTERN int	p_paste;	/* 'paste' */
 EXTERN char_u	*p_pt;		/* 'pastetoggle' */
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -31,6 +31,10 @@
 
 #include "vim.h"
 
+#ifdef FEAT_MZSCHEME
+# include "if_mzsch.h"
+#endif
+
 #ifdef HAVE_FCNTL_H
 # include <fcntl.h>
 #endif
@@ -260,7 +264,8 @@ static struct signalinfo
 #ifdef SIGVTALRM
     {SIGVTALRM,	    "VTALRM",	TRUE},
 #endif
-#ifdef SIGPROF
+#if defined(SIGPROF) && !defined(FEAT_MZSCHEME)
+    /* MzScheme uses SIGPROF for its own needs */
     {SIGPROF,	    "PROF",	TRUE},
 #endif
 #ifdef SIGXCPU
@@ -520,6 +525,9 @@ mch_delay(msec, ignoreinput)
     int		ignoreinput;
 {
     int		old_tmode;
+#ifdef FEAT_MZSCHEME
+    long	total = msec; /* remember original value */
+#endif
 
     if (ignoreinput)
     {
@@ -534,6 +542,16 @@ mch_delay(msec, ignoreinput)
 	 * Prefer nanosleep(), some versions of usleep() can only sleep up to
 	 * one second.
 	 */
+#ifdef FEAT_MZSCHEME
+	do
+	{
+	    /* if total is large enough, wait by portions in p_mzq */
+	    if (total > p_mzq)
+		msec = p_mzq;
+	    else
+		msec = total;
+	    total -= msec;
+#endif
 #ifdef HAVE_NANOSLEEP
 	{
 	    struct timespec ts;
@@ -572,6 +590,10 @@ mch_delay(msec, ignoreinput)
 #  endif /* HAVE_SELECT */
 # endif /* HAVE_NANOSLEEP */
 #endif /* HAVE_USLEEP */
+#ifdef FEAT_MZSCHEME
+	}
+	while (total > 0);
+#endif
 
 	settmode(old_tmode);
     }
@@ -4066,7 +4088,7 @@ RealWaitForChar(fd, msec, check_for_gpm)
     int		*check_for_gpm;
 {
     int		ret;
-#if defined(FEAT_XCLIPBOARD) || defined(USE_XSMP)
+#if defined(FEAT_XCLIPBOARD) || defined(USE_XSMP) || defined(FEAT_MZSCHEME)
     static int	busy = FALSE;
 
     /* May retry getting characters after an event was handled. */
@@ -4081,12 +4103,18 @@ RealWaitForChar(fd, msec, check_for_gpm)
     if (msec > 0 && (
 #  ifdef FEAT_XCLIPBOARD
 	    xterm_Shell != (Widget)0
-#   ifdef USE_XSMP
+#   if defined(USE_XSMP) || defined(FEAT_MZSCHEME)
 	    ||
 #   endif
 #  endif
 #  ifdef USE_XSMP
 	    xsmp_icefd != -1
+#   ifdef FEAT_MZSCHEME
+	    ||
+#   endif
+#  endif
+#  ifdef FEAT_MZSCHEME
+	(mzthreads_allowed() && p_mzq > 0)
 #  endif
 	    ))
 	gettimeofday(&start_tv, NULL);
@@ -4104,6 +4132,9 @@ RealWaitForChar(fd, msec, check_for_gpm)
     {
 #ifdef MAY_LOOP
 	int		finished = TRUE; /* default is to 'loop' just once */
+# ifdef FEAT_MZSCHEME
+	int		mzquantum_used = FALSE;
+# endif
 #endif
 #ifndef HAVE_SELECT
 	struct pollfd   fds[5];
@@ -4117,7 +4148,16 @@ RealWaitForChar(fd, msec, check_for_gpm)
 # ifdef USE_XSMP
 	int		xsmp_idx = -1;
 # endif
-
+	int		towait = (int)msec;
+
+# ifdef FEAT_MZSCHEME
+	mzvim_check_threads();
+	if (mzthreads_allowed() && p_mzq > 0 && (msec < 0 || msec > p_mzq))
+	{
+	    towait = (int)p_mzq;    /* don't wait longer than 'mzquantum' */
+	    mzquantum_used = TRUE;
+	}
+# endif
 	fds[0].fd = fd;
 	fds[0].events = POLLIN;
 	nfd = 1;
@@ -4159,7 +4199,12 @@ RealWaitForChar(fd, msec, check_for_gpm)
 	}
 # endif
 
-	ret = poll(fds, nfd, (int)msec);
+	ret = poll(fds, nfd, towait);
+# ifdef FEAT_MZSCHEME
+	if (ret == 0 && mzquantum_used)
+	    /* MzThreads scheduling is required and timeout occured */
+	    finished = FALSE;
+# endif
 
 # ifdef FEAT_SNIFF
 	if (ret < 0)
@@ -4203,8 +4248,7 @@ RealWaitForChar(fd, msec, check_for_gpm)
 		xsmp_close();
 	    }
 	    if (--ret == 0)
-		/* Try again */
-		finished = FALSE;
+		finished = FALSE;	/* Try again */
 	}
 # endif
 
@@ -4212,9 +4256,19 @@ RealWaitForChar(fd, msec, check_for_gpm)
 #else /* HAVE_SELECT */
 
 	struct timeval  tv;
+	struct timeval	*tvp;
 	fd_set		rfds, efds;
 	int		maxfd;
-
+	long		towait = msec;
+
+# ifdef FEAT_MZSCHEME
+	mzvim_check_threads();
+	if (mzthreads_allowed() && p_mzq > 0 && (msec < 0 || msec > p_mzq))
+	{
+	    towait = p_mzq;	/* don't wait longer than 'mzquantum' */
+	    mzquantum_used = TRUE;
+	}
+# endif
 # ifdef __EMX__
 	/* don't check for incoming chars if not in raw mode, because select()
 	 * always returns TRUE then (in some version of emx.dll) */
@@ -4222,11 +4276,14 @@ RealWaitForChar(fd, msec, check_for_gpm)
 	    return 0;
 # endif
 
-	if (msec >= 0)
+	if (towait >= 0)
 	{
-	    tv.tv_sec = msec / 1000;
-	    tv.tv_usec = (msec % 1000) * (1000000/1000);
+	    tv.tv_sec = towait / 1000;
+	    tv.tv_usec = (towait % 1000) * (1000000/1000);
+	    tvp = &tv;
 	}
+	else
+	    tvp = NULL;
 
 	/*
 	 * Select on ready for reading and exceptional condition (end of file).
@@ -4281,7 +4338,12 @@ RealWaitForChar(fd, msec, check_for_gpm)
 	 * required. Should not be used */
 	ret = 0;
 # else
-	ret = select(maxfd + 1, &rfds, NULL, &efds, (msec >= 0) ? &tv : NULL);
+	ret = select(maxfd + 1, &rfds, NULL, &efds, tvp);
+# endif
+# ifdef FEAT_MZSCHEME
+	if (ret == 0 && mzquantum_used)
+	    /* loop if MzThreads must be scheduled and timeout occured */
+	    finished = FALSE;
 # endif
 
 # ifdef FEAT_SNIFF
--- a/src/os_win32.c
+++ b/src/os_win32.c
@@ -23,6 +23,10 @@
 #include <io.h>
 #include "vim.h"
 
+#ifdef FEAT_MZSCHEME
+# include "if_mzsch.h"
+#endif
+
 #ifdef HAVE_FCNTL_H
 # include <fcntl.h>
 #endif
@@ -1097,6 +1101,9 @@ WaitForChar(long msec)
      */
     for (;;)
     {
+#ifdef FEAT_MZSCHEME
+	mzvim_check_threads();
+#endif
 #ifdef FEAT_CLIENTSERVER
 	serverProcessPendingMessages();
 #endif
@@ -1119,14 +1126,20 @@ WaitForChar(long msec)
 	}
 	if (msec != 0)
 	{
+	    DWORD dwWaitTime = dwEndTime - dwNow;
+
+#ifdef FEAT_MZSCHEME
+	    if (mzthreads_allowed() && p_mzq > 0
+				    && (msec < 0 || (long)dwWaitTime > p_mzq))
+		dwWaitTime = p_mzq; /* don't wait longer than 'mzquantum' */
+#endif
 #ifdef FEAT_CLIENTSERVER
 	    /* Wait for either an event on the console input or a message in
 	     * the client-server window. */
 	    if (MsgWaitForMultipleObjects(1, &g_hConIn, FALSE,
-			  dwEndTime - dwNow, QS_SENDMESSAGE) != WAIT_OBJECT_0)
+				 dwWaitTime, QS_SENDMESSAGE) != WAIT_OBJECT_0)
 #else
-	    if (WaitForSingleObject(g_hConIn, dwEndTime - dwNow)
-							     != WAIT_OBJECT_0)
+	    if (WaitForSingleObject(g_hConIn, dwWaitTime) != WAIT_OBJECT_0)
 #endif
 		    continue;
 	}
@@ -4106,9 +4119,26 @@ mch_delay(
 {
 #ifdef FEAT_GUI_W32
     Sleep((int)msec);	    /* never wait for input */
-#else
+#else /* Console */
     if (ignoreinput)
-	Sleep((int)msec);
+# ifdef FEAT_MZSCHEME
+	if (mzthreads_allowed() && p_mzq > 0 && msec > p_mzq)
+	{
+	    int towait = p_mzq;
+
+	    /* if msec is large enough, wait by portions in p_mzq */
+	    while (msec > 0)
+	    {
+		mzvim_check_threads();
+		if (msec < towait)
+		    towait = msec;
+		Sleep(towait);
+		msec -= towait;
+	    }
+	}
+	else
+# endif
+	    Sleep((int)msec);
     else
 	WaitForChar(msec);
 #endif
--- a/src/proto.h
+++ b/src/proto.h
@@ -146,6 +146,10 @@ void qsort __ARGS((void *base, size_t el
 # include "version.pro"
 # include "window.pro"
 
+# ifdef FEAT_MZSCHEME
+#  include "if_mzsch.pro"
+# endif
+
 # ifdef FEAT_PYTHON
 #  include "if_python.pro"
 # endif
new file mode 100644
--- /dev/null
+++ b/src/proto/if_mzsch.pro
@@ -0,0 +1,19 @@
+/* if_mzsch.c */
+int mzscheme_enabled __ARGS((int verbose));
+void mzscheme_end __ARGS((void));
+void ex_mzscheme __ARGS((exarg_T *eap));
+void ex_mzfile __ARGS((exarg_T *eap));
+void mzscheme_buffer_free __ARGS((buf_T *buf));
+void mzscheme_window_free __ARGS((win_T *win));
+char *mzscheme_version __ARGS((void));
+void raise_vim_exn(const char *add_info);
+void raise_if_error __ARGS((void));
+buf_T *get_valid_buffer __ARGS((void *));
+win_T *get_valid_window __ARGS((void *));
+void mzvim_check_threads __ARGS((void));
+void mzvim_reset_timer __ARGS((void));
+void *mzvim_eval_string __ARGS((char_u *str));
+struct Scheme_Object *mzvim_apply __ARGS((struct Scheme_Object *, int argc,
+    struct Scheme_Object **));
+int mzthreads_allowed (void);
+/* vim: set ft=c : */
--- a/src/search.c
+++ b/src/search.c
@@ -1558,6 +1558,10 @@ findmatchlimit(oap, initc, flags, maxtra
     int		match_escaped = 0;	/* search for escaped match */
     int		dir;			/* Direction to search */
     int		comment_col = MAXCOL;   /* start of / / comment */
+#ifdef FEAT_LISP
+    int		lispcomm = FALSE;	/* inside of Lisp-style comment */
+    int		lisp = curbuf->b_p_lisp; /* engage Lisp-specific hacks ;) */
+#endif
 
     pos = curwin->w_cursor;
     linep = ml_get(pos.lnum);
@@ -1822,8 +1826,16 @@ findmatchlimit(oap, initc, flags, maxtra
     do_quotes = -1;
     start_in_quotes = MAYBE;
     /* backward search: Check if this line contains a single-line comment */
-    if (backwards && comment_dir)
+    if ((backwards && comment_dir)
+#ifdef FEAT_LISP
+	    || lisp
+#endif
+	    )
 	comment_col = check_linecomment(linep);
+#ifdef FEAT_LISP
+    if (lisp && comment_col != MAXCOL && pos.col > (colnr_T)comment_col)
+	lispcomm = TRUE;    /* find match inside this comment */
+#endif
     while (!got_int)
     {
 	/*
@@ -1832,6 +1844,11 @@ findmatchlimit(oap, initc, flags, maxtra
 	 */
 	if (backwards)
 	{
+#ifdef FEAT_LISP
+	    /* char to match is inside of comment, don't search outside */
+	    if (lispcomm && pos.col < (colnr_T)comment_col)
+		break;
+#endif
 	    if (pos.col == 0)		/* at start of line, go to prev. one */
 	    {
 		if (pos.lnum == 1)	/* start of file */
@@ -1847,8 +1864,17 @@ findmatchlimit(oap, initc, flags, maxtra
 		line_breakcheck();
 
 		/* Check if this line contains a single-line comment */
-		if (comment_dir)
+		if (comment_dir
+#ifdef FEAT_LISP
+			|| lisp
+#endif
+			)
 		    comment_col = check_linecomment(linep);
+#ifdef FEAT_LISP
+		/* skip comment */
+		if (lisp && comment_col != MAXCOL)
+		    pos.col = comment_col;
+#endif
 	    }
 	    else
 	    {
@@ -1861,9 +1887,22 @@ findmatchlimit(oap, initc, flags, maxtra
 	}
 	else				/* forward search */
 	{
-	    if (linep[pos.col] == NUL)	/* at end of line, go to next one */
+	    if (linep[pos.col] == NUL
+		    /* at end of line, go to next one */
+#ifdef FEAT_LISP
+		    /* don't search for match in comment */
+		    || (lisp && comment_col != MAXCOL
+					   && pos.col == (colnr_T)comment_col)
+#endif
+		    )
 	    {
-		if (pos.lnum == curbuf->b_ml.ml_line_count) /* end of file */
+		if (pos.lnum == curbuf->b_ml.ml_line_count  /* end of file */
+#ifdef FEAT_LISP
+			/* line is exhausted and comment with it,
+			 * don't search for match in code */
+			 || lispcomm
+#endif
+			 )
 		    break;
 		++pos.lnum;
 
@@ -1874,6 +1913,10 @@ findmatchlimit(oap, initc, flags, maxtra
 		pos.col = 0;
 		do_quotes = -1;
 		line_breakcheck();
+#ifdef FEAT_LISP
+		if (lisp)   /* find comment pos in new line */
+		    comment_col = check_linecomment(linep);
+#endif
 	    }
 	    else
 	    {
@@ -2094,11 +2137,15 @@ findmatchlimit(oap, initc, flags, maxtra
 
 	default:
 #ifdef FEAT_LISP
-	    /* For Lisp skip over backslashed (), {} and []. */
+	    /*
+	     * For Lisp skip over backslashed (), {} and [].
+	     * (actually, we skip #\( et al)
+	     */
 	    if (curbuf->b_p_lisp
 		    && vim_strchr((char_u *)"(){}[]", c) != NULL
-		    && pos.col > 0
-		    && check_prevcol(linep, pos.col, '\\', NULL))
+		    && pos.col > 1
+		    && check_prevcol(linep, pos.col, '\\', NULL)
+		    && check_prevcol(linep, pos.col - 1, '#', NULL))
 		break;
 #endif
 
@@ -2151,6 +2198,40 @@ check_linecomment(line)
     char_u  *p;
 
     p = line;
+#ifdef FEAT_LISP
+    /* skip Lispish one-line comments */
+    if (curbuf->b_p_lisp)
+    {
+	if (vim_strchr(p, ';') != NULL) /* there may be comments */
+	{
+	    int instr = FALSE;	/* inside of string */
+
+	    p = line;		/* scan from start */
+	    while ((p = vim_strpbrk(p, "\";")) != NULL)
+	    {
+		if (*p == '"')
+		{
+		    if (instr)
+		    {
+			if (*(p - 1) != '\\') /* skip escaped quote */
+			    instr = FALSE;
+		    }
+		    else if (p == line || ((p - line) >= 2
+				      /* skip #\" form */
+				      && *(p - 1) != '\\' && *(p - 2) != '#'))
+			instr = TRUE;
+		}
+		else if (!instr && ((p - line) < 2
+				    || (*(p - 1) != '\\' && *(p - 2) != '#')))
+		    break;	/* found! */
+		++p;
+	    }
+	}
+	else
+	    p = NULL;
+    }
+    else
+#endif
     while ((p = vim_strchr(p, '/')) != NULL)
     {
 	if (p[1] == '/')
--- a/src/structs.h
+++ b/src/structs.h
@@ -1209,12 +1209,16 @@ struct file_buffer
     int		b_shortname;	/* this file has an 8.3 file name */
 #endif
 
+#ifdef FEAT_MZSCHEME
+    void	*mzscheme_ref;	/* The MzScheme reference to this buffer */
+#endif
+
 #ifdef FEAT_PERL
     void	*perl_private;
 #endif
 
 #ifdef FEAT_PYTHON
-    void	*python_ref;	/* The Python value referring to this buffer */
+    void	*python_ref;	/* The Python reference to this buffer */
 #endif
 
 #ifdef FEAT_TCL
@@ -1591,6 +1595,11 @@ struct window
     int		w_nrwidth_width;	/* nr of chars to print line count. */
 #endif
 
+
+#ifdef FEAT_MZSCHEME
+    void	    *mzscheme_ref;	/* The MzScheme value referring to this window */
+#endif
+
 #ifdef FEAT_PERL
     void	*perl_private;
 #endif
--- a/src/version.c
+++ b/src/version.c
@@ -370,6 +370,11 @@ static char *(features[]) =
 #else
 	"-multi_lang",
 #endif
+#ifdef FEAT_MZSCHEME
+	"+mzscheme",
+#else
+	"-mzscheme",
+#endif
 #ifdef FEAT_NETBEANS_INTG
 	"+netbeans_intg",
 #else
--- a/src/vim.h
+++ b/src/vim.h
@@ -15,6 +15,7 @@
     defined(FEAT_PYTHON) || \
     defined(FEAT_RUBY) || \
     defined(FEAT_TCL) || \
+    defined(FEAT_MZSCHEME) || \
     defined(DYNAMIC_GETTEXT) || \
     defined(DYNAMIC_ICONV) || \
     defined(DYNAMIC_IME) || \
--- a/src/window.c
+++ b/src/window.c
@@ -3106,6 +3106,10 @@ win_free(wp)
 {
     int		i;
 
+#ifdef FEAT_MZSCHEME
+    mzscheme_window_free(wp);
+#endif
+
 #ifdef FEAT_PERL
     perl_win_free(wp);
 #endif