#!/bin/sh
# Use this script to patch ncurses 5.9 to 5.9 (20130504)
# Run this script inside the ncurses 5.9 source directory et voila! Updated.

if ( egrep '^NCURSES_MAJOR = 5$' dist.mk >/dev/null 2>&1 \
  && egrep '^NCURSES_MINOR = 9$' dist.mk >/dev/null 2>&1 \
  && egrep '^NCURSES_PATCH = 20110404$' dist.mk >/dev/null 2>&1 )
then
        echo patching...
	rm -f mk-dlls.sh.in
	rm -f ncurses/base/memmove.c
	rm -f ncurses/tinfo/setbuf.c
	rm -f ncurses/tty/tty_display.h
	rm -f ncurses/tty/tty_input.h
else
        echo 'This does not look like ncurses 5.9'
        exit 1
fi

patch -p1 -i $0         # shell command = this script = inputfile for patch
exit

# patch by Thomas E. Dickey <dickey@invisible-island.net>
# created  Sun May  5 16:20:54 UTC 2013
# ------------------------------------------------------------------------------
# Ada95/aclocal.m4                                  | 1081 -
# Ada95/configure                                   | 4663 +++--
# Ada95/configure.in                                |  115 
# Ada95/doc/Makefile.in                             |    3 
# Ada95/gen/Makefile.in                             |   12 
# Ada95/gen/gen.c                                   |   45 
# Ada95/include/ncurses_defs                        |    7 
# Ada95/samples/Makefile.in                         |    7 
# Ada95/src/Makefile.in                             |   32 
# INSTALL                                           |  100 
# MANIFEST                                          |   27 
# Makefile.in                                       |   13 
# NEWS                                              | 1234 +
# README                                            |   17 
# README.MinGW                                      |   95 
# aclocal.m4                                        | 1517 +
# announce.html.in                                  |   63 
# c++/Makefile.in                                   |  111 
# c++/cursesapp.h                                   |   21 
# c++/cursesf.cc                                    |   12 
# c++/cursesf.h                                     |   14 
# c++/cursesm.cc                                    |   10 
# c++/cursesm.h                                     |   13 
# c++/cursesp.h                                     |    6 
# c++/cursespad.cc                                  |   56 
# c++/cursesw.cc                                    |    7 
# c++/cursesw.h                                     |   11 
# c++/cursslk.cc                                    |    9 
# c++/demo.cc                                       |    9 
# c++/etip.h.in                                     |   18 
# c++/internal.h                                    |    6 
# c++/modules                                       |   21 
# config.guess                                      |  253 
# config.sub                                        |  200 
# configure                                         | 7253 +++++---
# configure.in                                      |  510 
# dist.mk                                           |    6 
# doc/html/man/adacurses-config.1.html              |    2 
# doc/html/man/captoinfo.1m.html                    |   11 
# doc/html/man/clear.1.html                         |    2 
# doc/html/man/curs_add_wch.3x.html                 |   24 
# doc/html/man/curs_add_wchstr.3x.html              |   79 
# doc/html/man/curs_addch.3x.html                   |    5 
# doc/html/man/curs_addchstr.3x.html                |   67 
# doc/html/man/curs_addstr.3x.html                  |   47 
# doc/html/man/curs_addwstr.3x.html                 |   54 
# doc/html/man/curs_attr.3x.html                    |    2 
# doc/html/man/curs_bkgrnd.3x.html                  |    6 
# doc/html/man/curs_border_set.3x.html              |    6 
# doc/html/man/curs_get_wch.3x.html                 |    6 
# doc/html/man/curs_get_wstr.3x.html                |    6 
# doc/html/man/curs_getcchar.3x.html                |    6 
# doc/html/man/curs_getch.3x.html                   |   22 
# doc/html/man/curs_in_wchstr.3x.html               |    6 
# doc/html/man/curs_inopts.3x.html                  |   52 
# doc/html/man/curs_ins_wstr.3x.html                |    6 
# doc/html/man/curs_inwstr.3x.html                  |    6 
# doc/html/man/curs_mouse.3x.html                   |    4 
# doc/html/man/curs_sp_funcs.3x.html                |   50 
# doc/html/man/curs_termattrs.3x.html               |   10 
# doc/html/man/curs_termcap.3x.html                 |  129 
# doc/html/man/curs_terminfo.3x.html                |    6 
# doc/html/man/curs_threads.3x.html                 |    8 
# doc/html/man/curs_util.3x.html                    |   91 
# doc/html/man/form.3x.html                         |    2 
# doc/html/man/form_field.3x.html                   |    6 
# doc/html/man/form_field_buffer.3x.html            |    4 
# doc/html/man/form_fieldtype.3x.html               |    4 
# doc/html/man/infocmp.1m.html                      |  284 
# doc/html/man/infotocap.1m.html                    |    6 
# doc/html/man/menu.3x.html                         |    2 
# doc/html/man/menu_driver.3x.html                  |   46 
# doc/html/man/menu_items.3x.html                   |    6 
# doc/html/man/ncurses.3x.html                      |  611 
# doc/html/man/ncurses5-config.1.html               |    7 
# doc/html/man/panel.3x.html                        |   40 
# doc/html/man/resizeterm.3x.html                   |    8 
# doc/html/man/tabs.1.html                          |    6 
# doc/html/man/term.7.html                          |   10 
# doc/html/man/term_variables.3x.html               |    4 
# doc/html/man/terminfo.5.html                      | 1319 -
# doc/html/man/tic.1m.html                          |  271 
# doc/html/man/toe.1m.html                          |   16 
# doc/html/man/tput.1.html                          |  128 
# doc/html/man/tset.1.html                          |  149 
# doc/html/ncurses-intro.html                       |    5 
# doc/ncurses-intro.doc                             |    1 
# form/Makefile.in                                  |    7 
# form/fld_arg.c                                    |    6 
# form/fld_def.c                                    |   27 
# form/fld_dup.c                                    |    8 
# form/fld_ftchoice.c                               |    6 
# form/fld_ftlink.c                                 |   10 
# form/fld_just.c                                   |    6 
# form/fld_link.c                                   |    8 
# form/fld_max.c                                    |    8 
# form/fld_move.c                                   |    8 
# form/fld_page.c                                   |    8 
# form/fld_stat.c                                   |    8 
# form/form.priv.h                                  |    9 
# form/frm_def.c                                    |   24 
# form/frm_driver.c                                 |  164 
# form/frm_hook.c                                   |    6 
# form/frm_opts.c                                   |   10 
# form/frm_page.c                                   |    6 
# form/frm_post.c                                   |    8 
# form/frm_req_name.c                               |   21 
# form/fty_generic.c                                |    6 
# form/fty_int.c                                    |    7 
# form/fty_num.c                                    |    7 
# form/fty_regex.c                                  |   14 
# include/Caps                                      |   18 
# include/Caps.aix4                                 |   18 
# include/Caps.hpux11                               |   18 
# include/Caps.keys                                 |   18 
# include/Caps.osf1r5                               |    6 
# include/MKkey_defs.sh                             |    9 
# include/MKterm.h.awk.in                           |   39 
# include/curses.h.in                               |  220 
# include/curses.tail                               |    4 
# include/curses.wide                               |  140 
# include/headers                                   |   17 
# include/nc_alloc.h                                |   14 
# include/nc_tparm.h                                |    8 
# include/ncurses_defs                              |   19 
# include/ncurses_mingw.h                           |  100 
# include/term_entry.h                              |   66 
# include/tic.h                                     |   35 
# man/Makefile.in                                   |    3 
# man/curs_add_wch.3x                               |    6 
# man/curs_add_wchstr.3x                            |   64 
# man/curs_addchstr.3x                              |   50 
# man/curs_addstr.3x                                |   38 
# man/curs_addwstr.3x                               |   35 
# man/curs_bkgrnd.3x                                |    6 
# man/curs_border_set.3x                            |    6 
# man/curs_get_wch.3x                               |    6 
# man/curs_get_wstr.3x                              |    6 
# man/curs_getcchar.3x                              |    6 
# man/curs_getch.3x                                 |   12 
# man/curs_in_wchstr.3x                             |    6 
# man/curs_inopts.3x                                |   47 
# man/curs_ins_wstr.3x                              |    6 
# man/curs_inwstr.3x                                |    6 
# man/curs_overlay.3x                               |   26 
# man/curs_termcap.3x                               |   61 
# man/curs_terminfo.3x                              |    8 
# man/curs_threads.3x                               |    8 
# man/curs_util.3x                                  |   88 
# man/form_field.3x                                 |    6 
# man/infocmp.1m                                    |  176 
# man/menu_items.3x                                 |    6 
# man/ncurses.3x                                    |  142 
# man/resizeterm.3x                                 |    6 
# man/tabs.1                                        |   20 
# man/term.7                                        |    6 
# man/term_variables.3x                             |    6 
# man/terminfo.head                                 |   15 
# man/terminfo.tail                                 |  188 
# man/tic.1m                                        |  200 
# man/toe.1m                                        |   21 
# man/tput.1                                        |   35 
# man/tset.1                                        |   39 
# menu/Makefile.in                                  |    7 
# menu/m_attribs.c                                  |    6 
# menu/m_driver.c                                   |   12 
# menu/m_format.c                                   |   20 
# menu/m_global.c                                   |   38 
# menu/m_hook.c                                     |    6 
# menu/m_item_new.c                                 |   21 
# menu/m_pad.c                                      |    6 
# menu/m_post.c                                     |   40 
# menu/m_req_name.c                                 |   19 
# menu/m_spacing.c                                  |   10 
# menu/menu.priv.h                                  |   15 
# menu/mf_common.h                                  |   18 
# misc/Makefile.in                                  |   10 
# misc/gen-pkgconfig.in                             |   86 
# misc/gen_edit.sh                                  |   72 
# misc/ncurses-config.in                            |   49 
# misc/run_tic.in                                   |    7 
# misc/terminfo.src                                 | 1357 +
# mk-0th.awk                                        |   91 
# mk-1st.awk                                        |  118 
# ncurses-5.9-20130504/include/nc_string.h          |   77 
# ncurses-5.9-20130504/include/nc_termios.h         |  171 
# ncurses-5.9-20130504/ncurses/llib-ltic            |  212 
# ncurses-5.9-20130504/ncurses/llib-ltictw          |  212 
# ncurses-5.9-20130504/ncurses/llib-lticw           |  212 
# ncurses-5.9-20130504/ncurses/llib-ltinfo          | 1504 +
# ncurses-5.9-20130504/ncurses/llib-ltinfotw        | 1646 +
# ncurses-5.9-20130504/ncurses/llib-ltinfow         | 1537 +
# ncurses-5.9-20130504/ncurses/tinfo/obsolete.c     |  102 
# ncurses-5.9-20130504/ncurses/widechar/widechars.c |  152 
# ncurses-5.9-20130504/package/debian/changelog     |   11 
# ncurses-5.9-20130504/package/debian/compat        |    1 
# ncurses-5.9-20130504/package/debian/control       |   16 
# ncurses-5.9-20130504/package/debian/copyright     |  112 
# ncurses-5.9-20130504/package/debian/rules         |  123 
# ncurses-5.9-20130504/package/debian/source/format |    1 
# ncurses-5.9-20130504/package/debian/watch         |    4 
# ncurses-5.9-20130504/package/ncurses.spec         |   92 
# ncurses-5.9-20130504/test/color_name.h            |  103 
# ncurses-5.9-20130504/test/test_vid_puts.c         |  148 
# ncurses-5.9-20130504/test/test_vidputs.c          |  148 
# ncurses-5.9-20130504/test/widechars.h             |   71 
# ncurses/Makefile.in                               |   22 
# ncurses/base/MKkeyname.awk                        |   13 
# ncurses/base/MKlib_gen.sh                         |   43 
# ncurses/base/MKunctrl.awk                         |    6 
# ncurses/base/keybound.c                           |    9 
# ncurses/base/keyok.c                              |   66 
# ncurses/base/lib_addch.c                          |   16 
# ncurses/base/lib_addstr.c                         |   10 
# ncurses/base/lib_beep.c                           |   11 
# ncurses/base/lib_bkgd.c                           |   11 
# ncurses/base/lib_color.c                          |   89 
# ncurses/base/lib_dft_fgbg.c                       |    5 
# ncurses/base/lib_driver.c                         |   22 
# ncurses/base/lib_flash.c                          |   20 
# ncurses/base/lib_freeall.c                        |   20 
# ncurses/base/lib_getch.c                          |   39 
# ncurses/base/lib_getstr.c                         |    6 
# ncurses/base/lib_insch.c                          |    8 
# ncurses/base/lib_instr.c                          |   14 
# ncurses/base/lib_mouse.c                          |  415 
# ncurses/base/lib_newterm.c                        |   11 
# ncurses/base/lib_newwin.c                         |   17 
# ncurses/base/lib_overlay.c                        |   21 
# ncurses/base/lib_printw.c                         |   34 
# ncurses/base/lib_refresh.c                        |   17 
# ncurses/base/lib_restart.c                        |   10 
# ncurses/base/lib_scanw.c                          |    6 
# ncurses/base/lib_screen.c                         |   19 
# ncurses/base/lib_scroll.c                         |    8 
# ncurses/base/lib_set_term.c                       |   41 
# ncurses/base/lib_slkrefr.c                        |   22 
# ncurses/base/lib_slkset.c                         |   17 
# ncurses/base/lib_touch.c                          |    6 
# ncurses/base/lib_ungetch.c                        |   11 
# ncurses/base/resizeterm.c                         |   83 
# ncurses/base/safe_sprintf.c                       |   20 
# ncurses/base/vsscanf.c                            |    8 
# ncurses/base/wresize.c                            |    9 
# ncurses/build.priv.h                              |    6 
# ncurses/curses.priv.h                             |  280 
# ncurses/fifo_defs.h                               |   46 
# ncurses/llib-lncurses                             |   11 
# ncurses/llib-lncursest                            |   11 
# ncurses/llib-lncursestw                           |   11 
# ncurses/llib-lncursesw                            |   11 
# ncurses/modules                                   |    8 
# ncurses/tinfo/MKcaptab.sh                         |   10 
# ncurses/tinfo/access.c                            |   43 
# ncurses/tinfo/alloc_entry.c                       |   31 
# ncurses/tinfo/alloc_ttype.c                       |   52 
# ncurses/tinfo/captoinfo.c                         |  212 
# ncurses/tinfo/comp_error.c                        |   20 
# ncurses/tinfo/comp_expand.c                       |   19 
# ncurses/tinfo/comp_parse.c                        |  189 
# ncurses/tinfo/comp_scan.c                         |  169 
# ncurses/tinfo/db_iterator.c                       |  413 
# ncurses/tinfo/doalloc.c                           |   21 
# ncurses/tinfo/entries.c                           |   11 
# ncurses/tinfo/getenv_num.c                        |   21 
# ncurses/tinfo/hashed_db.c                         |  159 
# ncurses/tinfo/home_terminfo.c                     |   10 
# ncurses/tinfo/lib_acs.c                           |    7 
# ncurses/tinfo/lib_cur_term.c                      |    7 
# ncurses/tinfo/lib_data.c                          |   14 
# ncurses/tinfo/lib_napms.c                         |   12 
# ncurses/tinfo/lib_options.c                       |   39 
# ncurses/tinfo/lib_print.c                         |   10 
# ncurses/tinfo/lib_raw.c                           |   35 
# ncurses/tinfo/lib_setup.c                         |  158 
# ncurses/tinfo/lib_termcap.c                       |   39 
# ncurses/tinfo/lib_tgoto.c                         |    9 
# ncurses/tinfo/lib_tparm.c                         |   28 
# ncurses/tinfo/lib_tputs.c                         |   92 
# ncurses/tinfo/lib_ttyflags.c                      |   10 
# ncurses/tinfo/make_hash.c                         |   51 
# ncurses/tinfo/make_keys.c                         |    6 
# ncurses/tinfo/name_match.c                        |   42 
# ncurses/tinfo/parse_entry.c                       |   40 
# ncurses/tinfo/read_entry.c                        |  274 
# ncurses/tinfo/read_termcap.c                      |   85 
# ncurses/tinfo/strings.c                           |    8 
# ncurses/tinfo/tinfo_driver.c                      |  181 
# ncurses/tinfo/trim_sgr0.c                         |   85 
# ncurses/tinfo/write_entry.c                       |  103 
# ncurses/trace/lib_trace.c                         |   20 
# ncurses/trace/lib_traceatr.c                      |   44 
# ncurses/trace/lib_tracebits.c                     |   24 
# ncurses/trace/lib_tracechr.c                      |   15 
# ncurses/trace/lib_tracedmp.c                      |    8 
# ncurses/trace/lib_tracemse.c                      |   42 
# ncurses/trace/trace_buf.c                         |   11 
# ncurses/trace/trace_tries.c                       |   37 
# ncurses/trace/varargs.c                           |   23 
# ncurses/trace/visbuf.c                            |   48 
# ncurses/tty/hardscroll.c                          |   24 
# ncurses/tty/hashmap.c                             |    6 
# ncurses/tty/lib_mvcur.c                           |  115 
# ncurses/tty/lib_tstp.c                            |   55 
# ncurses/tty/lib_twait.c                           |   64 
# ncurses/tty/lib_vidattr.c                         |   50 
# ncurses/tty/tty_update.c                          |  264 
# ncurses/widechar/lib_box_set.c                    |    6 
# ncurses/widechar/lib_cchar.c                      |   16 
# ncurses/widechar/lib_get_wch.c                    |    9 
# ncurses/widechar/lib_get_wstr.c                   |    8 
# ncurses/widechar/lib_ins_wch.c                    |    6 
# ncurses/widechar/lib_inwstr.c                     |   11 
# ncurses/widechar/lib_slk_wset.c                   |   30 
# ncurses/widechar/lib_unget_wch.c                  |    6 
# ncurses/widechar/lib_vid_attr.c                   |   40 
# ncurses/widechar/lib_wacs.c                       |   38 
# ncurses/widechar/lib_wunctrl.c                    |   17 
# ncurses/win32con/win_driver.c                     |  385 
# panel/Makefile.in                                 |    8 
# panel/p_above.c                                   |    6 
# panel/p_below.c                                   |    6 
# panel/panel.c                                     |   12 
# panel/panel.priv.h                                |    8 
# progs/Makefile.in                                 |   30 
# progs/capconvert                                  |   24 
# progs/dump_entry.c                                |  205 
# progs/dump_entry.h                                |   14 
# progs/infocmp.c                                   |  467 
# progs/progs.priv.h                                |   22 
# progs/tabs.c                                      |   92 
# progs/tic.c                                       |  565 
# progs/toe.c                                       |  442 
# progs/tput.c                                      |    9 
# progs/transform.c                                 |   16 
# progs/tset.c                                      |   43 
# test/Makefile.in                                  |   10 
# test/README                                       |   52 
# test/aclocal.m4                                   | 1128 -
# test/background.c                                 |  228 
# test/blue.c                                       |   12 
# test/bs.c                                         |   60 
# test/cardfile.c                                   |   26 
# test/chgat.c                                      |    6 
# test/clip_printw.c                                |   11 
# test/color_set.c                                  |    6 
# test/configure                                    |16812 ++++++++++----------
# test/configure.in                                 |  189 
# test/demo_defkey.c                                |    6 
# test/demo_forms.c                                 |   25 
# test/demo_menus.c                                 |   33 
# test/demo_termcap.c                               |  289 
# test/demo_terminfo.c                              |  245 
# test/ditto.c                                      |   10 
# test/dots.c                                       |    8 
# test/dots_mvcur.c                                 |    8 
# test/echochar.c                                   |    6 
# test/filter.c                                     |    8 
# test/firework.c                                   |   16 
# test/gdc.c                                        |   20 
# test/hanoi.c                                      |   33 
# test/hashtest.c                                   |    6 
# test/inchs.c                                      |   16 
# test/ins_wide.c                                   |   34 
# test/insdelln.c                                   |    8 
# test/inserts.c                                    |   29 
# test/knight.c                                     |   70 
# test/linedata.h                                   |    6 
# test/modules                                      |    8 
# test/movewindow.c                                 |  227 
# test/ncurses.c                                    |  351 
# test/newdemo.c                                    |   23 
# test/programs                                     |    6 
# test/railroad.c                                   |    8 
# test/rain.c                                       |    8 
# test/redraw.c                                     |    6 
# test/tclock.c                                     |    6 
# test/test.priv.h                                  |  111 
# test/test_add_wchstr.c                            |   31 
# test/test_addchstr.c                              |   31 
# test/test_addstr.c                                |   29 
# test/test_addwstr.c                               |   34 
# test/test_getstr.c                                |   15 
# test/testaddch.c                                  |   12 
# test/testcurs.c                                   |   64 
# test/view.c                                       |   88 
# test/worm.c                                       |   28 
# test/xmas.c                                       |    6 
# 388 files changed, 39001 insertions(+), 21591 deletions(-)
# ------------------------------------------------------------------------------
# Please remove the following files before applying this patch.
# (You can feed this patch to 'sh' to do so.)

rm -f mk-dlls.sh.in
rm -f ncurses/base/memmove.c
rm -f ncurses/tinfo/setbuf.c
rm -f ncurses/tty/tty_display.h
rm -f ncurses/tty/tty_input.h
exit

Index: Ada95/aclocal.m4
Prereq:  1.24 
--- ncurses-5.9/Ada95/aclocal.m4	2011-03-31 23:32:36.000000000 +0000
+++ ncurses-5.9-20130504/Ada95/aclocal.m4	2013-04-13 23:00:18.000000000 +0000
@@ -1,5 +1,5 @@
 dnl***************************************************************************
-dnl Copyright (c) 2010,2011 Free Software Foundation, Inc.                   *
+dnl Copyright (c) 2010-2012,2013 Free Software Foundation, Inc.              *
 dnl                                                                          *
 dnl Permission is hereby granted, free of charge, to any person obtaining a  *
 dnl copy of this software and associated documentation files (the            *
@@ -28,7 +28,7 @@
 dnl
 dnl Author: Thomas E. Dickey
 dnl
-dnl $Id: aclocal.m4,v 1.24 2011/03/31 23:32:36 tom Exp $
+dnl $Id: aclocal.m4,v 1.66 2013/04/13 23:00:18 tom Exp $
 dnl Macros used in NCURSES Ada95 auto-configuration script.
 dnl
 dnl These macros are maintained separately from NCURSES.  The copyright on
@@ -39,6 +39,32 @@
 dnl
 dnl ---------------------------------------------------------------------------
 dnl ---------------------------------------------------------------------------
+dnl CF_ACVERSION_CHECK version: 4 updated: 2013/03/04 19:52:56
+dnl ------------------
+dnl Conditionally generate script according to whether we're using a given autoconf.
+dnl
+dnl $1 = version to compare against
+dnl $2 = code to use if AC_ACVERSION is at least as high as $1.
+dnl $3 = code to use if AC_ACVERSION is older than $1.
+define([CF_ACVERSION_CHECK],
+[
+ifdef([AC_ACVERSION], ,[m4_copy([m4_PACKAGE_VERSION],[AC_ACVERSION])])dnl
+ifdef([m4_version_compare],
+[m4_if(m4_version_compare(m4_defn([AC_ACVERSION]), [$1]), -1, [$3], [$2])],
+[CF_ACVERSION_COMPARE(
+AC_PREREQ_CANON(AC_PREREQ_SPLIT([$1])),
+AC_PREREQ_CANON(AC_PREREQ_SPLIT(AC_ACVERSION)), AC_ACVERSION, [$2], [$3])])])dnl
+dnl ---------------------------------------------------------------------------
+dnl CF_ACVERSION_COMPARE version: 3 updated: 2012/10/03 18:39:53
+dnl --------------------
+dnl CF_ACVERSION_COMPARE(MAJOR1, MINOR1, TERNARY1,
+dnl                      MAJOR2, MINOR2, TERNARY2,
+dnl                      PRINTABLE2, not FOUND, FOUND)
+define([CF_ACVERSION_COMPARE],
+[ifelse(builtin([eval], [$2 < $5]), 1,
+[ifelse([$8], , ,[$8])],
+[ifelse([$9], , ,[$9])])])dnl
+dnl ---------------------------------------------------------------------------
 dnl CF_ADA_INCLUDE_DIRS version: 6 updated: 2010/02/26 19:52:07
 dnl -------------------
 dnl Construct the list of include-options for the C programs in the Ada95
@@ -290,75 +316,34 @@
 }
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_ANSI_CC_CHECK version: 10 updated: 2010/10/23 15:52:32
-dnl ----------------
-dnl This is adapted from the macros 'fp_PROG_CC_STDC' and 'fp_C_PROTOTYPES'
-dnl in the sharutils 4.2 distribution.
-AC_DEFUN([CF_ANSI_CC_CHECK],
-[
-AC_CACHE_CHECK(for ${CC:-cc} option to accept ANSI C, cf_cv_ansi_cc,[
-cf_cv_ansi_cc=no
-cf_save_CFLAGS="$CFLAGS"
-cf_save_CPPFLAGS="$CPPFLAGS"
-# Don't try gcc -ansi; that turns off useful extensions and
-# breaks some systems' header files.
-# AIX			-qlanglvl=ansi
-# Ultrix and OSF/1	-std1
-# HP-UX			-Aa -D_HPUX_SOURCE
-# SVR4			-Xc
-# UnixWare 1.2		(cannot use -Xc, since ANSI/POSIX clashes)
-for cf_arg in "-DCC_HAS_PROTOS" \
-	"" \
-	-qlanglvl=ansi \
-	-std1 \
-	-Ae \
-	"-Aa -D_HPUX_SOURCE" \
-	-Xc
-do
-	CF_ADD_CFLAGS($cf_arg)
-	AC_TRY_COMPILE(
-[
-#ifndef CC_HAS_PROTOS
-#if !defined(__STDC__) || (__STDC__ != 1)
-choke me
-#endif
-#endif
-],[
-	int test (int i, double x);
-	struct s1 {int (*f) (int a);};
-	struct s2 {int (*f) (double a);};],
-	[cf_cv_ansi_cc="$cf_arg"; break])
-done
-CFLAGS="$cf_save_CFLAGS"
-CPPFLAGS="$cf_save_CPPFLAGS"
-])
-
-if test "$cf_cv_ansi_cc" != "no"; then
-if test ".$cf_cv_ansi_cc" != ".-DCC_HAS_PROTOS"; then
-	CF_ADD_CFLAGS($cf_cv_ansi_cc)
-else
-	AC_DEFINE(CC_HAS_PROTOS)
-fi
-fi
-])dnl
+dnl CF_ARG_DISABLE version: 3 updated: 1999/03/30 17:24:31
+dnl --------------
+dnl Allow user to disable a normally-on option.
+AC_DEFUN([CF_ARG_DISABLE],
+[CF_ARG_OPTION($1,[$2],[$3],[$4],yes)])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_ANSI_CC_REQD version: 4 updated: 2008/03/23 14:48:54
-dnl ---------------
-dnl For programs that must use an ANSI compiler, obtain compiler options that
-dnl will make it recognize prototypes.  We'll do preprocessor checks in other
-dnl macros, since tools such as unproto can fake prototypes, but only part of
-dnl the preprocessor.
-AC_DEFUN([CF_ANSI_CC_REQD],
-[AC_REQUIRE([CF_ANSI_CC_CHECK])
-if test "$cf_cv_ansi_cc" = "no"; then
-	AC_MSG_ERROR(
-[Your compiler does not appear to recognize prototypes.
-You have the following choices:
-	a. adjust your compiler options
-	b. get an up-to-date compiler
-	c. use a wrapper such as unproto])
-fi
+dnl CF_ARG_OPTION version: 4 updated: 2010/05/26 05:38:42
+dnl -------------
+dnl Restricted form of AC_ARG_ENABLE that ensures user doesn't give bogus
+dnl values.
+dnl
+dnl Parameters:
+dnl $1 = option name
+dnl $2 = help-string
+dnl $3 = action to perform if option is not default
+dnl $4 = action if perform if option is default
+dnl $5 = default option value (either 'yes' or 'no')
+AC_DEFUN([CF_ARG_OPTION],
+[AC_ARG_ENABLE([$1],[$2],[test "$enableval" != ifelse([$5],no,yes,no) && enableval=ifelse([$5],no,no,yes)
+  if test "$enableval" != "$5" ; then
+ifelse([$3],,[    :]dnl
+,[    $3]) ifelse([$4],,,[
+  else
+    $4])
+  fi],[enableval=$5 ifelse([$4],,,[
+  $4
 ])dnl
+  ])])dnl
 dnl ---------------------------------------------------------------------------
 dnl CF_AR_FLAGS version: 5 updated: 2010/05/20 20:24:29
 dnl -----------
@@ -413,7 +398,7 @@
 AC_SUBST(ARFLAGS)
 ])
 dnl ---------------------------------------------------------------------------
-dnl CF_BUILD_CC version: 6 updated: 2006/10/14 15:23:15
+dnl CF_BUILD_CC version: 7 updated: 2012/10/06 15:31:55
 dnl -----------
 dnl If we're cross-compiling, allow the user to override the tools and their
 dnl options.  The configure script is oriented toward identifying the host
@@ -423,7 +408,8 @@
 dnl $1 = default for $CPPFLAGS
 dnl $2 = default for $LIBS
 AC_DEFUN([CF_BUILD_CC],[
-AC_REQUIRE([CF_PROG_EXT])
+CF_ACVERSION_CHECK(2.52,,
+	[AC_REQUIRE([CF_PROG_EXT])])
 if test "$cross_compiling" = yes ; then
 
 	# defaults that we might want to override
@@ -504,7 +490,33 @@
 AC_SUBST(BUILD_OBJEXT)
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_CFG_DEFAULTS version: 7 updated: 2005/09/24 16:15:00
+dnl CF_CC_ENV_FLAGS version: 1 updated: 2012/10/03 05:25:49
+dnl ---------------
+dnl Check for user's environment-breakage by stuffing CFLAGS/CPPFLAGS content
+dnl into CC.  This will not help with broken scripts that wrap the compiler with
+dnl options, but eliminates a more common category of user confusion.
+AC_DEFUN([CF_CC_ENV_FLAGS],
+[
+# This should have been defined by AC_PROG_CC
+: ${CC:=cc}
+
+AC_MSG_CHECKING(\$CC variable)
+case "$CC" in #(vi
+*[[\ \	]]-[[IUD]]*)
+	AC_MSG_RESULT(broken)
+	AC_MSG_WARN(your environment misuses the CC variable to hold CFLAGS/CPPFLAGS options)
+	# humor him...
+	cf_flags=`echo "$CC" | sed -e 's/^[[^ 	]]*[[ 	]]//'`
+	CC=`echo "$CC" | sed -e 's/[[ 	]].*//'`
+	CF_ADD_CFLAGS($cf_flags)
+	;;
+*)
+	AC_MSG_RESULT(ok)
+	;;
+esac
+])dnl
+dnl ---------------------------------------------------------------------------
+dnl CF_CFG_DEFAULTS version: 9 updated: 2013/04/13 18:58:32
 dnl ---------------
 dnl Determine the default configuration into which we'll install ncurses.  This
 dnl can be overridden by the user's command-line options.  There's two items to
@@ -522,7 +534,7 @@
 if test "x$prefix" = "xNONE" ; then
 	case "$cf_cv_system_name" in
 		# non-vendor systems don't have a conflict
-	openbsd*|freebsd*|linux*|cygwin*|k*bsd*-gnu)
+	openbsd*|freebsd*|mirbsd*|linux*|cygwin*|k*bsd*-gnu|mingw*)
 		prefix=/usr
 		;;
 	*)	prefix=$ac_default_prefix
@@ -558,7 +570,7 @@
 fi
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_CHECK_CACHE version: 11 updated: 2008/03/23 14:45:59
+dnl CF_CHECK_CACHE version: 12 updated: 2012/10/02 20:55:03
 dnl --------------
 dnl Check if we're accidentally using a cache from a different machine.
 dnl Derive the system name, as a check for reusing the autoconf cache.
@@ -581,7 +593,7 @@
 		system_name="`(hostname) 2>/dev/null`"
 	fi
 fi
-test -n "$system_name" && AC_DEFINE_UNQUOTED(SYSTEM_NAME,"$system_name")
+test -n "$system_name" && AC_DEFINE_UNQUOTED(SYSTEM_NAME,"$system_name",[Define to the system name.])
 AC_CACHE_VAL(cf_cv_system_name,[cf_cv_system_name="$system_name"])
 
 test -z "$system_name" && system_name="$cf_cv_system_name"
@@ -593,7 +605,40 @@
 fi
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_CURSES_HEADER version: 2 updated: 2010/04/28 06:02:16
+dnl CF_CLANG_COMPILER version: 1 updated: 2012/06/16 14:55:39
+dnl -----------------
+dnl Check if the given compiler is really clang.  clang's C driver defines
+dnl __GNUC__ (fooling the configure script into setting $GCC to yes) but does
+dnl not ignore some gcc options.
+dnl
+dnl This macro should be run "soon" after AC_PROG_CC or AC_PROG_CPLUSPLUS, to
+dnl ensure that it is not mistaken for gcc/g++.  It is normally invoked from
+dnl the wrappers for gcc and g++ warnings.
+dnl
+dnl $1 = GCC (default) or GXX
+dnl $2 = INTEL_COMPILER (default) or INTEL_CPLUSPLUS
+dnl $3 = CFLAGS (default) or CXXFLAGS
+AC_DEFUN([CF_CLANG_COMPILER],[
+ifelse([$2],,CLANG_COMPILER,[$2])=no
+
+if test "$ifelse([$1],,[$1],GCC)" = yes ; then
+	AC_MSG_CHECKING(if this is really Clang ifelse([$1],GXX,C++,C) compiler)
+	cf_save_CFLAGS="$ifelse([$3],,CFLAGS,[$3])"
+	ifelse([$3],,CFLAGS,[$3])="$ifelse([$3],,CFLAGS,[$3]) -Qunused-arguments"
+	AC_TRY_COMPILE([],[
+#ifdef __clang__
+#else
+make an error
+#endif
+],[ifelse([$2],,CLANG_COMPILER,[$2])=yes
+cf_save_CFLAGS="$cf_save_CFLAGS -Qunused-arguments"
+],[])
+	ifelse([$3],,CFLAGS,[$3])="$cf_save_CFLAGS"
+	AC_MSG_RESULT($ifelse([$2],,CLANG_COMPILER,[$2]))
+fi
+])
+dnl ---------------------------------------------------------------------------
+dnl CF_CURSES_HEADER version: 3 updated: 2011/05/01 19:47:45
 dnl ----------------
 dnl Find a "curses" header file, e.g,. "curses.h", or one of the more common
 dnl variations of ncurses' installs.
@@ -603,10 +648,10 @@
 AC_CACHE_CHECK(if we have identified curses headers,cf_cv_ncurses_header,[
 cf_cv_ncurses_header=none
 for cf_header in ifelse($1,,,[ \
-    $1/curses.h \
-	$1/ncurses.h]) \
-	curses.h \
-	ncurses.h ifelse($1,,[ncurses/curses.h ncurses/ncurses.h])
+    $1/ncurses.h \
+	$1/curses.h]) \
+	ncurses.h \
+	curses.h ifelse($1,,[ncurses/ncurses.h ncurses/curses.h])
 do
 AC_TRY_COMPILE([#include <${cf_header}>],
 	[initscr(); tgoto("?", 0,0)],
@@ -627,6 +672,67 @@
 dnl "dirname" is not portable, so we fake it with a shell script.
 AC_DEFUN([CF_DIRNAME],[$1=`echo $2 | sed -e 's%/[[^/]]*$%%'`])dnl
 dnl ---------------------------------------------------------------------------
+dnl CF_DISABLE_ECHO version: 12 updated: 2012/10/06 16:30:28
+dnl ---------------
+dnl You can always use "make -n" to see the actual options, but it's hard to
+dnl pick out/analyze warning messages when the compile-line is long.
+dnl
+dnl Sets:
+dnl	ECHO_LT - symbol to control if libtool is verbose
+dnl	ECHO_LD - symbol to prefix "cc -o" lines
+dnl	RULE_CC - symbol to put before implicit "cc -c" lines (e.g., .c.o)
+dnl	SHOW_CC - symbol to put before explicit "cc -c" lines
+dnl	ECHO_CC - symbol to put before any "cc" line
+dnl
+AC_DEFUN([CF_DISABLE_ECHO],[
+AC_MSG_CHECKING(if you want to see long compiling messages)
+CF_ARG_DISABLE(echo,
+	[  --disable-echo          do not display "compiling" commands],
+	[
+    ECHO_LT='--silent'
+    ECHO_LD='@echo linking [$]@;'
+    RULE_CC='@echo compiling [$]<'
+    SHOW_CC='@echo compiling [$]@'
+    ECHO_CC='@'
+],[
+    ECHO_LT=''
+    ECHO_LD=''
+    RULE_CC=''
+    SHOW_CC=''
+    ECHO_CC=''
+])
+AC_MSG_RESULT($enableval)
+AC_SUBST(ECHO_LT)
+AC_SUBST(ECHO_LD)
+AC_SUBST(RULE_CC)
+AC_SUBST(SHOW_CC)
+AC_SUBST(ECHO_CC)
+])dnl
+dnl ---------------------------------------------------------------------------
+dnl CF_ENABLE_PC_FILES version: 9 updated: 2012/08/04 13:59:54
+dnl ------------------
+dnl This is the "--enable-pc-files" option, which is available if there is a
+dnl pkg-config configuration on the local machine.
+AC_DEFUN([CF_ENABLE_PC_FILES],[
+AC_REQUIRE([CF_PKG_CONFIG])
+AC_REQUIRE([CF_WITH_PKG_CONFIG_LIBDIR])
+
+if test "$PKG_CONFIG" != none ; then
+	AC_MSG_CHECKING(if we should install .pc files for $PKG_CONFIG)
+	AC_ARG_ENABLE(pc-files,
+		[  --enable-pc-files       generate and install .pc files for pkg-config],
+		[enable_pc_files=$enableval],
+		[enable_pc_files=no])
+	AC_MSG_RESULT($enable_pc_files)
+	if test "$enable_pc_files" != no
+	then
+		CF_PATH_SYNTAX(PKG_CONFIG_LIBDIR)
+	fi
+else
+	enable_pc_files=no
+fi
+])dnl
+dnl ---------------------------------------------------------------------------
 dnl CF_FIND_LIBRARY version: 9 updated: 2008/03/23 14:48:54
 dnl ---------------
 dnl Look for a non-standard library, given parameters for AC_TRY_LINK.  We
@@ -807,7 +913,26 @@
 fi
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_GCC_ATTRIBUTES version: 14 updated: 2010/10/23 15:52:32
+dnl CF_FIXUP_ADAFLAGS version: 1 updated: 2012/03/31 18:48:10
+dnl -----------------
+dnl make ADAFLAGS consistent with CFLAGS
+AC_DEFUN([CF_FIXUP_ADAFLAGS],[
+	AC_MSG_CHECKING(optimization options for ADAFLAGS)
+	case "$CFLAGS" in
+	*-g*)
+		CF_ADD_ADAFLAGS(-g)
+		;;
+	esac
+	case "$CFLAGS" in
+	*-O*)
+		cf_O_flag=`echo "$CFLAGS" |sed -e 's/^.*-O/-O/' -e 's/[[ 	]].*//'`
+		CF_ADD_ADAFLAGS($cf_O_flag)
+		;;
+	esac
+	AC_MSG_RESULT($ADAFLAGS)
+])dnl
+dnl ---------------------------------------------------------------------------
+dnl CF_GCC_ATTRIBUTES version: 16 updated: 2012/10/02 20:55:03
 dnl -----------------
 dnl Test for availability of useful gcc __attribute__ directives to quiet
 dnl compiler warnings.  Though useful, not all are supported -- and contrary
@@ -885,27 +1010,27 @@
 			test -n "$verbose" && AC_MSG_RESULT(... $cf_attribute)
 			cat conftest.h >>confdefs.h
 			case $cf_attribute in #(vi
+			noreturn) #(vi
+				AC_DEFINE_UNQUOTED(GCC_NORETURN,$cf_directive,[Define to noreturn-attribute for gcc])
+				;;
 			printf) #(vi
-				if test "$cf_printf_attribute" = no ; then
-					cat >>confdefs.h <<EOF
-#define GCC_PRINTFLIKE(fmt,var) /* nothing */
-EOF
-				else
-					cat >>confdefs.h <<EOF
-#define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var)))
-EOF
+				cf_value='/* nothing */'
+				if test "$cf_printf_attribute" != no ; then
+					cf_value='__attribute__((format(printf,fmt,var)))'
+					AC_DEFINE(GCC_PRINTF,1,[Define to 1 if the compiler supports gcc-like printf attribute.])
 				fi
+				AC_DEFINE_UNQUOTED(GCC_PRINTFLIKE(fmt,var),$cf_value,[Define to printf-attribute for gcc])
 				;;
 			scanf) #(vi
-				if test "$cf_scanf_attribute" = no ; then
-					cat >>confdefs.h <<EOF
-#define GCC_SCANFLIKE(fmt,var) /* nothing */
-EOF
-				else
-					cat >>confdefs.h <<EOF
-#define GCC_SCANFLIKE(fmt,var)  __attribute__((format(scanf,fmt,var)))
-EOF
+				cf_value='/* nothing */'
+				if test "$cf_scanf_attribute" != no ; then
+					cf_value='__attribute__((format(scanf,fmt,var)))'
+					AC_DEFINE(GCC_SCANF,1,[Define to 1 if the compiler supports gcc-like scanf attribute.])
 				fi
+				AC_DEFINE_UNQUOTED(GCC_SCANFLIKE(fmt,var),$cf_value,[Define to sscanf-attribute for gcc])
+				;;
+			unused) #(vi
+				AC_DEFINE_UNQUOTED(GCC_UNUSED,$cf_directive,[Define to unused-attribute for gcc])
 				;;
 			esac
 		fi
@@ -917,7 +1042,7 @@
 fi
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_GCC_VERSION version: 5 updated: 2010/04/24 11:02:31
+dnl CF_GCC_VERSION version: 7 updated: 2012/10/18 06:46:33
 dnl --------------
 dnl Find version of gcc
 AC_DEFUN([CF_GCC_VERSION],[
@@ -925,13 +1050,13 @@
 GCC_VERSION=none
 if test "$GCC" = yes ; then
 	AC_MSG_CHECKING(version of $CC)
-	GCC_VERSION="`${CC} --version 2>/dev/null | sed -e '2,$d' -e 's/^.*(GCC) //' -e 's/^[[^0-9.]]*//' -e 's/[[^0-9.]].*//'`"
+	GCC_VERSION="`${CC} --version 2>/dev/null | sed -e '2,$d' -e 's/^.*(GCC[[^)]]*) //' -e 's/^.*(Debian[[^)]]*) //' -e 's/^[[^0-9.]]*//' -e 's/[[^0-9.]].*//'`"
 	test -z "$GCC_VERSION" && GCC_VERSION=unknown
 	AC_MSG_RESULT($GCC_VERSION)
 fi
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_GCC_WARNINGS version: 27 updated: 2010/10/23 15:52:32
+dnl CF_GCC_WARNINGS version: 29 updated: 2012/06/16 14:55:39
 dnl ---------------
 dnl Check if the compiler supports useful warning options.  There's a few that
 dnl we don't use, simply because they're too noisy:
@@ -954,6 +1079,7 @@
 [
 AC_REQUIRE([CF_GCC_VERSION])
 CF_INTEL_COMPILER(GCC,INTEL_COMPILER,CFLAGS)
+CF_CLANG_COMPILER(GCC,CLANG_COMPILER,CFLAGS)
 
 cat > conftest.$ac_ext <<EOF
 #line __oline__ "${as_me:-configure}"
@@ -1029,6 +1155,13 @@
 					continue;;
 				esac
 				;;
+			Wpointer-arith) #(vi
+				case $GCC_VERSION in
+				[[12]].*)
+					CF_VERBOSE(feature is broken in gcc $GCC_VERSION)
+					continue;;
+				esac
+				;;
 			esac
 			EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt"
 		fi
@@ -1070,53 +1203,6 @@
 AC_SUBST(cf_generic_objects)
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_GNAT_SIGINT version: 1 updated: 2011/03/27 20:07:59
-dnl --------------
-dnl Check if gnat supports SIGINT, and presumably tasking.  For the latter, it
-dnl is noted that gnat may compile a tasking unit even for configurations which
-dnl fail at runtime.
-AC_DEFUN([CF_GNAT_SIGINT],[
-AC_CACHE_CHECK(if GNAT supports SIGINT,cf_cv_gnat_sigint,[
-CF_GNAT_TRY_LINK([with Ada.Interrupts.Names;
-
-package ConfTest is
-
-   pragma Warnings (Off);  --  the next pragma exists since 3.11p
-   pragma Unreserve_All_Interrupts;
-   pragma Warnings (On);
-
-   protected Process is
-      procedure Stop;
-      function Continue return Boolean;
-      pragma Attach_Handler (Stop, Ada.Interrupts.Names.SIGINT);
-   private
-      Done : Boolean := False;
-   end Process;
-
-end ConfTest;],
-[package body ConfTest is
-   protected body Process is
-      procedure Stop is
-      begin
-         Done := True;
-      end Stop;
-      function Continue return Boolean is
-      begin
-         return not Done;
-      end Continue;
-   end Process;
-end ConfTest;],
-	[cf_cv_gnat_sigint=yes],
-	[cf_cv_gnat_sigint=no])])
-
-if test $cf_cv_gnat_sigint = yes ; then
-	USE_GNAT_SIGINT=""
-else
-	USE_GNAT_SIGINT="#"
-fi
-AC_SUBST(USE_GNAT_SIGINT)
-])dnl
-dnl ---------------------------------------------------------------------------
 dnl CF_GNAT_PRAGMA_UNREF version: 1 updated: 2010/06/19 15:22:18
 dnl --------------------
 dnl Check if the gnat pragma "Unreferenced" works.
@@ -1253,6 +1339,53 @@
 AC_SUBST(USE_GNAT_LIBRARIES)
 ])dnl
 dnl ---------------------------------------------------------------------------
+dnl CF_GNAT_SIGINT version: 1 updated: 2011/03/27 20:07:59
+dnl --------------
+dnl Check if gnat supports SIGINT, and presumably tasking.  For the latter, it
+dnl is noted that gnat may compile a tasking unit even for configurations which
+dnl fail at runtime.
+AC_DEFUN([CF_GNAT_SIGINT],[
+AC_CACHE_CHECK(if GNAT supports SIGINT,cf_cv_gnat_sigint,[
+CF_GNAT_TRY_LINK([with Ada.Interrupts.Names;
+
+package ConfTest is
+
+   pragma Warnings (Off);  --  the next pragma exists since 3.11p
+   pragma Unreserve_All_Interrupts;
+   pragma Warnings (On);
+
+   protected Process is
+      procedure Stop;
+      function Continue return Boolean;
+      pragma Attach_Handler (Stop, Ada.Interrupts.Names.SIGINT);
+   private
+      Done : Boolean := False;
+   end Process;
+
+end ConfTest;],
+[package body ConfTest is
+   protected body Process is
+      procedure Stop is
+      begin
+         Done := True;
+      end Stop;
+      function Continue return Boolean is
+      begin
+         return not Done;
+      end Continue;
+   end Process;
+end ConfTest;],
+	[cf_cv_gnat_sigint=yes],
+	[cf_cv_gnat_sigint=no])])
+
+if test $cf_cv_gnat_sigint = yes ; then
+	USE_GNAT_SIGINT=""
+else
+	USE_GNAT_SIGINT="#"
+fi
+AC_SUBST(USE_GNAT_SIGINT)
+])dnl
+dnl ---------------------------------------------------------------------------
 dnl CF_GNAT_TRY_LINK version: 3 updated: 2011/03/19 14:47:45
 dnl ----------------
 dnl Verify that a test program compiles/links with GNAT.
@@ -1311,7 +1444,7 @@
 rm -rf conftest* *~conftest*
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_GNAT_VERSION version: 17 updated: 2011/03/23 20:24:41
+dnl CF_GNAT_VERSION version: 18 updated: 2012/01/21 19:28:10
 dnl ---------------
 dnl Verify version of GNAT.
 AC_DEFUN([CF_GNAT_VERSION],
@@ -1323,7 +1456,7 @@
 AC_MSG_RESULT($cf_gnat_version)
 
 case $cf_gnat_version in #(vi
-3.1[[1-9]]*|3.[[2-9]]*|[[4-9]].*) #(vi
+3.1[[1-9]]*|3.[[2-9]]*|[[4-9]].*|20[[0-9]][[0-9]]) #(vi
 	cf_cv_prog_gnat_correct=yes
 	;;
 *)
@@ -1416,7 +1549,7 @@
 [AC_DIVERT_HELP([$1])dnl
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_INCLUDE_DIRS version: 6 updated: 2009/01/06 19:37:40
+dnl CF_INCLUDE_DIRS version: 7 updated: 2012/11/10 19:15:05
 dnl ---------------
 dnl Construct the list of include-options according to whether we're building
 dnl in the source directory or using '--srcdir=DIR' option.  If we're building
@@ -1424,25 +1557,25 @@
 dnl since that usually breaks gcc's shadow-includes.
 AC_DEFUN([CF_INCLUDE_DIRS],
 [
-CPPFLAGS="$CPPFLAGS -I. -I../include"
-if test "$srcdir" != "."; then
-	CPPFLAGS="$CPPFLAGS -I\${srcdir}/../include"
-fi
 if test "$GCC" != yes; then
-	CPPFLAGS="$CPPFLAGS -I\${includedir}"
+	CPPFLAGS="-I\${includedir} $CPPFLAGS"
 elif test "$includedir" != "/usr/include"; then
 	if test "$includedir" = '${prefix}/include' ; then
 		if test $prefix != /usr ; then
-			CPPFLAGS="$CPPFLAGS -I\${includedir}"
+			CPPFLAGS="-I\${includedir} $CPPFLAGS"
 		fi
 	else
-		CPPFLAGS="$CPPFLAGS -I\${includedir}"
+		CPPFLAGS="-I\${includedir} $CPPFLAGS"
 	fi
 fi
+if test "$srcdir" != "."; then
+	CPPFLAGS="-I\${srcdir}/../include $CPPFLAGS"
+fi
+CPPFLAGS="-I. -I../include $CPPFLAGS"
 AC_SUBST(CPPFLAGS)
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_INTEL_COMPILER version: 4 updated: 2010/05/26 05:38:42
+dnl CF_INTEL_COMPILER version: 5 updated: 2013/02/10 10:41:05
 dnl -----------------
 dnl Check if the given compiler is really the Intel compiler for Linux.  It
 dnl tries to imitate gcc, but does not return an error when it finds a mismatch
@@ -1456,6 +1589,7 @@
 dnl $2 = INTEL_COMPILER (default) or INTEL_CPLUSPLUS
 dnl $3 = CFLAGS (default) or CXXFLAGS
 AC_DEFUN([CF_INTEL_COMPILER],[
+AC_REQUIRE([AC_CANONICAL_HOST])
 ifelse([$2],,INTEL_COMPILER,[$2])=no
 
 if test "$ifelse([$1],,[$1],GCC)" = yes ; then
@@ -1479,7 +1613,7 @@
 fi
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_LARGEFILE version: 7 updated: 2007/06/02 11:58:50
+dnl CF_LARGEFILE version: 8 updated: 2012/10/06 08:57:51
 dnl ------------
 dnl Add checks for large file support.
 AC_DEFUN([CF_LARGEFILE],[
@@ -1513,12 +1647,12 @@
 		[cf_cv_struct_dirent64=yes],
 		[cf_cv_struct_dirent64=no])
 	])
-	test "$cf_cv_struct_dirent64" = yes && AC_DEFINE(HAVE_STRUCT_DIRENT64)
+	test "$cf_cv_struct_dirent64" = yes && AC_DEFINE(HAVE_STRUCT_DIRENT64,1,[Define to 1 if we have struct dirent64])
     fi
 ])
 ])
 dnl ---------------------------------------------------------------------------
-dnl CF_LD_RPATH_OPT version: 3 updated: 2010/06/02 05:03:05
+dnl CF_LD_RPATH_OPT version: 5 updated: 2011/07/17 14:48:41
 dnl ---------------
 dnl For the given system and compiler, find the compiler flags to pass to the
 dnl loader to use the "rpath" feature.
@@ -1539,10 +1673,10 @@
 linux*|gnu*|k*bsd*-gnu) #(vi
 	LD_RPATH_OPT="-Wl,-rpath,"
 	;;
-openbsd[[2-9]].*) #(vi
+openbsd[[2-9]].*|mirbsd*) #(vi
 	LD_RPATH_OPT="-Wl,-rpath,"
 	;;
-freebsd*) #(vi
+dragonfly*|freebsd*) #(vi
 	LD_RPATH_OPT="-rpath "
 	;;
 netbsd*) #(vi
@@ -1601,11 +1735,11 @@
 $1="$cf_library_path_list [$]$1"
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_LIB_PREFIX version: 8 updated: 2008/09/13 11:34:16
+dnl CF_LIB_PREFIX version: 9 updated: 2012/01/21 19:28:10
 dnl -------------
 dnl Compute the library-prefix for the given host system
 dnl $1 = variable to set
-AC_DEFUN([CF_LIB_PREFIX],
+define([CF_LIB_PREFIX],
 [
 	case $cf_cv_system_name in #(vi
 	OS/2*|os2*) #(vi
@@ -1618,44 +1752,7 @@
 	AC_SUBST(LIB_PREFIX)
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_LIB_SONAME version: 5 updated: 2010/08/14 18:25:37
-dnl -------------
-dnl Find the and soname for the given shared library.  Set the cache variable
-dnl cf_cv_$3_soname to this, unless it is not found.  Then set the cache
-dnl variable to "unknown".
-dnl
-dnl $1 = headers
-dnl $2 = code
-dnl $3 = library name
-AC_DEFUN([CF_LIB_SONAME],
-[
-AC_CACHE_CHECK(for soname of $3 library,cf_cv_$3_soname,[
-
-cf_cv_$3_soname=unknown
-if test "$cross_compiling" != yes ; then
-cat >conftest.$ac_ext <<CF_EOF
-$1
-int main()
-{
-$2
-	${cf_cv_main_return:-return}(0);
-}
-CF_EOF
-cf_save_LIBS="$LIBS"
-	CF_ADD_LIB($3)
-	if AC_TRY_EVAL(ac_compile) ; then
-		if AC_TRY_EVAL(ac_link) ; then
-			cf_cv_$3_soname=`ldd conftest$ac_exeext 2>/dev/null | sed -e 's,^.*/,,' -e 's, .*$,,' | fgrep lib$3.`
-			test -z "$cf_cv_$3_soname" && cf_cv_$3_soname=unknown
-		fi
-	fi
-rm -rf conftest*
-LIBS="$cf_save_LIBS"
-fi
-])
-])
-dnl ---------------------------------------------------------------------------
-dnl CF_LIB_SUFFIX version: 16 updated: 2008/12/27 12:30:03
+dnl CF_LIB_SUFFIX version: 18 updated: 2012/02/25 15:20:07
 dnl -------------
 dnl Compute the library file-suffix from the given model name
 dnl $1 = model name
@@ -1684,11 +1781,11 @@
 		;;
 	shared) #(vi
 		case $cf_cv_system_name in
-		aix[[56]]*) #(vi
+		aix[[5-7]]*) #(vi
 			$2='.a'
 			$3=[$]$2
 			;;
-		cygwin*) #(vi
+		cygwin*|mingw*) #(vi
 			$2='.dll'
 			$3='.dll.a'
 			;;
@@ -1735,7 +1832,7 @@
 	test -n "$LIB_SUFFIX" && $2="${LIB_SUFFIX}[$]{$2}"
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_LINK_DATAONLY version: 9 updated: 2009/01/01 20:21:38
+dnl CF_LINK_DATAONLY version: 10 updated: 2012/10/06 17:41:51
 dnl ----------------
 dnl Some systems have a non-ANSI linker that doesn't pull in modules that have
 dnl only data (i.e., no functions), for example NeXT.  On those systems we'll
@@ -1792,81 +1889,12 @@
 AC_MSG_RESULT($cf_cv_link_dataonly)
 
 if test "$cf_cv_link_dataonly" = no ; then
-	AC_DEFINE(BROKEN_LINKER)
+	AC_DEFINE(BROKEN_LINKER,1,[if data-only library module does not link])
 	BROKEN_LINKER=1
 fi
 
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_LINK_FUNCS version: 7 updated: 2006/12/16 12:33:30
-dnl -------------
-dnl Most Unix systems have both link and symlink, a few don't have symlink.
-dnl A few non-Unix systems implement symlink, but not link.
-dnl A few non-systems implement neither (or have nonfunctional versions).
-AC_DEFUN([CF_LINK_FUNCS],
-[
-AC_CHECK_FUNCS( \
-	remove \
-	unlink )
-
-if test "$cross_compiling" = yes ; then
-	AC_CHECK_FUNCS( \
-		link \
-		symlink )
-else
-	AC_CACHE_CHECK(if link/symlink functions work,cf_cv_link_funcs,[
-		cf_cv_link_funcs=
-		for cf_func in link symlink ; do
-			AC_TRY_RUN([
-#include <sys/types.h>
-#include <sys/stat.h>
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-int main()
-{
-	int fail = 0;
-	char *src = "config.log";
-	char *dst = "conftest.chk";
-	struct stat src_sb;
-	struct stat dst_sb;
-
-	stat(src, &src_sb);
-	fail = ($cf_func("config.log", "conftest.chk") < 0)
-	    || (stat(dst, &dst_sb) < 0)
-	    || (dst_sb.st_mtime != src_sb.st_mtime);
-#ifdef HAVE_UNLINK
-	unlink(dst);
-#else
-	remove(dst);
-#endif
-	${cf_cv_main_return:-return} (fail);
-}
-			],[
-			cf_cv_link_funcs="$cf_cv_link_funcs $cf_func"
-			eval 'ac_cv_func_'$cf_func'=yes'],[
-			eval 'ac_cv_func_'$cf_func'=no'],[
-			eval 'ac_cv_func_'$cf_func'=error'])
-		done
-		test -z "$cf_cv_link_funcs" && cf_cv_link_funcs=no
-	])
-	test "$ac_cv_func_link"    = yes && AC_DEFINE(HAVE_LINK)
-	test "$ac_cv_func_symlink" = yes && AC_DEFINE(HAVE_SYMLINK)
-fi
-])dnl
-dnl ---------------------------------------------------------------------------
-dnl CF_MAIN_RETURN version: 1 updated: 2006/12/10 09:51:54
-dnl --------------
-dnl Check if a return from main to the shell actually returns the same exit
-dnl code.  This is true for almost any POSIX environment.
-dnl
-dnl Some very old environments did not flush stdout, etc., on an exit.  That
-dnl would be a useful case to test for also.
-AC_DEFUN([CF_MAIN_RETURN],
-[
-cf_cv_main_return=return
-])dnl
-dnl ---------------------------------------------------------------------------
 dnl CF_MAKEFLAGS version: 14 updated: 2011/03/31 19:29:46
 dnl ------------
 dnl Some 'make' programs support ${MAKEFLAGS}, some ${MFLAGS}, to pass 'make'
@@ -1944,7 +1972,7 @@
 AC_SUBST(MAKE_LOWER_TAGS)
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_MIXEDCASE_FILENAMES version: 3 updated: 2003/09/20 17:07:55
+dnl CF_MIXEDCASE_FILENAMES version: 4 updated: 2012/10/02 20:55:03
 dnl ----------------------
 dnl Check if the file-system supports mixed-case filenames.  If we're able to
 dnl create a lowercase name and see it as uppercase, it doesn't support that.
@@ -1971,10 +1999,10 @@
 	rm -f conftest CONFTEST
 fi
 ])
-test "$cf_cv_mixedcase" = yes && AC_DEFINE(MIXEDCASE_FILENAMES)
+test "$cf_cv_mixedcase" = yes && AC_DEFINE(MIXEDCASE_FILENAMES,1,[Define to 1 if filesystem supports mixed-case filenames.])
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_MKSTEMP version: 7 updated: 2010/08/14 18:25:37
+dnl CF_MKSTEMP version: 9 updated: 2012/10/03 04:34:49
 dnl ----------
 dnl Check for a working mkstemp.  This creates two files, checks that they are
 dnl successfully created and distinct (AmigaOS apparently fails on the last).
@@ -2016,11 +2044,13 @@
 }
 ],[cf_cv_func_mkstemp=yes
 ],[cf_cv_func_mkstemp=no
-],[AC_CHECK_FUNC(mkstemp)
-])
+],[cf_cv_func_mkstemp=maybe])
 ])
+if test "x$cf_cv_func_mkstemp" = xmaybe ; then
+	AC_CHECK_FUNC(mkstemp)
+fi
 if test "x$cf_cv_func_mkstemp" = xyes || test "x$ac_cv_func_mkstemp" = xyes ; then
-	AC_DEFINE(HAVE_MKSTEMP)
+	AC_DEFINE(HAVE_MKSTEMP,1,[Define to 1 if mkstemp() is available and working.])
 fi
 ])dnl
 dnl ---------------------------------------------------------------------------
@@ -2141,7 +2171,7 @@
 	,[$1=no])
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_NCURSES_CONFIG version: 8 updated: 2010/07/08 05:17:30
+dnl CF_NCURSES_CONFIG version: 10 updated: 2012/10/06 08:57:51
 dnl -----------------
 dnl Tie together the configure-script macros for ncurses.
 dnl Prefer the "-config" script from ncurses 6.x, to simplify analysis.
@@ -2153,7 +2183,10 @@
 cf_ncuconfig_root=ifelse($1,,ncurses,$1)
 
 echo "Looking for ${cf_ncuconfig_root}-config"
-AC_PATH_PROGS(NCURSES_CONFIG,${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}5-config,none)
+
+CF_ACVERSION_CHECK(2.52,
+	[AC_CHECK_TOOLS(NCURSES_CONFIG, ${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}5-config, none)],
+	[AC_PATH_PROGS(NCURSES_CONFIG, ${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}5-config, none)])
 
 if test "$NCURSES_CONFIG" != none ; then
 
@@ -2164,7 +2197,7 @@
 CF_CURSES_HEADER(ifelse($1,,ncurses,$1))
 
 dnl like CF_NCURSES_CPPFLAGS
-AC_DEFINE(NCURSES)
+AC_DEFINE(NCURSES,1,[Define to 1 if we are using ncurses headers/libraries])
 
 dnl like CF_NCURSES_LIBS
 CF_UPPER(cf_nculib_ROOT,HAVE_LIB$cf_ncuconfig_root)
@@ -2181,7 +2214,7 @@
 fi
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_NCURSES_CPPFLAGS version: 20 updated: 2010/11/20 17:02:38
+dnl CF_NCURSES_CPPFLAGS version: 21 updated: 2012/10/06 08:57:51
 dnl -------------------
 dnl Look for the SVr4 curses clone 'ncurses' in the standard places, adjusting
 dnl the CPPFLAGS variable so we can include its header.
@@ -2227,12 +2260,12 @@
 CF_TERM_HEADER
 
 # some applications need this, but should check for NCURSES_VERSION
-AC_DEFINE(NCURSES)
+AC_DEFINE(NCURSES,1,[Define to 1 if we are using ncurses headers/libraries])
 
 CF_NCURSES_VERSION
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_NCURSES_HEADER version: 2 updated: 2008/03/23 14:48:54
+dnl CF_NCURSES_HEADER version: 3 updated: 2012/10/06 08:57:51
 dnl -----------------
 dnl Find a "curses" header file, e.g,. "curses.h", or one of the more common
 dnl variations of ncurses' installs.
@@ -2283,16 +2316,16 @@
 
 case $cf_cv_ncurses_header in # (vi
 *ncurses.h)
-	AC_DEFINE(HAVE_NCURSES_H)
+	AC_DEFINE(HAVE_NCURSES_H,1,[Define to 1 if we have ncurses.h])
 	;;
 esac
 
 case $cf_cv_ncurses_header in # (vi
 ncurses/curses.h|ncurses/ncurses.h)
-	AC_DEFINE(HAVE_NCURSES_NCURSES_H)
+	AC_DEFINE(HAVE_NCURSES_NCURSES_H,1,[Define to 1 if we have ncurses/ncurses.h])
 	;;
 ncursesw/curses.h|ncursesw/ncurses.h)
-	AC_DEFINE(HAVE_NCURSESW_NCURSES_H)
+	AC_DEFINE(HAVE_NCURSESW_NCURSES_H,1,[Define to 1 if we have ncursesw/ncurses.h])
 	;;
 esac
 
@@ -2366,7 +2399,7 @@
 AC_DEFINE_UNQUOTED($cf_nculib_ROOT)
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_NCURSES_VERSION version: 13 updated: 2010/10/23 15:54:49
+dnl CF_NCURSES_VERSION version: 14 updated: 2012/10/06 08:57:51
 dnl ------------------
 dnl Check for the version of ncurses, to aid in reporting bugs, etc.
 dnl Call CF_CURSES_CPPFLAGS first, or CF_NCURSES_CPPFLAGS.  We don't use
@@ -2425,55 +2458,7 @@
 ])
 	rm -f $cf_tempfile
 ])
-test "$cf_cv_ncurses_version" = no || AC_DEFINE(NCURSES)
-])dnl
-dnl ---------------------------------------------------------------------------
-dnl CF_NO_LEAKS_OPTION version: 4 updated: 2006/12/16 14:24:05
-dnl ------------------
-dnl see CF_WITH_NO_LEAKS
-AC_DEFUN([CF_NO_LEAKS_OPTION],[
-AC_MSG_CHECKING(if you want to use $1 for testing)
-AC_ARG_WITH($1,
-	[$2],
-	[AC_DEFINE($3)ifelse([$4],,[
-	 $4
-])
-	: ${with_cflags:=-g}
-	: ${with_no_leaks:=yes}
-	 with_$1=yes],
-	[with_$1=])
-AC_MSG_RESULT(${with_$1:-no})
-
-case .$with_cflags in #(vi
-.*-g*)
-	case .$CFLAGS in #(vi
-	.*-g*) #(vi
-		;;
-	*)
-		CF_ADD_CFLAGS([-g])
-		;;
-	esac
-	;;
-esac
-])dnl
-dnl ---------------------------------------------------------------------------
-dnl CF_NUMBER_SYNTAX version: 1 updated: 2003/09/20 18:12:49
-dnl ----------------
-dnl Check if the given variable is a number.  If not, report an error.
-dnl $1 is the variable
-dnl $2 is the message
-AC_DEFUN([CF_NUMBER_SYNTAX],[
-if test -n "$1" ; then
-  case $1 in #(vi
-  [[0-9]]*) #(vi
- 	;;
-  *)
-	AC_MSG_ERROR($2 is not a number: $1)
- 	;;
-  esac
-else
-  AC_MSG_ERROR($2 value is empty)
-fi
+test "$cf_cv_ncurses_version" = no || AC_DEFINE(NCURSES,1,[Define to 1 if we are using ncurses headers/libraries])
 ])dnl
 dnl ---------------------------------------------------------------------------
 dnl CF_OBJ_SUBDIR version: 4 updated: 2002/02/23 20:38:31
@@ -2496,20 +2481,23 @@
 	esac
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_PATHSEP version: 5 updated: 2010/05/26 05:38:42
+dnl CF_PATHSEP version: 6 updated: 2012/09/29 18:38:12
 dnl ----------
-dnl Provide a value for the $PATH and similar separator
+dnl Provide a value for the $PATH and similar separator (or amend the value
+dnl as provided in autoconf 2.5x).
 AC_DEFUN([CF_PATHSEP],
 [
+	AC_MSG_CHECKING(for PATH separator)
 	case $cf_cv_system_name in
 	os2*)	PATH_SEPARATOR=';'  ;;
-	*)	PATH_SEPARATOR=':'  ;;
+	*)	${PATH_SEPARATOR:=':'}  ;;
 	esac
 ifelse([$1],,,[$1=$PATH_SEPARATOR])
 	AC_SUBST(PATH_SEPARATOR)
+	AC_MSG_RESULT($PATH_SEPARATOR)
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_PATH_SYNTAX version: 13 updated: 2010/05/26 05:38:42
+dnl CF_PATH_SYNTAX version: 14 updated: 2012/06/19 20:58:54
 dnl --------------
 dnl Check the argument to see that it looks like a pathname.  Rewrite it if it
 dnl begins with one of the prefix/exec_prefix variables, and then again if the
@@ -2529,7 +2517,7 @@
   ;;
 .[[a-zA-Z]]:[[\\/]]*) #(vi OS/2 EMX
   ;;
-.\[$]{*prefix}*) #(vi
+.\[$]{*prefix}*|.\[$]{*dir}*) #(vi
   eval $1="[$]$1"
   case ".[$]$1" in #(vi
   .NONE/*)
@@ -2546,7 +2534,7 @@
 esac
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_PKG_CONFIG version: 4 updated: 2011/02/18 20:26:24
+dnl CF_PKG_CONFIG version: 7 updated: 2011/04/29 04:53:22
 dnl -------------
 dnl Check for the package-config program, unless disabled by command-line.
 AC_DEFUN([CF_PKG_CONFIG],
@@ -2563,7 +2551,9 @@
 	PKG_CONFIG=none
 	;;
 yes) #(vi
-	AC_PATH_TOOL(PKG_CONFIG, pkg-config, none)
+	CF_ACVERSION_CHECK(2.52,
+		[AC_PATH_TOOL(PKG_CONFIG, pkg-config, none)],
+		[AC_PATH_PROG(PKG_CONFIG, pkg-config, none)])
 	;;
 *)
 	PKG_CONFIG=$withval
@@ -2667,6 +2657,19 @@
 test -z "$AWK" && AC_MSG_ERROR(No awk program found)
 ])dnl
 dnl ---------------------------------------------------------------------------
+dnl CF_PROG_CC version: 3 updated: 2012/10/06 15:31:55
+dnl ----------
+dnl standard check for CC, plus followup sanity checks
+dnl $1 = optional parameter to pass to AC_PROG_CC to specify compiler name
+AC_DEFUN([CF_PROG_CC],[
+ifelse($1,,[AC_PROG_CC],[AC_PROG_CC($1)])
+CF_GCC_VERSION
+CF_ACVERSION_CHECK(2.52,
+	[AC_PROG_CC_STDC],
+	[CF_ANSI_CC_REQD])
+CF_CC_ENV_FLAGS 
+])dnl
+dnl ---------------------------------------------------------------------------
 dnl CF_PROG_CC_C_O version: 3 updated: 2010/08/14 18:25:37
 dnl --------------
 dnl Analogous to AC_PROG_CC_C_O, but more useful: tests only $CC, ensures that
@@ -2721,7 +2724,7 @@
 test -z "$EGREP" && AC_MSG_ERROR(No egrep program found)
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_PROG_EXT version: 10 updated: 2004/01/03 19:28:18
+dnl CF_PROG_EXT version: 11 updated: 2012/10/06 08:57:51
 dnl -----------
 dnl Compute $PROG_EXT, used for non-Unix ports, such as OS/2 EMX.
 AC_DEFUN([CF_PROG_EXT],
@@ -2743,10 +2746,10 @@
 
 PROG_EXT="$EXEEXT"
 AC_SUBST(PROG_EXT)
-test -n "$PROG_EXT" && AC_DEFINE_UNQUOTED(PROG_EXT,"$PROG_EXT")
+test -n "$PROG_EXT" && AC_DEFINE_UNQUOTED(PROG_EXT,"$PROG_EXT",[Define to the program extension (normally blank)])
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_PROG_GNAT version: 1 updated: 2010/06/19 15:22:18
+dnl CF_PROG_GNAT version: 2 updated: 2011/10/22 14:01:47
 dnl ------------
 dnl Check for gnatmake, ensure that it is complete.
 AC_DEFUN([CF_PROG_GNAT],[
@@ -2754,6 +2757,7 @@
 AC_CHECK_PROG(gnat_exists, $cf_ada_make, yes, no)
 if test "$ac_cv_prog_gnat_exists" = no; then
    cf_ada_make=
+   cf_cv_prog_gnat_correct=no
 else
    CF_GNAT_VERSION
    AC_CHECK_PROG(M4_exists, m4, yes, no)
@@ -2831,7 +2835,7 @@
 $1=`echo "$2" | sed -e 's/-l$3[[ 	]]//g' -e 's/-l$3[$]//'`
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_SHARED_OPTS version: 64 updated: 2010/06/05 16:51:16
+dnl CF_SHARED_OPTS version: 72 updated: 2013/01/26 16:26:12
 dnl --------------
 dnl --------------
 dnl Attempt to determine the appropriate CC/LD options for creating a shared
@@ -2887,6 +2891,7 @@
 	AC_MSG_RESULT($cf_cv_shlib_version)
 
 	cf_cv_rm_so_locs=no
+	cf_try_cflags=
 
 	# Some less-capable ports of gcc support only -fpic
 	CC_SHARED_OPTS=
@@ -2906,10 +2911,14 @@
 	cf_cv_shlib_version_infix=no
 
 	case $cf_cv_system_name in #(vi
-	aix[[56]]*) #(vi
+	aix4.[3-9]*|aix[[5-7]]*) #(vi
 		if test "$GCC" = yes; then
 			CC_SHARED_OPTS=
-			MK_SHARED_LIB='$(CC) -shared'
+			MK_SHARED_LIB='${CC} -shared -Wl,-brtl -Wl,-blibpath:${RPATH_LIST}:/usr/lib -o [$]@'
+		else
+			# CC_SHARED_OPTS='-qpic=large -G'
+			# perhaps "-bM:SRE -bnoentry -bexpall"
+			MK_SHARED_LIB='${CC} -G -Wl,-brtl -Wl,-blibpath:${RPATH_LIST}:/usr/lib -o [$]@'
 		fi
 		;;
 	beos*) #(vi
@@ -2935,7 +2944,7 @@
 		chmod +x mk_shared_lib.sh
 		;;
 	darwin*) #(vi
-		EXTRA_CFLAGS="-no-cpp-precomp"
+		cf_try_cflags="no-cpp-precomp"
 		CC_SHARED_OPTS="-dynamic"
 		MK_SHARED_LIB='${CC} ${CFLAGS} -dynamiclib -install_name ${libdir}/`basename $[@]` -compatibility_version ${ABI_VERSION} -current_version ${ABI_VERSION} -o $[@]'
 		test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=abi
@@ -2949,6 +2958,14 @@
 			LDFLAGS="$LDFLAGS -Wl,-search_paths_first"
 		fi
 		;;
+	hpux[[7-8]]*) #(vi
+		# HP-UX 8.07 ld lacks "+b" option used for libdir search-list 
+		if test "$GCC" != yes; then
+			CC_SHARED_OPTS='+Z'
+		fi
+		MK_SHARED_LIB='${LD} -b -o $[@]'
+		INSTALL_LIB="-m 555"
+		;;
 	hpux*) #(vi
 		# (tested with gcc 2.7.2 -- I don't have c89)
 		if test "$GCC" = yes; then
@@ -2962,9 +2979,19 @@
 		# readonly to exploit a quirk in the memory manager.
 		INSTALL_LIB="-m 555"
 		;;
+	interix*)
+		test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel
+		if test "$cf_cv_shlib_version" = rel; then
+			cf_shared_soname='`basename $@ .${REL_VERSION}`.${ABI_VERSION}'
+		else
+			cf_shared_soname='`basename $@`'
+		fi
+		CC_SHARED_OPTS=
+		MK_SHARED_LIB='${CC} -shared -Wl,-rpath,${RPATH_LIST} -Wl,-h,'$cf_shared_soname' -o $@'
+		;;
 	irix*) #(vi
 		if test "$cf_cv_enable_rpath" = yes ; then
-			EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${libdir} $EXTRA_LDFLAGS"
+			EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${RPATH_LIST} $EXTRA_LDFLAGS"
 		fi
 		# tested with IRIX 5.2 and 'cc'.
 		if test "$GCC" != yes; then
@@ -2981,18 +3008,39 @@
 			LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
 		fi
 		if test "$cf_cv_enable_rpath" = yes ; then
-			EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${libdir} $EXTRA_LDFLAGS"
+			EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${RPATH_LIST} $EXTRA_LDFLAGS"
 		fi
 		CF_SHARED_SONAME
 		MK_SHARED_LIB='${CC} ${CFLAGS} -shared -Wl,-soname,'$cf_cv_shared_soname',-stats,-lc -o $[@]'
 		;;
-	openbsd[[2-9]].*) #(vi
+	mingw*) #(vi
+		cf_cv_shlib_version=mingw
+		cf_cv_shlib_version_infix=mingw
+		CC_SHARED_OPTS=
+		MK_SHARED_LIB='sh ../mk_shared_lib.sh [$]@ [$]{CC} [$]{CFLAGS}'
+		#MK_SHARED_LIB='${CC} ${CFLAGS} -mdll -Wl,-soname,'$cf_cv_shared_soname',-stats -o $[@]'
+		#MK_SHARED_LIB='${DLLTOOL} --export-all-symbols --output-exp --output-lib $[@]'
+		cat >mk_shared_lib.sh <<-CF_EOF
+		#!/bin/sh
+		SHARED_LIB=\[$]1
+		IMPORT_LIB=\`echo "\[$]1" | sed -e 's/[[0-9]]*\.dll[$]/.dll.a/'\`
+		shift
+		cat <<-EOF
+		Linking shared library
+		** SHARED_LIB \[$]SHARED_LIB
+		** IMPORT_LIB \[$]IMPORT_LIB
+EOF
+		exec \[$]* -shared -Wl,--out-implib=../lib/\[$]{IMPORT_LIB} -Wl,--export-all-symbols -o ../lib/\[$]{SHARED_LIB}
+CF_EOF
+		chmod +x mk_shared_lib.sh
+		;;
+	openbsd[[2-9]].*|mirbsd*) #(vi
 		if test "$DFT_LWR_MODEL" = "shared" ; then
 			LOCAL_LDFLAGS="${LD_RPATH_OPT}\$(LOCAL_LIBDIR)"
 			LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
 		fi
 		if test "$cf_cv_enable_rpath" = yes ; then
-			EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${libdir} $EXTRA_LDFLAGS"
+			EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${RPATH_LIST} $EXTRA_LDFLAGS"
 		fi
 		CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC"
 		CF_SHARED_SONAME
@@ -3003,12 +3051,12 @@
 		MK_SHARED_LIB='${LD} -Bshareable -o $[@]'
 		test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel
 		;;
-	freebsd*) #(vi
+	dragonfly*|freebsd*) #(vi
 		CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC"
 		if test "$DFT_LWR_MODEL" = "shared" && test "$cf_cv_enable_rpath" = yes ; then
 			LOCAL_LDFLAGS="${cf_ld_rpath_opt}\$(LOCAL_LIBDIR)"
-			LOCAL_LDFLAGS2="${cf_ld_rpath_opt}\${libdir} $LOCAL_LDFLAGS"
-			EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${libdir} $EXTRA_LDFLAGS"
+			LOCAL_LDFLAGS2="${cf_ld_rpath_opt}\${RPATH_LIST} $LOCAL_LDFLAGS"
+			EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${RPATH_LIST} $EXTRA_LDFLAGS"
 		fi
 		CF_SHARED_SONAME
 		MK_SHARED_LIB='${LD} -shared -Bshareable -soname=`basename $[@]` -o $[@]'
@@ -3018,7 +3066,7 @@
 		if test "$DFT_LWR_MODEL" = "shared" && test "$cf_cv_enable_rpath" = yes ; then
 			LOCAL_LDFLAGS="${cf_ld_rpath_opt}\$(LOCAL_LIBDIR)"
 			LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
-			EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${libdir} $EXTRA_LDFLAGS"
+			EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${RPATH_LIST} $EXTRA_LDFLAGS"
 			if test "$cf_cv_shlib_version" = auto; then
 			if test -f /usr/libexec/ld.elf_so; then
 				cf_cv_shlib_version=abi
@@ -3123,10 +3171,40 @@
 		;;
 	esac
 
-	if test -n "$cf_ld_rpath_opt" ; then
-		MK_SHARED_LIB="$MK_SHARED_LIB $cf_ld_rpath_opt\${libdir}"
+	if test -n "$cf_try_cflags"
+	then
+cat > conftest.$ac_ext <<EOF
+#line __oline__ "${as_me:-configure}"
+#include <stdio.h>
+int main(int argc, char *argv[[]])
+{
+	printf("hello\n");
+	return (argv[[argc-1]] == 0) ;
+}
+EOF
+		cf_save_CFLAGS="$CFLAGS"
+		for cf_opt in $cf_try_cflags
+		do
+			CFLAGS="$cf_save_CFLAGS -$cf_opt"
+			AC_MSG_CHECKING(if CFLAGS option -$cf_opt works)
+			if AC_TRY_EVAL(ac_compile); then
+				AC_MSG_RESULT(yes)
+				cf_save_CFLAGS="$CFLAGS"
+			else
+				AC_MSG_RESULT(no)
+			fi
+		done
+		CFLAGS="$cf_save_CFLAGS"
 	fi
 
+
+	# RPATH_LIST is a colon-separated list of directories
+	test -n "$cf_ld_rpath_opt" && MK_SHARED_LIB="$MK_SHARED_LIB $cf_ld_rpath_opt\${RPATH_LIST}"
+	test -z "$RPATH_LIST" && RPATH_LIST="\${libdir}"
+
+	CF_VERBOSE(CC_SHARED_OPTS: $CC_SHARED_OPTS)
+	CF_VERBOSE(MK_SHARED_LIB:  $MK_SHARED_LIB)
+
 	AC_SUBST(CC_SHARED_OPTS)
 	AC_SUBST(LD_RPATH_OPT)
 	AC_SUBST(LD_SHARED_OPTS)
@@ -3137,6 +3215,7 @@
 	AC_SUBST(LOCAL_LDFLAGS)
 	AC_SUBST(LOCAL_LDFLAGS2)
 	AC_SUBST(INSTALL_LIB)
+	AC_SUBST(RPATH_LIST)
 ])dnl
 dnl ---------------------------------------------------------------------------
 dnl CF_SHARED_SONAME version: 3 updated: 2008/09/08 18:34:43
@@ -3180,24 +3259,7 @@
 CF_ADD_SUBDIR_PATH($1,$2,$3,[$]HOME,$prefix)
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_SUBST version: 4 updated: 2006/06/17 12:33:03
-dnl --------
-dnl	Shorthand macro for substituting things that the user may override
-dnl	with an environment variable.
-dnl
-dnl	$1 = long/descriptive name
-dnl	$2 = environment variable
-dnl	$3 = default value
-AC_DEFUN([CF_SUBST],
-[AC_CACHE_VAL(cf_cv_subst_$2,[
-AC_MSG_CHECKING(for $1 (symbol $2))
-CF_SUBST_IF([-z "[$]$2"], [$2], [$3])
-cf_cv_subst_$2=[$]$2
-AC_MSG_RESULT([$]$2)
-])
-])dnl
-dnl ---------------------------------------------------------------------------
-dnl CF_TERM_HEADER version: 2 updated: 2010/10/23 15:54:49
+dnl CF_TERM_HEADER version: 3 updated: 2012/10/06 08:57:51
 dnl --------------
 dnl Look for term.h, which is part of X/Open curses.  It defines the interface
 dnl to terminfo database.  Usually it is in the same include-path as curses.h,
@@ -3230,16 +3292,16 @@
 
 case $cf_cv_term_header in # (vi
 *term.h)
-	AC_DEFINE(HAVE_TERM_H)
+	AC_DEFINE(HAVE_TERM_H,1,[Define to 1 if we have term.h])
 	;;
 esac
 
 case $cf_cv_term_header in # (vi
 ncurses/term.h) #(vi
-	AC_DEFINE(HAVE_NCURSES_TERM_H)
+	AC_DEFINE(HAVE_NCURSES_TERM_H,1,[Define to 1 if we have ncurses/term.h])
 	;;
 ncursesw/term.h)
-	AC_DEFINE(HAVE_NCURSESW_TERM_H)
+	AC_DEFINE(HAVE_NCURSESW_TERM_H,1,[Define to 1 if we have ncursesw/term.h])
 	;;
 esac
 ])dnl
@@ -3253,6 +3315,45 @@
 AC_SUBST(top_builddir)
 ])dnl
 dnl ---------------------------------------------------------------------------
+dnl CF_TRY_XOPEN_SOURCE version: 1 updated: 2011/10/30 17:09:50
+dnl -------------------
+dnl If _XOPEN_SOURCE is not defined in the compile environment, check if we
+dnl can define it successfully.
+AC_DEFUN([CF_TRY_XOPEN_SOURCE],[
+AC_CACHE_CHECK(if we should define _XOPEN_SOURCE,cf_cv_xopen_source,[
+	AC_TRY_COMPILE([
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+],[
+#ifndef _XOPEN_SOURCE
+make an error
+#endif],
+	[cf_cv_xopen_source=no],
+	[cf_save="$CPPFLAGS"
+	 CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE"
+	 AC_TRY_COMPILE([
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+],[
+#ifdef _XOPEN_SOURCE
+make an error
+#endif],
+	[cf_cv_xopen_source=no],
+	[cf_cv_xopen_source=$cf_XOPEN_SOURCE])
+	CPPFLAGS="$cf_save"
+	])
+])
+
+if test "$cf_cv_xopen_source" != no ; then
+	CF_REMOVE_DEFINE(CFLAGS,$CFLAGS,_XOPEN_SOURCE)
+	CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,_XOPEN_SOURCE)
+	cf_temp_xopen_source="-D_XOPEN_SOURCE=$cf_cv_xopen_source"
+	CF_ADD_CFLAGS($cf_temp_xopen_source)
+fi
+])
+dnl ---------------------------------------------------------------------------
 dnl CF_UPPER version: 5 updated: 2001/01/29 23:40:59
 dnl --------
 dnl Make an uppercase version of a variable
@@ -3262,7 +3363,7 @@
 $1=`echo "$2" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_UTF8_LIB version: 7 updated: 2010/06/20 09:24:28
+dnl CF_UTF8_LIB version: 8 updated: 2012/10/06 08:57:51
 dnl -----------
 dnl Check for multibyte support, and if not found, utf8 compatibility library
 AC_DEFUN([CF_UTF8_LIB],
@@ -3281,7 +3382,7 @@
 # HAVE_LIBUTF8_H is used by ncurses if curses.h is shared between
 # ncurses/ncursesw:
 if test "$cf_cv_utf8_lib" = "add-on" ; then
-	AC_DEFINE(HAVE_LIBUTF8_H)
+	AC_DEFINE(HAVE_LIBUTF8_H,1,[Define to 1 if we should include libutf8.h])
 	CF_ADD_INCDIR($cf_cv_header_path_utf8)
 	CF_ADD_LIBDIR($cf_cv_library_path_utf8)
 	CF_ADD_LIBS($cf_cv_library_file_utf8)
@@ -3415,7 +3516,33 @@
 fi
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_WITH_PATH version: 10 updated: 2010/10/23 15:44:18
+dnl CF_WITH_LIB_PREFIX version: 1 updated: 2012/01/21 19:28:10
+dnl ------------------
+dnl Allow the library-prefix to be overridden.  OS/2 EMX originally had no
+dnl "lib" prefix, e.g., because it used the dll naming convention.
+dnl
+dnl $1 = variable to set
+AC_DEFUN([CF_WITH_LIB_PREFIX],
+[
+AC_MSG_CHECKING(if you want to have a library-prefix)
+AC_ARG_WITH(lib-prefix,
+	[  --with-lib-prefix       override library-prefix],
+	[with_lib_prefix=$withval],
+	[with_lib_prefix=auto])
+AC_MSG_RESULT($with_lib_prefix)
+
+if test $with_lib_prefix = auto
+then
+	CF_LIB_PREFIX($1)
+elif test $with_lib_prefix = no
+then
+	LIB_PREFIX=
+else
+	LIB_PREFIX=$with_lib_prefix
+fi
+])dnl
+dnl ---------------------------------------------------------------------------
+dnl CF_WITH_PATH version: 11 updated: 2012/09/29 15:04:19
 dnl ------------
 dnl Wrapper for AC_ARG_WITH to ensure that user supplies a pathname, not just
 dnl defaulting to yes/no.
@@ -3432,11 +3559,54 @@
 if ifelse([$5],,true,[test -n "$5"]) ; then
 CF_PATH_SYNTAX(withval)
 fi
-$3="$withval"
+eval $3="$withval"
 AC_SUBST($3)dnl
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_WITH_PTHREAD version: 3 updated: 2010/05/29 16:31:02
+dnl CF_WITH_PKG_CONFIG_LIBDIR version: 2 updated: 2011/12/10 18:58:47
+dnl -------------------------
+dnl Allow the choice of the pkg-config library directory to be overridden.
+AC_DEFUN([CF_WITH_PKG_CONFIG_LIBDIR],[
+if test "$PKG_CONFIG" != none ; then
+	AC_MSG_CHECKING(for $PKG_CONFIG library directory)
+	AC_ARG_WITH(pkg-config-libdir,
+		[  --with-pkg-config-libdir=XXX use given directory for installing pc-files],
+		[PKG_CONFIG_LIBDIR=$withval],
+		[PKG_CONFIG_LIBDIR=yes])
+
+	case x$PKG_CONFIG_LIBDIR in #(vi
+	x/*) #(vi
+		;;
+	xyes) #(vi
+		# look for the library directory using the same prefix as the executable
+		cf_path=`echo "$PKG_CONFIG" | sed -e 's,/[[^/]]*/[[^/]]*$,,'`
+		case x`(arch) 2>/dev/null` in #(vi
+		*64) #(vi
+			for cf_config in $cf_path/share $cf_path/lib64 $cf_path/lib32 $cf_path/lib
+			do
+				if test -d $cf_config/pkgconfig
+				then
+					PKG_CONFIG_LIBDIR=$cf_config/pkgconfig
+					break
+				fi
+			done
+			;;
+		*)
+			PKG_CONFIG_LIBDIR=$cf_path/lib/pkgconfig
+			;;
+		esac
+		;;
+	*)
+		;;
+	esac
+
+	AC_MSG_RESULT($PKG_CONFIG_LIBDIR)
+fi
+
+AC_SUBST(PKG_CONFIG_LIBDIR)
+])dnl
+dnl ---------------------------------------------------------------------------
+dnl CF_WITH_PTHREAD version: 6 updated: 2012/10/06 17:41:51
 dnl ---------------
 dnl Check for POSIX thread library.
 AC_DEFUN([CF_WITH_PTHREAD],
@@ -3450,30 +3620,55 @@
 
 if test "$with_pthread" != no ; then
     AC_CHECK_HEADER(pthread.h,[
-        AC_DEFINE(HAVE_PTHREADS_H)
+        AC_DEFINE(HAVE_PTHREADS_H,1,[Define to 1 if we have pthreads.h header])
 
-        AC_MSG_CHECKING(if we can link with the pthread library)
-        cf_save_LIBS="$LIBS"
-        CF_ADD_LIB(pthread)
-        AC_TRY_LINK([
+	for cf_lib_pthread in pthread c_r
+	do
+	    AC_MSG_CHECKING(if we can link with the $cf_lib_pthread library)
+	    cf_save_LIBS="$LIBS"
+	    CF_ADD_LIB($cf_lib_pthread)
+	    AC_TRY_LINK([
 #include <pthread.h>
 ],[
-        int rc = pthread_create(0,0,0,0);
+		int rc = pthread_create(0,0,0,0);
+		int r2 = pthread_mutexattr_settype(0, 0);
 ],[with_pthread=yes],[with_pthread=no])
-        LIBS="$cf_save_LIBS"
-        AC_MSG_RESULT($with_pthread)
+	    LIBS="$cf_save_LIBS"
+	    AC_MSG_RESULT($with_pthread)
+	    test "$with_pthread" = yes && break
+	done
 
-        if test "$with_pthread" = yes ; then
-            CF_ADD_LIB(pthread)
-            AC_DEFINE(HAVE_LIBPTHREADS)
-        else
-            AC_MSG_ERROR(Cannot link with pthread library)
-        fi
+	if test "$with_pthread" = yes ; then
+	    CF_ADD_LIB($cf_lib_pthread)
+	    AC_DEFINE(HAVE_LIBPTHREADS,1,[Define to 1 if we have pthreads library])
+	else
+	    AC_MSG_ERROR(Cannot link with pthread library)
+	fi
     ])
 fi
 ])
 dnl ---------------------------------------------------------------------------
-dnl CF_XOPEN_SOURCE version: 35 updated: 2011/02/20 20:37:37
+dnl CF_WITH_SYSTYPE version: 1 updated: 2013/01/26 16:26:12
+dnl ---------------
+dnl For testing, override the derived host system-type which is used to decide
+dnl things such as the linker commands used to build shared libraries.  This is
+dnl normally chosen automatically based on the type of system which you are
+dnl building on.  We use it for testing the configure script.
+dnl
+dnl This is different from the --host option: it is used only for testing parts
+dnl of the configure script which would not be reachable with --host since that
+dnl relies on the build environment being real, rather than mocked up.
+AC_DEFUN([CF_WITH_SYSTYPE],[
+CF_CHECK_CACHE([AC_CANONICAL_SYSTEM])
+AC_ARG_WITH(system-type,
+	[  --with-system-type=XXX  test: override derived host system-type],
+[AC_MSG_WARN(overriding system type to $withval)
+	cf_cv_system_name=$withval
+	host_os=$withval
+])
+])dnl
+dnl ---------------------------------------------------------------------------
+dnl CF_XOPEN_SOURCE version: 43 updated: 2013/02/10 10:41:05
 dnl ---------------
 dnl Try to get _XOPEN_SOURCE defined properly that we can use POSIX functions,
 dnl or adapt to the vendor's definitions to get equivalent functionality,
@@ -3483,13 +3678,14 @@
 dnl	$1 is the nominal value for _XOPEN_SOURCE
 dnl	$2 is the nominal value for _POSIX_C_SOURCE
 AC_DEFUN([CF_XOPEN_SOURCE],[
+AC_REQUIRE([AC_CANONICAL_HOST])
 
 cf_XOPEN_SOURCE=ifelse([$1],,500,[$1])
 cf_POSIX_C_SOURCE=ifelse([$2],,199506L,[$2])
 cf_xopen_source=
 
 case $host_os in #(vi
-aix[[456]]*) #(vi
+aix[[4-7]]*) #(vi
 	cf_xopen_source="-D_ALL_SOURCE"
 	;;
 cygwin) #(vi
@@ -3500,6 +3696,7 @@
 	;;
 darwin*) #(vi
 	cf_xopen_source="-D_DARWIN_C_SOURCE"
+	cf_XOPEN_SOURCE=
 	;;
 freebsd*|dragonfly*) #(vi
 	# 5.x headers associate
@@ -3517,15 +3714,23 @@
 	;;
 irix[[56]].*) #(vi
 	cf_xopen_source="-D_SGI_SOURCE"
+	cf_XOPEN_SOURCE=
 	;;
 linux*|gnu*|mint*|k*bsd*-gnu) #(vi
 	CF_GNU_SOURCE
 	;;
 mirbsd*) #(vi
-	# setting _XOPEN_SOURCE or _POSIX_SOURCE breaks <arpa/inet.h>
+	# setting _XOPEN_SOURCE or _POSIX_SOURCE breaks <sys/select.h> and other headers which use u_int / u_short types
+	cf_XOPEN_SOURCE=
+	CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE)
 	;;
 netbsd*) #(vi
-	# setting _XOPEN_SOURCE breaks IPv6 for lynx on NetBSD 1.6, breaks xterm, is not needed for ncursesw
+	cf_xopen_source="-D_NETBSD_SOURCE" # setting _XOPEN_SOURCE breaks IPv6 for lynx on NetBSD 1.6, breaks xterm, is not needed for ncursesw
+	;;
+openbsd[[4-9]]*) #(vi
+	# setting _XOPEN_SOURCE lower than 500 breaks g++ compile with wchar.h, needed for ncursesw
+	cf_xopen_source="-D_BSD_SOURCE"
+	cf_XOPEN_SOURCE=600
 	;;
 openbsd*) #(vi
 	# setting _XOPEN_SOURCE breaks xterm on OpenBSD 2.8, is not needed for ncursesw
@@ -3539,36 +3744,11 @@
 sco*) #(vi
 	# setting _XOPEN_SOURCE breaks Lynx on SCO Unix / OpenServer
 	;;
-solaris2.1[[0-9]]) #(vi
-	cf_xopen_source="-D__EXTENSIONS__ -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE"
-	;;
-solaris2.[[1-9]]) #(vi
+solaris2.*) #(vi
 	cf_xopen_source="-D__EXTENSIONS__"
 	;;
 *)
-	AC_CACHE_CHECK(if we should define _XOPEN_SOURCE,cf_cv_xopen_source,[
-	AC_TRY_COMPILE([#include <sys/types.h>],[
-#ifndef _XOPEN_SOURCE
-make an error
-#endif],
-	[cf_cv_xopen_source=no],
-	[cf_save="$CPPFLAGS"
-	 CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE"
-	 AC_TRY_COMPILE([#include <sys/types.h>],[
-#ifdef _XOPEN_SOURCE
-make an error
-#endif],
-	[cf_cv_xopen_source=no],
-	[cf_cv_xopen_source=$cf_XOPEN_SOURCE])
-	CPPFLAGS="$cf_save"
-	])
-])
-	if test "$cf_cv_xopen_source" != no ; then
-		CF_REMOVE_DEFINE(CFLAGS,$CFLAGS,_XOPEN_SOURCE)
-		CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,_XOPEN_SOURCE)
-		cf_temp_xopen_source="-D_XOPEN_SOURCE=$cf_cv_xopen_source"
-		CF_ADD_CFLAGS($cf_temp_xopen_source)
-	fi
+	CF_TRY_XOPEN_SOURCE
 	CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE)
 	;;
 esac
@@ -3576,4 +3756,33 @@
 if test -n "$cf_xopen_source" ; then
 	CF_ADD_CFLAGS($cf_xopen_source)
 fi
+
+dnl In anything but the default case, we may have system-specific setting
+dnl which is still not guaranteed to provide all of the entrypoints that
+dnl _XOPEN_SOURCE would yield.
+if test -n "$cf_XOPEN_SOURCE" && test -z "$cf_cv_xopen_source" ; then
+	AC_MSG_CHECKING(if _XOPEN_SOURCE really is set)
+	AC_TRY_COMPILE([#include <stdlib.h>],[
+#ifndef _XOPEN_SOURCE
+make an error
+#endif],
+	[cf_XOPEN_SOURCE_set=yes],
+	[cf_XOPEN_SOURCE_set=no])
+	AC_MSG_RESULT($cf_XOPEN_SOURCE_set)
+	if test $cf_XOPEN_SOURCE_set = yes
+	then
+		AC_TRY_COMPILE([#include <stdlib.h>],[
+#if (_XOPEN_SOURCE - 0) < $cf_XOPEN_SOURCE
+make an error
+#endif],
+		[cf_XOPEN_SOURCE_set_ok=yes],
+		[cf_XOPEN_SOURCE_set_ok=no])
+		if test $cf_XOPEN_SOURCE_set_ok = no
+		then
+			AC_MSG_WARN(_XOPEN_SOURCE is lower than requested)
+		fi
+	else
+		CF_TRY_XOPEN_SOURCE
+	fi
+fi
 ])
Index: Ada95/configure
--- ncurses-5.9/Ada95/configure	2011-03-31 23:34:47.000000000 +0000
+++ ncurses-5.9-20130504/Ada95/configure	2013-04-27 19:50:59.000000000 +0000
@@ -1,7 +1,7 @@
 #! /bin/sh
-# From configure.in Revision: 1.30 .
+# From configure.in Revision: 1.47 .
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by Autoconf 2.52.20101002.
+# Generated by Autoconf 2.52.20121002.
 #
 # Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001
 # Free Software Foundation, Inc.
@@ -135,15 +135,16 @@
 bindir='${exec_prefix}/bin'
 sbindir='${exec_prefix}/sbin'
 libexecdir='${exec_prefix}/libexec'
-datadir='${prefix}/share'
+datarootdir='${prefix}/share'
+datadir='${datarootdir}'
 sysconfdir='${prefix}/etc'
 sharedstatedir='${prefix}/com'
 localstatedir='${prefix}/var'
 libdir='${exec_prefix}/lib'
 includedir='${prefix}/include'
 oldincludedir='/usr/include'
-infodir='${prefix}/info'
-mandir='${prefix}/man'
+infodir='${datarootdir}/info'
+mandir='${datarootdir}/man'
 
 # Identity of this package.
 PACKAGE_NAME=
@@ -194,6 +195,13 @@
   | --da=*)
     datadir=$ac_optarg ;;
 
+  -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \
+  | --dataroo | --dataro | --datar)
+    ac_prev=datarootdir ;;
+  -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \
+  | --dataroot=* | --dataroo=* | --dataro=* | --datar=*)
+    datarootdir=$ac_optarg ;;
+
   -disable-* | --disable-*)
     ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
     # Reject names that are not valid shell variable names.
@@ -469,7 +477,7 @@
 done
 
 # Be sure to have absolute paths.
-for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \
+for ac_var in bindir sbindir libexecdir datarootdir datadir sysconfdir sharedstatedir \
               localstatedir libdir includedir oldincludedir infodir mandir
 do
   eval ac_val=$`echo $ac_var`
@@ -606,15 +614,16 @@
   --bindir=DIR            user executables [EPREFIX/bin]
   --sbindir=DIR           system admin executables [EPREFIX/sbin]
   --libexecdir=DIR        program executables [EPREFIX/libexec]
-  --datadir=DIR           read-only architecture-independent data [PREFIX/share]
+  --datarootdir=DIR       read-only architecture-independent data [PREFIX/share]
+  --datadir=DIR           read-only architecture-independent data [DATAROOTDIR]
   --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
   --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
   --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
   --libdir=DIR            object code libraries [EPREFIX/lib]
   --includedir=DIR        C header files [PREFIX/include]
   --oldincludedir=DIR     C header files for non-gcc [/usr/include]
-  --infodir=DIR           info documentation [PREFIX/info]
-  --mandir=DIR            man documentation [PREFIX/man]
+  --infodir=DIR           info documentation [DATAROOTDIR/info]
+  --mandir=DIR            man documentation [DATAROOTDIR/man]
 EOF
 
   cat <<\EOF
@@ -645,6 +654,7 @@
 
   --with-system-type=XXX  test: override derived host system-type
   --with-pkg-config{=path} enable/disable use of pkg-config
+  --with-pkg-config-libdir=XXX use given directory for installing pc-files
   --enable-pc-files       generate and install .pc files for pkg-config
   --without-tests         suppress build with test-programs
   --enable-mixed-case     tic should assume mixed-case filenames
@@ -660,6 +670,7 @@
   --with-shared           generate shared C-objects (needed for --with-ada-sharedlib)
   --enable-widec          compile with wide-char/UTF-8 code
   --with-curses-dir=DIR   directory in which (n)curses is installed
+  --with-lib-prefix       override library-prefix
   --with-shlib-version=X  Specify rel or abi version for shared libs
   --enable-rpath-link     link sample programs with rpath option
 Fine-Tuning Your Configuration:
@@ -677,7 +688,7 @@
   --enable-reentrant      compile with experimental reentrant code
   --with-wrap-prefix=XXX  override prefix used for public variables
 Testing/development Options:
-  --enable-echo           build: display "compiling" commands (default)
+  --disable-echo          do not display "compiling" commands
   --enable-warnings       build: turn on GCC compiler warnings
   --enable-assertions     test: turn on generation of assertion code
   --enable-expanded       test: generate functions for certain macros
@@ -757,7 +768,7 @@
 running configure, to aid debugging if configure makes a mistake.
 
 It was created by $as_me, which was
-generated by GNU Autoconf 2.52.20101002.  Invocation command line was
+generated by GNU Autoconf 2.52.20121002.  Invocation command line was
 
   $ $0 $@
 
@@ -881,7 +892,7 @@
 fi
 for ac_site_file in $CONFIG_SITE; do
   if test -r "$ac_site_file"; then
-    { echo "$as_me:884: loading site script $ac_site_file" >&5
+    { echo "$as_me:895: loading site script $ac_site_file" >&5
 echo "$as_me: loading site script $ac_site_file" >&6;}
     cat "$ac_site_file" >&5
     . "$ac_site_file"
@@ -892,7 +903,7 @@
   # Some versions of bash will fail to source /dev/null (special
   # files actually), so we avoid doing that.
   if test -f "$cache_file"; then
-    { echo "$as_me:895: loading cache $cache_file" >&5
+    { echo "$as_me:906: loading cache $cache_file" >&5
 echo "$as_me: loading cache $cache_file" >&6;}
     case $cache_file in
       [\\/]* | ?:[\\/]* ) . $cache_file;;
@@ -900,7 +911,7 @@
     esac
   fi
 else
-  { echo "$as_me:903: creating cache $cache_file" >&5
+  { echo "$as_me:914: creating cache $cache_file" >&5
 echo "$as_me: creating cache $cache_file" >&6;}
   >$cache_file
 fi
@@ -916,21 +927,21 @@
   eval ac_new_val="\$ac_env_${ac_var}_value"
   case $ac_old_set,$ac_new_set in
     set,)
-      { echo "$as_me:919: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
+      { echo "$as_me:930: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
 echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
       ac_cache_corrupted=: ;;
     ,set)
-      { echo "$as_me:923: error: \`$ac_var' was not set in the previous run" >&5
+      { echo "$as_me:934: error: \`$ac_var' was not set in the previous run" >&5
 echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
       ac_cache_corrupted=: ;;
     ,);;
     *)
       if test "x$ac_old_val" != "x$ac_new_val"; then
-        { echo "$as_me:929: error: \`$ac_var' has changed since the previous run:" >&5
+        { echo "$as_me:940: error: \`$ac_var' has changed since the previous run:" >&5
 echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
-        { echo "$as_me:931:   former value:  $ac_old_val" >&5
+        { echo "$as_me:942:   former value:  $ac_old_val" >&5
 echo "$as_me:   former value:  $ac_old_val" >&2;}
-        { echo "$as_me:933:   current value: $ac_new_val" >&5
+        { echo "$as_me:944:   current value: $ac_new_val" >&5
 echo "$as_me:   current value: $ac_new_val" >&2;}
         ac_cache_corrupted=:
       fi;;
@@ -949,9 +960,9 @@
   fi
 done
 if $ac_cache_corrupted; then
-  { echo "$as_me:952: error: changes in the environment can compromise the build" >&5
+  { echo "$as_me:963: error: changes in the environment can compromise the build" >&5
 echo "$as_me: error: changes in the environment can compromise the build" >&2;}
-  { { echo "$as_me:954: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
+  { { echo "$as_me:965: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
 echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;}
    { (exit 1); exit 1; }; }
 fi
@@ -972,10 +983,10 @@
 echo "#! $SHELL" >conftest.sh
 echo  "exit 0"   >>conftest.sh
 chmod +x conftest.sh
-if { (echo "$as_me:975: PATH=\".;.\"; conftest.sh") >&5
+if { (echo "$as_me:986: PATH=\".;.\"; conftest.sh") >&5
   (PATH=".;."; conftest.sh) 2>&5
   ac_status=$?
-  echo "$as_me:978: \$? = $ac_status" >&5
+  echo "$as_me:989: \$? = $ac_status" >&5
   (exit $ac_status); }; then
   ac_path_separator=';'
 else
@@ -1005,7 +1016,7 @@
   fi
 done
 if test -z "$ac_aux_dir"; then
-  { { echo "$as_me:1008: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5
+  { { echo "$as_me:1019: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5
 echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;}
    { (exit 1); exit 1; }; }
 fi
@@ -1015,11 +1026,11 @@
 
 # Make sure we can run config.sub.
 $ac_config_sub sun4 >/dev/null 2>&1 ||
-  { { echo "$as_me:1018: error: cannot run $ac_config_sub" >&5
+  { { echo "$as_me:1029: error: cannot run $ac_config_sub" >&5
 echo "$as_me: error: cannot run $ac_config_sub" >&2;}
    { (exit 1); exit 1; }; }
 
-echo "$as_me:1022: checking build system type" >&5
+echo "$as_me:1033: checking build system type" >&5
 echo $ECHO_N "checking build system type... $ECHO_C" >&6
 if test "${ac_cv_build+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -1028,23 +1039,23 @@
 test -z "$ac_cv_build_alias" &&
   ac_cv_build_alias=`$ac_config_guess`
 test -z "$ac_cv_build_alias" &&
-  { { echo "$as_me:1031: error: cannot guess build type; you must specify one" >&5
+  { { echo "$as_me:1042: error: cannot guess build type; you must specify one" >&5
 echo "$as_me: error: cannot guess build type; you must specify one" >&2;}
    { (exit 1); exit 1; }; }
 ac_cv_build=`$ac_config_sub $ac_cv_build_alias` ||
-  { { echo "$as_me:1035: error: $ac_config_sub $ac_cv_build_alias failed." >&5
+  { { echo "$as_me:1046: error: $ac_config_sub $ac_cv_build_alias failed." >&5
 echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed." >&2;}
    { (exit 1); exit 1; }; }
 
 fi
-echo "$as_me:1040: result: $ac_cv_build" >&5
+echo "$as_me:1051: result: $ac_cv_build" >&5
 echo "${ECHO_T}$ac_cv_build" >&6
 build=$ac_cv_build
 build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
 build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
 build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
 
-echo "$as_me:1047: checking host system type" >&5
+echo "$as_me:1058: checking host system type" >&5
 echo $ECHO_N "checking host system type... $ECHO_C" >&6
 if test "${ac_cv_host+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -1053,12 +1064,12 @@
 test -z "$ac_cv_host_alias" &&
   ac_cv_host_alias=$ac_cv_build_alias
 ac_cv_host=`$ac_config_sub $ac_cv_host_alias` ||
-  { { echo "$as_me:1056: error: $ac_config_sub $ac_cv_host_alias failed" >&5
+  { { echo "$as_me:1067: error: $ac_config_sub $ac_cv_host_alias failed" >&5
 echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;}
    { (exit 1); exit 1; }; }
 
 fi
-echo "$as_me:1061: result: $ac_cv_host" >&5
+echo "$as_me:1072: result: $ac_cv_host" >&5
 echo "${ECHO_T}$ac_cv_host" >&6
 host=$ac_cv_host
 host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
@@ -1066,7 +1077,7 @@
 host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
 
 if test -f $srcdir/config.guess || test -f $ac_aux_dir/config.guess ; then
-	echo "$as_me:1069: checking target system type" >&5
+	echo "$as_me:1080: checking target system type" >&5
 echo $ECHO_N "checking target system type... $ECHO_C" >&6
 if test "${ac_cv_target+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -1075,12 +1086,12 @@
 test "x$ac_cv_target_alias" = "x" &&
   ac_cv_target_alias=$ac_cv_host_alias
 ac_cv_target=`$ac_config_sub $ac_cv_target_alias` ||
-  { { echo "$as_me:1078: error: $ac_config_sub $ac_cv_target_alias failed" >&5
+  { { echo "$as_me:1089: error: $ac_config_sub $ac_cv_target_alias failed" >&5
 echo "$as_me: error: $ac_config_sub $ac_cv_target_alias failed" >&2;}
    { (exit 1); exit 1; }; }
 
 fi
-echo "$as_me:1083: result: $ac_cv_target" >&5
+echo "$as_me:1094: result: $ac_cv_target" >&5
 echo "${ECHO_T}$ac_cv_target" >&6
 target=$ac_cv_target
 target_cpu=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
@@ -1100,7 +1111,8 @@
 		system_name="`(hostname) 2>/dev/null`"
 	fi
 fi
-test -n "$system_name" && cat >>confdefs.h <<EOF
+test -n "$system_name" &&
+cat >>confdefs.h <<EOF
 #define SYSTEM_NAME "$system_name"
 EOF
 
@@ -1111,13 +1123,13 @@
 fi
 
 test -z "$system_name" && system_name="$cf_cv_system_name"
-test -n "$cf_cv_system_name" && echo "$as_me:1114: result: Configuring for $cf_cv_system_name" >&5
+test -n "$cf_cv_system_name" && echo "$as_me:1126: result: Configuring for $cf_cv_system_name" >&5
 echo "${ECHO_T}Configuring for $cf_cv_system_name" >&6
 
 if test ".$system_name" != ".$cf_cv_system_name" ; then
-	echo "$as_me:1118: result: Cached system name ($system_name) does not agree with actual ($cf_cv_system_name)" >&5
+	echo "$as_me:1130: result: Cached system name ($system_name) does not agree with actual ($cf_cv_system_name)" >&5
 echo "${ECHO_T}Cached system name ($system_name) does not agree with actual ($cf_cv_system_name)" >&6
-	{ { echo "$as_me:1120: error: \"Please remove config.cache and try again.\"" >&5
+	{ { echo "$as_me:1132: error: \"Please remove config.cache and try again.\"" >&5
 echo "$as_me: error: \"Please remove config.cache and try again.\"" >&2;}
    { (exit 1); exit 1; }; }
 fi
@@ -1125,9 +1137,11 @@
 # Check whether --with-system-type or --without-system-type was given.
 if test "${with_system_type+set}" = set; then
   withval="$with_system_type"
-  { echo "$as_me:1128: WARNING: overriding system type to $withval" >&5
+  { echo "$as_me:1140: WARNING: overriding system type to $withval" >&5
 echo "$as_me: WARNING: overriding system type to $withval" >&2;}
- cf_cv_system_name=$withval
+	cf_cv_system_name=$withval
+	host_os=$withval
+
 fi;
 
 ###	Save the given $CFLAGS to allow user-override.
@@ -1135,23 +1149,23 @@
 
 ###	Default install-location
 
-echo "$as_me:1138: checking for prefix" >&5
+echo "$as_me:1152: checking for prefix" >&5
 echo $ECHO_N "checking for prefix... $ECHO_C" >&6
 if test "x$prefix" = "xNONE" ; then
 	case "$cf_cv_system_name" in
 		# non-vendor systems don't have a conflict
-	openbsd*|freebsd*|linux*|cygwin*|k*bsd*-gnu)
+	openbsd*|freebsd*|mirbsd*|linux*|cygwin*|k*bsd*-gnu|mingw*)
 		prefix=/usr
 		;;
 	*)	prefix=$ac_default_prefix
 		;;
 	esac
 fi
-echo "$as_me:1150: result: $prefix" >&5
+echo "$as_me:1164: result: $prefix" >&5
 echo "${ECHO_T}$prefix" >&6
 
 if test "x$prefix" = "xNONE" ; then
-echo "$as_me:1154: checking for default include-directory" >&5
+echo "$as_me:1168: checking for default include-directory" >&5
 echo $ECHO_N "checking for default include-directory... $ECHO_C" >&6
 test -n "$verbose" && echo 1>&6
 for cf_symbol in \
@@ -1174,11 +1188,12 @@
 	fi
 	test -n "$verbose"  && echo "	tested $cf_dir" 1>&6
 done
-echo "$as_me:1177: result: $includedir" >&5
+echo "$as_me:1191: result: $includedir" >&5
 echo "${ECHO_T}$includedir" >&6
 fi
 
 ###	Checks for programs.
+
 ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -1186,213 +1201,11 @@
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
 ac_main_return=return
 if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
-set dummy ${ac_tool_prefix}gcc; ac_word=$2
-echo "$as_me:1191: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_CC+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  if test -n "$CC"; then
-  ac_cv_prog_CC="$CC" # Let the user override the test.
-else
-  ac_save_IFS=$IFS; IFS=$ac_path_separator
-ac_dummy="$PATH"
-for ac_dir in $ac_dummy; do
-  IFS=$ac_save_IFS
-  test -z "$ac_dir" && ac_dir=.
-  $as_executable_p "$ac_dir/$ac_word" || continue
-ac_cv_prog_CC="${ac_tool_prefix}gcc"
-echo "$as_me:1206: found $ac_dir/$ac_word" >&5
-break
-done
-
-fi
-fi
-CC=$ac_cv_prog_CC
-if test -n "$CC"; then
-  echo "$as_me:1214: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6
-else
-  echo "$as_me:1217: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
-fi
-if test -z "$ac_cv_prog_CC"; then
-  ac_ct_CC=$CC
-  # Extract the first word of "gcc", so it can be a program name with args.
-set dummy gcc; ac_word=$2
-echo "$as_me:1226: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  if test -n "$ac_ct_CC"; then
-  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
-else
-  ac_save_IFS=$IFS; IFS=$ac_path_separator
-ac_dummy="$PATH"
-for ac_dir in $ac_dummy; do
-  IFS=$ac_save_IFS
-  test -z "$ac_dir" && ac_dir=.
-  $as_executable_p "$ac_dir/$ac_word" || continue
-ac_cv_prog_ac_ct_CC="gcc"
-echo "$as_me:1241: found $ac_dir/$ac_word" >&5
-break
-done
-
-fi
-fi
-ac_ct_CC=$ac_cv_prog_ac_ct_CC
-if test -n "$ac_ct_CC"; then
-  echo "$as_me:1249: result: $ac_ct_CC" >&5
-echo "${ECHO_T}$ac_ct_CC" >&6
-else
-  echo "$as_me:1252: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
-  CC=$ac_ct_CC
-else
-  CC="$ac_cv_prog_CC"
-fi
-
-if test -z "$CC"; then
-  if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
-set dummy ${ac_tool_prefix}cc; ac_word=$2
-echo "$as_me:1265: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_CC+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  if test -n "$CC"; then
-  ac_cv_prog_CC="$CC" # Let the user override the test.
-else
-  ac_save_IFS=$IFS; IFS=$ac_path_separator
-ac_dummy="$PATH"
-for ac_dir in $ac_dummy; do
-  IFS=$ac_save_IFS
-  test -z "$ac_dir" && ac_dir=.
-  $as_executable_p "$ac_dir/$ac_word" || continue
-ac_cv_prog_CC="${ac_tool_prefix}cc"
-echo "$as_me:1280: found $ac_dir/$ac_word" >&5
-break
-done
-
-fi
-fi
-CC=$ac_cv_prog_CC
-if test -n "$CC"; then
-  echo "$as_me:1288: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6
-else
-  echo "$as_me:1291: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
-fi
-if test -z "$ac_cv_prog_CC"; then
-  ac_ct_CC=$CC
-  # Extract the first word of "cc", so it can be a program name with args.
-set dummy cc; ac_word=$2
-echo "$as_me:1300: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  if test -n "$ac_ct_CC"; then
-  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
-else
-  ac_save_IFS=$IFS; IFS=$ac_path_separator
-ac_dummy="$PATH"
-for ac_dir in $ac_dummy; do
-  IFS=$ac_save_IFS
-  test -z "$ac_dir" && ac_dir=.
-  $as_executable_p "$ac_dir/$ac_word" || continue
-ac_cv_prog_ac_ct_CC="cc"
-echo "$as_me:1315: found $ac_dir/$ac_word" >&5
-break
-done
-
-fi
-fi
-ac_ct_CC=$ac_cv_prog_ac_ct_CC
-if test -n "$ac_ct_CC"; then
-  echo "$as_me:1323: result: $ac_ct_CC" >&5
-echo "${ECHO_T}$ac_ct_CC" >&6
-else
-  echo "$as_me:1326: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
-  CC=$ac_ct_CC
-else
-  CC="$ac_cv_prog_CC"
-fi
-
-fi
-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 "$as_me:1339: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_CC+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  if test -n "$CC"; then
-  ac_cv_prog_CC="$CC" # Let the user override the test.
-else
-  ac_prog_rejected=no
-  ac_save_IFS=$IFS; IFS=$ac_path_separator
-ac_dummy="$PATH"
-for ac_dir in $ac_dummy; do
-  IFS=$ac_save_IFS
-  test -z "$ac_dir" && ac_dir=.
-  $as_executable_p "$ac_dir/$ac_word" || continue
-if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then
-  ac_prog_rejected=yes
-  continue
-fi
-ac_cv_prog_CC="cc"
-echo "$as_me:1359: found $ac_dir/$ac_word" >&5
-break
-done
-
-if test $ac_prog_rejected = yes; then
-  # We found a bogon in the path, so make sure we never use it.
-  set dummy $ac_cv_prog_CC
-  shift
-  if test $# != 0; then
-    # We chose a different compiler from the bogus one.
-    # However, it has the same basename, so the bogon will be chosen
-    # first if we set CC to just the basename; use the full file name.
-    shift
-    set dummy "$ac_dir/$ac_word" ${1+"$@"}
-    shift
-    ac_cv_prog_CC="$@"
-  fi
-fi
-fi
-fi
-CC=$ac_cv_prog_CC
-if test -n "$CC"; then
-  echo "$as_me:1381: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6
-else
-  echo "$as_me:1384: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
-fi
-if test -z "$CC"; then
-  if test -n "$ac_tool_prefix"; then
-  for ac_prog in cl
+  for ac_prog in gnatgcc gcc cc
   do
     # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
 set dummy $ac_tool_prefix$ac_prog; ac_word=$2
-echo "$as_me:1395: checking for $ac_word" >&5
+echo "$as_me:1208: checking for $ac_word" >&5
 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
 if test "${ac_cv_prog_CC+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -1407,7 +1220,7 @@
   test -z "$ac_dir" && ac_dir=.
   $as_executable_p "$ac_dir/$ac_word" || continue
 ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
-echo "$as_me:1410: found $ac_dir/$ac_word" >&5
+echo "$as_me:1223: found $ac_dir/$ac_word" >&5
 break
 done
 
@@ -1415,10 +1228,10 @@
 fi
 CC=$ac_cv_prog_CC
 if test -n "$CC"; then
-  echo "$as_me:1418: result: $CC" >&5
+  echo "$as_me:1231: result: $CC" >&5
 echo "${ECHO_T}$CC" >&6
 else
-  echo "$as_me:1421: result: no" >&5
+  echo "$as_me:1234: result: no" >&5
 echo "${ECHO_T}no" >&6
 fi
 
@@ -1427,11 +1240,11 @@
 fi
 if test -z "$CC"; then
   ac_ct_CC=$CC
-  for ac_prog in cl
+  for ac_prog in gnatgcc gcc cc
 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 "$as_me:1434: checking for $ac_word" >&5
+echo "$as_me:1247: checking for $ac_word" >&5
 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -1446,7 +1259,7 @@
   test -z "$ac_dir" && ac_dir=.
   $as_executable_p "$ac_dir/$ac_word" || continue
 ac_cv_prog_ac_ct_CC="$ac_prog"
-echo "$as_me:1449: found $ac_dir/$ac_word" >&5
+echo "$as_me:1262: found $ac_dir/$ac_word" >&5
 break
 done
 
@@ -1454,10 +1267,10 @@
 fi
 ac_ct_CC=$ac_cv_prog_ac_ct_CC
 if test -n "$ac_ct_CC"; then
-  echo "$as_me:1457: result: $ac_ct_CC" >&5
+  echo "$as_me:1270: result: $ac_ct_CC" >&5
 echo "${ECHO_T}$ac_ct_CC" >&6
 else
-  echo "$as_me:1460: result: no" >&5
+  echo "$as_me:1273: result: no" >&5
 echo "${ECHO_T}no" >&6
 fi
 
@@ -1467,34 +1280,32 @@
   CC=$ac_ct_CC
 fi
 
-fi
-
-test -z "$CC" && { { echo "$as_me:1472: error: no acceptable cc found in \$PATH" >&5
+test -z "$CC" && { { echo "$as_me:1283: error: no acceptable cc found in \$PATH" >&5
 echo "$as_me: error: no acceptable cc found in \$PATH" >&2;}
    { (exit 1); exit 1; }; }
 
 # Provide some information about the compiler.
-echo "$as_me:1477:" \
+echo "$as_me:1288:" \
      "checking for C compiler version" >&5
 ac_compiler=`set X $ac_compile; echo $2`
-{ (eval echo "$as_me:1480: \"$ac_compiler --version </dev/null >&5\"") >&5
+{ (eval echo "$as_me:1291: \"$ac_compiler --version </dev/null >&5\"") >&5
   (eval $ac_compiler --version </dev/null >&5) 2>&5
   ac_status=$?
-  echo "$as_me:1483: \$? = $ac_status" >&5
+  echo "$as_me:1294: \$? = $ac_status" >&5
   (exit $ac_status); }
-{ (eval echo "$as_me:1485: \"$ac_compiler -v </dev/null >&5\"") >&5
+{ (eval echo "$as_me:1296: \"$ac_compiler -v </dev/null >&5\"") >&5
   (eval $ac_compiler -v </dev/null >&5) 2>&5
   ac_status=$?
-  echo "$as_me:1488: \$? = $ac_status" >&5
+  echo "$as_me:1299: \$? = $ac_status" >&5
   (exit $ac_status); }
-{ (eval echo "$as_me:1490: \"$ac_compiler -V </dev/null >&5\"") >&5
+{ (eval echo "$as_me:1301: \"$ac_compiler -V </dev/null >&5\"") >&5
   (eval $ac_compiler -V </dev/null >&5) 2>&5
   ac_status=$?
-  echo "$as_me:1493: \$? = $ac_status" >&5
+  echo "$as_me:1304: \$? = $ac_status" >&5
   (exit $ac_status); }
 
 cat >conftest.$ac_ext <<_ACEOF
-#line 1497 "configure"
+#line 1308 "configure"
 #include "confdefs.h"
 
 int
@@ -1510,13 +1321,13 @@
 # Try to create an executable without -o first, disregard a.out.
 # It will help us diagnose broken compilers, and finding out an intuition
 # of exeext.
-echo "$as_me:1513: checking for C compiler default output" >&5
+echo "$as_me:1324: checking for C compiler default output" >&5
 echo $ECHO_N "checking for C compiler default output... $ECHO_C" >&6
 ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
-if { (eval echo "$as_me:1516: \"$ac_link_default\"") >&5
+if { (eval echo "$as_me:1327: \"$ac_link_default\"") >&5
   (eval $ac_link_default) 2>&5
   ac_status=$?
-  echo "$as_me:1519: \$? = $ac_status" >&5
+  echo "$as_me:1330: \$? = $ac_status" >&5
   (exit $ac_status); }; then
   # Find the output, starting from the most likely.  This scheme is
 # not robust to junk in `.', hence go to wildcards (a.*) only as a last
@@ -1539,34 +1350,34 @@
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-{ { echo "$as_me:1542: error: C compiler cannot create executables" >&5
+{ { echo "$as_me:1353: error: C compiler cannot create executables" >&5
 echo "$as_me: error: C compiler cannot create executables" >&2;}
    { (exit 77); exit 77; }; }
 fi
 
 ac_exeext=$ac_cv_exeext
-echo "$as_me:1548: result: $ac_file" >&5
+echo "$as_me:1359: result: $ac_file" >&5
 echo "${ECHO_T}$ac_file" >&6
 
 # Check the compiler produces executables we can run.  If not, either
 # the compiler is broken, or we cross compile.
-echo "$as_me:1553: checking whether the C compiler works" >&5
+echo "$as_me:1364: checking whether the C compiler works" >&5
 echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6
 # FIXME: These cross compiler hacks should be removed for Autoconf 3.0
 # If not cross compiling, check that we can run a simple program.
 if test "$cross_compiling" != yes; then
   if { ac_try='./$ac_file'
-  { (eval echo "$as_me:1559: \"$ac_try\"") >&5
+  { (eval echo "$as_me:1370: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:1562: \$? = $ac_status" >&5
+  echo "$as_me:1373: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
     cross_compiling=no
   else
     if test "$cross_compiling" = maybe; then
 	cross_compiling=yes
     else
-	{ { echo "$as_me:1569: error: cannot run C compiled programs.
+	{ { echo "$as_me:1380: error: cannot run C compiled programs.
 If you meant to cross compile, use \`--host'." >&5
 echo "$as_me: error: cannot run C compiled programs.
 If you meant to cross compile, use \`--host'." >&2;}
@@ -1574,24 +1385,24 @@
     fi
   fi
 fi
-echo "$as_me:1577: result: yes" >&5
+echo "$as_me:1388: result: yes" >&5
 echo "${ECHO_T}yes" >&6
 
 rm -f a.out a.exe conftest$ac_cv_exeext
 ac_clean_files=$ac_clean_files_save
 # Check the compiler produces executables we can run.  If not, either
 # the compiler is broken, or we cross compile.
-echo "$as_me:1584: checking whether we are cross compiling" >&5
+echo "$as_me:1395: checking whether we are cross compiling" >&5
 echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6
-echo "$as_me:1586: result: $cross_compiling" >&5
+echo "$as_me:1397: result: $cross_compiling" >&5
 echo "${ECHO_T}$cross_compiling" >&6
 
-echo "$as_me:1589: checking for executable suffix" >&5
+echo "$as_me:1400: checking for executable suffix" >&5
 echo $ECHO_N "checking for executable suffix... $ECHO_C" >&6
-if { (eval echo "$as_me:1591: \"$ac_link\"") >&5
+if { (eval echo "$as_me:1402: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:1594: \$? = $ac_status" >&5
+  echo "$as_me:1405: \$? = $ac_status" >&5
   (exit $ac_status); }; then
   # If both `conftest.exe' and `conftest' are `present' (well, observable)
 # catch `conftest.exe'.  For instance with Cygwin, `ls conftest' will
@@ -1607,25 +1418,25 @@
   esac
 done
 else
-  { { echo "$as_me:1610: error: cannot compute EXEEXT: cannot compile and link" >&5
+  { { echo "$as_me:1421: error: cannot compute EXEEXT: cannot compile and link" >&5
 echo "$as_me: error: cannot compute EXEEXT: cannot compile and link" >&2;}
    { (exit 1); exit 1; }; }
 fi
 
 rm -f conftest$ac_cv_exeext
-echo "$as_me:1616: result: $ac_cv_exeext" >&5
+echo "$as_me:1427: result: $ac_cv_exeext" >&5
 echo "${ECHO_T}$ac_cv_exeext" >&6
 
 rm -f conftest.$ac_ext
 EXEEXT=$ac_cv_exeext
 ac_exeext=$EXEEXT
-echo "$as_me:1622: checking for object suffix" >&5
+echo "$as_me:1433: checking for object suffix" >&5
 echo $ECHO_N "checking for object suffix... $ECHO_C" >&6
 if test "${ac_cv_objext+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 1628 "configure"
+#line 1439 "configure"
 #include "confdefs.h"
 
 int
@@ -1637,10 +1448,10 @@
 }
 _ACEOF
 rm -f conftest.o conftest.obj
-if { (eval echo "$as_me:1640: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:1451: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:1643: \$? = $ac_status" >&5
+  echo "$as_me:1454: \$? = $ac_status" >&5
   (exit $ac_status); }; then
   for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do
   case $ac_file in
@@ -1652,24 +1463,24 @@
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-{ { echo "$as_me:1655: error: cannot compute OBJEXT: cannot compile" >&5
+{ { echo "$as_me:1466: error: cannot compute OBJEXT: cannot compile" >&5
 echo "$as_me: error: cannot compute OBJEXT: cannot compile" >&2;}
    { (exit 1); exit 1; }; }
 fi
 
 rm -f conftest.$ac_cv_objext conftest.$ac_ext
 fi
-echo "$as_me:1662: result: $ac_cv_objext" >&5
+echo "$as_me:1473: result: $ac_cv_objext" >&5
 echo "${ECHO_T}$ac_cv_objext" >&6
 OBJEXT=$ac_cv_objext
 ac_objext=$OBJEXT
-echo "$as_me:1666: checking whether we are using the GNU C compiler" >&5
+echo "$as_me:1477: checking whether we are using the GNU C compiler" >&5
 echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6
 if test "${ac_cv_c_compiler_gnu+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 1672 "configure"
+#line 1483 "configure"
 #include "confdefs.h"
 
 int
@@ -1684,16 +1495,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:1687: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:1498: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:1690: \$? = $ac_status" >&5
+  echo "$as_me:1501: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:1693: \"$ac_try\"") >&5
+  { (eval echo "$as_me:1504: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:1696: \$? = $ac_status" >&5
+  echo "$as_me:1507: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_compiler_gnu=yes
 else
@@ -1705,19 +1516,19 @@
 ac_cv_c_compiler_gnu=$ac_compiler_gnu
 
 fi
-echo "$as_me:1708: result: $ac_cv_c_compiler_gnu" >&5
+echo "$as_me:1519: result: $ac_cv_c_compiler_gnu" >&5
 echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6
 GCC=`test $ac_compiler_gnu = yes && echo yes`
 ac_test_CFLAGS=${CFLAGS+set}
 ac_save_CFLAGS=$CFLAGS
 CFLAGS="-g"
-echo "$as_me:1714: checking whether $CC accepts -g" >&5
+echo "$as_me:1525: checking whether $CC accepts -g" >&5
 echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6
 if test "${ac_cv_prog_cc_g+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 1720 "configure"
+#line 1531 "configure"
 #include "confdefs.h"
 
 int
@@ -1729,16 +1540,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:1732: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:1543: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:1735: \$? = $ac_status" >&5
+  echo "$as_me:1546: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:1738: \"$ac_try\"") >&5
+  { (eval echo "$as_me:1549: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:1741: \$? = $ac_status" >&5
+  echo "$as_me:1552: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_prog_cc_g=yes
 else
@@ -1748,7 +1559,7 @@
 fi
 rm -f conftest.$ac_objext conftest.$ac_ext
 fi
-echo "$as_me:1751: result: $ac_cv_prog_cc_g" >&5
+echo "$as_me:1562: result: $ac_cv_prog_cc_g" >&5
 echo "${ECHO_T}$ac_cv_prog_cc_g" >&6
 if test "$ac_test_CFLAGS" = set; then
   CFLAGS=$ac_save_CFLAGS
@@ -1775,16 +1586,16 @@
 #endif
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:1778: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:1589: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:1781: \$? = $ac_status" >&5
+  echo "$as_me:1592: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:1784: \"$ac_try\"") >&5
+  { (eval echo "$as_me:1595: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:1787: \$? = $ac_status" >&5
+  echo "$as_me:1598: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   for ac_declaration in \
    ''\
@@ -1796,7 +1607,7 @@
    'void exit (int);'
 do
   cat >conftest.$ac_ext <<_ACEOF
-#line 1799 "configure"
+#line 1610 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 $ac_declaration
@@ -1809,16 +1620,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:1812: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:1623: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:1815: \$? = $ac_status" >&5
+  echo "$as_me:1626: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:1818: \"$ac_try\"") >&5
+  { (eval echo "$as_me:1629: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:1821: \$? = $ac_status" >&5
+  echo "$as_me:1632: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   :
 else
@@ -1828,7 +1639,7 @@
 fi
 rm -f conftest.$ac_objext conftest.$ac_ext
   cat >conftest.$ac_ext <<_ACEOF
-#line 1831 "configure"
+#line 1642 "configure"
 #include "confdefs.h"
 $ac_declaration
 int
@@ -1840,16 +1651,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:1843: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:1654: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:1846: \$? = $ac_status" >&5
+  echo "$as_me:1657: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:1849: \"$ac_try\"") >&5
+  { (eval echo "$as_me:1660: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:1852: \$? = $ac_status" >&5
+  echo "$as_me:1663: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   break
 else
@@ -1879,68 +1690,259 @@
 
 GCC_VERSION=none
 if test "$GCC" = yes ; then
-	echo "$as_me:1882: checking version of $CC" >&5
+	echo "$as_me:1693: checking version of $CC" >&5
 echo $ECHO_N "checking version of $CC... $ECHO_C" >&6
-	GCC_VERSION="`${CC} --version 2>/dev/null | sed -e '2,$d' -e 's/^.*(GCC) //' -e 's/^[^0-9.]*//' -e 's/[^0-9.].*//'`"
+	GCC_VERSION="`${CC} --version 2>/dev/null | sed -e '2,$d' -e 's/^.*(GCC[^)]*) //' -e 's/^.*(Debian[^)]*) //' -e 's/^[^0-9.]*//' -e 's/[^0-9.].*//'`"
 	test -z "$GCC_VERSION" && GCC_VERSION=unknown
-	echo "$as_me:1886: result: $GCC_VERSION" >&5
+	echo "$as_me:1697: result: $GCC_VERSION" >&5
 echo "${ECHO_T}$GCC_VERSION" >&6
 fi
 
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-ac_main_return=return
-echo "$as_me:1896: checking how to run the C preprocessor" >&5
-echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6
-# On Suns, sometimes $CPP names a directory.
-if test -n "$CPP" && test -d "$CPP"; then
-  CPP=
-fi
-if test -z "$CPP"; then
-  if test "${ac_cv_prog_CPP+set}" = set; then
+echo "$as_me:1701: checking for $CC option to accept ANSI C" >&5
+echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6
+if test "${ac_cv_prog_cc_stdc+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-      # Double quotes because CPP needs to be expanded
-    for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
-    do
-      ac_preproc_ok=false
-for ac_c_preproc_warn_flag in '' yes
-do
-  # Use a header file that comes with gcc, so configuring glibc
-  # with a fresh cross-compiler works.
-  # On the NeXT, cc -E runs the code through the compiler's parser,
-  # not just through cpp. "Syntax error" is here to catch this case.
-  cat >conftest.$ac_ext <<_ACEOF
-#line 1917 "configure"
+  ac_cv_prog_cc_stdc=no
+ac_save_CC=$CC
+cat >conftest.$ac_ext <<_ACEOF
+#line 1709 "configure"
 #include "confdefs.h"
-#include <assert.h>
-                     Syntax error
+#include <stdarg.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+     char **p;
+     int i;
+{
+  return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+  char *s;
+  va_list v;
+  va_start (v,p);
+  s = g (p, va_arg (v,int));
+  va_end (v);
+  return s;
+}
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
+int argc;
+char **argv;
+int
+main ()
+{
+return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
+  ;
+  return 0;
+}
 _ACEOF
-if { (eval echo "$as_me:1922: \"$ac_cpp conftest.$ac_ext\"") >&5
-  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+# Don't try gcc -ansi; that turns off useful extensions and
+# breaks some systems' header files.
+# AIX			-qlanglvl=ansi
+# Ultrix and OSF/1	-std1
+# HP-UX 10.20 and later	-Ae
+# HP-UX older versions	-Aa -D_HPUX_SOURCE
+# SVR4			-Xc -D__EXTENSIONS__
+for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+  CC="$ac_save_CC $ac_arg"
+  rm -f conftest.$ac_objext
+if { (eval echo "$as_me:1758: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
   ac_status=$?
-  egrep -v '^ *\+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:1928: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null; then
-  if test -s conftest.err; then
-    ac_cpp_err=$ac_c_preproc_warn_flag
-  else
-    ac_cpp_err=
-  fi
-else
-  ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
-  :
+  echo "$as_me:1761: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:1764: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:1767: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_prog_cc_stdc=$ac_arg
+break
 else
   echo "$as_me: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  # Broken: fails on valid input.
+cat conftest.$ac_ext >&5
+fi
+rm -f conftest.$ac_objext
+done
+rm -f conftest.$ac_ext conftest.$ac_objext
+CC=$ac_save_CC
+
+fi
+
+case "x$ac_cv_prog_cc_stdc" in
+  x|xno)
+    echo "$as_me:1784: result: none needed" >&5
+echo "${ECHO_T}none needed" >&6 ;;
+  *)
+    echo "$as_me:1787: result: $ac_cv_prog_cc_stdc" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6
+    CC="$CC $ac_cv_prog_cc_stdc" ;;
+esac
+
+# This should have been defined by AC_PROG_CC
+: ${CC:=cc}
+
+echo "$as_me:1795: checking \$CC variable" >&5
+echo $ECHO_N "checking \$CC variable... $ECHO_C" >&6
+case "$CC" in #(vi
+*[\ \	]-[IUD]*)
+	echo "$as_me:1799: result: broken" >&5
+echo "${ECHO_T}broken" >&6
+	{ echo "$as_me:1801: WARNING: your environment misuses the CC variable to hold CFLAGS/CPPFLAGS options" >&5
+echo "$as_me: WARNING: your environment misuses the CC variable to hold CFLAGS/CPPFLAGS options" >&2;}
+	# humor him...
+	cf_flags=`echo "$CC" | sed -e 's/^[^ 	]*[ 	]//'`
+	CC=`echo "$CC" | sed -e 's/[ 	].*//'`
+
+cf_fix_cppflags=no
+cf_new_cflags=
+cf_new_cppflags=
+cf_new_extra_cppflags=
+
+for cf_add_cflags in $cf_flags
+do
+case $cf_fix_cppflags in
+no)
+	case $cf_add_cflags in #(vi
+	-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi
+		case $cf_add_cflags in
+		-D*)
+			cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'`
+
+			test "${cf_add_cflags}" != "${cf_tst_cflags}" \
+				&& test -z "${cf_tst_cflags}" \
+				&& cf_fix_cppflags=yes
+
+			if test $cf_fix_cppflags = yes ; then
+				cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
+				continue
+			elif test "${cf_tst_cflags}" = "\"'" ; then
+				cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
+				continue
+			fi
+			;;
+		esac
+		case "$CPPFLAGS" in
+		*$cf_add_cflags) #(vi
+			;;
+		*) #(vi
+			case $cf_add_cflags in #(vi
+			-D*)
+				cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'`
+
+CPPFLAGS=`echo "$CPPFLAGS" | \
+	sed	-e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ 	]*\)\?[ 	]/ /g' \
+		-e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ 	]*\)\?$//g'`
+
+				;;
+			esac
+			cf_new_cppflags="$cf_new_cppflags $cf_add_cflags"
+			;;
+		esac
+		;;
+	*)
+		cf_new_cflags="$cf_new_cflags $cf_add_cflags"
+		;;
+	esac
+	;;
+yes)
+	cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
+
+	cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'`
+
+	test "${cf_add_cflags}" != "${cf_tst_cflags}" \
+		&& test -z "${cf_tst_cflags}" \
+		&& cf_fix_cppflags=no
+	;;
+esac
+done
+
+if test -n "$cf_new_cflags" ; then
+
+	CFLAGS="$CFLAGS $cf_new_cflags"
+fi
+
+if test -n "$cf_new_cppflags" ; then
+
+	CPPFLAGS="$CPPFLAGS $cf_new_cppflags"
+fi
+
+if test -n "$cf_new_extra_cppflags" ; then
+
+	EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS"
+fi
+
+	;;
+*)
+	echo "$as_me:1887: result: ok" >&5
+echo "${ECHO_T}ok" >&6
+	;;
+esac
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+ac_main_return=return
+echo "$as_me:1898: checking how to run the C preprocessor" >&5
+echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+  CPP=
+fi
+if test -z "$CPP"; then
+  if test "${ac_cv_prog_CPP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+      # Double quotes because CPP needs to be expanded
+    for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
+    do
+      ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+  # Use a header file that comes with gcc, so configuring glibc
+  # with a fresh cross-compiler works.
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp. "Syntax error" is here to catch this case.
+  cat >conftest.$ac_ext <<_ACEOF
+#line 1919 "configure"
+#include "confdefs.h"
+#include <assert.h>
+                     Syntax error
+_ACEOF
+if { (eval echo "$as_me:1924: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  egrep -v '^ *\+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:1930: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  :
+else
+  echo "$as_me: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  # Broken: fails on valid input.
 continue
 fi
 rm -f conftest.err conftest.$ac_ext
@@ -1948,17 +1950,17 @@
   # OK, works on sane cases.  Now check whether non-existent headers
   # can be detected and how.
   cat >conftest.$ac_ext <<_ACEOF
-#line 1951 "configure"
+#line 1953 "configure"
 #include "confdefs.h"
 #include <ac_nonexistent.h>
 _ACEOF
-if { (eval echo "$as_me:1955: \"$ac_cpp conftest.$ac_ext\"") >&5
+if { (eval echo "$as_me:1957: \"$ac_cpp conftest.$ac_ext\"") >&5
   (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
   ac_status=$?
   egrep -v '^ *\+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
-  echo "$as_me:1961: \$? = $ac_status" >&5
+  echo "$as_me:1963: \$? = $ac_status" >&5
   (exit $ac_status); } >/dev/null; then
   if test -s conftest.err; then
     ac_cpp_err=$ac_c_preproc_warn_flag
@@ -1995,7 +1997,7 @@
 else
   ac_cv_prog_CPP=$CPP
 fi
-echo "$as_me:1998: result: $CPP" >&5
+echo "$as_me:2000: result: $CPP" >&5
 echo "${ECHO_T}$CPP" >&6
 ac_preproc_ok=false
 for ac_c_preproc_warn_flag in '' yes
@@ -2005,18 +2007,18 @@
   # On the NeXT, cc -E runs the code through the compiler's parser,
   # not just through cpp. "Syntax error" is here to catch this case.
   cat >conftest.$ac_ext <<_ACEOF
-#line 2008 "configure"
+#line 2010 "configure"
 #include "confdefs.h"
 #include <assert.h>
                      Syntax error
 _ACEOF
-if { (eval echo "$as_me:2013: \"$ac_cpp conftest.$ac_ext\"") >&5
+if { (eval echo "$as_me:2015: \"$ac_cpp conftest.$ac_ext\"") >&5
   (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
   ac_status=$?
   egrep -v '^ *\+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
-  echo "$as_me:2019: \$? = $ac_status" >&5
+  echo "$as_me:2021: \$? = $ac_status" >&5
   (exit $ac_status); } >/dev/null; then
   if test -s conftest.err; then
     ac_cpp_err=$ac_c_preproc_warn_flag
@@ -2039,17 +2041,17 @@
   # OK, works on sane cases.  Now check whether non-existent headers
   # can be detected and how.
   cat >conftest.$ac_ext <<_ACEOF
-#line 2042 "configure"
+#line 2044 "configure"
 #include "confdefs.h"
 #include <ac_nonexistent.h>
 _ACEOF
-if { (eval echo "$as_me:2046: \"$ac_cpp conftest.$ac_ext\"") >&5
+if { (eval echo "$as_me:2048: \"$ac_cpp conftest.$ac_ext\"") >&5
   (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
   ac_status=$?
   egrep -v '^ *\+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
-  echo "$as_me:2052: \$? = $ac_status" >&5
+  echo "$as_me:2054: \$? = $ac_status" >&5
   (exit $ac_status); } >/dev/null; then
   if test -s conftest.err; then
     ac_cpp_err=$ac_c_preproc_warn_flag
@@ -2077,7 +2079,7 @@
 if $ac_preproc_ok; then
   :
 else
-  { { echo "$as_me:2080: error: C preprocessor \"$CPP\" fails sanity check" >&5
+  { { echo "$as_me:2082: error: C preprocessor \"$CPP\" fails sanity check" >&5
 echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check" >&2;}
    { (exit 1); exit 1; }; }
 fi
@@ -2090,14 +2092,14 @@
 ac_main_return=return
 
 if test $ac_cv_c_compiler_gnu = yes; then
-    echo "$as_me:2093: checking whether $CC needs -traditional" >&5
+    echo "$as_me:2095: checking whether $CC needs -traditional" >&5
 echo $ECHO_N "checking whether $CC needs -traditional... $ECHO_C" >&6
 if test "${ac_cv_prog_gcc_traditional+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
     ac_pattern="Autoconf.*'x'"
   cat >conftest.$ac_ext <<_ACEOF
-#line 2100 "configure"
+#line 2102 "configure"
 #include "confdefs.h"
 #include <sgtty.h>
 int Autoconf = TIOCGETP;
@@ -2112,7 +2114,7 @@
 
   if test $ac_cv_prog_gcc_traditional = no; then
     cat >conftest.$ac_ext <<_ACEOF
-#line 2115 "configure"
+#line 2117 "configure"
 #include "confdefs.h"
 #include <termio.h>
 int Autoconf = TCGETA;
@@ -2125,14 +2127,14 @@
 
   fi
 fi
-echo "$as_me:2128: result: $ac_cv_prog_gcc_traditional" >&5
+echo "$as_me:2130: result: $ac_cv_prog_gcc_traditional" >&5
 echo "${ECHO_T}$ac_cv_prog_gcc_traditional" >&6
   if test $ac_cv_prog_gcc_traditional = yes; then
     CC="$CC -traditional"
   fi
 fi
 
-echo "$as_me:2135: checking whether $CC understands -c and -o together" >&5
+echo "$as_me:2137: checking whether $CC understands -c and -o together" >&5
 echo $ECHO_N "checking whether $CC understands -c and -o together... $ECHO_C" >&6
 if test "${cf_cv_prog_CC_c_o+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -2148,15 +2150,15 @@
 # We do the test twice because some compilers refuse to overwrite an
 # existing .o file with -o, though they will create one.
 ac_try='$CC -c conftest.$ac_ext -o conftest2.$ac_objext >&5'
-if { (eval echo "$as_me:2151: \"$ac_try\"") >&5
+if { (eval echo "$as_me:2153: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:2154: \$? = $ac_status" >&5
+  echo "$as_me:2156: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-  test -f conftest2.$ac_objext && { (eval echo "$as_me:2156: \"$ac_try\"") >&5
+  test -f conftest2.$ac_objext && { (eval echo "$as_me:2158: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:2159: \$? = $ac_status" >&5
+  echo "$as_me:2161: \$? = $ac_status" >&5
   (exit $ac_status); };
 then
   eval cf_cv_prog_CC_c_o=yes
@@ -2167,378 +2169,84 @@
 
 fi
 if test $cf_cv_prog_CC_c_o = yes; then
-  echo "$as_me:2170: result: yes" >&5
+  echo "$as_me:2172: result: yes" >&5
 echo "${ECHO_T}yes" >&6
 else
-  echo "$as_me:2173: result: no" >&5
+  echo "$as_me:2175: result: no" >&5
 echo "${ECHO_T}no" >&6
 fi
 
-echo "$as_me:2177: checking for POSIXized ISC" >&5
-echo $ECHO_N "checking for POSIXized ISC... $ECHO_C" >&6
-if test -d /etc/conf/kconfig.d &&
-   grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1
-then
-  echo "$as_me:2182: result: yes" >&5
-echo "${ECHO_T}yes" >&6
-  ISC=yes # If later tests want to check for ISC.
+test "$program_prefix" != NONE &&
+  program_transform_name="s,^,$program_prefix,;$program_transform_name"
+# Use a double $ so make ignores it.
+test "$program_suffix" != NONE &&
+  program_transform_name="s,\$,$program_suffix,;$program_transform_name"
+# Double any \ or $.  echo might interpret backslashes.
+# By default was `s,x,x', remove it if useless.
+cat <<\_ACEOF >conftest.sed
+s/[\\$]/&&/g;s/;s,x,x,$//
+_ACEOF
+program_transform_name=`echo $program_transform_name | sed -f conftest.sed`
+rm conftest.sed
 
-cat >>confdefs.h <<\EOF
-#define _POSIX_SOURCE 1
-EOF
+for ac_prog in mawk gawk nawk awk
+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 "$as_me:2196: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_AWK+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$AWK"; then
+  ac_cv_prog_AWK="$AWK" # Let the user override the test.
+else
+  ac_save_IFS=$IFS; IFS=$ac_path_separator
+ac_dummy="$PATH"
+for ac_dir in $ac_dummy; do
+  IFS=$ac_save_IFS
+  test -z "$ac_dir" && ac_dir=.
+  $as_executable_p "$ac_dir/$ac_word" || continue
+ac_cv_prog_AWK="$ac_prog"
+echo "$as_me:2211: found $ac_dir/$ac_word" >&5
+break
+done
 
-  if test "$GCC" = yes; then
-    CC="$CC -posix"
-  else
-    CC="$CC -Xp"
-  fi
+fi
+fi
+AWK=$ac_cv_prog_AWK
+if test -n "$AWK"; then
+  echo "$as_me:2219: result: $AWK" >&5
+echo "${ECHO_T}$AWK" >&6
 else
-  echo "$as_me:2196: result: no" >&5
+  echo "$as_me:2222: result: no" >&5
 echo "${ECHO_T}no" >&6
-  ISC=
 fi
 
-echo "$as_me:2201: checking for ${CC:-cc} option to accept ANSI C" >&5
-echo $ECHO_N "checking for ${CC:-cc} option to accept ANSI C... $ECHO_C" >&6
-if test "${cf_cv_ansi_cc+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-
-cf_cv_ansi_cc=no
-cf_save_CFLAGS="$CFLAGS"
-cf_save_CPPFLAGS="$CPPFLAGS"
-# Don't try gcc -ansi; that turns off useful extensions and
-# breaks some systems' header files.
-# AIX			-qlanglvl=ansi
-# Ultrix and OSF/1	-std1
-# HP-UX			-Aa -D_HPUX_SOURCE
-# SVR4			-Xc
-# UnixWare 1.2		(cannot use -Xc, since ANSI/POSIX clashes)
-for cf_arg in "-DCC_HAS_PROTOS" \
-	"" \
-	-qlanglvl=ansi \
-	-std1 \
-	-Ae \
-	"-Aa -D_HPUX_SOURCE" \
-	-Xc
-do
-
-cf_fix_cppflags=no
-cf_new_cflags=
-cf_new_cppflags=
-cf_new_extra_cppflags=
+  test -n "$AWK" && break
+done
 
-for cf_add_cflags in $cf_arg
-do
-case $cf_fix_cppflags in
-no)
-	case $cf_add_cflags in #(vi
-	-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi
-		case $cf_add_cflags in
-		-D*)
-			cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'`
+test -z "$AWK" && { { echo "$as_me:2229: error: No awk program found" >&5
+echo "$as_me: error: No awk program found" >&2;}
+   { (exit 1); exit 1; }; }
 
-			test "${cf_add_cflags}" != "${cf_tst_cflags}" \
-				&& test -z "${cf_tst_cflags}" \
-				&& cf_fix_cppflags=yes
+echo "$as_me:2233: checking for egrep" >&5
+echo $ECHO_N "checking for egrep... $ECHO_C" >&6
+if test "${ac_cv_prog_egrep+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if echo a | (grep -E '(a|b)') >/dev/null 2>&1
+    then ac_cv_prog_egrep='grep -E'
+    else ac_cv_prog_egrep='egrep'
+    fi
+fi
+echo "$as_me:2243: result: $ac_cv_prog_egrep" >&5
+echo "${ECHO_T}$ac_cv_prog_egrep" >&6
+ EGREP=$ac_cv_prog_egrep
 
-			if test $cf_fix_cppflags = yes ; then
-				cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
-				continue
-			elif test "${cf_tst_cflags}" = "\"'" ; then
-				cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
-				continue
-			fi
-			;;
-		esac
-		case "$CPPFLAGS" in
-		*$cf_add_cflags) #(vi
-			;;
-		*) #(vi
-			case $cf_add_cflags in #(vi
-			-D*)
-				cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'`
-
-CPPFLAGS=`echo "$CPPFLAGS" | \
-	sed	-e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ 	]*\)\?[ 	]/ /g' \
-		-e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ 	]*\)\?$//g'`
-
-				;;
-			esac
-			cf_new_cppflags="$cf_new_cppflags $cf_add_cflags"
-			;;
-		esac
-		;;
-	*)
-		cf_new_cflags="$cf_new_cflags $cf_add_cflags"
-		;;
-	esac
-	;;
-yes)
-	cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
-
-	cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'`
-
-	test "${cf_add_cflags}" != "${cf_tst_cflags}" \
-		&& test -z "${cf_tst_cflags}" \
-		&& cf_fix_cppflags=no
-	;;
-esac
-done
-
-if test -n "$cf_new_cflags" ; then
-
-	CFLAGS="$CFLAGS $cf_new_cflags"
-fi
-
-if test -n "$cf_new_cppflags" ; then
-
-	CPPFLAGS="$CPPFLAGS $cf_new_cppflags"
-fi
-
-if test -n "$cf_new_extra_cppflags" ; then
-
-	EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS"
-fi
-
-	cat >conftest.$ac_ext <<_ACEOF
-#line 2305 "configure"
-#include "confdefs.h"
-
-#ifndef CC_HAS_PROTOS
-#if !defined(__STDC__) || (__STDC__ != 1)
-choke me
-#endif
-#endif
-
-int
-main ()
-{
-
-	int test (int i, double x);
-	struct s1 {int (*f) (int a);};
-	struct s2 {int (*f) (double a);};
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:2326: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
-  ac_status=$?
-  echo "$as_me:2329: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:2332: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:2335: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  cf_cv_ansi_cc="$cf_arg"; break
-else
-  echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
-fi
-rm -f conftest.$ac_objext conftest.$ac_ext
-done
-CFLAGS="$cf_save_CFLAGS"
-CPPFLAGS="$cf_save_CPPFLAGS"
-
-fi
-echo "$as_me:2348: result: $cf_cv_ansi_cc" >&5
-echo "${ECHO_T}$cf_cv_ansi_cc" >&6
-
-if test "$cf_cv_ansi_cc" != "no"; then
-if test ".$cf_cv_ansi_cc" != ".-DCC_HAS_PROTOS"; then
-
-cf_fix_cppflags=no
-cf_new_cflags=
-cf_new_cppflags=
-cf_new_extra_cppflags=
-
-for cf_add_cflags in $cf_cv_ansi_cc
-do
-case $cf_fix_cppflags in
-no)
-	case $cf_add_cflags in #(vi
-	-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi
-		case $cf_add_cflags in
-		-D*)
-			cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'`
-
-			test "${cf_add_cflags}" != "${cf_tst_cflags}" \
-				&& test -z "${cf_tst_cflags}" \
-				&& cf_fix_cppflags=yes
-
-			if test $cf_fix_cppflags = yes ; then
-				cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
-				continue
-			elif test "${cf_tst_cflags}" = "\"'" ; then
-				cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
-				continue
-			fi
-			;;
-		esac
-		case "$CPPFLAGS" in
-		*$cf_add_cflags) #(vi
-			;;
-		*) #(vi
-			case $cf_add_cflags in #(vi
-			-D*)
-				cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'`
-
-CPPFLAGS=`echo "$CPPFLAGS" | \
-	sed	-e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ 	]*\)\?[ 	]/ /g' \
-		-e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ 	]*\)\?$//g'`
-
-				;;
-			esac
-			cf_new_cppflags="$cf_new_cppflags $cf_add_cflags"
-			;;
-		esac
-		;;
-	*)
-		cf_new_cflags="$cf_new_cflags $cf_add_cflags"
-		;;
-	esac
-	;;
-yes)
-	cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
-
-	cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'`
-
-	test "${cf_add_cflags}" != "${cf_tst_cflags}" \
-		&& test -z "${cf_tst_cflags}" \
-		&& cf_fix_cppflags=no
-	;;
-esac
-done
-
-if test -n "$cf_new_cflags" ; then
-
-	CFLAGS="$CFLAGS $cf_new_cflags"
-fi
-
-if test -n "$cf_new_cppflags" ; then
-
-	CPPFLAGS="$CPPFLAGS $cf_new_cppflags"
-fi
-
-if test -n "$cf_new_extra_cppflags" ; then
-
-	EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS"
-fi
-
-else
-	cat >>confdefs.h <<\EOF
-#define CC_HAS_PROTOS 1
-EOF
-
-fi
-fi
-
-if test "$cf_cv_ansi_cc" = "no"; then
-	{ { echo "$as_me:2441: error: Your compiler does not appear to recognize prototypes.
-You have the following choices:
-	a. adjust your compiler options
-	b. get an up-to-date compiler
-	c. use a wrapper such as unproto" >&5
-echo "$as_me: error: Your compiler does not appear to recognize prototypes.
-You have the following choices:
-	a. adjust your compiler options
-	b. get an up-to-date compiler
-	c. use a wrapper such as unproto" >&2;}
-   { (exit 1); exit 1; }; }
-fi
-
-case $cf_cv_system_name in
-os2*)
-    CFLAGS="$CFLAGS -Zmt"
-    CPPFLAGS="$CPPFLAGS -D__ST_MT_ERRNO__"
-    CXXFLAGS="$CXXFLAGS -Zmt"
-    # autoconf's macro sets -Zexe and suffix both, which conflict:w
-    LDFLAGS="$LDFLAGS -Zmt -Zcrtdll"
-    ac_cv_exeext=.exe
-    ;;
-esac
-
-PROG_EXT="$EXEEXT"
-
-test -n "$PROG_EXT" && cat >>confdefs.h <<EOF
-#define PROG_EXT "$PROG_EXT"
-EOF
-
-test "$program_prefix" != NONE &&
-  program_transform_name="s,^,$program_prefix,;$program_transform_name"
-# Use a double $ so make ignores it.
-test "$program_suffix" != NONE &&
-  program_transform_name="s,\$,$program_suffix,;$program_transform_name"
-# Double any \ or $.  echo might interpret backslashes.
-# By default was `s,x,x', remove it if useless.
-cat <<\_ACEOF >conftest.sed
-s/[\\$]/&&/g;s/;s,x,x,$//
-_ACEOF
-program_transform_name=`echo $program_transform_name | sed -f conftest.sed`
-rm conftest.sed
-
-for ac_prog in mawk gawk nawk awk
-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 "$as_me:2488: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_AWK+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  if test -n "$AWK"; then
-  ac_cv_prog_AWK="$AWK" # Let the user override the test.
-else
-  ac_save_IFS=$IFS; IFS=$ac_path_separator
-ac_dummy="$PATH"
-for ac_dir in $ac_dummy; do
-  IFS=$ac_save_IFS
-  test -z "$ac_dir" && ac_dir=.
-  $as_executable_p "$ac_dir/$ac_word" || continue
-ac_cv_prog_AWK="$ac_prog"
-echo "$as_me:2503: found $ac_dir/$ac_word" >&5
-break
-done
-
-fi
-fi
-AWK=$ac_cv_prog_AWK
-if test -n "$AWK"; then
-  echo "$as_me:2511: result: $AWK" >&5
-echo "${ECHO_T}$AWK" >&6
-else
-  echo "$as_me:2514: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
-  test -n "$AWK" && break
-done
-
-test -z "$AWK" && { { echo "$as_me:2521: error: No awk program found" >&5
-echo "$as_me: error: No awk program found" >&2;}
-   { (exit 1); exit 1; }; }
-
-echo "$as_me:2525: checking for egrep" >&5
-echo $ECHO_N "checking for egrep... $ECHO_C" >&6
-if test "${ac_cv_prog_egrep+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  if echo a | (grep -E '(a|b)') >/dev/null 2>&1
-    then ac_cv_prog_egrep='grep -E'
-    else ac_cv_prog_egrep='egrep'
-    fi
-fi
-echo "$as_me:2535: result: $ac_cv_prog_egrep" >&5
-echo "${ECHO_T}$ac_cv_prog_egrep" >&6
- EGREP=$ac_cv_prog_egrep
-
-test -z "$EGREP" && { { echo "$as_me:2539: error: No egrep program found" >&5
-echo "$as_me: error: No egrep program found" >&2;}
-   { (exit 1); exit 1; }; }
+test -z "$EGREP" && { { echo "$as_me:2247: error: No egrep program found" >&5
+echo "$as_me: error: No egrep program found" >&2;}
+   { (exit 1); exit 1; }; }
 
 # Find a good install program.  We prefer a C program (faster),
 # so one script is as good as another.  But avoid the broken or
@@ -2552,7 +2260,7 @@
 # AFS /usr/afsws/bin/install, which mishandles nonexistent args
 # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
 # ./install, which can be erroneously created by make from ./install.sh.
-echo "$as_me:2555: checking for a BSD compatible install" >&5
+echo "$as_me:2263: checking for a BSD compatible install" >&5
 echo $ECHO_N "checking for a BSD compatible install... $ECHO_C" >&6
 if test -z "$INSTALL"; then
 if test "${ac_cv_path_install+set}" = set; then
@@ -2601,7 +2309,7 @@
     INSTALL=$ac_install_sh
   fi
 fi
-echo "$as_me:2604: result: $INSTALL" >&5
+echo "$as_me:2312: result: $INSTALL" >&5
 echo "${ECHO_T}$INSTALL" >&6
 
 # Use test -z because SunOS4 sh mishandles braces in ${var-val}.
@@ -2612,18 +2320,18 @@
 
 test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
 
-echo "$as_me:2615: checking whether ln -s works" >&5
+echo "$as_me:2323: checking whether ln -s works" >&5
 echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6
 LN_S=$as_ln_s
 if test "$LN_S" = "ln -s"; then
-  echo "$as_me:2619: result: yes" >&5
+  echo "$as_me:2327: result: yes" >&5
 echo "${ECHO_T}yes" >&6
 else
-  echo "$as_me:2622: result: no, using $LN_S" >&5
+  echo "$as_me:2330: result: no, using $LN_S" >&5
 echo "${ECHO_T}no, using $LN_S" >&6
 fi
 
-echo "$as_me:2626: checking if $LN_S -f options work" >&5
+echo "$as_me:2334: checking if $LN_S -f options work" >&5
 echo $ECHO_N "checking if $LN_S -f options work... $ECHO_C" >&6
 
 rm -f conf$$.src conf$$dst
@@ -2635,12 +2343,12 @@
 	cf_prog_ln_sf=no
 fi
 rm -f conf$$.dst conf$$src
-echo "$as_me:2638: result: $cf_prog_ln_sf" >&5
+echo "$as_me:2346: result: $cf_prog_ln_sf" >&5
 echo "${ECHO_T}$cf_prog_ln_sf" >&6
 
 test "$cf_prog_ln_sf" = yes && LN_S="$LN_S -f"
 
-echo "$as_me:2643: checking for long file names" >&5
+echo "$as_me:2351: checking for long file names" >&5
 echo $ECHO_N "checking for long file names... $ECHO_C" >&6
 if test "${ac_cv_sys_long_file_names+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -2679,7 +2387,7 @@
   rm -rf $ac_xdir 2>/dev/null
 done
 fi
-echo "$as_me:2682: result: $ac_cv_sys_long_file_names" >&5
+echo "$as_me:2390: result: $ac_cv_sys_long_file_names" >&5
 echo "${ECHO_T}$ac_cv_sys_long_file_names" >&6
 if test $ac_cv_sys_long_file_names = yes; then
 
@@ -2691,7 +2399,7 @@
 
 # if we find pkg-config, check if we should install the ".pc" files.
 
-echo "$as_me:2694: checking if you want to use pkg-config" >&5
+echo "$as_me:2402: checking if you want to use pkg-config" >&5
 echo $ECHO_N "checking if you want to use pkg-config... $ECHO_C" >&6
 
 # Check whether --with-pkg-config or --without-pkg-config was given.
@@ -2701,7 +2409,7 @@
 else
   cf_pkg_config=yes
 fi;
-echo "$as_me:2704: result: $cf_pkg_config" >&5
+echo "$as_me:2412: result: $cf_pkg_config" >&5
 echo "${ECHO_T}$cf_pkg_config" >&6
 
 case $cf_pkg_config in #(vi
@@ -2709,10 +2417,11 @@
 	PKG_CONFIG=none
 	;;
 yes) #(vi
-	if test -n "$ac_tool_prefix"; then
+
+if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args.
 set dummy ${ac_tool_prefix}pkg-config; ac_word=$2
-echo "$as_me:2715: checking for $ac_word" >&5
+echo "$as_me:2424: checking for $ac_word" >&5
 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
 if test "${ac_cv_path_PKG_CONFIG+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -2729,7 +2438,7 @@
   test -z "$ac_dir" && ac_dir=.
   if $as_executable_p "$ac_dir/$ac_word"; then
    ac_cv_path_PKG_CONFIG="$ac_dir/$ac_word"
-   echo "$as_me:2732: found $ac_dir/$ac_word" >&5
+   echo "$as_me:2441: found $ac_dir/$ac_word" >&5
    break
 fi
 done
@@ -2740,10 +2449,10 @@
 PKG_CONFIG=$ac_cv_path_PKG_CONFIG
 
 if test -n "$PKG_CONFIG"; then
-  echo "$as_me:2743: result: $PKG_CONFIG" >&5
+  echo "$as_me:2452: result: $PKG_CONFIG" >&5
 echo "${ECHO_T}$PKG_CONFIG" >&6
 else
-  echo "$as_me:2746: result: no" >&5
+  echo "$as_me:2455: result: no" >&5
 echo "${ECHO_T}no" >&6
 fi
 
@@ -2752,7 +2461,7 @@
   ac_pt_PKG_CONFIG=$PKG_CONFIG
   # Extract the first word of "pkg-config", so it can be a program name with args.
 set dummy pkg-config; ac_word=$2
-echo "$as_me:2755: checking for $ac_word" >&5
+echo "$as_me:2464: checking for $ac_word" >&5
 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
 if test "${ac_cv_path_ac_pt_PKG_CONFIG+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -2769,7 +2478,7 @@
   test -z "$ac_dir" && ac_dir=.
   if $as_executable_p "$ac_dir/$ac_word"; then
    ac_cv_path_ac_pt_PKG_CONFIG="$ac_dir/$ac_word"
-   echo "$as_me:2772: found $ac_dir/$ac_word" >&5
+   echo "$as_me:2481: found $ac_dir/$ac_word" >&5
    break
 fi
 done
@@ -2781,10 +2490,10 @@
 ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG
 
 if test -n "$ac_pt_PKG_CONFIG"; then
-  echo "$as_me:2784: result: $ac_pt_PKG_CONFIG" >&5
+  echo "$as_me:2493: result: $ac_pt_PKG_CONFIG" >&5
 echo "${ECHO_T}$ac_pt_PKG_CONFIG" >&6
 else
-  echo "$as_me:2787: result: no" >&5
+  echo "$as_me:2496: result: no" >&5
 echo "${ECHO_T}no" >&6
 fi
 
@@ -2815,7 +2524,7 @@
   ;;
 .[a-zA-Z]:[\\/]*) #(vi OS/2 EMX
   ;;
-.\${*prefix}*) #(vi
+.\${*prefix}*|.\${*dir}*) #(vi
   eval PKG_CONFIG="$PKG_CONFIG"
   case ".$PKG_CONFIG" in #(vi
   .NONE/*)
@@ -2827,7 +2536,7 @@
   PKG_CONFIG=`echo $PKG_CONFIG | sed -e s%NONE%$cf_path_syntax%`
   ;;
 *)
-  { { echo "$as_me:2830: error: expected a pathname, not \"$PKG_CONFIG\"" >&5
+  { { echo "$as_me:2539: error: expected a pathname, not \"$PKG_CONFIG\"" >&5
 echo "$as_me: error: expected a pathname, not \"$PKG_CONFIG\"" >&2;}
    { (exit 1); exit 1; }; }
   ;;
@@ -2836,15 +2545,50 @@
 fi
 
 if test "$PKG_CONFIG" != none ; then
-	echo "$as_me:2839: checking if we should install .pc files for $PKG_CONFIG" >&5
-echo $ECHO_N "checking if we should install .pc files for $PKG_CONFIG... $ECHO_C" >&6
+	echo "$as_me:2548: checking for $PKG_CONFIG library directory" >&5
+echo $ECHO_N "checking for $PKG_CONFIG library directory... $ECHO_C" >&6
 
-	# Leave this as something that can be overridden in the environment.
-	if test -z "$PKG_CONFIG_LIBDIR" ; then
-		PKG_CONFIG_LIBDIR=`echo "$PKG_CONFIG" | sed -e 's,/[^/]*/[^/]*$,,'`/lib/pkgconfig
-	fi
-	PKG_CONFIG_LIBDIR=`echo "$PKG_CONFIG_LIBDIR" | sed -e 's/^://' -e 's/:.*//'`
-	if test -n "$PKG_CONFIG_LIBDIR" && test -d "$PKG_CONFIG_LIBDIR" ; then
+# Check whether --with-pkg-config-libdir or --without-pkg-config-libdir was given.
+if test "${with_pkg_config_libdir+set}" = set; then
+  withval="$with_pkg_config_libdir"
+  PKG_CONFIG_LIBDIR=$withval
+else
+  PKG_CONFIG_LIBDIR=yes
+fi;
+
+	case x$PKG_CONFIG_LIBDIR in #(vi
+	x/*) #(vi
+		;;
+	xyes) #(vi
+		# look for the library directory using the same prefix as the executable
+		cf_path=`echo "$PKG_CONFIG" | sed -e 's,/[^/]*/[^/]*$,,'`
+		case x`(arch) 2>/dev/null` in #(vi
+		*64) #(vi
+			for cf_config in $cf_path/share $cf_path/lib64 $cf_path/lib32 $cf_path/lib
+			do
+				if test -d $cf_config/pkgconfig
+				then
+					PKG_CONFIG_LIBDIR=$cf_config/pkgconfig
+					break
+				fi
+			done
+			;;
+		*)
+			PKG_CONFIG_LIBDIR=$cf_path/lib/pkgconfig
+			;;
+		esac
+		;;
+	*)
+		;;
+	esac
+
+	echo "$as_me:2585: result: $PKG_CONFIG_LIBDIR" >&5
+echo "${ECHO_T}$PKG_CONFIG_LIBDIR" >&6
+fi
+
+if test "$PKG_CONFIG" != none ; then
+	echo "$as_me:2590: checking if we should install .pc files for $PKG_CONFIG" >&5
+echo $ECHO_N "checking if we should install .pc files for $PKG_CONFIG... $ECHO_C" >&6
 
 # Check whether --enable-pc-files or --disable-pc-files was given.
 if test "${enable_pc_files+set}" = set; then
@@ -2853,18 +2597,48 @@
 else
   enable_pc_files=no
 fi;
-		echo "$as_me:2856: result: $enable_pc_files" >&5
+	echo "$as_me:2600: result: $enable_pc_files" >&5
 echo "${ECHO_T}$enable_pc_files" >&6
-	else
-		echo "$as_me:2859: result: no" >&5
-echo "${ECHO_T}no" >&6
-		{ echo "$as_me:2861: WARNING: did not find library $PKG_CONFIG_LIBDIR" >&5
-echo "$as_me: WARNING: did not find library $PKG_CONFIG_LIBDIR" >&2;}
-		enable_pc_files=no
+	if test "$enable_pc_files" != no
+	then
+
+if test "x$prefix" != xNONE; then
+  cf_path_syntax="$prefix"
+else
+  cf_path_syntax="$ac_default_prefix"
+fi
+
+case ".$PKG_CONFIG_LIBDIR" in #(vi
+.\$\(*\)*|.\'*\'*) #(vi
+  ;;
+..|./*|.\\*) #(vi
+  ;;
+.[a-zA-Z]:[\\/]*) #(vi OS/2 EMX
+  ;;
+.\${*prefix}*|.\${*dir}*) #(vi
+  eval PKG_CONFIG_LIBDIR="$PKG_CONFIG_LIBDIR"
+  case ".$PKG_CONFIG_LIBDIR" in #(vi
+  .NONE/*)
+    PKG_CONFIG_LIBDIR=`echo $PKG_CONFIG_LIBDIR | sed -e s%NONE%$cf_path_syntax%`
+    ;;
+  esac
+  ;; #(vi
+.no|.NONE/*)
+  PKG_CONFIG_LIBDIR=`echo $PKG_CONFIG_LIBDIR | sed -e s%NONE%$cf_path_syntax%`
+  ;;
+*)
+  { { echo "$as_me:2630: error: expected a pathname, not \"$PKG_CONFIG_LIBDIR\"" >&5
+echo "$as_me: error: expected a pathname, not \"$PKG_CONFIG_LIBDIR\"" >&2;}
+   { (exit 1); exit 1; }; }
+  ;;
+esac
+
 	fi
+else
+	enable_pc_files=no
 fi
 
-echo "$as_me:2867: checking if you want to build test-programs" >&5
+echo "$as_me:2641: checking if you want to build test-programs" >&5
 echo $ECHO_N "checking if you want to build test-programs... $ECHO_C" >&6
 
 # Check whether --with-tests or --without-tests was given.
@@ -2874,10 +2648,10 @@
 else
   cf_with_tests=yes
 fi;
-echo "$as_me:2877: result: $cf_with_tests" >&5
+echo "$as_me:2651: result: $cf_with_tests" >&5
 echo "${ECHO_T}$cf_with_tests" >&6
 
-echo "$as_me:2880: checking if we should assume mixed-case filenames" >&5
+echo "$as_me:2654: checking if we should assume mixed-case filenames" >&5
 echo $ECHO_N "checking if we should assume mixed-case filenames... $ECHO_C" >&6
 
 # Check whether --enable-mixed-case or --disable-mixed-case was given.
@@ -2887,11 +2661,11 @@
 else
   enable_mixedcase=auto
 fi;
-echo "$as_me:2890: result: $enable_mixedcase" >&5
+echo "$as_me:2664: result: $enable_mixedcase" >&5
 echo "${ECHO_T}$enable_mixedcase" >&6
 if test "$enable_mixedcase" = "auto" ; then
 
-echo "$as_me:2894: checking if filesystem supports mixed-case filenames" >&5
+echo "$as_me:2668: checking if filesystem supports mixed-case filenames" >&5
 echo $ECHO_N "checking if filesystem supports mixed-case filenames... $ECHO_C" >&6
 if test "${cf_cv_mixedcase+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -2918,9 +2692,10 @@
 fi
 
 fi
-echo "$as_me:2921: result: $cf_cv_mixedcase" >&5
+echo "$as_me:2695: result: $cf_cv_mixedcase" >&5
 echo "${ECHO_T}$cf_cv_mixedcase" >&6
-test "$cf_cv_mixedcase" = yes && cat >>confdefs.h <<\EOF
+test "$cf_cv_mixedcase" = yes &&
+cat >>confdefs.h <<\EOF
 #define MIXEDCASE_FILENAMES 1
 EOF
 
@@ -2935,7 +2710,7 @@
 fi
 
 # do this after mixed-case option (tags/TAGS is not as important as tic).
-echo "$as_me:2938: checking whether ${MAKE-make} sets \${MAKE}" >&5
+echo "$as_me:2713: checking whether ${MAKE-make} sets \${MAKE}" >&5
 echo $ECHO_N "checking whether ${MAKE-make} sets \${MAKE}... $ECHO_C" >&6
 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,./+-,__p_,'`
 if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then
@@ -2955,11 +2730,11 @@
 rm -f conftest.make
 fi
 if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then
-  echo "$as_me:2958: result: yes" >&5
+  echo "$as_me:2733: result: yes" >&5
 echo "${ECHO_T}yes" >&6
   SET_MAKE=
 else
-  echo "$as_me:2962: result: no" >&5
+  echo "$as_me:2737: result: no" >&5
 echo "${ECHO_T}no" >&6
   SET_MAKE="MAKE=${MAKE-make}"
 fi
@@ -2968,7 +2743,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 "$as_me:2971: checking for $ac_word" >&5
+echo "$as_me:2746: checking for $ac_word" >&5
 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
 if test "${ac_cv_prog_CTAGS+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -2983,7 +2758,7 @@
   test -z "$ac_dir" && ac_dir=.
   $as_executable_p "$ac_dir/$ac_word" || continue
 ac_cv_prog_CTAGS="$ac_prog"
-echo "$as_me:2986: found $ac_dir/$ac_word" >&5
+echo "$as_me:2761: found $ac_dir/$ac_word" >&5
 break
 done
 
@@ -2991,10 +2766,10 @@
 fi
 CTAGS=$ac_cv_prog_CTAGS
 if test -n "$CTAGS"; then
-  echo "$as_me:2994: result: $CTAGS" >&5
+  echo "$as_me:2769: result: $CTAGS" >&5
 echo "${ECHO_T}$CTAGS" >&6
 else
-  echo "$as_me:2997: result: no" >&5
+  echo "$as_me:2772: result: no" >&5
 echo "${ECHO_T}no" >&6
 fi
 
@@ -3005,7 +2780,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 "$as_me:3008: checking for $ac_word" >&5
+echo "$as_me:2783: checking for $ac_word" >&5
 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
 if test "${ac_cv_prog_ETAGS+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -3020,7 +2795,7 @@
   test -z "$ac_dir" && ac_dir=.
   $as_executable_p "$ac_dir/$ac_word" || continue
 ac_cv_prog_ETAGS="$ac_prog"
-echo "$as_me:3023: found $ac_dir/$ac_word" >&5
+echo "$as_me:2798: found $ac_dir/$ac_word" >&5
 break
 done
 
@@ -3028,10 +2803,10 @@
 fi
 ETAGS=$ac_cv_prog_ETAGS
 if test -n "$ETAGS"; then
-  echo "$as_me:3031: result: $ETAGS" >&5
+  echo "$as_me:2806: result: $ETAGS" >&5
 echo "${ECHO_T}$ETAGS" >&6
 else
-  echo "$as_me:3034: result: no" >&5
+  echo "$as_me:2809: result: no" >&5
 echo "${ECHO_T}no" >&6
 fi
 
@@ -3040,7 +2815,7 @@
 
 # Extract the first word of "${CTAGS:-ctags}", so it can be a program name with args.
 set dummy ${CTAGS:-ctags}; ac_word=$2
-echo "$as_me:3043: checking for $ac_word" >&5
+echo "$as_me:2818: checking for $ac_word" >&5
 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
 if test "${ac_cv_prog_MAKE_LOWER_TAGS+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -3055,7 +2830,7 @@
   test -z "$ac_dir" && ac_dir=.
   $as_executable_p "$ac_dir/$ac_word" || continue
 ac_cv_prog_MAKE_LOWER_TAGS="yes"
-echo "$as_me:3058: found $ac_dir/$ac_word" >&5
+echo "$as_me:2833: found $ac_dir/$ac_word" >&5
 break
 done
 
@@ -3064,17 +2839,17 @@
 fi
 MAKE_LOWER_TAGS=$ac_cv_prog_MAKE_LOWER_TAGS
 if test -n "$MAKE_LOWER_TAGS"; then
-  echo "$as_me:3067: result: $MAKE_LOWER_TAGS" >&5
+  echo "$as_me:2842: result: $MAKE_LOWER_TAGS" >&5
 echo "${ECHO_T}$MAKE_LOWER_TAGS" >&6
 else
-  echo "$as_me:3070: result: no" >&5
+  echo "$as_me:2845: result: no" >&5
 echo "${ECHO_T}no" >&6
 fi
 
 if test "$cf_cv_mixedcase" = yes ; then
 	# Extract the first word of "${ETAGS:-etags}", so it can be a program name with args.
 set dummy ${ETAGS:-etags}; ac_word=$2
-echo "$as_me:3077: checking for $ac_word" >&5
+echo "$as_me:2852: checking for $ac_word" >&5
 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
 if test "${ac_cv_prog_MAKE_UPPER_TAGS+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -3089,7 +2864,7 @@
   test -z "$ac_dir" && ac_dir=.
   $as_executable_p "$ac_dir/$ac_word" || continue
 ac_cv_prog_MAKE_UPPER_TAGS="yes"
-echo "$as_me:3092: found $ac_dir/$ac_word" >&5
+echo "$as_me:2867: found $ac_dir/$ac_word" >&5
 break
 done
 
@@ -3098,10 +2873,10 @@
 fi
 MAKE_UPPER_TAGS=$ac_cv_prog_MAKE_UPPER_TAGS
 if test -n "$MAKE_UPPER_TAGS"; then
-  echo "$as_me:3101: result: $MAKE_UPPER_TAGS" >&5
+  echo "$as_me:2876: result: $MAKE_UPPER_TAGS" >&5
 echo "${ECHO_T}$MAKE_UPPER_TAGS" >&6
 else
-  echo "$as_me:3104: result: no" >&5
+  echo "$as_me:2879: result: no" >&5
 echo "${ECHO_T}no" >&6
 fi
 
@@ -3121,7 +2896,7 @@
 	MAKE_LOWER_TAGS="#"
 fi
 
-echo "$as_me:3124: checking for makeflags variable" >&5
+echo "$as_me:2899: checking for makeflags variable" >&5
 echo $ECHO_N "checking for makeflags variable... $ECHO_C" >&6
 if test "${cf_cv_makeflags+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -3155,13 +2930,13 @@
 	rm -f cf_makeflags.tmp
 
 fi
-echo "$as_me:3158: result: $cf_cv_makeflags" >&5
+echo "$as_me:2933: result: $cf_cv_makeflags" >&5
 echo "${ECHO_T}$cf_cv_makeflags" >&6
 
 if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
 set dummy ${ac_tool_prefix}ranlib; ac_word=$2
-echo "$as_me:3164: checking for $ac_word" >&5
+echo "$as_me:2939: checking for $ac_word" >&5
 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
 if test "${ac_cv_prog_RANLIB+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -3176,7 +2951,7 @@
   test -z "$ac_dir" && ac_dir=.
   $as_executable_p "$ac_dir/$ac_word" || continue
 ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
-echo "$as_me:3179: found $ac_dir/$ac_word" >&5
+echo "$as_me:2954: found $ac_dir/$ac_word" >&5
 break
 done
 
@@ -3184,10 +2959,10 @@
 fi
 RANLIB=$ac_cv_prog_RANLIB
 if test -n "$RANLIB"; then
-  echo "$as_me:3187: result: $RANLIB" >&5
+  echo "$as_me:2962: result: $RANLIB" >&5
 echo "${ECHO_T}$RANLIB" >&6
 else
-  echo "$as_me:3190: result: no" >&5
+  echo "$as_me:2965: result: no" >&5
 echo "${ECHO_T}no" >&6
 fi
 
@@ -3196,7 +2971,7 @@
   ac_ct_RANLIB=$RANLIB
   # Extract the first word of "ranlib", so it can be a program name with args.
 set dummy ranlib; ac_word=$2
-echo "$as_me:3199: checking for $ac_word" >&5
+echo "$as_me:2974: checking for $ac_word" >&5
 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
 if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -3211,7 +2986,7 @@
   test -z "$ac_dir" && ac_dir=.
   $as_executable_p "$ac_dir/$ac_word" || continue
 ac_cv_prog_ac_ct_RANLIB="ranlib"
-echo "$as_me:3214: found $ac_dir/$ac_word" >&5
+echo "$as_me:2989: found $ac_dir/$ac_word" >&5
 break
 done
 
@@ -3220,10 +2995,10 @@
 fi
 ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
 if test -n "$ac_ct_RANLIB"; then
-  echo "$as_me:3223: result: $ac_ct_RANLIB" >&5
+  echo "$as_me:2998: result: $ac_ct_RANLIB" >&5
 echo "${ECHO_T}$ac_ct_RANLIB" >&6
 else
-  echo "$as_me:3226: result: no" >&5
+  echo "$as_me:3001: result: no" >&5
 echo "${ECHO_T}no" >&6
 fi
 
@@ -3235,7 +3010,7 @@
 if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}ld", so it can be a program name with args.
 set dummy ${ac_tool_prefix}ld; ac_word=$2
-echo "$as_me:3238: checking for $ac_word" >&5
+echo "$as_me:3013: checking for $ac_word" >&5
 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
 if test "${ac_cv_prog_LD+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -3250,7 +3025,7 @@
   test -z "$ac_dir" && ac_dir=.
   $as_executable_p "$ac_dir/$ac_word" || continue
 ac_cv_prog_LD="${ac_tool_prefix}ld"
-echo "$as_me:3253: found $ac_dir/$ac_word" >&5
+echo "$as_me:3028: found $ac_dir/$ac_word" >&5
 break
 done
 
@@ -3258,10 +3033,10 @@
 fi
 LD=$ac_cv_prog_LD
 if test -n "$LD"; then
-  echo "$as_me:3261: result: $LD" >&5
+  echo "$as_me:3036: result: $LD" >&5
 echo "${ECHO_T}$LD" >&6
 else
-  echo "$as_me:3264: result: no" >&5
+  echo "$as_me:3039: result: no" >&5
 echo "${ECHO_T}no" >&6
 fi
 
@@ -3270,7 +3045,7 @@
   ac_ct_LD=$LD
   # Extract the first word of "ld", so it can be a program name with args.
 set dummy ld; ac_word=$2
-echo "$as_me:3273: checking for $ac_word" >&5
+echo "$as_me:3048: checking for $ac_word" >&5
 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
 if test "${ac_cv_prog_ac_ct_LD+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -3285,7 +3060,7 @@
   test -z "$ac_dir" && ac_dir=.
   $as_executable_p "$ac_dir/$ac_word" || continue
 ac_cv_prog_ac_ct_LD="ld"
-echo "$as_me:3288: found $ac_dir/$ac_word" >&5
+echo "$as_me:3063: found $ac_dir/$ac_word" >&5
 break
 done
 
@@ -3294,10 +3069,10 @@
 fi
 ac_ct_LD=$ac_cv_prog_ac_ct_LD
 if test -n "$ac_ct_LD"; then
-  echo "$as_me:3297: result: $ac_ct_LD" >&5
+  echo "$as_me:3072: result: $ac_ct_LD" >&5
 echo "${ECHO_T}$ac_ct_LD" >&6
 else
-  echo "$as_me:3300: result: no" >&5
+  echo "$as_me:3075: result: no" >&5
 echo "${ECHO_T}no" >&6
 fi
 
@@ -3309,7 +3084,7 @@
 if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
 set dummy ${ac_tool_prefix}ar; ac_word=$2
-echo "$as_me:3312: checking for $ac_word" >&5
+echo "$as_me:3087: checking for $ac_word" >&5
 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
 if test "${ac_cv_prog_AR+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -3324,7 +3099,7 @@
   test -z "$ac_dir" && ac_dir=.
   $as_executable_p "$ac_dir/$ac_word" || continue
 ac_cv_prog_AR="${ac_tool_prefix}ar"
-echo "$as_me:3327: found $ac_dir/$ac_word" >&5
+echo "$as_me:3102: found $ac_dir/$ac_word" >&5
 break
 done
 
@@ -3332,10 +3107,10 @@
 fi
 AR=$ac_cv_prog_AR
 if test -n "$AR"; then
-  echo "$as_me:3335: result: $AR" >&5
+  echo "$as_me:3110: result: $AR" >&5
 echo "${ECHO_T}$AR" >&6
 else
-  echo "$as_me:3338: result: no" >&5
+  echo "$as_me:3113: result: no" >&5
 echo "${ECHO_T}no" >&6
 fi
 
@@ -3344,7 +3119,7 @@
   ac_ct_AR=$AR
   # Extract the first word of "ar", so it can be a program name with args.
 set dummy ar; ac_word=$2
-echo "$as_me:3347: checking for $ac_word" >&5
+echo "$as_me:3122: checking for $ac_word" >&5
 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
 if test "${ac_cv_prog_ac_ct_AR+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -3359,7 +3134,7 @@
   test -z "$ac_dir" && ac_dir=.
   $as_executable_p "$ac_dir/$ac_word" || continue
 ac_cv_prog_ac_ct_AR="ar"
-echo "$as_me:3362: found $ac_dir/$ac_word" >&5
+echo "$as_me:3137: found $ac_dir/$ac_word" >&5
 break
 done
 
@@ -3368,10 +3143,10 @@
 fi
 ac_ct_AR=$ac_cv_prog_ac_ct_AR
 if test -n "$ac_ct_AR"; then
-  echo "$as_me:3371: result: $ac_ct_AR" >&5
+  echo "$as_me:3146: result: $ac_ct_AR" >&5
 echo "${ECHO_T}$ac_ct_AR" >&6
 else
-  echo "$as_me:3374: result: no" >&5
+  echo "$as_me:3149: result: no" >&5
 echo "${ECHO_T}no" >&6
 fi
 
@@ -3383,7 +3158,7 @@
 if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
 set dummy ${ac_tool_prefix}ar; ac_word=$2
-echo "$as_me:3386: checking for $ac_word" >&5
+echo "$as_me:3161: checking for $ac_word" >&5
 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
 if test "${ac_cv_prog_AR+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -3398,7 +3173,7 @@
   test -z "$ac_dir" && ac_dir=.
   $as_executable_p "$ac_dir/$ac_word" || continue
 ac_cv_prog_AR="${ac_tool_prefix}ar"
-echo "$as_me:3401: found $ac_dir/$ac_word" >&5
+echo "$as_me:3176: found $ac_dir/$ac_word" >&5
 break
 done
 
@@ -3406,10 +3181,10 @@
 fi
 AR=$ac_cv_prog_AR
 if test -n "$AR"; then
-  echo "$as_me:3409: result: $AR" >&5
+  echo "$as_me:3184: result: $AR" >&5
 echo "${ECHO_T}$AR" >&6
 else
-  echo "$as_me:3412: result: no" >&5
+  echo "$as_me:3187: result: no" >&5
 echo "${ECHO_T}no" >&6
 fi
 
@@ -3418,7 +3193,7 @@
   ac_ct_AR=$AR
   # Extract the first word of "ar", so it can be a program name with args.
 set dummy ar; ac_word=$2
-echo "$as_me:3421: checking for $ac_word" >&5
+echo "$as_me:3196: checking for $ac_word" >&5
 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
 if test "${ac_cv_prog_ac_ct_AR+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -3433,7 +3208,7 @@
   test -z "$ac_dir" && ac_dir=.
   $as_executable_p "$ac_dir/$ac_word" || continue
 ac_cv_prog_ac_ct_AR="ar"
-echo "$as_me:3436: found $ac_dir/$ac_word" >&5
+echo "$as_me:3211: found $ac_dir/$ac_word" >&5
 break
 done
 
@@ -3442,10 +3217,10 @@
 fi
 ac_ct_AR=$ac_cv_prog_ac_ct_AR
 if test -n "$ac_ct_AR"; then
-  echo "$as_me:3445: result: $ac_ct_AR" >&5
+  echo "$as_me:3220: result: $ac_ct_AR" >&5
 echo "${ECHO_T}$ac_ct_AR" >&6
 else
-  echo "$as_me:3448: result: no" >&5
+  echo "$as_me:3223: result: no" >&5
 echo "${ECHO_T}no" >&6
 fi
 
@@ -3454,7 +3229,7 @@
   AR="$ac_cv_prog_AR"
 fi
 
-echo "$as_me:3457: checking for options to update archives" >&5
+echo "$as_me:3232: checking for options to update archives" >&5
 echo $ECHO_N "checking for options to update archives... $ECHO_C" >&6
 if test "${cf_cv_ar_flags+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -3477,13 +3252,13 @@
 		rm -f conftest.a
 
 		cat >conftest.$ac_ext <<EOF
-#line 3480 "configure"
+#line 3255 "configure"
 int	testdata[3] = { 123, 456, 789 };
 EOF
-		if { (eval echo "$as_me:3483: \"$ac_compile\"") >&5
+		if { (eval echo "$as_me:3258: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:3486: \$? = $ac_status" >&5
+  echo "$as_me:3261: \$? = $ac_status" >&5
   (exit $ac_status); } ; then
 			echo "$AR $ARFLAGS $cf_ar_flags conftest.a conftest.$ac_cv_objext" >&5
 			$AR $ARFLAGS $cf_ar_flags conftest.a conftest.$ac_cv_objext 2>&5 1>/dev/null
@@ -3494,7 +3269,7 @@
 		else
 			test -n "$verbose" && echo "	cannot compile test-program" 1>&6
 
-echo "${as_me:-configure}:3497: testing cannot compile test-program ..." 1>&5
+echo "${as_me:-configure}:3272: testing cannot compile test-program ..." 1>&5
 
 			break
 		fi
@@ -3502,7 +3277,7 @@
 	rm -f conftest.a conftest.$ac_ext conftest.$ac_cv_objext
 
 fi
-echo "$as_me:3505: result: $cf_cv_ar_flags" >&5
+echo "$as_me:3280: result: $cf_cv_ar_flags" >&5
 echo "${ECHO_T}$cf_cv_ar_flags" >&6
 
 if test -n "$ARFLAGS" ; then
@@ -3513,7 +3288,17 @@
 	ARFLAGS=$cf_cv_ar_flags
 fi
 
-echo "$as_me:3516: checking if you have specified an install-prefix" >&5
+	echo "$as_me:3291: checking for PATH separator" >&5
+echo $ECHO_N "checking for PATH separator... $ECHO_C" >&6
+	case $cf_cv_system_name in
+	os2*)	PATH_SEPARATOR=';'  ;;
+	*)	${PATH_SEPARATOR:=':'}  ;;
+	esac
+
+	echo "$as_me:3298: result: $PATH_SEPARATOR" >&5
+echo "${ECHO_T}$PATH_SEPARATOR" >&6
+
+echo "$as_me:3301: checking if you have specified an install-prefix" >&5
 echo $ECHO_N "checking if you have specified an install-prefix... $ECHO_C" >&6
 
 # Check whether --with-install-prefix or --without-install-prefix was given.
@@ -3526,7 +3311,7 @@
 		;;
 	esac
 fi;
-echo "$as_me:3529: result: $DESTDIR" >&5
+echo "$as_me:3314: result: $DESTDIR" >&5
 echo "${ECHO_T}$DESTDIR" >&6
 
 ###############################################################################
@@ -3554,7 +3339,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 "$as_me:3557: checking for $ac_word" >&5
+echo "$as_me:3342: checking for $ac_word" >&5
 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
 if test "${ac_cv_prog_BUILD_CC+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -3569,7 +3354,7 @@
   test -z "$ac_dir" && ac_dir=.
   $as_executable_p "$ac_dir/$ac_word" || continue
 ac_cv_prog_BUILD_CC="$ac_prog"
-echo "$as_me:3572: found $ac_dir/$ac_word" >&5
+echo "$as_me:3357: found $ac_dir/$ac_word" >&5
 break
 done
 
@@ -3577,10 +3362,10 @@
 fi
 BUILD_CC=$ac_cv_prog_BUILD_CC
 if test -n "$BUILD_CC"; then
-  echo "$as_me:3580: result: $BUILD_CC" >&5
+  echo "$as_me:3365: result: $BUILD_CC" >&5
 echo "${ECHO_T}$BUILD_CC" >&6
 else
-  echo "$as_me:3583: result: no" >&5
+  echo "$as_me:3368: result: no" >&5
 echo "${ECHO_T}no" >&6
 fi
 
@@ -3588,12 +3373,12 @@
 done
 
 fi;
-	echo "$as_me:3591: checking for native build C compiler" >&5
+	echo "$as_me:3376: checking for native build C compiler" >&5
 echo $ECHO_N "checking for native build C compiler... $ECHO_C" >&6
-	echo "$as_me:3593: result: $BUILD_CC" >&5
+	echo "$as_me:3378: result: $BUILD_CC" >&5
 echo "${ECHO_T}$BUILD_CC" >&6
 
-	echo "$as_me:3596: checking for native build C preprocessor" >&5
+	echo "$as_me:3381: checking for native build C preprocessor" >&5
 echo $ECHO_N "checking for native build C preprocessor... $ECHO_C" >&6
 
 # Check whether --with-build-cpp or --without-build-cpp was given.
@@ -3603,10 +3388,10 @@
 else
   BUILD_CPP='${BUILD_CC} -E'
 fi;
-	echo "$as_me:3606: result: $BUILD_CPP" >&5
+	echo "$as_me:3391: result: $BUILD_CPP" >&5
 echo "${ECHO_T}$BUILD_CPP" >&6
 
-	echo "$as_me:3609: checking for native build C flags" >&5
+	echo "$as_me:3394: checking for native build C flags" >&5
 echo $ECHO_N "checking for native build C flags... $ECHO_C" >&6
 
 # Check whether --with-build-cflags or --without-build-cflags was given.
@@ -3614,10 +3399,10 @@
   withval="$with_build_cflags"
   BUILD_CFLAGS="$withval"
 fi;
-	echo "$as_me:3617: result: $BUILD_CFLAGS" >&5
+	echo "$as_me:3402: result: $BUILD_CFLAGS" >&5
 echo "${ECHO_T}$BUILD_CFLAGS" >&6
 
-	echo "$as_me:3620: checking for native build C preprocessor-flags" >&5
+	echo "$as_me:3405: checking for native build C preprocessor-flags" >&5
 echo $ECHO_N "checking for native build C preprocessor-flags... $ECHO_C" >&6
 
 # Check whether --with-build-cppflags or --without-build-cppflags was given.
@@ -3625,10 +3410,10 @@
   withval="$with_build_cppflags"
   BUILD_CPPFLAGS="$withval"
 fi;
-	echo "$as_me:3628: result: $BUILD_CPPFLAGS" >&5
+	echo "$as_me:3413: result: $BUILD_CPPFLAGS" >&5
 echo "${ECHO_T}$BUILD_CPPFLAGS" >&6
 
-	echo "$as_me:3631: checking for native build linker-flags" >&5
+	echo "$as_me:3416: checking for native build linker-flags" >&5
 echo $ECHO_N "checking for native build linker-flags... $ECHO_C" >&6
 
 # Check whether --with-build-ldflags or --without-build-ldflags was given.
@@ -3636,10 +3421,10 @@
   withval="$with_build_ldflags"
   BUILD_LDFLAGS="$withval"
 fi;
-	echo "$as_me:3639: result: $BUILD_LDFLAGS" >&5
+	echo "$as_me:3424: result: $BUILD_LDFLAGS" >&5
 echo "${ECHO_T}$BUILD_LDFLAGS" >&6
 
-	echo "$as_me:3642: checking for native build linker-libraries" >&5
+	echo "$as_me:3427: checking for native build linker-libraries" >&5
 echo $ECHO_N "checking for native build linker-libraries... $ECHO_C" >&6
 
 # Check whether --with-build-libs or --without-build-libs was given.
@@ -3647,7 +3432,7 @@
   withval="$with_build_libs"
   BUILD_LIBS="$withval"
 fi;
-	echo "$as_me:3650: result: $BUILD_LIBS" >&5
+	echo "$as_me:3435: result: $BUILD_LIBS" >&5
 echo "${ECHO_T}$BUILD_LIBS" >&6
 
 	# this assumes we're on Unix.
@@ -3657,7 +3442,7 @@
 	: ${BUILD_CC:='${CC}'}
 
 	if ( test "$BUILD_CC" = "$CC" || test "$BUILD_CC" = '${CC}' ) ; then
-		{ { echo "$as_me:3660: error: Cross-build requires two compilers.
+		{ { echo "$as_me:3445: error: Cross-build requires two compilers.
 Use --with-build-cc to specify the native compiler." >&5
 echo "$as_me: error: Cross-build requires two compilers.
 Use --with-build-cc to specify the native compiler." >&2;}
@@ -3682,7 +3467,7 @@
 ### shared, for example.
 cf_list_models=""
 
-echo "$as_me:3685: checking if you want to build shared C-objects" >&5
+echo "$as_me:3470: checking if you want to build shared C-objects" >&5
 echo $ECHO_N "checking if you want to build shared C-objects... $ECHO_C" >&6
 
 # Check whether --with-shared or --without-shared was given.
@@ -3692,27 +3477,27 @@
 else
   with_shared=no
 fi;
-echo "$as_me:3695: result: $with_shared" >&5
+echo "$as_me:3480: result: $with_shared" >&5
 echo "${ECHO_T}$with_shared" >&6
 test "$with_shared" = "yes" && cf_list_models="$cf_list_models shared"
 
-echo "$as_me:3699: checking for specified models" >&5
+echo "$as_me:3484: checking for specified models" >&5
 echo $ECHO_N "checking for specified models... $ECHO_C" >&6
 test -z "$cf_list_models" && cf_list_models=normal
-echo "$as_me:3702: result: $cf_list_models" >&5
+echo "$as_me:3487: result: $cf_list_models" >&5
 echo "${ECHO_T}$cf_list_models" >&6
 
 ### Use the first model as the default, and save its suffix for use in building
 ### up test-applications.
-echo "$as_me:3707: checking for default model" >&5
+echo "$as_me:3492: checking for default model" >&5
 echo $ECHO_N "checking for default model... $ECHO_C" >&6
 DFT_LWR_MODEL=`echo "$cf_list_models" | $AWK '{print $1}'`
-echo "$as_me:3710: result: $DFT_LWR_MODEL" >&5
+echo "$as_me:3495: result: $DFT_LWR_MODEL" >&5
 echo "${ECHO_T}$DFT_LWR_MODEL" >&6
 
 DFT_UPR_MODEL=`echo "$DFT_LWR_MODEL" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
 
-echo "$as_me:3715: checking for specific curses-directory" >&5
+echo "$as_me:3500: checking for specific curses-directory" >&5
 echo $ECHO_N "checking for specific curses-directory... $ECHO_C" >&6
 
 # Check whether --with-curses-dir or --without-curses-dir was given.
@@ -3722,7 +3507,7 @@
 else
   cf_cv_curses_dir=no
 fi;
-echo "$as_me:3725: result: $cf_cv_curses_dir" >&5
+echo "$as_me:3510: result: $cf_cv_curses_dir" >&5
 echo "${ECHO_T}$cf_cv_curses_dir" >&6
 
 if ( test -n "$cf_cv_curses_dir" && test "$cf_cv_curses_dir" != "no" )
@@ -3741,7 +3526,7 @@
   ;;
 .[a-zA-Z]:[\\/]*) #(vi OS/2 EMX
   ;;
-.\${*prefix}*) #(vi
+.\${*prefix}*|.\${*dir}*) #(vi
   eval withval="$withval"
   case ".$withval" in #(vi
   .NONE/*)
@@ -3753,7 +3538,7 @@
   withval=`echo $withval | sed -e s%NONE%$cf_path_syntax%`
   ;;
 *)
-  { { echo "$as_me:3756: error: expected a pathname, not \"$withval\"" >&5
+  { { echo "$as_me:3541: error: expected a pathname, not \"$withval\"" >&5
 echo "$as_me: error: expected a pathname, not \"$withval\"" >&2;}
    { (exit 1); exit 1; }; }
   ;;
@@ -3786,7 +3571,7 @@
 			  cf_save_CPPFLAGS=$CPPFLAGS
 			  CPPFLAGS="$CPPFLAGS -I$cf_add_incdir"
 			  cat >conftest.$ac_ext <<_ACEOF
-#line 3789 "configure"
+#line 3574 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 int
@@ -3798,16 +3583,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:3801: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:3586: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:3804: \$? = $ac_status" >&5
+  echo "$as_me:3589: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:3807: \"$ac_try\"") >&5
+  { (eval echo "$as_me:3592: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:3810: \$? = $ac_status" >&5
+  echo "$as_me:3595: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   :
 else
@@ -3824,7 +3609,7 @@
 		if test "$cf_have_incdir" = no ; then
 		  test -n "$verbose" && echo "	adding $cf_add_incdir to include-path" 1>&6
 
-echo "${as_me:-configure}:3827: testing adding $cf_add_incdir to include-path ..." 1>&5
+echo "${as_me:-configure}:3612: testing adding $cf_add_incdir to include-path ..." 1>&5
 
 		  CPPFLAGS="$CPPFLAGS -I$cf_add_incdir"
 
@@ -3858,7 +3643,7 @@
       if test "$cf_have_libdir" = no ; then
         test -n "$verbose" && echo "	adding $cf_add_libdir to library-path" 1>&6
 
-echo "${as_me:-configure}:3861: testing adding $cf_add_libdir to library-path ..." 1>&5
+echo "${as_me:-configure}:3646: testing adding $cf_add_libdir to library-path ..." 1>&5
 
         LDFLAGS="-L$cf_add_libdir $LDFLAGS"
       fi
@@ -3869,7 +3654,7 @@
 	fi
 fi
 
-echo "$as_me:3872: checking if you want wide-character code" >&5
+echo "$as_me:3657: checking if you want wide-character code" >&5
 echo $ECHO_N "checking if you want wide-character code... $ECHO_C" >&6
 
 # Check whether --enable-widec or --disable-widec was given.
@@ -3879,11 +3664,11 @@
 else
   with_widec=no
 fi;
-echo "$as_me:3882: result: $with_widec" >&5
+echo "$as_me:3667: result: $with_widec" >&5
 echo "${ECHO_T}$with_widec" >&6
 if test "$with_widec" = yes ; then
 
-echo "$as_me:3886: checking for multibyte character support" >&5
+echo "$as_me:3671: checking for multibyte character support" >&5
 echo $ECHO_N "checking for multibyte character support... $ECHO_C" >&6
 if test "${cf_cv_utf8_lib+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -3891,7 +3676,7 @@
 
 	cf_save_LIBS="$LIBS"
 	cat >conftest.$ac_ext <<_ACEOF
-#line 3894 "configure"
+#line 3679 "configure"
 #include "confdefs.h"
 
 #include <stdlib.h>
@@ -3904,16 +3689,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:3907: \"$ac_link\"") >&5
+if { (eval echo "$as_me:3692: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:3910: \$? = $ac_status" >&5
+  echo "$as_me:3695: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:3913: \"$ac_try\"") >&5
+  { (eval echo "$as_me:3698: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:3916: \$? = $ac_status" >&5
+  echo "$as_me:3701: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   cf_cv_utf8_lib=yes
 else
@@ -3925,12 +3710,12 @@
 cf_cv_header_path_utf8=
 cf_cv_library_path_utf8=
 
-echo "${as_me:-configure}:3928: testing Starting FIND_LINKAGE(utf8,) ..." 1>&5
+echo "${as_me:-configure}:3713: testing Starting FIND_LINKAGE(utf8,) ..." 1>&5
 
 cf_save_LIBS="$LIBS"
 
 cat >conftest.$ac_ext <<_ACEOF
-#line 3933 "configure"
+#line 3718 "configure"
 #include "confdefs.h"
 
 #include <libutf8.h>
@@ -3943,16 +3728,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:3946: \"$ac_link\"") >&5
+if { (eval echo "$as_me:3731: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:3949: \$? = $ac_status" >&5
+  echo "$as_me:3734: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:3952: \"$ac_try\"") >&5
+  { (eval echo "$as_me:3737: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:3955: \$? = $ac_status" >&5
+  echo "$as_me:3740: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
 
 	cf_cv_find_linkage_utf8=yes
@@ -3966,7 +3751,7 @@
 LIBS="-lutf8  $cf_save_LIBS"
 
 cat >conftest.$ac_ext <<_ACEOF
-#line 3969 "configure"
+#line 3754 "configure"
 #include "confdefs.h"
 
 #include <libutf8.h>
@@ -3979,16 +3764,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:3982: \"$ac_link\"") >&5
+if { (eval echo "$as_me:3767: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:3985: \$? = $ac_status" >&5
+  echo "$as_me:3770: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:3988: \"$ac_try\"") >&5
+  { (eval echo "$as_me:3773: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:3991: \$? = $ac_status" >&5
+  echo "$as_me:3776: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
 
 	cf_cv_find_linkage_utf8=yes
@@ -4005,9 +3790,9 @@
 
     test -n "$verbose" && echo "	find linkage for utf8 library" 1>&6
 
-echo "${as_me:-configure}:4008: testing find linkage for utf8 library ..." 1>&5
+echo "${as_me:-configure}:3793: testing find linkage for utf8 library ..." 1>&5
 
-echo "${as_me:-configure}:4010: testing Searching for headers in FIND_LINKAGE(utf8,) ..." 1>&5
+echo "${as_me:-configure}:3795: testing Searching for headers in FIND_LINKAGE(utf8,) ..." 1>&5
 
     cf_save_CPPFLAGS="$CPPFLAGS"
     cf_test_CPPFLAGS="$CPPFLAGS"
@@ -4120,11 +3905,11 @@
       if test -d $cf_cv_header_path_utf8 ; then
         test -n "$verbose" && echo "	... testing $cf_cv_header_path_utf8" 1>&6
 
-echo "${as_me:-configure}:4123: testing ... testing $cf_cv_header_path_utf8 ..." 1>&5
+echo "${as_me:-configure}:3908: testing ... testing $cf_cv_header_path_utf8 ..." 1>&5
 
         CPPFLAGS="$cf_save_CPPFLAGS -I$cf_cv_header_path_utf8"
         cat >conftest.$ac_ext <<_ACEOF
-#line 4127 "configure"
+#line 3912 "configure"
 #include "confdefs.h"
 
 #include <libutf8.h>
@@ -4137,21 +3922,21 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:4140: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:3925: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:4143: \$? = $ac_status" >&5
+  echo "$as_me:3928: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:4146: \"$ac_try\"") >&5
+  { (eval echo "$as_me:3931: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:4149: \$? = $ac_status" >&5
+  echo "$as_me:3934: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
 
             test -n "$verbose" && echo "	... found utf8 headers in $cf_cv_header_path_utf8" 1>&6
 
-echo "${as_me:-configure}:4154: testing ... found utf8 headers in $cf_cv_header_path_utf8 ..." 1>&5
+echo "${as_me:-configure}:3939: testing ... found utf8 headers in $cf_cv_header_path_utf8 ..." 1>&5
 
             cf_cv_find_linkage_utf8=maybe
             cf_test_CPPFLAGS="$CPPFLAGS"
@@ -4169,7 +3954,7 @@
 
     if test "$cf_cv_find_linkage_utf8" = maybe ; then
 
-echo "${as_me:-configure}:4172: testing Searching for utf8 library in FIND_LINKAGE(utf8,) ..." 1>&5
+echo "${as_me:-configure}:3957: testing Searching for utf8 library in FIND_LINKAGE(utf8,) ..." 1>&5
 
       cf_save_LIBS="$LIBS"
       cf_save_LDFLAGS="$LDFLAGS"
@@ -4266,13 +4051,13 @@
           if test -d $cf_cv_library_path_utf8 ; then
             test -n "$verbose" && echo "	... testing $cf_cv_library_path_utf8" 1>&6
 
-echo "${as_me:-configure}:4269: testing ... testing $cf_cv_library_path_utf8 ..." 1>&5
+echo "${as_me:-configure}:4054: testing ... testing $cf_cv_library_path_utf8 ..." 1>&5
 
             CPPFLAGS="$cf_test_CPPFLAGS"
             LIBS="-lutf8  $cf_save_LIBS"
             LDFLAGS="$cf_save_LDFLAGS -L$cf_cv_library_path_utf8"
             cat >conftest.$ac_ext <<_ACEOF
-#line 4275 "configure"
+#line 4060 "configure"
 #include "confdefs.h"
 
 #include <libutf8.h>
@@ -4285,21 +4070,21 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:4288: \"$ac_link\"") >&5
+if { (eval echo "$as_me:4073: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:4291: \$? = $ac_status" >&5
+  echo "$as_me:4076: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:4294: \"$ac_try\"") >&5
+  { (eval echo "$as_me:4079: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:4297: \$? = $ac_status" >&5
+  echo "$as_me:4082: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
 
                 test -n "$verbose" && echo "	... found utf8 library in $cf_cv_library_path_utf8" 1>&6
 
-echo "${as_me:-configure}:4302: testing ... found utf8 library in $cf_cv_library_path_utf8 ..." 1>&5
+echo "${as_me:-configure}:4087: testing ... found utf8 library in $cf_cv_library_path_utf8 ..." 1>&5
 
                 cf_cv_find_linkage_utf8=yes
                 cf_cv_library_file_utf8="-lutf8"
@@ -4341,13 +4126,14 @@
 fi
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 fi
-echo "$as_me:4344: result: $cf_cv_utf8_lib" >&5
+echo "$as_me:4129: result: $cf_cv_utf8_lib" >&5
 echo "${ECHO_T}$cf_cv_utf8_lib" >&6
 
 # HAVE_LIBUTF8_H is used by ncurses if curses.h is shared between
 # ncurses/ncursesw:
 if test "$cf_cv_utf8_lib" = "add-on" ; then
-	cat >>confdefs.h <<\EOF
+
+cat >>confdefs.h <<\EOF
 #define HAVE_LIBUTF8_H 1
 EOF
 
@@ -4375,7 +4161,7 @@
 			  cf_save_CPPFLAGS=$CPPFLAGS
 			  CPPFLAGS="$CPPFLAGS -I$cf_add_incdir"
 			  cat >conftest.$ac_ext <<_ACEOF
-#line 4378 "configure"
+#line 4164 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 int
@@ -4387,16 +4173,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:4390: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:4176: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:4393: \$? = $ac_status" >&5
+  echo "$as_me:4179: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:4396: \"$ac_try\"") >&5
+  { (eval echo "$as_me:4182: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:4399: \$? = $ac_status" >&5
+  echo "$as_me:4185: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   :
 else
@@ -4413,7 +4199,7 @@
 		if test "$cf_have_incdir" = no ; then
 		  test -n "$verbose" && echo "	adding $cf_add_incdir to include-path" 1>&6
 
-echo "${as_me:-configure}:4416: testing adding $cf_add_incdir to include-path ..." 1>&5
+echo "${as_me:-configure}:4202: testing adding $cf_add_incdir to include-path ..." 1>&5
 
 		  CPPFLAGS="$CPPFLAGS -I$cf_add_incdir"
 
@@ -4447,7 +4233,7 @@
       if test "$cf_have_libdir" = no ; then
         test -n "$verbose" && echo "	adding $cf_add_libdir to library-path" 1>&6
 
-echo "${as_me:-configure}:4450: testing adding $cf_add_libdir to library-path ..." 1>&5
+echo "${as_me:-configure}:4236: testing adding $cf_add_libdir to library-path ..." 1>&5
 
         LDFLAGS="-L$cf_add_libdir $LDFLAGS"
       fi
@@ -4461,48 +4247,87 @@
 cf_ncuconfig_root=ncursesw
 
 echo "Looking for ${cf_ncuconfig_root}-config"
-for ac_prog in ${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}5-config
+
+if test -n "$ac_tool_prefix"; then
+  for ac_prog in ${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}5-config
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+echo "$as_me:4256: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_NCURSES_CONFIG+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$NCURSES_CONFIG"; then
+  ac_cv_prog_NCURSES_CONFIG="$NCURSES_CONFIG" # Let the user override the test.
+else
+  ac_save_IFS=$IFS; IFS=$ac_path_separator
+ac_dummy="$PATH"
+for ac_dir in $ac_dummy; do
+  IFS=$ac_save_IFS
+  test -z "$ac_dir" && ac_dir=.
+  $as_executable_p "$ac_dir/$ac_word" || continue
+ac_cv_prog_NCURSES_CONFIG="$ac_tool_prefix$ac_prog"
+echo "$as_me:4271: found $ac_dir/$ac_word" >&5
+break
+done
+
+fi
+fi
+NCURSES_CONFIG=$ac_cv_prog_NCURSES_CONFIG
+if test -n "$NCURSES_CONFIG"; then
+  echo "$as_me:4279: result: $NCURSES_CONFIG" >&5
+echo "${ECHO_T}$NCURSES_CONFIG" >&6
+else
+  echo "$as_me:4282: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+    test -n "$NCURSES_CONFIG" && break
+  done
+fi
+if test -z "$NCURSES_CONFIG"; then
+  ac_ct_NCURSES_CONFIG=$NCURSES_CONFIG
+  for ac_prog in ${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}5-config
 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 "$as_me:4468: checking for $ac_word" >&5
+echo "$as_me:4295: checking for $ac_word" >&5
 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_path_NCURSES_CONFIG+set}" = set; then
+if test "${ac_cv_prog_ac_ct_NCURSES_CONFIG+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  case $NCURSES_CONFIG in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_NCURSES_CONFIG="$NCURSES_CONFIG" # Let the user override the test with a path.
-  ;;
-  *)
+  if test -n "$ac_ct_NCURSES_CONFIG"; then
+  ac_cv_prog_ac_ct_NCURSES_CONFIG="$ac_ct_NCURSES_CONFIG" # Let the user override the test.
+else
   ac_save_IFS=$IFS; IFS=$ac_path_separator
 ac_dummy="$PATH"
 for ac_dir in $ac_dummy; do
   IFS=$ac_save_IFS
   test -z "$ac_dir" && ac_dir=.
-  if $as_executable_p "$ac_dir/$ac_word"; then
-   ac_cv_path_NCURSES_CONFIG="$ac_dir/$ac_word"
-   echo "$as_me:4485: found $ac_dir/$ac_word" >&5
-   break
-fi
+  $as_executable_p "$ac_dir/$ac_word" || continue
+ac_cv_prog_ac_ct_NCURSES_CONFIG="$ac_prog"
+echo "$as_me:4310: found $ac_dir/$ac_word" >&5
+break
 done
 
-  ;;
-esac
 fi
-NCURSES_CONFIG=$ac_cv_path_NCURSES_CONFIG
-
-if test -n "$NCURSES_CONFIG"; then
-  echo "$as_me:4496: result: $NCURSES_CONFIG" >&5
-echo "${ECHO_T}$NCURSES_CONFIG" >&6
+fi
+ac_ct_NCURSES_CONFIG=$ac_cv_prog_ac_ct_NCURSES_CONFIG
+if test -n "$ac_ct_NCURSES_CONFIG"; then
+  echo "$as_me:4318: result: $ac_ct_NCURSES_CONFIG" >&5
+echo "${ECHO_T}$ac_ct_NCURSES_CONFIG" >&6
 else
-  echo "$as_me:4499: result: no" >&5
+  echo "$as_me:4321: result: no" >&5
 echo "${ECHO_T}no" >&6
 fi
 
-  test -n "$NCURSES_CONFIG" && break
+  test -n "$ac_ct_NCURSES_CONFIG" && break
 done
-test -n "$NCURSES_CONFIG" || NCURSES_CONFIG="none"
+test -n "$ac_ct_NCURSES_CONFIG" || ac_ct_NCURSES_CONFIG="none"
+
+  NCURSES_CONFIG=$ac_ct_NCURSES_CONFIG
+fi
 
 if test "$NCURSES_CONFIG" != none ; then
 
@@ -4511,7 +4336,7 @@
 
 # even with config script, some packages use no-override for curses.h
 
-echo "$as_me:4514: checking if we have identified curses headers" >&5
+echo "$as_me:4339: checking if we have identified curses headers" >&5
 echo $ECHO_N "checking if we have identified curses headers... $ECHO_C" >&6
 if test "${cf_cv_ncurses_header+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -4519,13 +4344,13 @@
 
 cf_cv_ncurses_header=none
 for cf_header in  \
-    ncursesw/curses.h \
-	ncursesw/ncurses.h \
-	curses.h \
-	ncurses.h
+    ncursesw/ncurses.h \
+	ncursesw/curses.h \
+	ncurses.h \
+	curses.h
 do
 cat >conftest.$ac_ext <<_ACEOF
-#line 4528 "configure"
+#line 4353 "configure"
 #include "confdefs.h"
 #include <${cf_header}>
 int
@@ -4537,16 +4362,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:4540: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:4365: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:4543: \$? = $ac_status" >&5
+  echo "$as_me:4368: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:4546: \"$ac_try\"") >&5
+  { (eval echo "$as_me:4371: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:4549: \$? = $ac_status" >&5
+  echo "$as_me:4374: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   cf_cv_ncurses_header=$cf_header; break
 else
@@ -4557,11 +4382,11 @@
 done
 
 fi
-echo "$as_me:4560: result: $cf_cv_ncurses_header" >&5
+echo "$as_me:4385: result: $cf_cv_ncurses_header" >&5
 echo "${ECHO_T}$cf_cv_ncurses_header" >&6
 
 if test "$cf_cv_ncurses_header" = none ; then
-	{ { echo "$as_me:4564: error: No curses header-files found" >&5
+	{ { echo "$as_me:4389: error: No curses header-files found" >&5
 echo "$as_me: error: No curses header-files found" >&2;}
    { (exit 1); exit 1; }; }
 fi
@@ -4571,23 +4396,23 @@
 for ac_header in $cf_cv_ncurses_header
 do
 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-echo "$as_me:4574: checking for $ac_header" >&5
+echo "$as_me:4399: checking for $ac_header" >&5
 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
 if eval "test \"\${$as_ac_Header+set}\" = set"; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 4580 "configure"
+#line 4405 "configure"
 #include "confdefs.h"
 #include <$ac_header>
 _ACEOF
-if { (eval echo "$as_me:4584: \"$ac_cpp conftest.$ac_ext\"") >&5
+if { (eval echo "$as_me:4409: \"$ac_cpp conftest.$ac_ext\"") >&5
   (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
   ac_status=$?
   egrep -v '^ *\+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
-  echo "$as_me:4590: \$? = $ac_status" >&5
+  echo "$as_me:4415: \$? = $ac_status" >&5
   (exit $ac_status); } >/dev/null; then
   if test -s conftest.err; then
     ac_cpp_err=$ac_c_preproc_warn_flag
@@ -4606,7 +4431,7 @@
 fi
 rm -f conftest.err conftest.$ac_ext
 fi
-echo "$as_me:4609: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "$as_me:4434: result: `eval echo '${'$as_ac_Header'}'`" >&5
 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
 if test `eval echo '${'$as_ac_Header'}'` = yes; then
   cat >>confdefs.h <<EOF
@@ -4659,7 +4484,7 @@
 			  cf_save_CPPFLAGS=$CPPFLAGS
 			  CPPFLAGS="$CPPFLAGS -I$cf_add_incdir"
 			  cat >conftest.$ac_ext <<_ACEOF
-#line 4662 "configure"
+#line 4487 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 int
@@ -4671,16 +4496,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:4674: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:4499: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:4677: \$? = $ac_status" >&5
+  echo "$as_me:4502: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:4680: \"$ac_try\"") >&5
+  { (eval echo "$as_me:4505: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:4683: \$? = $ac_status" >&5
+  echo "$as_me:4508: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   :
 else
@@ -4697,7 +4522,7 @@
 		if test "$cf_have_incdir" = no ; then
 		  test -n "$verbose" && echo "	adding $cf_add_incdir to include-path" 1>&6
 
-echo "${as_me:-configure}:4700: testing adding $cf_add_incdir to include-path ..." 1>&5
+echo "${as_me:-configure}:4525: testing adding $cf_add_incdir to include-path ..." 1>&5
 
 		  CPPFLAGS="$CPPFLAGS -I$cf_add_incdir"
 
@@ -4714,7 +4539,7 @@
 
 }
 
-echo "$as_me:4717: checking for $cf_ncuhdr_root header in include-path" >&5
+echo "$as_me:4542: checking for $cf_ncuhdr_root header in include-path" >&5
 echo $ECHO_N "checking for $cf_ncuhdr_root header in include-path... $ECHO_C" >&6
 if test "${cf_cv_ncurses_h+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -4726,7 +4551,7 @@
 	do
 
 	cat >conftest.$ac_ext <<_ACEOF
-#line 4729 "configure"
+#line 4554 "configure"
 #include "confdefs.h"
 
 #define _XOPEN_SOURCE_EXTENDED
@@ -4758,16 +4583,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:4761: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:4586: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:4764: \$? = $ac_status" >&5
+  echo "$as_me:4589: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:4767: \"$ac_try\"") >&5
+  { (eval echo "$as_me:4592: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:4770: \$? = $ac_status" >&5
+  echo "$as_me:4595: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   cf_cv_ncurses_h=$cf_header
 
@@ -4782,14 +4607,14 @@
 	done
 
 fi
-echo "$as_me:4785: result: $cf_cv_ncurses_h" >&5
+echo "$as_me:4610: result: $cf_cv_ncurses_h" >&5
 echo "${ECHO_T}$cf_cv_ncurses_h" >&6
 
 if test "$cf_cv_ncurses_h" != no ; then
 	cf_cv_ncurses_header=$cf_cv_ncurses_h
 else
 
-echo "$as_me:4792: checking for $cf_ncuhdr_root include-path" >&5
+echo "$as_me:4617: checking for $cf_ncuhdr_root include-path" >&5
 echo $ECHO_N "checking for $cf_ncuhdr_root include-path... $ECHO_C" >&6
 if test "${cf_cv_ncurses_h2+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -4929,7 +4754,7 @@
 			  cf_save_CPPFLAGS=$CPPFLAGS
 			  CPPFLAGS="$CPPFLAGS -I$cf_add_incdir"
 			  cat >conftest.$ac_ext <<_ACEOF
-#line 4932 "configure"
+#line 4757 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 int
@@ -4941,16 +4766,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:4944: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:4769: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:4947: \$? = $ac_status" >&5
+  echo "$as_me:4772: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:4950: \"$ac_try\"") >&5
+  { (eval echo "$as_me:4775: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:4953: \$? = $ac_status" >&5
+  echo "$as_me:4778: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   :
 else
@@ -4967,7 +4792,7 @@
 		if test "$cf_have_incdir" = no ; then
 		  test -n "$verbose" && echo "	adding $cf_add_incdir to include-path" 1>&6
 
-echo "${as_me:-configure}:4970: testing adding $cf_add_incdir to include-path ..." 1>&5
+echo "${as_me:-configure}:4795: testing adding $cf_add_incdir to include-path ..." 1>&5
 
 		  CPPFLAGS="$CPPFLAGS -I$cf_add_incdir"
 
@@ -4988,7 +4813,7 @@
 		do
 
 	cat >conftest.$ac_ext <<_ACEOF
-#line 4991 "configure"
+#line 4816 "configure"
 #include "confdefs.h"
 
 #include <$cf_header>
@@ -5012,16 +4837,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:5015: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:4840: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:5018: \$? = $ac_status" >&5
+  echo "$as_me:4843: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:5021: \"$ac_try\"") >&5
+  { (eval echo "$as_me:4846: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:5024: \$? = $ac_status" >&5
+  echo "$as_me:4849: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   cf_cv_ncurses_h2=$cf_header
 
@@ -5042,12 +4867,12 @@
 		CPPFLAGS="$cf_save2_CPPFLAGS"
 		test "$cf_cv_ncurses_h2" != no && break
 	done
-	test "$cf_cv_ncurses_h2" = no && { { echo "$as_me:5045: error: not found" >&5
+	test "$cf_cv_ncurses_h2" = no && { { echo "$as_me:4870: error: not found" >&5
 echo "$as_me: error: not found" >&2;}
    { (exit 1); exit 1; }; }
 
 fi
-echo "$as_me:5050: result: $cf_cv_ncurses_h2" >&5
+echo "$as_me:4875: result: $cf_cv_ncurses_h2" >&5
 echo "${ECHO_T}$cf_cv_ncurses_h2" >&6
 
 	cf_1st_incdir=`echo $cf_cv_ncurses_h2 | sed -e 's%/[^/]*$%%'`
@@ -5080,7 +4905,7 @@
 			  cf_save_CPPFLAGS=$CPPFLAGS
 			  CPPFLAGS="$CPPFLAGS -I$cf_add_incdir"
 			  cat >conftest.$ac_ext <<_ACEOF
-#line 5083 "configure"
+#line 4908 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 int
@@ -5092,16 +4917,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:5095: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:4920: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:5098: \$? = $ac_status" >&5
+  echo "$as_me:4923: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:5101: \"$ac_try\"") >&5
+  { (eval echo "$as_me:4926: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:5104: \$? = $ac_status" >&5
+  echo "$as_me:4929: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   :
 else
@@ -5118,7 +4943,7 @@
 		if test "$cf_have_incdir" = no ; then
 		  test -n "$verbose" && echo "	adding $cf_add_incdir to include-path" 1>&6
 
-echo "${as_me:-configure}:5121: testing adding $cf_add_incdir to include-path ..." 1>&5
+echo "${as_me:-configure}:4946: testing adding $cf_add_incdir to include-path ..." 1>&5
 
 		  CPPFLAGS="$CPPFLAGS -I$cf_add_incdir"
 
@@ -5139,7 +4964,8 @@
 
 case $cf_cv_ncurses_header in # (vi
 *ncurses.h)
-	cat >>confdefs.h <<\EOF
+
+cat >>confdefs.h <<\EOF
 #define HAVE_NCURSES_H 1
 EOF
 
@@ -5148,20 +4974,22 @@
 
 case $cf_cv_ncurses_header in # (vi
 ncurses/curses.h|ncurses/ncurses.h)
-	cat >>confdefs.h <<\EOF
+
+cat >>confdefs.h <<\EOF
 #define HAVE_NCURSES_NCURSES_H 1
 EOF
 
 	;;
 ncursesw/curses.h|ncursesw/ncurses.h)
-	cat >>confdefs.h <<\EOF
+
+cat >>confdefs.h <<\EOF
 #define HAVE_NCURSESW_NCURSES_H 1
 EOF
 
 	;;
 esac
 
-echo "$as_me:5164: checking for terminfo header" >&5
+echo "$as_me:4992: checking for terminfo header" >&5
 echo $ECHO_N "checking for terminfo header... $ECHO_C" >&6
 if test "${cf_cv_term_header+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -5179,7 +5007,7 @@
 for cf_test in $cf_term_header "ncurses/term.h" "ncursesw/term.h"
 do
 cat >conftest.$ac_ext <<_ACEOF
-#line 5182 "configure"
+#line 5010 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 #include <${cf_cv_ncurses_header:-curses.h}>
@@ -5194,16 +5022,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:5197: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:5025: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:5200: \$? = $ac_status" >&5
+  echo "$as_me:5028: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:5203: \"$ac_try\"") >&5
+  { (eval echo "$as_me:5031: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:5206: \$? = $ac_status" >&5
+  echo "$as_me:5034: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
 
 	cf_cv_term_header="$cf_test"
@@ -5219,14 +5047,15 @@
 done
 
 fi
-echo "$as_me:5222: result: $cf_cv_term_header" >&5
+echo "$as_me:5050: result: $cf_cv_term_header" >&5
 echo "${ECHO_T}$cf_cv_term_header" >&6
 
 # Set definitions to allow ifdef'ing to accommodate subdirectories
 
 case $cf_cv_term_header in # (vi
 *term.h)
-	cat >>confdefs.h <<\EOF
+
+cat >>confdefs.h <<\EOF
 #define HAVE_TERM_H 1
 EOF
 
@@ -5235,13 +5064,15 @@
 
 case $cf_cv_term_header in # (vi
 ncurses/term.h) #(vi
-	cat >>confdefs.h <<\EOF
+
+cat >>confdefs.h <<\EOF
 #define HAVE_NCURSES_TERM_H 1
 EOF
 
 	;;
 ncursesw/term.h)
-	cat >>confdefs.h <<\EOF
+
+cat >>confdefs.h <<\EOF
 #define HAVE_NCURSESW_TERM_H 1
 EOF
 
@@ -5249,11 +5080,12 @@
 esac
 
 # some applications need this, but should check for NCURSES_VERSION
+
 cat >>confdefs.h <<\EOF
 #define NCURSES 1
 EOF
 
-echo "$as_me:5256: checking for ncurses version" >&5
+echo "$as_me:5088: checking for ncurses version" >&5
 echo $ECHO_N "checking for ncurses version... $ECHO_C" >&6
 if test "${cf_cv_ncurses_version+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -5279,10 +5111,10 @@
 #endif
 EOF
 	cf_try="$ac_cpp conftest.$ac_ext 2>&5 | grep '^Autoconf ' >conftest.out"
-	{ (eval echo "$as_me:5282: \"$cf_try\"") >&5
+	{ (eval echo "$as_me:5114: \"$cf_try\"") >&5
   (eval $cf_try) 2>&5
   ac_status=$?
-  echo "$as_me:5285: \$? = $ac_status" >&5
+  echo "$as_me:5117: \$? = $ac_status" >&5
   (exit $ac_status); }
 	if test -f conftest.out ; then
 		cf_out=`cat conftest.out | sed -e 's%^Autoconf %%' -e 's%^[^"]*"%%' -e 's%".*%%'`
@@ -5292,7 +5124,7 @@
 
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 5295 "configure"
+#line 5127 "configure"
 #include "confdefs.h"
 
 #include <${cf_cv_ncurses_header:-curses.h}>
@@ -5317,15 +5149,15 @@
 }
 _ACEOF
 rm -f conftest$ac_exeext
-if { (eval echo "$as_me:5320: \"$ac_link\"") >&5
+if { (eval echo "$as_me:5152: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:5323: \$? = $ac_status" >&5
+  echo "$as_me:5155: \$? = $ac_status" >&5
   (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (eval echo "$as_me:5325: \"$ac_try\"") >&5
+  { (eval echo "$as_me:5157: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:5328: \$? = $ac_status" >&5
+  echo "$as_me:5160: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
 
 	cf_cv_ncurses_version=`cat $cf_tempfile`
@@ -5339,9 +5171,10 @@
 	rm -f $cf_tempfile
 
 fi
-echo "$as_me:5342: result: $cf_cv_ncurses_version" >&5
+echo "$as_me:5174: result: $cf_cv_ncurses_version" >&5
 echo "${ECHO_T}$cf_cv_ncurses_version" >&6
-test "$cf_cv_ncurses_version" = no || cat >>confdefs.h <<\EOF
+test "$cf_cv_ncurses_version" = no ||
+cat >>confdefs.h <<\EOF
 #define NCURSES 1
 EOF
 
@@ -5351,7 +5184,7 @@
 	# to link gpm.
 cf_ncurses_LIBS=""
 cf_ncurses_SAVE="$LIBS"
-echo "$as_me:5354: checking for Gpm_Open in -lgpm" >&5
+echo "$as_me:5187: checking for Gpm_Open in -lgpm" >&5
 echo $ECHO_N "checking for Gpm_Open in -lgpm... $ECHO_C" >&6
 if test "${ac_cv_lib_gpm_Gpm_Open+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -5359,7 +5192,7 @@
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lgpm  $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
-#line 5362 "configure"
+#line 5195 "configure"
 #include "confdefs.h"
 
 /* Override any gcc2 internal prototype to avoid an error.  */
@@ -5378,16 +5211,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:5381: \"$ac_link\"") >&5
+if { (eval echo "$as_me:5214: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:5384: \$? = $ac_status" >&5
+  echo "$as_me:5217: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:5387: \"$ac_try\"") >&5
+  { (eval echo "$as_me:5220: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:5390: \$? = $ac_status" >&5
+  echo "$as_me:5223: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_lib_gpm_Gpm_Open=yes
 else
@@ -5398,10 +5231,10 @@
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-echo "$as_me:5401: result: $ac_cv_lib_gpm_Gpm_Open" >&5
+echo "$as_me:5234: result: $ac_cv_lib_gpm_Gpm_Open" >&5
 echo "${ECHO_T}$ac_cv_lib_gpm_Gpm_Open" >&6
 if test $ac_cv_lib_gpm_Gpm_Open = yes; then
-  echo "$as_me:5404: checking for initscr in -lgpm" >&5
+  echo "$as_me:5237: checking for initscr in -lgpm" >&5
 echo $ECHO_N "checking for initscr in -lgpm... $ECHO_C" >&6
 if test "${ac_cv_lib_gpm_initscr+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -5409,7 +5242,7 @@
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lgpm  $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
-#line 5412 "configure"
+#line 5245 "configure"
 #include "confdefs.h"
 
 /* Override any gcc2 internal prototype to avoid an error.  */
@@ -5428,16 +5261,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:5431: \"$ac_link\"") >&5
+if { (eval echo "$as_me:5264: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:5434: \$? = $ac_status" >&5
+  echo "$as_me:5267: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:5437: \"$ac_try\"") >&5
+  { (eval echo "$as_me:5270: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:5440: \$? = $ac_status" >&5
+  echo "$as_me:5273: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_lib_gpm_initscr=yes
 else
@@ -5448,7 +5281,7 @@
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-echo "$as_me:5451: result: $ac_cv_lib_gpm_initscr" >&5
+echo "$as_me:5284: result: $ac_cv_lib_gpm_initscr" >&5
 echo "${ECHO_T}$ac_cv_lib_gpm_initscr" >&6
 if test $ac_cv_lib_gpm_initscr = yes; then
   LIBS="$cf_ncurses_SAVE"
@@ -5463,7 +5296,7 @@
 	# This is only necessary if you are linking against an obsolete
 	# version of ncurses (but it should do no harm, since it's static).
 	if test "$cf_nculib_root" = ncurses ; then
-		echo "$as_me:5466: checking for tgoto in -lmytinfo" >&5
+		echo "$as_me:5299: checking for tgoto in -lmytinfo" >&5
 echo $ECHO_N "checking for tgoto in -lmytinfo... $ECHO_C" >&6
 if test "${ac_cv_lib_mytinfo_tgoto+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -5471,7 +5304,7 @@
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lmytinfo  $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
-#line 5474 "configure"
+#line 5307 "configure"
 #include "confdefs.h"
 
 /* Override any gcc2 internal prototype to avoid an error.  */
@@ -5490,16 +5323,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:5493: \"$ac_link\"") >&5
+if { (eval echo "$as_me:5326: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:5496: \$? = $ac_status" >&5
+  echo "$as_me:5329: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:5499: \"$ac_try\"") >&5
+  { (eval echo "$as_me:5332: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:5502: \$? = $ac_status" >&5
+  echo "$as_me:5335: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_lib_mytinfo_tgoto=yes
 else
@@ -5510,7 +5343,7 @@
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-echo "$as_me:5513: result: $ac_cv_lib_mytinfo_tgoto" >&5
+echo "$as_me:5346: result: $ac_cv_lib_mytinfo_tgoto" >&5
 echo "${ECHO_T}$ac_cv_lib_mytinfo_tgoto" >&6
 if test $ac_cv_lib_mytinfo_tgoto = yes; then
   cf_ncurses_LIBS="-lmytinfo $cf_ncurses_LIBS"
@@ -5529,13 +5362,13 @@
 
 	eval 'cf_cv_have_lib_'$cf_nculib_root'=no'
 	cf_libdir=""
-	echo "$as_me:5532: checking for initscr" >&5
+	echo "$as_me:5365: checking for initscr" >&5
 echo $ECHO_N "checking for initscr... $ECHO_C" >&6
 if test "${ac_cv_func_initscr+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 5538 "configure"
+#line 5371 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char initscr (); below.  */
@@ -5558,7 +5391,7 @@
 #if defined (__stub_initscr) || defined (__stub___initscr)
 choke me
 #else
-f = initscr;
+f = initscr; /* workaround for ICC 12.0.3 */ if (f == 0) return 1;
 #endif
 
   ;
@@ -5566,16 +5399,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:5569: \"$ac_link\"") >&5
+if { (eval echo "$as_me:5402: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:5572: \$? = $ac_status" >&5
+  echo "$as_me:5405: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:5575: \"$ac_try\"") >&5
+  { (eval echo "$as_me:5408: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:5578: \$? = $ac_status" >&5
+  echo "$as_me:5411: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_func_initscr=yes
 else
@@ -5585,18 +5418,18 @@
 fi
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 fi
-echo "$as_me:5588: result: $ac_cv_func_initscr" >&5
+echo "$as_me:5421: result: $ac_cv_func_initscr" >&5
 echo "${ECHO_T}$ac_cv_func_initscr" >&6
 if test $ac_cv_func_initscr = yes; then
   eval 'cf_cv_have_lib_'$cf_nculib_root'=yes'
 else
 
 		cf_save_LIBS="$LIBS"
-		echo "$as_me:5595: checking for initscr in -l$cf_nculib_root" >&5
+		echo "$as_me:5428: checking for initscr in -l$cf_nculib_root" >&5
 echo $ECHO_N "checking for initscr in -l$cf_nculib_root... $ECHO_C" >&6
 		LIBS="-l$cf_nculib_root $LIBS"
 		cat >conftest.$ac_ext <<_ACEOF
-#line 5599 "configure"
+#line 5432 "configure"
 #include "confdefs.h"
 #include <${cf_cv_ncurses_header:-curses.h}>
 int
@@ -5608,25 +5441,25 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:5611: \"$ac_link\"") >&5
+if { (eval echo "$as_me:5444: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:5614: \$? = $ac_status" >&5
+  echo "$as_me:5447: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:5617: \"$ac_try\"") >&5
+  { (eval echo "$as_me:5450: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:5620: \$? = $ac_status" >&5
+  echo "$as_me:5453: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  echo "$as_me:5622: result: yes" >&5
+  echo "$as_me:5455: result: yes" >&5
 echo "${ECHO_T}yes" >&6
 			 eval 'cf_cv_have_lib_'$cf_nculib_root'=yes'
 
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-echo "$as_me:5629: result: no" >&5
+echo "$as_me:5462: result: no" >&5
 echo "${ECHO_T}no" >&6
 
 cf_search=
@@ -5716,11 +5549,11 @@
 
 			for cf_libdir in $cf_search
 			do
-				echo "$as_me:5719: checking for -l$cf_nculib_root in $cf_libdir" >&5
+				echo "$as_me:5552: checking for -l$cf_nculib_root in $cf_libdir" >&5
 echo $ECHO_N "checking for -l$cf_nculib_root in $cf_libdir... $ECHO_C" >&6
 				LIBS="-L$cf_libdir -l$cf_nculib_root $cf_save_LIBS"
 				cat >conftest.$ac_ext <<_ACEOF
-#line 5723 "configure"
+#line 5556 "configure"
 #include "confdefs.h"
 #include <${cf_cv_ncurses_header:-curses.h}>
 int
@@ -5732,25 +5565,25 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:5735: \"$ac_link\"") >&5
+if { (eval echo "$as_me:5568: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:5738: \$? = $ac_status" >&5
+  echo "$as_me:5571: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:5741: \"$ac_try\"") >&5
+  { (eval echo "$as_me:5574: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:5744: \$? = $ac_status" >&5
+  echo "$as_me:5577: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  echo "$as_me:5746: result: yes" >&5
+  echo "$as_me:5579: result: yes" >&5
 echo "${ECHO_T}yes" >&6
 			 		 eval 'cf_cv_have_lib_'$cf_nculib_root'=yes'
 					 break
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-echo "$as_me:5753: result: no" >&5
+echo "$as_me:5586: result: no" >&5
 echo "${ECHO_T}no" >&6
 					 LIBS="$cf_save_LIBS"
 fi
@@ -5765,7 +5598,7 @@
 eval 'cf_found_library=$cf_cv_have_lib_'$cf_nculib_root
 
 if test $cf_found_library = no ; then
-	{ { echo "$as_me:5768: error: Cannot link $cf_nculib_root library" >&5
+	{ { echo "$as_me:5601: error: Cannot link $cf_nculib_root library" >&5
 echo "$as_me: error: Cannot link $cf_nculib_root library" >&2;}
    { (exit 1); exit 1; }; }
 fi
@@ -5773,7 +5606,7 @@
 fi
 
 if test -n "$cf_ncurses_LIBS" ; then
-	echo "$as_me:5776: checking if we can link $cf_nculib_root without $cf_ncurses_LIBS" >&5
+	echo "$as_me:5609: checking if we can link $cf_nculib_root without $cf_ncurses_LIBS" >&5
 echo $ECHO_N "checking if we can link $cf_nculib_root without $cf_ncurses_LIBS... $ECHO_C" >&6
 	cf_ncurses_SAVE="$LIBS"
 	for p in $cf_ncurses_LIBS ; do
@@ -5783,7 +5616,7 @@
 		fi
 	done
 	cat >conftest.$ac_ext <<_ACEOF
-#line 5786 "configure"
+#line 5619 "configure"
 #include "confdefs.h"
 #include <${cf_cv_ncurses_header:-curses.h}>
 int
@@ -5795,23 +5628,23 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:5798: \"$ac_link\"") >&5
+if { (eval echo "$as_me:5631: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:5801: \$? = $ac_status" >&5
+  echo "$as_me:5634: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:5804: \"$ac_try\"") >&5
+  { (eval echo "$as_me:5637: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:5807: \$? = $ac_status" >&5
+  echo "$as_me:5640: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  echo "$as_me:5809: result: yes" >&5
+  echo "$as_me:5642: result: yes" >&5
 echo "${ECHO_T}yes" >&6
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-echo "$as_me:5814: result: no" >&5
+echo "$as_me:5647: result: no" >&5
 echo "${ECHO_T}no" >&6
 		 LIBS="$cf_ncurses_SAVE"
 fi
@@ -5831,48 +5664,87 @@
 cf_ncuconfig_root=ncurses
 
 echo "Looking for ${cf_ncuconfig_root}-config"
-for ac_prog in ${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}5-config
+
+if test -n "$ac_tool_prefix"; then
+  for ac_prog in ${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}5-config
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+echo "$as_me:5673: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_NCURSES_CONFIG+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$NCURSES_CONFIG"; then
+  ac_cv_prog_NCURSES_CONFIG="$NCURSES_CONFIG" # Let the user override the test.
+else
+  ac_save_IFS=$IFS; IFS=$ac_path_separator
+ac_dummy="$PATH"
+for ac_dir in $ac_dummy; do
+  IFS=$ac_save_IFS
+  test -z "$ac_dir" && ac_dir=.
+  $as_executable_p "$ac_dir/$ac_word" || continue
+ac_cv_prog_NCURSES_CONFIG="$ac_tool_prefix$ac_prog"
+echo "$as_me:5688: found $ac_dir/$ac_word" >&5
+break
+done
+
+fi
+fi
+NCURSES_CONFIG=$ac_cv_prog_NCURSES_CONFIG
+if test -n "$NCURSES_CONFIG"; then
+  echo "$as_me:5696: result: $NCURSES_CONFIG" >&5
+echo "${ECHO_T}$NCURSES_CONFIG" >&6
+else
+  echo "$as_me:5699: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+    test -n "$NCURSES_CONFIG" && break
+  done
+fi
+if test -z "$NCURSES_CONFIG"; then
+  ac_ct_NCURSES_CONFIG=$NCURSES_CONFIG
+  for ac_prog in ${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}5-config
 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 "$as_me:5838: checking for $ac_word" >&5
+echo "$as_me:5712: checking for $ac_word" >&5
 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_path_NCURSES_CONFIG+set}" = set; then
+if test "${ac_cv_prog_ac_ct_NCURSES_CONFIG+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  case $NCURSES_CONFIG in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_NCURSES_CONFIG="$NCURSES_CONFIG" # Let the user override the test with a path.
-  ;;
-  *)
+  if test -n "$ac_ct_NCURSES_CONFIG"; then
+  ac_cv_prog_ac_ct_NCURSES_CONFIG="$ac_ct_NCURSES_CONFIG" # Let the user override the test.
+else
   ac_save_IFS=$IFS; IFS=$ac_path_separator
 ac_dummy="$PATH"
 for ac_dir in $ac_dummy; do
   IFS=$ac_save_IFS
   test -z "$ac_dir" && ac_dir=.
-  if $as_executable_p "$ac_dir/$ac_word"; then
-   ac_cv_path_NCURSES_CONFIG="$ac_dir/$ac_word"
-   echo "$as_me:5855: found $ac_dir/$ac_word" >&5
-   break
-fi
+  $as_executable_p "$ac_dir/$ac_word" || continue
+ac_cv_prog_ac_ct_NCURSES_CONFIG="$ac_prog"
+echo "$as_me:5727: found $ac_dir/$ac_word" >&5
+break
 done
 
-  ;;
-esac
 fi
-NCURSES_CONFIG=$ac_cv_path_NCURSES_CONFIG
-
-if test -n "$NCURSES_CONFIG"; then
-  echo "$as_me:5866: result: $NCURSES_CONFIG" >&5
-echo "${ECHO_T}$NCURSES_CONFIG" >&6
+fi
+ac_ct_NCURSES_CONFIG=$ac_cv_prog_ac_ct_NCURSES_CONFIG
+if test -n "$ac_ct_NCURSES_CONFIG"; then
+  echo "$as_me:5735: result: $ac_ct_NCURSES_CONFIG" >&5
+echo "${ECHO_T}$ac_ct_NCURSES_CONFIG" >&6
 else
-  echo "$as_me:5869: result: no" >&5
+  echo "$as_me:5738: result: no" >&5
 echo "${ECHO_T}no" >&6
 fi
 
-  test -n "$NCURSES_CONFIG" && break
+  test -n "$ac_ct_NCURSES_CONFIG" && break
 done
-test -n "$NCURSES_CONFIG" || NCURSES_CONFIG="none"
+test -n "$ac_ct_NCURSES_CONFIG" || ac_ct_NCURSES_CONFIG="none"
+
+  NCURSES_CONFIG=$ac_ct_NCURSES_CONFIG
+fi
 
 if test "$NCURSES_CONFIG" != none ; then
 
@@ -5881,7 +5753,7 @@
 
 # even with config script, some packages use no-override for curses.h
 
-echo "$as_me:5884: checking if we have identified curses headers" >&5
+echo "$as_me:5756: checking if we have identified curses headers" >&5
 echo $ECHO_N "checking if we have identified curses headers... $ECHO_C" >&6
 if test "${cf_cv_ncurses_header+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -5889,13 +5761,13 @@
 
 cf_cv_ncurses_header=none
 for cf_header in  \
-    ncurses/curses.h \
-	ncurses/ncurses.h \
-	curses.h \
-	ncurses.h
+    ncurses/ncurses.h \
+	ncurses/curses.h \
+	ncurses.h \
+	curses.h
 do
 cat >conftest.$ac_ext <<_ACEOF
-#line 5898 "configure"
+#line 5770 "configure"
 #include "confdefs.h"
 #include <${cf_header}>
 int
@@ -5907,16 +5779,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:5910: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:5782: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:5913: \$? = $ac_status" >&5
+  echo "$as_me:5785: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:5916: \"$ac_try\"") >&5
+  { (eval echo "$as_me:5788: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:5919: \$? = $ac_status" >&5
+  echo "$as_me:5791: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   cf_cv_ncurses_header=$cf_header; break
 else
@@ -5927,11 +5799,11 @@
 done
 
 fi
-echo "$as_me:5930: result: $cf_cv_ncurses_header" >&5
+echo "$as_me:5802: result: $cf_cv_ncurses_header" >&5
 echo "${ECHO_T}$cf_cv_ncurses_header" >&6
 
 if test "$cf_cv_ncurses_header" = none ; then
-	{ { echo "$as_me:5934: error: No curses header-files found" >&5
+	{ { echo "$as_me:5806: error: No curses header-files found" >&5
 echo "$as_me: error: No curses header-files found" >&2;}
    { (exit 1); exit 1; }; }
 fi
@@ -5941,23 +5813,23 @@
 for ac_header in $cf_cv_ncurses_header
 do
 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-echo "$as_me:5944: checking for $ac_header" >&5
+echo "$as_me:5816: checking for $ac_header" >&5
 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
 if eval "test \"\${$as_ac_Header+set}\" = set"; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 5950 "configure"
+#line 5822 "configure"
 #include "confdefs.h"
 #include <$ac_header>
 _ACEOF
-if { (eval echo "$as_me:5954: \"$ac_cpp conftest.$ac_ext\"") >&5
+if { (eval echo "$as_me:5826: \"$ac_cpp conftest.$ac_ext\"") >&5
   (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
   ac_status=$?
   egrep -v '^ *\+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
-  echo "$as_me:5960: \$? = $ac_status" >&5
+  echo "$as_me:5832: \$? = $ac_status" >&5
   (exit $ac_status); } >/dev/null; then
   if test -s conftest.err; then
     ac_cpp_err=$ac_c_preproc_warn_flag
@@ -5976,7 +5848,7 @@
 fi
 rm -f conftest.err conftest.$ac_ext
 fi
-echo "$as_me:5979: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "$as_me:5851: result: `eval echo '${'$as_ac_Header'}'`" >&5
 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
 if test `eval echo '${'$as_ac_Header'}'` = yes; then
   cat >>confdefs.h <<EOF
@@ -6029,7 +5901,7 @@
 			  cf_save_CPPFLAGS=$CPPFLAGS
 			  CPPFLAGS="$CPPFLAGS -I$cf_add_incdir"
 			  cat >conftest.$ac_ext <<_ACEOF
-#line 6032 "configure"
+#line 5904 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 int
@@ -6041,16 +5913,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:6044: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:5916: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:6047: \$? = $ac_status" >&5
+  echo "$as_me:5919: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:6050: \"$ac_try\"") >&5
+  { (eval echo "$as_me:5922: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:6053: \$? = $ac_status" >&5
+  echo "$as_me:5925: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   :
 else
@@ -6067,7 +5939,7 @@
 		if test "$cf_have_incdir" = no ; then
 		  test -n "$verbose" && echo "	adding $cf_add_incdir to include-path" 1>&6
 
-echo "${as_me:-configure}:6070: testing adding $cf_add_incdir to include-path ..." 1>&5
+echo "${as_me:-configure}:5942: testing adding $cf_add_incdir to include-path ..." 1>&5
 
 		  CPPFLAGS="$CPPFLAGS -I$cf_add_incdir"
 
@@ -6084,7 +5956,7 @@
 
 }
 
-echo "$as_me:6087: checking for $cf_ncuhdr_root header in include-path" >&5
+echo "$as_me:5959: checking for $cf_ncuhdr_root header in include-path" >&5
 echo $ECHO_N "checking for $cf_ncuhdr_root header in include-path... $ECHO_C" >&6
 if test "${cf_cv_ncurses_h+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -6096,7 +5968,7 @@
 	do
 
 	cat >conftest.$ac_ext <<_ACEOF
-#line 6099 "configure"
+#line 5971 "configure"
 #include "confdefs.h"
 
 #include <$cf_header>
@@ -6120,16 +5992,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:6123: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:5995: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:6126: \$? = $ac_status" >&5
+  echo "$as_me:5998: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:6129: \"$ac_try\"") >&5
+  { (eval echo "$as_me:6001: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:6132: \$? = $ac_status" >&5
+  echo "$as_me:6004: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   cf_cv_ncurses_h=$cf_header
 
@@ -6144,14 +6016,14 @@
 	done
 
 fi
-echo "$as_me:6147: result: $cf_cv_ncurses_h" >&5
+echo "$as_me:6019: result: $cf_cv_ncurses_h" >&5
 echo "${ECHO_T}$cf_cv_ncurses_h" >&6
 
 if test "$cf_cv_ncurses_h" != no ; then
 	cf_cv_ncurses_header=$cf_cv_ncurses_h
 else
 
-echo "$as_me:6154: checking for $cf_ncuhdr_root include-path" >&5
+echo "$as_me:6026: checking for $cf_ncuhdr_root include-path" >&5
 echo $ECHO_N "checking for $cf_ncuhdr_root include-path... $ECHO_C" >&6
 if test "${cf_cv_ncurses_h2+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -6291,7 +6163,7 @@
 			  cf_save_CPPFLAGS=$CPPFLAGS
 			  CPPFLAGS="$CPPFLAGS -I$cf_add_incdir"
 			  cat >conftest.$ac_ext <<_ACEOF
-#line 6294 "configure"
+#line 6166 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 int
@@ -6303,16 +6175,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:6306: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:6178: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:6309: \$? = $ac_status" >&5
+  echo "$as_me:6181: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:6312: \"$ac_try\"") >&5
+  { (eval echo "$as_me:6184: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:6315: \$? = $ac_status" >&5
+  echo "$as_me:6187: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   :
 else
@@ -6329,7 +6201,7 @@
 		if test "$cf_have_incdir" = no ; then
 		  test -n "$verbose" && echo "	adding $cf_add_incdir to include-path" 1>&6
 
-echo "${as_me:-configure}:6332: testing adding $cf_add_incdir to include-path ..." 1>&5
+echo "${as_me:-configure}:6204: testing adding $cf_add_incdir to include-path ..." 1>&5
 
 		  CPPFLAGS="$CPPFLAGS -I$cf_add_incdir"
 
@@ -6350,7 +6222,7 @@
 		do
 
 	cat >conftest.$ac_ext <<_ACEOF
-#line 6353 "configure"
+#line 6225 "configure"
 #include "confdefs.h"
 
 #include <$cf_header>
@@ -6374,16 +6246,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:6377: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:6249: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:6380: \$? = $ac_status" >&5
+  echo "$as_me:6252: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:6383: \"$ac_try\"") >&5
+  { (eval echo "$as_me:6255: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:6386: \$? = $ac_status" >&5
+  echo "$as_me:6258: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   cf_cv_ncurses_h2=$cf_header
 
@@ -6404,12 +6276,12 @@
 		CPPFLAGS="$cf_save2_CPPFLAGS"
 		test "$cf_cv_ncurses_h2" != no && break
 	done
-	test "$cf_cv_ncurses_h2" = no && { { echo "$as_me:6407: error: not found" >&5
+	test "$cf_cv_ncurses_h2" = no && { { echo "$as_me:6279: error: not found" >&5
 echo "$as_me: error: not found" >&2;}
    { (exit 1); exit 1; }; }
 
 fi
-echo "$as_me:6412: result: $cf_cv_ncurses_h2" >&5
+echo "$as_me:6284: result: $cf_cv_ncurses_h2" >&5
 echo "${ECHO_T}$cf_cv_ncurses_h2" >&6
 
 	cf_1st_incdir=`echo $cf_cv_ncurses_h2 | sed -e 's%/[^/]*$%%'`
@@ -6442,7 +6314,7 @@
 			  cf_save_CPPFLAGS=$CPPFLAGS
 			  CPPFLAGS="$CPPFLAGS -I$cf_add_incdir"
 			  cat >conftest.$ac_ext <<_ACEOF
-#line 6445 "configure"
+#line 6317 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 int
@@ -6454,16 +6326,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:6457: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:6329: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:6460: \$? = $ac_status" >&5
+  echo "$as_me:6332: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:6463: \"$ac_try\"") >&5
+  { (eval echo "$as_me:6335: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:6466: \$? = $ac_status" >&5
+  echo "$as_me:6338: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   :
 else
@@ -6480,7 +6352,7 @@
 		if test "$cf_have_incdir" = no ; then
 		  test -n "$verbose" && echo "	adding $cf_add_incdir to include-path" 1>&6
 
-echo "${as_me:-configure}:6483: testing adding $cf_add_incdir to include-path ..." 1>&5
+echo "${as_me:-configure}:6355: testing adding $cf_add_incdir to include-path ..." 1>&5
 
 		  CPPFLAGS="$CPPFLAGS -I$cf_add_incdir"
 
@@ -6501,7 +6373,8 @@
 
 case $cf_cv_ncurses_header in # (vi
 *ncurses.h)
-	cat >>confdefs.h <<\EOF
+
+cat >>confdefs.h <<\EOF
 #define HAVE_NCURSES_H 1
 EOF
 
@@ -6510,20 +6383,22 @@
 
 case $cf_cv_ncurses_header in # (vi
 ncurses/curses.h|ncurses/ncurses.h)
-	cat >>confdefs.h <<\EOF
+
+cat >>confdefs.h <<\EOF
 #define HAVE_NCURSES_NCURSES_H 1
 EOF
 
 	;;
 ncursesw/curses.h|ncursesw/ncurses.h)
-	cat >>confdefs.h <<\EOF
+
+cat >>confdefs.h <<\EOF
 #define HAVE_NCURSESW_NCURSES_H 1
 EOF
 
 	;;
 esac
 
-echo "$as_me:6526: checking for terminfo header" >&5
+echo "$as_me:6401: checking for terminfo header" >&5
 echo $ECHO_N "checking for terminfo header... $ECHO_C" >&6
 if test "${cf_cv_term_header+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -6541,7 +6416,7 @@
 for cf_test in $cf_term_header "ncurses/term.h" "ncursesw/term.h"
 do
 cat >conftest.$ac_ext <<_ACEOF
-#line 6544 "configure"
+#line 6419 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 #include <${cf_cv_ncurses_header:-curses.h}>
@@ -6556,16 +6431,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:6559: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:6434: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:6562: \$? = $ac_status" >&5
+  echo "$as_me:6437: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:6565: \"$ac_try\"") >&5
+  { (eval echo "$as_me:6440: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:6568: \$? = $ac_status" >&5
+  echo "$as_me:6443: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
 
 	cf_cv_term_header="$cf_test"
@@ -6581,14 +6456,15 @@
 done
 
 fi
-echo "$as_me:6584: result: $cf_cv_term_header" >&5
+echo "$as_me:6459: result: $cf_cv_term_header" >&5
 echo "${ECHO_T}$cf_cv_term_header" >&6
 
 # Set definitions to allow ifdef'ing to accommodate subdirectories
 
 case $cf_cv_term_header in # (vi
 *term.h)
-	cat >>confdefs.h <<\EOF
+
+cat >>confdefs.h <<\EOF
 #define HAVE_TERM_H 1
 EOF
 
@@ -6597,13 +6473,15 @@
 
 case $cf_cv_term_header in # (vi
 ncurses/term.h) #(vi
-	cat >>confdefs.h <<\EOF
+
+cat >>confdefs.h <<\EOF
 #define HAVE_NCURSES_TERM_H 1
 EOF
 
 	;;
 ncursesw/term.h)
-	cat >>confdefs.h <<\EOF
+
+cat >>confdefs.h <<\EOF
 #define HAVE_NCURSESW_TERM_H 1
 EOF
 
@@ -6611,11 +6489,12 @@
 esac
 
 # some applications need this, but should check for NCURSES_VERSION
+
 cat >>confdefs.h <<\EOF
 #define NCURSES 1
 EOF
 
-echo "$as_me:6618: checking for ncurses version" >&5
+echo "$as_me:6497: checking for ncurses version" >&5
 echo $ECHO_N "checking for ncurses version... $ECHO_C" >&6
 if test "${cf_cv_ncurses_version+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -6641,10 +6520,10 @@
 #endif
 EOF
 	cf_try="$ac_cpp conftest.$ac_ext 2>&5 | grep '^Autoconf ' >conftest.out"
-	{ (eval echo "$as_me:6644: \"$cf_try\"") >&5
+	{ (eval echo "$as_me:6523: \"$cf_try\"") >&5
   (eval $cf_try) 2>&5
   ac_status=$?
-  echo "$as_me:6647: \$? = $ac_status" >&5
+  echo "$as_me:6526: \$? = $ac_status" >&5
   (exit $ac_status); }
 	if test -f conftest.out ; then
 		cf_out=`cat conftest.out | sed -e 's%^Autoconf %%' -e 's%^[^"]*"%%' -e 's%".*%%'`
@@ -6654,7 +6533,7 @@
 
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 6657 "configure"
+#line 6536 "configure"
 #include "confdefs.h"
 
 #include <${cf_cv_ncurses_header:-curses.h}>
@@ -6679,15 +6558,15 @@
 }
 _ACEOF
 rm -f conftest$ac_exeext
-if { (eval echo "$as_me:6682: \"$ac_link\"") >&5
+if { (eval echo "$as_me:6561: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:6685: \$? = $ac_status" >&5
+  echo "$as_me:6564: \$? = $ac_status" >&5
   (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (eval echo "$as_me:6687: \"$ac_try\"") >&5
+  { (eval echo "$as_me:6566: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:6690: \$? = $ac_status" >&5
+  echo "$as_me:6569: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
 
 	cf_cv_ncurses_version=`cat $cf_tempfile`
@@ -6701,9 +6580,10 @@
 	rm -f $cf_tempfile
 
 fi
-echo "$as_me:6704: result: $cf_cv_ncurses_version" >&5
+echo "$as_me:6583: result: $cf_cv_ncurses_version" >&5
 echo "${ECHO_T}$cf_cv_ncurses_version" >&6
-test "$cf_cv_ncurses_version" = no || cat >>confdefs.h <<\EOF
+test "$cf_cv_ncurses_version" = no ||
+cat >>confdefs.h <<\EOF
 #define NCURSES 1
 EOF
 
@@ -6713,7 +6593,7 @@
 	# to link gpm.
 cf_ncurses_LIBS=""
 cf_ncurses_SAVE="$LIBS"
-echo "$as_me:6716: checking for Gpm_Open in -lgpm" >&5
+echo "$as_me:6596: checking for Gpm_Open in -lgpm" >&5
 echo $ECHO_N "checking for Gpm_Open in -lgpm... $ECHO_C" >&6
 if test "${ac_cv_lib_gpm_Gpm_Open+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -6721,7 +6601,7 @@
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lgpm  $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
-#line 6724 "configure"
+#line 6604 "configure"
 #include "confdefs.h"
 
 /* Override any gcc2 internal prototype to avoid an error.  */
@@ -6740,16 +6620,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:6743: \"$ac_link\"") >&5
+if { (eval echo "$as_me:6623: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:6746: \$? = $ac_status" >&5
+  echo "$as_me:6626: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:6749: \"$ac_try\"") >&5
+  { (eval echo "$as_me:6629: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:6752: \$? = $ac_status" >&5
+  echo "$as_me:6632: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_lib_gpm_Gpm_Open=yes
 else
@@ -6760,10 +6640,10 @@
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-echo "$as_me:6763: result: $ac_cv_lib_gpm_Gpm_Open" >&5
+echo "$as_me:6643: result: $ac_cv_lib_gpm_Gpm_Open" >&5
 echo "${ECHO_T}$ac_cv_lib_gpm_Gpm_Open" >&6
 if test $ac_cv_lib_gpm_Gpm_Open = yes; then
-  echo "$as_me:6766: checking for initscr in -lgpm" >&5
+  echo "$as_me:6646: checking for initscr in -lgpm" >&5
 echo $ECHO_N "checking for initscr in -lgpm... $ECHO_C" >&6
 if test "${ac_cv_lib_gpm_initscr+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -6771,7 +6651,7 @@
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lgpm  $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
-#line 6774 "configure"
+#line 6654 "configure"
 #include "confdefs.h"
 
 /* Override any gcc2 internal prototype to avoid an error.  */
@@ -6790,16 +6670,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:6793: \"$ac_link\"") >&5
+if { (eval echo "$as_me:6673: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:6796: \$? = $ac_status" >&5
+  echo "$as_me:6676: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:6799: \"$ac_try\"") >&5
+  { (eval echo "$as_me:6679: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:6802: \$? = $ac_status" >&5
+  echo "$as_me:6682: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_lib_gpm_initscr=yes
 else
@@ -6810,7 +6690,7 @@
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-echo "$as_me:6813: result: $ac_cv_lib_gpm_initscr" >&5
+echo "$as_me:6693: result: $ac_cv_lib_gpm_initscr" >&5
 echo "${ECHO_T}$ac_cv_lib_gpm_initscr" >&6
 if test $ac_cv_lib_gpm_initscr = yes; then
   LIBS="$cf_ncurses_SAVE"
@@ -6825,7 +6705,7 @@
 	# This is only necessary if you are linking against an obsolete
 	# version of ncurses (but it should do no harm, since it's static).
 	if test "$cf_nculib_root" = ncurses ; then
-		echo "$as_me:6828: checking for tgoto in -lmytinfo" >&5
+		echo "$as_me:6708: checking for tgoto in -lmytinfo" >&5
 echo $ECHO_N "checking for tgoto in -lmytinfo... $ECHO_C" >&6
 if test "${ac_cv_lib_mytinfo_tgoto+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -6833,7 +6713,7 @@
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lmytinfo  $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
-#line 6836 "configure"
+#line 6716 "configure"
 #include "confdefs.h"
 
 /* Override any gcc2 internal prototype to avoid an error.  */
@@ -6852,16 +6732,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:6855: \"$ac_link\"") >&5
+if { (eval echo "$as_me:6735: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:6858: \$? = $ac_status" >&5
+  echo "$as_me:6738: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:6861: \"$ac_try\"") >&5
+  { (eval echo "$as_me:6741: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:6864: \$? = $ac_status" >&5
+  echo "$as_me:6744: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_lib_mytinfo_tgoto=yes
 else
@@ -6872,7 +6752,7 @@
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-echo "$as_me:6875: result: $ac_cv_lib_mytinfo_tgoto" >&5
+echo "$as_me:6755: result: $ac_cv_lib_mytinfo_tgoto" >&5
 echo "${ECHO_T}$ac_cv_lib_mytinfo_tgoto" >&6
 if test $ac_cv_lib_mytinfo_tgoto = yes; then
   cf_ncurses_LIBS="-lmytinfo $cf_ncurses_LIBS"
@@ -6891,13 +6771,13 @@
 
 	eval 'cf_cv_have_lib_'$cf_nculib_root'=no'
 	cf_libdir=""
-	echo "$as_me:6894: checking for initscr" >&5
+	echo "$as_me:6774: checking for initscr" >&5
 echo $ECHO_N "checking for initscr... $ECHO_C" >&6
 if test "${ac_cv_func_initscr+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 6900 "configure"
+#line 6780 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char initscr (); below.  */
@@ -6920,7 +6800,7 @@
 #if defined (__stub_initscr) || defined (__stub___initscr)
 choke me
 #else
-f = initscr;
+f = initscr; /* workaround for ICC 12.0.3 */ if (f == 0) return 1;
 #endif
 
   ;
@@ -6928,16 +6808,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:6931: \"$ac_link\"") >&5
+if { (eval echo "$as_me:6811: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:6934: \$? = $ac_status" >&5
+  echo "$as_me:6814: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:6937: \"$ac_try\"") >&5
+  { (eval echo "$as_me:6817: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:6940: \$? = $ac_status" >&5
+  echo "$as_me:6820: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_func_initscr=yes
 else
@@ -6947,18 +6827,18 @@
 fi
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 fi
-echo "$as_me:6950: result: $ac_cv_func_initscr" >&5
+echo "$as_me:6830: result: $ac_cv_func_initscr" >&5
 echo "${ECHO_T}$ac_cv_func_initscr" >&6
 if test $ac_cv_func_initscr = yes; then
   eval 'cf_cv_have_lib_'$cf_nculib_root'=yes'
 else
 
 		cf_save_LIBS="$LIBS"
-		echo "$as_me:6957: checking for initscr in -l$cf_nculib_root" >&5
+		echo "$as_me:6837: checking for initscr in -l$cf_nculib_root" >&5
 echo $ECHO_N "checking for initscr in -l$cf_nculib_root... $ECHO_C" >&6
 		LIBS="-l$cf_nculib_root $LIBS"
 		cat >conftest.$ac_ext <<_ACEOF
-#line 6961 "configure"
+#line 6841 "configure"
 #include "confdefs.h"
 #include <${cf_cv_ncurses_header:-curses.h}>
 int
@@ -6970,25 +6850,25 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:6973: \"$ac_link\"") >&5
+if { (eval echo "$as_me:6853: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:6976: \$? = $ac_status" >&5
+  echo "$as_me:6856: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:6979: \"$ac_try\"") >&5
+  { (eval echo "$as_me:6859: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:6982: \$? = $ac_status" >&5
+  echo "$as_me:6862: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  echo "$as_me:6984: result: yes" >&5
+  echo "$as_me:6864: result: yes" >&5
 echo "${ECHO_T}yes" >&6
 			 eval 'cf_cv_have_lib_'$cf_nculib_root'=yes'
 
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-echo "$as_me:6991: result: no" >&5
+echo "$as_me:6871: result: no" >&5
 echo "${ECHO_T}no" >&6
 
 cf_search=
@@ -7078,11 +6958,11 @@
 
 			for cf_libdir in $cf_search
 			do
-				echo "$as_me:7081: checking for -l$cf_nculib_root in $cf_libdir" >&5
+				echo "$as_me:6961: checking for -l$cf_nculib_root in $cf_libdir" >&5
 echo $ECHO_N "checking for -l$cf_nculib_root in $cf_libdir... $ECHO_C" >&6
 				LIBS="-L$cf_libdir -l$cf_nculib_root $cf_save_LIBS"
 				cat >conftest.$ac_ext <<_ACEOF
-#line 7085 "configure"
+#line 6965 "configure"
 #include "confdefs.h"
 #include <${cf_cv_ncurses_header:-curses.h}>
 int
@@ -7094,25 +6974,25 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:7097: \"$ac_link\"") >&5
+if { (eval echo "$as_me:6977: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:7100: \$? = $ac_status" >&5
+  echo "$as_me:6980: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:7103: \"$ac_try\"") >&5
+  { (eval echo "$as_me:6983: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:7106: \$? = $ac_status" >&5
+  echo "$as_me:6986: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  echo "$as_me:7108: result: yes" >&5
+  echo "$as_me:6988: result: yes" >&5
 echo "${ECHO_T}yes" >&6
 			 		 eval 'cf_cv_have_lib_'$cf_nculib_root'=yes'
 					 break
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-echo "$as_me:7115: result: no" >&5
+echo "$as_me:6995: result: no" >&5
 echo "${ECHO_T}no" >&6
 					 LIBS="$cf_save_LIBS"
 fi
@@ -7127,7 +7007,7 @@
 eval 'cf_found_library=$cf_cv_have_lib_'$cf_nculib_root
 
 if test $cf_found_library = no ; then
-	{ { echo "$as_me:7130: error: Cannot link $cf_nculib_root library" >&5
+	{ { echo "$as_me:7010: error: Cannot link $cf_nculib_root library" >&5
 echo "$as_me: error: Cannot link $cf_nculib_root library" >&2;}
    { (exit 1); exit 1; }; }
 fi
@@ -7135,7 +7015,7 @@
 fi
 
 if test -n "$cf_ncurses_LIBS" ; then
-	echo "$as_me:7138: checking if we can link $cf_nculib_root without $cf_ncurses_LIBS" >&5
+	echo "$as_me:7018: checking if we can link $cf_nculib_root without $cf_ncurses_LIBS" >&5
 echo $ECHO_N "checking if we can link $cf_nculib_root without $cf_ncurses_LIBS... $ECHO_C" >&6
 	cf_ncurses_SAVE="$LIBS"
 	for p in $cf_ncurses_LIBS ; do
@@ -7145,7 +7025,7 @@
 		fi
 	done
 	cat >conftest.$ac_ext <<_ACEOF
-#line 7148 "configure"
+#line 7028 "configure"
 #include "confdefs.h"
 #include <${cf_cv_ncurses_header:-curses.h}>
 int
@@ -7157,23 +7037,23 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:7160: \"$ac_link\"") >&5
+if { (eval echo "$as_me:7040: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:7163: \$? = $ac_status" >&5
+  echo "$as_me:7043: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:7166: \"$ac_try\"") >&5
+  { (eval echo "$as_me:7046: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:7169: \$? = $ac_status" >&5
+  echo "$as_me:7049: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  echo "$as_me:7171: result: yes" >&5
+  echo "$as_me:7051: result: yes" >&5
 echo "${ECHO_T}yes" >&6
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-echo "$as_me:7176: result: no" >&5
+echo "$as_me:7056: result: no" >&5
 echo "${ECHO_T}no" >&6
 		 LIBS="$cf_ncurses_SAVE"
 fi
@@ -7210,10 +7090,10 @@
 AUTOCONF_$cf_name NCURSES_VERSION_$cf_name
 CF_EOF
 	cf_try="$ac_cpp conftest.$ac_ext 2>&5 | fgrep AUTOCONF_$cf_name >conftest.out"
-	{ (eval echo "$as_me:7213: \"$cf_try\"") >&5
+	{ (eval echo "$as_me:7093: \"$cf_try\"") >&5
   (eval $cf_try) 2>&5
   ac_status=$?
-  echo "$as_me:7216: \$? = $ac_status" >&5
+  echo "$as_me:7096: \$? = $ac_status" >&5
   (exit $ac_status); }
 	if test -f conftest.out ; then
 		cf_result=`cat conftest.out | sed -e "s/^.*AUTOCONF_$cf_name[ 	][ 	]*//"`
@@ -7231,9 +7111,25 @@
 
 cf_cv_timestamp=`date`
 
-echo "$as_me:7234: result: Configuring NCURSES $cf_cv_rel_version ABI $cf_cv_abi_version ($cf_cv_timestamp)" >&5
+echo "$as_me:7114: result: Configuring NCURSES $cf_cv_rel_version ABI $cf_cv_abi_version ($cf_cv_timestamp)" >&5
 echo "${ECHO_T}Configuring NCURSES $cf_cv_rel_version ABI $cf_cv_abi_version ($cf_cv_timestamp)" >&6
 
+echo "$as_me:7117: checking if you want to have a library-prefix" >&5
+echo $ECHO_N "checking if you want to have a library-prefix... $ECHO_C" >&6
+
+# Check whether --with-lib-prefix or --without-lib-prefix was given.
+if test "${with_lib_prefix+set}" = set; then
+  withval="$with_lib_prefix"
+  with_lib_prefix=$withval
+else
+  with_lib_prefix=auto
+fi;
+echo "$as_me:7127: result: $with_lib_prefix" >&5
+echo "${ECHO_T}$with_lib_prefix" >&6
+
+if test $with_lib_prefix = auto
+then
+
 	case $cf_cv_system_name in #(vi
 	OS/2*|os2*) #(vi
         LIB_PREFIX=''
@@ -7243,7 +7139,12 @@
 	esac
 cf_prefix=$LIB_PREFIX
 
-LIB_PREFIX=$cf_prefix
+elif test $with_lib_prefix = no
+then
+	LIB_PREFIX=
+else
+	LIB_PREFIX=$with_lib_prefix
+fi
 
 LIB_SUFFIX=
 
@@ -7254,7 +7155,7 @@
 	test -n "$GCC" && test "${ac_cv_prog_cc_g}" != yes && CC_G_OPT=''
 fi
 
-echo "$as_me:7257: checking for default loader flags" >&5
+echo "$as_me:7158: checking for default loader flags" >&5
 echo $ECHO_N "checking for default loader flags... $ECHO_C" >&6
 case $DFT_LWR_MODEL in
 normal)  LD_MODEL=''   ;;
@@ -7262,11 +7163,11 @@
 profile) LD_MODEL='-pg';;
 shared)  LD_MODEL=''   ;;
 esac
-echo "$as_me:7265: result: $LD_MODEL" >&5
+echo "$as_me:7166: result: $LD_MODEL" >&5
 echo "${ECHO_T}$LD_MODEL" >&6
 
 LD_RPATH_OPT=
-echo "$as_me:7269: checking for an rpath option" >&5
+echo "$as_me:7170: checking for an rpath option" >&5
 echo $ECHO_N "checking for an rpath option... $ECHO_C" >&6
 case $cf_cv_system_name in #(vi
 irix*) #(vi
@@ -7279,10 +7180,10 @@
 linux*|gnu*|k*bsd*-gnu) #(vi
 	LD_RPATH_OPT="-Wl,-rpath,"
 	;;
-openbsd[2-9].*) #(vi
+openbsd[2-9].*|mirbsd*) #(vi
 	LD_RPATH_OPT="-Wl,-rpath,"
 	;;
-freebsd*) #(vi
+dragonfly*|freebsd*) #(vi
 	LD_RPATH_OPT="-rpath "
 	;;
 netbsd*) #(vi
@@ -7297,17 +7198,17 @@
 *)
 	;;
 esac
-echo "$as_me:7300: result: $LD_RPATH_OPT" >&5
+echo "$as_me:7201: result: $LD_RPATH_OPT" >&5
 echo "${ECHO_T}$LD_RPATH_OPT" >&6
 
 case "x$LD_RPATH_OPT" in #(vi
 x-R*)
-	echo "$as_me:7305: checking if we need a space after rpath option" >&5
+	echo "$as_me:7206: checking if we need a space after rpath option" >&5
 echo $ECHO_N "checking if we need a space after rpath option... $ECHO_C" >&6
 	cf_save_LIBS="$LIBS"
 	LIBS="${LD_RPATH_OPT}$libdir $LIBS"
 	cat >conftest.$ac_ext <<_ACEOF
-#line 7310 "configure"
+#line 7211 "configure"
 #include "confdefs.h"
 
 int
@@ -7319,16 +7220,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:7322: \"$ac_link\"") >&5
+if { (eval echo "$as_me:7223: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:7325: \$? = $ac_status" >&5
+  echo "$as_me:7226: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:7328: \"$ac_try\"") >&5
+  { (eval echo "$as_me:7229: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:7331: \$? = $ac_status" >&5
+  echo "$as_me:7232: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   cf_rpath_space=no
 else
@@ -7338,7 +7239,7 @@
 fi
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 	LIBS="$cf_save_LIBS"
-	echo "$as_me:7341: result: $cf_rpath_space" >&5
+	echo "$as_me:7242: result: $cf_rpath_space" >&5
 echo "${ECHO_T}$cf_rpath_space" >&6
 	test "$cf_rpath_space" = yes && LD_RPATH_OPT="$LD_RPATH_OPT "
 	;;
@@ -7353,7 +7254,7 @@
 	cf_ld_rpath_opt=
 	test "$cf_cv_enable_rpath" = yes && cf_ld_rpath_opt="$LD_RPATH_OPT"
 
-	echo "$as_me:7356: checking if release/abi version should be used for shared libs" >&5
+	echo "$as_me:7257: checking if release/abi version should be used for shared libs" >&5
 echo $ECHO_N "checking if release/abi version should be used for shared libs... $ECHO_C" >&6
 
 # Check whether --with-shlib-version or --without-shlib-version was given.
@@ -7368,7 +7269,7 @@
 		cf_cv_shlib_version=$withval
 		;;
 	*)
-		{ { echo "$as_me:7371: error: option value must be one of: rel, abi, auto or no" >&5
+		{ { echo "$as_me:7272: error: option value must be one of: rel, abi, auto or no" >&5
 echo "$as_me: error: option value must be one of: rel, abi, auto or no" >&2;}
    { (exit 1); exit 1; }; }
 		;;
@@ -7377,23 +7278,24 @@
 else
   cf_cv_shlib_version=auto
 fi;
-	echo "$as_me:7380: result: $cf_cv_shlib_version" >&5
+	echo "$as_me:7281: result: $cf_cv_shlib_version" >&5
 echo "${ECHO_T}$cf_cv_shlib_version" >&6
 
 	cf_cv_rm_so_locs=no
+	cf_try_cflags=
 
 	# Some less-capable ports of gcc support only -fpic
 	CC_SHARED_OPTS=
 	if test "$GCC" = yes
 	then
-		echo "$as_me:7389: checking which $CC option to use" >&5
+		echo "$as_me:7291: checking which $CC option to use" >&5
 echo $ECHO_N "checking which $CC option to use... $ECHO_C" >&6
 		cf_save_CFLAGS="$CFLAGS"
 		for CC_SHARED_OPTS in -fPIC -fpic ''
 		do
 			CFLAGS="$cf_save_CFLAGS $CC_SHARED_OPTS"
 			cat >conftest.$ac_ext <<_ACEOF
-#line 7396 "configure"
+#line 7298 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 int
@@ -7405,16 +7307,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:7408: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:7310: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:7411: \$? = $ac_status" >&5
+  echo "$as_me:7313: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:7414: \"$ac_try\"") >&5
+  { (eval echo "$as_me:7316: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:7417: \$? = $ac_status" >&5
+  echo "$as_me:7319: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   break
 else
@@ -7423,7 +7325,7 @@
 fi
 rm -f conftest.$ac_objext conftest.$ac_ext
 		done
-		echo "$as_me:7426: result: $CC_SHARED_OPTS" >&5
+		echo "$as_me:7328: result: $CC_SHARED_OPTS" >&5
 echo "${ECHO_T}$CC_SHARED_OPTS" >&6
 		CFLAGS="$cf_save_CFLAGS"
 	fi
@@ -7431,10 +7333,14 @@
 	cf_cv_shlib_version_infix=no
 
 	case $cf_cv_system_name in #(vi
-	aix[56]*) #(vi
+	aix4.3-9*|aix[5-7]*) #(vi
 		if test "$GCC" = yes; then
 			CC_SHARED_OPTS=
-			MK_SHARED_LIB='$(CC) -shared'
+			MK_SHARED_LIB='${CC} -shared -Wl,-brtl -Wl,-blibpath:${RPATH_LIST}:/usr/lib -o $@'
+		else
+			# CC_SHARED_OPTS='-qpic=large -G'
+			# perhaps "-bM:SRE -bnoentry -bexpall"
+			MK_SHARED_LIB='${CC} -G -Wl,-brtl -Wl,-blibpath:${RPATH_LIST}:/usr/lib -o $@'
 		fi
 		;;
 	beos*) #(vi
@@ -7460,12 +7366,12 @@
 		chmod +x mk_shared_lib.sh
 		;;
 	darwin*) #(vi
-		EXTRA_CFLAGS="-no-cpp-precomp"
+		cf_try_cflags="no-cpp-precomp"
 		CC_SHARED_OPTS="-dynamic"
 		MK_SHARED_LIB='${CC} ${CFLAGS} -dynamiclib -install_name ${libdir}/`basename $@` -compatibility_version ${ABI_VERSION} -current_version ${ABI_VERSION} -o $@'
 		test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=abi
 		cf_cv_shlib_version_infix=yes
-		echo "$as_me:7468: checking if ld -search_paths_first works" >&5
+		echo "$as_me:7374: checking if ld -search_paths_first works" >&5
 echo $ECHO_N "checking if ld -search_paths_first works... $ECHO_C" >&6
 if test "${cf_cv_ldflags_search_paths_first+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -7474,7 +7380,7 @@
 			cf_save_LDFLAGS=$LDFLAGS
 			LDFLAGS="$LDFLAGS -Wl,-search_paths_first"
 			cat >conftest.$ac_ext <<_ACEOF
-#line 7477 "configure"
+#line 7383 "configure"
 #include "confdefs.h"
 
 int
@@ -7486,16 +7392,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:7489: \"$ac_link\"") >&5
+if { (eval echo "$as_me:7395: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:7492: \$? = $ac_status" >&5
+  echo "$as_me:7398: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:7495: \"$ac_try\"") >&5
+  { (eval echo "$as_me:7401: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:7498: \$? = $ac_status" >&5
+  echo "$as_me:7404: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   cf_cv_ldflags_search_paths_first=yes
 else
@@ -7506,12 +7412,20 @@
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 				LDFLAGS=$cf_save_LDFLAGS
 fi
-echo "$as_me:7509: result: $cf_cv_ldflags_search_paths_first" >&5
+echo "$as_me:7415: result: $cf_cv_ldflags_search_paths_first" >&5
 echo "${ECHO_T}$cf_cv_ldflags_search_paths_first" >&6
 		if test $cf_cv_ldflags_search_paths_first = yes; then
 			LDFLAGS="$LDFLAGS -Wl,-search_paths_first"
 		fi
 		;;
+	hpux[7-8]*) #(vi
+		# HP-UX 8.07 ld lacks "+b" option used for libdir search-list
+		if test "$GCC" != yes; then
+			CC_SHARED_OPTS='+Z'
+		fi
+		MK_SHARED_LIB='${LD} -b -o $@'
+		INSTALL_LIB="-m 555"
+		;;
 	hpux*) #(vi
 		# (tested with gcc 2.7.2 -- I don't have c89)
 		if test "$GCC" = yes; then
@@ -7525,9 +7439,19 @@
 		# readonly to exploit a quirk in the memory manager.
 		INSTALL_LIB="-m 555"
 		;;
+	interix*)
+		test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel
+		if test "$cf_cv_shlib_version" = rel; then
+			cf_shared_soname='`basename  .${REL_VERSION}`.${ABI_VERSION}'
+		else
+			cf_shared_soname='`basename `'
+		fi
+		CC_SHARED_OPTS=
+		MK_SHARED_LIB='${CC} -shared -Wl,-rpath,${RPATH_LIST} -Wl,-h,'$cf_shared_soname' -o '
+		;;
 	irix*) #(vi
 		if test "$cf_cv_enable_rpath" = yes ; then
-			EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${libdir} $EXTRA_LDFLAGS"
+			EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${RPATH_LIST} $EXTRA_LDFLAGS"
 		fi
 		# tested with IRIX 5.2 and 'cc'.
 		if test "$GCC" != yes; then
@@ -7544,7 +7468,7 @@
 			LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
 		fi
 		if test "$cf_cv_enable_rpath" = yes ; then
-			EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${libdir} $EXTRA_LDFLAGS"
+			EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${RPATH_LIST} $EXTRA_LDFLAGS"
 		fi
 
 	test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel
@@ -7556,13 +7480,34 @@
 
 		MK_SHARED_LIB='${CC} ${CFLAGS} -shared -Wl,-soname,'$cf_cv_shared_soname',-stats,-lc -o $@'
 		;;
-	openbsd[2-9].*) #(vi
+	mingw*) #(vi
+		cf_cv_shlib_version=mingw
+		cf_cv_shlib_version_infix=mingw
+		CC_SHARED_OPTS=
+		MK_SHARED_LIB='sh ../mk_shared_lib.sh $@ ${CC} ${CFLAGS}'
+		#MK_SHARED_LIB='${CC} ${CFLAGS} -mdll -Wl,-soname,'$cf_cv_shared_soname',-stats -o $[@]'
+		#MK_SHARED_LIB='${DLLTOOL} --export-all-symbols --output-exp --output-lib $[@]'
+		cat >mk_shared_lib.sh <<-CF_EOF
+		#!/bin/sh
+		SHARED_LIB=\$1
+		IMPORT_LIB=\`echo "\$1" | sed -e 's/[0-9]*\.dll$/.dll.a/'\`
+		shift
+		cat <<-EOF
+		Linking shared library
+		** SHARED_LIB \$SHARED_LIB
+		** IMPORT_LIB \$IMPORT_LIB
+EOF
+		exec \$* -shared -Wl,--out-implib=../lib/\${IMPORT_LIB} -Wl,--export-all-symbols -o ../lib/\${SHARED_LIB}
+CF_EOF
+		chmod +x mk_shared_lib.sh
+		;;
+	openbsd[2-9].*|mirbsd*) #(vi
 		if test "$DFT_LWR_MODEL" = "shared" ; then
 			LOCAL_LDFLAGS="${LD_RPATH_OPT}\$(LOCAL_LIBDIR)"
 			LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
 		fi
 		if test "$cf_cv_enable_rpath" = yes ; then
-			EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${libdir} $EXTRA_LDFLAGS"
+			EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${RPATH_LIST} $EXTRA_LDFLAGS"
 		fi
 		CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC"
 
@@ -7580,12 +7525,12 @@
 		MK_SHARED_LIB='${LD} -Bshareable -o $@'
 		test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel
 		;;
-	freebsd*) #(vi
+	dragonfly*|freebsd*) #(vi
 		CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC"
 		if test "$DFT_LWR_MODEL" = "shared" && test "$cf_cv_enable_rpath" = yes ; then
 			LOCAL_LDFLAGS="${cf_ld_rpath_opt}\$(LOCAL_LIBDIR)"
-			LOCAL_LDFLAGS2="${cf_ld_rpath_opt}\${libdir} $LOCAL_LDFLAGS"
-			EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${libdir} $EXTRA_LDFLAGS"
+			LOCAL_LDFLAGS2="${cf_ld_rpath_opt}\${RPATH_LIST} $LOCAL_LDFLAGS"
+			EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${RPATH_LIST} $EXTRA_LDFLAGS"
 		fi
 
 	test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel
@@ -7602,7 +7547,7 @@
 		if test "$DFT_LWR_MODEL" = "shared" && test "$cf_cv_enable_rpath" = yes ; then
 			LOCAL_LDFLAGS="${cf_ld_rpath_opt}\$(LOCAL_LIBDIR)"
 			LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
-			EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${libdir} $EXTRA_LDFLAGS"
+			EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${RPATH_LIST} $EXTRA_LDFLAGS"
 			if test "$cf_cv_shlib_version" = auto; then
 			if test -f /usr/libexec/ld.elf_so; then
 				cf_cv_shlib_version=abi
@@ -7686,7 +7631,7 @@
 			do
 				CFLAGS="$cf_shared_opts $cf_save_CFLAGS"
 				cat >conftest.$ac_ext <<_ACEOF
-#line 7689 "configure"
+#line 7634 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 int
@@ -7698,16 +7643,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:7701: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:7646: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:7704: \$? = $ac_status" >&5
+  echo "$as_me:7649: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:7707: \"$ac_try\"") >&5
+  { (eval echo "$as_me:7652: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:7710: \$? = $ac_status" >&5
+  echo "$as_me:7655: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   break
 else
@@ -7744,22 +7689,63 @@
 			test "$cf_cv_do_symlinks" = no && cf_cv_do_symlinks=yes
 			;;
 		*)
-			{ echo "$as_me:7747: WARNING: ignored --with-shlib-version" >&5
+			{ echo "$as_me:7692: WARNING: ignored --with-shlib-version" >&5
 echo "$as_me: WARNING: ignored --with-shlib-version" >&2;}
 			;;
 		esac
 		;;
 	esac
 
-	if test -n "$cf_ld_rpath_opt" ; then
-		MK_SHARED_LIB="$MK_SHARED_LIB $cf_ld_rpath_opt\${libdir}"
+	if test -n "$cf_try_cflags"
+	then
+cat > conftest.$ac_ext <<EOF
+#line 7702 "${as_me:-configure}"
+#include <stdio.h>
+int main(int argc, char *argv[])
+{
+	printf("hello\n");
+	return (argv[argc-1] == 0) ;
+}
+EOF
+		cf_save_CFLAGS="$CFLAGS"
+		for cf_opt in $cf_try_cflags
+		do
+			CFLAGS="$cf_save_CFLAGS -$cf_opt"
+			echo "$as_me:7714: checking if CFLAGS option -$cf_opt works" >&5
+echo $ECHO_N "checking if CFLAGS option -$cf_opt works... $ECHO_C" >&6
+			if { (eval echo "$as_me:7716: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:7719: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+				echo "$as_me:7721: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+				cf_save_CFLAGS="$CFLAGS"
+			else
+				echo "$as_me:7725: result: no" >&5
+echo "${ECHO_T}no" >&6
+			fi
+		done
+		CFLAGS="$cf_save_CFLAGS"
 	fi
 
+	# RPATH_LIST is a colon-separated list of directories
+	test -n "$cf_ld_rpath_opt" && MK_SHARED_LIB="$MK_SHARED_LIB $cf_ld_rpath_opt\${RPATH_LIST}"
+	test -z "$RPATH_LIST" && RPATH_LIST="\${libdir}"
+
+	test -n "$verbose" && echo "	CC_SHARED_OPTS: $CC_SHARED_OPTS" 1>&6
+
+echo "${as_me:-configure}:7738: testing CC_SHARED_OPTS: $CC_SHARED_OPTS ..." 1>&5
+
+	test -n "$verbose" && echo "	MK_SHARED_LIB:  $MK_SHARED_LIB" 1>&6
+
+echo "${as_me:-configure}:7742: testing MK_SHARED_LIB:  $MK_SHARED_LIB ..." 1>&5
+
 # The test/sample programs in the original tree link using rpath option.
 # Make it optional for packagers.
 if test -n "$LOCAL_LDFLAGS"
 then
-	echo "$as_me:7762: checking if you want to link sample programs with rpath option" >&5
+	echo "$as_me:7748: checking if you want to link sample programs with rpath option" >&5
 echo $ECHO_N "checking if you want to link sample programs with rpath option... $ECHO_C" >&6
 
 # Check whether --enable-rpath-link or --disable-rpath-link was given.
@@ -7769,7 +7755,7 @@
 else
   with_rpath_link=yes
 fi;
-	echo "$as_me:7772: result: $with_rpath_link" >&5
+	echo "$as_me:7758: result: $with_rpath_link" >&5
 echo "${ECHO_T}$with_rpath_link" >&6
 	if test "$with_rpath_link" = no
 	then
@@ -7780,13 +7766,8 @@
 
 ###############################################################################
 
-	case $cf_cv_system_name in
-	os2*)	PATH_SEPARATOR=';'  ;;
-	*)	PATH_SEPARATOR=':'  ;;
-	esac
-
 ###   use option --enable-broken-linker to force on use of broken-linker support
-echo "$as_me:7789: checking if you want broken-linker support code" >&5
+echo "$as_me:7770: checking if you want broken-linker support code" >&5
 echo $ECHO_N "checking if you want broken-linker support code... $ECHO_C" >&6
 
 # Check whether --enable-broken_linker or --disable-broken_linker was given.
@@ -7796,7 +7777,7 @@
 else
   with_broken_linker=${BROKEN_LINKER:-no}
 fi;
-echo "$as_me:7799: result: $with_broken_linker" >&5
+echo "$as_me:7780: result: $with_broken_linker" >&5
 echo "${ECHO_T}$with_broken_linker" >&6
 
 BROKEN_LINKER=0
@@ -7816,7 +7797,7 @@
 		BROKEN_LINKER=1
 		test -n "$verbose" && echo "	cygwin linker is broken anyway" 1>&6
 
-echo "${as_me:-configure}:7819: testing cygwin linker is broken anyway ..." 1>&5
+echo "${as_me:-configure}:7800: testing cygwin linker is broken anyway ..." 1>&5
 
 		;;
 	esac
@@ -7829,7 +7810,7 @@
 cf_xopen_source=
 
 case $host_os in #(vi
-aix[456]*) #(vi
+aix[4-7]*) #(vi
 	cf_xopen_source="-D_ALL_SOURCE"
 	;;
 cygwin) #(vi
@@ -7840,6 +7821,7 @@
 	;;
 darwin*) #(vi
 	cf_xopen_source="-D_DARWIN_C_SOURCE"
+	cf_XOPEN_SOURCE=
 	;;
 freebsd*|dragonfly*) #(vi
 	# 5.x headers associate
@@ -7857,17 +7839,18 @@
 	;;
 irix[56].*) #(vi
 	cf_xopen_source="-D_SGI_SOURCE"
+	cf_XOPEN_SOURCE=
 	;;
 linux*|gnu*|mint*|k*bsd*-gnu) #(vi
 
-echo "$as_me:7863: checking if we must define _GNU_SOURCE" >&5
+echo "$as_me:7846: checking if we must define _GNU_SOURCE" >&5
 echo $ECHO_N "checking if we must define _GNU_SOURCE... $ECHO_C" >&6
 if test "${cf_cv_gnu_source+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
 
 cat >conftest.$ac_ext <<_ACEOF
-#line 7870 "configure"
+#line 7853 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 int
@@ -7882,16 +7865,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:7885: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:7868: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:7888: \$? = $ac_status" >&5
+  echo "$as_me:7871: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:7891: \"$ac_try\"") >&5
+  { (eval echo "$as_me:7874: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:7894: \$? = $ac_status" >&5
+  echo "$as_me:7877: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   cf_cv_gnu_source=no
 else
@@ -7900,7 +7883,7 @@
 cf_save="$CPPFLAGS"
 	 CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
 	 cat >conftest.$ac_ext <<_ACEOF
-#line 7903 "configure"
+#line 7886 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 int
@@ -7915,16 +7898,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:7918: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:7901: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:7921: \$? = $ac_status" >&5
+  echo "$as_me:7904: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:7924: \"$ac_try\"") >&5
+  { (eval echo "$as_me:7907: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:7927: \$? = $ac_status" >&5
+  echo "$as_me:7910: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   cf_cv_gnu_source=no
 else
@@ -7939,51 +7922,45 @@
 rm -f conftest.$ac_objext conftest.$ac_ext
 
 fi
-echo "$as_me:7942: result: $cf_cv_gnu_source" >&5
+echo "$as_me:7925: result: $cf_cv_gnu_source" >&5
 echo "${ECHO_T}$cf_cv_gnu_source" >&6
 test "$cf_cv_gnu_source" = yes && CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
 
 	;;
 mirbsd*) #(vi
-	# setting _XOPEN_SOURCE or _POSIX_SOURCE breaks <arpa/inet.h>
-	;;
-netbsd*) #(vi
-	# setting _XOPEN_SOURCE breaks IPv6 for lynx on NetBSD 1.6, breaks xterm, is not needed for ncursesw
-	;;
-openbsd*) #(vi
-	# setting _XOPEN_SOURCE breaks xterm on OpenBSD 2.8, is not needed for ncursesw
-	;;
-osf[45]*) #(vi
-	cf_xopen_source="-D_OSF_SOURCE"
-	;;
-nto-qnx*) #(vi
-	cf_xopen_source="-D_QNX_SOURCE"
-	;;
-sco*) #(vi
-	# setting _XOPEN_SOURCE breaks Lynx on SCO Unix / OpenServer
-	;;
-solaris2.1[0-9]) #(vi
-	cf_xopen_source="-D__EXTENSIONS__ -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE"
-	;;
-solaris2.[1-9]) #(vi
-	cf_xopen_source="-D__EXTENSIONS__"
-	;;
-*)
-	echo "$as_me:7972: checking if we should define _XOPEN_SOURCE" >&5
-echo $ECHO_N "checking if we should define _XOPEN_SOURCE... $ECHO_C" >&6
-if test "${cf_cv_xopen_source+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
+	# setting _XOPEN_SOURCE or _POSIX_SOURCE breaks <sys/select.h> and other headers which use u_int / u_short types
+	cf_XOPEN_SOURCE=
 
-	cat >conftest.$ac_ext <<_ACEOF
-#line 7979 "configure"
-#include "confdefs.h"
-#include <sys/types.h>
-int
-main ()
+cf_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE
+
+cf_save_CFLAGS="$CFLAGS"
+cf_save_CPPFLAGS="$CPPFLAGS"
+
+cf_trim_CFLAGS=`echo "$cf_save_CFLAGS" | \
+	sed	-e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ 	]*\)\?[ 	]/ /g' \
+		-e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ 	]*\)\?$//g'`
+
+cf_trim_CPPFLAGS=`echo "$cf_save_CPPFLAGS" | \
+	sed	-e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ 	]*\)\?[ 	]/ /g' \
+		-e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ 	]*\)\?$//g'`
+
+echo "$as_me:7947: checking if we should define _POSIX_C_SOURCE" >&5
+echo $ECHO_N "checking if we should define _POSIX_C_SOURCE... $ECHO_C" >&6
+if test "${cf_cv_posix_c_source+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+echo "${as_me:-configure}:7953: testing if the symbol is already defined go no further ..." 1>&5
+
+	cat >conftest.$ac_ext <<_ACEOF
+#line 7956 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+int
+main ()
 {
 
-#ifndef _XOPEN_SOURCE
+#ifndef _POSIX_C_SOURCE
 make an error
 #endif
   ;
@@ -7991,32 +7968,44 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:7994: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:7971: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:7997: \$? = $ac_status" >&5
+  echo "$as_me:7974: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:8000: \"$ac_try\"") >&5
+  { (eval echo "$as_me:7977: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:8003: \$? = $ac_status" >&5
+  echo "$as_me:7980: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  cf_cv_xopen_source=no
+  cf_cv_posix_c_source=no
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-cf_save="$CPPFLAGS"
-	 CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE"
-	 cat >conftest.$ac_ext <<_ACEOF
-#line 8012 "configure"
+cf_want_posix_source=no
+	 case .$cf_POSIX_C_SOURCE in #(vi
+	 .[12]??*) #(vi
+		cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE"
+		;;
+	 .2) #(vi
+		cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE"
+		cf_want_posix_source=yes
+		;;
+	 .*)
+		cf_want_posix_source=yes
+		;;
+	 esac
+	 if test "$cf_want_posix_source" = yes ; then
+		cat >conftest.$ac_ext <<_ACEOF
+#line 8001 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 int
 main ()
 {
 
-#ifdef _XOPEN_SOURCE
+#ifdef _POSIX_SOURCE
 make an error
 #endif
   ;
@@ -8024,50 +8013,87 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:8027: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:8016: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:8030: \$? = $ac_status" >&5
+  echo "$as_me:8019: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:8033: \"$ac_try\"") >&5
+  { (eval echo "$as_me:8022: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:8036: \$? = $ac_status" >&5
+  echo "$as_me:8025: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  cf_cv_xopen_source=no
+  :
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-cf_cv_xopen_source=$cf_XOPEN_SOURCE
+cf_cv_posix_c_source="$cf_cv_posix_c_source -D_POSIX_SOURCE"
 fi
 rm -f conftest.$ac_objext conftest.$ac_ext
-	CPPFLAGS="$cf_save"
+	 fi
+
+echo "${as_me:-configure}:8036: testing ifdef from value $cf_POSIX_C_SOURCE ..." 1>&5
+
+	 CFLAGS="$cf_trim_CFLAGS"
+	 CPPFLAGS="$cf_trim_CPPFLAGS $cf_cv_posix_c_source"
+
+echo "${as_me:-configure}:8041: testing if the second compile does not leave our definition intact error ..." 1>&5
+
+	 cat >conftest.$ac_ext <<_ACEOF
+#line 8044 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+int
+main ()
+{
 
+#ifndef _POSIX_C_SOURCE
+make an error
+#endif
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:8059: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:8062: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:8065: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:8068: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  :
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+cf_cv_posix_c_source=no
 fi
 rm -f conftest.$ac_objext conftest.$ac_ext
+	 CFLAGS="$cf_save_CFLAGS"
+	 CPPFLAGS="$cf_save_CPPFLAGS"
 
 fi
-echo "$as_me:8051: result: $cf_cv_xopen_source" >&5
-echo "${ECHO_T}$cf_cv_xopen_source" >&6
-	if test "$cf_cv_xopen_source" != no ; then
-
-CFLAGS=`echo "$CFLAGS" | \
-	sed	-e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ 	]*\)\?[ 	]/ /g' \
-		-e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ 	]*\)\?$//g'`
+rm -f conftest.$ac_objext conftest.$ac_ext
 
-CPPFLAGS=`echo "$CPPFLAGS" | \
-	sed	-e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ 	]*\)\?[ 	]/ /g' \
-		-e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ 	]*\)\?$//g'`
+fi
+echo "$as_me:8084: result: $cf_cv_posix_c_source" >&5
+echo "${ECHO_T}$cf_cv_posix_c_source" >&6
 
-		cf_temp_xopen_source="-D_XOPEN_SOURCE=$cf_cv_xopen_source"
+if test "$cf_cv_posix_c_source" != no ; then
+	CFLAGS="$cf_trim_CFLAGS"
+	CPPFLAGS="$cf_trim_CPPFLAGS"
 
 cf_fix_cppflags=no
 cf_new_cflags=
 cf_new_cppflags=
 cf_new_extra_cppflags=
 
-for cf_add_cflags in $cf_temp_xopen_source
+for cf_add_cflags in $cf_cv_posix_c_source
 do
 case $cf_fix_cppflags in
 no)
@@ -8140,38 +8166,550 @@
 	EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS"
 fi
 
-	fi
+fi
 
-cf_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE
+	;;
+netbsd*) #(vi
+	cf_xopen_source="-D_NETBSD_SOURCE" # setting _XOPEN_SOURCE breaks IPv6 for lynx on NetBSD 1.6, breaks xterm, is not needed for ncursesw
+	;;
+openbsd[4-9]*) #(vi
+	# setting _XOPEN_SOURCE lower than 500 breaks g++ compile with wchar.h, needed for ncursesw
+	cf_xopen_source="-D_BSD_SOURCE"
+	cf_XOPEN_SOURCE=600
+	;;
+openbsd*) #(vi
+	# setting _XOPEN_SOURCE breaks xterm on OpenBSD 2.8, is not needed for ncursesw
+	;;
+osf[45]*) #(vi
+	cf_xopen_source="-D_OSF_SOURCE"
+	;;
+nto-qnx*) #(vi
+	cf_xopen_source="-D_QNX_SOURCE"
+	;;
+sco*) #(vi
+	# setting _XOPEN_SOURCE breaks Lynx on SCO Unix / OpenServer
+	;;
+solaris2.*) #(vi
+	cf_xopen_source="-D__EXTENSIONS__"
+	;;
+*)
 
-cf_save_CFLAGS="$CFLAGS"
-cf_save_CPPFLAGS="$CPPFLAGS"
+echo "$as_me:8197: checking if we should define _XOPEN_SOURCE" >&5
+echo $ECHO_N "checking if we should define _XOPEN_SOURCE... $ECHO_C" >&6
+if test "${cf_cv_xopen_source+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
 
-cf_trim_CFLAGS=`echo "$cf_save_CFLAGS" | \
-	sed	-e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ 	]*\)\?[ 	]/ /g' \
-		-e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ 	]*\)\?$//g'`
+	cat >conftest.$ac_ext <<_ACEOF
+#line 8204 "configure"
+#include "confdefs.h"
 
-cf_trim_CPPFLAGS=`echo "$cf_save_CPPFLAGS" | \
-	sed	-e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ 	]*\)\?[ 	]/ /g' \
-		-e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ 	]*\)\?$//g'`
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
 
-echo "$as_me:8158: checking if we should define _POSIX_C_SOURCE" >&5
-echo $ECHO_N "checking if we should define _POSIX_C_SOURCE... $ECHO_C" >&6
-if test "${cf_cv_posix_c_source+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+int
+main ()
+{
+
+#ifndef _XOPEN_SOURCE
+make an error
+#endif
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:8223: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:8226: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:8229: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:8232: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  cf_cv_xopen_source=no
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+cf_save="$CPPFLAGS"
+	 CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE"
+	 cat >conftest.$ac_ext <<_ACEOF
+#line 8241 "configure"
+#include "confdefs.h"
+
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+
+int
+main ()
+{
+
+#ifdef _XOPEN_SOURCE
+make an error
+#endif
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:8260: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:8263: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:8266: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:8269: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  cf_cv_xopen_source=no
 else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+cf_cv_xopen_source=$cf_XOPEN_SOURCE
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+	CPPFLAGS="$cf_save"
+
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+
+fi
+echo "$as_me:8284: result: $cf_cv_xopen_source" >&5
+echo "${ECHO_T}$cf_cv_xopen_source" >&6
+
+if test "$cf_cv_xopen_source" != no ; then
+
+CFLAGS=`echo "$CFLAGS" | \
+	sed	-e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ 	]*\)\?[ 	]/ /g' \
+		-e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ 	]*\)\?$//g'`
+
+CPPFLAGS=`echo "$CPPFLAGS" | \
+	sed	-e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ 	]*\)\?[ 	]/ /g' \
+		-e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ 	]*\)\?$//g'`
+
+	cf_temp_xopen_source="-D_XOPEN_SOURCE=$cf_cv_xopen_source"
+
+cf_fix_cppflags=no
+cf_new_cflags=
+cf_new_cppflags=
+cf_new_extra_cppflags=
+
+for cf_add_cflags in $cf_temp_xopen_source
+do
+case $cf_fix_cppflags in
+no)
+	case $cf_add_cflags in #(vi
+	-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi
+		case $cf_add_cflags in
+		-D*)
+			cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'`
+
+			test "${cf_add_cflags}" != "${cf_tst_cflags}" \
+				&& test -z "${cf_tst_cflags}" \
+				&& cf_fix_cppflags=yes
+
+			if test $cf_fix_cppflags = yes ; then
+				cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
+				continue
+			elif test "${cf_tst_cflags}" = "\"'" ; then
+				cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
+				continue
+			fi
+			;;
+		esac
+		case "$CPPFLAGS" in
+		*$cf_add_cflags) #(vi
+			;;
+		*) #(vi
+			case $cf_add_cflags in #(vi
+			-D*)
+				cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'`
+
+CPPFLAGS=`echo "$CPPFLAGS" | \
+	sed	-e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ 	]*\)\?[ 	]/ /g' \
+		-e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ 	]*\)\?$//g'`
+
+				;;
+			esac
+			cf_new_cppflags="$cf_new_cppflags $cf_add_cflags"
+			;;
+		esac
+		;;
+	*)
+		cf_new_cflags="$cf_new_cflags $cf_add_cflags"
+		;;
+	esac
+	;;
+yes)
+	cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
+
+	cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'`
+
+	test "${cf_add_cflags}" != "${cf_tst_cflags}" \
+		&& test -z "${cf_tst_cflags}" \
+		&& cf_fix_cppflags=no
+	;;
+esac
+done
+
+if test -n "$cf_new_cflags" ; then
+
+	CFLAGS="$CFLAGS $cf_new_cflags"
+fi
+
+if test -n "$cf_new_cppflags" ; then
+
+	CPPFLAGS="$CPPFLAGS $cf_new_cppflags"
+fi
+
+if test -n "$cf_new_extra_cppflags" ; then
+
+	EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS"
+fi
+
+fi
+
+cf_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE
+
+cf_save_CFLAGS="$CFLAGS"
+cf_save_CPPFLAGS="$CPPFLAGS"
+
+cf_trim_CFLAGS=`echo "$cf_save_CFLAGS" | \
+	sed	-e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ 	]*\)\?[ 	]/ /g' \
+		-e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ 	]*\)\?$//g'`
+
+cf_trim_CPPFLAGS=`echo "$cf_save_CPPFLAGS" | \
+	sed	-e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ 	]*\)\?[ 	]/ /g' \
+		-e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ 	]*\)\?$//g'`
+
+echo "$as_me:8392: checking if we should define _POSIX_C_SOURCE" >&5
+echo $ECHO_N "checking if we should define _POSIX_C_SOURCE... $ECHO_C" >&6
+if test "${cf_cv_posix_c_source+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+echo "${as_me:-configure}:8398: testing if the symbol is already defined go no further ..." 1>&5
+
+	cat >conftest.$ac_ext <<_ACEOF
+#line 8401 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+int
+main ()
+{
+
+#ifndef _POSIX_C_SOURCE
+make an error
+#endif
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:8416: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:8419: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:8422: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:8425: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  cf_cv_posix_c_source=no
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+cf_want_posix_source=no
+	 case .$cf_POSIX_C_SOURCE in #(vi
+	 .[12]??*) #(vi
+		cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE"
+		;;
+	 .2) #(vi
+		cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE"
+		cf_want_posix_source=yes
+		;;
+	 .*)
+		cf_want_posix_source=yes
+		;;
+	 esac
+	 if test "$cf_want_posix_source" = yes ; then
+		cat >conftest.$ac_ext <<_ACEOF
+#line 8446 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+int
+main ()
+{
+
+#ifdef _POSIX_SOURCE
+make an error
+#endif
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:8461: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:8464: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:8467: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:8470: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  :
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+cf_cv_posix_c_source="$cf_cv_posix_c_source -D_POSIX_SOURCE"
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+	 fi
+
+echo "${as_me:-configure}:8481: testing ifdef from value $cf_POSIX_C_SOURCE ..." 1>&5
+
+	 CFLAGS="$cf_trim_CFLAGS"
+	 CPPFLAGS="$cf_trim_CPPFLAGS $cf_cv_posix_c_source"
+
+echo "${as_me:-configure}:8486: testing if the second compile does not leave our definition intact error ..." 1>&5
+
+	 cat >conftest.$ac_ext <<_ACEOF
+#line 8489 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+int
+main ()
+{
+
+#ifndef _POSIX_C_SOURCE
+make an error
+#endif
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:8504: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:8507: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:8510: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:8513: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  :
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+cf_cv_posix_c_source=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+	 CFLAGS="$cf_save_CFLAGS"
+	 CPPFLAGS="$cf_save_CPPFLAGS"
+
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+
+fi
+echo "$as_me:8529: result: $cf_cv_posix_c_source" >&5
+echo "${ECHO_T}$cf_cv_posix_c_source" >&6
+
+if test "$cf_cv_posix_c_source" != no ; then
+	CFLAGS="$cf_trim_CFLAGS"
+	CPPFLAGS="$cf_trim_CPPFLAGS"
+
+cf_fix_cppflags=no
+cf_new_cflags=
+cf_new_cppflags=
+cf_new_extra_cppflags=
+
+for cf_add_cflags in $cf_cv_posix_c_source
+do
+case $cf_fix_cppflags in
+no)
+	case $cf_add_cflags in #(vi
+	-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi
+		case $cf_add_cflags in
+		-D*)
+			cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'`
+
+			test "${cf_add_cflags}" != "${cf_tst_cflags}" \
+				&& test -z "${cf_tst_cflags}" \
+				&& cf_fix_cppflags=yes
+
+			if test $cf_fix_cppflags = yes ; then
+				cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
+				continue
+			elif test "${cf_tst_cflags}" = "\"'" ; then
+				cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
+				continue
+			fi
+			;;
+		esac
+		case "$CPPFLAGS" in
+		*$cf_add_cflags) #(vi
+			;;
+		*) #(vi
+			case $cf_add_cflags in #(vi
+			-D*)
+				cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'`
+
+CPPFLAGS=`echo "$CPPFLAGS" | \
+	sed	-e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ 	]*\)\?[ 	]/ /g' \
+		-e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ 	]*\)\?$//g'`
+
+				;;
+			esac
+			cf_new_cppflags="$cf_new_cppflags $cf_add_cflags"
+			;;
+		esac
+		;;
+	*)
+		cf_new_cflags="$cf_new_cflags $cf_add_cflags"
+		;;
+	esac
+	;;
+yes)
+	cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
+
+	cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'`
+
+	test "${cf_add_cflags}" != "${cf_tst_cflags}" \
+		&& test -z "${cf_tst_cflags}" \
+		&& cf_fix_cppflags=no
+	;;
+esac
+done
+
+if test -n "$cf_new_cflags" ; then
+
+	CFLAGS="$CFLAGS $cf_new_cflags"
+fi
+
+if test -n "$cf_new_cppflags" ; then
+
+	CPPFLAGS="$CPPFLAGS $cf_new_cppflags"
+fi
+
+if test -n "$cf_new_extra_cppflags" ; then
+
+	EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS"
+fi
+
+fi
+
+	;;
+esac
+
+if test -n "$cf_xopen_source" ; then
+
+cf_fix_cppflags=no
+cf_new_cflags=
+cf_new_cppflags=
+cf_new_extra_cppflags=
+
+for cf_add_cflags in $cf_xopen_source
+do
+case $cf_fix_cppflags in
+no)
+	case $cf_add_cflags in #(vi
+	-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi
+		case $cf_add_cflags in
+		-D*)
+			cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'`
+
+			test "${cf_add_cflags}" != "${cf_tst_cflags}" \
+				&& test -z "${cf_tst_cflags}" \
+				&& cf_fix_cppflags=yes
+
+			if test $cf_fix_cppflags = yes ; then
+				cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
+				continue
+			elif test "${cf_tst_cflags}" = "\"'" ; then
+				cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
+				continue
+			fi
+			;;
+		esac
+		case "$CPPFLAGS" in
+		*$cf_add_cflags) #(vi
+			;;
+		*) #(vi
+			case $cf_add_cflags in #(vi
+			-D*)
+				cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'`
+
+CPPFLAGS=`echo "$CPPFLAGS" | \
+	sed	-e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ 	]*\)\?[ 	]/ /g' \
+		-e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ 	]*\)\?$//g'`
+
+				;;
+			esac
+			cf_new_cppflags="$cf_new_cppflags $cf_add_cflags"
+			;;
+		esac
+		;;
+	*)
+		cf_new_cflags="$cf_new_cflags $cf_add_cflags"
+		;;
+	esac
+	;;
+yes)
+	cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
+
+	cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'`
+
+	test "${cf_add_cflags}" != "${cf_tst_cflags}" \
+		&& test -z "${cf_tst_cflags}" \
+		&& cf_fix_cppflags=no
+	;;
+esac
+done
+
+if test -n "$cf_new_cflags" ; then
+
+	CFLAGS="$CFLAGS $cf_new_cflags"
+fi
+
+if test -n "$cf_new_cppflags" ; then
+
+	CPPFLAGS="$CPPFLAGS $cf_new_cppflags"
+fi
+
+if test -n "$cf_new_extra_cppflags" ; then
+
+	EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS"
+fi
 
-echo "${as_me:-configure}:8164: testing if the symbol is already defined go no further ..." 1>&5
+fi
 
+if test -n "$cf_XOPEN_SOURCE" && test -z "$cf_cv_xopen_source" ; then
+	echo "$as_me:8702: checking if _XOPEN_SOURCE really is set" >&5
+echo $ECHO_N "checking if _XOPEN_SOURCE really is set... $ECHO_C" >&6
 	cat >conftest.$ac_ext <<_ACEOF
-#line 8167 "configure"
+#line 8705 "configure"
 #include "confdefs.h"
-#include <sys/types.h>
+#include <stdlib.h>
 int
 main ()
 {
 
-#ifndef _POSIX_C_SOURCE
+#ifndef _XOPEN_SOURCE
 make an error
 #endif
   ;
@@ -8179,44 +8717,37 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:8182: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:8720: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:8185: \$? = $ac_status" >&5
+  echo "$as_me:8723: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:8188: \"$ac_try\"") >&5
+  { (eval echo "$as_me:8726: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:8191: \$? = $ac_status" >&5
+  echo "$as_me:8729: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  cf_cv_posix_c_source=no
+  cf_XOPEN_SOURCE_set=yes
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-cf_want_posix_source=no
-	 case .$cf_POSIX_C_SOURCE in #(vi
-	 .[12]??*) #(vi
-		cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE"
-		;;
-	 .2) #(vi
-		cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE"
-		cf_want_posix_source=yes
-		;;
-	 .*)
-		cf_want_posix_source=yes
-		;;
-	 esac
-	 if test "$cf_want_posix_source" = yes ; then
+cf_XOPEN_SOURCE_set=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+	echo "$as_me:8738: result: $cf_XOPEN_SOURCE_set" >&5
+echo "${ECHO_T}$cf_XOPEN_SOURCE_set" >&6
+	if test $cf_XOPEN_SOURCE_set = yes
+	then
 		cat >conftest.$ac_ext <<_ACEOF
-#line 8212 "configure"
+#line 8743 "configure"
 #include "confdefs.h"
-#include <sys/types.h>
+#include <stdlib.h>
 int
 main ()
 {
 
-#ifdef _POSIX_SOURCE
+#if (_XOPEN_SOURCE - 0) < $cf_XOPEN_SOURCE
 make an error
 #endif
   ;
@@ -8224,42 +8755,87 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:8227: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:8758: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:8230: \$? = $ac_status" >&5
+  echo "$as_me:8761: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:8233: \"$ac_try\"") >&5
+  { (eval echo "$as_me:8764: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:8236: \$? = $ac_status" >&5
+  echo "$as_me:8767: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  :
+  cf_XOPEN_SOURCE_set_ok=yes
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-cf_cv_posix_c_source="$cf_cv_posix_c_source -D_POSIX_SOURCE"
+cf_XOPEN_SOURCE_set_ok=no
 fi
 rm -f conftest.$ac_objext conftest.$ac_ext
-	 fi
+		if test $cf_XOPEN_SOURCE_set_ok = no
+		then
+			{ echo "$as_me:8778: WARNING: _XOPEN_SOURCE is lower than requested" >&5
+echo "$as_me: WARNING: _XOPEN_SOURCE is lower than requested" >&2;}
+		fi
+	else
 
-echo "${as_me:-configure}:8247: testing ifdef from value $cf_POSIX_C_SOURCE ..." 1>&5
+echo "$as_me:8783: checking if we should define _XOPEN_SOURCE" >&5
+echo $ECHO_N "checking if we should define _XOPEN_SOURCE... $ECHO_C" >&6
+if test "${cf_cv_xopen_source+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
 
-	 CFLAGS="$cf_trim_CFLAGS"
-	 CPPFLAGS="$cf_trim_CPPFLAGS $cf_cv_posix_c_source"
+	cat >conftest.$ac_ext <<_ACEOF
+#line 8790 "configure"
+#include "confdefs.h"
 
-echo "${as_me:-configure}:8252: testing if the second compile does not leave our definition intact error ..." 1>&5
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+
+int
+main ()
+{
 
+#ifndef _XOPEN_SOURCE
+make an error
+#endif
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:8809: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:8812: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:8815: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:8818: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  cf_cv_xopen_source=no
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+cf_save="$CPPFLAGS"
+	 CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE"
 	 cat >conftest.$ac_ext <<_ACEOF
-#line 8255 "configure"
+#line 8827 "configure"
 #include "confdefs.h"
+
+#include <stdlib.h>
+#include <string.h>
 #include <sys/types.h>
+
 int
 main ()
 {
 
-#ifndef _POSIX_C_SOURCE
+#ifdef _XOPEN_SOURCE
 make an error
 #endif
   ;
@@ -8267,129 +8843,51 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:8270: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:8846: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:8273: \$? = $ac_status" >&5
+  echo "$as_me:8849: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:8276: \"$ac_try\"") >&5
+  { (eval echo "$as_me:8852: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:8279: \$? = $ac_status" >&5
+  echo "$as_me:8855: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  :
+  cf_cv_xopen_source=no
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-cf_cv_posix_c_source=no
+cf_cv_xopen_source=$cf_XOPEN_SOURCE
 fi
 rm -f conftest.$ac_objext conftest.$ac_ext
-	 CFLAGS="$cf_save_CFLAGS"
-	 CPPFLAGS="$cf_save_CPPFLAGS"
+	CPPFLAGS="$cf_save"
 
 fi
 rm -f conftest.$ac_objext conftest.$ac_ext
 
 fi
-echo "$as_me:8295: result: $cf_cv_posix_c_source" >&5
-echo "${ECHO_T}$cf_cv_posix_c_source" >&6
-
-if test "$cf_cv_posix_c_source" != no ; then
-	CFLAGS="$cf_trim_CFLAGS"
-	CPPFLAGS="$cf_trim_CPPFLAGS"
-
-cf_fix_cppflags=no
-cf_new_cflags=
-cf_new_cppflags=
-cf_new_extra_cppflags=
-
-for cf_add_cflags in $cf_cv_posix_c_source
-do
-case $cf_fix_cppflags in
-no)
-	case $cf_add_cflags in #(vi
-	-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi
-		case $cf_add_cflags in
-		-D*)
-			cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'`
+echo "$as_me:8870: result: $cf_cv_xopen_source" >&5
+echo "${ECHO_T}$cf_cv_xopen_source" >&6
 
-			test "${cf_add_cflags}" != "${cf_tst_cflags}" \
-				&& test -z "${cf_tst_cflags}" \
-				&& cf_fix_cppflags=yes
+if test "$cf_cv_xopen_source" != no ; then
 
-			if test $cf_fix_cppflags = yes ; then
-				cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
-				continue
-			elif test "${cf_tst_cflags}" = "\"'" ; then
-				cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
-				continue
-			fi
-			;;
-		esac
-		case "$CPPFLAGS" in
-		*$cf_add_cflags) #(vi
-			;;
-		*) #(vi
-			case $cf_add_cflags in #(vi
-			-D*)
-				cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'`
+CFLAGS=`echo "$CFLAGS" | \
+	sed	-e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ 	]*\)\?[ 	]/ /g' \
+		-e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ 	]*\)\?$//g'`
 
 CPPFLAGS=`echo "$CPPFLAGS" | \
-	sed	-e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ 	]*\)\?[ 	]/ /g' \
-		-e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ 	]*\)\?$//g'`
-
-				;;
-			esac
-			cf_new_cppflags="$cf_new_cppflags $cf_add_cflags"
-			;;
-		esac
-		;;
-	*)
-		cf_new_cflags="$cf_new_cflags $cf_add_cflags"
-		;;
-	esac
-	;;
-yes)
-	cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
-
-	cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'`
-
-	test "${cf_add_cflags}" != "${cf_tst_cflags}" \
-		&& test -z "${cf_tst_cflags}" \
-		&& cf_fix_cppflags=no
-	;;
-esac
-done
-
-if test -n "$cf_new_cflags" ; then
-
-	CFLAGS="$CFLAGS $cf_new_cflags"
-fi
-
-if test -n "$cf_new_cppflags" ; then
-
-	CPPFLAGS="$CPPFLAGS $cf_new_cppflags"
-fi
-
-if test -n "$cf_new_extra_cppflags" ; then
-
-	EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS"
-fi
-
-fi
-
-	;;
-esac
+	sed	-e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ 	]*\)\?[ 	]/ /g' \
+		-e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ 	]*\)\?$//g'`
 
-if test -n "$cf_xopen_source" ; then
+	cf_temp_xopen_source="-D_XOPEN_SOURCE=$cf_cv_xopen_source"
 
 cf_fix_cppflags=no
 cf_new_cflags=
 cf_new_cppflags=
 cf_new_extra_cppflags=
 
-for cf_add_cflags in $cf_xopen_source
+for cf_add_cflags in $cf_temp_xopen_source
 do
 case $cf_fix_cppflags in
 no)
@@ -8464,6 +8962,9 @@
 
 fi
 
+	fi
+fi
+
 # Check whether --enable-largefile or --disable-largefile was given.
 if test "${enable_largefile+set}" = set; then
   enableval="$enable_largefile"
@@ -8471,7 +8972,7 @@
 fi;
 if test "$enable_largefile" != no; then
 
-  echo "$as_me:8474: checking for special C compiler options needed for large files" >&5
+  echo "$as_me:8975: checking for special C compiler options needed for large files" >&5
 echo $ECHO_N "checking for special C compiler options needed for large files... $ECHO_C" >&6
 if test "${ac_cv_sys_largefile_CC+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -8483,7 +8984,7 @@
      	 # IRIX 6.2 and later do not support large files by default,
      	 # so use the C compiler's -n32 option if that helps.
          cat >conftest.$ac_ext <<_ACEOF
-#line 8486 "configure"
+#line 8987 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
  /* Check that off_t can represent 2**63 - 1 correctly.
@@ -8503,16 +9004,16 @@
 }
 _ACEOF
      	 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:8506: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:9007: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:8509: \$? = $ac_status" >&5
+  echo "$as_me:9010: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:8512: \"$ac_try\"") >&5
+  { (eval echo "$as_me:9013: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:8515: \$? = $ac_status" >&5
+  echo "$as_me:9016: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   break
 else
@@ -8522,16 +9023,16 @@
 rm -f conftest.$ac_objext
      	 CC="$CC -n32"
      	 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:8525: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:9026: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:8528: \$? = $ac_status" >&5
+  echo "$as_me:9029: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:8531: \"$ac_try\"") >&5
+  { (eval echo "$as_me:9032: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:8534: \$? = $ac_status" >&5
+  echo "$as_me:9035: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_sys_largefile_CC=' -n32'; break
 else
@@ -8545,13 +9046,13 @@
        rm -f conftest.$ac_ext
     fi
 fi
-echo "$as_me:8548: result: $ac_cv_sys_largefile_CC" >&5
+echo "$as_me:9049: result: $ac_cv_sys_largefile_CC" >&5
 echo "${ECHO_T}$ac_cv_sys_largefile_CC" >&6
   if test "$ac_cv_sys_largefile_CC" != no; then
     CC=$CC$ac_cv_sys_largefile_CC
   fi
 
-  echo "$as_me:8554: checking for _FILE_OFFSET_BITS value needed for large files" >&5
+  echo "$as_me:9055: checking for _FILE_OFFSET_BITS value needed for large files" >&5
 echo $ECHO_N "checking for _FILE_OFFSET_BITS value needed for large files... $ECHO_C" >&6
 if test "${ac_cv_sys_file_offset_bits+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -8559,7 +9060,7 @@
   while :; do
   ac_cv_sys_file_offset_bits=no
   cat >conftest.$ac_ext <<_ACEOF
-#line 8562 "configure"
+#line 9063 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
  /* Check that off_t can represent 2**63 - 1 correctly.
@@ -8579,16 +9080,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:8582: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:9083: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:8585: \$? = $ac_status" >&5
+  echo "$as_me:9086: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:8588: \"$ac_try\"") >&5
+  { (eval echo "$as_me:9089: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:8591: \$? = $ac_status" >&5
+  echo "$as_me:9092: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   break
 else
@@ -8597,7 +9098,7 @@
 fi
 rm -f conftest.$ac_objext conftest.$ac_ext
   cat >conftest.$ac_ext <<_ACEOF
-#line 8600 "configure"
+#line 9101 "configure"
 #include "confdefs.h"
 #define _FILE_OFFSET_BITS 64
 #include <sys/types.h>
@@ -8618,16 +9119,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:8621: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:9122: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:8624: \$? = $ac_status" >&5
+  echo "$as_me:9125: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:8627: \"$ac_try\"") >&5
+  { (eval echo "$as_me:9128: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:8630: \$? = $ac_status" >&5
+  echo "$as_me:9131: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_sys_file_offset_bits=64; break
 else
@@ -8638,7 +9139,7 @@
   break
 done
 fi
-echo "$as_me:8641: result: $ac_cv_sys_file_offset_bits" >&5
+echo "$as_me:9142: result: $ac_cv_sys_file_offset_bits" >&5
 echo "${ECHO_T}$ac_cv_sys_file_offset_bits" >&6
 if test "$ac_cv_sys_file_offset_bits" != no; then
 
@@ -8648,7 +9149,7 @@
 
 fi
 rm -rf conftest*
-  echo "$as_me:8651: checking for _LARGE_FILES value needed for large files" >&5
+  echo "$as_me:9152: checking for _LARGE_FILES value needed for large files" >&5
 echo $ECHO_N "checking for _LARGE_FILES value needed for large files... $ECHO_C" >&6
 if test "${ac_cv_sys_large_files+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -8656,7 +9157,7 @@
   while :; do
   ac_cv_sys_large_files=no
   cat >conftest.$ac_ext <<_ACEOF
-#line 8659 "configure"
+#line 9160 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
  /* Check that off_t can represent 2**63 - 1 correctly.
@@ -8676,16 +9177,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:8679: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:9180: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:8682: \$? = $ac_status" >&5
+  echo "$as_me:9183: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:8685: \"$ac_try\"") >&5
+  { (eval echo "$as_me:9186: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:8688: \$? = $ac_status" >&5
+  echo "$as_me:9189: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   break
 else
@@ -8694,7 +9195,7 @@
 fi
 rm -f conftest.$ac_objext conftest.$ac_ext
   cat >conftest.$ac_ext <<_ACEOF
-#line 8697 "configure"
+#line 9198 "configure"
 #include "confdefs.h"
 #define _LARGE_FILES 1
 #include <sys/types.h>
@@ -8715,16 +9216,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:8718: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:9219: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:8721: \$? = $ac_status" >&5
+  echo "$as_me:9222: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:8724: \"$ac_try\"") >&5
+  { (eval echo "$as_me:9225: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:8727: \$? = $ac_status" >&5
+  echo "$as_me:9228: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_sys_large_files=1; break
 else
@@ -8735,7 +9236,7 @@
   break
 done
 fi
-echo "$as_me:8738: result: $ac_cv_sys_large_files" >&5
+echo "$as_me:9239: result: $ac_cv_sys_large_files" >&5
 echo "${ECHO_T}$ac_cv_sys_large_files" >&6
 if test "$ac_cv_sys_large_files" != no; then
 
@@ -8748,7 +9249,7 @@
 fi
 
     if test "$enable_largefile" != no ; then
-	echo "$as_me:8751: checking for _LARGEFILE_SOURCE value needed for large files" >&5
+	echo "$as_me:9252: checking for _LARGEFILE_SOURCE value needed for large files" >&5
 echo $ECHO_N "checking for _LARGEFILE_SOURCE value needed for large files... $ECHO_C" >&6
 if test "${ac_cv_sys_largefile_source+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -8756,7 +9257,7 @@
   while :; do
   ac_cv_sys_largefile_source=no
   cat >conftest.$ac_ext <<_ACEOF
-#line 8759 "configure"
+#line 9260 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 int
@@ -8768,16 +9269,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:8771: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:9272: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:8774: \$? = $ac_status" >&5
+  echo "$as_me:9275: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:8777: \"$ac_try\"") >&5
+  { (eval echo "$as_me:9278: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:8780: \$? = $ac_status" >&5
+  echo "$as_me:9281: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   break
 else
@@ -8786,7 +9287,7 @@
 fi
 rm -f conftest.$ac_objext conftest.$ac_ext
   cat >conftest.$ac_ext <<_ACEOF
-#line 8789 "configure"
+#line 9290 "configure"
 #include "confdefs.h"
 #define _LARGEFILE_SOURCE 1
 #include <stdio.h>
@@ -8799,16 +9300,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:8802: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:9303: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:8805: \$? = $ac_status" >&5
+  echo "$as_me:9306: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:8808: \"$ac_try\"") >&5
+  { (eval echo "$as_me:9309: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:8811: \$? = $ac_status" >&5
+  echo "$as_me:9312: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_sys_largefile_source=1; break
 else
@@ -8819,7 +9320,7 @@
   break
 done
 fi
-echo "$as_me:8822: result: $ac_cv_sys_largefile_source" >&5
+echo "$as_me:9323: result: $ac_cv_sys_largefile_source" >&5
 echo "${ECHO_T}$ac_cv_sys_largefile_source" >&6
 if test "$ac_cv_sys_largefile_source" != no; then
 
@@ -8833,13 +9334,13 @@
 # We used to try defining _XOPEN_SOURCE=500 too, to work around a bug
 # in glibc 2.1.3, but that breaks too many other things.
 # If you want fseeko and ftello with glibc, upgrade to a fixed glibc.
-echo "$as_me:8836: checking for fseeko" >&5
+echo "$as_me:9337: checking for fseeko" >&5
 echo $ECHO_N "checking for fseeko... $ECHO_C" >&6
 if test "${ac_cv_func_fseeko+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 8842 "configure"
+#line 9343 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 int
@@ -8851,16 +9352,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:8854: \"$ac_link\"") >&5
+if { (eval echo "$as_me:9355: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:8857: \$? = $ac_status" >&5
+  echo "$as_me:9358: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:8860: \"$ac_try\"") >&5
+  { (eval echo "$as_me:9361: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:8863: \$? = $ac_status" >&5
+  echo "$as_me:9364: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_func_fseeko=yes
 else
@@ -8870,7 +9371,7 @@
 fi
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 fi
-echo "$as_me:8873: result: $ac_cv_func_fseeko" >&5
+echo "$as_me:9374: result: $ac_cv_func_fseeko" >&5
 echo "${ECHO_T}$ac_cv_func_fseeko" >&6
 if test $ac_cv_func_fseeko = yes; then
 
@@ -8891,14 +9392,14 @@
 	test "$ac_cv_sys_largefile_source" != no && CPPFLAGS="$CPPFLAGS -D_LARGEFILE_SOURCE "
 	test "$ac_cv_sys_file_offset_bits" != no && CPPFLAGS="$CPPFLAGS -D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits "
 
-	echo "$as_me:8894: checking whether to use struct dirent64" >&5
+	echo "$as_me:9395: checking whether to use struct dirent64" >&5
 echo $ECHO_N "checking whether to use struct dirent64... $ECHO_C" >&6
 if test "${cf_cv_struct_dirent64+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
 
 		cat >conftest.$ac_ext <<_ACEOF
-#line 8901 "configure"
+#line 9402 "configure"
 #include "confdefs.h"
 
 #include <sys/types.h>
@@ -8919,16 +9420,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:8922: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:9423: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:8925: \$? = $ac_status" >&5
+  echo "$as_me:9426: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:8928: \"$ac_try\"") >&5
+  { (eval echo "$as_me:9429: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:8931: \$? = $ac_status" >&5
+  echo "$as_me:9432: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   cf_cv_struct_dirent64=yes
 else
@@ -8939,16 +9440,17 @@
 rm -f conftest.$ac_objext conftest.$ac_ext
 
 fi
-echo "$as_me:8942: result: $cf_cv_struct_dirent64" >&5
+echo "$as_me:9443: result: $cf_cv_struct_dirent64" >&5
 echo "${ECHO_T}$cf_cv_struct_dirent64" >&6
-	test "$cf_cv_struct_dirent64" = yes && cat >>confdefs.h <<\EOF
+	test "$cf_cv_struct_dirent64" = yes &&
+cat >>confdefs.h <<\EOF
 #define HAVE_STRUCT_DIRENT64 1
 EOF
 
     fi
 
 ### Enable compiling-in rcs id's
-echo "$as_me:8951: checking if RCS identifiers should be compiled-in" >&5
+echo "$as_me:9453: checking if RCS identifiers should be compiled-in" >&5
 echo $ECHO_N "checking if RCS identifiers should be compiled-in... $ECHO_C" >&6
 
 # Check whether --with-rcs-ids or --without-rcs-ids was given.
@@ -8958,16 +9460,17 @@
 else
   with_rcs_ids=no
 fi;
-echo "$as_me:8961: result: $with_rcs_ids" >&5
+echo "$as_me:9463: result: $with_rcs_ids" >&5
 echo "${ECHO_T}$with_rcs_ids" >&6
-test "$with_rcs_ids" = yes && cat >>confdefs.h <<\EOF
+test "$with_rcs_ids" = yes &&
+cat >>confdefs.h <<\EOF
 #define USE_RCS_IDS 1
 EOF
 
 ###############################################################################
 
 ### Note that some functions (such as const) are normally disabled anyway.
-echo "$as_me:8970: checking if you want to build with function extensions" >&5
+echo "$as_me:9473: checking if you want to build with function extensions" >&5
 echo $ECHO_N "checking if you want to build with function extensions... $ECHO_C" >&6
 
 # Check whether --enable-ext-funcs or --disable-ext-funcs was given.
@@ -8977,15 +9480,16 @@
 else
   with_ext_funcs=yes
 fi;
-echo "$as_me:8980: result: $with_ext_funcs" >&5
+echo "$as_me:9483: result: $with_ext_funcs" >&5
 echo "${ECHO_T}$with_ext_funcs" >&6
 if test "$with_ext_funcs" = yes ; then
 	NCURSES_EXT_FUNCS=1
-	cat >>confdefs.h <<\EOF
+
+cat >>confdefs.h <<\EOF
 #define HAVE_USE_DEFAULT_COLORS 1
 EOF
 
-	cat >>confdefs.h <<\EOF
+cat >>confdefs.h <<\EOF
 #define NCURSES_EXT_FUNCS 1
 EOF
 
@@ -8994,7 +9498,7 @@
 fi
 
 ###   use option --enable-const to turn on use of const beyond that in XSI.
-echo "$as_me:8997: checking for extended use of const keyword" >&5
+echo "$as_me:9501: checking for extended use of const keyword" >&5
 echo $ECHO_N "checking for extended use of const keyword... $ECHO_C" >&6
 
 # Check whether --enable-const or --disable-const was given.
@@ -9004,7 +9508,7 @@
 else
   with_ext_const=no
 fi;
-echo "$as_me:9007: result: $with_ext_const" >&5
+echo "$as_me:9511: result: $with_ext_const" >&5
 echo "${ECHO_T}$with_ext_const" >&6
 NCURSES_CONST='/*nothing*/'
 if test "$with_ext_const" = yes ; then
@@ -9014,7 +9518,7 @@
 ###############################################################################
 # These options are relatively safe to experiment with.
 
-echo "$as_me:9017: checking if you want all development code" >&5
+echo "$as_me:9521: checking if you want all development code" >&5
 echo $ECHO_N "checking if you want all development code... $ECHO_C" >&6
 
 # Check whether --with-develop or --without-develop was given.
@@ -9024,7 +9528,7 @@
 else
   with_develop=no
 fi;
-echo "$as_me:9027: result: $with_develop" >&5
+echo "$as_me:9531: result: $with_develop" >&5
 echo "${ECHO_T}$with_develop" >&6
 
 ###############################################################################
@@ -9033,7 +9537,7 @@
 # This is still experimental (20080329), but should ultimately be moved to
 # the script-block --with-normal, etc.
 
-echo "$as_me:9036: checking if you want to link with the pthread library" >&5
+echo "$as_me:9540: checking if you want to link with the pthread library" >&5
 echo $ECHO_N "checking if you want to link with the pthread library... $ECHO_C" >&6
 
 # Check whether --with-pthread or --without-pthread was given.
@@ -9043,27 +9547,27 @@
 else
   with_pthread=no
 fi;
-echo "$as_me:9046: result: $with_pthread" >&5
+echo "$as_me:9550: result: $with_pthread" >&5
 echo "${ECHO_T}$with_pthread" >&6
 
 if test "$with_pthread" != no ; then
-    echo "$as_me:9050: checking for pthread.h" >&5
+    echo "$as_me:9554: checking for pthread.h" >&5
 echo $ECHO_N "checking for pthread.h... $ECHO_C" >&6
 if test "${ac_cv_header_pthread_h+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 9056 "configure"
+#line 9560 "configure"
 #include "confdefs.h"
 #include <pthread.h>
 _ACEOF
-if { (eval echo "$as_me:9060: \"$ac_cpp conftest.$ac_ext\"") >&5
+if { (eval echo "$as_me:9564: \"$ac_cpp conftest.$ac_ext\"") >&5
   (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
   ac_status=$?
   egrep -v '^ *\+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
-  echo "$as_me:9066: \$? = $ac_status" >&5
+  echo "$as_me:9570: \$? = $ac_status" >&5
   (exit $ac_status); } >/dev/null; then
   if test -s conftest.err; then
     ac_cpp_err=$ac_c_preproc_warn_flag
@@ -9082,20 +9586,22 @@
 fi
 rm -f conftest.err conftest.$ac_ext
 fi
-echo "$as_me:9085: result: $ac_cv_header_pthread_h" >&5
+echo "$as_me:9589: result: $ac_cv_header_pthread_h" >&5
 echo "${ECHO_T}$ac_cv_header_pthread_h" >&6
 if test $ac_cv_header_pthread_h = yes; then
 
-        cat >>confdefs.h <<\EOF
+cat >>confdefs.h <<\EOF
 #define HAVE_PTHREADS_H 1
 EOF
 
-        echo "$as_me:9093: checking if we can link with the pthread library" >&5
-echo $ECHO_N "checking if we can link with the pthread library... $ECHO_C" >&6
-        cf_save_LIBS="$LIBS"
-        LIBS="-lpthread $LIBS"
-        cat >conftest.$ac_ext <<_ACEOF
-#line 9098 "configure"
+	for cf_lib_pthread in pthread c_r
+	do
+	    echo "$as_me:9599: checking if we can link with the $cf_lib_pthread library" >&5
+echo $ECHO_N "checking if we can link with the $cf_lib_pthread library... $ECHO_C" >&6
+	    cf_save_LIBS="$LIBS"
+	    LIBS="-l$cf_lib_pthread $LIBS"
+	    cat >conftest.$ac_ext <<_ACEOF
+#line 9604 "configure"
 #include "confdefs.h"
 
 #include <pthread.h>
@@ -9104,23 +9610,24 @@
 main ()
 {
 
-        int rc = pthread_create(0,0,0,0);
+		int rc = pthread_create(0,0,0,0);
+		int r2 = pthread_mutexattr_settype(0, 0);
 
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:9114: \"$ac_link\"") >&5
+if { (eval echo "$as_me:9621: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:9117: \$? = $ac_status" >&5
+  echo "$as_me:9624: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:9120: \"$ac_try\"") >&5
+  { (eval echo "$as_me:9627: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:9123: \$? = $ac_status" >&5
+  echo "$as_me:9630: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   with_pthread=yes
 else
@@ -9129,27 +9636,30 @@
 with_pthread=no
 fi
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
-        LIBS="$cf_save_LIBS"
-        echo "$as_me:9133: result: $with_pthread" >&5
+	    LIBS="$cf_save_LIBS"
+	    echo "$as_me:9640: result: $with_pthread" >&5
 echo "${ECHO_T}$with_pthread" >&6
+	    test "$with_pthread" = yes && break
+	done
+
+	if test "$with_pthread" = yes ; then
+	    LIBS="-l$cf_lib_pthread $LIBS"
 
-        if test "$with_pthread" = yes ; then
-            LIBS="-lpthread $LIBS"
-            cat >>confdefs.h <<\EOF
+cat >>confdefs.h <<\EOF
 #define HAVE_LIBPTHREADS 1
 EOF
 
-        else
-            { { echo "$as_me:9143: error: Cannot link with pthread library" >&5
+	else
+	    { { echo "$as_me:9653: error: Cannot link with pthread library" >&5
 echo "$as_me: error: Cannot link with pthread library" >&2;}
    { (exit 1); exit 1; }; }
-        fi
+	fi
 
 fi
 
 fi
 
-echo "$as_me:9152: checking if you want to use weak-symbols for pthreads" >&5
+echo "$as_me:9662: checking if you want to use weak-symbols for pthreads" >&5
 echo $ECHO_N "checking if you want to use weak-symbols for pthreads... $ECHO_C" >&6
 
 # Check whether --enable-weak-symbols or --disable-weak-symbols was given.
@@ -9159,18 +9669,18 @@
 else
   use_weak_symbols=no
 fi;
-echo "$as_me:9162: result: $use_weak_symbols" >&5
+echo "$as_me:9672: result: $use_weak_symbols" >&5
 echo "${ECHO_T}$use_weak_symbols" >&6
 if test "$use_weak_symbols" = yes ; then
 
-echo "$as_me:9166: checking if $CC supports weak symbols" >&5
+echo "$as_me:9676: checking if $CC supports weak symbols" >&5
 echo $ECHO_N "checking if $CC supports weak symbols... $ECHO_C" >&6
 if test "${cf_cv_weak_symbols+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
 
 cat >conftest.$ac_ext <<_ACEOF
-#line 9173 "configure"
+#line 9683 "configure"
 #include "confdefs.h"
 
 #include <stdio.h>
@@ -9196,16 +9706,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:9199: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:9709: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:9202: \$? = $ac_status" >&5
+  echo "$as_me:9712: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:9205: \"$ac_try\"") >&5
+  { (eval echo "$as_me:9715: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:9208: \$? = $ac_status" >&5
+  echo "$as_me:9718: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   cf_cv_weak_symbols=yes
 else
@@ -9216,7 +9726,7 @@
 rm -f conftest.$ac_objext conftest.$ac_ext
 
 fi
-echo "$as_me:9219: result: $cf_cv_weak_symbols" >&5
+echo "$as_me:9729: result: $cf_cv_weak_symbols" >&5
 echo "${ECHO_T}$cf_cv_weak_symbols" >&6
 
 else
@@ -9224,7 +9734,8 @@
 fi
 
 if test $cf_cv_weak_symbols = yes ; then
-    cat >>confdefs.h <<\EOF
+
+cat >>confdefs.h <<\EOF
 #define USE_WEAK_SYMBOLS 1
 EOF
 
@@ -9232,7 +9743,8 @@
 
 PTHREAD=
 if test "$with_pthread" = "yes" ; then
-    cat >>confdefs.h <<\EOF
+
+cat >>confdefs.h <<\EOF
 #define USE_PTHREADS 1
 EOF
 
@@ -9243,13 +9755,13 @@
 fi
 
 # OpenSUSE is installing ncurses6, using reentrant option.
-echo "$as_me:9246: checking for _nc_TABSIZE" >&5
+echo "$as_me:9758: checking for _nc_TABSIZE" >&5
 echo $ECHO_N "checking for _nc_TABSIZE... $ECHO_C" >&6
 if test "${ac_cv_func__nc_TABSIZE+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 9252 "configure"
+#line 9764 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char _nc_TABSIZE (); below.  */
@@ -9272,7 +9784,7 @@
 #if defined (__stub__nc_TABSIZE) || defined (__stub____nc_TABSIZE)
 choke me
 #else
-f = _nc_TABSIZE;
+f = _nc_TABSIZE; /* workaround for ICC 12.0.3 */ if (f == 0) return 1;
 #endif
 
   ;
@@ -9280,16 +9792,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:9283: \"$ac_link\"") >&5
+if { (eval echo "$as_me:9795: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:9286: \$? = $ac_status" >&5
+  echo "$as_me:9798: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:9289: \"$ac_try\"") >&5
+  { (eval echo "$as_me:9801: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:9292: \$? = $ac_status" >&5
+  echo "$as_me:9804: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_func__nc_TABSIZE=yes
 else
@@ -9299,7 +9811,7 @@
 fi
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 fi
-echo "$as_me:9302: result: $ac_cv_func__nc_TABSIZE" >&5
+echo "$as_me:9814: result: $ac_cv_func__nc_TABSIZE" >&5
 echo "${ECHO_T}$ac_cv_func__nc_TABSIZE" >&6
 if test $ac_cv_func__nc_TABSIZE = yes; then
   assume_reentrant=yes
@@ -9311,7 +9823,7 @@
 # opaque outside of that, so there is no --enable-opaque option.  We can use
 # this option without --with-pthreads, but this will be always set for
 # pthreads.
-echo "$as_me:9314: checking if you want experimental reentrant code" >&5
+echo "$as_me:9826: checking if you want experimental reentrant code" >&5
 echo $ECHO_N "checking if you want experimental reentrant code... $ECHO_C" >&6
 
 # Check whether --enable-reentrant or --disable-reentrant was given.
@@ -9321,7 +9833,7 @@
 else
   with_reentrant=$assume_reentrant
 fi;
-echo "$as_me:9324: result: $with_reentrant" >&5
+echo "$as_me:9836: result: $with_reentrant" >&5
 echo "${ECHO_T}$with_reentrant" >&6
 if test "$with_reentrant" = yes ; then
 	cf_cv_enable_reentrant=1
@@ -9333,7 +9845,8 @@
 	elif test "$assume_reentrant" = no ; then
 		LIB_SUFFIX="t${LIB_SUFFIX}"
 	fi
-	cat >>confdefs.h <<\EOF
+
+cat >>confdefs.h <<\EOF
 #define USE_REENTRANT 1
 EOF
 
@@ -9343,7 +9856,7 @@
 
 ### Allow using a different wrap-prefix
 if test "$cf_cv_enable_reentrant" != 0 || test "$BROKEN_LINKER" = 1 ; then
-	echo "$as_me:9346: checking for prefix used to wrap public variables" >&5
+	echo "$as_me:9859: checking for prefix used to wrap public variables" >&5
 echo $ECHO_N "checking for prefix used to wrap public variables... $ECHO_C" >&6
 
 # Check whether --with-wrap-prefix or --without-wrap-prefix was given.
@@ -9353,7 +9866,7 @@
 else
   NCURSES_WRAP_PREFIX=_nc_
 fi;
-	echo "$as_me:9356: result: $NCURSES_WRAP_PREFIX" >&5
+	echo "$as_me:9869: result: $NCURSES_WRAP_PREFIX" >&5
 echo "${ECHO_T}$NCURSES_WRAP_PREFIX" >&6
 else
 	NCURSES_WRAP_PREFIX=_nc_
@@ -9366,26 +9879,46 @@
 ###############################################################################
 
 ###	use option --disable-echo to suppress full display compiling commands
-echo "$as_me:9369: checking if you want to display full commands during build" >&5
-echo $ECHO_N "checking if you want to display full commands during build... $ECHO_C" >&6
+
+echo "$as_me:9883: checking if you want to see long compiling messages" >&5
+echo $ECHO_N "checking if you want to see long compiling messages... $ECHO_C" >&6
 
 # Check whether --enable-echo or --disable-echo was given.
 if test "${enable_echo+set}" = set; then
   enableval="$enable_echo"
-  with_echo=$enableval
+  test "$enableval" != no && enableval=yes
+  if test "$enableval" != "yes" ; then
+
+    ECHO_LT='--silent'
+    ECHO_LD='@echo linking $@;'
+    RULE_CC='@echo compiling $<'
+    SHOW_CC='@echo compiling $@'
+    ECHO_CC='@'
+
+  else
+
+    ECHO_LT=''
+    ECHO_LD=''
+    RULE_CC=''
+    SHOW_CC=''
+    ECHO_CC=''
+
+  fi
 else
-  with_echo=yes
+  enableval=yes
+
+    ECHO_LT=''
+    ECHO_LD=''
+    RULE_CC=''
+    SHOW_CC=''
+    ECHO_CC=''
+
 fi;
-if test "$with_echo" = yes; then
-	ECHO_LINK=
-else
-	ECHO_LINK='@ echo linking $@ ... ;'
-fi
-echo "$as_me:9384: result: $with_echo" >&5
-echo "${ECHO_T}$with_echo" >&6
+echo "$as_me:9917: result: $enableval" >&5
+echo "${ECHO_T}$enableval" >&6
 
 ###	use option --enable-warnings to turn on all gcc warnings
-echo "$as_me:9388: checking if you want to see compiler warnings" >&5
+echo "$as_me:9921: checking if you want to see compiler warnings" >&5
 echo $ECHO_N "checking if you want to see compiler warnings... $ECHO_C" >&6
 
 # Check whether --enable-warnings or --disable-warnings was given.
@@ -9393,7 +9926,7 @@
   enableval="$enable_warnings"
   with_warnings=$enableval
 fi;
-echo "$as_me:9396: result: $with_warnings" >&5
+echo "$as_me:9929: result: $with_warnings" >&5
 echo "${ECHO_T}$with_warnings" >&6
 
 if test "x$with_warnings" = "xyes"; then
@@ -9405,12 +9938,12 @@
 if test "$GCC" = yes ; then
 	case $host_os in
 	linux*|gnu*)
-		echo "$as_me:9408: checking if this is really Intel C compiler" >&5
+		echo "$as_me:9941: checking if this is really Intel C compiler" >&5
 echo $ECHO_N "checking if this is really Intel C compiler... $ECHO_C" >&6
 		cf_save_CFLAGS="$CFLAGS"
 		CFLAGS="$CFLAGS -no-gcc"
 		cat >conftest.$ac_ext <<_ACEOF
-#line 9413 "configure"
+#line 9946 "configure"
 #include "confdefs.h"
 
 int
@@ -9427,16 +9960,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:9430: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:9963: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:9433: \$? = $ac_status" >&5
+  echo "$as_me:9966: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:9436: \"$ac_try\"") >&5
+  { (eval echo "$as_me:9969: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:9439: \$? = $ac_status" >&5
+  echo "$as_me:9972: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   INTEL_COMPILER=yes
 cf_save_CFLAGS="$cf_save_CFLAGS -we147 -no-gcc"
@@ -9447,14 +9980,63 @@
 fi
 rm -f conftest.$ac_objext conftest.$ac_ext
 		CFLAGS="$cf_save_CFLAGS"
-		echo "$as_me:9450: result: $INTEL_COMPILER" >&5
+		echo "$as_me:9983: result: $INTEL_COMPILER" >&5
 echo "${ECHO_T}$INTEL_COMPILER" >&6
 		;;
 	esac
 fi
 
+CLANG_COMPILER=no
+
+if test "$GCC" = yes ; then
+	echo "$as_me:9992: checking if this is really Clang C compiler" >&5
+echo $ECHO_N "checking if this is really Clang C compiler... $ECHO_C" >&6
+	cf_save_CFLAGS="$CFLAGS"
+	CFLAGS="$CFLAGS -Qunused-arguments"
+	cat >conftest.$ac_ext <<_ACEOF
+#line 9997 "configure"
+#include "confdefs.h"
+
+int
+main ()
+{
+
+#ifdef __clang__
+#else
+make an error
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:10014: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:10017: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:10020: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:10023: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  CLANG_COMPILER=yes
+cf_save_CFLAGS="$cf_save_CFLAGS -Qunused-arguments"
+
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+	CFLAGS="$cf_save_CFLAGS"
+	echo "$as_me:10034: result: $CLANG_COMPILER" >&5
+echo "${ECHO_T}$CLANG_COMPILER" >&6
+fi
+
 cat > conftest.$ac_ext <<EOF
-#line 9457 "${as_me:-configure}"
+#line 10039 "${as_me:-configure}"
 int main(int argc, char *argv[]) { return (argv[argc-1] == 0) ; }
 EOF
 
@@ -9471,7 +10053,7 @@
 # remark #981: operands are evaluated in unspecified order
 # warning #279: controlling expression is constant
 
-	{ echo "$as_me:9474: checking for $CC warning options..." >&5
+	{ echo "$as_me:10056: checking for $CC warning options..." >&5
 echo "$as_me: checking for $CC warning options..." >&6;}
 	cf_save_CFLAGS="$CFLAGS"
 	EXTRA_CFLAGS="-Wall"
@@ -9487,12 +10069,12 @@
 		wd981
 	do
 		CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt"
-		if { (eval echo "$as_me:9490: \"$ac_compile\"") >&5
+		if { (eval echo "$as_me:10072: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:9493: \$? = $ac_status" >&5
+  echo "$as_me:10075: \$? = $ac_status" >&5
   (exit $ac_status); }; then
-			test -n "$verbose" && echo "$as_me:9495: result: ... -$cf_opt" >&5
+			test -n "$verbose" && echo "$as_me:10077: result: ... -$cf_opt" >&5
 echo "${ECHO_T}... -$cf_opt" >&6
 			EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt"
 		fi
@@ -9501,7 +10083,7 @@
 
 elif test "$GCC" = yes
 then
-	{ echo "$as_me:9504: checking for $CC warning options..." >&5
+	{ echo "$as_me:10086: checking for $CC warning options..." >&5
 echo "$as_me: checking for $CC warning options..." >&6;}
 	cf_save_CFLAGS="$CFLAGS"
 	EXTRA_CFLAGS=
@@ -9521,12 +10103,12 @@
 		Wundef $cf_warn_CONST Wdeclaration-after-statement Wextra Wno-unknown-pragmas Wswitch-enum
 	do
 		CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt"
-		if { (eval echo "$as_me:9524: \"$ac_compile\"") >&5
+		if { (eval echo "$as_me:10106: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:9527: \$? = $ac_status" >&5
+  echo "$as_me:10109: \$? = $ac_status" >&5
   (exit $ac_status); }; then
-			test -n "$verbose" && echo "$as_me:9529: result: ... -$cf_opt" >&5
+			test -n "$verbose" && echo "$as_me:10111: result: ... -$cf_opt" >&5
 echo "${ECHO_T}... -$cf_opt" >&6
 			case $cf_opt in #(vi
 			Wcast-qual) #(vi
@@ -9537,7 +10119,17 @@
 				[34].*)
 					test -n "$verbose" && echo "	feature is broken in gcc $GCC_VERSION" 1>&6
 
-echo "${as_me:-configure}:9540: testing feature is broken in gcc $GCC_VERSION ..." 1>&5
+echo "${as_me:-configure}:10122: testing feature is broken in gcc $GCC_VERSION ..." 1>&5
+
+					continue;;
+				esac
+				;;
+			Wpointer-arith) #(vi
+				case $GCC_VERSION in
+				[12].*)
+					test -n "$verbose" && echo "	feature is broken in gcc $GCC_VERSION" 1>&6
+
+echo "${as_me:-configure}:10132: testing feature is broken in gcc $GCC_VERSION ..." 1>&5
 
 					continue;;
 				esac
@@ -9570,10 +10162,10 @@
 EOF
 if test "$GCC" = yes
 then
-	{ echo "$as_me:9573: checking for $CC __attribute__ directives..." >&5
+	{ echo "$as_me:10165: checking for $CC __attribute__ directives..." >&5
 echo "$as_me: checking for $CC __attribute__ directives..." >&6;}
 cat > conftest.$ac_ext <<EOF
-#line 9576 "${as_me:-configure}"
+#line 10168 "${as_me:-configure}"
 #include "confdefs.h"
 #include "conftest.h"
 #include "conftest.i"
@@ -9622,36 +10214,60 @@
 			;;
 		esac
 
-		if { (eval echo "$as_me:9625: \"$ac_compile\"") >&5
+		if { (eval echo "$as_me:10217: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:9628: \$? = $ac_status" >&5
+  echo "$as_me:10220: \$? = $ac_status" >&5
   (exit $ac_status); }; then
-			test -n "$verbose" && echo "$as_me:9630: result: ... $cf_attribute" >&5
+			test -n "$verbose" && echo "$as_me:10222: result: ... $cf_attribute" >&5
 echo "${ECHO_T}... $cf_attribute" >&6
 			cat conftest.h >>confdefs.h
 			case $cf_attribute in #(vi
-			printf) #(vi
-				if test "$cf_printf_attribute" = no ; then
-					cat >>confdefs.h <<EOF
-#define GCC_PRINTFLIKE(fmt,var) /* nothing */
+			noreturn) #(vi
+
+cat >>confdefs.h <<EOF
+#define GCC_NORETURN $cf_directive
 EOF
-				else
-					cat >>confdefs.h <<EOF
-#define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var)))
+
+				;;
+			printf) #(vi
+				cf_value='/* nothing */'
+				if test "$cf_printf_attribute" != no ; then
+					cf_value='__attribute__((format(printf,fmt,var)))'
+
+cat >>confdefs.h <<\EOF
+#define GCC_PRINTF 1
 EOF
+
 				fi
+
+cat >>confdefs.h <<EOF
+#define GCC_PRINTFLIKE(fmt,var) $cf_value
+EOF
+
 				;;
 			scanf) #(vi
-				if test "$cf_scanf_attribute" = no ; then
-					cat >>confdefs.h <<EOF
-#define GCC_SCANFLIKE(fmt,var) /* nothing */
-EOF
-				else
-					cat >>confdefs.h <<EOF
-#define GCC_SCANFLIKE(fmt,var)  __attribute__((format(scanf,fmt,var)))
+				cf_value='/* nothing */'
+				if test "$cf_scanf_attribute" != no ; then
+					cf_value='__attribute__((format(scanf,fmt,var)))'
+
+cat >>confdefs.h <<\EOF
+#define GCC_SCANF 1
 EOF
+
 				fi
+
+cat >>confdefs.h <<EOF
+#define GCC_SCANFLIKE(fmt,var) $cf_value
+EOF
+
+				;;
+			unused) #(vi
+
+cat >>confdefs.h <<EOF
+#define GCC_UNUSED $cf_directive
+EOF
+
 				;;
 			esac
 		fi
@@ -9663,7 +10279,7 @@
 fi
 
 ###	use option --enable-assertions to turn on generation of assertion code
-echo "$as_me:9666: checking if you want to enable runtime assertions" >&5
+echo "$as_me:10282: checking if you want to enable runtime assertions" >&5
 echo $ECHO_N "checking if you want to enable runtime assertions... $ECHO_C" >&6
 
 # Check whether --enable-assertions or --disable-assertions was given.
@@ -9673,16 +10289,12 @@
 else
   with_assertions=no
 fi;
-echo "$as_me:9676: result: $with_assertions" >&5
+echo "$as_me:10292: result: $with_assertions" >&5
 echo "${ECHO_T}$with_assertions" >&6
 if test -n "$GCC"
 then
 	if test "$with_assertions" = no
 	then
-		cat >>confdefs.h <<\EOF
-#define NDEBUG 1
-EOF
-
 		CPPFLAGS="$CPPFLAGS -DNDEBUG"
 	else
 
@@ -9692,6 +10304,7 @@
 fi
 
 ###	use option --disable-leaks to suppress "permanent" leaks, for testing
+
 cat >>confdefs.h <<\EOF
 #define HAVE_NC_ALLOC_H 1
 EOF
@@ -9701,7 +10314,8 @@
 # Check whether --enable-expanded or --disable-expanded was given.
 if test "${enable_expanded+set}" = set; then
   enableval="$enable_expanded"
-  test "$enableval" = yes && cat >>confdefs.h <<\EOF
+  test "$enableval" = yes &&
+cat >>confdefs.h <<\EOF
 #define NCURSES_EXPANDED 1
 EOF
 
@@ -9712,7 +10326,8 @@
 # Check whether --enable-macros or --disable-macros was given.
 if test "${enable_macros+set}" = set; then
   enableval="$enable_macros"
-  test "$enableval" = no && cat >>confdefs.h <<\EOF
+  test "$enableval" = no &&
+cat >>confdefs.h <<\EOF
 #define NCURSES_NOMACROS 1
 EOF
 
@@ -9727,7 +10342,7 @@
 	;;
 esac
 
-echo "$as_me:9730: checking whether to add trace feature to all models" >&5
+echo "$as_me:10345: checking whether to add trace feature to all models" >&5
 echo $ECHO_N "checking whether to add trace feature to all models... $ECHO_C" >&6
 
 # Check whether --with-trace or --without-trace was given.
@@ -9737,7 +10352,7 @@
 else
   cf_with_trace=$cf_all_traces
 fi;
-echo "$as_me:9740: result: $cf_with_trace" >&5
+echo "$as_me:10355: result: $cf_with_trace" >&5
 echo "${ECHO_T}$cf_with_trace" >&6
 
 if test "$cf_with_trace" = yes ; then
@@ -9830,13 +10445,13 @@
 *mingw32*) #(vi
 	;;
 *)
-echo "$as_me:9833: checking for gettimeofday" >&5
+echo "$as_me:10448: checking for gettimeofday" >&5
 echo $ECHO_N "checking for gettimeofday... $ECHO_C" >&6
 if test "${ac_cv_func_gettimeofday+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 9839 "configure"
+#line 10454 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char gettimeofday (); below.  */
@@ -9859,7 +10474,7 @@
 #if defined (__stub_gettimeofday) || defined (__stub___gettimeofday)
 choke me
 #else
-f = gettimeofday;
+f = gettimeofday; /* workaround for ICC 12.0.3 */ if (f == 0) return 1;
 #endif
 
   ;
@@ -9867,16 +10482,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:9870: \"$ac_link\"") >&5
+if { (eval echo "$as_me:10485: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:9873: \$? = $ac_status" >&5
+  echo "$as_me:10488: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:9876: \"$ac_try\"") >&5
+  { (eval echo "$as_me:10491: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:9879: \$? = $ac_status" >&5
+  echo "$as_me:10494: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_func_gettimeofday=yes
 else
@@ -9886,7 +10501,7 @@
 fi
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 fi
-echo "$as_me:9889: result: $ac_cv_func_gettimeofday" >&5
+echo "$as_me:10504: result: $ac_cv_func_gettimeofday" >&5
 echo "${ECHO_T}$ac_cv_func_gettimeofday" >&6
 if test $ac_cv_func_gettimeofday = yes; then
   cat >>confdefs.h <<\EOF
@@ -9895,7 +10510,7 @@
 
 else
 
-echo "$as_me:9898: checking for gettimeofday in -lbsd" >&5
+echo "$as_me:10513: checking for gettimeofday in -lbsd" >&5
 echo $ECHO_N "checking for gettimeofday in -lbsd... $ECHO_C" >&6
 if test "${ac_cv_lib_bsd_gettimeofday+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -9903,7 +10518,7 @@
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lbsd  $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
-#line 9906 "configure"
+#line 10521 "configure"
 #include "confdefs.h"
 
 /* Override any gcc2 internal prototype to avoid an error.  */
@@ -9922,16 +10537,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:9925: \"$ac_link\"") >&5
+if { (eval echo "$as_me:10540: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:9928: \$? = $ac_status" >&5
+  echo "$as_me:10543: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:9931: \"$ac_try\"") >&5
+  { (eval echo "$as_me:10546: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:9934: \$? = $ac_status" >&5
+  echo "$as_me:10549: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_lib_bsd_gettimeofday=yes
 else
@@ -9942,10 +10557,11 @@
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-echo "$as_me:9945: result: $ac_cv_lib_bsd_gettimeofday" >&5
+echo "$as_me:10560: result: $ac_cv_lib_bsd_gettimeofday" >&5
 echo "${ECHO_T}$ac_cv_lib_bsd_gettimeofday" >&6
 if test $ac_cv_lib_bsd_gettimeofday = yes; then
-  cat >>confdefs.h <<\EOF
+
+cat >>confdefs.h <<\EOF
 #define HAVE_GETTIMEOFDAY 1
 EOF
 
@@ -9957,13 +10573,13 @@
 esac
 
 ###	Checks for header files.
-echo "$as_me:9960: checking for ANSI C header files" >&5
+echo "$as_me:10576: checking for ANSI C header files" >&5
 echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6
 if test "${ac_cv_header_stdc+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 9966 "configure"
+#line 10582 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 #include <stdarg.h>
@@ -9971,13 +10587,13 @@
 #include <float.h>
 
 _ACEOF
-if { (eval echo "$as_me:9974: \"$ac_cpp conftest.$ac_ext\"") >&5
+if { (eval echo "$as_me:10590: \"$ac_cpp conftest.$ac_ext\"") >&5
   (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
   ac_status=$?
   egrep -v '^ *\+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
-  echo "$as_me:9980: \$? = $ac_status" >&5
+  echo "$as_me:10596: \$? = $ac_status" >&5
   (exit $ac_status); } >/dev/null; then
   if test -s conftest.err; then
     ac_cpp_err=$ac_c_preproc_warn_flag
@@ -9999,7 +10615,7 @@
 if test $ac_cv_header_stdc = yes; then
   # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
   cat >conftest.$ac_ext <<_ACEOF
-#line 10002 "configure"
+#line 10618 "configure"
 #include "confdefs.h"
 #include <string.h>
 
@@ -10017,7 +10633,7 @@
 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 <<_ACEOF
-#line 10020 "configure"
+#line 10636 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 
@@ -10038,7 +10654,7 @@
   :
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 10041 "configure"
+#line 10657 "configure"
 #include "confdefs.h"
 #include <ctype.h>
 #if ((' ' & 0x0FF) == 0x020)
@@ -10064,15 +10680,15 @@
 }
 _ACEOF
 rm -f conftest$ac_exeext
-if { (eval echo "$as_me:10067: \"$ac_link\"") >&5
+if { (eval echo "$as_me:10683: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:10070: \$? = $ac_status" >&5
+  echo "$as_me:10686: \$? = $ac_status" >&5
   (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (eval echo "$as_me:10072: \"$ac_try\"") >&5
+  { (eval echo "$as_me:10688: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:10075: \$? = $ac_status" >&5
+  echo "$as_me:10691: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   :
 else
@@ -10085,7 +10701,7 @@
 fi
 fi
 fi
-echo "$as_me:10088: result: $ac_cv_header_stdc" >&5
+echo "$as_me:10704: result: $ac_cv_header_stdc" >&5
 echo "${ECHO_T}$ac_cv_header_stdc" >&6
 if test $ac_cv_header_stdc = yes; then
 
@@ -10098,13 +10714,13 @@
 ac_header_dirent=no
 for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do
   as_ac_Header=`echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh`
-echo "$as_me:10101: checking for $ac_hdr that defines DIR" >&5
+echo "$as_me:10717: checking for $ac_hdr that defines DIR" >&5
 echo $ECHO_N "checking for $ac_hdr that defines DIR... $ECHO_C" >&6
 if eval "test \"\${$as_ac_Header+set}\" = set"; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 10107 "configure"
+#line 10723 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <$ac_hdr>
@@ -10119,16 +10735,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:10122: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:10738: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:10125: \$? = $ac_status" >&5
+  echo "$as_me:10741: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:10128: \"$ac_try\"") >&5
+  { (eval echo "$as_me:10744: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:10131: \$? = $ac_status" >&5
+  echo "$as_me:10747: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   eval "$as_ac_Header=yes"
 else
@@ -10138,7 +10754,7 @@
 fi
 rm -f conftest.$ac_objext conftest.$ac_ext
 fi
-echo "$as_me:10141: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "$as_me:10757: result: `eval echo '${'$as_ac_Header'}'`" >&5
 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
 if test `eval echo '${'$as_ac_Header'}'` = yes; then
   cat >>confdefs.h <<EOF
@@ -10151,7 +10767,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 "$as_me:10154: checking for opendir in -ldir" >&5
+  echo "$as_me:10770: checking for opendir in -ldir" >&5
 echo $ECHO_N "checking for opendir in -ldir... $ECHO_C" >&6
 if test "${ac_cv_lib_dir_opendir+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -10159,7 +10775,7 @@
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-ldir  $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
-#line 10162 "configure"
+#line 10778 "configure"
 #include "confdefs.h"
 
 /* Override any gcc2 internal prototype to avoid an error.  */
@@ -10178,16 +10794,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:10181: \"$ac_link\"") >&5
+if { (eval echo "$as_me:10797: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:10184: \$? = $ac_status" >&5
+  echo "$as_me:10800: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:10187: \"$ac_try\"") >&5
+  { (eval echo "$as_me:10803: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:10190: \$? = $ac_status" >&5
+  echo "$as_me:10806: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_lib_dir_opendir=yes
 else
@@ -10198,14 +10814,14 @@
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-echo "$as_me:10201: result: $ac_cv_lib_dir_opendir" >&5
+echo "$as_me:10817: result: $ac_cv_lib_dir_opendir" >&5
 echo "${ECHO_T}$ac_cv_lib_dir_opendir" >&6
 if test $ac_cv_lib_dir_opendir = yes; then
   LIBS="$LIBS -ldir"
 fi
 
 else
-  echo "$as_me:10208: checking for opendir in -lx" >&5
+  echo "$as_me:10824: checking for opendir in -lx" >&5
 echo $ECHO_N "checking for opendir in -lx... $ECHO_C" >&6
 if test "${ac_cv_lib_x_opendir+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -10213,7 +10829,7 @@
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lx  $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
-#line 10216 "configure"
+#line 10832 "configure"
 #include "confdefs.h"
 
 /* Override any gcc2 internal prototype to avoid an error.  */
@@ -10232,16 +10848,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:10235: \"$ac_link\"") >&5
+if { (eval echo "$as_me:10851: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:10238: \$? = $ac_status" >&5
+  echo "$as_me:10854: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:10241: \"$ac_try\"") >&5
+  { (eval echo "$as_me:10857: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:10244: \$? = $ac_status" >&5
+  echo "$as_me:10860: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_lib_x_opendir=yes
 else
@@ -10252,7 +10868,7 @@
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-echo "$as_me:10255: result: $ac_cv_lib_x_opendir" >&5
+echo "$as_me:10871: result: $ac_cv_lib_x_opendir" >&5
 echo "${ECHO_T}$ac_cv_lib_x_opendir" >&6
 if test $ac_cv_lib_x_opendir = yes; then
   LIBS="$LIBS -lx"
@@ -10260,13 +10876,13 @@
 
 fi
 
-echo "$as_me:10263: checking whether time.h and sys/time.h may both be included" >&5
+echo "$as_me:10879: checking whether time.h and sys/time.h may both be included" >&5
 echo $ECHO_N "checking whether time.h and sys/time.h may both be included... $ECHO_C" >&6
 if test "${ac_cv_header_time+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 10269 "configure"
+#line 10885 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/time.h>
@@ -10282,16 +10898,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:10285: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:10901: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:10288: \$? = $ac_status" >&5
+  echo "$as_me:10904: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:10291: \"$ac_try\"") >&5
+  { (eval echo "$as_me:10907: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:10294: \$? = $ac_status" >&5
+  echo "$as_me:10910: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_header_time=yes
 else
@@ -10301,7 +10917,7 @@
 fi
 rm -f conftest.$ac_objext conftest.$ac_ext
 fi
-echo "$as_me:10304: result: $ac_cv_header_time" >&5
+echo "$as_me:10920: result: $ac_cv_header_time" >&5
 echo "${ECHO_T}$ac_cv_header_time" >&6
 if test $ac_cv_header_time = yes; then
 
@@ -10319,104 +10935,13 @@
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
 ac_main_return=return
 
-echo "$as_me:10322: checking for $CC option to accept ANSI C" >&5
-echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6
-if test "${ac_cv_prog_cc_stdc+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_cv_prog_cc_stdc=no
-ac_save_CC=$CC
-cat >conftest.$ac_ext <<_ACEOF
-#line 10330 "configure"
-#include "confdefs.h"
-#include <stdarg.h>
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-/* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
-struct buf { int x; };
-FILE * (*rcsopen) (struct buf *, struct stat *, int);
-static char *e (p, i)
-     char **p;
-     int i;
-{
-  return p[i];
-}
-static char *f (char * (*g) (char **, int), char **p, ...)
-{
-  char *s;
-  va_list v;
-  va_start (v,p);
-  s = g (p, va_arg (v,int));
-  va_end (v);
-  return s;
-}
-int test (int i, double x);
-struct s1 {int (*f) (int a);};
-struct s2 {int (*f) (double a);};
-int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
-int argc;
-char **argv;
-int
-main ()
-{
-return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
-  ;
-  return 0;
-}
-_ACEOF
-# Don't try gcc -ansi; that turns off useful extensions and
-# breaks some systems' header files.
-# AIX			-qlanglvl=ansi
-# Ultrix and OSF/1	-std1
-# HP-UX 10.20 and later	-Ae
-# HP-UX older versions	-Aa -D_HPUX_SOURCE
-# SVR4			-Xc -D__EXTENSIONS__
-for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
-do
-  CC="$ac_save_CC $ac_arg"
-  rm -f conftest.$ac_objext
-if { (eval echo "$as_me:10379: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
-  ac_status=$?
-  echo "$as_me:10382: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:10385: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:10388: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_prog_cc_stdc=$ac_arg
-break
-else
-  echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
-fi
-rm -f conftest.$ac_objext
-done
-rm -f conftest.$ac_ext conftest.$ac_objext
-CC=$ac_save_CC
-
-fi
-
-case "x$ac_cv_prog_cc_stdc" in
-  x|xno)
-    echo "$as_me:10405: result: none needed" >&5
-echo "${ECHO_T}none needed" >&6 ;;
-  *)
-    echo "$as_me:10408: result: $ac_cv_prog_cc_stdc" >&5
-echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6
-    CC="$CC $ac_cv_prog_cc_stdc" ;;
-esac
-
-echo "$as_me:10413: checking for an ANSI C-conforming const" >&5
+echo "$as_me:10938: checking for an ANSI C-conforming const" >&5
 echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6
 if test "${ac_cv_c_const+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 10419 "configure"
+#line 10944 "configure"
 #include "confdefs.h"
 
 int
@@ -10474,16 +10999,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:10477: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:11002: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:10480: \$? = $ac_status" >&5
+  echo "$as_me:11005: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:10483: \"$ac_try\"") >&5
+  { (eval echo "$as_me:11008: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:10486: \$? = $ac_status" >&5
+  echo "$as_me:11011: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_c_const=yes
 else
@@ -10493,7 +11018,7 @@
 fi
 rm -f conftest.$ac_objext conftest.$ac_ext
 fi
-echo "$as_me:10496: result: $ac_cv_c_const" >&5
+echo "$as_me:11021: result: $ac_cv_c_const" >&5
 echo "${ECHO_T}$ac_cv_c_const" >&6
 if test $ac_cv_c_const = no; then
 
@@ -10505,7 +11030,7 @@
 
 ###	Checks for external-data
 
-echo "$as_me:10508: checking if data-only library module links" >&5
+echo "$as_me:11033: checking if data-only library module links" >&5
 echo $ECHO_N "checking if data-only library module links... $ECHO_C" >&6
 if test "${cf_cv_link_dataonly+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -10513,20 +11038,20 @@
 
 	rm -f conftest.a
 	cat >conftest.$ac_ext <<EOF
-#line 10516 "configure"
+#line 11041 "configure"
 int	testdata[3] = { 123, 456, 789 };
 EOF
-	if { (eval echo "$as_me:10519: \"$ac_compile\"") >&5
+	if { (eval echo "$as_me:11044: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:10522: \$? = $ac_status" >&5
+  echo "$as_me:11047: \$? = $ac_status" >&5
   (exit $ac_status); } ; then
 		mv conftest.o data.o && \
 		( $AR $ARFLAGS conftest.a data.o ) 2>&5 1>/dev/null
 	fi
 	rm -f conftest.$ac_ext data.o
 	cat >conftest.$ac_ext <<EOF
-#line 10529 "configure"
+#line 11054 "configure"
 int	testfunc()
 {
 #if defined(NeXT)
@@ -10539,10 +11064,10 @@
 #endif
 }
 EOF
-	if { (eval echo "$as_me:10542: \"$ac_compile\"") >&5
+	if { (eval echo "$as_me:11067: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:10545: \$? = $ac_status" >&5
+  echo "$as_me:11070: \$? = $ac_status" >&5
   (exit $ac_status); }; then
 		mv conftest.o func.o && \
 		( $AR $ARFLAGS conftest.a func.o ) 2>&5 1>/dev/null
@@ -10555,7 +11080,7 @@
   cf_cv_link_dataonly=unknown
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 10558 "configure"
+#line 11083 "configure"
 #include "confdefs.h"
 
 	int main()
@@ -10566,15 +11091,15 @@
 
 _ACEOF
 rm -f conftest$ac_exeext
-if { (eval echo "$as_me:10569: \"$ac_link\"") >&5
+if { (eval echo "$as_me:11094: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:10572: \$? = $ac_status" >&5
+  echo "$as_me:11097: \$? = $ac_status" >&5
   (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (eval echo "$as_me:10574: \"$ac_try\"") >&5
+  { (eval echo "$as_me:11099: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:10577: \$? = $ac_status" >&5
+  echo "$as_me:11102: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   cf_cv_link_dataonly=yes
 else
@@ -10589,11 +11114,12 @@
 
 fi
 
-echo "$as_me:10592: result: $cf_cv_link_dataonly" >&5
+echo "$as_me:11117: result: $cf_cv_link_dataonly" >&5
 echo "${ECHO_T}$cf_cv_link_dataonly" >&6
 
 if test "$cf_cv_link_dataonly" = no ; then
-	cat >>confdefs.h <<\EOF
+
+cat >>confdefs.h <<\EOF
 #define BROKEN_LINKER 1
 EOF
 
@@ -10602,7 +11128,7 @@
 
 ###	Checks for library functions.
 
-echo "$as_me:10605: checking for working mkstemp" >&5
+echo "$as_me:11131: checking for working mkstemp" >&5
 echo $ECHO_N "checking for working mkstemp... $ECHO_C" >&6
 if test "${cf_cv_func_mkstemp+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -10610,68 +11136,10 @@
 
 rm -rf conftest*
 if test "$cross_compiling" = yes; then
-  echo "$as_me:10613: checking for mkstemp" >&5
-echo $ECHO_N "checking for mkstemp... $ECHO_C" >&6
-if test "${ac_cv_func_mkstemp+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-#line 10619 "configure"
-#include "confdefs.h"
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char mkstemp (); below.  */
-#include <assert.h>
-/* Override any gcc2 internal prototype to avoid an error.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
-char mkstemp ();
-char (*f) ();
-
-int
-main ()
-{
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined (__stub_mkstemp) || defined (__stub___mkstemp)
-choke me
-#else
-f = mkstemp;
-#endif
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:10650: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
-  ac_status=$?
-  echo "$as_me:10653: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:10656: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:10659: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_func_mkstemp=yes
-else
-  echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
-ac_cv_func_mkstemp=no
-fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
-fi
-echo "$as_me:10669: result: $ac_cv_func_mkstemp" >&5
-echo "${ECHO_T}$ac_cv_func_mkstemp" >&6
-
+  cf_cv_func_mkstemp=maybe
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 10674 "configure"
+#line 11142 "configure"
 #include "confdefs.h"
 
 #include <sys/types.h>
@@ -10709,15 +11177,15 @@
 
 _ACEOF
 rm -f conftest$ac_exeext
-if { (eval echo "$as_me:10712: \"$ac_link\"") >&5
+if { (eval echo "$as_me:11180: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:10715: \$? = $ac_status" >&5
+  echo "$as_me:11183: \$? = $ac_status" >&5
   (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (eval echo "$as_me:10717: \"$ac_try\"") >&5
+  { (eval echo "$as_me:11185: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:10720: \$? = $ac_status" >&5
+  echo "$as_me:11188: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   cf_cv_func_mkstemp=yes
 
@@ -10732,80 +11200,89 @@
 fi
 
 fi
-echo "$as_me:10735: result: $cf_cv_func_mkstemp" >&5
+echo "$as_me:11203: result: $cf_cv_func_mkstemp" >&5
 echo "${ECHO_T}$cf_cv_func_mkstemp" >&6
-if test "x$cf_cv_func_mkstemp" = xyes || test "x$ac_cv_func_mkstemp" = xyes ; then
-	cat >>confdefs.h <<\EOF
-#define HAVE_MKSTEMP 1
-EOF
-
-fi
-
-echo "$as_me:10744: checking return type of signal handlers" >&5
-echo $ECHO_N "checking return type of signal handlers... $ECHO_C" >&6
-if test "${ac_cv_type_signal+set}" = set; then
+if test "x$cf_cv_func_mkstemp" = xmaybe ; then
+	echo "$as_me:11206: checking for mkstemp" >&5
+echo $ECHO_N "checking for mkstemp... $ECHO_C" >&6
+if test "${ac_cv_func_mkstemp+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 10750 "configure"
+#line 11212 "configure"
 #include "confdefs.h"
-#include <sys/types.h>
-#include <signal.h>
-#ifdef signal
-# undef signal
-#endif
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char mkstemp (); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
 #ifdef __cplusplus
-extern "C" void (*signal (int, void (*)(int)))(int);
-#else
-void (*signal ()) ();
+extern "C"
 #endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char mkstemp ();
+char (*f) ();
 
 int
 main ()
 {
-int i;
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_mkstemp) || defined (__stub___mkstemp)
+choke me
+#else
+f = mkstemp; /* workaround for ICC 12.0.3 */ if (f == 0) return 1;
+#endif
+
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:10772: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:11243: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:10775: \$? = $ac_status" >&5
+  echo "$as_me:11246: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:10778: \"$ac_try\"") >&5
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:11249: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:10781: \$? = $ac_status" >&5
+  echo "$as_me:11252: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_type_signal=void
+  ac_cv_func_mkstemp=yes
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-ac_cv_type_signal=int
+ac_cv_func_mkstemp=no
 fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 fi
-echo "$as_me:10791: result: $ac_cv_type_signal" >&5
-echo "${ECHO_T}$ac_cv_type_signal" >&6
+echo "$as_me:11262: result: $ac_cv_func_mkstemp" >&5
+echo "${ECHO_T}$ac_cv_func_mkstemp" >&6
 
-cat >>confdefs.h <<EOF
-#define RETSIGTYPE $ac_cv_type_signal
+fi
+if test "x$cf_cv_func_mkstemp" = xyes || test "x$ac_cv_func_mkstemp" = xyes ; then
+
+cat >>confdefs.h <<\EOF
+#define HAVE_MKSTEMP 1
 EOF
 
+fi
+
 if test -z "$cf_user_CFLAGS" && test "$with_no_leaks" = no ; then
 	CFLAGS=`echo ${CFLAGS} | sed -e 's%-g %%' -e 's%-g$%%'`
 	CXXFLAGS=`echo ${CXXFLAGS} | sed -e 's%-g %%' -e 's%-g$%%'`
 fi
 
+cf_with_ada=yes
 if test "$cf_with_ada" != "no" ; then
 
 cf_ada_make=gnatmake
 # Extract the first word of "$cf_ada_make", so it can be a program name with args.
 set dummy $cf_ada_make; ac_word=$2
-echo "$as_me:10808: checking for $ac_word" >&5
+echo "$as_me:11285: checking for $ac_word" >&5
 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
 if test "${ac_cv_prog_gnat_exists+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -10820,7 +11297,7 @@
   test -z "$ac_dir" && ac_dir=.
   $as_executable_p "$ac_dir/$ac_word" || continue
 ac_cv_prog_gnat_exists="yes"
-echo "$as_me:10823: found $ac_dir/$ac_word" >&5
+echo "$as_me:11300: found $ac_dir/$ac_word" >&5
 break
 done
 
@@ -10829,31 +11306,32 @@
 fi
 gnat_exists=$ac_cv_prog_gnat_exists
 if test -n "$gnat_exists"; then
-  echo "$as_me:10832: result: $gnat_exists" >&5
+  echo "$as_me:11309: result: $gnat_exists" >&5
 echo "${ECHO_T}$gnat_exists" >&6
 else
-  echo "$as_me:10835: result: no" >&5
+  echo "$as_me:11312: result: no" >&5
 echo "${ECHO_T}no" >&6
 fi
 
 if test "$ac_cv_prog_gnat_exists" = no; then
    cf_ada_make=
+   cf_cv_prog_gnat_correct=no
 else
 
-echo "$as_me:10843: checking for gnat version" >&5
+echo "$as_me:11321: checking for gnat version" >&5
 echo $ECHO_N "checking for gnat version... $ECHO_C" >&6
 cf_gnat_version=`${cf_ada_make:-gnatmake} -v 2>&1 | \
 	grep '[0-9].[0-9][0-9]*' |\
     sed -e '2,$d' -e 's/[^0-9 \.]//g' -e 's/^[ ]*//' -e 's/ .*//'`
-echo "$as_me:10848: result: $cf_gnat_version" >&5
+echo "$as_me:11326: result: $cf_gnat_version" >&5
 echo "${ECHO_T}$cf_gnat_version" >&6
 
 case $cf_gnat_version in #(vi
-3.1[1-9]*|3.[2-9]*|[4-9].*) #(vi
+3.1[1-9]*|3.[2-9]*|[4-9].*|20[0-9][0-9]) #(vi
 	cf_cv_prog_gnat_correct=yes
 	;;
 *)
-	{ echo "$as_me:10856: WARNING: Unsupported GNAT version $cf_gnat_version. We require 3.11 or better. Disabling Ada95 binding." >&5
+	{ echo "$as_me:11334: WARNING: Unsupported GNAT version $cf_gnat_version. We require 3.11 or better. Disabling Ada95 binding." >&5
 echo "$as_me: WARNING: Unsupported GNAT version $cf_gnat_version. We require 3.11 or better. Disabling Ada95 binding." >&2;}
 	cf_cv_prog_gnat_correct=no
 	;;
@@ -10861,7 +11339,7 @@
 
    # Extract the first word of "m4", so it can be a program name with args.
 set dummy m4; ac_word=$2
-echo "$as_me:10864: checking for $ac_word" >&5
+echo "$as_me:11342: checking for $ac_word" >&5
 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
 if test "${ac_cv_prog_M4_exists+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -10876,7 +11354,7 @@
   test -z "$ac_dir" && ac_dir=.
   $as_executable_p "$ac_dir/$ac_word" || continue
 ac_cv_prog_M4_exists="yes"
-echo "$as_me:10879: found $ac_dir/$ac_word" >&5
+echo "$as_me:11357: found $ac_dir/$ac_word" >&5
 break
 done
 
@@ -10885,10 +11363,10 @@
 fi
 M4_exists=$ac_cv_prog_M4_exists
 if test -n "$M4_exists"; then
-  echo "$as_me:10888: result: $M4_exists" >&5
+  echo "$as_me:11366: result: $M4_exists" >&5
 echo "${ECHO_T}$M4_exists" >&6
 else
-  echo "$as_me:10891: result: no" >&5
+  echo "$as_me:11369: result: no" >&5
 echo "${ECHO_T}no" >&6
 fi
 
@@ -10897,7 +11375,7 @@
       echo Ada95 binding required program m4 not found. Ada95 binding disabled.
    fi
    if test "$cf_cv_prog_gnat_correct" = yes; then
-      echo "$as_me:10900: checking if GNAT works" >&5
+      echo "$as_me:11378: checking if GNAT works" >&5
 echo $ECHO_N "checking if GNAT works... $ECHO_C" >&6
 
 rm -rf conftest* *~conftest*
@@ -10925,30 +11403,34 @@
 fi
 rm -rf conftest* *~conftest*
 
-      echo "$as_me:10928: result: $cf_cv_prog_gnat_correct" >&5
+      echo "$as_me:11406: result: $cf_cv_prog_gnat_correct" >&5
 echo "${ECHO_T}$cf_cv_prog_gnat_correct" >&6
    fi
 fi
 
 	if test	"$cf_cv_prog_gnat_correct" = yes; then
 
-		# make ADAFLAGS consistent with CFLAGS
-		case "$CFLAGS" in
-		*-g*)
+	echo "$as_me:11413: checking optimization options for ADAFLAGS" >&5
+echo $ECHO_N "checking optimization options for ADAFLAGS... $ECHO_C" >&6
+	case "$CFLAGS" in
+	*-g*)
 
  	ADAFLAGS="$ADAFLAGS -g"
 
-			;;
-		esac
-		case "$CFLAGS" in
-		*-O*)
+		;;
+	esac
+	case "$CFLAGS" in
+	*-O*)
+		cf_O_flag=`echo "$CFLAGS" |sed -e 's/^.*-O/-O/' -e 's/[ 	].*//'`
 
- 	ADAFLAGS="$ADAFLAGS -O3"
+ 	ADAFLAGS="$ADAFLAGS $cf_O_flag"
 
-			;;
-		esac
+		;;
+	esac
+	echo "$as_me:11430: result: $ADAFLAGS" >&5
+echo "${ECHO_T}$ADAFLAGS" >&6
 
-echo "$as_me:10951: checking if GNAT supports generics" >&5
+echo "$as_me:11433: checking if GNAT supports generics" >&5
 echo $ECHO_N "checking if GNAT supports generics... $ECHO_C" >&6
 case $cf_gnat_version in #(vi
 3.[1-9]*|[4-9].*) #(vi
@@ -10958,7 +11440,7 @@
 	cf_gnat_generics=no
 	;;
 esac
-echo "$as_me:10961: result: $cf_gnat_generics" >&5
+echo "$as_me:11443: result: $cf_gnat_generics" >&5
 echo "${ECHO_T}$cf_gnat_generics" >&6
 
 if test "$cf_gnat_generics" = yes
@@ -10970,7 +11452,7 @@
 	cf_generic_objects=
 fi
 
-echo "$as_me:10973: checking if GNAT supports SIGINT" >&5
+echo "$as_me:11455: checking if GNAT supports SIGINT" >&5
 echo $ECHO_N "checking if GNAT supports SIGINT... $ECHO_C" >&6
 if test "${cf_cv_gnat_sigint+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -11018,7 +11500,7 @@
 rm -rf conftest* *~conftest*
 
 fi
-echo "$as_me:11021: result: $cf_cv_gnat_sigint" >&5
+echo "$as_me:11503: result: $cf_cv_gnat_sigint" >&5
 echo "${ECHO_T}$cf_cv_gnat_sigint" >&6
 
 if test $cf_cv_gnat_sigint = yes ; then
@@ -11027,7 +11509,7 @@
 	USE_GNAT_SIGINT="#"
 fi
 
-echo "$as_me:11030: checking if GNAT pragma Unreferenced works" >&5
+echo "$as_me:11512: checking if GNAT pragma Unreferenced works" >&5
 echo $ECHO_N "checking if GNAT pragma Unreferenced works... $ECHO_C" >&6
 if test "${cf_cv_pragma_unreferenced+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -11058,7 +11540,7 @@
 rm -rf conftest* *~conftest*
 
 fi
-echo "$as_me:11061: result: $cf_cv_pragma_unreferenced" >&5
+echo "$as_me:11543: result: $cf_cv_pragma_unreferenced" >&5
 echo "${ECHO_T}$cf_cv_pragma_unreferenced" >&6
 
 # if the pragma is supported, use it (needed in the Trace code).
@@ -11071,7 +11553,7 @@
 cf_gnat_libraries=no
 cf_gnat_projects=no
 
-echo "$as_me:11074: checking if GNAT supports project files" >&5
+echo "$as_me:11556: checking if GNAT supports project files" >&5
 echo $ECHO_N "checking if GNAT supports project files... $ECHO_C" >&6
 case $cf_gnat_version in #(vi
 3.[0-9]*) #(vi
@@ -11139,14 +11621,14 @@
 	esac
 	;;
 esac
-echo "$as_me:11142: result: $cf_gnat_projects" >&5
+echo "$as_me:11624: result: $cf_gnat_projects" >&5
 echo "${ECHO_T}$cf_gnat_projects" >&6
 
 if test $cf_gnat_projects = yes
 then
-	echo "$as_me:11147: checking if GNAT supports libraries" >&5
+	echo "$as_me:11629: checking if GNAT supports libraries" >&5
 echo $ECHO_N "checking if GNAT supports libraries... $ECHO_C" >&6
-	echo "$as_me:11149: result: $cf_gnat_libraries" >&5
+	echo "$as_me:11631: result: $cf_gnat_libraries" >&5
 echo "${ECHO_T}$cf_gnat_libraries" >&6
 fi
 
@@ -11166,7 +11648,7 @@
 	USE_GNAT_LIBRARIES="#"
 fi
 
-echo "$as_me:11169: checking for ada-compiler" >&5
+echo "$as_me:11651: checking for ada-compiler" >&5
 echo $ECHO_N "checking for ada-compiler... $ECHO_C" >&6
 
 # Check whether --with-ada-compiler or --without-ada-compiler was given.
@@ -11177,12 +11659,12 @@
   cf_ada_compiler=gnatmake
 fi;
 
-echo "$as_me:11180: result: $cf_ada_compiler" >&5
+echo "$as_me:11662: result: $cf_ada_compiler" >&5
 echo "${ECHO_T}$cf_ada_compiler" >&6
 
 		cf_ada_package=terminal_interface
 
-echo "$as_me:11185: checking for ada-include" >&5
+echo "$as_me:11667: checking for ada-include" >&5
 echo $ECHO_N "checking for ada-include... $ECHO_C" >&6
 
 # Check whether --with-ada-include or --without-ada-include was given.
@@ -11206,7 +11688,7 @@
   ;;
 .[a-zA-Z]:[\\/]*) #(vi OS/2 EMX
   ;;
-.\${*prefix}*) #(vi
+.\${*prefix}*|.\${*dir}*) #(vi
   eval withval="$withval"
   case ".$withval" in #(vi
   .NONE/*)
@@ -11218,19 +11700,19 @@
   withval=`echo $withval | sed -e s%NONE%$cf_path_syntax%`
   ;;
 *)
-  { { echo "$as_me:11221: error: expected a pathname, not \"$withval\"" >&5
+  { { echo "$as_me:11703: error: expected a pathname, not \"$withval\"" >&5
 echo "$as_me: error: expected a pathname, not \"$withval\"" >&2;}
    { (exit 1); exit 1; }; }
   ;;
 esac
 
 fi
-ADA_INCLUDE="$withval"
+eval ADA_INCLUDE="$withval"
 
-echo "$as_me:11230: result: $ADA_INCLUDE" >&5
+echo "$as_me:11712: result: $ADA_INCLUDE" >&5
 echo "${ECHO_T}$ADA_INCLUDE" >&6
 
-echo "$as_me:11233: checking for ada-objects" >&5
+echo "$as_me:11715: checking for ada-objects" >&5
 echo $ECHO_N "checking for ada-objects... $ECHO_C" >&6
 
 # Check whether --with-ada-objects or --without-ada-objects was given.
@@ -11254,7 +11736,7 @@
   ;;
 .[a-zA-Z]:[\\/]*) #(vi OS/2 EMX
   ;;
-.\${*prefix}*) #(vi
+.\${*prefix}*|.\${*dir}*) #(vi
   eval withval="$withval"
   case ".$withval" in #(vi
   .NONE/*)
@@ -11266,19 +11748,19 @@
   withval=`echo $withval | sed -e s%NONE%$cf_path_syntax%`
   ;;
 *)
-  { { echo "$as_me:11269: error: expected a pathname, not \"$withval\"" >&5
+  { { echo "$as_me:11751: error: expected a pathname, not \"$withval\"" >&5
 echo "$as_me: error: expected a pathname, not \"$withval\"" >&2;}
    { (exit 1); exit 1; }; }
   ;;
 esac
 
 fi
-ADA_OBJECTS="$withval"
+eval ADA_OBJECTS="$withval"
 
-echo "$as_me:11278: result: $ADA_OBJECTS" >&5
+echo "$as_me:11760: result: $ADA_OBJECTS" >&5
 echo "${ECHO_T}$ADA_OBJECTS" >&6
 
-echo "$as_me:11281: checking if an Ada95 shared-library should be built" >&5
+echo "$as_me:11763: checking if an Ada95 shared-library should be built" >&5
 echo $ECHO_N "checking if an Ada95 shared-library should be built... $ECHO_C" >&6
 
 # Check whether --with-ada-sharedlib or --without-ada-sharedlib was given.
@@ -11288,7 +11770,7 @@
 else
   with_ada_sharedlib=no
 fi;
-echo "$as_me:11291: result: $with_ada_sharedlib" >&5
+echo "$as_me:11773: result: $with_ada_sharedlib" >&5
 echo "${ECHO_T}$with_ada_sharedlib" >&6
 
 ADA_SHAREDLIB='lib$(LIB_NAME).so.1'
@@ -11304,12 +11786,12 @@
 fi
 
 	else
-		{ { echo "$as_me:11307: error: No usable Ada compiler found" >&5
+		{ { echo "$as_me:11789: error: No usable Ada compiler found" >&5
 echo "$as_me: error: No usable Ada compiler found" >&2;}
    { (exit 1); exit 1; }; }
 	fi
 else
-	{ { echo "$as_me:11312: error: The Ada compiler is needed for this package" >&5
+	{ { echo "$as_me:11794: error: The Ada compiler is needed for this package" >&5
 echo "$as_me: error: The Ada compiler is needed for this package" >&2;}
    { (exit 1); exit 1; }; }
 fi
@@ -11317,25 +11799,27 @@
 ################################################################################
 
 # not needed
-TINFO_ARGS2=
+TINFO_LDFLAGS2=
+
+TINFO_LIBS=
 
 ### Construct the list of include-directories to be generated
 
-CPPFLAGS="$CPPFLAGS -I. -I../include"
-if test "$srcdir" != "."; then
-	CPPFLAGS="$CPPFLAGS -I\${srcdir}/../include"
-fi
 if test "$GCC" != yes; then
-	CPPFLAGS="$CPPFLAGS -I\${includedir}"
+	CPPFLAGS="-I\${includedir} $CPPFLAGS"
 elif test "$includedir" != "/usr/include"; then
 	if test "$includedir" = '${prefix}/include' ; then
 		if test $prefix != /usr ; then
-			CPPFLAGS="$CPPFLAGS -I\${includedir}"
+			CPPFLAGS="-I\${includedir} $CPPFLAGS"
 		fi
 	else
-		CPPFLAGS="$CPPFLAGS -I\${includedir}"
+		CPPFLAGS="-I\${includedir} $CPPFLAGS"
 	fi
 fi
+if test "$srcdir" != "."; then
+	CPPFLAGS="-I\${srcdir}/../include $CPPFLAGS"
+fi
+CPPFLAGS="-I. -I../include $CPPFLAGS"
 
 ACPPFLAGS="-I. -I../include -I../../include $ACPPFLAGS"
 if test "$srcdir" != "."; then
@@ -11354,7 +11838,7 @@
 fi
 
 ### Build up pieces for makefile rules
-echo "$as_me:11357: checking default library suffix" >&5
+echo "$as_me:11841: checking default library suffix" >&5
 echo $ECHO_N "checking default library suffix... $ECHO_C" >&6
 
 	case $DFT_LWR_MODEL in
@@ -11365,10 +11849,10 @@
 	shared)  DFT_ARG_SUFFIX=''   ;;
 	esac
 	test -n "$LIB_SUFFIX" && DFT_ARG_SUFFIX="${LIB_SUFFIX}${DFT_ARG_SUFFIX}"
-echo "$as_me:11368: result: $DFT_ARG_SUFFIX" >&5
+echo "$as_me:11852: result: $DFT_ARG_SUFFIX" >&5
 echo "${ECHO_T}$DFT_ARG_SUFFIX" >&6
 
-echo "$as_me:11371: checking default library-dependency suffix" >&5
+echo "$as_me:11855: checking default library-dependency suffix" >&5
 echo $ECHO_N "checking default library-dependency suffix... $ECHO_C" >&6
 
 	case $DFT_LWR_MODEL in #(vi
@@ -11390,11 +11874,11 @@
 		;;
 	shared) #(vi
 		case $cf_cv_system_name in
-		aix[56]*) #(vi
+		aix[5-7]*) #(vi
 			DFT_LIB_SUFFIX='.a'
 			DFT_DEP_SUFFIX=$DFT_LIB_SUFFIX
 			;;
-		cygwin*) #(vi
+		cygwin*|mingw*) #(vi
 			DFT_LIB_SUFFIX='.dll'
 			DFT_DEP_SUFFIX='.dll.a'
 			;;
@@ -11421,10 +11905,10 @@
 	esac
 	test -n "$LIB_SUFFIX" && DFT_LIB_SUFFIX="${LIB_SUFFIX}${DFT_LIB_SUFFIX}"
 	test -n "$LIB_SUFFIX" && DFT_DEP_SUFFIX="${LIB_SUFFIX}${DFT_DEP_SUFFIX}"
-echo "$as_me:11424: result: $DFT_DEP_SUFFIX" >&5
+echo "$as_me:11908: result: $DFT_DEP_SUFFIX" >&5
 echo "${ECHO_T}$DFT_DEP_SUFFIX" >&6
 
-echo "$as_me:11427: checking default object directory" >&5
+echo "$as_me:11911: checking default object directory" >&5
 echo $ECHO_N "checking default object directory... $ECHO_C" >&6
 
 	case $DFT_LWR_MODEL in
@@ -11440,7 +11924,7 @@
 			DFT_OBJ_SUBDIR='obj_s' ;;
 		esac
 	esac
-echo "$as_me:11443: result: $DFT_OBJ_SUBDIR" >&5
+echo "$as_me:11927: result: $DFT_OBJ_SUBDIR" >&5
 echo "${ECHO_T}$DFT_OBJ_SUBDIR" >&6
 
 ### Set up low-level terminfo dependencies for makefiles.
@@ -11656,7 +12140,7 @@
 : ${CONFIG_STATUS=./config.status}
 ac_clean_files_save=$ac_clean_files
 ac_clean_files="$ac_clean_files $CONFIG_STATUS"
-{ echo "$as_me:11659: creating $CONFIG_STATUS" >&5
+{ echo "$as_me:12143: creating $CONFIG_STATUS" >&5
 echo "$as_me: creating $CONFIG_STATUS" >&6;}
 cat >$CONFIG_STATUS <<_ACEOF
 #! $SHELL
@@ -11788,7 +12272,7 @@
 cat >>$CONFIG_STATUS <<EOF
 ac_cs_version="\\
 config.status
-configured by $0, generated by GNU Autoconf 2.52.20101002,
+configured by $0, generated by GNU Autoconf 2.52.20121002,
   with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
 
 Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001
@@ -11832,7 +12316,7 @@
     echo "$ac_cs_version"; exit 0 ;;
   --he | --h)
     # Conflict between --help and --header
-    { { echo "$as_me:11835: error: ambiguous option: $1
+    { { echo "$as_me:12319: error: ambiguous option: $1
 Try \`$0 --help' for more information." >&5
 echo "$as_me: error: ambiguous option: $1
 Try \`$0 --help' for more information." >&2;}
@@ -11851,7 +12335,7 @@
     ac_need_defaults=false;;
 
   # This is an error.
-  -*) { { echo "$as_me:11854: error: unrecognized option: $1
+  -*) { { echo "$as_me:12338: error: unrecognized option: $1
 Try \`$0 --help' for more information." >&5
 echo "$as_me: error: unrecognized option: $1
 Try \`$0 --help' for more information." >&2;}
@@ -11870,7 +12354,7 @@
 ## Running config.status.  ##
 ## ----------------------- ##
 
-This file was extended by $as_me 2.52.20101002, executed with
+This file was extended by $as_me 2.52.20121002, executed with
   CONFIG_FILES    = $CONFIG_FILES
   CONFIG_HEADERS  = $CONFIG_HEADERS
   CONFIG_LINKS    = $CONFIG_LINKS
@@ -11892,8 +12376,8 @@
 AWK="$AWK"
 DFT_ARG_SUFFIX="$DFT_ARG_SUFFIX"
 DFT_LWR_MODEL="$DFT_LWR_MODEL"
-ECHO_LINK="$ECHO_LINK"
 LIB_NAME="$LIB_NAME"
+LIB_PREFIX="$LIB_PREFIX"
 LIB_SUFFIX="$LIB_SUFFIX"
 LN_S="$LN_S"
 NCURSES_MAJOR="$NCURSES_MAJOR"
@@ -11922,7 +12406,7 @@
   "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;;
   "default" ) CONFIG_COMMANDS="$CONFIG_COMMANDS default" ;;
   "include/ncurses_cfg.h" ) CONFIG_HEADERS="$CONFIG_HEADERS include/ncurses_cfg.h:include/ncurses_cfg.hin" ;;
-  *) { { echo "$as_me:11925: error: invalid argument: $ac_config_target" >&5
+  *) { { echo "$as_me:12409: error: invalid argument: $ac_config_target" >&5
 echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
    { (exit 1); exit 1; }; };;
   esac
@@ -11981,6 +12465,7 @@
 s,@bindir@,$bindir,;t t
 s,@sbindir@,$sbindir,;t t
 s,@libexecdir@,$libexecdir,;t t
+s,@datarootdir@,$datarootdir,;t t
 s,@datadir@,$datadir,;t t
 s,@sysconfdir@,$sysconfdir,;t t
 s,@sharedstatedir@,$sharedstatedir,;t t
@@ -12024,9 +12509,8 @@
 s,@ac_ct_CC@,$ac_ct_CC,;t t
 s,@EXEEXT@,$EXEEXT,;t t
 s,@OBJEXT@,$OBJEXT,;t t
-s,@CPP@,$CPP,;t t
 s,@EXTRA_CPPFLAGS@,$EXTRA_CPPFLAGS,;t t
-s,@PROG_EXT@,$PROG_EXT,;t t
+s,@CPP@,$CPP,;t t
 s,@AWK@,$AWK,;t t
 s,@EGREP@,$EGREP,;t t
 s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t
@@ -12061,6 +12545,7 @@
 s,@DFT_LWR_MODEL@,$DFT_LWR_MODEL,;t t
 s,@DFT_UPR_MODEL@,$DFT_UPR_MODEL,;t t
 s,@NCURSES_CONFIG@,$NCURSES_CONFIG,;t t
+s,@ac_ct_NCURSES_CONFIG@,$ac_ct_NCURSES_CONFIG,;t t
 s,@NCURSES_MAJOR@,$NCURSES_MAJOR,;t t
 s,@NCURSES_MINOR@,$NCURSES_MINOR,;t t
 s,@NCURSES_PATCH@,$NCURSES_PATCH,;t t
@@ -12083,13 +12568,18 @@
 s,@LOCAL_LDFLAGS@,$LOCAL_LDFLAGS,;t t
 s,@LOCAL_LDFLAGS2@,$LOCAL_LDFLAGS2,;t t
 s,@INSTALL_LIB@,$INSTALL_LIB,;t t
+s,@RPATH_LIST@,$RPATH_LIST,;t t
 s,@BROKEN_LINKER@,$BROKEN_LINKER,;t t
 s,@NCURSES_EXT_FUNCS@,$NCURSES_EXT_FUNCS,;t t
 s,@NCURSES_CONST@,$NCURSES_CONST,;t t
 s,@PTHREAD@,$PTHREAD,;t t
 s,@cf_cv_enable_reentrant@,$cf_cv_enable_reentrant,;t t
 s,@NCURSES_WRAP_PREFIX@,$NCURSES_WRAP_PREFIX,;t t
-s,@ECHO_LINK@,$ECHO_LINK,;t t
+s,@ECHO_LT@,$ECHO_LT,;t t
+s,@ECHO_LD@,$ECHO_LD,;t t
+s,@RULE_CC@,$RULE_CC,;t t
+s,@SHOW_CC@,$SHOW_CC,;t t
+s,@ECHO_CC@,$ECHO_CC,;t t
 s,@ADAFLAGS@,$ADAFLAGS,;t t
 s,@EXTRA_CFLAGS@,$EXTRA_CFLAGS,;t t
 s,@ADA_TRACE@,$ADA_TRACE,;t t
@@ -12109,7 +12599,8 @@
 s,@ADA_OBJECTS@,$ADA_OBJECTS,;t t
 s,@ADA_SHAREDLIB@,$ADA_SHAREDLIB,;t t
 s,@MAKE_ADA_SHAREDLIB@,$MAKE_ADA_SHAREDLIB,;t t
-s,@TINFO_ARGS2@,$TINFO_ARGS2,;t t
+s,@TINFO_LDFLAGS2@,$TINFO_LDFLAGS2,;t t
+s,@TINFO_LIBS@,$TINFO_LIBS,;t t
 s,@ACPPFLAGS@,$ACPPFLAGS,;t t
 s,@DFT_ARG_SUFFIX@,$DFT_ARG_SUFFIX,;t t
 s,@DFT_DEP_SUFFIX@,$DFT_DEP_SUFFIX,;t t
@@ -12237,7 +12728,7 @@
   esac
 
   if test x"$ac_file" != x-; then
-    { echo "$as_me:12240: creating $ac_file" >&5
+    { echo "$as_me:12731: creating $ac_file" >&5
 echo "$as_me: creating $ac_file" >&6;}
     rm -f "$ac_file"
   fi
@@ -12255,7 +12746,7 @@
       -) echo $tmp/stdin ;;
       [\\/$]*)
          # Absolute (can't be DOS-style, as IFS=:)
-         test -f "$f" || { { echo "$as_me:12258: error: cannot find input file: $f" >&5
+         test -f "$f" || { { echo "$as_me:12749: error: cannot find input file: $f" >&5
 echo "$as_me: error: cannot find input file: $f" >&2;}
    { (exit 1); exit 1; }; }
          echo $f;;
@@ -12268,13 +12759,45 @@
            echo $srcdir/$f
          else
            # /dev/null tree
-           { { echo "$as_me:12271: error: cannot find input file: $f" >&5
+           { { echo "$as_me:12762: error: cannot find input file: $f" >&5
 echo "$as_me: error: cannot find input file: $f" >&2;}
    { (exit 1); exit 1; }; }
          fi;;
       esac
     done` || { (exit 1); exit 1; }
 EOF
+cat >>$CONFIG_STATUS <<\EOF
+  ac_warn_datarootdir=no
+  if test x"$ac_file" != x-; then
+    for ac_item in $ac_file_inputs
+    do
+      ac_seen=`grep '@\(datadir\|mandir\|infodir\)@' $ac_item`
+      if test -n "$ac_seen"; then
+        ac_used=`grep '@datarootdir@' $ac_item`
+        if test -z "$ac_used"; then
+          { echo "$as_me:12778: WARNING: datarootdir was used implicitly but not set:
+$ac_seen" >&5
+echo "$as_me: WARNING: datarootdir was used implicitly but not set:
+$ac_seen" >&2;}
+          ac_warn_datarootdir=yes
+        fi
+      fi
+      ac_seen=`grep '${datarootdir}' $ac_item`
+      if test -n "$ac_seen"; then
+        { echo "$as_me:12787: WARNING: datarootdir was used explicitly but not set:
+$ac_seen" >&5
+echo "$as_me: WARNING: datarootdir was used explicitly but not set:
+$ac_seen" >&2;}
+        ac_warn_datarootdir=yes
+      fi
+    done
+  fi
+
+if test "x$ac_warn_datarootdir" = xyes; then
+  ac_sed_cmds="$ac_sed_cmds | sed -e 's,@datarootdir@,\${prefix}/share,g' -e 's,\${datarootdir},\${prefix}/share,g'"
+fi
+
+EOF
 cat >>$CONFIG_STATUS <<EOF
   sed "$ac_vpsub
 $extrasub
@@ -12289,11 +12812,35 @@
 " $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out
   rm -f $tmp/stdin
   if test x"$ac_file" != x-; then
-    mv $tmp/out $ac_file
+    cp $tmp/out $ac_file
+
+    for ac_name in prefix exec_prefix datarootdir
+    do
+        ac_seen=`fgrep -n '${'$ac_name'[:=].*}' $ac_file`
+        if test -n "$ac_seen"; then
+            ac_init=`egrep '[ 	]*'$ac_name'[ 	]*=' $ac_file`
+            if test -z "$ac_init"; then
+              ac_seen=`echo "$ac_seen" |sed -e 's,^,'$ac_file':,'`
+              { echo "$as_me:12824: WARNING: Variable $ac_name is used but was not set:
+$ac_seen" >&5
+echo "$as_me: WARNING: Variable $ac_name is used but was not set:
+$ac_seen" >&2;}
+            fi
+        fi
+    done
+    egrep -n '@[a-z_][a-z_0-9]+@' $ac_file >$tmp/out
+    egrep -n '@[A-Z_][A-Z_0-9]+@' $ac_file >>$tmp/out
+    if test -s $tmp/out; then
+      ac_seen=`sed -e 's,^,'$ac_file':,' < $tmp/out`
+      { echo "$as_me:12835: WARNING: Some variables may not be substituted:
+$ac_seen" >&5
+echo "$as_me: WARNING: Some variables may not be substituted:
+$ac_seen" >&2;}
+    fi
   else
     cat $tmp/out
-    rm -f $tmp/out
   fi
+  rm -f $tmp/out
 
 done
 EOF
@@ -12334,7 +12881,7 @@
   * )   ac_file_in=$ac_file.in ;;
   esac
 
-  test x"$ac_file" != x- && { echo "$as_me:12337: creating $ac_file" >&5
+  test x"$ac_file" != x- && { echo "$as_me:12884: creating $ac_file" >&5
 echo "$as_me: creating $ac_file" >&6;}
 
   # First look for the input files in the build tree, otherwise in the
@@ -12345,7 +12892,7 @@
       -) echo $tmp/stdin ;;
       [\\/$]*)
          # Absolute (can't be DOS-style, as IFS=:)
-         test -f "$f" || { { echo "$as_me:12348: error: cannot find input file: $f" >&5
+         test -f "$f" || { { echo "$as_me:12895: error: cannot find input file: $f" >&5
 echo "$as_me: error: cannot find input file: $f" >&2;}
    { (exit 1); exit 1; }; }
          echo $f;;
@@ -12358,7 +12905,7 @@
            echo $srcdir/$f
          else
            # /dev/null tree
-           { { echo "$as_me:12361: error: cannot find input file: $f" >&5
+           { { echo "$as_me:12908: error: cannot find input file: $f" >&5
 echo "$as_me: error: cannot find input file: $f" >&2;}
    { (exit 1); exit 1; }; }
          fi;;
@@ -12416,7 +12963,7 @@
   rm -f $tmp/in
   if test x"$ac_file" != x-; then
     if cmp -s $ac_file $tmp/config.h 2>/dev/null; then
-      { echo "$as_me:12419: $ac_file is unchanged" >&5
+      { echo "$as_me:12966: $ac_file is unchanged" >&5
 echo "$as_me: $ac_file is unchanged" >&6;}
     else
       ac_dir=`$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
Index: Ada95/configure.in
Prereq:  1.30 
--- ncurses-5.9/Ada95/configure.in	2011-03-31 22:49:22.000000000 +0000
+++ ncurses-5.9-20130504/Ada95/configure.in	2013-04-27 19:50:17.000000000 +0000
@@ -1,5 +1,5 @@
 dnl***************************************************************************
-dnl Copyright (c) 2010,2011 Free Software Foundation, Inc.                   *
+dnl Copyright (c) 2010-2012,2013 Free Software Foundation, Inc.              *
 dnl                                                                          *
 dnl Permission is hereby granted, free of charge, to any person obtaining a  *
 dnl copy of this software and associated documentation files (the            *
@@ -28,24 +28,20 @@
 dnl
 dnl Author: Thomas E. Dickey
 dnl
-dnl $Id: configure.in,v 1.30 2011/03/31 22:49:22 tom Exp $
+dnl $Id: configure.in,v 1.47 2013/04/27 19:50:17 tom Exp $
 dnl Process this file with autoconf to produce a configure script.
 dnl
 dnl See http://invisible-island.net/autoconf/ for additional information.
 dnl
 dnl ---------------------------------------------------------------------------
-AC_PREREQ(2.13.20020210)
-AC_REVISION($Revision: 1.30 $)
+AC_PREREQ(2.52.20030208)
+AC_REVISION($Revision: 1.47 $)
 AC_INIT(gen/gen.c)
 AC_CONFIG_HEADER(include/ncurses_cfg.h:include/ncurses_cfg.hin)
 
 CF_TOP_BUILDDIR
 
-CF_CHECK_CACHE([AC_CANONICAL_SYSTEM])
-AC_ARG_WITH(system-type,
-[  --with-system-type=XXX  test: override derived host system-type],
-[AC_MSG_WARN(overriding system type to $withval)
- cf_cv_system_name=$withval])
+CF_WITH_SYSTYPE
 
 ###	Save the given $CFLAGS to allow user-override.
 cf_user_CFLAGS="$CFLAGS"
@@ -54,15 +50,10 @@
 CF_CFG_DEFAULTS
 
 ###	Checks for programs.
-AC_PROG_CC
-CF_GCC_VERSION
-
+CF_PROG_CC(gnatgcc gcc cc)
 AC_PROG_CPP
 AC_PROG_GCC_TRADITIONAL
 CF_PROG_CC_C_O(CC)
-AC_ISC_POSIX
-CF_ANSI_CC_REQD
-CF_PROG_EXT
 
 AC_ARG_PROGRAM
 
@@ -75,28 +66,8 @@
 
 # if we find pkg-config, check if we should install the ".pc" files.
 CF_PKG_CONFIG
-
-if test "$PKG_CONFIG" != none ; then
-	AC_MSG_CHECKING(if we should install .pc files for $PKG_CONFIG)
-
-	# Leave this as something that can be overridden in the environment.
-	if test -z "$PKG_CONFIG_LIBDIR" ; then
-		PKG_CONFIG_LIBDIR=`echo "$PKG_CONFIG" | sed -e 's,/[[^/]]*/[[^/]]*$,,'`/lib/pkgconfig
-	fi
-	PKG_CONFIG_LIBDIR=`echo "$PKG_CONFIG_LIBDIR" | sed -e 's/^://' -e 's/:.*//'`
-	if test -n "$PKG_CONFIG_LIBDIR" && test -d "$PKG_CONFIG_LIBDIR" ; then
-		AC_ARG_ENABLE(pc-files,
-			[  --enable-pc-files       generate and install .pc files for pkg-config],
-			[enable_pc_files=$enableval],
-			[enable_pc_files=no])
-		AC_MSG_RESULT($enable_pc_files)
-	else
-		AC_MSG_RESULT(no)
-		AC_MSG_WARN(did not find library $PKG_CONFIG_LIBDIR)
-		enable_pc_files=no
-	fi
-fi
-AC_SUBST(PKG_CONFIG_LIBDIR)
+CF_WITH_PKG_CONFIG_LIBDIR
+CF_ENABLE_PC_FILES
 
 AC_MSG_CHECKING(if you want to build test-programs)
 AC_ARG_WITH(tests,
@@ -130,6 +101,7 @@
 AC_CHECK_TOOL(LD, ld, ld)
 AC_CHECK_TOOL(AR, ar, ar)
 CF_AR_FLAGS
+CF_PATHSEP
 
 dnl Special option for use by system-builders: the install-prefix is used to
 dnl adjust the location into which the actual install is done, so that an
@@ -186,9 +158,7 @@
 
 CF_NCURSES_ADDON
 
-CF_LIB_PREFIX(cf_prefix)
-LIB_PREFIX=$cf_prefix
-AC_SUBST(LIB_PREFIX)
+CF_WITH_LIB_PREFIX(cf_prefix)
 
 LIB_SUFFIX=
 AC_SUBST(LIB_SUFFIX)
@@ -235,8 +205,6 @@
 ###############################################################################
 CF_HELP_MESSAGE(Fine-Tuning Your Configuration:)
 
-CF_PATHSEP
-
 ###   use option --enable-broken-linker to force on use of broken-linker support
 AC_MSG_CHECKING(if you want broken-linker support code)
 AC_ARG_ENABLE(broken_linker,
@@ -272,7 +240,7 @@
 	[with_rcs_ids=$withval],
 	[with_rcs_ids=no])
 AC_MSG_RESULT($with_rcs_ids)
-test "$with_rcs_ids" = yes && AC_DEFINE(USE_RCS_IDS)
+test "$with_rcs_ids" = yes && AC_DEFINE(USE_RCS_IDS,1,[Define to 1 if RCS identifiers should be compiled-in)])
 
 ###############################################################################
 CF_HELP_MESSAGE(Extensions:)
@@ -286,8 +254,8 @@
 AC_MSG_RESULT($with_ext_funcs)
 if test "$with_ext_funcs" = yes ; then
 	NCURSES_EXT_FUNCS=1
-	AC_DEFINE(HAVE_USE_DEFAULT_COLORS)
-	AC_DEFINE(NCURSES_EXT_FUNCS)
+	AC_DEFINE(HAVE_USE_DEFAULT_COLORS,1,[Define to 1 if we have use_default_colors function])
+	AC_DEFINE(NCURSES_EXT_FUNCS,1,[Define to 1 if we have ncurses extended functions])
 else
 	NCURSES_EXT_FUNCS=0
 fi
@@ -337,12 +305,12 @@
 fi
 
 if test $cf_cv_weak_symbols = yes ; then
-    AC_DEFINE(USE_WEAK_SYMBOLS)
+    AC_DEFINE(USE_WEAK_SYMBOLS,1,[Define to 1 to enable weak-symbols for pthreads])
 fi
 
 PTHREAD=
 if test "$with_pthread" = "yes" ; then
-    AC_DEFINE(USE_PTHREADS)
+    AC_DEFINE(USE_PTHREADS,1,[Define to 1 to use the pthreads library])
     enable_reentrant=yes
     if test $cf_cv_weak_symbols = yes ; then
         PTHREAD=-lpthread
@@ -370,7 +338,7 @@
 	elif test "$assume_reentrant" = no ; then
 		LIB_SUFFIX="t${LIB_SUFFIX}"
 	fi
-	AC_DEFINE(USE_REENTRANT)
+	AC_DEFINE(USE_REENTRANT,1,[Define to 1 to compile with experimental reentrant code])
 else
 	cf_cv_enable_reentrant=0
 fi
@@ -388,24 +356,13 @@
 	NCURSES_WRAP_PREFIX=_nc_
 fi
 AC_SUBST(NCURSES_WRAP_PREFIX)
-AC_DEFINE_UNQUOTED(NCURSES_WRAP_PREFIX,"$NCURSES_WRAP_PREFIX")
+AC_DEFINE_UNQUOTED(NCURSES_WRAP_PREFIX,"$NCURSES_WRAP_PREFIX",[Define to override _nc_ ncurses internal prefix])
 
 ###############################################################################
 CF_HELP_MESSAGE(Testing/development Options:)
 
 ###	use option --disable-echo to suppress full display compiling commands
-AC_MSG_CHECKING(if you want to display full commands during build)
-AC_ARG_ENABLE(echo,
-	[  --enable-echo           build: display "compiling" commands (default)],
-	[with_echo=$enableval],
-	[with_echo=yes])
-if test "$with_echo" = yes; then
-	ECHO_LINK=
-else
-	ECHO_LINK='@ echo linking $@ ... ;'
-fi
-AC_MSG_RESULT($with_echo)
-AC_SUBST(ECHO_LINK)
+CF_DISABLE_ECHO
 
 ###	use option --enable-warnings to turn on all gcc warnings
 AC_MSG_CHECKING(if you want to see compiler warnings)
@@ -431,7 +388,6 @@
 then
 	if test "$with_assertions" = no
 	then
-		AC_DEFINE(NDEBUG)
 		CPPFLAGS="$CPPFLAGS -DNDEBUG"
 	else
 		CF_ADD_ADAFLAGS(-gnata)
@@ -439,17 +395,17 @@
 fi
 
 ###	use option --disable-leaks to suppress "permanent" leaks, for testing
-AC_DEFINE(HAVE_NC_ALLOC_H)
+AC_DEFINE(HAVE_NC_ALLOC_H,1,[Define to 1 if we have nc_alloc.h header])
 
 ###	use option --enable-expanded to generate certain macros as functions
 AC_ARG_ENABLE(expanded,
 	[  --enable-expanded       test: generate functions for certain macros],
-	[test "$enableval" = yes && AC_DEFINE(NCURSES_EXPANDED)])
+	[test "$enableval" = yes && AC_DEFINE(NCURSES_EXPANDED,1,[Define to 1 if ncurses macros should be expanded as functions])])
 
 ###	use option --disable-macros to suppress macros in favor of functions
 AC_ARG_ENABLE(macros,
 	[  --disable-macros        test: use functions rather than macros],
-	[test "$enableval" = no && AC_DEFINE(NCURSES_NOMACROS)])
+	[test "$enableval" = no && AC_DEFINE(NCURSES_NOMACROS,1,[Define to 1 if ncurses macros should be expanded as functions])])
 
 # Normally we only add trace() to the debug-library.  Allow this to be
 # extended to all models of the ncurses library:
@@ -485,7 +441,7 @@
 	AC_DEFINE(HAVE_GETTIMEOFDAY),[
 
 AC_CHECK_LIB(bsd, gettimeofday,
-	AC_DEFINE(HAVE_GETTIMEOFDAY)
+	AC_DEFINE(HAVE_GETTIMEOFDAY,1,[Define to 1 if we have gettimeofday])
 	LIBS="$LIBS -lbsd")])dnl CLIX: bzero, select, gettimeofday
 	;;
 esac
@@ -505,8 +461,6 @@
 ###	Checks for library functions.
 CF_MKSTEMP
 
-AC_TYPE_SIGNAL
-
 dnl We'll do our own -g libraries, unless the user's overridden via $CFLAGS
 if test -z "$cf_user_CFLAGS" && test "$with_no_leaks" = no ; then
 	CF_STRIP_G_OPT(CFLAGS)
@@ -514,24 +468,13 @@
 fi
 
 CF_HELP_MESSAGE(Ada95 Binding Options:)
-
+cf_with_ada=yes
 dnl Check for availability of GNU Ada Translator (GNAT).
 dnl At the moment we support no other Ada95 compiler.
 if test "$cf_with_ada" != "no" ; then
 	CF_PROG_GNAT
 	if test	"$cf_cv_prog_gnat_correct" = yes; then
-
-		# make ADAFLAGS consistent with CFLAGS
-		case "$CFLAGS" in
-		*-g*)
-			CF_ADD_ADAFLAGS(-g)
-			;;
-		esac
-		case "$CFLAGS" in
-		*-O*)
-			CF_ADD_ADAFLAGS(-O3)
-			;;
-		esac
+		CF_FIXUP_ADAFLAGS
 
 		CF_GNAT_GENERICS
 		CF_GNAT_SIGINT
@@ -556,8 +499,10 @@
 ################################################################################
 
 # not needed
-TINFO_ARGS2=
-AC_SUBST(TINFO_ARGS2)
+TINFO_LDFLAGS2=
+AC_SUBST(TINFO_LDFLAGS2)
+TINFO_LIBS=
+AC_SUBST(TINFO_LIBS)
 
 ### Construct the list of include-directories to be generated
 CF_INCLUDE_DIRS
@@ -594,7 +539,7 @@
 
 SUB_MAKEFILES="gen/adacurses${DFT_ARG_SUFFIX}-config:gen/adacurses-config.in"
 
-AC_DEFINE_UNQUOTED(NCURSES_PATHSEP,'$PATH_SEPARATOR')
+AC_DEFINE_UNQUOTED(NCURSES_PATHSEP,'$PATH_SEPARATOR',[Define to override ':' as the library path-separator])
 
 ### Now that we're done running tests, add the compiler-warnings, if any
 CF_ADD_CFLAGS($EXTRA_CFLAGS)
@@ -656,8 +601,8 @@
 AWK="$AWK"
 DFT_ARG_SUFFIX="$DFT_ARG_SUFFIX"
 DFT_LWR_MODEL="$DFT_LWR_MODEL"
-ECHO_LINK="$ECHO_LINK"
 LIB_NAME="$LIB_NAME"
+LIB_PREFIX="$LIB_PREFIX"
 LIB_SUFFIX="$LIB_SUFFIX"
 LN_S="$LN_S"
 NCURSES_MAJOR="$NCURSES_MAJOR"
Index: Ada95/doc/Makefile.in
Prereq:  1.2 
--- ncurses-5.9/Ada95/doc/Makefile.in	2011-03-26 19:26:17.000000000 +0000
+++ ncurses-5.9-20130504/Ada95/doc/Makefile.in	2012-08-11 21:31:56.000000000 +0000
@@ -1,4 +1,4 @@
-# $Id: Makefile.in,v 1.2 2011/03/26 19:26:17 tom Exp $
+# $Id: Makefile.in,v 1.3 2012/08/11 21:31:56 tom Exp $
 ##############################################################################
 # Copyright (c) 2011 Free Software Foundation, Inc.                          #
 #                                                                            #
@@ -38,6 +38,7 @@
 srcdir		= @srcdir@
 prefix		= @prefix@
 exec_prefix	= @exec_prefix@
+datarootdir	= @datarootdir@
 datadir		= @datadir@
 mandir		= @mandir@
 
Index: Ada95/gen/Makefile.in
Prereq:  1.74 
--- ncurses-5.9/Ada95/gen/Makefile.in	2011-03-26 23:36:30.000000000 +0000
+++ ncurses-5.9-20130504/Ada95/gen/Makefile.in	2012-10-06 18:58:48.000000000 +0000
@@ -1,5 +1,5 @@
 ##############################################################################
-# Copyright (c) 1998-2010,2011 Free Software Foundation, Inc.                #
+# Copyright (c) 1998-2011,2012 Free Software Foundation, Inc.                #
 #                                                                            #
 # Permission is hereby granted, free of charge, to any person obtaining a    #
 # copy of this software and associated documentation files (the "Software"), #
@@ -28,7 +28,7 @@
 #
 #  Author:  Juergen Pfeifer, 1996
 #
-#  $Id: Makefile.in,v 1.74 2011/03/26 23:36:30 tom Exp $
+#  $Id: Makefile.in,v 1.77 2012/10/06 18:58:48 tom Exp $
 #
 .SUFFIXES:
 
@@ -36,7 +36,7 @@
 VPATH		= @srcdir@
 THIS		= Makefile
 
-x		= @PROG_EXT@
+x		= @EXEEXT@
 
 top_srcdir	= @top_srcdir@
 DESTDIR		= @DESTDIR@
@@ -73,7 +73,7 @@
 LOCAL_LIBDIR	= @top_builddir@/lib
 
 LINK		= $(HOST_CC)
-LD_FLAGS	= @LD_MODEL@ $(LOCAL_LIBS) @LDFLAGS@ @LIBS@ @LOCAL_LDFLAGS2@ $(LDFLAGS) @TINFO_ARGS2@
+LD_FLAGS	= @LD_MODEL@ $(LOCAL_LIBS) @TINFO_LDFLAGS2@ @LDFLAGS@ @LIBS@ @LOCAL_LDFLAGS2@ $(LDFLAGS) @TINFO_LIBS@
 
 RANLIB		= @RANLIB@
 
@@ -179,7 +179,7 @@
 	-rm -f $(DESTDIR)$(bindir)/$(ADACURSES_CONFIG)
 
 $(PROG_GENERATE):  gen.o
-	@ECHO_LINK@ $(LINK) $(CFLAGS_NORMAL) gen.o $(LD_FLAGS) -o $@
+	@ECHO_LD@ $(LINK) $(CFLAGS_NORMAL) gen.o $(LD_FLAGS) -o $@
 
 gen.o:	$(srcdir)/gen.c
 	$(HOST_CC) $(CFLAGS_NORMAL) -c -o $@ $(srcdir)/gen.c
@@ -411,7 +411,7 @@
 	@mkdir -p $(HTML_DIR)
 	cp -p ../src/*.ad[sb] . && chmod +w *.ad[sb]
 @USE_OLD_MAKERULES@	ln -sf ../src/*.ali .
-@USE_GNAT_PROJECTS@	ln -sf ../static-ali/*.ali .	
+@USE_GNAT_PROJECTS@	ln -sf ../static-ali/*.ali .
 	@echo "Filtering generated files"
 	@for f in $(GEN_SRC); do \
 	   h=`basename $$f` ;\
Index: Ada95/gen/gen.c
Prereq:  1.59 
--- ncurses-5.9/Ada95/gen/gen.c	2011-03-31 23:50:24.000000000 +0000
+++ ncurses-5.9-20130504/Ada95/gen/gen.c	2011-04-30 19:47:19.000000000 +0000
@@ -32,7 +32,7 @@
 
 /*
     Version Control
-    $Id: gen.c,v 1.59 2011/03/31 23:50:24 tom Exp $
+    $Id: gen.c,v 1.60 2011/04/30 19:47:19 Nicolas.Boulenguez Exp $
   --------------------------------------------------------------------------*/
 /*
   This program generates various record structures and constants from the
@@ -124,19 +124,15 @@
 	  int len,		/* size of the record in bytes          */
 	  int bias)
 {
-  const char *unused_name = "Unused";
-  int long_bits = (8 * (int)sizeof(unsigned long));
-  int len_bits = (8 * len);
-  int i, j, n, l, cnt = 0, low, high;
+  const int len_bits = (8 * len);
+  int i, l, low, high;
   int width = strlen(RES_NAME) + 3;
   unsigned long a;
-  unsigned long mask = 0;
 
   assert(nap != NULL);
 
   for (i = 0; nap[i].name != (char *)0; i++)
     {
-      cnt++;
       l = (int)strlen(nap[i].name);
       if (l > width)
 	width = l;
@@ -147,32 +143,8 @@
   printf("      record\n");
   for (i = 0; nap[i].name != (char *)0; i++)
     {
-      mask |= nap[i].attr;
       printf("         %-*s : Boolean;\n", width, nap[i].name);
     }
-
-  /*
-   * Compute a mask for the unused bits in this target.
-   */
-  mask = ~mask;
-  /*
-   * Bits in the biased area are unused by the target.
-   */
-  for (j = 0; j < bias; ++j)
-    {
-      mask &= (unsigned long)(~(1L << j));
-    }
-  /*
-   * Bits past the target's size are really unused.
-   */
-  for (j = len_bits + bias; j < long_bits; ++j)
-    {
-      mask &= (unsigned long)(~(1L << j));
-    }
-  if (mask != 0)
-    {
-      printf("         %-*s : Boolean;\n", width, unused_name);
-    }
   printf("      end record;\n");
   printf("   pragma Convention (C, %s);\n\n", name);
 
@@ -187,17 +159,10 @@
 	printf("         %-*s at 0 range %2d .. %2d;\n", width, nap[i].name,
 	       low - bias, high - bias);
     }
-  if (mask != 0)
-    {
-      l = find_pos((char *)&mask, sizeof(mask), &low, &high);
-      if (l >= 0)
-	printf("         %-*s at 0 range %2d .. %2d;\n", width, unused_name,
-	       low - bias, high - bias);
-    }
-  i = 1;
-  n = cnt;
   printf("      end record;\n");
+  printf("   pragma Warnings (Off);");
   printf("   for %s'Size use %d;\n", name, len_bits);
+  printf("   pragma Warnings (On);\n");
   printf("   --  Please note: this rep. clause is generated and may be\n");
   printf("   --               different on your system.");
 }
Index: Ada95/include/ncurses_defs
Prereq:  1.41 
--- ncurses-5.9/Ada95/include/ncurses_defs	2008-11-16 00:19:59.000000000 +0000
+++ ncurses-5.9-20130504/Ada95/include/ncurses_defs	2013-04-27 19:50:17.000000000 +0000
@@ -1,6 +1,6 @@
-# $Id: ncurses_defs,v 1.41 2008/11/16 00:19:59 juergen Exp $
+# $Id: ncurses_defs,v 1.44 2013/04/27 19:50:17 tom Exp $
 ##############################################################################
-# Copyright (c) 2000-2007,2008 Free Software Foundation, Inc.                #
+# Copyright (c) 2000-2012,2013 Free Software Foundation, Inc.                #
 #                                                                            #
 # Permission is hereby granted, free of charge, to any person obtaining a    #
 # copy of this software and associated documentation files (the "Software"), #
@@ -33,7 +33,6 @@
 
 BROKEN_LINKER
 BSD_TPUTS
-CC_HAS_PROTOS
 CPP_HAS_PARAM_INIT
 CURSES_ACS_ARRAY	acs_map
 CURSES_WACS_ARRAY	_nc_wacs
@@ -120,7 +119,6 @@
 HAVE_SIZECHANGE
 HAVE_SLK_COLOR
 HAVE_SLK_INIT	1
-HAVE_STRDUP
 HAVE_STRSTR
 HAVE_SYMLINK
 HAVE_SYS_BSDTYPES_H
@@ -174,7 +172,6 @@
 NEED_PTEM_H
 NO_LEAKS
 PURE_TERMINFO
-RETSIGTYPE
 STDC_HEADERS
 SVR4_ACTION
 SVR4_TERMIO
Index: Ada95/samples/Makefile.in
Prereq:  1.46 
--- ncurses-5.9/Ada95/samples/Makefile.in	2011-03-28 23:45:08.000000000 +0000
+++ ncurses-5.9-20130504/Ada95/samples/Makefile.in	2012-10-06 19:00:42.000000000 +0000
@@ -1,5 +1,5 @@
 ##############################################################################
-# Copyright (c) 1998-2010,2011 Free Software Foundation, Inc.                #
+# Copyright (c) 1998-2011,2012 Free Software Foundation, Inc.                #
 #                                                                            #
 # Permission is hereby granted, free of charge, to any person obtaining a    #
 # copy of this software and associated documentation files (the "Software"), #
@@ -28,7 +28,7 @@
 #
 #  Author:  Juergen Pfeifer, 1996
 #
-#  $Id: Makefile.in,v 1.46 2011/03/28 23:45:08 tom Exp $
+#  $Id: Makefile.in,v 1.48 2012/10/06 19:00:42 tom Exp $
 #
 .SUFFIXES:
 
@@ -36,12 +36,13 @@
 VPATH		= @srcdir@
 THIS		= Makefile
 
-x		= @PROG_EXT@
+x		= @EXEEXT@
 
 srcdir		= @srcdir@
 prefix		= @prefix@
 exec_prefix	= @exec_prefix@
 bindir		= @bindir@
+datarootdir	= @datarootdir@
 datadir		= @datadir@
 libdir		= @libdir@
 includedir	= @includedir@
Index: Ada95/src/Makefile.in
Prereq:  1.60 
--- ncurses-5.9/Ada95/src/Makefile.in	2011-03-31 09:46:16.000000000 +0000
+++ ncurses-5.9-20130504/Ada95/src/Makefile.in	2011-04-30 22:24:45.000000000 +0000
@@ -28,7 +28,7 @@
 #
 #  Author:  Juergen Pfeifer, 1996
 #
-#  $Id: Makefile.in,v 1.60 2011/03/31 09:46:16 tom Exp $
+#  $Id: Makefile.in,v 1.62 2011/04/30 22:24:45 tom Exp $
 #
 .SUFFIXES:
 
@@ -218,7 +218,9 @@
 	$(ADAPREP) -DADA_TRACE=@ADA_TRACE@ -DPRAGMA_UNREF=@PRAGMA_UNREF@ $(srcdir)/$(ABASE)-trace.adb_p $@
 
 ###############################################################################
-C_OBJS	= c_varargs_to_ada.o ncurses_compat.o
+# Use these definitions when building a shared library.
+SHARED_C_OBJS	= c_varargs_to_ada.o ncurses_compat.o
+SHARED_OBJS 	= $(SHARED_C_OBJS) @USE_OLD_MAKERULES@$(LIBOBJS) @cf_generic_objects@
 
 c_varargs_to_ada.o :	$(srcdir)/c_varargs_to_ada.c
 	$(CC) $(CFLAGS_DEFAULT) -c -o $@ $(srcdir)/c_varargs_to_ada.c
@@ -227,13 +229,22 @@
 	$(CC) $(CFLAGS_DEFAULT) -c -o $@ $(srcdir)/ncurses_compat.c
 
 ###############################################################################
+# Use these definitions when building a static library.
+STATIC_C_OBJS	= static_c_varargs_to_ada.o static_ncurses_compat.o
+STATIC_OBJS 	= $(STATIC_C_OBJS) @USE_OLD_MAKERULES@$(LIBOBJS) @cf_generic_objects@
 
-MIXED_OBJS = $(C_OBJS) @USE_OLD_MAKERULES@$(LIBOBJS) @cf_generic_objects@
+static_c_varargs_to_ada.o :	$(srcdir)/c_varargs_to_ada.c
+	$(CC) $(CFLAGS_NORMAL) -c -o $@ $(srcdir)/c_varargs_to_ada.c
+
+static_ncurses_compat.o :	$(srcdir)/ncurses_compat.c
+	$(CC) $(CFLAGS_NORMAL) -c -o $@ $(srcdir)/ncurses_compat.c
+
+###############################################################################
 
 @USE_OLD_MAKERULES@$(BUILD_DIR_LIB)/$(STATIC_LIBNAME) :: \
 @USE_OLD_MAKERULES@		$(BUILD_DIR_LIB) \
-@USE_OLD_MAKERULES@		$(MIXED_OBJS)
-@USE_OLD_MAKERULES@	$(AR) $(ARFLAGS) $@ $(MIXED_OBJS)
+@USE_OLD_MAKERULES@		$(STATIC_OBJS)
+@USE_OLD_MAKERULES@	$(AR) $(ARFLAGS) $@ $(STATIC_OBJS)
 
 $(BUILD_DIR)/static-ali : ; mkdir -p $@
 $(BUILD_DIR)/static-obj : ; mkdir -p $@
@@ -245,10 +256,10 @@
 
 @USE_GNAT_PROJECTS@$(BUILD_DIR_LIB)/$(STATIC_LIBNAME) :: \
 @USE_GNAT_PROJECTS@		$(ABASE)-trace.adb \
-@USE_GNAT_PROJECTS@		$(C_OBJS) \
+@USE_GNAT_PROJECTS@		$(STATIC_C_OBJS) \
 @USE_GNAT_PROJECTS@		$(STATIC_DIRS)
 @USE_GNAT_PROJECTS@	$(ADAMAKE) $(ADAMAKEFLAGS) -XLIB_KIND=static
-@USE_GNAT_PROJECTS@	$(AR) $(ARFLAGS) $@ $(C_OBJS)
+@USE_GNAT_PROJECTS@	$(AR) $(ARFLAGS) $@ $(STATIC_C_OBJS)
 @USE_GNAT_PROJECTS@
 @USE_GNAT_LIBRARIES@install \
 @USE_GNAT_LIBRARIES@install.libs :: \
@@ -274,8 +285,11 @@
 	$(BUILD_DIR)/dynamic-obj
 
 @MAKE_ADA_SHAREDLIB@all :: $(BUILD_DIR_LIB)/$(SHARED_LIBNAME)
-@MAKE_ADA_SHAREDLIB@$(BUILD_DIR_LIB)/$(SHARED_LIBNAME) :: $(ABASE)-trace.adb $(SHARED_DIRS)
-@MAKE_ADA_SHAREDLIB@	cp $(MIXED_OBJS) $(BUILD_DIR)/dynamic-obj/
+@MAKE_ADA_SHAREDLIB@$(BUILD_DIR_LIB)/$(SHARED_LIBNAME) :: \
+@MAKE_ADA_SHAREDLIB@		$(ABASE)-trace.adb \
+@MAKE_ADA_SHAREDLIB@		$(SHARED_DIRS) \
+@MAKE_ADA_SHAREDLIB@		$(SHARED_OBJS)
+@MAKE_ADA_SHAREDLIB@	cp $(SHARED_OBJS) $(BUILD_DIR)/dynamic-obj/
 @MAKE_ADA_SHAREDLIB@	$(ADAMAKE) $(ADAMAKEFLAGS) -XLIB_KIND=dynamic
 
 install \
Index: INSTALL
Prereq:  1.155 
--- ncurses-5.9/INSTALL	2011-03-31 08:27:24.000000000 +0000
+++ ncurses-5.9-20130504/INSTALL	2013-03-09 21:22:04.000000000 +0000
@@ -1,5 +1,5 @@
 -------------------------------------------------------------------------------
--- Copyright (c) 1998-2010,2011 Free Software Foundation, Inc.               --
+-- Copyright (c) 1998-2012,2013 Free Software Foundation, Inc.               --
 --                                                                           --
 -- Permission is hereby granted, free of charge, to any person obtaining a   --
 -- copy of this software and associated documentation files (the             --
@@ -25,7 +25,7 @@
 -- sale, use or other dealings in this Software without prior written        --
 -- authorization.                                                            --
 -------------------------------------------------------------------------------
--- $Id: INSTALL,v 1.155 2011/03/31 08:27:24 tom Exp $
+-- $Id: INSTALL,v 1.167 2013/03/09 21:22:04 tom Exp $
 ---------------------------------------------------------------------
              How to install Ncurses/Terminfo on your system
 ---------------------------------------------------------------------
@@ -407,13 +407,14 @@
 
     --disable-tic-depends
 	When building shared libraries, normally the tic library is linked to
-	depend upon the ncurses library (and in turn, on the term-library if
-	the --with-termlib option was given).  The tic- and term-libraries
-	ABI does not depend on the --enable-widec option. Some packagers have
-	used this to reduce the number of library files which are packaged
-	by using only one copy of those libraries.  To make this work properly,
+	depend upon the ncurses library (or equivalently, on the tinfo-library
+	if the --with-termlib option was given).  The tic- and tinfo-library
+	ABIs do not depend on the --enable-widec option.  Some packagers have
+	used this to reduce the number of library files which are packaged by
+	using only one copy of those libraries.  To make this work properly,
 	the tic library must be built without an explicit dependency on the
-	ncurses (or ncursesw) library.  Use this configure option to do that.
+	underlying library (ncurses vs ncursesw, tinfo vs tinfow).  Use this
+	configure option to do that.
 	For example
 		configure --with-ticlib --with-shared --disable-tic-depends
 
@@ -555,6 +556,9 @@
 	library by reducing global and static variables.  This option is also
 	set if --with-pthread is used.
 
+	Enabling this option adds a "t" to the library names, except for the
+	special case when --enable-weak-symbols is also used.
+
     --enable-rpath
 	Use rpath option when generating shared libraries, and (with some
 	restrictions) when linking the corresponding programs.  This originally
@@ -595,6 +599,14 @@
 	reducing the need for juggling the global SP value with set_term() and
 	delscreen().
 
+    --enable-string-hacks
+	Controls whether strlcat and strlcpy may be used.  The same issue
+	applies to OpenBSD's warnings about snprintf, noting that this function
+	is weakly standardized.
+
+	Aside from stifling these warnings, there is no functional improvement
+	in ncurses.
+
     --enable-symlinks
 	If your system supports symbolic links, make tic use symbolic links
 	rather than hard links to save diskspace when writing aliases in the
@@ -616,6 +628,12 @@
 	match is found in the terminfo database.  See also the --enable-getcap
 	and --enable-getcap-cache options.
 
+	Termcap support requires run-time parsing rather than loading
+	predigested data.  If you have specified --with-ticlib, then you
+	cannot have termcap support since run-time parsing is done in the
+	tic library, which is intentionally not part of normal linkage
+	dependencies.
+
     --enable-warnings
 	Turn on GCC compiler warnings.  There should be only a few.
 
@@ -740,6 +758,12 @@
 	executables, e.g., by setting "--with-chtype=long" (the configure
 	script supplies "unsigned").
 
+    --with-cxx-shared
+	When --with-shared is set, build libncurses++ as a shared library.
+	This implicitly relies upon building with gcc/g++, since other
+	compiler suites may have differences in the way shared libraries are
+	built.  libtool by the way has similar limitations.
+
     --with-database=XXX
 	Specify the terminfo source file to install.  Usually you will wish
 	to install ncurses' default (misc/terminfo.src).  Certain systems
@@ -824,7 +848,17 @@
 	NOTE: a few systems build shared libraries with fixed pathnames; this
 	option probably will not work for those configurations.
 
-     --with-libtool[=XXX]
+    --with-lib-prefix=XXX
+	OS/2 EMX used a different naming convention from most Unix-like
+	platforms.  It required that the "lib" part of a library name was
+	omitted.  Newer EMX as part of eComStation does not follow that
+	convention.  Use this option to override the configure script's
+	assumptions about the library-prefix.  If this option is omitted, it
+	uses the original OS/2 EMX convention for that platform.  Use
+	"--with-lib-prefix=lib" for the newer EMX in eComStation.  Use
+	"--without-lib-prefix" to suppress it for other odd platforms.
+
+    --with-libtool[=XXX]
 	Generate libraries with libtool.  If this option is selected, then it
 	overrides all other library model specifications.  Note that libtool
 	must already be installed, uses makefile rules dependent on GNU make,
@@ -904,6 +938,10 @@
     --with-pkg-config=[DIR]
 	Check for pkg-config, optionally specifying its path.
 
+    --with-pkg-config-libdir=[DIR]
+	If pkg-config was found, override the automatic check for its library
+	path.
+
     --with-profile
 	Generate profile-libraries These are named by adding "_p" to the root,
 	e.g., libncurses_p.a
@@ -996,10 +1034,27 @@
 	library dependencies for tic and other programs built with the tic
 	library.
 
+    --with-tparm-arg[=XXX]
+	Override the type used for tparm() arguments, which normally is a
+	"long".  However the function must assume that its arguments can hold a
+	pointer to char's which is not always workable for 64-bit platforms.  A
+	better choice would be intptr_t, which was not available at the time
+	tparm's interface was defined.
+
+	If the option is not given, this defaults to "long".
+
     --with-trace
 	Configure the trace() function as part of the all models of the ncurses
 	library.  Normally it is part of the debug (libncurses_g) library only.
 
+    --with-xterm-kbs=XXX
+	Configure xterm's terminfo entries to use either BS (^H, i.e., ASCII
+	backspace) or DEL (^?, or 127).  XXX can be BS (or bs, 8) or DEL
+	(or del, 127).
+
+	During installation, the makefile and scripts modifies the "xterm+kbs"
+	terminfo entry to use this setting.
+
     --with-valgrind
 	For testing, compile with debug option.
 	This also sets the --disable-leaks option.
@@ -1024,6 +1079,8 @@
 	install as "ncurses.h" and modify the installed headers and manpages
 	accordingly.
 
+	Likewise, do not install an alias "curses" for the ncurses manpage.
+
     --without-cxx
 	XSI curses declares "bool" as part of the interface.  C++ also declares
 	"bool".  Neither specifies the size and type of booleans, but both
@@ -1726,20 +1783,37 @@
 	By default, there are no entries on the fallback list.  After you have
 	built the ncurses suite for the first time, you can change the list
 	(the process needs infocmp(1)).  To do so, use the script
-	ncurses/tinfo/MKfallback.sh.  A configure script option
+	ncurses/tinfo/MKfallback.sh.  The configure script option
 	--with-fallbacks does this (it accepts a comma-separated list of the
 	names you wish, and does not require a rebuild).
 
 	If you wanted (say) to have linux, vt100, and xterm fallbacks, you
-	would use the commands
+	might use the commands
 
 		cd ncurses;
-		tinfo/MKfallback.sh linux vt100 xterm >fallback.c
+		tinfo/MKfallback.sh \
+			$TERMINFO \
+			../misc/terminfo.src \
+			`which tic` \
+			linux vt100 xterm >fallback.c
+
+	The first three parameters of the script are normally supplied by
+	the configured makefiles via the "--with-fallbacks" option.  They
+	are
+
+		1) the location of the terminfo database
+		2) the source for the terminfo entries
+		3) the location of the tic program, used to create a terminfo
+		   database.
 
 	Then just rebuild and reinstall the library as you would normally.
 	You can restore the default empty fallback list with
 
-		tinfo/MKfallback.sh >fallback.c
+		tinfo/MKfallback.sh \
+			$TERMINFO \
+			../misc/terminfo.src \
+			`which tic` \
+			>fallback.c
 
 	The overhead for an empty fallback list is one trivial stub function.
 	Any non-empty fallback list is const-ed and therefore lives in sharable
Index: MANIFEST
--- ncurses-5.9/MANIFEST	2011-03-28 00:29:04.000000000 +0000
+++ ncurses-5.9-20130504/MANIFEST	2013-01-26 22:19:36.000000000 +0000
@@ -545,6 +545,8 @@
 ./include/nc_alloc.h
 ./include/nc_mingw.h
 ./include/nc_panel.h
+./include/nc_string.h
+./include/nc_termios.h
 ./include/nc_tparm.h
 ./include/ncurses_cfg.hin
 ./include/ncurses_defs
@@ -764,7 +766,6 @@
 ./mk-0th.awk
 ./mk-1st.awk
 ./mk-2nd.awk
-./mk-dlls.sh.in
 ./mk-hdr.awk
 ./ncurses/Makefile.in
 ./ncurses/README
@@ -850,7 +851,6 @@
 ./ncurses/base/lib_wattron.c
 ./ncurses/base/lib_winch.c
 ./ncurses/base/lib_window.c
-./ncurses/base/memmove.c
 ./ncurses/base/nc_panel.c
 ./ncurses/base/resizeterm.c
 ./ncurses/base/safe_sprintf.c
@@ -867,6 +867,12 @@
 ./ncurses/llib-lncursest
 ./ncurses/llib-lncursestw
 ./ncurses/llib-lncursesw
+./ncurses/llib-ltic
+./ncurses/llib-ltictw
+./ncurses/llib-lticw
+./ncurses/llib-ltinfo
+./ncurses/llib-ltinfotw
+./ncurses/llib-ltinfow
 ./ncurses/modules
 ./ncurses/tinfo/MKcaptab.awk
 ./ncurses/tinfo/MKcaptab.sh
@@ -915,10 +921,10 @@
 ./ncurses/tinfo/make_hash.c
 ./ncurses/tinfo/make_keys.c
 ./ncurses/tinfo/name_match.c
+./ncurses/tinfo/obsolete.c
 ./ncurses/tinfo/parse_entry.c
 ./ncurses/tinfo/read_entry.c
 ./ncurses/tinfo/read_termcap.c
-./ncurses/tinfo/setbuf.c
 ./ncurses/tinfo/strings.c
 ./ncurses/tinfo/tinfo_driver.c
 ./ncurses/tinfo/trim_sgr0.c
@@ -943,8 +949,6 @@
 ./ncurses/tty/lib_tstp.c
 ./ncurses/tty/lib_twait.c
 ./ncurses/tty/lib_vidattr.c
-./ncurses/tty/tty_display.h
-./ncurses/tty/tty_input.h
 ./ncurses/tty/tty_update.c
 ./ncurses/wcwidth.h
 ./ncurses/widechar/charable.c
@@ -967,9 +971,18 @@
 ./ncurses/widechar/lib_vline_set.c
 ./ncurses/widechar/lib_wacs.c
 ./ncurses/widechar/lib_wunctrl.c
+./ncurses/widechar/widechars.c
 ./ncurses/win32con/gettimeofday.c
 ./ncurses/win32con/wcwidth.c
 ./ncurses/win32con/win_driver.c
+./package/debian/changelog
+./package/debian/compat
+./package/debian/control
+./package/debian/copyright
+./package/debian/rules
+./package/debian/source/format
+./package/debian/watch
+./package/ncurses.spec
 ./panel/Makefile.in
 ./panel/headers
 ./panel/llib-lpanel
@@ -1022,6 +1035,7 @@
 ./test/cardfile.dat
 ./test/chgat.c
 ./test/clip_printw.c
+./test/color_name.h
 ./test/color_set.c
 ./test/configure
 ./test/configure.in
@@ -1092,12 +1106,15 @@
 ./test/test_instr.c
 ./test/test_inwstr.c
 ./test/test_opaque.c
+./test/test_vid_puts.c
+./test/test_vidputs.c
 ./test/testaddch.c
 ./test/testcurs.c
 ./test/testscanw.c
 ./test/tracemunch
 ./test/view.c
 ./test/widechars-utf8.txt
+./test/widechars.h
 ./test/worm.c
 ./test/xmas.c
 ./test/xterm-16color.dat
Index: Makefile.in
Prereq:  1.30 
--- ncurses-5.9/Makefile.in	2010-11-27 21:45:27.000000000 +0000
+++ ncurses-5.9-20130504/Makefile.in	2012-10-06 17:31:01.000000000 +0000
@@ -1,6 +1,6 @@
-# $Id: Makefile.in,v 1.30 2010/11/27 21:45:27 tom Exp $
+# $Id: Makefile.in,v 1.35 2012/10/06 17:31:01 tom Exp $
 ##############################################################################
-# Copyright (c) 1998-2008,2010 Free Software Foundation, Inc.                #
+# Copyright (c) 1998-2011,2012 Free Software Foundation, Inc.                #
 #                                                                            #
 # Permission is hereby granted, free of charge, to any person obtaining a    #
 # copy of this software and associated documentation files (the "Software"), #
@@ -35,7 +35,8 @@
 VPATH		= @srcdir@
 
 DESTDIR=@DESTDIR@
-CF_MFLAGS = @cf_cv_makeflags@ DESTDIR="$(DESTDIR)"
+RPATH_LIST=@RPATH_LIST@
+TOP_MFLAGS = @cf_cv_makeflags@ DESTDIR="$(DESTDIR)" RPATH_LIST="$(RPATH_LIST)"
 
 @SET_MAKE@
 
@@ -48,6 +49,7 @@
 
 prefix		= @prefix@
 exec_prefix	= @exec_prefix@
+datarootdir	= @datarootdir@
 
 bindir		= @bindir@
 ticdir		= @TERMINFO@
@@ -87,12 +89,9 @@
 		fgrep NCURSES_VERSION $(includedir)/curses.h >/dev/null || \
 		echo '** Will overwrite non-ncurses curses.h'
 
-dlls:	libs
-	$(SHELL) $(srcdir)/mk-dlls.sh
-
 distclean \
 realclean ::
-	-rm -f mk-dlls.sh mingw_arch
+
 
 # Put the common rules here so that we can easily construct the list of
 # directories to visit.
Index: NEWS
Prereq:  1.1682 
--- ncurses-5.9/NEWS	2011-04-04 00:02:42.000000000 +0000
+++ ncurses-5.9-20130504/NEWS	2013-05-04 23:03:37.000000000 +0000
@@ -1,5 +1,5 @@
 -------------------------------------------------------------------------------
--- Copyright (c) 1998-2010,2011 Free Software Foundation, Inc.               --
+-- Copyright (c) 1998-2012,2013 Free Software Foundation, Inc.               --
 --                                                                           --
 -- Permission is hereby granted, free of charge, to any person obtaining a   --
 -- copy of this software and associated documentation files (the             --
@@ -25,7 +25,7 @@
 -- sale, use or other dealings in this Software without prior written        --
 -- authorization.                                                            --
 -------------------------------------------------------------------------------
--- $Id: NEWS,v 1.1682 2011/04/04 00:02:42 tom Exp $
+-- $Id: NEWS,v 1.2053 2013/05/04 23:03:37 tom Exp $
 -------------------------------------------------------------------------------
 
 This is a log of changes that ncurses has gone through since Zeyd started
@@ -45,6 +45,1074 @@
 Changes through 1.9.9e did not credit all contributions;
 it is not possible to add this information.
 
+20130504
+	+ fixes for issues found by Coverity:
+	  + correct FNKEY() macro in progs/dump_entry.c, allowing kf11-kf63 to
+	    display when infocmp's -R option is used for HP or AIX subsets.
+	  + fix dead-code issue with test/movewindow.c
+	  + improve limited-checking in _nc_read_termtype().
+
+20130427
+	+ fix clang 3.2 warning in progs/dump_entry.c
+	+ drop AC_TYPE_SIGNAL check; ncurses relies on c89 and later.
+
+20130413
+	+ add MinGW to cases where ncurses installs by default into /usr
+	  (prompted by discussion with Daniel Silva Ferreira).
+	+ add -D option to infocmp's usage-message (patch by Miroslav Lichvar).
+	+ add a missing 'int' type for main function in configure check for
+	  type of bool variable, to work with clang 3.2 (report by Dmitri
+	  Gribenko).
+	+ improve configure check for static_cast, to work with clang 3.2
+	  (report by Dmitri Gribenko).
+	+ re-order rule for demo.o and macros defining header dependencies in
+	  c++/Makefile.in to accommodate gmake (report by Dmitri Gribenko).
+
+20130406
+	+ improve parameter checking in copywin().
+	+ modify configure script to work around OS X's "libtool" program, to
+	  choose glibtool instead.  At the same time, chance the autoconf macro
+	  to look for a "tool" rather than a "prog", to help with potential use
+	  in cross-compiling.
+	+ separate the rpath usage for c++ library from demo program
+	  (Redhat #911540)
+	+ update/correct header-dependencies in c++ makefile (report by Werner
+	  Fink).
+	+ add --with-cxx-shared to dpkg-script, as done for rpm-script.
+
+20130324
+	+ build-fix for libtool configuration (reports by Daniel Silva Ferreira
+	  and Roumen Petrov).
+
+20130323
+	+ build-fix for OS X, to handle changes for --with-cxx-shared feature
+	  (report by Christian Ebert).
+	+ change initialization for vt220, similar entries for consistency
+	  with cursor-key strings (NetBSD #47674) -TD
+	+ further improvements to linux-16color (Benjamin Sittler)
+
+20130316
+	+ additional fix for tic.c, to allocate missing buffer space.
+	+ eliminate configure-script warnings for gen-pkgconfig.in
+	+ correct typo in sgr string for sun-color,
+	  add bold for consistency with sgr,
+	  change smso for consistency with sgr -TD
+	+ correct typo in sgr string for terminator -TD
+	+ add blink to the attributes masked by ncv in linux-16color (report
+	  by Benjamin Sittler)
+	+ improve warning message from post-load checking for missing "%?"
+	  operator by tic/infocmp by showing the entry name and capability.
+	+ minor formatting improvement to tic/infocmp -f option to ensure
+	  line split after "%;".
+	+ amend scripting for --with-cxx-shared option to handle the debug
+	  library "libncurses++_g.a" (report by Sven Joachim).
+
+20130309
+	+ amend change to toe.c for reading from /dev/zero, to ensure that
+	  there is a buffer for the temporary filename (cf: 20120324).
+	+ regenerated html manpages.
+	+ fix typo in terminfo.head (report by Sven Joachim, cf: 20130302).
+	+ updated some autoconf macros:
+	  + CF_ACVERSION_CHECK, from byacc 1.9 20130304
+	  + CF_INTEL_COMPILER, CF_XOPEN_SOURCE from luit 2.0-20130217
+	+ add configure option --with-cxx-shared to permit building
+	  libncurses++ as a shared library when using g++, e.g., the same
+	  limitations as libtool but better integrated with the usual build
+	  configuration (Redhat #911540).
+	+ modify MKkey_defs.sh to filter out build-path which was unnecessarily
+	  shown in curses.h (Debian #689131).
+
+20130302
+	+ add section to terminfo manpage discussing user-defined capabilities.
+	+ update manpage description of NCURSES_NO_SETBUF, explaining why it
+	  is obsolete.
+	+ add a check in waddch_nosync() to ensure that tab characters are
+	  treated as control characters; some broken locales claim they are
+	  printable.
+	+ add some traces to the Windows console driver.
+	+ initialize a temporary array in _nc_mbtowc, needed for some cases
+	  of raw input in MinGW port.
+
+20130218
+	+ correct ifdef on change to lib_twait.c (report by  Werner Fink).
+	+ update config.guess, config.sub
+
+20130216
+	+ modify test/testcurs.c to work with mouse for ncurses as it does for
+	  pdcurses.
+	+ modify test/knight.c to work with mouse for pdcurses as it does for
+	  ncurses.
+	+ modify internal recursion in wgetch() which handles cooked mode to
+	  check if the call to wgetnstr() returned an error.  This can happen
+	  when both nocbreak() and nodelay() are set, for instance (report by
+	  Nils Christopher Brause) (cf: 960418).
+	+ fixes for issues found by Coverity:
+	  + add a check for valid position in ClearToEOS()
+	  + fix in lib_twait.c when --enable-wgetch-events is used, pointer
+	    use after free.
+	  + improve a limit-check in make_hash.c
+	  + fix a memory leak in hashed_db.c
+
+20130209
+	+ modify test/configure script to make it simpler to override names
+	  of curses-related libraries, to help with linking with pdcurses in
+	  mingw environment.
+	+ if the --with-terminfo-dirs configure option is not used, there is
+	  no corresponding compiled-in value for that.  Fill in "no default
+	  value" for that part of the manpage substitution.
+
+20130202
+	+ correct initialization in knight.c which let it occasionally make
+	  an incorrect move (cf: 20001028).
+	+ improve documentation of the terminfo/termcap search path.
+
+20130126
+	+ further fixes to mvcur to pass callback function (cf: 20130112),
+	  needed to make test/dots_mvcur work.
+	+ reduce calls to SetConsoleActiveScreenBuffer in win_driver.c, to
+	  help reduce flicker.
+	+ modify configure script to omit "+b" from linker options for very
+	  old HP-UX systems (report by Dennis Grevenstein)
+	+ add HP-UX workaround for missing EILSEQ on old HP-UX systems (patch
+	  by Dennis Grevenstein).
+	+ restore memmove/strdup support for antique systems (request by
+	  Dennis Grevenstein).
+	+ change %l behavior in tparm to push the string length onto the stack
+	  rather than saving the formatted length into the output buffer
+	  (report by Roy Marples, cf: 980620).
+
+20130119
+	+ fixes for issues found by Coverity:
+	  + fix memory leak in safe_sprintf.c
+	  + add check for return-value in tty_update.c
+	  + correct initialization for -s option in test/view.c
+	  + add check for numeric overflow in lib_instr.c
+	  + improve error-checking in copywin
+	+ add advice in infocmp manpage for termcap users (Debian #698469).
+	+ add "-y" option to test/demo_termcap and test/demo_terminfo to
+	  demonstrate behavior with/without extended capabilities.
+	+ updated termcap manpage to document legacy termcap behavior for
+	  matching capability names.
+	+ modify name-comparison for tgetstr, etc., to accommodate legacy
+	  applications as well as to improve compatbility with BSD 4.2
+	  termcap implementations (Debian #698299) (cf: 980725).
+
+20130112
+	+ correct prototype in manpage for vid_puts.
+	+ drop ncurses/tty/tty_display.h, ncurses/tty/tty_input.h, since they
+	  are unused in the current driver model.
+	+ modify mvcur to use stdout except when called within the ncurses
+	  library.
+	+ modify vidattr and vid_attr to use stdout as documented in manpage.
+	+ amend changes made to buffering in 20120825 so that the low-level
+	  putp() call uses stdout rather than ncurses' internal buffering.
+	  The putp_sp() call does the same, for consistency (Redhat #892674).
+
+20130105
+	+ add "-s" option to test/view.c to allow it to start in single-step
+	  mode, reducing size of trace files when it is used for debugging
+	  MinGW changes.
+	+ revert part of 20121222 change to tinfo_driver.c
+	+ add experimental logic in win_driver.c to improve optimization of
+	  screen updates.  This does not yet work with double-width characters,
+	  so it is ifdef'd out for the moment (prompted by report by Erwin
+	  Waterlander regarding screen flicker).
+
+20121229
+	+ fix coverity warnings regarding copying into fixed-size buffers.
+	+ add throw-declarations in the c++ binding per Coverity warning.
+	+ minor changes to new-items for consistent reference to bug-report
+	  numbers.
+
+20121222
+	+ add *.dSYM directories to clean-rule in ncurses directory makefile,
+	  for Mac OS builds.
+	+ add a configure check for gcc option -no-cpp-precomp, which is not
+	  available in all Mac OS X configurations (report by Andras Salamon,
+	  cf: 20011208).
+	+ improve 20021221 workaround for broken acs, handling a case where
+	  that ACS_xxx character is not in the acsc string but there is a known
+	  wide-character which can be used.
+
+20121215
+	+ fix several warnings from clang 3.1 --analyze, includes correcting
+	  a null-pointer check in _nc_mvcur_resume.
+	+ correct display of double-width characters with MinGW port (report
+	  by Erwin Waterlander).
+	+ replace MinGW's wcrtomb(), fixing a problem with _nc_viscbuf 
+	> fixes based on Coverity report:
+	+ correct coloring in test/bs.c
+	+ correct check for 8-bit value in _nc_insert_ch().
+	+ remove dead code in progs/tset.c, test/linedata.h
+	+ add null-pointer checks in lib_tracemse.c, panel.priv.h, and some
+	  test-programs.
+
+20121208
+	+ modify test/knight.c to show the number of choices possible for
+	  each position in automove option, e.g., to allow user to follow
+	  Warnsdorff's rule to solve the puzzle.
+	+ modify test/hanoi.c to show the minimum number of moves possible for
+	  the given number of tiles (prompted by patch by Lucas Gioia).
+	> fixes based on Coverity report:
+	+ remove a few redundant checks.
+	+ correct logic in test/bs.c, when randomly placing a specific type of
+	  ship.
+	+ check return value from remove/unlink in tic.
+	+ check return value from sscanf in test/ncurses.c
+	+ fix a null dereference in c++/cursesw.cc
+	+ fix two instances of uninitialized variables when configuring for the
+	  terminal driver.
+	+ correct scope of variable used in SetSafeOutcWrapper macro.
+	+ set umask when calling mkstemp in tic.
+	+ initialize wbkgrndset() temporary variable when extended-colors are
+	  used.
+
+20121201
+	+ also replace MinGW's wctomb(), fixing a problem with setcchar().
+	+ modify test/view.c to load UTF-8 when built with MinGW by using
+	  regular win32 API because the MinGW functions mblen() and mbtowc()
+	  do not work.
+
+20121124
+	+ correct order of color initialization versus display in some of the
+	  test-programs, e.g., test_addstr.c
+	> fixes based on Coverity report:
+	+ delete windows on exit from some of the test-programs.
+
+20121117
+	> fixes based on Coverity report:
+	+ add missing braces around FreeAndNull in two places.
+	+ various fixes in test/ncurses.c
+	+ improve limit-checks in tinfo/make_hash.c, tinfo/read_entry.c
+	+ correct malloc size in progs/infocmp.c
+	+ guard against negative array indices in test/knight.c
+	+ fix off-by-one limit check in test/color_name.h
+	+ add null-pointer check in progs/tabs.c, test/bs.c, test/demo_forms.c,
+	  test/inchs.c
+	+ fix memory-leak in tinfo/lib_setup.c, progs/toe.c,
+	  test/clip_printw.c, test/demo_menus.c
+	+ delete unused windows in test/chgat.c, test/clip_printw.c,
+	  test/insdelln.c, test/newdemo.c on error-return.
+
+20121110
+	+ modify configure macro CF_INCLUDE_DIRS to put $CPPFLAGS after the
+	  local -I include options in case someone has set conflicting -I
+	  options in $CPPFLAGS (prompted by patch for ncurses/Makefile.in by
+	  Vassili Courzakis).
+	+ modify the ncurses*-config scripts to eliminate relative paths from
+	  the RPATH_LIST variable, e.g., "../lib" as used in installing shared
+	  libraries or executables.
+
+20121102
+	+ realign these related pages:
+	    curs_add_wchstr.3x
+	    curs_addchstr.3x
+	    curs_addstr.3x
+	    curs_addwstr.3x
+	  and fix a long-ago error in curs_addstr.3x which said that a -1
+	  length parameter would only write as much as fit onto one line
+	  (report by Reuben Thomas).
+	+ remove obsolete fallback _nc_memmove() for memmove()/bcopy().
+	+ remove obsolete fallback _nc_strdup() for strdup().
+	+ cancel any debug-rpm in package/ncurses.spec
+	+ reviewed vte-2012, reverted most of the change since it was incorrect
+	  based on testing with tack -TD
+	+ un-cancel the initc in vte-256color, since this was implemented
+	  starting with version 0.20 in 2009 -TD
+
+20121026
+	+ improve malloc/realloc checking (prompted by discussion in Redhat
+	  #866989).
+	+ add ncurses test-program as "ncurses6" to the rpm- and dpkg-scripts.
+	+ updated configure macros CF_GCC_VERSION and CF_WITH_PATHLIST.  The
+	  first corrects pattern used for Mac OS X's customization of gcc.
+
+20121017
+	+ fix change to _nc_scroll_optimize(), which incorrectly freed memory 
+	  (Redhat #866989).
+
+20121013
+	+ add vte-2012, gnome-2012, making these the defaults for vte/gnome
+	  (patch by Christian Persch).
+
+20121006
+	+ improve CF_GCC_VERSION to work around Debian's customization of gcc
+	  --version message.
+	+ improve configure macros as done in byacc:
+	  + drop 2.13 compatibility; use 2.52.xxxx version only since EMX port
+	    has used that for a while.
+	  + add 3rd parameter to AC_DEFINE's to allow autoheader to run, i.e.,
+	    for experimental use.
+	  + remove unused configure macros.
+	+ modify configure script and makefiles to quiet new autoconf warning
+	  for LIBS_TO_MAKE variable.
+	+ modify configure script to show $PATH_SEPARATOR variable.
+	+ update config.guess, config.sub
+
+20120922
+	+ modify setupterm to set its copy of TERM to "unknown" if configured
+	  for the terminal driver and TERM was null or empty.
+	+ modify treatment of TERM variable for MinGW port to allow explicit
+	  use of the windows console driver by checking if $TERM is set to
+	  "#win32con" or an abbreviation of that.
+	+ undo recent change to fallback definition of vsscanf() to build with
+	  older Solaris compilers (cf: 20120728).
+
+20120908
+	+ add test-screens to test/ncurses to show 256-characters at a time,
+	  to help with MinGW port.
+
+20120903
+	+ simplify varargs logic in lib_printw.c; va_copy is no longer needed
+	  there.
+	+ modifications for MinGW port to make wide-character display usable.
+
+20120902
+	+ regenerate configure script (report by Sven Joachim, cf: 20120901).
+
+20120901
+	+ add a null-pointer check in _nc_flush (cf: 20120825).
+	+ fix a case in _nc_scroll_optimize() where the _oldnums_list array
+	  might not be allocated.
+	+ improve comparisons in configure.in for unset shell variables.
+
+20120826
+	+ increase size of ncurses' output-buffer, in case of very small
+	  initial screen-sizes.
+	+ fix evaluation of TERMINFO and TERMINFO_DIRS default values as needed
+	  after changes to use --datarootdir (reports by Gabriele Balducci,
+	  Roumen Petrov).
+
+20120825
+	+ change output buffering scheme, using buffer maintained by ncurses
+	  rather than stdio, to avoid problems with SIGTSTP handling (report
+	  by Brian Bloniarz).
+
+20120811
+	+ update autoconf patch to 2.52.20120811, adding --datarootdir
+	  (prompted by discussion with Erwin Waterlander).
+	+ improve description of --enable-reentrant option in README and the
+	  INSTALL file.
+	+ add nsterm-256color, make this the default nsterm -TD
+	+ remove bw from nsterm-bce, per testing with tack -TD
+
+20120804
+	+ update test/configure, adding check for tinfo library.
+	+ improve limit-checks for the getch fifo (report by Werner Fink).
+	+ fix a remaining mismatch between $with_echo and the symbols updated
+	  for CF_DISABLE_ECHO affecting parameters for mk-2nd.awk (report by
+	  Sven Joachim, cf:  20120317).
+	+ modify followup check for pkg-config's library directory in the
+	  --enable-pc-files option to validate syntax (report by Sven Joachim,
+	  cf: 20110716).
+
+20120728
+	+ correct path for ncurses_mingw.h in include/headers, in case build
+	  is done outside source-tree (patch by Roumen Petrov).
+	+ modify some older xterm entries to align with xterm source -TD
+	+ separate "xterm-old" alias from "xterm-r6" -TD
+	+ add E3 extended capability to xterm-basic and putty -TD
+	+ parenthesize parameters of other macros in curses.h -TD
+	+ parenthesize parameter of COLOR_PAIR and PAIR_NUMBER in curses.h
+	  in case it happens to be a comma-expression, etc.  (patch by Nick
+	  Black).
+
+20120721
+	+ improved form_request_by_name() and menu_request_by_name().
+	+ eliminate two fixed-size buffers in toe.c
+	+ extend use_tioctl() to have expected behavior when use_env(FALSE) and
+	  use_tioctl(TRUE) are called.
+	+ modify ncurses test-program, adding -E and -T options to demonstrate
+	  use_env() versus use_tioctl().
+
+20120714
+	+ add use_tioctl() function (adapted from patch by Werner Fink,
+	  Novell #769788):
+
+20120707
+	+ add ncurses_mingw.h to installed headers (prompted by patch by
+	  Juergen Pfeifer).
+	+ clarify return-codes from wgetch() in response to SIGWINCH (prompted
+	  by Novell #769788).
+	+ modify resizeterm() to always push a KEY_RESIZE onto the fifo, even
+	  if screensize is unchanged.  Modify _nc_update_screensize() to push a
+	  KEY_RESIZE if there was a SIGWINCH, even if it does not call
+	  resizeterm().  These changes eliminate the case where a SIGWINCH is
+	  received, but ERR returned from wgetch or wgetnstr because the screen
+	  dimensions did not change (Novell #769788).
+
+20120630
+	+ add --enable-interop to sample package scripts (suggested by Juergen
+	  Pfeifer).
+	+ update CF_PATH_SYNTAX macro, from mawk changes.
+	+ modify mk-0th.awk to allow for generating llib-ltic, etc., though
+	  some work is needed on cproto to work with lib_gen.c to update
+	  llib-lncurses.
+	+ remove redundant getenv() cal in database-iterator leftover from
+	  cleanup in 20120622 changes (report by Sven Joachim).
+
+20120622
+	+ add -d, -e and -q options to test/demo_terminfo and test/demo_termcap
+	+ fix caching of environment variables in database-iterator (patch by
+	  Philippe Troin, Redhat #831366).
+
+20120616
+	+ add configure check to distinguish clang from gcc to eliminate
+	  warnings about unused command-line parameters when compiler warnings
+	  are enabled.
+	+ improve behavior when updating terminfo entries which are hardlinked
+	  by allowing for the possibility that an alias has been repurposed to
+	  a new primary name.
+	+ fix some strict compiler warnings based on package scripts.
+	+ further fixes for configure check for working poll (Debian #676461).
+
+20120608
+	+ fix an uninitialized variable in -c/-n logic for infocmp changes
+	  (cf: 20120526).
+	+ corrected fix for building c++ binding with clang 3.0 (report/patch
+	  by Richard Yao, Gentoo #417613, cf: 20110409)
+	+ correct configure check for working poll, fixing the case where stdin
+	  is redirected, e.g., in rpm/dpkg builds (Debian #676461).
+	+ add rpm- and dpkg-scripts, to test those build-environments.
+	  The resulting packages are used only for testing.
+
+20120602
+	+ add kdch1 aka "Remove" to vt220 and vt220-8 entries -TD
+	+ add kdch1, etc., to qvt108 -TD
+	+ add dl1/il1 to some entries based on dl/il values -TD
+	+ add dl to simpleterm -TD
+	+ add consistency-checks in tic for insert-line vs delete-line
+	  controls, and insert/delete-char keys
+	+ correct no-leaks logic in infocmp when doing comparisons, fixing
+	  duplicate free of entries given via the command-line, and freeing
+	  entries loaded from the last-but-one of files specified on the
+	  command-line.
+	+ add kdch1 to wsvt25 entry from NetBSD CVS (reported by David Lord,
+	  analysis by Martin Husemann).
+	+ add cnorm/civis to wsvt25 entry from NetBSD CVS (report/analysis by
+	  Onno van der Linden).
+
+20120526
+	+ extend -c and -n options of infocmp to allow comparing more than two
+	  entries.
+	+ correct check in infocmp for number of terminal names when more than
+	  two are given.
+	+ correct typo in curs_threads.3x (report by Yanhui Shen on
+	  freebsd-hackers mailing list).
+
+20120512
+	+ corrected 'op' for bterm (report by Samuel Thibault) -TD
+	+ modify test/background.c to demonstrate a background character
+	  holding a colored ACS_HLINE.  The behavior differs from SVr4 due to
+	  the thick- and double-line extension (cf: 20091003).
+	+ modify handling of acs characters in PutAttrChar to avoid mapping an
+	  unmapped character to a space with A_ALTCHARSET set.
+	+ rewrite vt520 entry based on vt420 -TD
+
+20120505
+	+ remove p6 (bold) from opus3n1+ for consistency -TD
+	+ remove acs stuff from env230 per clues in Ingres termcap -TD
+	+ modify env230 sgr/sgr0 to match other capabilities -TD
+	+ modify smacs/rmacs in bq300-8 to match sgr/sgr0 -TD
+	+ make sgr for dku7202 agree with other caps -TD
+	+ make sgr for ibmpc agree with other caps -TD
+	+ make sgr for tek4107 agree with other caps -TD
+	+ make sgr for ndr9500 agree with other caps -TD
+	+ make sgr for sco-ansi agree with other caps -TD
+	+ make sgr for d410 agree with other caps -TD
+	+ make sgr for d210 agree with other caps -TD
+	+ make sgr for d470c, d470c-7b agree with other caps -TD
+	+ remove redundant AC_DEFINE for NDEBUG versus Makefile definition.
+	+ fix a back-link in _nc_delink_entry(), which is needed if ncurses is
+	  configured with --enable-termcap and --disable-getcap.
+
+20120428
+	+ fix some inconsistencies between vt320/vt420, e.g., cnorm/civis -TD
+	+ add eslok flag to dec+sl -TD
+	+ dec+sl applies to vt320 and up -TD
+	+ drop wsl width from xterm+sl -TD
+	+ reuse xterm+sl in putty and nsca-m -TD
+	+ add ansi+tabs to vt520 -TD
+	+ add ansi+enq to vt220-vt520 -TD
+	+ fix a compiler warning in example in ncurses-intro.doc (Paul Waring).
+	+ added paragraph in keyname manpage telling how extended capabilities
+	  are interpreted as key definitions.
+	+ modify tic's check of conflicting key definitions to include extended
+	  capability strings in addition to the existing check on predefined
+	  keys.
+
+20120421
+	+ improve cleanup of temporary files in tic using atexit().
+	+ add msgr to vt420, similar DEC vtXXX entries -TD
+	+ add several missing vt420 capabilities from vt220 -TD
+	+ factor out ansi+pp from several entries -TD
+	+ change xterm+sl and xterm+sl-twm to include only the status-line
+	  capabilities and not "use=xterm", making them more generally useful
+	  as building-blocks -TD
+	+ add dec+sl building block, as example -TD
+
+20120414
+	+ add XT to some terminfo entries to improve usefulness for other
+	  applications than screen, which would like to pretend that xterm's
+	  title is a status-line.  -TD
+	+ change use-clauses in ansi-mtabs, hp2626, and hp2622 based on review
+	  of ordering and overrides -TD
+	+ add consistency check in tic for screen's "XT" capability.
+	+ add section in terminfo.src summarizing the user-defined capabilities
+	  used in that file -TD
+
+20120407
+	+ fix an inconsistency between tic/infocmp "-x" option; tic omits all
+	  non-standard capabilities, while infocmp was ignoring only the user
+	  definable capabilities.
+	+ improve special case in tic parsing of description to allow it to be
+	  followed by terminfo capabilities.  Previously the description had to
+	  be the last field on an input line to allow tic to distinguish
+	  between termcap and terminfo format while still allowing commas to be
+	  embedded in the description.
+	+ correct variable name in gen_edit.sh which broke configurability of
+	  the --with-xterm-kbs option.
+	+ revert 2011-07-16 change to "linux" alias, return to "linux2.2" -TD
+	+ further amend 20110910 change, providing for configure-script
+	  override of the "linux" terminfo entry to install and changing the
+	  default for that to "linux2.2" (Debian #665959).
+
+20120331
+	+ update Ada95/configure to use CF_DISABLE_ECHO (cf: 20120317).
+	+ correct order of use-clauses in st-256color -TD
+	+ modify configure script to look for gnatgcc if the Ada95 binding
+	  is built, in preference to the default gcc/cc (suggested by
+	  Nicolas Boulenguez).
+	+ modify configure script to ensure that the same -On option used for
+	  the C compiler in CFLAGS is used for ADAFLAGS rather than simply
+	  using "-O3" (suggested by Nicolas Boulenguez)
+
+20120324
+	+ amend an old fix so that next_char() exits properly for empty files,
+	  e.g., from reading /dev/null (cf: 20080804).
+	+ modify tic so that it can read from the standard input, or from
+	  a character device.  Because tic uses seek's, this requires writing
+	  the data to a temporary file first (prompted by remark by Sven
+	  Joachim) (cf: 20000923).
+
+20120317
+	+ correct a check made in lib_napms.c, so that terminfo applications
+	  can again use napms() (cf: 20110604).
+	+ add a note in tic.h regarding required casts for ABSENT_BOOLEAN
+	  (cf: 20040327).
+	+ correct scripting for --disable-echo option in test/configure.
+	+ amend check for missing c++ compiler to work when no error is
+	  reported, and no variables set (cf: 20021206).
+	+ add/use configure macro CF_DISABLE_ECHO.
+
+20120310
+	+ fix some strict compiler warnings for abi6 and 64-bits.
+	+ use begin_va_copy/end_va_copy macros in lib_printw.c (cf: 20120303).
+	+ improve a limit-check in infocmp.c (Werner Fink):
+
+20120303
+	+ minor tidying of terminfo.tail, clarify reason for limitation
+	  regarding mapping of \0 to \200
+	+ minor improvement to _nc_copy_termtype(), using memcpy to replace
+	  loops.
+	+ fix no-leaks checking in test/demo_termcap.c to account for multiple
+	  calls to setupterm().
+	+ modified the libgpm change to show previous load as a problem in the
+	  debug-trace.
+	> merge some patches from OpenSUSE rpm (Werner Fink):
+	+ ncurses-5.7-printw.dif, fixes for varargs handling in lib_printw.c
+	+ ncurses-5.7-gpm.dif, do not dlopen libgpm if already loaded by
+	  runtime linker
+	+ ncurses-5.6-fallback.dif, do not free arrays and strings from static
+	  fallback entries
+
+20120228
+	+ fix breakage in tic/infocmp from 20120225 (report by Werner Fink).
+
+20120225
+	+ modify configure script to allow creating dll's for MinGW when
+	  cross-compiling.
+	+ add --enable-string-hacks option to control whether strlcat and
+	  strlcpy may be used.  The same issue applies to OpenBSD's warnings
+	  about snprintf, noting that this function is weakly standardized.
+	+ add configure checks for strlcat, strlcpy and snprintf, to help
+	  reduce bogus warnings with OpenBSD builds.
+	+ build-fix for OpenBSD 4.9 to supply consistent intptr_t declaration
+	  (cf:20111231)
+	+ update config.guess, config.sub
+
+20120218
+	+ correct CF_ETIP_DEFINES configure macro, making it exit properly on
+	  the first success (patch by Pierre Labastie).
+	+ improve configure macro CF_MKSTEMP by moving existence-check for
+	  mkstemp out of the AC_TRY_RUN, to help with cross-compiles.
+	+ improve configure macro CF_FUNC_POLL from luit changes to detect
+	  broken implementations, e.g., with Mac OS X.
+	+ add configure option --with-tparm-arg
+	+ build-fix for MinGW cross-compiling, so that make_hash does not
+	  depend on TTY definition (cf: 20111008).
+
+20120211
+	+ make sgr for xterm-pcolor agree with other caps -TD
+	+ make sgr for att5425 agree with other caps -TD
+	+ make sgr for att630 agree with other caps -TD
+	+ make sgr for linux entries agree with other caps -TD
+	+ make sgr for tvi9065 agree with other caps -TD
+	+ make sgr for ncr260vt200an agree with other caps -TD
+	+ make sgr for ncr160vt100pp agree with other caps -TD
+	+ make sgr for ncr260vt300an agree with other caps -TD
+	+ make sgr for aaa-60-dec-rv, aaa+dec agree with other caps -TD
+	+ make sgr for cygwin, cygwinDBG agree with other caps -TD
+	+ add configure option --with-xterm-kbs to simplify configuration for
+	  Linux versus most other systems.
+
+20120204
+	+ improved tic -D option, avoid making target directory and provide
+	  better diagnostics.
+
+20120128
+	+ add mach-gnu (Debian #614316, patch by Samuel Thibault)
+	+ add mach-gnu-color, tweaks to mach-gnu terminfo -TD
+	+ make sgr for sun-color agree with smso -TD
+	+ make sgr for prism9 agree with other caps -TD
+	+ make sgr for icl6404 agree with other caps -TD
+	+ make sgr for ofcons agree with other caps -TD
+	+ make sgr for att5410v1, att4415, att620 agree with other caps -TD
+	+ make sgr for aaa-unk, aaa-rv agree with other caps -TD
+	+ make sgr for avt-ns agree with other caps -TD
+	+ amend fix intended to separate fixups for acsc to allow "tic -cv" to
+	  give verbose warnings (cf:  20110730). 
+	+ modify misc/gen-edit.sh to make the location of the tabset directory
+	  consistent with misc/Makefile.in, i.e., using ${datadir}/tabset
+	  (Debian #653435, patch by Sven Joachim).
+
+20120121
+	+ add --with-lib-prefix option to allow configuring for old/new flavors
+	  of OS/2 EMX.
+	+ modify check for gnat version to allow for year, as used in FreeBSD
+	  port.
+	+ modify check_existence() in db_iterator.c to simply check if the
+	  path is a directory or file, according to the need.  Checking for
+	  directory size also gives no usable result with OS/2 (cf: 20120107).
+	+ support OS/2 kLIBC (patch by KO Myung-Han).
+
+20120114
+	+ several improvements to test/movewindow.c (prompted by discussion on
+	  Linux Mint forum):
+	  + modify movement commands to make them continuous
+	  + rewrote the test for mvderwin
+	  + rewrote the test for recursive mvwin
+	+ split-out reusable CF_WITH_NCURSES_ETC macro in test/configure.in
+	+ updated configure macro CF_XOPEN_SOURCE, build-fixes for Mac OS X
+	  and OpenBSD.
+	+ regenerated html manpages.
+
+20120107
+	+ various improvments for MinGW (Juergen Pfeifer):
+	  + modify stat() calls to ignore the st_size member
+	  + drop mk-dlls.sh script.
+	  + change recommended regular expression library.
+	  + modify rain.c to allow for threaded configuraton.
+	  + modify tset.c to allow for case when size-change logic is not used. 
+
+20111231
+	+ modify toe's report when -a and -s options are combined, to add
+	  a column showing which entries belong to a given database.
+	+ add -s option to toe, to sort its output.
+	+ modify progs/toe.c, simplifying use of db-iterator results to use
+	  caching improvements from 20111001 and 20111126.
+	+ correct generation of pc-files when ticlib or termlib options are
+	  given to rename the corresponding tic- or tinfo-libraries (report
+	  by Sven Joachim).
+
+20111224
+	+ document a portability issue with tput, i.e., that scripts which work
+	  with ncurses may fail in other implementations that do no parameter
+	  analysis.
+	+ add putty-sco entry -TD
+
+20111217
+	+ review/fix places in manpages where --program-prefix configure option
+	  was not being used.
+	+ add -D option to infocmp, to show the database locations that it
+	  could use.
+	+ fix build for the special case where term-driver, ticlib and termlib
+	  are all enabled.  The terminal driver depends on a few features in
+	  the base ncurses library, so tic's dependencies include both ncurses
+	  and termlib.
+	+ fix build work for term-driver when --enable-wgetch-events option is
+	  enabled.
+	+ use <stdint.h> types to fix some questionable casts to void*.
+
+20111210
+	+ modify configure script to check if thread library provides
+	  pthread_mutexattr_settype(), e.g., not provided by Solaris 2.6
+	+ modify configure script to suppress check to define _XOPEN_SOURCE
+	  for IRIX64, since its header files have a conflict versus
+	  _SGI_SOURCE.
+	+ modify configure script to add ".pc" files for tic- and
+	  tinfo-libraries, which were omitted in recent change (cf: 20111126).
+	+ fix inconsistent checks on $PKG_CONFIG variable in configure script.
+
+20111203
+	+ modify configure-check for etip.h dependencies, supplying a temporary
+	  copy of ncurses_dll.h since it is a generated file (prompted by
+	  Debian #646977).
+	+ modify CF_CPP_PARAM_INIT "main" function to work with current C++.
+
+20111126
+	+ correct database iterator's check for duplicate entries
+	  (cf: 20111001).
+	+ modify database iterator to ignore $TERMCAP when it is not an
+	  absolute pathname.
+	+ add -D option to tic, to show the database locations that it could
+	  use.
+	+ improve description of database locations in tic manpage.
+	+ modify the configure script to generate a list of the ".pc" files to
+	  generate, rather than deriving the list from the libraries which have
+	  been built (patch by Mike Frysinger).
+	+ use AC_CHECK_TOOLS in preference to AC_PATH_PROGS when searching for
+	  ncurses*-config, e.g., in Ada95/configure and test/configure (adapted
+	  from patch by Mike Frysinger).
+
+20111119
+	+ remove obsolete/conflicting fallback definition for _POSIX_SOURCE
+	  from curses.priv.h, fixing a regression with IRIX64 and Tru64
+	  (cf: 20110416)
+	+ modify _nc_tic_dir() to ensure that its return-value is nonnull,
+	  i.e., the database iterator was not initialized.  This case is needed
+	  to when tic is translating to termcap, rather than loading the
+	  database (cf:  20111001).
+
+20111112
+	+ add pccon entries for OpenBSD console (Alexei Malinin).
+	+ build-fix for OpenBSD 4.9 with gcc 4.2.1, setting _XOPEN_SOURCE to
+	  600 to work around inconsistent ifdef'ing of wcstof between C and
+	  C++ header files.
+	+ modify capconvert script to accept more than exact match on "xterm",
+	  e.g., the "xterm-*" variants, to exclude from the conversion (patch
+	  by Robert Millan).
+	+ add -lc_r as alternative for -lpthread, allows build of threaded code
+	  in older FreeBSD machines.
+	+ build-fix for MirBSD, which fails when either _XOPEN_SOURCE or
+	  _POSIX_SOURCE are defined.
+	+ fix a typo misc/Makefile.in, used in uninstalling pc-files.
+
+20111030
+	+ modify make_db_path() to allow creating "terminfo.db" in the same
+	  directory as an existing "terminfo" directory.  This fixes a case
+	  where switching between hashed/filesystem databases would cause the
+	  new hashed database to be installed in the next best location -
+	  root's home directory.
+	+ add variable cf_cv_prog_gnat_correct to those passed to
+	  config.status, fixing a problem with Ada95 builds (cf: 20111022).
+	+ change feature test from _XPG5 to _XOPEN_SOURCE in two places, to
+	  accommodate broken implementations for _XPG6.
+	+ eliminate usage of NULL symbol from etip.h, to reduce header
+	  interdependencies.
+	+ add configure check to decide when to add _XOPEN_SOURCE define to
+	  compiler options, i.e., for Solaris 10 and later (cf: 20100403).
+	  This is a workaround for gcc 4.6, which fails to build the c++
+	  binding if that symbol is defined by the application, due to
+	  incorrectly combining the corresponding feature test macros
+	  (report by Peter Kruse).
+
+20111022
+	+ correct logic for discarding mouse events, retaining the partial
+	  events used to build up click, double-click, etc, until needed
+	  (cf: 20110917).
+	+ fix configure script to avoid creating unused Ada95 makefile when
+	  gnat does not work.
+	+ cleanup width-related gcc 3.4.3 warnings for 64-bit platform, for the
+	  internal functions of libncurses.  The external interface of courses
+	  uses bool, which still produces these warnings.
+
+20111015
+	+ improve description of --disable-tic-depends option to make it
+	  clear that it may be useful whether or not the --with-termlib
+	  option is also given (report by Sven Joachim).
+	+ amend termcap equivalent for set_pglen_inch to use the X/Open
+	  "YI" rather than the obsolete Solaris 2.5 "sL" (cf: 990109).
+	+ improve manpage for tgetent differences from termcap library.
+
+20111008
+	+ moved static data from db_iterator.c to lib_data.c
+	+ modify db_iterator.c for memory-leak checking, fix one leak.
+	+ modify misc/gen-pkgconfig.in to use Requires.private for the parts
+	  of ncurses rather than Requires, as well as Libs.private for the
+	  other library dependencies (prompted by Debian #644728).
+
+20111001
+	+ modify tic "-K" option to only set the strict-flag rather than force
+	  source-output.  That allows the same flag to control the parser for
+	  input and output of termcap source.
+	+ modify _nc_getent() to ignore backslash at the end of a comment line,
+	  making it consistent with ncurses' parser.
+	+ restore a special-case check for directory needed to make termcap
+	  text files load as if they were databases (cf: 20110924).
+	+ modify tic's resolution/collision checking to attempt to remove the
+	  conflicting alias from the second entry in the pair, which is
+	  normally following in the source file.  Also improved the warning
+	  message to make it simpler to see which alias is the problem.
+	+ improve performance of the database iterator by caching search-list.
+
+20110925
+	+ add a missing "else" in changes to _nc_read_tic_entry().
+
+20110924
+	+ modify _nc_read_tic_entry() so that hashed-database is checked before
+	  filesystem.
+	+ updated CF_CURSES_LIBS check in test/configure script.
+	+ modify configure script and makefiles to split TIC_ARGS and
+	  TINFO_ARGS into pieces corresponding to LDFLAGS and LIBS variables,
+	  to help separate searches for tic- and tinfo-libraries (patch by Nick
+	  Alcock aka "Nix").
+	+ build-fix for lib_mouse.c changes (cf: 20110917).
+
+20110917
+	+ fix compiler warning for clang 2.9
+	+ improve merging of mouse events (integrated patch by Damien
+	  Guibouret).
+	+ correct mask-check used in lib_mouse for wheel mouse buttons 4/5
+	  (patch by Damien Guibouret).
+
+20110910
+	+ modify misc/gen_edit.sh to select a "linux" entry which works with
+	  the current kernel rather than assuming it is always "linux3.0"
+	  (cf: 20110716).
+	+ revert a change to getmouse() which had the undesirable side-effect
+	  of suppressing button-release events (report by Damien Guibouret,
+	  cf: 20100102).
+	+ add xterm+kbs fragment from xterm #272 -TD
+	+ add configure option --with-pkg-config-libdir to provide control over
+	  the actual directory into which pc-files are installed, do not use
+	  the pkg-config environment variables (discussion with Frederic L W
+	  Meunier).
+	+ add link to mailing-list archive in announce.html.in, as done in
+	  FAQ (prompted by question by Andrius Bentkus).
+	+ improve manpage install by adjusting the "#include" examples to
+	  show the ncurses-subdirectory used when --disable-overwrite option
+	  is used.
+	+ install an alias for "curses" to the ncurses manpage, tied to the
+	  --with-curses-h configure option (suggested by Reuben Thomas).
+
+20110903
+	+ propagate error-returns from wresize, i.e., the internal
+	  increase_size and decrease_size functions through resize_term (report
+	  by Tim van der Molen, cf:  20020713).
+	+ fix typo in tset manpage (patch by Sven Joachim).
+
+20110820
+	+ add a check to ensure that termcap files which might have "^?" do
+	  not use the terminfo interpretation as "\177".
+	+ minor cleanup of X-terminal emulator section of terminfo.src -TD
+	+ add terminator entry -TD
+	+ add simpleterm entry -TD
+	+ improve wattr_get macros by ensuring that if the window pointer is
+	  null, then the attribute and color values returned will be zero
+	  (cf: 20110528).
+
+20110813
+	+ add substitution for $RPATH_LIST to misc/ncurses-config.in
+	+ improve performance of tic with hashed-database by caching the
+	  database connection, using atexit() to cleanup.
+	+ modify treatment of 2-character aliases at the beginning of termcap
+	  entries so they are not counted in use-resolution, since these are
+	  guaranteed to be unique.  Also ignore these aliases when reporting
+	  the primary name of the entry (cf: 20040501)
+	+ double-check gn (generic) flag in terminal descriptions to
+	  accommodate old/buggy termcap databases which misused that feature.
+	+ minor fixes to _nc_tgetent(), ensure buffer is initialized even on
+	  error-return.
+
+20110807
+	+ improve rpath fix from 20110730 by ensuring that the new $RPATH_LIST
+	  variable is defined in the makefiles which use it.
+	+ build-fix for DragonFlyBSD's pkgsrc in test/configure script.
+	+ build-fixes for NetBSD 5.1 with termcap support enabled.
+	+ corrected k9 in dg460-ansi, add other features based on manuals -TD
+	+ improve trimming of whitespace at the end of terminfo/termcap output
+	  from tic/infocmp.
+	+ when writing termcap source, ensure that colons in the description
+	  field are translated to a non-delimiter, i.e., "=".
+	+ add "-0" option to tic/infocmp, to make the termcap/terminfo source
+	  use a single line.
+	+ add a null-pointer check when handling the $CC variable.
+
+20110730
+	+ modify configure script and makefiles in c++ and progs to allow the
+	  directory used for rpath option to be overridden, e.g., to work
+	  around updates to the variables used by tic during an install.
+	+ add -K option to tic/infocmp, to provide stricter BSD-compatibility
+	  for termcap output.
+	+ add _nc_strict_bsd variable in tic library which controls the
+	  "strict" BSD termcap compatibility from 20110723, plus these
+	  features:
+	  + allow escapes such as "\8" and "\9" when reading termcap
+	  + disallow "\a", "\e", "\l", "\s" and "\:" escapes when reading
+	    termcap files, passing through "a", "e", etc.
+	  + expand "\:" as "\072" on output.
+	+ modify _nc_get_token() to reset the token's string value in case
+	  there is a string-typed token lacking the "=" marker.
+	+ fix a few memory leaks in _nc_tgetent.
+	+ fix a few places where reading from a termcap file could refer to
+	  freed memory.
+	+ add an overflow check when converting terminfo/termcap numeric
+	  values, since terminfo stores those in a short, and they must be
+	  positive.
+	+ correct internal variables used for translating to termcap "%>"
+	  feature, and translating from termcap %B to terminfo, needed by
+	  tctest (cf: 19991211).
+	+ amend a minor fix to acsc when loading a termcap file to separate it
+	  from warnings needed for tic (cf: 20040710)
+	+ modify logic in _nc_read_entry() and _nc_read_tic_entry() to allow
+	  a termcap file to be handled via TERMINFO_DIRS.
+	+ modify _nc_infotocap() to include non-mandatory padding when
+	  translating to termcap.
+	+ modify _nc_read_termcap_entry(), passing a flag in the case where
+	  getcap is used, to reduce interactive warning messages.
+
+20110723
+	+ add a check in start_color() to limit color-pairs to 256 when
+	  extended colors are not supported (patch by David Benjamin).
+	+ modify setcchar to omit no-longer-needed OR'ing of color pair in
+	  the SetAttr() macro (patch by David Benjamin).
+	+ add kich1 to sun terminfo entry (Yuri Pankov)
+	+ use bold rather than reverse for smso in sun-color terminfo entry
+	  (Yuri Pankov).
+	+ improve generation of termcap using tic/infocmp -C option, e.g.,
+	  to correspond with 4.2BSD (prompted by discussion with Yuri Pankov
+	  regarding Schilling's test program):
+	  + translate %02 and %03 to %2 and %3 respectively.
+	  + suppress string capabilities which use %s, not supported by tgoto
+	  + use \040 rather than \s
+	  + expand null characters as \200 rather than \0
+	+ modify configure script to support shared libraries for DragonFlyBSD.
+
+20110716
+	+ replace an assert() in _nc_Free_Argument() with a regular null
+	  pointer check (report/analysis by Franjo Ivancic).
+	+ modify configure --enable-pc-files option to take into account the
+	  PKG_CONFIG_PATH variable (report by Frederic L W Meunier).
+	+ add/use xterm+tmux chunk from xterm #271 -TD
+	+ resync xterm-new entry from xterm #271 -TD
+	+ add E3 extended capability to linux-basic (Miroslav Lichvar)
+	+ add linux2.2, linux2.6, linux3.0 entries to give context for E3 -TD
+	+ add SI/SO change to linux2.6 entry (Debian #515609) -TD
+	+ fix inconsistent tabset path in pcmw (Todd C. Miller).
+	+ remove a backslash which continued comment, obscuring altos3
+	  definition with OpenBSD toolset (Nicholas Marriott).
+
+20110702
+	+ add workaround from xterm #271 changes to ensure that compiler flags
+	  are not used in the $CC variable.
+	+ improve support for shared libraries, tested with AIX 5.3, 6.1 and
+	  7.1 with both gcc 4.2.4 and cc.
+	+ modify configure checks for AIX to include release 7.x
+	+ add loader flags/libraries to libtool options so that dynamic loading
+	  works properly, adapted from ncurses-5.7-ldflags-with-libtool.patch
+	  at gentoo prefix repository (patch by Michael Haubenwallner).
+
+20110626
+	+ move include of nc_termios.h out of term_entry.h, since the latter
+	  is installed, e.g., for tack while the former is not (report by
+	  Sven Joachim).
+
+20110625
+	+ improve cleanup() function in lib_tstp.c, using _exit() rather than
+	  exit() and checking for SIGTERM rather than SIGQUIT (prompted by
+	  comments forwarded by Nicholas Marriott).
+	+ reduce name pollution from term.h, moving fallback #define's for
+	  tcgetattr(), etc., to new private header nc_termios.h (report by
+	  Sergio NNX).
+	+ two minor fixes for tracing (patch by Vassili Courzakis).
+	+ improve trace initialization by starting it in use_env() and
+	  ripoffline().
+	+ review old email, add details for some changelog entries.
+
+20110611
+	+ update minix entry to minix 3.2 (Thomas Cort).
+	+ fix a strict compiler warning in change to wattr_get (cf: 20110528).
+
+20110604
+	+ fixes for MirBSD port:
+	  + set default prefix to /usr.
+	  + add support for shared libraries in configure script.
+	  + use S_ISREG and S_ISDIR consistently, with fallback definitions.
+	+ add a few more checks based on ncurses/link_test.
+	+ modify MKlib_gen.sh to handle sp-funcs renaming of NCURSES_OUTC type.
+
+20110528
+	+ add case to CF_SHARED_OPTS for Interix (patch by Markus Duft).
+	+ used ncurses/link_test to check for behavior when the terminal has
+	  not been initialized and when an application passes null pointers
+	  to the library.  Added checks to cover this (prompted by Redhat
+	  #707344).
+	+ modify MKlib_gen.sh to make its main() function call each function
+	  with zero parameters, to help find inconsistent checking for null
+	  pointers, etc.
+
+20110521
+	+ fix warnings from clang 2.7 "--analyze"
+
+20110514
+	+ compiler-warning fixes in panel and progs.
+	+ modify CF_PKG_CONFIG macro, from changes to tin -TD
+	+ modify CF_CURSES_FUNCS configure macro, used in test directory
+	  configure script:
+	  + work around (non-optimizer) bug in gcc 4.2.1 which caused
+	    test-expression to be omitted from executable.
+	  + force the linker to see a link-time expression of a symbol, to
+	    help work around weak-symbol issues.
+
+20110507
+	+ update discussion of MKfallback.sh script in INSTALL; normally the
+	  script is used automatically via the configured makefiles.  However
+	  there are still occasions when it might be used directly by packagers
+	  (report by Gunter Schaffler).
+	+ modify misc/ncurses-config.in to omit the "-L" option from the
+	  "--libs" output if the library directory is /usr/lib.
+	+ change order of tests for curses.h versus ncurses.h headers in the
+	  configure scripts for Ada95 and test-directories, to look for
+	  ncurses.h, from fixes to tin -TD
+	+ modify ncurses/tinfo/access.c to account for Tandem's root uid
+	  (report by Joachim Schmitz).
+
+20110430
+	+ modify rules in Ada95/src/Makefile.in to ensure that the PIC option
+	  is not used when building a static library (report by Nicolas
+	  Boulenguez):
+	+ Ada95 build-fix for big-endian architectures such as sparc.  This
+	  undoes one of the fixes from 20110319, which added an "Unused" member
+	  to representation clauses, replacing that with pragmas to suppress
+	  warnings about unused bits (patch by Nicolas Boulenguez):
+
+20110423
+	+ add check in test/configure for use_window, use_screen.
+	+ add configure-checks for getopt's variables, which may be declared
+	  as different types on some Unix systems.
+	+ add check in test/configure for some legacy curses types of the
+	  function pointer passed to tputs().
+	+ modify init_pair() to accept -1's for color value after
+	  assume_default_colors() has been called (Debian #337095).
+	+ modify test/background.c, adding commmand-line options to demonstrate
+	  assume_default_colors() and use_default_colors().
+
+20110416
+	+ modify configure script/source-code to only define _POSIX_SOURCE if
+	  the checks for sigaction and/or termios fail, and if _POSIX_C_SOURCE
+	  and _XOPEN_SOURCE are undefined (report by Valentin Ochs).
+	+ update config.guess, config.sub
+
+20110409
+	+ fixes to build c++ binding with clang 3.0 (patch by Alexander
+	  Kolesen).
+	+ add check for unctrl.h in test/configure, to work around breakage in
+	  some ncurses packages.
+	+ add "--disable-widec" option to test/configure script.
+	+ add "--with-curses-colr" and "--with-curses-5lib" options to the
+	  test/configure script to address testing with very old machines.
+
 20110404 5.9 release for upload to ftp.gnu.org
 
 20110402
@@ -100,7 +1168,7 @@
 	+ modify configure script to provide value for HTML_DIR in
 	  Ada95/gen/Makefile.in, which depends on whether the Ada95 binding is
 	  distributed separately (report by Nicolas Boulenguez).
-	+ modify configure script to add -g and/or -O3 to ADAFLAGS if the
+	+ modify configure script to add "-g" and/or "-O3" to ADAFLAGS if the
 	  CFLAGS for the build has these options.
 	+ amend change from 20070324, to not add 1 to the result of getmaxx
 	  and getmaxy in the Ada binding (report by Nicolas Boulenguez for
@@ -155,7 +1223,7 @@
 20110212
 	+ regenerated html manpages.
 	+ use _tracef() in show_where() function of tic, to work correctly with
-	  special case of trace configuration. 
+	  special case of trace configuration.
 
 20110205
 	+ add xterm-utf8 entry as a demo of the U8 feature -TD
@@ -219,7 +1287,7 @@
 	  version which works with termcap.
 	+ remove obsolete emacs "Local Variables" section from documentation
 	  (request by Sven Joachim).
-	+ update doc/html/index.html to include NCURSES-Programming-HOWTO.html 
+	+ update doc/html/index.html to include NCURSES-Programming-HOWTO.html
 	  (report by Sven Joachim).
 
 20101128
@@ -294,8 +1362,8 @@
 	  Sven Joachim).
 	+ add parameterized cursor-controls to linux-basic (report by Dae) -TD
 	> patch by Juergen Pfeifer:
-	+ document how to build 32-bit libraries in README.MinGW 
-	+ fixes to filename computation in mk-dlls.sh.in 
+	+ document how to build 32-bit libraries in README.MinGW
+	+ fixes to filename computation in mk-dlls.sh.in
 	+ use POSIX locale in mk-dlls.sh.in rather than en_US (report by Sven
 	  Joachim).
 	+ add a check in mk-dlls.sh.in to obtain the size of a pointer to
@@ -478,7 +1546,7 @@
 20100417
 	+ modify _nc_capcmp() to work with cancelled strings.
 	+ correct translation of "^" in _nc_infotocap(), used to transform
-	  terminfo to termcap strings 
+	  terminfo to termcap strings
 	+ add configure --disable-rpath-hack, to allow disabling the feature
 	  which adds rpath options for libraries in unusual places.
 	+ improve CF_RPATH_HACK_2 by checking if the rpath option for a given
@@ -1533,8 +2601,8 @@
 	  that library.
 	+ add/modify null-pointer checks in several functions for SP and/or
 	  the WINDOW* parameter (report by Thorben Krueger).
-	+ fixes for field_buffer() in formw library (see Redhat Bugzilla
-	  #310071, patches by Miroslav Lichvar).
+	+ fixes for field_buffer() in formw library (see Redhat #310071,
+	  patches by Miroslav Lichvar).
 	+ improve performance of NCURSES_CHAR_EQ code (patch by Miroslav
 	  Lichvar).
 	+ update/improve mlterm and rxvt terminfo entries, e.g., for
@@ -1645,7 +2713,7 @@
 	+ modify configure script to quiet c++ build with libtool when the
 	  --disable-echo option is used.
 	+ modify configure script to disable ada95 if libtool is selected,
-	  writing a warning message (addresses FreeBSD ports/114493).
+	  writing a warning message (addresses FreeBSD #114493).
 	+ update config.guess, config.sub
 
 20070707
@@ -2130,8 +3198,7 @@
 	+ workaround for 20050806 ifdef's change to allow visbuf.c to compile
 	  when using --with-termlib --with-trace options.
 	+ improve tgetstr() by making the return value point into the user's
-	  buffer, if provided (patch by Miroslav Lichvar (see Redhat Bugzilla
-	  #202480)).
+	  buffer, if provided (patch by Miroslav Lichvar (see Redhat #202480)).
 	+ correct libraries needed for foldkeys (report by Stanislav Ievlev)
 
 20060826
@@ -2144,10 +3211,10 @@
 	  source output (Debian #378783).
 	+ modify configure script to ensure that if the C compiler is used
 	  rather than the loader in making shared libraries, the $(CFLAGS)
-	  variable is also used (Redhat Bugzilla #199369).
+	  variable is also used (Redhat #199369).
 	+ port hashed-db code to db2 and db3.
 	+ fix a bug in tgetent() from 20060625 and 20060715 changes
-	  (patch/analysis by Miroslav Lichvar (see Redhat Bugzilla #202480)).
+	  (patch/analysis by Miroslav Lichvar (see Redhat #202480)).
 
 20060805
 	+ updated xterm function-keys terminfo to match xterm #216 -TD
@@ -2939,7 +4006,7 @@
 	  of cur_term if the same output was selected.  This now reuses it only
 	  when setupterm() is called from tgetent(), which has no notion of
 	  separate SCREENs.  Note that tgetent() must be called after initscr()
-	  or newterm() to use this feature (Redhat Bugzilla #140326).
+	  or newterm() to use this feature (Redhat #140326).
 	+ add a check in CF_BUILD_CC macro to ensure that developer has given
 	  the --with-build-cc option when cross-compiling (report by Alexandre
 	  Campo).
@@ -3032,7 +4099,7 @@
 	  entries, e.g., so it can analyze the xterm-8bit entry.
 	+ add morphos terminfo entry, improve amiga-8bit entry (Pavel Fedin).
 	+ correct translation of "%%" in terminfo format to termcap, e.g.,
-	  using "tic -C" (Redhat Bugzilla #130921).
+	  using "tic -C" (Redhat #130921).
 	+ modified configure script CF_XOPEN_SOURCE macro to ensure that if
 	  it defines _POSIX_C_SOURCE, that it defines it to a specific value
 	  (comp.os.stratus newsgroup comment).
@@ -3043,9 +4110,9 @@
 	  However that did find a coding error in Assume_Default_Colors().
 	+ modify several terminfo entries to ensure xterm mouse and cursor
 	  visibility are reset in rs2 string:  hurd, putty, gnome,
-	  konsole-base, mlterm, Eterm, screen (Debian #265784, #55637).  The
-	  xterm entries are left alone - old ones for compatibility, and the
-	  new ones do not require this change. -TD
+	  konsole-base, mlterm, Eterm, screen (Debian #265784, Debian #55637). 
+	  The xterm entries are left alone - old ones for compatibility, and
+	  the new ones do not require this change. -TD
 
 20040814
 	+ fake a SIGWINCH in newterm() to accommodate buggy terminal emulators
@@ -3076,8 +4143,8 @@
 	+ modify "tic -cv" to ignore delays when comparing strings.  Also
 	  modify it to ignore a canceled sgr string, e.g., for terminals which
 	  cannot properly combine attributes in one control sequence.
-	+ corrections for gnome and konsole entries (Redhat Bugzilla #122815,
-	  patch by Hans de Goede)
+	+ corrections for gnome and konsole entries (Redhat #122815, patch by
+	  Hans de Goede)
 	> terminfo updates -TD
 	+ make ncsa-m rmacs/smacs consistent with sgr
 	+ add sgr, rc/sc and ech to syscons entries
@@ -3090,7 +4157,7 @@
 	> terminfo updates -TD
 	+ add xterm-pc-fkeys
 	+ review/update gnome and gnome-rh90 entries (prompted by Redhat
-	  Bugzilla #122815).
+	  #122815).
 	+ review/update konsole entries
 	+ add sgr, correct sgr0 for kterm and mlterm
 	+ correct tsl string in kterm
@@ -4204,7 +5271,7 @@
 	+ add a check in kgetch() for cooked characters in the fifo to avoid
 	  calling fifo_push() when a KEY_RESIZE is available (report/analysis
 	  by Sam Varshavchik <mrsam@courier-mta.com>).
-	+ fix an overlooked case for bugzilla #68199 (Philippe Blain).
+	+ fix an overlooked case for Redhat #68199 (Philippe Blain).
 	+ ensure clearerr() is called before using ferror() e.g., in
 	  lib_screen.c (report by Philippe Blain).
 
@@ -4212,7 +5279,7 @@
 	+ modify lib_screen.c and lib_newwin.c to maintain the SCREEN-specific
 	  pointers for curscr/stdscr/newscr when scr_save() and scr_restore()
 	  modify the global curscr/stdscr/newscr variables.  Fixes Redhat
-	  bugzilla #68199 dated 2002-07-07.
+	  #68199.
 	+ add checks for null pointer in calls to tparm() and tgoto() based on
 	  FreeBSD bug report.  If ncurses were built with termcap support, and
 	  the first call to tgoto() were a zero-length string, the result would
@@ -4245,7 +5312,7 @@
 	  Olaf Buddenhagen <olafBuddenhagen@web.de>).
 	+ modified wresize() to ensure that a failed realloc will not corrupt
 	  the window structure, and to make subwindows fit within the resized
-	  window (completes Debian #87678, #101699)
+	  window (completes Debian #87678, Debian #101699)
 
 20020803
 	+ fix an off-by-one in lib_pad.c check for limits of pad (patch by
@@ -4940,9 +6007,9 @@
 	  which may be in libutf8.
 	+ remove some unnecessary text from curs_extend.3x and
 	  default_colors.3x which caused man-db to make incorrect symbolic
-	  links (Debian bug report #99550).
+	  links (Debian #99550).
 	+ add configure check if cast for _IO_va_list is needed to compile
-	  C++ vscan code (Debian bug report #97945).
+	  C++ vscan code (Debian #97945).
 	> several patches from Sven Verdoolaege:
 	+ correct code that used non-standard auto-initialization of a struct,
 	  which gcc allows (report by Larry Virden).
@@ -5077,7 +6144,7 @@
 	+ add some examples of customizing screen's terminfo:
 	  screen.xterm-xfree86, screen.xterm-r6, screen.teraterm -TD
 	+ modify screen's terminfo entry to match the khome/kend in screen
-	  3.09.08 (Debian bug report #92215).
+	  3.09.08 (Debian #92215).
 	+ correct a memory leak in forms library (report by Stefan Vogtner
 	  <stefan@vogtner.de>) (patch by Juergen Pfeifer).
 
@@ -5091,12 +6158,12 @@
 	+ add .cc.ii rule to c++ makefile, to get preprocessor output for
 	  debugging.
 	+ correct configure script handling of @keyword@ substitutions when the
-	  --with-manpage-renames option is given (cf:  20000715, fixes Debian
-	  bug #89939).
+	  --with-manpage-renames option is given (cf: 20000715, fixes Debian
+	  #89939).
 	+ report stack underflow/overflow in tparm() when tic -cv option is
 	  given.
 	+ remove spurious "%|" operator from xterm-xfree86 terminfo entry,
-	  (reported by Adam Costello <amc@cs.berkeley.edu>, Debian bug #89222).
+	  (reported by Adam Costello <amc@cs.berkeley.edu>, Debian #89222).
 
 20010310
 	+ cleanup of newdemo.c, fixing some ambiguous expressions noted by gcc
@@ -5800,7 +6867,7 @@
 	+ correct spelling error in terminfo entry name:  bq300-rv was given as
 	  bg300-rv in esr's version.
 	+ modify redrawwin() macro so its parameter is fully parenthesized
-	  (fixes Debian bug report #61088).
+	  (fixes Debian #61088).
 	+ correct formatting error in dump_entry() which set incorrect column
 	  value when no newline trimming was needed at the end of an entry,
 	  before appending "use=" clauses (cf: 960406).
@@ -6530,7 +7597,7 @@
 	  handling in lynx (reported by Kim DeVaughn).
 
 990306	pre-release
-	+ add -G option to tic and infocmp, to reverse the -g option.
+	+ add -G option to tic and infocmp, to reverse the "-g" option.
 	+ recode functions in name_match.c to avoid use of strncpy, which
 	  caused a 4-fold slowdown in tic (cf: 980530).
 	+ correct a few warnings about sign-extension in recent changes.
@@ -6901,7 +7968,7 @@
 	  since that is a little more efficient.
 	+ minor correction to infocmp to avoid displaying "difference" between
 	  two capabilities that are rendered in equivalent forms.
-	+ add -g option to tic/infocmp to force character constants to be
+	+ add "-g" option to tic/infocmp to force character constants to be
 	  displayed in quoted form.  Otherwise their decimal values are shown.
 	+ modify setupterm so that cancelled strings are treated the same as
 	  absent strings, cancelled and absent booleans false (does not affect
@@ -8979,15 +10046,18 @@
 	+ correction to #317.
 	> patch 317 (ESR):
 	+ re-add _nc_hash_map
-	+ modify EmitRange to maintain position as per original design.
-	+ add hashtest.c, program to time the hashmap optimization.
+	+ modify EmitRange to maintain position as per original design
+	  (patch by A. Lukyanov).
+	+ modify test/ncurses.c and tputs, etc., to allow trace counting
+	  output characters.
+	+ add hashtest.c program to time the hashmap optimization.
 	> patch 316 (ESR):
 	+ add logic to deal with magic-cookie (how was this tested?)
 	  (lib_doupdate.c).
 	+ add ncurses.c driver for magic-cookie, some fixes to ncurses.c
 	> patch 315 (ESR):
-	+ merged Alexander V Lukyanov's patch to use ech and rep - untested
-	  (lib_doupdate.c).
+	+ merge changes to lib_doupdate.c to use ech and rep - untested
+	  (patch by Alexander V Lukyanov).
 	+ modified handling of interrupted system calls - untested
 	  (lib_getch.c, lib_twait.c).
 	+ new function _nc_mvcur_resume()
@@ -9059,12 +10129,12 @@
 	+ corrected typo in dtterm description.
 	> patch 313 (ESR):
 	+ add dtterm description
-	+ clarify ncurses 'i' test (drop vscanf subtest)
+	+ clarify ncurses 'i' test (drop mvwscanw subtest)
 
 960810	- snapshot
 	+ correct nl()/nonl() to work as per SVr4 & XSI.
 	+ minor fixes to ncurses.c (use 'noraw()', mvscanw return-code)
-	+ refine configure-test for -g option (Tim Mooney).
+	+ refine configure-test for "-g" option (Tim Mooney).
 	+ correct interaction between O_BLANK and NEW_LINE request in form
 	  library (Juergen Pfeifer)
 
@@ -9073,7 +10143,8 @@
 	> patch 312 (ESR):
 	  correct terminfo.src corrupted by #310
 	> patch 311 (ESR):
-	+ fix idlok() and idcok() and the default of the idlok switch.
+	+ fix idlok() and idcok() and the default of the idlok switch (report
+	  by Ville Sulko).
 
 960803	- snapshot
 	+ corrected tparm to handle capability strings without explicit pop
@@ -9083,7 +10154,7 @@
 	> patch 310 (ESR):
 	+ documentation and prototyping errors for has_color, immedok and idcok
 	  (reported by William P Setzer <wsetzer@pams.ncsu.edu>)
-	+ updated qnx terminfo entry (by Michael Hunter)
+	+ updated qnx terminfo entry (patch by Michael Hunter)
 
 960730
 	+ eliminate quoted includes in ncurses subdirectory, ensure config.h
@@ -9095,7 +10166,7 @@
 	+ call cbreak() in initscr(), as per XSI & SVr4.
 	+ turn off hardware echo in initscr() as per XSI & SVr4
 	> patch 309 (ESR):
-	+ terminfo changes (9.3.10), from BRL
+	+ terminfo changes (9.3.9), from BRL
 	+ add more checks to terminfo parser.
 	+ add more symbols to infocmp.
 
@@ -9114,6 +10185,7 @@
 	> patch 308 (ESR):
 	+ terminfo changes (9.3.8)
 	+ modified logic of error-reporting in terminfo parser
+	+ fix option-processing bug in toe.
 
 960713	- snapshot
 	+ always check for <sys/bsdtypes.h> since ISC needs it to declare
@@ -9122,9 +10194,19 @@
 	  by Juergen Pfeifer, Mike Long)
 	+ add LOCAL_LDFLAGS2 symbol (Juergen Pfeifer)
 	+ corrected prototype for delay_output() -- bump ABI to 3.2
-	+ terminfo patches #306/307 (ESR).
+	+ patch 307 (ESR):
+	+ enable more translations of nonstandard caps, and document them.
+	+ misc/terminfo.src update to 9.13.8
+	+ patch 306 (ESR):
 	+ moved logic that filters out rmul and rmso from setupterm to newterm
 	  where it is less likely to interfere with termcap applications.
+	+ cosmetic fixes to test/ncurses.c
+	+ modify open() call in ncurses/read_entry.c to use O_RDONLY symbol
+	  rather than constant (report by mib).
+	+ misc/terminfo.src sgr0 and acsc changes (report by Philippe De
+	  Muyter).
+	+ modify ncurses/comp_parse.c so that entries containing a "+" can
+	  have missing rmcup vs smcup.
 
 960707
 	+ rollback ESR's #305 change to terminfo.src (it breaks existing
@@ -9139,7 +10221,6 @@
 	+ make lib_vidattr.c more readable using macros.
 	+ filter out rmul, rmso that conflict with sgr0 when reading terminal
 	  descriptions.
-	+ added sanity-checking of various paired string attributes (ESR).
 	+ work around autoconf bug, force $INSTALL to absolute path
 	  (reported by Zeyd).
 	+ modify man-page install for BSDI to install preformatted .0 files
@@ -9152,6 +10233,12 @@
 	+ disable scrollok during the ncurses 'p' test; if it is enabled the
 	  stdscr will scroll when putting the box-corners in the lower-right
 	  of the screen.
+	> patch 305 (ESR):
+	+ added sanity-checking of various paired string attributes.
+	+ misc/terminfo.src update to 9.13.7 (report by A. Lukyanov).
+	+ modify man/Makefile.in to make terminfo.5 during normal build.
+	> patch 304 (ESR):
+	+ corrected allocation-length for $HOME/.terminfo path.
 
 960629	- snapshot
 	+ check return code of _nc_mvcur_scrolln() in _nc_scroll_optimize() for
@@ -9234,6 +10321,7 @@
 	+ better fix for nvi refresh-bug (Rick Marshall)
 	+ fix for bug in handling of interrupted keystroke waits,
 	  (Werner Fleck).
+	+ misc/ncurses-intro.html syntax fix (Kajiyama Tamito).
 
 960601	- snapshot
 	+ auto-configure man-page compression-format and renames for Debian.
@@ -9248,7 +10336,7 @@
 	+ enhancement to the control over the new PC-style soft key format.
 	  allow caller now to select whether or not one wants to have
 	  the index-line; see curs_slk.3x for documentation (Juergen Pfeifer).
-	+ typos, don't use inline with -g (Philippe De Muyter)
+	+ typos, don't use inline with "-g" (Philippe De Muyter)
 	+ fixes for menus & wattr-, slk-functions (Juergen Pfeifer)
 
 960526	- snapshot
@@ -9263,6 +10351,9 @@
 	+ include sys/types.h in case stdlib.h does not declare size_t.
 	+ fixes for makefile (Tim Mooney)
 	+ fixes for menus & forms (Juergen Pfeifer)
+	> patch 302 (ESR):
+	+ improve hash function (suggested by Alexander V Lukyanov).
+	+ 9.13.4 update for terminfo.src
 
 960518	- snapshot
 	+ revised ncurses.c panner test, let pad abut all 4 sides of screen.
@@ -9275,6 +10366,8 @@
 	  confusion, and made this check for the /usr/lib/terminfo pre-existing
 	  directory.
 	> patches 299-301 (ESR):
+	+ html fixes (Phillippe de Muyter).
+	+ fix typo in ncurses-intro.html (report by Fabrizio Polacco).
 	+ added hashmap.c
 	+ mods to tracing, especially for ACS chars.
 	+ corrected off-by-one in IDCtransform.
@@ -9294,13 +10387,21 @@
 	> patches 297, 298 (ESR):
 	+ implement TERMINFO_DIRS, and -o option of tic
 	+ added TRACE_IEVENT
-	+ removed boolean version of 'getm'
-	+ added lib_print.c (for Rick Marshall)
-	+ added has_key()
+	+ fix REQ_TOGGLE_ITEM in menu/menu_driver.c; it could select but not
+	  deselect.
+	+ added lib_print.c (request by Rick Marshall).
+	+ added has_key() (request by Juergen Pfeifer).
+	+ do not issue clrtoeol or clrtobot if the relevant portion of the line
+	  is already blank (analysis by Keith Bostic).
+	+ add parentheses for parameters of COLOR_PAIR and PAIR_NUMBER macros
+	  (analysis by Jurgen Eidt).
+	+ update screen's notion of cursor position in endwin() (analysis by
+	  Alexander Lukyanov).
 	+ added 't' to ncurses.c test.
 	+ moved delay_output() to lib_tputs.c
 	+ removed tparam() (was added in 1.9.9, but conflicts with emacs and
 	  is not part of X/Open Curses).
+	+ removed boolean version of 'getm'.
 	+ misc cursor & optimization fixes.
 
 960504	- snapshot
@@ -9326,11 +10427,20 @@
 	+ make TIOCGWINSZ configure test less stringent, in case user
 	  configures via terminal that cannot get screen size.
 	> patches 295, 296 (ESR):
-	+ new "-e" option of tic.
-	+ fix for "infocmp -e".
-	+ restore working-directory in read_termcap.c
 	+ split lib_kernel.c, lib_setup.c and names.c in order to reduce
 	  overhead for programs that use only termcap features.
+	+ new "-e" and "-h" options of tic (request by Tony Nugent).
+	+ fix bug in mandatory-delay logic in lib_tputs.c (report by Sven
+	  Verdoolaege).
+	+ fix for "infocmp -e" to emit correct initializers (reported by Manual
+	  J Novoa III).
+	+ restore working-directory in read_termcap.c (report by Kayvan
+	  Sylvan).
+	+ use "-h" option on Solaris when generating shared libraries on
+	  Solaris 2.5 to record the library name in the file, for assisting
+	  the loader (patch by Scott Kramer).
+	+ undo patch #294 changes to form and menu libraries (request by
+	  Juergen Pfeifer).
 
 960418	- snapshot
 	+ use autoconf 2.9
@@ -9338,10 +10448,22 @@
 	  definitions via <termios.h>, modified macros in lib_raw.c to avoid
 	  K&R-style substitution)
 	> patches 293, 294 (ESR):
-	+ mods to wgetch() in cooked mode
-	+ corrected askuser() logic in tset
-	+ correct interaction of endwin() with mouse processing
+	+ rewrite wsyncup(), wsyncdown(), as well as small fixes to form and
+	  menu libraries to fix echo-breakage introduced by 1.8.9, 1.9.9e
+	  changes (patches by Juergen Pfeifer).
+	+ fix compile under QNX 4.2 by defining ONLCR in lib_raw.c when
+	  __QNX__ is defined (patch by Michael Hunter).
+	+ modify setupterm() to match documentation for its return value, fix
+	  newterm to work with this change (report by Emmet Lazich).
+	+ add checks in getch() for error, return ERR as appropriate (report by
+	  Emmet Lazich).
+	+ mods to wgetch() in cooked mode (report by Pete Seebach).
+	+ corrected askuser() logic in tset (patch by Remco Treffkorn).
+	+ correct interaction of endwin() with mouse processing (report by
+	  Michael Elkins).
 	+ added trace support for TTY flags
+	+ update terminfo.src to 9.13.1
+	+ FreeBSD console entries (patch by Andrew Chernov).
 
 960406
 	+ fixes for NeXT, ISC and HPUX auto-configure
Index: README
Prereq:  1.23 
--- ncurses-5.9/README	2006-04-22 22:19:37.000000000 +0000
+++ ncurses-5.9-20130504/README	2012-08-11 20:11:26.000000000 +0000
@@ -1,5 +1,5 @@
 -------------------------------------------------------------------------------
--- Copyright (c) 1998-2004,2006 Free Software Foundation, Inc.               --
+-- Copyright (c) 1998-2011,2012 Free Software Foundation, Inc.               --
 --                                                                           --
 -- Permission is hereby granted, free of charge, to any person obtaining a   --
 -- copy of this software and associated documentation files (the             --
@@ -25,7 +25,7 @@
 -- sale, use or other dealings in this Software without prior written        --
 -- authorization.                                                            --
 -------------------------------------------------------------------------------
--- $Id: README,v 1.23 2006/04/22 22:19:37 tom Exp $
+-- $Id: README,v 1.25 2012/08/11 20:11:26 tom Exp $
 -------------------------------------------------------------------------------
 		README file for the ncurses package
 
@@ -78,6 +78,10 @@
 library interfaces are not binary-compatible with the non-wide-character
 version.
 
+If you configure using the --enable-reentrant option, a "t" is appended to the
+library names (e.g., libncursest.a) and the resulting libraries have a
+different binary interface which makes the ncurses interface more "opaque".
+
 The ncurses libraries implement the curses API.  The panel, menu and forms
 libraries implement clones of the SVr4 panel, menu and forms APIs.  The source
 code for these lives in the `ncurses', `panel', `menu', and `form' directories
@@ -122,8 +126,9 @@
 	tic             -- terminfo source to binary compiler
 	infocmp         -- terminfo binary to source decompiler/comparator
 	clear           -- emits clear-screen for current terminal
+	tabs            -- set tabs on a terminal
 	tput            -- shell-script access to terminal capabilities.
-	toe		-- table of entries utility
+	toe             -- table of entries utility
 	tset            -- terminal-initialization utility
 
 The first two (tic and infocmp) are used for manipulating terminfo
@@ -153,8 +158,10 @@
 	configuration scripts, porting, mods to adhere to XSI Curses in the
 	areas of background color, terminal modes.  Also memory leak testing,
 	the wresize, default colors and key definition extensions and numerous
-	bug fixes (more than half of those enumerated in NEWS beginning with
-	the internal release 1.8.9).
+	bug fixes -- more than half of those enumerated in NEWS beginning with
+	the internal release 1.8.9, see
+
+		http://invisible-island.net/personal/changelogs.html
 
 Florian La Roche (official maintainer for FSF's ncurses 4.2)
 	Beginning with release 4.2, ncurses is distributed under an MIT-style
Index: README.MinGW
Prereq:  1.5 
--- ncurses-5.9/README.MinGW	2011-02-26 16:57:17.000000000 +0000
+++ ncurses-5.9-20130504/README.MinGW	2012-09-22 17:46:04.000000000 +0000
@@ -1,5 +1,5 @@
 -------------------------------------------------------------------------------
--- Copyright (c) 2008-2010,2011 Free Software Foundation, Inc.               --
+-- Copyright (c) 2008-2011,2012 Free Software Foundation, Inc.               --
 --                                                                           --
 -- Permission is hereby granted, free of charge, to any person obtaining a   --
 -- copy of this software and associated documentation files (the             --
@@ -25,7 +25,7 @@
 -- sale, use or other dealings in this Software without prior written        --
 -- authorization.                                                            --
 -------------------------------------------------------------------------------
--- $Id: README.MinGW,v 1.5 2011/02/26 16:57:17 tom Exp $
+-- $Id: README.MinGW,v 1.9 2012/09/22 17:46:04 tom Exp $
 -- Author: Juergen Pfeifer
 -------------------------------------------------------------------------------
 
@@ -39,7 +39,7 @@
 To build ncurses for native Windows, you need the MinGW toolchain.  The
 original MinGW toolchain from the above site is only for 32-Bit Windows.  As
 Windows Server - and also regular workstations - are moving to 64-Bit, it
-seems to be reasonable to have a toolchain that supports both architectures. 
+seems to be reasonable to have a toolchain that supports both architectures.
 I recommend to use the TDM gcc toolchain which you can find at
 http://tdm-gcc.tdragon.net/download.  Go to the download section and select
 the bundle installer for tdm64 (MinGW-w64).  This installs a multilib version
@@ -47,7 +47,7 @@
 versions.  It also comes with a working pthread implementation.
 
 The latest config and build scripts we use for MinGW have only been tested
-for the gcc-4.4 compiler toolchain (or better).
+for the gcc-4.6.1 compiler toolchain (or better).
 
 Using MinGW is a pragmatic decision, it's the easiest way to port this
 heavily UNIX based sourcebase to native Windows. The goal is of course
@@ -55,22 +55,13 @@
 common traditional development environments on Windows, mainly with
 Microsoft Visual Studio.
 
-If you start a bash from the MSYS environment, please make sure that the
-Microsoft Development tools are in your PATH right after the MinGW
-tools. The LIB.EXE tool is the only one needed. You need this only if 
-you want to build DLLs that work with native Windows programs. If you 
-don't have any Microsoft  Development tools on your machine, consider 
-at least to get the free "Visual C++ 2010 Express Edition". 
-It contains the LIB.EXE tool. You may also use this compiler to test 
-writing native Windows programs using the ncurses DLLs without using 
-MinGW then for writing apps.
-
-It is necessary to unset the TERM environment variable, to activate the
-Windows console-driver.
+The TERM environment variable must be set specially to active the Windows
+console-driver.  The driver checks if TERM is set to "#win32con" (explicit
+use) or if TERM is unset or empty (implicit).
 
 Please also make sure that MSYS links to the correct directory containing
 your MinGW toolchain. For TDM this is usually C:\MinGW64. In your Windows
-CMD.EXE command shell go to the MSYS root directory (most probably 
+CMD.EXE command shell go to the MSYS root directory (most probably
 C:\MSYS or C:\MSYS\1.0) and verify, that there is a junction point mingw
 that points to the MinGW toolchain directory. If not, delete the mingw
 directory and use the mklink command (or the linkd.exe utility on older
@@ -79,62 +70,60 @@
 This code requires WindowsNT 5.1 or better, which means on the client
 Windows XP or better, on the server Windows Server 2003 or better.
 
-In order to build ncurses for the planned interop layer with .NET, we
-recommend to use these options with configure
+I recommend using libtool to build ncurses on MinGW, because libtool
+knows exactly how to build dll's on Windows for use with MinGW.
+
+To build a modern but still small footprint ncurses that provides
+hooks for interop, I recommend using these options:
 
+	  --with-libtool
 	  --disable-home-terminfo
-	  --enable-reentrant
+	  --enable-database
+	  --disable-termcap
 	  --enable-sp-funcs
 	  --enable-term-driver
 	  --enable-interop
-	  --with-pthread         (if using TDM toolchain as recommended)
 
-This is the configuration commandline as I'm using it at the moment:
+This is the configuration commandline as I'm using it at the moment (assuming
+environment variable MINGW_ROOT to hold the root directory name of your MinGW
+build):
 
 ./configure \
-	--prefix=/mingw \
-	--without-cxx-binding \
+	--prefix=$MINGW_ROOT \
+	--with-cxx \
 	--without-ada \
 	--enable-warnings \
 	--enable-assertions \
-	--enable-reentrant \
-	--with-debug \
-	--with-normal \
 	--disable-home-terminfo \
+	--enable-database \
 	--enable-sp-funcs \
 	--enable-term-driver \
 	--enable-interop \
-	--with-pthread
+	--disable-termcap \
+	--with-progs \
+	--with-libtool \
+	--enable-pc-files \
+	--mandir=$MINGW_ROOT/share/man
 
-If you are on a 64-Bit Windows system and want to build a 32-Bit version
-of ncurses, you may use this commandline for configuration (when using
-the TDM toolchain):
-
-CC="gcc -m32" LD="ld -m32" ./configure \
-	--prefix=/mingw \
-	--without-cxx-binding \
-	--without-ada \
-	--enable-warnings \
-	--enable-assertions \
-	--enable-reentrant \
-	--with-debug \
-	--with-normal \
-	--disable-home-terminfo \
-	--enable-sp-funcs \
-	--enable-term-driver \
-	--enable-interop \
-	--with-pthread
+Please note that it is also necessary to set this environment variable:
 
-All the options above are - like the whole Windows support -
-experimental.
+export PATH_SEPARATOR=";"
+
+in order to parse the terminfo paths correctly. Terminfo paths should
+always be separated by a seeeemicolon,even when running under MSYS.
 
-In order to build the DLLs, after your regular make you must call
+To support regular expressions properly, ncurses under MinGW should be
+linked against the gnurx regex library, which must be built separately
+under MinGW.  See
 
-   make dlls
+    ftp.gnome.org/pub/GNOME/binaries/win32/dependencies/libgnurx-src-2.5.zip
+
+All the options above are - like the whole Windows support -
+experimental.
 
 A lot is still TODO, e.g.:
 
-  - Wide Character support
+  - Wide Character support (display is workable, but input untested)
     The Win32Con driver should actually only use Unicode in the
     future.
   - Thread support (locking). If using TDM toolchain this is done by
@@ -145,5 +134,5 @@
   - Workarounds for MinGW's filesystem access are necessary to make infocmp
     work (though tic works).
 
-To support terminfo, we need to have an ioctl() simulation for the
-serial and networked Terminals.
+To support terminfo, we would need to have an ioctl() simulation for the
+serial and networked terminals.
Index: aclocal.m4
Prereq:  1.553 
--- ncurses-5.9/aclocal.m4	2011-03-31 23:35:38.000000000 +0000
+++ ncurses-5.9-20130504/aclocal.m4	2013-04-13 22:59:35.000000000 +0000
@@ -1,5 +1,5 @@
 dnl***************************************************************************
-dnl Copyright (c) 1998-2010,2011 Free Software Foundation, Inc.              *
+dnl Copyright (c) 1998-2012,2013 Free Software Foundation, Inc.              *
 dnl                                                                          *
 dnl Permission is hereby granted, free of charge, to any person obtaining a  *
 dnl copy of this software and associated documentation files (the            *
@@ -28,7 +28,7 @@
 dnl
 dnl Author: Thomas E. Dickey 1995-on
 dnl
-dnl $Id: aclocal.m4,v 1.553 2011/03/31 23:35:38 tom Exp $
+dnl $Id: aclocal.m4,v 1.666 2013/04/13 22:59:35 tom Exp $
 dnl Macros used in NCURSES auto-configuration script.
 dnl
 dnl These macros are maintained separately from NCURSES.  The copyright on
@@ -62,6 +62,32 @@
   fi
 ])dnl
 dnl ---------------------------------------------------------------------------
+dnl CF_ACVERSION_CHECK version: 4 updated: 2013/03/04 19:52:56
+dnl ------------------
+dnl Conditionally generate script according to whether we're using a given autoconf.
+dnl
+dnl $1 = version to compare against
+dnl $2 = code to use if AC_ACVERSION is at least as high as $1.
+dnl $3 = code to use if AC_ACVERSION is older than $1.
+define([CF_ACVERSION_CHECK],
+[
+ifdef([AC_ACVERSION], ,[m4_copy([m4_PACKAGE_VERSION],[AC_ACVERSION])])dnl
+ifdef([m4_version_compare],
+[m4_if(m4_version_compare(m4_defn([AC_ACVERSION]), [$1]), -1, [$3], [$2])],
+[CF_ACVERSION_COMPARE(
+AC_PREREQ_CANON(AC_PREREQ_SPLIT([$1])),
+AC_PREREQ_CANON(AC_PREREQ_SPLIT(AC_ACVERSION)), AC_ACVERSION, [$2], [$3])])])dnl
+dnl ---------------------------------------------------------------------------
+dnl CF_ACVERSION_COMPARE version: 3 updated: 2012/10/03 18:39:53
+dnl --------------------
+dnl CF_ACVERSION_COMPARE(MAJOR1, MINOR1, TERNARY1,
+dnl                      MAJOR2, MINOR2, TERNARY2,
+dnl                      PRINTABLE2, not FOUND, FOUND)
+define([CF_ACVERSION_COMPARE],
+[ifelse(builtin([eval], [$2 < $5]), 1,
+[ifelse([$8], , ,[$8])],
+[ifelse([$9], , ,[$9])])])dnl
+dnl ---------------------------------------------------------------------------
 dnl CF_ADA_INCLUDE_DIRS version: 6 updated: 2010/02/26 19:52:07
 dnl -------------------
 dnl Construct the list of include-options for the C programs in the Ada95
@@ -313,76 +339,6 @@
 }
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_ANSI_CC_CHECK version: 10 updated: 2010/10/23 15:52:32
-dnl ----------------
-dnl This is adapted from the macros 'fp_PROG_CC_STDC' and 'fp_C_PROTOTYPES'
-dnl in the sharutils 4.2 distribution.
-AC_DEFUN([CF_ANSI_CC_CHECK],
-[
-AC_CACHE_CHECK(for ${CC:-cc} option to accept ANSI C, cf_cv_ansi_cc,[
-cf_cv_ansi_cc=no
-cf_save_CFLAGS="$CFLAGS"
-cf_save_CPPFLAGS="$CPPFLAGS"
-# Don't try gcc -ansi; that turns off useful extensions and
-# breaks some systems' header files.
-# AIX			-qlanglvl=ansi
-# Ultrix and OSF/1	-std1
-# HP-UX			-Aa -D_HPUX_SOURCE
-# SVR4			-Xc
-# UnixWare 1.2		(cannot use -Xc, since ANSI/POSIX clashes)
-for cf_arg in "-DCC_HAS_PROTOS" \
-	"" \
-	-qlanglvl=ansi \
-	-std1 \
-	-Ae \
-	"-Aa -D_HPUX_SOURCE" \
-	-Xc
-do
-	CF_ADD_CFLAGS($cf_arg)
-	AC_TRY_COMPILE(
-[
-#ifndef CC_HAS_PROTOS
-#if !defined(__STDC__) || (__STDC__ != 1)
-choke me
-#endif
-#endif
-],[
-	int test (int i, double x);
-	struct s1 {int (*f) (int a);};
-	struct s2 {int (*f) (double a);};],
-	[cf_cv_ansi_cc="$cf_arg"; break])
-done
-CFLAGS="$cf_save_CFLAGS"
-CPPFLAGS="$cf_save_CPPFLAGS"
-])
-
-if test "$cf_cv_ansi_cc" != "no"; then
-if test ".$cf_cv_ansi_cc" != ".-DCC_HAS_PROTOS"; then
-	CF_ADD_CFLAGS($cf_cv_ansi_cc)
-else
-	AC_DEFINE(CC_HAS_PROTOS)
-fi
-fi
-])dnl
-dnl ---------------------------------------------------------------------------
-dnl CF_ANSI_CC_REQD version: 4 updated: 2008/03/23 14:48:54
-dnl ---------------
-dnl For programs that must use an ANSI compiler, obtain compiler options that
-dnl will make it recognize prototypes.  We'll do preprocessor checks in other
-dnl macros, since tools such as unproto can fake prototypes, but only part of
-dnl the preprocessor.
-AC_DEFUN([CF_ANSI_CC_REQD],
-[AC_REQUIRE([CF_ANSI_CC_CHECK])
-if test "$cf_cv_ansi_cc" = "no"; then
-	AC_MSG_ERROR(
-[Your compiler does not appear to recognize prototypes.
-You have the following choices:
-	a. adjust your compiler options
-	b. get an up-to-date compiler
-	c. use a wrapper such as unproto])
-fi
-])dnl
-dnl ---------------------------------------------------------------------------
 dnl CF_ARG_DISABLE version: 3 updated: 1999/03/30 17:24:31
 dnl --------------
 dnl Allow user to disable a normally-on option.
@@ -465,7 +421,7 @@
 AC_SUBST(ARFLAGS)
 ])
 dnl ---------------------------------------------------------------------------
-dnl CF_AWK_BIG_PRINTF version: 3 updated: 2008/12/27 12:30:03
+dnl CF_AWK_BIG_PRINTF version: 4 updated: 2011/10/30 17:09:50
 dnl -----------------
 dnl Check if awk can handle big strings using printf.  Some older versions of
 dnl awk choke on large strings passed via "%s".
@@ -479,8 +435,8 @@
 		eval $2=no
 		;;
 	*) #(vi
-		if ( ${AWK} 'BEGIN { xx = "x"; while (length(xx) < $1) { xx = xx "x"; }; printf("%s\n", xx); }' \
-			| $AWK '{ printf "%d\n", length([$]0); }' | $AWK 'BEGIN { eqls=0; recs=0; } { recs++; if ([$]0 == 12000) eqls++; } END { if (recs != 1 || eqls != 1) exit 1; }' 2>/dev/null >/dev/null ) ; then
+		if ( ${AWK} 'BEGIN { xx = "x"; while (length(xx) < $1) { xx = xx "x"; }; printf("%s\n", xx); }' 2>/dev/null \
+			| $AWK '{ printf "%d\n", length([$]0); }' 2>/dev/null | $AWK 'BEGIN { eqls=0; recs=0; } { recs++; if ([$]0 == 12000) eqls++; } END { if (recs != 1 || eqls != 1) exit 1; }' 2>/dev/null >/dev/null ) ; then
 			eval $2=yes
 		else
 			eval $2=no
@@ -536,7 +492,7 @@
 fi
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_BOOL_SIZE version: 12 updated: 2006/12/16 12:33:30
+dnl CF_BOOL_SIZE version: 13 updated: 2013/04/13 18:03:21
 dnl ------------
 dnl Test for the size of 'bool' in the configured C++ compiler (e.g., a type).
 dnl Don't bother looking for bool.h, since it's been deprecated.
@@ -570,7 +526,7 @@
 
 #endif
 
-main()
+int main()
 {
 	FILE *fp = fopen("cf_test.out", "w");
 	if (fp != 0) {
@@ -604,7 +560,7 @@
 fi
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_BUILD_CC version: 6 updated: 2006/10/14 15:23:15
+dnl CF_BUILD_CC version: 7 updated: 2012/10/06 15:31:55
 dnl -----------
 dnl If we're cross-compiling, allow the user to override the tools and their
 dnl options.  The configure script is oriented toward identifying the host
@@ -614,7 +570,8 @@
 dnl $1 = default for $CPPFLAGS
 dnl $2 = default for $LIBS
 AC_DEFUN([CF_BUILD_CC],[
-AC_REQUIRE([CF_PROG_EXT])
+CF_ACVERSION_CHECK(2.52,,
+	[AC_REQUIRE([CF_PROG_EXT])])
 if test "$cross_compiling" = yes ; then
 
 	# defaults that we might want to override
@@ -695,7 +652,33 @@
 AC_SUBST(BUILD_OBJEXT)
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_CFG_DEFAULTS version: 7 updated: 2005/09/24 16:15:00
+dnl CF_CC_ENV_FLAGS version: 1 updated: 2012/10/03 05:25:49
+dnl ---------------
+dnl Check for user's environment-breakage by stuffing CFLAGS/CPPFLAGS content
+dnl into CC.  This will not help with broken scripts that wrap the compiler with
+dnl options, but eliminates a more common category of user confusion.
+AC_DEFUN([CF_CC_ENV_FLAGS],
+[
+# This should have been defined by AC_PROG_CC
+: ${CC:=cc}
+
+AC_MSG_CHECKING(\$CC variable)
+case "$CC" in #(vi
+*[[\ \	]]-[[IUD]]*)
+	AC_MSG_RESULT(broken)
+	AC_MSG_WARN(your environment misuses the CC variable to hold CFLAGS/CPPFLAGS options)
+	# humor him...
+	cf_flags=`echo "$CC" | sed -e 's/^[[^ 	]]*[[ 	]]//'`
+	CC=`echo "$CC" | sed -e 's/[[ 	]].*//'`
+	CF_ADD_CFLAGS($cf_flags)
+	;;
+*)
+	AC_MSG_RESULT(ok)
+	;;
+esac
+])dnl
+dnl ---------------------------------------------------------------------------
+dnl CF_CFG_DEFAULTS version: 9 updated: 2013/04/13 18:58:32
 dnl ---------------
 dnl Determine the default configuration into which we'll install ncurses.  This
 dnl can be overridden by the user's command-line options.  There's two items to
@@ -713,7 +696,7 @@
 if test "x$prefix" = "xNONE" ; then
 	case "$cf_cv_system_name" in
 		# non-vendor systems don't have a conflict
-	openbsd*|freebsd*|linux*|cygwin*|k*bsd*-gnu)
+	openbsd*|freebsd*|mirbsd*|linux*|cygwin*|k*bsd*-gnu|mingw*)
 		prefix=/usr
 		;;
 	*)	prefix=$ac_default_prefix
@@ -749,30 +732,51 @@
 fi
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_CGETENT version: 3 updated: 2000/08/12 23:18:52
+dnl CF_CGETENT version: 5 updated: 2012/10/06 17:56:13
 dnl ----------
 dnl Check if the terminal-capability database functions are available.  If not,
 dnl ncurses has a much-reduced version.
 AC_DEFUN([CF_CGETENT],[
-AC_MSG_CHECKING(for terminal-capability database functions)
-AC_CACHE_VAL(cf_cv_cgetent,[
+AC_CACHE_CHECK(for terminal-capability database functions,cf_cv_cgetent,[
 AC_TRY_LINK([
 #include <stdlib.h>],[
 	char temp[128];
 	char *buf = temp;
 	char *db_array = temp;
-	cgetent(&buf, /* int *, */ &db_array, "vt100");
+	cgetent(&buf, &db_array, "vt100");
 	cgetcap(buf, "tc", '=');
 	cgetmatch(buf, "tc");
 	],
 	[cf_cv_cgetent=yes],
 	[cf_cv_cgetent=no])
 ])
-AC_MSG_RESULT($cf_cv_cgetent)
-test "$cf_cv_cgetent" = yes && AC_DEFINE(HAVE_BSD_CGETENT)
+
+if test "$cf_cv_cgetent" = yes
+then
+	AC_DEFINE(HAVE_BSD_CGETENT,1,[Define to 1 if we have BSD cgetent])
+AC_CACHE_CHECK(if cgetent uses const parameter,cf_cv_cgetent_const,[
+AC_TRY_LINK([
+#include <stdlib.h>],[
+	char temp[128];
+	char *buf = temp;
+#ifndef _NETBSD_SOURCE			/* given, since April 2004 in stdlib.h */
+	const char *db_array = temp;
+	cgetent(&buf, &db_array, "vt100");
+#endif
+	cgetcap(buf, "tc", '=');
+	cgetmatch(buf, "tc");
+	],
+	[cf_cv_cgetent_const=yes],
+	[cf_cv_cgetent_const=no])
+])
+	if test "$cf_cv_cgetent_const" = yes
+	then
+		AC_DEFINE_UNQUOTED(CGETENT_CONST,const,[Define to const if needed for some BSD cgetent variations])
+	fi
+fi
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_CHECK_CACHE version: 11 updated: 2008/03/23 14:45:59
+dnl CF_CHECK_CACHE version: 12 updated: 2012/10/02 20:55:03
 dnl --------------
 dnl Check if we're accidentally using a cache from a different machine.
 dnl Derive the system name, as a check for reusing the autoconf cache.
@@ -795,7 +799,7 @@
 		system_name="`(hostname) 2>/dev/null`"
 	fi
 fi
-test -n "$system_name" && AC_DEFINE_UNQUOTED(SYSTEM_NAME,"$system_name")
+test -n "$system_name" && AC_DEFINE_UNQUOTED(SYSTEM_NAME,"$system_name",[Define to the system name.])
 AC_CACHE_VAL(cf_cv_system_name,[cf_cv_system_name="$system_name"])
 
 test -z "$system_name" && system_name="$cf_cv_system_name"
@@ -908,7 +912,82 @@
 fi
 ])])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_CPP_PARAM_INIT version: 4 updated: 2001/04/07 22:31:18
+dnl CF_CHECK_LIBTOOL_VERSION version: 1 updated: 2013/04/06 18:03:09
+dnl ------------------------
+dnl Show the version of libtool
+dnl
+dnl Save the version in a cache variable - this is not entirely a good thing,
+dnl but the version string from libtool is very ugly, and for bug reports it
+dnl might be useful to have the original string.
+AC_DEFUN([CF_CHECK_LIBTOOL_VERSION],[
+if test -n "$LIBTOOL" && test "$LIBTOOL" != none
+then
+	AC_MSG_CHECKING(version of $LIBTOOL)
+	CF_LIBTOOL_VERSION
+	AC_MSG_RESULT($cf_cv_libtool_version)
+	if test -z "$cf_cv_libtool_version" ; then
+		AC_MSG_ERROR(This is not GNU libtool)
+	fi
+else
+	AC_MSG_ERROR(GNU libtool has not been found)
+fi
+])dnl
+dnl ---------------------------------------------------------------------------
+dnl CF_CHECK_WCHAR_H version: 1 updated: 2011/10/29 15:01:05
+dnl ----------------
+dnl Check if wchar.h can be used, i.e., without defining _XOPEN_SOURCE_EXTENDED
+AC_DEFUN([CF_CHECK_WCHAR_H],[
+AC_CACHE_CHECK(if wchar.h can be used as is,cf_cv_wchar_h_okay,[
+AC_TRY_COMPILE(
+[
+#include <stdlib.h>
+#include <wchar.h>
+],[
+	wint_t foo = 0;
+	int bar = iswpunct(foo)],
+	[cf_cv_wchar_h_okay=yes],
+	[cf_cv_wchar_h_okay=no])])
+
+if test $cf_cv_wchar_h_okay = no
+then
+	CF_PREDEFINE(_XOPEN_SOURCE_EXTENDED)
+fi
+])dnl
+dnl ---------------------------------------------------------------------------
+dnl CF_CLANG_COMPILER version: 1 updated: 2012/06/16 14:55:39
+dnl -----------------
+dnl Check if the given compiler is really clang.  clang's C driver defines
+dnl __GNUC__ (fooling the configure script into setting $GCC to yes) but does
+dnl not ignore some gcc options.
+dnl
+dnl This macro should be run "soon" after AC_PROG_CC or AC_PROG_CPLUSPLUS, to
+dnl ensure that it is not mistaken for gcc/g++.  It is normally invoked from
+dnl the wrappers for gcc and g++ warnings.
+dnl
+dnl $1 = GCC (default) or GXX
+dnl $2 = INTEL_COMPILER (default) or INTEL_CPLUSPLUS
+dnl $3 = CFLAGS (default) or CXXFLAGS
+AC_DEFUN([CF_CLANG_COMPILER],[
+ifelse([$2],,CLANG_COMPILER,[$2])=no
+
+if test "$ifelse([$1],,[$1],GCC)" = yes ; then
+	AC_MSG_CHECKING(if this is really Clang ifelse([$1],GXX,C++,C) compiler)
+	cf_save_CFLAGS="$ifelse([$3],,CFLAGS,[$3])"
+	ifelse([$3],,CFLAGS,[$3])="$ifelse([$3],,CFLAGS,[$3]) -Qunused-arguments"
+	AC_TRY_COMPILE([],[
+#ifdef __clang__
+#else
+make an error
+#endif
+],[ifelse([$2],,CLANG_COMPILER,[$2])=yes
+cf_save_CFLAGS="$cf_save_CFLAGS -Qunused-arguments"
+],[])
+	ifelse([$3],,CFLAGS,[$3])="$cf_save_CFLAGS"
+	AC_MSG_RESULT($ifelse([$2],,CLANG_COMPILER,[$2]))
+fi
+])
+dnl ---------------------------------------------------------------------------
+dnl CF_CPP_PARAM_INIT version: 6 updated: 2012/10/06 17:56:13
 dnl -----------------
 dnl Check if the C++ compiler accepts duplicate parameter initialization.  This
 dnl is a late feature for the standard and is not in some recent compilers
@@ -932,7 +1011,7 @@
 {
 	value = x;
 }
-void main() { }
+int main() { }
 ],
 	[cf_cv_cpp_param_init=yes],
 	[cf_cv_cpp_param_init=no],
@@ -940,10 +1019,10 @@
 	AC_LANG_RESTORE
 ])
 fi
-test "$cf_cv_cpp_param_init" = yes && AC_DEFINE(CPP_HAS_PARAM_INIT)
+test "$cf_cv_cpp_param_init" = yes && AC_DEFINE(CPP_HAS_PARAM_INIT,1,[Define to 1 if C++ has parameter initialization])
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_CPP_STATIC_CAST version: 1 updated: 2005/07/23 16:52:43
+dnl CF_CPP_STATIC_CAST version: 3 updated: 2013/04/13 18:03:21
 dnl ------------------
 dnl Check if the C++ compiler accepts static_cast in generics.  This appears to
 dnl not be supported in g++ before 3.0
@@ -965,7 +1044,7 @@
 	       int begin_x = 0)
   {
   }
-
+  NCursesPanel();
   ~NCursesPanel();
 };
 
@@ -996,10 +1075,58 @@
 
 fi
 
-test "$cf_cv_cpp_static_cast" = yes && AC_DEFINE(CPP_HAS_STATIC_CAST)
+test "$cf_cv_cpp_static_cast" = yes && AC_DEFINE(CPP_HAS_STATIC_CAST,1,[Define to 1 if C++ has static_cast])
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_C_INLINE version: 3 updated: 2010/05/01 15:14:41
+dnl CF_CXX_AR_FLAGS version: 1 updated: 2011/10/29 08:35:34
+dnl ---------------
+dnl Setup special archiver flags for given compilers.
+AC_DEFUN([CF_CXX_AR_FLAGS],[
+	CXX_AR='$(AR)'
+	CXX_ARFLAGS='$(ARFLAGS)'
+	case $cf_cv_system_name in #(vi
+	irix*) #(vi
+	    if test "$GXX" != yes ; then
+		CXX_AR='$(CXX)'
+		CXX_ARFLAGS='-ar -o'
+	    fi
+	    ;;
+	sco3.2v5*) #(vi
+	    CXXLDFLAGS="-u main"
+	    ;;
+	solaris2*)
+	    if test "$GXX" != yes ; then
+		CXX_AR='$(CXX)'
+		CXX_ARFLAGS='-xar -o'
+	    fi
+	    ;;
+	esac
+	AC_SUBST(CXXLDFLAGS)
+	AC_SUBST(CXX_AR)
+	AC_SUBST(CXX_ARFLAGS)
+])dnl
+dnl ---------------------------------------------------------------------------
+dnl CF_CXX_IOSTREAM_NAMESPACE version: 2 updated: 2012/10/06 17:56:13
+dnl -------------------------
+dnl For c++, check if iostream uses "std::" namespace.
+AC_DEFUN([CF_CXX_IOSTREAM_NAMESPACE],[
+AC_CHECK_HEADERS(iostream)
+if test x"$ac_cv_header_iostream" = xyes ; then
+	AC_MSG_CHECKING(if iostream uses std-namespace)
+	AC_TRY_COMPILE([
+#include <iostream>
+using std::endl;
+using std::cerr;],[
+cerr << "testing" << endl;
+],[cf_iostream_namespace=yes],[cf_iostream_namespace=no])
+	AC_MSG_RESULT($cf_iostream_namespace)
+	if test "$cf_iostream_namespace" = yes ; then
+		AC_DEFINE(IOSTREAM_NAMESPACE,1,[Define to 1 if C++ has namespace iostream])
+	fi
+fi
+])dnl
+dnl ---------------------------------------------------------------------------
+dnl CF_C_INLINE version: 4 updated: 2012/06/16 14:55:39
 dnl -----------
 dnl Check if the C compiler supports "inline".
 dnl $1 is the name of a shell variable to set if inline is supported
@@ -1012,6 +1139,9 @@
   if test "$INTEL_COMPILER" = yes
   then
     :
+  elif test "$CLANG_COMPILER" = yes
+  then
+    :
   elif test "$GCC" = yes
   then
     AC_CACHE_CHECK(if $CC supports options to tune inlining,cf_cv_gcc_inline,[
@@ -1057,7 +1187,44 @@
 AC_SUBST(DIRS_TO_MAKE)
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_DISABLE_LEAKS version: 6 updated: 2010/07/23 04:14:32
+dnl CF_DISABLE_ECHO version: 12 updated: 2012/10/06 16:30:28
+dnl ---------------
+dnl You can always use "make -n" to see the actual options, but it's hard to
+dnl pick out/analyze warning messages when the compile-line is long.
+dnl
+dnl Sets:
+dnl	ECHO_LT - symbol to control if libtool is verbose
+dnl	ECHO_LD - symbol to prefix "cc -o" lines
+dnl	RULE_CC - symbol to put before implicit "cc -c" lines (e.g., .c.o)
+dnl	SHOW_CC - symbol to put before explicit "cc -c" lines
+dnl	ECHO_CC - symbol to put before any "cc" line
+dnl
+AC_DEFUN([CF_DISABLE_ECHO],[
+AC_MSG_CHECKING(if you want to see long compiling messages)
+CF_ARG_DISABLE(echo,
+	[  --disable-echo          do not display "compiling" commands],
+	[
+    ECHO_LT='--silent'
+    ECHO_LD='@echo linking [$]@;'
+    RULE_CC='@echo compiling [$]<'
+    SHOW_CC='@echo compiling [$]@'
+    ECHO_CC='@'
+],[
+    ECHO_LT=''
+    ECHO_LD=''
+    RULE_CC=''
+    SHOW_CC=''
+    ECHO_CC=''
+])
+AC_MSG_RESULT($enableval)
+AC_SUBST(ECHO_LT)
+AC_SUBST(ECHO_LD)
+AC_SUBST(RULE_CC)
+AC_SUBST(SHOW_CC)
+AC_SUBST(ECHO_CC)
+])dnl
+dnl ---------------------------------------------------------------------------
+dnl CF_DISABLE_LEAKS version: 7 updated: 2012/10/02 20:55:03
 dnl ----------------
 dnl Combine no-leak checks with the libraries or tools that are used for the
 dnl checks.
@@ -1075,8 +1242,8 @@
 AC_MSG_RESULT($with_no_leaks)
 
 if test "$with_no_leaks" = yes ; then
-	AC_DEFINE(NO_LEAKS)
-	AC_DEFINE(YY_NO_LEAKS)
+	AC_DEFINE(NO_LEAKS,1,[Define to 1 if you want to perform memory-leak testing.])
+	AC_DEFINE(YY_NO_LEAKS,1,[Define to 1 if you want to perform memory-leak testing.])
 fi
 ])dnl
 dnl ---------------------------------------------------------------------------
@@ -1123,6 +1290,30 @@
 fi
 ])
 dnl ---------------------------------------------------------------------------
+dnl CF_ENABLE_PC_FILES version: 9 updated: 2012/08/04 13:59:54
+dnl ------------------
+dnl This is the "--enable-pc-files" option, which is available if there is a
+dnl pkg-config configuration on the local machine.
+AC_DEFUN([CF_ENABLE_PC_FILES],[
+AC_REQUIRE([CF_PKG_CONFIG])
+AC_REQUIRE([CF_WITH_PKG_CONFIG_LIBDIR])
+
+if test "$PKG_CONFIG" != none ; then
+	AC_MSG_CHECKING(if we should install .pc files for $PKG_CONFIG)
+	AC_ARG_ENABLE(pc-files,
+		[  --enable-pc-files       generate and install .pc files for pkg-config],
+		[enable_pc_files=$enableval],
+		[enable_pc_files=no])
+	AC_MSG_RESULT($enable_pc_files)
+	if test "$enable_pc_files" != no
+	then
+		CF_PATH_SYNTAX(PKG_CONFIG_LIBDIR)
+	fi
+else
+	enable_pc_files=no
+fi
+])dnl
+dnl ---------------------------------------------------------------------------
 dnl CF_ENABLE_RPATH version: 2 updated: 2010/03/27 18:39:42
 dnl ---------------
 dnl Check if the rpath option should be used, setting cache variable
@@ -1137,6 +1328,37 @@
 AC_MSG_RESULT($cf_cv_enable_rpath)
 ])dnl
 dnl ---------------------------------------------------------------------------
+dnl CF_ENABLE_STRING_HACKS version: 3 updated: 2013/01/26 16:26:12
+dnl ----------------------
+dnl On a few platforms, the compiler and/or loader nags with untruthful
+dnl comments stating that "most" uses of strcat/strcpy/sprintf are incorrect,
+dnl and implying that most uses of the recommended alternatives are correct.
+dnl
+dnl Factually speaking, no one has actually counted the number of uses of these
+dnl functions versus the total of incorrect uses.  Samples of a few thousand
+dnl instances are meaningless compared to the hundreds of millions of lines of
+dnl existing C code.
+dnl
+dnl strlcat/strlcpy are (as of 2012) non-standard, and are available on some
+dnl platforms, in implementations of varying quality.  Likewise, snprintf is
+dnl standard - but evolved through phases, and older implementations are likely
+dnl to yield surprising results, as documented in manpages on various systems.
+AC_DEFUN([CF_ENABLE_STRING_HACKS],
+[
+AC_MSG_CHECKING(if you want to work around bogus compiler/loader warnings)
+AC_ARG_ENABLE(string-hacks,
+	[  --enable-string-hacks   work around bogus compiler/loader warnings],
+	[with_string_hacks=$enableval],
+	[with_string_hacks=no])
+AC_MSG_RESULT($with_string_hacks)
+
+if test "x$with_string_hacks" = "xyes"; then
+ 	AC_DEFINE(USE_STRING_HACKS,1,[Define to 1 to work around bogus compiler/loader warnings])
+	AC_MSG_WARN(enabling string-hacks to work around bogus compiler/loader warnings)
+	AC_CHECK_FUNCS( strlcat strlcpy snprintf )
+fi
+])dnl
+dnl ---------------------------------------------------------------------------
 dnl CF_ERRNO version: 5 updated: 1997/11/30 12:44:39
 dnl --------
 dnl Check if 'errno' is declared in <errno.h>
@@ -1145,7 +1367,7 @@
 CF_CHECK_ERRNO(errno)
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_ETIP_DEFINES version: 3 updated: 2003/03/22 19:13:43
+dnl CF_ETIP_DEFINES version: 5 updated: 2012/02/18 17:51:07
 dnl ---------------
 dnl Test for conflicting definitions of exception in gcc 2.8.0, etc., between
 dnl math.h and builtin.h, only for ncurses
@@ -1154,11 +1376,17 @@
 AC_MSG_CHECKING(for special defines needed for etip.h)
 cf_save_CXXFLAGS="$CXXFLAGS"
 cf_result="none"
+
+# etip.h includes ncurses.h which includes ncurses_dll.h
+# But ncurses_dll.h is generated - fix here.
+test -d include || mkdir include
+test -f include/ncurses_dll.h || sed -e 's/@NCURSES_WRAP_PREFIX@/'$NCURSES_WRAP_PREFIX'/g' ${srcdir}/include/ncurses_dll.h.in >include/ncurses_dll.h
+
 for cf_math in "" MATH_H
 do
 for cf_excp in "" MATH_EXCEPTION
 do
-	CXXFLAGS="$cf_save_CXXFLAGS -I${srcdir}/c++ -I${srcdir}/menu -I${srcdir}/include"
+	CXXFLAGS="$cf_save_CXXFLAGS -I${srcdir}/c++ -I${srcdir}/menu -Iinclude -I${srcdir}/include"
 	test -n "$cf_math" && CXXFLAGS="$CXXFLAGS -DETIP_NEEDS_${cf_math}"
 	test -n "$cf_excp" && CXXFLAGS="$CXXFLAGS -DETIP_NEEDS_${cf_excp}"
 AC_TRY_COMPILE([
@@ -1167,7 +1395,7 @@
 	test -n "$cf_math" && AC_DEFINE_UNQUOTED(ETIP_NEEDS_${cf_math})
 	test -n "$cf_excp" && AC_DEFINE_UNQUOTED(ETIP_NEEDS_${cf_excp})
 	cf_result="$cf_math $cf_excp"
-	break
+	break 2
 ],[])
 done
 done
@@ -1305,7 +1533,35 @@
 fi
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_FUNC_DLSYM version: 2 updated: 2010/05/29 16:31:02
+dnl CF_FIXUP_ADAFLAGS version: 1 updated: 2012/03/31 18:48:10
+dnl -----------------
+dnl make ADAFLAGS consistent with CFLAGS
+AC_DEFUN([CF_FIXUP_ADAFLAGS],[
+	AC_MSG_CHECKING(optimization options for ADAFLAGS)
+	case "$CFLAGS" in
+	*-g*)
+		CF_ADD_ADAFLAGS(-g)
+		;;
+	esac
+	case "$CFLAGS" in
+	*-O*)
+		cf_O_flag=`echo "$CFLAGS" |sed -e 's/^.*-O/-O/' -e 's/[[ 	]].*//'`
+		CF_ADD_ADAFLAGS($cf_O_flag)
+		;;
+	esac
+	AC_MSG_RESULT($ADAFLAGS)
+])dnl
+dnl ---------------------------------------------------------------------------
+dnl CF_FORGET_TOOL version: 1 updated: 2013/04/06 18:03:09
+dnl --------------
+dnl Forget that we saw the given tool.
+AC_DEFUN([CF_FORGET_TOOL],[
+unset ac_cv_prog_ac_ct_$1
+unset ac_ct_$1
+unset $1
+])dnl
+dnl ---------------------------------------------------------------------------
+dnl CF_FUNC_DLSYM version: 3 updated: 2012/10/06 11:17:15
 dnl -------------
 dnl Test for dlsym() and related functions, as well as libdl.
 dnl
@@ -1332,7 +1588,7 @@
 			dlclose(obj);
 			}
 		}],[
-		AC_DEFINE(HAVE_LIBDL)],[
+		AC_DEFINE(HAVE_LIBDL,1,[Define to 1 if we have dl library])],[
 		AC_MSG_ERROR(Cannot link test program for libdl)])
 	AC_MSG_RESULT(ok)
 else
@@ -1340,7 +1596,7 @@
 fi
 ])
 dnl ---------------------------------------------------------------------------
-dnl CF_FUNC_MEMMOVE version: 7 updated: 2006/12/16 12:33:30
+dnl CF_FUNC_MEMMOVE version: 8 updated: 2012/10/04 20:12:20
 dnl ---------------
 dnl Check for memmove, or a bcopy that can handle overlapping copy.  If neither
 dnl is found, add our own version of memmove to the list of objects.
@@ -1365,13 +1621,13 @@
 		])
 	],[cf_cv_good_bcopy=no])
 	if test "$cf_cv_good_bcopy" = yes ; then
-		AC_DEFINE(USE_OK_BCOPY)
+		AC_DEFINE(USE_OK_BCOPY,1,[Define to 1 to use bcopy when memmove is unavailable])
 	else
-		AC_DEFINE(USE_MY_MEMMOVE)
+		AC_DEFINE(USE_MY_MEMMOVE,1,[Define to 1 to use replacement function when memmove is unavailable])
 	fi
 ])])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_FUNC_NANOSLEEP version: 3 updated: 2006/12/16 12:33:30
+dnl CF_FUNC_NANOSLEEP version: 4 updated: 2012/10/06 17:56:13
 dnl -----------------
 dnl Check for existence of workable nanosleep() function.  Some systems, e.g.,
 dnl AIX 4.x, provide a non-working version.
@@ -1402,7 +1658,7 @@
 	[cf_cv_func_nanosleep=no],
 	[cf_cv_func_nanosleep=unknown])])
 
-test "$cf_cv_func_nanosleep" = "yes" && AC_DEFINE(HAVE_NANOSLEEP)
+test "$cf_cv_func_nanosleep" = "yes" && AC_DEFINE(HAVE_NANOSLEEP,1,[Define to 1 if we have nanosleep()])
 ])
 dnl ---------------------------------------------------------------------------
 dnl CF_FUNC_OPENPTY version: 3 updated: 2010/05/29 16:31:02
@@ -1433,14 +1689,17 @@
 ])
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_FUNC_POLL version: 4 updated: 2006/12/16 12:33:30
+dnl CF_FUNC_POLL version: 8 updated: 2012/10/04 05:24:07
 dnl ------------
 dnl See if the poll function really works.  Some platforms have poll(), but
 dnl it does not work for terminals or files.
 AC_DEFUN([CF_FUNC_POLL],[
 AC_CACHE_CHECK(if poll really works,cf_cv_working_poll,[
 AC_TRY_RUN([
+#include <stdlib.h>
 #include <stdio.h>
+#include <unistd.h>
+#include <fcntl.h>
 #ifdef HAVE_POLL_H
 #include <poll.h>
 #else
@@ -1450,19 +1709,42 @@
 	struct pollfd myfds;
 	int ret;
 
-	myfds.fd = 0;
+	/* check for Darwin bug with respect to "devices" */
+	myfds.fd = open("/dev/null", 1);	/* O_WRONLY */
+	if (myfds.fd < 0)
+		myfds.fd = 0;
 	myfds.events = POLLIN;
+	myfds.revents = 0;
 
 	ret = poll(&myfds, 1, 100);
-	${cf_cv_main_return:-return}(ret != 0);
+
+	if (ret < 0 || (myfds.revents & POLLNVAL)) {
+		ret = -1;
+	} else {
+		int fd = 0;
+		if (!isatty(fd)) {
+			fd = open("/dev/tty", 2);	/* O_RDWR */
+		}
+
+		if (fd >= 0) {
+			/* also check with standard input */
+			myfds.fd = fd;
+			myfds.events = POLLIN;
+			myfds.revents = 0;
+			ret = poll(&myfds, 1, 100);
+		} else {
+			ret = -1;
+		}
+	}
+	${cf_cv_main_return:-return}(ret < 0);
 }],
 	[cf_cv_working_poll=yes],
 	[cf_cv_working_poll=no],
 	[cf_cv_working_poll=unknown])])
-test "$cf_cv_working_poll" = "yes" && AC_DEFINE(HAVE_WORKING_POLL)
+test "$cf_cv_working_poll" = "yes" && AC_DEFINE(HAVE_WORKING_POLL,1,[Define to 1 if the poll function seems to work])
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_FUNC_TERMIOS version: 2 updated: 2000/07/22 23:37:24
+dnl CF_FUNC_TERMIOS version: 3 updated: 2012/10/06 17:56:13
 dnl ---------------
 dnl Some old/broken variations define tcgetattr() only as a macro in
 dnl termio(s).h
@@ -1488,10 +1770,10 @@
 tcgetattr(1, &foo);],
 [cf_cv_have_tcgetattr=yes],
 [cf_cv_have_tcgetattr=no])])
-test "$cf_cv_have_tcgetattr" = yes && AC_DEFINE(HAVE_TCGETATTR)
+test "$cf_cv_have_tcgetattr" = yes && AC_DEFINE(HAVE_TCGETATTR,1,[Define to 1 if we have tcgetattr])
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_FUNC_VSSCANF version: 3 updated: 2001/12/19 00:50:10
+dnl CF_FUNC_VSSCANF version: 4 updated: 2012/10/06 17:56:13
 dnl ---------------
 dnl Check for vsscanf() function, which is in c9x but generally not in earlier
 dnl versions of C.  It is in the GNU C library, and can often be simulated by
@@ -1529,14 +1811,14 @@
 cf_cv_func_vsscanf=no])])])])
 
 case $cf_cv_func_vsscanf in #(vi
-vsscanf) AC_DEFINE(HAVE_VSSCANF);; #(vi
-vfscanf) AC_DEFINE(HAVE_VFSCANF);; #(vi
-_doscan) AC_DEFINE(HAVE__DOSCAN);;
+vsscanf) AC_DEFINE(HAVE_VSSCANF,1,[Define to 1 if we have vsscanf]);; #(vi
+vfscanf) AC_DEFINE(HAVE_VFSCANF,1,[Define to 1 if we have vfscanf]);; #(vi
+_doscan) AC_DEFINE(HAVE__DOSCAN,1,[Define to 1 if we have _doscan]);;
 esac
 
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_GCC_ATTRIBUTES version: 14 updated: 2010/10/23 15:52:32
+dnl CF_GCC_ATTRIBUTES version: 16 updated: 2012/10/02 20:55:03
 dnl -----------------
 dnl Test for availability of useful gcc __attribute__ directives to quiet
 dnl compiler warnings.  Though useful, not all are supported -- and contrary
@@ -1614,27 +1896,27 @@
 			test -n "$verbose" && AC_MSG_RESULT(... $cf_attribute)
 			cat conftest.h >>confdefs.h
 			case $cf_attribute in #(vi
+			noreturn) #(vi
+				AC_DEFINE_UNQUOTED(GCC_NORETURN,$cf_directive,[Define to noreturn-attribute for gcc])
+				;;
 			printf) #(vi
-				if test "$cf_printf_attribute" = no ; then
-					cat >>confdefs.h <<EOF
-#define GCC_PRINTFLIKE(fmt,var) /* nothing */
-EOF
-				else
-					cat >>confdefs.h <<EOF
-#define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var)))
-EOF
+				cf_value='/* nothing */'
+				if test "$cf_printf_attribute" != no ; then
+					cf_value='__attribute__((format(printf,fmt,var)))'
+					AC_DEFINE(GCC_PRINTF,1,[Define to 1 if the compiler supports gcc-like printf attribute.])
 				fi
+				AC_DEFINE_UNQUOTED(GCC_PRINTFLIKE(fmt,var),$cf_value,[Define to printf-attribute for gcc])
 				;;
 			scanf) #(vi
-				if test "$cf_scanf_attribute" = no ; then
-					cat >>confdefs.h <<EOF
-#define GCC_SCANFLIKE(fmt,var) /* nothing */
-EOF
-				else
-					cat >>confdefs.h <<EOF
-#define GCC_SCANFLIKE(fmt,var)  __attribute__((format(scanf,fmt,var)))
-EOF
+				cf_value='/* nothing */'
+				if test "$cf_scanf_attribute" != no ; then
+					cf_value='__attribute__((format(scanf,fmt,var)))'
+					AC_DEFINE(GCC_SCANF,1,[Define to 1 if the compiler supports gcc-like scanf attribute.])
 				fi
+				AC_DEFINE_UNQUOTED(GCC_SCANFLIKE(fmt,var),$cf_value,[Define to sscanf-attribute for gcc])
+				;;
+			unused) #(vi
+				AC_DEFINE_UNQUOTED(GCC_UNUSED,$cf_directive,[Define to unused-attribute for gcc])
 				;;
 			esac
 		fi
@@ -1646,7 +1928,7 @@
 fi
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_GCC_VERSION version: 5 updated: 2010/04/24 11:02:31
+dnl CF_GCC_VERSION version: 7 updated: 2012/10/18 06:46:33
 dnl --------------
 dnl Find version of gcc
 AC_DEFUN([CF_GCC_VERSION],[
@@ -1654,13 +1936,13 @@
 GCC_VERSION=none
 if test "$GCC" = yes ; then
 	AC_MSG_CHECKING(version of $CC)
-	GCC_VERSION="`${CC} --version 2>/dev/null | sed -e '2,$d' -e 's/^.*(GCC) //' -e 's/^[[^0-9.]]*//' -e 's/[[^0-9.]].*//'`"
+	GCC_VERSION="`${CC} --version 2>/dev/null | sed -e '2,$d' -e 's/^.*(GCC[[^)]]*) //' -e 's/^.*(Debian[[^)]]*) //' -e 's/^[[^0-9.]]*//' -e 's/[[^0-9.]].*//'`"
 	test -z "$GCC_VERSION" && GCC_VERSION=unknown
 	AC_MSG_RESULT($GCC_VERSION)
 fi
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_GCC_WARNINGS version: 27 updated: 2010/10/23 15:52:32
+dnl CF_GCC_WARNINGS version: 29 updated: 2012/06/16 14:55:39
 dnl ---------------
 dnl Check if the compiler supports useful warning options.  There's a few that
 dnl we don't use, simply because they're too noisy:
@@ -1683,6 +1965,7 @@
 [
 AC_REQUIRE([CF_GCC_VERSION])
 CF_INTEL_COMPILER(GCC,INTEL_COMPILER,CFLAGS)
+CF_CLANG_COMPILER(GCC,CLANG_COMPILER,CFLAGS)
 
 cat > conftest.$ac_ext <<EOF
 #line __oline__ "${as_me:-configure}"
@@ -1758,6 +2041,13 @@
 					continue;;
 				esac
 				;;
+			Wpointer-arith) #(vi
+				case $GCC_VERSION in
+				[[12]].*)
+					CF_VERBOSE(feature is broken in gcc $GCC_VERSION)
+					continue;;
+				esac
+				;;
 			esac
 			EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt"
 		fi
@@ -1769,6 +2059,29 @@
 AC_SUBST(EXTRA_CFLAGS)
 ])dnl
 dnl ---------------------------------------------------------------------------
+dnl CF_GETOPT_HEADER version: 5 updated: 2012/10/06 16:39:58
+dnl ----------------
+dnl Check for getopt's variables which are commonly defined in stdlib.h,
+dnl unistd.h or (nonstandard) in getopt.h
+AC_DEFUN([CF_GETOPT_HEADER],
+[
+AC_HAVE_HEADERS(unistd.h getopt.h)
+AC_CACHE_CHECK(for header declaring getopt variables,cf_cv_getopt_header,[
+cf_cv_getopt_header=none
+for cf_header in stdio.h stdlib.h unistd.h getopt.h
+do
+AC_TRY_COMPILE([
+#include <$cf_header>],
+[int x = optind; char *y = optarg],
+[cf_cv_getopt_header=$cf_header
+ break])
+done
+])
+if test $cf_cv_getopt_header != none ; then
+	AC_DEFINE(HAVE_GETOPT_HEADER,1,[Define to 1 if we need to include getopt.h])
+fi
+])dnl
+dnl ---------------------------------------------------------------------------
 dnl CF_GNAT_GENERICS version: 2 updated: 2011/03/23 20:24:41
 dnl ----------------
 AC_DEFUN([CF_GNAT_GENERICS],
@@ -2040,7 +2353,7 @@
 rm -rf conftest* *~conftest*
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_GNAT_VERSION version: 17 updated: 2011/03/23 20:24:41
+dnl CF_GNAT_VERSION version: 18 updated: 2012/01/21 19:28:10
 dnl ---------------
 dnl Verify version of GNAT.
 AC_DEFUN([CF_GNAT_VERSION],
@@ -2052,7 +2365,7 @@
 AC_MSG_RESULT($cf_gnat_version)
 
 case $cf_gnat_version in #(vi
-3.1[[1-9]]*|3.[[2-9]]*|[[4-9]].*) #(vi
+3.1[[1-9]]*|3.[[2-9]]*|[[4-9]].*|20[[0-9]][[0-9]]) #(vi
 	cf_cv_prog_gnat_correct=yes
 	;;
 *)
@@ -2092,7 +2405,7 @@
 test "$cf_cv_gnu_source" = yes && CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_GPP_LIBRARY version: 10 updated: 2010/05/29 16:31:02
+dnl CF_GPP_LIBRARY version: 11 updated: 2012/10/06 17:56:13
 dnl --------------
 dnl If we're trying to use g++, test if libg++ is installed (a rather common
 dnl problem :-).  If we have the compiler but no library, we'll be able to
@@ -2119,9 +2432,9 @@
 	[cf_cxx_library=yes
 	 CF_ADD_LIB($cf_gpp_libname,CXXLIBS)
 	 if test "$cf_gpp_libname" = cpp ; then
-	    AC_DEFINE(HAVE_GPP_BUILTIN_H)
+	    AC_DEFINE(HAVE_GPP_BUILTIN_H,1,[Define to 1 if we have gpp builtin.h])
 	 else
-	    AC_DEFINE(HAVE_GXX_BUILTIN_H)
+	    AC_DEFINE(HAVE_GXX_BUILTIN_H,1,[Define to 1 if we have g++ builtin.h])
 	 fi],
 	[AC_TRY_LINK([
 #include <builtin.h>
@@ -2129,28 +2442,28 @@
 	[two_arg_error_handler_t foo2 = lib_error_handler],
 	[cf_cxx_library=yes
 	 CF_ADD_LIB($cf_gpp_libname,CXXLIBS)
-	 AC_DEFINE(HAVE_BUILTIN_H)],
+	 AC_DEFINE(HAVE_BUILTIN_H,1,[Define to 1 if we have builtin.h])],
 	[cf_cxx_library=no])])
 	LIBS="$cf_save"
 	AC_MSG_RESULT($cf_cxx_library)
 fi
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_GXX_VERSION version: 6 updated: 2010/10/23 15:44:18
+dnl CF_GXX_VERSION version: 7 updated: 2012/06/16 14:55:39
 dnl --------------
 dnl Check for version of g++
 AC_DEFUN([CF_GXX_VERSION],[
 AC_REQUIRE([AC_PROG_CPP])
 GXX_VERSION=none
 if test "$GXX" = yes; then
-	AC_MSG_CHECKING(version of g++)
+	AC_MSG_CHECKING(version of ${CXX:-g++})
 	GXX_VERSION="`${CXX:-g++} --version| sed -e '2,$d' -e 's/^.*(GCC) //' -e 's/^[[^0-9.]]*//' -e 's/[[^0-9.]].*//'`"
 	test -z "$GXX_VERSION" && GXX_VERSION=unknown
 	AC_MSG_RESULT($GXX_VERSION)
 fi
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_GXX_WARNINGS version: 6 updated: 2010/08/14 18:25:37
+dnl CF_GXX_WARNINGS version: 7 updated: 2012/06/16 14:55:39
 dnl ---------------
 dnl Check if the compiler supports useful warning options.
 dnl
@@ -2173,6 +2486,7 @@
 [
 
 CF_INTEL_COMPILER(GXX,INTEL_CPLUSPLUS,CXXFLAGS)
+CF_CLANG_COMPILER(GXX,CLANG_CPLUSPLUS,CXXFLAGS)
 
 AC_REQUIRE([CF_GXX_VERSION])
 
@@ -2464,7 +2778,7 @@
 [AC_DIVERT_HELP([$1])dnl
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_INCLUDE_DIRS version: 6 updated: 2009/01/06 19:37:40
+dnl CF_INCLUDE_DIRS version: 7 updated: 2012/11/10 19:15:05
 dnl ---------------
 dnl Construct the list of include-options according to whether we're building
 dnl in the source directory or using '--srcdir=DIR' option.  If we're building
@@ -2472,25 +2786,25 @@
 dnl since that usually breaks gcc's shadow-includes.
 AC_DEFUN([CF_INCLUDE_DIRS],
 [
-CPPFLAGS="$CPPFLAGS -I. -I../include"
-if test "$srcdir" != "."; then
-	CPPFLAGS="$CPPFLAGS -I\${srcdir}/../include"
-fi
 if test "$GCC" != yes; then
-	CPPFLAGS="$CPPFLAGS -I\${includedir}"
+	CPPFLAGS="-I\${includedir} $CPPFLAGS"
 elif test "$includedir" != "/usr/include"; then
 	if test "$includedir" = '${prefix}/include' ; then
 		if test $prefix != /usr ; then
-			CPPFLAGS="$CPPFLAGS -I\${includedir}"
+			CPPFLAGS="-I\${includedir} $CPPFLAGS"
 		fi
 	else
-		CPPFLAGS="$CPPFLAGS -I\${includedir}"
+		CPPFLAGS="-I\${includedir} $CPPFLAGS"
 	fi
 fi
+if test "$srcdir" != "."; then
+	CPPFLAGS="-I\${srcdir}/../include $CPPFLAGS"
+fi
+CPPFLAGS="-I. -I../include $CPPFLAGS"
 AC_SUBST(CPPFLAGS)
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_INTEL_COMPILER version: 4 updated: 2010/05/26 05:38:42
+dnl CF_INTEL_COMPILER version: 5 updated: 2013/02/10 10:41:05
 dnl -----------------
 dnl Check if the given compiler is really the Intel compiler for Linux.  It
 dnl tries to imitate gcc, but does not return an error when it finds a mismatch
@@ -2504,6 +2818,7 @@
 dnl $2 = INTEL_COMPILER (default) or INTEL_CPLUSPLUS
 dnl $3 = CFLAGS (default) or CXXFLAGS
 AC_DEFUN([CF_INTEL_COMPILER],[
+AC_REQUIRE([AC_CANONICAL_HOST])
 ifelse([$2],,INTEL_COMPILER,[$2])=no
 
 if test "$ifelse([$1],,[$1],GCC)" = yes ; then
@@ -2527,7 +2842,7 @@
 fi
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_ISASCII version: 3 updated: 2000/08/12 23:18:52
+dnl CF_ISASCII version: 4 updated: 2012/10/06 17:56:13
 dnl ----------
 dnl Check if we have either a function or macro for 'isascii()'.
 AC_DEFUN([CF_ISASCII],
@@ -2539,10 +2854,10 @@
 	[cf_cv_have_isascii=no])
 ])dnl
 AC_MSG_RESULT($cf_cv_have_isascii)
-test "$cf_cv_have_isascii" = yes && AC_DEFINE(HAVE_ISASCII)
+test "$cf_cv_have_isascii" = yes && AC_DEFINE(HAVE_ISASCII,1,[Define to 1 if we have isascii()])
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_LARGEFILE version: 7 updated: 2007/06/02 11:58:50
+dnl CF_LARGEFILE version: 8 updated: 2012/10/06 08:57:51
 dnl ------------
 dnl Add checks for large file support.
 AC_DEFUN([CF_LARGEFILE],[
@@ -2576,12 +2891,12 @@
 		[cf_cv_struct_dirent64=yes],
 		[cf_cv_struct_dirent64=no])
 	])
-	test "$cf_cv_struct_dirent64" = yes && AC_DEFINE(HAVE_STRUCT_DIRENT64)
+	test "$cf_cv_struct_dirent64" = yes && AC_DEFINE(HAVE_STRUCT_DIRENT64,1,[Define to 1 if we have struct dirent64])
     fi
 ])
 ])
 dnl ---------------------------------------------------------------------------
-dnl CF_LDFLAGS_STATIC version: 8 updated: 2010/10/23 14:39:56
+dnl CF_LDFLAGS_STATIC version: 10 updated: 2011/09/24 12:51:48
 dnl -----------------
 dnl Check for compiler/linker flags used to temporarily force usage of static
 dnl libraries.  This depends on the compiler and platform.  Use this to help
@@ -2602,7 +2917,7 @@
     esac
 else
 	case $cf_cv_system_name in #(
-	aix[[456]]*) 	#( from ld manpage
+	aix[[4-7]]*) 	#( from ld manpage
 		LDFLAGS_STATIC=-bstatic
 		LDFLAGS_SHARED=-bdynamic
 		;;
@@ -2652,7 +2967,17 @@
 int cf_ldflags_static(FILE *fp);
 ],[
 	return cf_ldflags_static(stdin);
-],[cf_ldflags_static=yes],[cf_ldflags_static=no])
+],[
+	# some linkers simply ignore the -dynamic
+	case x`file conftest$ac_exeext 2>/dev/null` in #(vi
+	*static*) # (vi
+		cf_ldflags_static=no
+		;;
+	*)
+		cf_ldflags_static=yes
+		;;
+	esac
+],[cf_ldflags_static=no])
 
 	rm -f libconftest.*
 	LIBS="$cf_save_LIBS"
@@ -2673,7 +2998,7 @@
 AC_SUBST(LDFLAGS_SHARED)
 ])
 dnl ---------------------------------------------------------------------------
-dnl CF_LD_RPATH_OPT version: 3 updated: 2010/06/02 05:03:05
+dnl CF_LD_RPATH_OPT version: 5 updated: 2011/07/17 14:48:41
 dnl ---------------
 dnl For the given system and compiler, find the compiler flags to pass to the
 dnl loader to use the "rpath" feature.
@@ -2694,10 +3019,10 @@
 linux*|gnu*|k*bsd*-gnu) #(vi
 	LD_RPATH_OPT="-Wl,-rpath,"
 	;;
-openbsd[[2-9]].*) #(vi
+openbsd[[2-9]].*|mirbsd*) #(vi
 	LD_RPATH_OPT="-Wl,-rpath,"
 	;;
-freebsd*) #(vi
+dragonfly*|freebsd*) #(vi
 	LD_RPATH_OPT="-rpath "
 	;;
 netbsd*) #(vi
@@ -2756,11 +3081,23 @@
 $1="$cf_library_path_list [$]$1"
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_LIB_PREFIX version: 8 updated: 2008/09/13 11:34:16
+dnl CF_LIBTOOL_VERSION version: 1 updated: 2013/04/06 18:03:09
+dnl ------------------
+AC_DEFUN([CF_LIBTOOL_VERSION],[
+if test -n "$LIBTOOL" && test "$LIBTOOL" != none
+then
+	cf_cv_libtool_version=`$LIBTOOL --version 2>&1 | sed -e '/^$/d' |sed -e '2,$d' -e 's/([[^)]]*)//g' -e 's/^[[^1-9]]*//' -e 's/[[^0-9.]].*//'`
+else
+	cf_cv_libtool_version=
+fi
+test -z "$cf_cv_libtool_version" && unset cf_cv_libtool_version
+])dnl
+dnl ---------------------------------------------------------------------------
+dnl CF_LIB_PREFIX version: 9 updated: 2012/01/21 19:28:10
 dnl -------------
 dnl Compute the library-prefix for the given host system
 dnl $1 = variable to set
-AC_DEFUN([CF_LIB_PREFIX],
+define([CF_LIB_PREFIX],
 [
 	case $cf_cv_system_name in #(vi
 	OS/2*|os2*) #(vi
@@ -2773,11 +3110,11 @@
 	AC_SUBST(LIB_PREFIX)
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_LIB_RULES version: 61 updated: 2010/10/23 16:10:30
+dnl CF_LIB_RULES version: 72 updated: 2013/03/24 17:10:41
 dnl ------------
 dnl Append definitions and rules for the given models to the subdirectory
 dnl Makefiles, and the recursion rule for the top-level Makefile.  If the
-dnl subdirectory is a library-source directory, modify the LIBS_TO_MAKE list in
+dnl subdirectory is a library-source directory, modify the Libs_To_Make list in
 dnl the corresponding makefile to list the models that we'll generate.
 dnl
 dnl For shared libraries, make a list of symbolic links to construct when
@@ -2786,15 +3123,19 @@
 dnl	lib<name>.so	->
 dnl	lib<name>.so.<major>	->
 dnl	lib<name>.so.<maj>.<minor>
+dnl
+dnl Note: Libs_To_Make is mixed case, since it is not a pure autoconf variable.
 AC_DEFUN([CF_LIB_RULES],
 [
-CF_LIB_PREFIX(cf_prefix)
+cf_prefix=$LIB_PREFIX
 AC_REQUIRE([CF_SUBST_NCURSES_VERSION])
 
-if test $cf_cv_shlib_version = cygdll ; then
+case $cf_cv_shlib_version in #(vi
+cygdll|mingw)
 	TINFO_NAME=$TINFO_ARG_SUFFIX
 	TINFO_SUFFIX=.dll
-fi
+	;;
+esac
 
 if test -n "$TINFO_SUFFIX" ; then
 	case $TINFO_SUFFIX in
@@ -2820,79 +3161,73 @@
 	elif test -f $srcdir/$cf_dir/modules; then
 
 		SHARED_LIB=
-		LIBS_TO_MAKE=
+		Libs_To_Make=
 		for cf_item in $cf_LIST_MODELS
 		do
 			CF_LIB_SUFFIX($cf_item,cf_suffix,cf_depsuf)
+			cf_libname=$cf_dir
+			test "$cf_dir" = c++ && cf_libname=ncurses++
 			if test $cf_item = shared ; then
-			if test "$cf_cv_do_symlinks" = yes ; then
-				case "$cf_cv_shlib_version" in #(vi
-				rel) #(vi
-					case "$cf_cv_system_name" in #(vi
-					darwin*)
-					case .${LIB_SUFFIX} in
-					.tw*)
-						cf_suffix=`echo $cf_suffix | sed 's/^tw//'`
-						cf_suffix=tw'.${REL_VERSION}'"$cf_suffix"
-						;;
-					.t*)
-						cf_suffix=`echo $cf_suffix | sed 's/^t//'`
-						cf_suffix=t'.${REL_VERSION}'"$cf_suffix"
-						;;
-					.w*)
-						cf_suffix=`echo $cf_suffix | sed 's/^w//'`
-						cf_suffix=w'.${REL_VERSION}'"$cf_suffix"
+				if test -n "${LIB_SUFFIX}"
+				then
+					cf_shared_suffix=`echo "$cf_suffix" | sed 's/^'"${LIB_SUFFIX}"'//'`
+				else
+					cf_shared_suffix="$cf_suffix"
+				fi
+				if test "$cf_cv_do_symlinks" = yes ; then
+					cf_version_name=
+
+					case "$cf_cv_shlib_version" in #(vi
+					rel) #(vi
+						cf_version_name=REL_VERSION
 						;;
-					*)
-						cf_suffix='.${REL_VERSION}'"$cf_suffix"
+					abi)
+						cf_version_name=ABI_VERSION
 						;;
 					esac
-					;; #(vi
-					*) cf_suffix="$cf_suffix"'.${REL_VERSION}' ;;
-					esac
+
+					if test -n "$cf_version_name"
+					then
+						case "$cf_cv_system_name" in #(vi
+						darwin*)
+							# "w", etc?
+							cf_suffix="${LIB_SUFFIX}"'.${'$cf_version_name'}'"$cf_shared_suffix"
+							;; #(vi
+						*)
+							cf_suffix="$cf_suffix"'.${'$cf_version_name'}'
+							;;
+						esac
+					fi
+					if test -n "${LIB_SUFFIX}"
+					then
+						cf_shared_suffix=`echo "$cf_suffix" | sed 's/^'"${LIB_SUFFIX}"'//'`
+					else
+						cf_shared_suffix="$cf_suffix"
+					fi
+				fi
+				# cygwin needs import library, and has unique naming convention
+				# use autodetected ${cf_prefix} for import lib and static lib, but
+				# use 'cyg' prefix for shared lib.
+				case $cf_cv_shlib_version in #(vi
+				cygdll) #(vi
+					cf_cygsuf=`echo "$cf_suffix" | sed -e 's/\.dll/\${ABI_VERSION}.dll/'`
+					Libs_To_Make="$Libs_To_Make ../lib/cyg${cf_libname}${cf_cygsuf}"
+					continue
 					;;
-				abi)
-					case "$cf_cv_system_name" in #(vi
-					darwin*)
-					case .${LIB_SUFFIX} in
-					.tw*)
-						cf_suffix=`echo $cf_suffix | sed 's/^tw//'`
-						cf_suffix=tw'.${ABI_VERSION}'"$cf_suffix"
-						;;
-					.t*)
-						cf_suffix=`echo $cf_suffix | sed 's/^t//'`
-						cf_suffix=t'.${ABI_VERSION}'"$cf_suffix"
-						;;
-					.w*)
-						cf_suffix=`echo $cf_suffix | sed 's/^w//'`
-						cf_suffix=w'.${ABI_VERSION}'"$cf_suffix"
-						;;
-					*)
-						cf_suffix='.${ABI_VERSION}'"$cf_suffix"
-						;;
-					esac
-					;; #(vi
-					*) cf_suffix="$cf_suffix"'.${ABI_VERSION}' ;;
-					esac
+				mingw)
+					cf_cygsuf=`echo "$cf_suffix" | sed -e 's/\.dll/\${ABI_VERSION}.dll/'`
+					Libs_To_Make="$Libs_To_Make ../lib/lib${cf_libname}${cf_cygsuf}"
+					continue
 					;;
 				esac
 			fi
-			# cygwin needs import library, and has unique naming convention
-			# use autodetected ${cf_prefix} for import lib and static lib, but
-			# use 'cyg' prefix for shared lib.
-			if test $cf_cv_shlib_version = cygdll ; then
-				cf_cygsuf=`echo "$cf_suffix" | sed -e 's/\.dll/\${ABI_VERSION}.dll/'`
-				LIBS_TO_MAKE="$LIBS_TO_MAKE ../lib/cyg${cf_dir}${cf_cygsuf}"
-				continue
-			fi
-			fi
-			LIBS_TO_MAKE="$LIBS_TO_MAKE ../lib/${cf_prefix}${cf_dir}${cf_suffix}"
+			Libs_To_Make="$Libs_To_Make ../lib/${cf_prefix}${cf_libname}${cf_suffix}"
 		done
 
 		if test $cf_dir = ncurses ; then
 			cf_subsets="$LIB_SUBSETS"
 			cf_r_parts="$cf_subsets"
-			cf_liblist="$LIBS_TO_MAKE"
+			cf_liblist="$Libs_To_Make"
 
 			while test -n "$cf_r_parts"
 			do
@@ -2912,7 +3247,7 @@
 						;;
 					esac
 					if test -n "$cf_item"; then
-						LIBS_TO_MAKE="$cf_item $LIBS_TO_MAKE"
+						Libs_To_Make="$cf_item $Libs_To_Make"
 					fi
 				else
 					break
@@ -2922,13 +3257,40 @@
 			cf_subsets=`echo "$LIB_SUBSETS" | sed -e 's/^termlib.* //'`
 		fi
 
-		sed -e "s%@LIBS_TO_MAKE@%$LIBS_TO_MAKE%" \
+		if test $cf_dir = c++; then
+			if test "x$with_shared_cxx" != xyes && test -n "$cf_shared_suffix"; then
+				cf_list=
+				for cf_item in $Libs_To_Make
+				do
+					case $cf_item in
+					*.a)
+						;;
+					*)
+						cf_item=`echo "$cf_item" | sed -e "s,"$cf_shared_suffix",.a,"`
+						;;
+					esac
+					for cf_test in $cf_list
+					do
+						if test "$cf_test" = "$cf_item"
+						then
+							cf_LIST_MODELS=`echo "$cf_LIST_MODELS" | sed -e 's/normal//'`
+							cf_item=
+							break
+						fi
+					done
+					test -n "$cf_item" && cf_list="$cf_list $cf_item"
+				done
+				Libs_To_Make="$cf_list"
+			fi
+		fi
+
+		sed -e "s%@Libs_To_Make@%$Libs_To_Make%" \
 		    -e "s%@SHARED_LIB@%$SHARED_LIB%" \
 			$cf_dir/Makefile >$cf_dir/Makefile.out
 		mv $cf_dir/Makefile.out $cf_dir/Makefile
 
 		$AWK -f $srcdir/mk-0th.awk \
-			libname="${cf_dir}${LIB_SUFFIX}" subsets="$LIB_SUBSETS" \
+			libname="${cf_dir}${LIB_SUFFIX}" subsets="$LIB_SUBSETS" ticlib="$TICS_LIB_SUFFIX" termlib="$TINFO_LIB_SUFFIX" \
 			$srcdir/$cf_dir/modules >>$cf_dir/Makefile
 
 		for cf_subset in $cf_subsets
@@ -2936,8 +3298,23 @@
 			cf_subdirs=
 			for cf_item in $cf_LIST_MODELS
 			do
+
 			echo "Appending rules for ${cf_item} model (${cf_dir}: ${cf_subset})"
 			CF_UPPER(cf_ITEM,$cf_item)
+
+			CXX_MODEL=$cf_ITEM
+			if test "$CXX_MODEL" = SHARED; then
+				case $cf_cv_shlib_version in #(vi
+				cygdll|mingw) #(vi
+					test "x$with_shared_cxx" = xno && CF_VERBOSE(overriding CXX_MODEL to SHARED)
+					with_shared_cxx=yes
+					;;
+				*)
+					test "x$with_shared_cxx" = xno && CXX_MODEL=NORMAL
+					;;
+				esac
+			fi
+
 			CF_LIB_SUFFIX($cf_item,cf_suffix,cf_depsuf)
 			CF_OBJ_SUBDIR($cf_item,cf_subdir)
 
@@ -2955,6 +3332,8 @@
 					cf_libname=$TICS_LIB_SUFFIX
 					;;
 				esac
+			elif test $cf_dir = c++ ; then
+				cf_libname=ncurses++$LIB_SUFFIX
 			else
 				cf_libname=${cf_libname}$LIB_SUFFIX
 			fi
@@ -3006,10 +3385,12 @@
 				name=${cf_libname}${cf_dir_suffix} \
 				traces=$LIB_TRACING \
 				MODEL=$cf_ITEM \
+				CXX_MODEL=$CXX_MODEL \
 				model=$cf_subdir \
 				prefix=$cf_prefix \
 				suffix=$cf_suffix \
 				subset=$cf_subset \
+				driver=$cf_cv_term_driver \
 				SymLink="$LN_S" \
 				TermlibRoot=$TINFO_NAME \
 				TermlibSuffix=$TINFO_SUFFIX \
@@ -3048,7 +3429,7 @@
 		done
 	fi
 
-	echo '	cd '$cf_dir' && ${MAKE} ${CF_MFLAGS} [$]@' >>Makefile
+	echo '	cd '$cf_dir' && ${MAKE} ${TOP_MFLAGS} [$]@' >>Makefile
 done
 
 for cf_dir in $SRC_SUBDIRS
@@ -3063,7 +3444,7 @@
 			echo 'libs \' >> Makefile
 			echo 'install.libs \' >> Makefile
 			echo 'uninstall.libs ::' >> Makefile
-			echo '	cd '$cf_dir' && ${MAKE} ${CF_MFLAGS} [$]@' >> Makefile
+			echo '	cd '$cf_dir' && ${MAKE} ${TOP_MFLAGS} [$]@' >> Makefile
 			;;
 		esac
 	fi
@@ -3086,7 +3467,7 @@
 uninstall.libs \\
 install.$cf_dir \\
 uninstall.$cf_dir ::
-	cd $cf_dir && \${MAKE} \${CF_MFLAGS} \[$]@
+	cd $cf_dir && \${MAKE} \${TOP_MFLAGS} \[$]@
 CF_EOF
 	elif test -f $srcdir/$cf_dir/headers; then
 cat >> Makefile <<CF_EOF
@@ -3096,7 +3477,7 @@
 uninstall.libs \\
 install.includes \\
 uninstall.includes ::
-	cd $cf_dir && \${MAKE} \${CF_MFLAGS} \[$]@
+	cd $cf_dir && \${MAKE} \${TOP_MFLAGS} \[$]@
 CF_EOF
 fi
 done
@@ -3105,7 +3486,7 @@
 
 install.libs uninstall.libs \\
 install.data uninstall.data ::
-$MAKE_TERMINFO	cd misc && \${MAKE} \${CF_MFLAGS} \[$]@
+$MAKE_TERMINFO	cd misc && \${MAKE} \${TOP_MFLAGS} \[$]@
 CF_EOF
 
 if test "x$cf_with_manpages" = xyes; then
@@ -3113,7 +3494,7 @@
 
 install.man \\
 uninstall.man ::
-	cd man && \${MAKE} \${CF_MFLAGS} \[$]@
+	cd man && \${MAKE} \${TOP_MFLAGS} \[$]@
 CF_EOF
 fi
 
@@ -3134,7 +3515,7 @@
 
 install.man \\
 uninstall.man ::
-	cd tack && \${MAKE} \${CF_MFLAGS} \[$]@
+	cd tack && \${MAKE} \${TOP_MFLAGS} \[$]@
 CF_EOF
 fi
 fi
@@ -3252,7 +3633,7 @@
 		fi
 	fi
 done
-AC_SUBST(LIBS_TO_MAKE)
+AC_SUBST(Libs_To_Make)
 ])dnl
 dnl ---------------------------------------------------------------------------
 dnl CF_LIB_SONAME version: 5 updated: 2010/08/14 18:25:37
@@ -3292,7 +3673,7 @@
 ])
 ])
 dnl ---------------------------------------------------------------------------
-dnl CF_LIB_SUFFIX version: 16 updated: 2008/12/27 12:30:03
+dnl CF_LIB_SUFFIX version: 18 updated: 2012/02/25 15:20:07
 dnl -------------
 dnl Compute the library file-suffix from the given model name
 dnl $1 = model name
@@ -3321,11 +3702,11 @@
 		;;
 	shared) #(vi
 		case $cf_cv_system_name in
-		aix[[56]]*) #(vi
+		aix[[5-7]]*) #(vi
 			$2='.a'
 			$3=[$]$2
 			;;
-		cygwin*) #(vi
+		cygwin*|mingw*) #(vi
 			$2='.dll'
 			$3='.dll.a'
 			;;
@@ -3372,7 +3753,7 @@
 	test -n "$LIB_SUFFIX" && $2="${LIB_SUFFIX}[$]{$2}"
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_LINK_DATAONLY version: 9 updated: 2009/01/01 20:21:38
+dnl CF_LINK_DATAONLY version: 10 updated: 2012/10/06 17:41:51
 dnl ----------------
 dnl Some systems have a non-ANSI linker that doesn't pull in modules that have
 dnl only data (i.e., no functions), for example NeXT.  On those systems we'll
@@ -3429,13 +3810,13 @@
 AC_MSG_RESULT($cf_cv_link_dataonly)
 
 if test "$cf_cv_link_dataonly" = no ; then
-	AC_DEFINE(BROKEN_LINKER)
+	AC_DEFINE(BROKEN_LINKER,1,[if data-only library module does not link])
 	BROKEN_LINKER=1
 fi
 
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_LINK_FUNCS version: 7 updated: 2006/12/16 12:33:30
+dnl CF_LINK_FUNCS version: 8 updated: 2012/10/06 17:56:13
 dnl -------------
 dnl Most Unix systems have both link and symlink, a few don't have symlink.
 dnl A few non-Unix systems implement symlink, but not link.
@@ -3487,23 +3868,11 @@
 		done
 		test -z "$cf_cv_link_funcs" && cf_cv_link_funcs=no
 	])
-	test "$ac_cv_func_link"    = yes && AC_DEFINE(HAVE_LINK)
-	test "$ac_cv_func_symlink" = yes && AC_DEFINE(HAVE_SYMLINK)
+	test "$ac_cv_func_link"    = yes && AC_DEFINE(HAVE_LINK,1,[Define to 1 if we have link() function])
+	test "$ac_cv_func_symlink" = yes && AC_DEFINE(HAVE_SYMLINK,1,[Define to 1 if we have symlink() function])
 fi
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_MAIN_RETURN version: 1 updated: 2006/12/10 09:51:54
-dnl --------------
-dnl Check if a return from main to the shell actually returns the same exit
-dnl code.  This is true for almost any POSIX environment.
-dnl
-dnl Some very old environments did not flush stdout, etc., on an exit.  That
-dnl would be a useful case to test for also.
-AC_DEFUN([CF_MAIN_RETURN],
-[
-cf_cv_main_return=return
-])dnl
-dnl ---------------------------------------------------------------------------
 dnl CF_MAKEFLAGS version: 14 updated: 2011/03/31 19:29:46
 dnl ------------
 dnl Some 'make' programs support ${MAKEFLAGS}, some ${MFLAGS}, to pass 'make'
@@ -3799,7 +4168,7 @@
 AC_MSG_RESULT($MANPAGE_TBL)
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_MAN_PAGES version: 39 updated: 2010/10/23 15:44:18
+dnl CF_MAN_PAGES version: 43 updated: 2013/02/09 12:53:45
 dnl ------------
 dnl Try to determine if the man-pages on the system are compressed, and if
 dnl so, what format is used.  Use this information to construct a script that
@@ -3856,6 +4225,7 @@
 # this script is generated by the configure-script CF_MAN_PAGES macro.
 
 prefix="$cf_prefix"
+datarootdir="$datarootdir"
 datadir="$datadir"
 
 NCURSES_MAJOR="$NCURSES_MAJOR"
@@ -3916,11 +4286,12 @@
 	if test ! -f $cf_man_alias ; then
 cat >>$cf_man_alias <<-CF_EOF2
 		s,@DATADIR@,\$datadir,g
-		s,@TERMINFO@,\$TERMINFO,g
-		s,@NCURSES_MAJOR@,\$NCURSES_MAJOR,g
-		s,@NCURSES_MINOR@,\$NCURSES_MINOR,g
-		s,@NCURSES_PATCH@,\$NCURSES_PATCH,g
-		s,@NCURSES_OSPEED@,\$NCURSES_OSPEED,g
+		s,@TERMINFO@,\${TERMINFO:="no default value"},g
+		s,@TERMINFO_DIRS@,\${TERMINFO_DIRS:="no default value"},g
+		s,@NCURSES_MAJOR@,\${NCURSES_MAJOR:="no default value"},g
+		s,@NCURSES_MINOR@,\${NCURSES_MINOR:="no default value"},g
+		s,@NCURSES_PATCH@,\${NCURSES_PATCH:="no default value"},g
+		s,@NCURSES_OSPEED@,\${NCURSES_OSPEED:="no default value"},g
 CF_EOF
 	ifelse($1,,,[
 	for cf_name in $1
@@ -3949,7 +4320,9 @@
 
 if test "$MANPAGE_ALIASES" != no ; then
 cat >>$cf_edit_man <<CF_EOF
-	aliases=\`sed -f \$top_srcdir/man/manlinks.sed \$inalias |sed -f $cf_man_alias | sort -u\`
+	nCurses=ignore.3x
+	test $with_curses_h = yes && nCurses=ncurses.3x
+	aliases=\`sed -f \$top_srcdir/man/manlinks.sed \$inalias |sed -f $cf_man_alias | sort -u; test \$inalias = \$nCurses && echo curses\`
 CF_EOF
 fi
 
@@ -3995,6 +4368,13 @@
 fi
 CF_EOF
 
+if test $with_overwrite != yes ; then
+cat >>$cf_edit_man <<CF_EOF
+	sed -e "/\#[    ]*include/s,<curses.h,<ncurses$LIB_SUFFIX/curses.h," < \$TMP >\$TMP.out
+	mv \$TMP.out \$TMP
+CF_EOF
+fi
+
 if test $with_curses_h != yes ; then
 cat >>$cf_edit_man <<CF_EOF
 	sed -e "/\#[    ]*include/s,curses.h,ncurses.h," < \$TMP >\$TMP.out
@@ -4154,7 +4534,7 @@
 fi
 ])
 dnl ---------------------------------------------------------------------------
-dnl CF_MIXEDCASE_FILENAMES version: 3 updated: 2003/09/20 17:07:55
+dnl CF_MIXEDCASE_FILENAMES version: 4 updated: 2012/10/02 20:55:03
 dnl ----------------------
 dnl Check if the file-system supports mixed-case filenames.  If we're able to
 dnl create a lowercase name and see it as uppercase, it doesn't support that.
@@ -4181,10 +4561,10 @@
 	rm -f conftest CONFTEST
 fi
 ])
-test "$cf_cv_mixedcase" = yes && AC_DEFINE(MIXEDCASE_FILENAMES)
+test "$cf_cv_mixedcase" = yes && AC_DEFINE(MIXEDCASE_FILENAMES,1,[Define to 1 if filesystem supports mixed-case filenames.])
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_MKSTEMP version: 7 updated: 2010/08/14 18:25:37
+dnl CF_MKSTEMP version: 9 updated: 2012/10/03 04:34:49
 dnl ----------
 dnl Check for a working mkstemp.  This creates two files, checks that they are
 dnl successfully created and distinct (AmigaOS apparently fails on the last).
@@ -4226,11 +4606,13 @@
 }
 ],[cf_cv_func_mkstemp=yes
 ],[cf_cv_func_mkstemp=no
-],[AC_CHECK_FUNC(mkstemp)
-])
+],[cf_cv_func_mkstemp=maybe])
 ])
+if test "x$cf_cv_func_mkstemp" = xmaybe ; then
+	AC_CHECK_FUNC(mkstemp)
+fi
 if test "x$cf_cv_func_mkstemp" = xyes || test "x$ac_cv_func_mkstemp" = xyes ; then
-	AC_DEFINE(HAVE_MKSTEMP)
+	AC_DEFINE(HAVE_MKSTEMP,1,[Define to 1 if mkstemp() is available and working.])
 fi
 ])dnl
 dnl ---------------------------------------------------------------------------
@@ -4258,14 +4640,14 @@
 fi
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_NO_LEAKS_OPTION version: 4 updated: 2006/12/16 14:24:05
+dnl CF_NO_LEAKS_OPTION version: 5 updated: 2012/10/02 20:55:03
 dnl ------------------
 dnl see CF_WITH_NO_LEAKS
 AC_DEFUN([CF_NO_LEAKS_OPTION],[
 AC_MSG_CHECKING(if you want to use $1 for testing)
 AC_ARG_WITH($1,
 	[$2],
-	[AC_DEFINE($3)ifelse([$4],,[
+	[AC_DEFINE_UNQUOTED($3,1,"Define to 1 if you want to use $1 for testing.")ifelse([$4],,[
 	 $4
 ])
 	: ${with_cflags:=-g}
@@ -4326,20 +4708,23 @@
 	esac
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_PATHSEP version: 5 updated: 2010/05/26 05:38:42
+dnl CF_PATHSEP version: 6 updated: 2012/09/29 18:38:12
 dnl ----------
-dnl Provide a value for the $PATH and similar separator
+dnl Provide a value for the $PATH and similar separator (or amend the value
+dnl as provided in autoconf 2.5x).
 AC_DEFUN([CF_PATHSEP],
 [
+	AC_MSG_CHECKING(for PATH separator)
 	case $cf_cv_system_name in
 	os2*)	PATH_SEPARATOR=';'  ;;
-	*)	PATH_SEPARATOR=':'  ;;
+	*)	${PATH_SEPARATOR:=':'}  ;;
 	esac
 ifelse([$1],,,[$1=$PATH_SEPARATOR])
 	AC_SUBST(PATH_SEPARATOR)
+	AC_MSG_RESULT($PATH_SEPARATOR)
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_PATH_SYNTAX version: 13 updated: 2010/05/26 05:38:42
+dnl CF_PATH_SYNTAX version: 14 updated: 2012/06/19 20:58:54
 dnl --------------
 dnl Check the argument to see that it looks like a pathname.  Rewrite it if it
 dnl begins with one of the prefix/exec_prefix variables, and then again if the
@@ -4359,7 +4744,7 @@
   ;;
 .[[a-zA-Z]]:[[\\/]]*) #(vi OS/2 EMX
   ;;
-.\[$]{*prefix}*) #(vi
+.\[$]{*prefix}*|.\[$]{*dir}*) #(vi
   eval $1="[$]$1"
   case ".[$]$1" in #(vi
   .NONE/*)
@@ -4376,7 +4761,7 @@
 esac
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_PKG_CONFIG version: 4 updated: 2011/02/18 20:26:24
+dnl CF_PKG_CONFIG version: 7 updated: 2011/04/29 04:53:22
 dnl -------------
 dnl Check for the package-config program, unless disabled by command-line.
 AC_DEFUN([CF_PKG_CONFIG],
@@ -4393,7 +4778,9 @@
 	PKG_CONFIG=none
 	;;
 yes) #(vi
-	AC_PATH_TOOL(PKG_CONFIG, pkg-config, none)
+	CF_ACVERSION_CHECK(2.52,
+		[AC_PATH_TOOL(PKG_CONFIG, pkg-config, none)],
+		[AC_PATH_PROG(PKG_CONFIG, pkg-config, none)])
 	;;
 *)
 	PKG_CONFIG=$withval
@@ -4554,6 +4941,19 @@
 test -z "$AWK" && AC_MSG_ERROR(No awk program found)
 ])dnl
 dnl ---------------------------------------------------------------------------
+dnl CF_PROG_CC version: 3 updated: 2012/10/06 15:31:55
+dnl ----------
+dnl standard check for CC, plus followup sanity checks
+dnl $1 = optional parameter to pass to AC_PROG_CC to specify compiler name
+AC_DEFUN([CF_PROG_CC],[
+ifelse($1,,[AC_PROG_CC],[AC_PROG_CC($1)])
+CF_GCC_VERSION
+CF_ACVERSION_CHECK(2.52,
+	[AC_PROG_CC_STDC],
+	[CF_ANSI_CC_REQD])
+CF_CC_ENV_FLAGS 
+])dnl
+dnl ---------------------------------------------------------------------------
 dnl CF_PROG_CC_C_O version: 3 updated: 2010/08/14 18:25:37
 dnl --------------
 dnl Analogous to AC_PROG_CC_C_O, but more useful: tests only $CC, ensures that
@@ -4593,31 +4993,6 @@
 fi
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_PROG_CC_U_D version: 1 updated: 2005/07/14 16:59:30
-dnl --------------
-dnl Check if C (preprocessor) -U and -D options are processed in the order
-dnl given rather than by type of option.  Some compilers insist on apply all
-dnl of the -U options after all of the -D options.  Others allow mixing them,
-dnl and may predefine symbols that conflict with those we define.
-AC_DEFUN([CF_PROG_CC_U_D],
-[
-AC_CACHE_CHECK(if $CC -U and -D options work together,cf_cv_cc_u_d_options,[
-	cf_save_CPPFLAGS="$CPPFLAGS"
-	CPPFLAGS="-UU_D_OPTIONS -DU_D_OPTIONS -DD_U_OPTIONS -UD_U_OPTIONS"
-	AC_TRY_COMPILE([],[
-#ifndef U_D_OPTIONS
-make an undefined-error
-#endif
-#ifdef  D_U_OPTIONS
-make a defined-error
-#endif
-	],[
-	cf_cv_cc_u_d_options=yes],[
-	cf_cv_cc_u_d_options=no])
-	CPPFLAGS="$cf_save_CPPFLAGS"
-])
-])dnl
-dnl ---------------------------------------------------------------------------
 dnl CF_PROG_EGREP version: 1 updated: 2006/09/16 11:40:59
 dnl -------------
 dnl AC_PROG_EGREP was introduced in autoconf 2.53.
@@ -4633,32 +5008,7 @@
 test -z "$EGREP" && AC_MSG_ERROR(No egrep program found)
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_PROG_EXT version: 10 updated: 2004/01/03 19:28:18
-dnl -----------
-dnl Compute $PROG_EXT, used for non-Unix ports, such as OS/2 EMX.
-AC_DEFUN([CF_PROG_EXT],
-[
-AC_REQUIRE([CF_CHECK_CACHE])
-case $cf_cv_system_name in
-os2*)
-    CFLAGS="$CFLAGS -Zmt"
-    CPPFLAGS="$CPPFLAGS -D__ST_MT_ERRNO__"
-    CXXFLAGS="$CXXFLAGS -Zmt"
-    # autoconf's macro sets -Zexe and suffix both, which conflict:w
-    LDFLAGS="$LDFLAGS -Zmt -Zcrtdll"
-    ac_cv_exeext=.exe
-    ;;
-esac
-
-AC_EXEEXT
-AC_OBJEXT
-
-PROG_EXT="$EXEEXT"
-AC_SUBST(PROG_EXT)
-test -n "$PROG_EXT" && AC_DEFINE_UNQUOTED(PROG_EXT,"$PROG_EXT")
-])dnl
-dnl ---------------------------------------------------------------------------
-dnl CF_PROG_GNAT version: 1 updated: 2010/06/19 15:22:18
+dnl CF_PROG_GNAT version: 2 updated: 2011/10/22 14:01:47
 dnl ------------
 dnl Check for gnatmake, ensure that it is complete.
 AC_DEFUN([CF_PROG_GNAT],[
@@ -4666,6 +5016,7 @@
 AC_CHECK_PROG(gnat_exists, $cf_ada_make, yes, no)
 if test "$ac_cv_prog_gnat_exists" = no; then
    cf_ada_make=
+   cf_cv_prog_gnat_correct=no
 else
    CF_GNAT_VERSION
    AC_CHECK_PROG(M4_exists, m4, yes, no)
@@ -4709,7 +5060,7 @@
 esac
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_PROG_LDCONFIG version: 2 updated: 2008/12/13 14:08:40
+dnl CF_PROG_LDCONFIG version: 3 updated: 2011/06/04 20:09:13
 dnl ----------------
 dnl Check for ldconfig, needed to fixup shared libraries that would be built
 dnl and then used in the install.
@@ -4718,7 +5069,7 @@
   LDCONFIG=:
 else
 case "$cf_cv_system_name" in #(vi
-dragonfly*|freebsd*) #(vi
+dragonfly*|mirbsd*|freebsd*) #(vi
   test -z "$LDCONFIG" && LDCONFIG="/sbin/ldconfig -R"
   ;;
 *) LDPATH=$PATH:/sbin:/usr/sbin
@@ -4759,7 +5110,7 @@
 test "$cf_prog_ln_sf" = yes && LN_S="$LN_S -f"
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_REGEX version: 8 updated: 2010/08/07 14:09:44
+dnl CF_REGEX version: 10 updated: 2012/10/04 20:12:20
 dnl --------
 dnl Attempt to determine if we've got one of the flavors of regular-expression
 dnl code that we can support.
@@ -4771,7 +5122,7 @@
 cf_regex_libs="regex re"
 case $host_os in #(vi
 mingw*)
-	cf_regex_libs="regex.dll $cf_regex_libs"
+	cf_regex_libs="gnurx $cf_regex_libs"
 	;;
 esac
 
@@ -4833,9 +5184,9 @@
 
 case $cf_cv_regex_hdrs in #(vi
     no)	       AC_MSG_WARN(no regular expression header found) ;; #(vi
-    regex.h)   AC_DEFINE(HAVE_REGEX_H_FUNCS) ;; #(vi
-    regexp.h)  AC_DEFINE(HAVE_REGEXP_H_FUNCS) ;; #(vi
-    regexpr.h) AC_DEFINE(HAVE_REGEXPR_H_FUNCS) ;;
+    regex.h)   AC_DEFINE(HAVE_REGEX_H_FUNCS,1,[Define to 1 to include regex.h for regular expressions]) ;; #(vi
+    regexp.h)  AC_DEFINE(HAVE_REGEXP_H_FUNCS,1,[Define to 1 to include regexp.h for regular expressions]) ;; #(vi
+    regexpr.h) AC_DEFINE(HAVE_REGEXPR_H_FUNCS,1,[Define to 1 to include regexpr.h for regular expressions]) ;;
 esac
 ])dnl
 dnl ---------------------------------------------------------------------------
@@ -4984,7 +5335,7 @@
 AC_SUBST(EXTRA_LDFLAGS)
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_SHARED_OPTS version: 64 updated: 2010/06/05 16:51:16
+dnl CF_SHARED_OPTS version: 72 updated: 2013/01/26 16:26:12
 dnl --------------
 dnl --------------
 dnl Attempt to determine the appropriate CC/LD options for creating a shared
@@ -5040,6 +5391,7 @@
 	AC_MSG_RESULT($cf_cv_shlib_version)
 
 	cf_cv_rm_so_locs=no
+	cf_try_cflags=
 
 	# Some less-capable ports of gcc support only -fpic
 	CC_SHARED_OPTS=
@@ -5059,10 +5411,14 @@
 	cf_cv_shlib_version_infix=no
 
 	case $cf_cv_system_name in #(vi
-	aix[[56]]*) #(vi
+	aix4.[3-9]*|aix[[5-7]]*) #(vi
 		if test "$GCC" = yes; then
 			CC_SHARED_OPTS=
-			MK_SHARED_LIB='$(CC) -shared'
+			MK_SHARED_LIB='${CC} -shared -Wl,-brtl -Wl,-blibpath:${RPATH_LIST}:/usr/lib -o [$]@'
+		else
+			# CC_SHARED_OPTS='-qpic=large -G'
+			# perhaps "-bM:SRE -bnoentry -bexpall"
+			MK_SHARED_LIB='${CC} -G -Wl,-brtl -Wl,-blibpath:${RPATH_LIST}:/usr/lib -o [$]@'
 		fi
 		;;
 	beos*) #(vi
@@ -5088,7 +5444,7 @@
 		chmod +x mk_shared_lib.sh
 		;;
 	darwin*) #(vi
-		EXTRA_CFLAGS="-no-cpp-precomp"
+		cf_try_cflags="no-cpp-precomp"
 		CC_SHARED_OPTS="-dynamic"
 		MK_SHARED_LIB='${CC} ${CFLAGS} -dynamiclib -install_name ${libdir}/`basename $[@]` -compatibility_version ${ABI_VERSION} -current_version ${ABI_VERSION} -o $[@]'
 		test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=abi
@@ -5102,6 +5458,14 @@
 			LDFLAGS="$LDFLAGS -Wl,-search_paths_first"
 		fi
 		;;
+	hpux[[7-8]]*) #(vi
+		# HP-UX 8.07 ld lacks "+b" option used for libdir search-list 
+		if test "$GCC" != yes; then
+			CC_SHARED_OPTS='+Z'
+		fi
+		MK_SHARED_LIB='${LD} -b -o $[@]'
+		INSTALL_LIB="-m 555"
+		;;
 	hpux*) #(vi
 		# (tested with gcc 2.7.2 -- I don't have c89)
 		if test "$GCC" = yes; then
@@ -5115,9 +5479,19 @@
 		# readonly to exploit a quirk in the memory manager.
 		INSTALL_LIB="-m 555"
 		;;
+	interix*)
+		test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel
+		if test "$cf_cv_shlib_version" = rel; then
+			cf_shared_soname='`basename $@ .${REL_VERSION}`.${ABI_VERSION}'
+		else
+			cf_shared_soname='`basename $@`'
+		fi
+		CC_SHARED_OPTS=
+		MK_SHARED_LIB='${CC} -shared -Wl,-rpath,${RPATH_LIST} -Wl,-h,'$cf_shared_soname' -o $@'
+		;;
 	irix*) #(vi
 		if test "$cf_cv_enable_rpath" = yes ; then
-			EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${libdir} $EXTRA_LDFLAGS"
+			EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${RPATH_LIST} $EXTRA_LDFLAGS"
 		fi
 		# tested with IRIX 5.2 and 'cc'.
 		if test "$GCC" != yes; then
@@ -5134,18 +5508,39 @@
 			LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
 		fi
 		if test "$cf_cv_enable_rpath" = yes ; then
-			EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${libdir} $EXTRA_LDFLAGS"
+			EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${RPATH_LIST} $EXTRA_LDFLAGS"
 		fi
 		CF_SHARED_SONAME
 		MK_SHARED_LIB='${CC} ${CFLAGS} -shared -Wl,-soname,'$cf_cv_shared_soname',-stats,-lc -o $[@]'
 		;;
-	openbsd[[2-9]].*) #(vi
+	mingw*) #(vi
+		cf_cv_shlib_version=mingw
+		cf_cv_shlib_version_infix=mingw
+		CC_SHARED_OPTS=
+		MK_SHARED_LIB='sh ../mk_shared_lib.sh [$]@ [$]{CC} [$]{CFLAGS}'
+		#MK_SHARED_LIB='${CC} ${CFLAGS} -mdll -Wl,-soname,'$cf_cv_shared_soname',-stats -o $[@]'
+		#MK_SHARED_LIB='${DLLTOOL} --export-all-symbols --output-exp --output-lib $[@]'
+		cat >mk_shared_lib.sh <<-CF_EOF
+		#!/bin/sh
+		SHARED_LIB=\[$]1
+		IMPORT_LIB=\`echo "\[$]1" | sed -e 's/[[0-9]]*\.dll[$]/.dll.a/'\`
+		shift
+		cat <<-EOF
+		Linking shared library
+		** SHARED_LIB \[$]SHARED_LIB
+		** IMPORT_LIB \[$]IMPORT_LIB
+EOF
+		exec \[$]* -shared -Wl,--out-implib=../lib/\[$]{IMPORT_LIB} -Wl,--export-all-symbols -o ../lib/\[$]{SHARED_LIB}
+CF_EOF
+		chmod +x mk_shared_lib.sh
+		;;
+	openbsd[[2-9]].*|mirbsd*) #(vi
 		if test "$DFT_LWR_MODEL" = "shared" ; then
 			LOCAL_LDFLAGS="${LD_RPATH_OPT}\$(LOCAL_LIBDIR)"
 			LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
 		fi
 		if test "$cf_cv_enable_rpath" = yes ; then
-			EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${libdir} $EXTRA_LDFLAGS"
+			EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${RPATH_LIST} $EXTRA_LDFLAGS"
 		fi
 		CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC"
 		CF_SHARED_SONAME
@@ -5156,12 +5551,12 @@
 		MK_SHARED_LIB='${LD} -Bshareable -o $[@]'
 		test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel
 		;;
-	freebsd*) #(vi
+	dragonfly*|freebsd*) #(vi
 		CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC"
 		if test "$DFT_LWR_MODEL" = "shared" && test "$cf_cv_enable_rpath" = yes ; then
 			LOCAL_LDFLAGS="${cf_ld_rpath_opt}\$(LOCAL_LIBDIR)"
-			LOCAL_LDFLAGS2="${cf_ld_rpath_opt}\${libdir} $LOCAL_LDFLAGS"
-			EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${libdir} $EXTRA_LDFLAGS"
+			LOCAL_LDFLAGS2="${cf_ld_rpath_opt}\${RPATH_LIST} $LOCAL_LDFLAGS"
+			EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${RPATH_LIST} $EXTRA_LDFLAGS"
 		fi
 		CF_SHARED_SONAME
 		MK_SHARED_LIB='${LD} -shared -Bshareable -soname=`basename $[@]` -o $[@]'
@@ -5171,7 +5566,7 @@
 		if test "$DFT_LWR_MODEL" = "shared" && test "$cf_cv_enable_rpath" = yes ; then
 			LOCAL_LDFLAGS="${cf_ld_rpath_opt}\$(LOCAL_LIBDIR)"
 			LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
-			EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${libdir} $EXTRA_LDFLAGS"
+			EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${RPATH_LIST} $EXTRA_LDFLAGS"
 			if test "$cf_cv_shlib_version" = auto; then
 			if test -f /usr/libexec/ld.elf_so; then
 				cf_cv_shlib_version=abi
@@ -5276,10 +5671,40 @@
 		;;
 	esac
 
-	if test -n "$cf_ld_rpath_opt" ; then
-		MK_SHARED_LIB="$MK_SHARED_LIB $cf_ld_rpath_opt\${libdir}"
+	if test -n "$cf_try_cflags"
+	then
+cat > conftest.$ac_ext <<EOF
+#line __oline__ "${as_me:-configure}"
+#include <stdio.h>
+int main(int argc, char *argv[[]])
+{
+	printf("hello\n");
+	return (argv[[argc-1]] == 0) ;
+}
+EOF
+		cf_save_CFLAGS="$CFLAGS"
+		for cf_opt in $cf_try_cflags
+		do
+			CFLAGS="$cf_save_CFLAGS -$cf_opt"
+			AC_MSG_CHECKING(if CFLAGS option -$cf_opt works)
+			if AC_TRY_EVAL(ac_compile); then
+				AC_MSG_RESULT(yes)
+				cf_save_CFLAGS="$CFLAGS"
+			else
+				AC_MSG_RESULT(no)
+			fi
+		done
+		CFLAGS="$cf_save_CFLAGS"
 	fi
 
+
+	# RPATH_LIST is a colon-separated list of directories
+	test -n "$cf_ld_rpath_opt" && MK_SHARED_LIB="$MK_SHARED_LIB $cf_ld_rpath_opt\${RPATH_LIST}"
+	test -z "$RPATH_LIST" && RPATH_LIST="\${libdir}"
+
+	CF_VERBOSE(CC_SHARED_OPTS: $CC_SHARED_OPTS)
+	CF_VERBOSE(MK_SHARED_LIB:  $MK_SHARED_LIB)
+
 	AC_SUBST(CC_SHARED_OPTS)
 	AC_SUBST(LD_RPATH_OPT)
 	AC_SUBST(LD_SHARED_OPTS)
@@ -5290,6 +5715,7 @@
 	AC_SUBST(LOCAL_LDFLAGS)
 	AC_SUBST(LOCAL_LDFLAGS2)
 	AC_SUBST(INSTALL_LIB)
+	AC_SUBST(RPATH_LIST)
 ])dnl
 dnl ---------------------------------------------------------------------------
 dnl CF_SHARED_SONAME version: 3 updated: 2008/09/08 18:34:43
@@ -5369,7 +5795,7 @@
 fi
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_SIG_ATOMIC_T version: 2 updated: 2005/09/18 17:27:12
+dnl CF_SIG_ATOMIC_T version: 3 updated: 2012/10/04 20:12:20
 dnl ---------------
 dnl signal handler, but there are some gcc depedencies in that recommendation.
 dnl Try anyway.
@@ -5401,10 +5827,10 @@
 	done
 	])
 AC_MSG_RESULT($cf_cv_sig_atomic_t)
-test "$cf_cv_sig_atomic_t" != no && AC_DEFINE_UNQUOTED(SIG_ATOMIC_T, $cf_cv_sig_atomic_t)
+test "$cf_cv_sig_atomic_t" != no && AC_DEFINE_UNQUOTED(SIG_ATOMIC_T, $cf_cv_sig_atomic_t,[Define to signal global datatype])
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_SIZECHANGE version: 8 updated: 2000/11/04 12:22:16
+dnl CF_SIZECHANGE version: 9 updated: 2012/10/06 11:17:15
 dnl -------------
 dnl Check for definitions & structures needed for window size-changing
 dnl FIXME: check that this works with "snake" (HP-UX 10.x)
@@ -5465,7 +5891,7 @@
 done
 ])
 if test "$cf_cv_sizechange" != no ; then
-	AC_DEFINE(HAVE_SIZECHANGE)
+	AC_DEFINE(HAVE_SIZECHANGE,1,[Define to 1 if sizechar declarations are provided])
 	case $cf_cv_sizechange in #(vi
 	NEED*)
 		AC_DEFINE_UNQUOTED($cf_cv_sizechange )
@@ -5474,7 +5900,7 @@
 fi
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_SRC_MODULES version: 21 updated: 2010/09/04 17:37:40
+dnl CF_SRC_MODULES version: 26 updated: 2012/01/07 15:08:24
 dnl --------------
 dnl For each parameter, test if the source-directory exists, and if it contains
 dnl a 'modules' file.  If so, add to the list $cf_cv_src_modules which we'll
@@ -5497,6 +5923,7 @@
 	TEST_ARG2="-l${LIB_NAME}${DFT_ARG_SUFFIX} $TEST_ARG2"
 fi
 
+PC_MODULES_TO_MAKE="ncurses${DFT_ARG_SUFFIX}"
 cf_cv_src_modules=
 for cf_dir in $1
 do
@@ -5535,6 +5962,7 @@
 				TEST_ARGS="-l${cf_dir}${DFT_ARG_SUFFIX} $TEST_ARGS"
 				TEST_ARG2="-l${cf_dir}${DFT_ARG_SUFFIX} $TEST_ARG2"
 			fi
+			PC_MODULES_TO_MAKE="${PC_MODULES_TO_MAKE} ${cf_dir}${DFT_ARG_SUFFIX}"
 		fi
 	fi
 done
@@ -5562,10 +5990,18 @@
 	SRC_SUBDIRS="$SRC_SUBDIRS test"
 fi
 test -z "$MAKE_TERMINFO" && SRC_SUBDIRS="$SRC_SUBDIRS misc"
-test "$cf_with_cxx_binding" != no && SRC_SUBDIRS="$SRC_SUBDIRS c++"
+if test "$cf_with_cxx_binding" != no; then
+	PC_MODULES_TO_MAKE="${PC_MODULES_TO_MAKE} ncurses++${DFT_ARG_SUFFIX}"
+	SRC_SUBDIRS="$SRC_SUBDIRS c++"
+fi
+
+test "x$with_termlib" != xno && PC_MODULES_TO_MAKE="$PC_MODULES_TO_MAKE $TINFO_ARG_SUFFIX"
+test "x$with_ticlib" != xno && PC_MODULES_TO_MAKE="$PC_MODULES_TO_MAKE $TICS_ARG_SUFFIX"
+
+AC_SUBST(PC_MODULES_TO_MAKE)
 
 ADA_SUBDIRS=
-if test "$cf_cv_prog_gnat_correct" = yes && test -f $srcdir/Ada95/Makefile.in; then
+if test "x$cf_with_ada" = "xyes" && test "x$cf_cv_prog_gnat_correct" = xyes && test -f $srcdir/Ada95/Makefile.in; then
 	SRC_SUBDIRS="$SRC_SUBDIRS Ada95"
 	ADA_SUBDIRS="gen src"
 	if test "x$cf_with_tests" != "xno" ; then
@@ -5624,13 +6060,13 @@
 AC_DEFUN([CF_STRIP_G_OPT],
 [$1=`echo ${$1} | sed -e 's%-g %%' -e 's%-g$%%'`])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_STRUCT_SIGACTION version: 3 updated: 2000/08/12 23:18:52
+dnl CF_STRUCT_SIGACTION version: 5 updated: 2012/10/06 17:56:13
 dnl -------------------
 dnl Check if we need _POSIX_SOURCE defined to use struct sigaction.  We'll only
 dnl do this if we've found the sigaction function.
-dnl
-dnl If needed, define SVR4_ACTION.
 AC_DEFUN([CF_STRUCT_SIGACTION],[
+AC_REQUIRE([CF_XOPEN_SOURCE])
+
 if test "$ac_cv_func_sigaction" = yes; then
 AC_MSG_CHECKING(whether sigaction needs _POSIX_SOURCE)
 AC_TRY_COMPILE([
@@ -5645,22 +6081,24 @@
 #include <signal.h>],
 	[struct sigaction act],
 	[sigact_bad=yes
-	 AC_DEFINE(SVR4_ACTION)],
+	 AC_DEFINE(_POSIX_SOURCE,1,[Define to 1 if we must define _POSIX_SOURCE])],
 	 [sigact_bad=unknown])])
 AC_MSG_RESULT($sigact_bad)
 fi
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_STRUCT_TERMIOS version: 5 updated: 2000/11/04 12:22:46
+dnl CF_STRUCT_TERMIOS version: 7 updated: 2012/10/06 17:56:13
 dnl -----------------
 dnl Some machines require _POSIX_SOURCE to completely define struct termios.
-dnl If so, define SVR4_TERMIO
 AC_DEFUN([CF_STRUCT_TERMIOS],[
+AC_REQUIRE([CF_XOPEN_SOURCE])
+
 AC_CHECK_HEADERS( \
 termio.h \
 termios.h \
 unistd.h \
 )
+
 if test "$ISC" = yes ; then
 	AC_CHECK_HEADERS( sys/termio.h )
 fi
@@ -5680,7 +6118,7 @@
 #include <termios.h>],
 			[struct termios foo; int x = foo.c_iflag],
 			termios_bad=unknown,
-			termios_bad=yes AC_DEFINE(SVR4_TERMIO))
+			termios_bad=yes AC_DEFINE(_POSIX_SOURCE,1,[Define to 1 if we must define _POSIX_SOURCE]))
 			])
 	AC_MSG_RESULT($termios_bad)
 	fi
@@ -5704,23 +6142,6 @@
 CF_ADD_SUBDIR_PATH($1,$2,$3,[$]HOME,$prefix)
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_SUBST version: 4 updated: 2006/06/17 12:33:03
-dnl --------
-dnl	Shorthand macro for substituting things that the user may override
-dnl	with an environment variable.
-dnl
-dnl	$1 = long/descriptive name
-dnl	$2 = environment variable
-dnl	$3 = default value
-AC_DEFUN([CF_SUBST],
-[AC_CACHE_VAL(cf_cv_subst_$2,[
-AC_MSG_CHECKING(for $1 (symbol $2))
-CF_SUBST_IF([-z "[$]$2"], [$2], [$3])
-cf_cv_subst_$2=[$]$2
-AC_MSG_RESULT([$]$2)
-])
-])dnl
-dnl ---------------------------------------------------------------------------
 dnl CF_SUBST_IF version: 2 updated: 2006/06/17 12:33:03
 dnl -----------
 dnl	Shorthand macro for substituting things that the user may override
@@ -5766,7 +6187,7 @@
 AC_SUBST(cf_cv_type_of_bool)dnl
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_SYS_TIME_SELECT version: 4 updated: 2000/10/04 09:18:40
+dnl CF_SYS_TIME_SELECT version: 5 updated: 2012/10/04 05:24:07
 dnl ------------------
 dnl Check if we can include <sys/time.h> with <sys/select.h>; this breaks on
 dnl older SCO configurations.
@@ -5786,7 +6207,7 @@
      [cf_cv_sys_time_select=no])
      ])
 AC_MSG_RESULT($cf_cv_sys_time_select)
-test "$cf_cv_sys_time_select" = yes && AC_DEFINE(HAVE_SYS_TIME_SELECT)
+test "$cf_cv_sys_time_select" = yes && AC_DEFINE(HAVE_SYS_TIME_SELECT,1,[Define to 1 if we can include <sys/time.h> with <sys/select.h>])
 ])dnl
 dnl ---------------------------------------------------------------------------
 dnl CF_TOP_BUILDDIR version: 1 updated: 2006/10/15 16:33:23
@@ -5798,7 +6219,46 @@
 AC_SUBST(top_builddir)
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_TYPEOF_CHTYPE version: 8 updated: 2006/12/16 12:33:30
+dnl CF_TRY_XOPEN_SOURCE version: 1 updated: 2011/10/30 17:09:50
+dnl -------------------
+dnl If _XOPEN_SOURCE is not defined in the compile environment, check if we
+dnl can define it successfully.
+AC_DEFUN([CF_TRY_XOPEN_SOURCE],[
+AC_CACHE_CHECK(if we should define _XOPEN_SOURCE,cf_cv_xopen_source,[
+	AC_TRY_COMPILE([
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+],[
+#ifndef _XOPEN_SOURCE
+make an error
+#endif],
+	[cf_cv_xopen_source=no],
+	[cf_save="$CPPFLAGS"
+	 CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE"
+	 AC_TRY_COMPILE([
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+],[
+#ifdef _XOPEN_SOURCE
+make an error
+#endif],
+	[cf_cv_xopen_source=no],
+	[cf_cv_xopen_source=$cf_XOPEN_SOURCE])
+	CPPFLAGS="$cf_save"
+	])
+])
+
+if test "$cf_cv_xopen_source" != no ; then
+	CF_REMOVE_DEFINE(CFLAGS,$CFLAGS,_XOPEN_SOURCE)
+	CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,_XOPEN_SOURCE)
+	cf_temp_xopen_source="-D_XOPEN_SOURCE=$cf_cv_xopen_source"
+	CF_ADD_CFLAGS($cf_temp_xopen_source)
+fi
+])
+dnl ---------------------------------------------------------------------------
+dnl CF_TYPEOF_CHTYPE version: 9 updated: 2012/10/06 17:56:13
 dnl ----------------
 dnl Determine the type we should use for chtype (and attr_t, which is treated
 dnl as the same thing).  We want around 32 bits, so on most machines want a
@@ -5847,10 +6307,10 @@
 AC_MSG_RESULT($cf_cv_typeof_chtype)
 
 AC_SUBST(cf_cv_typeof_chtype)
-AC_DEFINE_UNQUOTED(TYPEOF_CHTYPE,$cf_cv_typeof_chtype)
+AC_DEFINE_UNQUOTED(TYPEOF_CHTYPE,$cf_cv_typeof_chtype,[Define to actual type if needed for chtype])
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_TYPE_SIGACTION version: 3 updated: 2000/08/12 23:18:52
+dnl CF_TYPE_SIGACTION version: 4 updated: 2012/10/06 17:56:13
 dnl -----------------
 dnl
 AC_DEFUN([CF_TYPE_SIGACTION],
@@ -5863,7 +6323,7 @@
 		[cf_cv_type_sigaction=yes],
 		[cf_cv_type_sigaction=no])])
 AC_MSG_RESULT($cf_cv_type_sigaction)
-test "$cf_cv_type_sigaction" = yes && AC_DEFINE(HAVE_TYPE_SIGACTION)
+test "$cf_cv_type_sigaction" = yes && AC_DEFINE(HAVE_TYPE_SIGACTION,1,[Define to 1 if we have the sigaction_t type])
 ])dnl
 dnl ---------------------------------------------------------------------------
 dnl CF_UNSIGNED_LITERALS version: 2 updated: 1998/02/07 22:10:16
@@ -5890,7 +6350,7 @@
 $1=`echo "$2" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_UTF8_LIB version: 7 updated: 2010/06/20 09:24:28
+dnl CF_UTF8_LIB version: 8 updated: 2012/10/06 08:57:51
 dnl -----------
 dnl Check for multibyte support, and if not found, utf8 compatibility library
 AC_DEFUN([CF_UTF8_LIB],
@@ -5909,14 +6369,14 @@
 # HAVE_LIBUTF8_H is used by ncurses if curses.h is shared between
 # ncurses/ncursesw:
 if test "$cf_cv_utf8_lib" = "add-on" ; then
-	AC_DEFINE(HAVE_LIBUTF8_H)
+	AC_DEFINE(HAVE_LIBUTF8_H,1,[Define to 1 if we should include libutf8.h])
 	CF_ADD_INCDIR($cf_cv_header_path_utf8)
 	CF_ADD_LIBDIR($cf_cv_library_path_utf8)
 	CF_ADD_LIBS($cf_cv_library_file_utf8)
 fi
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_VA_COPY version: 2 updated: 2010/03/04 05:37:29
+dnl CF_VA_COPY version: 3 updated: 2012/10/06 11:17:15
 dnl ----------
 dnl check for va_copy, part of stdarg.h
 dnl Also, workaround for glibc's __va_copy, by checking for both.
@@ -5931,7 +6391,7 @@
 	cf_cv_have_va_copy=yes,
 	cf_cv_have_va_copy=no)])
 
-test "$cf_cv_have_va_copy" = yes && AC_DEFINE(HAVE_VA_COPY)
+test "$cf_cv_have_va_copy" = yes && AC_DEFINE(HAVE_VA_COPY,1,[Define to 1 if we have va_copy])
 
 AC_CACHE_CHECK(for __va_copy, cf_cv_have___va_copy,[
 AC_TRY_LINK([
@@ -5943,7 +6403,7 @@
 	cf_cv_have___va_copy=yes,
 	cf_cv_have___va_copy=no)])
 
-test "$cf_cv_have___va_copy" = yes && AC_DEFINE(HAVE___VA_COPY)
+test "$cf_cv_have___va_copy" = yes && AC_DEFINE(HAVE___VA_COPY,1,[Define to 1 if we have __va_copy])
 ])
 dnl ---------------------------------------------------------------------------
 dnl CF_VERBOSE version: 3 updated: 2007/07/29 09:55:12
@@ -5954,7 +6414,7 @@
 CF_MSG_LOG([$1])
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_WCHAR_TYPE version: 3 updated: 2010/05/26 16:44:57
+dnl CF_WCHAR_TYPE version: 4 updated: 2012/10/06 16:39:58
 dnl -------------
 dnl Check if type wide-character type $1 is declared, and if so, which header
 dnl file is needed.  The second parameter is used to set a shell variable when
@@ -5986,7 +6446,7 @@
 	[cf_cv_$1=unknown])])])
 
 if test "$cf_cv_$1" = yes ; then
-	AC_DEFINE(NEED_WCHAR_H)
+	AC_DEFINE(NEED_WCHAR_H,1,[Define to 1 if we must include wchar.h])
 	NEED_WCHAR_H=1
 fi
 
@@ -6149,7 +6609,7 @@
 fi
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_WITH_GPM version: 7 updated: 2008/03/23 14:48:54
+dnl CF_WITH_GPM version: 8 updated: 2012/10/06 17:56:13
 dnl -----------
 dnl
 dnl The option parameter (if neither yes/no) is assumed to be the name of
@@ -6165,10 +6625,10 @@
 
 if test "$with_gpm" != no ; then
 	AC_CHECK_HEADER(gpm.h,[
-		AC_DEFINE(HAVE_GPM_H)
+		AC_DEFINE(HAVE_GPM_H,1,[Define to 1 if we have gpm.h header])
 		if test "$with_gpm" != yes && test "$with_gpm" != maybe ; then
 			CF_VERBOSE(assuming we really have GPM library)
-			AC_DEFINE(HAVE_LIBGPM)
+			AC_DEFINE(HAVE_LIBGPM,1,[Define to 1 if we have the gpm library])
 		else
 			AC_CHECK_LIB(gpm,Gpm_Open,[:],[
 				AC_MSG_ERROR(Cannot link with GPM library)
@@ -6182,7 +6642,7 @@
 fi
 ])
 dnl ---------------------------------------------------------------------------
-dnl CF_WITH_LIBTOOL version: 26 updated: 2010/10/23 15:55:24
+dnl CF_WITH_LIBTOOL version: 29 updated: 2013/04/06 18:03:09
 dnl ---------------
 dnl Provide a configure option to incorporate libtool.  Define several useful
 dnl symbols for the makefile rules.
@@ -6252,13 +6712,20 @@
 		CF_PATH_SYNTAX(with_libtool)
 		LIBTOOL=$with_libtool
 	else
-		AC_PATH_PROG(LIBTOOL,libtool)
+		AC_CHECK_TOOLS(LIBTOOL,[libtool glibtool],none)
+		CF_LIBTOOL_VERSION
+		if test -z "$cf_cv_libtool_version" && test "$LIBTOOL" = libtool
+		then
+			CF_FORGET_TOOL(LIBTOOL)
+			AC_CHECK_TOOLS(LIBTOOL,[glibtool],none)
+			CF_LIBTOOL_VERSION
+		fi
 	fi
 	if test -z "$LIBTOOL" ; then
 		AC_MSG_ERROR(Cannot find libtool)
 	fi
 ])dnl
-	LIB_CREATE='${LIBTOOL} --mode=link ${CC} -rpath ${DESTDIR}${libdir} ${LIBTOOL_VERSION} `cut -f1 ${srcdir}/VERSION` ${LIBTOOL_OPTS} ${LT_UNDEF} -o'
+	LIB_CREATE='${LIBTOOL} --mode=link ${CC} -rpath ${DESTDIR}${libdir} ${LIBTOOL_VERSION} `cut -f1 ${srcdir}/VERSION` ${LIBTOOL_OPTS} ${LT_UNDEF} $(LIBS) -o'
 	LIB_OBJECT='${OBJECTS:.o=.lo}'
 	LIB_SUFFIX=.la
 	LIB_CLEAN='${LIBTOOL} --mode=clean'
@@ -6268,22 +6735,12 @@
 	LIB_UNINSTALL='${LIBTOOL} --mode=uninstall'
 	LIB_PREP=:
 
-	# Show the version of libtool
-	AC_MSG_CHECKING(version of libtool)
-
-	# Save the version in a cache variable - this is not entirely a good
-	# thing, but the version string from libtool is very ugly, and for
-	# bug reports it might be useful to have the original string. "("
-	cf_cv_libtool_version=`$LIBTOOL --version 2>&1 | sed -e '/^$/d' |sed -e '2,$d' -e 's/([[^)]]*)//g' -e 's/^[[^1-9]]*//' -e 's/[[^0-9.]].*//'`
-	AC_MSG_RESULT($cf_cv_libtool_version)
-	if test -z "$cf_cv_libtool_version" ; then
-		AC_MSG_ERROR(This is not GNU libtool)
-	fi
+	CF_CHECK_LIBTOOL_VERSION
 
 	# special hack to add -no-undefined (which libtool should do for itself)
 	LT_UNDEF=
 	case "$cf_cv_system_name" in #(vi
-	cygwin*|mingw32*|uwin*|aix[[456]]) #(vi
+	cygwin*|mingw32*|uwin*|aix[[4-7]]) #(vi
 		LT_UNDEF=-no-undefined
 		;;
 	esac
@@ -6323,7 +6780,33 @@
 
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_WITH_PATH version: 10 updated: 2010/10/23 15:44:18
+dnl CF_WITH_LIB_PREFIX version: 1 updated: 2012/01/21 19:28:10
+dnl ------------------
+dnl Allow the library-prefix to be overridden.  OS/2 EMX originally had no
+dnl "lib" prefix, e.g., because it used the dll naming convention.
+dnl
+dnl $1 = variable to set
+AC_DEFUN([CF_WITH_LIB_PREFIX],
+[
+AC_MSG_CHECKING(if you want to have a library-prefix)
+AC_ARG_WITH(lib-prefix,
+	[  --with-lib-prefix       override library-prefix],
+	[with_lib_prefix=$withval],
+	[with_lib_prefix=auto])
+AC_MSG_RESULT($with_lib_prefix)
+
+if test $with_lib_prefix = auto
+then
+	CF_LIB_PREFIX($1)
+elif test $with_lib_prefix = no
+then
+	LIB_PREFIX=
+else
+	LIB_PREFIX=$with_lib_prefix
+fi
+])dnl
+dnl ---------------------------------------------------------------------------
+dnl CF_WITH_PATH version: 11 updated: 2012/09/29 15:04:19
 dnl ------------
 dnl Wrapper for AC_ARG_WITH to ensure that user supplies a pathname, not just
 dnl defaulting to yes/no.
@@ -6340,11 +6823,11 @@
 if ifelse([$5],,true,[test -n "$5"]) ; then
 CF_PATH_SYNTAX(withval)
 fi
-$3="$withval"
+eval $3="$withval"
 AC_SUBST($3)dnl
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_WITH_PATHLIST version: 7 updated: 2010/10/23 16:10:30
+dnl CF_WITH_PATHLIST version: 9 updated: 2012/10/18 05:05:24
 dnl ----------------
 dnl Process an option specifying a list of colon-separated paths.
 dnl
@@ -6365,7 +6848,7 @@
 for cf_src_path in $withval
 do
   CF_PATH_SYNTAX(cf_src_path)
-  test -n "$cf_dst_path" && cf_dst_path="${cf_dst_path}:"
+  test -n "$cf_dst_path" && cf_dst_path="${cf_dst_path}$PATH_SEPARATOR"
   cf_dst_path="${cf_dst_path}${cf_src_path}"
 done
 IFS="$ac_save_ifs"
@@ -6381,12 +6864,65 @@
 cf_dst_path=`echo "$cf_dst_path" | sed -e 's/\\\\/\\\\\\\\/g'`
 ])
 
-eval '$3="$cf_dst_path"'
+# This may use the prefix/exec_prefix symbols which will only yield "NONE"
+# so we have to check/work around.  We do prefer the result of "eval"...
+eval cf_dst_eval="$cf_dst_path"
+case "x$cf_dst_eval" in #(vi
+xNONE*) #(vi
+	$3=$cf_dst_path
+	;;
+*)
+	$3="$cf_dst_eval"
+	;;
+esac
 AC_SUBST($3)dnl
 
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_WITH_PTHREAD version: 3 updated: 2010/05/29 16:31:02
+dnl CF_WITH_PKG_CONFIG_LIBDIR version: 2 updated: 2011/12/10 18:58:47
+dnl -------------------------
+dnl Allow the choice of the pkg-config library directory to be overridden.
+AC_DEFUN([CF_WITH_PKG_CONFIG_LIBDIR],[
+if test "$PKG_CONFIG" != none ; then
+	AC_MSG_CHECKING(for $PKG_CONFIG library directory)
+	AC_ARG_WITH(pkg-config-libdir,
+		[  --with-pkg-config-libdir=XXX use given directory for installing pc-files],
+		[PKG_CONFIG_LIBDIR=$withval],
+		[PKG_CONFIG_LIBDIR=yes])
+
+	case x$PKG_CONFIG_LIBDIR in #(vi
+	x/*) #(vi
+		;;
+	xyes) #(vi
+		# look for the library directory using the same prefix as the executable
+		cf_path=`echo "$PKG_CONFIG" | sed -e 's,/[[^/]]*/[[^/]]*$,,'`
+		case x`(arch) 2>/dev/null` in #(vi
+		*64) #(vi
+			for cf_config in $cf_path/share $cf_path/lib64 $cf_path/lib32 $cf_path/lib
+			do
+				if test -d $cf_config/pkgconfig
+				then
+					PKG_CONFIG_LIBDIR=$cf_config/pkgconfig
+					break
+				fi
+			done
+			;;
+		*)
+			PKG_CONFIG_LIBDIR=$cf_path/lib/pkgconfig
+			;;
+		esac
+		;;
+	*)
+		;;
+	esac
+
+	AC_MSG_RESULT($PKG_CONFIG_LIBDIR)
+fi
+
+AC_SUBST(PKG_CONFIG_LIBDIR)
+])dnl
+dnl ---------------------------------------------------------------------------
+dnl CF_WITH_PTHREAD version: 6 updated: 2012/10/06 17:41:51
 dnl ---------------
 dnl Check for POSIX thread library.
 AC_DEFUN([CF_WITH_PTHREAD],
@@ -6400,25 +6936,30 @@
 
 if test "$with_pthread" != no ; then
     AC_CHECK_HEADER(pthread.h,[
-        AC_DEFINE(HAVE_PTHREADS_H)
+        AC_DEFINE(HAVE_PTHREADS_H,1,[Define to 1 if we have pthreads.h header])
 
-        AC_MSG_CHECKING(if we can link with the pthread library)
-        cf_save_LIBS="$LIBS"
-        CF_ADD_LIB(pthread)
-        AC_TRY_LINK([
+	for cf_lib_pthread in pthread c_r
+	do
+	    AC_MSG_CHECKING(if we can link with the $cf_lib_pthread library)
+	    cf_save_LIBS="$LIBS"
+	    CF_ADD_LIB($cf_lib_pthread)
+	    AC_TRY_LINK([
 #include <pthread.h>
 ],[
-        int rc = pthread_create(0,0,0,0);
+		int rc = pthread_create(0,0,0,0);
+		int r2 = pthread_mutexattr_settype(0, 0);
 ],[with_pthread=yes],[with_pthread=no])
-        LIBS="$cf_save_LIBS"
-        AC_MSG_RESULT($with_pthread)
+	    LIBS="$cf_save_LIBS"
+	    AC_MSG_RESULT($with_pthread)
+	    test "$with_pthread" = yes && break
+	done
 
-        if test "$with_pthread" = yes ; then
-            CF_ADD_LIB(pthread)
-            AC_DEFINE(HAVE_LIBPTHREADS)
-        else
-            AC_MSG_ERROR(Cannot link with pthread library)
-        fi
+	if test "$with_pthread" = yes ; then
+	    CF_ADD_LIB($cf_lib_pthread)
+	    AC_DEFINE(HAVE_LIBPTHREADS,1,[Define to 1 if we have pthreads library])
+	else
+	    AC_MSG_ERROR(Cannot link with pthread library)
+	fi
     ])
 fi
 ])
@@ -6448,7 +6989,7 @@
 ])
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_WITH_SYSMOUSE version: 2 updated: 2003/03/22 19:13:43
+dnl CF_WITH_SYSMOUSE version: 3 updated: 2012/10/06 17:56:13
 dnl ----------------
 dnl If we can compile with sysmouse, make it available unless it is not wanted.
 AC_DEFUN([CF_WITH_SYSMOUSE],[
@@ -6474,10 +7015,30 @@
 ],[cf_with_sysmouse=yes],[cf_with_sysmouse=no])
 	fi
 AC_MSG_RESULT($cf_with_sysmouse)
-test "$cf_with_sysmouse" = yes && AC_DEFINE(USE_SYSMOUSE)
+test "$cf_with_sysmouse" = yes && AC_DEFINE(USE_SYSMOUSE,1,[Define to 1 if we can/should use the sysmouse interface])
 fi
 ])dnl
 dnl ---------------------------------------------------------------------------
+dnl CF_WITH_SYSTYPE version: 1 updated: 2013/01/26 16:26:12
+dnl ---------------
+dnl For testing, override the derived host system-type which is used to decide
+dnl things such as the linker commands used to build shared libraries.  This is
+dnl normally chosen automatically based on the type of system which you are
+dnl building on.  We use it for testing the configure script.
+dnl
+dnl This is different from the --host option: it is used only for testing parts
+dnl of the configure script which would not be reachable with --host since that
+dnl relies on the build environment being real, rather than mocked up.
+AC_DEFUN([CF_WITH_SYSTYPE],[
+CF_CHECK_CACHE([AC_CANONICAL_SYSTEM])
+AC_ARG_WITH(system-type,
+	[  --with-system-type=XXX  test: override derived host system-type],
+[AC_MSG_WARN(overriding system type to $withval)
+	cf_cv_system_name=$withval
+	host_os=$withval
+])
+])dnl
+dnl ---------------------------------------------------------------------------
 dnl CF_WITH_VALGRIND version: 1 updated: 2006/12/14 18:00:21
 dnl ----------------
 AC_DEFUN([CF_WITH_VALGRIND],[
@@ -6486,7 +7047,7 @@
 	[USE_VALGRIND])
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_XOPEN_SOURCE version: 35 updated: 2011/02/20 20:37:37
+dnl CF_XOPEN_SOURCE version: 43 updated: 2013/02/10 10:41:05
 dnl ---------------
 dnl Try to get _XOPEN_SOURCE defined properly that we can use POSIX functions,
 dnl or adapt to the vendor's definitions to get equivalent functionality,
@@ -6496,13 +7057,14 @@
 dnl	$1 is the nominal value for _XOPEN_SOURCE
 dnl	$2 is the nominal value for _POSIX_C_SOURCE
 AC_DEFUN([CF_XOPEN_SOURCE],[
+AC_REQUIRE([AC_CANONICAL_HOST])
 
 cf_XOPEN_SOURCE=ifelse([$1],,500,[$1])
 cf_POSIX_C_SOURCE=ifelse([$2],,199506L,[$2])
 cf_xopen_source=
 
 case $host_os in #(vi
-aix[[456]]*) #(vi
+aix[[4-7]]*) #(vi
 	cf_xopen_source="-D_ALL_SOURCE"
 	;;
 cygwin) #(vi
@@ -6513,6 +7075,7 @@
 	;;
 darwin*) #(vi
 	cf_xopen_source="-D_DARWIN_C_SOURCE"
+	cf_XOPEN_SOURCE=
 	;;
 freebsd*|dragonfly*) #(vi
 	# 5.x headers associate
@@ -6530,15 +7093,23 @@
 	;;
 irix[[56]].*) #(vi
 	cf_xopen_source="-D_SGI_SOURCE"
+	cf_XOPEN_SOURCE=
 	;;
 linux*|gnu*|mint*|k*bsd*-gnu) #(vi
 	CF_GNU_SOURCE
 	;;
 mirbsd*) #(vi
-	# setting _XOPEN_SOURCE or _POSIX_SOURCE breaks <arpa/inet.h>
+	# setting _XOPEN_SOURCE or _POSIX_SOURCE breaks <sys/select.h> and other headers which use u_int / u_short types
+	cf_XOPEN_SOURCE=
+	CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE)
 	;;
 netbsd*) #(vi
-	# setting _XOPEN_SOURCE breaks IPv6 for lynx on NetBSD 1.6, breaks xterm, is not needed for ncursesw
+	cf_xopen_source="-D_NETBSD_SOURCE" # setting _XOPEN_SOURCE breaks IPv6 for lynx on NetBSD 1.6, breaks xterm, is not needed for ncursesw
+	;;
+openbsd[[4-9]]*) #(vi
+	# setting _XOPEN_SOURCE lower than 500 breaks g++ compile with wchar.h, needed for ncursesw
+	cf_xopen_source="-D_BSD_SOURCE"
+	cf_XOPEN_SOURCE=600
 	;;
 openbsd*) #(vi
 	# setting _XOPEN_SOURCE breaks xterm on OpenBSD 2.8, is not needed for ncursesw
@@ -6552,36 +7123,11 @@
 sco*) #(vi
 	# setting _XOPEN_SOURCE breaks Lynx on SCO Unix / OpenServer
 	;;
-solaris2.1[[0-9]]) #(vi
-	cf_xopen_source="-D__EXTENSIONS__ -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE"
-	;;
-solaris2.[[1-9]]) #(vi
+solaris2.*) #(vi
 	cf_xopen_source="-D__EXTENSIONS__"
 	;;
 *)
-	AC_CACHE_CHECK(if we should define _XOPEN_SOURCE,cf_cv_xopen_source,[
-	AC_TRY_COMPILE([#include <sys/types.h>],[
-#ifndef _XOPEN_SOURCE
-make an error
-#endif],
-	[cf_cv_xopen_source=no],
-	[cf_save="$CPPFLAGS"
-	 CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE"
-	 AC_TRY_COMPILE([#include <sys/types.h>],[
-#ifdef _XOPEN_SOURCE
-make an error
-#endif],
-	[cf_cv_xopen_source=no],
-	[cf_cv_xopen_source=$cf_XOPEN_SOURCE])
-	CPPFLAGS="$cf_save"
-	])
-])
-	if test "$cf_cv_xopen_source" != no ; then
-		CF_REMOVE_DEFINE(CFLAGS,$CFLAGS,_XOPEN_SOURCE)
-		CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,_XOPEN_SOURCE)
-		cf_temp_xopen_source="-D_XOPEN_SOURCE=$cf_cv_xopen_source"
-		CF_ADD_CFLAGS($cf_temp_xopen_source)
-	fi
+	CF_TRY_XOPEN_SOURCE
 	CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE)
 	;;
 esac
@@ -6589,4 +7135,33 @@
 if test -n "$cf_xopen_source" ; then
 	CF_ADD_CFLAGS($cf_xopen_source)
 fi
+
+dnl In anything but the default case, we may have system-specific setting
+dnl which is still not guaranteed to provide all of the entrypoints that
+dnl _XOPEN_SOURCE would yield.
+if test -n "$cf_XOPEN_SOURCE" && test -z "$cf_cv_xopen_source" ; then
+	AC_MSG_CHECKING(if _XOPEN_SOURCE really is set)
+	AC_TRY_COMPILE([#include <stdlib.h>],[
+#ifndef _XOPEN_SOURCE
+make an error
+#endif],
+	[cf_XOPEN_SOURCE_set=yes],
+	[cf_XOPEN_SOURCE_set=no])
+	AC_MSG_RESULT($cf_XOPEN_SOURCE_set)
+	if test $cf_XOPEN_SOURCE_set = yes
+	then
+		AC_TRY_COMPILE([#include <stdlib.h>],[
+#if (_XOPEN_SOURCE - 0) < $cf_XOPEN_SOURCE
+make an error
+#endif],
+		[cf_XOPEN_SOURCE_set_ok=yes],
+		[cf_XOPEN_SOURCE_set_ok=no])
+		if test $cf_XOPEN_SOURCE_set_ok = no
+		then
+			AC_MSG_WARN(_XOPEN_SOURCE is lower than requested)
+		fi
+	else
+		CF_TRY_XOPEN_SOURCE
+	fi
+fi
 ])
Index: announce.html.in
Prereq:  1.85 
--- ncurses-5.9/announce.html.in	2011-04-04 00:05:34.000000000 +0000
+++ ncurses-5.9-20130504/announce.html.in	2011-09-10 18:11:12.000000000 +0000
@@ -1,6 +1,6 @@
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 <!--
-  $Id: announce.html.in,v 1.85 2011/04/04 00:05:34 tom Exp $
+  $Id: announce.html.in,v 1.86 2011/09/10 18:11:12 tom Exp $
   ****************************************************************************
   * Copyright (c) 1998-2010,2011 Free Software Foundation, Inc.              *
   *                                                                          *
@@ -77,30 +77,38 @@
   compatible from ncurses 5.0 through 5.8; very few applications
   will require recompilation, depending on the platform. These are
   the highlights from the change-log since ncurses 5.8 release.
-  <p>
-  This is a bug-fix release, correcting a small number of urgent problems
-  in the ncurses library from the 5.8 release.
-  <p>
-  It also improves the Ada95 binding:
+
+  <p>This is a bug-fix release, correcting a small number of urgent
+  problems in the ncurses library from the 5.8 release.</p>
+
+  <p>It also improves the Ada95 binding:</p>
+
   <ul>
-  <li>fixes a longstanding portability problem with its use of the
-      <a href="http://invisible-island.net/ncurses/man/form_fieldtype.3x">set_field_type</a>
-      function.  Because that function uses variable-length argument lists,
-      its interface with gnat does not work with certain platforms.
-  <li>improves configurability and portability, particularly when built
-      separately from the main ncurses tree.  The 5.8 release introduced
-      scripts which can be used to construct separate tarballs for the
-      Ada95 and ncurses examples.
-      <p>Those were a proof of concept.  For the 5.9 release, those
-      scripts are augmented with rpm- and dpkg-scripts used in test builds
-      against a variety of gnat- and system ncurses versions as old as
-      gnat 3.15 and ncurses 5.4 (see snapshots and systems tested
-      <a href="http://invisible-island.net/ncurses/ncurses-Ada95.html">here</a>.
-  <li>additional improvements were made for portability of the
-      ncurses examples, adding rpm- and dpkg-scripts for test-builds.
-      See 
-      <a href="http://invisible-island.net/ncurses/ncurses-examples.html">this page</a>
-      for snapshots and other information.
+    <li>fixes a longstanding portability problem with its use of
+    the <a href=
+    "http://invisible-island.net/ncurses/man/form_fieldtype.3x">set_field_type</a>
+    function. Because that function uses variable-length argument
+    lists, its interface with gnat does not work with certain
+    platforms.</li>
+
+    <li>improves configurability and portability, particularly when
+    built separately from the main ncurses tree. The 5.8 release
+    introduced scripts which can be used to construct separate
+    tarballs for the Ada95 and ncurses examples.
+
+      <p>Those were a proof of concept. For the 5.9 release, those
+      scripts are augmented with rpm- and dpkg-scripts used in test
+      builds against a variety of gnat- and system ncurses versions
+      as old as gnat 3.15 and ncurses 5.4 (see snapshots and
+      systems tested <a href=
+      "http://invisible-island.net/ncurses/ncurses-Ada95.html">here</a>.</p>
+    </li>
+
+    <li>additional improvements were made for portability of the
+    ncurses examples, adding rpm- and dpkg-scripts for test-builds.
+    See <a href=
+    "http://invisible-island.net/ncurses/ncurses-examples.html">this
+    page</a> for snapshots and other information.</li>
   </ul>
 
   <h1>Features of Ncurses</h1>The ncurses package is fully
@@ -364,6 +372,13 @@
   are made available at <a href=
   "ftp://invisible-island.net/ncurses/">ftp://invisible-island.net/ncurses/</a>&nbsp;.</p>
 
+  <p>There is an archive of the mailing list here:</p>
+
+  <p><a href=
+  "http://lists.gnu.org/archive/html/bug-ncurses">http://lists.gnu.org/archive/html/bug-ncurses</a>
+  (also <a href=
+  "https://lists.gnu.org/archive/html/bug-ncurses">https</a>)</p>
+
   <h2>Future Plans</h2>
 
   <ul>
Index: c++/Makefile.in
Prereq:  1.93 
--- ncurses-5.9/c++/Makefile.in	2010-11-27 21:45:27.000000000 +0000
+++ ncurses-5.9-20130504/c++/Makefile.in	2013-04-13 18:24:43.000000000 +0000
@@ -1,6 +1,6 @@
-# $Id: Makefile.in,v 1.93 2010/11/27 21:45:27 tom Exp $
+# $Id: Makefile.in,v 1.104 2013/04/13 18:24:43 tom Exp $
 ##############################################################################
-# Copyright (c) 1998-2009,2010 Free Software Foundation, Inc.                #
+# Copyright (c) 1998-2012,2013 Free Software Foundation, Inc.                #
 #                                                                            #
 # Permission is hereby granted, free of charge, to any person obtaining a    #
 # copy of this software and associated documentation files (the "Software"), #
@@ -65,6 +65,9 @@
 
 AR		= @AR@
 ARFLAGS		= @ARFLAGS@
+AWK		= @AWK@
+LD		= @LD@
+LN_S		= @LN_S@
 
 CXX_AR		= @CXX_AR@
 CXX_ARFLAGS	= @CXX_ARFLAGS@
@@ -109,35 +112,41 @@
 LIBNAME_NORMAL	= @LIB_PREFIX@$(LIBROOT)@LIB_SUFFIX@.a
 LIBNAME		= @LIB_PREFIX@$(LIBROOT)@CXX_LIB_SUFFIX@
 
-MY_LIBRARY	= ../lib/$(LIBNAME)
+LIBRARIES	= @Libs_To_Make@
 
 LINK_FLAGS	= @EXTRA_LDFLAGS@ -L../lib -l$(LIBROOT)@LIB_SUFFIX@
+RPATH_LIST	= @RPATH_LIST@
+MK_SHARED_LIB	= @MK_SHARED_LIB@
 
-LINK_LIBTOOL	= @EXTRA_LDFLAGS@ -L../lib $(MY_LIBRARY)
+LINK_LIBTOOL	= @EXTRA_LDFLAGS@ -L../lib $(LIBRARIES)
 LINK_NORMAL	= $(LINK_FLAGS)
 LINK_DEBUG	= $(LINK_FLAGS)
 LINK_PROFILE	= $(LINK_FLAGS)
 LINK_SHARED	= $(LINK_FLAGS)
 
+# flags for test-programs
 TEST_LIBS	= @TEST_LIBS@
 TEST_ARGS	= @LDFLAGS_STATIC@ @TEST_ARGS@ @LDFLAGS_SHARED@ 
-
-LDFLAGS		= $(TEST_ARGS) @LDFLAGS@ \
+TEST_LDFLAGS	= $(TEST_ARGS) @LDFLAGS@ \
 	@LD_MODEL@ $(TEST_LIBS) @LIBS@ @LOCAL_LDFLAGS@ $(CXXLIBS)
 
-LDFLAGS_LIBTOOL	= $(LDFLAGS) $(CFLAGS_LIBTOOL)
-LDFLAGS_NORMAL	= $(LDFLAGS) $(CFLAGS_NORMAL)
-LDFLAGS_DEBUG	= $(LDFLAGS) $(CFLAGS_DEBUG)
-LDFLAGS_PROFILE	= $(LDFLAGS) $(CFLAGS_PROFILE)
-LDFLAGS_SHARED	= $(LDFLAGS) $(CFLAGS_SHARED) @LD_SHARED_OPTS@
+LDFLAGS_LIBTOOL	= $(TEST_LDFLAGS) $(CFLAGS_LIBTOOL)
+LDFLAGS_NORMAL	= $(TEST_LDFLAGS) $(CFLAGS_NORMAL)
+LDFLAGS_DEBUG	= $(TEST_LDFLAGS) $(CFLAGS_DEBUG)
+LDFLAGS_PROFILE	= $(TEST_LDFLAGS) $(CFLAGS_PROFILE)
+LDFLAGS_SHARED	= $(TEST_LDFLAGS) $(CFLAGS_SHARED) @LD_SHARED_OPTS@
 
 LDFLAGS_DEFAULT	= $(LINK_@DFT_UPR_MODEL@) $(LDFLAGS_@DFT_UPR_MODEL@)
 
+# flags for library built by this makefile
+LDFLAGS		= $(TEST_ARGS) @LDFLAGS@ \
+	@LD_MODEL@ $(TEST_LIBS) @LIBS@ $(CXXLIBS)
+
 AUTO_SRC	= \
 		etip.h
 
 all \
-libs ::		$(AUTO_SRC) $(MY_LIBRARY)
+libs ::		$(AUTO_SRC) $(LIBRARIES)
 
 @MAKE_TESTS@all ::		demo$x
 
@@ -148,61 +157,16 @@
 tags:
 	$(CTAGS) *.[h] *.cc
 
-# Build a conventional library for installing, since a shared library would
-# pull in all of the ncurses libraries (panel, menu, form, ncurses) as direct
-# dependencies.
-LIB_OBJS = \
-	$(MODEL)/cursesf$o \
-	$(MODEL)/cursesm$o \
-	$(MODEL)/cursesw$o \
-	$(MODEL)/cursespad$o \
-	$(MODEL)/cursesp$o \
-	$(MODEL)/cursslk$o \
-	$(MODEL)/cursesapp$o \
-	$(MODEL)/cursesmain$o
-
-../lib/$(LIBNAME_NORMAL) : $(LIB_OBJS)
-	$(CXX_AR) $(CXX_ARFLAGS) $@ $?
-	$(RANLIB) $@
-
-../lib/$(LIBNAME_LIBTOOL) : $(LIB_OBJS)
-	cd ../lib && $(LIBTOOL_LINK) $(CXX) $(CXXFLAGS) \
-		-o $(LIBNAME) $(LIB_OBJS:$o=.lo) \
-		-rpath $(INSTALL_PREFIX)$(libdir) \
-		$(LIBTOOL_VERSION) $(NCURSES_MAJOR):$(NCURSES_MINOR) $(LT_UNDEF) $(SHLIB_LIST)
-
-OBJS_DEMO = $(MODEL)/demo$o
-
-$(MODEL)/demo$o : $(srcdir)/demo.cc \
-	$(cursesf_h) $(cursesm_h) $(cursesapp_h)
-
-demo$x:	$(OBJS_DEMO) \
-	$(MY_LIBRARY)  \
-	@TEST_DEPS@
-	@ECHO_LINK@ $(LINK) -o $@ $(OBJS_DEMO) $(LDFLAGS_DEFAULT)
-
-etip.h:	$(srcdir)/etip.h.in $(srcdir)/edit_cfg.sh
-	cp $(srcdir)/etip.h.in $@
-	sh $(srcdir)/edit_cfg.sh ../include/ncurses_cfg.h $@
-
 $(DESTDIR)$(libdir) :
 	mkdir -p $@
 
-install \
-install.libs:: $(MY_LIBRARY) $(DESTDIR)$(libdir)
-	$(LIBTOOL_INSTALL) $(INSTALL_LIB) $(MY_LIBRARY) $(DESTDIR)$(libdir)/$(LIBNAME)
-
-uninstall \
-uninstall.libs::
-	-$(LIBTOOL_UNINSTALL) rm -f $(DESTDIR)$(libdir)/$(LIBNAME)
-
 mostlyclean ::
 	-rm -f core tags TAGS *~ *.bak *.i *.ii *.ln *.atac trace
 
 clean :: mostlyclean
 	-sh -c "if test -n '$x' ; then $(MAKE) clean x=''; fi"
 	-rm -rf $(MODEL)/SunWS_cache
-	-$(LIBTOOL_CLEAN) rm -f demo$x $(AUTO_SRC) $(MY_LIBRARY) $(LIB_OBJS) $(OBJS_DEMO)
+	-$(LIBTOOL_CLEAN) rm -f demo$x $(AUTO_SRC) $(LIBRARIES) $(OBJS_DEMO)
 	-rm -rf .libs
 
 distclean :: clean
@@ -212,8 +176,16 @@
 
 ###############################################################################
 
+internal_h	= $(srcdir)/internal.h \
+		  $(INCDIR)/ncurses_cfg.h \
+		  $(INCDIR)/nc_mingw.h \
+		  $(INCDIR)/nc_string.h
+
+etip_h		= etip.h \
+		  $(INCDIR)/ncurses_dll.h
+
 cursesw_h	= $(srcdir)/cursesw.h \
-		  etip.h \
+		  $(etip_h) \
 		  $(INCDIR)/curses.h
 
 cursesp_h	= $(srcdir)/cursesp.h \
@@ -244,5 +216,26 @@
 	cd ../panel && $(MAKE) $@
 
 ###############################################################################
+
+OBJS_DEMO = $(MODEL)/demo$o
+
+$(MODEL)/demo$o : $(srcdir)/demo.cc \
+		$(internal_h) \
+		$(cursesf_h) \
+		$(cursesm_h) \
+		$(cursesapp_h)
+	@echo 'compiling demo (obj_s)'
+	@$(LIBTOOL_COMPILE) $(CXX) $(CFLAGS_DEFAULT) -c $(srcdir)/demo.cc -o $@
+
+demo$x:	$(OBJS_DEMO) \
+	$(LIBRARIES)  \
+	@TEST_DEPS@
+	@ECHO_LD@ $(LINK) -o $@ $(OBJS_DEMO) $(LDFLAGS_DEFAULT)
+
+etip.h:	$(srcdir)/etip.h.in $(srcdir)/edit_cfg.sh
+	cp $(srcdir)/etip.h.in $@
+	sh $(srcdir)/edit_cfg.sh ../include/ncurses_cfg.h $@
+
+###############################################################################
 # The remainder of this file is automatically generated during configuration
 ###############################################################################
Index: c++/cursesapp.h
Prereq:  1.11 
--- ncurses-5.9/c++/cursesapp.h	2005-05-28 21:57:44.000000000 +0000
+++ ncurses-5.9-20130504/c++/cursesapp.h	2011-09-17 22:12:10.000000000 +0000
@@ -1,6 +1,6 @@
 // * This makes emacs happy -*-Mode: C++;-*-
 /****************************************************************************
- * Copyright (c) 1998-2003,2005 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2005,2011 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -31,7 +31,7 @@
  *   Author: Juergen Pfeifer, 1997                                          *
  ****************************************************************************/
 
-// $Id: cursesapp.h,v 1.11 2005/05/28 21:57:44 tom Exp $
+// $Id: cursesapp.h,v 1.12 2011/09/17 22:12:10 tom Exp $
 
 #ifndef NCURSES_CURSESAPP_H_incl
 #define NCURSES_CURSESAPP_H_incl
@@ -80,6 +80,7 @@
   // This method is called to initialize the SLKs. Default is nothing.
   // You may rewrite this in your derived class
   virtual void init_labels(Soft_Label_Key_Set& S) const {
+    (void) S;
   }
 
   // Your derived class must implement this method. The return value must
@@ -118,6 +119,8 @@
   // Process the commandline arguments. The default implementation simply
   // ignores them. Your derived class may rewrite this.
   virtual void handleArgs(int argc, char* argv[]) {
+    (void) argc;
+    (void) argv;
   }
 
   // Does this application use colors?
@@ -138,37 +141,37 @@
 
   // Attributes to use for menu and forms foregrounds
   virtual chtype foregrounds() const {
-    return b_Colors ? COLOR_PAIR(1) : A_BOLD;
+    return b_Colors ? static_cast<chtype>(COLOR_PAIR(1)) : A_BOLD;
   }
 
   // Attributes to use for menu and forms backgrounds
   virtual chtype backgrounds() const {
-    return b_Colors ? COLOR_PAIR(2) : A_NORMAL;
+    return b_Colors ? static_cast<chtype>(COLOR_PAIR(2)) : A_NORMAL;
   }
 
   // Attributes to use for inactive (menu) elements
   virtual chtype inactives() const {
-    return b_Colors ? (COLOR_PAIR(3)|A_DIM) : A_DIM;
+    return b_Colors ? static_cast<chtype>(COLOR_PAIR(3)|A_DIM) : A_DIM;
   }
 
   // Attributes to use for (form) labels and SLKs
   virtual chtype labels() const {
-    return b_Colors ? COLOR_PAIR(4) : A_NORMAL;
+    return b_Colors ? static_cast<chtype>(COLOR_PAIR(4)) : A_NORMAL;
   }
 
   // Attributes to use for form backgrounds
   virtual chtype dialog_backgrounds() const {
-    return b_Colors ? COLOR_PAIR(4) : A_NORMAL;
+    return b_Colors ? static_cast<chtype>(COLOR_PAIR(4)) : A_NORMAL;
   }
 
   // Attributes to use as default for (form) window backgrounds
   virtual chtype window_backgrounds() const {
-    return b_Colors ? COLOR_PAIR(5) : A_NORMAL;
+    return b_Colors ? static_cast<chtype>(COLOR_PAIR(5)) : A_NORMAL;
   }
 
   // Attributes to use for the title window
   virtual chtype screen_titles() const {
-    return b_Colors ? COLOR_PAIR(6) : A_BOLD;
+    return b_Colors ? static_cast<chtype>(COLOR_PAIR(6)) : A_BOLD;
   }
 
 };
Index: c++/cursesf.cc
Prereq:  1.21 
--- ncurses-5.9/c++/cursesf.cc	2005-08-13 18:09:06.000000000 +0000
+++ ncurses-5.9-20130504/c++/cursesf.cc	2011-09-17 22:12:10.000000000 +0000
@@ -1,6 +1,6 @@
 // * this is for making emacs happy: -*-Mode: C++;-*-
 /****************************************************************************
- * Copyright (c) 1998-2003,2005 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2005,2011 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -35,7 +35,7 @@
 #include "cursesf.h"
 #include "cursesapp.h"
 
-MODULE_ID("$Id: cursesf.cc,v 1.21 2005/08/13 18:09:06 tom Exp $")
+MODULE_ID("$Id: cursesf.cc,v 1.22 2011/09/17 22:12:10 tom Exp $")
 
 NCursesFormField::~NCursesFormField ()
 {
@@ -234,11 +234,13 @@
 void
 NCursesForm::On_Field_Init(NCursesFormField& field)
 {
+  (void) field;
 }
 
 void
 NCursesForm::On_Field_Termination(NCursesFormField& field)
 {
+  (void) field;
 }
 
 // call the form driver and do basic error checking.
@@ -260,16 +262,19 @@
 
 void NCursesForm::On_Request_Denied(int c) const
 {
+  (void) c;
   ::beep();
 }
 
 void NCursesForm::On_Invalid_Field(int c) const
 {
+  (void) c;
   ::beep();
 }
 
 void NCursesForm::On_Unknown_Command(int c) const
 {
+  (void) c;
   ::beep();
 }
 
@@ -373,6 +378,7 @@
 //
 bool _nc_xx_fld_fcheck(FIELD *f, const void *u)
 {
+  (void) f;
   NCursesFormField* F = reinterpret_cast<NCursesFormField*>(const_cast<void *>(u));
   assert(F != 0);
   UserDefinedFieldType* udf = reinterpret_cast<UserDefinedFieldType*>(F->fieldtype());
@@ -405,6 +411,7 @@
 
 bool _nc_xx_next_choice(FIELD *f, const void *u)
 {
+  (void) f;
   NCursesFormField* F = reinterpret_cast<NCursesFormField*>(const_cast<void *>(u));
   assert(F != 0);
   UserDefinedFieldType_With_Choice* udf =
@@ -415,6 +422,7 @@
 
 bool _nc_xx_prev_choice(FIELD *f, const void *u)
 {
+  (void) f;
   NCursesFormField* F = reinterpret_cast<NCursesFormField*>(const_cast<void *>(u));
   assert(F != 0);
   UserDefinedFieldType_With_Choice* udf =
Index: c++/cursesf.h
Prereq:  1.28 
--- ncurses-5.9/c++/cursesf.h	2005-08-13 18:08:24.000000000 +0000
+++ ncurses-5.9-20130504/c++/cursesf.h	2012-12-29 21:49:58.000000000 +0000
@@ -1,6 +1,6 @@
 // * This makes emacs happy -*-Mode: C++;-*-
 /****************************************************************************
- * Copyright (c) 1998-2004,2005 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -31,7 +31,7 @@
  *   Author: Juergen Pfeifer, 1997                                          *
  ****************************************************************************/
 
-// $Id: cursesf.h,v 1.28 2005/08/13 18:08:24 tom Exp $
+// $Id: cursesf.h,v 1.31 2012/12/29 21:49:58 tom Exp $
 
 #ifndef NCURSES_CURSESF_H_incl
 #define NCURSES_CURSESF_H_incl 1
@@ -61,7 +61,7 @@
 protected:
   FIELDTYPE* fieldtype;
 
-  inline void OnError(int err) const THROWS(NCursesFormException) {
+  inline void OnError(int err) const THROW2(NCursesException const, NCursesFormException) {
     if (err!=E_OK)
       THROW(new NCursesFormException (err));
   }
@@ -109,7 +109,7 @@
   NCursesFieldType* ftype;   // Associated field type
 
   // Error handler
-  inline void OnError (int err) const THROWS(NCursesFormException) {
+  inline void OnError (int err) const THROW2(NCursesException const, NCursesFormException) {
     if (err != E_OK)
       THROW(new NCursesFormException (err));
   }
@@ -391,7 +391,7 @@
 		 bool with_frame,
 		 bool autoDeleteFields);
 
-  inline void OnError (int err) const THROWS(NCursesFormException) {
+  inline void OnError (int err) const THROW2(NCursesException const, NCursesFormException) {
     if (err != E_OK)
       THROW(new NCursesFormException (err));
   }
@@ -677,7 +677,7 @@
   }
 
 public:
-  NCursesUserForm (NCursesFormField Fields[],
+  NCursesUserForm (NCursesFormField* Fields[],
 		   const T* p_UserData = STATIC_CAST(T*)(0),
 		   bool with_frame=FALSE,
 		   bool autoDelete_Fields=FALSE)
@@ -686,7 +686,7 @@
 	set_user (const_cast<void *>(p_UserData));
   };
 
-  NCursesUserForm (NCursesFormField Fields[],
+  NCursesUserForm (NCursesFormField* Fields[],
 		   int nlines,
 		   int ncols,
 		   int begin_y = 0,
Index: c++/cursesm.cc
Prereq:  1.22 
--- ncurses-5.9/c++/cursesm.cc	2005-04-02 20:39:05.000000000 +0000
+++ ncurses-5.9-20130504/c++/cursesm.cc	2011-09-17 22:11:32.000000000 +0000
@@ -1,6 +1,6 @@
 // * this is for making emacs happy: -*-Mode: C++;-*-
 /****************************************************************************
- * Copyright (c) 1998-2003,2005 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2005,2011 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -35,7 +35,7 @@
 #include "cursesm.h"
 #include "cursesapp.h"
 
-MODULE_ID("$Id: cursesm.cc,v 1.22 2005/04/02 20:39:05 tom Exp $")
+MODULE_ID("$Id: cursesm.cc,v 1.23 2011/09/17 22:11:32 tom Exp $")
 
 NCursesMenuItem::~NCursesMenuItem()
 {
@@ -375,33 +375,39 @@
 void
 NCursesMenu::On_Item_Init(NCursesMenuItem& item)
 {
+  (void) item;
 }
 
 void
 NCursesMenu::On_Item_Termination(NCursesMenuItem& item)
 {
+  (void) item;
 }
 
 void
 NCursesMenu::On_Request_Denied(int c) const
 {
+  (void) c;
   ::beep();
 }
 
 void
 NCursesMenu::On_Not_Selectable(int c) const
 {
+  (void) c;
   ::beep();
 }
 
 void
 NCursesMenu::On_No_Match(int c) const
 {
+  (void) c;
   ::beep();
 }
 
 void
 NCursesMenu::On_Unknown_Command(int c) const
 {
+  (void) c;
   ::beep();
 }
Index: c++/cursesm.h
Prereq:  1.25 
--- ncurses-5.9/c++/cursesm.h	2005-08-13 18:10:36.000000000 +0000
+++ ncurses-5.9-20130504/c++/cursesm.h	2012-12-29 21:48:33.000000000 +0000
@@ -1,6 +1,6 @@
 // * This makes emacs happy -*-Mode: C++;-*-
 /****************************************************************************
- * Copyright (c) 1998-2003,2005 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -31,7 +31,7 @@
  *   Author: Juergen Pfeifer, 1997                                          *
  ****************************************************************************/
 
-// $Id: cursesm.h,v 1.25 2005/08/13 18:10:36 tom Exp $
+// $Id: cursesm.h,v 1.29 2012/12/29 21:48:33 tom Exp $
 
 #ifndef NCURSES_CURSESM_H_incl
 #define NCURSES_CURSESM_H_incl 1
@@ -53,7 +53,7 @@
 protected:
   ITEM *item;
 
-  inline void OnError (int err) const THROWS(NCursesMenuException) {
+  inline void OnError (int err) const THROW2(NCursesException const, NCursesMenuException) {
     if (err != E_OK)
       THROW(new NCursesMenuException (err));
   }
@@ -82,6 +82,7 @@
   NCursesMenuItem(const NCursesMenuItem& rhs)
     : item(0)
   {
+    (void) rhs;
   }
 
   virtual ~NCursesMenuItem ();
@@ -252,7 +253,7 @@
 		 bool with_frame,
 		 bool autoDeleteItems);
 
-  inline void OnError (int err) const THROWS(NCursesMenuException) {
+  inline void OnError (int err) const THROW2(NCursesException const, NCursesMenuException) {
     if (err != E_OK)
       THROW(new NCursesMenuException (this, err));
   }
@@ -635,7 +636,7 @@
   }
 
 public:
-  NCursesUserMenu (NCursesMenuItem Items[],
+  NCursesUserMenu (NCursesMenuItem* Items[],
 		   const T* p_UserData = STATIC_CAST(T*)(0),
 		   bool with_frame=FALSE,
 		   bool autoDelete_Items=FALSE)
@@ -644,7 +645,7 @@
 	set_user (const_cast<void *>(p_UserData));
   };
 
-  NCursesUserMenu (NCursesMenuItem Items[],
+  NCursesUserMenu (NCursesMenuItem* Items[],
 		   int nlines,
 		   int ncols,
 		   int begin_y = 0,
Index: c++/cursesp.h
Prereq:  1.29 
--- ncurses-5.9/c++/cursesp.h	2008-08-16 17:20:23.000000000 +0000
+++ ncurses-5.9-20130504/c++/cursesp.h	2012-12-29 21:50:55.000000000 +0000
@@ -1,6 +1,6 @@
 // * This makes emacs happy -*-Mode: C++;-*-
 /****************************************************************************
- * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2008,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -34,7 +34,7 @@
 #ifndef NCURSES_CURSESP_H_incl
 #define NCURSES_CURSESP_H_incl 1
 
-// $Id: cursesp.h,v 1.29 2008/08/16 17:20:23 tom Exp $
+// $Id: cursesp.h,v 1.30 2012/12/29 21:50:55 tom Exp $
 
 #include <cursesw.h>
 
@@ -86,7 +86,7 @@
     return result;
   }
 
-  void OnError (int err) const THROWS(NCursesPanelException)
+  void OnError (int err) const THROW2(NCursesException const, NCursesPanelException)
   {
     if (err==ERR)
       THROW(new NCursesPanelException (this, err));
Index: c++/cursespad.cc
Prereq:  1.13 
--- ncurses-5.9/c++/cursespad.cc	2008-08-04 18:59:22.000000000 +0000
+++ ncurses-5.9-20130504/c++/cursespad.cc	2013-03-30 19:45:36.000000000 +0000
@@ -1,6 +1,6 @@
 // * this is for making emacs happy: -*-Mode: C++;-*-
 /****************************************************************************
- * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -33,10 +33,9 @@
 
 #include "internal.h"
 
-#include <etip.h>
 #include <cursesw.h>
 
-MODULE_ID("$Id: cursespad.cc,v 1.13 2008/08/04 18:59:22 tom Exp $")
+MODULE_ID("$Id: cursespad.cc,v 1.17 2013/03/30 19:45:36 tom Exp $")
 
 NCursesPad::NCursesPad(int nlines, int ncols)
   : NCursesWindow(),
@@ -220,6 +219,7 @@
 
 void NCursesFramedPad::OnOperation(int pad_req)
 {
+  (void) pad_req;
   NCursesWindow* W = Win();
   NCursesWindow* W2 = getWindow();
 
@@ -228,25 +228,45 @@
     int Height = W->height();
     int i, row, col, h_len, v_len;
 
-    h_len = (Width*Width + width() - 1)/width();
-    if (h_len==0)
+    int my_width = width();
+
+    if (my_width != 0) {
+      h_len = (Width*Width + my_width - 1) / my_width;
+      if (h_len==0)
+	h_len = 1;
+      if (h_len > Width)
+	h_len = Width;
+    } else {
       h_len = 1;
-    if (h_len > Width)
-      h_len = Width;
+    }
 
-    v_len = (Height*Height + height() - 1)/height();
-    if (v_len==0)
+    int my_height = height();
+
+    if (my_height != 0) {
+      v_len = (Height*Height + my_height - 1) / my_height;
+      if (v_len==0)
+	v_len = 1;
+      if (v_len > Height)
+	v_len = Height;
+    } else {
       v_len = 1;
-    if (v_len > Height)
-      v_len = Height;
+    }
 
-    col  = (min_col * Width + width() - 1)  / width();
-    if (col + h_len > Width)
-      col = Width - h_len;
-
-    row  = (min_row * Height + height() - 1) / height();
-    if (row + v_len > Height)
-      row = Height - v_len;
+    if (my_width != 0) {
+      col  = (min_col * Width + my_width - 1) / my_width;
+      if (col + h_len > Width)
+        col = Width - h_len;
+    } else {
+      col = 0;
+    }
+
+    if (my_height != 0) {
+      row  = (min_row * Height + my_height - 1) / my_height;
+      if (row + v_len > Height)
+        row = Height - v_len;
+    } else {
+      row = 0;
+    }
 
     W2->vline(1,Width+1,Height);
     W2->attron(A_REVERSE);
Index: c++/cursesw.cc
Prereq:  1.51 
--- ncurses-5.9/c++/cursesw.cc	2009-03-28 21:31:37.000000000 +0000
+++ ncurses-5.9-20130504/c++/cursesw.cc	2012-12-08 22:06:41.000000000 +0000
@@ -1,6 +1,6 @@
 // * this is for making emacs happy: -*-Mode: C++;-*-
 /****************************************************************************
- * Copyright (c) 2007-2008,2009 Free Software Foundation, Inc.              *
+ * Copyright (c) 2007-2011,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -42,7 +42,7 @@
 #include "internal.h"
 #include "cursesw.h"
 
-MODULE_ID("$Id: cursesw.cc,v 1.51 2009/03/28 21:31:37 tom Exp $")
+MODULE_ID("$Id: cursesw.cc,v 1.53 2012/12/08 22:06:41 tom Exp $")
 
 #define COLORS_NEED_INITIALIZATION  -1
 #define COLORS_NOT_INITIALIZED       0
@@ -192,7 +192,6 @@
     constructing();
 
     w = static_cast<WINDOW *>(0);
-    set_keyboard();
 }
 
 NCursesWindow::NCursesWindow(int nlines, int ncols, int begin_y, int begin_x)
@@ -285,12 +284,14 @@
 NCursesWindow::NCursesWindow(WINDOW *win, int ncols)
   : w(0), alloced(FALSE), par(0), subwins(0), sib(0)
 {
+    (void) ncols;
     initialize();
     w = win;
 }
 
 int _nc_xx_ripoff_init(WINDOW *w, int ncols)
 {
+    (void) ncols;
     int res = ERR;
 
     RIPOFFINIT init = *prip++;
Index: c++/cursesw.h
Prereq:  1.48 
--- ncurses-5.9/c++/cursesw.h	2008-01-19 21:09:10.000000000 +0000
+++ ncurses-5.9-20130504/c++/cursesw.h	2011-09-17 22:12:10.000000000 +0000
@@ -1,7 +1,7 @@
 // * This makes emacs happy -*-Mode: C++;-*-
 // vile:cppmode
 /****************************************************************************
- * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2008,2011 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -31,7 +31,7 @@
 #ifndef NCURSES_CURSESW_H_incl
 #define NCURSES_CURSESW_H_incl 1
 
-// $Id: cursesw.h,v 1.48 2008/01/19 21:09:10 tom Exp $
+// $Id: cursesw.h,v 1.49 2011/09/17 22:12:10 tom Exp $
 
 #include <etip.h>
 
@@ -1438,16 +1438,19 @@
   // The driver translates the keystroke c into an Pad_Request
 
   virtual void OnUnknownOperation(int pad_req) {
+    (void) pad_req;
     ::beep();
   }
   // This is called if the driver returns an unknown op-code
 
   virtual void OnNavigationError(int pad_req) {
+    (void) pad_req;
     ::beep();
   }
   // This is called if a navigation request couldn't be satisfied
 
   virtual void OnOperation(int pad_req) {
+    (void) pad_req;
   };
   // OnOperation is called if a Pad_Operation was executed and just before
   // the refresh() operation is done.
@@ -1542,11 +1545,15 @@
   }
 
   void setWindow(NCursesWindow& view, int v_grid = 1, int h_grid = 1) {
+    (void) view;
+    (void) v_grid;
+    (void) h_grid;
     err_handler("Operation not allowed");
   }
   // Disable this call; the viewport is already defined
 
   void setSubWindow(NCursesWindow& sub) {
+    (void) sub;
     err_handler("Operation not allowed");
   }
   // Disable this call; the viewport subwindow is already defined
Index: c++/cursslk.cc
Prereq:  1.15 
--- ncurses-5.9/c++/cursslk.cc	2005-08-06 22:12:36.000000000 +0000
+++ ncurses-5.9-20130504/c++/cursslk.cc	2012-02-23 10:41:56.000000000 +0000
@@ -1,6 +1,6 @@
 // * this is for making emacs happy: -*-Mode: C++;-*-
 /****************************************************************************
- * Copyright (c) 1998-2003,2005 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2005,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -35,14 +35,15 @@
 #include "cursslk.h"
 #include "cursesapp.h"
 
-MODULE_ID("$Id: cursslk.cc,v 1.15 2005/08/06 22:12:36 tom Exp $")
+MODULE_ID("$Id: cursslk.cc,v 1.16 2012/02/23 10:41:56 tom Exp $")
 
 Soft_Label_Key_Set::Soft_Label_Key&
   Soft_Label_Key_Set::Soft_Label_Key::operator=(char *text)
 {
   delete[] label;
-  label = new char[1 + ::strlen(text)];
-  (::strcpy)(label,text);
+  size_t need = 1 + ::strlen(text);
+  label = new char[need];
+  ::_nc_STRCPY(label,text,need);
   return *this;
 }
 
Index: c++/demo.cc
Prereq:  1.39 
--- ncurses-5.9/c++/demo.cc	2008-12-07 02:07:34.000000000 +0000
+++ ncurses-5.9-20130504/c++/demo.cc	2012-02-23 10:41:56.000000000 +0000
@@ -1,6 +1,6 @@
 // * This makes emacs happy -*-Mode: C++;-*-
 /****************************************************************************
- * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -35,7 +35,7 @@
  *   Demo code for NCursesMenu and NCursesForm written by
  *   Juergen Pfeifer
  *
- * $Id: demo.cc,v 1.39 2008/12/07 02:07:34 juergen Exp $
+ * $Id: demo.cc,v 1.41 2012/02/23 10:41:56 tom Exp $
  */
 
 #include "internal.h"
@@ -220,6 +220,7 @@
   int chk;
 protected:
   bool field_check(NCursesFormField& f) {
+    (void) f;
     return TRUE;
   }
   bool char_check(int c) {
@@ -319,7 +320,7 @@
     for(int i=1; i <= S->labels(); i++) {
       char buf[8];
       assert(i < 100);
-      ::sprintf(buf, "Frm%02d", i);
+      ::_nc_SPRINTF(buf, _nc_SLIMIT(sizeof(buf)) "Frm%02d", i);
       (*S)[i] = buf;                                      // Text
       (*S)[i] = Soft_Label_Key_Set::Soft_Label_Key::Left; // Justification
     }
@@ -539,7 +540,7 @@
   for(int i=1; i <= S.labels(); i++) {
     char buf[8];
     assert(i < 100);
-    ::sprintf(buf, "Key%02d", i);
+    ::_nc_SPRINTF(buf, _nc_SLIMIT(sizeof(buf)) "Key%02d", i);
     S[i] = buf;                                      // Text
     S[i] = Soft_Label_Key_Set::Soft_Label_Key::Left; // Justification
   }
Index: c++/etip.h.in
Prereq:  1.37 
--- ncurses-5.9/c++/etip.h.in	2008-08-30 19:27:32.000000000 +0000
+++ ncurses-5.9-20130504/c++/etip.h.in	2012-12-29 21:50:44.000000000 +0000
@@ -1,6 +1,6 @@
 // * This makes emacs happy -*-Mode: C++;-*-
 /****************************************************************************
- * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -31,7 +31,7 @@
  *   Author: Juergen Pfeifer, 1997                                          *
  ****************************************************************************/
 
-// $Id: etip.h.in,v 1.37 2008/08/30 19:27:32 tom Exp $
+// $Id: etip.h.in,v 1.39 2012/12/29 21:50:44 tom Exp $
 
 #ifndef NCURSES_ETIP_H_incl
 #define NCURSES_ETIP_H_incl 1
@@ -184,7 +184,7 @@
 
   NCursesPanelException (const char *msg, int err) :
     NCursesException (msg, err),
-    p (NULL)
+    p (0)
     {};
 
   NCursesPanelException (const NCursesPanel* panel,
@@ -196,7 +196,7 @@
 
   NCursesPanelException (int err) :
     NCursesException ("panel library error", err),
-    p (NULL)
+    p (0)
     {};
 
   NCursesPanelException (const NCursesPanel* panel,
@@ -235,7 +235,7 @@
 
   NCursesMenuException (const char *msg, int err) :
     NCursesException (msg, err),
-    m (NULL)
+    m (0)
     {};
 
   NCursesMenuException (const NCursesMenu* menu,
@@ -247,7 +247,7 @@
 
   NCursesMenuException (int err) :
     NCursesException ("menu library error", err),
-    m (NULL)
+    m (0)
     {};
 
   NCursesMenuException (const NCursesMenu* menu,
@@ -286,7 +286,7 @@
 
   NCursesFormException (const char *msg, int err) :
     NCursesException (msg, err),
-    f (NULL)
+    f (0)
     {};
 
   NCursesFormException (const NCursesForm* form,
@@ -298,7 +298,7 @@
 
   NCursesFormException (int err) :
     NCursesException ("form library error", err),
-    f (NULL)
+    f (0)
     {};
 
   NCursesFormException (const NCursesForm* form,
@@ -367,11 +367,13 @@
 #define NCURSES_CPP_TRY		/* nothing */
 #define NCURSES_CPP_CATCH(e)	if (false)
 #define THROWS(s)		/* nothing */
+#define THROW2(s,t)		/* nothing */
 #elif CPP_HAS_TRY_CATCH
   throw *e;
 #define NCURSES_CPP_TRY		try
 #define NCURSES_CPP_CATCH(e)	catch(e)
 #define THROWS(s)		throw(s)
+#define THROW2(s,t)		throw(s,t)
 #endif
 }
 
Index: c++/internal.h
Prereq:  1.17 
--- ncurses-5.9/c++/internal.h	2008-12-07 02:07:34.000000000 +0000
+++ ncurses-5.9-20130504/c++/internal.h	2012-02-23 10:41:56.000000000 +0000
@@ -1,6 +1,6 @@
 // * This makes emacs happy -*-Mode: C++;-*-
 /****************************************************************************
- * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2008,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -31,7 +31,7 @@
  *   Author: Juergen Pfeifer, 1997                                          *
  ****************************************************************************/
 
-// $Id: internal.h,v 1.17 2008/12/07 02:07:34 juergen Exp $
+// $Id: internal.h,v 1.18 2012/02/23 10:41:56 tom Exp $
 
 #ifndef NCURSES_CPLUS_INTERNAL_H
 #define NCURSES_CPLUS_INTERNAL_H 1
@@ -62,4 +62,6 @@
 #define NULL 0
 #endif
 
+#include <nc_string.h>
+
 #endif /* NCURSES_CPLUS_INTERNAL_H */
Index: c++/modules
Prereq:  1.7 
--- ncurses-5.9/c++/modules	2006-12-24 00:53:08.000000000 +0000
+++ ncurses-5.9-20130504/c++/modules	2013-03-30 19:41:11.000000000 +0000
@@ -1,7 +1,7 @@
 # Program modules
-# $Id: modules,v 1.7 2006/12/24 00:53:08 tom Exp $
+# $Id: modules,v 1.11 2013/03/30 19:41:11 tom Exp $
 ##############################################################################
-# Copyright (c) 1998,2006 Free Software Foundation, Inc.                     #
+# Copyright (c) 1998-2006,2013 Free Software Foundation, Inc.                #
 #                                                                            #
 # Permission is hereby granted, free of charge, to any person obtaining a    #
 # copy of this software and associated documentation files (the "Software"), #
@@ -32,14 +32,13 @@
 #
 
 @ base
-cursesf		c++		$(srcdir)	$(cursesf_h) $(cursesapp_h)
-cursesm		c++		$(srcdir)	$(cursesm_h) $(cursesapp_h)
-cursesp		c++		$(srcdir)	$(cursesp_h)
-cursesw		c++		$(srcdir)	$(cursesw_h)
-cursespad	c++		$(srcdir)	$(cursesw_h)
-cursslk		c++		$(srcdir)	$(cursslk_h) $(cursesapp_h)
-cursesapp	c++		$(srcdir)	$(cursesapp_h)
-cursesmain	c++		$(srcdir)	$(cursesapp_h)
-demo		c++		$(srcdir)	$(cursesf_h) $(cursesm_h) $(cursesapp_h)
+cursesf		c++		$(srcdir)	$(internal_h) $(cursesf_h) $(cursesapp_h)
+cursesm		c++		$(srcdir)	$(internal_h) $(cursesm_h) $(cursesapp_h)
+cursesw		c++		$(srcdir)	$(internal_h) $(cursesw_h)
+cursespad	c++		$(srcdir)	$(internal_h) $(cursesw_h)
+cursesp		c++		$(srcdir)	$(internal_h) $(cursesp_h)
+cursslk		c++		$(srcdir)	$(internal_h) $(cursesapp_h)
+cursesapp	c++		$(srcdir)	$(internal_h) $(cursesapp_h)
+cursesmain	c++		$(srcdir)	$(internal_h) $(cursesapp_h) $(INCDIR)/nc_alloc.h
 
 # vile:makemode
Index: config.guess
--- ncurses-5.9/config.guess	2010-09-28 23:11:39.000000000 +0000
+++ ncurses-5.9-20130504/config.guess	2013-02-10 14:28:37.000000000 +0000
@@ -1,14 +1,12 @@
 #! /bin/sh
 # Attempt to guess a canonical system name.
-#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
-#   Free Software Foundation, Inc.
+#   Copyright 1992-2013 Free Software Foundation, Inc.
 
-timestamp='2010-09-24'
+timestamp='2013-02-04'
 
 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
+# the Free Software Foundation; either version 3 of the License, or
 # (at your option) any later version.
 #
 # This program is distributed in the hope that it will be useful, but
@@ -17,26 +15,22 @@
 # General Public License for more details.
 #
 # You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
-# 02110-1301, USA.
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
 #
 # As a special exception to the GNU General Public License, if you
 # distribute this file as part of a program that contains a
 # configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-
-# Originally written by Per Bothner.  Please send patches (context
-# diff format) to <config-patches@gnu.org> and include a ChangeLog
-# entry.
+# the same distribution terms that you use for the rest of that
+# program.  This Exception is an additional permission under section 7
+# of the GNU General Public License, version 3 ("GPLv3").
 #
-# This script attempts to guess a canonical system name similar to
-# config.sub.  If it succeeds, it prints the system name on stdout, and
-# exits with 0.  Otherwise, it exits with 1.
+# Originally written by Per Bothner.
 #
 # You can get the latest version of this script from:
 # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
+#
+# Please send patches with a ChangeLog entry to config-patches@gnu.org.
+
 
 me=`echo "$0" | sed -e 's,.*/,,'`
 
@@ -56,9 +50,7 @@
 GNU config.guess ($timestamp)
 
 Originally written by Per Bothner.
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free
-Software Foundation, Inc.
+Copyright 1992-2013 Free Software Foundation, Inc.
 
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -92,7 +84,7 @@
   exit 1
 fi
 
-trap 'exit 1' HUP INT TERM
+trap 'exit 1' 1 2 15
 
 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a
 # compiler to aid in system detection is discouraged as it requires
@@ -106,7 +98,7 @@
 
 set_cc_for_build='
 trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
-trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" HUP INT PIPE TERM ;
+trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
 : ${TMPDIR=/tmp} ;
  { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
  { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
@@ -145,7 +137,7 @@
 case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
     *:NetBSD:*:*)
 	# NetBSD (nbsd) targets should (where applicable) match one or
-	# more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
+	# more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
 	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
 	# switched to ELF, *-*-netbsd* would select the old
 	# object file format.  This provides both forward
@@ -202,6 +194,10 @@
 	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
 	echo "${machine}-${os}${release}"
 	exit ;;
+    *:Bitrig:*:*)
+	UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
+	echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE}
+	exit ;;
     *:OpenBSD:*:*)
 	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
 	echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
@@ -220,10 +216,10 @@
 	exit ;;
     alpha:OSF1:*:*)
 	case $UNAME_RELEASE in
-	    *4.0)
+	*4.0)
 		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
 		;;
-	    *5.*)
+	*5.*)
 		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
 		;;
 	esac
@@ -270,7 +266,10 @@
 	# A Xn.n version is an unreleased experimental baselevel.
 	# 1.2 uses "1.2" for uname -r.
 	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
-	exit ;;
+	# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
+	exitcode=$?
+	trap '' 0
+	exit $exitcode ;;
     Alpha\ *:Windows_NT*:*)
 	# How do we know it's Interix rather than the generic POSIX subsystem?
 	# Should we change UNAME_MACHINE based on the output of uname instead
@@ -301,7 +300,7 @@
     arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
 	echo arm-acorn-riscix${UNAME_RELEASE}
 	exit ;;
-    arm:riscos:*:*|arm:RISCOS:*:*)
+    arm*:riscos:*:*|arm*:RISCOS:*:*)
 	echo arm-unknown-riscos
 	exit ;;
     SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
@@ -326,8 +325,8 @@
 	    sparc) echo sparc-icl-nx7; exit ;;
 	esac ;;
     s390x:SunOS:*:*)
-    	echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
-    	exit ;;
+	echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit ;;
     sun4H:SunOS:5.*:*)
 	echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
 	exit ;;
@@ -495,7 +494,7 @@
 	else
 	    echo i586-dg-dgux${UNAME_RELEASE}
 	fi
- 	exit ;;
+	exit ;;
     M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
 	echo m88k-dolphin-sysv3
 	exit ;;
@@ -597,50 +596,50 @@
 		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
 		    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
 		    case "${sc_cpu_version}" in
-                      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
-                      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
-                      532)                      # CPU_PA_RISC2_0
-                        case "${sc_kernel_bits}" in
-                          32) HP_ARCH="hppa2.0n" ;;
-                          64) HP_ARCH="hppa2.0w" ;;
+		      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
+		      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
+		      532)                      # CPU_PA_RISC2_0
+			case "${sc_kernel_bits}" in
+			  32) HP_ARCH="hppa2.0n" ;;
+			  64) HP_ARCH="hppa2.0w" ;;
 			  '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
-                        esac ;;
-                    esac
+			esac ;;
+		    esac
 		fi
 		if [ "${HP_ARCH}" = "" ]; then
 		    eval $set_cc_for_build
-		    sed 's/^              //' << EOF >$dummy.c
+		    sed 's/^		//' << EOF >$dummy.c
 
-              #define _HPUX_SOURCE
-              #include <stdlib.h>
-              #include <unistd.h>
-
-              int main ()
-              {
-              #if defined(_SC_KERNEL_BITS)
-                  long bits = sysconf(_SC_KERNEL_BITS);
-              #endif
-                  long cpu  = sysconf (_SC_CPU_VERSION);
-
-                  switch (cpu)
-              	{
-              	case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
-              	case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
-              	case CPU_PA_RISC2_0:
-              #if defined(_SC_KERNEL_BITS)
-              	    switch (bits)
-              		{
-              		case 64: puts ("hppa2.0w"); break;
-              		case 32: puts ("hppa2.0n"); break;
-              		default: puts ("hppa2.0"); break;
-              		} break;
-              #else  /* !defined(_SC_KERNEL_BITS) */
-              	    puts ("hppa2.0"); break;
-              #endif
-              	default: puts ("hppa1.0"); break;
-              	}
-                  exit (0);
-              }
+		#define _HPUX_SOURCE
+		#include <stdlib.h>
+		#include <unistd.h>
+
+		int main ()
+		{
+		#if defined(_SC_KERNEL_BITS)
+		    long bits = sysconf(_SC_KERNEL_BITS);
+		#endif
+		    long cpu  = sysconf (_SC_CPU_VERSION);
+
+		    switch (cpu)
+			{
+			case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
+			case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
+			case CPU_PA_RISC2_0:
+		#if defined(_SC_KERNEL_BITS)
+			    switch (bits)
+				{
+				case 64: puts ("hppa2.0w"); break;
+				case 32: puts ("hppa2.0n"); break;
+				default: puts ("hppa2.0"); break;
+				} break;
+		#else  /* !defined(_SC_KERNEL_BITS) */
+			    puts ("hppa2.0"); break;
+		#endif
+			default: puts ("hppa1.0"); break;
+			}
+		    exit (0);
+		}
 EOF
 		    (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
 		    test -z "$HP_ARCH" && HP_ARCH=hppa
@@ -789,21 +788,26 @@
 	echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
 	exit ;;
     *:FreeBSD:*:*)
-	case ${UNAME_MACHINE} in
-	    pc98)
-		echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+	UNAME_PROCESSOR=`/usr/bin/uname -p`
+	case ${UNAME_PROCESSOR} in
 	    amd64)
 		echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
 	    *)
-		echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+		echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
 	esac
 	exit ;;
     i*:CYGWIN*:*)
 	echo ${UNAME_MACHINE}-pc-cygwin
 	exit ;;
+    *:MINGW64*:*)
+	echo ${UNAME_MACHINE}-pc-mingw64
+	exit ;;
     *:MINGW*:*)
 	echo ${UNAME_MACHINE}-pc-mingw32
 	exit ;;
+    i*:MSYS*:*)
+	echo ${UNAME_MACHINE}-pc-msys
+	exit ;;
     i*:windows32*:*)
 	# uname -m includes "-pc" on this system.
 	echo ${UNAME_MACHINE}-mingw32
@@ -820,8 +824,8 @@
 		echo x86_64-unknown-interix${UNAME_RELEASE}
 		exit ;;
 	    IA64)
-	    	echo ia64-unknown-interix${UNAME_RELEASE}
-	    	exit ;;
+		echo ia64-unknown-interix${UNAME_RELEASE}
+		exit ;;
 	esac ;;
     [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
 	echo i${UNAME_MACHINE}-pc-mks
@@ -858,15 +862,22 @@
     i*86:Minix:*:*)
 	echo ${UNAME_MACHINE}-pc-minix
 	exit ;;
+    aarch64:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    aarch64_be:Linux:*:*)
+	UNAME_MACHINE=aarch64_be
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
     alpha:Linux:*:*)
 	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
-	    EV5)   UNAME_MACHINE=alphaev5 ;;
-	    EV56)  UNAME_MACHINE=alphaev56 ;;
-	    PCA56) UNAME_MACHINE=alphapca56 ;;
-	    PCA57) UNAME_MACHINE=alphapca56 ;;
-	    EV6)   UNAME_MACHINE=alphaev6 ;;
-	    EV67)  UNAME_MACHINE=alphaev67 ;;
-	    EV68*) UNAME_MACHINE=alphaev68 ;;
+	  EV5)   UNAME_MACHINE=alphaev5 ;;
+	  EV56)  UNAME_MACHINE=alphaev56 ;;
+	  PCA56) UNAME_MACHINE=alphapca56 ;;
+	  PCA57) UNAME_MACHINE=alphapca56 ;;
+	  EV6)   UNAME_MACHINE=alphaev6 ;;
+	  EV67)  UNAME_MACHINE=alphaev67 ;;
+	  EV68*) UNAME_MACHINE=alphaev68 ;;
 	esac
 	objdump --private-headers /bin/sh | grep -q ld.so.1
 	if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
@@ -874,30 +885,39 @@
 	exit ;;
     arm*:Linux:*:*)
 	eval $set_cc_for_build
-	if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null | \
-	    grep -q __ARM_EABI__
+	if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
+	    | grep -q __ARM_EABI__
 	then
 	    echo ${UNAME_MACHINE}-unknown-linux-gnu
 	else
-	    echo ${UNAME_MACHINE}-unknown-linux-gnueabi
+	    if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
+		| grep -q __ARM_PCS_VFP
+	    then
+		echo ${UNAME_MACHINE}-unknown-linux-gnueabi
+	    else
+		echo ${UNAME_MACHINE}-unknown-linux-gnueabihf
+	    fi
 	fi
 	exit ;;
     avr32*:Linux:*:*)
 	echo ${UNAME_MACHINE}-unknown-linux-gnu
 	exit ;;
     cris:Linux:*:*)
-	echo cris-axis-linux-gnu
+	echo ${UNAME_MACHINE}-axis-linux-gnu
 	exit ;;
     crisv32:Linux:*:*)
-	echo crisv32-axis-linux-gnu
+	echo ${UNAME_MACHINE}-axis-linux-gnu
 	exit ;;
     frv:Linux:*:*)
-	echo frv-unknown-linux-gnu
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    hexagon:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
 	exit ;;
     i*86:Linux:*:*)
 	LIBC=gnu
 	eval $set_cc_for_build
-	sed 's/^        //' << EOF >$dummy.c
+	sed 's/^	//' << EOF >$dummy.c
 	#ifdef __dietlibc__
 	LIBC=dietlibc
 	#endif
@@ -934,14 +954,14 @@
 	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
 	;;
     or32:Linux:*:*)
-    	echo or32-unknown-linux-gnu
-    	exit ;;
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
     padre:Linux:*:*)
 	echo sparc-unknown-linux-gnu
 	exit ;;
     parisc64:Linux:*:* | hppa64:Linux:*:*)
-    	echo hppa64-unknown-linux-gnu
-    	exit ;;
+	echo hppa64-unknown-linux-gnu
+	exit ;;
     parisc:Linux:*:* | hppa:Linux:*:*)
 	# Look for CPU level
 	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
@@ -969,13 +989,13 @@
 	echo ${UNAME_MACHINE}-unknown-linux-gnu
 	exit ;;
     tile*:Linux:*:*)
-	echo ${UNAME_MACHINE}-tilera-linux-gnu
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
 	exit ;;
     vax:Linux:*:*)
 	echo ${UNAME_MACHINE}-dec-linux-gnu
 	exit ;;
     x86_64:Linux:*:*)
-	echo x86_64-unknown-linux-gnu
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
 	exit ;;
     xtensa*:Linux:*:*)
 	echo ${UNAME_MACHINE}-unknown-linux-gnu
@@ -1093,7 +1113,7 @@
 	  && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
     3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
 	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
-	   && { echo i486-ncr-sysv4; exit; } ;;
+	  && { echo i486-ncr-sysv4; exit; } ;;
     NCR*:*:4.2:* | MPRAS*:*:4.2:*)
 	OS_REL='.3'
 	test -r /etc/.relid \
@@ -1136,8 +1156,8 @@
 		echo ns32k-sni-sysv
 	fi
 	exit ;;
-    PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
-	              # says <Richard.M.Bartel@ccMail.Census.GOV>
+    PENTIUM:*:4.0*:*)	# Unisys `ClearPath HMP IX 4000' SVR4/MP effort
+			# says <Richard.M.Bartel@ccMail.Census.GOV>
 	echo i586-unisys-sysv4
 	exit ;;
     *:UNIX_System_V:4*:FTX*)
@@ -1165,9 +1185,9 @@
 	exit ;;
     R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
 	if [ -d /usr/nec ]; then
-	        echo mips-nec-sysv${UNAME_RELEASE}
+		echo mips-nec-sysv${UNAME_RELEASE}
 	else
-	        echo mips-unknown-sysv${UNAME_RELEASE}
+		echo mips-unknown-sysv${UNAME_RELEASE}
 	fi
 	exit ;;
     BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
@@ -1182,6 +1202,9 @@
     BePC:Haiku:*:*)	# Haiku running on Intel PC compatible.
 	echo i586-pc-haiku
 	exit ;;
+    x86_64:Haiku:*:*)
+	echo x86_64-unknown-haiku
+	exit ;;
     SX-4:SUPER-UX:*:*)
 	echo sx4-nec-superux${UNAME_RELEASE}
 	exit ;;
@@ -1212,12 +1235,12 @@
 	    i386)
 		eval $set_cc_for_build
 		if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
-		    if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
-			(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
-			grep IS_64BIT_ARCH >/dev/null
-		    then
-			UNAME_PROCESSOR="x86_64"
-		    fi
+		  if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
+		      (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
+		      grep IS_64BIT_ARCH >/dev/null
+		  then
+		      UNAME_PROCESSOR="x86_64"
+		  fi
 		fi ;;
 	    unknown) UNAME_PROCESSOR=powerpc ;;
 	esac
@@ -1226,8 +1249,8 @@
     *:procnto*:*:* | *:QNX:[0123456789]*:*)
 	UNAME_PROCESSOR=`uname -p`
 	if test "$UNAME_PROCESSOR" = "x86"; then
-	    UNAME_PROCESSOR=i386
-	    UNAME_MACHINE=pc
+		UNAME_PROCESSOR=i386
+		UNAME_MACHINE=pc
 	fi
 	echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
 	exit ;;
@@ -1237,7 +1260,7 @@
     NEO-?:NONSTOP_KERNEL:*:*)
 	echo neo-tandem-nsk${UNAME_RELEASE}
 	exit ;;
-    NSE-?:NONSTOP_KERNEL:*:*)
+    NSE-*:NONSTOP_KERNEL:*:*)
 	echo nse-tandem-nsk${UNAME_RELEASE}
 	exit ;;
     NSR-?:NONSTOP_KERNEL:*:*)
@@ -1306,11 +1329,11 @@
     i*86:AROS:*:*)
 	echo ${UNAME_MACHINE}-pc-aros
 	exit ;;
+    x86_64:VMkernel:*:*)
+	echo ${UNAME_MACHINE}-unknown-esx
+	exit ;;
 esac
 
-#echo '(No uname command or uname output not recognized.)' 1>&2
-#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
-
 eval $set_cc_for_build
 cat >$dummy.c <<EOF
 #ifdef _SEQUENT_
@@ -1328,11 +1351,11 @@
 #include <sys/param.h>
   printf ("m68k-sony-newsos%s\n",
 #ifdef NEWSOS4
-          "4"
+	"4"
 #else
-	  ""
+	""
 #endif
-         ); exit (0);
+	); exit (0);
 #endif
 #endif
 
Index: config.sub
--- ncurses-5.9/config.sub	2010-09-10 22:25:58.000000000 +0000
+++ ncurses-5.9-20130504/config.sub	2013-02-10 14:28:47.000000000 +0000
@@ -1,38 +1,31 @@
 #! /bin/sh
 # Configuration validation subroutine script.
-#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
-#   Free Software Foundation, Inc.
-
-timestamp='2010-09-11'
-
-# This file is (in principle) common to ALL GNU software.
-# The presence of a machine in this file suggests that SOME GNU software
-# can handle that machine.  It does not imply ALL GNU software can.
-#
-# This file is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
+#   Copyright 1992-2013 Free Software Foundation, Inc.
+
+timestamp='2013-02-04'
+
+# This file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
 # (at your option) any later version.
 #
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
 #
 # You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
-# 02110-1301, USA.
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
 #
 # As a special exception to the GNU General Public License, if you
 # distribute this file as part of a program that contains a
 # configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
+# the same distribution terms that you use for the rest of that
+# program.  This Exception is an additional permission under section 7
+# of the GNU General Public License, version 3 ("GPLv3").
 
 
-# Please send patches to <config-patches@gnu.org>.  Submit a context
-# diff and a properly formatted GNU ChangeLog entry.
+# Please send patches with a ChangeLog entry to config-patches@gnu.org.
 #
 # Configuration subroutine to validate and canonicalize a configuration type.
 # Supply the specified configuration type as an argument.
@@ -75,9 +68,7 @@
 version="\
 GNU config.sub ($timestamp)
 
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free
-Software Foundation, Inc.
+Copyright 1992-2013 Free Software Foundation, Inc.
 
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -125,13 +116,17 @@
 maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
 case $maybe_os in
   nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
-  linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
+  linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
   knetbsd*-gnu* | netbsd*-gnu* | \
   kopensolaris*-gnu* | \
   storm-chaos* | os2-emx* | rtmk-nova*)
     os=-$maybe_os
     basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
     ;;
+  android-linux)
+    os=-linux-android
+    basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown
+    ;;
   *)
     basic_machine=`echo $1 | sed 's/-[^-]*$//'`
     if [ $basic_machine != $1 ]
@@ -154,7 +149,7 @@
 	-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
 	-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
 	-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
-	-apple | -axis | -knuth | -cray | -microblaze)
+	-apple | -axis | -knuth | -cray | -microblaze*)
 		os=
 		basic_machine=$1
 		;;
@@ -175,10 +170,10 @@
 		os=-chorusos
 		basic_machine=$1
 		;;
- 	-chorusrdb)
- 		os=-chorusrdb
+	-chorusrdb)
+		os=-chorusrdb
 		basic_machine=$1
- 		;;
+		;;
 	-hiux*)
 		os=-hiuxwe2
 		;;
@@ -223,6 +218,12 @@
 	-isc*)
 		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
 		;;
+	-lynx*178)
+		os=-lynxos178
+		;;
+	-lynx*5)
+		os=-lynxos5
+		;;
 	-lynx*)
 		os=-lynxos
 		;;
@@ -247,20 +248,27 @@
 	# Some are omitted here because they have special meanings below.
 	1750a | 580 \
 	| a29k \
+	| aarch64 | aarch64_be \
 	| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
 	| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
 	| am33_2.0 \
-	| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
+	| arc \
+	| arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \
+	| avr | avr32 \
+	| be32 | be64 \
 	| bfin \
 	| c4x | clipper \
 	| d10v | d30v | dlx | dsp16xx \
+	| epiphany \
 	| fido | fr30 | frv \
 	| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
+	| hexagon \
 	| i370 | i860 | i960 | ia64 \
 	| ip2k | iq2000 \
+	| le32 | le64 \
 	| lm32 \
 	| m32c | m32r | m32rle | m68000 | m68k | m88k \
-	| maxq | mb | microblaze | mcore | mep | metag \
+	| maxq | mb | microblaze | microblazeel | mcore | mep | metag \
 	| mips | mipsbe | mipseb | mipsel | mipsle \
 	| mips16 \
 	| mips64 | mips64el \
@@ -278,30 +286,32 @@
 	| mipsisa64r2 | mipsisa64r2el \
 	| mipsisa64sb1 | mipsisa64sb1el \
 	| mipsisa64sr71k | mipsisa64sr71kel \
+	| mipsr5900 | mipsr5900el \
 	| mipstx39 | mipstx39el \
 	| mn10200 | mn10300 \
 	| moxie \
 	| mt \
 	| msp430 \
-	| nds32 | nds32le | nds32be\
-	| nios | nios2 \
+	| nds32 | nds32le | nds32be \
+	| nios | nios2 | nios2eb | nios2el \
 	| ns16k | ns32k \
+	| open8 \
 	| or32 \
 	| pdp10 | pdp11 | pj | pjl \
-	| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
+	| powerpc | powerpc64 | powerpc64le | powerpcle \
 	| pyramid \
-	| rx \
+	| rl78 | rx \
 	| score \
 	| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
 	| sh64 | sh64le \
 	| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
 	| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
-	| spu | strongarm \
-	| tahoe | thumb | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
+	| spu \
+	| tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
 	| ubicom32 \
-	| v850 | v850e \
+	| v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
 	| we32k \
-	| x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \
+	| x86 | xc16x | xstormy16 | xtensa \
 	| z8k | z80)
 		basic_machine=$basic_machine-unknown
 		;;
@@ -314,8 +324,7 @@
 	c6x)
 		basic_machine=tic6x-unknown
 		;;
-	m6811 | m68hc11 | m6812 | m68hc12 | picochip)
-		# Motorola 68HC11/12.
+	m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip)
 		basic_machine=$basic_machine-unknown
 		os=-none
 		;;
@@ -325,12 +334,27 @@
 		basic_machine=mt-unknown
 		;;
 
+	strongarm | thumb | xscale)
+		basic_machine=arm-unknown
+		;;
+	xgate)
+		basic_machine=$basic_machine-unknown
+		os=-none
+		;;
+	xscaleeb)
+		basic_machine=armeb-unknown
+		;;
+
+	xscaleel)
+		basic_machine=armel-unknown
+		;;
+
 	# We use `pc' rather than `unknown'
 	# because (1) that's what they normally are, and
 	# (2) the word "unknown" tends to confuse beginning users.
 	i*86 | x86_64)
-		basic_machine=$basic_machine-pc
-		;;
+	  basic_machine=$basic_machine-pc
+	  ;;
 	# Object if more than one company name word.
 	*-*-*)
 		echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
@@ -339,11 +363,13 @@
 	# Recognize the basic CPU types with company name.
 	580-* \
 	| a29k-* \
+	| aarch64-* | aarch64_be-* \
 	| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
 	| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
 	| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
 	| arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
 	| avr-* | avr32-* \
+	| be32-* | be64-* \
 	| bfin-* | bs2000-* \
 	| c[123]* | c30-* | [cjt]90-* | c4x-* \
 	| clipper-* | craynv-* | cydra-* \
@@ -352,12 +378,15 @@
 	| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
 	| h8300-* | h8500-* \
 	| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
+	| hexagon-* \
 	| i*86-* | i860-* | i960-* | ia64-* \
 	| ip2k-* | iq2000-* \
+	| le32-* | le64-* \
 	| lm32-* \
 	| m32c-* | m32r-* | m32rle-* \
 	| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
-	| m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \
+	| m88110-* | m88k-* | maxq-* | mcore-* | metag-* \
+	| microblaze-* | microblazeel-* \
 	| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
 	| mips16-* \
 	| mips64-* | mips64el-* \
@@ -375,31 +404,34 @@
 	| mipsisa64r2-* | mipsisa64r2el-* \
 	| mipsisa64sb1-* | mipsisa64sb1el-* \
 	| mipsisa64sr71k-* | mipsisa64sr71kel-* \
+	| mipsr5900-* | mipsr5900el-* \
 	| mipstx39-* | mipstx39el-* \
 	| mmix-* \
 	| mt-* \
 	| msp430-* \
 	| nds32-* | nds32le-* | nds32be-* \
-	| nios-* | nios2-* \
+	| nios-* | nios2-* | nios2eb-* | nios2el-* \
 	| none-* | np1-* | ns16k-* | ns32k-* \
+	| open8-* \
 	| orion-* \
 	| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
-	| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
+	| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
 	| pyramid-* \
-	| romp-* | rs6000-* | rx-* \
+	| rl78-* | romp-* | rs6000-* | rx-* \
 	| sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
 	| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
 	| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
 	| sparclite-* \
-	| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \
-	| tahoe-* | thumb-* \
+	| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \
+	| tahoe-* \
 	| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
-	| tile-* | tilegx-* \
+	| tile*-* \
 	| tron-* \
 	| ubicom32-* \
-	| v850-* | v850e-* | vax-* \
+	| v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
+	| vax-* \
 	| we32k-* \
-	| x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
+	| x86-* | x86_64-* | xc16x-* | xps100-* \
 	| xstormy16-* | xtensa*-* \
 	| ymp-* \
 	| z8k-* | z80-*)
@@ -539,7 +571,7 @@
 		basic_machine=craynv-cray
 		os=-unicosmp
 		;;
-	cr16)
+	cr16 | cr16-*)
 		basic_machine=cr16-unknown
 		os=-elf
 		;;
@@ -697,7 +729,6 @@
 	i370-ibm* | ibm*)
 		basic_machine=i370-ibm
 		;;
-# I'm not sure what "Sysv32" means.  Should this be sysv3.2?
 	i*86v32)
 		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
 		os=-sysv32
@@ -755,9 +786,13 @@
 		basic_machine=ns32k-utek
 		os=-sysv
 		;;
-	microblaze)
+	microblaze*)
 		basic_machine=microblaze-xilinx
 		;;
+	mingw64)
+		basic_machine=x86_64-pc
+		os=-mingw64
+		;;
 	mingw32)
 		basic_machine=i386-pc
 		os=-mingw32
@@ -794,10 +829,18 @@
 	ms1-*)
 		basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
 		;;
+	msys)
+		basic_machine=i386-pc
+		os=-msys
+		;;
 	mvs)
 		basic_machine=i370-ibm
 		os=-mvs
 		;;
+	nacl)
+		basic_machine=le32-unknown
+		os=-nacl
+		;;
 	ncr3000)
 		basic_machine=i486-ncr
 		os=-sysv4
@@ -950,9 +993,10 @@
 		;;
 	power)	basic_machine=power-ibm
 		;;
-	ppc)	basic_machine=powerpc-unknown
+	ppc | ppcbe)	basic_machine=powerpc-unknown
 		;;
-	ppc-*)	basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
+	ppc-* | ppcbe-*)
+		basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
 		;;
 	ppcle | powerpclittle | ppc-le | powerpc-little)
 		basic_machine=powerpcle-unknown
@@ -977,7 +1021,11 @@
 		basic_machine=i586-unknown
 		os=-pw32
 		;;
-	rdos)
+	rdos | rdos64)
+		basic_machine=x86_64-pc
+		os=-rdos
+		;;
+	rdos32)
 		basic_machine=i386-pc
 		os=-rdos
 		;;
@@ -1046,6 +1094,9 @@
 		basic_machine=i860-stratus
 		os=-sysv4
 		;;
+	strongarm-* | thumb-*)
+		basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
 	sun2)
 		basic_machine=m68000-sun
 		;;
@@ -1102,13 +1153,8 @@
 		basic_machine=t90-cray
 		os=-unicos
 		;;
-	# This must be matched before tile*.
-	tilegx*)
-		basic_machine=tilegx-unknown
-		os=-linux-gnu
-		;;
 	tile*)
-		basic_machine=tile-unknown
+		basic_machine=$basic_machine-unknown
 		os=-linux-gnu
 		;;
 	tx39)
@@ -1178,6 +1224,9 @@
 	xps | xps100)
 		basic_machine=xps100-honeywell
 		;;
+	xscale-* | xscalee[bl]-*)
+		basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'`
+		;;
 	ymp)
 		basic_machine=ymp-cray
 		os=-unicos
@@ -1303,21 +1352,21 @@
 	-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
 	      | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
 	      | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
-	      | -sym* | -kopensolaris* \
+	      | -sym* | -kopensolaris* | -plan9* \
 	      | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
 	      | -aos* | -aros* \
 	      | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
 	      | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
 	      | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
-	      | -openbsd* | -solidbsd* \
+	      | -bitrig* | -openbsd* | -solidbsd* \
 	      | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
 	      | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
 	      | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
 	      | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
 	      | -chorusos* | -chorusrdb* | -cegcc* \
-	      | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
-	      | -mingw32* | -linux-gnu* | -linux-android* \
-	      | -linux-newlib* | -linux-uclibc* \
+	      | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
+	      | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
+	      | -linux-newlib* | -linux-musl* | -linux-uclibc* \
 	      | -uxpv* | -beos* | -mpeix* | -udk* \
 	      | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
 	      | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
@@ -1449,9 +1498,6 @@
 	-aros*)
 		os=-aros
 		;;
-	-kaos*)
-		os=-kaos
-		;;
 	-zvmoe)
 		os=-zvmoe
 		;;
@@ -1500,6 +1546,9 @@
 	c4x-* | tic4x-*)
 		os=-coff
 		;;
+	hexagon-*)
+		os=-elf
+		;;
 	tic54x-*)
 		os=-coff
 		;;
@@ -1527,9 +1576,6 @@
 		;;
 	m68000-sun)
 		os=-sunos3
-		# This also exists in the configure program, but was not the
-		# default.
-		# os=-sunos4
 		;;
 	m68*-cisco)
 		os=-aout
Index: configure
--- ncurses-5.9/configure	2011-03-31 23:35:51.000000000 +0000
+++ ncurses-5.9-20130504/configure	2013-04-27 19:50:56.000000000 +0000
@@ -1,7 +1,7 @@
 #! /bin/sh
-# From configure.in Revision: 1.520 .
+# From configure.in Revision: 1.565 .
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by Autoconf 2.52.20101002.
+# Generated by Autoconf 2.52.20121002.
 #
 # Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001
 # Free Software Foundation, Inc.
@@ -171,15 +171,16 @@
 bindir='${exec_prefix}/bin'
 sbindir='${exec_prefix}/sbin'
 libexecdir='${exec_prefix}/libexec'
-datadir='${prefix}/share'
+datarootdir='${prefix}/share'
+datadir='${datarootdir}'
 sysconfdir='${prefix}/etc'
 sharedstatedir='${prefix}/com'
 localstatedir='${prefix}/var'
 libdir='${exec_prefix}/lib'
 includedir='${prefix}/include'
 oldincludedir='/usr/include'
-infodir='${prefix}/info'
-mandir='${prefix}/man'
+infodir='${datarootdir}/info'
+mandir='${datarootdir}/man'
 
 # Identity of this package.
 PACKAGE_NAME=
@@ -230,6 +231,13 @@
   | --da=*)
     datadir=$ac_optarg ;;
 
+  -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \
+  | --dataroo | --dataro | --datar)
+    ac_prev=datarootdir ;;
+  -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \
+  | --dataroot=* | --dataroo=* | --dataro=* | --datar=*)
+    datarootdir=$ac_optarg ;;
+
   -disable-* | --disable-*)
     ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
     # Reject names that are not valid shell variable names.
@@ -505,7 +513,7 @@
 done
 
 # Be sure to have absolute paths.
-for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \
+for ac_var in bindir sbindir libexecdir datarootdir datadir sysconfdir sharedstatedir \
               localstatedir libdir includedir oldincludedir infodir mandir
 do
   eval ac_val=$`echo $ac_var`
@@ -654,15 +662,16 @@
   --bindir=DIR            user executables [EPREFIX/bin]
   --sbindir=DIR           system admin executables [EPREFIX/sbin]
   --libexecdir=DIR        program executables [EPREFIX/libexec]
-  --datadir=DIR           read-only architecture-independent data [PREFIX/share]
+  --datarootdir=DIR       read-only architecture-independent data [PREFIX/share]
+  --datadir=DIR           read-only architecture-independent data [DATAROOTDIR]
   --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
   --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
   --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
   --libdir=DIR            object code libraries [EPREFIX/lib]
   --includedir=DIR        C header files [PREFIX/include]
   --oldincludedir=DIR     C header files for non-gcc [/usr/include]
-  --infodir=DIR           info documentation [PREFIX/info]
-  --mandir=DIR            man documentation [PREFIX/man]
+  --infodir=DIR           info documentation [DATAROOTDIR/info]
+  --mandir=DIR            man documentation [DATAROOTDIR/man]
 EOF
 
   cat <<\EOF
@@ -694,14 +703,15 @@
   --with-rel-version=XXX  override derived release version
   --with-abi-version=XXX  override derived ABI version
   --with-system-type=XXX  test: override derived host system-type
+  --without-ada           suppress check for Ada95, don't build demo
   --without-cxx           do not adjust ncurses bool to match C++
   --without-cxx-binding   do not build C++ binding and demo
-  --without-ada           suppress check for Ada95, don't build demo
   --without-manpages      suppress install of manpages
   --without-progs         suppress build with programs (e.g., tic)
   --without-tests         suppress build with test-programs
   --without-curses-h      install curses.h as ncurses.h only
   --with-pkg-config{=path} enable/disable use of pkg-config
+  --with-pkg-config-libdir=XXX use given directory for installing pc-files
   --enable-pc-files       generate and install .pc files for pkg-config
   --enable-mixed-case     tic should assume mixed-case filenames
   --with-install-prefix   prefixes actual install-location ($DESTDIR)
@@ -719,6 +729,8 @@
   --with-normal           generate normal-libraries (default)
   --with-debug            generate debug-libraries (default)
   --with-profile          generate profile-libraries
+  --with-cxx-shared       generate C++ shared-libraries
+  --with-lib-prefix       override library-prefix
   --with-termlib          generate separate terminfo library
   --with-ticlib           generate separate tic library
   --with-gpm              use Alessandro Rubini's GPM library
@@ -735,6 +747,7 @@
   --with-hashed-db        specify hashed-database library
   --with-fallbacks=XXX    specify list of fallback terminal descriptions
   --without-xterm-new     specify if xterm terminfo should be old version
+  --with-xterm-kbs=XXX    specify if xterm backspace sends BS or DEL
   --with-terminfo-dirs=XXX specify list of terminfo directories (default: DATADIR/terminfo)
   --with-default-terminfo-dir=DIR default terminfo directory (default: DATADIR/terminfo)
   --disable-big-core      assume machine has little memory
@@ -759,6 +772,7 @@
   --with-ospeed=TYPE      override type of ospeed variable
   --with-mmask-t=TYPE     override type of mmask_t
   --with-ccharw-max=XXX   override size CCHARW_MAX
+  --with-tparm-arg=TYPE   override parameter type of tparm
   --with-rcs-ids          compile-in RCS identifiers
 Options to Specify How Manpages are Installed:
   --with-manpage-format   specify manpage-format: gzip/compress/BSDI/normal and
@@ -796,8 +810,9 @@
   --disable-scroll-hints  compile without scroll-hints code
   --enable-wgetch-events  compile with experimental wgetch-events code
 Testing/development Options:
-  --enable-echo           build: display "compiling" commands (default)
+  --disable-echo          do not display "compiling" commands
   --enable-warnings       build: turn on GCC compiler warnings
+  --enable-string-hacks   work around bogus compiler/loader warnings
   --enable-assertions     test: turn on generation of assertion code
   --with-dmalloc          test: use Gray Watson's dmalloc library
   --with-dbmalloc         test: use Conor Cahill's dbmalloc library
@@ -883,7 +898,7 @@
 running configure, to aid debugging if configure makes a mistake.
 
 It was created by $as_me, which was
-generated by GNU Autoconf 2.52.20101002.  Invocation command line was
+generated by GNU Autoconf 2.52.20121002.  Invocation command line was
 
   $ $0 $@
 
@@ -1007,7 +1022,7 @@
 fi
 for ac_site_file in $CONFIG_SITE; do
   if test -r "$ac_site_file"; then
-    { echo "$as_me:1010: loading site script $ac_site_file" >&5
+    { echo "$as_me:1025: loading site script $ac_site_file" >&5
 echo "$as_me: loading site script $ac_site_file" >&6;}
     cat "$ac_site_file" >&5
     . "$ac_site_file"
@@ -1018,7 +1033,7 @@
   # Some versions of bash will fail to source /dev/null (special
   # files actually), so we avoid doing that.
   if test -f "$cache_file"; then
-    { echo "$as_me:1021: loading cache $cache_file" >&5
+    { echo "$as_me:1036: loading cache $cache_file" >&5
 echo "$as_me: loading cache $cache_file" >&6;}
     case $cache_file in
       [\\/]* | ?:[\\/]* ) . $cache_file;;
@@ -1026,7 +1041,7 @@
     esac
   fi
 else
-  { echo "$as_me:1029: creating cache $cache_file" >&5
+  { echo "$as_me:1044: creating cache $cache_file" >&5
 echo "$as_me: creating cache $cache_file" >&6;}
   >$cache_file
 fi
@@ -1042,21 +1057,21 @@
   eval ac_new_val="\$ac_env_${ac_var}_value"
   case $ac_old_set,$ac_new_set in
     set,)
-      { echo "$as_me:1045: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
+      { echo "$as_me:1060: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
 echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
       ac_cache_corrupted=: ;;
     ,set)
-      { echo "$as_me:1049: error: \`$ac_var' was not set in the previous run" >&5
+      { echo "$as_me:1064: error: \`$ac_var' was not set in the previous run" >&5
 echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
       ac_cache_corrupted=: ;;
     ,);;
     *)
       if test "x$ac_old_val" != "x$ac_new_val"; then
-        { echo "$as_me:1055: error: \`$ac_var' has changed since the previous run:" >&5
+        { echo "$as_me:1070: error: \`$ac_var' has changed since the previous run:" >&5
 echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
-        { echo "$as_me:1057:   former value:  $ac_old_val" >&5
+        { echo "$as_me:1072:   former value:  $ac_old_val" >&5
 echo "$as_me:   former value:  $ac_old_val" >&2;}
-        { echo "$as_me:1059:   current value: $ac_new_val" >&5
+        { echo "$as_me:1074:   current value: $ac_new_val" >&5
 echo "$as_me:   current value: $ac_new_val" >&2;}
         ac_cache_corrupted=:
       fi;;
@@ -1075,9 +1090,9 @@
   fi
 done
 if $ac_cache_corrupted; then
-  { echo "$as_me:1078: error: changes in the environment can compromise the build" >&5
+  { echo "$as_me:1093: error: changes in the environment can compromise the build" >&5
 echo "$as_me: error: changes in the environment can compromise the build" >&2;}
-  { { echo "$as_me:1080: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
+  { { echo "$as_me:1095: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
 echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;}
    { (exit 1); exit 1; }; }
 fi
@@ -1098,10 +1113,10 @@
 echo "#! $SHELL" >conftest.sh
 echo  "exit 0"   >>conftest.sh
 chmod +x conftest.sh
-if { (echo "$as_me:1101: PATH=\".;.\"; conftest.sh") >&5
+if { (echo "$as_me:1116: PATH=\".;.\"; conftest.sh") >&5
   (PATH=".;."; conftest.sh) 2>&5
   ac_status=$?
-  echo "$as_me:1104: \$? = $ac_status" >&5
+  echo "$as_me:1119: \$? = $ac_status" >&5
   (exit $ac_status); }; then
   ac_path_separator=';'
 else
@@ -1114,7 +1129,7 @@
 
 top_builddir=`pwd`
 
-echo "$as_me:1117: checking for egrep" >&5
+echo "$as_me:1132: checking for egrep" >&5
 echo $ECHO_N "checking for egrep... $ECHO_C" >&6
 if test "${ac_cv_prog_egrep+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -1124,11 +1139,11 @@
     else ac_cv_prog_egrep='egrep'
     fi
 fi
-echo "$as_me:1127: result: $ac_cv_prog_egrep" >&5
+echo "$as_me:1142: result: $ac_cv_prog_egrep" >&5
 echo "${ECHO_T}$ac_cv_prog_egrep" >&6
  EGREP=$ac_cv_prog_egrep
 
-test -z "$EGREP" && { { echo "$as_me:1131: error: No egrep program found" >&5
+test -z "$EGREP" && { { echo "$as_me:1146: error: No egrep program found" >&5
 echo "$as_me: error: No egrep program found" >&2;}
    { (exit 1); exit 1; }; }
 
@@ -1138,7 +1153,7 @@
 cf_cv_abi_version=${NCURSES_MAJOR}
 cf_cv_rel_version=${NCURSES_MAJOR}.${NCURSES_MINOR}
 cf_cv_timestamp=`date`
-echo "$as_me:1141: result: Configuring NCURSES $cf_cv_rel_version ABI $cf_cv_abi_version ($cf_cv_timestamp)" >&5
+echo "$as_me:1156: result: Configuring NCURSES $cf_cv_rel_version ABI $cf_cv_abi_version ($cf_cv_timestamp)" >&5
 echo "${ECHO_T}Configuring NCURSES $cf_cv_rel_version ABI $cf_cv_abi_version ($cf_cv_timestamp)" >&6
 
 test -z "$cf_cv_rel_version" && cf_cv_rel_version=0.0
@@ -1146,7 +1161,7 @@
 # Check whether --with-rel-version or --without-rel-version was given.
 if test "${with_rel_version+set}" = set; then
   withval="$with_rel_version"
-  { echo "$as_me:1149: WARNING: overriding release version $cf_cv_rel_version to $withval" >&5
+  { echo "$as_me:1164: WARNING: overriding release version $cf_cv_rel_version to $withval" >&5
 echo "$as_me: WARNING: overriding release version $cf_cv_rel_version to $withval" >&2;}
  cf_cv_rel_version=$withval
 fi;
@@ -1159,13 +1174,13 @@
   [0-9]*) #(vi
  	;;
   *)
-	{ { echo "$as_me:1162: error: Release major-version is not a number: $NCURSES_MAJOR" >&5
+	{ { echo "$as_me:1177: error: Release major-version is not a number: $NCURSES_MAJOR" >&5
 echo "$as_me: error: Release major-version is not a number: $NCURSES_MAJOR" >&2;}
    { (exit 1); exit 1; }; }
  	;;
   esac
 else
-  { { echo "$as_me:1168: error: Release major-version value is empty" >&5
+  { { echo "$as_me:1183: error: Release major-version value is empty" >&5
 echo "$as_me: error: Release major-version value is empty" >&2;}
    { (exit 1); exit 1; }; }
 fi
@@ -1175,13 +1190,13 @@
   [0-9]*) #(vi
  	;;
   *)
-	{ { echo "$as_me:1178: error: Release minor-version is not a number: $NCURSES_MINOR" >&5
+	{ { echo "$as_me:1193: error: Release minor-version is not a number: $NCURSES_MINOR" >&5
 echo "$as_me: error: Release minor-version is not a number: $NCURSES_MINOR" >&2;}
    { (exit 1); exit 1; }; }
  	;;
   esac
 else
-  { { echo "$as_me:1184: error: Release minor-version value is empty" >&5
+  { { echo "$as_me:1199: error: Release minor-version value is empty" >&5
 echo "$as_me: error: Release minor-version value is empty" >&2;}
    { (exit 1); exit 1; }; }
 fi
@@ -1191,7 +1206,7 @@
 # Check whether --with-abi-version or --without-abi-version was given.
 if test "${with_abi_version+set}" = set; then
   withval="$with_abi_version"
-  { echo "$as_me:1194: WARNING: overriding ABI version $cf_cv_abi_version to $withval" >&5
+  { echo "$as_me:1209: WARNING: overriding ABI version $cf_cv_abi_version to $withval" >&5
 echo "$as_me: WARNING: overriding ABI version $cf_cv_abi_version to $withval" >&2;}
  cf_cv_abi_version=$withval
 fi;
@@ -1201,13 +1216,13 @@
   [0-9]*) #(vi
  	;;
   *)
-	{ { echo "$as_me:1204: error: ABI version is not a number: $cf_cv_abi_version" >&5
+	{ { echo "$as_me:1219: error: ABI version is not a number: $cf_cv_abi_version" >&5
 echo "$as_me: error: ABI version is not a number: $cf_cv_abi_version" >&2;}
    { (exit 1); exit 1; }; }
  	;;
   esac
 else
-  { { echo "$as_me:1210: error: ABI version value is empty" >&5
+  { { echo "$as_me:1225: error: ABI version value is empty" >&5
 echo "$as_me: error: ABI version value is empty" >&2;}
    { (exit 1); exit 1; }; }
 fi
@@ -1229,7 +1244,7 @@
   fi
 done
 if test -z "$ac_aux_dir"; then
-  { { echo "$as_me:1232: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5
+  { { echo "$as_me:1247: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5
 echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;}
    { (exit 1); exit 1; }; }
 fi
@@ -1239,11 +1254,11 @@
 
 # Make sure we can run config.sub.
 $ac_config_sub sun4 >/dev/null 2>&1 ||
-  { { echo "$as_me:1242: error: cannot run $ac_config_sub" >&5
+  { { echo "$as_me:1257: error: cannot run $ac_config_sub" >&5
 echo "$as_me: error: cannot run $ac_config_sub" >&2;}
    { (exit 1); exit 1; }; }
 
-echo "$as_me:1246: checking build system type" >&5
+echo "$as_me:1261: checking build system type" >&5
 echo $ECHO_N "checking build system type... $ECHO_C" >&6
 if test "${ac_cv_build+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -1252,23 +1267,23 @@
 test -z "$ac_cv_build_alias" &&
   ac_cv_build_alias=`$ac_config_guess`
 test -z "$ac_cv_build_alias" &&
-  { { echo "$as_me:1255: error: cannot guess build type; you must specify one" >&5
+  { { echo "$as_me:1270: error: cannot guess build type; you must specify one" >&5
 echo "$as_me: error: cannot guess build type; you must specify one" >&2;}
    { (exit 1); exit 1; }; }
 ac_cv_build=`$ac_config_sub $ac_cv_build_alias` ||
-  { { echo "$as_me:1259: error: $ac_config_sub $ac_cv_build_alias failed." >&5
+  { { echo "$as_me:1274: error: $ac_config_sub $ac_cv_build_alias failed." >&5
 echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed." >&2;}
    { (exit 1); exit 1; }; }
 
 fi
-echo "$as_me:1264: result: $ac_cv_build" >&5
+echo "$as_me:1279: result: $ac_cv_build" >&5
 echo "${ECHO_T}$ac_cv_build" >&6
 build=$ac_cv_build
 build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
 build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
 build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
 
-echo "$as_me:1271: checking host system type" >&5
+echo "$as_me:1286: checking host system type" >&5
 echo $ECHO_N "checking host system type... $ECHO_C" >&6
 if test "${ac_cv_host+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -1277,12 +1292,12 @@
 test -z "$ac_cv_host_alias" &&
   ac_cv_host_alias=$ac_cv_build_alias
 ac_cv_host=`$ac_config_sub $ac_cv_host_alias` ||
-  { { echo "$as_me:1280: error: $ac_config_sub $ac_cv_host_alias failed" >&5
+  { { echo "$as_me:1295: error: $ac_config_sub $ac_cv_host_alias failed" >&5
 echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;}
    { (exit 1); exit 1; }; }
 
 fi
-echo "$as_me:1285: result: $ac_cv_host" >&5
+echo "$as_me:1300: result: $ac_cv_host" >&5
 echo "${ECHO_T}$ac_cv_host" >&6
 host=$ac_cv_host
 host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
@@ -1290,7 +1305,7 @@
 host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
 
 if test -f $srcdir/config.guess || test -f $ac_aux_dir/config.guess ; then
-	echo "$as_me:1293: checking target system type" >&5
+	echo "$as_me:1308: checking target system type" >&5
 echo $ECHO_N "checking target system type... $ECHO_C" >&6
 if test "${ac_cv_target+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -1299,12 +1314,12 @@
 test "x$ac_cv_target_alias" = "x" &&
   ac_cv_target_alias=$ac_cv_host_alias
 ac_cv_target=`$ac_config_sub $ac_cv_target_alias` ||
-  { { echo "$as_me:1302: error: $ac_config_sub $ac_cv_target_alias failed" >&5
+  { { echo "$as_me:1317: error: $ac_config_sub $ac_cv_target_alias failed" >&5
 echo "$as_me: error: $ac_config_sub $ac_cv_target_alias failed" >&2;}
    { (exit 1); exit 1; }; }
 
 fi
-echo "$as_me:1307: result: $ac_cv_target" >&5
+echo "$as_me:1322: result: $ac_cv_target" >&5
 echo "${ECHO_T}$ac_cv_target" >&6
 target=$ac_cv_target
 target_cpu=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
@@ -1324,7 +1339,8 @@
 		system_name="`(hostname) 2>/dev/null`"
 	fi
 fi
-test -n "$system_name" && cat >>confdefs.h <<EOF
+test -n "$system_name" &&
+cat >>confdefs.h <<EOF
 #define SYSTEM_NAME "$system_name"
 EOF
 
@@ -1335,13 +1351,13 @@
 fi
 
 test -z "$system_name" && system_name="$cf_cv_system_name"
-test -n "$cf_cv_system_name" && echo "$as_me:1338: result: Configuring for $cf_cv_system_name" >&5
+test -n "$cf_cv_system_name" && echo "$as_me:1354: result: Configuring for $cf_cv_system_name" >&5
 echo "${ECHO_T}Configuring for $cf_cv_system_name" >&6
 
 if test ".$system_name" != ".$cf_cv_system_name" ; then
-	echo "$as_me:1342: result: Cached system name ($system_name) does not agree with actual ($cf_cv_system_name)" >&5
+	echo "$as_me:1358: result: Cached system name ($system_name) does not agree with actual ($cf_cv_system_name)" >&5
 echo "${ECHO_T}Cached system name ($system_name) does not agree with actual ($cf_cv_system_name)" >&6
-	{ { echo "$as_me:1344: error: \"Please remove config.cache and try again.\"" >&5
+	{ { echo "$as_me:1360: error: \"Please remove config.cache and try again.\"" >&5
 echo "$as_me: error: \"Please remove config.cache and try again.\"" >&2;}
    { (exit 1); exit 1; }; }
 fi
@@ -1349,9 +1365,11 @@
 # Check whether --with-system-type or --without-system-type was given.
 if test "${with_system_type+set}" = set; then
   withval="$with_system_type"
-  { echo "$as_me:1352: WARNING: overriding system type to $withval" >&5
+  { echo "$as_me:1368: WARNING: overriding system type to $withval" >&5
 echo "$as_me: WARNING: overriding system type to $withval" >&2;}
- cf_cv_system_name=$withval
+	cf_cv_system_name=$withval
+	host_os=$withval
+
 fi;
 
 ###	Save the given $CFLAGS to allow user-override.
@@ -1359,23 +1377,23 @@
 
 ###	Default install-location
 
-echo "$as_me:1362: checking for prefix" >&5
+echo "$as_me:1380: checking for prefix" >&5
 echo $ECHO_N "checking for prefix... $ECHO_C" >&6
 if test "x$prefix" = "xNONE" ; then
 	case "$cf_cv_system_name" in
 		# non-vendor systems don't have a conflict
-	openbsd*|freebsd*|linux*|cygwin*|k*bsd*-gnu)
+	openbsd*|freebsd*|mirbsd*|linux*|cygwin*|k*bsd*-gnu|mingw*)
 		prefix=/usr
 		;;
 	*)	prefix=$ac_default_prefix
 		;;
 	esac
 fi
-echo "$as_me:1374: result: $prefix" >&5
+echo "$as_me:1392: result: $prefix" >&5
 echo "${ECHO_T}$prefix" >&6
 
 if test "x$prefix" = "xNONE" ; then
-echo "$as_me:1378: checking for default include-directory" >&5
+echo "$as_me:1396: checking for default include-directory" >&5
 echo $ECHO_N "checking for default include-directory... $ECHO_C" >&6
 test -n "$verbose" && echo 1>&6
 for cf_symbol in \
@@ -1398,11 +1416,26 @@
 	fi
 	test -n "$verbose"  && echo "	tested $cf_dir" 1>&6
 done
-echo "$as_me:1401: result: $includedir" >&5
+echo "$as_me:1419: result: $includedir" >&5
 echo "${ECHO_T}$includedir" >&6
 fi
 
 ###	Checks for programs.
+
+# Check whether --with-ada or --without-ada was given.
+if test "${with_ada+set}" = set; then
+  withval="$with_ada"
+  cf_with_ada=$withval
+else
+  cf_with_ada=yes
+fi;
+if test "x$cf_with_ada" = xyes
+then
+	cf_PROG_CC="gnatgcc gcc cc"
+else
+	cf_PROG_CC="gcc cc"
+fi
+
 ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -1410,213 +1443,11 @@
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
 ac_main_return=return
 if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
-set dummy ${ac_tool_prefix}gcc; ac_word=$2
-echo "$as_me:1415: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_CC+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  if test -n "$CC"; then
-  ac_cv_prog_CC="$CC" # Let the user override the test.
-else
-  ac_save_IFS=$IFS; IFS=$ac_path_separator
-ac_dummy="$PATH"
-for ac_dir in $ac_dummy; do
-  IFS=$ac_save_IFS
-  test -z "$ac_dir" && ac_dir=.
-  $as_executable_p "$ac_dir/$ac_word" || continue
-ac_cv_prog_CC="${ac_tool_prefix}gcc"
-echo "$as_me:1430: found $ac_dir/$ac_word" >&5
-break
-done
-
-fi
-fi
-CC=$ac_cv_prog_CC
-if test -n "$CC"; then
-  echo "$as_me:1438: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6
-else
-  echo "$as_me:1441: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
-fi
-if test -z "$ac_cv_prog_CC"; then
-  ac_ct_CC=$CC
-  # Extract the first word of "gcc", so it can be a program name with args.
-set dummy gcc; ac_word=$2
-echo "$as_me:1450: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  if test -n "$ac_ct_CC"; then
-  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
-else
-  ac_save_IFS=$IFS; IFS=$ac_path_separator
-ac_dummy="$PATH"
-for ac_dir in $ac_dummy; do
-  IFS=$ac_save_IFS
-  test -z "$ac_dir" && ac_dir=.
-  $as_executable_p "$ac_dir/$ac_word" || continue
-ac_cv_prog_ac_ct_CC="gcc"
-echo "$as_me:1465: found $ac_dir/$ac_word" >&5
-break
-done
-
-fi
-fi
-ac_ct_CC=$ac_cv_prog_ac_ct_CC
-if test -n "$ac_ct_CC"; then
-  echo "$as_me:1473: result: $ac_ct_CC" >&5
-echo "${ECHO_T}$ac_ct_CC" >&6
-else
-  echo "$as_me:1476: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
-  CC=$ac_ct_CC
-else
-  CC="$ac_cv_prog_CC"
-fi
-
-if test -z "$CC"; then
-  if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
-set dummy ${ac_tool_prefix}cc; ac_word=$2
-echo "$as_me:1489: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_CC+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  if test -n "$CC"; then
-  ac_cv_prog_CC="$CC" # Let the user override the test.
-else
-  ac_save_IFS=$IFS; IFS=$ac_path_separator
-ac_dummy="$PATH"
-for ac_dir in $ac_dummy; do
-  IFS=$ac_save_IFS
-  test -z "$ac_dir" && ac_dir=.
-  $as_executable_p "$ac_dir/$ac_word" || continue
-ac_cv_prog_CC="${ac_tool_prefix}cc"
-echo "$as_me:1504: found $ac_dir/$ac_word" >&5
-break
-done
-
-fi
-fi
-CC=$ac_cv_prog_CC
-if test -n "$CC"; then
-  echo "$as_me:1512: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6
-else
-  echo "$as_me:1515: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
-fi
-if test -z "$ac_cv_prog_CC"; then
-  ac_ct_CC=$CC
-  # Extract the first word of "cc", so it can be a program name with args.
-set dummy cc; ac_word=$2
-echo "$as_me:1524: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  if test -n "$ac_ct_CC"; then
-  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
-else
-  ac_save_IFS=$IFS; IFS=$ac_path_separator
-ac_dummy="$PATH"
-for ac_dir in $ac_dummy; do
-  IFS=$ac_save_IFS
-  test -z "$ac_dir" && ac_dir=.
-  $as_executable_p "$ac_dir/$ac_word" || continue
-ac_cv_prog_ac_ct_CC="cc"
-echo "$as_me:1539: found $ac_dir/$ac_word" >&5
-break
-done
-
-fi
-fi
-ac_ct_CC=$ac_cv_prog_ac_ct_CC
-if test -n "$ac_ct_CC"; then
-  echo "$as_me:1547: result: $ac_ct_CC" >&5
-echo "${ECHO_T}$ac_ct_CC" >&6
-else
-  echo "$as_me:1550: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
-  CC=$ac_ct_CC
-else
-  CC="$ac_cv_prog_CC"
-fi
-
-fi
-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 "$as_me:1563: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_CC+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  if test -n "$CC"; then
-  ac_cv_prog_CC="$CC" # Let the user override the test.
-else
-  ac_prog_rejected=no
-  ac_save_IFS=$IFS; IFS=$ac_path_separator
-ac_dummy="$PATH"
-for ac_dir in $ac_dummy; do
-  IFS=$ac_save_IFS
-  test -z "$ac_dir" && ac_dir=.
-  $as_executable_p "$ac_dir/$ac_word" || continue
-if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then
-  ac_prog_rejected=yes
-  continue
-fi
-ac_cv_prog_CC="cc"
-echo "$as_me:1583: found $ac_dir/$ac_word" >&5
-break
-done
-
-if test $ac_prog_rejected = yes; then
-  # We found a bogon in the path, so make sure we never use it.
-  set dummy $ac_cv_prog_CC
-  shift
-  if test $# != 0; then
-    # We chose a different compiler from the bogus one.
-    # However, it has the same basename, so the bogon will be chosen
-    # first if we set CC to just the basename; use the full file name.
-    shift
-    set dummy "$ac_dir/$ac_word" ${1+"$@"}
-    shift
-    ac_cv_prog_CC="$@"
-  fi
-fi
-fi
-fi
-CC=$ac_cv_prog_CC
-if test -n "$CC"; then
-  echo "$as_me:1605: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6
-else
-  echo "$as_me:1608: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
-fi
-if test -z "$CC"; then
-  if test -n "$ac_tool_prefix"; then
-  for ac_prog in cl
+  for ac_prog in $cf_PROG_CC
   do
     # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
 set dummy $ac_tool_prefix$ac_prog; ac_word=$2
-echo "$as_me:1619: checking for $ac_word" >&5
+echo "$as_me:1450: checking for $ac_word" >&5
 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
 if test "${ac_cv_prog_CC+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -1631,7 +1462,7 @@
   test -z "$ac_dir" && ac_dir=.
   $as_executable_p "$ac_dir/$ac_word" || continue
 ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
-echo "$as_me:1634: found $ac_dir/$ac_word" >&5
+echo "$as_me:1465: found $ac_dir/$ac_word" >&5
 break
 done
 
@@ -1639,10 +1470,10 @@
 fi
 CC=$ac_cv_prog_CC
 if test -n "$CC"; then
-  echo "$as_me:1642: result: $CC" >&5
+  echo "$as_me:1473: result: $CC" >&5
 echo "${ECHO_T}$CC" >&6
 else
-  echo "$as_me:1645: result: no" >&5
+  echo "$as_me:1476: result: no" >&5
 echo "${ECHO_T}no" >&6
 fi
 
@@ -1651,11 +1482,11 @@
 fi
 if test -z "$CC"; then
   ac_ct_CC=$CC
-  for ac_prog in cl
+  for ac_prog in $cf_PROG_CC
 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 "$as_me:1658: checking for $ac_word" >&5
+echo "$as_me:1489: checking for $ac_word" >&5
 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -1670,7 +1501,7 @@
   test -z "$ac_dir" && ac_dir=.
   $as_executable_p "$ac_dir/$ac_word" || continue
 ac_cv_prog_ac_ct_CC="$ac_prog"
-echo "$as_me:1673: found $ac_dir/$ac_word" >&5
+echo "$as_me:1504: found $ac_dir/$ac_word" >&5
 break
 done
 
@@ -1678,10 +1509,10 @@
 fi
 ac_ct_CC=$ac_cv_prog_ac_ct_CC
 if test -n "$ac_ct_CC"; then
-  echo "$as_me:1681: result: $ac_ct_CC" >&5
+  echo "$as_me:1512: result: $ac_ct_CC" >&5
 echo "${ECHO_T}$ac_ct_CC" >&6
 else
-  echo "$as_me:1684: result: no" >&5
+  echo "$as_me:1515: result: no" >&5
 echo "${ECHO_T}no" >&6
 fi
 
@@ -1691,34 +1522,32 @@
   CC=$ac_ct_CC
 fi
 
-fi
-
-test -z "$CC" && { { echo "$as_me:1696: error: no acceptable cc found in \$PATH" >&5
+test -z "$CC" && { { echo "$as_me:1525: error: no acceptable cc found in \$PATH" >&5
 echo "$as_me: error: no acceptable cc found in \$PATH" >&2;}
    { (exit 1); exit 1; }; }
 
 # Provide some information about the compiler.
-echo "$as_me:1701:" \
+echo "$as_me:1530:" \
      "checking for C compiler version" >&5
 ac_compiler=`set X $ac_compile; echo $2`
-{ (eval echo "$as_me:1704: \"$ac_compiler --version </dev/null >&5\"") >&5
+{ (eval echo "$as_me:1533: \"$ac_compiler --version </dev/null >&5\"") >&5
   (eval $ac_compiler --version </dev/null >&5) 2>&5
   ac_status=$?
-  echo "$as_me:1707: \$? = $ac_status" >&5
+  echo "$as_me:1536: \$? = $ac_status" >&5
   (exit $ac_status); }
-{ (eval echo "$as_me:1709: \"$ac_compiler -v </dev/null >&5\"") >&5
+{ (eval echo "$as_me:1538: \"$ac_compiler -v </dev/null >&5\"") >&5
   (eval $ac_compiler -v </dev/null >&5) 2>&5
   ac_status=$?
-  echo "$as_me:1712: \$? = $ac_status" >&5
+  echo "$as_me:1541: \$? = $ac_status" >&5
   (exit $ac_status); }
-{ (eval echo "$as_me:1714: \"$ac_compiler -V </dev/null >&5\"") >&5
+{ (eval echo "$as_me:1543: \"$ac_compiler -V </dev/null >&5\"") >&5
   (eval $ac_compiler -V </dev/null >&5) 2>&5
   ac_status=$?
-  echo "$as_me:1717: \$? = $ac_status" >&5
+  echo "$as_me:1546: \$? = $ac_status" >&5
   (exit $ac_status); }
 
 cat >conftest.$ac_ext <<_ACEOF
-#line 1721 "configure"
+#line 1550 "configure"
 #include "confdefs.h"
 
 int
@@ -1734,13 +1563,13 @@
 # Try to create an executable without -o first, disregard a.out.
 # It will help us diagnose broken compilers, and finding out an intuition
 # of exeext.
-echo "$as_me:1737: checking for C compiler default output" >&5
+echo "$as_me:1566: checking for C compiler default output" >&5
 echo $ECHO_N "checking for C compiler default output... $ECHO_C" >&6
 ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
-if { (eval echo "$as_me:1740: \"$ac_link_default\"") >&5
+if { (eval echo "$as_me:1569: \"$ac_link_default\"") >&5
   (eval $ac_link_default) 2>&5
   ac_status=$?
-  echo "$as_me:1743: \$? = $ac_status" >&5
+  echo "$as_me:1572: \$? = $ac_status" >&5
   (exit $ac_status); }; then
   # Find the output, starting from the most likely.  This scheme is
 # not robust to junk in `.', hence go to wildcards (a.*) only as a last
@@ -1763,34 +1592,34 @@
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-{ { echo "$as_me:1766: error: C compiler cannot create executables" >&5
+{ { echo "$as_me:1595: error: C compiler cannot create executables" >&5
 echo "$as_me: error: C compiler cannot create executables" >&2;}
    { (exit 77); exit 77; }; }
 fi
 
 ac_exeext=$ac_cv_exeext
-echo "$as_me:1772: result: $ac_file" >&5
+echo "$as_me:1601: result: $ac_file" >&5
 echo "${ECHO_T}$ac_file" >&6
 
 # Check the compiler produces executables we can run.  If not, either
 # the compiler is broken, or we cross compile.
-echo "$as_me:1777: checking whether the C compiler works" >&5
+echo "$as_me:1606: checking whether the C compiler works" >&5
 echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6
 # FIXME: These cross compiler hacks should be removed for Autoconf 3.0
 # If not cross compiling, check that we can run a simple program.
 if test "$cross_compiling" != yes; then
   if { ac_try='./$ac_file'
-  { (eval echo "$as_me:1783: \"$ac_try\"") >&5
+  { (eval echo "$as_me:1612: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:1786: \$? = $ac_status" >&5
+  echo "$as_me:1615: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
     cross_compiling=no
   else
     if test "$cross_compiling" = maybe; then
 	cross_compiling=yes
     else
-	{ { echo "$as_me:1793: error: cannot run C compiled programs.
+	{ { echo "$as_me:1622: error: cannot run C compiled programs.
 If you meant to cross compile, use \`--host'." >&5
 echo "$as_me: error: cannot run C compiled programs.
 If you meant to cross compile, use \`--host'." >&2;}
@@ -1798,24 +1627,24 @@
     fi
   fi
 fi
-echo "$as_me:1801: result: yes" >&5
+echo "$as_me:1630: result: yes" >&5
 echo "${ECHO_T}yes" >&6
 
 rm -f a.out a.exe conftest$ac_cv_exeext
 ac_clean_files=$ac_clean_files_save
 # Check the compiler produces executables we can run.  If not, either
 # the compiler is broken, or we cross compile.
-echo "$as_me:1808: checking whether we are cross compiling" >&5
+echo "$as_me:1637: checking whether we are cross compiling" >&5
 echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6
-echo "$as_me:1810: result: $cross_compiling" >&5
+echo "$as_me:1639: result: $cross_compiling" >&5
 echo "${ECHO_T}$cross_compiling" >&6
 
-echo "$as_me:1813: checking for executable suffix" >&5
+echo "$as_me:1642: checking for executable suffix" >&5
 echo $ECHO_N "checking for executable suffix... $ECHO_C" >&6
-if { (eval echo "$as_me:1815: \"$ac_link\"") >&5
+if { (eval echo "$as_me:1644: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:1818: \$? = $ac_status" >&5
+  echo "$as_me:1647: \$? = $ac_status" >&5
   (exit $ac_status); }; then
   # If both `conftest.exe' and `conftest' are `present' (well, observable)
 # catch `conftest.exe'.  For instance with Cygwin, `ls conftest' will
@@ -1831,25 +1660,25 @@
   esac
 done
 else
-  { { echo "$as_me:1834: error: cannot compute EXEEXT: cannot compile and link" >&5
+  { { echo "$as_me:1663: error: cannot compute EXEEXT: cannot compile and link" >&5
 echo "$as_me: error: cannot compute EXEEXT: cannot compile and link" >&2;}
    { (exit 1); exit 1; }; }
 fi
 
 rm -f conftest$ac_cv_exeext
-echo "$as_me:1840: result: $ac_cv_exeext" >&5
+echo "$as_me:1669: result: $ac_cv_exeext" >&5
 echo "${ECHO_T}$ac_cv_exeext" >&6
 
 rm -f conftest.$ac_ext
 EXEEXT=$ac_cv_exeext
 ac_exeext=$EXEEXT
-echo "$as_me:1846: checking for object suffix" >&5
+echo "$as_me:1675: checking for object suffix" >&5
 echo $ECHO_N "checking for object suffix... $ECHO_C" >&6
 if test "${ac_cv_objext+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 1852 "configure"
+#line 1681 "configure"
 #include "confdefs.h"
 
 int
@@ -1861,10 +1690,10 @@
 }
 _ACEOF
 rm -f conftest.o conftest.obj
-if { (eval echo "$as_me:1864: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:1693: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:1867: \$? = $ac_status" >&5
+  echo "$as_me:1696: \$? = $ac_status" >&5
   (exit $ac_status); }; then
   for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do
   case $ac_file in
@@ -1876,24 +1705,24 @@
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-{ { echo "$as_me:1879: error: cannot compute OBJEXT: cannot compile" >&5
+{ { echo "$as_me:1708: error: cannot compute OBJEXT: cannot compile" >&5
 echo "$as_me: error: cannot compute OBJEXT: cannot compile" >&2;}
    { (exit 1); exit 1; }; }
 fi
 
 rm -f conftest.$ac_cv_objext conftest.$ac_ext
 fi
-echo "$as_me:1886: result: $ac_cv_objext" >&5
+echo "$as_me:1715: result: $ac_cv_objext" >&5
 echo "${ECHO_T}$ac_cv_objext" >&6
 OBJEXT=$ac_cv_objext
 ac_objext=$OBJEXT
-echo "$as_me:1890: checking whether we are using the GNU C compiler" >&5
+echo "$as_me:1719: checking whether we are using the GNU C compiler" >&5
 echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6
 if test "${ac_cv_c_compiler_gnu+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 1896 "configure"
+#line 1725 "configure"
 #include "confdefs.h"
 
 int
@@ -1908,16 +1737,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:1911: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:1740: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:1914: \$? = $ac_status" >&5
+  echo "$as_me:1743: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:1917: \"$ac_try\"") >&5
+  { (eval echo "$as_me:1746: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:1920: \$? = $ac_status" >&5
+  echo "$as_me:1749: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_compiler_gnu=yes
 else
@@ -1929,19 +1758,19 @@
 ac_cv_c_compiler_gnu=$ac_compiler_gnu
 
 fi
-echo "$as_me:1932: result: $ac_cv_c_compiler_gnu" >&5
+echo "$as_me:1761: result: $ac_cv_c_compiler_gnu" >&5
 echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6
 GCC=`test $ac_compiler_gnu = yes && echo yes`
 ac_test_CFLAGS=${CFLAGS+set}
 ac_save_CFLAGS=$CFLAGS
 CFLAGS="-g"
-echo "$as_me:1938: checking whether $CC accepts -g" >&5
+echo "$as_me:1767: checking whether $CC accepts -g" >&5
 echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6
 if test "${ac_cv_prog_cc_g+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 1944 "configure"
+#line 1773 "configure"
 #include "confdefs.h"
 
 int
@@ -1953,16 +1782,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:1956: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:1785: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:1959: \$? = $ac_status" >&5
+  echo "$as_me:1788: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:1962: \"$ac_try\"") >&5
+  { (eval echo "$as_me:1791: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:1965: \$? = $ac_status" >&5
+  echo "$as_me:1794: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_prog_cc_g=yes
 else
@@ -1972,7 +1801,7 @@
 fi
 rm -f conftest.$ac_objext conftest.$ac_ext
 fi
-echo "$as_me:1975: result: $ac_cv_prog_cc_g" >&5
+echo "$as_me:1804: result: $ac_cv_prog_cc_g" >&5
 echo "${ECHO_T}$ac_cv_prog_cc_g" >&6
 if test "$ac_test_CFLAGS" = set; then
   CFLAGS=$ac_save_CFLAGS
@@ -1999,16 +1828,16 @@
 #endif
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:2002: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:1831: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:2005: \$? = $ac_status" >&5
+  echo "$as_me:1834: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:2008: \"$ac_try\"") >&5
+  { (eval echo "$as_me:1837: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:2011: \$? = $ac_status" >&5
+  echo "$as_me:1840: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   for ac_declaration in \
    ''\
@@ -2020,7 +1849,7 @@
    'void exit (int);'
 do
   cat >conftest.$ac_ext <<_ACEOF
-#line 2023 "configure"
+#line 1852 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 $ac_declaration
@@ -2033,16 +1862,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:2036: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:1865: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:2039: \$? = $ac_status" >&5
+  echo "$as_me:1868: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:2042: \"$ac_try\"") >&5
+  { (eval echo "$as_me:1871: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:2045: \$? = $ac_status" >&5
+  echo "$as_me:1874: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   :
 else
@@ -2052,7 +1881,7 @@
 fi
 rm -f conftest.$ac_objext conftest.$ac_ext
   cat >conftest.$ac_ext <<_ACEOF
-#line 2055 "configure"
+#line 1884 "configure"
 #include "confdefs.h"
 $ac_declaration
 int
@@ -2064,16 +1893,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:2067: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:1896: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:2070: \$? = $ac_status" >&5
+  echo "$as_me:1899: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:2073: \"$ac_try\"") >&5
+  { (eval echo "$as_me:1902: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:2076: \$? = $ac_status" >&5
+  echo "$as_me:1905: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   break
 else
@@ -2103,55 +1932,246 @@
 
 GCC_VERSION=none
 if test "$GCC" = yes ; then
-	echo "$as_me:2106: checking version of $CC" >&5
+	echo "$as_me:1935: checking version of $CC" >&5
 echo $ECHO_N "checking version of $CC... $ECHO_C" >&6
-	GCC_VERSION="`${CC} --version 2>/dev/null | sed -e '2,$d' -e 's/^.*(GCC) //' -e 's/^[^0-9.]*//' -e 's/[^0-9.].*//'`"
+	GCC_VERSION="`${CC} --version 2>/dev/null | sed -e '2,$d' -e 's/^.*(GCC[^)]*) //' -e 's/^.*(Debian[^)]*) //' -e 's/^[^0-9.]*//' -e 's/[^0-9.].*//'`"
 	test -z "$GCC_VERSION" && GCC_VERSION=unknown
-	echo "$as_me:2110: result: $GCC_VERSION" >&5
+	echo "$as_me:1939: result: $GCC_VERSION" >&5
 echo "${ECHO_T}$GCC_VERSION" >&6
 fi
 
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-ac_main_return=return
-echo "$as_me:2120: checking how to run the C preprocessor" >&5
-echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6
-# On Suns, sometimes $CPP names a directory.
-if test -n "$CPP" && test -d "$CPP"; then
-  CPP=
-fi
-if test -z "$CPP"; then
-  if test "${ac_cv_prog_CPP+set}" = set; then
+echo "$as_me:1943: checking for $CC option to accept ANSI C" >&5
+echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6
+if test "${ac_cv_prog_cc_stdc+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-      # Double quotes because CPP needs to be expanded
-    for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
-    do
-      ac_preproc_ok=false
-for ac_c_preproc_warn_flag in '' yes
-do
-  # Use a header file that comes with gcc, so configuring glibc
-  # with a fresh cross-compiler works.
-  # On the NeXT, cc -E runs the code through the compiler's parser,
-  # not just through cpp. "Syntax error" is here to catch this case.
-  cat >conftest.$ac_ext <<_ACEOF
-#line 2141 "configure"
+  ac_cv_prog_cc_stdc=no
+ac_save_CC=$CC
+cat >conftest.$ac_ext <<_ACEOF
+#line 1951 "configure"
 #include "confdefs.h"
-#include <assert.h>
-                     Syntax error
+#include <stdarg.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+     char **p;
+     int i;
+{
+  return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+  char *s;
+  va_list v;
+  va_start (v,p);
+  s = g (p, va_arg (v,int));
+  va_end (v);
+  return s;
+}
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
+int argc;
+char **argv;
+int
+main ()
+{
+return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
+  ;
+  return 0;
+}
 _ACEOF
-if { (eval echo "$as_me:2146: \"$ac_cpp conftest.$ac_ext\"") >&5
-  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
-  ac_status=$?
-  egrep -v '^ *\+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:2152: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null; then
-  if test -s conftest.err; then
+# Don't try gcc -ansi; that turns off useful extensions and
+# breaks some systems' header files.
+# AIX			-qlanglvl=ansi
+# Ultrix and OSF/1	-std1
+# HP-UX 10.20 and later	-Ae
+# HP-UX older versions	-Aa -D_HPUX_SOURCE
+# SVR4			-Xc -D__EXTENSIONS__
+for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+  CC="$ac_save_CC $ac_arg"
+  rm -f conftest.$ac_objext
+if { (eval echo "$as_me:2000: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:2003: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:2006: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:2009: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_prog_cc_stdc=$ac_arg
+break
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+fi
+rm -f conftest.$ac_objext
+done
+rm -f conftest.$ac_ext conftest.$ac_objext
+CC=$ac_save_CC
+
+fi
+
+case "x$ac_cv_prog_cc_stdc" in
+  x|xno)
+    echo "$as_me:2026: result: none needed" >&5
+echo "${ECHO_T}none needed" >&6 ;;
+  *)
+    echo "$as_me:2029: result: $ac_cv_prog_cc_stdc" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6
+    CC="$CC $ac_cv_prog_cc_stdc" ;;
+esac
+
+# This should have been defined by AC_PROG_CC
+: ${CC:=cc}
+
+echo "$as_me:2037: checking \$CC variable" >&5
+echo $ECHO_N "checking \$CC variable... $ECHO_C" >&6
+case "$CC" in #(vi
+*[\ \	]-[IUD]*)
+	echo "$as_me:2041: result: broken" >&5
+echo "${ECHO_T}broken" >&6
+	{ echo "$as_me:2043: WARNING: your environment misuses the CC variable to hold CFLAGS/CPPFLAGS options" >&5
+echo "$as_me: WARNING: your environment misuses the CC variable to hold CFLAGS/CPPFLAGS options" >&2;}
+	# humor him...
+	cf_flags=`echo "$CC" | sed -e 's/^[^ 	]*[ 	]//'`
+	CC=`echo "$CC" | sed -e 's/[ 	].*//'`
+
+cf_fix_cppflags=no
+cf_new_cflags=
+cf_new_cppflags=
+cf_new_extra_cppflags=
+
+for cf_add_cflags in $cf_flags
+do
+case $cf_fix_cppflags in
+no)
+	case $cf_add_cflags in #(vi
+	-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi
+		case $cf_add_cflags in
+		-D*)
+			cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'`
+
+			test "${cf_add_cflags}" != "${cf_tst_cflags}" \
+				&& test -z "${cf_tst_cflags}" \
+				&& cf_fix_cppflags=yes
+
+			if test $cf_fix_cppflags = yes ; then
+				cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
+				continue
+			elif test "${cf_tst_cflags}" = "\"'" ; then
+				cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
+				continue
+			fi
+			;;
+		esac
+		case "$CPPFLAGS" in
+		*$cf_add_cflags) #(vi
+			;;
+		*) #(vi
+			case $cf_add_cflags in #(vi
+			-D*)
+				cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'`
+
+CPPFLAGS=`echo "$CPPFLAGS" | \
+	sed	-e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ 	]*\)\?[ 	]/ /g' \
+		-e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ 	]*\)\?$//g'`
+
+				;;
+			esac
+			cf_new_cppflags="$cf_new_cppflags $cf_add_cflags"
+			;;
+		esac
+		;;
+	*)
+		cf_new_cflags="$cf_new_cflags $cf_add_cflags"
+		;;
+	esac
+	;;
+yes)
+	cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
+
+	cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'`
+
+	test "${cf_add_cflags}" != "${cf_tst_cflags}" \
+		&& test -z "${cf_tst_cflags}" \
+		&& cf_fix_cppflags=no
+	;;
+esac
+done
+
+if test -n "$cf_new_cflags" ; then
+
+	CFLAGS="$CFLAGS $cf_new_cflags"
+fi
+
+if test -n "$cf_new_cppflags" ; then
+
+	CPPFLAGS="$CPPFLAGS $cf_new_cppflags"
+fi
+
+if test -n "$cf_new_extra_cppflags" ; then
+
+	EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS"
+fi
+
+	;;
+*)
+	echo "$as_me:2129: result: ok" >&5
+echo "${ECHO_T}ok" >&6
+	;;
+esac
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+ac_main_return=return
+echo "$as_me:2140: checking how to run the C preprocessor" >&5
+echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+  CPP=
+fi
+if test -z "$CPP"; then
+  if test "${ac_cv_prog_CPP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+      # Double quotes because CPP needs to be expanded
+    for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
+    do
+      ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+  # Use a header file that comes with gcc, so configuring glibc
+  # with a fresh cross-compiler works.
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp. "Syntax error" is here to catch this case.
+  cat >conftest.$ac_ext <<_ACEOF
+#line 2161 "configure"
+#include "confdefs.h"
+#include <assert.h>
+                     Syntax error
+_ACEOF
+if { (eval echo "$as_me:2166: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  egrep -v '^ *\+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:2172: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
     ac_cpp_err=$ac_c_preproc_warn_flag
   else
     ac_cpp_err=
@@ -2172,17 +2192,17 @@
   # OK, works on sane cases.  Now check whether non-existent headers
   # can be detected and how.
   cat >conftest.$ac_ext <<_ACEOF
-#line 2175 "configure"
+#line 2195 "configure"
 #include "confdefs.h"
 #include <ac_nonexistent.h>
 _ACEOF
-if { (eval echo "$as_me:2179: \"$ac_cpp conftest.$ac_ext\"") >&5
+if { (eval echo "$as_me:2199: \"$ac_cpp conftest.$ac_ext\"") >&5
   (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
   ac_status=$?
   egrep -v '^ *\+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
-  echo "$as_me:2185: \$? = $ac_status" >&5
+  echo "$as_me:2205: \$? = $ac_status" >&5
   (exit $ac_status); } >/dev/null; then
   if test -s conftest.err; then
     ac_cpp_err=$ac_c_preproc_warn_flag
@@ -2219,7 +2239,7 @@
 else
   ac_cv_prog_CPP=$CPP
 fi
-echo "$as_me:2222: result: $CPP" >&5
+echo "$as_me:2242: result: $CPP" >&5
 echo "${ECHO_T}$CPP" >&6
 ac_preproc_ok=false
 for ac_c_preproc_warn_flag in '' yes
@@ -2229,18 +2249,18 @@
   # On the NeXT, cc -E runs the code through the compiler's parser,
   # not just through cpp. "Syntax error" is here to catch this case.
   cat >conftest.$ac_ext <<_ACEOF
-#line 2232 "configure"
+#line 2252 "configure"
 #include "confdefs.h"
 #include <assert.h>
                      Syntax error
 _ACEOF
-if { (eval echo "$as_me:2237: \"$ac_cpp conftest.$ac_ext\"") >&5
+if { (eval echo "$as_me:2257: \"$ac_cpp conftest.$ac_ext\"") >&5
   (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
   ac_status=$?
   egrep -v '^ *\+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
-  echo "$as_me:2243: \$? = $ac_status" >&5
+  echo "$as_me:2263: \$? = $ac_status" >&5
   (exit $ac_status); } >/dev/null; then
   if test -s conftest.err; then
     ac_cpp_err=$ac_c_preproc_warn_flag
@@ -2263,17 +2283,17 @@
   # OK, works on sane cases.  Now check whether non-existent headers
   # can be detected and how.
   cat >conftest.$ac_ext <<_ACEOF
-#line 2266 "configure"
+#line 2286 "configure"
 #include "confdefs.h"
 #include <ac_nonexistent.h>
 _ACEOF
-if { (eval echo "$as_me:2270: \"$ac_cpp conftest.$ac_ext\"") >&5
+if { (eval echo "$as_me:2290: \"$ac_cpp conftest.$ac_ext\"") >&5
   (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
   ac_status=$?
   egrep -v '^ *\+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
-  echo "$as_me:2276: \$? = $ac_status" >&5
+  echo "$as_me:2296: \$? = $ac_status" >&5
   (exit $ac_status); } >/dev/null; then
   if test -s conftest.err; then
     ac_cpp_err=$ac_c_preproc_warn_flag
@@ -2301,7 +2321,7 @@
 if $ac_preproc_ok; then
   :
 else
-  { { echo "$as_me:2304: error: C preprocessor \"$CPP\" fails sanity check" >&5
+  { { echo "$as_me:2324: error: C preprocessor \"$CPP\" fails sanity check" >&5
 echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check" >&2;}
    { (exit 1); exit 1; }; }
 fi
@@ -2314,14 +2334,14 @@
 ac_main_return=return
 
 if test $ac_cv_c_compiler_gnu = yes; then
-    echo "$as_me:2317: checking whether $CC needs -traditional" >&5
+    echo "$as_me:2337: checking whether $CC needs -traditional" >&5
 echo $ECHO_N "checking whether $CC needs -traditional... $ECHO_C" >&6
 if test "${ac_cv_prog_gcc_traditional+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
     ac_pattern="Autoconf.*'x'"
   cat >conftest.$ac_ext <<_ACEOF
-#line 2324 "configure"
+#line 2344 "configure"
 #include "confdefs.h"
 #include <sgtty.h>
 int Autoconf = TIOCGETP;
@@ -2336,7 +2356,7 @@
 
   if test $ac_cv_prog_gcc_traditional = no; then
     cat >conftest.$ac_ext <<_ACEOF
-#line 2339 "configure"
+#line 2359 "configure"
 #include "confdefs.h"
 #include <termio.h>
 int Autoconf = TCGETA;
@@ -2349,14 +2369,14 @@
 
   fi
 fi
-echo "$as_me:2352: result: $ac_cv_prog_gcc_traditional" >&5
+echo "$as_me:2372: result: $ac_cv_prog_gcc_traditional" >&5
 echo "${ECHO_T}$ac_cv_prog_gcc_traditional" >&6
   if test $ac_cv_prog_gcc_traditional = yes; then
     CC="$CC -traditional"
   fi
 fi
 
-echo "$as_me:2359: checking whether $CC understands -c and -o together" >&5
+echo "$as_me:2379: checking whether $CC understands -c and -o together" >&5
 echo $ECHO_N "checking whether $CC understands -c and -o together... $ECHO_C" >&6
 if test "${cf_cv_prog_CC_c_o+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -2372,15 +2392,15 @@
 # We do the test twice because some compilers refuse to overwrite an
 # existing .o file with -o, though they will create one.
 ac_try='$CC -c conftest.$ac_ext -o conftest2.$ac_objext >&5'
-if { (eval echo "$as_me:2375: \"$ac_try\"") >&5
+if { (eval echo "$as_me:2395: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:2378: \$? = $ac_status" >&5
+  echo "$as_me:2398: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-  test -f conftest2.$ac_objext && { (eval echo "$as_me:2380: \"$ac_try\"") >&5
+  test -f conftest2.$ac_objext && { (eval echo "$as_me:2400: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:2383: \$? = $ac_status" >&5
+  echo "$as_me:2403: \$? = $ac_status" >&5
   (exit $ac_status); };
 then
   eval cf_cv_prog_CC_c_o=yes
@@ -2391,318 +2411,24 @@
 
 fi
 if test $cf_cv_prog_CC_c_o = yes; then
-  echo "$as_me:2394: result: yes" >&5
+  echo "$as_me:2414: result: yes" >&5
 echo "${ECHO_T}yes" >&6
 else
-  echo "$as_me:2397: result: no" >&5
+  echo "$as_me:2417: result: no" >&5
 echo "${ECHO_T}no" >&6
 fi
 
-echo "$as_me:2401: checking for POSIXized ISC" >&5
-echo $ECHO_N "checking for POSIXized ISC... $ECHO_C" >&6
-if test -d /etc/conf/kconfig.d &&
-   grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1
-then
-  echo "$as_me:2406: result: yes" >&5
-echo "${ECHO_T}yes" >&6
-  ISC=yes # If later tests want to check for ISC.
-
-cat >>confdefs.h <<\EOF
-#define _POSIX_SOURCE 1
-EOF
-
-  if test "$GCC" = yes; then
-    CC="$CC -posix"
-  else
-    CC="$CC -Xp"
-  fi
-else
-  echo "$as_me:2420: result: no" >&5
-echo "${ECHO_T}no" >&6
-  ISC=
-fi
-
-echo "$as_me:2425: checking for ${CC:-cc} option to accept ANSI C" >&5
-echo $ECHO_N "checking for ${CC:-cc} option to accept ANSI C... $ECHO_C" >&6
-if test "${cf_cv_ansi_cc+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-
-cf_cv_ansi_cc=no
-cf_save_CFLAGS="$CFLAGS"
-cf_save_CPPFLAGS="$CPPFLAGS"
-# Don't try gcc -ansi; that turns off useful extensions and
-# breaks some systems' header files.
-# AIX			-qlanglvl=ansi
-# Ultrix and OSF/1	-std1
-# HP-UX			-Aa -D_HPUX_SOURCE
-# SVR4			-Xc
-# UnixWare 1.2		(cannot use -Xc, since ANSI/POSIX clashes)
-for cf_arg in "-DCC_HAS_PROTOS" \
-	"" \
-	-qlanglvl=ansi \
-	-std1 \
-	-Ae \
-	"-Aa -D_HPUX_SOURCE" \
-	-Xc
-do
-
-cf_fix_cppflags=no
-cf_new_cflags=
-cf_new_cppflags=
-cf_new_extra_cppflags=
-
-for cf_add_cflags in $cf_arg
-do
-case $cf_fix_cppflags in
-no)
-	case $cf_add_cflags in #(vi
-	-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi
-		case $cf_add_cflags in
-		-D*)
-			cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'`
-
-			test "${cf_add_cflags}" != "${cf_tst_cflags}" \
-				&& test -z "${cf_tst_cflags}" \
-				&& cf_fix_cppflags=yes
-
-			if test $cf_fix_cppflags = yes ; then
-				cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
-				continue
-			elif test "${cf_tst_cflags}" = "\"'" ; then
-				cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
-				continue
-			fi
-			;;
-		esac
-		case "$CPPFLAGS" in
-		*$cf_add_cflags) #(vi
-			;;
-		*) #(vi
-			case $cf_add_cflags in #(vi
-			-D*)
-				cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'`
-
-CPPFLAGS=`echo "$CPPFLAGS" | \
-	sed	-e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ 	]*\)\?[ 	]/ /g' \
-		-e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ 	]*\)\?$//g'`
-
-				;;
-			esac
-			cf_new_cppflags="$cf_new_cppflags $cf_add_cflags"
-			;;
-		esac
-		;;
-	*)
-		cf_new_cflags="$cf_new_cflags $cf_add_cflags"
-		;;
-	esac
-	;;
-yes)
-	cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
-
-	cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'`
-
-	test "${cf_add_cflags}" != "${cf_tst_cflags}" \
-		&& test -z "${cf_tst_cflags}" \
-		&& cf_fix_cppflags=no
-	;;
-esac
-done
-
-if test -n "$cf_new_cflags" ; then
-
-	CFLAGS="$CFLAGS $cf_new_cflags"
-fi
-
-if test -n "$cf_new_cppflags" ; then
-
-	CPPFLAGS="$CPPFLAGS $cf_new_cppflags"
-fi
-
-if test -n "$cf_new_extra_cppflags" ; then
-
-	EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS"
-fi
-
-	cat >conftest.$ac_ext <<_ACEOF
-#line 2529 "configure"
-#include "confdefs.h"
-
-#ifndef CC_HAS_PROTOS
-#if !defined(__STDC__) || (__STDC__ != 1)
-choke me
-#endif
-#endif
-
-int
-main ()
-{
-
-	int test (int i, double x);
-	struct s1 {int (*f) (int a);};
-	struct s2 {int (*f) (double a);};
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:2550: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
-  ac_status=$?
-  echo "$as_me:2553: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:2556: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:2559: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  cf_cv_ansi_cc="$cf_arg"; break
-else
-  echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
-fi
-rm -f conftest.$ac_objext conftest.$ac_ext
-done
-CFLAGS="$cf_save_CFLAGS"
-CPPFLAGS="$cf_save_CPPFLAGS"
-
-fi
-echo "$as_me:2572: result: $cf_cv_ansi_cc" >&5
-echo "${ECHO_T}$cf_cv_ansi_cc" >&6
-
-if test "$cf_cv_ansi_cc" != "no"; then
-if test ".$cf_cv_ansi_cc" != ".-DCC_HAS_PROTOS"; then
-
-cf_fix_cppflags=no
-cf_new_cflags=
-cf_new_cppflags=
-cf_new_extra_cppflags=
-
-for cf_add_cflags in $cf_cv_ansi_cc
-do
-case $cf_fix_cppflags in
-no)
-	case $cf_add_cflags in #(vi
-	-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi
-		case $cf_add_cflags in
-		-D*)
-			cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'`
-
-			test "${cf_add_cflags}" != "${cf_tst_cflags}" \
-				&& test -z "${cf_tst_cflags}" \
-				&& cf_fix_cppflags=yes
-
-			if test $cf_fix_cppflags = yes ; then
-				cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
-				continue
-			elif test "${cf_tst_cflags}" = "\"'" ; then
-				cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
-				continue
-			fi
-			;;
-		esac
-		case "$CPPFLAGS" in
-		*$cf_add_cflags) #(vi
-			;;
-		*) #(vi
-			case $cf_add_cflags in #(vi
-			-D*)
-				cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'`
-
-CPPFLAGS=`echo "$CPPFLAGS" | \
-	sed	-e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ 	]*\)\?[ 	]/ /g' \
-		-e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ 	]*\)\?$//g'`
-
-				;;
-			esac
-			cf_new_cppflags="$cf_new_cppflags $cf_add_cflags"
-			;;
-		esac
-		;;
-	*)
-		cf_new_cflags="$cf_new_cflags $cf_add_cflags"
-		;;
-	esac
-	;;
-yes)
-	cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
-
-	cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'`
-
-	test "${cf_add_cflags}" != "${cf_tst_cflags}" \
-		&& test -z "${cf_tst_cflags}" \
-		&& cf_fix_cppflags=no
-	;;
-esac
-done
-
-if test -n "$cf_new_cflags" ; then
-
-	CFLAGS="$CFLAGS $cf_new_cflags"
-fi
-
-if test -n "$cf_new_cppflags" ; then
-
-	CPPFLAGS="$CPPFLAGS $cf_new_cppflags"
-fi
-
-if test -n "$cf_new_extra_cppflags" ; then
-
-	EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS"
-fi
-
-else
-	cat >>confdefs.h <<\EOF
-#define CC_HAS_PROTOS 1
-EOF
-
-fi
-fi
-
-if test "$cf_cv_ansi_cc" = "no"; then
-	{ { echo "$as_me:2665: error: Your compiler does not appear to recognize prototypes.
-You have the following choices:
-	a. adjust your compiler options
-	b. get an up-to-date compiler
-	c. use a wrapper such as unproto" >&5
-echo "$as_me: error: Your compiler does not appear to recognize prototypes.
-You have the following choices:
-	a. adjust your compiler options
-	b. get an up-to-date compiler
-	c. use a wrapper such as unproto" >&2;}
-   { (exit 1); exit 1; }; }
-fi
-
-case $cf_cv_system_name in
-os2*)
-    CFLAGS="$CFLAGS -Zmt"
-    CPPFLAGS="$CPPFLAGS -D__ST_MT_ERRNO__"
-    CXXFLAGS="$CXXFLAGS -Zmt"
-    # autoconf's macro sets -Zexe and suffix both, which conflict:w
-    LDFLAGS="$LDFLAGS -Zmt -Zcrtdll"
-    ac_cv_exeext=.exe
-    ;;
-esac
-
-PROG_EXT="$EXEEXT"
-
-test -n "$PROG_EXT" && cat >>confdefs.h <<EOF
-#define PROG_EXT "$PROG_EXT"
-EOF
-
 if test "$cross_compiling" = yes ; then
   LDCONFIG=:
 else
 case "$cf_cv_system_name" in #(vi
-dragonfly*|freebsd*) #(vi
+dragonfly*|mirbsd*|freebsd*) #(vi
   test -z "$LDCONFIG" && LDCONFIG="/sbin/ldconfig -R"
   ;;
 *) LDPATH=$PATH:/sbin:/usr/sbin
   # Extract the first word of "ldconfig", so it can be a program name with args.
 set dummy ldconfig; ac_word=$2
-echo "$as_me:2705: checking for $ac_word" >&5
+echo "$as_me:2431: checking for $ac_word" >&5
 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
 if test "${ac_cv_path_LDCONFIG+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -2719,7 +2445,7 @@
   test -z "$ac_dir" && ac_dir=.
   if $as_executable_p "$ac_dir/$ac_word"; then
    ac_cv_path_LDCONFIG="$ac_dir/$ac_word"
-   echo "$as_me:2722: found $ac_dir/$ac_word" >&5
+   echo "$as_me:2448: found $ac_dir/$ac_word" >&5
    break
 fi
 done
@@ -2730,10 +2456,10 @@
 LDCONFIG=$ac_cv_path_LDCONFIG
 
 if test -n "$LDCONFIG"; then
-  echo "$as_me:2733: result: $LDCONFIG" >&5
+  echo "$as_me:2459: result: $LDCONFIG" >&5
 echo "${ECHO_T}$LDCONFIG" >&6
 else
-  echo "$as_me:2736: result: no" >&5
+  echo "$as_me:2462: result: no" >&5
 echo "${ECHO_T}no" >&6
 fi
 
@@ -2741,7 +2467,7 @@
 esac
 fi
 
-echo "$as_me:2744: checking if you want to ensure bool is consistent with C++" >&5
+echo "$as_me:2470: checking if you want to ensure bool is consistent with C++" >&5
 echo $ECHO_N "checking if you want to ensure bool is consistent with C++... $ECHO_C" >&6
 
 # Check whether --with-cxx or --without-cxx was given.
@@ -2751,7 +2477,7 @@
 else
   cf_with_cxx=yes
 fi;
-echo "$as_me:2754: result: $cf_with_cxx" >&5
+echo "$as_me:2480: result: $cf_with_cxx" >&5
 echo "${ECHO_T}$cf_with_cxx" >&6
 if test "X$cf_with_cxx" = Xno ; then
 	CXX=""
@@ -2769,7 +2495,7 @@
   do
     # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
 set dummy $ac_tool_prefix$ac_prog; ac_word=$2
-echo "$as_me:2772: checking for $ac_word" >&5
+echo "$as_me:2498: checking for $ac_word" >&5
 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
 if test "${ac_cv_prog_CXX+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -2784,7 +2510,7 @@
   test -z "$ac_dir" && ac_dir=.
   $as_executable_p "$ac_dir/$ac_word" || continue
 ac_cv_prog_CXX="$ac_tool_prefix$ac_prog"
-echo "$as_me:2787: found $ac_dir/$ac_word" >&5
+echo "$as_me:2513: found $ac_dir/$ac_word" >&5
 break
 done
 
@@ -2792,10 +2518,10 @@
 fi
 CXX=$ac_cv_prog_CXX
 if test -n "$CXX"; then
-  echo "$as_me:2795: result: $CXX" >&5
+  echo "$as_me:2521: result: $CXX" >&5
 echo "${ECHO_T}$CXX" >&6
 else
-  echo "$as_me:2798: result: no" >&5
+  echo "$as_me:2524: result: no" >&5
 echo "${ECHO_T}no" >&6
 fi
 
@@ -2808,7 +2534,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 "$as_me:2811: checking for $ac_word" >&5
+echo "$as_me:2537: checking for $ac_word" >&5
 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
 if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -2823,7 +2549,7 @@
   test -z "$ac_dir" && ac_dir=.
   $as_executable_p "$ac_dir/$ac_word" || continue
 ac_cv_prog_ac_ct_CXX="$ac_prog"
-echo "$as_me:2826: found $ac_dir/$ac_word" >&5
+echo "$as_me:2552: found $ac_dir/$ac_word" >&5
 break
 done
 
@@ -2831,10 +2557,10 @@
 fi
 ac_ct_CXX=$ac_cv_prog_ac_ct_CXX
 if test -n "$ac_ct_CXX"; then
-  echo "$as_me:2834: result: $ac_ct_CXX" >&5
+  echo "$as_me:2560: result: $ac_ct_CXX" >&5
 echo "${ECHO_T}$ac_ct_CXX" >&6
 else
-  echo "$as_me:2837: result: no" >&5
+  echo "$as_me:2563: result: no" >&5
 echo "${ECHO_T}no" >&6
 fi
 
@@ -2846,32 +2572,32 @@
 fi
 
 # Provide some information about the compiler.
-echo "$as_me:2849:" \
+echo "$as_me:2575:" \
      "checking for C++ compiler version" >&5
 ac_compiler=`set X $ac_compile; echo $2`
-{ (eval echo "$as_me:2852: \"$ac_compiler --version </dev/null >&5\"") >&5
+{ (eval echo "$as_me:2578: \"$ac_compiler --version </dev/null >&5\"") >&5
   (eval $ac_compiler --version </dev/null >&5) 2>&5
   ac_status=$?
-  echo "$as_me:2855: \$? = $ac_status" >&5
+  echo "$as_me:2581: \$? = $ac_status" >&5
   (exit $ac_status); }
-{ (eval echo "$as_me:2857: \"$ac_compiler -v </dev/null >&5\"") >&5
+{ (eval echo "$as_me:2583: \"$ac_compiler -v </dev/null >&5\"") >&5
   (eval $ac_compiler -v </dev/null >&5) 2>&5
   ac_status=$?
-  echo "$as_me:2860: \$? = $ac_status" >&5
+  echo "$as_me:2586: \$? = $ac_status" >&5
   (exit $ac_status); }
-{ (eval echo "$as_me:2862: \"$ac_compiler -V </dev/null >&5\"") >&5
+{ (eval echo "$as_me:2588: \"$ac_compiler -V </dev/null >&5\"") >&5
   (eval $ac_compiler -V </dev/null >&5) 2>&5
   ac_status=$?
-  echo "$as_me:2865: \$? = $ac_status" >&5
+  echo "$as_me:2591: \$? = $ac_status" >&5
   (exit $ac_status); }
 
-echo "$as_me:2868: checking whether we are using the GNU C++ compiler" >&5
+echo "$as_me:2594: checking whether we are using the GNU C++ compiler" >&5
 echo $ECHO_N "checking whether we are using the GNU C++ compiler... $ECHO_C" >&6
 if test "${ac_cv_cxx_compiler_gnu+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 2874 "configure"
+#line 2600 "configure"
 #include "confdefs.h"
 
 int
@@ -2886,16 +2612,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:2889: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:2615: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:2892: \$? = $ac_status" >&5
+  echo "$as_me:2618: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:2895: \"$ac_try\"") >&5
+  { (eval echo "$as_me:2621: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:2898: \$? = $ac_status" >&5
+  echo "$as_me:2624: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_compiler_gnu=yes
 else
@@ -2907,19 +2633,19 @@
 ac_cv_cxx_compiler_gnu=$ac_compiler_gnu
 
 fi
-echo "$as_me:2910: result: $ac_cv_cxx_compiler_gnu" >&5
+echo "$as_me:2636: result: $ac_cv_cxx_compiler_gnu" >&5
 echo "${ECHO_T}$ac_cv_cxx_compiler_gnu" >&6
 GXX=`test $ac_compiler_gnu = yes && echo yes`
 ac_test_CXXFLAGS=${CXXFLAGS+set}
 ac_save_CXXFLAGS=$CXXFLAGS
 CXXFLAGS="-g"
-echo "$as_me:2916: checking whether $CXX accepts -g" >&5
+echo "$as_me:2642: checking whether $CXX accepts -g" >&5
 echo $ECHO_N "checking whether $CXX accepts -g... $ECHO_C" >&6
 if test "${ac_cv_prog_cxx_g+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 2922 "configure"
+#line 2648 "configure"
 #include "confdefs.h"
 
 int
@@ -2931,16 +2657,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:2934: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:2660: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:2937: \$? = $ac_status" >&5
+  echo "$as_me:2663: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:2940: \"$ac_try\"") >&5
+  { (eval echo "$as_me:2666: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:2943: \$? = $ac_status" >&5
+  echo "$as_me:2669: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_prog_cxx_g=yes
 else
@@ -2950,7 +2676,7 @@
 fi
 rm -f conftest.$ac_objext conftest.$ac_ext
 fi
-echo "$as_me:2953: result: $ac_cv_prog_cxx_g" >&5
+echo "$as_me:2679: result: $ac_cv_prog_cxx_g" >&5
 echo "${ECHO_T}$ac_cv_prog_cxx_g" >&6
 if test "$ac_test_CXXFLAGS" = set; then
   CXXFLAGS=$ac_save_CXXFLAGS
@@ -2977,7 +2703,7 @@
    'void exit (int);'
 do
   cat >conftest.$ac_ext <<_ACEOF
-#line 2980 "configure"
+#line 2706 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 $ac_declaration
@@ -2990,16 +2716,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:2993: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:2719: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:2996: \$? = $ac_status" >&5
+  echo "$as_me:2722: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:2999: \"$ac_try\"") >&5
+  { (eval echo "$as_me:2725: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:3002: \$? = $ac_status" >&5
+  echo "$as_me:2728: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   :
 else
@@ -3009,7 +2735,7 @@
 fi
 rm -f conftest.$ac_objext conftest.$ac_ext
   cat >conftest.$ac_ext <<_ACEOF
-#line 3012 "configure"
+#line 2738 "configure"
 #include "confdefs.h"
 $ac_declaration
 int
@@ -3021,16 +2747,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:3024: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:2750: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:3027: \$? = $ac_status" >&5
+  echo "$as_me:2753: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:3030: \"$ac_try\"") >&5
+  { (eval echo "$as_me:2756: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:3033: \$? = $ac_status" >&5
+  echo "$as_me:2759: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   break
 else
@@ -3053,11 +2779,11 @@
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
 ac_main_return=return
 
-		# autoconf 2.5x removed the error - by hardcoding it to g++.
+		# autoconf 2.5x removed the error (hardcoding it to g++, or just blank)
 	if test "$CXX" = "g++" ; then
 		# Extract the first word of "g++", so it can be a program name with args.
 set dummy g++; ac_word=$2
-echo "$as_me:3060: checking for $ac_word" >&5
+echo "$as_me:2786: checking for $ac_word" >&5
 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
 if test "${ac_cv_path_CXX+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -3074,7 +2800,7 @@
   test -z "$ac_dir" && ac_dir=.
   if $as_executable_p "$ac_dir/$ac_word"; then
    ac_cv_path_CXX="$ac_dir/$ac_word"
-   echo "$as_me:3077: found $ac_dir/$ac_word" >&5
+   echo "$as_me:2803: found $ac_dir/$ac_word" >&5
    break
 fi
 done
@@ -3085,28 +2811,30 @@
 CXX=$ac_cv_path_CXX
 
 if test -n "$CXX"; then
-  echo "$as_me:3088: result: $CXX" >&5
+  echo "$as_me:2814: result: $CXX" >&5
 echo "${ECHO_T}$CXX" >&6
 else
-  echo "$as_me:3091: result: no" >&5
+  echo "$as_me:2817: result: no" >&5
 echo "${ECHO_T}no" >&6
 fi
 
 	fi
-	if test "$CXX" = "g++" ; then
-		{ echo "$as_me:3097: WARNING: ignoring hardcoded g++" >&5
-echo "$as_me: WARNING: ignoring hardcoded g++" >&2;}
+	case "x$CXX" in #(vi
+	x|xg++)
+		{ echo "$as_me:2824: WARNING: You don't have any C++ compiler, too bad" >&5
+echo "$as_me: WARNING: You don't have any C++ compiler, too bad" >&2;}
 		cf_with_cxx=no; CXX=""; GXX="";
-	fi
+		;;
+	esac
 fi
 
 GXX_VERSION=none
 if test "$GXX" = yes; then
-	echo "$as_me:3105: checking version of g++" >&5
-echo $ECHO_N "checking version of g++... $ECHO_C" >&6
+	echo "$as_me:2833: checking version of ${CXX:-g++}" >&5
+echo $ECHO_N "checking version of ${CXX:-g++}... $ECHO_C" >&6
 	GXX_VERSION="`${CXX:-g++} --version| sed -e '2,$d' -e 's/^.*(GCC) //' -e 's/^[^0-9.]*//' -e 's/[^0-9.].*//'`"
 	test -z "$GXX_VERSION" && GXX_VERSION=unknown
-	echo "$as_me:3109: result: $GXX_VERSION" >&5
+	echo "$as_me:2837: result: $GXX_VERSION" >&5
 echo "${ECHO_T}$GXX_VERSION" >&6
 fi
 
@@ -3114,12 +2842,12 @@
 1*|2.[0-6]*)
 	# GXX=""; CXX=""; ac_cv_prog_gxx=no
 	# cf_cxx_library=no
-	{ echo "$as_me:3117: WARNING: templates do not work" >&5
+	{ echo "$as_me:2845: WARNING: templates do not work" >&5
 echo "$as_me: WARNING: templates do not work" >&2;}
 	;;
 esac
 
-echo "$as_me:3122: checking if you want to build C++ binding and demo" >&5
+echo "$as_me:2850: checking if you want to build C++ binding and demo" >&5
 echo $ECHO_N "checking if you want to build C++ binding and demo... $ECHO_C" >&6
 
 # Check whether --with-cxx-binding or --without-cxx-binding was given.
@@ -3129,23 +2857,15 @@
 else
   cf_with_cxx_binding=$cf_with_cxx
 fi;
-echo "$as_me:3132: result: $cf_with_cxx_binding" >&5
+echo "$as_me:2860: result: $cf_with_cxx_binding" >&5
 echo "${ECHO_T}$cf_with_cxx_binding" >&6
 
-echo "$as_me:3135: checking if you want to build with Ada95" >&5
+echo "$as_me:2863: checking if you want to build with Ada95" >&5
 echo $ECHO_N "checking if you want to build with Ada95... $ECHO_C" >&6
-
-# Check whether --with-ada or --without-ada was given.
-if test "${with_ada+set}" = set; then
-  withval="$with_ada"
-  cf_with_ada=$withval
-else
-  cf_with_ada=yes
-fi;
-echo "$as_me:3145: result: $cf_with_ada" >&5
+echo "$as_me:2865: result: $cf_with_ada" >&5
 echo "${ECHO_T}$cf_with_ada" >&6
 
-echo "$as_me:3148: checking if you want to install manpages" >&5
+echo "$as_me:2868: checking if you want to install manpages" >&5
 echo $ECHO_N "checking if you want to install manpages... $ECHO_C" >&6
 
 # Check whether --with-manpages or --without-manpages was given.
@@ -3155,10 +2875,10 @@
 else
   cf_with_manpages=yes
 fi;
-echo "$as_me:3158: result: $cf_with_manpages" >&5
+echo "$as_me:2878: result: $cf_with_manpages" >&5
 echo "${ECHO_T}$cf_with_manpages" >&6
 
-echo "$as_me:3161: checking if you want to build programs such as tic" >&5
+echo "$as_me:2881: checking if you want to build programs such as tic" >&5
 echo $ECHO_N "checking if you want to build programs such as tic... $ECHO_C" >&6
 
 # Check whether --with-progs or --without-progs was given.
@@ -3168,10 +2888,10 @@
 else
   cf_with_progs=yes
 fi;
-echo "$as_me:3171: result: $cf_with_progs" >&5
+echo "$as_me:2891: result: $cf_with_progs" >&5
 echo "${ECHO_T}$cf_with_progs" >&6
 
-echo "$as_me:3174: checking if you want to build test-programs" >&5
+echo "$as_me:2894: checking if you want to build test-programs" >&5
 echo $ECHO_N "checking if you want to build test-programs... $ECHO_C" >&6
 
 # Check whether --with-tests or --without-tests was given.
@@ -3181,10 +2901,10 @@
 else
   cf_with_tests=yes
 fi;
-echo "$as_me:3184: result: $cf_with_tests" >&5
+echo "$as_me:2904: result: $cf_with_tests" >&5
 echo "${ECHO_T}$cf_with_tests" >&6
 
-echo "$as_me:3187: checking if you wish to install curses.h" >&5
+echo "$as_me:2907: checking if you wish to install curses.h" >&5
 echo $ECHO_N "checking if you wish to install curses.h... $ECHO_C" >&6
 
 # Check whether --with-curses-h or --without-curses-h was given.
@@ -3194,7 +2914,7 @@
 else
   with_curses_h=yes
 fi;
-echo "$as_me:3197: result: $with_curses_h" >&5
+echo "$as_me:2917: result: $with_curses_h" >&5
 echo "${ECHO_T}$with_curses_h" >&6
 
 modules_to_build="ncurses"
@@ -3220,7 +2940,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 "$as_me:3223: checking for $ac_word" >&5
+echo "$as_me:2943: checking for $ac_word" >&5
 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
 if test "${ac_cv_prog_AWK+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -3235,7 +2955,7 @@
   test -z "$ac_dir" && ac_dir=.
   $as_executable_p "$ac_dir/$ac_word" || continue
 ac_cv_prog_AWK="$ac_prog"
-echo "$as_me:3238: found $ac_dir/$ac_word" >&5
+echo "$as_me:2958: found $ac_dir/$ac_word" >&5
 break
 done
 
@@ -3243,21 +2963,21 @@
 fi
 AWK=$ac_cv_prog_AWK
 if test -n "$AWK"; then
-  echo "$as_me:3246: result: $AWK" >&5
+  echo "$as_me:2966: result: $AWK" >&5
 echo "${ECHO_T}$AWK" >&6
 else
-  echo "$as_me:3249: result: no" >&5
+  echo "$as_me:2969: result: no" >&5
 echo "${ECHO_T}no" >&6
 fi
 
   test -n "$AWK" && break
 done
 
-test -z "$AWK" && { { echo "$as_me:3256: error: No awk program found" >&5
+test -z "$AWK" && { { echo "$as_me:2976: error: No awk program found" >&5
 echo "$as_me: error: No awk program found" >&2;}
    { (exit 1); exit 1; }; }
 
-echo "$as_me:3260: checking for egrep" >&5
+echo "$as_me:2980: checking for egrep" >&5
 echo $ECHO_N "checking for egrep... $ECHO_C" >&6
 if test "${ac_cv_prog_egrep+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -3267,11 +2987,11 @@
     else ac_cv_prog_egrep='egrep'
     fi
 fi
-echo "$as_me:3270: result: $ac_cv_prog_egrep" >&5
+echo "$as_me:2990: result: $ac_cv_prog_egrep" >&5
 echo "${ECHO_T}$ac_cv_prog_egrep" >&6
  EGREP=$ac_cv_prog_egrep
 
-test -z "$EGREP" && { { echo "$as_me:3274: error: No egrep program found" >&5
+test -z "$EGREP" && { { echo "$as_me:2994: error: No egrep program found" >&5
 echo "$as_me: error: No egrep program found" >&2;}
    { (exit 1); exit 1; }; }
 
@@ -3287,7 +3007,7 @@
 # AFS /usr/afsws/bin/install, which mishandles nonexistent args
 # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
 # ./install, which can be erroneously created by make from ./install.sh.
-echo "$as_me:3290: checking for a BSD compatible install" >&5
+echo "$as_me:3010: checking for a BSD compatible install" >&5
 echo $ECHO_N "checking for a BSD compatible install... $ECHO_C" >&6
 if test -z "$INSTALL"; then
 if test "${ac_cv_path_install+set}" = set; then
@@ -3336,7 +3056,7 @@
     INSTALL=$ac_install_sh
   fi
 fi
-echo "$as_me:3339: result: $INSTALL" >&5
+echo "$as_me:3059: result: $INSTALL" >&5
 echo "${ECHO_T}$INSTALL" >&6
 
 # Use test -z because SunOS4 sh mishandles braces in ${var-val}.
@@ -3361,7 +3081,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 "$as_me:3364: checking for $ac_word" >&5
+echo "$as_me:3084: checking for $ac_word" >&5
 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
 if test "${ac_cv_prog_LINT+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -3376,7 +3096,7 @@
   test -z "$ac_dir" && ac_dir=.
   $as_executable_p "$ac_dir/$ac_word" || continue
 ac_cv_prog_LINT="$ac_prog"
-echo "$as_me:3379: found $ac_dir/$ac_word" >&5
+echo "$as_me:3099: found $ac_dir/$ac_word" >&5
 break
 done
 
@@ -3384,28 +3104,28 @@
 fi
 LINT=$ac_cv_prog_LINT
 if test -n "$LINT"; then
-  echo "$as_me:3387: result: $LINT" >&5
+  echo "$as_me:3107: result: $LINT" >&5
 echo "${ECHO_T}$LINT" >&6
 else
-  echo "$as_me:3390: result: no" >&5
+  echo "$as_me:3110: result: no" >&5
 echo "${ECHO_T}no" >&6
 fi
 
   test -n "$LINT" && break
 done
 
-echo "$as_me:3397: checking whether ln -s works" >&5
+echo "$as_me:3117: checking whether ln -s works" >&5
 echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6
 LN_S=$as_ln_s
 if test "$LN_S" = "ln -s"; then
-  echo "$as_me:3401: result: yes" >&5
+  echo "$as_me:3121: result: yes" >&5
 echo "${ECHO_T}yes" >&6
 else
-  echo "$as_me:3404: result: no, using $LN_S" >&5
+  echo "$as_me:3124: result: no, using $LN_S" >&5
 echo "${ECHO_T}no, using $LN_S" >&6
 fi
 
-echo "$as_me:3408: checking if $LN_S -f options work" >&5
+echo "$as_me:3128: checking if $LN_S -f options work" >&5
 echo $ECHO_N "checking if $LN_S -f options work... $ECHO_C" >&6
 
 rm -f conf$$.src conf$$dst
@@ -3417,12 +3137,12 @@
 	cf_prog_ln_sf=no
 fi
 rm -f conf$$.dst conf$$src
-echo "$as_me:3420: result: $cf_prog_ln_sf" >&5
+echo "$as_me:3140: result: $cf_prog_ln_sf" >&5
 echo "${ECHO_T}$cf_prog_ln_sf" >&6
 
 test "$cf_prog_ln_sf" = yes && LN_S="$LN_S -f"
 
-echo "$as_me:3425: checking for long file names" >&5
+echo "$as_me:3145: checking for long file names" >&5
 echo $ECHO_N "checking for long file names... $ECHO_C" >&6
 if test "${ac_cv_sys_long_file_names+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -3461,7 +3181,7 @@
   rm -rf $ac_xdir 2>/dev/null
 done
 fi
-echo "$as_me:3464: result: $ac_cv_sys_long_file_names" >&5
+echo "$as_me:3184: result: $ac_cv_sys_long_file_names" >&5
 echo "${ECHO_T}$ac_cv_sys_long_file_names" >&6
 if test $ac_cv_sys_long_file_names = yes; then
 
@@ -3473,7 +3193,7 @@
 
 # if we find pkg-config, check if we should install the ".pc" files.
 
-echo "$as_me:3476: checking if you want to use pkg-config" >&5
+echo "$as_me:3196: checking if you want to use pkg-config" >&5
 echo $ECHO_N "checking if you want to use pkg-config... $ECHO_C" >&6
 
 # Check whether --with-pkg-config or --without-pkg-config was given.
@@ -3483,7 +3203,7 @@
 else
   cf_pkg_config=yes
 fi;
-echo "$as_me:3486: result: $cf_pkg_config" >&5
+echo "$as_me:3206: result: $cf_pkg_config" >&5
 echo "${ECHO_T}$cf_pkg_config" >&6
 
 case $cf_pkg_config in #(vi
@@ -3491,10 +3211,11 @@
 	PKG_CONFIG=none
 	;;
 yes) #(vi
-	if test -n "$ac_tool_prefix"; then
+
+if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args.
 set dummy ${ac_tool_prefix}pkg-config; ac_word=$2
-echo "$as_me:3497: checking for $ac_word" >&5
+echo "$as_me:3218: checking for $ac_word" >&5
 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
 if test "${ac_cv_path_PKG_CONFIG+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -3511,7 +3232,7 @@
   test -z "$ac_dir" && ac_dir=.
   if $as_executable_p "$ac_dir/$ac_word"; then
    ac_cv_path_PKG_CONFIG="$ac_dir/$ac_word"
-   echo "$as_me:3514: found $ac_dir/$ac_word" >&5
+   echo "$as_me:3235: found $ac_dir/$ac_word" >&5
    break
 fi
 done
@@ -3522,10 +3243,10 @@
 PKG_CONFIG=$ac_cv_path_PKG_CONFIG
 
 if test -n "$PKG_CONFIG"; then
-  echo "$as_me:3525: result: $PKG_CONFIG" >&5
+  echo "$as_me:3246: result: $PKG_CONFIG" >&5
 echo "${ECHO_T}$PKG_CONFIG" >&6
 else
-  echo "$as_me:3528: result: no" >&5
+  echo "$as_me:3249: result: no" >&5
 echo "${ECHO_T}no" >&6
 fi
 
@@ -3534,7 +3255,7 @@
   ac_pt_PKG_CONFIG=$PKG_CONFIG
   # Extract the first word of "pkg-config", so it can be a program name with args.
 set dummy pkg-config; ac_word=$2
-echo "$as_me:3537: checking for $ac_word" >&5
+echo "$as_me:3258: checking for $ac_word" >&5
 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
 if test "${ac_cv_path_ac_pt_PKG_CONFIG+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -3551,7 +3272,7 @@
   test -z "$ac_dir" && ac_dir=.
   if $as_executable_p "$ac_dir/$ac_word"; then
    ac_cv_path_ac_pt_PKG_CONFIG="$ac_dir/$ac_word"
-   echo "$as_me:3554: found $ac_dir/$ac_word" >&5
+   echo "$as_me:3275: found $ac_dir/$ac_word" >&5
    break
 fi
 done
@@ -3563,10 +3284,10 @@
 ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG
 
 if test -n "$ac_pt_PKG_CONFIG"; then
-  echo "$as_me:3566: result: $ac_pt_PKG_CONFIG" >&5
+  echo "$as_me:3287: result: $ac_pt_PKG_CONFIG" >&5
 echo "${ECHO_T}$ac_pt_PKG_CONFIG" >&6
 else
-  echo "$as_me:3569: result: no" >&5
+  echo "$as_me:3290: result: no" >&5
 echo "${ECHO_T}no" >&6
 fi
 
@@ -3597,7 +3318,7 @@
   ;;
 .[a-zA-Z]:[\\/]*) #(vi OS/2 EMX
   ;;
-.\${*prefix}*) #(vi
+.\${*prefix}*|.\${*dir}*) #(vi
   eval PKG_CONFIG="$PKG_CONFIG"
   case ".$PKG_CONFIG" in #(vi
   .NONE/*)
@@ -3609,7 +3330,7 @@
   PKG_CONFIG=`echo $PKG_CONFIG | sed -e s%NONE%$cf_path_syntax%`
   ;;
 *)
-  { { echo "$as_me:3612: error: expected a pathname, not \"$PKG_CONFIG\"" >&5
+  { { echo "$as_me:3333: error: expected a pathname, not \"$PKG_CONFIG\"" >&5
 echo "$as_me: error: expected a pathname, not \"$PKG_CONFIG\"" >&2;}
    { (exit 1); exit 1; }; }
   ;;
@@ -3617,16 +3338,51 @@
 
 fi
 
-if test "$PKG_CONFIG" != no ; then
-	echo "$as_me:3621: checking if we should install .pc files for $PKG_CONFIG" >&5
-echo $ECHO_N "checking if we should install .pc files for $PKG_CONFIG... $ECHO_C" >&6
+if test "$PKG_CONFIG" != none ; then
+	echo "$as_me:3342: checking for $PKG_CONFIG library directory" >&5
+echo $ECHO_N "checking for $PKG_CONFIG library directory... $ECHO_C" >&6
 
-	# Leave this as something that can be overridden in the environment.
-	if test -z "$PKG_CONFIG_LIBDIR" ; then
-		PKG_CONFIG_LIBDIR=`echo "$PKG_CONFIG" | sed -e 's,/[^/]*/[^/]*$,,'`/lib/pkgconfig
-	fi
-	PKG_CONFIG_LIBDIR=`echo "$PKG_CONFIG_LIBDIR" | sed -e 's/^://' -e 's/:.*//'`
-	if test -n "$PKG_CONFIG_LIBDIR" && test -d "$PKG_CONFIG_LIBDIR" ; then
+# Check whether --with-pkg-config-libdir or --without-pkg-config-libdir was given.
+if test "${with_pkg_config_libdir+set}" = set; then
+  withval="$with_pkg_config_libdir"
+  PKG_CONFIG_LIBDIR=$withval
+else
+  PKG_CONFIG_LIBDIR=yes
+fi;
+
+	case x$PKG_CONFIG_LIBDIR in #(vi
+	x/*) #(vi
+		;;
+	xyes) #(vi
+		# look for the library directory using the same prefix as the executable
+		cf_path=`echo "$PKG_CONFIG" | sed -e 's,/[^/]*/[^/]*$,,'`
+		case x`(arch) 2>/dev/null` in #(vi
+		*64) #(vi
+			for cf_config in $cf_path/share $cf_path/lib64 $cf_path/lib32 $cf_path/lib
+			do
+				if test -d $cf_config/pkgconfig
+				then
+					PKG_CONFIG_LIBDIR=$cf_config/pkgconfig
+					break
+				fi
+			done
+			;;
+		*)
+			PKG_CONFIG_LIBDIR=$cf_path/lib/pkgconfig
+			;;
+		esac
+		;;
+	*)
+		;;
+	esac
+
+	echo "$as_me:3379: result: $PKG_CONFIG_LIBDIR" >&5
+echo "${ECHO_T}$PKG_CONFIG_LIBDIR" >&6
+fi
+
+if test "$PKG_CONFIG" != none ; then
+	echo "$as_me:3384: checking if we should install .pc files for $PKG_CONFIG" >&5
+echo $ECHO_N "checking if we should install .pc files for $PKG_CONFIG... $ECHO_C" >&6
 
 # Check whether --enable-pc-files or --disable-pc-files was given.
 if test "${enable_pc_files+set}" = set; then
@@ -3635,18 +3391,48 @@
 else
   enable_pc_files=no
 fi;
-		echo "$as_me:3638: result: $enable_pc_files" >&5
+	echo "$as_me:3394: result: $enable_pc_files" >&5
 echo "${ECHO_T}$enable_pc_files" >&6
-	else
-		echo "$as_me:3641: result: no" >&5
-echo "${ECHO_T}no" >&6
-		{ echo "$as_me:3643: WARNING: did not find library $PKG_CONFIG_LIBDIR" >&5
-echo "$as_me: WARNING: did not find library $PKG_CONFIG_LIBDIR" >&2;}
-		enable_pc_files=no
+	if test "$enable_pc_files" != no
+	then
+
+if test "x$prefix" != xNONE; then
+  cf_path_syntax="$prefix"
+else
+  cf_path_syntax="$ac_default_prefix"
+fi
+
+case ".$PKG_CONFIG_LIBDIR" in #(vi
+.\$\(*\)*|.\'*\'*) #(vi
+  ;;
+..|./*|.\\*) #(vi
+  ;;
+.[a-zA-Z]:[\\/]*) #(vi OS/2 EMX
+  ;;
+.\${*prefix}*|.\${*dir}*) #(vi
+  eval PKG_CONFIG_LIBDIR="$PKG_CONFIG_LIBDIR"
+  case ".$PKG_CONFIG_LIBDIR" in #(vi
+  .NONE/*)
+    PKG_CONFIG_LIBDIR=`echo $PKG_CONFIG_LIBDIR | sed -e s%NONE%$cf_path_syntax%`
+    ;;
+  esac
+  ;; #(vi
+.no|.NONE/*)
+  PKG_CONFIG_LIBDIR=`echo $PKG_CONFIG_LIBDIR | sed -e s%NONE%$cf_path_syntax%`
+  ;;
+*)
+  { { echo "$as_me:3424: error: expected a pathname, not \"$PKG_CONFIG_LIBDIR\"" >&5
+echo "$as_me: error: expected a pathname, not \"$PKG_CONFIG_LIBDIR\"" >&2;}
+   { (exit 1); exit 1; }; }
+  ;;
+esac
+
 	fi
+else
+	enable_pc_files=no
 fi
 
-echo "$as_me:3649: checking if we should assume mixed-case filenames" >&5
+echo "$as_me:3435: checking if we should assume mixed-case filenames" >&5
 echo $ECHO_N "checking if we should assume mixed-case filenames... $ECHO_C" >&6
 
 # Check whether --enable-mixed-case or --disable-mixed-case was given.
@@ -3656,11 +3442,11 @@
 else
   enable_mixedcase=auto
 fi;
-echo "$as_me:3659: result: $enable_mixedcase" >&5
+echo "$as_me:3445: result: $enable_mixedcase" >&5
 echo "${ECHO_T}$enable_mixedcase" >&6
 if test "$enable_mixedcase" = "auto" ; then
 
-echo "$as_me:3663: checking if filesystem supports mixed-case filenames" >&5
+echo "$as_me:3449: checking if filesystem supports mixed-case filenames" >&5
 echo $ECHO_N "checking if filesystem supports mixed-case filenames... $ECHO_C" >&6
 if test "${cf_cv_mixedcase+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -3687,16 +3473,18 @@
 fi
 
 fi
-echo "$as_me:3690: result: $cf_cv_mixedcase" >&5
+echo "$as_me:3476: result: $cf_cv_mixedcase" >&5
 echo "${ECHO_T}$cf_cv_mixedcase" >&6
-test "$cf_cv_mixedcase" = yes && cat >>confdefs.h <<\EOF
+test "$cf_cv_mixedcase" = yes &&
+cat >>confdefs.h <<\EOF
 #define MIXEDCASE_FILENAMES 1
 EOF
 
 else
     cf_cv_mixedcase=$enable_mixedcase
-    if test "$enable_mixedcase" = "yes" ; then
-        cat >>confdefs.h <<\EOF
+    if test "x$enable_mixedcase" = "xyes" ; then
+
+cat >>confdefs.h <<\EOF
 #define MIXEDCASE_FILENAMES 1
 EOF
 
@@ -3704,7 +3492,7 @@
 fi
 
 # do this after mixed-case option (tags/TAGS is not as important as tic).
-echo "$as_me:3707: checking whether ${MAKE-make} sets \${MAKE}" >&5
+echo "$as_me:3495: checking whether ${MAKE-make} sets \${MAKE}" >&5
 echo $ECHO_N "checking whether ${MAKE-make} sets \${MAKE}... $ECHO_C" >&6
 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,./+-,__p_,'`
 if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then
@@ -3724,11 +3512,11 @@
 rm -f conftest.make
 fi
 if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then
-  echo "$as_me:3727: result: yes" >&5
+  echo "$as_me:3515: result: yes" >&5
 echo "${ECHO_T}yes" >&6
   SET_MAKE=
 else
-  echo "$as_me:3731: result: no" >&5
+  echo "$as_me:3519: result: no" >&5
 echo "${ECHO_T}no" >&6
   SET_MAKE="MAKE=${MAKE-make}"
 fi
@@ -3737,7 +3525,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 "$as_me:3740: checking for $ac_word" >&5
+echo "$as_me:3528: checking for $ac_word" >&5
 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
 if test "${ac_cv_prog_CTAGS+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -3752,7 +3540,7 @@
   test -z "$ac_dir" && ac_dir=.
   $as_executable_p "$ac_dir/$ac_word" || continue
 ac_cv_prog_CTAGS="$ac_prog"
-echo "$as_me:3755: found $ac_dir/$ac_word" >&5
+echo "$as_me:3543: found $ac_dir/$ac_word" >&5
 break
 done
 
@@ -3760,10 +3548,10 @@
 fi
 CTAGS=$ac_cv_prog_CTAGS
 if test -n "$CTAGS"; then
-  echo "$as_me:3763: result: $CTAGS" >&5
+  echo "$as_me:3551: result: $CTAGS" >&5
 echo "${ECHO_T}$CTAGS" >&6
 else
-  echo "$as_me:3766: result: no" >&5
+  echo "$as_me:3554: result: no" >&5
 echo "${ECHO_T}no" >&6
 fi
 
@@ -3774,7 +3562,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 "$as_me:3777: checking for $ac_word" >&5
+echo "$as_me:3565: checking for $ac_word" >&5
 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
 if test "${ac_cv_prog_ETAGS+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -3789,7 +3577,7 @@
   test -z "$ac_dir" && ac_dir=.
   $as_executable_p "$ac_dir/$ac_word" || continue
 ac_cv_prog_ETAGS="$ac_prog"
-echo "$as_me:3792: found $ac_dir/$ac_word" >&5
+echo "$as_me:3580: found $ac_dir/$ac_word" >&5
 break
 done
 
@@ -3797,10 +3585,10 @@
 fi
 ETAGS=$ac_cv_prog_ETAGS
 if test -n "$ETAGS"; then
-  echo "$as_me:3800: result: $ETAGS" >&5
+  echo "$as_me:3588: result: $ETAGS" >&5
 echo "${ECHO_T}$ETAGS" >&6
 else
-  echo "$as_me:3803: result: no" >&5
+  echo "$as_me:3591: result: no" >&5
 echo "${ECHO_T}no" >&6
 fi
 
@@ -3809,7 +3597,7 @@
 
 # Extract the first word of "${CTAGS:-ctags}", so it can be a program name with args.
 set dummy ${CTAGS:-ctags}; ac_word=$2
-echo "$as_me:3812: checking for $ac_word" >&5
+echo "$as_me:3600: checking for $ac_word" >&5
 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
 if test "${ac_cv_prog_MAKE_LOWER_TAGS+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -3824,7 +3612,7 @@
   test -z "$ac_dir" && ac_dir=.
   $as_executable_p "$ac_dir/$ac_word" || continue
 ac_cv_prog_MAKE_LOWER_TAGS="yes"
-echo "$as_me:3827: found $ac_dir/$ac_word" >&5
+echo "$as_me:3615: found $ac_dir/$ac_word" >&5
 break
 done
 
@@ -3833,17 +3621,17 @@
 fi
 MAKE_LOWER_TAGS=$ac_cv_prog_MAKE_LOWER_TAGS
 if test -n "$MAKE_LOWER_TAGS"; then
-  echo "$as_me:3836: result: $MAKE_LOWER_TAGS" >&5
+  echo "$as_me:3624: result: $MAKE_LOWER_TAGS" >&5
 echo "${ECHO_T}$MAKE_LOWER_TAGS" >&6
 else
-  echo "$as_me:3839: result: no" >&5
+  echo "$as_me:3627: result: no" >&5
 echo "${ECHO_T}no" >&6
 fi
 
 if test "$cf_cv_mixedcase" = yes ; then
 	# Extract the first word of "${ETAGS:-etags}", so it can be a program name with args.
 set dummy ${ETAGS:-etags}; ac_word=$2
-echo "$as_me:3846: checking for $ac_word" >&5
+echo "$as_me:3634: checking for $ac_word" >&5
 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
 if test "${ac_cv_prog_MAKE_UPPER_TAGS+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -3858,7 +3646,7 @@
   test -z "$ac_dir" && ac_dir=.
   $as_executable_p "$ac_dir/$ac_word" || continue
 ac_cv_prog_MAKE_UPPER_TAGS="yes"
-echo "$as_me:3861: found $ac_dir/$ac_word" >&5
+echo "$as_me:3649: found $ac_dir/$ac_word" >&5
 break
 done
 
@@ -3867,10 +3655,10 @@
 fi
 MAKE_UPPER_TAGS=$ac_cv_prog_MAKE_UPPER_TAGS
 if test -n "$MAKE_UPPER_TAGS"; then
-  echo "$as_me:3870: result: $MAKE_UPPER_TAGS" >&5
+  echo "$as_me:3658: result: $MAKE_UPPER_TAGS" >&5
 echo "${ECHO_T}$MAKE_UPPER_TAGS" >&6
 else
-  echo "$as_me:3873: result: no" >&5
+  echo "$as_me:3661: result: no" >&5
 echo "${ECHO_T}no" >&6
 fi
 
@@ -3890,7 +3678,7 @@
 	MAKE_LOWER_TAGS="#"
 fi
 
-echo "$as_me:3893: checking for makeflags variable" >&5
+echo "$as_me:3681: checking for makeflags variable" >&5
 echo $ECHO_N "checking for makeflags variable... $ECHO_C" >&6
 if test "${cf_cv_makeflags+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -3924,13 +3712,13 @@
 	rm -f cf_makeflags.tmp
 
 fi
-echo "$as_me:3927: result: $cf_cv_makeflags" >&5
+echo "$as_me:3715: result: $cf_cv_makeflags" >&5
 echo "${ECHO_T}$cf_cv_makeflags" >&6
 
 if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
 set dummy ${ac_tool_prefix}ranlib; ac_word=$2
-echo "$as_me:3933: checking for $ac_word" >&5
+echo "$as_me:3721: checking for $ac_word" >&5
 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
 if test "${ac_cv_prog_RANLIB+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -3945,7 +3733,7 @@
   test -z "$ac_dir" && ac_dir=.
   $as_executable_p "$ac_dir/$ac_word" || continue
 ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
-echo "$as_me:3948: found $ac_dir/$ac_word" >&5
+echo "$as_me:3736: found $ac_dir/$ac_word" >&5
 break
 done
 
@@ -3953,10 +3741,10 @@
 fi
 RANLIB=$ac_cv_prog_RANLIB
 if test -n "$RANLIB"; then
-  echo "$as_me:3956: result: $RANLIB" >&5
+  echo "$as_me:3744: result: $RANLIB" >&5
 echo "${ECHO_T}$RANLIB" >&6
 else
-  echo "$as_me:3959: result: no" >&5
+  echo "$as_me:3747: result: no" >&5
 echo "${ECHO_T}no" >&6
 fi
 
@@ -3965,7 +3753,7 @@
   ac_ct_RANLIB=$RANLIB
   # Extract the first word of "ranlib", so it can be a program name with args.
 set dummy ranlib; ac_word=$2
-echo "$as_me:3968: checking for $ac_word" >&5
+echo "$as_me:3756: checking for $ac_word" >&5
 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
 if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -3980,7 +3768,7 @@
   test -z "$ac_dir" && ac_dir=.
   $as_executable_p "$ac_dir/$ac_word" || continue
 ac_cv_prog_ac_ct_RANLIB="ranlib"
-echo "$as_me:3983: found $ac_dir/$ac_word" >&5
+echo "$as_me:3771: found $ac_dir/$ac_word" >&5
 break
 done
 
@@ -3989,10 +3777,10 @@
 fi
 ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
 if test -n "$ac_ct_RANLIB"; then
-  echo "$as_me:3992: result: $ac_ct_RANLIB" >&5
+  echo "$as_me:3780: result: $ac_ct_RANLIB" >&5
 echo "${ECHO_T}$ac_ct_RANLIB" >&6
 else
-  echo "$as_me:3995: result: no" >&5
+  echo "$as_me:3783: result: no" >&5
 echo "${ECHO_T}no" >&6
 fi
 
@@ -4004,7 +3792,7 @@
 if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}ld", so it can be a program name with args.
 set dummy ${ac_tool_prefix}ld; ac_word=$2
-echo "$as_me:4007: checking for $ac_word" >&5
+echo "$as_me:3795: checking for $ac_word" >&5
 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
 if test "${ac_cv_prog_LD+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -4019,7 +3807,7 @@
   test -z "$ac_dir" && ac_dir=.
   $as_executable_p "$ac_dir/$ac_word" || continue
 ac_cv_prog_LD="${ac_tool_prefix}ld"
-echo "$as_me:4022: found $ac_dir/$ac_word" >&5
+echo "$as_me:3810: found $ac_dir/$ac_word" >&5
 break
 done
 
@@ -4027,10 +3815,10 @@
 fi
 LD=$ac_cv_prog_LD
 if test -n "$LD"; then
-  echo "$as_me:4030: result: $LD" >&5
+  echo "$as_me:3818: result: $LD" >&5
 echo "${ECHO_T}$LD" >&6
 else
-  echo "$as_me:4033: result: no" >&5
+  echo "$as_me:3821: result: no" >&5
 echo "${ECHO_T}no" >&6
 fi
 
@@ -4039,7 +3827,7 @@
   ac_ct_LD=$LD
   # Extract the first word of "ld", so it can be a program name with args.
 set dummy ld; ac_word=$2
-echo "$as_me:4042: checking for $ac_word" >&5
+echo "$as_me:3830: checking for $ac_word" >&5
 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
 if test "${ac_cv_prog_ac_ct_LD+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -4054,7 +3842,7 @@
   test -z "$ac_dir" && ac_dir=.
   $as_executable_p "$ac_dir/$ac_word" || continue
 ac_cv_prog_ac_ct_LD="ld"
-echo "$as_me:4057: found $ac_dir/$ac_word" >&5
+echo "$as_me:3845: found $ac_dir/$ac_word" >&5
 break
 done
 
@@ -4063,10 +3851,10 @@
 fi
 ac_ct_LD=$ac_cv_prog_ac_ct_LD
 if test -n "$ac_ct_LD"; then
-  echo "$as_me:4066: result: $ac_ct_LD" >&5
+  echo "$as_me:3854: result: $ac_ct_LD" >&5
 echo "${ECHO_T}$ac_ct_LD" >&6
 else
-  echo "$as_me:4069: result: no" >&5
+  echo "$as_me:3857: result: no" >&5
 echo "${ECHO_T}no" >&6
 fi
 
@@ -4078,7 +3866,7 @@
 if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
 set dummy ${ac_tool_prefix}ar; ac_word=$2
-echo "$as_me:4081: checking for $ac_word" >&5
+echo "$as_me:3869: checking for $ac_word" >&5
 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
 if test "${ac_cv_prog_AR+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -4093,7 +3881,7 @@
   test -z "$ac_dir" && ac_dir=.
   $as_executable_p "$ac_dir/$ac_word" || continue
 ac_cv_prog_AR="${ac_tool_prefix}ar"
-echo "$as_me:4096: found $ac_dir/$ac_word" >&5
+echo "$as_me:3884: found $ac_dir/$ac_word" >&5
 break
 done
 
@@ -4101,10 +3889,10 @@
 fi
 AR=$ac_cv_prog_AR
 if test -n "$AR"; then
-  echo "$as_me:4104: result: $AR" >&5
+  echo "$as_me:3892: result: $AR" >&5
 echo "${ECHO_T}$AR" >&6
 else
-  echo "$as_me:4107: result: no" >&5
+  echo "$as_me:3895: result: no" >&5
 echo "${ECHO_T}no" >&6
 fi
 
@@ -4113,7 +3901,7 @@
   ac_ct_AR=$AR
   # Extract the first word of "ar", so it can be a program name with args.
 set dummy ar; ac_word=$2
-echo "$as_me:4116: checking for $ac_word" >&5
+echo "$as_me:3904: checking for $ac_word" >&5
 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
 if test "${ac_cv_prog_ac_ct_AR+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -4128,7 +3916,7 @@
   test -z "$ac_dir" && ac_dir=.
   $as_executable_p "$ac_dir/$ac_word" || continue
 ac_cv_prog_ac_ct_AR="ar"
-echo "$as_me:4131: found $ac_dir/$ac_word" >&5
+echo "$as_me:3919: found $ac_dir/$ac_word" >&5
 break
 done
 
@@ -4137,10 +3925,10 @@
 fi
 ac_ct_AR=$ac_cv_prog_ac_ct_AR
 if test -n "$ac_ct_AR"; then
-  echo "$as_me:4140: result: $ac_ct_AR" >&5
+  echo "$as_me:3928: result: $ac_ct_AR" >&5
 echo "${ECHO_T}$ac_ct_AR" >&6
 else
-  echo "$as_me:4143: result: no" >&5
+  echo "$as_me:3931: result: no" >&5
 echo "${ECHO_T}no" >&6
 fi
 
@@ -4152,7 +3940,7 @@
 if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
 set dummy ${ac_tool_prefix}ar; ac_word=$2
-echo "$as_me:4155: checking for $ac_word" >&5
+echo "$as_me:3943: checking for $ac_word" >&5
 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
 if test "${ac_cv_prog_AR+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -4167,7 +3955,7 @@
   test -z "$ac_dir" && ac_dir=.
   $as_executable_p "$ac_dir/$ac_word" || continue
 ac_cv_prog_AR="${ac_tool_prefix}ar"
-echo "$as_me:4170: found $ac_dir/$ac_word" >&5
+echo "$as_me:3958: found $ac_dir/$ac_word" >&5
 break
 done
 
@@ -4175,10 +3963,10 @@
 fi
 AR=$ac_cv_prog_AR
 if test -n "$AR"; then
-  echo "$as_me:4178: result: $AR" >&5
+  echo "$as_me:3966: result: $AR" >&5
 echo "${ECHO_T}$AR" >&6
 else
-  echo "$as_me:4181: result: no" >&5
+  echo "$as_me:3969: result: no" >&5
 echo "${ECHO_T}no" >&6
 fi
 
@@ -4187,7 +3975,7 @@
   ac_ct_AR=$AR
   # Extract the first word of "ar", so it can be a program name with args.
 set dummy ar; ac_word=$2
-echo "$as_me:4190: checking for $ac_word" >&5
+echo "$as_me:3978: checking for $ac_word" >&5
 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
 if test "${ac_cv_prog_ac_ct_AR+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -4202,7 +3990,7 @@
   test -z "$ac_dir" && ac_dir=.
   $as_executable_p "$ac_dir/$ac_word" || continue
 ac_cv_prog_ac_ct_AR="ar"
-echo "$as_me:4205: found $ac_dir/$ac_word" >&5
+echo "$as_me:3993: found $ac_dir/$ac_word" >&5
 break
 done
 
@@ -4211,10 +3999,10 @@
 fi
 ac_ct_AR=$ac_cv_prog_ac_ct_AR
 if test -n "$ac_ct_AR"; then
-  echo "$as_me:4214: result: $ac_ct_AR" >&5
+  echo "$as_me:4002: result: $ac_ct_AR" >&5
 echo "${ECHO_T}$ac_ct_AR" >&6
 else
-  echo "$as_me:4217: result: no" >&5
+  echo "$as_me:4005: result: no" >&5
 echo "${ECHO_T}no" >&6
 fi
 
@@ -4223,7 +4011,7 @@
   AR="$ac_cv_prog_AR"
 fi
 
-echo "$as_me:4226: checking for options to update archives" >&5
+echo "$as_me:4014: checking for options to update archives" >&5
 echo $ECHO_N "checking for options to update archives... $ECHO_C" >&6
 if test "${cf_cv_ar_flags+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -4246,13 +4034,13 @@
 		rm -f conftest.a
 
 		cat >conftest.$ac_ext <<EOF
-#line 4249 "configure"
+#line 4037 "configure"
 int	testdata[3] = { 123, 456, 789 };
 EOF
-		if { (eval echo "$as_me:4252: \"$ac_compile\"") >&5
+		if { (eval echo "$as_me:4040: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:4255: \$? = $ac_status" >&5
+  echo "$as_me:4043: \$? = $ac_status" >&5
   (exit $ac_status); } ; then
 			echo "$AR $ARFLAGS $cf_ar_flags conftest.a conftest.$ac_cv_objext" >&5
 			$AR $ARFLAGS $cf_ar_flags conftest.a conftest.$ac_cv_objext 2>&5 1>/dev/null
@@ -4263,7 +4051,7 @@
 		else
 			test -n "$verbose" && echo "	cannot compile test-program" 1>&6
 
-echo "${as_me:-configure}:4266: testing cannot compile test-program ..." 1>&5
+echo "${as_me:-configure}:4054: testing cannot compile test-program ..." 1>&5
 
 			break
 		fi
@@ -4271,7 +4059,7 @@
 	rm -f conftest.a conftest.$ac_ext conftest.$ac_cv_objext
 
 fi
-echo "$as_me:4274: result: $cf_cv_ar_flags" >&5
+echo "$as_me:4062: result: $cf_cv_ar_flags" >&5
 echo "${ECHO_T}$cf_cv_ar_flags" >&6
 
 if test -n "$ARFLAGS" ; then
@@ -4282,20 +4070,20 @@
 	ARFLAGS=$cf_cv_ar_flags
 fi
 
-echo "$as_me:4285: checking if you have specified an install-prefix" >&5
+echo "$as_me:4073: checking if you have specified an install-prefix" >&5
 echo $ECHO_N "checking if you have specified an install-prefix... $ECHO_C" >&6
 
 # Check whether --with-install-prefix or --without-install-prefix was given.
 if test "${with_install_prefix+set}" = set; then
   withval="$with_install_prefix"
-  case "$withval" in #(vi
-	yes|no) #(vi
+  case "x$withval" in #(vi
+	xyes|xno) #(vi
 		;;
 	*)	DESTDIR="$withval"
 		;;
 	esac
 fi;
-echo "$as_me:4298: result: $DESTDIR" >&5
+echo "$as_me:4086: result: $DESTDIR" >&5
 echo "${ECHO_T}$DESTDIR" >&6
 
 ###############################################################################
@@ -4323,7 +4111,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 "$as_me:4326: checking for $ac_word" >&5
+echo "$as_me:4114: checking for $ac_word" >&5
 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
 if test "${ac_cv_prog_BUILD_CC+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -4338,7 +4126,7 @@
   test -z "$ac_dir" && ac_dir=.
   $as_executable_p "$ac_dir/$ac_word" || continue
 ac_cv_prog_BUILD_CC="$ac_prog"
-echo "$as_me:4341: found $ac_dir/$ac_word" >&5
+echo "$as_me:4129: found $ac_dir/$ac_word" >&5
 break
 done
 
@@ -4346,10 +4134,10 @@
 fi
 BUILD_CC=$ac_cv_prog_BUILD_CC
 if test -n "$BUILD_CC"; then
-  echo "$as_me:4349: result: $BUILD_CC" >&5
+  echo "$as_me:4137: result: $BUILD_CC" >&5
 echo "${ECHO_T}$BUILD_CC" >&6
 else
-  echo "$as_me:4352: result: no" >&5
+  echo "$as_me:4140: result: no" >&5
 echo "${ECHO_T}no" >&6
 fi
 
@@ -4357,12 +4145,12 @@
 done
 
 fi;
-	echo "$as_me:4360: checking for native build C compiler" >&5
+	echo "$as_me:4148: checking for native build C compiler" >&5
 echo $ECHO_N "checking for native build C compiler... $ECHO_C" >&6
-	echo "$as_me:4362: result: $BUILD_CC" >&5
+	echo "$as_me:4150: result: $BUILD_CC" >&5
 echo "${ECHO_T}$BUILD_CC" >&6
 
-	echo "$as_me:4365: checking for native build C preprocessor" >&5
+	echo "$as_me:4153: checking for native build C preprocessor" >&5
 echo $ECHO_N "checking for native build C preprocessor... $ECHO_C" >&6
 
 # Check whether --with-build-cpp or --without-build-cpp was given.
@@ -4372,10 +4160,10 @@
 else
   BUILD_CPP='${BUILD_CC} -E'
 fi;
-	echo "$as_me:4375: result: $BUILD_CPP" >&5
+	echo "$as_me:4163: result: $BUILD_CPP" >&5
 echo "${ECHO_T}$BUILD_CPP" >&6
 
-	echo "$as_me:4378: checking for native build C flags" >&5
+	echo "$as_me:4166: checking for native build C flags" >&5
 echo $ECHO_N "checking for native build C flags... $ECHO_C" >&6
 
 # Check whether --with-build-cflags or --without-build-cflags was given.
@@ -4383,10 +4171,10 @@
   withval="$with_build_cflags"
   BUILD_CFLAGS="$withval"
 fi;
-	echo "$as_me:4386: result: $BUILD_CFLAGS" >&5
+	echo "$as_me:4174: result: $BUILD_CFLAGS" >&5
 echo "${ECHO_T}$BUILD_CFLAGS" >&6
 
-	echo "$as_me:4389: checking for native build C preprocessor-flags" >&5
+	echo "$as_me:4177: checking for native build C preprocessor-flags" >&5
 echo $ECHO_N "checking for native build C preprocessor-flags... $ECHO_C" >&6
 
 # Check whether --with-build-cppflags or --without-build-cppflags was given.
@@ -4394,10 +4182,10 @@
   withval="$with_build_cppflags"
   BUILD_CPPFLAGS="$withval"
 fi;
-	echo "$as_me:4397: result: $BUILD_CPPFLAGS" >&5
+	echo "$as_me:4185: result: $BUILD_CPPFLAGS" >&5
 echo "${ECHO_T}$BUILD_CPPFLAGS" >&6
 
-	echo "$as_me:4400: checking for native build linker-flags" >&5
+	echo "$as_me:4188: checking for native build linker-flags" >&5
 echo $ECHO_N "checking for native build linker-flags... $ECHO_C" >&6
 
 # Check whether --with-build-ldflags or --without-build-ldflags was given.
@@ -4405,10 +4193,10 @@
   withval="$with_build_ldflags"
   BUILD_LDFLAGS="$withval"
 fi;
-	echo "$as_me:4408: result: $BUILD_LDFLAGS" >&5
+	echo "$as_me:4196: result: $BUILD_LDFLAGS" >&5
 echo "${ECHO_T}$BUILD_LDFLAGS" >&6
 
-	echo "$as_me:4411: checking for native build linker-libraries" >&5
+	echo "$as_me:4199: checking for native build linker-libraries" >&5
 echo $ECHO_N "checking for native build linker-libraries... $ECHO_C" >&6
 
 # Check whether --with-build-libs or --without-build-libs was given.
@@ -4416,7 +4204,7 @@
   withval="$with_build_libs"
   BUILD_LIBS="$withval"
 fi;
-	echo "$as_me:4419: result: $BUILD_LIBS" >&5
+	echo "$as_me:4207: result: $BUILD_LIBS" >&5
 echo "${ECHO_T}$BUILD_LIBS" >&6
 
 	# this assumes we're on Unix.
@@ -4426,7 +4214,7 @@
 	: ${BUILD_CC:='${CC}'}
 
 	if ( test "$BUILD_CC" = "$CC" || test "$BUILD_CC" = '${CC}' ) ; then
-		{ { echo "$as_me:4429: error: Cross-build requires two compilers.
+		{ { echo "$as_me:4217: error: Cross-build requires two compilers.
 Use --with-build-cc to specify the native compiler." >&5
 echo "$as_me: error: Cross-build requires two compilers.
 Use --with-build-cc to specify the native compiler." >&2;}
@@ -4451,7 +4239,7 @@
 ### shared, for example.
 cf_list_models=""
 
-echo "$as_me:4454: checking if libtool -version-number should be used" >&5
+echo "$as_me:4242: checking if libtool -version-number should be used" >&5
 echo $ECHO_N "checking if libtool -version-number should be used... $ECHO_C" >&6
 
 # Check whether --enable-libtool-version or --disable-libtool-version was given.
@@ -4468,7 +4256,7 @@
   cf_libtool_version=yes
 
 fi;
-echo "$as_me:4471: result: $cf_libtool_version" >&5
+echo "$as_me:4259: result: $cf_libtool_version" >&5
 echo "${ECHO_T}$cf_libtool_version" >&6
 
 if test "$cf_libtool_version" = yes ; then
@@ -4493,7 +4281,7 @@
 LIB_INSTALL=
 LIB_UNINSTALL=
 
-echo "$as_me:4496: checking if you want to build libraries with libtool" >&5
+echo "$as_me:4284: checking if you want to build libraries with libtool" >&5
 echo $ECHO_N "checking if you want to build libraries with libtool... $ECHO_C" >&6
 
 # Check whether --with-libtool or --without-libtool was given.
@@ -4503,7 +4291,7 @@
 else
   with_libtool=no
 fi;
-echo "$as_me:4506: result: $with_libtool" >&5
+echo "$as_me:4294: result: $with_libtool" >&5
 echo "${ECHO_T}$with_libtool" >&6
 if test "$with_libtool" != "no"; then
 
@@ -4522,7 +4310,7 @@
   ;;
 .[a-zA-Z]:[\\/]*) #(vi OS/2 EMX
   ;;
-.\${*prefix}*) #(vi
+.\${*prefix}*|.\${*dir}*) #(vi
   eval with_libtool="$with_libtool"
   case ".$with_libtool" in #(vi
   .NONE/*)
@@ -4534,7 +4322,7 @@
   with_libtool=`echo $with_libtool | sed -e s%NONE%$cf_path_syntax%`
   ;;
 *)
-  { { echo "$as_me:4537: error: expected a pathname, not \"$with_libtool\"" >&5
+  { { echo "$as_me:4325: error: expected a pathname, not \"$with_libtool\"" >&5
 echo "$as_me: error: expected a pathname, not \"$with_libtool\"" >&2;}
    { (exit 1); exit 1; }; }
   ;;
@@ -4542,50 +4330,199 @@
 
 		LIBTOOL=$with_libtool
 	else
-		# Extract the first word of "libtool", so it can be a program name with args.
-set dummy libtool; ac_word=$2
-echo "$as_me:4547: checking for $ac_word" >&5
+		if test -n "$ac_tool_prefix"; then
+  for ac_prog in libtool glibtool
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+echo "$as_me:4338: checking for $ac_word" >&5
 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_path_LIBTOOL+set}" = set; then
+if test "${ac_cv_prog_LIBTOOL+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  case $LIBTOOL in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_LIBTOOL="$LIBTOOL" # Let the user override the test with a path.
-  ;;
-  *)
+  if test -n "$LIBTOOL"; then
+  ac_cv_prog_LIBTOOL="$LIBTOOL" # Let the user override the test.
+else
   ac_save_IFS=$IFS; IFS=$ac_path_separator
 ac_dummy="$PATH"
 for ac_dir in $ac_dummy; do
   IFS=$ac_save_IFS
   test -z "$ac_dir" && ac_dir=.
-  if $as_executable_p "$ac_dir/$ac_word"; then
-   ac_cv_path_LIBTOOL="$ac_dir/$ac_word"
-   echo "$as_me:4564: found $ac_dir/$ac_word" >&5
-   break
+  $as_executable_p "$ac_dir/$ac_word" || continue
+ac_cv_prog_LIBTOOL="$ac_tool_prefix$ac_prog"
+echo "$as_me:4353: found $ac_dir/$ac_word" >&5
+break
+done
+
+fi
+fi
+LIBTOOL=$ac_cv_prog_LIBTOOL
+if test -n "$LIBTOOL"; then
+  echo "$as_me:4361: result: $LIBTOOL" >&5
+echo "${ECHO_T}$LIBTOOL" >&6
+else
+  echo "$as_me:4364: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+    test -n "$LIBTOOL" && break
+  done
 fi
+if test -z "$LIBTOOL"; then
+  ac_ct_LIBTOOL=$LIBTOOL
+  for ac_prog in libtool glibtool
+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 "$as_me:4377: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_LIBTOOL+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_LIBTOOL"; then
+  ac_cv_prog_ac_ct_LIBTOOL="$ac_ct_LIBTOOL" # Let the user override the test.
+else
+  ac_save_IFS=$IFS; IFS=$ac_path_separator
+ac_dummy="$PATH"
+for ac_dir in $ac_dummy; do
+  IFS=$ac_save_IFS
+  test -z "$ac_dir" && ac_dir=.
+  $as_executable_p "$ac_dir/$ac_word" || continue
+ac_cv_prog_ac_ct_LIBTOOL="$ac_prog"
+echo "$as_me:4392: found $ac_dir/$ac_word" >&5
+break
 done
 
-  ;;
-esac
 fi
-LIBTOOL=$ac_cv_path_LIBTOOL
+fi
+ac_ct_LIBTOOL=$ac_cv_prog_ac_ct_LIBTOOL
+if test -n "$ac_ct_LIBTOOL"; then
+  echo "$as_me:4400: result: $ac_ct_LIBTOOL" >&5
+echo "${ECHO_T}$ac_ct_LIBTOOL" >&6
+else
+  echo "$as_me:4403: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  test -n "$ac_ct_LIBTOOL" && break
+done
+test -n "$ac_ct_LIBTOOL" || ac_ct_LIBTOOL="none"
+
+  LIBTOOL=$ac_ct_LIBTOOL
+fi
+
+if test -n "$LIBTOOL" && test "$LIBTOOL" != none
+then
+	cf_cv_libtool_version=`$LIBTOOL --version 2>&1 | sed -e '/^$/d' |sed -e '2,$d' -e 's/([^)]*)//g' -e 's/^[^1-9]*//' -e 's/[^0-9.].*//'`
+else
+	cf_cv_libtool_version=
+fi
+test -z "$cf_cv_libtool_version" && unset cf_cv_libtool_version
+
+		if test -z "$cf_cv_libtool_version" && test "$LIBTOOL" = libtool
+		then
+
+unset ac_cv_prog_ac_ct_LIBTOOL
+unset ac_ct_LIBTOOL
+unset LIBTOOL
+
+			if test -n "$ac_tool_prefix"; then
+  for ac_prog in glibtool
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+echo "$as_me:4434: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_LIBTOOL+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$LIBTOOL"; then
+  ac_cv_prog_LIBTOOL="$LIBTOOL" # Let the user override the test.
+else
+  ac_save_IFS=$IFS; IFS=$ac_path_separator
+ac_dummy="$PATH"
+for ac_dir in $ac_dummy; do
+  IFS=$ac_save_IFS
+  test -z "$ac_dir" && ac_dir=.
+  $as_executable_p "$ac_dir/$ac_word" || continue
+ac_cv_prog_LIBTOOL="$ac_tool_prefix$ac_prog"
+echo "$as_me:4449: found $ac_dir/$ac_word" >&5
+break
+done
 
+fi
+fi
+LIBTOOL=$ac_cv_prog_LIBTOOL
 if test -n "$LIBTOOL"; then
-  echo "$as_me:4575: result: $LIBTOOL" >&5
+  echo "$as_me:4457: result: $LIBTOOL" >&5
 echo "${ECHO_T}$LIBTOOL" >&6
 else
-  echo "$as_me:4578: result: no" >&5
+  echo "$as_me:4460: result: no" >&5
 echo "${ECHO_T}no" >&6
 fi
 
+    test -n "$LIBTOOL" && break
+  done
+fi
+if test -z "$LIBTOOL"; then
+  ac_ct_LIBTOOL=$LIBTOOL
+  for ac_prog in glibtool
+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 "$as_me:4473: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_LIBTOOL+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_LIBTOOL"; then
+  ac_cv_prog_ac_ct_LIBTOOL="$ac_ct_LIBTOOL" # Let the user override the test.
+else
+  ac_save_IFS=$IFS; IFS=$ac_path_separator
+ac_dummy="$PATH"
+for ac_dir in $ac_dummy; do
+  IFS=$ac_save_IFS
+  test -z "$ac_dir" && ac_dir=.
+  $as_executable_p "$ac_dir/$ac_word" || continue
+ac_cv_prog_ac_ct_LIBTOOL="$ac_prog"
+echo "$as_me:4488: found $ac_dir/$ac_word" >&5
+break
+done
+
+fi
+fi
+ac_ct_LIBTOOL=$ac_cv_prog_ac_ct_LIBTOOL
+if test -n "$ac_ct_LIBTOOL"; then
+  echo "$as_me:4496: result: $ac_ct_LIBTOOL" >&5
+echo "${ECHO_T}$ac_ct_LIBTOOL" >&6
+else
+  echo "$as_me:4499: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  test -n "$ac_ct_LIBTOOL" && break
+done
+test -n "$ac_ct_LIBTOOL" || ac_ct_LIBTOOL="none"
+
+  LIBTOOL=$ac_ct_LIBTOOL
+fi
+
+if test -n "$LIBTOOL" && test "$LIBTOOL" != none
+then
+	cf_cv_libtool_version=`$LIBTOOL --version 2>&1 | sed -e '/^$/d' |sed -e '2,$d' -e 's/([^)]*)//g' -e 's/^[^1-9]*//' -e 's/[^0-9.].*//'`
+else
+	cf_cv_libtool_version=
+fi
+test -z "$cf_cv_libtool_version" && unset cf_cv_libtool_version
+
+		fi
 	fi
 	if test -z "$LIBTOOL" ; then
-		{ { echo "$as_me:4584: error: Cannot find libtool" >&5
+		{ { echo "$as_me:4521: error: Cannot find libtool" >&5
 echo "$as_me: error: Cannot find libtool" >&2;}
    { (exit 1); exit 1; }; }
 	fi
-	LIB_CREATE='${LIBTOOL} --mode=link ${CC} -rpath ${DESTDIR}${libdir} ${LIBTOOL_VERSION} `cut -f1 ${srcdir}/VERSION` ${LIBTOOL_OPTS} ${LT_UNDEF} -o'
+	LIB_CREATE='${LIBTOOL} --mode=link ${CC} -rpath ${DESTDIR}${libdir} ${LIBTOOL_VERSION} `cut -f1 ${srcdir}/VERSION` ${LIBTOOL_OPTS} ${LT_UNDEF} $(LIBS) -o'
 	LIB_OBJECT='${OBJECTS:.o=.lo}'
 	LIB_SUFFIX=.la
 	LIB_CLEAN='${LIBTOOL} --mode=clean'
@@ -4595,26 +4532,36 @@
 	LIB_UNINSTALL='${LIBTOOL} --mode=uninstall'
 	LIB_PREP=:
 
-	# Show the version of libtool
-	echo "$as_me:4599: checking version of libtool" >&5
-echo $ECHO_N "checking version of libtool... $ECHO_C" >&6
-
-	# Save the version in a cache variable - this is not entirely a good
-	# thing, but the version string from libtool is very ugly, and for
-	# bug reports it might be useful to have the original string. "("
+if test -n "$LIBTOOL" && test "$LIBTOOL" != none
+then
+	echo "$as_me:4537: checking version of $LIBTOOL" >&5
+echo $ECHO_N "checking version of $LIBTOOL... $ECHO_C" >&6
+
+if test -n "$LIBTOOL" && test "$LIBTOOL" != none
+then
 	cf_cv_libtool_version=`$LIBTOOL --version 2>&1 | sed -e '/^$/d' |sed -e '2,$d' -e 's/([^)]*)//g' -e 's/^[^1-9]*//' -e 's/[^0-9.].*//'`
-	echo "$as_me:4606: result: $cf_cv_libtool_version" >&5
+else
+	cf_cv_libtool_version=
+fi
+test -z "$cf_cv_libtool_version" && unset cf_cv_libtool_version
+
+	echo "$as_me:4548: result: $cf_cv_libtool_version" >&5
 echo "${ECHO_T}$cf_cv_libtool_version" >&6
 	if test -z "$cf_cv_libtool_version" ; then
-		{ { echo "$as_me:4609: error: This is not GNU libtool" >&5
+		{ { echo "$as_me:4551: error: This is not GNU libtool" >&5
 echo "$as_me: error: This is not GNU libtool" >&2;}
    { (exit 1); exit 1; }; }
 	fi
+else
+	{ { echo "$as_me:4556: error: GNU libtool has not been found" >&5
+echo "$as_me: error: GNU libtool has not been found" >&2;}
+   { (exit 1); exit 1; }; }
+fi
 
 	# special hack to add -no-undefined (which libtool should do for itself)
 	LT_UNDEF=
 	case "$cf_cv_system_name" in #(vi
-	cygwin*|mingw32*|uwin*|aix[456]) #(vi
+	cygwin*|mingw32*|uwin*|aix[4-7]) #(vi
 		LT_UNDEF=-no-undefined
 		;;
 	esac
@@ -4642,7 +4589,7 @@
 
 else
 
-echo "$as_me:4645: checking if you want to build shared libraries" >&5
+echo "$as_me:4592: checking if you want to build shared libraries" >&5
 echo $ECHO_N "checking if you want to build shared libraries... $ECHO_C" >&6
 
 # Check whether --with-shared or --without-shared was given.
@@ -4652,11 +4599,11 @@
 else
   with_shared=no
 fi;
-echo "$as_me:4655: result: $with_shared" >&5
+echo "$as_me:4602: result: $with_shared" >&5
 echo "${ECHO_T}$with_shared" >&6
-test "$with_shared" = "yes" && cf_list_models="$cf_list_models shared"
+test "x$with_shared" = "xyes" && cf_list_models="$cf_list_models shared"
 
-echo "$as_me:4659: checking if you want to build static libraries" >&5
+echo "$as_me:4606: checking if you want to build static libraries" >&5
 echo $ECHO_N "checking if you want to build static libraries... $ECHO_C" >&6
 
 # Check whether --with-normal or --without-normal was given.
@@ -4666,11 +4613,11 @@
 else
   with_normal=yes
 fi;
-echo "$as_me:4669: result: $with_normal" >&5
+echo "$as_me:4616: result: $with_normal" >&5
 echo "${ECHO_T}$with_normal" >&6
-test "$with_normal" = "yes" && cf_list_models="$cf_list_models normal"
+test "x$with_normal" = "xyes" && cf_list_models="$cf_list_models normal"
 
-echo "$as_me:4673: checking if you want to build debug libraries" >&5
+echo "$as_me:4620: checking if you want to build debug libraries" >&5
 echo $ECHO_N "checking if you want to build debug libraries... $ECHO_C" >&6
 
 # Check whether --with-debug or --without-debug was given.
@@ -4680,11 +4627,11 @@
 else
   with_debug=yes
 fi;
-echo "$as_me:4683: result: $with_debug" >&5
+echo "$as_me:4630: result: $with_debug" >&5
 echo "${ECHO_T}$with_debug" >&6
-test "$with_debug" = "yes" && cf_list_models="$cf_list_models debug"
+test "x$with_debug" = "xyes" && cf_list_models="$cf_list_models debug"
 
-echo "$as_me:4687: checking if you want to build profiling libraries" >&5
+echo "$as_me:4634: checking if you want to build profiling libraries" >&5
 echo $ECHO_N "checking if you want to build profiling libraries... $ECHO_C" >&6
 
 # Check whether --with-profile or --without-profile was given.
@@ -4694,27 +4641,44 @@
 else
   with_profile=no
 fi;
-echo "$as_me:4697: result: $with_profile" >&5
+echo "$as_me:4644: result: $with_profile" >&5
 echo "${ECHO_T}$with_profile" >&6
-test "$with_profile" = "yes" && cf_list_models="$cf_list_models profile"
+test "x$with_profile" = "xyes" && cf_list_models="$cf_list_models profile"
+
+fi
+
+if test "X$cf_with_cxx_binding" != Xno; then
+if test "x$with_shared" = "xyes"; then
+echo "$as_me:4652: checking if you want to build C++ shared libraries" >&5
+echo $ECHO_N "checking if you want to build C++ shared libraries... $ECHO_C" >&6
 
+# Check whether --with-cxx-shared or --without-cxx-shared was given.
+if test "${with_cxx_shared+set}" = set; then
+  withval="$with_cxx_shared"
+  with_shared_cxx=$withval
+else
+  with_shared_cxx=no
+fi;
+echo "$as_me:4662: result: $with_shared_cxx" >&5
+echo "${ECHO_T}$with_shared_cxx" >&6
+fi
 fi
 
 ###############################################################################
 
-echo "$as_me:4705: checking for specified models" >&5
+echo "$as_me:4669: checking for specified models" >&5
 echo $ECHO_N "checking for specified models... $ECHO_C" >&6
 test -z "$cf_list_models" && cf_list_models=normal
 test "$with_libtool" != "no" && cf_list_models=libtool
-echo "$as_me:4709: result: $cf_list_models" >&5
+echo "$as_me:4673: result: $cf_list_models" >&5
 echo "${ECHO_T}$cf_list_models" >&6
 
 ### Use the first model as the default, and save its suffix for use in building
 ### up test-applications.
-echo "$as_me:4714: checking for default model" >&5
+echo "$as_me:4678: checking for default model" >&5
 echo $ECHO_N "checking for default model... $ECHO_C" >&6
 DFT_LWR_MODEL=`echo "$cf_list_models" | $AWK '{print $1}'`
-echo "$as_me:4717: result: $DFT_LWR_MODEL" >&5
+echo "$as_me:4681: result: $DFT_LWR_MODEL" >&5
 echo "${ECHO_T}$DFT_LWR_MODEL" >&6
 
 DFT_UPR_MODEL=`echo "$DFT_LWR_MODEL" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
@@ -4728,6 +4692,22 @@
 LIB_DIR=../lib
 LIB_2ND=../../lib
 
+echo "$as_me:4695: checking if you want to have a library-prefix" >&5
+echo $ECHO_N "checking if you want to have a library-prefix... $ECHO_C" >&6
+
+# Check whether --with-lib-prefix or --without-lib-prefix was given.
+if test "${with_lib_prefix+set}" = set; then
+  withval="$with_lib_prefix"
+  with_lib_prefix=$withval
+else
+  with_lib_prefix=auto
+fi;
+echo "$as_me:4705: result: $with_lib_prefix" >&5
+echo "${ECHO_T}$with_lib_prefix" >&6
+
+if test $with_lib_prefix = auto
+then
+
 	case $cf_cv_system_name in #(vi
 	OS/2*|os2*) #(vi
         LIB_PREFIX=''
@@ -4737,13 +4717,28 @@
 	esac
 cf_prefix=$LIB_PREFIX
 
-LIB_PREFIX=$cf_prefix
+elif test $with_lib_prefix = no
+then
+	LIB_PREFIX=
+else
+	LIB_PREFIX=$with_lib_prefix
+fi
 
 LIB_SUFFIX=
 
+	echo "$as_me:4729: checking for PATH separator" >&5
+echo $ECHO_N "checking for PATH separator... $ECHO_C" >&6
+	case $cf_cv_system_name in
+	os2*)	PATH_SEPARATOR=';'  ;;
+	*)	${PATH_SEPARATOR:=':'}  ;;
+	esac
+
+	echo "$as_me:4736: result: $PATH_SEPARATOR" >&5
+echo "${ECHO_T}$PATH_SEPARATOR" >&6
+
 ###############################################################################
 
-echo "$as_me:4746: checking if you want to build a separate terminfo library" >&5
+echo "$as_me:4741: checking if you want to build a separate terminfo library" >&5
 echo $ECHO_N "checking if you want to build a separate terminfo library... $ECHO_C" >&6
 
 # Check whether --with-termlib or --without-termlib was given.
@@ -4753,10 +4748,10 @@
 else
   with_termlib=no
 fi;
-echo "$as_me:4756: result: $with_termlib" >&5
+echo "$as_me:4751: result: $with_termlib" >&5
 echo "${ECHO_T}$with_termlib" >&6
 
-echo "$as_me:4759: checking if you want to build a separate tic library" >&5
+echo "$as_me:4754: checking if you want to build a separate tic library" >&5
 echo $ECHO_N "checking if you want to build a separate tic library... $ECHO_C" >&6
 
 # Check whether --with-ticlib or --without-ticlib was given.
@@ -4766,13 +4761,13 @@
 else
   with_ticlib=no
 fi;
-echo "$as_me:4769: result: $with_ticlib" >&5
+echo "$as_me:4764: result: $with_ticlib" >&5
 echo "${ECHO_T}$with_ticlib" >&6
 
 ### Checks for special libraries, must be done up-front.
 SHLIB_LIST=""
 
-echo "$as_me:4775: checking if you want to link with the GPM mouse library" >&5
+echo "$as_me:4770: checking if you want to link with the GPM mouse library" >&5
 echo $ECHO_N "checking if you want to link with the GPM mouse library... $ECHO_C" >&6
 
 # Check whether --with-gpm or --without-gpm was given.
@@ -4782,27 +4777,27 @@
 else
   with_gpm=maybe
 fi;
-echo "$as_me:4785: result: $with_gpm" >&5
+echo "$as_me:4780: result: $with_gpm" >&5
 echo "${ECHO_T}$with_gpm" >&6
 
 if test "$with_gpm" != no ; then
-	echo "$as_me:4789: checking for gpm.h" >&5
+	echo "$as_me:4784: checking for gpm.h" >&5
 echo $ECHO_N "checking for gpm.h... $ECHO_C" >&6
 if test "${ac_cv_header_gpm_h+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 4795 "configure"
+#line 4790 "configure"
 #include "confdefs.h"
 #include <gpm.h>
 _ACEOF
-if { (eval echo "$as_me:4799: \"$ac_cpp conftest.$ac_ext\"") >&5
+if { (eval echo "$as_me:4794: \"$ac_cpp conftest.$ac_ext\"") >&5
   (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
   ac_status=$?
   egrep -v '^ *\+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
-  echo "$as_me:4805: \$? = $ac_status" >&5
+  echo "$as_me:4800: \$? = $ac_status" >&5
   (exit $ac_status); } >/dev/null; then
   if test -s conftest.err; then
     ac_cpp_err=$ac_c_preproc_warn_flag
@@ -4821,25 +4816,25 @@
 fi
 rm -f conftest.err conftest.$ac_ext
 fi
-echo "$as_me:4824: result: $ac_cv_header_gpm_h" >&5
+echo "$as_me:4819: result: $ac_cv_header_gpm_h" >&5
 echo "${ECHO_T}$ac_cv_header_gpm_h" >&6
 if test $ac_cv_header_gpm_h = yes; then
 
-		cat >>confdefs.h <<\EOF
+cat >>confdefs.h <<\EOF
 #define HAVE_GPM_H 1
 EOF
 
 		if test "$with_gpm" != yes && test "$with_gpm" != maybe ; then
 			test -n "$verbose" && echo "	assuming we really have GPM library" 1>&6
 
-echo "${as_me:-configure}:4835: testing assuming we really have GPM library ..." 1>&5
+echo "${as_me:-configure}:4830: testing assuming we really have GPM library ..." 1>&5
 
-			cat >>confdefs.h <<\EOF
+cat >>confdefs.h <<\EOF
 #define HAVE_LIBGPM 1
 EOF
 
 		else
-			echo "$as_me:4842: checking for Gpm_Open in -lgpm" >&5
+			echo "$as_me:4837: checking for Gpm_Open in -lgpm" >&5
 echo $ECHO_N "checking for Gpm_Open in -lgpm... $ECHO_C" >&6
 if test "${ac_cv_lib_gpm_Gpm_Open+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -4847,7 +4842,7 @@
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lgpm  $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
-#line 4850 "configure"
+#line 4845 "configure"
 #include "confdefs.h"
 
 /* Override any gcc2 internal prototype to avoid an error.  */
@@ -4866,16 +4861,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:4869: \"$ac_link\"") >&5
+if { (eval echo "$as_me:4864: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:4872: \$? = $ac_status" >&5
+  echo "$as_me:4867: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:4875: \"$ac_try\"") >&5
+  { (eval echo "$as_me:4870: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:4878: \$? = $ac_status" >&5
+  echo "$as_me:4873: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_lib_gpm_Gpm_Open=yes
 else
@@ -4886,13 +4881,13 @@
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-echo "$as_me:4889: result: $ac_cv_lib_gpm_Gpm_Open" >&5
+echo "$as_me:4884: result: $ac_cv_lib_gpm_Gpm_Open" >&5
 echo "${ECHO_T}$ac_cv_lib_gpm_Gpm_Open" >&6
 if test $ac_cv_lib_gpm_Gpm_Open = yes; then
   :
 else
 
-				{ { echo "$as_me:4895: error: Cannot link with GPM library" >&5
+				{ { echo "$as_me:4890: error: Cannot link with GPM library" >&5
 echo "$as_me: error: Cannot link with GPM library" >&2;}
    { (exit 1); exit 1; }; }
 		fi
@@ -4902,7 +4897,7 @@
 
 else
 
-		test "$with_gpm" != maybe && { echo "$as_me:4905: WARNING: Cannot find GPM header" >&5
+		test "$with_gpm" != maybe && { echo "$as_me:4900: WARNING: Cannot find GPM header" >&5
 echo "$as_me: WARNING: Cannot find GPM header" >&2;}
 		with_gpm=no
 
@@ -4911,7 +4906,7 @@
 fi
 
 if test "$with_gpm" != no ; then
-	echo "$as_me:4914: checking if you want to load GPM dynamically" >&5
+	echo "$as_me:4909: checking if you want to load GPM dynamically" >&5
 echo $ECHO_N "checking if you want to load GPM dynamically... $ECHO_C" >&6
 
 # Check whether --with-dlsym or --without-dlsym was given.
@@ -4921,18 +4916,18 @@
 else
   with_dlsym=yes
 fi;
-	echo "$as_me:4924: result: $with_dlsym" >&5
+	echo "$as_me:4919: result: $with_dlsym" >&5
 echo "${ECHO_T}$with_dlsym" >&6
-	if test "$with_dlsym" = yes ; then
+	if test "x$with_dlsym" = xyes ; then
 
 cf_have_dlsym=no
-echo "$as_me:4929: checking for dlsym" >&5
+echo "$as_me:4924: checking for dlsym" >&5
 echo $ECHO_N "checking for dlsym... $ECHO_C" >&6
 if test "${ac_cv_func_dlsym+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 4935 "configure"
+#line 4930 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char dlsym (); below.  */
@@ -4955,7 +4950,7 @@
 #if defined (__stub_dlsym) || defined (__stub___dlsym)
 choke me
 #else
-f = dlsym;
+f = dlsym; /* workaround for ICC 12.0.3 */ if (f == 0) return 1;
 #endif
 
   ;
@@ -4963,16 +4958,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:4966: \"$ac_link\"") >&5
+if { (eval echo "$as_me:4961: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:4969: \$? = $ac_status" >&5
+  echo "$as_me:4964: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:4972: \"$ac_try\"") >&5
+  { (eval echo "$as_me:4967: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:4975: \$? = $ac_status" >&5
+  echo "$as_me:4970: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_func_dlsym=yes
 else
@@ -4982,14 +4977,14 @@
 fi
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 fi
-echo "$as_me:4985: result: $ac_cv_func_dlsym" >&5
+echo "$as_me:4980: result: $ac_cv_func_dlsym" >&5
 echo "${ECHO_T}$ac_cv_func_dlsym" >&6
 if test $ac_cv_func_dlsym = yes; then
   cf_have_dlsym=yes
 else
 
 cf_have_libdl=no
-echo "$as_me:4992: checking for dlsym in -ldl" >&5
+echo "$as_me:4987: checking for dlsym in -ldl" >&5
 echo $ECHO_N "checking for dlsym in -ldl... $ECHO_C" >&6
 if test "${ac_cv_lib_dl_dlsym+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -4997,7 +4992,7 @@
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-ldl  $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
-#line 5000 "configure"
+#line 4995 "configure"
 #include "confdefs.h"
 
 /* Override any gcc2 internal prototype to avoid an error.  */
@@ -5016,16 +5011,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:5019: \"$ac_link\"") >&5
+if { (eval echo "$as_me:5014: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:5022: \$? = $ac_status" >&5
+  echo "$as_me:5017: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:5025: \"$ac_try\"") >&5
+  { (eval echo "$as_me:5020: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:5028: \$? = $ac_status" >&5
+  echo "$as_me:5023: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_lib_dl_dlsym=yes
 else
@@ -5036,7 +5031,7 @@
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-echo "$as_me:5039: result: $ac_cv_lib_dl_dlsym" >&5
+echo "$as_me:5034: result: $ac_cv_lib_dl_dlsym" >&5
 echo "${ECHO_T}$ac_cv_lib_dl_dlsym" >&6
 if test $ac_cv_lib_dl_dlsym = yes; then
 
@@ -5049,10 +5044,10 @@
 if test "$cf_have_dlsym" = yes ; then
 	test "$cf_have_libdl" = yes && LIBS="-ldl $LIBS"
 
-	echo "$as_me:5052: checking whether able to link to dl*() functions" >&5
+	echo "$as_me:5047: checking whether able to link to dl*() functions" >&5
 echo $ECHO_N "checking whether able to link to dl*() functions... $ECHO_C" >&6
 	cat >conftest.$ac_ext <<_ACEOF
-#line 5055 "configure"
+#line 5050 "configure"
 #include "confdefs.h"
 #include <dlfcn.h>
 int
@@ -5070,19 +5065,19 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:5073: \"$ac_link\"") >&5
+if { (eval echo "$as_me:5068: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:5076: \$? = $ac_status" >&5
+  echo "$as_me:5071: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:5079: \"$ac_try\"") >&5
+  { (eval echo "$as_me:5074: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:5082: \$? = $ac_status" >&5
+  echo "$as_me:5077: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
 
-		cat >>confdefs.h <<\EOF
+cat >>confdefs.h <<\EOF
 #define HAVE_LIBDL 1
 EOF
 
@@ -5090,28 +5085,28 @@
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
 
-		{ { echo "$as_me:5093: error: Cannot link test program for libdl" >&5
+		{ { echo "$as_me:5088: error: Cannot link test program for libdl" >&5
 echo "$as_me: error: Cannot link test program for libdl" >&2;}
    { (exit 1); exit 1; }; }
 fi
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
-	echo "$as_me:5098: result: ok" >&5
+	echo "$as_me:5093: result: ok" >&5
 echo "${ECHO_T}ok" >&6
 else
-	{ { echo "$as_me:5101: error: Cannot find dlsym function" >&5
+	{ { echo "$as_me:5096: error: Cannot find dlsym function" >&5
 echo "$as_me: error: Cannot find dlsym function" >&2;}
    { (exit 1); exit 1; }; }
 fi
 
-		if test "$with_gpm" != yes ; then
+		if test "x$with_gpm" != xyes ; then
 			test -n "$verbose" && echo "	assuming soname for gpm is $with_gpm" 1>&6
 
-echo "${as_me:-configure}:5109: testing assuming soname for gpm is $with_gpm ..." 1>&5
+echo "${as_me:-configure}:5104: testing assuming soname for gpm is $with_gpm ..." 1>&5
 
 			cf_cv_gpm_soname="$with_gpm"
 		else
 
-echo "$as_me:5114: checking for soname of gpm library" >&5
+echo "$as_me:5109: checking for soname of gpm library" >&5
 echo $ECHO_N "checking for soname of gpm library... $ECHO_C" >&6
 if test "${cf_cv_gpm_soname+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -5129,15 +5124,15 @@
 CF_EOF
 cf_save_LIBS="$LIBS"
 	LIBS="-lgpm $LIBS"
-	if { (eval echo "$as_me:5132: \"$ac_compile\"") >&5
+	if { (eval echo "$as_me:5127: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:5135: \$? = $ac_status" >&5
+  echo "$as_me:5130: \$? = $ac_status" >&5
   (exit $ac_status); } ; then
-		if { (eval echo "$as_me:5137: \"$ac_link\"") >&5
+		if { (eval echo "$as_me:5132: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:5140: \$? = $ac_status" >&5
+  echo "$as_me:5135: \$? = $ac_status" >&5
   (exit $ac_status); } ; then
 			cf_cv_gpm_soname=`ldd conftest$ac_exeext 2>/dev/null | sed -e 's,^.*/,,' -e 's, .*$,,' | fgrep libgpm.`
 			test -z "$cf_cv_gpm_soname" && cf_cv_gpm_soname=unknown
@@ -5148,11 +5143,12 @@
 fi
 
 fi
-echo "$as_me:5151: result: $cf_cv_gpm_soname" >&5
+echo "$as_me:5146: result: $cf_cv_gpm_soname" >&5
 echo "${ECHO_T}$cf_cv_gpm_soname" >&6
 
 		fi
-		test "$cf_cv_gpm_soname" != "unknown" && cat >>confdefs.h <<EOF
+		test "$cf_cv_gpm_soname" != "unknown" &&
+cat >>confdefs.h <<EOF
 #define LIBGPM_SONAME "$cf_cv_gpm_soname"
 EOF
 
@@ -5161,11 +5157,12 @@
 		SHLIB_LIST="-lgpm $SHLIB_LIST"
 		TEST_LIBS="-lgpm $TEST_LIBS"
 	fi
-	cat >>confdefs.h <<\EOF
+
+cat >>confdefs.h <<\EOF
 #define HAVE_LIBGPM 1
 EOF
 
-echo "$as_me:5168: checking for Gpm_Wgetch in -lgpm" >&5
+echo "$as_me:5165: checking for Gpm_Wgetch in -lgpm" >&5
 echo $ECHO_N "checking for Gpm_Wgetch in -lgpm... $ECHO_C" >&6
 if test "${ac_cv_lib_gpm_Gpm_Wgetch+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -5173,7 +5170,7 @@
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lgpm  $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
-#line 5176 "configure"
+#line 5173 "configure"
 #include "confdefs.h"
 
 /* Override any gcc2 internal prototype to avoid an error.  */
@@ -5192,16 +5189,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:5195: \"$ac_link\"") >&5
+if { (eval echo "$as_me:5192: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:5198: \$? = $ac_status" >&5
+  echo "$as_me:5195: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:5201: \"$ac_try\"") >&5
+  { (eval echo "$as_me:5198: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:5204: \$? = $ac_status" >&5
+  echo "$as_me:5201: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_lib_gpm_Gpm_Wgetch=yes
 else
@@ -5212,11 +5209,11 @@
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-echo "$as_me:5215: result: $ac_cv_lib_gpm_Gpm_Wgetch" >&5
+echo "$as_me:5212: result: $ac_cv_lib_gpm_Gpm_Wgetch" >&5
 echo "${ECHO_T}$ac_cv_lib_gpm_Gpm_Wgetch" >&6
 if test $ac_cv_lib_gpm_Gpm_Wgetch = yes; then
 
-echo "$as_me:5219: checking if GPM is weakly bound to curses library" >&5
+echo "$as_me:5216: checking if GPM is weakly bound to curses library" >&5
 echo $ECHO_N "checking if GPM is weakly bound to curses library... $ECHO_C" >&6
 if test "${cf_cv_check_gpm_wgetch+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -5240,15 +5237,15 @@
 	# to rely on the static library, noting that some packagers may not
 	# include it.
 	LIBS="-static -lgpm -dynamic $LIBS"
-	if { (eval echo "$as_me:5243: \"$ac_compile\"") >&5
+	if { (eval echo "$as_me:5240: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:5246: \$? = $ac_status" >&5
+  echo "$as_me:5243: \$? = $ac_status" >&5
   (exit $ac_status); } ; then
-		if { (eval echo "$as_me:5248: \"$ac_link\"") >&5
+		if { (eval echo "$as_me:5245: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:5251: \$? = $ac_status" >&5
+  echo "$as_me:5248: \$? = $ac_status" >&5
   (exit $ac_status); } ; then
 			cf_cv_check_gpm_wgetch=`nm conftest$ac_exeext | egrep '\<wgetch\>' | egrep '\<[vVwW]\>'`
 			test -n "$cf_cv_check_gpm_wgetch" && cf_cv_check_gpm_wgetch=yes
@@ -5260,11 +5257,11 @@
 fi
 
 fi
-echo "$as_me:5263: result: $cf_cv_check_gpm_wgetch" >&5
+echo "$as_me:5260: result: $cf_cv_check_gpm_wgetch" >&5
 echo "${ECHO_T}$cf_cv_check_gpm_wgetch" >&6
 
 if test "$cf_cv_check_gpm_wgetch" != yes ; then
-	{ echo "$as_me:5267: WARNING: GPM library is already linked with curses - read the FAQ" >&5
+	{ echo "$as_me:5264: WARNING: GPM library is already linked with curses - read the FAQ" >&5
 echo "$as_me: WARNING: GPM library is already linked with curses - read the FAQ" >&2;}
 fi
 
@@ -5274,7 +5271,7 @@
 
 # not everyone has "test -c"
 if test -c /dev/sysmouse 2>/dev/null ; then
-echo "$as_me:5277: checking if you want to use sysmouse" >&5
+echo "$as_me:5274: checking if you want to use sysmouse" >&5
 echo $ECHO_N "checking if you want to use sysmouse... $ECHO_C" >&6
 
 # Check whether --with-sysmouse or --without-sysmouse was given.
@@ -5286,7 +5283,7 @@
 fi;
 	if test "$cf_with_sysmouse" != no ; then
 	cat >conftest.$ac_ext <<_ACEOF
-#line 5289 "configure"
+#line 5286 "configure"
 #include "confdefs.h"
 
 #include <osreldate.h>
@@ -5309,16 +5306,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:5312: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:5309: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:5315: \$? = $ac_status" >&5
+  echo "$as_me:5312: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:5318: \"$ac_try\"") >&5
+  { (eval echo "$as_me:5315: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:5321: \$? = $ac_status" >&5
+  echo "$as_me:5318: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   cf_with_sysmouse=yes
 else
@@ -5328,9 +5325,10 @@
 fi
 rm -f conftest.$ac_objext conftest.$ac_ext
 	fi
-echo "$as_me:5331: result: $cf_with_sysmouse" >&5
+echo "$as_me:5328: result: $cf_with_sysmouse" >&5
 echo "${ECHO_T}$cf_with_sysmouse" >&6
-test "$cf_with_sysmouse" = yes && cat >>confdefs.h <<\EOF
+test "$cf_with_sysmouse" = yes &&
+cat >>confdefs.h <<\EOF
 #define USE_SYSMOUSE 1
 EOF
 
@@ -5338,15 +5336,15 @@
 
 if test X"$CC_G_OPT" = X"" ; then
 	CC_G_OPT='-g'
-	test -n "$GCC" && test "${ac_cv_prog_cc_g}" != yes && CC_G_OPT=''
+	test -n "$GCC" && test "x${ac_cv_prog_cc_g}" != xyes && CC_G_OPT=''
 fi
 
 if test X"$CXX_G_OPT" = X"" ; then
 	CXX_G_OPT='-g'
-	test -n "$GXX" && test "${ac_cv_prog_cxx_g}" != yes && CXX_G_OPT=''
+	test -n "$GXX" && test "x${ac_cv_prog_cxx_g}" != xyes && CXX_G_OPT=''
 fi
 
-echo "$as_me:5349: checking for default loader flags" >&5
+echo "$as_me:5347: checking for default loader flags" >&5
 echo $ECHO_N "checking for default loader flags... $ECHO_C" >&6
 case $DFT_LWR_MODEL in
 libtool) LD_MODEL=''   ;;
@@ -5355,13 +5353,13 @@
 profile) LD_MODEL='-pg';;
 shared)  LD_MODEL=''   ;;
 esac
-echo "$as_me:5358: result: $LD_MODEL" >&5
+echo "$as_me:5356: result: $LD_MODEL" >&5
 echo "${ECHO_T}$LD_MODEL" >&6
 
 case $DFT_LWR_MODEL in
 shared)
 
-echo "$as_me:5364: checking if rpath option should be used" >&5
+echo "$as_me:5362: checking if rpath option should be used" >&5
 echo $ECHO_N "checking if rpath option should be used... $ECHO_C" >&6
 
 # Check whether --enable-rpath or --disable-rpath was given.
@@ -5371,10 +5369,10 @@
 else
   cf_cv_enable_rpath=no
 fi;
-echo "$as_me:5374: result: $cf_cv_enable_rpath" >&5
+echo "$as_me:5372: result: $cf_cv_enable_rpath" >&5
 echo "${ECHO_T}$cf_cv_enable_rpath" >&6
 
-echo "$as_me:5377: checking if shared libraries should be relinked during install" >&5
+echo "$as_me:5375: checking if shared libraries should be relinked during install" >&5
 echo $ECHO_N "checking if shared libraries should be relinked during install... $ECHO_C" >&6
 
 # Check whether --enable-relink or --disable-relink was given.
@@ -5384,13 +5382,13 @@
 else
   cf_cv_do_relink=yes
 fi;
-echo "$as_me:5387: result: $cf_cv_do_relink" >&5
+echo "$as_me:5385: result: $cf_cv_do_relink" >&5
 echo "${ECHO_T}$cf_cv_do_relink" >&6
 	;;
 esac
 
 LD_RPATH_OPT=
-echo "$as_me:5393: checking for an rpath option" >&5
+echo "$as_me:5391: checking for an rpath option" >&5
 echo $ECHO_N "checking for an rpath option... $ECHO_C" >&6
 case $cf_cv_system_name in #(vi
 irix*) #(vi
@@ -5403,10 +5401,10 @@
 linux*|gnu*|k*bsd*-gnu) #(vi
 	LD_RPATH_OPT="-Wl,-rpath,"
 	;;
-openbsd[2-9].*) #(vi
+openbsd[2-9].*|mirbsd*) #(vi
 	LD_RPATH_OPT="-Wl,-rpath,"
 	;;
-freebsd*) #(vi
+dragonfly*|freebsd*) #(vi
 	LD_RPATH_OPT="-rpath "
 	;;
 netbsd*) #(vi
@@ -5421,17 +5419,17 @@
 *)
 	;;
 esac
-echo "$as_me:5424: result: $LD_RPATH_OPT" >&5
+echo "$as_me:5422: result: $LD_RPATH_OPT" >&5
 echo "${ECHO_T}$LD_RPATH_OPT" >&6
 
 case "x$LD_RPATH_OPT" in #(vi
 x-R*)
-	echo "$as_me:5429: checking if we need a space after rpath option" >&5
+	echo "$as_me:5427: checking if we need a space after rpath option" >&5
 echo $ECHO_N "checking if we need a space after rpath option... $ECHO_C" >&6
 	cf_save_LIBS="$LIBS"
 	LIBS="${LD_RPATH_OPT}$libdir $LIBS"
 	cat >conftest.$ac_ext <<_ACEOF
-#line 5434 "configure"
+#line 5432 "configure"
 #include "confdefs.h"
 
 int
@@ -5443,16 +5441,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:5446: \"$ac_link\"") >&5
+if { (eval echo "$as_me:5444: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:5449: \$? = $ac_status" >&5
+  echo "$as_me:5447: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:5452: \"$ac_try\"") >&5
+  { (eval echo "$as_me:5450: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:5455: \$? = $ac_status" >&5
+  echo "$as_me:5453: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   cf_rpath_space=no
 else
@@ -5462,7 +5460,7 @@
 fi
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 	LIBS="$cf_save_LIBS"
-	echo "$as_me:5465: result: $cf_rpath_space" >&5
+	echo "$as_me:5463: result: $cf_rpath_space" >&5
 echo "${ECHO_T}$cf_rpath_space" >&6
 	test "$cf_rpath_space" = yes && LD_RPATH_OPT="$LD_RPATH_OPT "
 	;;
@@ -5477,7 +5475,7 @@
 	cf_ld_rpath_opt=
 	test "$cf_cv_enable_rpath" = yes && cf_ld_rpath_opt="$LD_RPATH_OPT"
 
-	echo "$as_me:5480: checking if release/abi version should be used for shared libs" >&5
+	echo "$as_me:5478: checking if release/abi version should be used for shared libs" >&5
 echo $ECHO_N "checking if release/abi version should be used for shared libs... $ECHO_C" >&6
 
 # Check whether --with-shlib-version or --without-shlib-version was given.
@@ -5492,7 +5490,7 @@
 		cf_cv_shlib_version=$withval
 		;;
 	*)
-		{ { echo "$as_me:5495: error: option value must be one of: rel, abi, auto or no" >&5
+		{ { echo "$as_me:5493: error: option value must be one of: rel, abi, auto or no" >&5
 echo "$as_me: error: option value must be one of: rel, abi, auto or no" >&2;}
    { (exit 1); exit 1; }; }
 		;;
@@ -5501,23 +5499,24 @@
 else
   cf_cv_shlib_version=auto
 fi;
-	echo "$as_me:5504: result: $cf_cv_shlib_version" >&5
+	echo "$as_me:5502: result: $cf_cv_shlib_version" >&5
 echo "${ECHO_T}$cf_cv_shlib_version" >&6
 
 	cf_cv_rm_so_locs=no
+	cf_try_cflags=
 
 	# Some less-capable ports of gcc support only -fpic
 	CC_SHARED_OPTS=
 	if test "$GCC" = yes
 	then
-		echo "$as_me:5513: checking which $CC option to use" >&5
+		echo "$as_me:5512: checking which $CC option to use" >&5
 echo $ECHO_N "checking which $CC option to use... $ECHO_C" >&6
 		cf_save_CFLAGS="$CFLAGS"
 		for CC_SHARED_OPTS in -fPIC -fpic ''
 		do
 			CFLAGS="$cf_save_CFLAGS $CC_SHARED_OPTS"
 			cat >conftest.$ac_ext <<_ACEOF
-#line 5520 "configure"
+#line 5519 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 int
@@ -5529,16 +5528,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:5532: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:5531: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:5535: \$? = $ac_status" >&5
+  echo "$as_me:5534: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:5538: \"$ac_try\"") >&5
+  { (eval echo "$as_me:5537: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:5541: \$? = $ac_status" >&5
+  echo "$as_me:5540: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   break
 else
@@ -5547,7 +5546,7 @@
 fi
 rm -f conftest.$ac_objext conftest.$ac_ext
 		done
-		echo "$as_me:5550: result: $CC_SHARED_OPTS" >&5
+		echo "$as_me:5549: result: $CC_SHARED_OPTS" >&5
 echo "${ECHO_T}$CC_SHARED_OPTS" >&6
 		CFLAGS="$cf_save_CFLAGS"
 	fi
@@ -5555,10 +5554,14 @@
 	cf_cv_shlib_version_infix=no
 
 	case $cf_cv_system_name in #(vi
-	aix[56]*) #(vi
+	aix4.3-9*|aix[5-7]*) #(vi
 		if test "$GCC" = yes; then
 			CC_SHARED_OPTS=
-			MK_SHARED_LIB='$(CC) -shared'
+			MK_SHARED_LIB='${CC} -shared -Wl,-brtl -Wl,-blibpath:${RPATH_LIST}:/usr/lib -o $@'
+		else
+			# CC_SHARED_OPTS='-qpic=large -G'
+			# perhaps "-bM:SRE -bnoentry -bexpall"
+			MK_SHARED_LIB='${CC} -G -Wl,-brtl -Wl,-blibpath:${RPATH_LIST}:/usr/lib -o $@'
 		fi
 		;;
 	beos*) #(vi
@@ -5584,12 +5587,12 @@
 		chmod +x mk_shared_lib.sh
 		;;
 	darwin*) #(vi
-		EXTRA_CFLAGS="-no-cpp-precomp"
+		cf_try_cflags="no-cpp-precomp"
 		CC_SHARED_OPTS="-dynamic"
 		MK_SHARED_LIB='${CC} ${CFLAGS} -dynamiclib -install_name ${libdir}/`basename $@` -compatibility_version ${ABI_VERSION} -current_version ${ABI_VERSION} -o $@'
 		test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=abi
 		cf_cv_shlib_version_infix=yes
-		echo "$as_me:5592: checking if ld -search_paths_first works" >&5
+		echo "$as_me:5595: checking if ld -search_paths_first works" >&5
 echo $ECHO_N "checking if ld -search_paths_first works... $ECHO_C" >&6
 if test "${cf_cv_ldflags_search_paths_first+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -5598,7 +5601,7 @@
 			cf_save_LDFLAGS=$LDFLAGS
 			LDFLAGS="$LDFLAGS -Wl,-search_paths_first"
 			cat >conftest.$ac_ext <<_ACEOF
-#line 5601 "configure"
+#line 5604 "configure"
 #include "confdefs.h"
 
 int
@@ -5610,16 +5613,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:5613: \"$ac_link\"") >&5
+if { (eval echo "$as_me:5616: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:5616: \$? = $ac_status" >&5
+  echo "$as_me:5619: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:5619: \"$ac_try\"") >&5
+  { (eval echo "$as_me:5622: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:5622: \$? = $ac_status" >&5
+  echo "$as_me:5625: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   cf_cv_ldflags_search_paths_first=yes
 else
@@ -5630,12 +5633,20 @@
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 				LDFLAGS=$cf_save_LDFLAGS
 fi
-echo "$as_me:5633: result: $cf_cv_ldflags_search_paths_first" >&5
+echo "$as_me:5636: result: $cf_cv_ldflags_search_paths_first" >&5
 echo "${ECHO_T}$cf_cv_ldflags_search_paths_first" >&6
 		if test $cf_cv_ldflags_search_paths_first = yes; then
 			LDFLAGS="$LDFLAGS -Wl,-search_paths_first"
 		fi
 		;;
+	hpux[7-8]*) #(vi
+		# HP-UX 8.07 ld lacks "+b" option used for libdir search-list
+		if test "$GCC" != yes; then
+			CC_SHARED_OPTS='+Z'
+		fi
+		MK_SHARED_LIB='${LD} -b -o $@'
+		INSTALL_LIB="-m 555"
+		;;
 	hpux*) #(vi
 		# (tested with gcc 2.7.2 -- I don't have c89)
 		if test "$GCC" = yes; then
@@ -5649,9 +5660,19 @@
 		# readonly to exploit a quirk in the memory manager.
 		INSTALL_LIB="-m 555"
 		;;
+	interix*)
+		test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel
+		if test "$cf_cv_shlib_version" = rel; then
+			cf_shared_soname='`basename  .${REL_VERSION}`.${ABI_VERSION}'
+		else
+			cf_shared_soname='`basename `'
+		fi
+		CC_SHARED_OPTS=
+		MK_SHARED_LIB='${CC} -shared -Wl,-rpath,${RPATH_LIST} -Wl,-h,'$cf_shared_soname' -o '
+		;;
 	irix*) #(vi
 		if test "$cf_cv_enable_rpath" = yes ; then
-			EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${libdir} $EXTRA_LDFLAGS"
+			EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${RPATH_LIST} $EXTRA_LDFLAGS"
 		fi
 		# tested with IRIX 5.2 and 'cc'.
 		if test "$GCC" != yes; then
@@ -5668,7 +5689,7 @@
 			LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
 		fi
 		if test "$cf_cv_enable_rpath" = yes ; then
-			EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${libdir} $EXTRA_LDFLAGS"
+			EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${RPATH_LIST} $EXTRA_LDFLAGS"
 		fi
 
 	test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel
@@ -5680,13 +5701,34 @@
 
 		MK_SHARED_LIB='${CC} ${CFLAGS} -shared -Wl,-soname,'$cf_cv_shared_soname',-stats,-lc -o $@'
 		;;
-	openbsd[2-9].*) #(vi
+	mingw*) #(vi
+		cf_cv_shlib_version=mingw
+		cf_cv_shlib_version_infix=mingw
+		CC_SHARED_OPTS=
+		MK_SHARED_LIB='sh ../mk_shared_lib.sh $@ ${CC} ${CFLAGS}'
+		#MK_SHARED_LIB='${CC} ${CFLAGS} -mdll -Wl,-soname,'$cf_cv_shared_soname',-stats -o $[@]'
+		#MK_SHARED_LIB='${DLLTOOL} --export-all-symbols --output-exp --output-lib $[@]'
+		cat >mk_shared_lib.sh <<-CF_EOF
+		#!/bin/sh
+		SHARED_LIB=\$1
+		IMPORT_LIB=\`echo "\$1" | sed -e 's/[0-9]*\.dll$/.dll.a/'\`
+		shift
+		cat <<-EOF
+		Linking shared library
+		** SHARED_LIB \$SHARED_LIB
+		** IMPORT_LIB \$IMPORT_LIB
+EOF
+		exec \$* -shared -Wl,--out-implib=../lib/\${IMPORT_LIB} -Wl,--export-all-symbols -o ../lib/\${SHARED_LIB}
+CF_EOF
+		chmod +x mk_shared_lib.sh
+		;;
+	openbsd[2-9].*|mirbsd*) #(vi
 		if test "$DFT_LWR_MODEL" = "shared" ; then
 			LOCAL_LDFLAGS="${LD_RPATH_OPT}\$(LOCAL_LIBDIR)"
 			LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
 		fi
 		if test "$cf_cv_enable_rpath" = yes ; then
-			EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${libdir} $EXTRA_LDFLAGS"
+			EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${RPATH_LIST} $EXTRA_LDFLAGS"
 		fi
 		CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC"
 
@@ -5704,12 +5746,12 @@
 		MK_SHARED_LIB='${LD} -Bshareable -o $@'
 		test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel
 		;;
-	freebsd*) #(vi
+	dragonfly*|freebsd*) #(vi
 		CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC"
 		if test "$DFT_LWR_MODEL" = "shared" && test "$cf_cv_enable_rpath" = yes ; then
 			LOCAL_LDFLAGS="${cf_ld_rpath_opt}\$(LOCAL_LIBDIR)"
-			LOCAL_LDFLAGS2="${cf_ld_rpath_opt}\${libdir} $LOCAL_LDFLAGS"
-			EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${libdir} $EXTRA_LDFLAGS"
+			LOCAL_LDFLAGS2="${cf_ld_rpath_opt}\${RPATH_LIST} $LOCAL_LDFLAGS"
+			EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${RPATH_LIST} $EXTRA_LDFLAGS"
 		fi
 
 	test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel
@@ -5726,7 +5768,7 @@
 		if test "$DFT_LWR_MODEL" = "shared" && test "$cf_cv_enable_rpath" = yes ; then
 			LOCAL_LDFLAGS="${cf_ld_rpath_opt}\$(LOCAL_LIBDIR)"
 			LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
-			EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${libdir} $EXTRA_LDFLAGS"
+			EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${RPATH_LIST} $EXTRA_LDFLAGS"
 			if test "$cf_cv_shlib_version" = auto; then
 			if test -f /usr/libexec/ld.elf_so; then
 				cf_cv_shlib_version=abi
@@ -5810,7 +5852,7 @@
 			do
 				CFLAGS="$cf_shared_opts $cf_save_CFLAGS"
 				cat >conftest.$ac_ext <<_ACEOF
-#line 5813 "configure"
+#line 5855 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 int
@@ -5822,16 +5864,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:5825: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:5867: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:5828: \$? = $ac_status" >&5
+  echo "$as_me:5870: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:5831: \"$ac_try\"") >&5
+  { (eval echo "$as_me:5873: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:5834: \$? = $ac_status" >&5
+  echo "$as_me:5876: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   break
 else
@@ -5868,21 +5910,62 @@
 			test "$cf_cv_do_symlinks" = no && cf_cv_do_symlinks=yes
 			;;
 		*)
-			{ echo "$as_me:5871: WARNING: ignored --with-shlib-version" >&5
+			{ echo "$as_me:5913: WARNING: ignored --with-shlib-version" >&5
 echo "$as_me: WARNING: ignored --with-shlib-version" >&2;}
 			;;
 		esac
 		;;
 	esac
 
-	if test -n "$cf_ld_rpath_opt" ; then
-		MK_SHARED_LIB="$MK_SHARED_LIB $cf_ld_rpath_opt\${libdir}"
+	if test -n "$cf_try_cflags"
+	then
+cat > conftest.$ac_ext <<EOF
+#line 5923 "${as_me:-configure}"
+#include <stdio.h>
+int main(int argc, char *argv[])
+{
+	printf("hello\n");
+	return (argv[argc-1] == 0) ;
+}
+EOF
+		cf_save_CFLAGS="$CFLAGS"
+		for cf_opt in $cf_try_cflags
+		do
+			CFLAGS="$cf_save_CFLAGS -$cf_opt"
+			echo "$as_me:5935: checking if CFLAGS option -$cf_opt works" >&5
+echo $ECHO_N "checking if CFLAGS option -$cf_opt works... $ECHO_C" >&6
+			if { (eval echo "$as_me:5937: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:5940: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+				echo "$as_me:5942: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+				cf_save_CFLAGS="$CFLAGS"
+			else
+				echo "$as_me:5946: result: no" >&5
+echo "${ECHO_T}no" >&6
+			fi
+		done
+		CFLAGS="$cf_save_CFLAGS"
 	fi
 
+	# RPATH_LIST is a colon-separated list of directories
+	test -n "$cf_ld_rpath_opt" && MK_SHARED_LIB="$MK_SHARED_LIB $cf_ld_rpath_opt\${RPATH_LIST}"
+	test -z "$RPATH_LIST" && RPATH_LIST="\${libdir}"
+
+	test -n "$verbose" && echo "	CC_SHARED_OPTS: $CC_SHARED_OPTS" 1>&6
+
+echo "${as_me:-configure}:5959: testing CC_SHARED_OPTS: $CC_SHARED_OPTS ..." 1>&5
+
+	test -n "$verbose" && echo "	MK_SHARED_LIB:  $MK_SHARED_LIB" 1>&6
+
+echo "${as_me:-configure}:5963: testing MK_SHARED_LIB:  $MK_SHARED_LIB ..." 1>&5
+
 if test "$CC_SHARED_OPTS" = "unknown"; then
 	for model in $cf_list_models; do
 		if test "$model" = "shared"; then
-			{ { echo "$as_me:5885: error: Shared libraries are not supported in this version" >&5
+			{ { echo "$as_me:5968: error: Shared libraries are not supported in this version" >&5
 echo "$as_me: error: Shared libraries are not supported in this version" >&2;}
    { (exit 1); exit 1; }; }
 		fi
@@ -5892,7 +5975,7 @@
 ### If we're building with rpath, try to link non-standard libs that way too.
 if test "$DFT_LWR_MODEL" = "shared"; then
 
-echo "$as_me:5895: checking if rpath-hack should be disabled" >&5
+echo "$as_me:5978: checking if rpath-hack should be disabled" >&5
 echo $ECHO_N "checking if rpath-hack should be disabled... $ECHO_C" >&6
 
 # Check whether --enable-rpath-hack or --disable-rpath-hack was given.
@@ -5909,21 +5992,21 @@
   cf_disable_rpath_hack=no
 
 fi;
-echo "$as_me:5912: result: $cf_disable_rpath_hack" >&5
+echo "$as_me:5995: result: $cf_disable_rpath_hack" >&5
 echo "${ECHO_T}$cf_disable_rpath_hack" >&6
 if test "$cf_disable_rpath_hack" = no ; then
 
-echo "$as_me:5916: checking for updated LDFLAGS" >&5
+echo "$as_me:5999: checking for updated LDFLAGS" >&5
 echo $ECHO_N "checking for updated LDFLAGS... $ECHO_C" >&6
 if test -n "$LD_RPATH_OPT" ; then
-	echo "$as_me:5919: result: maybe" >&5
+	echo "$as_me:6002: result: maybe" >&5
 echo "${ECHO_T}maybe" >&6
 
 	for ac_prog in ldd
 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 "$as_me:5926: checking for $ac_word" >&5
+echo "$as_me:6009: checking for $ac_word" >&5
 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
 if test "${ac_cv_prog_cf_ldd_prog+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -5938,7 +6021,7 @@
   test -z "$ac_dir" && ac_dir=.
   $as_executable_p "$ac_dir/$ac_word" || continue
 ac_cv_prog_cf_ldd_prog="$ac_prog"
-echo "$as_me:5941: found $ac_dir/$ac_word" >&5
+echo "$as_me:6024: found $ac_dir/$ac_word" >&5
 break
 done
 
@@ -5946,10 +6029,10 @@
 fi
 cf_ldd_prog=$ac_cv_prog_cf_ldd_prog
 if test -n "$cf_ldd_prog"; then
-  echo "$as_me:5949: result: $cf_ldd_prog" >&5
+  echo "$as_me:6032: result: $cf_ldd_prog" >&5
 echo "${ECHO_T}$cf_ldd_prog" >&6
 else
-  echo "$as_me:5952: result: no" >&5
+  echo "$as_me:6035: result: no" >&5
 echo "${ECHO_T}no" >&6
 fi
 
@@ -5963,7 +6046,7 @@
 		cf_rpath_oops=
 
 cat >conftest.$ac_ext <<_ACEOF
-#line 5966 "configure"
+#line 6049 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 int
@@ -5975,16 +6058,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:5978: \"$ac_link\"") >&5
+if { (eval echo "$as_me:6061: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:5981: \$? = $ac_status" >&5
+  echo "$as_me:6064: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:5984: \"$ac_try\"") >&5
+  { (eval echo "$as_me:6067: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:5987: \$? = $ac_status" >&5
+  echo "$as_me:6070: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   cf_rpath_oops=`$cf_ldd_prog conftest$ac_exeext | fgrep ' not found' | sed -e 's% =>.*$%%' |sort -u`
 		 cf_rpath_list=`$cf_ldd_prog conftest$ac_exeext | fgrep / | sed -e 's%^.*[ 	]/%/%' -e 's%/[^/][^/]*$%%' |sort -u`
@@ -6012,7 +6095,7 @@
 					then
 						test -n "$verbose" && echo "	...adding -L$cf_rpath_dir/lib to LDFLAGS for $cf_rpath_src" 1>&6
 
-echo "${as_me:-configure}:6015: testing ...adding -L$cf_rpath_dir/lib to LDFLAGS for $cf_rpath_src ..." 1>&5
+echo "${as_me:-configure}:6098: testing ...adding -L$cf_rpath_dir/lib to LDFLAGS for $cf_rpath_src ..." 1>&5
 
 						LDFLAGS="$LDFLAGS -L$cf_rpath_dir/lib"
 						break
@@ -6024,11 +6107,11 @@
 
 	test -n "$verbose" && echo "	...checking EXTRA_LDFLAGS $EXTRA_LDFLAGS" 1>&6
 
-echo "${as_me:-configure}:6027: testing ...checking EXTRA_LDFLAGS $EXTRA_LDFLAGS ..." 1>&5
+echo "${as_me:-configure}:6110: testing ...checking EXTRA_LDFLAGS $EXTRA_LDFLAGS ..." 1>&5
 
 test -n "$verbose" && echo "	...checking LDFLAGS $LDFLAGS" 1>&6
 
-echo "${as_me:-configure}:6031: testing ...checking LDFLAGS $LDFLAGS ..." 1>&5
+echo "${as_me:-configure}:6114: testing ...checking LDFLAGS $LDFLAGS ..." 1>&5
 
 cf_rpath_dst=
 for cf_rpath_src in $LDFLAGS
@@ -6065,7 +6148,7 @@
 			then
 				test -n "$verbose" && echo "	...Filter $cf_rpath_src ->$cf_rpath_tmp" 1>&6
 
-echo "${as_me:-configure}:6068: testing ...Filter $cf_rpath_src ->$cf_rpath_tmp ..." 1>&5
+echo "${as_me:-configure}:6151: testing ...Filter $cf_rpath_src ->$cf_rpath_tmp ..." 1>&5
 
 				EXTRA_LDFLAGS="$cf_rpath_tmp $EXTRA_LDFLAGS"
 			fi
@@ -6078,11 +6161,11 @@
 
 test -n "$verbose" && echo "	...checked LDFLAGS $LDFLAGS" 1>&6
 
-echo "${as_me:-configure}:6081: testing ...checked LDFLAGS $LDFLAGS ..." 1>&5
+echo "${as_me:-configure}:6164: testing ...checked LDFLAGS $LDFLAGS ..." 1>&5
 
 test -n "$verbose" && echo "	...checking LIBS $LIBS" 1>&6
 
-echo "${as_me:-configure}:6085: testing ...checking LIBS $LIBS ..." 1>&5
+echo "${as_me:-configure}:6168: testing ...checking LIBS $LIBS ..." 1>&5
 
 cf_rpath_dst=
 for cf_rpath_src in $LIBS
@@ -6119,7 +6202,7 @@
 			then
 				test -n "$verbose" && echo "	...Filter $cf_rpath_src ->$cf_rpath_tmp" 1>&6
 
-echo "${as_me:-configure}:6122: testing ...Filter $cf_rpath_src ->$cf_rpath_tmp ..." 1>&5
+echo "${as_me:-configure}:6205: testing ...Filter $cf_rpath_src ->$cf_rpath_tmp ..." 1>&5
 
 				EXTRA_LDFLAGS="$cf_rpath_tmp $EXTRA_LDFLAGS"
 			fi
@@ -6132,11 +6215,11 @@
 
 test -n "$verbose" && echo "	...checked LIBS $LIBS" 1>&6
 
-echo "${as_me:-configure}:6135: testing ...checked LIBS $LIBS ..." 1>&5
+echo "${as_me:-configure}:6218: testing ...checked LIBS $LIBS ..." 1>&5
 
 	test -n "$verbose" && echo "	...checked EXTRA_LDFLAGS $EXTRA_LDFLAGS" 1>&6
 
-echo "${as_me:-configure}:6139: testing ...checked EXTRA_LDFLAGS $EXTRA_LDFLAGS ..." 1>&5
+echo "${as_me:-configure}:6222: testing ...checked EXTRA_LDFLAGS $EXTRA_LDFLAGS ..." 1>&5
 
 fi
 
@@ -6147,7 +6230,7 @@
 ###############################################################################
 
 ###	use option --disable-overwrite to leave out the link to -lcurses
-echo "$as_me:6150: checking if you wish to install ncurses overwriting curses" >&5
+echo "$as_me:6233: checking if you wish to install ncurses overwriting curses" >&5
 echo $ECHO_N "checking if you wish to install ncurses overwriting curses... $ECHO_C" >&6
 
 # Check whether --enable-overwrite or --disable-overwrite was given.
@@ -6157,10 +6240,10 @@
 else
   if test "$prefix" = "/usr" ; then with_overwrite=yes; else with_overwrite=no; fi
 fi;
-echo "$as_me:6160: result: $with_overwrite" >&5
+echo "$as_me:6243: result: $with_overwrite" >&5
 echo "${ECHO_T}$with_overwrite" >&6
 
-echo "$as_me:6163: checking if external terminfo-database is used" >&5
+echo "$as_me:6246: checking if external terminfo-database is used" >&5
 echo $ECHO_N "checking if external terminfo-database is used... $ECHO_C" >&6
 
 # Check whether --enable-database or --disable-database was given.
@@ -6170,7 +6253,7 @@
 else
   use_database=yes
 fi;
-echo "$as_me:6173: result: $use_database" >&5
+echo "$as_me:6256: result: $use_database" >&5
 echo "${ECHO_T}$use_database" >&6
 
 case $host_os in #(vi
@@ -6178,21 +6261,17 @@
 	TERMINFO_SRC='${top_srcdir}/misc/emx.src'
 	;;
 *) #(vi
-	TERMINFO_SRC='${top_srcdir}/misc/terminfo.src'
-	;;
-esac
-
-	case $cf_cv_system_name in
-	os2*)	PATH_SEPARATOR=';'  ;;
-	*)	PATH_SEPARATOR=':'  ;;
-	esac
+	TERMINFO_SRC='${top_srcdir}/misc/terminfo.src'
+	;;
+esac
 
 if test "$use_database" != no ; then
-	cat >>confdefs.h <<\EOF
+
+cat >>confdefs.h <<\EOF
 #define USE_DATABASE 1
 EOF
 
-	echo "$as_me:6195: checking which terminfo source-file will be installed" >&5
+	echo "$as_me:6274: checking which terminfo source-file will be installed" >&5
 echo $ECHO_N "checking which terminfo source-file will be installed... $ECHO_C" >&6
 
 # Check whether --with-database or --without-database was given.
@@ -6200,10 +6279,10 @@
   withval="$with_database"
   TERMINFO_SRC=$withval
 fi;
-	echo "$as_me:6203: result: $TERMINFO_SRC" >&5
+	echo "$as_me:6282: result: $TERMINFO_SRC" >&5
 echo "${ECHO_T}$TERMINFO_SRC" >&6
 
-	echo "$as_me:6206: checking whether to use hashed database instead of directory/tree" >&5
+	echo "$as_me:6285: checking whether to use hashed database instead of directory/tree" >&5
 echo $ECHO_N "checking whether to use hashed database instead of directory/tree... $ECHO_C" >&6
 
 # Check whether --with-hashed-db or --without-hashed-db was given.
@@ -6213,13 +6292,13 @@
 else
   with_hashed_db=no
 fi;
-	echo "$as_me:6216: result: $with_hashed_db" >&5
+	echo "$as_me:6295: result: $with_hashed_db" >&5
 echo "${ECHO_T}$with_hashed_db" >&6
 else
 	with_hashed_db=no
 fi
 
-echo "$as_me:6222: checking for list of fallback descriptions" >&5
+echo "$as_me:6301: checking for list of fallback descriptions" >&5
 echo $ECHO_N "checking for list of fallback descriptions... $ECHO_C" >&6
 
 # Check whether --with-fallbacks or --without-fallbacks was given.
@@ -6229,11 +6308,11 @@
 else
   with_fallback=
 fi;
-echo "$as_me:6232: result: $with_fallback" >&5
+echo "$as_me:6311: result: $with_fallback" >&5
 echo "${ECHO_T}$with_fallback" >&6
 FALLBACK_LIST=`echo "$with_fallback" | sed -e 's/,/ /g'`
 
-echo "$as_me:6236: checking if you want modern xterm or antique" >&5
+echo "$as_me:6315: checking if you want modern xterm or antique" >&5
 echo $ECHO_N "checking if you want modern xterm or antique... $ECHO_C" >&6
 
 # Check whether --with-xterm-new or --without-xterm-new was given.
@@ -6247,17 +6326,42 @@
 no)	with_xterm_new=xterm-old;;
 *)	with_xterm_new=xterm-new;;
 esac
-echo "$as_me:6250: result: $with_xterm_new" >&5
+echo "$as_me:6329: result: $with_xterm_new" >&5
 echo "${ECHO_T}$with_xterm_new" >&6
 WHICH_XTERM=$with_xterm_new
 
+echo "$as_me:6333: checking if xterm backspace sends BS or DEL" >&5
+echo $ECHO_N "checking if xterm backspace sends BS or DEL... $ECHO_C" >&6
+
+# Check whether --with-xterm-kbs or --without-xterm-kbs was given.
+if test "${with_xterm_kbs+set}" = set; then
+  withval="$with_xterm_kbs"
+  with_xterm_kbs=$withval
+else
+  with_xterm_kbs=BS
+fi;
+case x$with_xterm_kbs in
+xyes|xno|xBS|xbs|x8)
+	with_xterm_kbs=BS
+	;;
+xDEL|xdel|x127)
+	with_xterm_kbs=DEL
+	;;
+*)
+	with_xterm_kbs=$withval
+	;;
+esac
+echo "$as_me:6354: result: $with_xterm_kbs" >&5
+echo "${ECHO_T}$with_xterm_kbs" >&6
+XTERM_KBS=$with_xterm_kbs
+
 MAKE_TERMINFO=
 if test "$use_database" = no ; then
 	TERMINFO="${datadir}/terminfo"
 	MAKE_TERMINFO="#"
 else
 
-echo "$as_me:6260: checking for list of terminfo directories" >&5
+echo "$as_me:6364: checking for list of terminfo directories" >&5
 echo $ECHO_N "checking for list of terminfo directories... $ECHO_C" >&6
 
 # Check whether --with-terminfo-dirs or --without-terminfo-dirs was given.
@@ -6285,7 +6389,7 @@
   ;;
 .[a-zA-Z]:[\\/]*) #(vi OS/2 EMX
   ;;
-.\${*prefix}*) #(vi
+.\${*prefix}*|.\${*dir}*) #(vi
   eval cf_src_path="$cf_src_path"
   case ".$cf_src_path" in #(vi
   .NONE/*)
@@ -6297,26 +6401,37 @@
   cf_src_path=`echo $cf_src_path | sed -e s%NONE%$cf_path_syntax%`
   ;;
 *)
-  { { echo "$as_me:6300: error: expected a pathname, not \"$cf_src_path\"" >&5
+  { { echo "$as_me:6404: error: expected a pathname, not \"$cf_src_path\"" >&5
 echo "$as_me: error: expected a pathname, not \"$cf_src_path\"" >&2;}
    { (exit 1); exit 1; }; }
   ;;
 esac
 
-  test -n "$cf_dst_path" && cf_dst_path="${cf_dst_path}:"
+  test -n "$cf_dst_path" && cf_dst_path="${cf_dst_path}$PATH_SEPARATOR"
   cf_dst_path="${cf_dst_path}${cf_src_path}"
 done
 IFS="$ac_save_ifs"
 
-eval 'TERMINFO_DIRS="$cf_dst_path"'
+# This may use the prefix/exec_prefix symbols which will only yield "NONE"
+# so we have to check/work around.  We do prefer the result of "eval"...
+eval cf_dst_eval="$cf_dst_path"
+case "x$cf_dst_eval" in #(vi
+xNONE*) #(vi
+	TERMINFO_DIRS=$cf_dst_path
+	;;
+*)
+	TERMINFO_DIRS="$cf_dst_eval"
+	;;
+esac
 
-echo "$as_me:6313: result: $TERMINFO_DIRS" >&5
+echo "$as_me:6427: result: $TERMINFO_DIRS" >&5
 echo "${ECHO_T}$TERMINFO_DIRS" >&6
-test -n "$TERMINFO_DIRS" && cat >>confdefs.h <<EOF
+test -n "$TERMINFO_DIRS" &&
+cat >>confdefs.h <<EOF
 #define TERMINFO_DIRS "$TERMINFO_DIRS"
 EOF
 
-echo "$as_me:6319: checking for default terminfo directory" >&5
+echo "$as_me:6434: checking for default terminfo directory" >&5
 echo $ECHO_N "checking for default terminfo directory... $ECHO_C" >&6
 
 # Check whether --with-default-terminfo-dir or --without-default-terminfo-dir was given.
@@ -6340,7 +6455,7 @@
   ;;
 .[a-zA-Z]:[\\/]*) #(vi OS/2 EMX
   ;;
-.\${*prefix}*) #(vi
+.\${*prefix}*|.\${*dir}*) #(vi
   eval withval="$withval"
   case ".$withval" in #(vi
   .NONE/*)
@@ -6352,17 +6467,18 @@
   withval=`echo $withval | sed -e s%NONE%$cf_path_syntax%`
   ;;
 *)
-  { { echo "$as_me:6355: error: expected a pathname, not \"$withval\"" >&5
+  { { echo "$as_me:6470: error: expected a pathname, not \"$withval\"" >&5
 echo "$as_me: error: expected a pathname, not \"$withval\"" >&2;}
    { (exit 1); exit 1; }; }
   ;;
 esac
 
 fi
-TERMINFO="$withval"
+eval TERMINFO="$withval"
 
-echo "$as_me:6364: result: $TERMINFO" >&5
+echo "$as_me:6479: result: $TERMINFO" >&5
 echo "${ECHO_T}$TERMINFO" >&6
+
 cat >>confdefs.h <<EOF
 #define TERMINFO "$TERMINFO"
 EOF
@@ -6371,7 +6487,7 @@
 
 ###	use option --disable-big-core to make tic run on small machines
 ###	We need 4Mb, check if we can allocate 50% more than that.
-echo "$as_me:6374: checking if big-core option selected" >&5
+echo "$as_me:6490: checking if big-core option selected" >&5
 echo $ECHO_N "checking if big-core option selected... $ECHO_C" >&6
 
 # Check whether --enable-big-core or --disable-big-core was given.
@@ -6383,7 +6499,7 @@
   with_big_core=no
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 6386 "configure"
+#line 6502 "configure"
 #include "confdefs.h"
 
 #include <stdlib.h>
@@ -6397,15 +6513,15 @@
 }
 _ACEOF
 rm -f conftest$ac_exeext
-if { (eval echo "$as_me:6400: \"$ac_link\"") >&5
+if { (eval echo "$as_me:6516: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:6403: \$? = $ac_status" >&5
+  echo "$as_me:6519: \$? = $ac_status" >&5
   (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (eval echo "$as_me:6405: \"$ac_try\"") >&5
+  { (eval echo "$as_me:6521: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:6408: \$? = $ac_status" >&5
+  echo "$as_me:6524: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   with_big_core=yes
 else
@@ -6417,16 +6533,17 @@
 rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
 fi;
-echo "$as_me:6420: result: $with_big_core" >&5
+echo "$as_me:6536: result: $with_big_core" >&5
 echo "${ECHO_T}$with_big_core" >&6
-test "$with_big_core" = "yes" && cat >>confdefs.h <<\EOF
+test "x$with_big_core" = "xyes" &&
+cat >>confdefs.h <<\EOF
 #define HAVE_BIG_CORE 1
 EOF
 
 ### ISO C only guarantees 512-char strings, we have tables which load faster
 ### when constructed using "big" strings.  More than the C compiler, the awk
 ### program is a limit on most vendor UNIX systems.  Check that we can build.
-echo "$as_me:6429: checking if big-strings option selected" >&5
+echo "$as_me:6546: checking if big-strings option selected" >&5
 echo $ECHO_N "checking if big-strings option selected... $ECHO_C" >&6
 
 # Check whether --enable-big-strings or --disable-big-strings was given.
@@ -6440,8 +6557,8 @@
 		eval with_big_strings=no
 		;;
 	*) #(vi
-		if ( ${AWK} 'BEGIN { xx = "x"; while (length(xx) < 12000) { xx = xx "x"; }; printf("%s\n", xx); }' \
-			| $AWK '{ printf "%d\n", length($0); }' | $AWK 'BEGIN { eqls=0; recs=0; } { recs++; if ($0 == 12000) eqls++; } END { if (recs != 1 || eqls != 1) exit 1; }' 2>/dev/null >/dev/null ) ; then
+		if ( ${AWK} 'BEGIN { xx = "x"; while (length(xx) < 12000) { xx = xx "x"; }; printf("%s\n", xx); }' 2>/dev/null \
+			| $AWK '{ printf "%d\n", length($0); }' 2>/dev/null | $AWK 'BEGIN { eqls=0; recs=0; } { recs++; if ($0 == 12000) eqls++; } END { if (recs != 1 || eqls != 1) exit 1; }' 2>/dev/null >/dev/null ) ; then
 			eval with_big_strings=yes
 		else
 			eval with_big_strings=no
@@ -6450,14 +6567,14 @@
 	esac
 
 fi;
-echo "$as_me:6453: result: $with_big_strings" >&5
+echo "$as_me:6570: result: $with_big_strings" >&5
 echo "${ECHO_T}$with_big_strings" >&6
 
 USE_BIG_STRINGS=0
-test "$with_big_strings" = "yes" && USE_BIG_STRINGS=1
+test "x$with_big_strings" = "xyes" && USE_BIG_STRINGS=1
 
 ###	use option --enable-termcap to compile in the termcap fallback support
-echo "$as_me:6460: checking if you want termcap-fallback support" >&5
+echo "$as_me:6577: checking if you want termcap-fallback support" >&5
 echo $ECHO_N "checking if you want termcap-fallback support... $ECHO_C" >&6
 
 # Check whether --enable-termcap or --disable-termcap was given.
@@ -6467,25 +6584,26 @@
 else
   with_termcap=no
 fi;
-echo "$as_me:6470: result: $with_termcap" >&5
+echo "$as_me:6587: result: $with_termcap" >&5
 echo "${ECHO_T}$with_termcap" >&6
 
-if test "$with_termcap" != "yes" ; then
+if test "x$with_termcap" != "xyes" ; then
 	if test "$use_database" = no ; then
 		if test -z "$with_fallback" ; then
-			{ { echo "$as_me:6476: error: You have disabled the database w/o specifying fallbacks" >&5
+			{ { echo "$as_me:6593: error: You have disabled the database w/o specifying fallbacks" >&5
 echo "$as_me: error: You have disabled the database w/o specifying fallbacks" >&2;}
    { (exit 1); exit 1; }; }
 		fi
 	fi
-	cat >>confdefs.h <<\EOF
+
+cat >>confdefs.h <<\EOF
 #define PURE_TERMINFO 1
 EOF
 
 else
 
 if test "$with_ticlib" != no ; then
-	{ { echo "$as_me:6488: error: Options --with-ticlib and --enable-termcap cannot be combined" >&5
+	{ { echo "$as_me:6606: error: Options --with-ticlib and --enable-termcap cannot be combined" >&5
 echo "$as_me: error: Options --with-ticlib and --enable-termcap cannot be combined" >&2;}
    { (exit 1); exit 1; }; }
 fi
@@ -6494,7 +6612,7 @@
 #define USE_TERMCAP 1
 EOF
 
-echo "$as_me:6497: checking for list of termcap files" >&5
+echo "$as_me:6615: checking for list of termcap files" >&5
 echo $ECHO_N "checking for list of termcap files... $ECHO_C" >&6
 
 # Check whether --with-termpath or --without-termpath was given.
@@ -6522,7 +6640,7 @@
   ;;
 .[a-zA-Z]:[\\/]*) #(vi OS/2 EMX
   ;;
-.\${*prefix}*) #(vi
+.\${*prefix}*|.\${*dir}*) #(vi
   eval cf_src_path="$cf_src_path"
   case ".$cf_src_path" in #(vi
   .NONE/*)
@@ -6534,27 +6652,38 @@
   cf_src_path=`echo $cf_src_path | sed -e s%NONE%$cf_path_syntax%`
   ;;
 *)
-  { { echo "$as_me:6537: error: expected a pathname, not \"$cf_src_path\"" >&5
+  { { echo "$as_me:6655: error: expected a pathname, not \"$cf_src_path\"" >&5
 echo "$as_me: error: expected a pathname, not \"$cf_src_path\"" >&2;}
    { (exit 1); exit 1; }; }
   ;;
 esac
 
-  test -n "$cf_dst_path" && cf_dst_path="${cf_dst_path}:"
+  test -n "$cf_dst_path" && cf_dst_path="${cf_dst_path}$PATH_SEPARATOR"
   cf_dst_path="${cf_dst_path}${cf_src_path}"
 done
 IFS="$ac_save_ifs"
 
-eval 'TERMPATH="$cf_dst_path"'
+# This may use the prefix/exec_prefix symbols which will only yield "NONE"
+# so we have to check/work around.  We do prefer the result of "eval"...
+eval cf_dst_eval="$cf_dst_path"
+case "x$cf_dst_eval" in #(vi
+xNONE*) #(vi
+	TERMPATH=$cf_dst_path
+	;;
+*)
+	TERMPATH="$cf_dst_eval"
+	;;
+esac
 
-echo "$as_me:6550: result: $TERMPATH" >&5
+echo "$as_me:6678: result: $TERMPATH" >&5
 echo "${ECHO_T}$TERMPATH" >&6
-test -n "$TERMPATH" && cat >>confdefs.h <<EOF
+test -n "$TERMPATH" &&
+cat >>confdefs.h <<EOF
 #define TERMPATH "$TERMPATH"
 EOF
 
 ###	use option --enable-getcap to use a hacked getcap for reading termcaps
-echo "$as_me:6557: checking if fast termcap-loader is needed" >&5
+echo "$as_me:6686: checking if fast termcap-loader is needed" >&5
 echo $ECHO_N "checking if fast termcap-loader is needed... $ECHO_C" >&6
 
 # Check whether --enable-getcap or --disable-getcap was given.
@@ -6564,13 +6693,14 @@
 else
   with_getcap=no
 fi;
-echo "$as_me:6567: result: $with_getcap" >&5
+echo "$as_me:6696: result: $with_getcap" >&5
 echo "${ECHO_T}$with_getcap" >&6
-test "$with_getcap" = "yes" && cat >>confdefs.h <<\EOF
+test "x$with_getcap" = "xyes" &&
+cat >>confdefs.h <<\EOF
 #define USE_GETCAP 1
 EOF
 
-echo "$as_me:6573: checking if translated termcaps will be cached in ~/.terminfo" >&5
+echo "$as_me:6703: checking if translated termcaps will be cached in ~/.terminfo" >&5
 echo $ECHO_N "checking if translated termcaps will be cached in ~/.terminfo... $ECHO_C" >&6
 
 # Check whether --enable-getcap-cache or --disable-getcap-cache was given.
@@ -6580,16 +6710,17 @@
 else
   with_getcap_cache=no
 fi;
-echo "$as_me:6583: result: $with_getcap_cache" >&5
+echo "$as_me:6713: result: $with_getcap_cache" >&5
 echo "${ECHO_T}$with_getcap_cache" >&6
-test "$with_getcap_cache" = "yes" && cat >>confdefs.h <<\EOF
+test "x$with_getcap_cache" = "xyes" &&
+cat >>confdefs.h <<\EOF
 #define USE_GETCAP_CACHE 1
 EOF
 
 fi
 
 ###   Use option --disable-home-terminfo to completely remove ~/.terminfo
-echo "$as_me:6592: checking if ~/.terminfo is wanted" >&5
+echo "$as_me:6723: checking if ~/.terminfo is wanted" >&5
 echo $ECHO_N "checking if ~/.terminfo is wanted... $ECHO_C" >&6
 
 # Check whether --enable-home-terminfo or --disable-home-terminfo was given.
@@ -6599,13 +6730,14 @@
 else
   with_home_terminfo=yes
 fi;
-echo "$as_me:6602: result: $with_home_terminfo" >&5
+echo "$as_me:6733: result: $with_home_terminfo" >&5
 echo "${ECHO_T}$with_home_terminfo" >&6
-test "$with_home_terminfo" = "yes" && cat >>confdefs.h <<\EOF
+test "x$with_home_terminfo" = "xyes" &&
+cat >>confdefs.h <<\EOF
 #define USE_HOME_TERMINFO 1
 EOF
 
-echo "$as_me:6608: checking if you want to use restricted environment when running as root" >&5
+echo "$as_me:6740: checking if you want to use restricted environment when running as root" >&5
 echo $ECHO_N "checking if you want to use restricted environment when running as root... $ECHO_C" >&6
 
 # Check whether --enable-root-environ or --disable-root-environ was given.
@@ -6615,9 +6747,10 @@
 else
   with_root_environ=yes
 fi;
-echo "$as_me:6618: result: $with_root_environ" >&5
+echo "$as_me:6750: result: $with_root_environ" >&5
 echo "${ECHO_T}$with_root_environ" >&6
-test "$with_root_environ" = yes && cat >>confdefs.h <<\EOF
+test "x$with_root_environ" = xyes &&
+cat >>confdefs.h <<\EOF
 #define USE_ROOT_ENVIRON 1
 EOF
 
@@ -6629,13 +6762,13 @@
 	unlink
 do
 as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
-echo "$as_me:6632: checking for $ac_func" >&5
+echo "$as_me:6765: checking for $ac_func" >&5
 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
 if eval "test \"\${$as_ac_var+set}\" = set"; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 6638 "configure"
+#line 6771 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func (); below.  */
@@ -6658,7 +6791,7 @@
 #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
 choke me
 #else
-f = $ac_func;
+f = $ac_func; /* workaround for ICC 12.0.3 */ if (f == 0) return 1;
 #endif
 
   ;
@@ -6666,16 +6799,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:6669: \"$ac_link\"") >&5
+if { (eval echo "$as_me:6802: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:6672: \$? = $ac_status" >&5
+  echo "$as_me:6805: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:6675: \"$ac_try\"") >&5
+  { (eval echo "$as_me:6808: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:6678: \$? = $ac_status" >&5
+  echo "$as_me:6811: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   eval "$as_ac_var=yes"
 else
@@ -6685,7 +6818,7 @@
 fi
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 fi
-echo "$as_me:6688: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "$as_me:6821: result: `eval echo '${'$as_ac_var'}'`" >&5
 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
 if test `eval echo '${'$as_ac_var'}'` = yes; then
   cat >>confdefs.h <<EOF
@@ -6702,13 +6835,13 @@
 		symlink
 do
 as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
-echo "$as_me:6705: checking for $ac_func" >&5
+echo "$as_me:6838: checking for $ac_func" >&5
 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
 if eval "test \"\${$as_ac_var+set}\" = set"; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 6711 "configure"
+#line 6844 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func (); below.  */
@@ -6731,7 +6864,7 @@
 #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
 choke me
 #else
-f = $ac_func;
+f = $ac_func; /* workaround for ICC 12.0.3 */ if (f == 0) return 1;
 #endif
 
   ;
@@ -6739,16 +6872,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:6742: \"$ac_link\"") >&5
+if { (eval echo "$as_me:6875: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:6745: \$? = $ac_status" >&5
+  echo "$as_me:6878: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:6748: \"$ac_try\"") >&5
+  { (eval echo "$as_me:6881: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:6751: \$? = $ac_status" >&5
+  echo "$as_me:6884: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   eval "$as_ac_var=yes"
 else
@@ -6758,7 +6891,7 @@
 fi
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 fi
-echo "$as_me:6761: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "$as_me:6894: result: `eval echo '${'$as_ac_var'}'`" >&5
 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
 if test `eval echo '${'$as_ac_var'}'` = yes; then
   cat >>confdefs.h <<EOF
@@ -6769,7 +6902,7 @@
 done
 
 else
-	echo "$as_me:6772: checking if link/symlink functions work" >&5
+	echo "$as_me:6905: checking if link/symlink functions work" >&5
 echo $ECHO_N "checking if link/symlink functions work... $ECHO_C" >&6
 if test "${cf_cv_link_funcs+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -6782,7 +6915,7 @@
 			eval 'ac_cv_func_'$cf_func'=error'
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 6785 "configure"
+#line 6918 "configure"
 #include "confdefs.h"
 
 #include <sys/types.h>
@@ -6812,15 +6945,15 @@
 
 _ACEOF
 rm -f conftest$ac_exeext
-if { (eval echo "$as_me:6815: \"$ac_link\"") >&5
+if { (eval echo "$as_me:6948: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:6818: \$? = $ac_status" >&5
+  echo "$as_me:6951: \$? = $ac_status" >&5
   (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (eval echo "$as_me:6820: \"$ac_try\"") >&5
+  { (eval echo "$as_me:6953: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:6823: \$? = $ac_status" >&5
+  echo "$as_me:6956: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
 
 			cf_cv_link_funcs="$cf_cv_link_funcs $cf_func"
@@ -6838,13 +6971,15 @@
 		test -z "$cf_cv_link_funcs" && cf_cv_link_funcs=no
 
 fi
-echo "$as_me:6841: result: $cf_cv_link_funcs" >&5
+echo "$as_me:6974: result: $cf_cv_link_funcs" >&5
 echo "${ECHO_T}$cf_cv_link_funcs" >&6
-	test "$ac_cv_func_link"    = yes && cat >>confdefs.h <<\EOF
+	test "$ac_cv_func_link"    = yes &&
+cat >>confdefs.h <<\EOF
 #define HAVE_LINK 1
 EOF
 
-	test "$ac_cv_func_symlink" = yes && cat >>confdefs.h <<\EOF
+	test "$ac_cv_func_symlink" = yes &&
+cat >>confdefs.h <<\EOF
 #define HAVE_SYMLINK 1
 EOF
 
@@ -6855,8 +6990,8 @@
 
 # soft links (symbolic links) are useful for some systems where hard links do
 # not work, or to make it simpler to copy terminfo trees around.
-if test "$ac_cv_func_symlink" = yes ; then
-    echo "$as_me:6859: checking if tic should use symbolic links" >&5
+if test "x$ac_cv_func_symlink" = xyes ; then
+    echo "$as_me:6994: checking if tic should use symbolic links" >&5
 echo $ECHO_N "checking if tic should use symbolic links... $ECHO_C" >&6
 
 # Check whether --enable-symlinks or --disable-symlinks was given.
@@ -6866,34 +7001,36 @@
 else
   with_symlinks=no
 fi;
-    echo "$as_me:6869: result: $with_symlinks" >&5
+    echo "$as_me:7004: result: $with_symlinks" >&5
 echo "${ECHO_T}$with_symlinks" >&6
 fi
 
 # If we have hard links and did not choose to use soft links instead, there is
 # no reason to make this choice optional - use the hard links.
 if test "$with_symlinks" = no ; then
-    echo "$as_me:6876: checking if tic should use hard links" >&5
+    echo "$as_me:7011: checking if tic should use hard links" >&5
 echo $ECHO_N "checking if tic should use hard links... $ECHO_C" >&6
-    if test "$ac_cv_func_link" = yes ; then
+    if test "x$ac_cv_func_link" = xyes ; then
 	with_links=yes
     else
 	with_links=no
     fi
-    echo "$as_me:6883: result: $with_links" >&5
+    echo "$as_me:7018: result: $with_links" >&5
 echo "${ECHO_T}$with_links" >&6
 fi
 
-test "$with_links" = yes && cat >>confdefs.h <<\EOF
+test "x$with_links" = xyes &&
+cat >>confdefs.h <<\EOF
 #define USE_LINKS 1
 EOF
 
-test "$with_symlinks" = yes && cat >>confdefs.h <<\EOF
+test "x$with_symlinks" = xyes &&
+cat >>confdefs.h <<\EOF
 #define USE_SYMLINKS 1
 EOF
 
 ###   use option --enable-broken-linker to force on use of broken-linker support
-echo "$as_me:6896: checking if you want broken-linker support code" >&5
+echo "$as_me:7033: checking if you want broken-linker support code" >&5
 echo $ECHO_N "checking if you want broken-linker support code... $ECHO_C" >&6
 
 # Check whether --enable-broken_linker or --disable-broken_linker was given.
@@ -6903,12 +7040,13 @@
 else
   with_broken_linker=${BROKEN_LINKER:-no}
 fi;
-echo "$as_me:6906: result: $with_broken_linker" >&5
+echo "$as_me:7043: result: $with_broken_linker" >&5
 echo "${ECHO_T}$with_broken_linker" >&6
 
 BROKEN_LINKER=0
-if test "$with_broken_linker" = yes ; then
-	cat >>confdefs.h <<\EOF
+if test "x$with_broken_linker" = xyes ; then
+
+cat >>confdefs.h <<\EOF
 #define BROKEN_LINKER 1
 EOF
 
@@ -6916,21 +7054,22 @@
 elif test "$DFT_LWR_MODEL" = shared ; then
 	case $cf_cv_system_name in #(vi
 	cygwin*)
-		cat >>confdefs.h <<\EOF
+
+cat >>confdefs.h <<\EOF
 #define BROKEN_LINKER 1
 EOF
 
 		BROKEN_LINKER=1
 		test -n "$verbose" && echo "	cygwin linker is broken anyway" 1>&6
 
-echo "${as_me:-configure}:6926: testing cygwin linker is broken anyway ..." 1>&5
+echo "${as_me:-configure}:7065: testing cygwin linker is broken anyway ..." 1>&5
 
 		;;
 	esac
 fi
 
 ###   use option --enable-bsdpad to have tputs process BSD-style prefix padding
-echo "$as_me:6933: checking if tputs should process BSD-style prefix padding" >&5
+echo "$as_me:7072: checking if tputs should process BSD-style prefix padding" >&5
 echo $ECHO_N "checking if tputs should process BSD-style prefix padding... $ECHO_C" >&6
 
 # Check whether --enable-bsdpad or --disable-bsdpad was given.
@@ -6940,9 +7079,10 @@
 else
   with_bsdpad=no
 fi;
-echo "$as_me:6943: result: $with_bsdpad" >&5
+echo "$as_me:7082: result: $with_bsdpad" >&5
 echo "${ECHO_T}$with_bsdpad" >&6
-test "$with_bsdpad" = yes && cat >>confdefs.h <<\EOF
+test "x$with_bsdpad" = xyes &&
+cat >>confdefs.h <<\EOF
 #define BSD_TPUTS 1
 EOF
 
@@ -6962,7 +7102,7 @@
 cf_xopen_source=
 
 case $host_os in #(vi
-aix[456]*) #(vi
+aix[4-7]*) #(vi
 	cf_xopen_source="-D_ALL_SOURCE"
 	;;
 cygwin) #(vi
@@ -6973,6 +7113,7 @@
 	;;
 darwin*) #(vi
 	cf_xopen_source="-D_DARWIN_C_SOURCE"
+	cf_XOPEN_SOURCE=
 	;;
 freebsd*|dragonfly*) #(vi
 	# 5.x headers associate
@@ -6990,17 +7131,18 @@
 	;;
 irix[56].*) #(vi
 	cf_xopen_source="-D_SGI_SOURCE"
+	cf_XOPEN_SOURCE=
 	;;
 linux*|gnu*|mint*|k*bsd*-gnu) #(vi
 
-echo "$as_me:6996: checking if we must define _GNU_SOURCE" >&5
+echo "$as_me:7138: checking if we must define _GNU_SOURCE" >&5
 echo $ECHO_N "checking if we must define _GNU_SOURCE... $ECHO_C" >&6
 if test "${cf_cv_gnu_source+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
 
 cat >conftest.$ac_ext <<_ACEOF
-#line 7003 "configure"
+#line 7145 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 int
@@ -7015,16 +7157,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:7018: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:7160: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:7021: \$? = $ac_status" >&5
+  echo "$as_me:7163: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:7024: \"$ac_try\"") >&5
+  { (eval echo "$as_me:7166: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:7027: \$? = $ac_status" >&5
+  echo "$as_me:7169: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   cf_cv_gnu_source=no
 else
@@ -7033,7 +7175,7 @@
 cf_save="$CPPFLAGS"
 	 CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
 	 cat >conftest.$ac_ext <<_ACEOF
-#line 7036 "configure"
+#line 7178 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 int
@@ -7048,16 +7190,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:7051: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:7193: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:7054: \$? = $ac_status" >&5
+  echo "$as_me:7196: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:7057: \"$ac_try\"") >&5
+  { (eval echo "$as_me:7199: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:7060: \$? = $ac_status" >&5
+  echo "$as_me:7202: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   cf_cv_gnu_source=no
 else
@@ -7065,23 +7207,267 @@
 cat conftest.$ac_ext >&5
 cf_cv_gnu_source=yes
 fi
-rm -f conftest.$ac_objext conftest.$ac_ext
-	CPPFLAGS="$cf_save"
+rm -f conftest.$ac_objext conftest.$ac_ext
+	CPPFLAGS="$cf_save"
+
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+
+fi
+echo "$as_me:7217: result: $cf_cv_gnu_source" >&5
+echo "${ECHO_T}$cf_cv_gnu_source" >&6
+test "$cf_cv_gnu_source" = yes && CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
+
+	;;
+mirbsd*) #(vi
+	# setting _XOPEN_SOURCE or _POSIX_SOURCE breaks <sys/select.h> and other headers which use u_int / u_short types
+	cf_XOPEN_SOURCE=
+
+cf_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE
+
+cf_save_CFLAGS="$CFLAGS"
+cf_save_CPPFLAGS="$CPPFLAGS"
+
+cf_trim_CFLAGS=`echo "$cf_save_CFLAGS" | \
+	sed	-e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ 	]*\)\?[ 	]/ /g' \
+		-e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ 	]*\)\?$//g'`
+
+cf_trim_CPPFLAGS=`echo "$cf_save_CPPFLAGS" | \
+	sed	-e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ 	]*\)\?[ 	]/ /g' \
+		-e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ 	]*\)\?$//g'`
+
+echo "$as_me:7239: checking if we should define _POSIX_C_SOURCE" >&5
+echo $ECHO_N "checking if we should define _POSIX_C_SOURCE... $ECHO_C" >&6
+if test "${cf_cv_posix_c_source+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+echo "${as_me:-configure}:7245: testing if the symbol is already defined go no further ..." 1>&5
+
+	cat >conftest.$ac_ext <<_ACEOF
+#line 7248 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+int
+main ()
+{
+
+#ifndef _POSIX_C_SOURCE
+make an error
+#endif
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:7263: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:7266: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:7269: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:7272: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  cf_cv_posix_c_source=no
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+cf_want_posix_source=no
+	 case .$cf_POSIX_C_SOURCE in #(vi
+	 .[12]??*) #(vi
+		cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE"
+		;;
+	 .2) #(vi
+		cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE"
+		cf_want_posix_source=yes
+		;;
+	 .*)
+		cf_want_posix_source=yes
+		;;
+	 esac
+	 if test "$cf_want_posix_source" = yes ; then
+		cat >conftest.$ac_ext <<_ACEOF
+#line 7293 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+int
+main ()
+{
+
+#ifdef _POSIX_SOURCE
+make an error
+#endif
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:7308: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:7311: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:7314: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:7317: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  :
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+cf_cv_posix_c_source="$cf_cv_posix_c_source -D_POSIX_SOURCE"
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+	 fi
+
+echo "${as_me:-configure}:7328: testing ifdef from value $cf_POSIX_C_SOURCE ..." 1>&5
+
+	 CFLAGS="$cf_trim_CFLAGS"
+	 CPPFLAGS="$cf_trim_CPPFLAGS $cf_cv_posix_c_source"
+
+echo "${as_me:-configure}:7333: testing if the second compile does not leave our definition intact error ..." 1>&5
+
+	 cat >conftest.$ac_ext <<_ACEOF
+#line 7336 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+int
+main ()
+{
+
+#ifndef _POSIX_C_SOURCE
+make an error
+#endif
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:7351: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:7354: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:7357: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:7360: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  :
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+cf_cv_posix_c_source=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+	 CFLAGS="$cf_save_CFLAGS"
+	 CPPFLAGS="$cf_save_CPPFLAGS"
+
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+
+fi
+echo "$as_me:7376: result: $cf_cv_posix_c_source" >&5
+echo "${ECHO_T}$cf_cv_posix_c_source" >&6
+
+if test "$cf_cv_posix_c_source" != no ; then
+	CFLAGS="$cf_trim_CFLAGS"
+	CPPFLAGS="$cf_trim_CPPFLAGS"
+
+cf_fix_cppflags=no
+cf_new_cflags=
+cf_new_cppflags=
+cf_new_extra_cppflags=
+
+for cf_add_cflags in $cf_cv_posix_c_source
+do
+case $cf_fix_cppflags in
+no)
+	case $cf_add_cflags in #(vi
+	-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi
+		case $cf_add_cflags in
+		-D*)
+			cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'`
+
+			test "${cf_add_cflags}" != "${cf_tst_cflags}" \
+				&& test -z "${cf_tst_cflags}" \
+				&& cf_fix_cppflags=yes
+
+			if test $cf_fix_cppflags = yes ; then
+				cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
+				continue
+			elif test "${cf_tst_cflags}" = "\"'" ; then
+				cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
+				continue
+			fi
+			;;
+		esac
+		case "$CPPFLAGS" in
+		*$cf_add_cflags) #(vi
+			;;
+		*) #(vi
+			case $cf_add_cflags in #(vi
+			-D*)
+				cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'`
+
+CPPFLAGS=`echo "$CPPFLAGS" | \
+	sed	-e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ 	]*\)\?[ 	]/ /g' \
+		-e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ 	]*\)\?$//g'`
+
+				;;
+			esac
+			cf_new_cppflags="$cf_new_cppflags $cf_add_cflags"
+			;;
+		esac
+		;;
+	*)
+		cf_new_cflags="$cf_new_cflags $cf_add_cflags"
+		;;
+	esac
+	;;
+yes)
+	cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
+
+	cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'`
+
+	test "${cf_add_cflags}" != "${cf_tst_cflags}" \
+		&& test -z "${cf_tst_cflags}" \
+		&& cf_fix_cppflags=no
+	;;
+esac
+done
+
+if test -n "$cf_new_cflags" ; then
+
+	CFLAGS="$CFLAGS $cf_new_cflags"
+fi
+
+if test -n "$cf_new_cppflags" ; then
 
+	CPPFLAGS="$CPPFLAGS $cf_new_cppflags"
+fi
+
+if test -n "$cf_new_extra_cppflags" ; then
+
+	EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS"
 fi
-rm -f conftest.$ac_objext conftest.$ac_ext
 
 fi
-echo "$as_me:7075: result: $cf_cv_gnu_source" >&5
-echo "${ECHO_T}$cf_cv_gnu_source" >&6
-test "$cf_cv_gnu_source" = yes && CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
 
-	;;
-mirbsd*) #(vi
-	# setting _XOPEN_SOURCE or _POSIX_SOURCE breaks <arpa/inet.h>
 	;;
 netbsd*) #(vi
-	# setting _XOPEN_SOURCE breaks IPv6 for lynx on NetBSD 1.6, breaks xterm, is not needed for ncursesw
+	cf_xopen_source="-D_NETBSD_SOURCE" # setting _XOPEN_SOURCE breaks IPv6 for lynx on NetBSD 1.6, breaks xterm, is not needed for ncursesw
+	;;
+openbsd[4-9]*) #(vi
+	# setting _XOPEN_SOURCE lower than 500 breaks g++ compile with wchar.h, needed for ncursesw
+	cf_xopen_source="-D_BSD_SOURCE"
+	cf_XOPEN_SOURCE=600
 	;;
 openbsd*) #(vi
 	# setting _XOPEN_SOURCE breaks xterm on OpenBSD 2.8, is not needed for ncursesw
@@ -7095,23 +7481,25 @@
 sco*) #(vi
 	# setting _XOPEN_SOURCE breaks Lynx on SCO Unix / OpenServer
 	;;
-solaris2.1[0-9]) #(vi
-	cf_xopen_source="-D__EXTENSIONS__ -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE"
-	;;
-solaris2.[1-9]) #(vi
+solaris2.*) #(vi
 	cf_xopen_source="-D__EXTENSIONS__"
 	;;
 *)
-	echo "$as_me:7105: checking if we should define _XOPEN_SOURCE" >&5
+
+echo "$as_me:7489: checking if we should define _XOPEN_SOURCE" >&5
 echo $ECHO_N "checking if we should define _XOPEN_SOURCE... $ECHO_C" >&6
 if test "${cf_cv_xopen_source+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
 
 	cat >conftest.$ac_ext <<_ACEOF
-#line 7112 "configure"
+#line 7496 "configure"
 #include "confdefs.h"
+
+#include <stdlib.h>
+#include <string.h>
 #include <sys/types.h>
+
 int
 main ()
 {
@@ -7124,16 +7512,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:7127: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:7515: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:7130: \$? = $ac_status" >&5
+  echo "$as_me:7518: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:7133: \"$ac_try\"") >&5
+  { (eval echo "$as_me:7521: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:7136: \$? = $ac_status" >&5
+  echo "$as_me:7524: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   cf_cv_xopen_source=no
 else
@@ -7142,9 +7530,13 @@
 cf_save="$CPPFLAGS"
 	 CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE"
 	 cat >conftest.$ac_ext <<_ACEOF
-#line 7145 "configure"
+#line 7533 "configure"
 #include "confdefs.h"
+
+#include <stdlib.h>
+#include <string.h>
 #include <sys/types.h>
+
 int
 main ()
 {
@@ -7157,16 +7549,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:7160: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:7552: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:7163: \$? = $ac_status" >&5
+  echo "$as_me:7555: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:7166: \"$ac_try\"") >&5
+  { (eval echo "$as_me:7558: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:7169: \$? = $ac_status" >&5
+  echo "$as_me:7561: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   cf_cv_xopen_source=no
 else
@@ -7181,9 +7573,10 @@
 rm -f conftest.$ac_objext conftest.$ac_ext
 
 fi
-echo "$as_me:7184: result: $cf_cv_xopen_source" >&5
+echo "$as_me:7576: result: $cf_cv_xopen_source" >&5
 echo "${ECHO_T}$cf_cv_xopen_source" >&6
-	if test "$cf_cv_xopen_source" != no ; then
+
+if test "$cf_cv_xopen_source" != no ; then
 
 CFLAGS=`echo "$CFLAGS" | \
 	sed	-e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ 	]*\)\?[ 	]/ /g' \
@@ -7193,7 +7586,7 @@
 	sed	-e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ 	]*\)\?[ 	]/ /g' \
 		-e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ 	]*\)\?$//g'`
 
-		cf_temp_xopen_source="-D_XOPEN_SOURCE=$cf_cv_xopen_source"
+	cf_temp_xopen_source="-D_XOPEN_SOURCE=$cf_cv_xopen_source"
 
 cf_fix_cppflags=no
 cf_new_cflags=
@@ -7273,7 +7666,7 @@
 	EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS"
 fi
 
-	fi
+fi
 
 cf_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE
 
@@ -7288,16 +7681,16 @@
 	sed	-e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ 	]*\)\?[ 	]/ /g' \
 		-e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ 	]*\)\?$//g'`
 
-echo "$as_me:7291: checking if we should define _POSIX_C_SOURCE" >&5
+echo "$as_me:7684: checking if we should define _POSIX_C_SOURCE" >&5
 echo $ECHO_N "checking if we should define _POSIX_C_SOURCE... $ECHO_C" >&6
 if test "${cf_cv_posix_c_source+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
 
-echo "${as_me:-configure}:7297: testing if the symbol is already defined go no further ..." 1>&5
+echo "${as_me:-configure}:7690: testing if the symbol is already defined go no further ..." 1>&5
 
 	cat >conftest.$ac_ext <<_ACEOF
-#line 7300 "configure"
+#line 7693 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 int
@@ -7312,16 +7705,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:7315: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:7708: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:7318: \$? = $ac_status" >&5
+  echo "$as_me:7711: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:7321: \"$ac_try\"") >&5
+  { (eval echo "$as_me:7714: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:7324: \$? = $ac_status" >&5
+  echo "$as_me:7717: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   cf_cv_posix_c_source=no
 else
@@ -7342,7 +7735,7 @@
 	 esac
 	 if test "$cf_want_posix_source" = yes ; then
 		cat >conftest.$ac_ext <<_ACEOF
-#line 7345 "configure"
+#line 7738 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 int
@@ -7357,16 +7750,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:7360: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:7753: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:7363: \$? = $ac_status" >&5
+  echo "$as_me:7756: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:7366: \"$ac_try\"") >&5
+  { (eval echo "$as_me:7759: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:7369: \$? = $ac_status" >&5
+  echo "$as_me:7762: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   :
 else
@@ -7377,15 +7770,15 @@
 rm -f conftest.$ac_objext conftest.$ac_ext
 	 fi
 
-echo "${as_me:-configure}:7380: testing ifdef from value $cf_POSIX_C_SOURCE ..." 1>&5
+echo "${as_me:-configure}:7773: testing ifdef from value $cf_POSIX_C_SOURCE ..." 1>&5
 
 	 CFLAGS="$cf_trim_CFLAGS"
 	 CPPFLAGS="$cf_trim_CPPFLAGS $cf_cv_posix_c_source"
 
-echo "${as_me:-configure}:7385: testing if the second compile does not leave our definition intact error ..." 1>&5
+echo "${as_me:-configure}:7778: testing if the second compile does not leave our definition intact error ..." 1>&5
 
 	 cat >conftest.$ac_ext <<_ACEOF
-#line 7388 "configure"
+#line 7781 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 int
@@ -7400,16 +7793,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:7403: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:7796: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:7406: \$? = $ac_status" >&5
+  echo "$as_me:7799: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:7409: \"$ac_try\"") >&5
+  { (eval echo "$as_me:7802: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:7412: \$? = $ac_status" >&5
+  echo "$as_me:7805: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   :
 else
@@ -7425,7 +7818,7 @@
 rm -f conftest.$ac_objext conftest.$ac_ext
 
 fi
-echo "$as_me:7428: result: $cf_cv_posix_c_source" >&5
+echo "$as_me:7821: result: $cf_cv_posix_c_source" >&5
 echo "${ECHO_T}$cf_cv_posix_c_source" >&6
 
 if test "$cf_cv_posix_c_source" != no ; then
@@ -7500,29 +7893,293 @@
 	CFLAGS="$CFLAGS $cf_new_cflags"
 fi
 
-if test -n "$cf_new_cppflags" ; then
-
-	CPPFLAGS="$CPPFLAGS $cf_new_cppflags"
+if test -n "$cf_new_cppflags" ; then
+
+	CPPFLAGS="$CPPFLAGS $cf_new_cppflags"
+fi
+
+if test -n "$cf_new_extra_cppflags" ; then
+
+	EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS"
+fi
+
+fi
+
+	;;
+esac
+
+if test -n "$cf_xopen_source" ; then
+
+cf_fix_cppflags=no
+cf_new_cflags=
+cf_new_cppflags=
+cf_new_extra_cppflags=
+
+for cf_add_cflags in $cf_xopen_source
+do
+case $cf_fix_cppflags in
+no)
+	case $cf_add_cflags in #(vi
+	-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi
+		case $cf_add_cflags in
+		-D*)
+			cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'`
+
+			test "${cf_add_cflags}" != "${cf_tst_cflags}" \
+				&& test -z "${cf_tst_cflags}" \
+				&& cf_fix_cppflags=yes
+
+			if test $cf_fix_cppflags = yes ; then
+				cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
+				continue
+			elif test "${cf_tst_cflags}" = "\"'" ; then
+				cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
+				continue
+			fi
+			;;
+		esac
+		case "$CPPFLAGS" in
+		*$cf_add_cflags) #(vi
+			;;
+		*) #(vi
+			case $cf_add_cflags in #(vi
+			-D*)
+				cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'`
+
+CPPFLAGS=`echo "$CPPFLAGS" | \
+	sed	-e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ 	]*\)\?[ 	]/ /g' \
+		-e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ 	]*\)\?$//g'`
+
+				;;
+			esac
+			cf_new_cppflags="$cf_new_cppflags $cf_add_cflags"
+			;;
+		esac
+		;;
+	*)
+		cf_new_cflags="$cf_new_cflags $cf_add_cflags"
+		;;
+	esac
+	;;
+yes)
+	cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
+
+	cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'`
+
+	test "${cf_add_cflags}" != "${cf_tst_cflags}" \
+		&& test -z "${cf_tst_cflags}" \
+		&& cf_fix_cppflags=no
+	;;
+esac
+done
+
+if test -n "$cf_new_cflags" ; then
+
+	CFLAGS="$CFLAGS $cf_new_cflags"
+fi
+
+if test -n "$cf_new_cppflags" ; then
+
+	CPPFLAGS="$CPPFLAGS $cf_new_cppflags"
+fi
+
+if test -n "$cf_new_extra_cppflags" ; then
+
+	EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS"
+fi
+
+fi
+
+if test -n "$cf_XOPEN_SOURCE" && test -z "$cf_cv_xopen_source" ; then
+	echo "$as_me:7994: checking if _XOPEN_SOURCE really is set" >&5
+echo $ECHO_N "checking if _XOPEN_SOURCE really is set... $ECHO_C" >&6
+	cat >conftest.$ac_ext <<_ACEOF
+#line 7997 "configure"
+#include "confdefs.h"
+#include <stdlib.h>
+int
+main ()
+{
+
+#ifndef _XOPEN_SOURCE
+make an error
+#endif
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:8012: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:8015: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:8018: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:8021: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  cf_XOPEN_SOURCE_set=yes
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+cf_XOPEN_SOURCE_set=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+	echo "$as_me:8030: result: $cf_XOPEN_SOURCE_set" >&5
+echo "${ECHO_T}$cf_XOPEN_SOURCE_set" >&6
+	if test $cf_XOPEN_SOURCE_set = yes
+	then
+		cat >conftest.$ac_ext <<_ACEOF
+#line 8035 "configure"
+#include "confdefs.h"
+#include <stdlib.h>
+int
+main ()
+{
+
+#if (_XOPEN_SOURCE - 0) < $cf_XOPEN_SOURCE
+make an error
+#endif
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:8050: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:8053: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:8056: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:8059: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  cf_XOPEN_SOURCE_set_ok=yes
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+cf_XOPEN_SOURCE_set_ok=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+		if test $cf_XOPEN_SOURCE_set_ok = no
+		then
+			{ echo "$as_me:8070: WARNING: _XOPEN_SOURCE is lower than requested" >&5
+echo "$as_me: WARNING: _XOPEN_SOURCE is lower than requested" >&2;}
+		fi
+	else
+
+echo "$as_me:8075: checking if we should define _XOPEN_SOURCE" >&5
+echo $ECHO_N "checking if we should define _XOPEN_SOURCE... $ECHO_C" >&6
+if test "${cf_cv_xopen_source+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+	cat >conftest.$ac_ext <<_ACEOF
+#line 8082 "configure"
+#include "confdefs.h"
+
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+
+int
+main ()
+{
+
+#ifndef _XOPEN_SOURCE
+make an error
+#endif
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:8101: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:8104: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:8107: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:8110: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  cf_cv_xopen_source=no
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+cf_save="$CPPFLAGS"
+	 CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE"
+	 cat >conftest.$ac_ext <<_ACEOF
+#line 8119 "configure"
+#include "confdefs.h"
+
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+
+int
+main ()
+{
+
+#ifdef _XOPEN_SOURCE
+make an error
+#endif
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:8138: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:8141: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:8144: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:8147: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  cf_cv_xopen_source=no
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+cf_cv_xopen_source=$cf_XOPEN_SOURCE
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+	CPPFLAGS="$cf_save"
+
 fi
+rm -f conftest.$ac_objext conftest.$ac_ext
 
-if test -n "$cf_new_extra_cppflags" ; then
-
-	EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS"
 fi
+echo "$as_me:8162: result: $cf_cv_xopen_source" >&5
+echo "${ECHO_T}$cf_cv_xopen_source" >&6
 
-fi
+if test "$cf_cv_xopen_source" != no ; then
 
-	;;
-esac
+CFLAGS=`echo "$CFLAGS" | \
+	sed	-e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ 	]*\)\?[ 	]/ /g' \
+		-e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ 	]*\)\?$//g'`
 
-if test -n "$cf_xopen_source" ; then
+CPPFLAGS=`echo "$CPPFLAGS" | \
+	sed	-e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ 	]*\)\?[ 	]/ /g' \
+		-e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ 	]*\)\?$//g'`
+
+	cf_temp_xopen_source="-D_XOPEN_SOURCE=$cf_cv_xopen_source"
 
 cf_fix_cppflags=no
 cf_new_cflags=
 cf_new_cppflags=
 cf_new_extra_cppflags=
 
-for cf_add_cflags in $cf_xopen_source
+for cf_add_cflags in $cf_temp_xopen_source
 do
 case $cf_fix_cppflags in
 no)
@@ -7597,16 +8254,19 @@
 
 fi
 
+	fi
+fi
+
 # Work around breakage on OS X
 
-echo "$as_me:7602: checking if SIGWINCH is defined" >&5
+echo "$as_me:8262: checking if SIGWINCH is defined" >&5
 echo $ECHO_N "checking if SIGWINCH is defined... $ECHO_C" >&6
 if test "${cf_cv_define_sigwinch+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
 
 	cat >conftest.$ac_ext <<_ACEOF
-#line 7609 "configure"
+#line 8269 "configure"
 #include "confdefs.h"
 
 #include <sys/types.h>
@@ -7621,23 +8281,23 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:7624: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:8284: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:7627: \$? = $ac_status" >&5
+  echo "$as_me:8287: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:7630: \"$ac_try\"") >&5
+  { (eval echo "$as_me:8290: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:7633: \$? = $ac_status" >&5
+  echo "$as_me:8293: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   cf_cv_define_sigwinch=yes
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
 cat >conftest.$ac_ext <<_ACEOF
-#line 7640 "configure"
+#line 8300 "configure"
 #include "confdefs.h"
 
 #undef _XOPEN_SOURCE
@@ -7655,16 +8315,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:7658: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:8318: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:7661: \$? = $ac_status" >&5
+  echo "$as_me:8321: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:7664: \"$ac_try\"") >&5
+  { (eval echo "$as_me:8324: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:7667: \$? = $ac_status" >&5
+  echo "$as_me:8327: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   cf_cv_define_sigwinch=maybe
 else
@@ -7678,11 +8338,11 @@
 rm -f conftest.$ac_objext conftest.$ac_ext
 
 fi
-echo "$as_me:7681: result: $cf_cv_define_sigwinch" >&5
+echo "$as_me:8341: result: $cf_cv_define_sigwinch" >&5
 echo "${ECHO_T}$cf_cv_define_sigwinch" >&6
 
 if test "$cf_cv_define_sigwinch" = maybe ; then
-echo "$as_me:7685: checking for actual SIGWINCH definition" >&5
+echo "$as_me:8345: checking for actual SIGWINCH definition" >&5
 echo $ECHO_N "checking for actual SIGWINCH definition... $ECHO_C" >&6
 if test "${cf_cv_fixup_sigwinch+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -7693,7 +8353,7 @@
 while test $cf_sigwinch != 1
 do
 	cat >conftest.$ac_ext <<_ACEOF
-#line 7696 "configure"
+#line 8356 "configure"
 #include "confdefs.h"
 
 #undef _XOPEN_SOURCE
@@ -7715,16 +8375,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:7718: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:8378: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:7721: \$? = $ac_status" >&5
+  echo "$as_me:8381: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:7724: \"$ac_try\"") >&5
+  { (eval echo "$as_me:8384: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:7727: \$? = $ac_status" >&5
+  echo "$as_me:8387: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   cf_cv_fixup_sigwinch=$cf_sigwinch
 	 break
@@ -7738,7 +8398,7 @@
 done
 
 fi
-echo "$as_me:7741: result: $cf_cv_fixup_sigwinch" >&5
+echo "$as_me:8401: result: $cf_cv_fixup_sigwinch" >&5
 echo "${ECHO_T}$cf_cv_fixup_sigwinch" >&6
 
 	if test "$cf_cv_fixup_sigwinch" != unknown ; then
@@ -7748,13 +8408,13 @@
 
 # Checks for CODESET support.
 
-  echo "$as_me:7751: checking for nl_langinfo and CODESET" >&5
+  echo "$as_me:8411: checking for nl_langinfo and CODESET" >&5
 echo $ECHO_N "checking for nl_langinfo and CODESET... $ECHO_C" >&6
 if test "${am_cv_langinfo_codeset+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 7757 "configure"
+#line 8417 "configure"
 #include "confdefs.h"
 #include <langinfo.h>
 int
@@ -7766,16 +8426,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:7769: \"$ac_link\"") >&5
+if { (eval echo "$as_me:8429: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:7772: \$? = $ac_status" >&5
+  echo "$as_me:8432: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:7775: \"$ac_try\"") >&5
+  { (eval echo "$as_me:8435: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:7778: \$? = $ac_status" >&5
+  echo "$as_me:8438: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   am_cv_langinfo_codeset=yes
 else
@@ -7786,7 +8446,7 @@
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 
 fi
-echo "$as_me:7789: result: $am_cv_langinfo_codeset" >&5
+echo "$as_me:8449: result: $am_cv_langinfo_codeset" >&5
 echo "${ECHO_T}$am_cv_langinfo_codeset" >&6
   if test $am_cv_langinfo_codeset = yes; then
 
@@ -7800,7 +8460,7 @@
 NCURSES_OK_WCHAR_T=
 NCURSES_OK_WINT_T=
 
-echo "$as_me:7803: checking if you want wide-character code" >&5
+echo "$as_me:8463: checking if you want wide-character code" >&5
 echo $ECHO_N "checking if you want wide-character code... $ECHO_C" >&6
 
 # Check whether --enable-widec or --disable-widec was given.
@@ -7810,23 +8470,72 @@
 else
   with_widec=no
 fi;
-echo "$as_me:7813: result: $with_widec" >&5
+echo "$as_me:8473: result: $with_widec" >&5
 echo "${ECHO_T}$with_widec" >&6
-if test "$with_widec" = yes ; then
+if test "x$with_widec" = xyes ; then
 	LIB_SUFFIX="w${LIB_SUFFIX}"
-	cat >>confdefs.h <<\EOF
+
+cat >>confdefs.h <<\EOF
 #define USE_WIDEC_SUPPORT 1
 EOF
 
-	case "$CFLAGS $CPPFLAGS" in #(vi
-	*-D_XOPEN_SOURCE=500) #(vi
-		;;
-	*)
+cat >>confdefs.h <<\EOF
+#define NCURSES_WIDECHAR 1
+EOF
+
+echo "$as_me:8486: checking if wchar.h can be used as is" >&5
+echo $ECHO_N "checking if wchar.h can be used as is... $ECHO_C" >&6
+if test "${cf_cv_wchar_h_okay+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+cat >conftest.$ac_ext <<_ACEOF
+#line 8493 "configure"
+#include "confdefs.h"
+
+#include <stdlib.h>
+#include <wchar.h>
+
+int
+main ()
+{
+
+	wint_t foo = 0;
+	int bar = iswpunct(foo)
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:8510: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:8513: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:8516: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:8519: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  cf_cv_wchar_h_okay=yes
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+cf_cv_wchar_h_okay=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:8529: result: $cf_cv_wchar_h_okay" >&5
+echo "${ECHO_T}$cf_cv_wchar_h_okay" >&6
 
-echo "$as_me:7826: checking if we must define _XOPEN_SOURCE_EXTENDED" >&5
+if test $cf_cv_wchar_h_okay = no
+then
+
+echo "$as_me:8535: checking if we must define _XOPEN_SOURCE_EXTENDED" >&5
 echo $ECHO_N "checking if we must define _XOPEN_SOURCE_EXTENDED... $ECHO_C" >&6
 cat >conftest.$ac_ext <<_ACEOF
-#line 7829 "configure"
+#line 8538 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 
@@ -7842,16 +8551,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:7845: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:8554: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:7848: \$? = $ac_status" >&5
+  echo "$as_me:8557: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:7851: \"$ac_try\"") >&5
+  { (eval echo "$as_me:8560: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:7854: \$? = $ac_status" >&5
+  echo "$as_me:8563: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   cf_result=no
 else
@@ -7860,16 +8569,16 @@
 cf_result=yes
 fi
 rm -f conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:7863: result: $cf_result" >&5
+echo "$as_me:8572: result: $cf_result" >&5
 echo "${ECHO_T}$cf_result" >&6
 
 if test "$cf_result" = yes ; then
 	CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE_EXTENDED"
 elif test "x" != "x" ; then
-	echo "$as_me:7869: checking checking for compatible value versus " >&5
+	echo "$as_me:8578: checking checking for compatible value versus " >&5
 echo $ECHO_N "checking checking for compatible value versus ... $ECHO_C" >&6
 	cat >conftest.$ac_ext <<_ACEOF
-#line 7872 "configure"
+#line 8581 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 
@@ -7885,16 +8594,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:7888: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:8597: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:7891: \$? = $ac_status" >&5
+  echo "$as_me:8600: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:7894: \"$ac_try\"") >&5
+  { (eval echo "$as_me:8603: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:7897: \$? = $ac_status" >&5
+  echo "$as_me:8606: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   cf_result=yes
 else
@@ -7903,7 +8612,7 @@
 cf_result=no
 fi
 rm -f conftest.$ac_objext conftest.$ac_ext
-	echo "$as_me:7906: result: $cf_result" >&5
+	echo "$as_me:8615: result: $cf_result" >&5
 echo "${ECHO_T}$cf_result" >&6
 	if test "$cf_result" = no ; then
 		# perhaps we can override it - try...
@@ -7911,8 +8620,7 @@
 	fi
 fi
 
-		;;
-	esac
+fi
 
 	# with_overwrite=no
 	NCURSES_CH_T=cchar_t
@@ -7920,13 +8628,13 @@
 for ac_func in putwc btowc wctob mbtowc wctomb mblen mbrlen mbrtowc wcsrtombs mbsrtowcs wcstombs mbstowcs
 do
 as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
-echo "$as_me:7923: checking for $ac_func" >&5
+echo "$as_me:8631: checking for $ac_func" >&5
 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
 if eval "test \"\${$as_ac_var+set}\" = set"; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 7929 "configure"
+#line 8637 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func (); below.  */
@@ -7949,7 +8657,7 @@
 #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
 choke me
 #else
-f = $ac_func;
+f = $ac_func; /* workaround for ICC 12.0.3 */ if (f == 0) return 1;
 #endif
 
   ;
@@ -7957,16 +8665,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:7960: \"$ac_link\"") >&5
+if { (eval echo "$as_me:8668: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:7963: \$? = $ac_status" >&5
+  echo "$as_me:8671: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:7966: \"$ac_try\"") >&5
+  { (eval echo "$as_me:8674: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:7969: \$? = $ac_status" >&5
+  echo "$as_me:8677: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   eval "$as_ac_var=yes"
 else
@@ -7976,7 +8684,7 @@
 fi
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 fi
-echo "$as_me:7979: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "$as_me:8687: result: `eval echo '${'$as_ac_var'}'`" >&5
 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
 if test `eval echo '${'$as_ac_var'}'` = yes; then
   cat >>confdefs.h <<EOF
@@ -7986,9 +8694,9 @@
 fi
 done
 
-	if test "$ac_cv_func_putwc" != yes ; then
+	if test "x$ac_cv_func_putwc" != xyes ; then
 
-echo "$as_me:7991: checking for multibyte character support" >&5
+echo "$as_me:8699: checking for multibyte character support" >&5
 echo $ECHO_N "checking for multibyte character support... $ECHO_C" >&6
 if test "${cf_cv_utf8_lib+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -7996,7 +8704,7 @@
 
 	cf_save_LIBS="$LIBS"
 	cat >conftest.$ac_ext <<_ACEOF
-#line 7999 "configure"
+#line 8707 "configure"
 #include "confdefs.h"
 
 #include <stdlib.h>
@@ -8009,16 +8717,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:8012: \"$ac_link\"") >&5
+if { (eval echo "$as_me:8720: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:8015: \$? = $ac_status" >&5
+  echo "$as_me:8723: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:8018: \"$ac_try\"") >&5
+  { (eval echo "$as_me:8726: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:8021: \$? = $ac_status" >&5
+  echo "$as_me:8729: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   cf_cv_utf8_lib=yes
 else
@@ -8030,12 +8738,12 @@
 cf_cv_header_path_utf8=
 cf_cv_library_path_utf8=
 
-echo "${as_me:-configure}:8033: testing Starting FIND_LINKAGE(utf8,) ..." 1>&5
+echo "${as_me:-configure}:8741: testing Starting FIND_LINKAGE(utf8,) ..." 1>&5
 
 cf_save_LIBS="$LIBS"
 
 cat >conftest.$ac_ext <<_ACEOF
-#line 8038 "configure"
+#line 8746 "configure"
 #include "confdefs.h"
 
 #include <libutf8.h>
@@ -8048,16 +8756,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:8051: \"$ac_link\"") >&5
+if { (eval echo "$as_me:8759: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:8054: \$? = $ac_status" >&5
+  echo "$as_me:8762: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:8057: \"$ac_try\"") >&5
+  { (eval echo "$as_me:8765: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:8060: \$? = $ac_status" >&5
+  echo "$as_me:8768: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
 
 	cf_cv_find_linkage_utf8=yes
@@ -8071,7 +8779,7 @@
 LIBS="-lutf8  $cf_save_LIBS"
 
 cat >conftest.$ac_ext <<_ACEOF
-#line 8074 "configure"
+#line 8782 "configure"
 #include "confdefs.h"
 
 #include <libutf8.h>
@@ -8084,16 +8792,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:8087: \"$ac_link\"") >&5
+if { (eval echo "$as_me:8795: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:8090: \$? = $ac_status" >&5
+  echo "$as_me:8798: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:8093: \"$ac_try\"") >&5
+  { (eval echo "$as_me:8801: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:8096: \$? = $ac_status" >&5
+  echo "$as_me:8804: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
 
 	cf_cv_find_linkage_utf8=yes
@@ -8110,9 +8818,9 @@
 
     test -n "$verbose" && echo "	find linkage for utf8 library" 1>&6
 
-echo "${as_me:-configure}:8113: testing find linkage for utf8 library ..." 1>&5
+echo "${as_me:-configure}:8821: testing find linkage for utf8 library ..." 1>&5
 
-echo "${as_me:-configure}:8115: testing Searching for headers in FIND_LINKAGE(utf8,) ..." 1>&5
+echo "${as_me:-configure}:8823: testing Searching for headers in FIND_LINKAGE(utf8,) ..." 1>&5
 
     cf_save_CPPFLAGS="$CPPFLAGS"
     cf_test_CPPFLAGS="$CPPFLAGS"
@@ -8225,11 +8933,11 @@
       if test -d $cf_cv_header_path_utf8 ; then
         test -n "$verbose" && echo "	... testing $cf_cv_header_path_utf8" 1>&6
 
-echo "${as_me:-configure}:8228: testing ... testing $cf_cv_header_path_utf8 ..." 1>&5
+echo "${as_me:-configure}:8936: testing ... testing $cf_cv_header_path_utf8 ..." 1>&5
 
         CPPFLAGS="$cf_save_CPPFLAGS -I$cf_cv_header_path_utf8"
         cat >conftest.$ac_ext <<_ACEOF
-#line 8232 "configure"
+#line 8940 "configure"
 #include "confdefs.h"
 
 #include <libutf8.h>
@@ -8242,21 +8950,21 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:8245: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:8953: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:8248: \$? = $ac_status" >&5
+  echo "$as_me:8956: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:8251: \"$ac_try\"") >&5
+  { (eval echo "$as_me:8959: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:8254: \$? = $ac_status" >&5
+  echo "$as_me:8962: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
 
             test -n "$verbose" && echo "	... found utf8 headers in $cf_cv_header_path_utf8" 1>&6
 
-echo "${as_me:-configure}:8259: testing ... found utf8 headers in $cf_cv_header_path_utf8 ..." 1>&5
+echo "${as_me:-configure}:8967: testing ... found utf8 headers in $cf_cv_header_path_utf8 ..." 1>&5
 
             cf_cv_find_linkage_utf8=maybe
             cf_test_CPPFLAGS="$CPPFLAGS"
@@ -8274,7 +8982,7 @@
 
     if test "$cf_cv_find_linkage_utf8" = maybe ; then
 
-echo "${as_me:-configure}:8277: testing Searching for utf8 library in FIND_LINKAGE(utf8,) ..." 1>&5
+echo "${as_me:-configure}:8985: testing Searching for utf8 library in FIND_LINKAGE(utf8,) ..." 1>&5
 
       cf_save_LIBS="$LIBS"
       cf_save_LDFLAGS="$LDFLAGS"
@@ -8371,13 +9079,13 @@
           if test -d $cf_cv_library_path_utf8 ; then
             test -n "$verbose" && echo "	... testing $cf_cv_library_path_utf8" 1>&6
 
-echo "${as_me:-configure}:8374: testing ... testing $cf_cv_library_path_utf8 ..." 1>&5
+echo "${as_me:-configure}:9082: testing ... testing $cf_cv_library_path_utf8 ..." 1>&5
 
             CPPFLAGS="$cf_test_CPPFLAGS"
             LIBS="-lutf8  $cf_save_LIBS"
             LDFLAGS="$cf_save_LDFLAGS -L$cf_cv_library_path_utf8"
             cat >conftest.$ac_ext <<_ACEOF
-#line 8380 "configure"
+#line 9088 "configure"
 #include "confdefs.h"
 
 #include <libutf8.h>
@@ -8390,21 +9098,21 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:8393: \"$ac_link\"") >&5
+if { (eval echo "$as_me:9101: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:8396: \$? = $ac_status" >&5
+  echo "$as_me:9104: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:8399: \"$ac_try\"") >&5
+  { (eval echo "$as_me:9107: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:8402: \$? = $ac_status" >&5
+  echo "$as_me:9110: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
 
                 test -n "$verbose" && echo "	... found utf8 library in $cf_cv_library_path_utf8" 1>&6
 
-echo "${as_me:-configure}:8407: testing ... found utf8 library in $cf_cv_library_path_utf8 ..." 1>&5
+echo "${as_me:-configure}:9115: testing ... found utf8 library in $cf_cv_library_path_utf8 ..." 1>&5
 
                 cf_cv_find_linkage_utf8=yes
                 cf_cv_library_file_utf8="-lutf8"
@@ -8446,13 +9154,14 @@
 fi
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 fi
-echo "$as_me:8449: result: $cf_cv_utf8_lib" >&5
+echo "$as_me:9157: result: $cf_cv_utf8_lib" >&5
 echo "${ECHO_T}$cf_cv_utf8_lib" >&6
 
 # HAVE_LIBUTF8_H is used by ncurses if curses.h is shared between
 # ncurses/ncursesw:
 if test "$cf_cv_utf8_lib" = "add-on" ; then
-	cat >>confdefs.h <<\EOF
+
+cat >>confdefs.h <<\EOF
 #define HAVE_LIBUTF8_H 1
 EOF
 
@@ -8480,7 +9189,7 @@
 			  cf_save_CPPFLAGS=$CPPFLAGS
 			  CPPFLAGS="$CPPFLAGS -I$cf_add_incdir"
 			  cat >conftest.$ac_ext <<_ACEOF
-#line 8483 "configure"
+#line 9192 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 int
@@ -8492,16 +9201,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:8495: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:9204: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:8498: \$? = $ac_status" >&5
+  echo "$as_me:9207: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:8501: \"$ac_try\"") >&5
+  { (eval echo "$as_me:9210: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:8504: \$? = $ac_status" >&5
+  echo "$as_me:9213: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   :
 else
@@ -8518,7 +9227,7 @@
 		if test "$cf_have_incdir" = no ; then
 		  test -n "$verbose" && echo "	adding $cf_add_incdir to include-path" 1>&6
 
-echo "${as_me:-configure}:8521: testing adding $cf_add_incdir to include-path ..." 1>&5
+echo "${as_me:-configure}:9230: testing adding $cf_add_incdir to include-path ..." 1>&5
 
 		  CPPFLAGS="$CPPFLAGS -I$cf_add_incdir"
 
@@ -8552,7 +9261,7 @@
       if test "$cf_have_libdir" = no ; then
         test -n "$verbose" && echo "	adding $cf_add_libdir to library-path" 1>&6
 
-echo "${as_me:-configure}:8555: testing adding $cf_add_libdir to library-path ..." 1>&5
+echo "${as_me:-configure}:9264: testing adding $cf_add_libdir to library-path ..." 1>&5
 
         LDFLAGS="-L$cf_add_libdir $LDFLAGS"
       fi
@@ -8569,14 +9278,14 @@
 	fi
 
 # This is needed on Tru64 5.0 to declare mbstate_t
-echo "$as_me:8572: checking if we must include wchar.h to declare mbstate_t" >&5
+echo "$as_me:9281: checking if we must include wchar.h to declare mbstate_t" >&5
 echo $ECHO_N "checking if we must include wchar.h to declare mbstate_t... $ECHO_C" >&6
 if test "${cf_cv_mbstate_t+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
 
 cat >conftest.$ac_ext <<_ACEOF
-#line 8579 "configure"
+#line 9288 "configure"
 #include "confdefs.h"
 
 #include <stdlib.h>
@@ -8594,23 +9303,23 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:8597: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:9306: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:8600: \$? = $ac_status" >&5
+  echo "$as_me:9309: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:8603: \"$ac_try\"") >&5
+  { (eval echo "$as_me:9312: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:8606: \$? = $ac_status" >&5
+  echo "$as_me:9315: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   cf_cv_mbstate_t=no
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
 cat >conftest.$ac_ext <<_ACEOF
-#line 8613 "configure"
+#line 9322 "configure"
 #include "confdefs.h"
 
 #include <stdlib.h>
@@ -8629,16 +9338,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:8632: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:9341: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:8635: \$? = $ac_status" >&5
+  echo "$as_me:9344: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:8638: \"$ac_try\"") >&5
+  { (eval echo "$as_me:9347: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:8641: \$? = $ac_status" >&5
+  echo "$as_me:9350: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   cf_cv_mbstate_t=yes
 else
@@ -8650,11 +9359,12 @@
 fi
 rm -f conftest.$ac_objext conftest.$ac_ext
 fi
-echo "$as_me:8653: result: $cf_cv_mbstate_t" >&5
+echo "$as_me:9362: result: $cf_cv_mbstate_t" >&5
 echo "${ECHO_T}$cf_cv_mbstate_t" >&6
 
 if test "$cf_cv_mbstate_t" = yes ; then
-	cat >>confdefs.h <<\EOF
+
+cat >>confdefs.h <<\EOF
 #define NEED_WCHAR_H 1
 EOF
 
@@ -8667,14 +9377,14 @@
 fi
 
 # This is needed on Tru64 5.0 to declare wchar_t
-echo "$as_me:8670: checking if we must include wchar.h to declare wchar_t" >&5
+echo "$as_me:9380: checking if we must include wchar.h to declare wchar_t" >&5
 echo $ECHO_N "checking if we must include wchar.h to declare wchar_t... $ECHO_C" >&6
 if test "${cf_cv_wchar_t+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
 
 cat >conftest.$ac_ext <<_ACEOF
-#line 8677 "configure"
+#line 9387 "configure"
 #include "confdefs.h"
 
 #include <stdlib.h>
@@ -8692,23 +9402,23 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:8695: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:9405: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:8698: \$? = $ac_status" >&5
+  echo "$as_me:9408: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:8701: \"$ac_try\"") >&5
+  { (eval echo "$as_me:9411: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:8704: \$? = $ac_status" >&5
+  echo "$as_me:9414: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   cf_cv_wchar_t=no
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
 cat >conftest.$ac_ext <<_ACEOF
-#line 8711 "configure"
+#line 9421 "configure"
 #include "confdefs.h"
 
 #include <stdlib.h>
@@ -8727,16 +9437,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:8730: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:9440: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:8733: \$? = $ac_status" >&5
+  echo "$as_me:9443: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:8736: \"$ac_try\"") >&5
+  { (eval echo "$as_me:9446: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:8739: \$? = $ac_status" >&5
+  echo "$as_me:9449: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   cf_cv_wchar_t=yes
 else
@@ -8748,11 +9458,12 @@
 fi
 rm -f conftest.$ac_objext conftest.$ac_ext
 fi
-echo "$as_me:8751: result: $cf_cv_wchar_t" >&5
+echo "$as_me:9461: result: $cf_cv_wchar_t" >&5
 echo "${ECHO_T}$cf_cv_wchar_t" >&6
 
 if test "$cf_cv_wchar_t" = yes ; then
-	cat >>confdefs.h <<\EOF
+
+cat >>confdefs.h <<\EOF
 #define NEED_WCHAR_H 1
 EOF
 
@@ -8770,14 +9481,14 @@
 fi
 
 # This is needed on Tru64 5.0 to declare wint_t
-echo "$as_me:8773: checking if we must include wchar.h to declare wint_t" >&5
+echo "$as_me:9484: checking if we must include wchar.h to declare wint_t" >&5
 echo $ECHO_N "checking if we must include wchar.h to declare wint_t... $ECHO_C" >&6
 if test "${cf_cv_wint_t+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
 
 cat >conftest.$ac_ext <<_ACEOF
-#line 8780 "configure"
+#line 9491 "configure"
 #include "confdefs.h"
 
 #include <stdlib.h>
@@ -8795,23 +9506,23 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:8798: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:9509: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:8801: \$? = $ac_status" >&5
+  echo "$as_me:9512: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:8804: \"$ac_try\"") >&5
+  { (eval echo "$as_me:9515: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:8807: \$? = $ac_status" >&5
+  echo "$as_me:9518: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   cf_cv_wint_t=no
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
 cat >conftest.$ac_ext <<_ACEOF
-#line 8814 "configure"
+#line 9525 "configure"
 #include "confdefs.h"
 
 #include <stdlib.h>
@@ -8830,16 +9541,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:8833: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:9544: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:8836: \$? = $ac_status" >&5
+  echo "$as_me:9547: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:8839: \"$ac_try\"") >&5
+  { (eval echo "$as_me:9550: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:8842: \$? = $ac_status" >&5
+  echo "$as_me:9553: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   cf_cv_wint_t=yes
 else
@@ -8851,11 +9562,12 @@
 fi
 rm -f conftest.$ac_objext conftest.$ac_ext
 fi
-echo "$as_me:8854: result: $cf_cv_wint_t" >&5
+echo "$as_me:9565: result: $cf_cv_wint_t" >&5
 echo "${ECHO_T}$cf_cv_wint_t" >&6
 
 if test "$cf_cv_wint_t" = yes ; then
-	cat >>confdefs.h <<\EOF
+
+cat >>confdefs.h <<\EOF
 #define NEED_WCHAR_H 1
 EOF
 
@@ -8873,7 +9585,8 @@
 fi
 
 	if test "$NCURSES_MBSTATE_T" != 0; then
-		cat >>confdefs.h <<\EOF
+
+cat >>confdefs.h <<\EOF
 #define NEED_MBSTATE_T_DEF 1
 EOF
 
@@ -8890,7 +9603,7 @@
 	;;
 esac
 
-echo "$as_me:8893: checking whether to enable _LP64 definition in curses.h" >&5
+echo "$as_me:9606: checking whether to enable _LP64 definition in curses.h" >&5
 echo $ECHO_N "checking whether to enable _LP64 definition in curses.h... $ECHO_C" >&6
 
 # Check whether --enable-lp64 or --disable-lp64 was given.
@@ -8900,10 +9613,10 @@
 else
   with_lp64=$default_with_lp64
 fi;
-echo "$as_me:8903: result: $with_lp64" >&5
+echo "$as_me:9616: result: $with_lp64" >&5
 echo "${ECHO_T}$with_lp64" >&6
 
-if test "$with_lp64" = yes ; then
+if test "x$with_lp64" = xyes ; then
 	cf_cv_enable_lp64=1
 else
 	cf_cv_enable_lp64=0
@@ -8916,7 +9629,7 @@
 fi;
 if test "$enable_largefile" != no; then
 
-  echo "$as_me:8919: checking for special C compiler options needed for large files" >&5
+  echo "$as_me:9632: checking for special C compiler options needed for large files" >&5
 echo $ECHO_N "checking for special C compiler options needed for large files... $ECHO_C" >&6
 if test "${ac_cv_sys_largefile_CC+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -8928,7 +9641,7 @@
      	 # IRIX 6.2 and later do not support large files by default,
      	 # so use the C compiler's -n32 option if that helps.
          cat >conftest.$ac_ext <<_ACEOF
-#line 8931 "configure"
+#line 9644 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
  /* Check that off_t can represent 2**63 - 1 correctly.
@@ -8948,16 +9661,16 @@
 }
 _ACEOF
      	 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:8951: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:9664: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:8954: \$? = $ac_status" >&5
+  echo "$as_me:9667: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:8957: \"$ac_try\"") >&5
+  { (eval echo "$as_me:9670: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:8960: \$? = $ac_status" >&5
+  echo "$as_me:9673: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   break
 else
@@ -8967,16 +9680,16 @@
 rm -f conftest.$ac_objext
      	 CC="$CC -n32"
      	 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:8970: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:9683: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:8973: \$? = $ac_status" >&5
+  echo "$as_me:9686: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:8976: \"$ac_try\"") >&5
+  { (eval echo "$as_me:9689: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:8979: \$? = $ac_status" >&5
+  echo "$as_me:9692: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_sys_largefile_CC=' -n32'; break
 else
@@ -8990,13 +9703,13 @@
        rm -f conftest.$ac_ext
     fi
 fi
-echo "$as_me:8993: result: $ac_cv_sys_largefile_CC" >&5
+echo "$as_me:9706: result: $ac_cv_sys_largefile_CC" >&5
 echo "${ECHO_T}$ac_cv_sys_largefile_CC" >&6
   if test "$ac_cv_sys_largefile_CC" != no; then
     CC=$CC$ac_cv_sys_largefile_CC
   fi
 
-  echo "$as_me:8999: checking for _FILE_OFFSET_BITS value needed for large files" >&5
+  echo "$as_me:9712: checking for _FILE_OFFSET_BITS value needed for large files" >&5
 echo $ECHO_N "checking for _FILE_OFFSET_BITS value needed for large files... $ECHO_C" >&6
 if test "${ac_cv_sys_file_offset_bits+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -9004,7 +9717,7 @@
   while :; do
   ac_cv_sys_file_offset_bits=no
   cat >conftest.$ac_ext <<_ACEOF
-#line 9007 "configure"
+#line 9720 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
  /* Check that off_t can represent 2**63 - 1 correctly.
@@ -9024,16 +9737,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:9027: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:9740: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:9030: \$? = $ac_status" >&5
+  echo "$as_me:9743: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:9033: \"$ac_try\"") >&5
+  { (eval echo "$as_me:9746: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:9036: \$? = $ac_status" >&5
+  echo "$as_me:9749: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   break
 else
@@ -9042,7 +9755,7 @@
 fi
 rm -f conftest.$ac_objext conftest.$ac_ext
   cat >conftest.$ac_ext <<_ACEOF
-#line 9045 "configure"
+#line 9758 "configure"
 #include "confdefs.h"
 #define _FILE_OFFSET_BITS 64
 #include <sys/types.h>
@@ -9063,16 +9776,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:9066: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:9779: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:9069: \$? = $ac_status" >&5
+  echo "$as_me:9782: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:9072: \"$ac_try\"") >&5
+  { (eval echo "$as_me:9785: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:9075: \$? = $ac_status" >&5
+  echo "$as_me:9788: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_sys_file_offset_bits=64; break
 else
@@ -9083,7 +9796,7 @@
   break
 done
 fi
-echo "$as_me:9086: result: $ac_cv_sys_file_offset_bits" >&5
+echo "$as_me:9799: result: $ac_cv_sys_file_offset_bits" >&5
 echo "${ECHO_T}$ac_cv_sys_file_offset_bits" >&6
 if test "$ac_cv_sys_file_offset_bits" != no; then
 
@@ -9093,7 +9806,7 @@
 
 fi
 rm -rf conftest*
-  echo "$as_me:9096: checking for _LARGE_FILES value needed for large files" >&5
+  echo "$as_me:9809: checking for _LARGE_FILES value needed for large files" >&5
 echo $ECHO_N "checking for _LARGE_FILES value needed for large files... $ECHO_C" >&6
 if test "${ac_cv_sys_large_files+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -9101,7 +9814,7 @@
   while :; do
   ac_cv_sys_large_files=no
   cat >conftest.$ac_ext <<_ACEOF
-#line 9104 "configure"
+#line 9817 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
  /* Check that off_t can represent 2**63 - 1 correctly.
@@ -9121,16 +9834,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:9124: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:9837: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:9127: \$? = $ac_status" >&5
+  echo "$as_me:9840: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:9130: \"$ac_try\"") >&5
+  { (eval echo "$as_me:9843: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:9133: \$? = $ac_status" >&5
+  echo "$as_me:9846: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   break
 else
@@ -9139,7 +9852,7 @@
 fi
 rm -f conftest.$ac_objext conftest.$ac_ext
   cat >conftest.$ac_ext <<_ACEOF
-#line 9142 "configure"
+#line 9855 "configure"
 #include "confdefs.h"
 #define _LARGE_FILES 1
 #include <sys/types.h>
@@ -9160,16 +9873,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:9163: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:9876: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:9166: \$? = $ac_status" >&5
+  echo "$as_me:9879: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:9169: \"$ac_try\"") >&5
+  { (eval echo "$as_me:9882: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:9172: \$? = $ac_status" >&5
+  echo "$as_me:9885: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_sys_large_files=1; break
 else
@@ -9180,7 +9893,7 @@
   break
 done
 fi
-echo "$as_me:9183: result: $ac_cv_sys_large_files" >&5
+echo "$as_me:9896: result: $ac_cv_sys_large_files" >&5
 echo "${ECHO_T}$ac_cv_sys_large_files" >&6
 if test "$ac_cv_sys_large_files" != no; then
 
@@ -9193,7 +9906,7 @@
 fi
 
     if test "$enable_largefile" != no ; then
-	echo "$as_me:9196: checking for _LARGEFILE_SOURCE value needed for large files" >&5
+	echo "$as_me:9909: checking for _LARGEFILE_SOURCE value needed for large files" >&5
 echo $ECHO_N "checking for _LARGEFILE_SOURCE value needed for large files... $ECHO_C" >&6
 if test "${ac_cv_sys_largefile_source+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -9201,7 +9914,7 @@
   while :; do
   ac_cv_sys_largefile_source=no
   cat >conftest.$ac_ext <<_ACEOF
-#line 9204 "configure"
+#line 9917 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 int
@@ -9213,16 +9926,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:9216: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:9929: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:9219: \$? = $ac_status" >&5
+  echo "$as_me:9932: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:9222: \"$ac_try\"") >&5
+  { (eval echo "$as_me:9935: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:9225: \$? = $ac_status" >&5
+  echo "$as_me:9938: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   break
 else
@@ -9231,7 +9944,7 @@
 fi
 rm -f conftest.$ac_objext conftest.$ac_ext
   cat >conftest.$ac_ext <<_ACEOF
-#line 9234 "configure"
+#line 9947 "configure"
 #include "confdefs.h"
 #define _LARGEFILE_SOURCE 1
 #include <stdio.h>
@@ -9244,16 +9957,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:9247: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:9960: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:9250: \$? = $ac_status" >&5
+  echo "$as_me:9963: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:9253: \"$ac_try\"") >&5
+  { (eval echo "$as_me:9966: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:9256: \$? = $ac_status" >&5
+  echo "$as_me:9969: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_sys_largefile_source=1; break
 else
@@ -9264,7 +9977,7 @@
   break
 done
 fi
-echo "$as_me:9267: result: $ac_cv_sys_largefile_source" >&5
+echo "$as_me:9980: result: $ac_cv_sys_largefile_source" >&5
 echo "${ECHO_T}$ac_cv_sys_largefile_source" >&6
 if test "$ac_cv_sys_largefile_source" != no; then
 
@@ -9278,13 +9991,13 @@
 # We used to try defining _XOPEN_SOURCE=500 too, to work around a bug
 # in glibc 2.1.3, but that breaks too many other things.
 # If you want fseeko and ftello with glibc, upgrade to a fixed glibc.
-echo "$as_me:9281: checking for fseeko" >&5
+echo "$as_me:9994: checking for fseeko" >&5
 echo $ECHO_N "checking for fseeko... $ECHO_C" >&6
 if test "${ac_cv_func_fseeko+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 9287 "configure"
+#line 10000 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 int
@@ -9296,16 +10009,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:9299: \"$ac_link\"") >&5
+if { (eval echo "$as_me:10012: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:9302: \$? = $ac_status" >&5
+  echo "$as_me:10015: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:9305: \"$ac_try\"") >&5
+  { (eval echo "$as_me:10018: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:9308: \$? = $ac_status" >&5
+  echo "$as_me:10021: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_func_fseeko=yes
 else
@@ -9315,7 +10028,7 @@
 fi
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 fi
-echo "$as_me:9318: result: $ac_cv_func_fseeko" >&5
+echo "$as_me:10031: result: $ac_cv_func_fseeko" >&5
 echo "${ECHO_T}$ac_cv_func_fseeko" >&6
 if test $ac_cv_func_fseeko = yes; then
 
@@ -9336,14 +10049,14 @@
 	test "$ac_cv_sys_largefile_source" != no && CPPFLAGS="$CPPFLAGS -D_LARGEFILE_SOURCE "
 	test "$ac_cv_sys_file_offset_bits" != no && CPPFLAGS="$CPPFLAGS -D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits "
 
-	echo "$as_me:9339: checking whether to use struct dirent64" >&5
+	echo "$as_me:10052: checking whether to use struct dirent64" >&5
 echo $ECHO_N "checking whether to use struct dirent64... $ECHO_C" >&6
 if test "${cf_cv_struct_dirent64+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
 
 		cat >conftest.$ac_ext <<_ACEOF
-#line 9346 "configure"
+#line 10059 "configure"
 #include "confdefs.h"
 
 #include <sys/types.h>
@@ -9364,16 +10077,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:9367: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:10080: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:9370: \$? = $ac_status" >&5
+  echo "$as_me:10083: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:9373: \"$ac_try\"") >&5
+  { (eval echo "$as_me:10086: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:9376: \$? = $ac_status" >&5
+  echo "$as_me:10089: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   cf_cv_struct_dirent64=yes
 else
@@ -9384,16 +10097,17 @@
 rm -f conftest.$ac_objext conftest.$ac_ext
 
 fi
-echo "$as_me:9387: result: $cf_cv_struct_dirent64" >&5
+echo "$as_me:10100: result: $cf_cv_struct_dirent64" >&5
 echo "${ECHO_T}$cf_cv_struct_dirent64" >&6
-	test "$cf_cv_struct_dirent64" = yes && cat >>confdefs.h <<\EOF
+	test "$cf_cv_struct_dirent64" = yes &&
+cat >>confdefs.h <<\EOF
 #define HAVE_STRUCT_DIRENT64 1
 EOF
 
     fi
 
 ###   use option --disable-tparm-varargs to make tparm() conform to X/Open
-echo "$as_me:9396: checking if you want tparm not to use X/Open fixed-parameter list" >&5
+echo "$as_me:10110: checking if you want tparm not to use X/Open fixed-parameter list" >&5
 echo $ECHO_N "checking if you want tparm not to use X/Open fixed-parameter list... $ECHO_C" >&6
 
 # Check whether --enable-tparm-varargs or --disable-tparm-varargs was given.
@@ -9403,14 +10117,14 @@
 else
   with_tparm_varargs=yes
 fi;
-echo "$as_me:9406: result: $with_tparm_varargs" >&5
+echo "$as_me:10120: result: $with_tparm_varargs" >&5
 echo "${ECHO_T}$with_tparm_varargs" >&6
 NCURSES_TPARM_VARARGS=0
-test "$with_tparm_varargs" = yes && NCURSES_TPARM_VARARGS=1
+test "x$with_tparm_varargs" = xyes && NCURSES_TPARM_VARARGS=1
 
 ###   use option --disable-tic-depends to make libtic not explicitly depend on ncurses/ncursesw
 if test "$with_ticlib" != no ; then
-echo "$as_me:9413: checking if you want tic library to use explicit dependency on ncurses$LIB_SUFFIX library" >&5
+echo "$as_me:10127: checking if you want tic library to use explicit dependency on ncurses$LIB_SUFFIX library" >&5
 echo $ECHO_N "checking if you want tic library to use explicit dependency on ncurses$LIB_SUFFIX library... $ECHO_C" >&6
 
 # Check whether --enable-tic-depends or --disable-tic-depends was given.
@@ -9420,14 +10134,14 @@
 else
   with_tic_depends=yes
 fi;
-echo "$as_me:9423: result: $with_tic_depends" >&5
+echo "$as_me:10137: result: $with_tic_depends" >&5
 echo "${ECHO_T}$with_tic_depends" >&6
 else
 	with_tic_depends=no
 fi
 
 ###   use option --with-bool to override bool's type
-echo "$as_me:9430: checking for type of bool" >&5
+echo "$as_me:10144: checking for type of bool" >&5
 echo $ECHO_N "checking for type of bool... $ECHO_C" >&6
 
 # Check whether --with-bool or --without-bool was given.
@@ -9437,10 +10151,10 @@
 else
   NCURSES_BOOL=auto
 fi;
-echo "$as_me:9440: result: $NCURSES_BOOL" >&5
+echo "$as_me:10154: result: $NCURSES_BOOL" >&5
 echo "${ECHO_T}$NCURSES_BOOL" >&6
 
-echo "$as_me:9443: checking for alternate terminal capabilities file" >&5
+echo "$as_me:10157: checking for alternate terminal capabilities file" >&5
 echo $ECHO_N "checking for alternate terminal capabilities file... $ECHO_C" >&6
 
 # Check whether --with-caps or --without-caps was given.
@@ -9451,11 +10165,11 @@
   TERMINFO_CAPS=Caps
 fi;
 test -f "${srcdir}/include/${TERMINFO_CAPS}" || TERMINFO_CAPS=Caps
-echo "$as_me:9454: result: $TERMINFO_CAPS" >&5
+echo "$as_me:10168: result: $TERMINFO_CAPS" >&5
 echo "${ECHO_T}$TERMINFO_CAPS" >&6
 
 ###   use option --with-chtype to override chtype's type
-echo "$as_me:9458: checking for type of chtype" >&5
+echo "$as_me:10172: checking for type of chtype" >&5
 echo $ECHO_N "checking for type of chtype... $ECHO_C" >&6
 
 # Check whether --with-chtype or --without-chtype was given.
@@ -9465,11 +10179,11 @@
 else
   NCURSES_CHTYPE=auto
 fi;
-echo "$as_me:9468: result: $NCURSES_CHTYPE" >&5
+echo "$as_me:10182: result: $NCURSES_CHTYPE" >&5
 echo "${ECHO_T}$NCURSES_CHTYPE" >&6
 
 ###   use option --with-ospeed to override ospeed's type
-echo "$as_me:9472: checking for type of ospeed" >&5
+echo "$as_me:10186: checking for type of ospeed" >&5
 echo $ECHO_N "checking for type of ospeed... $ECHO_C" >&6
 
 # Check whether --with-ospeed or --without-ospeed was given.
@@ -9479,11 +10193,11 @@
 else
   NCURSES_OSPEED=short
 fi;
-echo "$as_me:9482: result: $NCURSES_OSPEED" >&5
+echo "$as_me:10196: result: $NCURSES_OSPEED" >&5
 echo "${ECHO_T}$NCURSES_OSPEED" >&6
 
 ###   use option --with-mmask-t to override mmask_t's type
-echo "$as_me:9486: checking for type of mmask_t" >&5
+echo "$as_me:10200: checking for type of mmask_t" >&5
 echo $ECHO_N "checking for type of mmask_t... $ECHO_C" >&6
 
 # Check whether --with-mmask-t or --without-mmask-t was given.
@@ -9493,11 +10207,11 @@
 else
   NCURSES_MMASK_T=auto
 fi;
-echo "$as_me:9496: result: $NCURSES_MMASK_T" >&5
+echo "$as_me:10210: result: $NCURSES_MMASK_T" >&5
 echo "${ECHO_T}$NCURSES_MMASK_T" >&6
 
 ###   use option --with-ccharw-max to override CCHARW_MAX size
-echo "$as_me:9500: checking for size CCHARW_MAX" >&5
+echo "$as_me:10214: checking for size CCHARW_MAX" >&5
 echo $ECHO_N "checking for size CCHARW_MAX... $ECHO_C" >&6
 
 # Check whether --with-ccharw-max or --without-ccharw-max was given.
@@ -9507,11 +10221,25 @@
 else
   NCURSES_CCHARW_MAX=5
 fi;
-echo "$as_me:9510: result: $NCURSES_CCHARW_MAX" >&5
+echo "$as_me:10224: result: $NCURSES_CCHARW_MAX" >&5
 echo "${ECHO_T}$NCURSES_CCHARW_MAX" >&6
 
+###   use option --with-tparm-arg to override tparm's argument type
+echo "$as_me:10228: checking for type of tparm args" >&5
+echo $ECHO_N "checking for type of tparm args... $ECHO_C" >&6
+
+# Check whether --with-tparm-arg or --without-tparm-arg was given.
+if test "${with_tparm_arg+set}" = set; then
+  withval="$with_tparm_arg"
+  NCURSES_TPARM_ARG="$withval"
+else
+  NCURSES_TPARM_ARG=long
+fi;
+echo "$as_me:10238: result: $NCURSES_TPARM_ARG" >&5
+echo "${ECHO_T}$NCURSES_TPARM_ARG" >&6
+
 ### Enable compiling-in rcs id's
-echo "$as_me:9514: checking if RCS identifiers should be compiled-in" >&5
+echo "$as_me:10242: checking if RCS identifiers should be compiled-in" >&5
 echo $ECHO_N "checking if RCS identifiers should be compiled-in... $ECHO_C" >&6
 
 # Check whether --with-rcs-ids or --without-rcs-ids was given.
@@ -9521,15 +10249,16 @@
 else
   with_rcs_ids=no
 fi;
-echo "$as_me:9524: result: $with_rcs_ids" >&5
+echo "$as_me:10252: result: $with_rcs_ids" >&5
 echo "${ECHO_T}$with_rcs_ids" >&6
-test "$with_rcs_ids" = yes && cat >>confdefs.h <<\EOF
+test "x$with_rcs_ids" = xyes &&
+cat >>confdefs.h <<\EOF
 #define USE_RCS_IDS 1
 EOF
 
 ###############################################################################
 
-echo "$as_me:9532: checking format of man-pages" >&5
+echo "$as_me:10261: checking format of man-pages" >&5
 echo $ECHO_N "checking format of man-pages... $ECHO_C" >&6
 
 # Check whether --with-manpage-format or --without-manpage-format was given.
@@ -9618,14 +10347,14 @@
   ;;
 esac
 
-echo "$as_me:9621: result: $MANPAGE_FORMAT" >&5
+echo "$as_me:10350: result: $MANPAGE_FORMAT" >&5
 echo "${ECHO_T}$MANPAGE_FORMAT" >&6
 if test -n "$cf_unknown" ; then
-  { echo "$as_me:9624: WARNING: Unexpected manpage-format $cf_unknown" >&5
+  { echo "$as_me:10353: WARNING: Unexpected manpage-format $cf_unknown" >&5
 echo "$as_me: WARNING: Unexpected manpage-format $cf_unknown" >&2;}
 fi
 
-echo "$as_me:9628: checking for manpage renaming" >&5
+echo "$as_me:10357: checking for manpage renaming" >&5
 echo $ECHO_N "checking for manpage renaming... $ECHO_C" >&6
 
 # Check whether --with-manpage-renames or --without-manpage-renames was given.
@@ -9653,7 +10382,7 @@
   if test -f $srcdir/man/$MANPAGE_RENAMES ; then
     MANPAGE_RENAMES=`cd $srcdir/man && pwd`/$MANPAGE_RENAMES
   elif test ! -f $MANPAGE_RENAMES ; then
-    { { echo "$as_me:9656: error: not a filename: $MANPAGE_RENAMES" >&5
+    { { echo "$as_me:10385: error: not a filename: $MANPAGE_RENAMES" >&5
 echo "$as_me: error: not a filename: $MANPAGE_RENAMES" >&2;}
    { (exit 1); exit 1; }; }
   fi
@@ -9667,10 +10396,10 @@
   fi
 fi
 
-echo "$as_me:9670: result: $MANPAGE_RENAMES" >&5
+echo "$as_me:10399: result: $MANPAGE_RENAMES" >&5
 echo "${ECHO_T}$MANPAGE_RENAMES" >&6
 
-echo "$as_me:9673: checking if manpage aliases will be installed" >&5
+echo "$as_me:10402: checking if manpage aliases will be installed" >&5
 echo $ECHO_N "checking if manpage aliases will be installed... $ECHO_C" >&6
 
 # Check whether --with-manpage-aliases or --without-manpage-aliases was given.
@@ -9681,7 +10410,7 @@
   MANPAGE_ALIASES=yes
 fi;
 
-echo "$as_me:9684: result: $MANPAGE_ALIASES" >&5
+echo "$as_me:10413: result: $MANPAGE_ALIASES" >&5
 echo "${ECHO_T}$MANPAGE_ALIASES" >&6
 
 case "x$LN_S" in #(vi
@@ -9695,7 +10424,7 @@
 
 MANPAGE_SYMLINKS=no
 if test "$MANPAGE_ALIASES" = yes ; then
-echo "$as_me:9698: checking if manpage symlinks should be used" >&5
+echo "$as_me:10427: checking if manpage symlinks should be used" >&5
 echo $ECHO_N "checking if manpage symlinks should be used... $ECHO_C" >&6
 
 # Check whether --with-manpage-symlinks or --without-manpage-symlinks was given.
@@ -9708,17 +10437,17 @@
 
 if test "$$cf_use_symlinks" = no; then
 if test "$MANPAGE_SYMLINKS" = yes ; then
-	{ echo "$as_me:9711: WARNING: cannot make symlinks" >&5
+	{ echo "$as_me:10440: WARNING: cannot make symlinks" >&5
 echo "$as_me: WARNING: cannot make symlinks" >&2;}
 	MANPAGE_SYMLINKS=no
 fi
 fi
 
-echo "$as_me:9717: result: $MANPAGE_SYMLINKS" >&5
+echo "$as_me:10446: result: $MANPAGE_SYMLINKS" >&5
 echo "${ECHO_T}$MANPAGE_SYMLINKS" >&6
 fi
 
-echo "$as_me:9721: checking for manpage tbl" >&5
+echo "$as_me:10450: checking for manpage tbl" >&5
 echo $ECHO_N "checking for manpage tbl... $ECHO_C" >&6
 
 # Check whether --with-manpage-tbl or --without-manpage-tbl was given.
@@ -9729,7 +10458,7 @@
   MANPAGE_TBL=no
 fi;
 
-echo "$as_me:9732: result: $MANPAGE_TBL" >&5
+echo "$as_me:10461: result: $MANPAGE_TBL" >&5
 echo "${ECHO_T}$MANPAGE_TBL" >&6
 
   if test "$prefix" = "NONE" ; then
@@ -9776,6 +10505,7 @@
 # this script is generated by the configure-script CF_MAN_PAGES macro.
 
 prefix="$cf_prefix"
+datarootdir="$datarootdir"
 datadir="$datadir"
 
 NCURSES_MAJOR="$NCURSES_MAJOR"
@@ -9836,11 +10566,12 @@
 	if test ! -f $cf_man_alias ; then
 cat >>$cf_man_alias <<-CF_EOF2
 		s,@DATADIR@,\$datadir,g
-		s,@TERMINFO@,\$TERMINFO,g
-		s,@NCURSES_MAJOR@,\$NCURSES_MAJOR,g
-		s,@NCURSES_MINOR@,\$NCURSES_MINOR,g
-		s,@NCURSES_PATCH@,\$NCURSES_PATCH,g
-		s,@NCURSES_OSPEED@,\$NCURSES_OSPEED,g
+		s,@TERMINFO@,\${TERMINFO:="no default value"},g
+		s,@TERMINFO_DIRS@,\${TERMINFO_DIRS:="no default value"},g
+		s,@NCURSES_MAJOR@,\${NCURSES_MAJOR:="no default value"},g
+		s,@NCURSES_MINOR@,\${NCURSES_MINOR:="no default value"},g
+		s,@NCURSES_PATCH@,\${NCURSES_PATCH:="no default value"},g
+		s,@NCURSES_OSPEED@,\${NCURSES_OSPEED:="no default value"},g
 CF_EOF
 
 	for cf_name in  captoinfo clear infocmp infotocap tabs tic toe tput tset
@@ -9869,7 +10600,9 @@
 
 if test "$MANPAGE_ALIASES" != no ; then
 cat >>$cf_edit_man <<CF_EOF
-	aliases=\`sed -f \$top_srcdir/man/manlinks.sed \$inalias |sed -f $cf_man_alias | sort -u\`
+	nCurses=ignore.3x
+	test $with_curses_h = yes && nCurses=ncurses.3x
+	aliases=\`sed -f \$top_srcdir/man/manlinks.sed \$inalias |sed -f $cf_man_alias | sort -u; test \$inalias = \$nCurses && echo curses\`
 CF_EOF
 fi
 
@@ -9915,6 +10648,13 @@
 fi
 CF_EOF
 
+if test $with_overwrite != yes ; then
+cat >>$cf_edit_man <<CF_EOF
+	sed -e "/\#[    ]*include/s,<curses.h,<ncurses$LIB_SUFFIX/curses.h," < \$TMP >\$TMP.out
+	mv \$TMP.out \$TMP
+CF_EOF
+fi
+
 if test $with_curses_h != yes ; then
 cat >>$cf_edit_man <<CF_EOF
 	sed -e "/\#[    ]*include/s,curses.h,ncurses.h," < \$TMP >\$TMP.out
@@ -10051,7 +10791,7 @@
 ###############################################################################
 
 ### Note that some functions (such as const) are normally disabled anyway.
-echo "$as_me:10054: checking if you want to build with function extensions" >&5
+echo "$as_me:10794: checking if you want to build with function extensions" >&5
 echo $ECHO_N "checking if you want to build with function extensions... $ECHO_C" >&6
 
 # Check whether --enable-ext-funcs or --disable-ext-funcs was given.
@@ -10061,39 +10801,52 @@
 else
   with_ext_funcs=yes
 fi;
-echo "$as_me:10064: result: $with_ext_funcs" >&5
+echo "$as_me:10804: result: $with_ext_funcs" >&5
 echo "${ECHO_T}$with_ext_funcs" >&6
-if test "$with_ext_funcs" = yes ; then
+if test "x$with_ext_funcs" = xyes ; then
 	NCURSES_EXT_FUNCS=1
-	cat >>confdefs.h <<\EOF
+
+cat >>confdefs.h <<\EOF
+#define HAVE_ASSUME_DEFAULT_COLORS 1
+EOF
+
+cat >>confdefs.h <<\EOF
 #define HAVE_CURSES_VERSION 1
 EOF
 
-	cat >>confdefs.h <<\EOF
+cat >>confdefs.h <<\EOF
 #define HAVE_HAS_KEY 1
 EOF
 
-	cat >>confdefs.h <<\EOF
+cat >>confdefs.h <<\EOF
 #define HAVE_RESIZETERM 1
 EOF
 
-	cat >>confdefs.h <<\EOF
+cat >>confdefs.h <<\EOF
 #define HAVE_RESIZE_TERM 1
 EOF
 
-	cat >>confdefs.h <<\EOF
+cat >>confdefs.h <<\EOF
 #define HAVE_TERM_ENTRY_H 1
 EOF
 
-	cat >>confdefs.h <<\EOF
+cat >>confdefs.h <<\EOF
 #define HAVE_USE_DEFAULT_COLORS 1
 EOF
 
-	cat >>confdefs.h <<\EOF
+cat >>confdefs.h <<\EOF
+#define HAVE_USE_SCREEN 1
+EOF
+
+cat >>confdefs.h <<\EOF
+#define HAVE_USE_WINDOW 1
+EOF
+
+cat >>confdefs.h <<\EOF
 #define HAVE_WRESIZE 1
 EOF
 
-	cat >>confdefs.h <<\EOF
+cat >>confdefs.h <<\EOF
 #define NCURSES_EXT_FUNCS 1
 EOF
 
@@ -10103,7 +10856,7 @@
 	GENERATED_EXT_FUNCS=
 fi
 
-echo "$as_me:10106: checking if you want to build with experimental SCREEN extensions" >&5
+echo "$as_me:10859: checking if you want to build with experimental SCREEN extensions" >&5
 echo $ECHO_N "checking if you want to build with experimental SCREEN extensions... $ECHO_C" >&6
 
 # Check whether --enable-sp-funcs or --disable-sp-funcs was given.
@@ -10113,11 +10866,12 @@
 else
   with_sp_funcs=no
 fi;
-echo "$as_me:10116: result: $with_sp_funcs" >&5
+echo "$as_me:10869: result: $with_sp_funcs" >&5
 echo "${ECHO_T}$with_sp_funcs" >&6
-if test "$with_sp_funcs" = yes ; then
+if test "x$with_sp_funcs" = xyes ; then
 	NCURSES_SP_FUNCS=1
-	cat >>confdefs.h <<\EOF
+
+cat >>confdefs.h <<\EOF
 #define NCURSES_SP_FUNCS 1
 EOF
 
@@ -10127,7 +10881,7 @@
 	GENERATED_SP_FUNCS=
 fi
 
-echo "$as_me:10130: checking if you want to build with experimental terminal-driver" >&5
+echo "$as_me:10884: checking if you want to build with experimental terminal-driver" >&5
 echo $ECHO_N "checking if you want to build with experimental terminal-driver... $ECHO_C" >&6
 
 # Check whether --enable-term-driver or --disable-term-driver was given.
@@ -10137,22 +10891,23 @@
 else
   with_term_driver=no
 fi;
-echo "$as_me:10140: result: $with_term_driver" >&5
+echo "$as_me:10894: result: $with_term_driver" >&5
 echo "${ECHO_T}$with_term_driver" >&6
-if test "$with_term_driver" = yes ; then
-	cat >>confdefs.h <<\EOF
+if test "x$with_term_driver" = xyes ; then
+
+cat >>confdefs.h <<\EOF
 #define USE_TERM_DRIVER 1
 EOF
 
-	if test "$with_sp_funcs" != yes ; then
-		{ { echo "$as_me:10148: error: The term-driver option relies upon sp-funcs" >&5
+	if test "x$with_sp_funcs" != xyes ; then
+		{ { echo "$as_me:10903: error: The term-driver option relies upon sp-funcs" >&5
 echo "$as_me: error: The term-driver option relies upon sp-funcs" >&2;}
    { (exit 1); exit 1; }; }
 	fi
 fi
 
 ###   use option --enable-const to turn on use of const beyond that in XSI.
-echo "$as_me:10155: checking for extended use of const keyword" >&5
+echo "$as_me:10910: checking for extended use of const keyword" >&5
 echo $ECHO_N "checking for extended use of const keyword... $ECHO_C" >&6
 
 # Check whether --enable-const or --disable-const was given.
@@ -10162,15 +10917,15 @@
 else
   with_ext_const=no
 fi;
-echo "$as_me:10165: result: $with_ext_const" >&5
+echo "$as_me:10920: result: $with_ext_const" >&5
 echo "${ECHO_T}$with_ext_const" >&6
 NCURSES_CONST='/*nothing*/'
-if test "$with_ext_const" = yes ; then
+if test "x$with_ext_const" = xyes ; then
 	NCURSES_CONST=const
 fi
 
 ###   use option --enable-ext-colors to turn on use of colors beyond 16.
-echo "$as_me:10173: checking if you want to use extended colors" >&5
+echo "$as_me:10928: checking if you want to use extended colors" >&5
 echo $ECHO_N "checking if you want to use extended colors... $ECHO_C" >&6
 
 # Check whether --enable-ext-colors or --disable-ext-colors was given.
@@ -10180,12 +10935,12 @@
 else
   with_ext_colors=no
 fi;
-echo "$as_me:10183: result: $with_ext_colors" >&5
+echo "$as_me:10938: result: $with_ext_colors" >&5
 echo "${ECHO_T}$with_ext_colors" >&6
 NCURSES_EXT_COLORS=0
-if test "$with_ext_colors" = yes ; then
-	if test "$with_widec" != yes ; then
-		{ { echo "$as_me:10188: error: This option applies only to wide-character library" >&5
+if test "x$with_ext_colors" = xyes ; then
+	if test "x$with_widec" != xyes ; then
+		{ { echo "$as_me:10943: error: This option applies only to wide-character library" >&5
 echo "$as_me: error: This option applies only to wide-character library" >&2;}
    { (exit 1); exit 1; }; }
 	else
@@ -10196,7 +10951,7 @@
 	5.*)
 		cf_cv_rel_version=6.0
 		cf_cv_abi_version=6
-		{ echo "$as_me:10199: WARNING: Overriding ABI version to $cf_cv_abi_version" >&5
+		{ echo "$as_me:10954: WARNING: Overriding ABI version to $cf_cv_abi_version" >&5
 echo "$as_me: WARNING: Overriding ABI version to $cf_cv_abi_version" >&2;}
 		;;
 	esac
@@ -10204,14 +10959,15 @@
 
 	fi
 	NCURSES_EXT_COLORS=1
-	cat >>confdefs.h <<\EOF
+
+cat >>confdefs.h <<\EOF
 #define NCURSES_EXT_COLORS 1
 EOF
 
 fi
 
 ###   use option --enable-ext-mouse to modify coding to support 5-button mice
-echo "$as_me:10214: checking if you want to use extended mouse encoding" >&5
+echo "$as_me:10970: checking if you want to use extended mouse encoding" >&5
 echo $ECHO_N "checking if you want to use extended mouse encoding... $ECHO_C" >&6
 
 # Check whether --enable-ext-mouse or --disable-ext-mouse was given.
@@ -10221,10 +10977,10 @@
 else
   with_ext_mouse=no
 fi;
-echo "$as_me:10224: result: $with_ext_mouse" >&5
+echo "$as_me:10980: result: $with_ext_mouse" >&5
 echo "${ECHO_T}$with_ext_mouse" >&6
 NCURSES_MOUSE_VERSION=1
-if test "$with_ext_mouse" = yes ; then
+if test "x$with_ext_mouse" = xyes ; then
 	NCURSES_MOUSE_VERSION=2
 
 if test "${with_abi_version+set}" != set; then
@@ -10232,7 +10988,7 @@
 	5.*)
 		cf_cv_rel_version=6.0
 		cf_cv_abi_version=6
-		{ echo "$as_me:10235: WARNING: Overriding ABI version to $cf_cv_abi_version" >&5
+		{ echo "$as_me:10991: WARNING: Overriding ABI version to $cf_cv_abi_version" >&5
 echo "$as_me: WARNING: Overriding ABI version to $cf_cv_abi_version" >&2;}
 		;;
 	esac
@@ -10240,7 +10996,7 @@
 
 fi
 
-echo "$as_me:10243: checking if you want \$NCURSES_NO_PADDING code" >&5
+echo "$as_me:10999: checking if you want \$NCURSES_NO_PADDING code" >&5
 echo $ECHO_N "checking if you want \$NCURSES_NO_PADDING code... $ECHO_C" >&6
 
 # Check whether --enable-no-padding or --disable-no-padding was given.
@@ -10250,19 +11006,20 @@
 else
   with_no_padding=$with_ext_funcs
 fi;
-echo "$as_me:10253: result: $with_no_padding" >&5
+echo "$as_me:11009: result: $with_no_padding" >&5
 echo "${ECHO_T}$with_no_padding" >&6
-test "$with_no_padding" = yes && cat >>confdefs.h <<\EOF
+test "x$with_no_padding" = xyes &&
+cat >>confdefs.h <<\EOF
 #define NCURSES_NO_PADDING 1
 EOF
 
-echo "$as_me:10259: checking for ANSI C header files" >&5
+echo "$as_me:11016: checking for ANSI C header files" >&5
 echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6
 if test "${ac_cv_header_stdc+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 10265 "configure"
+#line 11022 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 #include <stdarg.h>
@@ -10270,13 +11027,13 @@
 #include <float.h>
 
 _ACEOF
-if { (eval echo "$as_me:10273: \"$ac_cpp conftest.$ac_ext\"") >&5
+if { (eval echo "$as_me:11030: \"$ac_cpp conftest.$ac_ext\"") >&5
   (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
   ac_status=$?
   egrep -v '^ *\+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
-  echo "$as_me:10279: \$? = $ac_status" >&5
+  echo "$as_me:11036: \$? = $ac_status" >&5
   (exit $ac_status); } >/dev/null; then
   if test -s conftest.err; then
     ac_cpp_err=$ac_c_preproc_warn_flag
@@ -10298,7 +11055,7 @@
 if test $ac_cv_header_stdc = yes; then
   # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
   cat >conftest.$ac_ext <<_ACEOF
-#line 10301 "configure"
+#line 11058 "configure"
 #include "confdefs.h"
 #include <string.h>
 
@@ -10316,7 +11073,7 @@
 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 <<_ACEOF
-#line 10319 "configure"
+#line 11076 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 
@@ -10337,7 +11094,7 @@
   :
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 10340 "configure"
+#line 11097 "configure"
 #include "confdefs.h"
 #include <ctype.h>
 #if ((' ' & 0x0FF) == 0x020)
@@ -10363,15 +11120,15 @@
 }
 _ACEOF
 rm -f conftest$ac_exeext
-if { (eval echo "$as_me:10366: \"$ac_link\"") >&5
+if { (eval echo "$as_me:11123: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:10369: \$? = $ac_status" >&5
+  echo "$as_me:11126: \$? = $ac_status" >&5
   (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (eval echo "$as_me:10371: \"$ac_try\"") >&5
+  { (eval echo "$as_me:11128: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:10374: \$? = $ac_status" >&5
+  echo "$as_me:11131: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   :
 else
@@ -10384,7 +11141,7 @@
 fi
 fi
 fi
-echo "$as_me:10387: result: $ac_cv_header_stdc" >&5
+echo "$as_me:11144: result: $ac_cv_header_stdc" >&5
 echo "${ECHO_T}$ac_cv_header_stdc" >&6
 if test $ac_cv_header_stdc = yes; then
 
@@ -10400,28 +11157,28 @@
                   inttypes.h stdint.h unistd.h
 do
 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-echo "$as_me:10403: checking for $ac_header" >&5
+echo "$as_me:11160: checking for $ac_header" >&5
 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
 if eval "test \"\${$as_ac_Header+set}\" = set"; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 10409 "configure"
+#line 11166 "configure"
 #include "confdefs.h"
 $ac_includes_default
 #include <$ac_header>
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:10415: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:11172: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:10418: \$? = $ac_status" >&5
+  echo "$as_me:11175: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:10421: \"$ac_try\"") >&5
+  { (eval echo "$as_me:11178: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:10424: \$? = $ac_status" >&5
+  echo "$as_me:11181: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   eval "$as_ac_Header=yes"
 else
@@ -10431,7 +11188,7 @@
 fi
 rm -f conftest.$ac_objext conftest.$ac_ext
 fi
-echo "$as_me:10434: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "$as_me:11191: result: `eval echo '${'$as_ac_Header'}'`" >&5
 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
 if test `eval echo '${'$as_ac_Header'}'` = yes; then
   cat >>confdefs.h <<EOF
@@ -10441,13 +11198,13 @@
 fi
 done
 
-echo "$as_me:10444: checking for signed char" >&5
+echo "$as_me:11201: checking for signed char" >&5
 echo $ECHO_N "checking for signed char... $ECHO_C" >&6
 if test "${ac_cv_type_signed_char+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 10450 "configure"
+#line 11207 "configure"
 #include "confdefs.h"
 $ac_includes_default
 int
@@ -10462,16 +11219,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:10465: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:11222: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:10468: \$? = $ac_status" >&5
+  echo "$as_me:11225: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:10471: \"$ac_try\"") >&5
+  { (eval echo "$as_me:11228: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:10474: \$? = $ac_status" >&5
+  echo "$as_me:11231: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_type_signed_char=yes
 else
@@ -10481,10 +11238,10 @@
 fi
 rm -f conftest.$ac_objext conftest.$ac_ext
 fi
-echo "$as_me:10484: result: $ac_cv_type_signed_char" >&5
+echo "$as_me:11241: result: $ac_cv_type_signed_char" >&5
 echo "${ECHO_T}$ac_cv_type_signed_char" >&6
 
-echo "$as_me:10487: checking size of signed char" >&5
+echo "$as_me:11244: checking size of signed char" >&5
 echo $ECHO_N "checking size of signed char... $ECHO_C" >&6
 if test "${ac_cv_sizeof_signed_char+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -10493,7 +11250,7 @@
   if test "$cross_compiling" = yes; then
   # Depending upon the size, compute the lo and hi bounds.
 cat >conftest.$ac_ext <<_ACEOF
-#line 10496 "configure"
+#line 11253 "configure"
 #include "confdefs.h"
 $ac_includes_default
 int
@@ -10505,21 +11262,21 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:10508: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:11265: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:10511: \$? = $ac_status" >&5
+  echo "$as_me:11268: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:10514: \"$ac_try\"") >&5
+  { (eval echo "$as_me:11271: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:10517: \$? = $ac_status" >&5
+  echo "$as_me:11274: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_lo=0 ac_mid=0
   while :; do
     cat >conftest.$ac_ext <<_ACEOF
-#line 10522 "configure"
+#line 11279 "configure"
 #include "confdefs.h"
 $ac_includes_default
 int
@@ -10531,16 +11288,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:10534: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:11291: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:10537: \$? = $ac_status" >&5
+  echo "$as_me:11294: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:10540: \"$ac_try\"") >&5
+  { (eval echo "$as_me:11297: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:10543: \$? = $ac_status" >&5
+  echo "$as_me:11300: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_hi=$ac_mid; break
 else
@@ -10556,7 +11313,7 @@
 ac_hi=-1 ac_mid=-1
   while :; do
     cat >conftest.$ac_ext <<_ACEOF
-#line 10559 "configure"
+#line 11316 "configure"
 #include "confdefs.h"
 $ac_includes_default
 int
@@ -10568,16 +11325,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:10571: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:11328: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:10574: \$? = $ac_status" >&5
+  echo "$as_me:11331: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:10577: \"$ac_try\"") >&5
+  { (eval echo "$as_me:11334: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:10580: \$? = $ac_status" >&5
+  echo "$as_me:11337: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_lo=$ac_mid; break
 else
@@ -10593,7 +11350,7 @@
 while test "x$ac_lo" != "x$ac_hi"; do
   ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
   cat >conftest.$ac_ext <<_ACEOF
-#line 10596 "configure"
+#line 11353 "configure"
 #include "confdefs.h"
 $ac_includes_default
 int
@@ -10605,16 +11362,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:10608: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:11365: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:10611: \$? = $ac_status" >&5
+  echo "$as_me:11368: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:10614: \"$ac_try\"") >&5
+  { (eval echo "$as_me:11371: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:10617: \$? = $ac_status" >&5
+  echo "$as_me:11374: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_hi=$ac_mid
 else
@@ -10627,12 +11384,12 @@
 ac_cv_sizeof_signed_char=$ac_lo
 else
   if test "$cross_compiling" = yes; then
-  { { echo "$as_me:10630: error: cannot run test program while cross compiling" >&5
+  { { echo "$as_me:11387: error: cannot run test program while cross compiling" >&5
 echo "$as_me: error: cannot run test program while cross compiling" >&2;}
    { (exit 1); exit 1; }; }
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 10635 "configure"
+#line 11392 "configure"
 #include "confdefs.h"
 $ac_includes_default
 int
@@ -10648,15 +11405,15 @@
 }
 _ACEOF
 rm -f conftest$ac_exeext
-if { (eval echo "$as_me:10651: \"$ac_link\"") >&5
+if { (eval echo "$as_me:11408: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:10654: \$? = $ac_status" >&5
+  echo "$as_me:11411: \$? = $ac_status" >&5
   (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (eval echo "$as_me:10656: \"$ac_try\"") >&5
+  { (eval echo "$as_me:11413: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:10659: \$? = $ac_status" >&5
+  echo "$as_me:11416: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_sizeof_signed_char=`cat conftest.val`
 else
@@ -10672,7 +11429,7 @@
   ac_cv_sizeof_signed_char=0
 fi
 fi
-echo "$as_me:10675: result: $ac_cv_sizeof_signed_char" >&5
+echo "$as_me:11432: result: $ac_cv_sizeof_signed_char" >&5
 echo "${ECHO_T}$ac_cv_sizeof_signed_char" >&6
 cat >>confdefs.h <<EOF
 #define SIZEOF_SIGNED_CHAR $ac_cv_sizeof_signed_char
@@ -10683,7 +11440,7 @@
 else
 	NCURSES_SBOOL="char"
 fi
-echo "$as_me:10686: checking if you want to use signed Boolean array in term.h" >&5
+echo "$as_me:11443: checking if you want to use signed Boolean array in term.h" >&5
 echo $ECHO_N "checking if you want to use signed Boolean array in term.h... $ECHO_C" >&6
 
 # Check whether --enable-signed-char or --disable-signed-char was given.
@@ -10693,12 +11450,12 @@
 else
   with_signed_char=no
 fi;
-echo "$as_me:10696: result: $with_signed_char" >&5
+echo "$as_me:11453: result: $with_signed_char" >&5
 echo "${ECHO_T}$with_signed_char" >&6
-test "$with_signed_char" != yes && NCURSES_SBOOL="char"
+test "x$with_signed_char" != xyes && NCURSES_SBOOL="char"
 
 ###   use option --enable-sigwinch to turn on use of SIGWINCH logic
-echo "$as_me:10701: checking if you want SIGWINCH handler" >&5
+echo "$as_me:11458: checking if you want SIGWINCH handler" >&5
 echo $ECHO_N "checking if you want SIGWINCH handler... $ECHO_C" >&6
 
 # Check whether --enable-sigwinch or --disable-sigwinch was given.
@@ -10708,14 +11465,15 @@
 else
   with_sigwinch=$with_ext_funcs
 fi;
-echo "$as_me:10711: result: $with_sigwinch" >&5
+echo "$as_me:11468: result: $with_sigwinch" >&5
 echo "${ECHO_T}$with_sigwinch" >&6
-test "$with_sigwinch" = yes && cat >>confdefs.h <<\EOF
+test "x$with_sigwinch" = xyes &&
+cat >>confdefs.h <<\EOF
 #define USE_SIGWINCH 1
 EOF
 
 ###   use option --enable-tcap-names to allow user to define new capabilities
-echo "$as_me:10718: checking if you want user-definable terminal capabilities like termcap" >&5
+echo "$as_me:11476: checking if you want user-definable terminal capabilities like termcap" >&5
 echo $ECHO_N "checking if you want user-definable terminal capabilities like termcap... $ECHO_C" >&6
 
 # Check whether --enable-tcap-names or --disable-tcap-names was given.
@@ -10725,15 +11483,15 @@
 else
   with_tcap_names=$with_ext_funcs
 fi;
-echo "$as_me:10728: result: $with_tcap_names" >&5
+echo "$as_me:11486: result: $with_tcap_names" >&5
 echo "${ECHO_T}$with_tcap_names" >&6
 NCURSES_XNAMES=0
-test "$with_tcap_names" = yes && NCURSES_XNAMES=1
+test "x$with_tcap_names" = xyes && NCURSES_XNAMES=1
 
 ###############################################################################
 # These options are relatively safe to experiment with.
 
-echo "$as_me:10736: checking if you want all development code" >&5
+echo "$as_me:11494: checking if you want all development code" >&5
 echo $ECHO_N "checking if you want all development code... $ECHO_C" >&6
 
 # Check whether --with-develop or --without-develop was given.
@@ -10743,11 +11501,11 @@
 else
   with_develop=no
 fi;
-echo "$as_me:10746: result: $with_develop" >&5
+echo "$as_me:11504: result: $with_develop" >&5
 echo "${ECHO_T}$with_develop" >&6
 
 ###   use option --enable-hard-tabs to turn on use of hard-tabs optimize
-echo "$as_me:10750: checking if you want hard-tabs code" >&5
+echo "$as_me:11508: checking if you want hard-tabs code" >&5
 echo $ECHO_N "checking if you want hard-tabs code... $ECHO_C" >&6
 
 # Check whether --enable-hard-tabs or --disable-hard-tabs was given.
@@ -10757,14 +11515,15 @@
 else
   enable_hard_tabs=$with_develop
 fi;
-echo "$as_me:10760: result: $enable_hard_tabs" >&5
+echo "$as_me:11518: result: $enable_hard_tabs" >&5
 echo "${ECHO_T}$enable_hard_tabs" >&6
-test "$enable_hard_tabs" = yes && cat >>confdefs.h <<\EOF
+test "x$enable_hard_tabs" = xyes &&
+cat >>confdefs.h <<\EOF
 #define USE_HARD_TABS 1
 EOF
 
 ###   use option --enable-xmc-glitch to turn on use of magic-cookie optimize
-echo "$as_me:10767: checking if you want limited support for xmc" >&5
+echo "$as_me:11526: checking if you want limited support for xmc" >&5
 echo $ECHO_N "checking if you want limited support for xmc... $ECHO_C" >&6
 
 # Check whether --enable-xmc-glitch or --disable-xmc-glitch was given.
@@ -10774,16 +11533,17 @@
 else
   enable_xmc_glitch=$with_develop
 fi;
-echo "$as_me:10777: result: $enable_xmc_glitch" >&5
+echo "$as_me:11536: result: $enable_xmc_glitch" >&5
 echo "${ECHO_T}$enable_xmc_glitch" >&6
-test "$enable_xmc_glitch" = yes && cat >>confdefs.h <<\EOF
+test "x$enable_xmc_glitch" = xyes &&
+cat >>confdefs.h <<\EOF
 #define USE_XMC_SUPPORT 1
 EOF
 
 ###############################################################################
 # These are just experimental, probably should not be in a package:
 
-echo "$as_me:10786: checking if you do not want to assume colors are white-on-black" >&5
+echo "$as_me:11546: checking if you do not want to assume colors are white-on-black" >&5
 echo $ECHO_N "checking if you do not want to assume colors are white-on-black... $ECHO_C" >&6
 
 # Check whether --enable-assumed-color or --disable-assumed-color was given.
@@ -10793,14 +11553,15 @@
 else
   with_assumed_color=yes
 fi;
-echo "$as_me:10796: result: $with_assumed_color" >&5
+echo "$as_me:11556: result: $with_assumed_color" >&5
 echo "${ECHO_T}$with_assumed_color" >&6
-test "$with_assumed_color" = yes && cat >>confdefs.h <<\EOF
+test "x$with_assumed_color" = xyes &&
+cat >>confdefs.h <<\EOF
 #define USE_ASSUMED_COLOR 1
 EOF
 
 ###   use option --enable-hashmap to turn on use of hashmap scrolling logic
-echo "$as_me:10803: checking if you want hashmap scrolling-optimization code" >&5
+echo "$as_me:11564: checking if you want hashmap scrolling-optimization code" >&5
 echo $ECHO_N "checking if you want hashmap scrolling-optimization code... $ECHO_C" >&6
 
 # Check whether --enable-hashmap or --disable-hashmap was given.
@@ -10810,14 +11571,15 @@
 else
   with_hashmap=yes
 fi;
-echo "$as_me:10813: result: $with_hashmap" >&5
+echo "$as_me:11574: result: $with_hashmap" >&5
 echo "${ECHO_T}$with_hashmap" >&6
-test "$with_hashmap" = yes && cat >>confdefs.h <<\EOF
+test "x$with_hashmap" = xyes &&
+cat >>confdefs.h <<\EOF
 #define USE_HASHMAP 1
 EOF
 
 ###   use option --enable-colorfgbg to turn on use of $COLORFGBG environment
-echo "$as_me:10820: checking if you want colorfgbg code" >&5
+echo "$as_me:11582: checking if you want colorfgbg code" >&5
 echo $ECHO_N "checking if you want colorfgbg code... $ECHO_C" >&6
 
 # Check whether --enable-colorfgbg or --disable-colorfgbg was given.
@@ -10827,14 +11589,15 @@
 else
   with_colorfgbg=no
 fi;
-echo "$as_me:10830: result: $with_colorfgbg" >&5
+echo "$as_me:11592: result: $with_colorfgbg" >&5
 echo "${ECHO_T}$with_colorfgbg" >&6
-test "$with_colorfgbg" = yes && cat >>confdefs.h <<\EOF
+test "x$with_colorfgbg" = xyes &&
+cat >>confdefs.h <<\EOF
 #define USE_COLORFGBG 1
 EOF
 
 ###   use option --enable-interop to turn on use of bindings used for interop
-echo "$as_me:10837: checking if you want interop bindings" >&5
+echo "$as_me:11600: checking if you want interop bindings" >&5
 echo $ECHO_N "checking if you want interop bindings... $ECHO_C" >&6
 
 # Check whether --enable-interop or --disable-interop was given.
@@ -10844,16 +11607,16 @@
 else
   with_exp_interop=no
 fi;
-echo "$as_me:10847: result: $with_exp_interop" >&5
+echo "$as_me:11610: result: $with_exp_interop" >&5
 echo "${ECHO_T}$with_exp_interop" >&6
 
 NCURSES_INTEROP_FUNCS=0
-test "$with_exp_interop" = yes && NCURSES_INTEROP_FUNCS=1
+test "x$with_exp_interop" = xyes && NCURSES_INTEROP_FUNCS=1
 
 # This is still experimental (20080329), but should ultimately be moved to
 # the script-block --with-normal, etc.
 
-echo "$as_me:10856: checking if you want to link with the pthread library" >&5
+echo "$as_me:11619: checking if you want to link with the pthread library" >&5
 echo $ECHO_N "checking if you want to link with the pthread library... $ECHO_C" >&6
 
 # Check whether --with-pthread or --without-pthread was given.
@@ -10863,27 +11626,27 @@
 else
   with_pthread=no
 fi;
-echo "$as_me:10866: result: $with_pthread" >&5
+echo "$as_me:11629: result: $with_pthread" >&5
 echo "${ECHO_T}$with_pthread" >&6
 
 if test "$with_pthread" != no ; then
-    echo "$as_me:10870: checking for pthread.h" >&5
+    echo "$as_me:11633: checking for pthread.h" >&5
 echo $ECHO_N "checking for pthread.h... $ECHO_C" >&6
 if test "${ac_cv_header_pthread_h+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 10876 "configure"
+#line 11639 "configure"
 #include "confdefs.h"
 #include <pthread.h>
 _ACEOF
-if { (eval echo "$as_me:10880: \"$ac_cpp conftest.$ac_ext\"") >&5
+if { (eval echo "$as_me:11643: \"$ac_cpp conftest.$ac_ext\"") >&5
   (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
   ac_status=$?
   egrep -v '^ *\+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
-  echo "$as_me:10886: \$? = $ac_status" >&5
+  echo "$as_me:11649: \$? = $ac_status" >&5
   (exit $ac_status); } >/dev/null; then
   if test -s conftest.err; then
     ac_cpp_err=$ac_c_preproc_warn_flag
@@ -10902,20 +11665,22 @@
 fi
 rm -f conftest.err conftest.$ac_ext
 fi
-echo "$as_me:10905: result: $ac_cv_header_pthread_h" >&5
+echo "$as_me:11668: result: $ac_cv_header_pthread_h" >&5
 echo "${ECHO_T}$ac_cv_header_pthread_h" >&6
 if test $ac_cv_header_pthread_h = yes; then
 
-        cat >>confdefs.h <<\EOF
+cat >>confdefs.h <<\EOF
 #define HAVE_PTHREADS_H 1
 EOF
 
-        echo "$as_me:10913: checking if we can link with the pthread library" >&5
-echo $ECHO_N "checking if we can link with the pthread library... $ECHO_C" >&6
-        cf_save_LIBS="$LIBS"
-        LIBS="-lpthread $LIBS"
-        cat >conftest.$ac_ext <<_ACEOF
-#line 10918 "configure"
+	for cf_lib_pthread in pthread c_r
+	do
+	    echo "$as_me:11678: checking if we can link with the $cf_lib_pthread library" >&5
+echo $ECHO_N "checking if we can link with the $cf_lib_pthread library... $ECHO_C" >&6
+	    cf_save_LIBS="$LIBS"
+	    LIBS="-l$cf_lib_pthread $LIBS"
+	    cat >conftest.$ac_ext <<_ACEOF
+#line 11683 "configure"
 #include "confdefs.h"
 
 #include <pthread.h>
@@ -10924,23 +11689,24 @@
 main ()
 {
 
-        int rc = pthread_create(0,0,0,0);
+		int rc = pthread_create(0,0,0,0);
+		int r2 = pthread_mutexattr_settype(0, 0);
 
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:10934: \"$ac_link\"") >&5
+if { (eval echo "$as_me:11700: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:10937: \$? = $ac_status" >&5
+  echo "$as_me:11703: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:10940: \"$ac_try\"") >&5
+  { (eval echo "$as_me:11706: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:10943: \$? = $ac_status" >&5
+  echo "$as_me:11709: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   with_pthread=yes
 else
@@ -10949,34 +11715,37 @@
 with_pthread=no
 fi
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
-        LIBS="$cf_save_LIBS"
-        echo "$as_me:10953: result: $with_pthread" >&5
+	    LIBS="$cf_save_LIBS"
+	    echo "$as_me:11719: result: $with_pthread" >&5
 echo "${ECHO_T}$with_pthread" >&6
+	    test "$with_pthread" = yes && break
+	done
+
+	if test "$with_pthread" = yes ; then
+	    LIBS="-l$cf_lib_pthread $LIBS"
 
-        if test "$with_pthread" = yes ; then
-            LIBS="-lpthread $LIBS"
-            cat >>confdefs.h <<\EOF
+cat >>confdefs.h <<\EOF
 #define HAVE_LIBPTHREADS 1
 EOF
 
-        else
-            { { echo "$as_me:10963: error: Cannot link with pthread library" >&5
+	else
+	    { { echo "$as_me:11732: error: Cannot link with pthread library" >&5
 echo "$as_me: error: Cannot link with pthread library" >&2;}
    { (exit 1); exit 1; }; }
-        fi
+	fi
 
 fi
 
 fi
 
 if test "x$with_pthread" != xno; then
-	echo "$as_me:10973: checking for pthread_kill" >&5
+	echo "$as_me:11742: checking for pthread_kill" >&5
 echo $ECHO_N "checking for pthread_kill... $ECHO_C" >&6
 if test "${ac_cv_func_pthread_kill+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 10979 "configure"
+#line 11748 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char pthread_kill (); below.  */
@@ -10999,7 +11768,7 @@
 #if defined (__stub_pthread_kill) || defined (__stub___pthread_kill)
 choke me
 #else
-f = pthread_kill;
+f = pthread_kill; /* workaround for ICC 12.0.3 */ if (f == 0) return 1;
 #endif
 
   ;
@@ -11007,16 +11776,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:11010: \"$ac_link\"") >&5
+if { (eval echo "$as_me:11779: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:11013: \$? = $ac_status" >&5
+  echo "$as_me:11782: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:11016: \"$ac_try\"") >&5
+  { (eval echo "$as_me:11785: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:11019: \$? = $ac_status" >&5
+  echo "$as_me:11788: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_func_pthread_kill=yes
 else
@@ -11026,11 +11795,11 @@
 fi
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 fi
-echo "$as_me:11029: result: $ac_cv_func_pthread_kill" >&5
+echo "$as_me:11798: result: $ac_cv_func_pthread_kill" >&5
 echo "${ECHO_T}$ac_cv_func_pthread_kill" >&6
 if test $ac_cv_func_pthread_kill = yes; then
 
-		echo "$as_me:11033: checking if you want to allow EINTR in wgetch with pthreads" >&5
+		echo "$as_me:11802: checking if you want to allow EINTR in wgetch with pthreads" >&5
 echo $ECHO_N "checking if you want to allow EINTR in wgetch with pthreads... $ECHO_C" >&6
 
 # Check whether --enable-pthreads-eintr or --disable-pthreads-eintr was given.
@@ -11040,17 +11809,18 @@
 else
   use_pthreads_eintr=no
 fi;
-		echo "$as_me:11043: result: $use_pthreads_eintr" >&5
+		echo "$as_me:11812: result: $use_pthreads_eintr" >&5
 echo "${ECHO_T}$use_pthreads_eintr" >&6
-		if test $use_pthreads_eintr = yes ; then
-			cat >>confdefs.h <<\EOF
+		if test "x$use_pthreads_eintr" = xyes ; then
+
+cat >>confdefs.h <<\EOF
 #define USE_PTHREADS_EINTR 1
 EOF
 
 		fi
 fi
 
-	echo "$as_me:11053: checking if you want to use weak-symbols for pthreads" >&5
+	echo "$as_me:11823: checking if you want to use weak-symbols for pthreads" >&5
 echo $ECHO_N "checking if you want to use weak-symbols for pthreads... $ECHO_C" >&6
 
 # Check whether --enable-weak-symbols or --disable-weak-symbols was given.
@@ -11060,18 +11830,18 @@
 else
   use_weak_symbols=no
 fi;
-	echo "$as_me:11063: result: $use_weak_symbols" >&5
+	echo "$as_me:11833: result: $use_weak_symbols" >&5
 echo "${ECHO_T}$use_weak_symbols" >&6
-	if test "$use_weak_symbols" = yes ; then
+	if test "x$use_weak_symbols" = xyes ; then
 
-echo "$as_me:11067: checking if $CC supports weak symbols" >&5
+echo "$as_me:11837: checking if $CC supports weak symbols" >&5
 echo $ECHO_N "checking if $CC supports weak symbols... $ECHO_C" >&6
 if test "${cf_cv_weak_symbols+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
 
 cat >conftest.$ac_ext <<_ACEOF
-#line 11074 "configure"
+#line 11844 "configure"
 #include "confdefs.h"
 
 #include <stdio.h>
@@ -11097,16 +11867,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:11100: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:11870: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:11103: \$? = $ac_status" >&5
+  echo "$as_me:11873: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:11106: \"$ac_try\"") >&5
+  { (eval echo "$as_me:11876: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:11109: \$? = $ac_status" >&5
+  echo "$as_me:11879: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   cf_cv_weak_symbols=yes
 else
@@ -11117,15 +11887,16 @@
 rm -f conftest.$ac_objext conftest.$ac_ext
 
 fi
-echo "$as_me:11120: result: $cf_cv_weak_symbols" >&5
+echo "$as_me:11890: result: $cf_cv_weak_symbols" >&5
 echo "${ECHO_T}$cf_cv_weak_symbols" >&6
 
 	else
 		cf_cv_weak_symbols=no
 	fi
 
-	if test $cf_cv_weak_symbols = yes ; then
-		cat >>confdefs.h <<\EOF
+	if test "x$cf_cv_weak_symbols" = xyes ; then
+
+cat >>confdefs.h <<\EOF
 #define USE_WEAK_SYMBOLS 1
 EOF
 
@@ -11133,13 +11904,14 @@
 fi
 
 PTHREAD=
-if test "$with_pthread" = "yes" ; then
-    cat >>confdefs.h <<\EOF
+if test "x$with_pthread" = "xyes" ; then
+
+cat >>confdefs.h <<\EOF
 #define USE_PTHREADS 1
 EOF
 
     enable_reentrant=yes
-    if test $cf_cv_weak_symbols = yes ; then
+    if test "x$cf_cv_weak_symbols" = xyes ; then
         PTHREAD=-lpthread
     fi
 fi
@@ -11148,7 +11920,7 @@
 # opaque outside of that, so there is no --enable-opaque option.  We can use
 # this option without --with-pthreads, but this will be always set for
 # pthreads.
-echo "$as_me:11151: checking if you want experimental reentrant code" >&5
+echo "$as_me:11923: checking if you want experimental reentrant code" >&5
 echo $ECHO_N "checking if you want experimental reentrant code... $ECHO_C" >&6
 
 # Check whether --enable-reentrant or --disable-reentrant was given.
@@ -11158,14 +11930,14 @@
 else
   with_reentrant=no
 fi;
-echo "$as_me:11161: result: $with_reentrant" >&5
+echo "$as_me:11933: result: $with_reentrant" >&5
 echo "${ECHO_T}$with_reentrant" >&6
-if test "$with_reentrant" = yes ; then
+if test "x$with_reentrant" = xyes ; then
 	cf_cv_enable_reentrant=1
 	cf_cv_enable_opaque="NCURSES_INTERNALS"
 	NCURSES_OPAQUE=1
 	NCURSES_SIZE_T=int
-	if test $cf_cv_weak_symbols = yes ; then
+	if test "x$cf_cv_weak_symbols" = xyes ; then
 
 # remove pthread library from $LIBS
 LIBS=`echo "$LIBS" | sed -e 's/-lpthread[ 	]//g' -e 's/-lpthread$//'`
@@ -11175,7 +11947,8 @@
 	else
 		LIB_SUFFIX="t${LIB_SUFFIX}"
 	fi
-	cat >>confdefs.h <<\EOF
+
+cat >>confdefs.h <<\EOF
 #define USE_REENTRANT 1
 EOF
 
@@ -11184,7 +11957,7 @@
 	5.*)
 		cf_cv_rel_version=6.0
 		cf_cv_abi_version=6
-		{ echo "$as_me:11187: WARNING: Overriding ABI version to $cf_cv_abi_version" >&5
+		{ echo "$as_me:11960: WARNING: Overriding ABI version to $cf_cv_abi_version" >&5
 echo "$as_me: WARNING: Overriding ABI version to $cf_cv_abi_version" >&2;}
 		;;
 	esac
@@ -11199,7 +11972,7 @@
 
 ### Allow using a different wrap-prefix
 if test "$cf_cv_enable_reentrant" != 0 || test "$BROKEN_LINKER" = 1 ; then
-	echo "$as_me:11202: checking for prefix used to wrap public variables" >&5
+	echo "$as_me:11975: checking for prefix used to wrap public variables" >&5
 echo $ECHO_N "checking for prefix used to wrap public variables... $ECHO_C" >&6
 
 # Check whether --with-wrap-prefix or --without-wrap-prefix was given.
@@ -11209,7 +11982,7 @@
 else
   NCURSES_WRAP_PREFIX=_nc_
 fi;
-	echo "$as_me:11212: result: $NCURSES_WRAP_PREFIX" >&5
+	echo "$as_me:11985: result: $NCURSES_WRAP_PREFIX" >&5
 echo "${ECHO_T}$NCURSES_WRAP_PREFIX" >&6
 else
 	NCURSES_WRAP_PREFIX=_nc_
@@ -11219,7 +11992,7 @@
 #define NCURSES_WRAP_PREFIX "$NCURSES_WRAP_PREFIX"
 EOF
 
-echo "$as_me:11222: checking if you want experimental safe-sprintf code" >&5
+echo "$as_me:11995: checking if you want experimental safe-sprintf code" >&5
 echo $ECHO_N "checking if you want experimental safe-sprintf code... $ECHO_C" >&6
 
 # Check whether --enable-safe-sprintf or --disable-safe-sprintf was given.
@@ -11229,16 +12002,17 @@
 else
   with_safe_sprintf=no
 fi;
-echo "$as_me:11232: result: $with_safe_sprintf" >&5
+echo "$as_me:12005: result: $with_safe_sprintf" >&5
 echo "${ECHO_T}$with_safe_sprintf" >&6
-test "$with_safe_sprintf" = yes && cat >>confdefs.h <<\EOF
+test "x$with_safe_sprintf" = xyes &&
+cat >>confdefs.h <<\EOF
 #define USE_SAFE_SPRINTF 1
 EOF
 
 ###   use option --disable-scroll-hints to turn off use of scroll-hints scrolling logic
 # when hashmap is used scroll hints are useless
 if test "$with_hashmap" = no ; then
-echo "$as_me:11241: checking if you want to experiment without scrolling-hints code" >&5
+echo "$as_me:12015: checking if you want to experiment without scrolling-hints code" >&5
 echo $ECHO_N "checking if you want to experiment without scrolling-hints code... $ECHO_C" >&6
 
 # Check whether --enable-scroll-hints or --disable-scroll-hints was given.
@@ -11248,15 +12022,16 @@
 else
   with_scroll_hints=yes
 fi;
-echo "$as_me:11251: result: $with_scroll_hints" >&5
+echo "$as_me:12025: result: $with_scroll_hints" >&5
 echo "${ECHO_T}$with_scroll_hints" >&6
-test "$with_scroll_hints" = yes && cat >>confdefs.h <<\EOF
+test "x$with_scroll_hints" = xyes &&
+cat >>confdefs.h <<\EOF
 #define USE_SCROLL_HINTS 1
 EOF
 
 fi
 
-echo "$as_me:11259: checking if you want experimental wgetch-events code" >&5
+echo "$as_me:12034: checking if you want experimental wgetch-events code" >&5
 echo $ECHO_N "checking if you want experimental wgetch-events code... $ECHO_C" >&6
 
 # Check whether --enable-wgetch-events or --disable-wgetch-events was given.
@@ -11266,37 +12041,64 @@
 else
   with_wgetch_events=no
 fi;
-echo "$as_me:11269: result: $with_wgetch_events" >&5
+echo "$as_me:12044: result: $with_wgetch_events" >&5
 echo "${ECHO_T}$with_wgetch_events" >&6
-test "$with_wgetch_events" = yes && cat >>confdefs.h <<\EOF
+test "x$with_wgetch_events" = xyes &&
+cat >>confdefs.h <<\EOF
 #define NCURSES_WGETCH_EVENTS 1
 EOF
 
 ###############################################################################
 
 ###	use option --disable-echo to suppress full display compiling commands
-echo "$as_me:11278: checking if you want to display full commands during build" >&5
-echo $ECHO_N "checking if you want to display full commands during build... $ECHO_C" >&6
+
+echo "$as_me:12055: checking if you want to see long compiling messages" >&5
+echo $ECHO_N "checking if you want to see long compiling messages... $ECHO_C" >&6
 
 # Check whether --enable-echo or --disable-echo was given.
 if test "${enable_echo+set}" = set; then
   enableval="$enable_echo"
-  with_echo=$enableval
+  test "$enableval" != no && enableval=yes
+  if test "$enableval" != "yes" ; then
+
+    ECHO_LT='--silent'
+    ECHO_LD='@echo linking $@;'
+    RULE_CC='@echo compiling $<'
+    SHOW_CC='@echo compiling $@'
+    ECHO_CC='@'
+
+  else
+
+    ECHO_LT=''
+    ECHO_LD=''
+    RULE_CC=''
+    SHOW_CC=''
+    ECHO_CC=''
+
+  fi
 else
-  with_echo=yes
+  enableval=yes
+
+    ECHO_LT=''
+    ECHO_LD=''
+    RULE_CC=''
+    SHOW_CC=''
+    ECHO_CC=''
+
 fi;
-if test "$with_echo" = yes; then
+echo "$as_me:12089: result: $enableval" >&5
+echo "${ECHO_T}$enableval" >&6
+
+if test "x$enable_echo" = xyes; then
 	ECHO_LINK=
 else
 	ECHO_LINK='@ echo linking $@ ... ;'
 	test -n "$LIBTOOL" && LIBTOOL="$LIBTOOL --silent"
 	test -n "$LIBTOOL_CXX" && LIBTOOL_CXX="$LIBTOOL_CXX --silent"
 fi
-echo "$as_me:11295: result: $with_echo" >&5
-echo "${ECHO_T}$with_echo" >&6
 
 ###	use option --enable-warnings to turn on all gcc warnings
-echo "$as_me:11299: checking if you want to see compiler warnings" >&5
+echo "$as_me:12101: checking if you want to see compiler warnings" >&5
 echo $ECHO_N "checking if you want to see compiler warnings... $ECHO_C" >&6
 
 # Check whether --enable-warnings or --disable-warnings was given.
@@ -11304,7 +12106,7 @@
   enableval="$enable_warnings"
   with_warnings=$enableval
 fi;
-echo "$as_me:11307: result: $with_warnings" >&5
+echo "$as_me:12109: result: $with_warnings" >&5
 echo "${ECHO_T}$with_warnings" >&6
 
 if test "x$with_warnings" = "xyes"; then
@@ -11316,12 +12118,12 @@
 if test "$GCC" = yes ; then
 	case $host_os in
 	linux*|gnu*)
-		echo "$as_me:11319: checking if this is really Intel C compiler" >&5
+		echo "$as_me:12121: checking if this is really Intel C compiler" >&5
 echo $ECHO_N "checking if this is really Intel C compiler... $ECHO_C" >&6
 		cf_save_CFLAGS="$CFLAGS"
 		CFLAGS="$CFLAGS -no-gcc"
 		cat >conftest.$ac_ext <<_ACEOF
-#line 11324 "configure"
+#line 12126 "configure"
 #include "confdefs.h"
 
 int
@@ -11338,16 +12140,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:11341: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:12143: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:11344: \$? = $ac_status" >&5
+  echo "$as_me:12146: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:11347: \"$ac_try\"") >&5
+  { (eval echo "$as_me:12149: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:11350: \$? = $ac_status" >&5
+  echo "$as_me:12152: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   INTEL_COMPILER=yes
 cf_save_CFLAGS="$cf_save_CFLAGS -we147 -no-gcc"
@@ -11358,14 +12160,63 @@
 fi
 rm -f conftest.$ac_objext conftest.$ac_ext
 		CFLAGS="$cf_save_CFLAGS"
-		echo "$as_me:11361: result: $INTEL_COMPILER" >&5
+		echo "$as_me:12163: result: $INTEL_COMPILER" >&5
 echo "${ECHO_T}$INTEL_COMPILER" >&6
 		;;
 	esac
 fi
 
+CLANG_COMPILER=no
+
+if test "$GCC" = yes ; then
+	echo "$as_me:12172: checking if this is really Clang C compiler" >&5
+echo $ECHO_N "checking if this is really Clang C compiler... $ECHO_C" >&6
+	cf_save_CFLAGS="$CFLAGS"
+	CFLAGS="$CFLAGS -Qunused-arguments"
+	cat >conftest.$ac_ext <<_ACEOF
+#line 12177 "configure"
+#include "confdefs.h"
+
+int
+main ()
+{
+
+#ifdef __clang__
+#else
+make an error
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:12194: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:12197: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:12200: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:12203: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  CLANG_COMPILER=yes
+cf_save_CFLAGS="$cf_save_CFLAGS -Qunused-arguments"
+
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+	CFLAGS="$cf_save_CFLAGS"
+	echo "$as_me:12214: result: $CLANG_COMPILER" >&5
+echo "${ECHO_T}$CLANG_COMPILER" >&6
+fi
+
 cat > conftest.$ac_ext <<EOF
-#line 11368 "${as_me:-configure}"
+#line 12219 "${as_me:-configure}"
 int main(int argc, char *argv[]) { return (argv[argc-1] == 0) ; }
 EOF
 
@@ -11382,7 +12233,7 @@
 # remark #981: operands are evaluated in unspecified order
 # warning #279: controlling expression is constant
 
-	{ echo "$as_me:11385: checking for $CC warning options..." >&5
+	{ echo "$as_me:12236: checking for $CC warning options..." >&5
 echo "$as_me: checking for $CC warning options..." >&6;}
 	cf_save_CFLAGS="$CFLAGS"
 	EXTRA_CFLAGS="-Wall"
@@ -11398,12 +12249,12 @@
 		wd981
 	do
 		CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt"
-		if { (eval echo "$as_me:11401: \"$ac_compile\"") >&5
+		if { (eval echo "$as_me:12252: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:11404: \$? = $ac_status" >&5
+  echo "$as_me:12255: \$? = $ac_status" >&5
   (exit $ac_status); }; then
-			test -n "$verbose" && echo "$as_me:11406: result: ... -$cf_opt" >&5
+			test -n "$verbose" && echo "$as_me:12257: result: ... -$cf_opt" >&5
 echo "${ECHO_T}... -$cf_opt" >&6
 			EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt"
 		fi
@@ -11412,7 +12263,7 @@
 
 elif test "$GCC" = yes
 then
-	{ echo "$as_me:11415: checking for $CC warning options..." >&5
+	{ echo "$as_me:12266: checking for $CC warning options..." >&5
 echo "$as_me: checking for $CC warning options..." >&6;}
 	cf_save_CFLAGS="$CFLAGS"
 	EXTRA_CFLAGS=
@@ -11432,12 +12283,12 @@
 		Wundef $cf_warn_CONST Wdeclaration-after-statement Wextra Wno-unknown-pragmas Wswitch-enum
 	do
 		CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt"
-		if { (eval echo "$as_me:11435: \"$ac_compile\"") >&5
+		if { (eval echo "$as_me:12286: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:11438: \$? = $ac_status" >&5
+  echo "$as_me:12289: \$? = $ac_status" >&5
   (exit $ac_status); }; then
-			test -n "$verbose" && echo "$as_me:11440: result: ... -$cf_opt" >&5
+			test -n "$verbose" && echo "$as_me:12291: result: ... -$cf_opt" >&5
 echo "${ECHO_T}... -$cf_opt" >&6
 			case $cf_opt in #(vi
 			Wcast-qual) #(vi
@@ -11448,7 +12299,17 @@
 				[34].*)
 					test -n "$verbose" && echo "	feature is broken in gcc $GCC_VERSION" 1>&6
 
-echo "${as_me:-configure}:11451: testing feature is broken in gcc $GCC_VERSION ..." 1>&5
+echo "${as_me:-configure}:12302: testing feature is broken in gcc $GCC_VERSION ..." 1>&5
+
+					continue;;
+				esac
+				;;
+			Wpointer-arith) #(vi
+				case $GCC_VERSION in
+				[12].*)
+					test -n "$verbose" && echo "	feature is broken in gcc $GCC_VERSION" 1>&6
+
+echo "${as_me:-configure}:12312: testing feature is broken in gcc $GCC_VERSION ..." 1>&5
 
 					continue;;
 				esac
@@ -11461,19 +12322,19 @@
 fi
 rm -rf conftest*
 
-	if test "$cf_with_cxx" = yes ; then
+	if test "x$cf_with_cxx" = xyes ; then
 
 INTEL_CPLUSPLUS=no
 
 if test "$GCC" = yes ; then
 	case $host_os in
 	linux*|gnu*)
-		echo "$as_me:11471: checking if this is really Intel C++ compiler" >&5
+		echo "$as_me:12332: checking if this is really Intel C++ compiler" >&5
 echo $ECHO_N "checking if this is really Intel C++ compiler... $ECHO_C" >&6
 		cf_save_CFLAGS="$CXXFLAGS"
 		CXXFLAGS="$CXXFLAGS -no-gcc"
 		cat >conftest.$ac_ext <<_ACEOF
-#line 11476 "configure"
+#line 12337 "configure"
 #include "confdefs.h"
 
 int
@@ -11490,16 +12351,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:11493: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:12354: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:11496: \$? = $ac_status" >&5
+  echo "$as_me:12357: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:11499: \"$ac_try\"") >&5
+  { (eval echo "$as_me:12360: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:11502: \$? = $ac_status" >&5
+  echo "$as_me:12363: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   INTEL_CPLUSPLUS=yes
 cf_save_CFLAGS="$cf_save_CFLAGS -we147 -no-gcc"
@@ -11510,12 +12371,61 @@
 fi
 rm -f conftest.$ac_objext conftest.$ac_ext
 		CXXFLAGS="$cf_save_CFLAGS"
-		echo "$as_me:11513: result: $INTEL_CPLUSPLUS" >&5
+		echo "$as_me:12374: result: $INTEL_CPLUSPLUS" >&5
 echo "${ECHO_T}$INTEL_CPLUSPLUS" >&6
 		;;
 	esac
 fi
 
+CLANG_CPLUSPLUS=no
+
+if test "$GCC" = yes ; then
+	echo "$as_me:12383: checking if this is really Clang C++ compiler" >&5
+echo $ECHO_N "checking if this is really Clang C++ compiler... $ECHO_C" >&6
+	cf_save_CFLAGS="$CXXFLAGS"
+	CXXFLAGS="$CXXFLAGS -Qunused-arguments"
+	cat >conftest.$ac_ext <<_ACEOF
+#line 12388 "configure"
+#include "confdefs.h"
+
+int
+main ()
+{
+
+#ifdef __clang__
+#else
+make an error
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:12405: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:12408: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:12411: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:12414: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  CLANG_CPLUSPLUS=yes
+cf_save_CFLAGS="$cf_save_CFLAGS -Qunused-arguments"
+
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+	CXXFLAGS="$cf_save_CFLAGS"
+	echo "$as_me:12425: result: $CLANG_CPLUSPLUS" >&5
+echo "${ECHO_T}$CLANG_CPLUSPLUS" >&6
+fi
+
 ac_ext=cc
 ac_cpp='$CXXCPP $CPPFLAGS'
 ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -11524,7 +12434,7 @@
 ac_main_return=return
 
 cat > conftest.$ac_ext <<EOF
-#line 11527 "configure"
+#line 12437 "configure"
 int main(int argc, char *argv[]) { return (argv[argc-1] == 0) ; }
 EOF
 
@@ -11542,7 +12452,7 @@
 # remark #981: operands are evaluated in unspecified order
 # warning #269: invalid format string conversion
 
-	{ echo "$as_me:11545: checking for $CC warning options..." >&5
+	{ echo "$as_me:12455: checking for $CC warning options..." >&5
 echo "$as_me: checking for $CC warning options..." >&6;}
 	cf_save_CXXFLAGS="$CXXFLAGS"
 	EXTRA_CXXFLAGS="-Wall"
@@ -11559,12 +12469,12 @@
 		wd981
 	do
 		CXXFLAGS="$cf_save_CXXFLAGS $EXTRA_CXXFLAGS -$cf_opt"
-		if { (eval echo "$as_me:11562: \"$ac_compile\"") >&5
+		if { (eval echo "$as_me:12472: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:11565: \$? = $ac_status" >&5
+  echo "$as_me:12475: \$? = $ac_status" >&5
   (exit $ac_status); }; then
-			test -n "$verbose" && echo "$as_me:11567: result: ... -$cf_opt" >&5
+			test -n "$verbose" && echo "$as_me:12477: result: ... -$cf_opt" >&5
 echo "${ECHO_T}... -$cf_opt" >&6
 			EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS -$cf_opt"
 		fi
@@ -11573,7 +12483,7 @@
 
 elif test "$GXX" = yes
 then
-	{ echo "$as_me:11576: checking for $CXX warning options..." >&5
+	{ echo "$as_me:12486: checking for $CXX warning options..." >&5
 echo "$as_me: checking for $CXX warning options..." >&6;}
 	cf_save_CXXFLAGS="$CXXFLAGS"
 	EXTRA_CXXFLAGS="-W -Wall"
@@ -11602,16 +12512,16 @@
 		Wundef $cf_gxx_extra_warnings Wno-unused
 	do
 		CXXFLAGS="$cf_save_CXXFLAGS $EXTRA_CXXFLAGS -Werror -$cf_opt"
-		if { (eval echo "$as_me:11605: \"$ac_compile\"") >&5
+		if { (eval echo "$as_me:12515: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:11608: \$? = $ac_status" >&5
+  echo "$as_me:12518: \$? = $ac_status" >&5
   (exit $ac_status); }; then
-			test -n "$verbose" && echo "$as_me:11610: result: ... -$cf_opt" >&5
+			test -n "$verbose" && echo "$as_me:12520: result: ... -$cf_opt" >&5
 echo "${ECHO_T}... -$cf_opt" >&6
 			EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS -$cf_opt"
 		else
-			test -n "$verbose" && echo "$as_me:11614: result: ... no -$cf_opt" >&5
+			test -n "$verbose" && echo "$as_me:12524: result: ... no -$cf_opt" >&5
 echo "${ECHO_T}... no -$cf_opt" >&6
 		fi
 	done
@@ -11647,10 +12557,10 @@
 EOF
 if test "$GCC" = yes
 then
-	{ echo "$as_me:11650: checking for $CC __attribute__ directives..." >&5
+	{ echo "$as_me:12560: checking for $CC __attribute__ directives..." >&5
 echo "$as_me: checking for $CC __attribute__ directives..." >&6;}
 cat > conftest.$ac_ext <<EOF
-#line 11653 "${as_me:-configure}"
+#line 12563 "${as_me:-configure}"
 #include "confdefs.h"
 #include "conftest.h"
 #include "conftest.i"
@@ -11699,36 +12609,60 @@
 			;;
 		esac
 
-		if { (eval echo "$as_me:11702: \"$ac_compile\"") >&5
+		if { (eval echo "$as_me:12612: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:11705: \$? = $ac_status" >&5
+  echo "$as_me:12615: \$? = $ac_status" >&5
   (exit $ac_status); }; then
-			test -n "$verbose" && echo "$as_me:11707: result: ... $cf_attribute" >&5
+			test -n "$verbose" && echo "$as_me:12617: result: ... $cf_attribute" >&5
 echo "${ECHO_T}... $cf_attribute" >&6
 			cat conftest.h >>confdefs.h
 			case $cf_attribute in #(vi
+			noreturn) #(vi
+
+cat >>confdefs.h <<EOF
+#define GCC_NORETURN $cf_directive
+EOF
+
+				;;
 			printf) #(vi
-				if test "$cf_printf_attribute" = no ; then
-					cat >>confdefs.h <<EOF
-#define GCC_PRINTFLIKE(fmt,var) /* nothing */
-EOF
-				else
-					cat >>confdefs.h <<EOF
-#define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var)))
+				cf_value='/* nothing */'
+				if test "$cf_printf_attribute" != no ; then
+					cf_value='__attribute__((format(printf,fmt,var)))'
+
+cat >>confdefs.h <<\EOF
+#define GCC_PRINTF 1
 EOF
+
 				fi
+
+cat >>confdefs.h <<EOF
+#define GCC_PRINTFLIKE(fmt,var) $cf_value
+EOF
+
 				;;
 			scanf) #(vi
-				if test "$cf_scanf_attribute" = no ; then
-					cat >>confdefs.h <<EOF
-#define GCC_SCANFLIKE(fmt,var) /* nothing */
-EOF
-				else
-					cat >>confdefs.h <<EOF
-#define GCC_SCANFLIKE(fmt,var)  __attribute__((format(scanf,fmt,var)))
+				cf_value='/* nothing */'
+				if test "$cf_scanf_attribute" != no ; then
+					cf_value='__attribute__((format(scanf,fmt,var)))'
+
+cat >>confdefs.h <<\EOF
+#define GCC_SCANF 1
 EOF
+
 				fi
+
+cat >>confdefs.h <<EOF
+#define GCC_SCANFLIKE(fmt,var) $cf_value
+EOF
+
+				;;
+			unused) #(vi
+
+cat >>confdefs.h <<EOF
+#define GCC_UNUSED $cf_directive
+EOF
+
 				;;
 			esac
 		fi
@@ -11739,8 +12673,101 @@
 rm -rf conftest*
 fi
 
+echo "$as_me:12676: checking if you want to work around bogus compiler/loader warnings" >&5
+echo $ECHO_N "checking if you want to work around bogus compiler/loader warnings... $ECHO_C" >&6
+
+# Check whether --enable-string-hacks or --disable-string-hacks was given.
+if test "${enable_string_hacks+set}" = set; then
+  enableval="$enable_string_hacks"
+  with_string_hacks=$enableval
+else
+  with_string_hacks=no
+fi;
+echo "$as_me:12686: result: $with_string_hacks" >&5
+echo "${ECHO_T}$with_string_hacks" >&6
+
+if test "x$with_string_hacks" = "xyes"; then
+
+cat >>confdefs.h <<\EOF
+#define USE_STRING_HACKS 1
+EOF
+
+	{ echo "$as_me:12695: WARNING: enabling string-hacks to work around bogus compiler/loader warnings" >&5
+echo "$as_me: WARNING: enabling string-hacks to work around bogus compiler/loader warnings" >&2;}
+
+for ac_func in strlcat strlcpy snprintf
+do
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+echo "$as_me:12701: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+if eval "test \"\${$as_ac_var+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+#line 12707 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func (); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char $ac_func ();
+char (*f) ();
+
+int
+main ()
+{
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+f = $ac_func; /* workaround for ICC 12.0.3 */ if (f == 0) return 1;
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:12738: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:12741: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:12744: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:12747: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  eval "$as_ac_var=yes"
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+eval "$as_ac_var=no"
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:12757: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+  cat >>confdefs.h <<EOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+EOF
+
+fi
+done
+
+fi
+
 ###	use option --enable-assertions to turn on generation of assertion code
-echo "$as_me:11743: checking if you want to enable runtime assertions" >&5
+echo "$as_me:12770: checking if you want to enable runtime assertions" >&5
 echo $ECHO_N "checking if you want to enable runtime assertions... $ECHO_C" >&6
 
 # Check whether --enable-assertions or --disable-assertions was given.
@@ -11750,16 +12777,12 @@
 else
   with_assertions=no
 fi;
-echo "$as_me:11753: result: $with_assertions" >&5
+echo "$as_me:12780: result: $with_assertions" >&5
 echo "${ECHO_T}$with_assertions" >&6
 if test -n "$GCC"
 then
 	if test "$with_assertions" = no
 	then
-		cat >>confdefs.h <<\EOF
-#define NDEBUG 1
-EOF
-
 		CPPFLAGS="$CPPFLAGS -DNDEBUG"
 	else
 
@@ -11770,13 +12793,14 @@
 
 ###	use option --disable-leaks to suppress "permanent" leaks, for testing
 
-echo "$as_me:11773: checking if you want to use dmalloc for testing" >&5
+echo "$as_me:12796: checking if you want to use dmalloc for testing" >&5
 echo $ECHO_N "checking if you want to use dmalloc for testing... $ECHO_C" >&6
 
 # Check whether --with-dmalloc or --without-dmalloc was given.
 if test "${with_dmalloc+set}" = set; then
   withval="$with_dmalloc"
-  cat >>confdefs.h <<\EOF
+
+cat >>confdefs.h <<EOF
 #define USE_DMALLOC 1
 EOF
 
@@ -11786,7 +12810,7 @@
 else
   with_dmalloc=
 fi;
-echo "$as_me:11789: result: ${with_dmalloc:-no}" >&5
+echo "$as_me:12813: result: ${with_dmalloc:-no}" >&5
 echo "${ECHO_T}${with_dmalloc:-no}" >&6
 
 case .$with_cflags in #(vi
@@ -11880,23 +12904,23 @@
 esac
 
 if test "$with_dmalloc" = yes ; then
-	echo "$as_me:11883: checking for dmalloc.h" >&5
+	echo "$as_me:12907: checking for dmalloc.h" >&5
 echo $ECHO_N "checking for dmalloc.h... $ECHO_C" >&6
 if test "${ac_cv_header_dmalloc_h+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 11889 "configure"
+#line 12913 "configure"
 #include "confdefs.h"
 #include <dmalloc.h>
 _ACEOF
-if { (eval echo "$as_me:11893: \"$ac_cpp conftest.$ac_ext\"") >&5
+if { (eval echo "$as_me:12917: \"$ac_cpp conftest.$ac_ext\"") >&5
   (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
   ac_status=$?
   egrep -v '^ *\+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
-  echo "$as_me:11899: \$? = $ac_status" >&5
+  echo "$as_me:12923: \$? = $ac_status" >&5
   (exit $ac_status); } >/dev/null; then
   if test -s conftest.err; then
     ac_cpp_err=$ac_c_preproc_warn_flag
@@ -11915,11 +12939,11 @@
 fi
 rm -f conftest.err conftest.$ac_ext
 fi
-echo "$as_me:11918: result: $ac_cv_header_dmalloc_h" >&5
+echo "$as_me:12942: result: $ac_cv_header_dmalloc_h" >&5
 echo "${ECHO_T}$ac_cv_header_dmalloc_h" >&6
 if test $ac_cv_header_dmalloc_h = yes; then
 
-echo "$as_me:11922: checking for dmalloc_debug in -ldmalloc" >&5
+echo "$as_me:12946: checking for dmalloc_debug in -ldmalloc" >&5
 echo $ECHO_N "checking for dmalloc_debug in -ldmalloc... $ECHO_C" >&6
 if test "${ac_cv_lib_dmalloc_dmalloc_debug+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -11927,7 +12951,7 @@
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-ldmalloc  $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
-#line 11930 "configure"
+#line 12954 "configure"
 #include "confdefs.h"
 
 /* Override any gcc2 internal prototype to avoid an error.  */
@@ -11946,16 +12970,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:11949: \"$ac_link\"") >&5
+if { (eval echo "$as_me:12973: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:11952: \$? = $ac_status" >&5
+  echo "$as_me:12976: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:11955: \"$ac_try\"") >&5
+  { (eval echo "$as_me:12979: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:11958: \$? = $ac_status" >&5
+  echo "$as_me:12982: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_lib_dmalloc_dmalloc_debug=yes
 else
@@ -11966,7 +12990,7 @@
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-echo "$as_me:11969: result: $ac_cv_lib_dmalloc_dmalloc_debug" >&5
+echo "$as_me:12993: result: $ac_cv_lib_dmalloc_dmalloc_debug" >&5
 echo "${ECHO_T}$ac_cv_lib_dmalloc_dmalloc_debug" >&6
 if test $ac_cv_lib_dmalloc_dmalloc_debug = yes; then
   cat >>confdefs.h <<EOF
@@ -11981,13 +13005,14 @@
 
 fi
 
-echo "$as_me:11984: checking if you want to use dbmalloc for testing" >&5
+echo "$as_me:13008: checking if you want to use dbmalloc for testing" >&5
 echo $ECHO_N "checking if you want to use dbmalloc for testing... $ECHO_C" >&6
 
 # Check whether --with-dbmalloc or --without-dbmalloc was given.
 if test "${with_dbmalloc+set}" = set; then
   withval="$with_dbmalloc"
-  cat >>confdefs.h <<\EOF
+
+cat >>confdefs.h <<EOF
 #define USE_DBMALLOC 1
 EOF
 
@@ -11997,7 +13022,7 @@
 else
   with_dbmalloc=
 fi;
-echo "$as_me:12000: result: ${with_dbmalloc:-no}" >&5
+echo "$as_me:13025: result: ${with_dbmalloc:-no}" >&5
 echo "${ECHO_T}${with_dbmalloc:-no}" >&6
 
 case .$with_cflags in #(vi
@@ -12091,23 +13116,23 @@
 esac
 
 if test "$with_dbmalloc" = yes ; then
-	echo "$as_me:12094: checking for dbmalloc.h" >&5
+	echo "$as_me:13119: checking for dbmalloc.h" >&5
 echo $ECHO_N "checking for dbmalloc.h... $ECHO_C" >&6
 if test "${ac_cv_header_dbmalloc_h+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 12100 "configure"
+#line 13125 "configure"
 #include "confdefs.h"
 #include <dbmalloc.h>
 _ACEOF
-if { (eval echo "$as_me:12104: \"$ac_cpp conftest.$ac_ext\"") >&5
+if { (eval echo "$as_me:13129: \"$ac_cpp conftest.$ac_ext\"") >&5
   (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
   ac_status=$?
   egrep -v '^ *\+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
-  echo "$as_me:12110: \$? = $ac_status" >&5
+  echo "$as_me:13135: \$? = $ac_status" >&5
   (exit $ac_status); } >/dev/null; then
   if test -s conftest.err; then
     ac_cpp_err=$ac_c_preproc_warn_flag
@@ -12126,11 +13151,11 @@
 fi
 rm -f conftest.err conftest.$ac_ext
 fi
-echo "$as_me:12129: result: $ac_cv_header_dbmalloc_h" >&5
+echo "$as_me:13154: result: $ac_cv_header_dbmalloc_h" >&5
 echo "${ECHO_T}$ac_cv_header_dbmalloc_h" >&6
 if test $ac_cv_header_dbmalloc_h = yes; then
 
-echo "$as_me:12133: checking for debug_malloc in -ldbmalloc" >&5
+echo "$as_me:13158: checking for debug_malloc in -ldbmalloc" >&5
 echo $ECHO_N "checking for debug_malloc in -ldbmalloc... $ECHO_C" >&6
 if test "${ac_cv_lib_dbmalloc_debug_malloc+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -12138,7 +13163,7 @@
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-ldbmalloc  $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
-#line 12141 "configure"
+#line 13166 "configure"
 #include "confdefs.h"
 
 /* Override any gcc2 internal prototype to avoid an error.  */
@@ -12157,16 +13182,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:12160: \"$ac_link\"") >&5
+if { (eval echo "$as_me:13185: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:12163: \$? = $ac_status" >&5
+  echo "$as_me:13188: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:12166: \"$ac_try\"") >&5
+  { (eval echo "$as_me:13191: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:12169: \$? = $ac_status" >&5
+  echo "$as_me:13194: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_lib_dbmalloc_debug_malloc=yes
 else
@@ -12177,7 +13202,7 @@
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-echo "$as_me:12180: result: $ac_cv_lib_dbmalloc_debug_malloc" >&5
+echo "$as_me:13205: result: $ac_cv_lib_dbmalloc_debug_malloc" >&5
 echo "${ECHO_T}$ac_cv_lib_dbmalloc_debug_malloc" >&6
 if test $ac_cv_lib_dbmalloc_debug_malloc = yes; then
   cat >>confdefs.h <<EOF
@@ -12192,13 +13217,14 @@
 
 fi
 
-echo "$as_me:12195: checking if you want to use valgrind for testing" >&5
+echo "$as_me:13220: checking if you want to use valgrind for testing" >&5
 echo $ECHO_N "checking if you want to use valgrind for testing... $ECHO_C" >&6
 
 # Check whether --with-valgrind or --without-valgrind was given.
 if test "${with_valgrind+set}" = set; then
   withval="$with_valgrind"
-  cat >>confdefs.h <<\EOF
+
+cat >>confdefs.h <<EOF
 #define USE_VALGRIND 1
 EOF
 
@@ -12208,7 +13234,7 @@
 else
   with_valgrind=
 fi;
-echo "$as_me:12211: result: ${with_valgrind:-no}" >&5
+echo "$as_me:13237: result: ${with_valgrind:-no}" >&5
 echo "${ECHO_T}${with_valgrind:-no}" >&6
 
 case .$with_cflags in #(vi
@@ -12301,7 +13327,7 @@
 	;;
 esac
 
-echo "$as_me:12304: checking if you want to perform memory-leak testing" >&5
+echo "$as_me:13330: checking if you want to perform memory-leak testing" >&5
 echo $ECHO_N "checking if you want to perform memory-leak testing... $ECHO_C" >&6
 
 # Check whether --enable-leaks or --disable-leaks was given.
@@ -12311,15 +13337,16 @@
 else
   : ${with_no_leaks:=no}
 fi;
-echo "$as_me:12314: result: $with_no_leaks" >&5
+echo "$as_me:13340: result: $with_no_leaks" >&5
 echo "${ECHO_T}$with_no_leaks" >&6
 
 if test "$with_no_leaks" = yes ; then
-	cat >>confdefs.h <<\EOF
+
+cat >>confdefs.h <<\EOF
 #define NO_LEAKS 1
 EOF
 
-	cat >>confdefs.h <<\EOF
+cat >>confdefs.h <<\EOF
 #define YY_NO_LEAKS 1
 EOF
 
@@ -12334,7 +13361,8 @@
 # Check whether --enable-expanded or --disable-expanded was given.
 if test "${enable_expanded+set}" = set; then
   enableval="$enable_expanded"
-  test "$enableval" = yes && cat >>confdefs.h <<\EOF
+  test "x$enableval" = xyes &&
+cat >>confdefs.h <<\EOF
 #define NCURSES_EXPANDED 1
 EOF
 
@@ -12345,7 +13373,8 @@
 # Check whether --enable-macros or --disable-macros was given.
 if test "${enable_macros+set}" = set; then
   enableval="$enable_macros"
-  test "$enableval" = no && cat >>confdefs.h <<\EOF
+  test "$enableval" = no &&
+cat >>confdefs.h <<\EOF
 #define NCURSES_NOMACROS 1
 EOF
 
@@ -12360,7 +13389,7 @@
 	;;
 esac
 
-echo "$as_me:12363: checking whether to add trace feature to all models" >&5
+echo "$as_me:13392: checking whether to add trace feature to all models" >&5
 echo $ECHO_N "checking whether to add trace feature to all models... $ECHO_C" >&6
 
 # Check whether --with-trace or --without-trace was given.
@@ -12370,10 +13399,10 @@
 else
   cf_with_trace=$cf_all_traces
 fi;
-echo "$as_me:12373: result: $cf_with_trace" >&5
+echo "$as_me:13402: result: $cf_with_trace" >&5
 echo "${ECHO_T}$cf_with_trace" >&6
 
-if test "$cf_with_trace" = yes ; then
+if test "x$cf_with_trace" = xyes ; then
 	LIB_TRACING=all
 	ADA_TRACE=TRUE
 
@@ -12465,13 +13494,13 @@
 *mingw32*) #(vi
 	;;
 *)
-echo "$as_me:12468: checking for gettimeofday" >&5
+echo "$as_me:13497: checking for gettimeofday" >&5
 echo $ECHO_N "checking for gettimeofday... $ECHO_C" >&6
 if test "${ac_cv_func_gettimeofday+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 12474 "configure"
+#line 13503 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char gettimeofday (); below.  */
@@ -12494,7 +13523,7 @@
 #if defined (__stub_gettimeofday) || defined (__stub___gettimeofday)
 choke me
 #else
-f = gettimeofday;
+f = gettimeofday; /* workaround for ICC 12.0.3 */ if (f == 0) return 1;
 #endif
 
   ;
@@ -12502,16 +13531,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:12505: \"$ac_link\"") >&5
+if { (eval echo "$as_me:13534: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:12508: \$? = $ac_status" >&5
+  echo "$as_me:13537: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:12511: \"$ac_try\"") >&5
+  { (eval echo "$as_me:13540: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:12514: \$? = $ac_status" >&5
+  echo "$as_me:13543: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_func_gettimeofday=yes
 else
@@ -12521,16 +13550,17 @@
 fi
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 fi
-echo "$as_me:12524: result: $ac_cv_func_gettimeofday" >&5
+echo "$as_me:13553: result: $ac_cv_func_gettimeofday" >&5
 echo "${ECHO_T}$ac_cv_func_gettimeofday" >&6
 if test $ac_cv_func_gettimeofday = yes; then
-  cat >>confdefs.h <<\EOF
+
+cat >>confdefs.h <<\EOF
 #define HAVE_GETTIMEOFDAY 1
 EOF
 
 else
 
-echo "$as_me:12533: checking for gettimeofday in -lbsd" >&5
+echo "$as_me:13563: checking for gettimeofday in -lbsd" >&5
 echo $ECHO_N "checking for gettimeofday in -lbsd... $ECHO_C" >&6
 if test "${ac_cv_lib_bsd_gettimeofday+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -12538,7 +13568,7 @@
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lbsd  $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
-#line 12541 "configure"
+#line 13571 "configure"
 #include "confdefs.h"
 
 /* Override any gcc2 internal prototype to avoid an error.  */
@@ -12557,16 +13587,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:12560: \"$ac_link\"") >&5
+if { (eval echo "$as_me:13590: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:12563: \$? = $ac_status" >&5
+  echo "$as_me:13593: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:12566: \"$ac_try\"") >&5
+  { (eval echo "$as_me:13596: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:12569: \$? = $ac_status" >&5
+  echo "$as_me:13599: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_lib_bsd_gettimeofday=yes
 else
@@ -12577,10 +13607,11 @@
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-echo "$as_me:12580: result: $ac_cv_lib_bsd_gettimeofday" >&5
+echo "$as_me:13610: result: $ac_cv_lib_bsd_gettimeofday" >&5
 echo "${ECHO_T}$ac_cv_lib_bsd_gettimeofday" >&6
 if test $ac_cv_lib_bsd_gettimeofday = yes; then
-  cat >>confdefs.h <<\EOF
+
+cat >>confdefs.h <<\EOF
 #define HAVE_GETTIMEOFDAY 1
 EOF
 
@@ -12591,14 +13622,14 @@
 	;;
 esac
 
-echo "$as_me:12594: checking if -lm needed for math functions" >&5
+echo "$as_me:13625: checking if -lm needed for math functions" >&5
 echo $ECHO_N "checking if -lm needed for math functions... $ECHO_C" >&6
 if test "${cf_cv_need_libm+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
 
 	cat >conftest.$ac_ext <<_ACEOF
-#line 12601 "configure"
+#line 13632 "configure"
 #include "confdefs.h"
 
 	#include <stdio.h>
@@ -12613,16 +13644,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:12616: \"$ac_link\"") >&5
+if { (eval echo "$as_me:13647: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:12619: \$? = $ac_status" >&5
+  echo "$as_me:13650: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:12622: \"$ac_try\"") >&5
+  { (eval echo "$as_me:13653: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:12625: \$? = $ac_status" >&5
+  echo "$as_me:13656: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   cf_cv_need_libm=no
 else
@@ -12632,7 +13663,7 @@
 fi
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 fi
-echo "$as_me:12635: result: $cf_cv_need_libm" >&5
+echo "$as_me:13666: result: $cf_cv_need_libm" >&5
 echo "${ECHO_T}$cf_cv_need_libm" >&6
 if test "$cf_cv_need_libm" = yes
 then
@@ -12640,13 +13671,13 @@
 fi
 
 ###	Checks for header files.
-echo "$as_me:12643: checking for ANSI C header files" >&5
+echo "$as_me:13674: checking for ANSI C header files" >&5
 echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6
 if test "${ac_cv_header_stdc+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 12649 "configure"
+#line 13680 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 #include <stdarg.h>
@@ -12654,13 +13685,13 @@
 #include <float.h>
 
 _ACEOF
-if { (eval echo "$as_me:12657: \"$ac_cpp conftest.$ac_ext\"") >&5
+if { (eval echo "$as_me:13688: \"$ac_cpp conftest.$ac_ext\"") >&5
   (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
   ac_status=$?
   egrep -v '^ *\+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
-  echo "$as_me:12663: \$? = $ac_status" >&5
+  echo "$as_me:13694: \$? = $ac_status" >&5
   (exit $ac_status); } >/dev/null; then
   if test -s conftest.err; then
     ac_cpp_err=$ac_c_preproc_warn_flag
@@ -12682,7 +13713,7 @@
 if test $ac_cv_header_stdc = yes; then
   # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
   cat >conftest.$ac_ext <<_ACEOF
-#line 12685 "configure"
+#line 13716 "configure"
 #include "confdefs.h"
 #include <string.h>
 
@@ -12700,7 +13731,7 @@
 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 <<_ACEOF
-#line 12703 "configure"
+#line 13734 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 
@@ -12721,7 +13752,7 @@
   :
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 12724 "configure"
+#line 13755 "configure"
 #include "confdefs.h"
 #include <ctype.h>
 #if ((' ' & 0x0FF) == 0x020)
@@ -12747,15 +13778,15 @@
 }
 _ACEOF
 rm -f conftest$ac_exeext
-if { (eval echo "$as_me:12750: \"$ac_link\"") >&5
+if { (eval echo "$as_me:13781: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:12753: \$? = $ac_status" >&5
+  echo "$as_me:13784: \$? = $ac_status" >&5
   (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (eval echo "$as_me:12755: \"$ac_try\"") >&5
+  { (eval echo "$as_me:13786: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:12758: \$? = $ac_status" >&5
+  echo "$as_me:13789: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   :
 else
@@ -12768,7 +13799,7 @@
 fi
 fi
 fi
-echo "$as_me:12771: result: $ac_cv_header_stdc" >&5
+echo "$as_me:13802: result: $ac_cv_header_stdc" >&5
 echo "${ECHO_T}$ac_cv_header_stdc" >&6
 if test $ac_cv_header_stdc = yes; then
 
@@ -12781,13 +13812,13 @@
 ac_header_dirent=no
 for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do
   as_ac_Header=`echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh`
-echo "$as_me:12784: checking for $ac_hdr that defines DIR" >&5
+echo "$as_me:13815: checking for $ac_hdr that defines DIR" >&5
 echo $ECHO_N "checking for $ac_hdr that defines DIR... $ECHO_C" >&6
 if eval "test \"\${$as_ac_Header+set}\" = set"; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 12790 "configure"
+#line 13821 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <$ac_hdr>
@@ -12802,16 +13833,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:12805: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:13836: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:12808: \$? = $ac_status" >&5
+  echo "$as_me:13839: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:12811: \"$ac_try\"") >&5
+  { (eval echo "$as_me:13842: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:12814: \$? = $ac_status" >&5
+  echo "$as_me:13845: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   eval "$as_ac_Header=yes"
 else
@@ -12821,7 +13852,7 @@
 fi
 rm -f conftest.$ac_objext conftest.$ac_ext
 fi
-echo "$as_me:12824: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "$as_me:13855: result: `eval echo '${'$as_ac_Header'}'`" >&5
 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
 if test `eval echo '${'$as_ac_Header'}'` = yes; then
   cat >>confdefs.h <<EOF
@@ -12834,7 +13865,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 "$as_me:12837: checking for opendir in -ldir" >&5
+  echo "$as_me:13868: checking for opendir in -ldir" >&5
 echo $ECHO_N "checking for opendir in -ldir... $ECHO_C" >&6
 if test "${ac_cv_lib_dir_opendir+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -12842,7 +13873,7 @@
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-ldir  $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
-#line 12845 "configure"
+#line 13876 "configure"
 #include "confdefs.h"
 
 /* Override any gcc2 internal prototype to avoid an error.  */
@@ -12861,16 +13892,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:12864: \"$ac_link\"") >&5
+if { (eval echo "$as_me:13895: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:12867: \$? = $ac_status" >&5
+  echo "$as_me:13898: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:12870: \"$ac_try\"") >&5
+  { (eval echo "$as_me:13901: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:12873: \$? = $ac_status" >&5
+  echo "$as_me:13904: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_lib_dir_opendir=yes
 else
@@ -12881,14 +13912,14 @@
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-echo "$as_me:12884: result: $ac_cv_lib_dir_opendir" >&5
+echo "$as_me:13915: result: $ac_cv_lib_dir_opendir" >&5
 echo "${ECHO_T}$ac_cv_lib_dir_opendir" >&6
 if test $ac_cv_lib_dir_opendir = yes; then
   LIBS="$LIBS -ldir"
 fi
 
 else
-  echo "$as_me:12891: checking for opendir in -lx" >&5
+  echo "$as_me:13922: checking for opendir in -lx" >&5
 echo $ECHO_N "checking for opendir in -lx... $ECHO_C" >&6
 if test "${ac_cv_lib_x_opendir+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -12896,7 +13927,7 @@
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lx  $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
-#line 12899 "configure"
+#line 13930 "configure"
 #include "confdefs.h"
 
 /* Override any gcc2 internal prototype to avoid an error.  */
@@ -12915,16 +13946,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:12918: \"$ac_link\"") >&5
+if { (eval echo "$as_me:13949: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:12921: \$? = $ac_status" >&5
+  echo "$as_me:13952: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:12924: \"$ac_try\"") >&5
+  { (eval echo "$as_me:13955: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:12927: \$? = $ac_status" >&5
+  echo "$as_me:13958: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_lib_x_opendir=yes
 else
@@ -12935,7 +13966,7 @@
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-echo "$as_me:12938: result: $ac_cv_lib_x_opendir" >&5
+echo "$as_me:13969: result: $ac_cv_lib_x_opendir" >&5
 echo "${ECHO_T}$ac_cv_lib_x_opendir" >&6
 if test $ac_cv_lib_x_opendir = yes; then
   LIBS="$LIBS -lx"
@@ -12943,13 +13974,13 @@
 
 fi
 
-echo "$as_me:12946: checking whether time.h and sys/time.h may both be included" >&5
+echo "$as_me:13977: checking whether time.h and sys/time.h may both be included" >&5
 echo $ECHO_N "checking whether time.h and sys/time.h may both be included... $ECHO_C" >&6
 if test "${ac_cv_header_time+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 12952 "configure"
+#line 13983 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/time.h>
@@ -12965,16 +13996,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:12968: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:13999: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:12971: \$? = $ac_status" >&5
+  echo "$as_me:14002: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:12974: \"$ac_try\"") >&5
+  { (eval echo "$as_me:14005: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:12977: \$? = $ac_status" >&5
+  echo "$as_me:14008: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_header_time=yes
 else
@@ -12984,7 +14015,7 @@
 fi
 rm -f conftest.$ac_objext conftest.$ac_ext
 fi
-echo "$as_me:12987: result: $ac_cv_header_time" >&5
+echo "$as_me:14018: result: $ac_cv_header_time" >&5
 echo "${ECHO_T}$ac_cv_header_time" >&6
 if test $ac_cv_header_time = yes; then
 
@@ -12999,17 +14030,17 @@
 cf_regex_libs="regex re"
 case $host_os in #(vi
 mingw*)
-	cf_regex_libs="regex.dll $cf_regex_libs"
+	cf_regex_libs="gnurx $cf_regex_libs"
 	;;
 esac
 
-echo "$as_me:13006: checking for regcomp" >&5
+echo "$as_me:14037: checking for regcomp" >&5
 echo $ECHO_N "checking for regcomp... $ECHO_C" >&6
 if test "${ac_cv_func_regcomp+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 13012 "configure"
+#line 14043 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char regcomp (); below.  */
@@ -13032,7 +14063,7 @@
 #if defined (__stub_regcomp) || defined (__stub___regcomp)
 choke me
 #else
-f = regcomp;
+f = regcomp; /* workaround for ICC 12.0.3 */ if (f == 0) return 1;
 #endif
 
   ;
@@ -13040,16 +14071,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:13043: \"$ac_link\"") >&5
+if { (eval echo "$as_me:14074: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:13046: \$? = $ac_status" >&5
+  echo "$as_me:14077: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:13049: \"$ac_try\"") >&5
+  { (eval echo "$as_me:14080: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:13052: \$? = $ac_status" >&5
+  echo "$as_me:14083: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_func_regcomp=yes
 else
@@ -13059,7 +14090,7 @@
 fi
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 fi
-echo "$as_me:13062: result: $ac_cv_func_regcomp" >&5
+echo "$as_me:14093: result: $ac_cv_func_regcomp" >&5
 echo "${ECHO_T}$ac_cv_func_regcomp" >&6
 if test $ac_cv_func_regcomp = yes; then
   cf_regex_func=regcomp
@@ -13068,7 +14099,7 @@
 	for cf_regex_lib in $cf_regex_libs
 	do
 		as_ac_Lib=`echo "ac_cv_lib_$cf_regex_lib''_regcomp" | $as_tr_sh`
-echo "$as_me:13071: checking for regcomp in -l$cf_regex_lib" >&5
+echo "$as_me:14102: checking for regcomp in -l$cf_regex_lib" >&5
 echo $ECHO_N "checking for regcomp in -l$cf_regex_lib... $ECHO_C" >&6
 if eval "test \"\${$as_ac_Lib+set}\" = set"; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -13076,7 +14107,7 @@
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-l$cf_regex_lib  $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
-#line 13079 "configure"
+#line 14110 "configure"
 #include "confdefs.h"
 
 /* Override any gcc2 internal prototype to avoid an error.  */
@@ -13095,16 +14126,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:13098: \"$ac_link\"") >&5
+if { (eval echo "$as_me:14129: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:13101: \$? = $ac_status" >&5
+  echo "$as_me:14132: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:13104: \"$ac_try\"") >&5
+  { (eval echo "$as_me:14135: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:13107: \$? = $ac_status" >&5
+  echo "$as_me:14138: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   eval "$as_ac_Lib=yes"
 else
@@ -13115,7 +14146,7 @@
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-echo "$as_me:13118: result: `eval echo '${'$as_ac_Lib'}'`" >&5
+echo "$as_me:14149: result: `eval echo '${'$as_ac_Lib'}'`" >&5
 echo "${ECHO_T}`eval echo '${'$as_ac_Lib'}'`" >&6
 if test `eval echo '${'$as_ac_Lib'}'` = yes; then
 
@@ -13129,13 +14160,13 @@
 fi
 
 if test "$cf_regex_func" = no ; then
-	echo "$as_me:13132: checking for compile" >&5
+	echo "$as_me:14163: checking for compile" >&5
 echo $ECHO_N "checking for compile... $ECHO_C" >&6
 if test "${ac_cv_func_compile+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 13138 "configure"
+#line 14169 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char compile (); below.  */
@@ -13158,7 +14189,7 @@
 #if defined (__stub_compile) || defined (__stub___compile)
 choke me
 #else
-f = compile;
+f = compile; /* workaround for ICC 12.0.3 */ if (f == 0) return 1;
 #endif
 
   ;
@@ -13166,16 +14197,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:13169: \"$ac_link\"") >&5
+if { (eval echo "$as_me:14200: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:13172: \$? = $ac_status" >&5
+  echo "$as_me:14203: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:13175: \"$ac_try\"") >&5
+  { (eval echo "$as_me:14206: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:13178: \$? = $ac_status" >&5
+  echo "$as_me:14209: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_func_compile=yes
 else
@@ -13185,13 +14216,13 @@
 fi
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 fi
-echo "$as_me:13188: result: $ac_cv_func_compile" >&5
+echo "$as_me:14219: result: $ac_cv_func_compile" >&5
 echo "${ECHO_T}$ac_cv_func_compile" >&6
 if test $ac_cv_func_compile = yes; then
   cf_regex_func=compile
 else
 
-		echo "$as_me:13194: checking for compile in -lgen" >&5
+		echo "$as_me:14225: checking for compile in -lgen" >&5
 echo $ECHO_N "checking for compile in -lgen... $ECHO_C" >&6
 if test "${ac_cv_lib_gen_compile+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -13199,7 +14230,7 @@
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lgen  $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
-#line 13202 "configure"
+#line 14233 "configure"
 #include "confdefs.h"
 
 /* Override any gcc2 internal prototype to avoid an error.  */
@@ -13218,16 +14249,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:13221: \"$ac_link\"") >&5
+if { (eval echo "$as_me:14252: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:13224: \$? = $ac_status" >&5
+  echo "$as_me:14255: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:13227: \"$ac_try\"") >&5
+  { (eval echo "$as_me:14258: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:13230: \$? = $ac_status" >&5
+  echo "$as_me:14261: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_lib_gen_compile=yes
 else
@@ -13238,7 +14269,7 @@
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-echo "$as_me:13241: result: $ac_cv_lib_gen_compile" >&5
+echo "$as_me:14272: result: $ac_cv_lib_gen_compile" >&5
 echo "${ECHO_T}$ac_cv_lib_gen_compile" >&6
 if test $ac_cv_lib_gen_compile = yes; then
 
@@ -13251,11 +14282,11 @@
 fi
 
 if test "$cf_regex_func" = no ; then
-	{ echo "$as_me:13254: WARNING: cannot find regular expression library" >&5
+	{ echo "$as_me:14285: WARNING: cannot find regular expression library" >&5
 echo "$as_me: WARNING: cannot find regular expression library" >&2;}
 fi
 
-echo "$as_me:13258: checking for regular-expression headers" >&5
+echo "$as_me:14289: checking for regular-expression headers" >&5
 echo $ECHO_N "checking for regular-expression headers... $ECHO_C" >&6
 if test "${cf_cv_regex_hdrs+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -13267,7 +14298,7 @@
 	for cf_regex_hdr in regexp.h regexpr.h
 	do
 		cat >conftest.$ac_ext <<_ACEOF
-#line 13270 "configure"
+#line 14301 "configure"
 #include "confdefs.h"
 #include <$cf_regex_hdr>
 int
@@ -13282,16 +14313,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:13285: \"$ac_link\"") >&5
+if { (eval echo "$as_me:14316: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:13288: \$? = $ac_status" >&5
+  echo "$as_me:14319: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:13291: \"$ac_try\"") >&5
+  { (eval echo "$as_me:14322: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:13294: \$? = $ac_status" >&5
+  echo "$as_me:14325: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
 
 			cf_cv_regex_hdrs=$cf_regex_hdr
@@ -13308,7 +14339,7 @@
 	for cf_regex_hdr in regex.h
 	do
 		cat >conftest.$ac_ext <<_ACEOF
-#line 13311 "configure"
+#line 14342 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <$cf_regex_hdr>
@@ -13326,16 +14357,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:13329: \"$ac_link\"") >&5
+if { (eval echo "$as_me:14360: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:13332: \$? = $ac_status" >&5
+  echo "$as_me:14363: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:13335: \"$ac_try\"") >&5
+  { (eval echo "$as_me:14366: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:13338: \$? = $ac_status" >&5
+  echo "$as_me:14369: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
 
 			cf_cv_regex_hdrs=$cf_regex_hdr
@@ -13351,21 +14382,24 @@
 esac
 
 fi
-echo "$as_me:13354: result: $cf_cv_regex_hdrs" >&5
+echo "$as_me:14385: result: $cf_cv_regex_hdrs" >&5
 echo "${ECHO_T}$cf_cv_regex_hdrs" >&6
 
 case $cf_cv_regex_hdrs in #(vi
-    no)	       { echo "$as_me:13358: WARNING: no regular expression header found" >&5
+    no)	       { echo "$as_me:14389: WARNING: no regular expression header found" >&5
 echo "$as_me: WARNING: no regular expression header found" >&2;} ;; #(vi
-    regex.h)   cat >>confdefs.h <<\EOF
+    regex.h)
+cat >>confdefs.h <<\EOF
 #define HAVE_REGEX_H_FUNCS 1
 EOF
  ;; #(vi
-    regexp.h)  cat >>confdefs.h <<\EOF
+    regexp.h)
+cat >>confdefs.h <<\EOF
 #define HAVE_REGEXP_H_FUNCS 1
 EOF
  ;; #(vi
-    regexpr.h) cat >>confdefs.h <<\EOF
+    regexpr.h)
+cat >>confdefs.h <<\EOF
 #define HAVE_REGEXPR_H_FUNCS 1
 EOF
  ;;
@@ -13391,23 +14425,71 @@
 
 do
 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-echo "$as_me:13394: checking for $ac_header" >&5
+echo "$as_me:14428: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+#line 14434 "configure"
+#include "confdefs.h"
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:14438: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  egrep -v '^ *\+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:14444: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  eval "$as_ac_Header=yes"
+else
+  echo "$as_me: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  eval "$as_ac_Header=no"
+fi
+rm -f conftest.err conftest.$ac_ext
+fi
+echo "$as_me:14463: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<EOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+EOF
+
+fi
+done
+
+for ac_header in unistd.h getopt.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+echo "$as_me:14476: checking for $ac_header" >&5
 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
 if eval "test \"\${$as_ac_Header+set}\" = set"; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 13400 "configure"
+#line 14482 "configure"
 #include "confdefs.h"
 #include <$ac_header>
 _ACEOF
-if { (eval echo "$as_me:13404: \"$ac_cpp conftest.$ac_ext\"") >&5
+if { (eval echo "$as_me:14486: \"$ac_cpp conftest.$ac_ext\"") >&5
   (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
   ac_status=$?
   egrep -v '^ *\+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
-  echo "$as_me:13410: \$? = $ac_status" >&5
+  echo "$as_me:14492: \$? = $ac_status" >&5
   (exit $ac_status); } >/dev/null; then
   if test -s conftest.err; then
     ac_cpp_err=$ac_c_preproc_warn_flag
@@ -13426,7 +14508,7 @@
 fi
 rm -f conftest.err conftest.$ac_ext
 fi
-echo "$as_me:13429: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "$as_me:14511: result: `eval echo '${'$as_ac_Header'}'`" >&5
 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
 if test `eval echo '${'$as_ac_Header'}'` = yes; then
   cat >>confdefs.h <<EOF
@@ -13436,11 +14518,65 @@
 fi
 done
 
+echo "$as_me:14521: checking for header declaring getopt variables" >&5
+echo $ECHO_N "checking for header declaring getopt variables... $ECHO_C" >&6
+if test "${cf_cv_getopt_header+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+cf_cv_getopt_header=none
+for cf_header in stdio.h stdlib.h unistd.h getopt.h
+do
+cat >conftest.$ac_ext <<_ACEOF
+#line 14531 "configure"
+#include "confdefs.h"
+
+#include <$cf_header>
+int
+main ()
+{
+int x = optind; char *y = optarg
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:14544: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:14547: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:14550: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:14553: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  cf_cv_getopt_header=$cf_header
+ break
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+done
+
+fi
+echo "$as_me:14565: result: $cf_cv_getopt_header" >&5
+echo "${ECHO_T}$cf_cv_getopt_header" >&6
+if test $cf_cv_getopt_header != none ; then
+
+cat >>confdefs.h <<\EOF
+#define HAVE_GETOPT_HEADER 1
+EOF
+
+fi
+
 # check for ISC (this may also define _POSIX_SOURCE)
 # Note: even non-Posix ISC needs <sys/bsdtypes.h> to declare fd_set
-if test "$ISC" = yes ; then
+if test "x$ISC" = xyes ; then
 
-echo "$as_me:13443: checking for main in -lcposix" >&5
+echo "$as_me:14579: checking for main in -lcposix" >&5
 echo $ECHO_N "checking for main in -lcposix... $ECHO_C" >&6
 if test "${ac_cv_lib_cposix_main+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -13448,7 +14584,7 @@
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lcposix  $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
-#line 13451 "configure"
+#line 14587 "configure"
 #include "confdefs.h"
 
 int
@@ -13460,16 +14596,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:13463: \"$ac_link\"") >&5
+if { (eval echo "$as_me:14599: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:13466: \$? = $ac_status" >&5
+  echo "$as_me:14602: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:13469: \"$ac_try\"") >&5
+  { (eval echo "$as_me:14605: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:13472: \$? = $ac_status" >&5
+  echo "$as_me:14608: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_lib_cposix_main=yes
 else
@@ -13480,7 +14616,7 @@
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-echo "$as_me:13483: result: $ac_cv_lib_cposix_main" >&5
+echo "$as_me:14619: result: $ac_cv_lib_cposix_main" >&5
 echo "${ECHO_T}$ac_cv_lib_cposix_main" >&6
 if test $ac_cv_lib_cposix_main = yes; then
   cat >>confdefs.h <<EOF
@@ -13491,7 +14627,7 @@
 
 fi
 
-	echo "$as_me:13494: checking for bzero in -linet" >&5
+	echo "$as_me:14630: checking for bzero in -linet" >&5
 echo $ECHO_N "checking for bzero in -linet... $ECHO_C" >&6
 if test "${ac_cv_lib_inet_bzero+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -13499,7 +14635,7 @@
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-linet  $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
-#line 13502 "configure"
+#line 14638 "configure"
 #include "confdefs.h"
 
 /* Override any gcc2 internal prototype to avoid an error.  */
@@ -13518,16 +14654,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:13521: \"$ac_link\"") >&5
+if { (eval echo "$as_me:14657: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:13524: \$? = $ac_status" >&5
+  echo "$as_me:14660: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:13527: \"$ac_try\"") >&5
+  { (eval echo "$as_me:14663: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:13530: \$? = $ac_status" >&5
+  echo "$as_me:14666: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_lib_inet_bzero=yes
 else
@@ -13538,173 +14674,83 @@
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-echo "$as_me:13541: result: $ac_cv_lib_inet_bzero" >&5
+echo "$as_me:14677: result: $ac_cv_lib_inet_bzero" >&5
 echo "${ECHO_T}$ac_cv_lib_inet_bzero" >&6
 if test $ac_cv_lib_inet_bzero = yes; then
   LIBS="-linet $LIBS"
 fi
 fi
-
-echo "$as_me:13548: checking if sys/time.h works with sys/select.h" >&5
-echo $ECHO_N "checking if sys/time.h works with sys/select.h... $ECHO_C" >&6
-if test "${cf_cv_sys_time_select+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-
-cat >conftest.$ac_ext <<_ACEOF
-#line 13555 "configure"
-#include "confdefs.h"
-
-#include <sys/types.h>
-#ifdef HAVE_SYS_TIME_H
-#include <sys/time.h>
-#endif
-#ifdef HAVE_SYS_SELECT_H
-#include <sys/select.h>
-#endif
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:13575: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
-  ac_status=$?
-  echo "$as_me:13578: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:13581: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:13584: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  cf_cv_sys_time_select=yes
-else
-  echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
-cf_cv_sys_time_select=no
-fi
-rm -f conftest.$ac_objext conftest.$ac_ext
-
-fi
-
-echo "$as_me:13596: result: $cf_cv_sys_time_select" >&5
-echo "${ECHO_T}$cf_cv_sys_time_select" >&6
-test "$cf_cv_sys_time_select" = yes && cat >>confdefs.h <<\EOF
-#define HAVE_SYS_TIME_SELECT 1
-EOF
-
-###	checks for compiler characteristics
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-ac_main_return=return
-
-echo "$as_me:13610: checking for $CC option to accept ANSI C" >&5
-echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6
-if test "${ac_cv_prog_cc_stdc+set}" = set; then
+
+echo "$as_me:14684: checking if sys/time.h works with sys/select.h" >&5
+echo $ECHO_N "checking if sys/time.h works with sys/select.h... $ECHO_C" >&6
+if test "${cf_cv_sys_time_select+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  ac_cv_prog_cc_stdc=no
-ac_save_CC=$CC
+
 cat >conftest.$ac_ext <<_ACEOF
-#line 13618 "configure"
+#line 14691 "configure"
 #include "confdefs.h"
-#include <stdarg.h>
-#include <stdio.h>
+
 #include <sys/types.h>
-#include <sys/stat.h>
-/* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
-struct buf { int x; };
-FILE * (*rcsopen) (struct buf *, struct stat *, int);
-static char *e (p, i)
-     char **p;
-     int i;
-{
-  return p[i];
-}
-static char *f (char * (*g) (char **, int), char **p, ...)
-{
-  char *s;
-  va_list v;
-  va_start (v,p);
-  s = g (p, va_arg (v,int));
-  va_end (v);
-  return s;
-}
-int test (int i, double x);
-struct s1 {int (*f) (int a);};
-struct s2 {int (*f) (double a);};
-int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
-int argc;
-char **argv;
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+#ifdef HAVE_SYS_SELECT_H
+#include <sys/select.h>
+#endif
+
 int
 main ()
 {
-return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
+
   ;
   return 0;
 }
 _ACEOF
-# Don't try gcc -ansi; that turns off useful extensions and
-# breaks some systems' header files.
-# AIX			-qlanglvl=ansi
-# Ultrix and OSF/1	-std1
-# HP-UX 10.20 and later	-Ae
-# HP-UX older versions	-Aa -D_HPUX_SOURCE
-# SVR4			-Xc -D__EXTENSIONS__
-for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
-do
-  CC="$ac_save_CC $ac_arg"
-  rm -f conftest.$ac_objext
-if { (eval echo "$as_me:13667: \"$ac_compile\"") >&5
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:14711: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:13670: \$? = $ac_status" >&5
+  echo "$as_me:14714: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:13673: \"$ac_try\"") >&5
+  { (eval echo "$as_me:14717: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:13676: \$? = $ac_status" >&5
+  echo "$as_me:14720: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_prog_cc_stdc=$ac_arg
-break
+  cf_cv_sys_time_select=yes
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
+cf_cv_sys_time_select=no
 fi
-rm -f conftest.$ac_objext
-done
-rm -f conftest.$ac_ext conftest.$ac_objext
-CC=$ac_save_CC
+rm -f conftest.$ac_objext conftest.$ac_ext
 
 fi
 
-case "x$ac_cv_prog_cc_stdc" in
-  x|xno)
-    echo "$as_me:13693: result: none needed" >&5
-echo "${ECHO_T}none needed" >&6 ;;
-  *)
-    echo "$as_me:13696: result: $ac_cv_prog_cc_stdc" >&5
-echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6
-    CC="$CC $ac_cv_prog_cc_stdc" ;;
-esac
+echo "$as_me:14732: result: $cf_cv_sys_time_select" >&5
+echo "${ECHO_T}$cf_cv_sys_time_select" >&6
+test "$cf_cv_sys_time_select" = yes &&
+cat >>confdefs.h <<\EOF
+#define HAVE_SYS_TIME_SELECT 1
+EOF
+
+###	checks for compiler characteristics
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+ac_main_return=return
 
-echo "$as_me:13701: checking for an ANSI C-conforming const" >&5
+echo "$as_me:14747: checking for an ANSI C-conforming const" >&5
 echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6
 if test "${ac_cv_c_const+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 13707 "configure"
+#line 14753 "configure"
 #include "confdefs.h"
 
 int
@@ -13762,16 +14808,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:13765: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:14811: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:13768: \$? = $ac_status" >&5
+  echo "$as_me:14814: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:13771: \"$ac_try\"") >&5
+  { (eval echo "$as_me:14817: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:13774: \$? = $ac_status" >&5
+  echo "$as_me:14820: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_c_const=yes
 else
@@ -13781,7 +14827,7 @@
 fi
 rm -f conftest.$ac_objext conftest.$ac_ext
 fi
-echo "$as_me:13784: result: $ac_cv_c_const" >&5
+echo "$as_me:14830: result: $ac_cv_c_const" >&5
 echo "${ECHO_T}$ac_cv_c_const" >&6
 if test $ac_cv_c_const = no; then
 
@@ -13791,7 +14837,7 @@
 
 fi
 
-echo "$as_me:13794: checking for inline" >&5
+echo "$as_me:14840: checking for inline" >&5
 echo $ECHO_N "checking for inline... $ECHO_C" >&6
 if test "${ac_cv_c_inline+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -13799,7 +14845,7 @@
   ac_cv_c_inline=no
 for ac_kw in inline __inline__ __inline; do
   cat >conftest.$ac_ext <<_ACEOF
-#line 13802 "configure"
+#line 14848 "configure"
 #include "confdefs.h"
 #ifndef __cplusplus
 static $ac_kw int static_foo () {return 0; }
@@ -13808,16 +14854,16 @@
 
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:13811: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:14857: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:13814: \$? = $ac_status" >&5
+  echo "$as_me:14860: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:13817: \"$ac_try\"") >&5
+  { (eval echo "$as_me:14863: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:13820: \$? = $ac_status" >&5
+  echo "$as_me:14866: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_c_inline=$ac_kw; break
 else
@@ -13828,7 +14874,7 @@
 done
 
 fi
-echo "$as_me:13831: result: $ac_cv_c_inline" >&5
+echo "$as_me:14877: result: $ac_cv_c_inline" >&5
 echo "${ECHO_T}$ac_cv_c_inline" >&6
 case $ac_cv_c_inline in
   inline | yes) ;;
@@ -13849,9 +14895,12 @@
   if test "$INTEL_COMPILER" = yes
   then
     :
+  elif test "$CLANG_COMPILER" = yes
+  then
+    :
   elif test "$GCC" = yes
   then
-    echo "$as_me:13854: checking if $CC supports options to tune inlining" >&5
+    echo "$as_me:14903: checking if $CC supports options to tune inlining" >&5
 echo $ECHO_N "checking if $CC supports options to tune inlining... $ECHO_C" >&6
 if test "${cf_cv_gcc_inline+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -13860,7 +14909,7 @@
       cf_save_CFLAGS=$CFLAGS
       CFLAGS="$CFLAGS --param max-inline-insns-single=1200"
       cat >conftest.$ac_ext <<_ACEOF
-#line 13863 "configure"
+#line 14912 "configure"
 #include "confdefs.h"
 inline int foo(void) { return 1; }
 int
@@ -13872,16 +14921,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:13875: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:14924: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:13878: \$? = $ac_status" >&5
+  echo "$as_me:14927: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:13881: \"$ac_try\"") >&5
+  { (eval echo "$as_me:14930: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:13884: \$? = $ac_status" >&5
+  echo "$as_me:14933: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   cf_cv_gcc_inline=yes
 else
@@ -13893,7 +14942,7 @@
       CFLAGS=$cf_save_CFLAGS
 
 fi
-echo "$as_me:13896: result: $cf_cv_gcc_inline" >&5
+echo "$as_me:14945: result: $cf_cv_gcc_inline" >&5
 echo "${ECHO_T}$cf_cv_gcc_inline" >&6
     if test "$cf_cv_gcc_inline" = yes ; then
 
@@ -13979,7 +15028,7 @@
   fi
 fi
 
-echo "$as_me:13982: checking for signal global datatype" >&5
+echo "$as_me:15031: checking for signal global datatype" >&5
 echo $ECHO_N "checking for signal global datatype... $ECHO_C" >&6
 if test "${cf_cv_sig_atomic_t+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -13991,7 +15040,7 @@
 		"int"
 	do
 	cat >conftest.$ac_ext <<_ACEOF
-#line 13994 "configure"
+#line 15043 "configure"
 #include "confdefs.h"
 
 #include <sys/types.h>
@@ -14014,16 +15063,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:14017: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:15066: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:14020: \$? = $ac_status" >&5
+  echo "$as_me:15069: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:14023: \"$ac_try\"") >&5
+  { (eval echo "$as_me:15072: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:14026: \$? = $ac_status" >&5
+  echo "$as_me:15075: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   cf_cv_sig_atomic_t=$cf_type
 else
@@ -14037,15 +15086,16 @@
 
 fi
 
-echo "$as_me:14040: result: $cf_cv_sig_atomic_t" >&5
+echo "$as_me:15089: result: $cf_cv_sig_atomic_t" >&5
 echo "${ECHO_T}$cf_cv_sig_atomic_t" >&6
-test "$cf_cv_sig_atomic_t" != no && cat >>confdefs.h <<EOF
+test "$cf_cv_sig_atomic_t" != no &&
+cat >>confdefs.h <<EOF
 #define SIG_ATOMIC_T $cf_cv_sig_atomic_t
 EOF
 
 if test $NCURSES_CHTYPE = auto ; then
 
-echo "$as_me:14048: checking for type of chtype" >&5
+echo "$as_me:15098: checking for type of chtype" >&5
 echo $ECHO_N "checking for type of chtype... $ECHO_C" >&6
 if test "${cf_cv_typeof_chtype+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -14055,7 +15105,7 @@
   cf_cv_typeof_chtype=long
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 14058 "configure"
+#line 15108 "configure"
 #include "confdefs.h"
 
 #define WANT_BITS 31
@@ -14090,15 +15140,15 @@
 
 _ACEOF
 rm -f conftest$ac_exeext
-if { (eval echo "$as_me:14093: \"$ac_link\"") >&5
+if { (eval echo "$as_me:15143: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:14096: \$? = $ac_status" >&5
+  echo "$as_me:15146: \$? = $ac_status" >&5
   (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (eval echo "$as_me:14098: \"$ac_try\"") >&5
+  { (eval echo "$as_me:15148: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:14101: \$? = $ac_status" >&5
+  echo "$as_me:15151: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   cf_cv_typeof_chtype=`cat cf_test.out`
 else
@@ -14113,7 +15163,7 @@
 
 fi
 
-echo "$as_me:14116: result: $cf_cv_typeof_chtype" >&5
+echo "$as_me:15166: result: $cf_cv_typeof_chtype" >&5
 echo "${ECHO_T}$cf_cv_typeof_chtype" >&6
 
 cat >>confdefs.h <<EOF
@@ -14125,14 +15175,14 @@
 fi
 test "$cf_cv_typeof_chtype" = unsigned && cf_cv_typeof_chtype=""
 
-echo "$as_me:14128: checking if unsigned literals are legal" >&5
+echo "$as_me:15178: checking if unsigned literals are legal" >&5
 echo $ECHO_N "checking if unsigned literals are legal... $ECHO_C" >&6
 if test "${cf_cv_unsigned_literals+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
 
 	cat >conftest.$ac_ext <<_ACEOF
-#line 14135 "configure"
+#line 15185 "configure"
 #include "confdefs.h"
 
 int
@@ -14144,16 +15194,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:14147: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:15197: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:14150: \$? = $ac_status" >&5
+  echo "$as_me:15200: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:14153: \"$ac_try\"") >&5
+  { (eval echo "$as_me:15203: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:14156: \$? = $ac_status" >&5
+  echo "$as_me:15206: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   cf_cv_unsigned_literals=yes
 else
@@ -14165,7 +15215,7 @@
 
 fi
 
-echo "$as_me:14168: result: $cf_cv_unsigned_literals" >&5
+echo "$as_me:15218: result: $cf_cv_unsigned_literals" >&5
 echo "${ECHO_T}$cf_cv_unsigned_literals" >&6
 
 cf_cv_1UL="1"
@@ -14181,14 +15231,14 @@
 
 ###	Checks for external-data
 
-echo "$as_me:14184: checking if external errno is declared" >&5
+echo "$as_me:15234: checking if external errno is declared" >&5
 echo $ECHO_N "checking if external errno is declared... $ECHO_C" >&6
 if test "${cf_cv_dcl_errno+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
 
     cat >conftest.$ac_ext <<_ACEOF
-#line 14191 "configure"
+#line 15241 "configure"
 #include "confdefs.h"
 
 #ifdef HAVE_STDLIB_H
@@ -14206,16 +15256,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:14209: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:15259: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:14212: \$? = $ac_status" >&5
+  echo "$as_me:15262: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:14215: \"$ac_try\"") >&5
+  { (eval echo "$as_me:15265: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:14218: \$? = $ac_status" >&5
+  echo "$as_me:15268: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   cf_cv_dcl_errno=yes
 else
@@ -14226,7 +15276,7 @@
 rm -f conftest.$ac_objext conftest.$ac_ext
 
 fi
-echo "$as_me:14229: result: $cf_cv_dcl_errno" >&5
+echo "$as_me:15279: result: $cf_cv_dcl_errno" >&5
 echo "${ECHO_T}$cf_cv_dcl_errno" >&6
 
 if test "$cf_cv_dcl_errno" = no ; then
@@ -14241,14 +15291,14 @@
 
 # It's possible (for near-UNIX clones) that the data doesn't exist
 
-echo "$as_me:14244: checking if external errno exists" >&5
+echo "$as_me:15294: checking if external errno exists" >&5
 echo $ECHO_N "checking if external errno exists... $ECHO_C" >&6
 if test "${cf_cv_have_errno+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
 
     cat >conftest.$ac_ext <<_ACEOF
-#line 14251 "configure"
+#line 15301 "configure"
 #include "confdefs.h"
 
 #undef errno
@@ -14263,16 +15313,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:14266: \"$ac_link\"") >&5
+if { (eval echo "$as_me:15316: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:14269: \$? = $ac_status" >&5
+  echo "$as_me:15319: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:14272: \"$ac_try\"") >&5
+  { (eval echo "$as_me:15322: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:14275: \$? = $ac_status" >&5
+  echo "$as_me:15325: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   cf_cv_have_errno=yes
 else
@@ -14283,7 +15333,7 @@
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 
 fi
-echo "$as_me:14286: result: $cf_cv_have_errno" >&5
+echo "$as_me:15336: result: $cf_cv_have_errno" >&5
 echo "${ECHO_T}$cf_cv_have_errno" >&6
 
 if test "$cf_cv_have_errno" = yes ; then
@@ -14296,7 +15346,7 @@
 
 fi
 
-echo "$as_me:14299: checking if data-only library module links" >&5
+echo "$as_me:15349: checking if data-only library module links" >&5
 echo $ECHO_N "checking if data-only library module links... $ECHO_C" >&6
 if test "${cf_cv_link_dataonly+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -14304,20 +15354,20 @@
 
 	rm -f conftest.a
 	cat >conftest.$ac_ext <<EOF
-#line 14307 "configure"
+#line 15357 "configure"
 int	testdata[3] = { 123, 456, 789 };
 EOF
-	if { (eval echo "$as_me:14310: \"$ac_compile\"") >&5
+	if { (eval echo "$as_me:15360: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:14313: \$? = $ac_status" >&5
+  echo "$as_me:15363: \$? = $ac_status" >&5
   (exit $ac_status); } ; then
 		mv conftest.o data.o && \
 		( $AR $ARFLAGS conftest.a data.o ) 2>&5 1>/dev/null
 	fi
 	rm -f conftest.$ac_ext data.o
 	cat >conftest.$ac_ext <<EOF
-#line 14320 "configure"
+#line 15370 "configure"
 int	testfunc()
 {
 #if defined(NeXT)
@@ -14330,10 +15380,10 @@
 #endif
 }
 EOF
-	if { (eval echo "$as_me:14333: \"$ac_compile\"") >&5
+	if { (eval echo "$as_me:15383: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:14336: \$? = $ac_status" >&5
+  echo "$as_me:15386: \$? = $ac_status" >&5
   (exit $ac_status); }; then
 		mv conftest.o func.o && \
 		( $AR $ARFLAGS conftest.a func.o ) 2>&5 1>/dev/null
@@ -14346,7 +15396,7 @@
   cf_cv_link_dataonly=unknown
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 14349 "configure"
+#line 15399 "configure"
 #include "confdefs.h"
 
 	int main()
@@ -14357,15 +15407,15 @@
 
 _ACEOF
 rm -f conftest$ac_exeext
-if { (eval echo "$as_me:14360: \"$ac_link\"") >&5
+if { (eval echo "$as_me:15410: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:14363: \$? = $ac_status" >&5
+  echo "$as_me:15413: \$? = $ac_status" >&5
   (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (eval echo "$as_me:14365: \"$ac_try\"") >&5
+  { (eval echo "$as_me:15415: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:14368: \$? = $ac_status" >&5
+  echo "$as_me:15418: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   cf_cv_link_dataonly=yes
 else
@@ -14380,11 +15430,12 @@
 
 fi
 
-echo "$as_me:14383: result: $cf_cv_link_dataonly" >&5
+echo "$as_me:15433: result: $cf_cv_link_dataonly" >&5
 echo "${ECHO_T}$cf_cv_link_dataonly" >&6
 
 if test "$cf_cv_link_dataonly" = no ; then
-	cat >>confdefs.h <<\EOF
+
+cat >>confdefs.h <<\EOF
 #define BROKEN_LINKER 1
 EOF
 
@@ -14400,10 +15451,12 @@
 getttynam \
 issetugid \
 poll \
+putenv \
 remove \
 select \
 setbuf \
 setbuffer \
+setenv \
 setvbuf \
 sigaction \
 sigvec \
@@ -14415,13 +15468,13 @@
 
 do
 as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
-echo "$as_me:14418: checking for $ac_func" >&5
+echo "$as_me:15471: checking for $ac_func" >&5
 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
 if eval "test \"\${$as_ac_var+set}\" = set"; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 14424 "configure"
+#line 15477 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func (); below.  */
@@ -14444,7 +15497,7 @@
 #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
 choke me
 #else
-f = $ac_func;
+f = $ac_func; /* workaround for ICC 12.0.3 */ if (f == 0) return 1;
 #endif
 
   ;
@@ -14452,16 +15505,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:14455: \"$ac_link\"") >&5
+if { (eval echo "$as_me:15508: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:14458: \$? = $ac_status" >&5
+  echo "$as_me:15511: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:14461: \"$ac_try\"") >&5
+  { (eval echo "$as_me:15514: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:14464: \$? = $ac_status" >&5
+  echo "$as_me:15517: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   eval "$as_ac_var=yes"
 else
@@ -14471,7 +15524,7 @@
 fi
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 fi
-echo "$as_me:14474: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "$as_me:15527: result: `eval echo '${'$as_ac_var'}'`" >&5
 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
 if test `eval echo '${'$as_ac_var'}'` = yes; then
   cat >>confdefs.h <<EOF
@@ -14481,16 +15534,16 @@
 fi
 done
 
-if test "$with_getcap" = "yes" ; then
+if test "x$with_getcap" = "xyes" ; then
 
-echo "$as_me:14486: checking for terminal-capability database functions" >&5
+echo "$as_me:15539: checking for terminal-capability database functions" >&5
 echo $ECHO_N "checking for terminal-capability database functions... $ECHO_C" >&6
 if test "${cf_cv_cgetent+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
 
 cat >conftest.$ac_ext <<_ACEOF
-#line 14493 "configure"
+#line 15546 "configure"
 #include "confdefs.h"
 
 #include <stdlib.h>
@@ -14501,7 +15554,7 @@
 	char temp[128];
 	char *buf = temp;
 	char *db_array = temp;
-	cgetent(&buf, /* int *, */ &db_array, "vt100");
+	cgetent(&buf, &db_array, "vt100");
 	cgetcap(buf, "tc", '=');
 	cgetmatch(buf, "tc");
 
@@ -14510,16 +15563,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:14513: \"$ac_link\"") >&5
+if { (eval echo "$as_me:15566: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:14516: \$? = $ac_status" >&5
+  echo "$as_me:15569: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:14519: \"$ac_try\"") >&5
+  { (eval echo "$as_me:15572: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:14522: \$? = $ac_status" >&5
+  echo "$as_me:15575: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   cf_cv_cgetent=yes
 else
@@ -14530,23 +15583,87 @@
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 
 fi
-
-echo "$as_me:14534: result: $cf_cv_cgetent" >&5
+echo "$as_me:15586: result: $cf_cv_cgetent" >&5
 echo "${ECHO_T}$cf_cv_cgetent" >&6
-test "$cf_cv_cgetent" = yes && cat >>confdefs.h <<\EOF
+
+if test "$cf_cv_cgetent" = yes
+then
+
+cat >>confdefs.h <<\EOF
 #define HAVE_BSD_CGETENT 1
 EOF
 
+echo "$as_me:15596: checking if cgetent uses const parameter" >&5
+echo $ECHO_N "checking if cgetent uses const parameter... $ECHO_C" >&6
+if test "${cf_cv_cgetent_const+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+cat >conftest.$ac_ext <<_ACEOF
+#line 15603 "configure"
+#include "confdefs.h"
+
+#include <stdlib.h>
+int
+main ()
+{
+
+	char temp[128];
+	char *buf = temp;
+#ifndef _NETBSD_SOURCE			/* given, since April 2004 in stdlib.h */
+	const char *db_array = temp;
+	cgetent(&buf, &db_array, "vt100");
+#endif
+	cgetcap(buf, "tc", '=');
+	cgetmatch(buf, "tc");
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:15625: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:15628: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:15631: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:15634: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  cf_cv_cgetent_const=yes
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+cf_cv_cgetent_const=no
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+
+fi
+echo "$as_me:15645: result: $cf_cv_cgetent_const" >&5
+echo "${ECHO_T}$cf_cv_cgetent_const" >&6
+	if test "$cf_cv_cgetent_const" = yes
+	then
+
+cat >>confdefs.h <<EOF
+#define CGETENT_CONST const
+EOF
+
+	fi
+fi
+
 fi
 
-echo "$as_me:14542: checking for isascii" >&5
+echo "$as_me:15659: checking for isascii" >&5
 echo $ECHO_N "checking for isascii... $ECHO_C" >&6
 if test "${cf_cv_have_isascii+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
 
 	cat >conftest.$ac_ext <<_ACEOF
-#line 14549 "configure"
+#line 15666 "configure"
 #include "confdefs.h"
 #include <ctype.h>
 int
@@ -14558,16 +15675,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:14561: \"$ac_link\"") >&5
+if { (eval echo "$as_me:15678: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:14564: \$? = $ac_status" >&5
+  echo "$as_me:15681: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:14567: \"$ac_try\"") >&5
+  { (eval echo "$as_me:15684: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:14570: \$? = $ac_status" >&5
+  echo "$as_me:15687: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   cf_cv_have_isascii=yes
 else
@@ -14578,17 +15695,18 @@
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 
 fi
-echo "$as_me:14581: result: $cf_cv_have_isascii" >&5
+echo "$as_me:15698: result: $cf_cv_have_isascii" >&5
 echo "${ECHO_T}$cf_cv_have_isascii" >&6
-test "$cf_cv_have_isascii" = yes && cat >>confdefs.h <<\EOF
+test "$cf_cv_have_isascii" = yes &&
+cat >>confdefs.h <<\EOF
 #define HAVE_ISASCII 1
 EOF
 
 if test "$ac_cv_func_sigaction" = yes; then
-echo "$as_me:14588: checking whether sigaction needs _POSIX_SOURCE" >&5
+echo "$as_me:15706: checking whether sigaction needs _POSIX_SOURCE" >&5
 echo $ECHO_N "checking whether sigaction needs _POSIX_SOURCE... $ECHO_C" >&6
 cat >conftest.$ac_ext <<_ACEOF
-#line 14591 "configure"
+#line 15709 "configure"
 #include "confdefs.h"
 
 #include <sys/types.h>
@@ -14602,16 +15720,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:14605: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:15723: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:14608: \$? = $ac_status" >&5
+  echo "$as_me:15726: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:14611: \"$ac_try\"") >&5
+  { (eval echo "$as_me:15729: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:14614: \$? = $ac_status" >&5
+  echo "$as_me:15732: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   sigact_bad=no
 else
@@ -14619,7 +15737,7 @@
 cat conftest.$ac_ext >&5
 
 cat >conftest.$ac_ext <<_ACEOF
-#line 14622 "configure"
+#line 15740 "configure"
 #include "confdefs.h"
 
 #define _POSIX_SOURCE
@@ -14634,20 +15752,21 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:14637: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:15755: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:14640: \$? = $ac_status" >&5
+  echo "$as_me:15758: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:14643: \"$ac_try\"") >&5
+  { (eval echo "$as_me:15761: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:14646: \$? = $ac_status" >&5
+  echo "$as_me:15764: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   sigact_bad=yes
-	 cat >>confdefs.h <<\EOF
-#define SVR4_ACTION 1
+
+cat >>confdefs.h <<\EOF
+#define _POSIX_SOURCE 1
 EOF
 
 else
@@ -14658,11 +15777,11 @@
 rm -f conftest.$ac_objext conftest.$ac_ext
 fi
 rm -f conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:14661: result: $sigact_bad" >&5
+echo "$as_me:15780: result: $sigact_bad" >&5
 echo "${ECHO_T}$sigact_bad" >&6
 fi
 
-echo "$as_me:14665: checking if nanosleep really works" >&5
+echo "$as_me:15784: checking if nanosleep really works" >&5
 echo $ECHO_N "checking if nanosleep really works... $ECHO_C" >&6
 if test "${cf_cv_func_nanosleep+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -14672,7 +15791,7 @@
   cf_cv_func_nanosleep=unknown
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 14675 "configure"
+#line 15794 "configure"
 #include "confdefs.h"
 
 #include <stdio.h>
@@ -14697,15 +15816,15 @@
 
 _ACEOF
 rm -f conftest$ac_exeext
-if { (eval echo "$as_me:14700: \"$ac_link\"") >&5
+if { (eval echo "$as_me:15819: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:14703: \$? = $ac_status" >&5
+  echo "$as_me:15822: \$? = $ac_status" >&5
   (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (eval echo "$as_me:14705: \"$ac_try\"") >&5
+  { (eval echo "$as_me:15824: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:14708: \$? = $ac_status" >&5
+  echo "$as_me:15827: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   cf_cv_func_nanosleep=yes
 else
@@ -14717,10 +15836,11 @@
 rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
 fi
-echo "$as_me:14720: result: $cf_cv_func_nanosleep" >&5
+echo "$as_me:15839: result: $cf_cv_func_nanosleep" >&5
 echo "${ECHO_T}$cf_cv_func_nanosleep" >&6
 
-test "$cf_cv_func_nanosleep" = "yes" && cat >>confdefs.h <<\EOF
+test "$cf_cv_func_nanosleep" = "yes" &&
+cat >>confdefs.h <<\EOF
 #define HAVE_NANOSLEEP 1
 EOF
 
@@ -14731,23 +15851,23 @@
 
 do
 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-echo "$as_me:14734: checking for $ac_header" >&5
+echo "$as_me:15854: checking for $ac_header" >&5
 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
 if eval "test \"\${$as_ac_Header+set}\" = set"; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 14740 "configure"
+#line 15860 "configure"
 #include "confdefs.h"
 #include <$ac_header>
 _ACEOF
-if { (eval echo "$as_me:14744: \"$ac_cpp conftest.$ac_ext\"") >&5
+if { (eval echo "$as_me:15864: \"$ac_cpp conftest.$ac_ext\"") >&5
   (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
   ac_status=$?
   egrep -v '^ *\+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
-  echo "$as_me:14750: \$? = $ac_status" >&5
+  echo "$as_me:15870: \$? = $ac_status" >&5
   (exit $ac_status); } >/dev/null; then
   if test -s conftest.err; then
     ac_cpp_err=$ac_c_preproc_warn_flag
@@ -14766,7 +15886,7 @@
 fi
 rm -f conftest.err conftest.$ac_ext
 fi
-echo "$as_me:14769: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "$as_me:15889: result: `eval echo '${'$as_ac_Header'}'`" >&5
 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
 if test `eval echo '${'$as_ac_Header'}'` = yes; then
   cat >>confdefs.h <<EOF
@@ -14781,23 +15901,23 @@
 for ac_header in sys/termio.h
 do
 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-echo "$as_me:14784: checking for $ac_header" >&5
+echo "$as_me:15904: checking for $ac_header" >&5
 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
 if eval "test \"\${$as_ac_Header+set}\" = set"; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 14790 "configure"
+#line 15910 "configure"
 #include "confdefs.h"
 #include <$ac_header>
 _ACEOF
-if { (eval echo "$as_me:14794: \"$ac_cpp conftest.$ac_ext\"") >&5
+if { (eval echo "$as_me:15914: \"$ac_cpp conftest.$ac_ext\"") >&5
   (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
   ac_status=$?
   egrep -v '^ *\+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
-  echo "$as_me:14800: \$? = $ac_status" >&5
+  echo "$as_me:15920: \$? = $ac_status" >&5
   (exit $ac_status); } >/dev/null; then
   if test -s conftest.err; then
     ac_cpp_err=$ac_c_preproc_warn_flag
@@ -14816,7 +15936,7 @@
 fi
 rm -f conftest.err conftest.$ac_ext
 fi
-echo "$as_me:14819: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "$as_me:15939: result: `eval echo '${'$as_ac_Header'}'`" >&5
 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
 if test `eval echo '${'$as_ac_Header'}'` = yes; then
   cat >>confdefs.h <<EOF
@@ -14834,10 +15954,10 @@
 	*)	termios_bad=maybe ;;
 	esac
 	if test "$termios_bad" = maybe ; then
-	echo "$as_me:14837: checking whether termios.h needs _POSIX_SOURCE" >&5
+	echo "$as_me:15957: checking whether termios.h needs _POSIX_SOURCE" >&5
 echo $ECHO_N "checking whether termios.h needs _POSIX_SOURCE... $ECHO_C" >&6
 	cat >conftest.$ac_ext <<_ACEOF
-#line 14840 "configure"
+#line 15960 "configure"
 #include "confdefs.h"
 #include <termios.h>
 int
@@ -14849,16 +15969,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:14852: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:15972: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:14855: \$? = $ac_status" >&5
+  echo "$as_me:15975: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:14858: \"$ac_try\"") >&5
+  { (eval echo "$as_me:15978: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:14861: \$? = $ac_status" >&5
+  echo "$as_me:15981: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   termios_bad=no
 else
@@ -14866,7 +15986,7 @@
 cat conftest.$ac_ext >&5
 
 		cat >conftest.$ac_ext <<_ACEOF
-#line 14869 "configure"
+#line 15989 "configure"
 #include "confdefs.h"
 
 #define _POSIX_SOURCE
@@ -14880,23 +16000,24 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:14883: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:16003: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:14886: \$? = $ac_status" >&5
+  echo "$as_me:16006: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:14889: \"$ac_try\"") >&5
+  { (eval echo "$as_me:16009: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:14892: \$? = $ac_status" >&5
+  echo "$as_me:16012: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   termios_bad=unknown
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-termios_bad=yes cat >>confdefs.h <<\EOF
-#define SVR4_TERMIO 1
+termios_bad=yes
+cat >>confdefs.h <<\EOF
+#define _POSIX_SOURCE 1
 EOF
 
 fi
@@ -14904,19 +16025,19 @@
 
 fi
 rm -f conftest.$ac_objext conftest.$ac_ext
-	echo "$as_me:14907: result: $termios_bad" >&5
+	echo "$as_me:16028: result: $termios_bad" >&5
 echo "${ECHO_T}$termios_bad" >&6
 	fi
 fi
 
-echo "$as_me:14912: checking for tcgetattr" >&5
+echo "$as_me:16033: checking for tcgetattr" >&5
 echo $ECHO_N "checking for tcgetattr... $ECHO_C" >&6
 if test "${cf_cv_have_tcgetattr+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
 
 cat >conftest.$ac_ext <<_ACEOF
-#line 14919 "configure"
+#line 16040 "configure"
 #include "confdefs.h"
 
 #include <sys/types.h>
@@ -14944,16 +16065,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:14947: \"$ac_link\"") >&5
+if { (eval echo "$as_me:16068: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:14950: \$? = $ac_status" >&5
+  echo "$as_me:16071: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:14953: \"$ac_try\"") >&5
+  { (eval echo "$as_me:16074: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:14956: \$? = $ac_status" >&5
+  echo "$as_me:16077: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   cf_cv_have_tcgetattr=yes
 else
@@ -14963,20 +16084,21 @@
 fi
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 fi
-echo "$as_me:14966: result: $cf_cv_have_tcgetattr" >&5
+echo "$as_me:16087: result: $cf_cv_have_tcgetattr" >&5
 echo "${ECHO_T}$cf_cv_have_tcgetattr" >&6
-test "$cf_cv_have_tcgetattr" = yes && cat >>confdefs.h <<\EOF
+test "$cf_cv_have_tcgetattr" = yes &&
+cat >>confdefs.h <<\EOF
 #define HAVE_TCGETATTR 1
 EOF
 
-echo "$as_me:14972: checking for vsscanf function or workaround" >&5
+echo "$as_me:16094: checking for vsscanf function or workaround" >&5
 echo $ECHO_N "checking for vsscanf function or workaround... $ECHO_C" >&6
 if test "${cf_cv_func_vsscanf+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
 
 cat >conftest.$ac_ext <<_ACEOF
-#line 14979 "configure"
+#line 16101 "configure"
 #include "confdefs.h"
 
 #include <stdarg.h>
@@ -14992,16 +16114,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:14995: \"$ac_link\"") >&5
+if { (eval echo "$as_me:16117: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:14998: \$? = $ac_status" >&5
+  echo "$as_me:16120: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:15001: \"$ac_try\"") >&5
+  { (eval echo "$as_me:16123: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:15004: \$? = $ac_status" >&5
+  echo "$as_me:16126: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   cf_cv_func_vsscanf=vsscanf
 else
@@ -15009,7 +16131,7 @@
 cat conftest.$ac_ext >&5
 
 cat >conftest.$ac_ext <<_ACEOF
-#line 15012 "configure"
+#line 16134 "configure"
 #include "confdefs.h"
 
 #include <stdarg.h>
@@ -15031,16 +16153,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:15034: \"$ac_link\"") >&5
+if { (eval echo "$as_me:16156: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:15037: \$? = $ac_status" >&5
+  echo "$as_me:16159: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:15040: \"$ac_try\"") >&5
+  { (eval echo "$as_me:16162: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:15043: \$? = $ac_status" >&5
+  echo "$as_me:16165: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   cf_cv_func_vsscanf=vfscanf
 else
@@ -15048,7 +16170,7 @@
 cat conftest.$ac_ext >&5
 
 cat >conftest.$ac_ext <<_ACEOF
-#line 15051 "configure"
+#line 16173 "configure"
 #include "confdefs.h"
 
 #include <stdarg.h>
@@ -15070,16 +16192,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:15073: \"$ac_link\"") >&5
+if { (eval echo "$as_me:16195: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:15076: \$? = $ac_status" >&5
+  echo "$as_me:16198: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:15079: \"$ac_try\"") >&5
+  { (eval echo "$as_me:16201: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:15082: \$? = $ac_status" >&5
+  echo "$as_me:16204: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   cf_cv_func_vsscanf=_doscan
 else
@@ -15094,25 +16216,28 @@
 fi
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 fi
-echo "$as_me:15097: result: $cf_cv_func_vsscanf" >&5
+echo "$as_me:16219: result: $cf_cv_func_vsscanf" >&5
 echo "${ECHO_T}$cf_cv_func_vsscanf" >&6
 
 case $cf_cv_func_vsscanf in #(vi
-vsscanf) cat >>confdefs.h <<\EOF
+vsscanf)
+cat >>confdefs.h <<\EOF
 #define HAVE_VSSCANF 1
 EOF
 ;; #(vi
-vfscanf) cat >>confdefs.h <<\EOF
+vfscanf)
+cat >>confdefs.h <<\EOF
 #define HAVE_VFSCANF 1
 EOF
 ;; #(vi
-_doscan) cat >>confdefs.h <<\EOF
+_doscan)
+cat >>confdefs.h <<\EOF
 #define HAVE__DOSCAN 1
 EOF
 ;;
 esac
 
-echo "$as_me:15115: checking for working mkstemp" >&5
+echo "$as_me:16240: checking for working mkstemp" >&5
 echo $ECHO_N "checking for working mkstemp... $ECHO_C" >&6
 if test "${cf_cv_func_mkstemp+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -15120,13 +16245,80 @@
 
 rm -rf conftest*
 if test "$cross_compiling" = yes; then
-  echo "$as_me:15123: checking for mkstemp" >&5
+  cf_cv_func_mkstemp=maybe
+else
+  cat >conftest.$ac_ext <<_ACEOF
+#line 16251 "configure"
+#include "confdefs.h"
+
+#include <sys/types.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <sys/stat.h>
+int main()
+{
+	char *tmpl = "conftestXXXXXX";
+	char name[2][80];
+	int n;
+	int result = 0;
+	int fd;
+	struct stat sb;
+
+	umask(077);
+	for (n = 0; n < 2; ++n) {
+		strcpy(name[n], tmpl);
+		if ((fd = mkstemp(name[n])) >= 0) {
+			if (!strcmp(name[n], tmpl)
+			 || stat(name[n], &sb) != 0
+			 || (sb.st_mode & S_IFMT) != S_IFREG
+			 || (sb.st_mode & 077) != 0) {
+				result = 1;
+			}
+			close(fd);
+		}
+	}
+	if (result == 0
+	 && !strcmp(name[0], name[1]))
+		result = 1;
+	${cf_cv_main_return:-return}(result);
+}
+
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:16289: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:16292: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (eval echo "$as_me:16294: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:16297: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  cf_cv_func_mkstemp=yes
+
+else
+  echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+cf_cv_func_mkstemp=no
+
+fi
+rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+
+fi
+echo "$as_me:16312: result: $cf_cv_func_mkstemp" >&5
+echo "${ECHO_T}$cf_cv_func_mkstemp" >&6
+if test "x$cf_cv_func_mkstemp" = xmaybe ; then
+	echo "$as_me:16315: checking for mkstemp" >&5
 echo $ECHO_N "checking for mkstemp... $ECHO_C" >&6
 if test "${ac_cv_func_mkstemp+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 15129 "configure"
+#line 16321 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char mkstemp (); below.  */
@@ -15148,104 +16340,41 @@
     something starting with __ and the normal name is an alias.  */
 #if defined (__stub_mkstemp) || defined (__stub___mkstemp)
 choke me
-#else
-f = mkstemp;
-#endif
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:15160: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
-  ac_status=$?
-  echo "$as_me:15163: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:15166: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:15169: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_func_mkstemp=yes
-else
-  echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
-ac_cv_func_mkstemp=no
-fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
-fi
-echo "$as_me:15179: result: $ac_cv_func_mkstemp" >&5
-echo "${ECHO_T}$ac_cv_func_mkstemp" >&6
-
-else
-  cat >conftest.$ac_ext <<_ACEOF
-#line 15184 "configure"
-#include "confdefs.h"
-
-#include <sys/types.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <sys/stat.h>
-int main()
-{
-	char *tmpl = "conftestXXXXXX";
-	char name[2][80];
-	int n;
-	int result = 0;
-	int fd;
-	struct stat sb;
+#else
+f = mkstemp; /* workaround for ICC 12.0.3 */ if (f == 0) return 1;
+#endif
 
-	umask(077);
-	for (n = 0; n < 2; ++n) {
-		strcpy(name[n], tmpl);
-		if ((fd = mkstemp(name[n])) >= 0) {
-			if (!strcmp(name[n], tmpl)
-			 || stat(name[n], &sb) != 0
-			 || (sb.st_mode & S_IFMT) != S_IFREG
-			 || (sb.st_mode & 077) != 0) {
-				result = 1;
-			}
-			close(fd);
-		}
-	}
-	if (result == 0
-	 && !strcmp(name[0], name[1]))
-		result = 1;
-	${cf_cv_main_return:-return}(result);
+  ;
+  return 0;
 }
-
 _ACEOF
-rm -f conftest$ac_exeext
-if { (eval echo "$as_me:15222: \"$ac_link\"") >&5
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:16352: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:15225: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (eval echo "$as_me:15227: \"$ac_try\"") >&5
+  echo "$as_me:16355: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:16358: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:15230: \$? = $ac_status" >&5
+  echo "$as_me:16361: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  cf_cv_func_mkstemp=yes
-
+  ac_cv_func_mkstemp=yes
 else
-  echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
+  echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-cf_cv_func_mkstemp=no
-
+ac_cv_func_mkstemp=no
 fi
-rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 fi
+echo "$as_me:16371: result: $ac_cv_func_mkstemp" >&5
+echo "${ECHO_T}$ac_cv_func_mkstemp" >&6
 
 fi
-echo "$as_me:15245: result: $cf_cv_func_mkstemp" >&5
-echo "${ECHO_T}$cf_cv_func_mkstemp" >&6
 if test "x$cf_cv_func_mkstemp" = xyes || test "x$ac_cv_func_mkstemp" = xyes ; then
-	cat >>confdefs.h <<\EOF
+
+cat >>confdefs.h <<\EOF
 #define HAVE_MKSTEMP 1
 EOF
 
@@ -15259,22 +16388,22 @@
 	HAVE_VSSCANF=0
 fi
 
-if test "$cross_compiling" = yes ; then
-	{ echo "$as_me:15263: WARNING: cross compiling: assume setvbuf params not reversed" >&5
+if test "x$cross_compiling" = xyes ; then
+	{ echo "$as_me:16392: WARNING: cross compiling: assume setvbuf params not reversed" >&5
 echo "$as_me: WARNING: cross compiling: assume setvbuf params not reversed" >&2;}
 else
-	echo "$as_me:15266: checking whether setvbuf arguments are reversed" >&5
+	echo "$as_me:16395: checking whether setvbuf arguments are reversed" >&5
 echo $ECHO_N "checking whether setvbuf arguments are reversed... $ECHO_C" >&6
 if test "${ac_cv_func_setvbuf_reversed+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   if test "$cross_compiling" = yes; then
-  { { echo "$as_me:15272: error: cannot run test program while cross compiling" >&5
+  { { echo "$as_me:16401: error: cannot run test program while cross compiling" >&5
 echo "$as_me: error: cannot run test program while cross compiling" >&2;}
    { (exit 1); exit 1; }; }
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 15277 "configure"
+#line 16406 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 /* If setvbuf has the reversed format, exit 0. */
@@ -15291,15 +16420,15 @@
 }
 _ACEOF
 rm -f conftest$ac_exeext
-if { (eval echo "$as_me:15294: \"$ac_link\"") >&5
+if { (eval echo "$as_me:16423: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:15297: \$? = $ac_status" >&5
+  echo "$as_me:16426: \$? = $ac_status" >&5
   (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (eval echo "$as_me:15299: \"$ac_try\"") >&5
+  { (eval echo "$as_me:16428: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:15302: \$? = $ac_status" >&5
+  echo "$as_me:16431: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_func_setvbuf_reversed=yes
 else
@@ -15312,7 +16441,7 @@
 fi
 rm -f core core.* *.core
 fi
-echo "$as_me:15315: result: $ac_cv_func_setvbuf_reversed" >&5
+echo "$as_me:16444: result: $ac_cv_func_setvbuf_reversed" >&5
 echo "${ECHO_T}$ac_cv_func_setvbuf_reversed" >&6
 if test $ac_cv_func_setvbuf_reversed = yes; then
 
@@ -15323,68 +16452,66 @@
 fi
 
 fi
-echo "$as_me:15326: checking return type of signal handlers" >&5
-echo $ECHO_N "checking return type of signal handlers... $ECHO_C" >&6
-if test "${ac_cv_type_signal+set}" = set; then
+echo "$as_me:16455: checking for intptr_t" >&5
+echo $ECHO_N "checking for intptr_t... $ECHO_C" >&6
+if test "${ac_cv_type_intptr_t+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 15332 "configure"
+#line 16461 "configure"
 #include "confdefs.h"
-#include <sys/types.h>
-#include <signal.h>
-#ifdef signal
-# undef signal
-#endif
-#ifdef __cplusplus
-extern "C" void (*signal (int, void (*)(int)))(int);
-#else
-void (*signal ()) ();
-#endif
-
+$ac_includes_default
 int
 main ()
 {
-int i;
+if ((intptr_t *) 0)
+  return 0;
+if (sizeof (intptr_t))
+  return 0;
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:15354: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:16476: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:15357: \$? = $ac_status" >&5
+  echo "$as_me:16479: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:15360: \"$ac_try\"") >&5
+  { (eval echo "$as_me:16482: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:15363: \$? = $ac_status" >&5
+  echo "$as_me:16485: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_type_signal=void
+  ac_cv_type_intptr_t=yes
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-ac_cv_type_signal=int
+ac_cv_type_intptr_t=no
 fi
 rm -f conftest.$ac_objext conftest.$ac_ext
 fi
-echo "$as_me:15373: result: $ac_cv_type_signal" >&5
-echo "${ECHO_T}$ac_cv_type_signal" >&6
+echo "$as_me:16495: result: $ac_cv_type_intptr_t" >&5
+echo "${ECHO_T}$ac_cv_type_intptr_t" >&6
+if test $ac_cv_type_intptr_t = yes; then
+  :
+else
 
 cat >>confdefs.h <<EOF
-#define RETSIGTYPE $ac_cv_type_signal
+#define intptr_t long
 EOF
 
-echo "$as_me:15380: checking for type sigaction_t" >&5
+fi
+
+echo "$as_me:16507: checking for type sigaction_t" >&5
 echo $ECHO_N "checking for type sigaction_t... $ECHO_C" >&6
 if test "${cf_cv_type_sigaction+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
 
 	cat >conftest.$ac_ext <<_ACEOF
-#line 15387 "configure"
+#line 16514 "configure"
 #include "confdefs.h"
 
 #include <signal.h>
@@ -15397,16 +16524,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:15400: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:16527: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:15403: \$? = $ac_status" >&5
+  echo "$as_me:16530: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:15406: \"$ac_try\"") >&5
+  { (eval echo "$as_me:16533: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:15409: \$? = $ac_status" >&5
+  echo "$as_me:16536: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   cf_cv_type_sigaction=yes
 else
@@ -15417,13 +16544,14 @@
 rm -f conftest.$ac_objext conftest.$ac_ext
 fi
 
-echo "$as_me:15420: result: $cf_cv_type_sigaction" >&5
+echo "$as_me:16547: result: $cf_cv_type_sigaction" >&5
 echo "${ECHO_T}$cf_cv_type_sigaction" >&6
-test "$cf_cv_type_sigaction" = yes && cat >>confdefs.h <<\EOF
+test "$cf_cv_type_sigaction" = yes &&
+cat >>confdefs.h <<\EOF
 #define HAVE_TYPE_SIGACTION 1
 EOF
 
-echo "$as_me:15426: checking declaration of size-change" >&5
+echo "$as_me:16554: checking declaration of size-change" >&5
 echo $ECHO_N "checking declaration of size-change... $ECHO_C" >&6
 if test "${cf_cv_sizechange+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -15438,7 +16566,7 @@
     CPPFLAGS="$cf_save_CPPFLAGS"
     test -n "$cf_opts" && CPPFLAGS="$CPPFLAGS -D$cf_opts"
     cat >conftest.$ac_ext <<_ACEOF
-#line 15441 "configure"
+#line 16569 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #ifdef HAVE_TERMIOS_H
@@ -15482,16 +16610,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:15485: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:16613: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:15488: \$? = $ac_status" >&5
+  echo "$as_me:16616: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:15491: \"$ac_try\"") >&5
+  { (eval echo "$as_me:16619: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:15494: \$? = $ac_status" >&5
+  echo "$as_me:16622: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   cf_cv_sizechange=yes
 else
@@ -15510,10 +16638,11 @@
 done
 
 fi
-echo "$as_me:15513: result: $cf_cv_sizechange" >&5
+echo "$as_me:16641: result: $cf_cv_sizechange" >&5
 echo "${ECHO_T}$cf_cv_sizechange" >&6
 if test "$cf_cv_sizechange" != no ; then
-	cat >>confdefs.h <<\EOF
+
+cat >>confdefs.h <<\EOF
 #define HAVE_SIZECHANGE 1
 EOF
 
@@ -15527,13 +16656,13 @@
 	esac
 fi
 
-echo "$as_me:15530: checking for memmove" >&5
+echo "$as_me:16659: checking for memmove" >&5
 echo $ECHO_N "checking for memmove... $ECHO_C" >&6
 if test "${ac_cv_func_memmove+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 15536 "configure"
+#line 16665 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char memmove (); below.  */
@@ -15556,7 +16685,7 @@
 #if defined (__stub_memmove) || defined (__stub___memmove)
 choke me
 #else
-f = memmove;
+f = memmove; /* workaround for ICC 12.0.3 */ if (f == 0) return 1;
 #endif
 
   ;
@@ -15564,16 +16693,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:15567: \"$ac_link\"") >&5
+if { (eval echo "$as_me:16696: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:15570: \$? = $ac_status" >&5
+  echo "$as_me:16699: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:15573: \"$ac_try\"") >&5
+  { (eval echo "$as_me:16702: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:15576: \$? = $ac_status" >&5
+  echo "$as_me:16705: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_func_memmove=yes
 else
@@ -15583,19 +16712,19 @@
 fi
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 fi
-echo "$as_me:15586: result: $ac_cv_func_memmove" >&5
+echo "$as_me:16715: result: $ac_cv_func_memmove" >&5
 echo "${ECHO_T}$ac_cv_func_memmove" >&6
 if test $ac_cv_func_memmove = yes; then
   :
 else
 
-echo "$as_me:15592: checking for bcopy" >&5
+echo "$as_me:16721: checking for bcopy" >&5
 echo $ECHO_N "checking for bcopy... $ECHO_C" >&6
 if test "${ac_cv_func_bcopy+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 15598 "configure"
+#line 16727 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char bcopy (); below.  */
@@ -15618,7 +16747,7 @@
 #if defined (__stub_bcopy) || defined (__stub___bcopy)
 choke me
 #else
-f = bcopy;
+f = bcopy; /* workaround for ICC 12.0.3 */ if (f == 0) return 1;
 #endif
 
   ;
@@ -15626,16 +16755,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:15629: \"$ac_link\"") >&5
+if { (eval echo "$as_me:16758: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:15632: \$? = $ac_status" >&5
+  echo "$as_me:16761: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:15635: \"$ac_try\"") >&5
+  { (eval echo "$as_me:16764: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:15638: \$? = $ac_status" >&5
+  echo "$as_me:16767: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_func_bcopy=yes
 else
@@ -15645,11 +16774,11 @@
 fi
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 fi
-echo "$as_me:15648: result: $ac_cv_func_bcopy" >&5
+echo "$as_me:16777: result: $ac_cv_func_bcopy" >&5
 echo "${ECHO_T}$ac_cv_func_bcopy" >&6
 if test $ac_cv_func_bcopy = yes; then
 
-	echo "$as_me:15652: checking if bcopy does overlapping moves" >&5
+	echo "$as_me:16781: checking if bcopy does overlapping moves" >&5
 echo $ECHO_N "checking if bcopy does overlapping moves... $ECHO_C" >&6
 if test "${cf_cv_good_bcopy+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -15659,7 +16788,7 @@
   cf_cv_good_bcopy=unknown
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 15662 "configure"
+#line 16791 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -15673,15 +16802,15 @@
 
 _ACEOF
 rm -f conftest$ac_exeext
-if { (eval echo "$as_me:15676: \"$ac_link\"") >&5
+if { (eval echo "$as_me:16805: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:15679: \$? = $ac_status" >&5
+  echo "$as_me:16808: \$? = $ac_status" >&5
   (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (eval echo "$as_me:15681: \"$ac_try\"") >&5
+  { (eval echo "$as_me:16810: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:15684: \$? = $ac_status" >&5
+  echo "$as_me:16813: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   cf_cv_good_bcopy=yes
 else
@@ -15694,7 +16823,7 @@
 fi
 
 fi
-echo "$as_me:15697: result: $cf_cv_good_bcopy" >&5
+echo "$as_me:16826: result: $cf_cv_good_bcopy" >&5
 echo "${ECHO_T}$cf_cv_good_bcopy" >&6
 
 else
@@ -15702,12 +16831,14 @@
 fi
 
 	if test "$cf_cv_good_bcopy" = yes ; then
-		cat >>confdefs.h <<\EOF
+
+cat >>confdefs.h <<\EOF
 #define USE_OK_BCOPY 1
 EOF
 
 	else
-		cat >>confdefs.h <<\EOF
+
+cat >>confdefs.h <<\EOF
 #define USE_MY_MEMMOVE 1
 EOF
 
@@ -15715,7 +16846,7 @@
 
 fi
 
-echo "$as_me:15718: checking if poll really works" >&5
+echo "$as_me:16849: checking if poll really works" >&5
 echo $ECHO_N "checking if poll really works... $ECHO_C" >&6
 if test "${cf_cv_working_poll+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -15725,10 +16856,13 @@
   cf_cv_working_poll=unknown
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 15728 "configure"
+#line 16859 "configure"
 #include "confdefs.h"
 
+#include <stdlib.h>
 #include <stdio.h>
+#include <unistd.h>
+#include <fcntl.h>
 #ifdef HAVE_POLL_H
 #include <poll.h>
 #else
@@ -15738,23 +16872,46 @@
 	struct pollfd myfds;
 	int ret;
 
-	myfds.fd = 0;
+	/* check for Darwin bug with respect to "devices" */
+	myfds.fd = open("/dev/null", 1);	/* O_WRONLY */
+	if (myfds.fd < 0)
+		myfds.fd = 0;
 	myfds.events = POLLIN;
+	myfds.revents = 0;
 
 	ret = poll(&myfds, 1, 100);
-	${cf_cv_main_return:-return}(ret != 0);
+
+	if (ret < 0 || (myfds.revents & POLLNVAL)) {
+		ret = -1;
+	} else {
+		int fd = 0;
+		if (!isatty(fd)) {
+			fd = open("/dev/tty", 2);	/* O_RDWR */
+		}
+
+		if (fd >= 0) {
+			/* also check with standard input */
+			myfds.fd = fd;
+			myfds.events = POLLIN;
+			myfds.revents = 0;
+			ret = poll(&myfds, 1, 100);
+		} else {
+			ret = -1;
+		}
+	}
+	${cf_cv_main_return:-return}(ret < 0);
 }
 _ACEOF
 rm -f conftest$ac_exeext
-if { (eval echo "$as_me:15749: \"$ac_link\"") >&5
+if { (eval echo "$as_me:16906: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:15752: \$? = $ac_status" >&5
+  echo "$as_me:16909: \$? = $ac_status" >&5
   (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (eval echo "$as_me:15754: \"$ac_try\"") >&5
+  { (eval echo "$as_me:16911: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:15757: \$? = $ac_status" >&5
+  echo "$as_me:16914: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   cf_cv_working_poll=yes
 else
@@ -15766,20 +16923,21 @@
 rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
 fi
-echo "$as_me:15769: result: $cf_cv_working_poll" >&5
+echo "$as_me:16926: result: $cf_cv_working_poll" >&5
 echo "${ECHO_T}$cf_cv_working_poll" >&6
-test "$cf_cv_working_poll" = "yes" && cat >>confdefs.h <<\EOF
+test "$cf_cv_working_poll" = "yes" &&
+cat >>confdefs.h <<\EOF
 #define HAVE_WORKING_POLL 1
 EOF
 
-echo "$as_me:15775: checking for va_copy" >&5
+echo "$as_me:16933: checking for va_copy" >&5
 echo $ECHO_N "checking for va_copy... $ECHO_C" >&6
 if test "${cf_cv_have_va_copy+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
 
 cat >conftest.$ac_ext <<_ACEOF
-#line 15782 "configure"
+#line 16940 "configure"
 #include "confdefs.h"
 
 #include <stdarg.h>
@@ -15796,16 +16954,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:15799: \"$ac_link\"") >&5
+if { (eval echo "$as_me:16957: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:15802: \$? = $ac_status" >&5
+  echo "$as_me:16960: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:15805: \"$ac_try\"") >&5
+  { (eval echo "$as_me:16963: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:15808: \$? = $ac_status" >&5
+  echo "$as_me:16966: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   cf_cv_have_va_copy=yes
 else
@@ -15815,21 +16973,22 @@
 fi
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 fi
-echo "$as_me:15818: result: $cf_cv_have_va_copy" >&5
+echo "$as_me:16976: result: $cf_cv_have_va_copy" >&5
 echo "${ECHO_T}$cf_cv_have_va_copy" >&6
 
-test "$cf_cv_have_va_copy" = yes && cat >>confdefs.h <<\EOF
+test "$cf_cv_have_va_copy" = yes &&
+cat >>confdefs.h <<\EOF
 #define HAVE_VA_COPY 1
 EOF
 
-echo "$as_me:15825: checking for __va_copy" >&5
+echo "$as_me:16984: checking for __va_copy" >&5
 echo $ECHO_N "checking for __va_copy... $ECHO_C" >&6
 if test "${cf_cv_have___va_copy+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
 
 cat >conftest.$ac_ext <<_ACEOF
-#line 15832 "configure"
+#line 16991 "configure"
 #include "confdefs.h"
 
 #include <stdarg.h>
@@ -15846,16 +17005,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:15849: \"$ac_link\"") >&5
+if { (eval echo "$as_me:17008: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:15852: \$? = $ac_status" >&5
+  echo "$as_me:17011: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:15855: \"$ac_try\"") >&5
+  { (eval echo "$as_me:17014: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:15858: \$? = $ac_status" >&5
+  echo "$as_me:17017: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   cf_cv_have___va_copy=yes
 else
@@ -15865,20 +17024,21 @@
 fi
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 fi
-echo "$as_me:15868: result: $cf_cv_have___va_copy" >&5
+echo "$as_me:17027: result: $cf_cv_have___va_copy" >&5
 echo "${ECHO_T}$cf_cv_have___va_copy" >&6
 
-test "$cf_cv_have___va_copy" = yes && cat >>confdefs.h <<\EOF
+test "$cf_cv_have___va_copy" = yes &&
+cat >>confdefs.h <<\EOF
 #define HAVE___VA_COPY 1
 EOF
 
-echo "$as_me:15875: checking for pid_t" >&5
+echo "$as_me:17035: checking for pid_t" >&5
 echo $ECHO_N "checking for pid_t... $ECHO_C" >&6
 if test "${ac_cv_type_pid_t+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 15881 "configure"
+#line 17041 "configure"
 #include "confdefs.h"
 $ac_includes_default
 int
@@ -15893,16 +17053,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:15896: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:17056: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:15899: \$? = $ac_status" >&5
+  echo "$as_me:17059: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:15902: \"$ac_try\"") >&5
+  { (eval echo "$as_me:17062: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:15905: \$? = $ac_status" >&5
+  echo "$as_me:17065: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_type_pid_t=yes
 else
@@ -15912,7 +17072,7 @@
 fi
 rm -f conftest.$ac_objext conftest.$ac_ext
 fi
-echo "$as_me:15915: result: $ac_cv_type_pid_t" >&5
+echo "$as_me:17075: result: $ac_cv_type_pid_t" >&5
 echo "${ECHO_T}$ac_cv_type_pid_t" >&6
 if test $ac_cv_type_pid_t = yes; then
   :
@@ -15927,23 +17087,23 @@
 for ac_header in unistd.h vfork.h
 do
 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-echo "$as_me:15930: checking for $ac_header" >&5
+echo "$as_me:17090: checking for $ac_header" >&5
 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
 if eval "test \"\${$as_ac_Header+set}\" = set"; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 15936 "configure"
+#line 17096 "configure"
 #include "confdefs.h"
 #include <$ac_header>
 _ACEOF
-if { (eval echo "$as_me:15940: \"$ac_cpp conftest.$ac_ext\"") >&5
+if { (eval echo "$as_me:17100: \"$ac_cpp conftest.$ac_ext\"") >&5
   (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
   ac_status=$?
   egrep -v '^ *\+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
-  echo "$as_me:15946: \$? = $ac_status" >&5
+  echo "$as_me:17106: \$? = $ac_status" >&5
   (exit $ac_status); } >/dev/null; then
   if test -s conftest.err; then
     ac_cpp_err=$ac_c_preproc_warn_flag
@@ -15962,7 +17122,7 @@
 fi
 rm -f conftest.err conftest.$ac_ext
 fi
-echo "$as_me:15965: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "$as_me:17125: result: `eval echo '${'$as_ac_Header'}'`" >&5
 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
 if test `eval echo '${'$as_ac_Header'}'` = yes; then
   cat >>confdefs.h <<EOF
@@ -15975,13 +17135,13 @@
 for ac_func in fork vfork
 do
 as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
-echo "$as_me:15978: checking for $ac_func" >&5
+echo "$as_me:17138: checking for $ac_func" >&5
 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
 if eval "test \"\${$as_ac_var+set}\" = set"; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 15984 "configure"
+#line 17144 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func (); below.  */
@@ -16004,7 +17164,7 @@
 #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
 choke me
 #else
-f = $ac_func;
+f = $ac_func; /* workaround for ICC 12.0.3 */ if (f == 0) return 1;
 #endif
 
   ;
@@ -16012,16 +17172,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:16015: \"$ac_link\"") >&5
+if { (eval echo "$as_me:17175: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:16018: \$? = $ac_status" >&5
+  echo "$as_me:17178: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:16021: \"$ac_try\"") >&5
+  { (eval echo "$as_me:17181: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:16024: \$? = $ac_status" >&5
+  echo "$as_me:17184: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   eval "$as_ac_var=yes"
 else
@@ -16031,7 +17191,7 @@
 fi
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 fi
-echo "$as_me:16034: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "$as_me:17194: result: `eval echo '${'$as_ac_var'}'`" >&5
 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
 if test `eval echo '${'$as_ac_var'}'` = yes; then
   cat >>confdefs.h <<EOF
@@ -16043,7 +17203,7 @@
 
 ac_cv_func_fork_works=$ac_cv_func_fork
 if test "x$ac_cv_func_fork" = xyes; then
-  echo "$as_me:16046: checking for working fork" >&5
+  echo "$as_me:17206: checking for working fork" >&5
 echo $ECHO_N "checking for working fork... $ECHO_C" >&6
 if test "${ac_cv_func_fork_works+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -16066,15 +17226,15 @@
       }
 _ACEOF
 rm -f conftest$ac_exeext
-if { (eval echo "$as_me:16069: \"$ac_link\"") >&5
+if { (eval echo "$as_me:17229: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:16072: \$? = $ac_status" >&5
+  echo "$as_me:17232: \$? = $ac_status" >&5
   (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (eval echo "$as_me:16074: \"$ac_try\"") >&5
+  { (eval echo "$as_me:17234: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:16077: \$? = $ac_status" >&5
+  echo "$as_me:17237: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_func_fork_works=yes
 else
@@ -16086,7 +17246,7 @@
 rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
 fi
-echo "$as_me:16089: result: $ac_cv_func_fork_works" >&5
+echo "$as_me:17249: result: $ac_cv_func_fork_works" >&5
 echo "${ECHO_T}$ac_cv_func_fork_works" >&6
 
 fi
@@ -16100,12 +17260,12 @@
       ac_cv_func_fork_works=yes
       ;;
   esac
-  { echo "$as_me:16103: WARNING: CROSS: Result $ac_cv_func_fork_works guessed due to cross-compiling." >&5
+  { echo "$as_me:17263: WARNING: CROSS: Result $ac_cv_func_fork_works guessed due to cross-compiling." >&5
 echo "$as_me: WARNING: CROSS: Result $ac_cv_func_fork_works guessed due to cross-compiling." >&2;}
 fi
 ac_cv_func_vfork_works=$ac_cv_func_vfork
 if test "x$ac_cv_func_vfork" = xyes; then
-  echo "$as_me:16108: checking for working vfork" >&5
+  echo "$as_me:17268: checking for working vfork" >&5
 echo $ECHO_N "checking for working vfork... $ECHO_C" >&6
 if test "${ac_cv_func_vfork_works+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -16114,7 +17274,7 @@
   ac_cv_func_vfork_works=cross
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 16117 "configure"
+#line 17277 "configure"
 #include "confdefs.h"
 /* Thanks to Paul Eggert for this test.  */
 #include <stdio.h>
@@ -16211,15 +17371,15 @@
 }
 _ACEOF
 rm -f conftest$ac_exeext
-if { (eval echo "$as_me:16214: \"$ac_link\"") >&5
+if { (eval echo "$as_me:17374: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:16217: \$? = $ac_status" >&5
+  echo "$as_me:17377: \$? = $ac_status" >&5
   (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (eval echo "$as_me:16219: \"$ac_try\"") >&5
+  { (eval echo "$as_me:17379: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:16222: \$? = $ac_status" >&5
+  echo "$as_me:17382: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_func_vfork_works=yes
 else
@@ -16231,13 +17391,13 @@
 rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
 fi
-echo "$as_me:16234: result: $ac_cv_func_vfork_works" >&5
+echo "$as_me:17394: result: $ac_cv_func_vfork_works" >&5
 echo "${ECHO_T}$ac_cv_func_vfork_works" >&6
 
 fi;
 if test "x$ac_cv_func_fork_works" = xcross; then
   ac_cv_func_vfork_works=ac_cv_func_vfork
-  { echo "$as_me:16240: WARNING: CROSS: Result $ac_cv_func_vfork_works guessed due to cross-compiling." >&5
+  { echo "$as_me:17400: WARNING: CROSS: Result $ac_cv_func_vfork_works guessed due to cross-compiling." >&5
 echo "$as_me: WARNING: CROSS: Result $ac_cv_func_vfork_works guessed due to cross-compiling." >&2;}
 fi
 
@@ -16264,7 +17424,7 @@
 
 # special check for test/ditto.c
 
-echo "$as_me:16267: checking for openpty in -lutil" >&5
+echo "$as_me:17427: checking for openpty in -lutil" >&5
 echo $ECHO_N "checking for openpty in -lutil... $ECHO_C" >&6
 if test "${ac_cv_lib_util_openpty+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -16272,7 +17432,7 @@
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lutil  $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
-#line 16275 "configure"
+#line 17435 "configure"
 #include "confdefs.h"
 
 /* Override any gcc2 internal prototype to avoid an error.  */
@@ -16291,16 +17451,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:16294: \"$ac_link\"") >&5
+if { (eval echo "$as_me:17454: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:16297: \$? = $ac_status" >&5
+  echo "$as_me:17457: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:16300: \"$ac_try\"") >&5
+  { (eval echo "$as_me:17460: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:16303: \$? = $ac_status" >&5
+  echo "$as_me:17463: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_lib_util_openpty=yes
 else
@@ -16311,7 +17471,7 @@
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-echo "$as_me:16314: result: $ac_cv_lib_util_openpty" >&5
+echo "$as_me:17474: result: $ac_cv_lib_util_openpty" >&5
 echo "${ECHO_T}$ac_cv_lib_util_openpty" >&6
 if test $ac_cv_lib_util_openpty = yes; then
   cf_cv_lib_util=yes
@@ -16319,7 +17479,7 @@
   cf_cv_lib_util=no
 fi
 
-echo "$as_me:16322: checking for openpty header" >&5
+echo "$as_me:17482: checking for openpty header" >&5
 echo $ECHO_N "checking for openpty header... $ECHO_C" >&6
 if test "${cf_cv_func_openpty+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -16330,7 +17490,7 @@
     for cf_header in pty.h libutil.h util.h
     do
     cat >conftest.$ac_ext <<_ACEOF
-#line 16333 "configure"
+#line 17493 "configure"
 #include "confdefs.h"
 
 #include <$cf_header>
@@ -16347,16 +17507,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:16350: \"$ac_link\"") >&5
+if { (eval echo "$as_me:17510: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:16353: \$? = $ac_status" >&5
+  echo "$as_me:17513: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:16356: \"$ac_try\"") >&5
+  { (eval echo "$as_me:17516: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:16359: \$? = $ac_status" >&5
+  echo "$as_me:17519: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
 
         cf_cv_func_openpty=$cf_header
@@ -16374,25 +17534,27 @@
     LIBS="$cf_save_LIBS"
 
 fi
-echo "$as_me:16377: result: $cf_cv_func_openpty" >&5
+echo "$as_me:17537: result: $cf_cv_func_openpty" >&5
 echo "${ECHO_T}$cf_cv_func_openpty" >&6
 
 if test "$cf_cv_func_openpty" != no ; then
-    cat >>confdefs.h <<EOF
+
+cat >>confdefs.h <<EOF
 #define USE_OPENPTY_HEADER <$cf_cv_func_openpty>
 EOF
 
-    cat >>confdefs.h <<\EOF
+cat >>confdefs.h <<\EOF
 #define USE_XTERM_PTY 1
 EOF
 
-    if test "$cf_cv_lib_util" = yes ; then
+    if test "x$cf_cv_lib_util" = xyes ; then
         TEST_LIBS="-lutil $TEST_LIBS"
     fi
 fi
 
 if test "$with_hashed_db" != no ; then
-	cat >>confdefs.h <<\EOF
+
+cat >>confdefs.h <<\EOF
 #define USE_HASHED_DB 1
 EOF
 
@@ -16426,7 +17588,7 @@
 			  cf_save_CPPFLAGS=$CPPFLAGS
 			  CPPFLAGS="$CPPFLAGS -I$cf_add_incdir"
 			  cat >conftest.$ac_ext <<_ACEOF
-#line 16429 "configure"
+#line 17591 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 int
@@ -16438,16 +17600,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:16441: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:17603: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:16444: \$? = $ac_status" >&5
+  echo "$as_me:17606: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:16447: \"$ac_try\"") >&5
+  { (eval echo "$as_me:17609: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:16450: \$? = $ac_status" >&5
+  echo "$as_me:17612: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   :
 else
@@ -16464,7 +17626,7 @@
 		if test "$cf_have_incdir" = no ; then
 		  test -n "$verbose" && echo "	adding $cf_add_incdir to include-path" 1>&6
 
-echo "${as_me:-configure}:16467: testing adding $cf_add_incdir to include-path ..." 1>&5
+echo "${as_me:-configure}:17629: testing adding $cf_add_incdir to include-path ..." 1>&5
 
 		  CPPFLAGS="$CPPFLAGS -I$cf_add_incdir"
 
@@ -16498,7 +17660,7 @@
       if test "$cf_have_libdir" = no ; then
         test -n "$verbose" && echo "	adding $cf_add_libdir to library-path" 1>&6
 
-echo "${as_me:-configure}:16501: testing adding $cf_add_libdir to library-path ..." 1>&5
+echo "${as_me:-configure}:17663: testing adding $cf_add_libdir to library-path ..." 1>&5
 
         LDFLAGS="-L$cf_add_libdir $LDFLAGS"
       fi
@@ -16509,23 +17671,23 @@
     fi
 esac
 
-echo "$as_me:16512: checking for db.h" >&5
+echo "$as_me:17674: checking for db.h" >&5
 echo $ECHO_N "checking for db.h... $ECHO_C" >&6
 if test "${ac_cv_header_db_h+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 16518 "configure"
+#line 17680 "configure"
 #include "confdefs.h"
 #include <db.h>
 _ACEOF
-if { (eval echo "$as_me:16522: \"$ac_cpp conftest.$ac_ext\"") >&5
+if { (eval echo "$as_me:17684: \"$ac_cpp conftest.$ac_ext\"") >&5
   (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
   ac_status=$?
   egrep -v '^ *\+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
-  echo "$as_me:16528: \$? = $ac_status" >&5
+  echo "$as_me:17690: \$? = $ac_status" >&5
   (exit $ac_status); } >/dev/null; then
   if test -s conftest.err; then
     ac_cpp_err=$ac_c_preproc_warn_flag
@@ -16544,11 +17706,11 @@
 fi
 rm -f conftest.err conftest.$ac_ext
 fi
-echo "$as_me:16547: result: $ac_cv_header_db_h" >&5
+echo "$as_me:17709: result: $ac_cv_header_db_h" >&5
 echo "${ECHO_T}$ac_cv_header_db_h" >&6
 if test $ac_cv_header_db_h = yes; then
 
-echo "$as_me:16551: checking for version of db" >&5
+echo "$as_me:17713: checking for version of db" >&5
 echo $ECHO_N "checking for version of db... $ECHO_C" >&6
 if test "${cf_cv_hashed_db_version+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -16559,10 +17721,10 @@
 for cf_db_version in 1 2 3 4 5
 do
 
-echo "${as_me:-configure}:16562: testing checking for db version $cf_db_version ..." 1>&5
+echo "${as_me:-configure}:17724: testing checking for db version $cf_db_version ..." 1>&5
 
 	cat >conftest.$ac_ext <<_ACEOF
-#line 16565 "configure"
+#line 17727 "configure"
 #include "confdefs.h"
 
 $ac_includes_default
@@ -16592,16 +17754,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:16595: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:17757: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:16598: \$? = $ac_status" >&5
+  echo "$as_me:17760: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:16601: \"$ac_try\"") >&5
+  { (eval echo "$as_me:17763: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:16604: \$? = $ac_status" >&5
+  echo "$as_me:17766: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
 
 	cf_cv_hashed_db_version=$cf_db_version
@@ -16615,16 +17777,16 @@
 done
 
 fi
-echo "$as_me:16618: result: $cf_cv_hashed_db_version" >&5
+echo "$as_me:17780: result: $cf_cv_hashed_db_version" >&5
 echo "${ECHO_T}$cf_cv_hashed_db_version" >&6
 
 if test "$cf_cv_hashed_db_version" = unknown ; then
-	{ { echo "$as_me:16622: error: Cannot determine version of db" >&5
+	{ { echo "$as_me:17784: error: Cannot determine version of db" >&5
 echo "$as_me: error: Cannot determine version of db" >&2;}
    { (exit 1); exit 1; }; }
 else
 
-echo "$as_me:16627: checking for db libraries" >&5
+echo "$as_me:17789: checking for db libraries" >&5
 echo $ECHO_N "checking for db libraries... $ECHO_C" >&6
 if test "${cf_cv_hashed_db_libs+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -16638,10 +17800,10 @@
 		LIBS="-l$cf_db_libs $LIBS"
 	fi
 
-echo "${as_me:-configure}:16641: testing checking for library "$cf_db_libs" ..." 1>&5
+echo "${as_me:-configure}:17803: testing checking for library "$cf_db_libs" ..." 1>&5
 
 	cat >conftest.$ac_ext <<_ACEOF
-#line 16644 "configure"
+#line 17806 "configure"
 #include "confdefs.h"
 
 $ac_includes_default
@@ -16696,16 +17858,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:16699: \"$ac_link\"") >&5
+if { (eval echo "$as_me:17861: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:16702: \$? = $ac_status" >&5
+  echo "$as_me:17864: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:16705: \"$ac_try\"") >&5
+  { (eval echo "$as_me:17867: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:16708: \$? = $ac_status" >&5
+  echo "$as_me:17870: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
 
 	if test -n "$cf_db_libs" ; then
@@ -16725,11 +17887,11 @@
 done
 
 fi
-echo "$as_me:16728: result: $cf_cv_hashed_db_libs" >&5
+echo "$as_me:17890: result: $cf_cv_hashed_db_libs" >&5
 echo "${ECHO_T}$cf_cv_hashed_db_libs" >&6
 
 	if test "$cf_cv_hashed_db_libs" = unknown ; then
-		{ { echo "$as_me:16732: error: Cannot determine library for db" >&5
+		{ { echo "$as_me:17894: error: Cannot determine library for db" >&5
 echo "$as_me: error: Cannot determine library for db" >&2;}
    { (exit 1); exit 1; }; }
 	elif test "$cf_cv_hashed_db_libs" != default ; then
@@ -16739,7 +17901,7 @@
 
 else
 
-	{ { echo "$as_me:16742: error: Cannot find db.h" >&5
+	{ { echo "$as_me:17904: error: Cannot find db.h" >&5
 echo "$as_me: error: Cannot find db.h" >&2;}
    { (exit 1); exit 1; }; }
 
@@ -16754,7 +17916,7 @@
 
 # Just in case, check if the C compiler has a bool type.
 
-echo "$as_me:16757: checking if we should include stdbool.h" >&5
+echo "$as_me:17919: checking if we should include stdbool.h" >&5
 echo $ECHO_N "checking if we should include stdbool.h... $ECHO_C" >&6
 
 if test "${cf_cv_header_stdbool_h+set}" = set; then
@@ -16762,7 +17924,7 @@
 else
 
 	cat >conftest.$ac_ext <<_ACEOF
-#line 16765 "configure"
+#line 17927 "configure"
 #include "confdefs.h"
 
 int
@@ -16774,23 +17936,23 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:16777: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:17939: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:16780: \$? = $ac_status" >&5
+  echo "$as_me:17942: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:16783: \"$ac_try\"") >&5
+  { (eval echo "$as_me:17945: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:16786: \$? = $ac_status" >&5
+  echo "$as_me:17948: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   cf_cv_header_stdbool_h=0
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
 cat >conftest.$ac_ext <<_ACEOF
-#line 16793 "configure"
+#line 17955 "configure"
 #include "confdefs.h"
 
 #ifndef __BEOS__
@@ -16806,16 +17968,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:16809: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:17971: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:16812: \$? = $ac_status" >&5
+  echo "$as_me:17974: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:16815: \"$ac_try\"") >&5
+  { (eval echo "$as_me:17977: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:16818: \$? = $ac_status" >&5
+  echo "$as_me:17980: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   cf_cv_header_stdbool_h=1
 else
@@ -16829,13 +17991,13 @@
 fi
 
 if test "$cf_cv_header_stdbool_h" = 1
-then	echo "$as_me:16832: result: yes" >&5
+then	echo "$as_me:17994: result: yes" >&5
 echo "${ECHO_T}yes" >&6
-else	echo "$as_me:16834: result: no" >&5
+else	echo "$as_me:17996: result: no" >&5
 echo "${ECHO_T}no" >&6
 fi
 
-echo "$as_me:16838: checking for builtin bool type" >&5
+echo "$as_me:18000: checking for builtin bool type" >&5
 echo $ECHO_N "checking for builtin bool type... $ECHO_C" >&6
 
 if test "${cf_cv_cc_bool_type+set}" = set; then
@@ -16843,7 +18005,7 @@
 else
 
 	cat >conftest.$ac_ext <<_ACEOF
-#line 16846 "configure"
+#line 18008 "configure"
 #include "confdefs.h"
 
 #include <stdio.h>
@@ -16858,16 +18020,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:16861: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:18023: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:16864: \$? = $ac_status" >&5
+  echo "$as_me:18026: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:16867: \"$ac_try\"") >&5
+  { (eval echo "$as_me:18029: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:16870: \$? = $ac_status" >&5
+  echo "$as_me:18032: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   cf_cv_cc_bool_type=1
 else
@@ -16880,9 +18042,9 @@
 fi
 
 if test "$cf_cv_cc_bool_type" = 1
-then	echo "$as_me:16883: result: yes" >&5
+then	echo "$as_me:18045: result: yes" >&5
 echo "${ECHO_T}yes" >&6
-else	echo "$as_me:16885: result: no" >&5
+else	echo "$as_me:18047: result: no" >&5
 echo "${ECHO_T}no" >&6
 fi
 
@@ -16904,7 +18066,7 @@
 	cf_stdcpp_libname=stdc++
 	;;
 esac
-echo "$as_me:16907: checking for library $cf_stdcpp_libname" >&5
+echo "$as_me:18069: checking for library $cf_stdcpp_libname" >&5
 echo $ECHO_N "checking for library $cf_stdcpp_libname... $ECHO_C" >&6
 if test "${cf_cv_libstdcpp+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -16913,7 +18075,7 @@
 	cf_save="$LIBS"
 	LIBS="-l$cf_stdcpp_libname $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
-#line 16916 "configure"
+#line 18078 "configure"
 #include "confdefs.h"
 
 #include <strstream.h>
@@ -16929,16 +18091,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:16932: \"$ac_link\"") >&5
+if { (eval echo "$as_me:18094: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:16935: \$? = $ac_status" >&5
+  echo "$as_me:18097: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:16938: \"$ac_try\"") >&5
+  { (eval echo "$as_me:18100: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:16941: \$? = $ac_status" >&5
+  echo "$as_me:18103: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   cf_cv_libstdcpp=yes
 else
@@ -16950,12 +18112,12 @@
 	LIBS="$cf_save"
 
 fi
-echo "$as_me:16953: result: $cf_cv_libstdcpp" >&5
+echo "$as_me:18115: result: $cf_cv_libstdcpp" >&5
 echo "${ECHO_T}$cf_cv_libstdcpp" >&6
 test "$cf_cv_libstdcpp" = yes && CXXLIBS="-l$cf_stdcpp_libname $CXXLIBS"
 fi
 
-	echo "$as_me:16958: checking whether $CXX understands -c and -o together" >&5
+	echo "$as_me:18120: checking whether $CXX understands -c and -o together" >&5
 echo $ECHO_N "checking whether $CXX understands -c and -o together... $ECHO_C" >&6
 if test "${cf_cv_prog_CXX_c_o+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -16971,15 +18133,15 @@
 # We do the test twice because some compilers refuse to overwrite an
 # existing .o file with -o, though they will create one.
 ac_try='$CXX -c conftest.$ac_ext -o conftest2.$ac_objext >&5'
-if { (eval echo "$as_me:16974: \"$ac_try\"") >&5
+if { (eval echo "$as_me:18136: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:16977: \$? = $ac_status" >&5
+  echo "$as_me:18139: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-  test -f conftest2.$ac_objext && { (eval echo "$as_me:16979: \"$ac_try\"") >&5
+  test -f conftest2.$ac_objext && { (eval echo "$as_me:18141: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:16982: \$? = $ac_status" >&5
+  echo "$as_me:18144: \$? = $ac_status" >&5
   (exit $ac_status); };
 then
   eval cf_cv_prog_CXX_c_o=yes
@@ -16990,10 +18152,10 @@
 
 fi
 if test $cf_cv_prog_CXX_c_o = yes; then
-  echo "$as_me:16993: result: yes" >&5
+  echo "$as_me:18155: result: yes" >&5
 echo "${ECHO_T}yes" >&6
 else
-  echo "$as_me:16996: result: no" >&5
+  echo "$as_me:18158: result: no" >&5
 echo "${ECHO_T}no" >&6
 fi
 
@@ -17013,12 +18175,12 @@
 	;;
 esac
 if test "$GXX" = yes; then
-	echo "$as_me:17016: checking for lib$cf_gpp_libname" >&5
+	echo "$as_me:18178: checking for lib$cf_gpp_libname" >&5
 echo $ECHO_N "checking for lib$cf_gpp_libname... $ECHO_C" >&6
 	cf_save="$LIBS"
 	LIBS="-l$cf_gpp_libname $LIBS"
 	cat >conftest.$ac_ext <<_ACEOF
-#line 17021 "configure"
+#line 18183 "configure"
 #include "confdefs.h"
 
 #include <$cf_gpp_libname/builtin.h>
@@ -17032,26 +18194,28 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:17035: \"$ac_link\"") >&5
+if { (eval echo "$as_me:18197: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:17038: \$? = $ac_status" >&5
+  echo "$as_me:18200: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:17041: \"$ac_try\"") >&5
+  { (eval echo "$as_me:18203: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:17044: \$? = $ac_status" >&5
+  echo "$as_me:18206: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   cf_cxx_library=yes
 	 CXXLIBS="-l$cf_gpp_libname $CXXLIBS"
 	 if test "$cf_gpp_libname" = cpp ; then
-	    cat >>confdefs.h <<\EOF
+
+cat >>confdefs.h <<\EOF
 #define HAVE_GPP_BUILTIN_H 1
 EOF
 
 	 else
-	    cat >>confdefs.h <<\EOF
+
+cat >>confdefs.h <<\EOF
 #define HAVE_GXX_BUILTIN_H 1
 EOF
 
@@ -17060,7 +18224,7 @@
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
 cat >conftest.$ac_ext <<_ACEOF
-#line 17063 "configure"
+#line 18227 "configure"
 #include "confdefs.h"
 
 #include <builtin.h>
@@ -17074,20 +18238,21 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:17077: \"$ac_link\"") >&5
+if { (eval echo "$as_me:18241: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:17080: \$? = $ac_status" >&5
+  echo "$as_me:18244: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:17083: \"$ac_try\"") >&5
+  { (eval echo "$as_me:18247: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:17086: \$? = $ac_status" >&5
+  echo "$as_me:18250: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   cf_cxx_library=yes
 	 CXXLIBS="-l$cf_gpp_libname $CXXLIBS"
-	 cat >>confdefs.h <<\EOF
+
+cat >>confdefs.h <<\EOF
 #define HAVE_BUILTIN_H 1
 EOF
 
@@ -17100,7 +18265,7 @@
 fi
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 	LIBS="$cf_save"
-	echo "$as_me:17103: result: $cf_cxx_library" >&5
+	echo "$as_me:18268: result: $cf_cxx_library" >&5
 echo "${ECHO_T}$cf_cxx_library" >&6
 fi
 
@@ -17116,7 +18281,7 @@
 ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
 ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
 ac_main_return=return
-echo "$as_me:17119: checking how to run the C++ preprocessor" >&5
+echo "$as_me:18284: checking how to run the C++ preprocessor" >&5
 echo $ECHO_N "checking how to run the C++ preprocessor... $ECHO_C" >&6
 if test -z "$CXXCPP"; then
   if test "${ac_cv_prog_CXXCPP+set}" = set; then
@@ -17133,18 +18298,18 @@
   # On the NeXT, cc -E runs the code through the compiler's parser,
   # not just through cpp. "Syntax error" is here to catch this case.
   cat >conftest.$ac_ext <<_ACEOF
-#line 17136 "configure"
+#line 18301 "configure"
 #include "confdefs.h"
 #include <assert.h>
                      Syntax error
 _ACEOF
-if { (eval echo "$as_me:17141: \"$ac_cpp conftest.$ac_ext\"") >&5
+if { (eval echo "$as_me:18306: \"$ac_cpp conftest.$ac_ext\"") >&5
   (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
   ac_status=$?
   egrep -v '^ *\+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
-  echo "$as_me:17147: \$? = $ac_status" >&5
+  echo "$as_me:18312: \$? = $ac_status" >&5
   (exit $ac_status); } >/dev/null; then
   if test -s conftest.err; then
     ac_cpp_err=$ac_cxx_preproc_warn_flag
@@ -17167,17 +18332,17 @@
   # OK, works on sane cases.  Now check whether non-existent headers
   # can be detected and how.
   cat >conftest.$ac_ext <<_ACEOF
-#line 17170 "configure"
+#line 18335 "configure"
 #include "confdefs.h"
 #include <ac_nonexistent.h>
 _ACEOF
-if { (eval echo "$as_me:17174: \"$ac_cpp conftest.$ac_ext\"") >&5
+if { (eval echo "$as_me:18339: \"$ac_cpp conftest.$ac_ext\"") >&5
   (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
   ac_status=$?
   egrep -v '^ *\+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
-  echo "$as_me:17180: \$? = $ac_status" >&5
+  echo "$as_me:18345: \$? = $ac_status" >&5
   (exit $ac_status); } >/dev/null; then
   if test -s conftest.err; then
     ac_cpp_err=$ac_cxx_preproc_warn_flag
@@ -17214,7 +18379,7 @@
 else
   ac_cv_prog_CXXCPP=$CXXCPP
 fi
-echo "$as_me:17217: result: $CXXCPP" >&5
+echo "$as_me:18382: result: $CXXCPP" >&5
 echo "${ECHO_T}$CXXCPP" >&6
 ac_preproc_ok=false
 for ac_cxx_preproc_warn_flag in '' yes
@@ -17224,18 +18389,18 @@
   # On the NeXT, cc -E runs the code through the compiler's parser,
   # not just through cpp. "Syntax error" is here to catch this case.
   cat >conftest.$ac_ext <<_ACEOF
-#line 17227 "configure"
+#line 18392 "configure"
 #include "confdefs.h"
 #include <assert.h>
                      Syntax error
 _ACEOF
-if { (eval echo "$as_me:17232: \"$ac_cpp conftest.$ac_ext\"") >&5
+if { (eval echo "$as_me:18397: \"$ac_cpp conftest.$ac_ext\"") >&5
   (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
   ac_status=$?
   egrep -v '^ *\+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
-  echo "$as_me:17238: \$? = $ac_status" >&5
+  echo "$as_me:18403: \$? = $ac_status" >&5
   (exit $ac_status); } >/dev/null; then
   if test -s conftest.err; then
     ac_cpp_err=$ac_cxx_preproc_warn_flag
@@ -17258,17 +18423,17 @@
   # OK, works on sane cases.  Now check whether non-existent headers
   # can be detected and how.
   cat >conftest.$ac_ext <<_ACEOF
-#line 17261 "configure"
+#line 18426 "configure"
 #include "confdefs.h"
 #include <ac_nonexistent.h>
 _ACEOF
-if { (eval echo "$as_me:17265: \"$ac_cpp conftest.$ac_ext\"") >&5
+if { (eval echo "$as_me:18430: \"$ac_cpp conftest.$ac_ext\"") >&5
   (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
   ac_status=$?
   egrep -v '^ *\+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
-  echo "$as_me:17271: \$? = $ac_status" >&5
+  echo "$as_me:18436: \$? = $ac_status" >&5
   (exit $ac_status); } >/dev/null; then
   if test -s conftest.err; then
     ac_cpp_err=$ac_cxx_preproc_warn_flag
@@ -17296,7 +18461,7 @@
 if $ac_preproc_ok; then
   :
 else
-  { { echo "$as_me:17299: error: C++ preprocessor \"$CXXCPP\" fails sanity check" >&5
+  { { echo "$as_me:18464: error: C++ preprocessor \"$CXXCPP\" fails sanity check" >&5
 echo "$as_me: error: C++ preprocessor \"$CXXCPP\" fails sanity check" >&2;}
    { (exit 1); exit 1; }; }
 fi
@@ -17308,26 +18473,74 @@
 ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
 ac_main_return=return
 
-for ac_header in iostream typeinfo
+for ac_header in typeinfo
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+echo "$as_me:18479: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+#line 18485 "configure"
+#include "confdefs.h"
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:18489: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  egrep -v '^ *\+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:18495: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_cxx_preproc_warn_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  eval "$as_ac_Header=yes"
+else
+  echo "$as_me: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  eval "$as_ac_Header=no"
+fi
+rm -f conftest.err conftest.$ac_ext
+fi
+echo "$as_me:18514: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<EOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+EOF
+
+fi
+done
+
+for ac_header in iostream
 do
 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-echo "$as_me:17314: checking for $ac_header" >&5
+echo "$as_me:18527: checking for $ac_header" >&5
 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
 if eval "test \"\${$as_ac_Header+set}\" = set"; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 17320 "configure"
+#line 18533 "configure"
 #include "confdefs.h"
 #include <$ac_header>
 _ACEOF
-if { (eval echo "$as_me:17324: \"$ac_cpp conftest.$ac_ext\"") >&5
+if { (eval echo "$as_me:18537: \"$ac_cpp conftest.$ac_ext\"") >&5
   (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
   ac_status=$?
   egrep -v '^ *\+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
-  echo "$as_me:17330: \$? = $ac_status" >&5
+  echo "$as_me:18543: \$? = $ac_status" >&5
   (exit $ac_status); } >/dev/null; then
   if test -s conftest.err; then
     ac_cpp_err=$ac_cxx_preproc_warn_flag
@@ -17346,7 +18559,7 @@
 fi
 rm -f conftest.err conftest.$ac_ext
 fi
-echo "$as_me:17349: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "$as_me:18562: result: `eval echo '${'$as_ac_Header'}'`" >&5
 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
 if test `eval echo '${'$as_ac_Header'}'` = yes; then
   cat >>confdefs.h <<EOF
@@ -17356,11 +18569,11 @@
 fi
 done
 
-    if test x"$ac_cv_header_iostream" = xyes ; then
-        echo "$as_me:17360: checking if iostream uses std-namespace" >&5
+if test x"$ac_cv_header_iostream" = xyes ; then
+	echo "$as_me:18573: checking if iostream uses std-namespace" >&5
 echo $ECHO_N "checking if iostream uses std-namespace... $ECHO_C" >&6
-        cat >conftest.$ac_ext <<_ACEOF
-#line 17363 "configure"
+	cat >conftest.$ac_ext <<_ACEOF
+#line 18576 "configure"
 #include "confdefs.h"
 
 #include <iostream>
@@ -17377,16 +18590,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:17380: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:18593: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:17383: \$? = $ac_status" >&5
+  echo "$as_me:18596: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:17386: \"$ac_try\"") >&5
+  { (eval echo "$as_me:18599: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:17389: \$? = $ac_status" >&5
+  echo "$as_me:18602: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   cf_iostream_namespace=yes
 else
@@ -17395,17 +18608,18 @@
 cf_iostream_namespace=no
 fi
 rm -f conftest.$ac_objext conftest.$ac_ext
-        echo "$as_me:17398: result: $cf_iostream_namespace" >&5
+	echo "$as_me:18611: result: $cf_iostream_namespace" >&5
 echo "${ECHO_T}$cf_iostream_namespace" >&6
-        if test "$cf_iostream_namespace" = yes ; then
-            cat >>confdefs.h <<\EOF
+	if test "$cf_iostream_namespace" = yes ; then
+
+cat >>confdefs.h <<\EOF
 #define IOSTREAM_NAMESPACE 1
 EOF
 
-        fi
-    fi
+	fi
+fi
 
-echo "$as_me:17408: checking if we should include stdbool.h" >&5
+echo "$as_me:18622: checking if we should include stdbool.h" >&5
 echo $ECHO_N "checking if we should include stdbool.h... $ECHO_C" >&6
 
 if test "${cf_cv_header_stdbool_h+set}" = set; then
@@ -17413,7 +18627,7 @@
 else
 
 	cat >conftest.$ac_ext <<_ACEOF
-#line 17416 "configure"
+#line 18630 "configure"
 #include "confdefs.h"
 
 int
@@ -17425,23 +18639,23 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:17428: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:18642: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:17431: \$? = $ac_status" >&5
+  echo "$as_me:18645: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:17434: \"$ac_try\"") >&5
+  { (eval echo "$as_me:18648: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:17437: \$? = $ac_status" >&5
+  echo "$as_me:18651: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   cf_cv_header_stdbool_h=0
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
 cat >conftest.$ac_ext <<_ACEOF
-#line 17444 "configure"
+#line 18658 "configure"
 #include "confdefs.h"
 
 #ifndef __BEOS__
@@ -17457,16 +18671,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:17460: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:18674: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:17463: \$? = $ac_status" >&5
+  echo "$as_me:18677: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:17466: \"$ac_try\"") >&5
+  { (eval echo "$as_me:18680: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:17469: \$? = $ac_status" >&5
+  echo "$as_me:18683: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   cf_cv_header_stdbool_h=1
 else
@@ -17480,13 +18694,13 @@
 fi
 
 if test "$cf_cv_header_stdbool_h" = 1
-then	echo "$as_me:17483: result: yes" >&5
+then	echo "$as_me:18697: result: yes" >&5
 echo "${ECHO_T}yes" >&6
-else	echo "$as_me:17485: result: no" >&5
+else	echo "$as_me:18699: result: no" >&5
 echo "${ECHO_T}no" >&6
 fi
 
-echo "$as_me:17489: checking for builtin bool type" >&5
+echo "$as_me:18703: checking for builtin bool type" >&5
 echo $ECHO_N "checking for builtin bool type... $ECHO_C" >&6
 
 if test "${cf_cv_builtin_bool+set}" = set; then
@@ -17494,7 +18708,7 @@
 else
 
 	cat >conftest.$ac_ext <<_ACEOF
-#line 17497 "configure"
+#line 18711 "configure"
 #include "confdefs.h"
 
 #include <stdio.h>
@@ -17509,16 +18723,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:17512: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:18726: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:17515: \$? = $ac_status" >&5
+  echo "$as_me:18729: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:17518: \"$ac_try\"") >&5
+  { (eval echo "$as_me:18732: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:17521: \$? = $ac_status" >&5
+  echo "$as_me:18735: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   cf_cv_builtin_bool=1
 else
@@ -17531,13 +18745,13 @@
 fi
 
 if test "$cf_cv_builtin_bool" = 1
-then	echo "$as_me:17534: result: yes" >&5
+then	echo "$as_me:18748: result: yes" >&5
 echo "${ECHO_T}yes" >&6
-else	echo "$as_me:17536: result: no" >&5
+else	echo "$as_me:18750: result: no" >&5
 echo "${ECHO_T}no" >&6
 fi
 
-echo "$as_me:17540: checking for size of bool" >&5
+echo "$as_me:18754: checking for size of bool" >&5
 echo $ECHO_N "checking for size of bool... $ECHO_C" >&6
 if test "${cf_cv_type_of_bool+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -17548,7 +18762,7 @@
   cf_cv_type_of_bool=unknown
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 17551 "configure"
+#line 18765 "configure"
 #include "confdefs.h"
 
 #include <stdlib.h>
@@ -17572,7 +18786,7 @@
 
 #endif
 
-main()
+int main()
 {
 	FILE *fp = fopen("cf_test.out", "w");
 	if (fp != 0) {
@@ -17590,15 +18804,15 @@
 
 _ACEOF
 rm -f conftest$ac_exeext
-if { (eval echo "$as_me:17593: \"$ac_link\"") >&5
+if { (eval echo "$as_me:18807: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:17596: \$? = $ac_status" >&5
+  echo "$as_me:18810: \$? = $ac_status" >&5
   (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (eval echo "$as_me:17598: \"$ac_try\"") >&5
+  { (eval echo "$as_me:18812: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:17601: \$? = $ac_status" >&5
+  echo "$as_me:18815: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   cf_cv_type_of_bool=`cat cf_test.out`
 		 if test -z "$cf_cv_type_of_bool"; then
@@ -17616,30 +18830,36 @@
 fi
 
 	rm -f cf_test.out
-echo "$as_me:17619: result: $cf_cv_type_of_bool" >&5
+echo "$as_me:18833: result: $cf_cv_type_of_bool" >&5
 echo "${ECHO_T}$cf_cv_type_of_bool" >&6
 if test "$cf_cv_type_of_bool" = unknown ; then
 	case .$NCURSES_BOOL in #(vi
 	.auto|.) NCURSES_BOOL=unsigned;;
 	esac
-	{ echo "$as_me:17625: WARNING: Assuming $NCURSES_BOOL for type of bool" >&5
+	{ echo "$as_me:18839: WARNING: Assuming $NCURSES_BOOL for type of bool" >&5
 echo "$as_me: WARNING: Assuming $NCURSES_BOOL for type of bool" >&2;}
 	cf_cv_type_of_bool=$NCURSES_BOOL
 fi
 
-echo "$as_me:17630: checking for special defines needed for etip.h" >&5
+echo "$as_me:18844: checking for special defines needed for etip.h" >&5
 echo $ECHO_N "checking for special defines needed for etip.h... $ECHO_C" >&6
 cf_save_CXXFLAGS="$CXXFLAGS"
 cf_result="none"
+
+# etip.h includes ncurses.h which includes ncurses_dll.h
+# But ncurses_dll.h is generated - fix here.
+test -d include || mkdir include
+test -f include/ncurses_dll.h || sed -e 's/@NCURSES_WRAP_PREFIX@/'$NCURSES_WRAP_PREFIX'/g' ${srcdir}/include/ncurses_dll.h.in >include/ncurses_dll.h
+
 for cf_math in "" MATH_H
 do
 for cf_excp in "" MATH_EXCEPTION
 do
-	CXXFLAGS="$cf_save_CXXFLAGS -I${srcdir}/c++ -I${srcdir}/menu -I${srcdir}/include"
+	CXXFLAGS="$cf_save_CXXFLAGS -I${srcdir}/c++ -I${srcdir}/menu -Iinclude -I${srcdir}/include"
 	test -n "$cf_math" && CXXFLAGS="$CXXFLAGS -DETIP_NEEDS_${cf_math}"
 	test -n "$cf_excp" && CXXFLAGS="$CXXFLAGS -DETIP_NEEDS_${cf_excp}"
 cat >conftest.$ac_ext <<_ACEOF
-#line 17642 "configure"
+#line 18862 "configure"
 #include "confdefs.h"
 
 #include <etip.h.in>
@@ -17653,16 +18873,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:17656: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:18876: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:17659: \$? = $ac_status" >&5
+  echo "$as_me:18879: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:17662: \"$ac_try\"") >&5
+  { (eval echo "$as_me:18882: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:17665: \$? = $ac_status" >&5
+  echo "$as_me:18885: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
 
 	test -n "$cf_math" && cat >>confdefs.h <<EOF
@@ -17674,7 +18894,7 @@
 EOF
 
 	cf_result="$cf_math $cf_excp"
-	break
+	break 2
 
 else
   echo "$as_me: failed program was:" >&5
@@ -17683,12 +18903,12 @@
 rm -f conftest.$ac_objext conftest.$ac_ext
 done
 done
-echo "$as_me:17686: result: $cf_result" >&5
+echo "$as_me:18906: result: $cf_result" >&5
 echo "${ECHO_T}$cf_result" >&6
 CXXFLAGS="$cf_save_CXXFLAGS"
 
 if test -n "$CXX"; then
-echo "$as_me:17691: checking if $CXX accepts parameter initialization" >&5
+echo "$as_me:18911: checking if $CXX accepts parameter initialization" >&5
 echo $ECHO_N "checking if $CXX accepts parameter initialization... $ECHO_C" >&6
 if test "${cf_cv_cpp_param_init+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -17705,7 +18925,7 @@
   cf_cv_cpp_param_init=unknown
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 17708 "configure"
+#line 18928 "configure"
 #include "confdefs.h"
 
 class TEST {
@@ -17720,19 +18940,19 @@
 {
 	value = x;
 }
-void main() { }
+int main() { }
 
 _ACEOF
 rm -f conftest$ac_exeext
-if { (eval echo "$as_me:17727: \"$ac_link\"") >&5
+if { (eval echo "$as_me:18947: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:17730: \$? = $ac_status" >&5
+  echo "$as_me:18950: \$? = $ac_status" >&5
   (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (eval echo "$as_me:17732: \"$ac_try\"") >&5
+  { (eval echo "$as_me:18952: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:17735: \$? = $ac_status" >&5
+  echo "$as_me:18955: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   cf_cv_cpp_param_init=yes
 else
@@ -17751,16 +18971,17 @@
 ac_main_return=return
 
 fi
-echo "$as_me:17754: result: $cf_cv_cpp_param_init" >&5
+echo "$as_me:18974: result: $cf_cv_cpp_param_init" >&5
 echo "${ECHO_T}$cf_cv_cpp_param_init" >&6
 fi
-test "$cf_cv_cpp_param_init" = yes && cat >>confdefs.h <<\EOF
+test "$cf_cv_cpp_param_init" = yes &&
+cat >>confdefs.h <<\EOF
 #define CPP_HAS_PARAM_INIT 1
 EOF
 
 if test -n "$CXX"; then
 
-echo "$as_me:17763: checking if $CXX accepts static_cast" >&5
+echo "$as_me:18984: checking if $CXX accepts static_cast" >&5
 echo $ECHO_N "checking if $CXX accepts static_cast... $ECHO_C" >&6
 if test "${cf_cv_cpp_static_cast+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -17774,7 +18995,7 @@
 ac_main_return=return
 
 	cat >conftest.$ac_ext <<_ACEOF
-#line 17777 "configure"
+#line 18998 "configure"
 #include "confdefs.h"
 
 class NCursesPanel
@@ -17786,7 +19007,7 @@
 	       int begin_x = 0)
   {
   }
-
+  NCursesPanel();
   ~NCursesPanel();
 };
 
@@ -17818,16 +19039,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:17821: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:19042: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:17824: \$? = $ac_status" >&5
+  echo "$as_me:19045: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:17827: \"$ac_try\"") >&5
+  { (eval echo "$as_me:19048: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:17830: \$? = $ac_status" >&5
+  echo "$as_me:19051: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   cf_cv_cpp_static_cast=yes
 else
@@ -17845,12 +19066,13 @@
 ac_main_return=return
 
 fi
-echo "$as_me:17848: result: $cf_cv_cpp_static_cast" >&5
+echo "$as_me:19069: result: $cf_cv_cpp_static_cast" >&5
 echo "${ECHO_T}$cf_cv_cpp_static_cast" >&6
 
 fi
 
-test "$cf_cv_cpp_static_cast" = yes && cat >>confdefs.h <<\EOF
+test "$cf_cv_cpp_static_cast" = yes &&
+cat >>confdefs.h <<\EOF
 #define CPP_HAS_STATIC_CAST 1
 EOF
 
@@ -17893,7 +19115,7 @@
 	else
 		if test "$cf_cv_header_stdbool_h" = 1 ; then
 
-echo "$as_me:17896: checking for size of bool" >&5
+echo "$as_me:19118: checking for size of bool" >&5
 echo $ECHO_N "checking for size of bool... $ECHO_C" >&6
 if test "${cf_cv_type_of_bool+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -17904,7 +19126,7 @@
   cf_cv_type_of_bool=unknown
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 17907 "configure"
+#line 19129 "configure"
 #include "confdefs.h"
 
 #include <stdlib.h>
@@ -17928,7 +19150,7 @@
 
 #endif
 
-main()
+int main()
 {
 	FILE *fp = fopen("cf_test.out", "w");
 	if (fp != 0) {
@@ -17946,15 +19168,15 @@
 
 _ACEOF
 rm -f conftest$ac_exeext
-if { (eval echo "$as_me:17949: \"$ac_link\"") >&5
+if { (eval echo "$as_me:19171: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:17952: \$? = $ac_status" >&5
+  echo "$as_me:19174: \$? = $ac_status" >&5
   (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (eval echo "$as_me:17954: \"$ac_try\"") >&5
+  { (eval echo "$as_me:19176: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:17957: \$? = $ac_status" >&5
+  echo "$as_me:19179: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   cf_cv_type_of_bool=`cat cf_test.out`
 		 if test -z "$cf_cv_type_of_bool"; then
@@ -17972,25 +19194,25 @@
 fi
 
 	rm -f cf_test.out
-echo "$as_me:17975: result: $cf_cv_type_of_bool" >&5
+echo "$as_me:19197: result: $cf_cv_type_of_bool" >&5
 echo "${ECHO_T}$cf_cv_type_of_bool" >&6
 if test "$cf_cv_type_of_bool" = unknown ; then
 	case .$NCURSES_BOOL in #(vi
 	.auto|.) NCURSES_BOOL=unsigned;;
 	esac
-	{ echo "$as_me:17981: WARNING: Assuming $NCURSES_BOOL for type of bool" >&5
+	{ echo "$as_me:19203: WARNING: Assuming $NCURSES_BOOL for type of bool" >&5
 echo "$as_me: WARNING: Assuming $NCURSES_BOOL for type of bool" >&2;}
 	cf_cv_type_of_bool=$NCURSES_BOOL
 fi
 
 		else
-			echo "$as_me:17987: checking for fallback type of bool" >&5
+			echo "$as_me:19209: checking for fallback type of bool" >&5
 echo $ECHO_N "checking for fallback type of bool... $ECHO_C" >&6
 			case "$host_cpu" in #(vi
 			i?86)	cf_cv_type_of_bool=char	;; #(vi
 			*)	cf_cv_type_of_bool=int	;;
 			esac
-			echo "$as_me:17993: result: $cf_cv_type_of_bool" >&5
+			echo "$as_me:19215: result: $cf_cv_type_of_bool" >&5
 echo "${ECHO_T}$cf_cv_type_of_bool" >&6
 		fi
 	fi
@@ -18019,7 +19241,7 @@
 
 	if test "$cf_with_ada" != "no" ; then
 		if test "$with_libtool" != "no"; then
-			{ echo "$as_me:18022: WARNING: libtool does not support Ada - disabling feature" >&5
+			{ echo "$as_me:19244: WARNING: libtool does not support Ada - disabling feature" >&5
 echo "$as_me: WARNING: libtool does not support Ada - disabling feature" >&2;}
 			cf_with_ada=no
 		fi
@@ -18030,7 +19252,7 @@
 cf_ada_make=gnatmake
 # Extract the first word of "$cf_ada_make", so it can be a program name with args.
 set dummy $cf_ada_make; ac_word=$2
-echo "$as_me:18033: checking for $ac_word" >&5
+echo "$as_me:19255: checking for $ac_word" >&5
 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
 if test "${ac_cv_prog_gnat_exists+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -18045,7 +19267,7 @@
   test -z "$ac_dir" && ac_dir=.
   $as_executable_p "$ac_dir/$ac_word" || continue
 ac_cv_prog_gnat_exists="yes"
-echo "$as_me:18048: found $ac_dir/$ac_word" >&5
+echo "$as_me:19270: found $ac_dir/$ac_word" >&5
 break
 done
 
@@ -18054,31 +19276,32 @@
 fi
 gnat_exists=$ac_cv_prog_gnat_exists
 if test -n "$gnat_exists"; then
-  echo "$as_me:18057: result: $gnat_exists" >&5
+  echo "$as_me:19279: result: $gnat_exists" >&5
 echo "${ECHO_T}$gnat_exists" >&6
 else
-  echo "$as_me:18060: result: no" >&5
+  echo "$as_me:19282: result: no" >&5
 echo "${ECHO_T}no" >&6
 fi
 
 if test "$ac_cv_prog_gnat_exists" = no; then
    cf_ada_make=
+   cf_cv_prog_gnat_correct=no
 else
 
-echo "$as_me:18068: checking for gnat version" >&5
+echo "$as_me:19291: checking for gnat version" >&5
 echo $ECHO_N "checking for gnat version... $ECHO_C" >&6
 cf_gnat_version=`${cf_ada_make:-gnatmake} -v 2>&1 | \
 	grep '[0-9].[0-9][0-9]*' |\
     sed -e '2,$d' -e 's/[^0-9 \.]//g' -e 's/^[ ]*//' -e 's/ .*//'`
-echo "$as_me:18073: result: $cf_gnat_version" >&5
+echo "$as_me:19296: result: $cf_gnat_version" >&5
 echo "${ECHO_T}$cf_gnat_version" >&6
 
 case $cf_gnat_version in #(vi
-3.1[1-9]*|3.[2-9]*|[4-9].*) #(vi
+3.1[1-9]*|3.[2-9]*|[4-9].*|20[0-9][0-9]) #(vi
 	cf_cv_prog_gnat_correct=yes
 	;;
 *)
-	{ echo "$as_me:18081: WARNING: Unsupported GNAT version $cf_gnat_version. We require 3.11 or better. Disabling Ada95 binding." >&5
+	{ echo "$as_me:19304: WARNING: Unsupported GNAT version $cf_gnat_version. We require 3.11 or better. Disabling Ada95 binding." >&5
 echo "$as_me: WARNING: Unsupported GNAT version $cf_gnat_version. We require 3.11 or better. Disabling Ada95 binding." >&2;}
 	cf_cv_prog_gnat_correct=no
 	;;
@@ -18086,7 +19309,7 @@
 
    # Extract the first word of "m4", so it can be a program name with args.
 set dummy m4; ac_word=$2
-echo "$as_me:18089: checking for $ac_word" >&5
+echo "$as_me:19312: checking for $ac_word" >&5
 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
 if test "${ac_cv_prog_M4_exists+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -18101,7 +19324,7 @@
   test -z "$ac_dir" && ac_dir=.
   $as_executable_p "$ac_dir/$ac_word" || continue
 ac_cv_prog_M4_exists="yes"
-echo "$as_me:18104: found $ac_dir/$ac_word" >&5
+echo "$as_me:19327: found $ac_dir/$ac_word" >&5
 break
 done
 
@@ -18110,10 +19333,10 @@
 fi
 M4_exists=$ac_cv_prog_M4_exists
 if test -n "$M4_exists"; then
-  echo "$as_me:18113: result: $M4_exists" >&5
+  echo "$as_me:19336: result: $M4_exists" >&5
 echo "${ECHO_T}$M4_exists" >&6
 else
-  echo "$as_me:18116: result: no" >&5
+  echo "$as_me:19339: result: no" >&5
 echo "${ECHO_T}no" >&6
 fi
 
@@ -18122,7 +19345,7 @@
       echo Ada95 binding required program m4 not found. Ada95 binding disabled.
    fi
    if test "$cf_cv_prog_gnat_correct" = yes; then
-      echo "$as_me:18125: checking if GNAT works" >&5
+      echo "$as_me:19348: checking if GNAT works" >&5
 echo $ECHO_N "checking if GNAT works... $ECHO_C" >&6
 
 rm -rf conftest* *~conftest*
@@ -18150,32 +19373,36 @@
 fi
 rm -rf conftest* *~conftest*
 
-      echo "$as_me:18153: result: $cf_cv_prog_gnat_correct" >&5
+      echo "$as_me:19376: result: $cf_cv_prog_gnat_correct" >&5
 echo "${ECHO_T}$cf_cv_prog_gnat_correct" >&6
    fi
 fi
 
-		if test	"$cf_cv_prog_gnat_correct" = yes; then
+		if test	"x$cf_cv_prog_gnat_correct" = xyes; then
 
  	ADAFLAGS="$ADAFLAGS -gnatpn"
 
-			# make ADAFLAGS consistent with CFLAGS
-			case "$CFLAGS" in
-			*-g*)
+	echo "$as_me:19385: checking optimization options for ADAFLAGS" >&5
+echo $ECHO_N "checking optimization options for ADAFLAGS... $ECHO_C" >&6
+	case "$CFLAGS" in
+	*-g*)
 
  	ADAFLAGS="$ADAFLAGS -g"
 
-				;;
-			esac
-			case "$CFLAGS" in
-			*-O*)
+		;;
+	esac
+	case "$CFLAGS" in
+	*-O*)
+		cf_O_flag=`echo "$CFLAGS" |sed -e 's/^.*-O/-O/' -e 's/[ 	].*//'`
 
- 	ADAFLAGS="$ADAFLAGS -O3"
+ 	ADAFLAGS="$ADAFLAGS $cf_O_flag"
 
-				;;
-			esac
+		;;
+	esac
+	echo "$as_me:19402: result: $ADAFLAGS" >&5
+echo "${ECHO_T}$ADAFLAGS" >&6
 
-echo "$as_me:18178: checking if GNAT supports generics" >&5
+echo "$as_me:19405: checking if GNAT supports generics" >&5
 echo $ECHO_N "checking if GNAT supports generics... $ECHO_C" >&6
 case $cf_gnat_version in #(vi
 3.[1-9]*|[4-9].*) #(vi
@@ -18185,7 +19412,7 @@
 	cf_gnat_generics=no
 	;;
 esac
-echo "$as_me:18188: result: $cf_gnat_generics" >&5
+echo "$as_me:19415: result: $cf_gnat_generics" >&5
 echo "${ECHO_T}$cf_gnat_generics" >&6
 
 if test "$cf_gnat_generics" = yes
@@ -18197,7 +19424,7 @@
 	cf_generic_objects=
 fi
 
-echo "$as_me:18200: checking if GNAT supports SIGINT" >&5
+echo "$as_me:19427: checking if GNAT supports SIGINT" >&5
 echo $ECHO_N "checking if GNAT supports SIGINT... $ECHO_C" >&6
 if test "${cf_cv_gnat_sigint+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -18245,7 +19472,7 @@
 rm -rf conftest* *~conftest*
 
 fi
-echo "$as_me:18248: result: $cf_cv_gnat_sigint" >&5
+echo "$as_me:19475: result: $cf_cv_gnat_sigint" >&5
 echo "${ECHO_T}$cf_cv_gnat_sigint" >&6
 
 if test $cf_cv_gnat_sigint = yes ; then
@@ -18254,7 +19481,7 @@
 	USE_GNAT_SIGINT="#"
 fi
 
-echo "$as_me:18257: checking if GNAT pragma Unreferenced works" >&5
+echo "$as_me:19484: checking if GNAT pragma Unreferenced works" >&5
 echo $ECHO_N "checking if GNAT pragma Unreferenced works... $ECHO_C" >&6
 if test "${cf_cv_pragma_unreferenced+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -18285,7 +19512,7 @@
 rm -rf conftest* *~conftest*
 
 fi
-echo "$as_me:18288: result: $cf_cv_pragma_unreferenced" >&5
+echo "$as_me:19515: result: $cf_cv_pragma_unreferenced" >&5
 echo "${ECHO_T}$cf_cv_pragma_unreferenced" >&6
 
 # if the pragma is supported, use it (needed in the Trace code).
@@ -18298,7 +19525,7 @@
 cf_gnat_libraries=no
 cf_gnat_projects=no
 
-echo "$as_me:18301: checking if GNAT supports project files" >&5
+echo "$as_me:19528: checking if GNAT supports project files" >&5
 echo $ECHO_N "checking if GNAT supports project files... $ECHO_C" >&6
 case $cf_gnat_version in #(vi
 3.[0-9]*) #(vi
@@ -18366,14 +19593,14 @@
 	esac
 	;;
 esac
-echo "$as_me:18369: result: $cf_gnat_projects" >&5
+echo "$as_me:19596: result: $cf_gnat_projects" >&5
 echo "${ECHO_T}$cf_gnat_projects" >&6
 
 if test $cf_gnat_projects = yes
 then
-	echo "$as_me:18374: checking if GNAT supports libraries" >&5
+	echo "$as_me:19601: checking if GNAT supports libraries" >&5
 echo $ECHO_N "checking if GNAT supports libraries... $ECHO_C" >&6
-	echo "$as_me:18376: result: $cf_gnat_libraries" >&5
+	echo "$as_me:19603: result: $cf_gnat_libraries" >&5
 echo "${ECHO_T}$cf_gnat_libraries" >&6
 fi
 
@@ -18393,7 +19620,7 @@
 	USE_GNAT_LIBRARIES="#"
 fi
 
-echo "$as_me:18396: checking for ada-compiler" >&5
+echo "$as_me:19623: checking for ada-compiler" >&5
 echo $ECHO_N "checking for ada-compiler... $ECHO_C" >&6
 
 # Check whether --with-ada-compiler or --without-ada-compiler was given.
@@ -18404,12 +19631,12 @@
   cf_ada_compiler=gnatmake
 fi;
 
-echo "$as_me:18407: result: $cf_ada_compiler" >&5
+echo "$as_me:19634: result: $cf_ada_compiler" >&5
 echo "${ECHO_T}$cf_ada_compiler" >&6
 
 			cf_ada_package=terminal_interface
 
-echo "$as_me:18412: checking for ada-include" >&5
+echo "$as_me:19639: checking for ada-include" >&5
 echo $ECHO_N "checking for ada-include... $ECHO_C" >&6
 
 # Check whether --with-ada-include or --without-ada-include was given.
@@ -18433,7 +19660,7 @@
   ;;
 .[a-zA-Z]:[\\/]*) #(vi OS/2 EMX
   ;;
-.\${*prefix}*) #(vi
+.\${*prefix}*|.\${*dir}*) #(vi
   eval withval="$withval"
   case ".$withval" in #(vi
   .NONE/*)
@@ -18445,19 +19672,19 @@
   withval=`echo $withval | sed -e s%NONE%$cf_path_syntax%`
   ;;
 *)
-  { { echo "$as_me:18448: error: expected a pathname, not \"$withval\"" >&5
+  { { echo "$as_me:19675: error: expected a pathname, not \"$withval\"" >&5
 echo "$as_me: error: expected a pathname, not \"$withval\"" >&2;}
    { (exit 1); exit 1; }; }
   ;;
 esac
 
 fi
-ADA_INCLUDE="$withval"
+eval ADA_INCLUDE="$withval"
 
-echo "$as_me:18457: result: $ADA_INCLUDE" >&5
+echo "$as_me:19684: result: $ADA_INCLUDE" >&5
 echo "${ECHO_T}$ADA_INCLUDE" >&6
 
-echo "$as_me:18460: checking for ada-objects" >&5
+echo "$as_me:19687: checking for ada-objects" >&5
 echo $ECHO_N "checking for ada-objects... $ECHO_C" >&6
 
 # Check whether --with-ada-objects or --without-ada-objects was given.
@@ -18481,7 +19708,7 @@
   ;;
 .[a-zA-Z]:[\\/]*) #(vi OS/2 EMX
   ;;
-.\${*prefix}*) #(vi
+.\${*prefix}*|.\${*dir}*) #(vi
   eval withval="$withval"
   case ".$withval" in #(vi
   .NONE/*)
@@ -18493,19 +19720,19 @@
   withval=`echo $withval | sed -e s%NONE%$cf_path_syntax%`
   ;;
 *)
-  { { echo "$as_me:18496: error: expected a pathname, not \"$withval\"" >&5
+  { { echo "$as_me:19723: error: expected a pathname, not \"$withval\"" >&5
 echo "$as_me: error: expected a pathname, not \"$withval\"" >&2;}
    { (exit 1); exit 1; }; }
   ;;
 esac
 
 fi
-ADA_OBJECTS="$withval"
+eval ADA_OBJECTS="$withval"
 
-echo "$as_me:18505: result: $ADA_OBJECTS" >&5
+echo "$as_me:19732: result: $ADA_OBJECTS" >&5
 echo "${ECHO_T}$ADA_OBJECTS" >&6
 
-echo "$as_me:18508: checking if an Ada95 shared-library should be built" >&5
+echo "$as_me:19735: checking if an Ada95 shared-library should be built" >&5
 echo $ECHO_N "checking if an Ada95 shared-library should be built... $ECHO_C" >&6
 
 # Check whether --with-ada-sharedlib or --without-ada-sharedlib was given.
@@ -18515,7 +19742,7 @@
 else
   with_ada_sharedlib=no
 fi;
-echo "$as_me:18518: result: $with_ada_sharedlib" >&5
+echo "$as_me:19745: result: $with_ada_sharedlib" >&5
 echo "${ECHO_T}$with_ada_sharedlib" >&6
 
 ADA_SHAREDLIB='lib$(LIB_NAME).so.1'
@@ -18546,11 +19773,11 @@
 ### chooses to split module lists into libraries.
 ###
 ### (see CF_LIB_RULES).
-echo "$as_me:18549: checking for library subsets" >&5
+echo "$as_me:19776: checking for library subsets" >&5
 echo $ECHO_N "checking for library subsets... $ECHO_C" >&6
 LIB_SUBSETS=
 
-if test "$cf_with_progs" = yes || test "$with_ticlib" != no || test "$with_termcap" != no; then
+if test "x$cf_with_progs" = xyes || test "$with_ticlib" != no || test "$with_termcap" != no; then
 	LIB_SUBSETS="${LIB_SUBSETS}ticlib"
 	if test "$with_ticlib" != no ; then
 		LIB_SUBSETS="${LIB_SUBSETS} "
@@ -18560,7 +19787,7 @@
 fi
 
 LIB_SUBSETS="${LIB_SUBSETS}termlib"
-test "$with_ext_funcs" = yes && LIB_SUBSETS="${LIB_SUBSETS}+ext_tinfo"
+test "x$with_ext_funcs" = xyes && LIB_SUBSETS="${LIB_SUBSETS}+ext_tinfo"
 
 if test "$with_termlib" != no ; then
 	LIB_SUBSETS="${LIB_SUBSETS} "
@@ -18584,29 +19811,29 @@
 	esac
 fi
 
-test "$with_widec"     = yes && LIB_SUBSETS="${LIB_SUBSETS}+widechar"
-test "$with_ext_funcs" = yes && LIB_SUBSETS="${LIB_SUBSETS}+ext_funcs"
+test "x$with_widec"     = xyes && LIB_SUBSETS="${LIB_SUBSETS}+widechar"
+test "x$with_ext_funcs" = xyes && LIB_SUBSETS="${LIB_SUBSETS}+ext_funcs"
 
-echo "$as_me:18590: result: $LIB_SUBSETS" >&5
+echo "$as_me:19817: result: $LIB_SUBSETS" >&5
 echo "${ECHO_T}$LIB_SUBSETS" >&6
 
 ### Construct the list of include-directories to be generated
 
-CPPFLAGS="$CPPFLAGS -I. -I../include"
-if test "$srcdir" != "."; then
-	CPPFLAGS="$CPPFLAGS -I\${srcdir}/../include"
-fi
 if test "$GCC" != yes; then
-	CPPFLAGS="$CPPFLAGS -I\${includedir}"
+	CPPFLAGS="-I\${includedir} $CPPFLAGS"
 elif test "$includedir" != "/usr/include"; then
 	if test "$includedir" = '${prefix}/include' ; then
 		if test $prefix != /usr ; then
-			CPPFLAGS="$CPPFLAGS -I\${includedir}"
+			CPPFLAGS="-I\${includedir} $CPPFLAGS"
 		fi
 	else
-		CPPFLAGS="$CPPFLAGS -I\${includedir}"
+		CPPFLAGS="-I\${includedir} $CPPFLAGS"
 	fi
 fi
+if test "$srcdir" != "."; then
+	CPPFLAGS="-I\${srcdir}/../include $CPPFLAGS"
+fi
+CPPFLAGS="-I. -I../include $CPPFLAGS"
 
 ACPPFLAGS="-I. -I../include -I../../include $ACPPFLAGS"
 if test "$srcdir" != "."; then
@@ -18625,7 +19852,7 @@
 fi
 
 ### Build up pieces for makefile rules
-echo "$as_me:18628: checking default library suffix" >&5
+echo "$as_me:19855: checking default library suffix" >&5
 echo $ECHO_N "checking default library suffix... $ECHO_C" >&6
 
 	case $DFT_LWR_MODEL in
@@ -18636,10 +19863,10 @@
 	shared)  DFT_ARG_SUFFIX=''   ;;
 	esac
 	test -n "$LIB_SUFFIX" && DFT_ARG_SUFFIX="${LIB_SUFFIX}${DFT_ARG_SUFFIX}"
-echo "$as_me:18639: result: $DFT_ARG_SUFFIX" >&5
+echo "$as_me:19866: result: $DFT_ARG_SUFFIX" >&5
 echo "${ECHO_T}$DFT_ARG_SUFFIX" >&6
 
-echo "$as_me:18642: checking default library-dependency suffix" >&5
+echo "$as_me:19869: checking default library-dependency suffix" >&5
 echo $ECHO_N "checking default library-dependency suffix... $ECHO_C" >&6
 
 	case $DFT_LWR_MODEL in #(vi
@@ -18661,11 +19888,11 @@
 		;;
 	shared) #(vi
 		case $cf_cv_system_name in
-		aix[56]*) #(vi
+		aix[5-7]*) #(vi
 			DFT_LIB_SUFFIX='.a'
 			DFT_DEP_SUFFIX=$DFT_LIB_SUFFIX
 			;;
-		cygwin*) #(vi
+		cygwin*|mingw*) #(vi
 			DFT_LIB_SUFFIX='.dll'
 			DFT_DEP_SUFFIX='.dll.a'
 			;;
@@ -18692,10 +19919,10 @@
 	esac
 	test -n "$LIB_SUFFIX" && DFT_LIB_SUFFIX="${LIB_SUFFIX}${DFT_LIB_SUFFIX}"
 	test -n "$LIB_SUFFIX" && DFT_DEP_SUFFIX="${LIB_SUFFIX}${DFT_DEP_SUFFIX}"
-echo "$as_me:18695: result: $DFT_DEP_SUFFIX" >&5
+echo "$as_me:19922: result: $DFT_DEP_SUFFIX" >&5
 echo "${ECHO_T}$DFT_DEP_SUFFIX" >&6
 
-echo "$as_me:18698: checking default object directory" >&5
+echo "$as_me:19925: checking default object directory" >&5
 echo $ECHO_N "checking default object directory... $ECHO_C" >&6
 
 	case $DFT_LWR_MODEL in
@@ -18711,16 +19938,20 @@
 			DFT_OBJ_SUBDIR='obj_s' ;;
 		esac
 	esac
-echo "$as_me:18714: result: $DFT_OBJ_SUBDIR" >&5
+echo "$as_me:19941: result: $DFT_OBJ_SUBDIR" >&5
 echo "${ECHO_T}$DFT_OBJ_SUBDIR" >&6
 
-# libtool thinks it can make c++ shared libraries (perhaps only g++)
-if test "$cf_with_cxx" = yes ; then
-echo "$as_me:18719: checking c++ library-dependency suffix" >&5
+if test "x$cf_with_cxx" = xyes ; then
+echo "$as_me:19945: checking c++ library-dependency suffix" >&5
 echo $ECHO_N "checking c++ library-dependency suffix... $ECHO_C" >&6
 if test "$with_libtool" != "no"; then
+	# libtool thinks it can make c++ shared libraries (perhaps only g++)
+	CXX_LIB_SUFFIX=$DFT_DEP_SUFFIX
+elif test "$with_shared_cxx" != "no"; then
+	# also for g++ users...
 	CXX_LIB_SUFFIX=$DFT_DEP_SUFFIX
 else
+	# we normally make a static library because C/C++ library rules differ
 
 	case normal in #(vi
 	libtool) #(vi
@@ -18741,11 +19972,11 @@
 		;;
 	shared) #(vi
 		case $cf_cv_system_name in
-		aix[56]*) #(vi
+		aix[5-7]*) #(vi
 			CXX_LIB_SUFFIX='.a'
 			CXX_DEP_SUFFIX=$CXX_LIB_SUFFIX
 			;;
-		cygwin*) #(vi
+		cygwin*|mingw*) #(vi
 			CXX_LIB_SUFFIX='.dll'
 			CXX_DEP_SUFFIX='.dll.a'
 			;;
@@ -18772,14 +20003,15 @@
 	esac
 	test -n "$LIB_SUFFIX" && CXX_LIB_SUFFIX="${LIB_SUFFIX}${CXX_LIB_SUFFIX}"
 	test -n "$LIB_SUFFIX" && CXX_DEP_SUFFIX="${LIB_SUFFIX}${CXX_DEP_SUFFIX}"
+
 fi
-echo "$as_me:18776: result: $CXX_LIB_SUFFIX" >&5
+echo "$as_me:20008: result: $CXX_LIB_SUFFIX" >&5
 echo "${ECHO_T}$CXX_LIB_SUFFIX" >&6
 
 fi
 
 # do not want -ldl in build except as needed for -lncurses dependency
-if test "$with_dlsym" = yes ; then
+if test "x$with_dlsym" = xyes ; then
 if test $DFT_LWR_MODEL = shared || \
    test $DFT_LWR_MODEL = libtool ; then
 
@@ -18793,7 +20025,7 @@
 # TICS_LIST and TINFO_LIST are needed to build libtic.so and libterm.so, but
 # do not need libdl
 TICS_LIST=
-if test "$with_dlsym" = yes ; then
+if test "x$with_dlsym" = xyes ; then
 
 # remove dl library from $SHLIB_LIST
 TINFO_LIST=`echo "$SHLIB_LIST" | sed -e 's/-ldl[ 	]//g' -e 's/-ldl$//'`
@@ -18802,7 +20034,7 @@
 
 if test "$with_ticlib" != no ; then
 
-	if test "$with_ticlib" != yes ; then
+	if test "x$with_ticlib" != xyes ; then
 		TICS_NAME=$with_ticlib
 		TICS_ARG_SUFFIX="${with_ticlib}`echo ${DFT_ARG_SUFFIX}|sed -e "s/^${LIB_SUFFIX}//"`"
 		TICS_DEP_SUFFIX="${with_ticlib}`echo ${DFT_DEP_SUFFIX}|sed -e "s/^${LIB_SUFFIX}//"`"
@@ -18812,14 +20044,16 @@
 		TICS_DEP_SUFFIX="${TICS_NAME}${DFT_DEP_SUFFIX}"
 		TICS_LIB_SUFFIX="${TICS_NAME}${LIB_SUFFIX}"
 	fi
-	TICS_ARGS="-L${LIB_DIR} -l${TICS_LIB_SUFFIX}"
+	TICS_LDFLAGS="-L${LIB_DIR}"
+	TICS_LIBS="-l${TICS_LIB_SUFFIX}"
 else
-	TICS_ARGS="-L${LIB_DIR} -l${LIB_NAME}${DFT_ARG_SUFFIX}"
+	TICS_LDFLAGS="-L${LIB_DIR}"
+	TICS_LIBS="-l${LIB_NAME}${DFT_ARG_SUFFIX}"
 fi
 
 if test "$with_termlib" != no ; then
 
-	if test "$with_termlib" != yes ; then
+	if test "x$with_termlib" != xyes ; then
 		TINFO_NAME=$with_termlib
 		TINFO_SUFFIX="`echo ${DFT_LIB_SUFFIX}|sed -e "s/^${LIB_SUFFIX}//"`"
 		TINFO_ARG_SUFFIX="${with_termlib}`echo ${DFT_ARG_SUFFIX}|sed -e "s/^${LIB_SUFFIX}//"`"
@@ -18837,14 +20071,22 @@
 	if test "$DFT_LWR_MODEL" = "libtool"; then
 		TEST_ARGS="${TEST_DEPS}"
 		TEST_ARG2="${TEST_DEP2}"
-		TINFO_ARGS="-L${LIB_DIR} $TEST_ARGS"
+		TINFO_LDFLAGS="-L${LIB_DIR}"
+		TINFO_LIBS="$TEST_ARGS"
 		TICS_LIST="$SHLIB_LIST $TEST_ARGS"
 		SHLIB_LIST="${SHLIB_LIST} $TEST_ARGS"
 	else
 		TEST_ARGS="-l${TINFO_ARG_SUFFIX}"
 		TEST_ARG2="-l${TINFO_ARG_SUFFIX}"
-		TICS_LIST="$SHLIB_LIST -l${TINFO_LIB_SUFFIX}"
-		TINFO_ARGS="-L${LIB_DIR} $TEST_ARGS"
+		if test "x$with_term_driver" != xno ; then
+			TICS_LIST="$SHLIB_LIST -l${LIB_NAME}${DFT_ARG_SUFFIX}"
+			TICS_LIBS="$TICS_LIBS -l${LIB_NAME}${DFT_ARG_SUFFIX}"
+			TINFO_LIBS="-l${LIB_NAME}${DFT_ARG_SUFFIX} $TEST_ARGS"
+		else
+			TICS_LIST="$SHLIB_LIST -l${TINFO_LIB_SUFFIX}"
+			TINFO_LIBS="$TEST_ARGS"
+		fi
+		TINFO_LDFLAGS="-L${LIB_DIR}"
 		SHLIB_LIST="$SHLIB_LIST -l${TINFO_LIB_SUFFIX}"
 	fi
 else
@@ -18852,13 +20094,14 @@
 	TINFO_NAME=${LIB_NAME}
 	TINFO_SUFFIX=${DFT_LIB_SUFFIX}
 	TINFO_ARG_SUFFIX=${LIB_NAME}${DFT_ARG_SUFFIX}
-	if test "$with_tic_depends" = yes ; then
+	if test "x$with_tic_depends" = xyes ; then
 		TICS_LIST="$SHLIB_LIST -l${LIB_NAME}${DFT_ARG_SUFFIX}"
 	else
 		TICS_LIST="$SHLIB_LIST"
 	fi
 
-	TINFO_ARGS="-L${LIB_DIR} -l${LIB_NAME}${DFT_ARG_SUFFIX}"
+	TINFO_LDFLAGS="-L${LIB_DIR}"
+	TINFO_LIBS="-l${LIB_NAME}${DFT_ARG_SUFFIX}"
 fi
 
 if test "$DFT_LWR_MODEL" = shared ; then
@@ -18870,7 +20113,7 @@
 	esac
 fi
 
-if test "$with_dlsym" = yes ; then
+if test "x$with_dlsym" = xyes ; then
 
 # remove dl library from $TICS_LIST
 TICS_LIST=`echo "$TICS_LIST" | sed -e 's/-ldl[ 	]//g' -e 's/-ldl$//'`
@@ -18882,7 +20125,7 @@
 fi
 
 # needed for Ada95
-TINFO_ARGS2=`echo "$TINFO_ARGS" | sed -e 's,-L\.\./,-L../../,'`
+TINFO_LDFLAGS2=`echo "$TINFO_LDFLAGS" | sed -e 's,-L\.\./,-L../../,'`
 
 case $DFT_LWR_MODEL in
 normal|debug|profile)
@@ -18900,7 +20143,7 @@
     esac
 else
 	case $cf_cv_system_name in #(
-	aix[456]*) 	#( from ld manpage
+	aix[4-7]*) 	#( from ld manpage
 		LDFLAGS_STATIC=-bstatic
 		LDFLAGS_SHARED=-bdynamic
 		;;
@@ -18927,19 +20170,19 @@
 
 if test -n "$LDFLAGS_STATIC" && test -n "$LDFLAGS_SHARED"
 then
-	echo "$as_me:18930: checking if linker supports switching between static/dynamic" >&5
+	echo "$as_me:20173: checking if linker supports switching between static/dynamic" >&5
 echo $ECHO_N "checking if linker supports switching between static/dynamic... $ECHO_C" >&6
 
 	rm -f libconftest.a
 	cat >conftest.$ac_ext <<EOF
-#line 18935 "configure"
+#line 20178 "configure"
 #include <stdio.h>
 int cf_ldflags_static(FILE *fp) { return fflush(fp); }
 EOF
-	if { (eval echo "$as_me:18939: \"$ac_compile\"") >&5
+	if { (eval echo "$as_me:20182: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:18942: \$? = $ac_status" >&5
+  echo "$as_me:20185: \$? = $ac_status" >&5
   (exit $ac_status); } ; then
 		( $AR $ARFLAGS libconftest.a conftest.o ) 2>&5 1>/dev/null
 		( eval $RANLIB libconftest.a ) 2>&5 >/dev/null
@@ -18950,10 +20193,10 @@
 
 	LIBS="$LDFLAGS_STATIC -L`pwd` -lconftest $LDFLAGS_DYNAMIC $LIBS"
 	cat >conftest.$ac_ext <<_ACEOF
-#line 18953 "configure"
+#line 20196 "configure"
 #include "confdefs.h"
 
-#line 18956 "configure"
+#line 20199 "configure"
 #include <stdio.h>
 int cf_ldflags_static(FILE *fp);
 
@@ -18968,18 +20211,28 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:18971: \"$ac_link\"") >&5
+if { (eval echo "$as_me:20214: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:18974: \$? = $ac_status" >&5
+  echo "$as_me:20217: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:18977: \"$ac_try\"") >&5
+  { (eval echo "$as_me:20220: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:18980: \$? = $ac_status" >&5
+  echo "$as_me:20223: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  cf_ldflags_static=yes
+
+	# some linkers simply ignore the -dynamic
+	case x`file conftest$ac_exeext 2>/dev/null` in #(vi
+	*static*) # (vi
+		cf_ldflags_static=no
+		;;
+	*)
+		cf_ldflags_static=yes
+		;;
+	esac
+
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
@@ -18990,7 +20243,7 @@
 	rm -f libconftest.*
 	LIBS="$cf_save_LIBS"
 
-	echo "$as_me:18993: result: $cf_ldflags_static" >&5
+	echo "$as_me:20246: result: $cf_ldflags_static" >&5
 echo "${ECHO_T}$cf_ldflags_static" >&6
 
 	if test $cf_ldflags_static != yes
@@ -19006,12 +20259,12 @@
 	;;
 esac
 
-echo "$as_me:19009: checking where we will install curses.h" >&5
+echo "$as_me:20262: checking where we will install curses.h" >&5
 echo $ECHO_N "checking where we will install curses.h... $ECHO_C" >&6
 test "$with_overwrite" = no && \
 test "x$includedir" = 'x${prefix}/include' && \
 	includedir='${prefix}/include/ncurses'${LIB_SUFFIX}
-echo "$as_me:19014: result: $includedir" >&5
+echo "$as_me:20267: result: $includedir" >&5
 echo "${ECHO_T}$includedir" >&6
 
 ### Resolve a conflict between normal and wide-curses by forcing applications
@@ -19019,7 +20272,7 @@
 if test "$with_overwrite" != no ; then
 if test "$NCURSES_LIBUTF8" = 1 ; then
 	NCURSES_LIBUTF8='defined(HAVE_LIBUTF8_H)'
-	{ echo "$as_me:19022: WARNING: Wide-character applications must define HAVE_LIBUTF8_H to include curses.h" >&5
+	{ echo "$as_me:20275: WARNING: Wide-character applications must define HAVE_LIBUTF8_H to include curses.h" >&5
 echo "$as_me: WARNING: Wide-character applications must define HAVE_LIBUTF8_H to include curses.h" >&2;}
 fi
 fi
@@ -19029,6 +20282,7 @@
 NCURSES_TREE=
 
 ### predefined stuff for the test programs
+
 cat >>confdefs.h <<\EOF
 #define HAVE_SLK_COLOR 1
 EOF
@@ -19036,7 +20290,7 @@
 ### Construct the list of subdirectories for which we'll customize makefiles
 ### with the appropriate compile-rules.
 
-echo "$as_me:19039: checking for src modules" >&5
+echo "$as_me:20293: checking for src modules" >&5
 echo $ECHO_N "checking for src modules... $ECHO_C" >&6
 
 # dependencies and linker-arguments for test-programs
@@ -19050,6 +20304,7 @@
 	TEST_ARG2="-l${LIB_NAME}${DFT_ARG_SUFFIX} $TEST_ARG2"
 fi
 
+PC_MODULES_TO_MAKE="ncurses${DFT_ARG_SUFFIX}"
 cf_cv_src_modules=
 for cf_dir in $modules_to_build
 do
@@ -19096,10 +20351,11 @@
 				TEST_ARGS="-l${cf_dir}${DFT_ARG_SUFFIX} $TEST_ARGS"
 				TEST_ARG2="-l${cf_dir}${DFT_ARG_SUFFIX} $TEST_ARG2"
 			fi
+			PC_MODULES_TO_MAKE="${PC_MODULES_TO_MAKE} ${cf_dir}${DFT_ARG_SUFFIX}"
 		fi
 	fi
 done
-echo "$as_me:19102: result: $cf_cv_src_modules" >&5
+echo "$as_me:20358: result: $cf_cv_src_modules" >&5
 echo "${ECHO_T}$cf_cv_src_modules" >&6
 
 TEST_ARGS="-L${LIB_DIR} $TEST_ARGS"
@@ -19118,10 +20374,16 @@
 	SRC_SUBDIRS="$SRC_SUBDIRS test"
 fi
 test -z "$MAKE_TERMINFO" && SRC_SUBDIRS="$SRC_SUBDIRS misc"
-test "$cf_with_cxx_binding" != no && SRC_SUBDIRS="$SRC_SUBDIRS c++"
+if test "$cf_with_cxx_binding" != no; then
+	PC_MODULES_TO_MAKE="${PC_MODULES_TO_MAKE} ncurses++${DFT_ARG_SUFFIX}"
+	SRC_SUBDIRS="$SRC_SUBDIRS c++"
+fi
+
+test "x$with_termlib" != xno && PC_MODULES_TO_MAKE="$PC_MODULES_TO_MAKE $TINFO_ARG_SUFFIX"
+test "x$with_ticlib" != xno && PC_MODULES_TO_MAKE="$PC_MODULES_TO_MAKE $TICS_ARG_SUFFIX"
 
 ADA_SUBDIRS=
-if test "$cf_cv_prog_gnat_correct" = yes && test -f $srcdir/Ada95/Makefile.in; then
+if test "x$cf_with_ada" = "xyes" && test "x$cf_cv_prog_gnat_correct" = xyes && test -f $srcdir/Ada95/Makefile.in; then
 	SRC_SUBDIRS="$SRC_SUBDIRS Ada95"
 	ADA_SUBDIRS="gen src"
 	if test "x$cf_with_tests" != "xno" ; then
@@ -19143,7 +20405,7 @@
 
 fi
 
-if test "$cf_with_ada" != "no" && test "$cf_cv_prog_gnat_correct" != "no"; then
+if test "x$cf_with_ada" = "xyes" && test "x$cf_cv_prog_gnat_correct" = "xyes"; then
    SUB_MAKEFILES="$SUB_MAKEFILES Ada95/gen/adacurses${DFT_ARG_SUFFIX}-config:Ada95/gen/adacurses-config.in"
    SUB_MAKEFILES="$SUB_MAKEFILES man/adacurses${DFT_ARG_SUFFIX}-config.1:man/MKada_config.in"
 fi
@@ -19181,6 +20443,7 @@
 NCURSES_SHLIB2='sh $(top_srcdir)/misc/shlib'
 
 # values to use as strings
+
 cat >>confdefs.h <<EOF
 #define NCURSES_PATHSEP '$PATH_SEPARATOR'
 EOF
@@ -19271,32 +20534,32 @@
 
 ### Define substitutions for header files to avoid name-pollution
 
-if test "$cf_cv_have_tcgetattr" = yes ; then
+if test "x$cf_cv_have_tcgetattr" = xyes ; then
 	HAVE_TCGETATTR=1
 else
 	HAVE_TCGETATTR=0
 fi
 
-if test "$ac_cv_header_termio_h" = yes ; then
+if test "x$ac_cv_header_termio_h" = xyes ; then
 	HAVE_TERMIO_H=1
 else
 	HAVE_TERMIO_H=0
 fi
 
-if test "$ac_cv_header_termios_h" = yes ; then
+if test "x$ac_cv_header_termios_h" = xyes ; then
 	HAVE_TERMIOS_H=1
 else
 	HAVE_TERMIOS_H=0
 fi
 
 ################################################################################
-test "$use_database" = yes && \
+test "x$use_database" = xyes && \
 SUB_MAKEFILES="$SUB_MAKEFILES misc/run_tic.sh:misc/run_tic.in"
 
 SUB_MAKEFILES="$SUB_MAKEFILES misc/ncurses-config:misc/ncurses-config.in"
 SUB_MAKEFILES="$SUB_MAKEFILES man/ncurses${DFT_ARG_SUFFIX}${cf_cv_abi_version}-config.1:man/MKncu_config.in"
 
-if test x"$enable_pc_files" = xyes ; then \
+if test "x$enable_pc_files" = xyes ; then \
 SUB_MAKEFILES="$SUB_MAKEFILES misc/gen-pkgconfig:misc/gen-pkgconfig.in"
 MAKE_PC_FILES=
 else
@@ -19305,7 +20568,7 @@
 
 # Extract the first word of "tic", so it can be a program name with args.
 set dummy tic; ac_word=$2
-echo "$as_me:19308: checking for $ac_word" >&5
+echo "$as_me:20571: checking for $ac_word" >&5
 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
 if test "${ac_cv_path_TIC_PATH+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -19322,7 +20585,7 @@
   test -z "$ac_dir" && ac_dir=.
   if $as_executable_p "$ac_dir/$ac_word"; then
    ac_cv_path_TIC_PATH="$ac_dir/$ac_word"
-   echo "$as_me:19325: found $ac_dir/$ac_word" >&5
+   echo "$as_me:20588: found $ac_dir/$ac_word" >&5
    break
 fi
 done
@@ -19334,10 +20597,10 @@
 TIC_PATH=$ac_cv_path_TIC_PATH
 
 if test -n "$TIC_PATH"; then
-  echo "$as_me:19337: result: $TIC_PATH" >&5
+  echo "$as_me:20600: result: $TIC_PATH" >&5
 echo "${ECHO_T}$TIC_PATH" >&6
 else
-  echo "$as_me:19340: result: no" >&5
+  echo "$as_me:20603: result: no" >&5
 echo "${ECHO_T}no" >&6
 fi
 
@@ -19345,7 +20608,7 @@
 then
 	if test "$TIC_PATH" = unknown
 	then
-		{ echo "$as_me:19348: WARNING: no tic program found for fallbacks" >&5
+		{ echo "$as_me:20611: WARNING: no tic program found for fallbacks" >&5
 echo "$as_me: WARNING: no tic program found for fallbacks" >&2;}
 	fi
 fi
@@ -19358,12 +20621,13 @@
 
 ADAHTML_DIR=../../doc/html/ada
 
+# these could be configurable, but are not currently
+PANEL_NAME=panel
+MENU_NAME=menu
+FORM_NAME=form
+CXX_NAME=ncurses++
+
 SUB_SCRIPTS=
-case $cf_cv_system_name in #(vi
-*mingw32*) #(vi
-	SUB_SCRIPTS="mk-dlls.sh"
-	;;
-esac
 
 ac_config_files="$ac_config_files include/MKterm.h.awk include/curses.head:include/curses.h.in include/ncurses_dll.h include/termcap.h include/unctrl.h $SUB_SCRIPTS $SUB_MAKEFILES Makefile"
 ac_config_commands="$ac_config_commands default"
@@ -19446,7 +20710,7 @@
 : ${CONFIG_STATUS=./config.status}
 ac_clean_files_save=$ac_clean_files
 ac_clean_files="$ac_clean_files $CONFIG_STATUS"
-{ echo "$as_me:19449: creating $CONFIG_STATUS" >&5
+{ echo "$as_me:20713: creating $CONFIG_STATUS" >&5
 echo "$as_me: creating $CONFIG_STATUS" >&6;}
 cat >$CONFIG_STATUS <<_ACEOF
 #! $SHELL
@@ -19578,7 +20842,7 @@
 cat >>$CONFIG_STATUS <<EOF
 ac_cs_version="\\
 config.status
-configured by $0, generated by GNU Autoconf 2.52.20101002,
+configured by $0, generated by GNU Autoconf 2.52.20121002,
   with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
 
 Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001
@@ -19622,7 +20886,7 @@
     echo "$ac_cs_version"; exit 0 ;;
   --he | --h)
     # Conflict between --help and --header
-    { { echo "$as_me:19625: error: ambiguous option: $1
+    { { echo "$as_me:20889: error: ambiguous option: $1
 Try \`$0 --help' for more information." >&5
 echo "$as_me: error: ambiguous option: $1
 Try \`$0 --help' for more information." >&2;}
@@ -19641,7 +20905,7 @@
     ac_need_defaults=false;;
 
   # This is an error.
-  -*) { { echo "$as_me:19644: error: unrecognized option: $1
+  -*) { { echo "$as_me:20908: error: unrecognized option: $1
 Try \`$0 --help' for more information." >&5
 echo "$as_me: error: unrecognized option: $1
 Try \`$0 --help' for more information." >&2;}
@@ -19660,7 +20924,7 @@
 ## Running config.status.  ##
 ## ----------------------- ##
 
-This file was extended by $as_me 2.52.20101002, executed with
+This file was extended by $as_me 2.52.20121002, executed with
   CONFIG_FILES    = $CONFIG_FILES
   CONFIG_HEADERS  = $CONFIG_HEADERS
   CONFIG_LINKS    = $CONFIG_LINKS
@@ -19682,10 +20946,11 @@
 AWK="$AWK"
 DFT_ARG_SUFFIX="$DFT_ARG_SUFFIX"
 DFT_LWR_MODEL="$DFT_LWR_MODEL"
-ECHO_LINK="$ECHO_LINK"
+ECHO_LD="$ECHO_LD"
 LDCONFIG="$LDCONFIG"
 LIBTOOL_VERSION="$LIBTOOL_VERSION"
 LIB_NAME="$LIB_NAME"
+LIB_PREFIX="$LIB_PREFIX"
 LIB_SUBSETS="$LIB_SUBSETS"
 LIB_SUFFIX="$LIB_SUFFIX"
 LIB_TRACING="$LIB_TRACING"
@@ -19707,7 +20972,7 @@
 TINFO_SUFFIX="$TINFO_SUFFIX"
 USE_OLD_MAKERULES="$USE_OLD_MAKERULES"
 WITH_CURSES_H="$with_curses_h"
-WITH_ECHO="$with_echo"
+WITH_ECHO="${enable_echo:=yes}"
 WITH_OVERWRITE="$with_overwrite"
 cf_LIST_MODELS="$cf_list_models"
 cf_cv_abi_version="$cf_cv_abi_version"
@@ -19717,16 +20982,19 @@
 cf_cv_enable_opaque="$cf_cv_enable_opaque"
 cf_cv_prog_CC_c_o=$cf_cv_prog_CC_c_o
 cf_cv_prog_CXX_c_o=$cf_cv_prog_CXX_c_o
+cf_cv_prog_gnat_correct=$cf_cv_prog_gnat_correct
 cf_cv_rel_version="$cf_cv_rel_version"
 cf_cv_rm_so_locs="$cf_cv_rm_so_locs"
 cf_cv_shared_soname='$cf_cv_shared_soname'
 cf_cv_shlib_version="$cf_cv_shlib_version"
 cf_cv_shlib_version_infix="$cf_cv_shlib_version_infix"
 cf_cv_system_name="$cf_cv_system_name"
+cf_cv_term_driver="$with_term_driver"
 cf_with_ada="$cf_with_ada"
 cf_with_cxx_binding="$cf_with_cxx_binding"
 cf_with_manpages="$cf_with_manpages"
 cf_with_tests="$cf_with_tests"
+with_shared_cxx="$with_shared_cxx"
 host="$host"
 target="$target"
 
@@ -19747,7 +21015,7 @@
   "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;;
   "default" ) CONFIG_COMMANDS="$CONFIG_COMMANDS default" ;;
   "include/ncurses_cfg.h" ) CONFIG_HEADERS="$CONFIG_HEADERS include/ncurses_cfg.h:include/ncurses_cfg.hin" ;;
-  *) { { echo "$as_me:19750: error: invalid argument: $ac_config_target" >&5
+  *) { { echo "$as_me:21018: error: invalid argument: $ac_config_target" >&5
 echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
    { (exit 1); exit 1; }; };;
   esac
@@ -19806,6 +21074,7 @@
 s,@bindir@,$bindir,;t t
 s,@sbindir@,$sbindir,;t t
 s,@libexecdir@,$libexecdir,;t t
+s,@datarootdir@,$datarootdir,;t t
 s,@datadir@,$datadir,;t t
 s,@sysconfdir@,$sysconfdir,;t t
 s,@sharedstatedir@,$sharedstatedir,;t t
@@ -19858,9 +21127,8 @@
 s,@ac_ct_CC@,$ac_ct_CC,;t t
 s,@EXEEXT@,$EXEEXT,;t t
 s,@OBJEXT@,$OBJEXT,;t t
-s,@CPP@,$CPP,;t t
 s,@EXTRA_CPPFLAGS@,$EXTRA_CPPFLAGS,;t t
-s,@PROG_EXT@,$PROG_EXT,;t t
+s,@CPP@,$CPP,;t t
 s,@LDCONFIG@,$LDCONFIG,;t t
 s,@CXX@,$CXX,;t t
 s,@CXXFLAGS@,$CXXFLAGS,;t t
@@ -19900,6 +21168,7 @@
 s,@cf_list_models@,$cf_list_models,;t t
 s,@LIBTOOL_VERSION@,$LIBTOOL_VERSION,;t t
 s,@LIBTOOL@,$LIBTOOL,;t t
+s,@ac_ct_LIBTOOL@,$ac_ct_LIBTOOL,;t t
 s,@LT_UNDEF@,$LT_UNDEF,;t t
 s,@LIBTOOL_CXX@,$LIBTOOL_CXX,;t t
 s,@LIBTOOL_OPTS@,$LIBTOOL_OPTS,;t t
@@ -19931,10 +21200,12 @@
 s,@LOCAL_LDFLAGS@,$LOCAL_LDFLAGS,;t t
 s,@LOCAL_LDFLAGS2@,$LOCAL_LDFLAGS2,;t t
 s,@INSTALL_LIB@,$INSTALL_LIB,;t t
+s,@RPATH_LIST@,$RPATH_LIST,;t t
 s,@cf_ldd_prog@,$cf_ldd_prog,;t t
 s,@TERMINFO_SRC@,$TERMINFO_SRC,;t t
 s,@FALLBACK_LIST@,$FALLBACK_LIST,;t t
 s,@WHICH_XTERM@,$WHICH_XTERM,;t t
+s,@XTERM_KBS@,$XTERM_KBS,;t t
 s,@TERMINFO_DIRS@,$TERMINFO_DIRS,;t t
 s,@TERMINFO@,$TERMINFO,;t t
 s,@MAKE_TERMINFO@,$MAKE_TERMINFO,;t t
@@ -19955,6 +21226,7 @@
 s,@TERMINFO_CAPS@,$TERMINFO_CAPS,;t t
 s,@NCURSES_OSPEED@,$NCURSES_OSPEED,;t t
 s,@NCURSES_CCHARW_MAX@,$NCURSES_CCHARW_MAX,;t t
+s,@NCURSES_TPARM_ARG@,$NCURSES_TPARM_ARG,;t t
 s,@MANPAGE_RENAMES@,$MANPAGE_RENAMES,;t t
 s,@NCURSES_EXT_FUNCS@,$NCURSES_EXT_FUNCS,;t t
 s,@GENERATED_EXT_FUNCS@,$GENERATED_EXT_FUNCS,;t t
@@ -19972,6 +21244,11 @@
 s,@NCURSES_OPAQUE@,$NCURSES_OPAQUE,;t t
 s,@NCURSES_SIZE_T@,$NCURSES_SIZE_T,;t t
 s,@NCURSES_WRAP_PREFIX@,$NCURSES_WRAP_PREFIX,;t t
+s,@ECHO_LT@,$ECHO_LT,;t t
+s,@ECHO_LD@,$ECHO_LD,;t t
+s,@RULE_CC@,$RULE_CC,;t t
+s,@SHOW_CC@,$SHOW_CC,;t t
+s,@ECHO_CC@,$ECHO_CC,;t t
 s,@ECHO_LINK@,$ECHO_LINK,;t t
 s,@ADAFLAGS@,$ADAFLAGS,;t t
 s,@EXTRA_CFLAGS@,$EXTRA_CFLAGS,;t t
@@ -20015,12 +21292,14 @@
 s,@TICS_ARG_SUFFIX@,$TICS_ARG_SUFFIX,;t t
 s,@TICS_DEP_SUFFIX@,$TICS_DEP_SUFFIX,;t t
 s,@TICS_LIB_SUFFIX@,$TICS_LIB_SUFFIX,;t t
-s,@TICS_ARGS@,$TICS_ARGS,;t t
+s,@TICS_LDFLAGS@,$TICS_LDFLAGS,;t t
+s,@TICS_LIBS@,$TICS_LIBS,;t t
 s,@TINFO_ARG_SUFFIX@,$TINFO_ARG_SUFFIX,;t t
 s,@TINFO_DEP_SUFFIX@,$TINFO_DEP_SUFFIX,;t t
 s,@TINFO_LIB_SUFFIX@,$TINFO_LIB_SUFFIX,;t t
-s,@TINFO_ARGS@,$TINFO_ARGS,;t t
-s,@TINFO_ARGS2@,$TINFO_ARGS2,;t t
+s,@TINFO_LDFLAGS@,$TINFO_LDFLAGS,;t t
+s,@TINFO_LIBS@,$TINFO_LIBS,;t t
+s,@TINFO_LDFLAGS2@,$TINFO_LDFLAGS2,;t t
 s,@LDFLAGS_STATIC@,$LDFLAGS_STATIC,;t t
 s,@LDFLAGS_SHARED@,$LDFLAGS_SHARED,;t t
 s,@WITH_OVERWRITE@,$WITH_OVERWRITE,;t t
@@ -20032,6 +21311,7 @@
 s,@TEST_DEPS@,$TEST_DEPS,;t t
 s,@TEST_ARG2@,$TEST_ARG2,;t t
 s,@TEST_DEP2@,$TEST_DEP2,;t t
+s,@PC_MODULES_TO_MAKE@,$PC_MODULES_TO_MAKE,;t t
 s,@ADA_SUBDIRS@,$ADA_SUBDIRS,;t t
 s,@DIRS_TO_MAKE@,$DIRS_TO_MAKE,;t t
 s,@NCURSES_SHLIB2@,$NCURSES_SHLIB2,;t t
@@ -20043,6 +21323,10 @@
 s,@TIC_PATH@,$TIC_PATH,;t t
 s,@MAKE_TESTS@,$MAKE_TESTS,;t t
 s,@ADAHTML_DIR@,$ADAHTML_DIR,;t t
+s,@PANEL_NAME@,$PANEL_NAME,;t t
+s,@MENU_NAME@,$MENU_NAME,;t t
+s,@FORM_NAME@,$FORM_NAME,;t t
+s,@CXX_NAME@,$CXX_NAME,;t t
 CEOF
 
 EOF
@@ -20157,7 +21441,7 @@
   esac
 
   if test x"$ac_file" != x-; then
-    { echo "$as_me:20160: creating $ac_file" >&5
+    { echo "$as_me:21444: creating $ac_file" >&5
 echo "$as_me: creating $ac_file" >&6;}
     rm -f "$ac_file"
   fi
@@ -20175,7 +21459,7 @@
       -) echo $tmp/stdin ;;
       [\\/$]*)
          # Absolute (can't be DOS-style, as IFS=:)
-         test -f "$f" || { { echo "$as_me:20178: error: cannot find input file: $f" >&5
+         test -f "$f" || { { echo "$as_me:21462: error: cannot find input file: $f" >&5
 echo "$as_me: error: cannot find input file: $f" >&2;}
    { (exit 1); exit 1; }; }
          echo $f;;
@@ -20188,13 +21472,45 @@
            echo $srcdir/$f
          else
            # /dev/null tree
-           { { echo "$as_me:20191: error: cannot find input file: $f" >&5
+           { { echo "$as_me:21475: error: cannot find input file: $f" >&5
 echo "$as_me: error: cannot find input file: $f" >&2;}
    { (exit 1); exit 1; }; }
          fi;;
       esac
     done` || { (exit 1); exit 1; }
 EOF
+cat >>$CONFIG_STATUS <<\EOF
+  ac_warn_datarootdir=no
+  if test x"$ac_file" != x-; then
+    for ac_item in $ac_file_inputs
+    do
+      ac_seen=`grep '@\(datadir\|mandir\|infodir\)@' $ac_item`
+      if test -n "$ac_seen"; then
+        ac_used=`grep '@datarootdir@' $ac_item`
+        if test -z "$ac_used"; then
+          { echo "$as_me:21491: WARNING: datarootdir was used implicitly but not set:
+$ac_seen" >&5
+echo "$as_me: WARNING: datarootdir was used implicitly but not set:
+$ac_seen" >&2;}
+          ac_warn_datarootdir=yes
+        fi
+      fi
+      ac_seen=`grep '${datarootdir}' $ac_item`
+      if test -n "$ac_seen"; then
+        { echo "$as_me:21500: WARNING: datarootdir was used explicitly but not set:
+$ac_seen" >&5
+echo "$as_me: WARNING: datarootdir was used explicitly but not set:
+$ac_seen" >&2;}
+        ac_warn_datarootdir=yes
+      fi
+    done
+  fi
+
+if test "x$ac_warn_datarootdir" = xyes; then
+  ac_sed_cmds="$ac_sed_cmds | sed -e 's,@datarootdir@,\${prefix}/share,g' -e 's,\${datarootdir},\${prefix}/share,g'"
+fi
+
+EOF
 cat >>$CONFIG_STATUS <<EOF
   sed "$ac_vpsub
 $extrasub
@@ -20209,11 +21525,35 @@
 " $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out
   rm -f $tmp/stdin
   if test x"$ac_file" != x-; then
-    mv $tmp/out $ac_file
+    cp $tmp/out $ac_file
+
+    for ac_name in prefix exec_prefix datarootdir
+    do
+        ac_seen=`fgrep -n '${'$ac_name'[:=].*}' $ac_file`
+        if test -n "$ac_seen"; then
+            ac_init=`egrep '[ 	]*'$ac_name'[ 	]*=' $ac_file`
+            if test -z "$ac_init"; then
+              ac_seen=`echo "$ac_seen" |sed -e 's,^,'$ac_file':,'`
+              { echo "$as_me:21537: WARNING: Variable $ac_name is used but was not set:
+$ac_seen" >&5
+echo "$as_me: WARNING: Variable $ac_name is used but was not set:
+$ac_seen" >&2;}
+            fi
+        fi
+    done
+    egrep -n '@[a-z_][a-z_0-9]+@' $ac_file >$tmp/out
+    egrep -n '@[A-Z_][A-Z_0-9]+@' $ac_file >>$tmp/out
+    if test -s $tmp/out; then
+      ac_seen=`sed -e 's,^,'$ac_file':,' < $tmp/out`
+      { echo "$as_me:21548: WARNING: Some variables may not be substituted:
+$ac_seen" >&5
+echo "$as_me: WARNING: Some variables may not be substituted:
+$ac_seen" >&2;}
+    fi
   else
     cat $tmp/out
-    rm -f $tmp/out
   fi
+  rm -f $tmp/out
 
 done
 EOF
@@ -20254,7 +21594,7 @@
   * )   ac_file_in=$ac_file.in ;;
   esac
 
-  test x"$ac_file" != x- && { echo "$as_me:20257: creating $ac_file" >&5
+  test x"$ac_file" != x- && { echo "$as_me:21597: creating $ac_file" >&5
 echo "$as_me: creating $ac_file" >&6;}
 
   # First look for the input files in the build tree, otherwise in the
@@ -20265,7 +21605,7 @@
       -) echo $tmp/stdin ;;
       [\\/$]*)
          # Absolute (can't be DOS-style, as IFS=:)
-         test -f "$f" || { { echo "$as_me:20268: error: cannot find input file: $f" >&5
+         test -f "$f" || { { echo "$as_me:21608: error: cannot find input file: $f" >&5
 echo "$as_me: error: cannot find input file: $f" >&2;}
    { (exit 1); exit 1; }; }
          echo $f;;
@@ -20278,7 +21618,7 @@
            echo $srcdir/$f
          else
            # /dev/null tree
-           { { echo "$as_me:20281: error: cannot find input file: $f" >&5
+           { { echo "$as_me:21621: error: cannot find input file: $f" >&5
 echo "$as_me: error: cannot find input file: $f" >&2;}
    { (exit 1); exit 1; }; }
          fi;;
@@ -20336,7 +21676,7 @@
   rm -f $tmp/in
   if test x"$ac_file" != x-; then
     if cmp -s $ac_file $tmp/config.h 2>/dev/null; then
-      { echo "$as_me:20339: $ac_file is unchanged" >&5
+      { echo "$as_me:21679: $ac_file is unchanged" >&5
 echo "$as_me: $ac_file is unchanged" >&6;}
     else
       ac_dir=`$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
@@ -20394,25 +21734,20 @@
 	if test ! -d $srcdir/$cf_dir; then
 		continue
 	elif test -f $srcdir/$cf_dir/programs; then
-		$AWK -f $srcdir/test/mk-test.awk INSTALL=no ECHO_LINK="$ECHO_LINK" $srcdir/$cf_dir/programs >>$cf_dir/Makefile
+		$AWK -f $srcdir/test/mk-test.awk INSTALL=no ECHO_LINK="$ECHO_LD" $srcdir/$cf_dir/programs >>$cf_dir/Makefile
 	fi
 done
 
 fi
 
-	case $cf_cv_system_name in #(vi
-	OS/2*|os2*) #(vi
-        LIB_PREFIX=''
-        ;;
-	*)	LIB_PREFIX='lib'
-        ;;
-	esac
 cf_prefix=$LIB_PREFIX
 
-if test $cf_cv_shlib_version = cygdll ; then
+case $cf_cv_shlib_version in #(vi
+cygdll|mingw)
 	TINFO_NAME=$TINFO_ARG_SUFFIX
 	TINFO_SUFFIX=.dll
-fi
+	;;
+esac
 
 if test -n "$TINFO_SUFFIX" ; then
 	case $TINFO_SUFFIX in
@@ -20438,7 +21773,7 @@
 	elif test -f $srcdir/$cf_dir/modules; then
 
 		SHARED_LIB=
-		LIBS_TO_MAKE=
+		Libs_To_Make=
 		for cf_item in $cf_LIST_MODELS
 		do
 
@@ -20461,11 +21796,11 @@
 		;;
 	shared) #(vi
 		case $cf_cv_system_name in
-		aix[56]*) #(vi
+		aix[5-7]*) #(vi
 			cf_suffix='.a'
 			cf_depsuf=$cf_suffix
 			;;
-		cygwin*) #(vi
+		cygwin*|mingw*) #(vi
 			cf_suffix='.dll'
 			cf_depsuf='.dll.a'
 			;;
@@ -20493,75 +21828,69 @@
 	test -n "$LIB_SUFFIX" && cf_suffix="${LIB_SUFFIX}${cf_suffix}"
 	test -n "$LIB_SUFFIX" && cf_depsuf="${LIB_SUFFIX}${cf_depsuf}"
 
+			cf_libname=$cf_dir
+			test "$cf_dir" = c++ && cf_libname=ncurses++
 			if test $cf_item = shared ; then
-			if test "$cf_cv_do_symlinks" = yes ; then
-				case "$cf_cv_shlib_version" in #(vi
-				rel) #(vi
-					case "$cf_cv_system_name" in #(vi
-					darwin*)
-					case .${LIB_SUFFIX} in
-					.tw*)
-						cf_suffix=`echo $cf_suffix | sed 's/^tw//'`
-						cf_suffix=tw'.${REL_VERSION}'"$cf_suffix"
-						;;
-					.t*)
-						cf_suffix=`echo $cf_suffix | sed 's/^t//'`
-						cf_suffix=t'.${REL_VERSION}'"$cf_suffix"
-						;;
-					.w*)
-						cf_suffix=`echo $cf_suffix | sed 's/^w//'`
-						cf_suffix=w'.${REL_VERSION}'"$cf_suffix"
+				if test -n "${LIB_SUFFIX}"
+				then
+					cf_shared_suffix=`echo "$cf_suffix" | sed 's/^'"${LIB_SUFFIX}"'//'`
+				else
+					cf_shared_suffix="$cf_suffix"
+				fi
+				if test "$cf_cv_do_symlinks" = yes ; then
+					cf_version_name=
+
+					case "$cf_cv_shlib_version" in #(vi
+					rel) #(vi
+						cf_version_name=REL_VERSION
 						;;
-					*)
-						cf_suffix='.${REL_VERSION}'"$cf_suffix"
+					abi)
+						cf_version_name=ABI_VERSION
 						;;
 					esac
-					;; #(vi
-					*) cf_suffix="$cf_suffix"'.${REL_VERSION}' ;;
-					esac
+
+					if test -n "$cf_version_name"
+					then
+						case "$cf_cv_system_name" in #(vi
+						darwin*)
+							# "w", etc?
+							cf_suffix="${LIB_SUFFIX}"'.${'$cf_version_name'}'"$cf_shared_suffix"
+							;; #(vi
+						*)
+							cf_suffix="$cf_suffix"'.${'$cf_version_name'}'
+							;;
+						esac
+					fi
+					if test -n "${LIB_SUFFIX}"
+					then
+						cf_shared_suffix=`echo "$cf_suffix" | sed 's/^'"${LIB_SUFFIX}"'//'`
+					else
+						cf_shared_suffix="$cf_suffix"
+					fi
+				fi
+				# cygwin needs import library, and has unique naming convention
+				# use autodetected ${cf_prefix} for import lib and static lib, but
+				# use 'cyg' prefix for shared lib.
+				case $cf_cv_shlib_version in #(vi
+				cygdll) #(vi
+					cf_cygsuf=`echo "$cf_suffix" | sed -e 's/\.dll/\${ABI_VERSION}.dll/'`
+					Libs_To_Make="$Libs_To_Make ../lib/cyg${cf_libname}${cf_cygsuf}"
+					continue
 					;;
-				abi)
-					case "$cf_cv_system_name" in #(vi
-					darwin*)
-					case .${LIB_SUFFIX} in
-					.tw*)
-						cf_suffix=`echo $cf_suffix | sed 's/^tw//'`
-						cf_suffix=tw'.${ABI_VERSION}'"$cf_suffix"
-						;;
-					.t*)
-						cf_suffix=`echo $cf_suffix | sed 's/^t//'`
-						cf_suffix=t'.${ABI_VERSION}'"$cf_suffix"
-						;;
-					.w*)
-						cf_suffix=`echo $cf_suffix | sed 's/^w//'`
-						cf_suffix=w'.${ABI_VERSION}'"$cf_suffix"
-						;;
-					*)
-						cf_suffix='.${ABI_VERSION}'"$cf_suffix"
-						;;
-					esac
-					;; #(vi
-					*) cf_suffix="$cf_suffix"'.${ABI_VERSION}' ;;
-					esac
+				mingw)
+					cf_cygsuf=`echo "$cf_suffix" | sed -e 's/\.dll/\${ABI_VERSION}.dll/'`
+					Libs_To_Make="$Libs_To_Make ../lib/lib${cf_libname}${cf_cygsuf}"
+					continue
 					;;
 				esac
 			fi
-			# cygwin needs import library, and has unique naming convention
-			# use autodetected ${cf_prefix} for import lib and static lib, but
-			# use 'cyg' prefix for shared lib.
-			if test $cf_cv_shlib_version = cygdll ; then
-				cf_cygsuf=`echo "$cf_suffix" | sed -e 's/\.dll/\${ABI_VERSION}.dll/'`
-				LIBS_TO_MAKE="$LIBS_TO_MAKE ../lib/cyg${cf_dir}${cf_cygsuf}"
-				continue
-			fi
-			fi
-			LIBS_TO_MAKE="$LIBS_TO_MAKE ../lib/${cf_prefix}${cf_dir}${cf_suffix}"
+			Libs_To_Make="$Libs_To_Make ../lib/${cf_prefix}${cf_libname}${cf_suffix}"
 		done
 
 		if test $cf_dir = ncurses ; then
 			cf_subsets="$LIB_SUBSETS"
 			cf_r_parts="$cf_subsets"
-			cf_liblist="$LIBS_TO_MAKE"
+			cf_liblist="$Libs_To_Make"
 
 			while test -n "$cf_r_parts"
 			do
@@ -20581,7 +21910,7 @@
 						;;
 					esac
 					if test -n "$cf_item"; then
-						LIBS_TO_MAKE="$cf_item $LIBS_TO_MAKE"
+						Libs_To_Make="$cf_item $Libs_To_Make"
 					fi
 				else
 					break
@@ -20591,13 +21920,40 @@
 			cf_subsets=`echo "$LIB_SUBSETS" | sed -e 's/^termlib.* //'`
 		fi
 
-		sed -e "s%@LIBS_TO_MAKE@%$LIBS_TO_MAKE%" \
+		if test $cf_dir = c++; then
+			if test "x$with_shared_cxx" != xyes && test -n "$cf_shared_suffix"; then
+				cf_list=
+				for cf_item in $Libs_To_Make
+				do
+					case $cf_item in
+					*.a)
+						;;
+					*)
+						cf_item=`echo "$cf_item" | sed -e "s,"$cf_shared_suffix",.a,"`
+						;;
+					esac
+					for cf_test in $cf_list
+					do
+						if test "$cf_test" = "$cf_item"
+						then
+							cf_LIST_MODELS=`echo "$cf_LIST_MODELS" | sed -e 's/normal//'`
+							cf_item=
+							break
+						fi
+					done
+					test -n "$cf_item" && cf_list="$cf_list $cf_item"
+				done
+				Libs_To_Make="$cf_list"
+			fi
+		fi
+
+		sed -e "s%@Libs_To_Make@%$Libs_To_Make%" \
 		    -e "s%@SHARED_LIB@%$SHARED_LIB%" \
 			$cf_dir/Makefile >$cf_dir/Makefile.out
 		mv $cf_dir/Makefile.out $cf_dir/Makefile
 
 		$AWK -f $srcdir/mk-0th.awk \
-			libname="${cf_dir}${LIB_SUFFIX}" subsets="$LIB_SUBSETS" \
+			libname="${cf_dir}${LIB_SUFFIX}" subsets="$LIB_SUBSETS" ticlib="$TICS_LIB_SUFFIX" termlib="$TINFO_LIB_SUFFIX" \
 			$srcdir/$cf_dir/modules >>$cf_dir/Makefile
 
 		for cf_subset in $cf_subsets
@@ -20605,10 +21961,27 @@
 			cf_subdirs=
 			for cf_item in $cf_LIST_MODELS
 			do
+
 			echo "Appending rules for ${cf_item} model (${cf_dir}: ${cf_subset})"
 
 cf_ITEM=`echo "$cf_item" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
 
+			CXX_MODEL=$cf_ITEM
+			if test "$CXX_MODEL" = SHARED; then
+				case $cf_cv_shlib_version in #(vi
+				cygdll|mingw) #(vi
+					test "x$with_shared_cxx" = xno && test -n "$verbose" && echo "	overriding CXX_MODEL to SHARED" 1>&6
+
+echo "${as_me:-configure}:21975: testing overriding CXX_MODEL to SHARED ..." 1>&5
+
+					with_shared_cxx=yes
+					;;
+				*)
+					test "x$with_shared_cxx" = xno && CXX_MODEL=NORMAL
+					;;
+				esac
+			fi
+
 	case $cf_item in #(vi
 	libtool) #(vi
 		cf_suffix='.la'
@@ -20628,11 +22001,11 @@
 		;;
 	shared) #(vi
 		case $cf_cv_system_name in
-		aix[56]*) #(vi
+		aix[5-7]*) #(vi
 			cf_suffix='.a'
 			cf_depsuf=$cf_suffix
 			;;
-		cygwin*) #(vi
+		cygwin*|mingw*) #(vi
 			cf_suffix='.dll'
 			cf_depsuf='.dll.a'
 			;;
@@ -20688,6 +22061,8 @@
 					cf_libname=$TICS_LIB_SUFFIX
 					;;
 				esac
+			elif test $cf_dir = c++ ; then
+				cf_libname=ncurses++$LIB_SUFFIX
 			else
 				cf_libname=${cf_libname}$LIB_SUFFIX
 			fi
@@ -20739,10 +22114,12 @@
 				name=${cf_libname}${cf_dir_suffix} \
 				traces=$LIB_TRACING \
 				MODEL=$cf_ITEM \
+				CXX_MODEL=$CXX_MODEL \
 				model=$cf_subdir \
 				prefix=$cf_prefix \
 				suffix=$cf_suffix \
 				subset=$cf_subset \
+				driver=$cf_cv_term_driver \
 				SymLink="$LN_S" \
 				TermlibRoot=$TINFO_NAME \
 				TermlibSuffix=$TINFO_SUFFIX \
@@ -20781,7 +22158,7 @@
 		done
 	fi
 
-	echo '	cd '$cf_dir' && ${MAKE} ${CF_MFLAGS} $@' >>Makefile
+	echo '	cd '$cf_dir' && ${MAKE} ${TOP_MFLAGS} $@' >>Makefile
 done
 
 for cf_dir in $SRC_SUBDIRS
@@ -20796,7 +22173,7 @@
 			echo 'libs \' >> Makefile
 			echo 'install.libs \' >> Makefile
 			echo 'uninstall.libs ::' >> Makefile
-			echo '	cd '$cf_dir' && ${MAKE} ${CF_MFLAGS} $@' >> Makefile
+			echo '	cd '$cf_dir' && ${MAKE} ${TOP_MFLAGS} $@' >> Makefile
 			;;
 		esac
 	fi
@@ -20819,7 +22196,7 @@
 uninstall.libs \\
 install.$cf_dir \\
 uninstall.$cf_dir ::
-	cd $cf_dir && \${MAKE} \${CF_MFLAGS} \$@
+	cd $cf_dir && \${MAKE} \${TOP_MFLAGS} \$@
 CF_EOF
 	elif test -f $srcdir/$cf_dir/headers; then
 cat >> Makefile <<CF_EOF
@@ -20829,7 +22206,7 @@
 uninstall.libs \\
 install.includes \\
 uninstall.includes ::
-	cd $cf_dir && \${MAKE} \${CF_MFLAGS} \$@
+	cd $cf_dir && \${MAKE} \${TOP_MFLAGS} \$@
 CF_EOF
 fi
 done
@@ -20838,7 +22215,7 @@
 
 install.libs uninstall.libs \\
 install.data uninstall.data ::
-$MAKE_TERMINFO	cd misc && \${MAKE} \${CF_MFLAGS} \$@
+$MAKE_TERMINFO	cd misc && \${MAKE} \${TOP_MFLAGS} \$@
 CF_EOF
 
 if test "x$cf_with_manpages" = xyes; then
@@ -20846,7 +22223,7 @@
 
 install.man \\
 uninstall.man ::
-	cd man && \${MAKE} \${CF_MFLAGS} \$@
+	cd man && \${MAKE} \${TOP_MFLAGS} \$@
 CF_EOF
 fi
 
@@ -20867,7 +22244,7 @@
 
 install.man \\
 uninstall.man ::
-	cd tack && \${MAKE} \${CF_MFLAGS} \$@
+	cd tack && \${MAKE} \${TOP_MFLAGS} \$@
 CF_EOF
 fi
 fi
@@ -20979,7 +22356,7 @@
 	fi
 done
 
-if test "x$cf_with_ada" != xno ; then
+if test "x$cf_with_ada" = "xyes" && test "x$cf_cv_prog_gnat_correct" = "xyes"; then
 if test -z "$USE_OLD_MAKERULES" ; then
 	$AWK -f $srcdir/Ada95/mk-1st.awk <$srcdir/Ada95/src/modules >>Ada95/src/Makefile
 fi
Index: configure.in
Prereq:  1.520 
--- ncurses-5.9/configure.in	2011-03-28 00:22:26.000000000 +0000
+++ ncurses-5.9-20130504/configure.in	2013-04-27 19:37:40.000000000 +0000
@@ -1,5 +1,5 @@
 dnl***************************************************************************
-dnl Copyright (c) 1998-2010,2011 Free Software Foundation, Inc.              *
+dnl Copyright (c) 1998-2012,2013 Free Software Foundation, Inc.              *
 dnl                                                                          *
 dnl Permission is hereby granted, free of charge, to any person obtaining a  *
 dnl copy of this software and associated documentation files (the            *
@@ -28,14 +28,14 @@
 dnl
 dnl Author: Thomas E. Dickey 1995-on
 dnl
-dnl $Id: configure.in,v 1.520 2011/03/28 00:22:26 tom Exp $
+dnl $Id: configure.in,v 1.565 2013/04/27 19:37:40 tom Exp $
 dnl Process this file with autoconf to produce a configure script.
 dnl
 dnl See http://invisible-island.net/autoconf/ for additional information.
 dnl
 dnl ---------------------------------------------------------------------------
-AC_PREREQ(2.13.20020210)
-AC_REVISION($Revision: 1.520 $)
+AC_PREREQ(2.52.20030208)
+AC_REVISION($Revision: 1.565 $)
 AC_INIT(ncurses/base/lib_initscr.c)
 AC_CONFIG_HEADER(include/ncurses_cfg.h:include/ncurses_cfg.hin)
 
@@ -45,11 +45,7 @@
 CF_WITH_REL_VERSION(NCURSES)
 CF_WITH_ABI_VERSION
 
-CF_CHECK_CACHE([AC_CANONICAL_SYSTEM])
-AC_ARG_WITH(system-type,
-[  --with-system-type=XXX  test: override derived host system-type],
-[AC_MSG_WARN(overriding system type to $withval)
- cf_cv_system_name=$withval])
+CF_WITH_SYSTYPE
 
 ###	Save the given $CFLAGS to allow user-override.
 cf_user_CFLAGS="$CFLAGS"
@@ -58,15 +54,22 @@
 CF_CFG_DEFAULTS
 
 ###	Checks for programs.
-AC_PROG_CC
-CF_GCC_VERSION
+AC_ARG_WITH(ada,
+	[  --without-ada           suppress check for Ada95, don't build demo],
+	[cf_with_ada=$withval],
+	[cf_with_ada=yes])
+if test "x$cf_with_ada" = xyes
+then
+	cf_PROG_CC="gnatgcc gcc cc"
+else
+	cf_PROG_CC="gcc cc"
+fi
+
+CF_PROG_CC($cf_PROG_CC)
 
 AC_PROG_CPP
 AC_PROG_GCC_TRADITIONAL
 CF_PROG_CC_C_O(CC)
-AC_ISC_POSIX
-CF_ANSI_CC_REQD
-CF_PROG_EXT
 CF_PROG_LDCONFIG
 
 dnl DEFECT in autoconf 2.12:	an attempt to set policy, this breaks the
@@ -89,14 +92,16 @@
 		cf_with_cxx=no; CXX=""; GXX="";])dnl
 	AC_PROG_CXX
 	popdef([AC_MSG_ERROR])dnl
-	# autoconf 2.5x removed the error - by hardcoding it to g++.
+	# autoconf 2.5x removed the error (hardcoding it to g++, or just blank)
 	if test "$CXX" = "g++" ; then
 		AC_PATH_PROG(CXX,g++)
 	fi
-	if test "$CXX" = "g++" ; then
-		AC_MSG_WARN(ignoring hardcoded g++)
+	case "x$CXX" in #(vi
+	x|xg++)
+		AC_MSG_WARN([You don't have any C++ compiler, too bad])
 		cf_with_cxx=no; CXX=""; GXX="";
-	fi
+		;;
+	esac
 fi
 
 CF_GXX_VERSION
@@ -116,10 +121,6 @@
 AC_MSG_RESULT($cf_with_cxx_binding)
 
 AC_MSG_CHECKING(if you want to build with Ada95)
-AC_ARG_WITH(ada,
-	[  --without-ada           suppress check for Ada95, don't build demo],
-	[cf_with_ada=$withval],
-	[cf_with_ada=yes])
 AC_MSG_RESULT($cf_with_ada)
 
 AC_MSG_CHECKING(if you want to install manpages)
@@ -168,28 +169,8 @@
 
 # if we find pkg-config, check if we should install the ".pc" files.
 CF_PKG_CONFIG
-
-if test "$PKG_CONFIG" != no ; then
-	AC_MSG_CHECKING(if we should install .pc files for $PKG_CONFIG)
-
-	# Leave this as something that can be overridden in the environment.
-	if test -z "$PKG_CONFIG_LIBDIR" ; then
-		PKG_CONFIG_LIBDIR=`echo "$PKG_CONFIG" | sed -e 's,/[[^/]]*/[[^/]]*$,,'`/lib/pkgconfig
-	fi
-	PKG_CONFIG_LIBDIR=`echo "$PKG_CONFIG_LIBDIR" | sed -e 's/^://' -e 's/:.*//'`
-	if test -n "$PKG_CONFIG_LIBDIR" && test -d "$PKG_CONFIG_LIBDIR" ; then
-		AC_ARG_ENABLE(pc-files,
-			[  --enable-pc-files       generate and install .pc files for pkg-config],
-			[enable_pc_files=$enableval],
-			[enable_pc_files=no])
-		AC_MSG_RESULT($enable_pc_files)
-	else
-		AC_MSG_RESULT(no)
-		AC_MSG_WARN(did not find library $PKG_CONFIG_LIBDIR)
-		enable_pc_files=no
-	fi
-fi
-AC_SUBST(PKG_CONFIG_LIBDIR)
+CF_WITH_PKG_CONFIG_LIBDIR
+CF_ENABLE_PC_FILES
 
 AC_MSG_CHECKING(if we should assume mixed-case filenames)
 AC_ARG_ENABLE(mixed-case,
@@ -201,8 +182,8 @@
     CF_MIXEDCASE_FILENAMES
 else
     cf_cv_mixedcase=$enable_mixedcase
-    if test "$enable_mixedcase" = "yes" ; then
-        AC_DEFINE(MIXEDCASE_FILENAMES)
+    if test "x$enable_mixedcase" = "xyes" ; then
+        AC_DEFINE(MIXEDCASE_FILENAMES,1,[Define to 1 if tic should assume mixed-case filenames])
     fi
 fi
 
@@ -223,8 +204,8 @@
 AC_MSG_CHECKING(if you have specified an install-prefix)
 AC_ARG_WITH(install-prefix,
 	[  --with-install-prefix   prefixes actual install-location ($DESTDIR)],
-	[case "$withval" in #(vi
-	yes|no) #(vi
+	[case "x$withval" in #(vi
+	xyes|xno) #(vi
 		;;
 	*)	DESTDIR="$withval"
 		;;
@@ -261,7 +242,7 @@
 	[with_shared=$withval],
 	[with_shared=no])
 AC_MSG_RESULT($with_shared)
-test "$with_shared" = "yes" && cf_list_models="$cf_list_models shared"
+test "x$with_shared" = "xyes" && cf_list_models="$cf_list_models shared"
 
 AC_MSG_CHECKING(if you want to build static libraries)
 AC_ARG_WITH(normal,
@@ -269,7 +250,7 @@
 	[with_normal=$withval],
 	[with_normal=yes])
 AC_MSG_RESULT($with_normal)
-test "$with_normal" = "yes" && cf_list_models="$cf_list_models normal"
+test "x$with_normal" = "xyes" && cf_list_models="$cf_list_models normal"
 
 AC_MSG_CHECKING(if you want to build debug libraries)
 AC_ARG_WITH(debug,
@@ -277,7 +258,7 @@
 	[with_debug=$withval],
 	[with_debug=yes])
 AC_MSG_RESULT($with_debug)
-test "$with_debug" = "yes" && cf_list_models="$cf_list_models debug"
+test "x$with_debug" = "xyes" && cf_list_models="$cf_list_models debug"
 
 AC_MSG_CHECKING(if you want to build profiling libraries)
 AC_ARG_WITH(profile,
@@ -285,10 +266,21 @@
 	[with_profile=$withval],
 	[with_profile=no])
 AC_MSG_RESULT($with_profile)
-test "$with_profile" = "yes" && cf_list_models="$cf_list_models profile"
+test "x$with_profile" = "xyes" && cf_list_models="$cf_list_models profile"
 
 fi
 
+if test "X$cf_with_cxx_binding" != Xno; then
+if test "x$with_shared" = "xyes"; then
+AC_MSG_CHECKING(if you want to build C++ shared libraries)
+AC_ARG_WITH(cxx-shared,
+	[  --with-cxx-shared       generate C++ shared-libraries],
+	[with_shared_cxx=$withval],
+	[with_shared_cxx=no])
+AC_MSG_RESULT($with_shared_cxx)
+fi
+fi
+
 ###############################################################################
 
 AC_MSG_CHECKING(for specified models)
@@ -321,12 +313,11 @@
 LIB_DIR=../lib
 LIB_2ND=../../lib
 
-CF_LIB_PREFIX(cf_prefix)
-LIB_PREFIX=$cf_prefix
-AC_SUBST(LIB_PREFIX)
+CF_WITH_LIB_PREFIX(cf_prefix)
 
 LIB_SUFFIX=
 AC_SUBST(LIB_SUFFIX)
+CF_PATHSEP
 
 ###############################################################################
 
@@ -354,21 +345,21 @@
 		[with_dlsym=$withval],
 		[with_dlsym=yes])
 	AC_MSG_RESULT($with_dlsym)
-	if test "$with_dlsym" = yes ; then
+	if test "x$with_dlsym" = xyes ; then
 		CF_FUNC_DLSYM
-		if test "$with_gpm" != yes ; then
+		if test "x$with_gpm" != xyes ; then
 			CF_VERBOSE(assuming soname for gpm is $with_gpm)
 			cf_cv_gpm_soname="$with_gpm"
 		else
 			CF_LIB_SONAME([#include <gpm.h>],[if (Gpm_Open(0,0)) Gpm_Close();],gpm)
 		fi
-		test "$cf_cv_gpm_soname" != "unknown" && AC_DEFINE_UNQUOTED(LIBGPM_SONAME,"$cf_cv_gpm_soname")
+		test "$cf_cv_gpm_soname" != "unknown" && AC_DEFINE_UNQUOTED(LIBGPM_SONAME,"$cf_cv_gpm_soname",[Define as needed to set the gpm share library soname])
 		SHLIB_LIST="-ldl $SHLIB_LIST"
 	else
 		SHLIB_LIST="-lgpm $SHLIB_LIST"
 		CF_ADD_LIB(gpm,TEST_LIBS)
 	fi
-	AC_DEFINE(HAVE_LIBGPM)
+	AC_DEFINE(HAVE_LIBGPM,1,[Define to 1 if we have the gpm library])
 	CF_CHECK_GPM_WGETCH
 fi
 
@@ -378,13 +369,13 @@
 
 if test X"$CC_G_OPT" = X"" ; then
 	CC_G_OPT='-g'
-	test -n "$GCC" && test "${ac_cv_prog_cc_g}" != yes && CC_G_OPT=''
+	test -n "$GCC" && test "x${ac_cv_prog_cc_g}" != xyes && CC_G_OPT=''
 fi
 AC_SUBST(CC_G_OPT)
 
 if test X"$CXX_G_OPT" = X"" ; then
 	CXX_G_OPT='-g'
-	test -n "$GXX" && test "${ac_cv_prog_cxx_g}" != yes && CXX_G_OPT=''
+	test -n "$GXX" && test "x${ac_cv_prog_cxx_g}" != xyes && CXX_G_OPT=''
 fi
 AC_SUBST(CXX_G_OPT)
 
@@ -453,9 +444,8 @@
 esac
 AC_SUBST(TERMINFO_SRC)
 
-CF_PATHSEP
 if test "$use_database" != no ; then
-	AC_DEFINE(USE_DATABASE)
+	AC_DEFINE(USE_DATABASE,1,[Define to 1 if we should use the terminal database])
 
 	AC_MSG_CHECKING(which terminfo source-file will be installed)
 	AC_ARG_WITH(database,
@@ -494,6 +484,26 @@
 WHICH_XTERM=$with_xterm_new
 AC_SUBST(WHICH_XTERM)
 
+AC_MSG_CHECKING(if xterm backspace sends BS or DEL)
+AC_ARG_WITH(xterm-kbs,
+	[  --with-xterm-kbs=XXX    specify if xterm backspace sends BS or DEL],
+	[with_xterm_kbs=$withval],
+	[with_xterm_kbs=BS])
+case x$with_xterm_kbs in
+xyes|xno|xBS|xbs|x8)
+	with_xterm_kbs=BS
+	;;
+xDEL|xdel|x127)
+	with_xterm_kbs=DEL
+	;;
+*)
+	with_xterm_kbs=$withval
+	;;
+esac
+AC_MSG_RESULT($with_xterm_kbs)
+XTERM_KBS=$with_xterm_kbs
+AC_SUBST(XTERM_KBS)
+
 MAKE_TERMINFO=
 if test "$use_database" = no ; then
 	TERMINFO="${datadir}/terminfo"
@@ -507,7 +517,7 @@
 	DATADIR/terminfo,
 	${datadir}/terminfo)
 AC_MSG_RESULT($TERMINFO_DIRS)
-test -n "$TERMINFO_DIRS" && AC_DEFINE_UNQUOTED(TERMINFO_DIRS,"$TERMINFO_DIRS")
+test -n "$TERMINFO_DIRS" && AC_DEFINE_UNQUOTED(TERMINFO_DIRS,"$TERMINFO_DIRS",[Define as needed to predefine the TERMINFO_DIR searchlist])
 
 AC_MSG_CHECKING(for default terminfo directory)
 CF_WITH_PATH(default-terminfo-dir,
@@ -516,7 +526,7 @@
 	DATADIR/terminfo,
 	${datadir}/terminfo)
 AC_MSG_RESULT($TERMINFO)
-AC_DEFINE_UNQUOTED(TERMINFO,"$TERMINFO")
+AC_DEFINE_UNQUOTED(TERMINFO,"$TERMINFO",[Define to set the default terminal database path])
 
 fi
 
@@ -543,7 +553,7 @@
 	[with_big_core=no],
 	[with_big_core=no])])
 AC_MSG_RESULT($with_big_core)
-test "$with_big_core" = "yes" && AC_DEFINE(HAVE_BIG_CORE)
+test "x$with_big_core" = "xyes" && AC_DEFINE(HAVE_BIG_CORE,1,[Define to 1 if machine has ample memory for tic])
 
 ### ISO C only guarantees 512-char strings, we have tables which load faster
 ### when constructed using "big" strings.  More than the C compiler, the awk
@@ -556,7 +566,7 @@
 AC_MSG_RESULT($with_big_strings)
 
 USE_BIG_STRINGS=0
-test "$with_big_strings" = "yes" && USE_BIG_STRINGS=1
+test "x$with_big_strings" = "xyes" && USE_BIG_STRINGS=1
 AC_SUBST(USE_BIG_STRINGS)
 
 ###	use option --enable-termcap to compile in the termcap fallback support
@@ -567,27 +577,27 @@
 	[with_termcap=no])
 AC_MSG_RESULT($with_termcap)
 
-if test "$with_termcap" != "yes" ; then
+if test "x$with_termcap" != "xyes" ; then
 	if test "$use_database" = no ; then
 		if test -z "$with_fallback" ; then
 			AC_ERROR(You have disabled the database w/o specifying fallbacks)
 		fi
 	fi
-	AC_DEFINE(PURE_TERMINFO)
+	AC_DEFINE(PURE_TERMINFO,1,[Define to 1 if we should support only terminfo])
 else
 
 if test "$with_ticlib" != no ; then
 	AC_ERROR(Options --with-ticlib and --enable-termcap cannot be combined)
 fi
 
-AC_DEFINE(USE_TERMCAP)
+AC_DEFINE(USE_TERMCAP,1,[Define to 1 if we should support termcap])
 AC_MSG_CHECKING(for list of termcap files)
 CF_WITH_PATHLIST(termpath,
 	[  --with-termpath=XXX     specify list of termcap files],
 	TERMPATH,
 	/etc/termcap:/usr/share/misc/termcap)
 AC_MSG_RESULT($TERMPATH)
-test -n "$TERMPATH" && AC_DEFINE_UNQUOTED(TERMPATH,"$TERMPATH")
+test -n "$TERMPATH" && AC_DEFINE_UNQUOTED(TERMPATH,"$TERMPATH",[Define to set the termcap searchlist])
 
 ###	use option --enable-getcap to use a hacked getcap for reading termcaps
 AC_MSG_CHECKING(if fast termcap-loader is needed)
@@ -596,7 +606,7 @@
 	[with_getcap=$enableval],
 	[with_getcap=no])
 AC_MSG_RESULT($with_getcap)
-test "$with_getcap" = "yes" && AC_DEFINE(USE_GETCAP)
+test "x$with_getcap" = "xyes" && AC_DEFINE(USE_GETCAP,1,[Define to 1 to use fast termcap-loader])
 
 AC_MSG_CHECKING(if translated termcaps will be cached in ~/.terminfo)
 AC_ARG_ENABLE(getcap-cache,
@@ -604,7 +614,7 @@
 	[with_getcap_cache=$enableval],
 	[with_getcap_cache=no])
 AC_MSG_RESULT($with_getcap_cache)
-test "$with_getcap_cache" = "yes" && AC_DEFINE(USE_GETCAP_CACHE)
+test "x$with_getcap_cache" = "xyes" && AC_DEFINE(USE_GETCAP_CACHE,1,[Define to 1 if translated termcap should be stored in $HOME/.terminfo])
 
 fi
 
@@ -615,7 +625,7 @@
 	[with_home_terminfo=$enableval],
 	[with_home_terminfo=yes])
 AC_MSG_RESULT($with_home_terminfo)
-test "$with_home_terminfo" = "yes" && AC_DEFINE(USE_HOME_TERMINFO)
+test "x$with_home_terminfo" = "xyes" && AC_DEFINE(USE_HOME_TERMINFO,1,[Define to 1 if $HOME/.terminfo feature is wanted])
 
 AC_MSG_CHECKING(if you want to use restricted environment when running as root)
 AC_ARG_ENABLE(root-environ,
@@ -623,7 +633,7 @@
 	[with_root_environ=$enableval],
 	[with_root_environ=yes])
 AC_MSG_RESULT($with_root_environ)
-test "$with_root_environ" = yes && AC_DEFINE(USE_ROOT_ENVIRON)
+test "x$with_root_environ" = xyes && AC_DEFINE(USE_ROOT_ENVIRON,1,[Define to 1 if environment should be restricted for root user])
 
 ###   Use option --enable-symlinks to make tic use symlinks, not hard links
 ###   to reduce storage requirements for the terminfo database.
@@ -634,7 +644,7 @@
 
 # soft links (symbolic links) are useful for some systems where hard links do
 # not work, or to make it simpler to copy terminfo trees around.
-if test "$ac_cv_func_symlink" = yes ; then
+if test "x$ac_cv_func_symlink" = xyes ; then
     AC_MSG_CHECKING(if tic should use symbolic links)
     AC_ARG_ENABLE(symlinks,
 	[  --enable-symlinks       make tic use symbolic links not hard links],
@@ -647,7 +657,7 @@
 # no reason to make this choice optional - use the hard links.
 if test "$with_symlinks" = no ; then
     AC_MSG_CHECKING(if tic should use hard links)
-    if test "$ac_cv_func_link" = yes ; then
+    if test "x$ac_cv_func_link" = xyes ; then
 	with_links=yes
     else
 	with_links=no
@@ -655,8 +665,8 @@
     AC_MSG_RESULT($with_links)
 fi
 
-test "$with_links" = yes && AC_DEFINE(USE_LINKS)
-test "$with_symlinks" = yes && AC_DEFINE(USE_SYMLINKS)
+test "x$with_links" = xyes && AC_DEFINE(USE_LINKS,1,[Define to 1 if hardlinks should be used in terminfo database])
+test "x$with_symlinks" = xyes && AC_DEFINE(USE_SYMLINKS,1,[Define to 1 if symbolic links should be used in terminfo database])
 
 ###   use option --enable-broken-linker to force on use of broken-linker support
 AC_MSG_CHECKING(if you want broken-linker support code)
@@ -667,13 +677,13 @@
 AC_MSG_RESULT($with_broken_linker)
 
 BROKEN_LINKER=0
-if test "$with_broken_linker" = yes ; then
-	AC_DEFINE(BROKEN_LINKER)
+if test "x$with_broken_linker" = xyes ; then
+	AC_DEFINE(BROKEN_LINKER,1,[Define to 1 to work around linkers which cannot link data-only modules])
 	BROKEN_LINKER=1
 elif test "$DFT_LWR_MODEL" = shared ; then
 	case $cf_cv_system_name in #(vi
 	cygwin*)
-		AC_DEFINE(BROKEN_LINKER)
+		AC_DEFINE(BROKEN_LINKER,1,[Define to 1 to work around linkers which cannot link data-only modules])
 		BROKEN_LINKER=1
 		CF_VERBOSE(cygwin linker is broken anyway)
 		;;
@@ -688,7 +698,7 @@
 	[with_bsdpad=$enableval],
 	[with_bsdpad=no])
 AC_MSG_RESULT($with_bsdpad)
-test "$with_bsdpad" = yes && AC_DEFINE(BSD_TPUTS)
+test "x$with_bsdpad" = xyes && AC_DEFINE(BSD_TPUTS,1,[Define to 1 to recognize BSD-style prefix padding])
 
 ###   use option --enable-widec to turn on use of wide-character support
 NCURSES_CH_T=chtype
@@ -718,22 +728,17 @@
 	[with_widec=$enableval],
 	[with_widec=no])
 AC_MSG_RESULT($with_widec)
-if test "$with_widec" = yes ; then
+if test "x$with_widec" = xyes ; then
 	LIB_SUFFIX="w${LIB_SUFFIX}"
-	AC_DEFINE(USE_WIDEC_SUPPORT)
+	AC_DEFINE(USE_WIDEC_SUPPORT,1,[Define to 1 to compile with wide-char/UTF-8 code])
+	AC_DEFINE(NCURSES_WIDECHAR,1,[Define to 1 to compile with wide-char/UTF-8 code])
 
-	case "$CFLAGS $CPPFLAGS" in #(vi
-	*-D_XOPEN_SOURCE=500) #(vi
-		;;
-	*)
-		CF_PREDEFINE(_XOPEN_SOURCE_EXTENDED)
-		;;
-	esac
+	CF_CHECK_WCHAR_H
 
 	# with_overwrite=no
 	NCURSES_CH_T=cchar_t
 	AC_CHECK_FUNCS(putwc btowc wctob mbtowc wctomb mblen mbrlen mbrtowc wcsrtombs mbsrtowcs wcstombs mbstowcs)
-	if test "$ac_cv_func_putwc" != yes ; then
+	if test "x$ac_cv_func_putwc" != xyes ; then
 		CF_UTF8_LIB
 		if test "$cf_cv_utf8_lib" != no ; then
 			NCURSES_LIBUTF8=1
@@ -744,7 +749,7 @@
 	CF_WCHAR_TYPE(wint_t,    NCURSES_WINT_T,    NCURSES_OK_WINT_T)
 
 	if test "$NCURSES_MBSTATE_T" != 0; then
-		AC_DEFINE(NEED_MBSTATE_T_DEF)
+		AC_DEFINE(NEED_MBSTATE_T_DEF,1,[Define to 1 if we must declare mbstate_t])
 	fi
 fi
 AC_SUBST(NCURSES_CH_T)
@@ -775,7 +780,7 @@
 	[with_lp64=$default_with_lp64])
 AC_MSG_RESULT($with_lp64)
 
-if test "$with_lp64" = yes ; then
+if test "x$with_lp64" = xyes ; then
 	cf_cv_enable_lp64=1
 else
 	cf_cv_enable_lp64=0
@@ -792,7 +797,7 @@
 	[with_tparm_varargs=yes])
 AC_MSG_RESULT($with_tparm_varargs)
 NCURSES_TPARM_VARARGS=0
-test "$with_tparm_varargs" = yes && NCURSES_TPARM_VARARGS=1
+test "x$with_tparm_varargs" = xyes && NCURSES_TPARM_VARARGS=1
 AC_SUBST(NCURSES_TPARM_VARARGS)
 
 ###   use option --disable-tic-depends to make libtic not explicitly depend on ncurses/ncursesw
@@ -859,6 +864,15 @@
 AC_MSG_RESULT($NCURSES_CCHARW_MAX)
 AC_SUBST(NCURSES_CCHARW_MAX)
 
+###   use option --with-tparm-arg to override tparm's argument type
+AC_MSG_CHECKING(for type of tparm args)
+AC_ARG_WITH(tparm-arg,
+	[  --with-tparm-arg=TYPE   override parameter type of tparm],
+	[NCURSES_TPARM_ARG="$withval"],
+	[NCURSES_TPARM_ARG=long])
+AC_MSG_RESULT($NCURSES_TPARM_ARG)
+AC_SUBST(NCURSES_TPARM_ARG)
+
 ### Enable compiling-in rcs id's
 AC_MSG_CHECKING(if RCS identifiers should be compiled-in)
 AC_ARG_WITH(rcs-ids,
@@ -866,7 +880,7 @@
 	[with_rcs_ids=$withval],
 	[with_rcs_ids=no])
 AC_MSG_RESULT($with_rcs_ids)
-test "$with_rcs_ids" = yes && AC_DEFINE(USE_RCS_IDS)
+test "x$with_rcs_ids" = xyes && AC_DEFINE(USE_RCS_IDS,1,[Define to 1 to compile-in RCS identifiers])
 
 ###############################################################################
 CF_MAN_PAGES([ captoinfo clear infocmp infotocap tabs tic toe tput tset ])
@@ -881,16 +895,19 @@
 	[with_ext_funcs=$enableval],
 	[with_ext_funcs=yes])
 AC_MSG_RESULT($with_ext_funcs)
-if test "$with_ext_funcs" = yes ; then
+if test "x$with_ext_funcs" = xyes ; then
 	NCURSES_EXT_FUNCS=1
-	AC_DEFINE(HAVE_CURSES_VERSION)
-	AC_DEFINE(HAVE_HAS_KEY)
-	AC_DEFINE(HAVE_RESIZETERM)
-	AC_DEFINE(HAVE_RESIZE_TERM)
-	AC_DEFINE(HAVE_TERM_ENTRY_H)
-	AC_DEFINE(HAVE_USE_DEFAULT_COLORS)
-	AC_DEFINE(HAVE_WRESIZE)
-	AC_DEFINE(NCURSES_EXT_FUNCS)
+	AC_DEFINE(HAVE_ASSUME_DEFAULT_COLORS,1,[Define to 1 to enable assume_default_colors() function])
+	AC_DEFINE(HAVE_CURSES_VERSION,1,[Define to 1 to enable curses_version() function])
+	AC_DEFINE(HAVE_HAS_KEY,1,[Define to 1 to enable has_key() function])
+	AC_DEFINE(HAVE_RESIZETERM,1,[Define to 1 to enable resizeterm() function])
+	AC_DEFINE(HAVE_RESIZE_TERM,1,[Define to 1 to enable resize_term() function])
+	AC_DEFINE(HAVE_TERM_ENTRY_H,1,[Define to 1 to enable term_entry() function])
+	AC_DEFINE(HAVE_USE_DEFAULT_COLORS,1,[Define to 1 to enable use_default_colors() function])
+	AC_DEFINE(HAVE_USE_SCREEN,1,[Define to 1 to enable use_screen() function])
+	AC_DEFINE(HAVE_USE_WINDOW,1,[Define to 1 to enable use_window() function])
+	AC_DEFINE(HAVE_WRESIZE,1,[Define to 1 to enable wresize() function])
+	AC_DEFINE(NCURSES_EXT_FUNCS,1,[Define to 1 to enable ncurses extended functions])
 	GENERATED_EXT_FUNCS=generated
 else
 	NCURSES_EXT_FUNCS=0
@@ -905,9 +922,9 @@
 	[with_sp_funcs=$enableval],
 	[with_sp_funcs=no])
 AC_MSG_RESULT($with_sp_funcs)
-if test "$with_sp_funcs" = yes ; then
+if test "x$with_sp_funcs" = xyes ; then
 	NCURSES_SP_FUNCS=1
-	AC_DEFINE(NCURSES_SP_FUNCS)
+	AC_DEFINE(NCURSES_SP_FUNCS,1,[Define to 1 to enable experimental SCREEN-extensions])
 	GENERATED_SP_FUNCS=generated
 else
 	NCURSES_SP_FUNCS=0
@@ -922,9 +939,9 @@
 	[with_term_driver=$enableval],
 	[with_term_driver=no])
 AC_MSG_RESULT($with_term_driver)
-if test "$with_term_driver" = yes ; then
-	AC_DEFINE(USE_TERM_DRIVER)
-	if test "$with_sp_funcs" != yes ; then
+if test "x$with_term_driver" = xyes ; then
+	AC_DEFINE(USE_TERM_DRIVER,1,[Define to 1 to enable experimental terminal-driver])
+	if test "x$with_sp_funcs" != xyes ; then
 		AC_MSG_ERROR(The term-driver option relies upon sp-funcs)
 	fi
 fi
@@ -937,7 +954,7 @@
 	[with_ext_const=no])
 AC_MSG_RESULT($with_ext_const)
 NCURSES_CONST='/*nothing*/'
-if test "$with_ext_const" = yes ; then
+if test "x$with_ext_const" = xyes ; then
 	NCURSES_CONST=const
 fi
 AC_SUBST(NCURSES_CONST)
@@ -950,15 +967,15 @@
 	[with_ext_colors=no])
 AC_MSG_RESULT($with_ext_colors)
 NCURSES_EXT_COLORS=0
-if test "$with_ext_colors" = yes ; then
-	if test "$with_widec" != yes ; then
+if test "x$with_ext_colors" = xyes ; then
+	if test "x$with_widec" != xyes ; then
 		AC_MSG_ERROR(This option applies only to wide-character library)
 	else
 		# cannot be ABI 5 since it changes sizeof(cchar_t)
 		CF_NCURSES_ABI_6
 	fi
 	NCURSES_EXT_COLORS=1
-	AC_DEFINE(NCURSES_EXT_COLORS)
+	AC_DEFINE(NCURSES_EXT_COLORS,1,[Define to 1 to compile for 256-color support])
 fi
 AC_SUBST(NCURSES_EXT_COLORS)
 
@@ -970,7 +987,7 @@
 	[with_ext_mouse=no])
 AC_MSG_RESULT($with_ext_mouse)
 NCURSES_MOUSE_VERSION=1
-if test "$with_ext_mouse" = yes ; then
+if test "x$with_ext_mouse" = xyes ; then
 	NCURSES_MOUSE_VERSION=2
 	CF_NCURSES_ABI_6
 fi
@@ -982,7 +999,7 @@
 	[with_no_padding=$enableval],
 	[with_no_padding=$with_ext_funcs])
 AC_MSG_RESULT($with_no_padding)
-test "$with_no_padding" = yes && AC_DEFINE(NCURSES_NO_PADDING)
+test "x$with_no_padding" = xyes && AC_DEFINE(NCURSES_NO_PADDING,1,[Define to 1 to compile with $NCURSES_NO_PADDING code])
 
 AC_CHECK_SIZEOF([signed char], 0)
 if test "$ac_cv_sizeof_signed_char" = 1 ; then
@@ -996,7 +1013,7 @@
 	[with_signed_char=$enableval],
 	[with_signed_char=no])
 AC_MSG_RESULT($with_signed_char)
-test "$with_signed_char" != yes && NCURSES_SBOOL="char"
+test "x$with_signed_char" != xyes && NCURSES_SBOOL="char"
 AC_SUBST(NCURSES_SBOOL)
 
 ###   use option --enable-sigwinch to turn on use of SIGWINCH logic
@@ -1006,7 +1023,7 @@
 	[with_sigwinch=$enableval],
 	[with_sigwinch=$with_ext_funcs])
 AC_MSG_RESULT($with_sigwinch)
-test "$with_sigwinch" = yes && AC_DEFINE(USE_SIGWINCH)
+test "x$with_sigwinch" = xyes && AC_DEFINE(USE_SIGWINCH,1,[Define to 1 to compile with SIGWINCH handler])
 
 ###   use option --enable-tcap-names to allow user to define new capabilities
 AC_MSG_CHECKING(if you want user-definable terminal capabilities like termcap)
@@ -1016,7 +1033,7 @@
 	[with_tcap_names=$with_ext_funcs])
 AC_MSG_RESULT($with_tcap_names)
 NCURSES_XNAMES=0
-test "$with_tcap_names" = yes && NCURSES_XNAMES=1
+test "x$with_tcap_names" = xyes && NCURSES_XNAMES=1
 AC_SUBST(NCURSES_XNAMES)
 
 ###############################################################################
@@ -1035,7 +1052,7 @@
 	[  --enable-hard-tabs      compile with hard-tabs code],,
 	[enable_hard_tabs=$with_develop])
 AC_MSG_RESULT($enable_hard_tabs)
-test "$enable_hard_tabs" = yes && AC_DEFINE(USE_HARD_TABS)
+test "x$enable_hard_tabs" = xyes && AC_DEFINE(USE_HARD_TABS,1,[Define to 1 to compile with hard-tabs code])
 
 ###   use option --enable-xmc-glitch to turn on use of magic-cookie optimize
 AC_MSG_CHECKING(if you want limited support for xmc)
@@ -1043,7 +1060,7 @@
 	[  --enable-xmc-glitch     compile with support for xmc (magic-cookie)],,
 	[enable_xmc_glitch=$with_develop])
 AC_MSG_RESULT($enable_xmc_glitch)
-test "$enable_xmc_glitch" = yes && AC_DEFINE(USE_XMC_SUPPORT)
+test "x$enable_xmc_glitch" = xyes && AC_DEFINE(USE_XMC_SUPPORT,1,[Define to 1 to compile with support for xmc (magic-cookie)])
 
 ###############################################################################
 # These are just experimental, probably should not be in a package:
@@ -1055,7 +1072,7 @@
 	[with_assumed_color=$enableval],
 	[with_assumed_color=yes])
 AC_MSG_RESULT($with_assumed_color)
-test "$with_assumed_color" = yes && AC_DEFINE(USE_ASSUMED_COLOR)
+test "x$with_assumed_color" = xyes && AC_DEFINE(USE_ASSUMED_COLOR,1,[Define to 1 to assume things about default-colors])
 
 ###   use option --enable-hashmap to turn on use of hashmap scrolling logic
 AC_MSG_CHECKING(if you want hashmap scrolling-optimization code)
@@ -1064,7 +1081,7 @@
 	[with_hashmap=$enableval],
 	[with_hashmap=yes])
 AC_MSG_RESULT($with_hashmap)
-test "$with_hashmap" = yes && AC_DEFINE(USE_HASHMAP)
+test "x$with_hashmap" = xyes && AC_DEFINE(USE_HASHMAP,1,[Define to 1 to compile with hashmap scrolling-optimization])
 
 ###   use option --enable-colorfgbg to turn on use of $COLORFGBG environment
 AC_MSG_CHECKING(if you want colorfgbg code)
@@ -1073,7 +1090,7 @@
 	[with_colorfgbg=$enableval],
 	[with_colorfgbg=no])
 AC_MSG_RESULT($with_colorfgbg)
-test "$with_colorfgbg" = yes && AC_DEFINE(USE_COLORFGBG)
+test "x$with_colorfgbg" = xyes && AC_DEFINE(USE_COLORFGBG,1,[Define to 1 to compile-in experimental $COLORFGBG code])
 
 ###   use option --enable-interop to turn on use of bindings used for interop
 AC_MSG_CHECKING(if you want interop bindings)
@@ -1084,7 +1101,7 @@
 AC_MSG_RESULT($with_exp_interop)
 
 NCURSES_INTEROP_FUNCS=0
-test "$with_exp_interop" = yes && NCURSES_INTEROP_FUNCS=1
+test "x$with_exp_interop" = xyes && NCURSES_INTEROP_FUNCS=1
 AC_SUBST(NCURSES_INTEROP_FUNCS)
 
 # This is still experimental (20080329), but should ultimately be moved to
@@ -1099,8 +1116,8 @@
 			[use_pthreads_eintr=$enableval],
 			[use_pthreads_eintr=no])
 		AC_MSG_RESULT($use_pthreads_eintr)
-		if test $use_pthreads_eintr = yes ; then
-			AC_DEFINE(USE_PTHREADS_EINTR)
+		if test "x$use_pthreads_eintr" = xyes ; then
+			AC_DEFINE(USE_PTHREADS_EINTR,1,[Define to 1 to enable EINTR in wgetch with pthreads])
 		fi])
 
 	AC_MSG_CHECKING(if you want to use weak-symbols for pthreads)
@@ -1109,22 +1126,22 @@
 		[use_weak_symbols=$enableval],
 		[use_weak_symbols=no])
 	AC_MSG_RESULT($use_weak_symbols)
-	if test "$use_weak_symbols" = yes ; then
+	if test "x$use_weak_symbols" = xyes ; then
 		CF_WEAK_SYMBOLS
 	else
 		cf_cv_weak_symbols=no
 	fi
 
-	if test $cf_cv_weak_symbols = yes ; then
-		AC_DEFINE(USE_WEAK_SYMBOLS)
+	if test "x$cf_cv_weak_symbols" = xyes ; then
+		AC_DEFINE(USE_WEAK_SYMBOLS,1,[Define to 1 to enable weak-symbols for pthreads])
 	fi
 fi
 
 PTHREAD=
-if test "$with_pthread" = "yes" ; then
-    AC_DEFINE(USE_PTHREADS)
+if test "x$with_pthread" = "xyes" ; then
+    AC_DEFINE(USE_PTHREADS,1,[Define to 1 to use pthreads feature])
     enable_reentrant=yes
-    if test $cf_cv_weak_symbols = yes ; then
+    if test "x$cf_cv_weak_symbols" = xyes ; then
         PTHREAD=-lpthread
     fi
 fi
@@ -1140,19 +1157,19 @@
 	[with_reentrant=$enableval],
 	[with_reentrant=no])
 AC_MSG_RESULT($with_reentrant)
-if test "$with_reentrant" = yes ; then
+if test "x$with_reentrant" = xyes ; then
 	cf_cv_enable_reentrant=1
 	cf_cv_enable_opaque="NCURSES_INTERNALS"
 	NCURSES_OPAQUE=1
 	NCURSES_SIZE_T=int
-	if test $cf_cv_weak_symbols = yes ; then
+	if test "x$cf_cv_weak_symbols" = xyes ; then
 		CF_REMOVE_LIB(LIBS,$LIBS,pthread)
 		CF_ADD_LIB(pthread,TEST_LIBS)
 		CF_ADD_LIB(pthread,TEST_LIBS2)
 	else
 		LIB_SUFFIX="t${LIB_SUFFIX}"
 	fi
-	AC_DEFINE(USE_REENTRANT)
+	AC_DEFINE(USE_REENTRANT,1,[Define to 1 to use experimental reentrant feature])
 	CF_NCURSES_ABI_6
 else
 	cf_cv_enable_reentrant=0
@@ -1177,7 +1194,7 @@
 	NCURSES_WRAP_PREFIX=_nc_
 fi
 AC_SUBST(NCURSES_WRAP_PREFIX)
-AC_DEFINE_UNQUOTED(NCURSES_WRAP_PREFIX,"$NCURSES_WRAP_PREFIX")
+AC_DEFINE_UNQUOTED(NCURSES_WRAP_PREFIX,"$NCURSES_WRAP_PREFIX",[Define to override _nc_ prefix])
 
 AC_MSG_CHECKING(if you want experimental safe-sprintf code)
 AC_ARG_ENABLE(safe-sprintf,
@@ -1185,7 +1202,7 @@
 	[with_safe_sprintf=$enableval],
 	[with_safe_sprintf=no])
 AC_MSG_RESULT($with_safe_sprintf)
-test "$with_safe_sprintf" = yes && AC_DEFINE(USE_SAFE_SPRINTF)
+test "x$with_safe_sprintf" = xyes && AC_DEFINE(USE_SAFE_SPRINTF,1,[Define to 1 to compile with experimental safe-sprintf code])
 
 ###   use option --disable-scroll-hints to turn off use of scroll-hints scrolling logic
 # when hashmap is used scroll hints are useless
@@ -1196,7 +1213,7 @@
 	[with_scroll_hints=$enableval],
 	[with_scroll_hints=yes])
 AC_MSG_RESULT($with_scroll_hints)
-test "$with_scroll_hints" = yes && AC_DEFINE(USE_SCROLL_HINTS)
+test "x$with_scroll_hints" = xyes && AC_DEFINE(USE_SCROLL_HINTS,1,[Define to 1 to compile without scroll-hints code])
 fi
 
 AC_MSG_CHECKING(if you want experimental wgetch-events code)
@@ -1205,25 +1222,20 @@
 	[with_wgetch_events=$enableval],
 	[with_wgetch_events=no])
 AC_MSG_RESULT($with_wgetch_events)
-test "$with_wgetch_events" = yes && AC_DEFINE(NCURSES_WGETCH_EVENTS)
+test "x$with_wgetch_events" = xyes && AC_DEFINE(NCURSES_WGETCH_EVENTS,1,[Define to 1 to compile with experimental wgetch-events code])
 
 ###############################################################################
 CF_HELP_MESSAGE(Testing/development Options:)
 
 ###	use option --disable-echo to suppress full display compiling commands
-AC_MSG_CHECKING(if you want to display full commands during build)
-AC_ARG_ENABLE(echo,
-	[  --enable-echo           build: display "compiling" commands (default)],
-	[with_echo=$enableval],
-	[with_echo=yes])
-if test "$with_echo" = yes; then
+CF_DISABLE_ECHO
+if test "x$enable_echo" = xyes; then
 	ECHO_LINK=
 else
 	ECHO_LINK='@ echo linking $@ ... ;'
 	test -n "$LIBTOOL" && LIBTOOL="$LIBTOOL --silent"
 	test -n "$LIBTOOL_CXX" && LIBTOOL_CXX="$LIBTOOL_CXX --silent"
 fi
-AC_MSG_RESULT($with_echo)
 AC_SUBST(ECHO_LINK)
 
 ###	use option --enable-warnings to turn on all gcc warnings
@@ -1236,11 +1248,12 @@
 if test "x$with_warnings" = "xyes"; then
  	CF_ADD_ADAFLAGS(-gnatg)
 	CF_GCC_WARNINGS(Wdeclaration-after-statement Wextra Wno-unknown-pragmas Wswitch-enum)
-	if test "$cf_with_cxx" = yes ; then
+	if test "x$cf_with_cxx" = xyes ; then
 		CF_GXX_WARNINGS(Wno-unused)
 	fi
 fi
 CF_GCC_ATTRIBUTES
+CF_ENABLE_STRING_HACKS
 
 ###	use option --enable-assertions to turn on generation of assertion code
 AC_MSG_CHECKING(if you want to enable runtime assertions)
@@ -1253,7 +1266,6 @@
 then
 	if test "$with_assertions" = no
 	then
-		AC_DEFINE(NDEBUG)
 		CPPFLAGS="$CPPFLAGS -DNDEBUG"
 	else
 		CF_ADD_ADAFLAGS(-gnata)
@@ -1262,17 +1274,17 @@
 
 ###	use option --disable-leaks to suppress "permanent" leaks, for testing
 CF_DISABLE_LEAKS
-AC_DEFINE(HAVE_NC_ALLOC_H)
+AC_DEFINE(HAVE_NC_ALLOC_H,1,[Define to 1 if we have nc_alloc.h header])
 
 ###	use option --enable-expanded to generate certain macros as functions
 AC_ARG_ENABLE(expanded,
 	[  --enable-expanded       test: generate functions for certain macros],
-	[test "$enableval" = yes && AC_DEFINE(NCURSES_EXPANDED)])
+	[test "x$enableval" = xyes && AC_DEFINE(NCURSES_EXPANDED,1,[Define to 1 to generate functions for certain macros])])
 
 ###	use option --disable-macros to suppress macros in favor of functions
 AC_ARG_ENABLE(macros,
 	[  --disable-macros        test: use functions rather than macros],
-	[test "$enableval" = no && AC_DEFINE(NCURSES_NOMACROS)])
+	[test "$enableval" = no && AC_DEFINE(NCURSES_NOMACROS,1,[Define to 1 to use functions rather than macros])])
 
 # Normally we only add trace() to the debug-library.  Allow this to be
 # extended to all models of the ncurses library:
@@ -1290,7 +1302,7 @@
 [cf_with_trace=$cf_all_traces])
 AC_MSG_RESULT($cf_with_trace)
 
-if test "$cf_with_trace" = yes ; then
+if test "x$cf_with_trace" = xyes ; then
 	LIB_TRACING=all
 	ADA_TRACE=TRUE
 	CF_ADD_CFLAGS(-DTRACE)
@@ -1307,10 +1319,10 @@
 	;;
 *)
 AC_CHECK_FUNC(gettimeofday,
-	AC_DEFINE(HAVE_GETTIMEOFDAY),[
+	AC_DEFINE(HAVE_GETTIMEOFDAY,1,[Define to 1 if we have gettimeofday function]),[
 
 AC_CHECK_LIB(bsd, gettimeofday,
-	AC_DEFINE(HAVE_GETTIMEOFDAY)
+	AC_DEFINE(HAVE_GETTIMEOFDAY,1,[Define to 1 if we have gettimeofday function])
 	CF_ADD_LIB(bsd))])dnl CLIX: bzero, select, gettimeofday
 	;;
 esac
@@ -1344,9 +1356,11 @@
 wctype.h \
 )
 
+CF_GETOPT_HEADER
+
 # check for ISC (this may also define _POSIX_SOURCE)
 # Note: even non-Posix ISC needs <sys/bsdtypes.h> to declare fd_set
-if test "$ISC" = yes ; then
+if test "x$ISC" = xyes ; then
 	AC_CHECK_LIB(cposix,main)
 	AC_CHECK_LIB(inet,bzero,CF_ADD_LIB(inet))dnl also 'select()'
 fi
@@ -1393,10 +1407,12 @@
 getttynam \
 issetugid \
 poll \
+putenv \
 remove \
 select \
 setbuf \
 setbuffer \
+setenv \
 setvbuf \
 sigaction \
 sigvec \
@@ -1406,7 +1422,7 @@
 times \
 vsnprintf \
 )
-if test "$with_getcap" = "yes" ; then
+if test "x$with_getcap" = "xyes" ; then
 	CF_CGETENT
 fi
 
@@ -1421,12 +1437,12 @@
 CF_SUBST_IF(["$cf_cv_func_vsscanf" = vsscanf], HAVE_VSSCANF, 1, 0)
 
 dnl FIXME (may need this) AC_SYS_RESTARTABLE_SYSCALLS
-if test "$cross_compiling" = yes ; then
+if test "x$cross_compiling" = xyes ; then
 	AC_MSG_WARN(cross compiling: assume setvbuf params not reversed)
 else
 	AC_FUNC_SETVBUF_REVERSED
 fi
-AC_TYPE_SIGNAL
+AC_CHECK_TYPE(intptr_t, long)
 CF_TYPE_SIGACTION
 CF_SIZECHANGE
 CF_FUNC_MEMMOVE
@@ -1437,9 +1453,9 @@
 # special check for test/ditto.c
 CF_FUNC_OPENPTY
 if test "$cf_cv_func_openpty" != no ; then
-    AC_DEFINE_UNQUOTED(USE_OPENPTY_HEADER,<$cf_cv_func_openpty>)
-    AC_DEFINE(USE_XTERM_PTY)
-    if test "$cf_cv_lib_util" = yes ; then
+    AC_DEFINE_UNQUOTED(USE_OPENPTY_HEADER,<$cf_cv_func_openpty>,[Define to actual header for openpty function])
+    AC_DEFINE(USE_XTERM_PTY,1,[Define to 1 if we should assume xterm pseudoterminal interface])
+    if test "x$cf_cv_lib_util" = xyes ; then
         CF_ADD_LIB(util,TEST_LIBS)
     fi
 fi
@@ -1447,7 +1463,7 @@
 AC_SUBST(TEST_LIBS2)
 
 if test "$with_hashed_db" != no ; then
-	AC_DEFINE(USE_HASHED_DB)
+	AC_DEFINE(USE_HASHED_DB,1,[Define to 1 if we should build terminfo in hashed database])
 	CF_HASHED_DB($with_hashed_db)
 fi
 
@@ -1478,50 +1494,14 @@
 		;;
 	esac
 
-	AC_CHECK_HEADERS(iostream typeinfo)
-
-    if test x"$ac_cv_header_iostream" = xyes ; then
-        AC_MSG_CHECKING(if iostream uses std-namespace)
-        AC_TRY_COMPILE([
-#include <iostream>
-using std::endl;
-using std::cerr;],[
-cerr << "testing" << endl;
-],[cf_iostream_namespace=yes],[cf_iostream_namespace=no])
-        AC_MSG_RESULT($cf_iostream_namespace)
-        if test "$cf_iostream_namespace" = yes ; then
-            AC_DEFINE(IOSTREAM_NAMESPACE)
-        fi
-    fi
-
+	AC_CHECK_HEADERS(typeinfo)
+	CF_CXX_IOSTREAM_NAMESPACE
 	CF_BOOL_DECL
 	CF_BOOL_SIZE
 	CF_ETIP_DEFINES
 	CF_CPP_PARAM_INIT
 	CF_CPP_STATIC_CAST
-
-	CXX_AR='$(AR)'
-	CXX_ARFLAGS='$(ARFLAGS)'
-	case $cf_cv_system_name in #(vi
-	irix*) #(vi
-	    if test "$GXX" != yes ; then
-		CXX_AR='$(CXX)'
-		CXX_ARFLAGS='-ar -o'
-	    fi
-	    ;;
-	sco3.2v5*) #(vi
-	    CXXLDFLAGS="-u main"
-	    ;;
-	solaris2*)
-	    if test "$GXX" != yes ; then
-		CXX_AR='$(CXX)'
-		CXX_ARFLAGS='-xar -o'
-	    fi
-	    ;;
-	esac
-	AC_SUBST(CXXLDFLAGS)
-	AC_SUBST(CXX_AR)
-	AC_SUBST(CXX_ARFLAGS)
+	CF_CXX_AR_FLAGS
 else
 	cf_cxx_library=no
 	cf_cv_builtin_bool=1
@@ -1593,20 +1573,9 @@
 dnl At the moment we support no other Ada95 compiler.
 	if test "$cf_with_ada" != "no" ; then
 		CF_PROG_GNAT
-		if test	"$cf_cv_prog_gnat_correct" = yes; then
+		if test	"x$cf_cv_prog_gnat_correct" = xyes; then
 			CF_ADD_ADAFLAGS(-gnatpn)
-
-			# make ADAFLAGS consistent with CFLAGS
-			case "$CFLAGS" in
-			*-g*)
-				CF_ADD_ADAFLAGS(-g)
-				;;
-			esac
-			case "$CFLAGS" in
-			*-O*)
-				CF_ADD_ADAFLAGS(-O3)
-				;;
-			esac
+			CF_FIXUP_ADAFLAGS
 
 			CF_GNAT_GENERICS
 			CF_GNAT_SIGINT
@@ -1640,7 +1609,7 @@
 AC_MSG_CHECKING(for library subsets)
 LIB_SUBSETS=
 
-if test "$cf_with_progs" = yes || test "$with_ticlib" != no || test "$with_termcap" != no; then
+if test "x$cf_with_progs" = xyes || test "$with_ticlib" != no || test "$with_termcap" != no; then
 	LIB_SUBSETS="${LIB_SUBSETS}ticlib"
 	if test "$with_ticlib" != no ; then
 		LIB_SUBSETS="${LIB_SUBSETS} "
@@ -1650,7 +1619,7 @@
 fi
 
 LIB_SUBSETS="${LIB_SUBSETS}termlib"
-test "$with_ext_funcs" = yes && LIB_SUBSETS="${LIB_SUBSETS}+ext_tinfo"
+test "x$with_ext_funcs" = xyes && LIB_SUBSETS="${LIB_SUBSETS}+ext_tinfo"
 
 if test "$with_termlib" != no ; then
 	LIB_SUBSETS="${LIB_SUBSETS} "
@@ -1674,8 +1643,8 @@
 	esac
 fi
 
-test "$with_widec"     = yes && LIB_SUBSETS="${LIB_SUBSETS}+widechar"
-test "$with_ext_funcs" = yes && LIB_SUBSETS="${LIB_SUBSETS}+ext_funcs"
+test "x$with_widec"     = xyes && LIB_SUBSETS="${LIB_SUBSETS}+widechar"
+test "x$with_ext_funcs" = xyes && LIB_SUBSETS="${LIB_SUBSETS}+ext_funcs"
 
 AC_MSG_RESULT($LIB_SUBSETS)
 
@@ -1699,20 +1668,24 @@
 AC_SUBST(DFT_OBJ_SUBDIR)dnl the default object-directory ("obj")
 AC_MSG_RESULT($DFT_OBJ_SUBDIR)
 
-# libtool thinks it can make c++ shared libraries (perhaps only g++)
-if test "$cf_with_cxx" = yes ; then
+if test "x$cf_with_cxx" = xyes ; then
 AC_MSG_CHECKING(c++ library-dependency suffix)
 if test "$with_libtool" != "no"; then
+	# libtool thinks it can make c++ shared libraries (perhaps only g++)
+	CXX_LIB_SUFFIX=$DFT_DEP_SUFFIX
+elif test "$with_shared_cxx" != "no"; then
+	# also for g++ users...
 	CXX_LIB_SUFFIX=$DFT_DEP_SUFFIX
 else
-	CF_LIB_SUFFIX(normal,CXX_LIB_SUFFIX,CXX_DEP_SUFFIX)dnl we normally make a static library
+	# we normally make a static library because C/C++ library rules differ
+	CF_LIB_SUFFIX(normal,CXX_LIB_SUFFIX,CXX_DEP_SUFFIX)
 fi
 AC_MSG_RESULT($CXX_LIB_SUFFIX)
 AC_SUBST(CXX_LIB_SUFFIX)
 fi
 
 # do not want -ldl in build except as needed for -lncurses dependency
-if test "$with_dlsym" = yes ; then
+if test "x$with_dlsym" = xyes ; then
 if test $DFT_LWR_MODEL = shared || \
    test $DFT_LWR_MODEL = libtool ; then
 	CF_REMOVE_LIB(LIBS,$LIBS,dl)
@@ -1723,13 +1696,13 @@
 # TICS_LIST and TINFO_LIST are needed to build libtic.so and libterm.so, but
 # do not need libdl
 TICS_LIST=
-if test "$with_dlsym" = yes ; then
+if test "x$with_dlsym" = xyes ; then
 	CF_REMOVE_LIB(TINFO_LIST,$SHLIB_LIST,dl)
 fi
 
 if test "$with_ticlib" != no ; then
 
-	if test "$with_ticlib" != yes ; then
+	if test "x$with_ticlib" != xyes ; then
 		TICS_NAME=$with_ticlib
 		TICS_ARG_SUFFIX="${with_ticlib}`echo ${DFT_ARG_SUFFIX}|sed -e "s/^${LIB_SUFFIX}//"`"
 		TICS_DEP_SUFFIX="${with_ticlib}`echo ${DFT_DEP_SUFFIX}|sed -e "s/^${LIB_SUFFIX}//"`"
@@ -1739,18 +1712,21 @@
 		TICS_DEP_SUFFIX="${TICS_NAME}${DFT_DEP_SUFFIX}"
 		TICS_LIB_SUFFIX="${TICS_NAME}${LIB_SUFFIX}"
 	fi
-	TICS_ARGS="-L${LIB_DIR} -l${TICS_LIB_SUFFIX}"
+	TICS_LDFLAGS="-L${LIB_DIR}"
+	TICS_LIBS="-l${TICS_LIB_SUFFIX}"
 else
-	TICS_ARGS="-L${LIB_DIR} -l${LIB_NAME}${DFT_ARG_SUFFIX}"
+	TICS_LDFLAGS="-L${LIB_DIR}"
+	TICS_LIBS="-l${LIB_NAME}${DFT_ARG_SUFFIX}"
 fi
 AC_SUBST(TICS_ARG_SUFFIX)
 AC_SUBST(TICS_DEP_SUFFIX)
 AC_SUBST(TICS_LIB_SUFFIX)
-AC_SUBST(TICS_ARGS)
+AC_SUBST(TICS_LDFLAGS)
+AC_SUBST(TICS_LIBS)
 
 if test "$with_termlib" != no ; then
 
-	if test "$with_termlib" != yes ; then
+	if test "x$with_termlib" != xyes ; then
 		TINFO_NAME=$with_termlib
 		TINFO_SUFFIX="`echo ${DFT_LIB_SUFFIX}|sed -e "s/^${LIB_SUFFIX}//"`"
 		TINFO_ARG_SUFFIX="${with_termlib}`echo ${DFT_ARG_SUFFIX}|sed -e "s/^${LIB_SUFFIX}//"`"
@@ -1768,14 +1744,22 @@
 	if test "$DFT_LWR_MODEL" = "libtool"; then
 		TEST_ARGS="${TEST_DEPS}"
 		TEST_ARG2="${TEST_DEP2}"
-		TINFO_ARGS="-L${LIB_DIR} $TEST_ARGS"
+		TINFO_LDFLAGS="-L${LIB_DIR}"
+		TINFO_LIBS="$TEST_ARGS"
 		TICS_LIST="$SHLIB_LIST $TEST_ARGS"
 		SHLIB_LIST="${SHLIB_LIST} $TEST_ARGS"
 	else
 		TEST_ARGS="-l${TINFO_ARG_SUFFIX}"
 		TEST_ARG2="-l${TINFO_ARG_SUFFIX}"
-		TICS_LIST="$SHLIB_LIST -l${TINFO_LIB_SUFFIX}"
-		TINFO_ARGS="-L${LIB_DIR} $TEST_ARGS"
+		if test "x$with_term_driver" != xno ; then
+			TICS_LIST="$SHLIB_LIST -l${LIB_NAME}${DFT_ARG_SUFFIX}"
+			TICS_LIBS="$TICS_LIBS -l${LIB_NAME}${DFT_ARG_SUFFIX}"
+			TINFO_LIBS="-l${LIB_NAME}${DFT_ARG_SUFFIX} $TEST_ARGS"
+		else
+			TICS_LIST="$SHLIB_LIST -l${TINFO_LIB_SUFFIX}"
+			TINFO_LIBS="$TEST_ARGS"
+		fi
+		TINFO_LDFLAGS="-L${LIB_DIR}"
 		SHLIB_LIST="$SHLIB_LIST -l${TINFO_LIB_SUFFIX}"
 	fi
 else
@@ -1783,13 +1767,14 @@
 	TINFO_NAME=${LIB_NAME}
 	TINFO_SUFFIX=${DFT_LIB_SUFFIX}
 	TINFO_ARG_SUFFIX=${LIB_NAME}${DFT_ARG_SUFFIX}
-	if test "$with_tic_depends" = yes ; then
+	if test "x$with_tic_depends" = xyes ; then
 		TICS_LIST="$SHLIB_LIST -l${LIB_NAME}${DFT_ARG_SUFFIX}"
 	else
 		TICS_LIST="$SHLIB_LIST"
 	fi
 
-	TINFO_ARGS="-L${LIB_DIR} -l${LIB_NAME}${DFT_ARG_SUFFIX}"
+	TINFO_LDFLAGS="-L${LIB_DIR}"
+	TINFO_LIBS="-l${LIB_NAME}${DFT_ARG_SUFFIX}"
 fi
 
 if test "$DFT_LWR_MODEL" = shared ; then
@@ -1804,9 +1789,10 @@
 AC_SUBST(TINFO_ARG_SUFFIX)
 AC_SUBST(TINFO_DEP_SUFFIX)
 AC_SUBST(TINFO_LIB_SUFFIX)
-AC_SUBST(TINFO_ARGS)
+AC_SUBST(TINFO_LDFLAGS)
+AC_SUBST(TINFO_LIBS)
 
-if test "$with_dlsym" = yes ; then
+if test "x$with_dlsym" = xyes ; then
 	CF_REMOVE_LIB(TICS_LIST,$TICS_LIST,dl)
 fi
 
@@ -1815,8 +1801,8 @@
 fi
 
 # needed for Ada95
-TINFO_ARGS2=`echo "$TINFO_ARGS" | sed -e 's,-L\.\./,-L../../,'`
-AC_SUBST(TINFO_ARGS2)
+TINFO_LDFLAGS2=`echo "$TINFO_LDFLAGS" | sed -e 's,-L\.\./,-L../../,'`
+AC_SUBST(TINFO_LDFLAGS2)
 
 case $DFT_LWR_MODEL in
 normal|debug|profile)
@@ -1850,14 +1836,14 @@
 AC_SUBST(NCURSES_TREE)
 
 ### predefined stuff for the test programs
-AC_DEFINE(HAVE_SLK_COLOR)
+AC_DEFINE(HAVE_SLK_COLOR,1,[Define to 1 if we have slk_color for test-programs])
 
 ### Construct the list of subdirectories for which we'll customize makefiles
 ### with the appropriate compile-rules.
 
 CF_SRC_MODULES($modules_to_build)
 
-if test "$cf_with_ada" != "no" && test "$cf_cv_prog_gnat_correct" != "no"; then
+if test "x$cf_with_ada" = "xyes" && test "x$cf_cv_prog_gnat_correct" = "xyes"; then
    SUB_MAKEFILES="$SUB_MAKEFILES Ada95/gen/adacurses${DFT_ARG_SUFFIX}-config:Ada95/gen/adacurses-config.in"
    SUB_MAKEFILES="$SUB_MAKEFILES man/adacurses${DFT_ARG_SUFFIX}-config.1:man/MKada_config.in"
 fi
@@ -1869,26 +1855,26 @@
 AC_SUBST(NCURSES_SHLIB2)
 
 # values to use as strings
-AC_DEFINE_UNQUOTED(NCURSES_PATHSEP,'$PATH_SEPARATOR')
+AC_DEFINE_UNQUOTED(NCURSES_PATHSEP,'$PATH_SEPARATOR',[Define to override ':' as library path-separator])
 
-AC_DEFINE_UNQUOTED(NCURSES_VERSION_STRING, "${NCURSES_MAJOR}.${NCURSES_MINOR}.${NCURSES_PATCH}")
+AC_DEFINE_UNQUOTED(NCURSES_VERSION_STRING, "${NCURSES_MAJOR}.${NCURSES_MINOR}.${NCURSES_PATCH}",[Define to 1 if machine has ample memory for tic])
 
 ### Now that we're done running tests, add the compiler-warnings, if any
 CF_ADD_CFLAGS($EXTRA_CFLAGS)
 
 ### Define substitutions for header files to avoid name-pollution
-CF_SUBST_IF(["$cf_cv_have_tcgetattr" = yes], HAVE_TCGETATTR, 1, 0)
-CF_SUBST_IF(["$ac_cv_header_termio_h" = yes], HAVE_TERMIO_H, 1, 0)
-CF_SUBST_IF(["$ac_cv_header_termios_h" = yes], HAVE_TERMIOS_H, 1, 0)
+CF_SUBST_IF(["x$cf_cv_have_tcgetattr" = xyes], HAVE_TCGETATTR, 1, 0)
+CF_SUBST_IF(["x$ac_cv_header_termio_h" = xyes], HAVE_TERMIO_H, 1, 0)
+CF_SUBST_IF(["x$ac_cv_header_termios_h" = xyes], HAVE_TERMIOS_H, 1, 0)
 
 ################################################################################
-test "$use_database" = yes && \
+test "x$use_database" = xyes && \
 SUB_MAKEFILES="$SUB_MAKEFILES misc/run_tic.sh:misc/run_tic.in"
 
 SUB_MAKEFILES="$SUB_MAKEFILES misc/ncurses-config:misc/ncurses-config.in"
 SUB_MAKEFILES="$SUB_MAKEFILES man/ncurses${DFT_ARG_SUFFIX}${cf_cv_abi_version}-config.1:man/MKncu_config.in"
 
-if test x"$enable_pc_files" = xyes ; then \
+if test "x$enable_pc_files" = xyes ; then \
 SUB_MAKEFILES="$SUB_MAKEFILES misc/gen-pkgconfig:misc/gen-pkgconfig.in"
 MAKE_PC_FILES=
 else
@@ -1917,12 +1903,18 @@
 ADAHTML_DIR=../../doc/html/ada
 AC_SUBST(ADAHTML_DIR)
 
+# these could be configurable, but are not currently
+PANEL_NAME=panel
+MENU_NAME=menu
+FORM_NAME=form
+CXX_NAME=ncurses++
+
+AC_SUBST(PANEL_NAME)
+AC_SUBST(MENU_NAME)
+AC_SUBST(FORM_NAME)
+AC_SUBST(CXX_NAME)
+
 SUB_SCRIPTS=
-case $cf_cv_system_name in #(vi
-*mingw32*) #(vi
-	SUB_SCRIPTS="mk-dlls.sh"
-	;;
-esac
 
 AC_OUTPUT( \
 	include/MKterm.h.awk \
@@ -1934,11 +1926,11 @@
 	$SUB_MAKEFILES \
 	Makefile,[
 if test "x$cf_with_tests" != xno ; then
-	CF_PRG_RULES([$srcdir/test/mk-test.awk INSTALL=no ECHO_LINK="$ECHO_LINK"], test)
+	CF_PRG_RULES([$srcdir/test/mk-test.awk INSTALL=no ECHO_LINK="$ECHO_LD"], test)
 fi
 CF_LIB_RULES($SRC_SUBDIRS)
 
-if test "x$cf_with_ada" != xno ; then
+if test "x$cf_with_ada" = "xyes" && test "x$cf_cv_prog_gnat_correct" = "xyes"; then
 if test -z "$USE_OLD_MAKERULES" ; then
 	$AWK -f $srcdir/Ada95/mk-1st.awk <$srcdir/Ada95/src/modules >>Ada95/src/Makefile
 fi
@@ -1950,10 +1942,11 @@
 AWK="$AWK"
 DFT_ARG_SUFFIX="$DFT_ARG_SUFFIX"
 DFT_LWR_MODEL="$DFT_LWR_MODEL"
-ECHO_LINK="$ECHO_LINK"
+ECHO_LD="$ECHO_LD"
 LDCONFIG="$LDCONFIG"
 LIBTOOL_VERSION="$LIBTOOL_VERSION"
 LIB_NAME="$LIB_NAME"
+LIB_PREFIX="$LIB_PREFIX"
 LIB_SUBSETS="$LIB_SUBSETS"
 LIB_SUFFIX="$LIB_SUFFIX"
 LIB_TRACING="$LIB_TRACING"
@@ -1975,7 +1968,7 @@
 TINFO_SUFFIX="$TINFO_SUFFIX"
 USE_OLD_MAKERULES="$USE_OLD_MAKERULES"
 WITH_CURSES_H="$with_curses_h"
-WITH_ECHO="$with_echo"
+WITH_ECHO="${enable_echo:=yes}"
 WITH_OVERWRITE="$with_overwrite"
 cf_LIST_MODELS="$cf_list_models"
 cf_cv_abi_version="$cf_cv_abi_version"
@@ -1985,16 +1978,19 @@
 cf_cv_enable_opaque="$cf_cv_enable_opaque"
 cf_cv_prog_CC_c_o=$cf_cv_prog_CC_c_o
 cf_cv_prog_CXX_c_o=$cf_cv_prog_CXX_c_o
+cf_cv_prog_gnat_correct=$cf_cv_prog_gnat_correct
 cf_cv_rel_version="$cf_cv_rel_version"
 cf_cv_rm_so_locs="$cf_cv_rm_so_locs"
 cf_cv_shared_soname='$cf_cv_shared_soname'
 cf_cv_shlib_version="$cf_cv_shlib_version"
 cf_cv_shlib_version_infix="$cf_cv_shlib_version_infix"
 cf_cv_system_name="$cf_cv_system_name"
+cf_cv_term_driver="$with_term_driver"
 cf_with_ada="$cf_with_ada"
 cf_with_cxx_binding="$cf_with_cxx_binding"
 cf_with_manpages="$cf_with_manpages"
 cf_with_tests="$cf_with_tests"
+with_shared_cxx="$with_shared_cxx"
 host="$host"
 target="$target"
 
Index: dist.mk
Prereq:  1.810 
--- ncurses-5.9/dist.mk	2011-04-04 22:42:20.000000000 +0000
+++ ncurses-5.9-20130504/dist.mk	2013-05-04 14:55:13.000000000 +0000
@@ -1,5 +1,5 @@
 ##############################################################################
-# Copyright (c) 1998-2010,2011 Free Software Foundation, Inc.                #
+# Copyright (c) 1998-2011,2012 Free Software Foundation, Inc.                #
 #                                                                            #
 # Permission is hereby granted, free of charge, to any person obtaining a    #
 # copy of this software and associated documentation files (the "Software"), #
@@ -25,7 +25,7 @@
 # use or other dealings in this Software without prior written               #
 # authorization.                                                             #
 ##############################################################################
-# $Id: dist.mk,v 1.810 2011/04/04 22:42:20 tom Exp $
+# $Id: dist.mk,v 1.926 2013/05/04 14:55:13 tom Exp $
 # Makefile for creating ncurses distributions.
 #
 # This only needs to be used directly as a makefile by developers, but
@@ -37,7 +37,7 @@
 # These define the major/minor/patch versions of ncurses.
 NCURSES_MAJOR = 5
 NCURSES_MINOR = 9
-NCURSES_PATCH = 20110404
+NCURSES_PATCH = 20130504
 
 # We don't append the patch to the version, since this only applies to releases
 VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR)
Index: doc/html/man/adacurses-config.1.html
--- ncurses-5.9/doc/html/man/adacurses-config.1.html	2011-04-04 22:46:28.000000000 +0000
+++ ncurses-5.9-20130504/doc/html/man/adacurses-config.1.html	2013-03-09 22:11:58.000000000 +0000
@@ -83,7 +83,7 @@
 <H2>SEE ALSO</H2><PRE>
        <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>
 
-       This describes <STRONG>ncurses</STRONG> version 5.9 (patch 20110404).
+       This describes <STRONG>ncurses</STRONG> version 5.9 (patch 20130309).
 
 
 
Index: doc/html/man/captoinfo.1m.html
--- ncurses-5.9/doc/html/man/captoinfo.1m.html	2011-04-04 22:46:28.000000000 +0000
+++ ncurses-5.9-20130504/doc/html/man/captoinfo.1m.html	2013-03-09 22:11:58.000000000 +0000
@@ -87,8 +87,8 @@
 
 </PRE>
 <H2>FILES</H2><PRE>
-       /usr/share/terminfo Compiled      terminal     description
-                           database.
+       /usr/share/terminfo Compiled  terminal  description  data-
+                           base.
 
 
 </PRE>
@@ -101,7 +101,6 @@
        has  not  mistakenly  translated  a completely unknown and
        random capability and/or syntax error.
 
-
        Nonstd   Std    From           Terminfo
         name    name                 capability
        -----------------------------------------------
@@ -116,8 +115,8 @@
        EN       @7     XENIX   key_end
        GE       ae     XENIX   exit_alt_charset_mode
        GS       as     XENIX   enter_alt_charset_mode
-
        HM       kh     XENIX   key_home
+
        LD       kL     XENIX   key_dl
        PD       kN     XENIX   key_npage
        PN       po     XENIX   prtr_off
@@ -139,7 +138,6 @@
        bilities  for forms drawing, designed to take advantage of
        the IBM PC high-half graphics.  They were as follows:
 
-
        Cap          Graphic
        -----------------------------
        G2    upper left
@@ -182,7 +180,6 @@
        font0   s0ds
        font1   s1ds
        font2   s2ds
-
        font3   s3ds
 
        Additionally,  the  AIX  <EM>box1</EM> capability will be automati-
@@ -208,7 +205,7 @@
 <H2>SEE ALSO</H2><PRE>
        <STRONG><A HREF="infocmp.1m.html">infocmp(1m)</A></STRONG>, <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>, <STRONG><A HREF="terminfo.5.html">terminfo(5)</A></STRONG>
 
-       This describes <STRONG>ncurses</STRONG> version 5.9 (patch 20110404).
+       This describes <STRONG>ncurses</STRONG> version 5.9 (patch 20130309).
 
 
 </PRE>
Index: doc/html/man/clear.1.html
--- ncurses-5.9/doc/html/man/clear.1.html	2011-04-04 22:46:28.000000000 +0000
+++ ncurses-5.9-20130504/doc/html/man/clear.1.html	2013-03-09 22:11:58.000000000 +0000
@@ -69,7 +69,7 @@
 <H2>SEE ALSO</H2><PRE>
        <STRONG><A HREF="tput.1.html">tput(1)</A></STRONG>, <STRONG><A HREF="terminfo.5.html">terminfo(5)</A></STRONG>
 
-       This describes <STRONG>ncurses</STRONG> version 5.9 (patch 20110404).
+       This describes <STRONG>ncurses</STRONG> version 5.9 (patch 20130309).
 
 
 
Index: doc/html/man/curs_add_wch.3x.html
--- ncurses-5.9/doc/html/man/curs_add_wch.3x.html	2011-02-25 23:24:49.000000000 +0000
+++ ncurses-5.9-20130504/doc/html/man/curs_add_wch.3x.html	2013-03-09 22:11:58.000000000 +0000
@@ -1,7 +1,7 @@
 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
 <!-- 
   ****************************************************************************
-  * Copyright (c) 2001-2010,2011 Free Software Foundation, Inc.              *
+  * Copyright (c) 2001-2011,2012 Free Software Foundation, Inc.              *
   *                                                                          *
   * Permission is hereby granted, free of charge, to any person obtaining a  *
   * copy of this software and associated documentation files (the            *
@@ -27,7 +27,7 @@
   * sale, use or other dealings in this Software without prior written       *
   * authorization.                                                           *
   ****************************************************************************
-  * @Id: curs_add_wch.3x,v 1.14 2011/01/15 15:27:43 tom Exp @
+  * @Id: curs_add_wch.3x,v 1.15 2012/11/03 23:03:59 tom Exp @
 -->
 <HTML>
 <HEAD>
@@ -77,17 +77,17 @@
            ous  character  at  that  location  is removed.  A new
            character specified by <EM>wch</EM> is placed at that  location
            with  rendition  specified  by  <EM>wch</EM>.   The cursor then
-           advances to the next spacing character on the  screen.
+           advances to the next spacing character on the screen.
 
        <STRONG>o</STRONG>   If <EM>wch</EM> refers to a non-spacing character, all previous
-           characters at that location are preserved.   The  non-
-           spacing  characters  of  <EM>wch</EM>  are added to the spacing
-           complex character, and the rendition specified by  <EM>wch</EM>
+           characters  at  that location are preserved.  The non-
+           spacing characters of <EM>wch</EM> are  added  to  the  spacing
+           complex  character, and the rendition specified by <EM>wch</EM>
            is ignored.
 
-       <STRONG>o</STRONG>   If  the  character  part  of  <EM>wch</EM>  is  a tab, newline,
-           backspace or other control character,  the  window  is
-           updated  and the cursor moves as if <STRONG>addch</STRONG> were called.
+       <STRONG>o</STRONG>   If the character  part  of  <EM>wch</EM>  is  a  tab,  newline,
+           backspace  or  other  control character, the window is
+           updated and the cursor moves as if <STRONG>addch</STRONG> were called.
 
        The <STRONG>echo_wchar</STRONG> function is functionally  equivalent  to  a
        call to <STRONG>add_wch</STRONG> followed by a call to <STRONG>refresh</STRONG>.  Similarly,
@@ -104,15 +104,14 @@
        characters.   These  symbols  correspond to the same VT100
        line-drawing set as <STRONG><A HREF="addch.3x.html">addch(3x)</A></STRONG>.
 
-
        <EM>Name</EM>              <EM>Unicode</EM>    <EM>Default</EM>   <EM>Description</EM>
        ----------------------------------------------------------------
        WACS_BLOCK        0x25ae     #         solid square block
        WACS_BOARD        0x2592     #         board of squares
        WACS_BTEE         0x2534     +         bottom tee
        WACS_BULLET       0x00b7     o         bullet
-
        WACS_CKBOARD      0x2592     :         checker board (stipple)
+
        WACS_DARROW       0x2193     v         arrow pointing down
        WACS_DEGREE       0x00b0     '         degree symbol
        WACS_DIAMOND      0x25c6     +         diamond
@@ -144,7 +143,6 @@
        The wide-character configuration of ncurses  also  defines
        symbols for thick- and double-lines:
 
-
        <EM>Name</EM>              <EM>Unicode</EM>   <EM>Default</EM>   <EM>Description</EM>
        ---------------------------------------------------------------------
        WACS_T_ULCORNER   0x250f    +         thick upper left corner
@@ -172,7 +170,7 @@
 
 
 </PRE>
-<H2>RETURN VALUES</H2><PRE>
+<H2>RETURN VALUE</H2><PRE>
        All routines return the integer <STRONG>ERR</STRONG> upon failure and <STRONG>OK</STRONG> on
        success.
 
Index: doc/html/man/curs_add_wchstr.3x.html
--- ncurses-5.9/doc/html/man/curs_add_wchstr.3x.html	2011-01-09 01:03:05.000000000 +0000
+++ ncurses-5.9-20130504/doc/html/man/curs_add_wchstr.3x.html	2013-03-09 22:11:58.000000000 +0000
@@ -1,7 +1,7 @@
 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
 <!-- 
   ****************************************************************************
-  * Copyright (c) 2002-2005,2010 Free Software Foundation, Inc.              *
+  * Copyright (c) 2002-2010,2012 Free Software Foundation, Inc.              *
   *                                                                          *
   * Permission is hereby granted, free of charge, to any person obtaining a  *
   * copy of this software and associated documentation files (the            *
@@ -27,7 +27,7 @@
   * sale, use or other dealings in this Software without prior written       *
   * authorization.                                                           *
   ****************************************************************************
-  * @Id: curs_add_wchstr.3x,v 1.9 2010/12/04 18:36:44 tom Exp @
+  * @Id: curs_add_wchstr.3x,v 1.10 2012/11/03 22:54:43 tom Exp @
 -->
 <HTML>
 <HEAD>
@@ -47,7 +47,7 @@
 
 </PRE>
 <H2>NAME</H2><PRE>
-       <STRONG>add_wchstr</STRONG>,    <STRONG>add_wchnstr</STRONG>,   <STRONG>wadd_wchstr</STRONG>,   <STRONG>wadd_wchnstr</STRONG>,
+       <STRONG>add_wchstr</STRONG>, <STRONG>add_wchnstr</STRONG>, <STRONG>wadd_wchstr</STRONG>, <STRONG>wadd_wchnstr</STRONG>,
        <STRONG>mvadd_wchstr</STRONG>, <STRONG>mvadd_wchnstr</STRONG>, <STRONG>mvwadd_wchstr</STRONG>, <STRONG>mvwadd_wchnstr</STRONG>
        - add an array of complex characters (and attributes) to a
        curses window
@@ -69,39 +69,42 @@
 
 </PRE>
 <H2>DESCRIPTION</H2><PRE>
-       These routines copy the array of complex characters <EM>wchstr</EM>
-       into  the  window image structure at and after the current
-       cursor position.  The four routines with  <EM>n</EM>  as  the  last
-       argument  copy  at  most <EM>n</EM> elements, but no more than will
-       fit on the line.  If <STRONG>n</STRONG>=<STRONG>-1</STRONG> then the whole array is  copied,
-       to  the  maximum number of characters that will fit on the
-       line.
-
-       The window cursor is <EM>not</EM> advanced.   These  routines  work
-       faster than <STRONG>waddnstr</STRONG>.  On the other hand, they do not per-
-       form checking (such as for the newline, backspace, or car-
-       riage  return characters), they do not advance the current
-       cursor position, they do not expand other control  charac-
-       ters  to  ^-escapes,  and  they  truncate the string if it
-       crosses the right margin, rather than wrapping  it  around
-       to the new line.
-
-       These  routines  end  successfully  on encountering a null
-       <EM>cchar</EM><STRONG>_</STRONG><EM>t</EM>, or when they have filled the current line.  If  a
-       complex  character cannot completely fit at the end of the
-       current line, the remaining columns are  filled  with  the
+       These functions copy the (null-terminated) array  of  com-
+       plex  characters  <EM>wchstr</EM>  into  the window image structure
+       starting at the current cursor position.  The  four  func-
+       tions with <EM>n</EM> as the last argument copy at most <EM>n</EM> elements,
+       but no more than will fit on the line.  If <STRONG>n</STRONG>=<STRONG>-1</STRONG>  then  the
+       whole array is copied, to the maximum number of characters
+       that will fit on the line.
+
+       The window cursor is <EM>not</EM> advanced.  These  functions  work
+       faster than <STRONG>waddnstr</STRONG>.  On the other hand:
+
+       <STRONG>o</STRONG>   they do not perform checking (such as for the newline,
+           backspace, or carriage return characters),
+
+       <STRONG>o</STRONG>   they do not advance the current cursor position,
+
+       <STRONG>o</STRONG>   they do not expand other control characters  to  ^-es-
+           capes, and
+
+       <STRONG>o</STRONG>   they  truncate the string if it crosses the right mar-
+           gin, rather than wrapping it around to the new line.
+
+       These functions end successfully on  encountering  a  null
+       <EM>cchar</EM><STRONG>_</STRONG><EM>t</EM>,  or when they have filled the current line.  If a
+       complex character cannot completely fit at the end of  the
+       current  line,  the  remaining columns are filled with the
        background character and rendition.
 
 
 </PRE>
-<H2>NOTES</H2><PRE>
-       All functions except <STRONG>wadd_wchnstr</STRONG> may be macros.
+<H2>RETURN VALUE</H2><PRE>
+       All functions return the integer <STRONG>ERR</STRONG> upon failure  and  <STRONG>OK</STRONG>
+       on success.
 
-
-</PRE>
-<H2>RETURN VALUES</H2><PRE>
-       All routines return the integer <STRONG>ERR</STRONG> upon failure and <STRONG>OK</STRONG> on
-       success.
+       X/Open  does not define any error conditions.  This imple-
+       mentation returns an error if the window pointer is null.
 
        Functions with a "mv" prefix first perform a cursor  move-
        ment  using  <STRONG>wmove</STRONG>, and return an error if the position is
@@ -109,14 +112,22 @@
 
 
 </PRE>
+<H2>NOTES</H2><PRE>
+       All functions except <STRONG>wadd_wchnstr</STRONG> may be macros.
+
+
+</PRE>
 <H2>PORTABILITY</H2><PRE>
-       All these entry points are described  in  the  XSI  Curses
-       standard, Issue 4.
+       These entry points are described in the XSI  Curses  stan-
+       dard, Issue 4.
 
 
 </PRE>
 <H2>SEE ALSO</H2><PRE>
-       <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>, <STRONG><A HREF="curs_addchstr.3x.html">curs_addchstr(3x)</A></STRONG>, <STRONG><A HREF="curs_addwstr.3x.html">curs_addwstr(3x)</A></STRONG>
+       <STRONG><A HREF="curs_addwstr.3x.html">curs_addwstr(3x)</A></STRONG>, <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>.
+
+       Comparable functions in the narrow-character (ncurses) li-
+       brary are described in <STRONG><A HREF="curs_addchstr.3x.html">curs_addchstr(3x)</A></STRONG>.
 
 
 
Index: doc/html/man/curs_addch.3x.html
--- ncurses-5.9/doc/html/man/curs_addch.3x.html	2011-02-25 23:24:50.000000000 +0000
+++ ncurses-5.9-20130504/doc/html/man/curs_addch.3x.html	2013-03-09 22:11:58.000000000 +0000
@@ -112,9 +112,8 @@
        characters to the screen with routines of the  <STRONG>addch</STRONG>  fam-
        ily.   The  default  character listed below is used if the
        <STRONG>acsc</STRONG>  capability  does  not  define  a   terminal-specific
-       replacement  for  it.   The  names  are  taken  from VT100
-       nomenclature.
-
+       replacement for it.  The names are taken from VT100 nomen-
+       clature.
 
        <EM>Name</EM>           <EM>Default</EM>   <EM>Description</EM>
        --------------------------------------------------
Index: doc/html/man/curs_addchstr.3x.html
--- ncurses-5.9/doc/html/man/curs_addchstr.3x.html	2011-01-09 01:03:04.000000000 +0000
+++ ncurses-5.9-20130504/doc/html/man/curs_addchstr.3x.html	2013-03-09 22:11:58.000000000 +0000
@@ -1,7 +1,7 @@
 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
 <!-- 
   ****************************************************************************
-  * Copyright (c) 1998-2006,2010 Free Software Foundation, Inc.              *
+  * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc.              *
   *                                                                          *
   * Permission is hereby granted, free of charge, to any person obtaining a  *
   * copy of this software and associated documentation files (the            *
@@ -27,7 +27,7 @@
   * sale, use or other dealings in this Software without prior written       *
   * authorization.                                                           *
   ****************************************************************************
-  * @Id: curs_addchstr.3x,v 1.15 2010/12/04 18:36:44 tom Exp @
+  * @Id: curs_addchstr.3x,v 1.16 2012/11/03 22:54:43 tom Exp @
 -->
 <HTML>
 <HEAD>
@@ -62,62 +62,63 @@
        <STRONG>int</STRONG> <STRONG>waddchnstr(WINDOW</STRONG> <STRONG>*win,</STRONG> <STRONG>const</STRONG> <STRONG>chtype</STRONG> <STRONG>*chstr,</STRONG> <STRONG>int</STRONG> <STRONG>n);</STRONG>
        <STRONG>int</STRONG> <STRONG>mvaddchstr(int</STRONG> <STRONG>y,</STRONG> <STRONG>int</STRONG> <STRONG>x,</STRONG> <STRONG>const</STRONG> <STRONG>chtype</STRONG> <STRONG>*chstr);</STRONG>
        <STRONG>int</STRONG> <STRONG>mvaddchnstr(int</STRONG> <STRONG>y,</STRONG> <STRONG>int</STRONG> <STRONG>x,</STRONG> <STRONG>const</STRONG> <STRONG>chtype</STRONG> <STRONG>*chstr,</STRONG> <STRONG>int</STRONG> <STRONG>n);</STRONG>
-       <STRONG>int</STRONG>  <STRONG>mvwaddchstr(WINDOW</STRONG>  <STRONG>*win,</STRONG>  <STRONG>int</STRONG> <STRONG>y,</STRONG> <STRONG>int</STRONG> <STRONG>x,</STRONG> <STRONG>const</STRONG> <STRONG>chtype</STRONG>
-       <STRONG>*chstr);</STRONG>
-       <STRONG>int</STRONG> <STRONG>mvwaddchnstr(WINDOW</STRONG> <STRONG>*win,</STRONG> <STRONG>int</STRONG> <STRONG>y,</STRONG> <STRONG>int</STRONG> <STRONG>x,</STRONG>  <STRONG>const</STRONG>  <STRONG>chtype</STRONG>
-       <STRONG>*chstr,</STRONG> <STRONG>int</STRONG> <STRONG>n);</STRONG>
+       <STRONG>int</STRONG> <STRONG>mvwaddchstr(WINDOW</STRONG> <STRONG>*win,</STRONG> <STRONG>int</STRONG> <STRONG>y,</STRONG> <STRONG>int</STRONG> <STRONG>x,</STRONG> <STRONG>const</STRONG> <STRONG>chtype</STRONG> <STRONG>*chstr);</STRONG>
+       <STRONG>int</STRONG> <STRONG>mvwaddchnstr(WINDOW</STRONG> <STRONG>*win,</STRONG> <STRONG>int</STRONG> <STRONG>y,</STRONG> <STRONG>int</STRONG> <STRONG>x,</STRONG> <STRONG>const</STRONG> <STRONG>chtype</STRONG> <STRONG>*chstr,</STRONG> <STRONG>int</STRONG> <STRONG>n);</STRONG>
 
 
 </PRE>
 <H2>DESCRIPTION</H2><PRE>
-       These  routines copy <EM>chstr</EM> into the window image structure
-       at and after the current cursor position.  The  four  rou-
-       tines with <EM>n</EM> as the last argument copy at most <EM>n</EM> elements,
-       but no more than will fit on the line.  If <STRONG>n</STRONG>=<STRONG>-1</STRONG>  then  the
-       whole  string  is copied, to the maximum number of charac-
-       ters that will fit on the line.
-
-       The window cursor is <EM>not</EM> advanced, and these routines work
-       faster than <STRONG>waddnstr</STRONG>.  On the other hand, they do not per-
-       form any kind  of  checking  (such  as  for  the  newline,
-       backspace, or carriage return characters), they do not ad-
-       vance the current cursor position, they do not expand oth-
-       er  control characters to ^-escapes, and they truncate the
-       string if it crosses the right margin, rather  than  wrap-
-       ping it around to the new line.
+       These functions copy the (null-terminated) <EM>chstr</EM> array in-
+       to the window image structure starting at the current cur-
+       sor position.  The four functions with <EM>n</EM> as the last argu-
+       ment copy at most <EM>n</EM> elements, but no more than will fit on
+       the  line.  If <STRONG>n</STRONG>=<STRONG>-1</STRONG> then the whole array is copied, to the
+       maximum number of characters that will fit on the line.
+
+       The window cursor is <EM>not</EM> advanced.  These  functions  work
+       faster than <STRONG>waddnstr</STRONG>.  On the other hand:
+
+       <STRONG>o</STRONG>   they do not perform checking (such as for the newline,
+           backspace, or carriage return characters),
+
+       <STRONG>o</STRONG>   they do not advance the current cursor position,
+
+       <STRONG>o</STRONG>   they do not expand other control characters  to  ^-es-
+           capes, and
+
+       <STRONG>o</STRONG>   they  truncate the string if it crosses the right mar-
+           gin, rather than wrapping it around to the new line.
 
 
 </PRE>
-<H2>RETURN VALUES</H2><PRE>
-       All routines return the integer <STRONG>ERR</STRONG> upon failure and <STRONG>OK</STRONG> on
-       success (the SVr4 manuals specify only "an  integer  value
-       other than <STRONG>ERR</STRONG>") upon successful completion, unless other-
-       wise noted in the preceding routine descriptions.
+<H2>RETURN VALUE</H2><PRE>
+       All functions return the integer <STRONG>ERR</STRONG> upon failure  and  <STRONG>OK</STRONG>
+       on success.
 
-       X/Open does not define any error conditions.  This  imple-
+       X/Open  does not define any error conditions.  This imple-
        mentation returns an error if the window pointer is null.
 
-       Functions  with a "mv" prefix first perform a cursor move-
-       ment using <STRONG>wmove</STRONG>, and return an error if the  position  is
+       Functions with a "mv" prefix first perform a cursor  move-
+       ment  using  <STRONG>wmove</STRONG>, and return an error if the position is
        outside the window, or if the window pointer is null.
 
 
 </PRE>
 <H2>NOTES</H2><PRE>
-       Note that all routines except <STRONG>waddchnstr</STRONG> may be macros.
+       All functions except <STRONG>waddchnstr</STRONG> may be macros.
 
 
 </PRE>
 <H2>PORTABILITY</H2><PRE>
-       These  entry  points are described in the XSI Curses stan-
+       These entry points are described in the XSI  Curses  stan-
        dard, Issue 4.
 
 
 </PRE>
 <H2>SEE ALSO</H2><PRE>
-       <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>.
+       <STRONG><A HREF="curs_addstr.3x.html">curs_addstr(3x)</A></STRONG>, <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>.
 
-       Comparable functions in the wide-character (ncursesw)  li-
+       Comparable  functions in the wide-character (ncursesw) li-
        brary are described in <STRONG><A HREF="curs_add_wchstr.3x.html">curs_add_wchstr(3x)</A></STRONG>.
 
 
Index: doc/html/man/curs_addstr.3x.html
--- ncurses-5.9/doc/html/man/curs_addstr.3x.html	2011-01-09 01:03:05.000000000 +0000
+++ ncurses-5.9-20130504/doc/html/man/curs_addstr.3x.html	2013-03-09 22:11:58.000000000 +0000
@@ -1,7 +1,7 @@
 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
 <!-- 
   ****************************************************************************
-  * Copyright (c) 1998-2005,2010 Free Software Foundation, Inc.              *
+  * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc.              *
   *                                                                          *
   * Permission is hereby granted, free of charge, to any person obtaining a  *
   * copy of this software and associated documentation files (the            *
@@ -27,7 +27,7 @@
   * sale, use or other dealings in this Software without prior written       *
   * authorization.                                                           *
   ****************************************************************************
-  * @Id: curs_addstr.3x,v 1.16 2010/12/04 18:36:44 tom Exp @
+  * @Id: curs_addstr.3x,v 1.17 2012/11/03 22:57:31 tom Exp @
 -->
 <HTML>
 <HEAD>
@@ -68,26 +68,32 @@
 
 </PRE>
 <H2>DESCRIPTION</H2><PRE>
-       These routines write the characters of the (null-terminat-
-       ed) character string <EM>str</EM> on the given window.  It is simi-
-       lar  to  calling  <STRONG>waddch</STRONG>  once  for  each character in the
-       string.  The four routines with <EM>n</EM>  as  the  last  argument
-       write  at  most <EM>n</EM> characters.  If <EM>n</EM> is -1, then the entire
-       string will be added, up to the maximum number of  charac-
-       ters  that  will  fit  on the line, or until a terminating
-       null is reached.
+       These  functions  write  the  (null-terminated)  character
+       string <EM>str</EM> on the given window.  It is similar to  calling
+       <STRONG>waddch</STRONG> once for each character in the string.
+
+       The  <EM>mv</EM>  functions  perform  cursor  movement once, before
+       writing any characters.  Thereafter,  the  cursor  is  ad-
+       vanced as a side-effect of writing to the window.
+
+       The  four  functions  with <EM>n</EM> as the last argument write at
+       most <EM>n</EM> characters, or until a terminating null is reached.
+       If <EM>n</EM> is -1, then the entire string will be added.
 
 
 </PRE>
 <H2>RETURN VALUE</H2><PRE>
-       All routines return the integer <STRONG>ERR</STRONG> upon failure and <STRONG>OK</STRONG> on
-       success  (the  SVr4 manuals specify only "an integer value
-       other than <STRONG>ERR</STRONG>") upon successful completion.
+       All  functions  return the integer <STRONG>ERR</STRONG> upon failure and <STRONG>OK</STRONG>
+       on success.
 
        X/Open does not define any error conditions.  This  imple-
-       mentation  returns  an error if the window pointer is null
-       or if the string pointer is null or if  the  corresponding
-       calls to <STRONG>waddch</STRONG> return an error.
+       mentation returns an error
+
+       <STRONG>o</STRONG>   if the window pointer is null or
+
+       <STRONG>o</STRONG>   if the string pointer is null or
+
+       <STRONG>o</STRONG>   if the corresponding calls to <STRONG>waddch</STRONG> return an error.
 
        Functions  with a "mv" prefix first perform a cursor move-
        ment using <STRONG>wmove</STRONG>, and return an error if the  position  is
@@ -96,16 +102,13 @@
 
 </PRE>
 <H2>NOTES</H2><PRE>
-       Note  that  all  of  these  routines  except  <STRONG>waddstr</STRONG>  and
-       <STRONG>waddnstr</STRONG> may be macros.
+       All of these functions except <STRONG>waddnstr</STRONG> may be macros.
 
 
 </PRE>
 <H2>PORTABILITY</H2><PRE>
-       All these entry points are described  in  the  XSI  Curses
-       standard,  Issue  4.  The XSI errors EILSEQ and EOVERFLOW,
-       associated with extended-level conformance,  are  not  yet
-       detected.
+       These  functions are described in the XSI Curses standard,
+       Issue 4.
 
 
 </PRE>
Index: doc/html/man/curs_addwstr.3x.html
--- ncurses-5.9/doc/html/man/curs_addwstr.3x.html	2011-01-09 01:03:05.000000000 +0000
+++ ncurses-5.9-20130504/doc/html/man/curs_addwstr.3x.html	2013-03-09 22:11:58.000000000 +0000
@@ -1,7 +1,7 @@
 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
 <!-- 
   ****************************************************************************
-  * Copyright (c) 2002-2006,2010 Free Software Foundation, Inc.              *
+  * Copyright (c) 2002-2010,2012 Free Software Foundation, Inc.              *
   *                                                                          *
   * Permission is hereby granted, free of charge, to any person obtaining a  *
   * copy of this software and associated documentation files (the            *
@@ -27,7 +27,7 @@
   * sale, use or other dealings in this Software without prior written       *
   * authorization.                                                           *
   ****************************************************************************
-  * @Id: curs_addwstr.3x,v 1.10 2010/12/04 18:36:44 tom Exp @
+  * @Id: curs_addwstr.3x,v 1.11 2012/11/03 22:57:31 tom Exp @
 -->
 <HTML>
 <HEAD>
@@ -68,43 +68,51 @@
 
 </PRE>
 <H2>DESCRIPTION</H2><PRE>
-       These routines write the characters of the (null-terminat-
-       ed) <STRONG>wchar_t</STRONG> character string <EM>wstr</EM> on the given window.  It
-       is  similar  to constructing a <STRONG>cchar_t</STRONG> for each wchar_t in
-       the  string,  then  calling  <STRONG>wadd_wch</STRONG>  for  the  resulting
+       These  functions  write the characters of the (null-termi-
+       nated) <STRONG>wchar_t</STRONG> character string <EM>wstr</EM> on the given  window.
+       It  is  similar to constructing a <STRONG>cchar_t</STRONG> for each wchar_t
+       in the string, then calling  <STRONG>wadd_wch</STRONG>  for  the  resulting
        <STRONG>cchar_t</STRONG>.
 
-       The <EM>mv</EM> routines perform cursor movement once, before writ-
-       ing any characters.  Thereafter, the cursor is advanced as
-       a side-effect of writing to the window.
+       The  <EM>mv</EM>  functions  perform  cursor  movement once, before
+       writing any characters.  Thereafter,  the  cursor  is  ad-
+       vanced as a side-effect of writing to the window.
 
-       The  four  routines  with  <EM>n</EM> as the last argument write at
-       most <EM>n</EM> <STRONG>wchar_t</STRONG> characters.  If <EM>n</EM> is -1,  then  the  entire
-       string  will be added, up to the maximum number of charac-
-       ters that will fit on the line,  or  until  a  terminating
-       null is reached.
+       The  four  functions  with <EM>n</EM> as the last argument write at
+       most <EM>n</EM> <STRONG>wchar_t</STRONG> characters, or until a terminating null  is
+       reached.   If  <EM>n</EM>  is  -1,  then  the entire string will be
+       added.
 
 
 </PRE>
-<H2>RETURN VALUES</H2><PRE>
-       All routines return the integer <STRONG>ERR</STRONG> upon failure and <STRONG>OK</STRONG> on
-       success.
+<H2>RETURN VALUE</H2><PRE>
+       All functions return the integer <STRONG>ERR</STRONG> upon failure  and  <STRONG>OK</STRONG>
+       on success.
 
-       Functions with a "mv" prefix first perform a cursor  move-
-       ment  using  <STRONG>wmove</STRONG>, and return an error if the position is
+       X/Open  does not define any error conditions.  This imple-
+       mentation returns an error
+
+       <STRONG>o</STRONG>   if the window pointer is null or
+
+       <STRONG>o</STRONG>   if the string pointer is null or
+
+       <STRONG>o</STRONG>   if the corresponding calls to <STRONG>wadd_wch</STRONG> return  an  er-
+           ror.
+
+       Functions  with a "mv" prefix first perform a cursor move-
+       ment using <STRONG>wmove</STRONG>, and return an error if the  position  is
        outside the window, or if the window pointer is null.
 
 
 </PRE>
 <H2>NOTES</H2><PRE>
-       Note that all of these routines except  <STRONG>waddnwstr</STRONG>  may  be
-       macros.
+       All of these functions except <STRONG>waddnwstr</STRONG> may be macros.
 
 
 </PRE>
 <H2>PORTABILITY</H2><PRE>
-       All  these  entry  points  are described in the XSI Curses
-       standard, Issue 4.
+       These  functions are described in the XSI Curses standard,
+       Issue 4.
 
 
 </PRE>
Index: doc/html/man/curs_attr.3x.html
--- ncurses-5.9/doc/html/man/curs_attr.3x.html	2011-02-25 23:24:50.000000000 +0000
+++ ncurses-5.9-20130504/doc/html/man/curs_attr.3x.html	2013-03-09 22:11:58.000000000 +0000
@@ -148,7 +148,6 @@
        be passed to the routines <STRONG>attron</STRONG>, <STRONG>attroff</STRONG>, and <STRONG>attrset</STRONG>, or
        OR'd with the characters passed to <STRONG>addch</STRONG>.
 
-
         <STRONG>A_NORMAL</STRONG>        Normal display (no highlight)
         <STRONG>A_STANDOUT</STRONG>      Best highlighting mode of the terminal.
         <STRONG>A_UNDERLINE</STRONG>     Underlining
@@ -211,7 +210,6 @@
        the  screen when changing the attributes.  Use <STRONG>touchwin</STRONG> to
        force the screen to match the updated attributes.
 
-
         <STRONG>WA_NORMAL</STRONG>       Normal display (no highlight)
         <STRONG>WA_STANDOUT</STRONG>     Best highlighting mode of the terminal.
         <STRONG>WA_UNDERLINE</STRONG>    Underlining
Index: doc/html/man/curs_bkgrnd.3x.html
--- ncurses-5.9/doc/html/man/curs_bkgrnd.3x.html	2011-01-09 01:03:06.000000000 +0000
+++ ncurses-5.9-20130504/doc/html/man/curs_bkgrnd.3x.html	2013-03-09 22:11:58.000000000 +0000
@@ -1,7 +1,7 @@
 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
 <!-- 
   ****************************************************************************
-  * Copyright (c) 2002-2006,2010 Free Software Foundation, Inc.              *
+  * Copyright (c) 2002-2010,2012 Free Software Foundation, Inc.              *
   *                                                                          *
   * Permission is hereby granted, free of charge, to any person obtaining a  *
   * copy of this software and associated documentation files (the            *
@@ -27,7 +27,7 @@
   * sale, use or other dealings in this Software without prior written       *
   * authorization.                                                           *
   ****************************************************************************
-  * @Id: curs_bkgrnd.3x,v 1.4 2010/12/04 18:49:20 tom Exp @
+  * @Id: curs_bkgrnd.3x,v 1.5 2012/11/03 23:03:59 tom Exp @
 -->
 <HTML>
 <HEAD>
@@ -102,7 +102,7 @@
 
 
 </PRE>
-<H2>RETURN VALUES</H2><PRE>
+<H2>RETURN VALUE</H2><PRE>
        The <STRONG>bkgrndset</STRONG> and <STRONG>wbkgrndset</STRONG>  routines  do  not  return  a
        value.
 
Index: doc/html/man/curs_border_set.3x.html
--- ncurses-5.9/doc/html/man/curs_border_set.3x.html	2011-01-22 21:01:21.000000000 +0000
+++ ncurses-5.9-20130504/doc/html/man/curs_border_set.3x.html	2013-03-09 22:11:58.000000000 +0000
@@ -1,7 +1,7 @@
 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
 <!-- 
   ****************************************************************************
-  * Copyright (c) 2002-2010,2011 Free Software Foundation, Inc.              *
+  * Copyright (c) 2002-2011,2012 Free Software Foundation, Inc.              *
   *                                                                          *
   * Permission is hereby granted, free of charge, to any person obtaining a  *
   * copy of this software and associated documentation files (the            *
@@ -27,7 +27,7 @@
   * sale, use or other dealings in this Software without prior written       *
   * authorization.                                                           *
   ****************************************************************************
-  * @Id: curs_border_set.3x,v 1.10 2011/01/15 12:56:18 tom Exp @
+  * @Id: curs_border_set.3x,v 1.11 2012/11/03 23:03:59 tom Exp @
 -->
 <HTML>
 <HEAD>
@@ -154,7 +154,7 @@
 
 
 </PRE>
-<H2>RETURN VALUES</H2><PRE>
+<H2>RETURN VALUE</H2><PRE>
        Upon successful completion,  these  functions  return  <STRONG>OK</STRONG>.
        Otherwise, they return <STRONG>ERR</STRONG>.
 
Index: doc/html/man/curs_get_wch.3x.html
--- ncurses-5.9/doc/html/man/curs_get_wch.3x.html	2010-09-18 21:35:17.000000000 +0000
+++ ncurses-5.9-20130504/doc/html/man/curs_get_wch.3x.html	2013-03-09 22:11:59.000000000 +0000
@@ -1,7 +1,7 @@
 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
 <!-- 
   ****************************************************************************
-  * Copyright (c) 2002-2006,2010 Free Software Foundation, Inc.              *
+  * Copyright (c) 2002-2010,2012 Free Software Foundation, Inc.              *
   *                                                                          *
   * Permission is hereby granted, free of charge, to any person obtaining a  *
   * copy of this software and associated documentation files (the            *
@@ -27,7 +27,7 @@
   * sale, use or other dealings in this Software without prior written       *
   * authorization.                                                           *
   ****************************************************************************
-  * @Id: curs_get_wch.3x,v 1.7 2010/08/14 23:31:42 tom Exp @
+  * @Id: curs_get_wch.3x,v 1.8 2012/11/03 23:03:59 tom Exp @
 -->
 <HTML>
 <HEAD>
@@ -122,7 +122,7 @@
 
 
 </PRE>
-<H2>RETURN VALUES</H2><PRE>
+<H2>RETURN VALUE</H2><PRE>
        When  <STRONG>get_wch</STRONG>,  <STRONG>wget_wch</STRONG>,  <STRONG>mvget_wch</STRONG>, and <STRONG>mvwget_wch</STRONG> func-
        tions successfully report the pressing of a function  key,
        they return <STRONG>KEY_CODE_YES</STRONG>.  When they successfully report a
Index: doc/html/man/curs_get_wstr.3x.html
--- ncurses-5.9/doc/html/man/curs_get_wstr.3x.html	2011-01-09 01:03:08.000000000 +0000
+++ ncurses-5.9-20130504/doc/html/man/curs_get_wstr.3x.html	2013-03-09 22:11:59.000000000 +0000
@@ -1,7 +1,7 @@
 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
 <!-- 
   ****************************************************************************
-  * Copyright (c) 2002-2006,2010 Free Software Foundation, Inc.              *
+  * Copyright (c) 2002-2010,2012 Free Software Foundation, Inc.              *
   *                                                                          *
   * Permission is hereby granted, free of charge, to any person obtaining a  *
   * copy of this software and associated documentation files (the            *
@@ -27,7 +27,7 @@
   * sale, use or other dealings in this Software without prior written       *
   * authorization.                                                           *
   ****************************************************************************
-  * @Id: curs_get_wstr.3x,v 1.8 2010/12/04 18:36:44 tom Exp @
+  * @Id: curs_get_wstr.3x,v 1.9 2012/11/03 23:03:59 tom Exp @
 -->
 <HTML>
 <HEAD>
@@ -118,7 +118,7 @@
 
 
 </PRE>
-<H2>RETURN VALUES</H2><PRE>
+<H2>RETURN VALUE</H2><PRE>
        All of these functions return <STRONG>OK</STRONG> upon  successful  comple-
        tion.  Otherwise, they return <STRONG>ERR</STRONG>.
 
Index: doc/html/man/curs_getcchar.3x.html
--- ncurses-5.9/doc/html/man/curs_getcchar.3x.html	2011-01-09 01:03:07.000000000 +0000
+++ ncurses-5.9-20130504/doc/html/man/curs_getcchar.3x.html	2013-03-09 22:11:59.000000000 +0000
@@ -1,7 +1,7 @@
 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
 <!-- 
   ****************************************************************************
-  * Copyright (c) 2001-2009,2010 Free Software Foundation, Inc.              *
+  * Copyright (c) 2001-2010,2012 Free Software Foundation, Inc.              *
   *                                                                          *
   * Permission is hereby granted, free of charge, to any person obtaining a  *
   * copy of this software and associated documentation files (the            *
@@ -27,7 +27,7 @@
   * sale, use or other dealings in this Software without prior written       *
   * authorization.                                                           *
   ****************************************************************************
-  * @Id: curs_getcchar.3x,v 1.15 2010/12/04 18:36:44 tom Exp @
+  * @Id: curs_getcchar.3x,v 1.16 2012/11/03 23:03:59 tom Exp @
 -->
 <HTML>
 <HEAD>
@@ -128,7 +128,7 @@
 
 
 </PRE>
-<H2>RETURN VALUES</H2><PRE>
+<H2>RETURN VALUE</H2><PRE>
        When <EM>wch</EM> is a null pointer, <STRONG>getcchar</STRONG> returns the number of
        wide characters referenced by <EM>wcval</EM>, including one  for  a
        trailing null.
Index: doc/html/man/curs_getch.3x.html
--- ncurses-5.9/doc/html/man/curs_getch.3x.html	2011-02-25 23:24:52.000000000 +0000
+++ ncurses-5.9-20130504/doc/html/man/curs_getch.3x.html	2013-03-09 22:11:59.000000000 +0000
@@ -2,7 +2,7 @@
 <!-- 
   * t
   ****************************************************************************
-  * Copyright (c) 1998-2010,2011 Free Software Foundation, Inc.              *
+  * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc.              *
   *                                                                          *
   * Permission is hereby granted, free of charge, to any person obtaining a  *
   * copy of this software and associated documentation files (the            *
@@ -28,7 +28,7 @@
   * sale, use or other dealings in this Software without prior written       *
   * authorization.                                                           *
   ****************************************************************************
-  * @Id: curs_getch.3x,v 1.36 2011/01/22 19:38:51 tom Exp @
+  * @Id: curs_getch.3x,v 1.37 2012/07/07 20:04:56 tom Exp @
 -->
 <HTML>
 <HEAD>
@@ -110,7 +110,6 @@
        be returned by the next call to <STRONG>wgetch</STRONG>.  There is just one
        input queue for all windows.
 
-
    <STRONG>Function</STRONG> <STRONG>Keys</STRONG>
        The following function keys, defined in <STRONG>&lt;curses.h&gt;</STRONG>,  might
        be  returned  by  <STRONG>getch</STRONG>  if <STRONG>keypad</STRONG> has been enabled.  Note
@@ -179,8 +178,8 @@
             KEY_REPLACE     Replace key
             KEY_RESIZE      Screen resized
             KEY_RESTART     Restart key
-            KEY_RESUME      Resume key
 
+            KEY_RESUME      Resume key
             KEY_SAVE        Save key
             KEY_SBEG        Shifted beginning key
             KEY_SCANCEL     Shifted cancel key
@@ -233,21 +232,18 @@
        sion of <STRONG>KEY_MOUSE</STRONG>.
 
 
-
 </PRE>
 <H2>RETURN VALUE</H2><PRE>
        All routines return the integer <STRONG>ERR</STRONG> upon  failure  and  an
        integer value other than <STRONG>ERR</STRONG> (<STRONG>OK</STRONG> in the case of ungetch())
        upon successful completion.
 
-              <STRONG>ungetch</STRONG>
-                   returns an error if there is no more  room  in
-                   the FIFO.
-
-              <STRONG>wgetch</STRONG>
-                   returns  an  error  if  the  window pointer is
-                   null, or if its timeout expires without having
-                   any data.
+          <STRONG>ungetch</STRONG>
+               returns ERR if there is no more room in the FIFO.
+
+          <STRONG>wgetch</STRONG>
+               returns ERR if the window pointer is null,  or  if
+               its timeout expires without having any data.
 
        Functions  with a "mv" prefix first perform a cursor move-
        ment using <STRONG>wmove</STRONG>, and return an error if the  position  is
Index: doc/html/man/curs_in_wchstr.3x.html
--- ncurses-5.9/doc/html/man/curs_in_wchstr.3x.html	2011-01-09 01:03:10.000000000 +0000
+++ ncurses-5.9-20130504/doc/html/man/curs_in_wchstr.3x.html	2013-03-09 22:11:59.000000000 +0000
@@ -1,7 +1,7 @@
 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
 <!-- 
   ****************************************************************************
-  * Copyright (c) 2002-2006,2010 Free Software Foundation, Inc.              *
+  * Copyright (c) 2002-2010,2012 Free Software Foundation, Inc.              *
   *                                                                          *
   * Permission is hereby granted, free of charge, to any person obtaining a  *
   * copy of this software and associated documentation files (the            *
@@ -27,7 +27,7 @@
   * sale, use or other dealings in this Software without prior written       *
   * authorization.                                                           *
   ****************************************************************************
-  * @Id: curs_in_wchstr.3x,v 1.8 2010/12/04 18:36:44 tom Exp @
+  * @Id: curs_in_wchstr.3x,v 1.9 2012/11/03 23:03:59 tom Exp @
 -->
 <HTML>
 <HEAD>
@@ -90,7 +90,7 @@
 
 
 </PRE>
-<H2>RETURN VALUES</H2><PRE>
+<H2>RETURN VALUE</H2><PRE>
        Upon successful completion,  these  functions  return  <STRONG>OK</STRONG>.
        Otherwise, they return <STRONG>ERR</STRONG>.
 
Index: doc/html/man/curs_inopts.3x.html
--- ncurses-5.9/doc/html/man/curs_inopts.3x.html	2011-01-09 01:03:09.000000000 +0000
+++ ncurses-5.9-20130504/doc/html/man/curs_inopts.3x.html	2013-03-09 22:11:59.000000000 +0000
@@ -1,7 +1,7 @@
 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
 <!-- 
   ****************************************************************************
-  * Copyright (c) 1998-2005,2010 Free Software Foundation, Inc.              *
+  * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc.              *
   *                                                                          *
   * Permission is hereby granted, free of charge, to any person obtaining a  *
   * copy of this software and associated documentation files (the            *
@@ -27,7 +27,7 @@
   * sale, use or other dealings in this Software without prior written       *
   * authorization.                                                           *
   ****************************************************************************
-  * @Id: curs_inopts.3x,v 1.15 2010/12/04 18:40:45 tom Exp @
+  * @Id: curs_inopts.3x,v 1.17 2012/04/28 19:09:15 tom Exp @
 -->
 <HTML>
 <HEAD>
@@ -229,24 +229,58 @@
        ty,  set  echo or noecho explicitly just after initializa-
        tion, even if your program remains in cooked mode.
 
+       When <STRONG>keypad</STRONG> is first enabled, ncurses loads the  key-defi-
+       nitions for the current terminal description.  If the ter-
+       minal description includes extended  string  capabilities,
+       e.g.,  from  using the <STRONG>-x</STRONG> option of tic, then ncurses also
+       defines keys for the capabilities whose names  begin  with
+       "k".   The  corresponding  keycodes are generated and (de-
+       pending on previous loads of  terminal  descriptions)  may
+       differ  from  one execution of a program to the next.  The
+       generated keycodes are recognized by the <STRONG>keyname</STRONG>  function
+       (which will then return a name beginning with "k" denoting
+       the terminfo capability name rather  than  "K",  used  for
+       curses  key-names).  On the other hand, an application can
+       use <STRONG>define_key</STRONG> to establish a specific keycode for a given
+       string.   This  makes  it  possible  for an application to
+       check for an extended capability's presence with <EM>tigetstr</EM>,
+       and reassign the keycode to match its own needs.
+
+       Low-level applications can use <STRONG>tigetstr</STRONG> to obtain the def-
+       inition of any particular string capability.  Higher-level
+       applications which use the curses <STRONG>wgetch</STRONG> and similar func-
+       tions to return keycodes rely upon the order in which  the
+       strings  are  loaded.  If more than one key definition has
+       the same string value, then <STRONG>wgetch</STRONG>  can  return  only  one
+       keycode.   Most curses implementations (including ncurses)
+       load key definitions in the order defined by the array  of
+       string capability names.  The last key to be loaded deter-
+       mines the keycode which will be returned.  In ncurses, you
+       may  also  have  extended  capabilities interpreted as key
+       definitions.  These are loaded after the predefined  keys,
+       and  if  a capability's value is the same as a previously-
+       loaded key definition, the later  definition  is  the  one
+       used.
+
 
 </PRE>
 <H2>NOTES</H2><PRE>
-       Note that <STRONG>echo</STRONG>, <STRONG>noecho</STRONG>, <STRONG>halfdelay</STRONG>, <STRONG>intrflush</STRONG>, <STRONG>meta</STRONG>,  <STRONG>node-</STRONG>
-       <STRONG>lay</STRONG>,  <STRONG>notimeout</STRONG>, <STRONG>noqiflush</STRONG>, <STRONG>qiflush</STRONG>, <STRONG>timeout</STRONG>, and <STRONG>wtimeout</STRONG>
+       Note  that <STRONG>echo</STRONG>, <STRONG>noecho</STRONG>, <STRONG>halfdelay</STRONG>, <STRONG>intrflush</STRONG>, <STRONG>meta</STRONG>, <STRONG>node-</STRONG>
+       <STRONG>lay</STRONG>, <STRONG>notimeout</STRONG>, <STRONG>noqiflush</STRONG>, <STRONG>qiflush</STRONG>, <STRONG>timeout</STRONG>, and  <STRONG>wtimeout</STRONG>
        may be macros.
 
        The <STRONG>noraw</STRONG> and <STRONG>nocbreak</STRONG> calls follow historical practice in
-       that  they  attempt  to  restore to normal (`cooked') mode
-       from raw and cbreak modes respectively.  Mixing  raw/noraw
-       and  cbreak/nocbreak  calls  leads  to  tty driver control
-       states that are hard to predict or understand; it  is  not
+       that they attempt to restore  to  normal  (`cooked')  mode
+       from  raw and cbreak modes respectively.  Mixing raw/noraw
+       and cbreak/nocbreak calls  leads  to  tty  driver  control
+       states  that  are hard to predict or understand; it is not
        recommended.
 
 
 </PRE>
 <H2>SEE ALSO</H2><PRE>
-       <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>, <STRONG><A HREF="curs_getch.3x.html">curs_getch(3x)</A></STRONG>, <STRONG><A HREF="curs_initscr.3x.html">curs_initscr(3x)</A></STRONG>, <STRONG><A HREF="termio.7.html">termio(7)</A></STRONG>
+       <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>,       <STRONG><A HREF="curs_getch.3x.html">curs_getch(3x)</A></STRONG>,        <STRONG><A HREF="curs_initscr.3x.html">curs_initscr(3x)</A></STRONG>,
+       <STRONG><A HREF="curs_util.3x.html">curs_util(3x)</A></STRONG>, <STRONG><A HREF="define_key.3x.html">define_key(3x)</A></STRONG>, <STRONG><A HREF="termio.7.html">termio(7)</A></STRONG>
 
 
 
Index: doc/html/man/curs_ins_wstr.3x.html
--- ncurses-5.9/doc/html/man/curs_ins_wstr.3x.html	2011-01-09 01:03:10.000000000 +0000
+++ ncurses-5.9-20130504/doc/html/man/curs_ins_wstr.3x.html	2013-03-09 22:11:59.000000000 +0000
@@ -1,7 +1,7 @@
 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
 <!-- 
   ****************************************************************************
-  * Copyright (c) 2002-2005,2010 Free Software Foundation, Inc.              *
+  * Copyright (c) 2002-2010,2012 Free Software Foundation, Inc.              *
   *                                                                          *
   * Permission is hereby granted, free of charge, to any person obtaining a  *
   * copy of this software and associated documentation files (the            *
@@ -27,7 +27,7 @@
   * sale, use or other dealings in this Software without prior written       *
   * authorization.                                                           *
   ****************************************************************************
-  * @Id: curs_ins_wstr.3x,v 1.6 2010/12/04 18:38:55 tom Exp @
+  * @Id: curs_ins_wstr.3x,v 1.7 2012/11/03 23:03:59 tom Exp @
 -->
 <HTML>
 <HEAD>
@@ -102,7 +102,7 @@
 
 
 </PRE>
-<H2>RETURN VALUES</H2><PRE>
+<H2>RETURN VALUE</H2><PRE>
        Upon successful completion,  these  functions  return  OK.
        Otherwise, they return ERR.
 
Index: doc/html/man/curs_inwstr.3x.html
--- ncurses-5.9/doc/html/man/curs_inwstr.3x.html	2011-01-09 01:03:11.000000000 +0000
+++ ncurses-5.9-20130504/doc/html/man/curs_inwstr.3x.html	2013-03-09 22:12:00.000000000 +0000
@@ -1,7 +1,7 @@
 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
 <!-- 
   ****************************************************************************
-  * Copyright (c) 2002-2006,2010 Free Software Foundation, Inc.              *
+  * Copyright (c) 2002-2010,2012 Free Software Foundation, Inc.              *
   *                                                                          *
   * Permission is hereby granted, free of charge, to any person obtaining a  *
   * copy of this software and associated documentation files (the            *
@@ -27,7 +27,7 @@
   * sale, use or other dealings in this Software without prior written       *
   * authorization.                                                           *
   ****************************************************************************
-  * @Id: curs_inwstr.3x,v 1.7 2010/12/04 18:38:55 tom Exp @
+  * @Id: curs_inwstr.3x,v 1.8 2012/11/03 23:03:59 tom Exp @
 -->
 <HTML>
 <HEAD>
@@ -87,7 +87,7 @@
 
 
 </PRE>
-<H2>RETURN VALUES</H2><PRE>
+<H2>RETURN VALUE</H2><PRE>
        All routines return <STRONG>ERR</STRONG> upon failure. Upon successful com-
        pletion, the *<STRONG>inwstr</STRONG> routines return <STRONG>OK</STRONG>, and the  *<STRONG>innwstr</STRONG>
        routines  return  the  number  of characters read into the
Index: doc/html/man/curs_mouse.3x.html
--- ncurses-5.9/doc/html/man/curs_mouse.3x.html	2011-02-25 23:24:55.000000000 +0000
+++ ncurses-5.9-20130504/doc/html/man/curs_mouse.3x.html	2013-03-09 22:12:00.000000000 +0000
@@ -98,7 +98,6 @@
 
        Here are the mouse event type masks which may be defined:
 
-
        <EM>Name</EM>                     <EM>Description</EM>
        ---------------------------------------------------------------------
        BUTTON1_PRESSED          mouse button 1 down
@@ -111,10 +110,9 @@
        BUTTON2_RELEASED         mouse button 2 up
        BUTTON2_CLICKED          mouse button 2 clicked
        BUTTON2_DOUBLE_CLICKED   mouse button 2 double clicked
-
-
        BUTTON2_TRIPLE_CLICKED   mouse button 2 triple clicked
        ---------------------------------------------------------------------
+
        BUTTON3_PRESSED          mouse button 3 down
        BUTTON3_RELEASED         mouse button 3 up
        BUTTON3_CLICKED          mouse button 3 clicked
Index: doc/html/man/curs_sp_funcs.3x.html
--- ncurses-5.9/doc/html/man/curs_sp_funcs.3x.html	2011-02-25 23:24:57.000000000 +0000
+++ ncurses-5.9-20130504/doc/html/man/curs_sp_funcs.3x.html	2013-03-09 22:12:01.000000000 +0000
@@ -193,16 +193,15 @@
        functions which improve the  ability  to  manage  multiple
        screens.  This feature can be added to any of the configu-
        rations supported by  ncurses;  it  adds  new  entrypoints
-       without  changing the meaning of any of the existing ones.
-
+       without changing the meaning of any of the existing ones.
 
    <STRONG>IMPROVED</STRONG> <STRONG>FUNCTIONS</STRONG>
-       Most of the functions are new versions of  existing  func-
+       Most  of  the functions are new versions of existing func-
        tions.  A parameter is added at the front of the parameter
        list.  It is a SCREEN pointer.
 
-       The existing functions all use the current  screen,  which
-       is  a  static  variable.   The  extended functions use the
+       The  existing  functions all use the current screen, which
+       is a static variable.   The  extended  functions  use  the
        specified screen, thereby reducing the number of variables
        which must be modified to update multiple screens.
 
@@ -210,22 +209,22 @@
        Here are the new functions:
 
        ceiling_panel
-            this  returns  a  pointer to the topmost panel in the
+            this returns a pointer to the topmost  panel  in  the
             given screen.
 
        ground_panel
-            this returns a pointer to the  lowest  panel  in  the
+            this  returns  a  pointer  to the lowest panel in the
             given screen.
 
        new_prescr
-            when  creating  a new screen, the library uses static
-            variables  which   have   been   preset,   e.g.,   by
+            when creating a new screen, the library  uses  static
+            variables   which   have   been   preset,   e.g.,  by
             <STRONG><A HREF="use_env.3x.html">use_env(3x)</A></STRONG>, <STRONG><A HREF="filter.3x.html">filter(3x)</A></STRONG>, etc.  With the screen-point-
             er extension, there are situations where it must cre-
-            ate  a  current  screen before the unextended library
-            does.  The <STRONG>new_prescr</STRONG> function is used internally  to
+            ate a current screen before  the  unextended  library
+            does.   The <STRONG>new_prescr</STRONG> function is used internally to
             handle these cases.  It is also provided as an entry-
-            point to allow applications to customize the  library
+            point  to allow applications to customize the library
             initialization.
 
 
@@ -234,37 +233,36 @@
        This extension introduces some new names:
 
        NCURSES_SP_FUNCS
-            This  is  set  to the library patch-level number.  In
-            the unextended library, this is zero (0), to make  it
+            This is set to the library  patch-level  number.   In
+            the  unextended library, this is zero (0), to make it
             useful for checking if the extension is provided.
 
        NCURSES_SP_NAME
-            The  new  functions  are named using the macro <EM>NCURS-</EM>
-            <EM>ES</EM><STRONG>_</STRONG><EM>SP</EM><STRONG>_</STRONG><EM>NAME</EM>, which hides  the  actual  implementation.
+            The new functions are named using  the  macro  <EM>NCURS-</EM>
+            <EM>ES</EM><STRONG>_</STRONG><EM>SP</EM><STRONG>_</STRONG><EM>NAME</EM>,  which  hides  the actual implementation.
             Currently this adds a "_sp" suffix to the name of the
-            unextended function.  This manual  page  indexes  the
+            unextended  function.   This  manual page indexes the
             extensions showing the full name.  However the proper
-            usage of these functions uses the macro,  to  provide
+            usage  of  these functions uses the macro, to provide
             for the possibility of changing the naming convention
             for specific library configurations.
 
        NCURSES_SP_OUTC
-            This is a new function-pointer type  to  use  in  the
-            screen-pointer  functions  where  an  <EM>NCURSES</EM><STRONG>_</STRONG><EM>OUTC</EM> is
+            This  is  a  new  function-pointer type to use in the
+            screen-pointer functions  where  an  <EM>NCURSES</EM><STRONG>_</STRONG><EM>OUTC</EM>  is
             used in the unextended library.
 
        NCURSES_OUTC
-            This is a function-pointer type used  for  the  cases
-            where  a  function  passes  characters  to the output
+            This  is  a  function-pointer type used for the cases
+            where a function  passes  characters  to  the  output
             stream, e.g., <STRONG><A HREF="vidputs.3x.html">vidputs(3x)</A></STRONG>.
 
 
-
 </PRE>
 <H2>PORTABILITY</H2><PRE>
-       These routines are specific to  ncurses.   They  were  not
-       supported  on  Version 7, BSD or System V implementations.
-       It is recommended that any code depending on  ncurses  ex-
+       These  routines  are  specific  to ncurses.  They were not
+       supported on Version 7, BSD or System  V  implementations.
+       It  is  recommended that any code depending on ncurses ex-
        tensions be conditioned using <EM>NCURSES</EM><STRONG>_</STRONG><EM>SP</EM><STRONG>_</STRONG><EM>FUNCS</EM>.
 
 
Index: doc/html/man/curs_termattrs.3x.html
--- ncurses-5.9/doc/html/man/curs_termattrs.3x.html	2011-02-25 23:24:58.000000000 +0000
+++ ncurses-5.9-20130504/doc/html/man/curs_termattrs.3x.html	2013-03-09 22:12:01.000000000 +0000
@@ -111,11 +111,11 @@
 
        If  a  given  terminal  does not support a video attribute
        that an application program is trying to use,  <STRONG>curses</STRONG>  may
-       substitute  a  different  video  attribute  for  it.   The
-       <STRONG>termattrs</STRONG> and <STRONG>term_attrs</STRONG> functions return a logical <STRONG>OR</STRONG>  of
-       all  video  attributes  supported by the terminal using <EM>A</EM><STRONG>_</STRONG>
-       and <EM>WA</EM><STRONG>_</STRONG> constants respectively.  This information is  use-
-       ful  when a <STRONG>curses</STRONG> program needs complete control over the
+       substitute  a  different video attribute for it.  The <STRONG>ter-</STRONG>
+       <STRONG>mattrs</STRONG> and <STRONG>term_attrs</STRONG> functions return a logical <STRONG>OR</STRONG> of all
+       video  attributes  supported  by the terminal using <EM>A</EM><STRONG>_</STRONG> and
+       <EM>WA</EM><STRONG>_</STRONG> constants respectively.  This  information  is  useful
+       when  a  <STRONG>curses</STRONG>  program  needs  complete control over the
        appearance of the screen.
 
        The <STRONG>termname</STRONG> routine returns the  terminal  name  used  by
Index: doc/html/man/curs_termcap.3x.html
--- ncurses-5.9/doc/html/man/curs_termcap.3x.html	2011-01-09 01:03:14.000000000 +0000
+++ ncurses-5.9-20130504/doc/html/man/curs_termcap.3x.html	2013-03-09 22:12:01.000000000 +0000
@@ -1,7 +1,7 @@
 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
 <!-- 
   ****************************************************************************
-  * Copyright (c) 1998-2007,2010 Free Software Foundation, Inc.              *
+  * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc.              *
   *                                                                          *
   * Permission is hereby granted, free of charge, to any person obtaining a  *
   * copy of this software and associated documentation files (the            *
@@ -27,7 +27,7 @@
   * sale, use or other dealings in this Software without prior written       *
   * authorization.                                                           *
   ****************************************************************************
-  * @Id: curs_termcap.3x,v 1.26 2010/12/04 18:38:55 tom Exp @
+  * @Id: curs_termcap.3x,v 1.30 2013/01/19 15:58:48 tom Exp @
 -->
 <HTML>
 <HEAD>
@@ -79,39 +79,62 @@
        bilities  of  entries  for which a terminfo entry has been
        compiled.
 
-       The <STRONG>tgetent</STRONG> routine loads the entry for <EM>name</EM>.  It  returns
-       1  on  success, 0 if there is no such entry, and -1 if the
-       terminfo database could not be found.  The  emulation  ig-
-       nores the buffer pointer <EM>bp</EM>.
+   <STRONG>INITIALIZATION</STRONG>
+       The <STRONG>tgetent</STRONG> routine loads the entry for <EM>name</EM>.  It returns:
 
+          1  on success,
+
+          0  if there is no such entry (or that it is  a  generic
+             type,  having  too little information for curses ap-
+             plications to run), and
+
+          -1 if the terminfo database could not be found.
+
+       This differs from the <EM>termcap</EM> library in two ways:
+
+          <STRONG>o</STRONG>   The emulation ignores the buffer pointer  <EM>bp</EM>.   The
+              <EM>termcap</EM>  library would store a copy of the terminal
+              description in the area referenced by this pointer.
+              However,  ncurses  stores its terminal descriptions
+              in compiled binary form,  which  is  not  the  same
+              thing.
+
+          <STRONG>o</STRONG>   There is a difference in return codes.  The <EM>termcap</EM>
+              library does not check if the terminal  description
+              is  marked  with  the <EM>generic</EM> capability, or if the
+              terminal description has cursor-addressing.
+
+   <STRONG>CAPABILITY</STRONG> <STRONG>VALUES</STRONG>
        The <STRONG>tgetflag</STRONG> routine gets the boolean entry for <EM>id</EM>, or ze-
        ro if it is not available.
 
-       The <STRONG>tgetnum</STRONG> routine gets the numeric entry for <EM>id</EM>,  or  -1
+       The  <STRONG>tgetnum</STRONG>  routine gets the numeric entry for <EM>id</EM>, or -1
        if it is not available.
 
-       The  <STRONG>tgetstr</STRONG>  routine  returns the string entry for <EM>id</EM>, or
-       zero if it is not available.  Use <STRONG>tputs</STRONG> to output the  re-
-       turned  string.   The  return value will also be copied to
-       the buffer pointed to by <EM>area</EM>, and the <EM>area</EM> value will  be
+       The <STRONG>tgetstr</STRONG> routine returns the string entry  for  <EM>id</EM>,  or
+       zero  if it is not available.  Use <STRONG>tputs</STRONG> to output the re-
+       turned string.  The return value will also  be  copied  to
+       the  buffer pointed to by <EM>area</EM>, and the <EM>area</EM> value will be
        updated to point past the null ending this value.
 
        Only the first two characters of the <STRONG>id</STRONG> parameter of <STRONG>tget-</STRONG>
        <STRONG>flag</STRONG>, <STRONG>tgetnum</STRONG> and <STRONG>tgetstr</STRONG> are compared in lookups.
 
-       The <STRONG>tgoto</STRONG> routine instantiates  the  parameters  into  the
-       given  capability.   The output from this routine is to be
+   <STRONG>FORMATTING</STRONG> <STRONG>CAPABILITIES</STRONG>
+       The  <STRONG>tgoto</STRONG>  routine  instantiates  the parameters into the
+       given capability.  The output from this routine is  to  be
        passed to <STRONG>tputs</STRONG>.
 
-       The <STRONG>tputs</STRONG> routine is described  on  the  <STRONG><A HREF="curs_terminfo.3x.html">curs_terminfo(3x)</A></STRONG>
+       The  <STRONG>tputs</STRONG>  routine  is described on the <STRONG><A HREF="curs_terminfo.3x.html">curs_terminfo(3x)</A></STRONG>
        manual page.  It can retrieve capabilities by either term-
        cap or terminfo name.
 
+   <STRONG>GLOBAL</STRONG> <STRONG>VARIABLES</STRONG>
        The variables <STRONG>PC</STRONG>, <STRONG>UP</STRONG> and <STRONG>BC</STRONG> are set by <STRONG>tgetent</STRONG> to the ter-
        minfo   entry's   data   for   <STRONG>pad_char</STRONG>,   <STRONG>cursor_up</STRONG>   and
-       <STRONG>backspace_if_not_bs</STRONG>, respectively.   <STRONG>UP</STRONG>  is  not  used  by
+       <STRONG>backspace_if_not_bs</STRONG>,  respectively.   <STRONG>UP</STRONG>  is  not  used by
        ncurses.  <STRONG>PC</STRONG> is used in the <STRONG>tdelay_output</STRONG> function.  <STRONG>BC</STRONG> is
-       used in the <STRONG>tgoto</STRONG> emulation.  The variable <STRONG>ospeed</STRONG>  is  set
+       used  in  the <STRONG>tgoto</STRONG> emulation.  The variable <STRONG>ospeed</STRONG> is set
        by ncurses in a system-specific coding to reflect the ter-
        minal speed.
 
@@ -119,7 +142,7 @@
 </PRE>
 <H2>RETURN VALUE</H2><PRE>
        Except where explicitly noted, routines that return an in-
-       teger  return <STRONG>ERR</STRONG> upon failure and <STRONG>OK</STRONG> (SVr4 only specifies
+       teger return <STRONG>ERR</STRONG> upon failure and <STRONG>OK</STRONG> (SVr4 only  specifies
        "an integer value other than <STRONG>ERR</STRONG>") upon successful comple-
        tion.
 
@@ -129,55 +152,77 @@
 </PRE>
 <H2>BUGS</H2><PRE>
        If you call <STRONG>tgetstr</STRONG> to fetch <STRONG>ca</STRONG> or any other parameterized
-       string, be aware that it will be returned in terminfo  no-
+       string,  be aware that it will be returned in terminfo no-
        tation, not the older and not-quite-compatible termcap no-
-       tation.  This will not cause problems if all you  do  with
-       it  is  call  <STRONG>tgoto</STRONG>  or <STRONG>tparm</STRONG>, which both expand terminfo-
-       style strings as terminfo.  (The <STRONG>tgoto</STRONG> function,  if  con-
-       figured  to  support  termcap, will check if the string is
-       indeed terminfo-style by looking for  "%p"  parameters  or
-       "$&lt;..&gt;"  delays,  and invoke a termcap-style parser if the
+       tation.   This  will not cause problems if all you do with
+       it is call <STRONG>tgoto</STRONG> or <STRONG>tparm</STRONG>,  which  both  expand  terminfo-
+       style  strings  as terminfo.  (The <STRONG>tgoto</STRONG> function, if con-
+       figured to support termcap, will check if  the  string  is
+       indeed  terminfo-style  by  looking for "%p" parameters or
+       "$&lt;..&gt;" delays, and invoke a termcap-style parser  if  the
        string does not appear to be terminfo).
 
-       Because terminfo conventions for representing  padding  in
-       string  capabilities  differ  from termcap's, <STRONG>tputs("50");</STRONG>
-       will put out a literal "50" rather than  busy-waiting  for
+       Because  terminfo  conventions for representing padding in
+       string capabilities differ  from  termcap's,  <STRONG>tputs("50");</STRONG>
+       will  put  out a literal "50" rather than busy-waiting for
        50 milliseconds.  Cope with it.
 
-       Note  that termcap has nothing analogous to terminfo's <STRONG>sgr</STRONG>
-       string.  One consequence of this is that termcap  applica-
-       tions  assume me (terminfo <STRONG>sgr0</STRONG>) does not reset the alter-
-       nate character set.  This implementation checks  for,  and
+       Note that termcap has nothing analogous to terminfo's  <STRONG>sgr</STRONG>
+       string.   One consequence of this is that termcap applica-
+       tions assume me (terminfo <STRONG>sgr0</STRONG>) does not reset the  alter-
+       nate  character  set.  This implementation checks for, and
        modifies the data shown to the termcap interface to accom-
        modate termcap's limitation in this respect.
 
 
 </PRE>
 <H2>PORTABILITY</H2><PRE>
-       The XSI Curses standard, Issue  4  describes  these  func-
-       tions.   However,  they are marked TO BE WITHDRAWN and may
+       The  XSI  Curses  standard,  Issue 4 describes these func-
+       tions.  However, they are marked TO BE WITHDRAWN  and  may
        be removed in future versions.
 
-       Neither the XSI Curses standard nor  the  SVr4  man  pages
-       documented  the return values of <STRONG>tgetent</STRONG> correctly, though
-       all three were in fact returned ever since SVr1.  In  par-
-       ticular,  an  omission in the XSI Curses documentation has
-       been misinterpreted to mean that  <STRONG>tgetent</STRONG>  returns  <STRONG>OK</STRONG>  or
+       Neither  the  XSI  Curses  standard nor the SVr4 man pages
+       documented the return values of <STRONG>tgetent</STRONG> correctly,  though
+       all  three were in fact returned ever since SVr1.  In par-
+       ticular, an omission in the XSI Curses  documentation  has
+       been  misinterpreted  to  mean  that <STRONG>tgetent</STRONG> returns <STRONG>OK</STRONG> or
        <STRONG>ERR</STRONG>.  Because the purpose of these functions is to provide
-       compatibility with the <EM>termcap</EM> library, that is  a  defect
+       compatibility  with  the <EM>termcap</EM> library, that is a defect
        in XCurses, Issue 4, Version 2 rather than in ncurses.
 
-       External  variables  are  provided  for support of certain
-       termcap applications.  However, termcap applications'  use
+       External variables are provided  for  support  of  certain
+       termcap  applications.  However, termcap applications' use
        of those variables is poorly documented, e.g., not distin-
-       guishing between input and output.   In  particular,  some
+       guishing  between  input  and output.  In particular, some
        applications are reported to declare and/or modify <STRONG>ospeed</STRONG>.
 
+       The comment that only the first two characters of  the  <STRONG>id</STRONG>
+       parameter  are  used  escapes many application developers.
+       The original  BSD  4.2  termcap  library  (and  historical
+       relics thereof) did not require a trailing null NUL on the
+       parameter name passed to <STRONG>tgetstr</STRONG>,  <STRONG>tgetnum</STRONG>  and  <STRONG>tgetflag</STRONG>.
+       Some  applications  assume that the termcap interface does
+       not require the trailing NUL for the parameter name.  Tak-
+       ing into account these issues:
+
+       <STRONG>o</STRONG>   As  a special case, <STRONG>tgetflag</STRONG> matched against a single-
+           character identifier provided that was at the  end  of
+           the  terminal  description.   You should not rely upon
+           this behavior in portable programs.  This  implementa-
+           tion  disallows matches against single-character capa-
+           bility names.
+
+       <STRONG>o</STRONG>   This implementation disallows matches by  the  termcap
+           interface  against extended capability names which are
+           longer than two characters.
+
 
 </PRE>
 <H2>SEE ALSO</H2><PRE>
        <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>, <STRONG><A HREF="terminfo.5.html">terminfo(5)</A></STRONG>, <STRONG><A HREF="term_variables.3x.html">term_variables(3x)</A></STRONG>, <STRONG><A HREF="putc.3.html">putc(3)</A></STRONG>.
 
+       http://invisible-island.net/ncurses/tctest.html
+
 
 
                                                        <STRONG><A HREF="curs_termcap.3x.html">curs_termcap(3x)</A></STRONG>
Index: doc/html/man/curs_terminfo.3x.html
--- ncurses-5.9/doc/html/man/curs_terminfo.3x.html	2011-01-09 01:03:15.000000000 +0000
+++ ncurses-5.9-20130504/doc/html/man/curs_terminfo.3x.html	2013-03-09 22:12:01.000000000 +0000
@@ -1,7 +1,7 @@
 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
 <!-- 
   ****************************************************************************
-  * Copyright (c) 1999-2008,2010 Free Software Foundation, Inc.              *
+  * Copyright (c) 1999-2011,2013 Free Software Foundation, Inc.              *
   *                                                                          *
   * Permission is hereby granted, free of charge, to any person obtaining a  *
   * copy of this software and associated documentation files (the            *
@@ -27,7 +27,7 @@
   * sale, use or other dealings in this Software without prior written       *
   * authorization.                                                           *
   ****************************************************************************
-  * @Id: curs_terminfo.3x,v 1.35 2010/12/04 18:38:55 tom Exp @
+  * @Id: curs_terminfo.3x,v 1.37 2013/01/12 18:11:40 tom Exp @
 -->
 <HTML>
 <HEAD>
@@ -68,7 +68,7 @@
        <STRONG>int</STRONG> <STRONG>putp(const</STRONG> <STRONG>char</STRONG> <STRONG>*</STRONG><EM>str</EM><STRONG>);</STRONG>
        <STRONG>int</STRONG> <STRONG>vidputs(chtype</STRONG> <EM>attrs</EM><STRONG>,</STRONG> <STRONG>int</STRONG> <STRONG>(*</STRONG><EM>putc</EM><STRONG>)(int));</STRONG>
        <STRONG>int</STRONG> <STRONG>vidattr(chtype</STRONG> <EM>attrs</EM><STRONG>);</STRONG>
-       <STRONG>int</STRONG> <STRONG>vid_puts(attr_t</STRONG> <EM>attrs</EM><STRONG>,</STRONG> <STRONG>short</STRONG> <EM>pair</EM><STRONG>,</STRONG> <STRONG>void</STRONG> <STRONG>*</STRONG><EM>opts</EM><STRONG>,</STRONG> <STRONG>int</STRONG> <STRONG>(*</STRONG><EM>putc</EM><STRONG>)(char));</STRONG>
+       <STRONG>int</STRONG> <STRONG>vid_puts(attr_t</STRONG> <EM>attrs</EM><STRONG>,</STRONG> <STRONG>short</STRONG> <EM>pair</EM><STRONG>,</STRONG> <STRONG>void</STRONG> <STRONG>*</STRONG><EM>opts</EM><STRONG>,</STRONG> <STRONG>int</STRONG> <STRONG>(*</STRONG><EM>putc</EM><STRONG>)(int));</STRONG>
        <STRONG>int</STRONG> <STRONG>vid_attr(attr_t</STRONG> <EM>attrs</EM><STRONG>,</STRONG> <STRONG>short</STRONG> <EM>pair</EM><STRONG>,</STRONG> <STRONG>void</STRONG> <STRONG>*</STRONG><EM>opts</EM><STRONG>);</STRONG>
        <STRONG>int</STRONG> <STRONG>mvcur(int</STRONG> <EM>oldrow</EM><STRONG>,</STRONG> <STRONG>int</STRONG> <EM>oldcol</EM><STRONG>,</STRONG> <STRONG>int</STRONG> <EM>newrow</EM>, int <EM>newcol</EM><STRONG>);</STRONG>
        <STRONG>int</STRONG> <STRONG>tigetflag(char</STRONG> <STRONG>*</STRONG><EM>capname</EM><STRONG>);</STRONG>
Index: doc/html/man/curs_threads.3x.html
--- ncurses-5.9/doc/html/man/curs_threads.3x.html	2011-01-09 01:03:15.000000000 +0000
+++ ncurses-5.9-20130504/doc/html/man/curs_threads.3x.html	2013-03-09 22:12:01.000000000 +0000
@@ -1,7 +1,7 @@
 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
 <!-- 
   ****************************************************************************
-  * Copyright (c) 2008,2010 Free Software Foundation, Inc.                   *
+  * Copyright (c) 2008-2010,2012 Free Software Foundation, Inc.              *
   *                                                                          *
   * Permission is hereby granted, free of charge, to any person obtaining a  *
   * copy of this software and associated documentation files (the            *
@@ -27,7 +27,7 @@
   * sale, use or other dealings in this Software without prior written       *
   * authorization.                                                           *
   ****************************************************************************
-  * @Id: curs_threads.3x,v 1.18 2010/12/04 18:38:55 tom Exp @
+  * @Id: curs_threads.3x,v 1.19 2012/05/26 17:03:26 tom Exp @
   * ***************************************************************************
   * ***************************************************************************
 -->
@@ -61,9 +61,9 @@
        <STRONG>int</STRONG> <STRONG>get_escdelay(void);</STRONG>
        <STRONG>int</STRONG> <STRONG>set_escdelay(int</STRONG> <STRONG>size);</STRONG>
        <STRONG>int</STRONG> <STRONG>set_tabsize(int</STRONG> <STRONG>size);</STRONG>
-       <STRONG>int</STRONG>  <STRONG>use_screen(SCREEN</STRONG>  <STRONG>*scr,</STRONG> <STRONG>NCURSES_WINDOW_CB</STRONG> <STRONG>func,</STRONG> <STRONG>void</STRONG>
+       <STRONG>int</STRONG>  <STRONG>use_screen(SCREEN</STRONG>  <STRONG>*scr,</STRONG> <STRONG>NCURSES_SCREEN_CB</STRONG> <STRONG>func,</STRONG> <STRONG>void</STRONG>
        <STRONG>*data);</STRONG>
-       <STRONG>int</STRONG> <STRONG>use_window(WINDOW</STRONG> <STRONG>*win,</STRONG> <STRONG>NCURSES_SCREEN_CB</STRONG>  <STRONG>func,</STRONG>  <STRONG>void</STRONG>
+       <STRONG>int</STRONG> <STRONG>use_window(WINDOW</STRONG> <STRONG>*win,</STRONG> <STRONG>NCURSES_WINDOW_CB</STRONG>  <STRONG>func,</STRONG>  <STRONG>void</STRONG>
        <STRONG>*data);</STRONG>
 
 
Index: doc/html/man/curs_util.3x.html
--- ncurses-5.9/doc/html/man/curs_util.3x.html	2011-02-25 23:24:59.000000000 +0000
+++ ncurses-5.9-20130504/doc/html/man/curs_util.3x.html	2013-03-09 22:12:01.000000000 +0000
@@ -1,7 +1,8 @@
 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
 <!-- 
+  * t
   ****************************************************************************
-  * Copyright (c) 1998-2008,2010 Free Software Foundation, Inc.              *
+  * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc.              *
   *                                                                          *
   * Permission is hereby granted, free of charge, to any person obtaining a  *
   * copy of this software and associated documentation files (the            *
@@ -27,7 +28,7 @@
   * sale, use or other dealings in this Software without prior written       *
   * authorization.                                                           *
   ****************************************************************************
-  * @Id: curs_util.3x,v 1.32 2010/12/04 18:38:55 tom Exp @
+  * @Id: curs_util.3x,v 1.36 2012/07/21 18:51:10 tom Exp @
 -->
 <HTML>
 <HEAD>
@@ -48,8 +49,8 @@
 </PRE>
 <H2>NAME</H2><PRE>
        <STRONG>delay_output</STRONG>, <STRONG>filter</STRONG>, <STRONG>flushinp</STRONG>, <STRONG>getwin</STRONG>, <STRONG>key_name</STRONG>, <STRONG>keyname</STRONG>,
-       <STRONG>nofilter</STRONG>, <STRONG>putwin</STRONG>, <STRONG>unctrl</STRONG>, <STRONG>use_env</STRONG>, <STRONG>wunctrl</STRONG> - miscellaneous
-       <STRONG>curses</STRONG> utility routines
+       <STRONG>nofilter</STRONG>, <STRONG>putwin</STRONG>, <STRONG>unctrl</STRONG>, <STRONG>use_env</STRONG>, <STRONG>use_tioctl</STRONG>, <STRONG>wunctrl</STRONG> -
+       miscellaneous <STRONG>curses</STRONG> utility routines
 
 
 </PRE>
@@ -63,6 +64,7 @@
        <STRONG>void</STRONG> <STRONG>filter(void);</STRONG>
        <STRONG>void</STRONG> <STRONG>nofilter(void);</STRONG>
        <STRONG>void</STRONG> <STRONG>use_env(bool</STRONG> <STRONG>f);</STRONG>
+       <STRONG>void</STRONG> <STRONG>use_tioctl(bool</STRONG> <STRONG>f);</STRONG>
        <STRONG>int</STRONG> <STRONG>putwin(WINDOW</STRONG> <STRONG>*win,</STRONG> <STRONG>FILE</STRONG> <STRONG>*filep);</STRONG>
        <STRONG>WINDOW</STRONG> <STRONG>*getwin(FILE</STRONG> <STRONG>*filep);</STRONG>
        <STRONG>int</STRONG> <STRONG>delay_output(int</STRONG> <STRONG>ms);</STRONG>
@@ -122,16 +124,66 @@
        <STRONG>$TERM</STRONG>.   The  limitation arises because the <STRONG>filter</STRONG> routine
        modifies the in-memory copy of the terminal information.
 
-       The <STRONG>use_env</STRONG> routine, if used, is called before <STRONG>initscr</STRONG>  or
-       <STRONG>newterm</STRONG>  are  called.   When called with <STRONG>FALSE</STRONG> as an argu-
-       ment, the values of <STRONG>lines</STRONG> and  <STRONG>columns</STRONG>  specified  in  the
-       <EM>terminfo</EM>  database will be used, even if environment vari-
-       ables <STRONG>LINES</STRONG> and <STRONG>COLUMNS</STRONG> (used by default) are set,  or  if
-       <STRONG>curses</STRONG>  is  running in a window (in which case default be-
-       havior would be to  use  the  window  size  if  <STRONG>LINES</STRONG>  and
-       <STRONG>COLUMNS</STRONG>  are not set).  Note that setting <STRONG>LINES</STRONG> or <STRONG>COLUMNS</STRONG>
-       overrides the corresponding size  which  may  be  obtained
-       from the operating system.
+       The <STRONG>use_env</STRONG> routine, if  used,  should  be  called  before
+       <STRONG>initscr</STRONG>  or  <STRONG>newterm</STRONG> are called (because those compute the
+       screen size).  It modifies the way <STRONG>ncurses</STRONG> treats environ-
+       ment variables when determining the screen size.
+
+       <STRONG>o</STRONG>   Normally  ncurses looks first at the terminal database
+           for the screen size.
+
+           If <STRONG>use_env</STRONG> was called with  <STRONG>FALSE</STRONG>  for  parameter,  it
+           stops  here  unless If <STRONG>use_tioctl</STRONG> was also called with
+           <STRONG>TRUE</STRONG> for parameter.
+
+       <STRONG>o</STRONG>   Then it asks for the screen size via operating  system
+           calls.   If  successful,  it overrides the values from
+           the terminal database.
+
+       <STRONG>o</STRONG>   Finally (unless <STRONG>use_env</STRONG> was called with <STRONG>FALSE</STRONG>  parame-
+           ter),  ncurses  examines the <STRONG>LINES</STRONG> or <STRONG>COLUMNS</STRONG> environ-
+           ment variables, using a value in those to override the
+           results  from  the  operating system or terminal data-
+           base.
+
+           Ncurses also updates the screen size  in  response  to
+           SIGWINCH,  unless  overridden  by the <STRONG>LINES</STRONG> or <STRONG>COLUMNS</STRONG>
+           environment variables,
+
+       The <STRONG>use_tioctl</STRONG> routine, if used, should be  called  before
+       <STRONG>initscr</STRONG>  or  <STRONG>newterm</STRONG> are called (because those compute the
+       screen size).  After <STRONG>use_tioctl</STRONG> is called with <STRONG>TRUE</STRONG> as  an
+       argument,  ncurses  modifies the last step in its computa-
+       tion of screen size as follows:
+
+       <STRONG>o</STRONG>   checks if the <STRONG>LINES</STRONG> and <STRONG>COLUMNS</STRONG> environment  variables
+           are set to a number greater than zero.
+
+       <STRONG>o</STRONG>   for  each,  ncurses updates the corresponding environ-
+           ment variable with the value that it has obtained  via
+           operating system call or from the terminal database.
+
+       <STRONG>o</STRONG>   ncurses  re-fetches the value of the environment vari-
+           ables so that it is still  the  environment  variables
+           which set the screen size.
+
+       The  <STRONG>use_env</STRONG> and <STRONG>use_tioctl</STRONG> routines combine as summarized
+       here:
+
+     <EM>use</EM><STRONG>_</STRONG><EM>env</EM>   <EM>use</EM><STRONG>_</STRONG><EM>tioctl</EM>   <EM>Summary</EM>
+     ----------------------------------------------------------------
+     TRUE      FALSE        This is the default  behavior.   ncurses
+                            uses operating system calls unless over-
+                            ridden by $LINES or $COLUMNS environment
+                            variables.
+     TRUE      TRUE         ncurses   updates  $LINES  and  $COLUMNS
+                            based on operating system calls.
+
+     FALSE     TRUE         ncurses ignores $LINES and $COLUMNS, us-
+                            es  operating  system  calls  to  obtain
+                            size.
+     FALSE     FALSE        ncurses relies on the terminal  database
+                            to determine size.
 
        The  <STRONG>putwin</STRONG> routine writes all data associated with window
        <EM>win</EM> into the file to which <EM>filep</EM> points.  This information
@@ -241,16 +293,17 @@
        loaded when the terminal description is read  by  the  li-
        brary.
 
-       The  <STRONG>nofilter</STRONG>  routine is specific to ncurses.  It was not
-       supported on Version 7, BSD or System  V  implementations.
-       It  is  recommended that any code depending on ncurses ex-
-       tensions be conditioned using NCURSES_VERSION.
+       The  <STRONG>nofilter</STRONG>  and  <STRONG>use_tioctl</STRONG>  routines  are  specific to
+       ncurses.  They were not supported on  Version  7,  BSD  or
+       System V implementations.  It is recommended that any code
+       depending  on  ncurses  extensions  be  conditioned  using
+       NCURSES_VERSION.
 
 
 </PRE>
 <H2>SEE ALSO</H2><PRE>
        <STRONG><A HREF="legacy_coding.3x.html">legacy_coding(3x)</A></STRONG>, <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>, <STRONG><A HREF="curs_initscr.3x.html">curs_initscr(3x)</A></STRONG>, <STRONG>curs_ker-</STRONG>
-       <STRONG><A HREF="curs_kernel.3x.html">nel(3x)</A></STRONG>,   <STRONG><A HREF="curs_scr_dump.3x.html">curs_scr_dump(3x)</A></STRONG>,   <STRONG><A HREF="curs_variables.3x.html">curs_variables(3x)</A></STRONG>,  <STRONG>lega-</STRONG>
+       <STRONG><A HREF="curs_kernel.3x.html">nel(3x)</A></STRONG>,  <STRONG><A HREF="curs_scr_dump.3x.html">curs_scr_dump(3x)</A></STRONG>,   <STRONG><A HREF="curs_variables.3x.html">curs_variables(3x)</A></STRONG>,   <STRONG>lega-</STRONG>
        <STRONG><A HREF="legacy_coding.3x.html">cy_coding(3x)</A></STRONG>.
 
 
Index: doc/html/man/form.3x.html
--- ncurses-5.9/doc/html/man/form.3x.html	2011-04-04 22:46:40.000000000 +0000
+++ ncurses-5.9-20130504/doc/html/man/form.3x.html	2013-03-09 22:12:01.000000000 +0000
@@ -243,7 +243,7 @@
 
 </PRE>
 <H2>SEE ALSO</H2><PRE>
-       This describes <STRONG>ncurses</STRONG> version 5.9 (patch 20110404).
+       This describes <STRONG>ncurses</STRONG> version 5.9 (patch 20130309).
 
 
 
Index: doc/html/man/form_field.3x.html
--- ncurses-5.9/doc/html/man/form_field.3x.html	2011-01-09 01:03:18.000000000 +0000
+++ ncurses-5.9-20130504/doc/html/man/form_field.3x.html	2013-03-09 22:12:01.000000000 +0000
@@ -2,7 +2,7 @@
 <!-- 
   * t
   ****************************************************************************
-  * Copyright (c) 1998-2006,2010 Free Software Foundation, Inc.              *
+  * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc.              *
   *                                                                          *
   * Permission is hereby granted, free of charge, to any person obtaining a  *
   * copy of this software and associated documentation files (the            *
@@ -28,7 +28,7 @@
   * sale, use or other dealings in this Software without prior written       *
   * authorization.                                                           *
   ****************************************************************************
-  * @Id: form_field.3x,v 1.10 2010/12/04 18:40:45 tom Exp @
+  * @Id: form_field.3x,v 1.11 2012/11/03 23:03:59 tom Exp @
 -->
 <HTML>
 <HEAD>
@@ -78,7 +78,7 @@
 
 
 </PRE>
-<H2>RETURN VALUES</H2><PRE>
+<H2>RETURN VALUE</H2><PRE>
        The  function  <STRONG>form_fields</STRONG> returns a pointer (which may be
        <STRONG>NULL</STRONG>).  It does not set errno.
 
Index: doc/html/man/form_field_buffer.3x.html
--- ncurses-5.9/doc/html/man/form_field_buffer.3x.html	2011-02-25 23:25:01.000000000 +0000
+++ ncurses-5.9-20130504/doc/html/man/form_field_buffer.3x.html	2013-03-09 22:12:02.000000000 +0000
@@ -151,8 +151,8 @@
        When  configured for wide characters, <STRONG>field_buffer</STRONG> returns
        a pointer to temporary storage (allocated and freed by the
        library).   The  application  should not attempt to modify
-       the  data.   It  will  be  freed  on  the  next  call   to
-       <STRONG>field_buffer</STRONG> to return the same buffer.  <STRONG>&lt;curses.h&gt;</STRONG>.
+       the data.  It will be freed on the next call to <STRONG>field_buf-</STRONG>
+       <STRONG>fer</STRONG> to return the same buffer.  <STRONG>&lt;curses.h&gt;</STRONG>.
 
 
 </PRE>
Index: doc/html/man/form_fieldtype.3x.html
--- ncurses-5.9/doc/html/man/form_fieldtype.3x.html	2011-02-25 23:25:02.000000000 +0000
+++ ncurses-5.9-20130504/doc/html/man/form_fieldtype.3x.html	2013-03-09 22:12:02.000000000 +0000
@@ -112,8 +112,8 @@
        <STRONG>REQ_PREV_CHOICE</STRONG> assume that the possible values of a field
        form an ordered set, and provide the forms user with a way
        to  move  through the set.  The <STRONG>set_fieldtype_choice</STRONG> func-
-       tion allows forms  programmers  to  define  successor  and
-       predecessor functions for the field type.  These functions
+       tion allows forms programmers to define successor and pre-
+       decessor  functions  for  the field type.  These functions
        take the field pointer and an argument-block structure  as
        arguments.
 
Index: doc/html/man/infocmp.1m.html
--- ncurses-5.9/doc/html/man/infocmp.1m.html	2011-04-04 22:46:44.000000000 +0000
+++ ncurses-5.9-20130504/doc/html/man/infocmp.1m.html	2013-03-09 22:12:03.000000000 +0000
@@ -2,7 +2,7 @@
 <!-- 
   * t
   ****************************************************************************
-  * Copyright (c) 1998-2006,2010 Free Software Foundation, Inc.              *
+  * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc.              *
   *                                                                          *
   * Permission is hereby granted, free of charge, to any person obtaining a  *
   * copy of this software and associated documentation files (the            *
@@ -28,7 +28,7 @@
   * sale, use or other dealings in this Software without prior written       *
   * authorization.                                                           *
   ****************************************************************************
-  * @Id: infocmp.1m,v 1.46 2010/12/04 18:40:45 tom Exp @
+  * @Id: infocmp.1m,v 1.53 2013/02/02 22:07:35 tom Exp @
 -->
 <HTML>
 <HEAD>
@@ -53,7 +53,7 @@
 
 </PRE>
 <H2>SYNOPSIS</H2><PRE>
-       <STRONG>infocmp</STRONG> [<STRONG>-1CEFGILTUVcdegilnpqrtux</STRONG>]
+       <STRONG>infocmp</STRONG> [<STRONG>-1CDEFGIKLTUVcdegilnpqrtux</STRONG>]
              [<STRONG>-v</STRONG> <EM>n</EM>] [<STRONG>-s</STRONG> <STRONG>d</STRONG>| <STRONG>i</STRONG>| <STRONG>l</STRONG>| <STRONG>c</STRONG>] [<STRONG>-R</STRONG> <STRONG>subset</STRONG>]
              [<STRONG>-w</STRONG> <EM>width</EM>] [<STRONG>-A</STRONG> <EM>directory</EM>] [<STRONG>-B</STRONG> <EM>directory</EM>]
              [<EM>termname</EM>...]
@@ -72,76 +72,91 @@
    <STRONG>Default</STRONG> <STRONG>Options</STRONG>
        If  no options are specified and zero or one <EM>termnames</EM> are
        specified, the <STRONG>-I</STRONG> option will be assumed.   If  more  than
-       one  <EM>termname</EM> is specified, the <STRONG>-d</STRONG> option will be assumed.
+       one <EM>termname</EM> is specified, the <STRONG>-d</STRONG> option will be assumed.
 
    <STRONG>Comparison</STRONG> <STRONG>Options</STRONG> <STRONG>[-d]</STRONG> <STRONG>[-c]</STRONG> <STRONG>[-n]</STRONG>
-       <STRONG>infocmp</STRONG> compares the <STRONG>terminfo</STRONG>  description  of  the  first
-       terminal  <EM>termname</EM>  with each of the descriptions given by
-       the entries for the  other  terminal's  <EM>termnames</EM>.   If  a
-       capability  is  defined for only one of the terminals, the
-       value returned will depend on the type of the  capability:
-       <STRONG>F</STRONG>  for  boolean  variables,  <STRONG>-1</STRONG> for integer variables, and
+       <STRONG>infocmp</STRONG>  compares  the  <STRONG>terminfo</STRONG>  description of the first
+       terminal <EM>termname</EM> with each of the descriptions  given  by
+       the  entries  for  the  other  terminal's <EM>termnames</EM>.  If a
+       capability is defined for only one of the  terminals,  the
+       value  returned will depend on the type of the capability:
+       <STRONG>F</STRONG> for boolean variables, <STRONG>-1</STRONG>  for  integer  variables,  and
        <STRONG>NULL</STRONG> for string variables.
 
-       The <STRONG>-d</STRONG> option produces a list of each capability  that  is
-       different  between  two entries.  This option is useful to
-       show the difference between two entries, created  by  dif-
+       The  <STRONG>-d</STRONG>  option produces a list of each capability that is
+       different between two entries.  This option is  useful  to
+       show  the  difference between two entries, created by dif-
        ferent people, for the same or similar terminals.
 
-       The  <STRONG>-c</STRONG>  option produces a list of each capability that is
-       common between two entries.  Capabilities that are not set
-       are  ignored.  This option can be used as a quick check to
-       see if the <STRONG>-u</STRONG> option is worth using.
-
-       The <STRONG>-n</STRONG> option produces a list of each capability  that  is
-       in neither entry.  If no <EM>termnames</EM> are given, the environ-
-       ment variable <STRONG>TERM</STRONG> will be used for both of the <EM>termnames</EM>.
-       This  can  be used as a quick check to see if anything was
-       left out of a description.
+       The <STRONG>-c</STRONG> option produces a list of each capability  that  is
+       common between two or more entries.  Capabilities that are
+       not set are ignored.  This option can be used as  a  quick
+       check to see if the <STRONG>-u</STRONG> option is worth using.
+
+       The  <STRONG>-n</STRONG>  option produces a list of each capability that is
+       in none of the given entries.  If no <EM>termnames</EM> are  given,
+       the environment variable <STRONG>TERM</STRONG> will be used for both of the
+       <EM>termnames</EM>.  This can be used as a quick check  to  see  if
+       anything was left out of a description.
 
    <STRONG>Source</STRONG> <STRONG>Listing</STRONG> <STRONG>Options</STRONG> <STRONG>[-I]</STRONG> <STRONG>[-L]</STRONG> <STRONG>[-C]</STRONG> <STRONG>[-r]</STRONG>
-       The <STRONG>-I</STRONG>, <STRONG>-L</STRONG>, and <STRONG>-C</STRONG> options will produce a  source  listing
+       The  <STRONG>-I</STRONG>,  <STRONG>-L</STRONG>, and <STRONG>-C</STRONG> options will produce a source listing
        for each terminal named.
 
       <STRONG>-I</STRONG>   use the <STRONG>terminfo</STRONG> names
       <STRONG>-L</STRONG>   use the long C variable name listed in &lt;<STRONG>term.h</STRONG>&gt;
       <STRONG>-C</STRONG>   use the <STRONG>termcap</STRONG> names
       <STRONG>-r</STRONG>   when using <STRONG>-C</STRONG>, put out all capabilities in <STRONG>termcap</STRONG> form
+      <STRONG>-K</STRONG>   modifies the <STRONG>-C</STRONG> option, improving BSD-compatibility.
 
-       If  no  <EM>termnames</EM> are given, the environment variable <STRONG>TERM</STRONG>
+       If no <EM>termnames</EM> are given, the environment  variable  <STRONG>TERM</STRONG>
        will be used for the terminal name.
 
-       The source produced by the <STRONG>-C</STRONG> option may be used  directly
-       as  a <STRONG>termcap</STRONG> entry, but not all parameterized strings can
+       The  source produced by the <STRONG>-C</STRONG> option may be used directly
+       as a <STRONG>termcap</STRONG> entry, but not all parameterized strings  can
        be changed to the <STRONG>termcap</STRONG> format.  <STRONG>infocmp</STRONG> will attempt to
-       convert  most  of  the parameterized information, and any-
-       thing not converted will be plainly marked in  the  output
+       convert most of the parameterized  information,  and  any-
+       thing  not  converted will be plainly marked in the output
        and commented out.  These should be edited by hand.
 
-       All  padding  information  for  strings  will be collected
-       together and placed at the beginning of the  string  where
-       <STRONG>termcap</STRONG>  expects  it.  Mandatory padding (padding informa-
+       For best results when converting to  <STRONG>termcap</STRONG>  format,  you
+       should use both <STRONG>-C</STRONG> and <STRONG>-r</STRONG>.  Normally a termcap description
+       is limited to 1023 bytes.  infocmp trims away less  essen-
+       tial  parts  to make it fit.  If you are converting to one
+       of the (rare)  termcap  implementations  which  accept  an
+       unlimited  size  of  termcap,  you  may want to add the <STRONG>-T</STRONG>
+       option.  More often however, you  must  help  the  termcap
+       implementation,  and  trim  excess  whitespace (use the <STRONG>-0</STRONG>
+       option for that).
+
+       All padding information  for  strings  will  be  collected
+       together  and  placed at the beginning of the string where
+       <STRONG>termcap</STRONG> expects it.  Mandatory padding  (padding  informa-
        tion with a trailing '/') will become optional.
 
        All <STRONG>termcap</STRONG> variables no longer supported by <STRONG>terminfo</STRONG>, but
        which are derivable from other <STRONG>terminfo</STRONG> variables, will be
        output.  Not all <STRONG>terminfo</STRONG> capabilities will be translated;
-       only  those variables which were part of <STRONG>termcap</STRONG> will nor-
-       mally be output.  Specifying the <STRONG>-r</STRONG> option will  take  off
-       this  restriction,  allowing all capabilities to be output
-       in <EM>termcap</EM> form.
+       only those variables which were part of <STRONG>termcap</STRONG> will  nor-
+       mally  be  output.  Specifying the <STRONG>-r</STRONG> option will take off
+       this restriction, allowing all capabilities to  be  output
+       in  <EM>termcap</EM>  form.  Normally you would use both the <STRONG>-C</STRONG> and
+       <STRONG>-r</STRONG> options.  The  actual  format  used  incorporates  some
+       improvements  for escaped characters from terminfo format.
+       For a stricter  BSD-compatible  translation,  use  the  <STRONG>-K</STRONG>
+       option rather than <STRONG>-C</STRONG>.
 
        Note that because padding is collected to the beginning of
-       the  capability,  not all capabilities are output.  Manda-
-       tory padding is not supported.   Because  <STRONG>termcap</STRONG>  strings
-       are  not as flexible, it is not always possible to convert
-       a <STRONG>terminfo</STRONG> string capability into  an  equivalent  <STRONG>termcap</STRONG>
-       format.   A subsequent conversion of the <STRONG>termcap</STRONG> file back
-       into <STRONG>terminfo</STRONG> format will not  necessarily  reproduce  the
+       the capability, not all capabilities are  output.   Manda-
+       tory  padding  is  not supported.  Because <STRONG>termcap</STRONG> strings
+       are not as flexible, it is not always possible to  convert
+       a  <STRONG>terminfo</STRONG>  string  capability into an equivalent <STRONG>termcap</STRONG>
+       format.  A subsequent conversion of the <STRONG>termcap</STRONG> file  back
+       into  <STRONG>terminfo</STRONG>  format  will not necessarily reproduce the
        original <STRONG>terminfo</STRONG> source.
 
-       Some  common  <STRONG>terminfo</STRONG>  parameter sequences, their <STRONG>termcap</STRONG>
-       equivalents, and some terminal types which  commonly  have
+       Some common <STRONG>terminfo</STRONG> parameter  sequences,  their  <STRONG>termcap</STRONG>
+       equivalents,  and  some terminal types which commonly have
        such sequences, are:
 
      <STRONG>terminfo</STRONG>                    <STRONG>termcap</STRONG>   Representative Terminals
@@ -154,66 +169,77 @@
      <STRONG>%p2</STRONG> is printed before <STRONG>%p1</STRONG>   <STRONG>%r</STRONG>        hp
 
    <STRONG>Use=</STRONG> <STRONG>Option</STRONG> <STRONG>[-u]</STRONG>
-       The  <STRONG>-u</STRONG>  option  produces a <STRONG>terminfo</STRONG> source description of
-       the first terminal <EM>termname</EM> which is relative to  the  sum
-       of  the  descriptions  given  by the entries for the other
-       terminals <EM>termnames</EM>.  It does this by analyzing  the  dif-
-       ferences   between   the  first  <EM>termname</EM>  and  the  other
+       The <STRONG>-u</STRONG> option produces a <STRONG>terminfo</STRONG>  source  description  of
+       the  first  terminal <EM>termname</EM> which is relative to the sum
+       of the descriptions given by the  entries  for  the  other
+       terminals  <EM>termnames</EM>.   It does this by analyzing the dif-
+       ferences  between  the  first  <EM>termname</EM>  and   the   other
        <EM>termnames</EM> and producing a description with <STRONG>use=</STRONG> fields for
-       the  other  terminals.   In this manner, it is possible to
-       retrofit  generic  terminfo  entries  into  a   terminal's
+       the other terminals.  In this manner, it  is  possible  to
+       retrofit   generic  terminfo  entries  into  a  terminal's
        description.  Or, if two similar terminals exist, but were
-       coded at different times or by different  people  so  that
+       coded  at  different  times or by different people so that
        each description is a full description, using <STRONG>infocmp</STRONG> will
        show what can be done to change one description to be rel-
        ative to the other.
 
        A capability will get printed with an at-sign (@) if it no
-       longer exists in the first <EM>termname</EM>, but one of the  other
-       <EM>termname</EM>  entries contains a value for it.  A capability's
-       value gets printed if the value in the first  <EM>termname</EM>  is
-       not  found in any of the other <EM>termname</EM> entries, or if the
+       longer  exists in the first <EM>termname</EM>, but one of the other
+       <EM>termname</EM> entries contains a value for it.  A  capability's
+       value  gets  printed if the value in the first <EM>termname</EM> is
+       not found in any of the other <EM>termname</EM> entries, or if  the
        first of the other <EM>termname</EM> entries that has this capabil-
-       ity  gives  a different value for the capability than that
+       ity gives a different value for the capability  than  that
        in the first <EM>termname</EM>.
 
-       The order of the other <EM>termname</EM>  entries  is  significant.
-       Since  the terminfo compiler <STRONG>tic</STRONG> does a left-to-right scan
+       The  order  of  the other <EM>termname</EM> entries is significant.
+       Since the terminfo compiler <STRONG>tic</STRONG> does a left-to-right  scan
        of the capabilities, specifying two <STRONG>use=</STRONG> entries that con-
        tain differing entries for the same capabilities will pro-
-       duce different results depending on  the  order  that  the
-       entries  are  given in.  <STRONG>infocmp</STRONG> will flag any such incon-
-       sistencies between the other <EM>termname</EM> entries as they  are
+       duce  different  results  depending  on the order that the
+       entries are given in.  <STRONG>infocmp</STRONG> will flag any  such  incon-
+       sistencies  between the other <EM>termname</EM> entries as they are
        found.
 
-       Alternatively,  specifying a capability <EM>after</EM> a <STRONG>use=</STRONG> entry
+       Alternatively, specifying a capability <EM>after</EM> a <STRONG>use=</STRONG>  entry
        that contains that capability will cause the second speci-
-       fication  to  be  ignored.   Using  <STRONG>infocmp</STRONG>  to recreate a
+       fication to be  ignored.   Using  <STRONG>infocmp</STRONG>  to  recreate  a
        description can be a useful check to make sure that every-
-       thing  was  specified  correctly  in  the  original source
+       thing was  specified  correctly  in  the  original  source
        description.
 
-       Another error  that  does  not  cause  incorrect  compiled
-       files,  but will slow down the compilation time, is speci-
-       fying extra <STRONG>use=</STRONG> fields  that  are  superfluous.   <STRONG>infocmp</STRONG>
-       will  flag  any  other  <EM>termname</EM> <EM>use=</EM> fields that were not
+       Another  error  that  does  not  cause  incorrect compiled
+       files, but will slow down the compilation time, is  speci-
+       fying  extra  <STRONG>use=</STRONG>  fields  that are superfluous.  <STRONG>infocmp</STRONG>
+       will flag any other <EM>termname</EM> <EM>use=</EM>  fields  that  were  not
        needed.
 
    <STRONG>Changing</STRONG> <STRONG>Databases</STRONG> <STRONG>[-A</STRONG> <EM>directory</EM>] [-B <EM>directory</EM>]
-       The location of the compiled <STRONG>terminfo</STRONG>  database  is  taken
-       from  the environment variable <STRONG>TERMINFO</STRONG> .  If the variable
-       is not defined, or the terminal is not found in that loca-
-       tion,  the  system  <STRONG>terminfo</STRONG>  database, in <STRONG>/usr/share/ter-</STRONG>
-       <STRONG>minfo</STRONG>, will be used.  The options <STRONG>-A</STRONG> and <STRONG>-B</STRONG> may be used to
-       override  this  location.  The <STRONG>-A</STRONG> option will set <STRONG>TERMINFO</STRONG>
-       for the first <EM>termname</EM> and the <STRONG>-B</STRONG> option will set <STRONG>TERMINFO</STRONG>
-       for  the  other  <EM>termnames</EM>.   With this, it is possible to
-       compare descriptions for a terminal  with  the  same  name
-       located  in  two  different databases.  This is useful for
-       comparing descriptions for the same  terminal  created  by
-       different people.
+       Like other <STRONG>ncurses</STRONG> utilities, infocmp looks for the termi-
+       nal descriptions in several places.  You can use the  <STRONG>TER-</STRONG>
+       <STRONG>MINFO</STRONG>  and <STRONG>TERMINFO_DIRS</STRONG> environment variables to override
+       the compiled-in default list  of  places  to  search  (see
+       <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG> for details).
+
+       You  can  also  use  the options <STRONG>-A</STRONG> and <STRONG>-B</STRONG> to override the
+       list of places to search when comparing terminal  descrip-
+       tions:
+
+       <STRONG>o</STRONG>   The <STRONG>-A</STRONG> option sets the location for the first <EM>termname</EM>
+
+       <STRONG>o</STRONG>   The   <STRONG>-B</STRONG>  option  sets  the  location  for  the  other
+           <EM>termnames</EM>.
+
+       Using these options, it is possible  to  compare  descrip-
+       tions  for  a  terminal  with the same name located in two
+       different databases.  For instance, you can use this  fea-
+       ture for comparing descriptions for the same terminal cre-
+       ated by different people.
 
    <STRONG>Other</STRONG> <STRONG>Options</STRONG>
+       <STRONG>-0</STRONG>   causes the fields to be printed on one line,  without
+            wrapping.
+
        <STRONG>-1</STRONG>   causes  the  fields  to be printed out one to a line.
             Otherwise, the fields will be printed  several  to  a
             line to a maximum width of 60 characters.
@@ -222,67 +248,71 @@
             rather than discarding them.  Capabilities  are  com-
             mented by prefixing them with a period.
 
+       <STRONG>-D</STRONG>   tells <STRONG>infocmp</STRONG> to print the database locations that it
+            knows about, and exit.
+
        <STRONG>-E</STRONG>   Dump  the  capabilities  of  the  given  terminal  as
-            tables, needed in the C initializer  for  a  TERMTYPE
-            structure  (the  terminal capability structure in the
-            <STRONG>&lt;term.h&gt;</STRONG>).  This option is useful for preparing  ver-
-            sions  of  the  curses  library hardwired for a given
-            terminal type.  The tables are all  declared  static,
-            and  are  named according to the type and the name of
+            tables,  needed  in  the C initializer for a TERMTYPE
+            structure (the terminal capability structure  in  the
+            <STRONG>&lt;term.h&gt;</STRONG>).   This option is useful for preparing ver-
+            sions of the curses library  hardwired  for  a  given
+            terminal  type.   The tables are all declared static,
+            and are named according to the type and the  name  of
             the corresponding terminal entry.
 
-            Before ncurses 5.0, the split between the <STRONG>-e</STRONG>  and  <STRONG>-E</STRONG>
-            options  was  not  needed;  but  support for extended
+            Before  ncurses  5.0, the split between the <STRONG>-e</STRONG> and <STRONG>-E</STRONG>
+            options was not  needed;  but  support  for  extended
             names required making the arrays of terminal capabil-
             ities separate from the TERMTYPE structure.
 
-       <STRONG>-e</STRONG>   Dump  the  capabilities  of the given terminal as a C
-            initializer for a TERMTYPE  structure  (the  terminal
-            capability  structure  in the <STRONG>&lt;term.h&gt;</STRONG>).  This option
+       <STRONG>-e</STRONG>   Dump the capabilities of the given terminal  as  a  C
+            initializer  for  a  TERMTYPE structure (the terminal
+            capability structure in the <STRONG>&lt;term.h&gt;</STRONG>).   This  option
             is  useful  for  preparing  versions  of  the  curses
             library hardwired for a given terminal type.
 
-       <STRONG>-F</STRONG>   compare  terminfo  files.  This assumes that two fol-
-            lowing  arguments  are  filenames.   The  files   are
-            searched  for  pairwise matches between entries, with
+       <STRONG>-F</STRONG>   compare terminfo files.  This assumes that  two  fol-
+            lowing   arguments  are  filenames.   The  files  are
+            searched for pairwise matches between  entries,  with
             two entries considered to match if any of their names
-            do.   The  report  printed  to  standard output lists
-            entries with  no  matches  in  the  other  file,  and
-            entries  with  more than one match.  For entries with
-            exactly one match it includes  a  difference  report.
-            Normally,  to  reduce  the  volume of the report, use
-            references are not resolved before looking  for  dif-
+            do.  The report  printed  to  standard  output  lists
+            entries  with  no  matches  in  the  other  file, and
+            entries with more than one match.  For  entries  with
+            exactly  one  match  it includes a difference report.
+            Normally, to reduce the volume  of  the  report,  use
+            references  are  not resolved before looking for dif-
             ferences, but resolution can be forced by also speci-
             fying <STRONG>-r</STRONG>.
 
-       <STRONG>-f</STRONG>   Display  complex  terminfo  strings   which   contain
+       <STRONG>-f</STRONG>   Display   complex   terminfo  strings  which  contain
             if/then/else/endif expressions indented for readabil-
             ity.
 
        <STRONG>-G</STRONG>   Display constant literals in decimal form rather than
             their character equivalents.
 
-       <STRONG>-g</STRONG>   Display  constant  character  literals in quoted form
+       <STRONG>-g</STRONG>   Display constant character literals  in  quoted  form
             rather than their decimal equivalents.
 
        <STRONG>-i</STRONG>   Analyze the initialization (<STRONG>is1</STRONG>, <STRONG>is2</STRONG>, <STRONG>is3</STRONG>), and reset
-            (<STRONG>rs1</STRONG>,  <STRONG>rs2</STRONG>,  <STRONG>rs3</STRONG>),  strings  in  the entry.  For each
-            string, the code tries to analyze it into actions  in
+            (<STRONG>rs1</STRONG>, <STRONG>rs2</STRONG>, <STRONG>rs3</STRONG>), strings  in  the  entry.   For  each
+            string,  the code tries to analyze it into actions in
             terms of the other capabilities in the entry, certain
-            X3.64/ISO 6429/ECMA-48 capabilities, and certain  DEC
-            VT-series  private  modes (the set of recognized spe-
-            cial sequences has  been  selected  for  completeness
-            over  the  existing  terminfo database).  Each report
-            line consists of the capability name, followed  by  a
+            X3.64/ISO  6429/ECMA-48 capabilities, and certain DEC
+            VT-series private modes (the set of  recognized  spe-
+            cial  sequences  has  been  selected for completeness
+            over the existing terminfo  database).   Each  report
+            line  consists  of the capability name, followed by a
             colon and space, followed by a printable expansion of
-            the capability string with sections  matching  recog-
-            nized  actions  translated into {}-bracketed descrip-
-            tions.  Here  is  a  list  of  the  DEC/ANSI  special
+            the  capability  string with sections matching recog-
+            nized actions translated into  {}-bracketed  descrip-
+            tions.   Here  is  a  list  of  the  DEC/ANSI special
             sequences recognized: i.
 
                   Action        Meaning
                   -----------------------------------------
                   RIS           full reset
+
                   SC            save cursor
                   RC            restore cursor
                   LL            home-down
@@ -310,17 +340,16 @@
                   DEC[+-]CKM    application cursor keys
                   DEC[+-]ANM    set VT52 mode
                   DEC[+-]COLM   132-column mode
-
                   DEC[+-]SCLM   smooth scroll
                   DEC[+-]SCNM   reverse video mode
                   DEC[+-]OM     origin mode
                   DEC[+-]AWM    wraparound mode
                   DEC[+-]ARM    auto-repeat mode
 
-            It  also  recognizes  a  SGR  action corresponding to
-            ANSI/ISO 6429/ECMA Set Graphics Rendition,  with  the
-            values  NORMAL,  BOLD, UNDERLINE, BLINK, and REVERSE.
-            All but NORMAL may be prefixed with `+' (turn on)  or
+            It also recognizes  a  SGR  action  corresponding  to
+            ANSI/ISO  6429/ECMA  Set Graphics Rendition, with the
+            values NORMAL, BOLD, UNDERLINE, BLINK,  and  REVERSE.
+            All  but NORMAL may be prefixed with `+' (turn on) or
             `-' (turn off).
 
        An SGR0 designates an empty highlight sequence (equivalent
@@ -398,18 +427,19 @@
 
 </PRE>
 <H2>FILES</H2><PRE>
-       /usr/share/terminfo Compiled      terminal     description
-                           database.
+       /usr/share/terminfo Compiled  terminal  description  data-
+                           base.
 
 
 </PRE>
 <H2>EXTENSIONS</H2><PRE>
-       The <STRONG>-E</STRONG>, <STRONG>-F</STRONG>, <STRONG>-G</STRONG>, <STRONG>-R</STRONG>, <STRONG>-T</STRONG>, <STRONG>-V</STRONG>, <STRONG>-a</STRONG>, <STRONG>-e</STRONG>, <STRONG>-f</STRONG>, <STRONG>-g</STRONG>, <STRONG>-i</STRONG>, <STRONG>-l</STRONG>, <STRONG>-p</STRONG>, <STRONG>-q</STRONG>
-       and <STRONG>-t</STRONG> options are not supported in SVr4 curses.
+       The <STRONG>-0</STRONG>, <STRONG>-1</STRONG>, <STRONG>-E</STRONG>, <STRONG>-F</STRONG>, <STRONG>-G</STRONG>, <STRONG>-R</STRONG>, <STRONG>-T</STRONG>, <STRONG>-V</STRONG>, <STRONG>-a</STRONG>, <STRONG>-e</STRONG>,  <STRONG>-f</STRONG>,  <STRONG>-g</STRONG>,  <STRONG>-i</STRONG>,
+       <STRONG>-l</STRONG>,  <STRONG>-p</STRONG>,  <STRONG>-q</STRONG>  and  <STRONG>-t</STRONG>  options  are  not supported in SVr4
+       curses.
 
        The <STRONG>-r</STRONG> option's notion of `termcap' capabilities is System
-       V Release 4's.  Actual BSD curses  versions  will  have  a
-       more  restricted  set.  To see only the 4.4BSD set, use <STRONG>-r</STRONG>
+       V  Release  4's.   Actual  BSD curses versions will have a
+       more restricted set.  To see only the 4.4BSD set,  use  <STRONG>-r</STRONG>
        <STRONG>-RBSD</STRONG>.
 
 
@@ -420,10 +450,12 @@
 
 </PRE>
 <H2>SEE ALSO</H2><PRE>
-       <STRONG><A HREF="captoinfo.1m.html">captoinfo(1m)</A></STRONG>,    <STRONG><A HREF="infotocap.1m.html">infotocap(1m)</A></STRONG>,     <STRONG><A HREF="tic.1m.html">tic(1m)</A></STRONG>,     <STRONG><A HREF="toe.1m.html">toe(1m)</A></STRONG>,
+       <STRONG><A HREF="captoinfo.1m.html">captoinfo(1m)</A></STRONG>,     <STRONG><A HREF="infotocap.1m.html">infotocap(1m)</A></STRONG>,     <STRONG><A HREF="tic.1m.html">tic(1m)</A></STRONG>,    <STRONG><A HREF="toe.1m.html">toe(1m)</A></STRONG>,
        <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>, <STRONG><A HREF="terminfo.5.html">terminfo(5)</A></STRONG>.
 
-       This describes <STRONG>ncurses</STRONG> version 5.9 (patch 20110404).
+       http://invisible-island.net/ncurses/tctest.html
+
+       This describes <STRONG>ncurses</STRONG> version 5.9 (patch 20130309).
 
 
 </PRE>
Index: doc/html/man/infotocap.1m.html
--- ncurses-5.9/doc/html/man/infotocap.1m.html	2011-04-04 22:46:44.000000000 +0000
+++ ncurses-5.9-20130504/doc/html/man/infotocap.1m.html	2013-03-09 22:12:03.000000000 +0000
@@ -80,8 +80,8 @@
 
 </PRE>
 <H2>FILES</H2><PRE>
-       /usr/share/terminfo Compiled     terminal      description
-                           database.
+       /usr/share/terminfo Compiled  terminal  description  data-
+                           base.
 
 
 </PRE>
@@ -94,7 +94,7 @@
 <H2>SEE ALSO</H2><PRE>
        <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>, <STRONG><A HREF="tic.1m.html">tic(1m)</A></STRONG>, <STRONG><A HREF="infocmp.1m.html">infocmp(1m)</A></STRONG>, <STRONG><A HREF="terminfo.5.html">terminfo(5)</A></STRONG>
 
-       This describes <STRONG>ncurses</STRONG> version 5.9 (patch 20110404).
+       This describes <STRONG>ncurses</STRONG> version 5.9 (patch 20130309).
 
 
 </PRE>
Index: doc/html/man/menu.3x.html
--- ncurses-5.9/doc/html/man/menu.3x.html	2011-04-04 22:46:45.000000000 +0000
+++ ncurses-5.9-20130504/doc/html/man/menu.3x.html	2013-03-09 22:12:03.000000000 +0000
@@ -226,7 +226,7 @@
 
 </PRE>
 <H2>SEE ALSO</H2><PRE>
-       This describes <STRONG>ncurses</STRONG> version 5.9 (patch 20110404).
+       This describes <STRONG>ncurses</STRONG> version 5.9 (patch 20130309).
 
 
 
Index: doc/html/man/menu_driver.3x.html
--- ncurses-5.9/doc/html/man/menu_driver.3x.html	2011-02-25 23:25:05.000000000 +0000
+++ ncurses-5.9-20130504/doc/html/man/menu_driver.3x.html	2013-03-09 22:12:03.000000000 +0000
@@ -119,8 +119,8 @@
             Clear the menu pattern buffer.
 
        REQ_BACK_PATTERN
-            Delete   the  previous  character  from  the  pattern
-            buffer.
+            Delete  the  previous character from the pattern buf-
+            fer.
 
        REQ_NEXT_MATCH
             Move to the next item matching the pattern match.
@@ -128,20 +128,20 @@
        REQ_PREV_MATCH
             Move to the previous item matching the pattern match.
 
-       If  the second argument is a printable character, the code
-       appends it to the pattern buffer and attempts to  move  to
-       the  next  item  matching the new pattern.  If there is no
+       If the second argument is a printable character, the  code
+       appends  it  to the pattern buffer and attempts to move to
+       the next item matching the new pattern.  If  there  is  no
        such match, <STRONG>menu_driver</STRONG> returns <STRONG>E_NO_MATCH</STRONG> and deletes the
        appended character from the buffer.
 
-       If  the  second  argument  is one of the above pre-defined
+       If the second argument is one  of  the  above  pre-defined
        requests, the corresponding action is performed.
 
    <STRONG>MOUSE</STRONG> <STRONG>HANDLING</STRONG>
-       If the second argument is the KEY_MOUSE special  key,  the
+       If  the  second argument is the KEY_MOUSE special key, the
        associated mouse event is translated into one of the above
-       pre-defined requests.  Currently only clicks in  the  user
-       window  (e.g., inside the menu display area or the decora-
+       pre-defined  requests.   Currently only clicks in the user
+       window (e.g., inside the menu display area or the  decora-
        tion window) are handled.
 
        If you click above the display region of the menu:
@@ -160,32 +160,32 @@
 
        <STRONG>o</STRONG>   a REQ_LAST_ITEM is generated for a triple-click.
 
-       If you click at an item inside the  display  area  of  the
+       If  you  click  at  an item inside the display area of the
        menu:
 
        <STRONG>o</STRONG>   the menu cursor is positioned to that item.
 
-       <STRONG>o</STRONG>   If  you double-click an item a REQ_TOGGLE_ITEM is gen-
+       <STRONG>o</STRONG>   If you double-click an item a REQ_TOGGLE_ITEM is  gen-
            erated and <STRONG>E_UNKNOWN_COMMAND</STRONG> is returned.  This return
-           value  makes  sense,  because  a  double click usually
+           value makes sense,  because  a  double  click  usually
            means that an item-specific action should be returned.
            It is exactly the purpose of this return value to sig-
-           nal that an application  specific  command  should  be
+           nal  that  an  application  specific command should be
            executed.
 
-       <STRONG>o</STRONG>   If  a translation into a request was done, <STRONG>menu_driver</STRONG>
+       <STRONG>o</STRONG>   If a translation into a request was done,  <STRONG>menu_driver</STRONG>
            returns the result of this request.
 
-       If you clicked outside the user window or the mouse  event
-       could   not   be   translated   into  a  menu  request  an
+       If  you clicked outside the user window or the mouse event
+       could  not  be  translated  into   a   menu   request   an
        <STRONG>E_REQUEST_DENIED</STRONG> is returned.
 
    <STRONG>APPLICATION-DEFINED</STRONG> <STRONG>COMMANDS</STRONG>
        If the second argument is neither printable nor one of the
-       above  pre-defined  menu  requests or KEY_MOUSE, the drive
-       assumes it is an application-specific command and  returns
+       above pre-defined menu requests or  KEY_MOUSE,  the  drive
+       assumes  it is an application-specific command and returns
        <STRONG>E_UNKNOWN_COMMAND</STRONG>.  Application-defined commands should be
-       defined relative to  <STRONG>MAX_COMMAND</STRONG>,  the  maximum  value  of
+       defined  relative  to  <STRONG>MAX_COMMAND</STRONG>,  the  maximum value of
        these pre-defined requests.
 
 
@@ -199,7 +199,7 @@
             System error occurred (see <STRONG>errno</STRONG>).
 
        <STRONG>E_BAD_ARGUMENT</STRONG>
-            Routine  detected  an incorrect or out-of-range argu-
+            Routine detected an incorrect or  out-of-range  argu-
             ment.
 
        <STRONG>E_BAD_STATE</STRONG>
@@ -232,14 +232,14 @@
 
 </PRE>
 <H2>PORTABILITY</H2><PRE>
-       These routines emulate the System V  menu  library.   They
-       were  not supported on Version 7 or BSD versions. The sup-
+       These  routines  emulate  the System V menu library.  They
+       were not supported on Version 7 or BSD versions. The  sup-
        port for mouse events is ncurses specific.
 
 
 </PRE>
 <H2>AUTHORS</H2><PRE>
-       Juergen Pfeifer.  Manual  pages  and  adaptation  for  new
+       Juergen  Pfeifer.   Manual  pages  and  adaptation for new
        curses by Eric S. Raymond.
 
 
Index: doc/html/man/menu_items.3x.html
--- ncurses-5.9/doc/html/man/menu_items.3x.html	2011-01-09 01:03:24.000000000 +0000
+++ ncurses-5.9-20130504/doc/html/man/menu_items.3x.html	2013-03-09 22:12:03.000000000 +0000
@@ -2,7 +2,7 @@
 <!-- 
   * t
   ****************************************************************************
-  * Copyright (c) 1998-2006,2010 Free Software Foundation, Inc.              *
+  * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc.              *
   *                                                                          *
   * Permission is hereby granted, free of charge, to any person obtaining a  *
   * copy of this software and associated documentation files (the            *
@@ -28,7 +28,7 @@
   * sale, use or other dealings in this Software without prior written       *
   * authorization.                                                           *
   ****************************************************************************
-  * @Id: menu_items.3x,v 1.9 2010/12/04 18:40:45 tom Exp @
+  * @Id: menu_items.3x,v 1.10 2012/11/03 23:03:59 tom Exp @
 -->
 <HTML>
 <HEAD>
@@ -74,7 +74,7 @@
 
 
 </PRE>
-<H2>RETURN VALUES</H2><PRE>
+<H2>RETURN VALUE</H2><PRE>
        The function <STRONG>menu_items</STRONG> returns a pointer  (which  may  be
        <STRONG>NULL</STRONG>).  It does not set errno.
 
Index: doc/html/man/ncurses.3x.html
--- ncurses-5.9/doc/html/man/ncurses.3x.html	2011-04-04 22:46:49.000000000 +0000
+++ ncurses-5.9-20130504/doc/html/man/ncurses.3x.html	2013-03-09 22:12:04.000000000 +0000
@@ -2,7 +2,7 @@
 <!-- 
   * t
   ****************************************************************************
-  * Copyright (c) 1998-2010,2011 Free Software Foundation, Inc.              *
+  * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc.              *
   *                                                                          *
   * Permission is hereby granted, free of charge, to any person obtaining a  *
   * copy of this software and associated documentation files (the            *
@@ -28,7 +28,7 @@
   * sale, use or other dealings in this Software without prior written       *
   * authorization.                                                           *
   ****************************************************************************
-  * @Id: ncurses.3x,v 1.103 2011/02/05 23:21:29 tom Exp @
+  * @Id: ncurses.3x,v 1.111 2013/03/02 22:15:25 tom Exp @
 -->
 <HTML>
 <HEAD>
@@ -63,7 +63,7 @@
        sonable   optimization.    This  implementation  is  ``new
        curses'' (ncurses) and is  the  approved  replacement  for
        4.4BSD  classic curses, which has been discontinued.  This
-       describes <STRONG>ncurses</STRONG> version 5.9 (patch 20110404).
+       describes <STRONG>ncurses</STRONG> version 5.9 (patch 20130309).
 
        The <STRONG>ncurses</STRONG> library emulates the curses library of  System
        V  Release  4  UNIX,  and  XPG4 (X/Open Portability Guide)
@@ -150,48 +150,48 @@
        Among those, the most basic routines are <STRONG>move</STRONG>  and  <STRONG>addch</STRONG>.
        More  general versions of these routines are included with
        names beginning with <STRONG>w</STRONG>, allowing the  user  to  specify  a
-       window.   The routines not beginning with <STRONG>w</STRONG> affect <STRONG>stdscr</STRONG>.
+       window.  The routines not beginning with <STRONG>w</STRONG> affect <STRONG>stdscr</STRONG>.
 
-       After using routines to manipulate a  window,  <STRONG>refresh</STRONG>  is
-       called,  telling <STRONG>curses</STRONG> to make the user's CRT screen look
-       like <STRONG>stdscr</STRONG>.  The characters in a window are  actually  of
-       type  <STRONG>chtype</STRONG>, (character and attribute data) so that other
-       information about the character may also  be  stored  with
+       After  using  routines  to manipulate a window, <STRONG>refresh</STRONG> is
+       called, telling <STRONG>curses</STRONG> to make the user's CRT screen  look
+       like  <STRONG>stdscr</STRONG>.   The characters in a window are actually of
+       type <STRONG>chtype</STRONG>, (character and attribute data) so that  other
+       information  about  the  character may also be stored with
        each character.
 
-       Special  windows  called  <EM>pads</EM>  may  also  be manipulated.
+       Special windows  called  <EM>pads</EM>  may  also  be  manipulated.
        These are windows which are not constrained to the size of
-       the  screen and whose contents need not be completely dis-
+       the screen and whose contents need not be completely  dis-
        played.  See <STRONG><A HREF="curs_pad.3x.html">curs_pad(3x)</A></STRONG> for more information.
 
-       In addition to drawing characters  on  the  screen,  video
-       attributes  and colors may be supported, causing the char-
-       acters to show up in such modes as underlined, in  reverse
-       video,  or in color on terminals that support such display
+       In  addition  to  drawing  characters on the screen, video
+       attributes and colors may be supported, causing the  char-
+       acters  to show up in such modes as underlined, in reverse
+       video, or in color on terminals that support such  display
        enhancements.  Line drawing characters may be specified to
-       be  output.   On  input,  <STRONG>curses</STRONG> is also able to translate
-       arrow and function keys  that  transmit  escape  sequences
-       into  single  values.   The video attributes, line drawing
-       characters,  and  input  values  use  names,  defined   in
+       be output.  On input, <STRONG>curses</STRONG> is  also  able  to  translate
+       arrow  and  function  keys  that transmit escape sequences
+       into single values.  The video  attributes,  line  drawing
+       characters,   and  input  values  use  names,  defined  in
        <STRONG>&lt;curses.h&gt;</STRONG>, such as <STRONG>A_REVERSE</STRONG>, <STRONG>ACS_HLINE</STRONG>, and <STRONG>KEY_LEFT</STRONG>.
 
        If the environment variables <STRONG>LINES</STRONG> and <STRONG>COLUMNS</STRONG> are set, or
-       if the program is executing in a window environment,  line
-       and  column  information  in the environment will override
+       if  the program is executing in a window environment, line
+       and column information in the  environment  will  override
        information read by <EM>terminfo</EM>.  This would affect a program
-       running  in an AT&amp;T 630 layer, for example, where the size
+       running in an AT&amp;T 630 layer, for example, where the  size
        of a screen is changeable (see <STRONG>ENVIRONMENT</STRONG>).
 
-       If the environment variable <STRONG>TERMINFO</STRONG> is defined, any  pro-
-       gram  using  <STRONG>curses</STRONG> checks for a local terminal definition
-       before checking in the standard place.   For  example,  if
+       If  the environment variable <STRONG>TERMINFO</STRONG> is defined, any pro-
+       gram using <STRONG>curses</STRONG> checks for a local  terminal  definition
+       before  checking  in  the standard place.  For example, if
        <STRONG>TERM</STRONG> is set to <STRONG>att4424</STRONG>, then the compiled terminal defini-
        tion is found in
 
              <STRONG>/usr/share/terminfo/a/att4424</STRONG>.
 
        (The <STRONG>a</STRONG> is copied from the first letter of <STRONG>att4424</STRONG> to avoid
-       creation  of  huge  directories.)  However, if <STRONG>TERMINFO</STRONG> is
+       creation of huge directories.)  However,  if  <STRONG>TERMINFO</STRONG>  is
        set to <STRONG>$HOME/myterms</STRONG>, <STRONG>curses</STRONG> first checks
 
              <STRONG>$HOME/myterms/a/att4424</STRONG>,
@@ -200,119 +200,117 @@
 
              <STRONG>/usr/share/terminfo/a/att4424</STRONG>.
 
-       This is useful for developing experimental definitions  or
+       This  is useful for developing experimental definitions or
        when write permission in <STRONG>/usr/share/terminfo</STRONG> is not avail-
        able.
 
-       The integer  variables  <STRONG>LINES</STRONG>  and  <STRONG>COLS</STRONG>  are  defined  in
-       <STRONG>&lt;curses.h&gt;</STRONG>  and will be filled in by <STRONG>initscr</STRONG> with the size
+       The  integer  variables  <STRONG>LINES</STRONG>  and  <STRONG>COLS</STRONG>  are  defined in
+       <STRONG>&lt;curses.h&gt;</STRONG> and will be filled in by <STRONG>initscr</STRONG> with the  size
        of the screen.  The constants <STRONG>TRUE</STRONG> and <STRONG>FALSE</STRONG> have the val-
        ues <STRONG>1</STRONG> and <STRONG>0</STRONG>, respectively.
 
-       The  <STRONG>curses</STRONG>  routines  also  define  the <STRONG>WINDOW</STRONG> <STRONG>*</STRONG> variable
+       The <STRONG>curses</STRONG> routines also  define  the  <STRONG>WINDOW</STRONG>  <STRONG>*</STRONG>  variable
        <STRONG>curscr</STRONG> which is used for certain low-level operations like
-       clearing  and  redrawing a screen containing garbage.  The
+       clearing and redrawing a screen containing  garbage.   The
        <STRONG>curscr</STRONG> can be used in only a few routines.
 
    <STRONG>Routine</STRONG> <STRONG>and</STRONG> <STRONG>Argument</STRONG> <STRONG>Names</STRONG>
-       Many <STRONG>curses</STRONG> routines have two or more versions.  The  rou-
+       Many  <STRONG>curses</STRONG> routines have two or more versions.  The rou-
        tines prefixed with <STRONG>w</STRONG> require a window argument.  The rou-
        tines prefixed with <STRONG>p</STRONG> require a pad argument.  Those with-
        out a prefix generally use <STRONG>stdscr</STRONG>.
 
        The routines prefixed with <STRONG>mv</STRONG> require a <EM>y</EM> and <EM>x</EM> coordinate
-       to move to before performing the appropriate action.   The
-       <STRONG>mv</STRONG>  routines  imply  a call to <STRONG>move</STRONG> before the call to the
-       other routine.  The coordinate <EM>y</EM> always refers to the  row
-       (of  the  window), and <EM>x</EM> always refers to the column.  The
+       to  move to before performing the appropriate action.  The
+       <STRONG>mv</STRONG> routines imply a call to <STRONG>move</STRONG> before the  call  to  the
+       other  routine.  The coordinate <EM>y</EM> always refers to the row
+       (of the window), and <EM>x</EM> always refers to the  column.   The
        upper left-hand corner is always (0,0), not (1,1).
 
        The routines prefixed with <STRONG>mvw</STRONG> take both a window argument
-       and  <EM>x</EM>  and  <EM>y</EM> coordinates.  The window argument is always
+       and <EM>x</EM> and <EM>y</EM> coordinates.  The window  argument  is  always
        specified before the coordinates.
 
-       In each case, <EM>win</EM> is the window affected, and <EM>pad</EM>  is  the
+       In  each  case, <EM>win</EM> is the window affected, and <EM>pad</EM> is the
        pad affected; <EM>win</EM> and <EM>pad</EM> are always pointers to type <STRONG>WIN-</STRONG>
        <STRONG>DOW</STRONG>.
 
        Option setting routines require a Boolean flag <EM>bf</EM> with the
-       value  <STRONG>TRUE</STRONG>  or <STRONG>FALSE</STRONG>; <EM>bf</EM> is always of type <STRONG>bool</STRONG>.  Most of
-       the data types used in the library routines, such as  <STRONG>WIN-</STRONG>
-       <STRONG>DOW</STRONG>,  <STRONG>SCREEN</STRONG>,  <STRONG>bool</STRONG>, and <STRONG>chtype</STRONG> are defined in <STRONG>&lt;curses.h&gt;</STRONG>.
-       Types used for the terminfo routines such as <STRONG>TERMINAL</STRONG>  are
+       value <STRONG>TRUE</STRONG> or <STRONG>FALSE</STRONG>; <EM>bf</EM> is always of type <STRONG>bool</STRONG>.   Most  of
+       the  data types used in the library routines, such as <STRONG>WIN-</STRONG>
+       <STRONG>DOW</STRONG>, <STRONG>SCREEN</STRONG>, <STRONG>bool</STRONG>, and <STRONG>chtype</STRONG> are defined  in  <STRONG>&lt;curses.h&gt;</STRONG>.
+       Types  used for the terminfo routines such as <STRONG>TERMINAL</STRONG> are
        defined in <STRONG>&lt;term.h&gt;</STRONG>.
 
-       This  manual  page describes functions which may appear in
-       any configuration of the library.  There  are  two  common
+       This manual page describes functions which may  appear  in
+       any  configuration  of  the library.  There are two common
        configurations of the library:
 
               ncurses
                    the  "normal"  library,  which  handles  8-bit
                    characters.  The normal (8-bit) library stores
-                   characters  combined with attributes in <STRONG>chtype</STRONG>
+                   characters combined with attributes in  <STRONG>chtype</STRONG>
                    data.
 
-                   Attributes alone (no corresponding  character)
-                   may  be  stored  in  <STRONG>chtype</STRONG>  or the equivalent
-                   <STRONG>attr_t</STRONG> data.  In  either  case,  the  data  is
+                   Attributes  alone (no corresponding character)
+                   may be stored  in  <STRONG>chtype</STRONG>  or  the  equivalent
+                   <STRONG>attr_t</STRONG>  data.   In  either  case,  the data is
                    stored in something like an integer.
 
-                   Each  cell  (row  and  column)  in a <STRONG>WINDOW</STRONG> is
+                   Each cell (row and  column)  in  a  <STRONG>WINDOW</STRONG>  is
                    stored as a <STRONG>chtype</STRONG>.
 
               ncursesw
-                   the so-called "wide"  library,  which  handles
-                   multibyte   characters  (see  the  section  on
+                   the  so-called  "wide"  library, which handles
+                   multibyte  characters  (see  the  section   on
                    <STRONG>ALTERNATE</STRONG> <STRONG>CONFIGURATIONS</STRONG>).  The "wide" library
-                   includes  all  of  the calls from the "normal"
-                   library.  It adds about one third  more  calls
+                   includes all of the calls  from  the  "normal"
+                   library.   It  adds about one third more calls
                    using data types which store multibyte charac-
                    ters:
 
                    <STRONG>cchar_t</STRONG>
-                        corresponds to <STRONG>chtype</STRONG>.  However it  is  a
-                        structure,  because  more  data is stored
-                        than can fit into an integer.  The  char-
+                        corresponds  to  <STRONG>chtype</STRONG>.  However it is a
+                        structure, because more  data  is  stored
+                        than  can fit into an integer.  The char-
                         acters are large enough to require a full
-                        integer value - and  there  may  be  more
-                        than  one  character per cell.  The video
-                        attributes and color are stored in  sepa-
+                        integer  value  -  and  there may be more
+                        than one character per cell.   The  video
+                        attributes  and color are stored in sepa-
                         rate fields of the structure.
 
                         Each cell (row and column) in a <STRONG>WINDOW</STRONG> is
                         stored as a <STRONG>cchar_t</STRONG>.
 
                    <STRONG>wchar_t</STRONG>
-                        stores a "wide" character.  Like  <STRONG>chtype</STRONG>,
+                        stores  a "wide" character.  Like <STRONG>chtype</STRONG>,
                         this may be an integer.
 
                    <STRONG>wint_t</STRONG>
-                        stores  a <STRONG>wchar_t</STRONG> or <STRONG>WEOF</STRONG> - not the same,
+                        stores a <STRONG>wchar_t</STRONG> or <STRONG>WEOF</STRONG> - not the  same,
                         though both may have the same size.
 
                    The  "wide"  library  provides  new  functions
-                   which  are analogous to functions in the "nor-
-                   mal" library.  There is  a  naming  convention
-                   which  relates  many  of the normal/wide vari-
-                   ants: a "_w" is inserted into the  name.   For
+                   which are analogous to functions in the  "nor-
+                   mal"  library.   There  is a naming convention
+                   which relates many of  the  normal/wide  vari-
+                   ants:  a  "_w" is inserted into the name.  For
                    example, <STRONG>waddch</STRONG> becomes <STRONG>wadd_wch</STRONG>.
 
-
    <STRONG>Routine</STRONG> <STRONG>Name</STRONG> <STRONG>Index</STRONG>
        The following table lists each <STRONG>curses</STRONG> routine and the name
-       of the manual page on which  it  is  described.   Routines
-       flagged  with  `*'  are ncurses-specific, not described by
+       of  the  manual  page  on which it is described.  Routines
+       flagged with `*' are ncurses-specific,  not  described  by
        XPG4 or present in SVr4.
 
-
               <STRONG>curses</STRONG> Routine Name     Manual Page Name
               --------------------------------------------
               COLOR_PAIR              <STRONG><A HREF="curs_color.3x.html">curs_color(3x)</A></STRONG>
               PAIR_NUMBER             <STRONG><A HREF="curs_attr.3x.html">curs_attr(3x)</A></STRONG>
               _nc_free_and_exit       <STRONG><A HREF="curs_memleaks.3x.html">curs_memleaks(3x)</A></STRONG>*
-
               _nc_freeall             <STRONG><A HREF="curs_memleaks.3x.html">curs_memleaks(3x)</A></STRONG>*
               _nc_tracebits           <STRONG><A HREF="curs_trace.3x.html">curs_trace(3x)</A></STRONG>*
+
               _traceattr              <STRONG><A HREF="curs_trace.3x.html">curs_trace(3x)</A></STRONG>*
               _traceattr2             <STRONG><A HREF="curs_trace.3x.html">curs_trace(3x)</A></STRONG>*
               _tracechar              <STRONG><A HREF="curs_trace.3x.html">curs_trace(3x)</A></STRONG>*
@@ -376,9 +374,9 @@
               echo                    <STRONG><A HREF="curs_inopts.3x.html">curs_inopts(3x)</A></STRONG>
               echo_wchar              <STRONG><A HREF="curs_add_wch.3x.html">curs_add_wch(3x)</A></STRONG>
               echochar                <STRONG><A HREF="curs_addch.3x.html">curs_addch(3x)</A></STRONG>
-
               endwin                  <STRONG><A HREF="curs_initscr.3x.html">curs_initscr(3x)</A></STRONG>
               erase                   <STRONG><A HREF="curs_clear.3x.html">curs_clear(3x)</A></STRONG>
+
               erasechar               <STRONG><A HREF="curs_termattrs.3x.html">curs_termattrs(3x)</A></STRONG>
               erasewchar              <STRONG><A HREF="curs_termattrs.3x.html">curs_termattrs(3x)</A></STRONG>
               filter                  <STRONG><A HREF="curs_util.3x.html">curs_util(3x)</A></STRONG>
@@ -442,9 +440,9 @@
               intrflush               <STRONG><A HREF="curs_inopts.3x.html">curs_inopts(3x)</A></STRONG>
               inwstr                  <STRONG><A HREF="curs_inwstr.3x.html">curs_inwstr(3x)</A></STRONG>
               is_cleared              <STRONG><A HREF="curs_opaque.3x.html">curs_opaque(3x)</A></STRONG>*
-
               is_idcok                <STRONG><A HREF="curs_opaque.3x.html">curs_opaque(3x)</A></STRONG>*
               is_idlok                <STRONG><A HREF="curs_opaque.3x.html">curs_opaque(3x)</A></STRONG>*
+
               is_immedok              <STRONG><A HREF="curs_opaque.3x.html">curs_opaque(3x)</A></STRONG>*
               is_keypad               <STRONG><A HREF="curs_opaque.3x.html">curs_opaque(3x)</A></STRONG>*
               is_leaveok              <STRONG><A HREF="curs_opaque.3x.html">curs_opaque(3x)</A></STRONG>*
@@ -508,9 +506,9 @@
               mvinsch                 <STRONG><A HREF="curs_insch.3x.html">curs_insch(3x)</A></STRONG>
               mvinsnstr               <STRONG><A HREF="curs_insstr.3x.html">curs_insstr(3x)</A></STRONG>
               mvinsstr                <STRONG><A HREF="curs_insstr.3x.html">curs_insstr(3x)</A></STRONG>
-
               mvinstr                 <STRONG><A HREF="curs_instr.3x.html">curs_instr(3x)</A></STRONG>
               mvinwstr                <STRONG><A HREF="curs_inwstr.3x.html">curs_inwstr(3x)</A></STRONG>
+
               mvprintw                <STRONG><A HREF="curs_printw.3x.html">curs_printw(3x)</A></STRONG>
               mvscanw                 <STRONG><A HREF="curs_scanw.3x.html">curs_scanw(3x)</A></STRONG>
               mvvline                 <STRONG><A HREF="curs_border.3x.html">curs_border(3x)</A></STRONG>
@@ -574,9 +572,9 @@
               pair_content            <STRONG><A HREF="curs_color.3x.html">curs_color(3x)</A></STRONG>
               pechochar               <STRONG><A HREF="curs_pad.3x.html">curs_pad(3x)</A></STRONG>
               pnoutrefresh            <STRONG><A HREF="curs_pad.3x.html">curs_pad(3x)</A></STRONG>
-
               prefresh                <STRONG><A HREF="curs_pad.3x.html">curs_pad(3x)</A></STRONG>
               printw                  <STRONG><A HREF="curs_printw.3x.html">curs_printw(3x)</A></STRONG>
+
               putp                    <STRONG><A HREF="curs_terminfo.3x.html">curs_terminfo(3x)</A></STRONG>
               putwin                  <STRONG><A HREF="curs_util.3x.html">curs_util(3x)</A></STRONG>
               qiflush                 <STRONG><A HREF="curs_inopts.3x.html">curs_inopts(3x)</A></STRONG>
@@ -640,9 +638,9 @@
               tigetstr                <STRONG><A HREF="curs_terminfo.3x.html">curs_terminfo(3x)</A></STRONG>
               timeout                 <STRONG><A HREF="curs_inopts.3x.html">curs_inopts(3x)</A></STRONG>
               touchline               <STRONG><A HREF="curs_touch.3x.html">curs_touch(3x)</A></STRONG>
-
               touchwin                <STRONG><A HREF="curs_touch.3x.html">curs_touch(3x)</A></STRONG>
               tparm                   <STRONG><A HREF="curs_terminfo.3x.html">curs_terminfo(3x)</A></STRONG>
+
               tputs                   <STRONG><A HREF="curs_termcap.3x.html">curs_termcap(3x)</A></STRONG>
               tputs                   <STRONG><A HREF="curs_terminfo.3x.html">curs_terminfo(3x)</A></STRONG>
               trace                   <STRONG><A HREF="curs_trace.3x.html">curs_trace(3x)</A></STRONG>*
@@ -656,6 +654,7 @@
               use_env                 <STRONG><A HREF="curs_util.3x.html">curs_util(3x)</A></STRONG>
               use_extended_names      <STRONG><A HREF="curs_extend.3x.html">curs_extend(3x)</A></STRONG>*
               use_legacy_coding       <STRONG><A HREF="legacy_coding.3x.html">legacy_coding(3x)</A></STRONG>*
+              use_tioctl              <STRONG><A HREF="curs_util.3x.html">curs_util(3x)</A></STRONG>
               vid_attr                <STRONG><A HREF="curs_terminfo.3x.html">curs_terminfo(3x)</A></STRONG>
               vid_puts                <STRONG><A HREF="curs_terminfo.3x.html">curs_terminfo(3x)</A></STRONG>
               vidattr                 <STRONG><A HREF="curs_terminfo.3x.html">curs_terminfo(3x)</A></STRONG>
@@ -706,8 +705,8 @@
               wgetbkgrnd              <STRONG><A HREF="curs_bkgrnd.3x.html">curs_bkgrnd(3x)</A></STRONG>
               wgetch                  <STRONG><A HREF="curs_getch.3x.html">curs_getch(3x)</A></STRONG>
               wgetn_wstr              <STRONG><A HREF="curs_get_wstr.3x.html">curs_get_wstr(3x)</A></STRONG>
-
               wgetnstr                <STRONG><A HREF="curs_getstr.3x.html">curs_getstr(3x)</A></STRONG>
+
               wgetstr                 <STRONG><A HREF="curs_getstr.3x.html">curs_getstr(3x)</A></STRONG>
               whline                  <STRONG><A HREF="curs_border.3x.html">curs_border(3x)</A></STRONG>
               whline_set              <STRONG><A HREF="curs_border_set.3x.html">curs_border_set(3x)</A></STRONG>
@@ -752,11 +751,14 @@
 
 </PRE>
 <H2>RETURN VALUE</H2><PRE>
-       Routines that return an integer return  <STRONG>ERR</STRONG>  upon  failure
-       and  an  integer value other than <STRONG>ERR</STRONG> upon successful com-
-       pletion, unless otherwise noted in  the  routine  descrip-
+       Routines  that  return  an integer return <STRONG>ERR</STRONG> upon failure
+       and an integer value other than <STRONG>ERR</STRONG> upon  successful  com-
+       pletion,  unless  otherwise  noted in the routine descrip-
        tions.
 
+       As a general rule, routines check for null pointers passed
+       as parameters, and handle this as an error.
+
        All  macros  return  the  value  of  the <STRONG>w</STRONG> version, except
        <STRONG>setscrreg</STRONG>, <STRONG>wsetscrreg</STRONG>, <STRONG>getyx</STRONG>, <STRONG>getbegyx</STRONG>, and <STRONG>getmaxyx</STRONG>.  The
        return  values  of <STRONG>setscrreg</STRONG>, <STRONG>wsetscrreg</STRONG>, <STRONG>getyx</STRONG>, <STRONG>getbegyx</STRONG>,
@@ -773,52 +775,56 @@
        important ones have been already discussed in detail.
 
        BAUDRATE
-            The  debugging library checks this environment symbol
-            when the application has redirected output to a file.
-            The  symbol's numeric value is used for the baudrate.
-            If no value is found, <STRONG>ncurses</STRONG> uses 9600.  This allows
-            testers  to construct repeatable test-cases that take
-            into account costs that depend on baudrate.
+            The  debugging  library checks this environment vari-
+            able when the application has redirected output to  a
+            file.   The  variable's numeric value is used for the
+            baudrate.  If no value is found, <STRONG>ncurses</STRONG>  uses  9600.
+            This  allows  testers  to  construct repeatable test-
+            cases that take into account  costs  that  depend  on
+            baudrate.
 
        CC   When set, change occurrences of the command_character
-            (i.e.,  the  <STRONG>cmdch</STRONG> capability) of the loaded terminfo
-            entries to the value of this symbol.  Very  few  ter-
+            (i.e., the <STRONG>cmdch</STRONG> capability) of the  loaded  terminfo
+            entries to the value of this variable.  Very few ter-
             minfo entries provide this feature.
 
-            Because  this  name is also used in development envi-
-            ronments to represent the C compiler's name,  <STRONG>ncurses</STRONG>
+            Because this name is also used in  development  envi-
+            ronments  to represent the C compiler's name, <STRONG>ncurses</STRONG>
             ignores it if it does not happen to be a single char-
             acter.
 
        COLUMNS
             Specify  the  width  of  the  screen  in  characters.
-            Applications  running in a windowing environment usu-
-            ally are able to obtain the width of  the  window  in
-            which  they  are  executing.   If neither the <STRONG>COLUMNS</STRONG>
-            value nor the terminal's screen  size  is  available,
-            <STRONG>ncurses</STRONG>  uses  the size which may be specified in the
+            Applications running in a windowing environment  usu-
+            ally  are  able  to obtain the width of the window in
+            which they are executing.   If  neither  the  <STRONG>COLUMNS</STRONG>
+            value  nor  the  terminal's screen size is available,
+            <STRONG>ncurses</STRONG> uses the size which may be specified  in  the
             terminfo database (i.e., the <STRONG>cols</STRONG> capability).
 
-            It is important that your application use  a  correct
-            size  for  the  screen.   This is not always possible
-            because your application may be  running  on  a  host
-            which  does not honor NAWS (Negotiations About Window
-            Size), or because  you  are  temporarily  running  as
-            another  user.  However, setting <STRONG>COLUMNS</STRONG> and/or <STRONG>LINES</STRONG>
+            It  is  important that your application use a correct
+            size for the screen.  This  is  not  always  possible
+            because  your  application  may  be running on a host
+            which does not honor NAWS (Negotiations About  Window
+            Size),  or  because  you  are  temporarily running as
+            another user.  However, setting <STRONG>COLUMNS</STRONG> and/or  <STRONG>LINES</STRONG>
             overrides  the  library's  use  of  the  screen  size
             obtained from the operating system.
 
-            Either  <STRONG>COLUMNS</STRONG>  or  <STRONG>LINES</STRONG>  symbols  may be specified
-            independently.  This is mainly useful  to  circumvent
-            legacy  misfeatures  of  terminal descriptions, e.g.,
+            Either <STRONG>COLUMNS</STRONG> or  <STRONG>LINES</STRONG>  symbols  may  be  specified
+            independently.   This  is mainly useful to circumvent
+            legacy misfeatures of  terminal  descriptions,  e.g.,
             xterm which commonly specifies a 65 line screen.  For
-            best  results, <STRONG>lines</STRONG> and <STRONG>cols</STRONG> should not be specified
+            best results, <STRONG>lines</STRONG> and <STRONG>cols</STRONG> should not be  specified
             in a terminal description for terminals which are run
             as emulations.
 
             Use the <STRONG>use_env</STRONG> function to disable all use of exter-
-            nal environment (including system calls) to determine
-            the screen size.
+            nal  environment  (but not including system calls) to
+            determine the screen size.  Use the <STRONG>use_tioctl</STRONG>  func-
+            tion  to  update <STRONG>COLUMNS</STRONG> or <STRONG>LINES</STRONG> to match the screen
+            size obtained from system calls or the terminal data-
+            base.
 
        ESCDELAY
             Specifies  the total time, in milliseconds, for which
@@ -858,234 +864,278 @@
 
        LINES
             Like  COLUMNS,  specify  the  height of the screen in
-            characters.  See COLUMNS for a detailed  description.
+            characters.  See COLUMNS for a detailed description.
 
        MOUSE_BUTTONS_123
             This applies only to the OS/2 EMX port.  It specifies
-            the order of buttons on the mouse.   OS/2  numbers  a
+            the  order  of  buttons on the mouse.  OS/2 numbers a
             3-button mouse inconsistently from other platforms:
 
             1 = left
             2 = right
             3 = middle.
 
-            This symbol lets you customize the mouse.  The symbol
-            must be three numeric digits 1-3 in any order,  e.g.,
-            123  or  321.   If  it is not specified, <STRONG>ncurses</STRONG> uses
-            132.
+            This variable lets  you  customize  the  mouse.   The
+            variable  must  be  three  numeric  digits 1-3 in any
+            order, e.g., 123 or 321.  If  it  is  not  specified,
+            <STRONG>ncurses</STRONG> uses 132.
 
        NCURSES_ASSUMED_COLORS
-            Override the compiled-in assumption that  the  termi-
-            nal's   default   colors   are   white-on-black  (see
-            <STRONG><A HREF="default_colors.3x.html">default_colors(3x)</A></STRONG>).  You may set the foreground  and
-            background  color  values with this environment vari-
-            able by proving a  2-element  list:  foreground,back-
-            ground.   For  example, to tell ncurses to not assume
-            anything about the colors, set this to  "-1,-1".   To
-            make  it  green-on-black, set it to "2,0".  Any posi-
+            Override  the  compiled-in assumption that the termi-
+            nal's  default   colors   are   white-on-black   (see
+            <STRONG><A HREF="default_colors.3x.html">default_colors(3x)</A></STRONG>).   You may set the foreground and
+            background color values with this  environment  vari-
+            able  by  proving  a 2-element list: foreground,back-
+            ground.  For example, to tell ncurses to  not  assume
+            anything  about  the colors, set this to "-1,-1".  To
+            make it green-on-black, set it to "2,0".   Any  posi-
             tive value from zero to the terminfo <STRONG>max_colors</STRONG> value
             is allowed.
 
        NCURSES_GPM_TERMS
-            This  applies  only  to ncurses configured to use the
+            This applies only to ncurses configured  to  use  the
             GPM interface.
 
             If present, the environment variable is a list of one
-            or  more  terminal names against which the TERM envi-
-            ronment variable is matched.  Setting it to an  empty
-            value  disables the GPM interface; using the built-in
+            or more terminal names against which the  TERM  envi-
+            ronment  variable is matched.  Setting it to an empty
+            value disables the GPM interface; using the  built-in
             support for xterm, etc.
 
-            If the environment variable is absent,  ncurses  will
+            If  the  environment variable is absent, ncurses will
             attempt to open GPM if TERM contains "linux".
 
        NCURSES_NO_HARD_TABS
-            <STRONG>Ncurses</STRONG>  may  use tabs as part of the cursor movement
-            optimization.  In some cases,  your  terminal  driver
-            may  not handle these properly.  Set this environment
+            <STRONG>Ncurses</STRONG> may use tabs as part of the  cursor  movement
+            optimization.   In  some  cases, your terminal driver
+            may not handle these properly.  Set this  environment
             variable to disable the feature.  You can also adjust
             your <STRONG>stty</STRONG> settings to avoid the problem.
 
        NCURSES_NO_MAGIC_COOKIES
             Some  terminals  use  a  magic-cookie  feature  which
-            requires special handling to  make  highlighting  and
-            other  video  attributes  display  properly.  You can
-            suppress the highlighting entirely for  these  termi-
+            requires  special  handling  to make highlighting and
+            other video attributes  display  properly.   You  can
+            suppress  the  highlighting entirely for these termi-
             nals by setting this environment variable.
 
        NCURSES_NO_PADDING
-            Most  of  the  terminal  descriptions in the terminfo
-            database are written for real  "hardware"  terminals.
-            Many  people  use  terminal  emulators which run in a
-            windowing environment and use  curses-based  applica-
-            tions.   Terminal  emulators can duplicate all of the
+            Most of the terminal  descriptions  in  the  terminfo
+            database  are  written for real "hardware" terminals.
+            Many people use terminal emulators  which  run  in  a
+            windowing  environment  and use curses-based applica-
+            tions.  Terminal emulators can duplicate all  of  the
             important aspects of a hardware terminal, but they do
-            not  have the same limitations.  The chief limitation
-            of a hardware terminal from the  standpoint  of  your
+            not have the same limitations.  The chief  limitation
+            of  a  hardware  terminal from the standpoint of your
             application is the management of dataflow, i.e., tim-
             ing.  Unless a hardware terminal is interfaced into a
-            terminal  concentrator  (which does flow control), it
-            (or your application) must manage dataflow,  prevent-
-            ing  overruns.   The  cheapest  solution (no hardware
+            terminal concentrator (which does flow  control),  it
+            (or  your application) must manage dataflow, prevent-
+            ing overruns.  The  cheapest  solution  (no  hardware
             cost) is for your program to do this by pausing after
-            operations  that  the  terminal  does slowly, such as
+            operations that the terminal  does  slowly,  such  as
             clearing the display.
 
-            As a result, many  terminal  descriptions  (including
-            the  vt100)  have delay times embedded.  You may wish
-            to use these descriptions, but not want  to  pay  the
+            As  a  result,  many terminal descriptions (including
+            the vt100) have delay times embedded.  You  may  wish
+            to  use  these  descriptions, but not want to pay the
             performance penalty.
 
-            Set  the NCURSES_NO_PADDING symbol to disable all but
-            mandatory padding.  Mandatory padding is  used  as  a
-            part of special control sequences such as <EM>flash</EM>.
+            Set the NCURSES_NO_PADDING  environment  variable  to
+            disable all but mandatory padding.  Mandatory padding
+            is used as a part of special control  sequences  such
+            as <EM>flash</EM>.
 
        NCURSES_NO_SETBUF
-            Normally  <STRONG>ncurses</STRONG> enables buffered output during ter-
-            minal initialization.   This  is  done  (as  in  SVr4
-            curses)  for  performance  reasons.  For testing pur-
-            poses, both of <STRONG>ncurses</STRONG> and certain applications, this
-            feature    is    made    optional.     Setting    the
-            NCURSES_NO_SETBUF variable disables output buffering,
-            leaving  the  output  in  the  original (usually line
-            buffered) mode.
+            This setting is obsolete.  Before changes
+
+            <STRONG>o</STRONG>   started with 5.9 patch 20120825 and
+
+            <STRONG>o</STRONG>   continued though 5.9 patch 20130126
+
+            <STRONG>ncurses</STRONG>  enabled buffered output during terminal ini-
+            tialization.  This was done (as in SVr4  curses)  for
+            performance  reasons.   For testing purposes, both of
+            <STRONG>ncurses</STRONG> and certain applications,  this  feature  was
+            made  optional.   Setting the NCURSES_NO_SETBUF vari-
+            able disabled output buffering, leaving the output in
+            the original (usually line buffered) mode.
+
+            In  the  current implementation, ncurses performs its
+            own buffering and does not require  this  workaround.
+            It does not modify the buffering of the standard out-
+            put.
+
+            The reason for the change was to  make  the  behavior
+            for  interrupts  and  other signals more robust.  One
+            drawback is  that  certain  nonconventional  programs
+            would mix ordinary stdio calls with ncurses calls and
+            (usually) work.  This is  no  longer  possible  since
+            ncurses is not using the buffered standard output but
+            its own output (to the same file descriptor).   As  a
+            special  case, the low-level calls such as <STRONG>putp</STRONG> still
+            use the standard output.  But high-level curses calls
+            do not.
 
        NCURSES_NO_UTF8_ACS
             During initialization, the <STRONG>ncurses</STRONG> library checks for
-            special  cases where VT100 line-drawing (and the cor-
-            responding  alternate  character  set   capabilities)
-            described  in  the  terminfo are known to be missing.
-            Specifically, when running in  a  UTF-8  locale,  the
-            Linux  console  emulator  and  the GNU screen program
-            ignore these.  Ncurses checks  the  TERM  environment
-            variable  for  these.   For  other special cases, you
-            should set this  environment  variable.   Doing  this
-            tells  ncurses to use Unicode values which correspond
+            special cases where VT100 line-drawing (and the  cor-
+            responding   alternate  character  set  capabilities)
+            described in the terminfo are known  to  be  missing.
+            Specifically,  when  running  in  a UTF-8 locale, the
+            Linux console emulator and  the  GNU  screen  program
+            ignore  these.   Ncurses  checks the TERM environment
+            variable for these.  For  other  special  cases,  you
+            should  set  this  environment  variable.  Doing this
+            tells ncurses to use Unicode values which  correspond
             to the VT100 line-drawing glyphs.  That works for the
             special cases cited, and is likely to work for termi-
             nal emulators.
 
-            When setting this variable, you should set  it  to  a
-            nonzero  value.   Setting it to zero (or to a nonnum-
-            ber) disables  the  special  check  for  "linux"  and
+            When  setting  this  variable, you should set it to a
+            nonzero value.  Setting it to zero (or to  a  nonnum-
+            ber)  disables  the  special  check  for  "linux" and
             "screen".
 
-            As   an  alternative  to  the  environment  variable,
-            ncurses checks for an  extended  terminfo  capability
-            <STRONG>U8</STRONG>.   This  is a numeric capability which can be com-
+            As  an  alternative  to  the  environment   variable,
+            ncurses  checks  for  an extended terminfo capability
+            <STRONG>U8</STRONG>.  This is a numeric capability which can  be  com-
             piled using <STRONG>tic</STRONG> <STRONG>-x</STRONG>.  For example
 
             # linux console, if patched to provide working
             # VT100 shift-in/shift-out, with corresponding font.
             linux-vt100|linux console with VT100 line-graphics,
-                                 U8#0, use=linux,
+                    U8#0, use=linux,
 
             # uxterm with vt100Graphics resource set to false
             xterm-utf8|xterm relying on UTF-8 line-graphics,
-                                 U8#1, use=xterm,
+                    U8#1, use=xterm,
 
             The name "U8" is chosen to be two characters, to per-
-            mit  it  to be used by applications that use ncurses'
+            mit it to be used by applications that  use  ncurses'
             termcap interface.
 
        NCURSES_TRACE
-            During initialization, the <STRONG>ncurses</STRONG> debugging  library
-            checks  the  NCURSES_TRACE symbol.  If it is defined,
-            to a numeric value, <STRONG>ncurses</STRONG> calls the <STRONG>trace</STRONG> function,
-            using that value as the argument.
-
-            The  argument  values, which are defined in <STRONG>curses.h</STRONG>,
-            provide several types of information.   When  running
-            with  traces enabled, your application will write the
+            During  initialization, the <STRONG>ncurses</STRONG> debugging library
+            checks the NCURSES_TRACE environment variable.  If it
+            is  defined,  to  a  numeric value, <STRONG>ncurses</STRONG> calls the
+            <STRONG>trace</STRONG> function, using that value as the argument.
+
+            The argument values, which are defined  in  <STRONG>curses.h</STRONG>,
+            provide  several  types of information.  When running
+            with traces enabled, your application will write  the
             file <STRONG>trace</STRONG> to the current directory.
 
-       TERM Denotes your terminal type.  Each  terminal  type  is
+       TERM Denotes  your  terminal  type.  Each terminal type is
             distinct, though many are similar.
 
        TERMCAP
             If the <STRONG>ncurses</STRONG> library has been configured with <EM>term-</EM>
-            <EM>cap</EM> support, <STRONG>ncurses</STRONG>  will  check  for  a  terminal's
+            <EM>cap</EM>  support,  <STRONG>ncurses</STRONG>  will  check  for a terminal's
             description in termcap form if it is not available in
             the terminfo database.
 
-            The  TERMCAP  symbol  contains  either   a   terminal
-            description  (with  newlines stripped out), or a file
-            name telling where the  information  denoted  by  the
-            TERM  symbol  exists.   In  either  case,  setting it
-            directs <STRONG>ncurses</STRONG> to ignore the usual  place  for  this
-            information, e.g., /etc/termcap.
+            The  TERMCAP  environment  variable contains either a
+            terminal description (with newlines stripped out), or
+            a  file name telling where the information denoted by
+            the TERM  environment  variable  exists.   In  either
+            case,  setting it directs <STRONG>ncurses</STRONG> to ignore the usual
+            place for this information, e.g., /etc/termcap.
 
        TERMINFO
             Overrides the directory in which <STRONG>ncurses</STRONG> searches for
             your terminal description.  This is the simplest, but
-            not  the  only way to change the list of directories.
+            not the only way to change the list  of  directories.
             The complete list of directories in order follows:
 
-            <STRONG>o</STRONG>   the last directory to  which  <STRONG>ncurses</STRONG>  wrote,  if
+            <STRONG>o</STRONG>   the  last  directory  to  which <STRONG>ncurses</STRONG> wrote, if
                 any, is searched first
 
-            <STRONG>o</STRONG>   the directory specified by the TERMINFO symbol
+            <STRONG>o</STRONG>   the directory specified by the TERMINFO  environ-
+                ment variable
 
             <STRONG>o</STRONG>   $HOME/.terminfo
 
-            <STRONG>o</STRONG>   directories listed in the TERMINFO_DIRS symbol
+            <STRONG>o</STRONG>   directories  listed in the TERMINFO_DIRS environ-
+                ment variable
+
+            <STRONG>o</STRONG>   one or more directories whose names  are  config-
+                ured and compiled into the ncurses library, i.e.,
 
-            <STRONG>o</STRONG>   one  or  more directories whose names are config-
-                ured and compiled into the ncurses library, e.g.,
-                /usr/share/terminfo
+                <STRONG>o</STRONG>   /usr/local/ncurses/share/ter-
+                    minfo:/usr/share/terminfo  (corresponding  to
+                    the TERMINFO_DIRS variable)
+
+                <STRONG>o</STRONG>   /usr/share/terminfo   (corresponding  to  the
+                    TERMINFO variable)
 
        TERMINFO_DIRS
-            Specifies  a list of directories to search for termi-
-            nal descriptions.  The list is  separated  by  colons
-            (i.e.,  ":") on Unix, semicolons on OS/2 EMX.  All of
-            the terminal descriptions are in terminfo form, which
-            makes  a  subdirectory  named for the first letter of
-            the terminal names therein.
+            Specifies a list of directories to search for  termi-
+            nal  descriptions.   The  list is separated by colons
+            (i.e., ":") on Unix, semicolons on OS/2 EMX.
+
+            All of the  terminal  descriptions  are  in  terminfo
+            form.  Normally these are stored in a directory tree,
+            using subdirectories named by the first letter of the
+            terminal names therein.
+
+            If <STRONG>ncurses</STRONG> is built with a hashed database, then each
+            entry in this list can also be the path of the corre-
+            sponding database file.
+
+            If  <STRONG>ncurses</STRONG> is built with a support for reading term-
+            cap files directly, then an entry in this list may be
+            the path of a termcap file.
 
        TERMPATH
-            If TERMCAP does not hold a  file  name  then  <STRONG>ncurses</STRONG>
-            checks  the TERMPATH symbol.  This is a list of file-
-            names separated by spaces or colons  (i.e.,  ":")  on
-            Unix, semicolons on OS/2 EMX.  If the TERMPATH symbol
-            is not set, <STRONG>ncurses</STRONG> looks in the files  /etc/termcap,
-            /usr/share/misc/termcap  and  $HOME/.termcap, in that
+            If  TERMCAP  does  not  hold a file name then <STRONG>ncurses</STRONG>
+            checks the TERMPATH environment variable.  This is  a
+            list  of  filenames  separated  by  spaces  or colons
+            (i.e., ":") on Unix, semicolons on OS/2 EMX.
+
+            If the TERMPATH  environment  variable  is  not  set,
+            <STRONG>ncurses</STRONG>    looks    in    the   files   /etc/termcap,
+            /usr/share/misc/termcap and $HOME/.termcap,  in  that
             order.
 
-       The library may be configured to disregard  the  following
-       variables  when  the current user is the superuser (root),
-       or if the application uses setuid or  setgid  permissions:
-       $TERMINFO, $TERMINFO_DIRS, $TERMPATH, as well as $HOME.
+       The  library  may be configured to disregard the following
+       variables when the current user is the  superuser  (root),
+       or if the application uses setuid or setgid permissions:
+
+              $TERMINFO,  $TERMINFO_DIRS,  $TERMPATH,  as well as
+              $HOME.
 
 
 </PRE>
 <H2>ALTERNATE CONFIGURATIONS</H2><PRE>
-       Several  different  configurations are possible, depending
-       on  the  configure  script  options  used  when   building
-       <STRONG>ncurses</STRONG>.   There  are a few main options whose effects are
+       Several different configurations are  possible,  depending
+       on   the  configure  script  options  used  when  building
+       <STRONG>ncurses</STRONG>.  There are a few main options whose  effects  are
        visible to the applications developer using <STRONG>ncurses</STRONG>:
 
        --disable-overwrite
-            The standard include for <STRONG>ncurses</STRONG> is as noted in  <STRONG>SYN-</STRONG>
+            The  standard include for <STRONG>ncurses</STRONG> is as noted in <STRONG>SYN-</STRONG>
             <STRONG>OPSIS</STRONG>:
 
             <STRONG>#include</STRONG> <STRONG>&lt;curses.h&gt;</STRONG>
 
-            This  option is used to avoid filename conflicts when
-            <STRONG>ncurses</STRONG> is not the main implementation of  curses  of
-            the  computer.   If  <STRONG>ncurses</STRONG>  is  installed disabling
-            overwrite, it puts its  headers  in  a  subdirectory,
+            This option is used to avoid filename conflicts  when
+            <STRONG>ncurses</STRONG>  is  not the main implementation of curses of
+            the computer.   If  <STRONG>ncurses</STRONG>  is  installed  disabling
+            overwrite,  it  puts  its  headers in a subdirectory,
             e.g.,
 
             <STRONG>#include</STRONG> <STRONG>&lt;ncurses/curses.h&gt;</STRONG>
 
-            It  also  omits a symbolic link which would allow you
+            It also omits a symbolic link which would  allow  you
             to use <STRONG>-lcurses</STRONG> to build executables.
 
        --enable-widec
-            The configure script renames the library and (if  the
-            <STRONG>--disable-overwrite</STRONG>  option  is used) puts the header
+            The  configure script renames the library and (if the
+            <STRONG>--disable-overwrite</STRONG> option is used) puts  the  header
             files  in  a  different  subdirectory.   All  of  the
-            library  names  have  a  "w"  appended to them, i.e.,
+            library names have a  "w"  appended  to  them,  i.e.,
             instead of
 
             <STRONG>-lncurses</STRONG>
@@ -1095,16 +1145,16 @@
             <STRONG>-lncursesw</STRONG>
 
             You must also define <STRONG>_XOPEN_SOURCE_EXTENDED</STRONG> when com-
-            piling  for  the  wide-character  library  to use the
-            extended (wide-character)  functions.   The  <STRONG>curses.h</STRONG>
-            file   which  is  installed  for  the  wide-character
-            library is designed to be compatible with the  normal
+            piling for the  wide-character  library  to  use  the
+            extended  (wide-character)  functions.   The <STRONG>curses.h</STRONG>
+            file  which  is  installed  for  the   wide-character
+            library  is designed to be compatible with the normal
             library's header.  Only the size of the <STRONG>WINDOW</STRONG> struc-
-            ture differs, and very few applications require  more
-            than  a  pointer  to  <STRONG>WINDOW</STRONG>s.   If  the  headers are
-            installed  allowing  overwrite,  the   wide-character
-            library's  headers should be installed last, to allow
-            applications to be built using  either  library  from
+            ture  differs, and very few applications require more
+            than a  pointer  to  <STRONG>WINDOW</STRONG>s.   If  the  headers  are
+            installed   allowing  overwrite,  the  wide-character
+            library's headers should be installed last, to  allow
+            applications  to  be  built using either library from
             the same set of headers.
 
        --with-shared
@@ -1114,16 +1164,16 @@
        --with-debug
 
        --with-profile
-            The  shared  and normal (static) library names differ
-            by   their   suffixes,   e.g.,   <STRONG>libncurses.so</STRONG>    and
-            <STRONG>libncurses.a</STRONG>.   The debug and profiling libraries add
-            a "_g" and a "_p" to  the  root  names  respectively,
-            e.g., <STRONG>libncurses_g.a</STRONG> and <STRONG>libncurses_p.a</STRONG>.
+            The shared and normal (static) library  names  differ
+            by  their  suffixes,  e.g.,  <STRONG>libncurses.so</STRONG>  and <STRONG>libn-</STRONG>
+            <STRONG>curses.a</STRONG>.  The debug and profiling  libraries  add  a
+            "_g" and a "_p" to the root names respectively, e.g.,
+            <STRONG>libncurses_g.a</STRONG> and <STRONG>libncurses_p.a</STRONG>.
 
        --with-trace
-            The  <STRONG>trace</STRONG>  function  normally  resides  in the debug
+            The <STRONG>trace</STRONG> function  normally  resides  in  the  debug
             library, but it is sometimes useful to configure this
-            in  the  shared  library.   Configure  scripts should
+            in the  shared  library.   Configure  scripts  should
             check for the function's existence rather than assum-
             ing it is always in the debug library.
 
@@ -1131,14 +1181,14 @@
 </PRE>
 <H2>FILES</H2><PRE>
        /usr/share/tabset
-            directory  containing  initialization  files  for the
+            directory containing  initialization  files  for  the
             terminal capability database /usr/share/terminfo ter-
             minal capability database
 
 
 </PRE>
 <H2>SEE ALSO</H2><PRE>
-       <STRONG><A HREF="terminfo.5.html">terminfo(5)</A></STRONG>  and  related  pages whose names begin "curs_"
+       <STRONG><A HREF="terminfo.5.html">terminfo(5)</A></STRONG> and related pages whose  names  begin  "curs_"
        for detailed routine descriptions.
        <STRONG><A HREF="curs_variables.3x.html">curs_variables(3x)</A></STRONG>
 
@@ -1148,52 +1198,61 @@
        The  <STRONG>ncurses</STRONG>  library  can  be  compiled  with  an  option
        (<STRONG>-DUSE_GETCAP</STRONG>) that falls back to the old-style /etc/term-
        cap file if the terminal setup code cannot find a terminfo
-       entry  corresponding  to <STRONG>TERM</STRONG>.  Use of this feature is not
-       recommended, as it essentially includes an entire  termcap
-       compiler  in the <STRONG>ncurses</STRONG> startup code, at significant cost
+       entry corresponding to <STRONG>TERM</STRONG>.  Use of this feature  is  not
+       recommended,  as it essentially includes an entire termcap
+       compiler in the <STRONG>ncurses</STRONG> startup code, at significant  cost
        in core and startup cycles.
 
-       The <STRONG>ncurses</STRONG>  library  includes  facilities  for  capturing
-       mouse  events on certain terminals (including xterm).  See
+       The  <STRONG>ncurses</STRONG>  library  includes  facilities  for capturing
+       mouse events on certain terminals (including xterm).   See
        the <STRONG><A HREF="curs_mouse.3x.html">curs_mouse(3x)</A></STRONG> manual page for details.
 
-       The <STRONG>ncurses</STRONG> library includes facilities for responding  to
-       window  resizing  events,  e.g., when running in an xterm.
-       See the <STRONG><A HREF="resizeterm.3x.html">resizeterm(3x)</A></STRONG> and <STRONG><A HREF="wresize.3x.html">wresize(3x)</A></STRONG>  manual  pages  for
-       details.   In addition, the library may be configured with
+       The  <STRONG>ncurses</STRONG> library includes facilities for responding to
+       window resizing events, e.g., when running  in  an  xterm.
+       See  the  <STRONG><A HREF="resizeterm.3x.html">resizeterm(3x)</A></STRONG>  and <STRONG><A HREF="wresize.3x.html">wresize(3x)</A></STRONG> manual pages for
+       details.  In addition, the library may be configured  with
        a SIGWINCH handler.
 
-       The <STRONG>ncurses</STRONG> library extends the fixed set of function  key
-       capabilities  of  terminals  by  allowing  the application
-       designer to define additional key  sequences  at  runtime.
+       The  <STRONG>ncurses</STRONG> library extends the fixed set of function key
+       capabilities of  terminals  by  allowing  the  application
+       designer  to  define  additional key sequences at runtime.
        See the <STRONG><A HREF="define_key.3x.html">define_key(3x)</A></STRONG> <STRONG><A HREF="key_defined.3x.html">key_defined(3x)</A></STRONG>, and <STRONG><A HREF="keyok.3x.html">keyok(3x)</A></STRONG> man-
        ual pages for details.
 
        The <STRONG>ncurses</STRONG> library can exploit the capabilities of termi-
-       nals  which  implement the ISO-6429 SGR 39 and SGR 49 con-
+       nals which implement the ISO-6429 SGR 39 and SGR  49  con-
        trols, which allow an application to reset the terminal to
-       its  original  foreground and background colors.  From the
-       users' perspective, the application is able to  draw  col-
-       ored  text  on  a  background  whose color is set indepen-
-       dently, providing better  control  over  color  contrasts.
+       its original foreground and background colors.   From  the
+       users'  perspective,  the application is able to draw col-
+       ored text on a background  whose  color  is  set  indepen-
+       dently,  providing  better  control  over color contrasts.
        See the <STRONG><A HREF="default_colors.3x.html">default_colors(3x)</A></STRONG> manual page for details.
 
-       The  <STRONG>ncurses</STRONG>  library  includes  a  function for directing
-       application output to a printer attached to  the  terminal
+       The <STRONG>ncurses</STRONG> library  includes  a  function  for  directing
+       application  output  to a printer attached to the terminal
        device.  See the <STRONG><A HREF="curs_print.3x.html">curs_print(3x)</A></STRONG> manual page for details.
 
 
 </PRE>
 <H2>PORTABILITY</H2><PRE>
-       The  <STRONG>ncurses</STRONG>  library is intended to be BASE-level confor-
+       The <STRONG>ncurses</STRONG> library is intended to be  BASE-level  confor-
        mant with XSI Curses.  The EXTENDED XSI Curses functional-
        ity (including color support) is supported.
 
-       A  small  number of local differences (that is, individual
-       differences between the XSI Curses and <STRONG>ncurses</STRONG> calls)  are
-       described  in  <STRONG>PORTABILITY</STRONG>  sections  of  the  library man
+       A small number of local differences (that  is,  individual
+       differences  between the XSI Curses and <STRONG>ncurses</STRONG> calls) are
+       described in  <STRONG>PORTABILITY</STRONG>  sections  of  the  library  man
        pages.
 
+       Unlike  other  implementations, this one checks parameters
+       such as pointers to WINDOW structures to ensure  they  are
+       not  null.  The main reason for providing this behavior is
+       to guard against programmer error.  The standard interface
+       does not provide a way for the library to tell an applica-
+       tion which  of  several  possible  errors  were  detected.
+       Relying  on  this (or some other) extension will adversely
+       affect the portability of curses applications.
+
        This implementation also contains several extensions:
 
        <STRONG>o</STRONG>   The routine <STRONG>has_key</STRONG> is not part of  XPG4,  nor  is  it
@@ -1227,31 +1286,31 @@
 
        <STRONG>o</STRONG>   This  implementation can also be configured to provide
            a set of functions which improve the ability to manage
-           multiple  screens.  See <STRONG><A HREF="curs_sp_funcs.3x.html">curs_sp_funcs(3x)</A></STRONG> for details.
+           multiple screens.  See <STRONG><A HREF="curs_sp_funcs.3x.html">curs_sp_funcs(3x)</A></STRONG> for details.
 
-       In historic curses versions, delays embedded in the  capa-
+       In  historic curses versions, delays embedded in the capa-
        bilities <STRONG>cr</STRONG>, <STRONG>ind</STRONG>, <STRONG>cub1</STRONG>, <STRONG>ff</STRONG> and <STRONG>tab</STRONG> activated corresponding
-       delay bits in the UNIX tty driver.   In  this  implementa-
-       tion,  all  padding  is  done  by sending NUL bytes.  This
-       method is slightly more expensive, but narrows the  inter-
-       face  to  the  UNIX kernel significantly and increases the
+       delay  bits  in  the UNIX tty driver.  In this implementa-
+       tion, all padding is done  by  sending  NUL  bytes.   This
+       method  is slightly more expensive, but narrows the inter-
+       face to the UNIX kernel significantly  and  increases  the
        package's portability correspondingly.
 
 
 </PRE>
 <H2>NOTES</H2><PRE>
-       The header  file  <STRONG>&lt;curses.h&gt;</STRONG>  automatically  includes  the
+       The  header  file  <STRONG>&lt;curses.h&gt;</STRONG>  automatically  includes the
        header files <STRONG>&lt;stdio.h&gt;</STRONG> and <STRONG>&lt;unctrl.h&gt;</STRONG>.
 
-       If  standard  output from a <STRONG>ncurses</STRONG> program is re-directed
-       to something which is not a tty, screen  updates  will  be
+       If standard output from a <STRONG>ncurses</STRONG> program  is  re-directed
+       to  something  which  is not a tty, screen updates will be
        directed to standard error.  This was an undocumented fea-
        ture of AT&amp;T System V Release 3 curses.
 
 
 </PRE>
 <H2>AUTHORS</H2><PRE>
-       Zeyd M. Ben-Halim, Eric  S.  Raymond,  Thomas  E.  Dickey.
+       Zeyd  M.  Ben-Halim,  Eric  S.  Raymond, Thomas E. Dickey.
        Based on pcurses by Pavel Curtis.
 
 
Index: doc/html/man/ncurses5-config.1.html
--- ncurses-5.9/doc/html/man/ncurses5-config.1.html	2011-04-04 22:46:49.000000000 +0000
+++ ncurses-5.9-20130504/doc/html/man/ncurses5-config.1.html	2013-03-09 22:12:04.000000000 +0000
@@ -105,10 +105,11 @@
 
        <STRONG>--terminfo-dirs</STRONG>
               echos the $TERMINFO_DIRS directory list, e.g.,
-              /usr/local/ncurses/lib/terminfo:/usr/share/terminfo
+              /usr/local/ncurses/share/terminfo:/usr/share/ter-
+              minfo
 
        <STRONG>--termpath</STRONG>
-              echos  the  $TERMPATH  termcap list, if support for
+              echos the $TERMPATH termcap list,  if  support  for
               termcap is configured.
 
        <STRONG>--help</STRONG> prints this message
@@ -118,7 +119,7 @@
 <H2>SEE ALSO</H2><PRE>
        <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>
 
-       This describes <STRONG>ncurses</STRONG> version 5.9 (patch 20110404).
+       This describes <STRONG>ncurses</STRONG> version 5.9 (patch 20130309).
 
 
 
Index: doc/html/man/panel.3x.html
--- ncurses-5.9/doc/html/man/panel.3x.html	2011-04-04 22:46:49.000000000 +0000
+++ ncurses-5.9-20130504/doc/html/man/panel.3x.html	2013-03-09 22:12:04.000000000 +0000
@@ -174,35 +174,35 @@
 
 </PRE>
 <H2>DIAGNOSTICS</H2><PRE>
-       Each routine that returns a pointer  returns  <STRONG>NULL</STRONG>  if  an
-       error  occurs.  Each  routine  that  returns  an int value
+       Each  routine  that  returns  a pointer returns <STRONG>NULL</STRONG> if an
+       error occurs. Each  routine  that  returns  an  int  value
        returns <STRONG>OK</STRONG> if it executes successfully and <STRONG>ERR</STRONG> if not.
 
 
 </PRE>
 <H2>COMPATIBILITY</H2><PRE>
-       Reasonable care has been taken to   ensure   compatibility
-       with   the   native   panel  facility introduced in SVr3.2
-       (inspection  of  the  SVr4  manual  pages   suggests   the
-       programming  interface  is  unchanged).   The  <STRONG>PANEL</STRONG>  data
-       structures are merely  similar. The   programmer  is  cau-
-       tioned not to directly use <STRONG>PANEL</STRONG> fields.
+       Reasonable  care  has been taken to  ensure  compatibility
+       with  the  native  panel  facility  introduced  in  SVr3.2
+       (inspection of the SVr4 manual pages suggests the program-
+       ming interface is unchanged).  The <STRONG>PANEL</STRONG>  data  structures
+       are  merely   similar. The  programmer is cautioned not to
+       directly use <STRONG>PANEL</STRONG> fields.
 
-       The  functions  <STRONG>show_panel()</STRONG> and <STRONG>top_panel()</STRONG> are identical
-       in this implementation, and work equally  well  with  dis-
+       The functions <STRONG>show_panel()</STRONG> and <STRONG>top_panel()</STRONG>  are  identical
+       in  this  implementation,  and work equally well with dis-
        played or hidden panels.  In the native System V implemen-
        tation, <STRONG>show_panel()</STRONG> is intended for making a hidden panel
-       visible  (at  the  top  of  the  stack) and <STRONG>top_panel()</STRONG> is
-       intended for making an already-visible panel move  to  the
-       top  of  the  stack.  You are cautioned to use the correct
-       function  to  ensure  compatibility  with   native   panel
+       visible (at the top  of  the  stack)  and  <STRONG>top_panel()</STRONG>  is
+       intended  for  making an already-visible panel move to the
+       top of the stack. You are cautioned  to  use  the  correct
+       function   to   ensure  compatibility  with  native  panel
        libraries.
 
 
 </PRE>
 <H2>NOTE</H2><PRE>
-       In  your  library  list, libpanel.a should be before libn-
-       curses.a; that is, you want to  say  `-lpanel  -lncurses',
+       In your library list, libpanel.a should  be  before  libn-
+       curses.a;  that  is,  you want to say `-lpanel -lncurses',
        not the other way around (which would usually give a link-
        error).
 
@@ -218,14 +218,14 @@
 <H2>SEE ALSO</H2><PRE>
        <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>, <STRONG><A HREF="curs_variables.3x.html">curs_variables(3x)</A></STRONG>,
 
-       This describes <STRONG>ncurses</STRONG> version 5.9 (patch 20110404).
+       This describes <STRONG>ncurses</STRONG> version 5.9 (patch 20130309).
 
 
 </PRE>
 <H2>AUTHOR</H2><PRE>
-       Originally  written  by   Warren   Tucker   &lt;wht@n4hgf.mt-
-       park.ga.us&gt;,  primarily  to  assist  in porting u386mon to
-       systems without a native panels library.   Repackaged  for
+       Originally   written   by   Warren  Tucker  &lt;wht@n4hgf.mt-
+       park.ga.us&gt;, primarily to assist  in  porting  u386mon  to
+       systems  without  a native panels library.  Repackaged for
        ncurses by Zeyd ben-Halim.
 
 
Index: doc/html/man/resizeterm.3x.html
--- ncurses-5.9/doc/html/man/resizeterm.3x.html	2011-01-09 01:03:28.000000000 +0000
+++ ncurses-5.9-20130504/doc/html/man/resizeterm.3x.html	2013-03-09 22:12:04.000000000 +0000
@@ -1,7 +1,7 @@
 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
 <!-- 
   ****************************************************************************
-  * Copyright (c) 1998-2005,2010 Free Software Foundation, Inc.              *
+  * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc.              *
   *                                                                          *
   * Permission is hereby granted, free of charge, to any person obtaining a  *
   * copy of this software and associated documentation files (the            *
@@ -28,7 +28,7 @@
   * authorization.                                                           *
   ****************************************************************************
   * Author: Thomas E. Dickey 1996-2005
-  * @Id: resizeterm.3x,v 1.14 2010/12/04 18:38:55 tom Exp @
+  * @Id: resizeterm.3x,v 1.15 2012/07/07 18:38:21 tom Exp @
 -->
 <HTML>
 <HEAD>
@@ -113,9 +113,7 @@
        If  the  environment  variables  <STRONG>LINES</STRONG> or <STRONG>COLUMNS</STRONG> are set,
        this overrides  the  library's  use  of  the  window  size
        obtained  from the operating system.  Thus, even if a SIG-
-       WINCH is received, no screen size change may be  recorded.
-       In that case, no <STRONG>KEY_RESIZE</STRONG> is queued for the next call to
-       <STRONG>getch</STRONG>; an <STRONG>ERR</STRONG> will be returned instead.
+       WINCH is received, no screen size change may be recorded.
 
 
 </PRE>
Index: doc/html/man/tabs.1.html
--- ncurses-5.9/doc/html/man/tabs.1.html	2011-04-04 22:46:50.000000000 +0000
+++ ncurses-5.9-20130504/doc/html/man/tabs.1.html	2013-03-09 22:12:04.000000000 +0000
@@ -1,7 +1,7 @@
 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
 <!-- 
   ****************************************************************************
-  * Copyright (c) 2008-2009,2010 Free Software Foundation, Inc.              *
+  * Copyright (c) 2008-2010,2011 Free Software Foundation, Inc.              *
   *                                                                          *
   * Permission is hereby granted, free of charge, to any person obtaining a  *
   * copy of this software and associated documentation files (the            *
@@ -27,7 +27,7 @@
   * sale, use or other dealings in this Software without prior written       *
   * authorization.                                                           *
   ****************************************************************************
-  * @Id: tabs.1,v 1.8 2010/12/04 18:40:45 tom Exp @
+  * @Id: tabs.1,v 1.9 2011/12/17 23:31:59 tom Exp @
 -->
 <HTML>
 <HEAD>
@@ -156,7 +156,7 @@
 <H2>SEE ALSO</H2><PRE>
        <STRONG><A HREF="tset.1.html">tset(1)</A></STRONG>, <STRONG><A HREF="infocmp.1m.html">infocmp(1m)</A></STRONG>, <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>, <STRONG><A HREF="terminfo.5.html">terminfo(5)</A></STRONG>.
 
-       This describes <STRONG>ncurses</STRONG> version 5.9 (patch 20110404).
+       This describes <STRONG>ncurses</STRONG> version 5.9 (patch 20130309).
 
 
 
Index: doc/html/man/term.7.html
--- ncurses-5.9/doc/html/man/term.7.html	2011-02-25 23:25:09.000000000 +0000
+++ ncurses-5.9-20130504/doc/html/man/term.7.html	2013-03-09 22:12:05.000000000 +0000
@@ -1,7 +1,7 @@
 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
 <!-- 
   ****************************************************************************
-  * Copyright (c) 1998-2007,2010 Free Software Foundation, Inc.              *
+  * Copyright (c) 1998-2010,2011 Free Software Foundation, Inc.              *
   *                                                                          *
   * Permission is hereby granted, free of charge, to any person obtaining a  *
   * copy of this software and associated documentation files (the            *
@@ -27,7 +27,7 @@
   * sale, use or other dealings in this Software without prior written       *
   * authorization.                                                           *
   ****************************************************************************
-  * @Id: term.7,v 1.22 2010/12/04 18:41:07 tom Exp @
+  * @Id: term.7,v 1.23 2011/12/17 23:32:17 tom Exp @
 -->
 <HTML>
 <HEAD>
@@ -85,9 +85,9 @@
        the tty device and baud rate.
 
        Setting your own <STRONG>TERM</STRONG> value may also be useful if you have
-       created a custom  entry  incorporating  options  (such  as
-       visual  bell  or reverse-video) which you wish to override
-       the system default type for your line.
+       created a custom entry incorporating options (such as vis-
+       ual  bell or reverse-video) which you wish to override the
+       system default type for your line.
 
        Terminal type descriptions are stored as files of capabil-
        ity data underneath /usr/share/terminfo.  To browse a list
Index: doc/html/man/term_variables.3x.html
--- ncurses-5.9/doc/html/man/term_variables.3x.html	2011-01-09 01:03:29.000000000 +0000
+++ ncurses-5.9-20130504/doc/html/man/term_variables.3x.html	2012-01-09 18:36:45.000000000 +0000
@@ -1,7 +1,7 @@
 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
 <!-- 
   ****************************************************************************
-  * Copyright (c) 2010 Free Software Foundation, Inc.                        *
+  * Copyright (c) 2010,2011 Free Software Foundation, Inc.                   *
   *                                                                          *
   * Permission is hereby granted, free of charge, to any person obtaining a  *
   * copy of this software and associated documentation files (the            *
@@ -27,7 +27,7 @@
   * sale, use or other dealings in this Software without prior written       *
   * authorization.                                                           *
   ****************************************************************************
-  * @Id: term_variables.3x,v 1.2 2010/12/04 18:38:55 tom Exp @
+  * @Id: term_variables.3x,v 1.3 2011/12/17 23:31:50 tom Exp @
 -->
 <HTML>
 <HEAD>
Index: doc/html/man/terminfo.5.html
--- ncurses-5.9/doc/html/man/terminfo.5.html	2011-04-04 22:46:51.000000000 +0000
+++ ncurses-5.9-20130504/doc/html/man/terminfo.5.html	2013-03-09 22:12:05.000000000 +0000
@@ -6,7 +6,7 @@
   * Note: this must be run through tbl before nroff.
   * The magic cookie on the first line triggers this under some man programs.
   ****************************************************************************
-  * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc.              *
+  * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc.              *
   *                                                                          *
   * Permission is hereby granted, free of charge, to any person obtaining a  *
   * copy of this software and associated documentation files (the            *
@@ -32,9 +32,9 @@
   * sale, use or other dealings in this Software without prior written       *
   * authorization.                                                           *
   ****************************************************************************
-  * @Id: terminfo.head,v 1.18 2010/07/31 16:08:48 tom Exp @
+  * @Id: terminfo.head,v 1.20 2013/03/02 23:52:37 tom Exp @
   * Head of terminfo man page ends here
-  * @Id: terminfo.tail,v 1.53 2010/12/04 18:38:55 tom Exp @
+  * @Id: terminfo.tail,v 1.61 2013/03/03 00:06:39 tom Exp @
   * Beginning of terminfo.tail file
   * This file is part of ncurses.
   * See "terminfo.head" for copyright.
@@ -78,7 +78,7 @@
        nals by giving a set of capabilities which they  have,  by
        specifying how to perform screen operations, and by speci-
        fying padding requirements and  initialization  sequences.
-       This describes <STRONG>ncurses</STRONG> version 5.9 (patch 20110404).
+       This describes <STRONG>ncurses</STRONG> version 5.9 (patch 20130309).
 
        Entries in <EM>terminfo</EM> consist of a sequence of `,' separated
        fields (embedded commas may be escaped with a backslash or
@@ -106,14 +106,13 @@
        Terminal names (except for the last, verbose entry) should
        be chosen using the following conventions.  The particular
        piece of hardware making up the  terminal  should  have  a
-       root  name, thus ``hp2621''.  This name should not contain
+       root  name,  thus  "hp2621".  This name should not contain
        hyphens.  Modes that the hardware can be in, or user pref-
        erences,  should  be indicated by appending a hyphen and a
        mode suffix.  Thus, a vt100 in 132 column  mode  would  be
        vt100-w.  The following suffixes should be used where pos-
        sible:
 
-
       <STRONG>Suffix</STRONG>                  <STRONG>Meaning</STRONG>                   <STRONG>Example</STRONG>
       -<EM>nn</EM>      Number of lines on the screen            aaa-60
       -<EM>n</EM>p      Number of pages of memory                c100-4p
@@ -126,14 +125,14 @@
       -ns      No status line                           hp2626-ns
       -rv      Reverse video                            c100-rv
       -s       Enable status line                       vt100-s
-
       -vb      Use visible bell instead of beep         wy370-vb
+
       -w       Wide mode (&gt; 80 columns, usually 132)    vt100-w
 
        For more on terminal naming conventions, see  the  <STRONG>term(7)</STRONG>
        manual page.
 
-   <STRONG>Capabilities</STRONG>
+   <STRONG>Predefined</STRONG> <STRONG>Capabilities</STRONG>
        The  following  is  a  complete  table of the capabilities
        included in a terminfo description block and available  to
        terminfo-using code.  In each line of the table,
@@ -176,133 +175,134 @@
        These are the boolean capabilities:
 
 
-               <STRONG>Variable</STRONG>          <STRONG>Cap-</STRONG>  <STRONG>TCap</STRONG>      <STRONG>Description</STRONG>
-               <STRONG>Booleans</STRONG>          <STRONG>name</STRONG>  <STRONG>Code</STRONG>
-       auto_left_margin          bw    bw    cub1 wraps from col-
+               <STRONG>Variable</STRONG>          <STRONG>Cap-</STRONG>   <STRONG>TCap</STRONG>     <STRONG>Description</STRONG>
+               <STRONG>Booleans</STRONG>          <STRONG>name</STRONG>   <STRONG>Code</STRONG>
+       auto_left_margin          bw     bw   cub1 wraps from col-
                                              umn 0 to last column
-       auto_right_margin         am    am    terminal has auto-
+       auto_right_margin         am     am   terminal has auto-
                                              matic margins
-       back_color_erase          bce   ut    screen erased with
+       back_color_erase          bce    ut   screen erased with
                                              background color
-       can_change                ccc   cc    terminal can re-
+       can_change                ccc    cc   terminal can re-
                                              define existing col-
                                              ors
-       ceol_standout_glitch      xhp   xs    standout not erased
+       ceol_standout_glitch      xhp    xs   standout not erased
                                              by overwriting (hp)
-       col_addr_glitch           xhpa  YA    only positive motion
+       col_addr_glitch           xhpa   YA   only positive motion
                                              for hpa/mhpa caps
 
 
-       cpi_changes_res           cpix  YF    changing character
+
+       cpi_changes_res           cpix   YF   changing character
                                              pitch changes reso-
                                              lution
-       cr_cancels_micro_mode     crxm  YB    using cr turns off
+       cr_cancels_micro_mode     crxm   YB   using cr turns off
                                              micro mode
-       dest_tabs_magic_smso      xt    xt    tabs destructive,
+       dest_tabs_magic_smso      xt     xt   tabs destructive,
                                              magic so char
                                              (t1061)
-       eat_newline_glitch        xenl  xn    newline ignored
+       eat_newline_glitch        xenl   xn   newline ignored
                                              after 80 cols (con-
                                              cept)
-       erase_overstrike          eo    eo    can erase over-
+       erase_overstrike          eo     eo   can erase over-
                                              strikes with a blank
-       generic_type              gn    gn    generic line type
-       hard_copy                 hc    hc    hardcopy terminal
-       hard_cursor               chts  HC    cursor is hard to
+       generic_type              gn     gn   generic line type
+       hard_copy                 hc     hc   hardcopy terminal
+       hard_cursor               chts   HC   cursor is hard to
                                              see
-       has_meta_key              km    km    Has a meta key
+       has_meta_key              km     km   Has a meta key
                                              (i.e., sets 8th-bit)
-       has_print_wheel           daisy YC    printer needs opera-
+       has_print_wheel           daisy  YC   printer needs opera-
                                              tor to change char-
                                              acter set
-       has_status_line           hs    hs    has extra status
+       has_status_line           hs     hs   has extra status
                                              line
-       hue_lightness_saturation  hls   hl    terminal uses only
+       hue_lightness_saturation  hls    hl   terminal uses only
                                              HLS color notation
                                              (Tektronix)
-       insert_null_glitch        in    in    insert mode distin-
+       insert_null_glitch        in     in   insert mode distin-
                                              guishes nulls
-       lpi_changes_res           lpix  YG    changing line pitch
+       lpi_changes_res           lpix   YG   changing line pitch
                                              changes resolution
-       memory_above              da    da    display may be
+       memory_above              da     da   display may be
                                              retained above the
                                              screen
-       memory_below              db    db    display may be
+       memory_below              db     db   display may be
                                              retained below the
                                              screen
-       move_insert_mode          mir   mi    safe to move while
+       move_insert_mode          mir    mi   safe to move while
                                              in insert mode
-       move_standout_mode        msgr  ms    safe to move while
+       move_standout_mode        msgr   ms   safe to move while
                                              in standout mode
-       needs_xon_xoff            nxon  nx    padding will not
+       needs_xon_xoff            nxon   nx   padding will not
                                              work, xon/xoff
                                              required
-       no_esc_ctlc               xsb   xb    beehive (f1=escape,
+       no_esc_ctlc               xsb    xb   beehive (f1=escape,
                                              f2=ctrl C)
-       no_pad_char               npc   NP    pad character does
+       no_pad_char               npc    NP   pad character does
                                              not exist
-       non_dest_scroll_region    ndscr ND    scrolling region is
+       non_dest_scroll_region    ndscr  ND   scrolling region is
                                              non-destructive
-       non_rev_rmcup             nrrmc NR    smcup does not
+       non_rev_rmcup             nrrmc  NR   smcup does not
                                              reverse rmcup
-       over_strike               os    os    terminal can over-
+       over_strike               os     os   terminal can over-
                                              strike
-       prtr_silent               mc5i  5i    printer will not
+       prtr_silent               mc5i   5i   printer will not
                                              echo on screen
-       row_addr_glitch           xvpa  YD    only positive motion
+       row_addr_glitch           xvpa   YD   only positive motion
                                              for vpa/mvpa caps
-       semi_auto_right_margin    sam   YE    printing in last
+       semi_auto_right_margin    sam    YE   printing in last
                                              column causes cr
-       status_line_esc_ok        eslok es    escape can be used
+       status_line_esc_ok        eslok  es   escape can be used
                                              on the status line
-       tilde_glitch              hz    hz    cannot print ~'s
+       tilde_glitch              hz     hz   cannot print ~'s
                                              (hazeltine)
 
 
-       transparent_underline     ul    ul    underline character
+       transparent_underline     ul     ul   underline character
                                              overstrikes
-       xon_xoff                  xon   xo    terminal uses
+       xon_xoff                  xon    xo   terminal uses
                                              xon/xoff handshaking
 
        These are the numeric capabilities:
 
 
-            <STRONG>Variable</STRONG>         <STRONG>Cap-</STRONG>     <STRONG>TCap</STRONG>       <STRONG>Description</STRONG>
-             <STRONG>Numeric</STRONG>         <STRONG>name</STRONG>     <STRONG>Code</STRONG>
-       columns               cols     co     number of columns in
+               <STRONG>Variable</STRONG>          <STRONG>Cap-</STRONG>   <STRONG>TCap</STRONG>     <STRONG>Description</STRONG>
+                <STRONG>Numeric</STRONG>          <STRONG>name</STRONG>   <STRONG>Code</STRONG>
+       columns                   cols   co   number of columns in
                                              a line
-       init_tabs             it       it     tabs initially every
+       init_tabs                 it     it   tabs initially every
                                              # spaces
-       label_height          lh       lh     rows in each label
-       label_width           lw       lw     columns in each
+       label_height              lh     lh   rows in each label
+       label_width               lw     lw   columns in each
                                              label
-       lines                 lines    li     number of lines on
+       lines                     lines  li   number of lines on
                                              screen or page
-       lines_of_memory       lm       lm     lines of memory if &gt;
+       lines_of_memory           lm     lm   lines of memory if &gt;
                                              line. 0 means varies
-       magic_cookie_glitch   xmc      sg     number of blank
+       magic_cookie_glitch       xmc    sg   number of blank
                                              characters left by
                                              smso or rmso
-       max_attributes        ma       ma     maximum combined
+       max_attributes            ma     ma   maximum combined
                                              attributes terminal
                                              can handle
-       max_colors            colors   Co     maximum number of
+       max_colors                colors Co   maximum number of
                                              colors on screen
-       max_pairs             pairs    pa     maximum number of
+       max_pairs                 pairs  pa   maximum number of
                                              color-pairs on the
                                              screen
-       maximum_windows       wnum     MW     maximum number of
+       maximum_windows           wnum   MW   maximum number of
                                              defineable windows
-       no_color_video        ncv      NC     video attributes
+       no_color_video            ncv    NC   video attributes
                                              that cannot be used
                                              with colors
-       num_labels            nlab     Nl     number of labels on
+       num_labels                nlab   Nl   number of labels on
                                              screen
-       padding_baud_rate     pb       pb     lowest baud rate
+       padding_baud_rate         pb     pb   lowest baud rate
                                              where padding needed
-       virtual_terminal      vt       vt     virtual terminal
+       virtual_terminal          vt     vt   virtual terminal
                                              number (CB/unix)
-       width_status_line     wsl      ws     number of columns in
+       width_status_line         wsl    ws   number of columns in
                                              status line
 
        The following numeric  capabilities  are  present  in  the
@@ -310,47 +310,47 @@
        man page.  They came in with SVr4's printer support.
 
 
-             <STRONG>Variable</STRONG>         <STRONG>Cap-</STRONG>    <STRONG>TCap</STRONG>       <STRONG>Description</STRONG>
-             <STRONG>Numeric</STRONG>          <STRONG>name</STRONG>    <STRONG>Code</STRONG>
-       bit_image_entwining    bitwin  Yo     number of passes for
+               <STRONG>Variable</STRONG>          <STRONG>Cap-</STRONG>   <STRONG>TCap</STRONG>     <STRONG>Description</STRONG>
+                <STRONG>Numeric</STRONG>          <STRONG>name</STRONG>   <STRONG>Code</STRONG>
+       bit_image_entwining       bitwin Yo   number of passes for
                                              each bit-image row
-       bit_image_type         bitype  Yp     type of bit-image
+       bit_image_type            bitype Yp   type of bit-image
                                              device
-       buffer_capacity        bufsz   Ya     numbers of bytes
+       buffer_capacity           bufsz  Ya   numbers of bytes
                                              buffered before
                                              printing
-       buttons                btns    BT     number of buttons on
+       buttons                   btns   BT   number of buttons on
                                              mouse
-       dot_horz_spacing       spinh   Yc     spacing of dots hor-
+       dot_horz_spacing          spinh  Yc   spacing of dots hor-
                                              izontally in dots
                                              per inch
 
-       dot_vert_spacing       spinv   Yb     spacing of pins ver-
+       dot_vert_spacing          spinv  Yb   spacing of pins ver-
                                              tically in pins per
                                              inch
-       max_micro_address      maddr   Yd     maximum value in
+       max_micro_address         maddr  Yd   maximum value in
                                              micro_..._address
-       max_micro_jump         mjump   Ye     maximum value in
+       max_micro_jump            mjump  Ye   maximum value in
                                              parm_..._micro
-       micro_col_size         mcs     Yf     character step size
+       micro_col_size            mcs    Yf   character step size
                                              when in micro mode
-       micro_line_size        mls     Yg     line step size when
+       micro_line_size           mls    Yg   line step size when
                                              in micro mode
-       number_of_pins         npins   Yh     numbers of pins in
+       number_of_pins            npins  Yh   numbers of pins in
                                              print-head
-       output_res_char        orc     Yi     horizontal resolu-
+       output_res_char           orc    Yi   horizontal resolu-
                                              tion in units per
                                              line
-       output_res_horz_inch   orhi    Yk     horizontal resolu-
+       output_res_horz_inch      orhi   Yk   horizontal resolu-
                                              tion in units per
                                              inch
-       output_res_line        orl     Yj     vertical resolution
+       output_res_line           orl    Yj   vertical resolution
                                              in units per line
-       output_res_vert_inch   orvi    Yl     vertical resolution
+       output_res_vert_inch      orvi   Yl   vertical resolution
                                              in units per inch
-       print_rate             cps     Ym     print rate in char-
+       print_rate                cps    Ym   print rate in char-
                                              acters per second
-       wide_char_size         widcs   Yn     character step size
+       wide_char_size            widcs  Yn   character step size
                                              when in double wide
                                              mode
 
@@ -402,8 +402,8 @@
                                              prototype !?
        create_window             cwin   CW   define a window #1
                                              from #2,#3 to #4,#5
-       cursor_address            cup    cm   move to row #1
-                                             columns #2
+       cursor_address            cup    cm   move to row #1 col-
+                                             umns #2
        cursor_down               cud1   do   down one line
        cursor_home               home   ho   home cursor (if no
                                              cup)
@@ -904,8 +904,8 @@
        zero_motion               zerom  Zx   No motion for subse-
                                              quent character
 
-       The  following  string  capabilities  are  present  in the
-       SVr4.0 term structure, but were originally not  documented
+       The following  string  capabilities  are  present  in  the
+       SVr4.0  term structure, but were originally not documented
        in the man page.
 
 
@@ -989,13 +989,14 @@
                                                bottom margins to
                                                #1, #2
 
-        The XSI Curses  standard  added  these.   They  are  some
-        post-4.1  versions  of System V curses, e.g., Solaris 2.5
-        and IRIX 6.x.  The <STRONG>ncurses</STRONG> termcap  names  for  them  are
-        invented; according to the XSI Curses standard, they have
-        no termcap names.  If your compiled terminfo entries  use
-        these,  they  may  not be binary-compatible with System V
-        terminfo entries after SVr4.1; beware!
+        The  XSI  Curses  standard added these hardcopy capabili-
+        ties.  They were used in some post-4.1 versions of System
+        V curses, e.g., Solaris 2.5 and IRIX 6.x.  Except for <STRONG>YI</STRONG>,
+        the <STRONG>ncurses</STRONG> termcap names for them are invented.  Accord-
+        ing  to  the  XSI  Curses  standard, they have no termcap
+        names.  If your compiled terminfo entries use these, they
+        may  not  be  binary-compatible  with  System  V terminfo
+        entries after SVr4.1; beware!
 
 
                 <STRONG>Variable</STRONG>         <STRONG>Cap-</STRONG>   <STRONG>TCap</STRONG>     <STRONG>Description</STRONG>
@@ -1015,13 +1016,57 @@
         set_a_attributes         sgr1   sA   Define second set of
                                              video attributes
                                              #1-#6
-        set_pglen_inch           slengthsL   YI Set page length
-                                             to #1 hundredth of
-                                             an inch
+        set_pglen_inch           slengthYI   Set page length to
+                                             #1 hundredth of an
+                                             inch (some implemen-
+                                             tations use sL for
+                                             termcap).
+
+   <STRONG>User-Defined</STRONG> <STRONG>Capabilities</STRONG>
+       The preceding section listed the <EM>predefined</EM>  capabilities.
+       They  deal  with  some  special  features for terminals no
+       longer (or possibly never) produced.   Occasionally  there
+       are  special features of newer terminals which are awkward
+       or impossible to represent by reusing the predefined capa-
+       bilities.
+
+       <STRONG>ncurses</STRONG> addresses this limitation by allowing user-defined
+       capabilities.  The <STRONG>tic</STRONG> and <STRONG>infocmp</STRONG> programs provide the <STRONG>-x</STRONG>
+       option  for  this  purpose.   When  <STRONG>-x</STRONG>  is set, <STRONG>tic</STRONG> treats
+       unknown capabilities as user-defined.   That  is,  if  <STRONG>tic</STRONG>
+       encounters  a capability name which it does not recognize,
+       it infers its type (boolean, number or  string)  from  the
+       syntax and makes an extended table entry for that capabil-
+       ity.  The <STRONG>use_extended_names</STRONG> function makes this  informa-
+       tion conditionally available to applications.  The ncurses
+       library provides the data leaving most of the behavior  to
+       applications:
+
+       <STRONG>o</STRONG>   User-defined capability strings whose name begins with
+           "k" are treated as function keys.
+
+       <STRONG>o</STRONG>   The types (boolean, number, string) determined by  <STRONG>tic</STRONG>
+           can be inferred by successful calls on <STRONG>tigetflag</STRONG>, etc.
+
+       <STRONG>o</STRONG>   If  the  capability name happens to be two characters,
+           the capability is also available through  the  termcap
+           interface.
+
+       While termcap is said to be extensible because it does not
+       use a predefined set of capabilities, in practice  it  has
+       been  limited  to  the  capabilities  defined  by terminfo
+       implementations.  As  a  rule,  user-defined  capabilities
+       intended for use by termcap applications should be limited
+       to booleans and numbers to avoid  running  past  the  1023
+       byte  limit  assumed  by termcap implementations and their
+       applications.  In particular, providing extended  sets  of
+       function  keys  (past the 60 numbered keys and the handful
+       of special named keys) is best done using the longer names
+       available using terminfo.
 
    <STRONG>A</STRONG> <STRONG>Sample</STRONG> <STRONG>Entry</STRONG>
        The following entry, describing an ANSI-standard terminal,
-       is  representative  of  what a <STRONG>terminfo</STRONG> entry for a modern
+       is representative of what a <STRONG>terminfo</STRONG> entry  for  a  modern
        terminal typically looks like.
 
      ansi|ansi/pc-term compatible with color,
@@ -1045,93 +1090,126 @@
              sgr0=\E[0;10m, tbc=\E[2g, u6=\E[%d;%dR, u7=\E[6n,
              u8=\E[?%[;0123456789]c, u9=\E[c, vpa=\E[%p1%dd,
 
-       Entries may continue onto multiple lines by placing  white
-       space  at  the  beginning  of  each line except the first.
-       Comments may be included on lines  beginning  with  ``#''.
-       Capabilities in <EM>terminfo</EM> are of three types: Boolean capa-
-       bilities which indicate that the terminal has some partic-
-       ular  feature, numeric capabilities giving the size of the
-       terminal or the size  of  particular  delays,  and  string
-       capabilities,  which  give a sequence which can be used to
-       perform particular terminal operations.
+       Entries  may continue onto multiple lines by placing white
+       space at the beginning of  each  line  except  the  first.
+       Comments  may  be  included  on  lines beginning with "#".
+       Capabilities in <EM>terminfo</EM> are of three types:
+
+       <STRONG>o</STRONG>   Boolean capabilities which indicate that the  terminal
+           has some particular feature,
 
+       <STRONG>o</STRONG>   numeric  capabilities  giving the size of the terminal
+           or the size of particular delays, and
+
+       <STRONG>o</STRONG>   string capabilities, which give a sequence  which  can
+           be used to perform particular terminal operations.
 
    <STRONG>Types</STRONG> <STRONG>of</STRONG> <STRONG>Capabilities</STRONG>
-       All capabilities have names.  For instance, the fact  that
-       ANSI-standard  terminals  have <EM>automatic</EM> <EM>margins</EM> (i.e., an
-       automatic return and line-feed when the end of a  line  is
-       reached)  is  indicated  by  the capability <STRONG>am</STRONG>.  Hence the
+       All  capabilities have names.  For instance, the fact that
+       ANSI-standard terminals have <EM>automatic</EM> <EM>margins</EM>  (i.e.,  an
+       automatic  return  and line-feed when the end of a line is
+       reached) is indicated by the  capability  <STRONG>am</STRONG>.   Hence  the
        description of ansi includes <STRONG>am</STRONG>.  Numeric capabilities are
-       followed  by  the character `#' and then a positive value.
-       Thus <STRONG>cols</STRONG>, which indicates the number of columns the  ter-
-       minal  has,  gives  the  value  `80' for ansi.  Values for
+       followed by the character `#' and then a  positive  value.
+       Thus  <STRONG>cols</STRONG>, which indicates the number of columns the ter-
+       minal has, gives the value  `80'  for  ansi.   Values  for
        numeric capabilities may be specified in decimal, octal or
-       hexadecimal,  using the C programming language conventions
+       hexadecimal, using the C programming language  conventions
        (e.g., 255, 0377 and 0xff or 0xFF).
 
-       Finally, string valued capabilities, such as <STRONG>el</STRONG> (clear  to
+       Finally,  string valued capabilities, such as <STRONG>el</STRONG> (clear to
        end of line sequence) are given by the two-character code,
-       an `=', and then a string ending  at  the  next  following
+       an  `=',  and  then  a string ending at the next following
        `,'.
 
-       A  number  of  escape sequences are provided in the string
+       A number of escape sequences are provided  in  the  string
        valued capabilities for easy encoding of characters there.
-       Both  <STRONG>\E</STRONG>  and  <STRONG>\e</STRONG> map to an ESCAPE character, <STRONG>^x</STRONG> maps to a
-       control-x for any appropriate x, and the sequences  <STRONG>\n</STRONG>  <STRONG>\l</STRONG>
-       <STRONG>\r</STRONG>  <STRONG>\t</STRONG>  <STRONG>\b</STRONG>  <STRONG>\f</STRONG>  <STRONG>\s</STRONG> give a newline, line-feed, return, tab,
-       backspace, form-feed, and space.  Other escapes include <STRONG>\^</STRONG>
-       for  <STRONG>^</STRONG>, <STRONG>\\</STRONG> for <STRONG>\</STRONG>, <STRONG>\</STRONG>, for comma, <STRONG>\:</STRONG> for <STRONG>:</STRONG>, and <STRONG>\0</STRONG> for null.
-       (<STRONG>\0</STRONG> will produce \200, which does not terminate  a  string
-       but behaves as a null character on most terminals, provid-
-       ing CS7 is specified.  See <STRONG><A HREF="stty.1.html">stty(1)</A></STRONG>.)  Finally,  characters
-       may be given as three octal digits after a <STRONG>\</STRONG>.
-
-       A  delay  in  milliseconds may appear anywhere in a string
-       capability, enclosed in $&lt;..&gt; brackets, as in  <STRONG>el</STRONG>=\EK$&lt;5&gt;,
-       and  padding  characters  are supplied by <EM>tputs</EM> to provide
-       this delay.  The delay must be a number with at  most  one
+       Both <STRONG>\E</STRONG> and <STRONG>\e</STRONG> map to an ESCAPE character, <STRONG>^x</STRONG>  maps  to  a
+       control-x  for  any appropriate x, and the sequences <STRONG>\n</STRONG> <STRONG>\l</STRONG>
+       <STRONG>\r</STRONG> <STRONG>\t</STRONG> <STRONG>\b</STRONG> <STRONG>\f</STRONG> <STRONG>\s</STRONG> give a  newline,  line-feed,  return,  tab,
+       backspace, form-feed, and space.  Other escapes include
+
+       <STRONG>o</STRONG>   <STRONG>\^</STRONG> for <STRONG>^</STRONG>,
+
+       <STRONG>o</STRONG>   <STRONG>\\</STRONG> for <STRONG>\</STRONG>,
+
+       <STRONG>o</STRONG>   <STRONG>\</STRONG>, for comma,
+
+       <STRONG>o</STRONG>   <STRONG>\:</STRONG> for <STRONG>:</STRONG>,
+
+       <STRONG>o</STRONG>   and <STRONG>\0</STRONG> for null.
+
+           <STRONG>\0</STRONG>  will  produce  \200,  which  does  not terminate a
+           string but behaves as a null character on most  termi-
+           nals, providing CS7 is specified.  See <STRONG><A HREF="stty.1.html">stty(1)</A></STRONG>.
+
+           The  reason  for this quirk is to maintain binary com-
+           patibility of the compiled terminfo files  with  other
+           implementations,  e.g.,  the SVr4 systems, which docu-
+           ment this.  Compiled terminfo  files  use  null-termi-
+           nated  strings, with no lengths.  Modifying this would
+           require a new binary format, which would not work with
+           other implementations.
+
+       Finally,  characters  may  be  given as three octal digits
+       after a <STRONG>\</STRONG>.
+
+       A delay in milliseconds may appear anywhere  in  a  string
+       capability,  enclosed in $&lt;..&gt; brackets, as in <STRONG>el</STRONG>=\EK$&lt;5&gt;,
+       and padding characters are supplied by  <EM>tputs</EM>  to  provide
+       this  delay.   The delay must be a number with at most one
        decimal place of precision; it may be followed by suffixes
-       `*' or '/' or both.  A  `*'  indicates  that  the  padding
-       required  is  proportional to the number of lines affected
-       by the  operation,  and  the  amount  given  is  the  per-
-       affected-unit  padding  required.   (In the case of insert
+       `*'  or  '/'  or  both.   A `*' indicates that the padding
+       required is proportional to the number of  lines  affected
+       by  the  operation,  and  the  amount  given  is  the per-
+       affected-unit padding required.  (In the  case  of  insert
        character,  the  factor  is  still  the  number  of  <EM>lines</EM>
-       affected.)   Normally,  padding  is advisory if the device
-       has the <STRONG>xon</STRONG> capability; it is used  for  cost  computation
-       but  does not trigger delays.  A `/' suffix indicates that
-       the padding is mandatory and forces a delay of  the  given
-       number  of  milliseconds  even on devices for which <STRONG>xon</STRONG> is
+       affected.)  Normally, padding is advisory  if  the  device
+       has  the  <STRONG>xon</STRONG>  capability; it is used for cost computation
+       but does not trigger delays.  A `/' suffix indicates  that
+       the  padding  is mandatory and forces a delay of the given
+       number of milliseconds even on devices for  which  <STRONG>xon</STRONG>  is
        present to indicate flow control.
 
-       Sometimes individual capabilities must be  commented  out.
-       To  do this, put a period before the capability name.  For
+       Sometimes  individual  capabilities must be commented out.
+       To do this, put a period before the capability name.   For
        example, see the second <STRONG>ind</STRONG> in the example above.
 
-
    <STRONG>Fetching</STRONG> <STRONG>Compiled</STRONG> <STRONG>Descriptions</STRONG>
-       If the environment variable TERMINFO is set, it is  inter-
-       preted  as the pathname of a directory containing the com-
-       piled description you are working on.  Only that directory
-       is searched.
-
-       If  TERMINFO  is  not set, the <STRONG>ncurses</STRONG> version of the ter-
-       minfo reader code  will  instead  look  in  the  directory
-       <STRONG>$HOME/.terminfo</STRONG>  for  a compiled description.  If it fails
-       to find one  there,  and  the  environment  variable  TER-
-       MINFO_DIRS  is set, it will interpret the contents of that
-       variable as a list of colon- separated directories  to  be
-       searched  (an  empty  entry is interpreted as a command to
-       search <EM>/usr/share/terminfo</EM>).  If no description  is  found
-       in  any of the TERMINFO_DIRS directories, the fetch fails.
-
-       If neither TERMINFO nor TERMINFO_DIRS  is  set,  the  last
-       place   tried  will  be  the  system  terminfo  directory,
-       <EM>/usr/share/terminfo</EM>.
-
-       (Neither the  <STRONG>$HOME/.terminfo</STRONG>  lookups  nor  TERMINFO_DIRS
-       extensions   are  supported  under  stock  System  V  ter-
-       minfo/curses.)
+       The  <STRONG>ncurses</STRONG> library searches for terminal descriptions in
+       several places.  It uses only the first description found.
+       The  library  has  a  compiled-in list of places to search
+       which can be overridden by environment variables.   Before
+       starting  to  search, <STRONG>ncurses</STRONG> eliminates duplicates in its
+       search list.
+
+       <STRONG>o</STRONG>   If the environment variable TERMINFO  is  set,  it  is
+           interpreted  as the pathname of a directory containing
+           the compiled description you  are  working  on.   Only
+           that directory is searched.
+
+       <STRONG>o</STRONG>   If  TERMINFO  is not set, <STRONG>ncurses</STRONG> will instead look in
+           the directory <STRONG>$HOME/.terminfo</STRONG> for a compiled  descrip-
+           tion.
+
+       <STRONG>o</STRONG>   Next,  if  the  environment  variable TERMINFO_DIRS is
+           set, <STRONG>ncurses</STRONG> will interpret the contents of that vari-
+           able  as  a  list  of  colon-separated directories (or
+           database files) to be searched.
+
+           An empty directory name (i.e., if the variable  begins
+           or  ends  with a colon, or contains adacent colons) is
+           interpreted as  the  system  location  <EM>/usr/share/ter-</EM>
+           <EM>minfo</EM>.
+
+       <STRONG>o</STRONG>   Finally, <STRONG>ncurses</STRONG> searches these compiled-in locations:
+
+           <STRONG>o</STRONG>   a           list           of          directories
+               (/usr/local/ncurses/share/terminfo:/usr/share/ter-
+               minfo), and
 
+           <STRONG>o</STRONG>   the system terminfo directory, <EM>/usr/share/terminfo</EM>
+               (the compiled-in default).
 
    <STRONG>Preparing</STRONG> <STRONG>Descriptions</STRONG>
        We now outline how to prepare descriptions  of  terminals.
@@ -1152,7 +1230,6 @@
        ally  needed.  A similar test can be used for insert char-
        acter.
 
-
    <STRONG>Basic</STRONG> <STRONG>Capabilities</STRONG>
        The number of columns on each line  for  the  terminal  is
        given  by the <STRONG>cols</STRONG> numeric capability.  If the terminal is
@@ -1190,35 +1267,35 @@
        left corner of the screen and send the <STRONG>ind</STRONG> (index) string.
 
        To scroll text down, a program goes to the top left corner
-       of  the  screen  and  sends the <STRONG>ri</STRONG> (reverse index) string.
-       The strings <STRONG>ind</STRONG> and <STRONG>ri</STRONG> are undefined  when  not  on  their
+       of the screen and sends the  <STRONG>ri</STRONG>  (reverse  index)  string.
+       The  strings  <STRONG>ind</STRONG>  and  <STRONG>ri</STRONG> are undefined when not on their
        respective corners of the screen.
 
        Parameterized versions of the scrolling sequences are <STRONG>indn</STRONG>
        and <STRONG>rin</STRONG> which have the same semantics as <STRONG>ind</STRONG> and <STRONG>ri</STRONG> except
-       that  they take one parameter, and scroll that many lines.
-       They are also undefined except at the appropriate edge  of
+       that they take one parameter, and scroll that many  lines.
+       They  are also undefined except at the appropriate edge of
        the screen.
 
-       The  <STRONG>am</STRONG>  capability tells whether the cursor sticks at the
-       right edge of the screen when text  is  output,  but  this
+       The <STRONG>am</STRONG> capability tells whether the cursor sticks  at  the
+       right  edge  of  the  screen when text is output, but this
        does not necessarily apply to a <STRONG>cuf1</STRONG> from the last column.
-       The only local motion which is defined from the left  edge
-       is  if  <STRONG>bw</STRONG>  is  given, then a <STRONG>cub1</STRONG> from the left edge will
-       move to the right edge of the previous row.  If <STRONG>bw</STRONG> is  not
-       given,  the effect is undefined.  This is useful for draw-
-       ing a box around the edge of the screen, for example.   If
-       the  terminal has switch selectable automatic margins, the
-       <EM>terminfo</EM> file usually assumes that this is on;  i.e.,  <STRONG>am</STRONG>.
-       If  the  terminal  has  a command which moves to the first
-       column of the next line, that command can be given as  <STRONG>nel</STRONG>
-       (newline).   It  does not matter if the command clears the
-       remainder of the current line, so if the terminal  has  no
-       <STRONG>cr</STRONG>  and <STRONG>lf</STRONG> it may still be possible to craft a working <STRONG>nel</STRONG>
+       The  only local motion which is defined from the left edge
+       is if <STRONG>bw</STRONG> is given, then a <STRONG>cub1</STRONG> from  the  left  edge  will
+       move  to the right edge of the previous row.  If <STRONG>bw</STRONG> is not
+       given, the effect is undefined.  This is useful for  draw-
+       ing  a box around the edge of the screen, for example.  If
+       the terminal has switch selectable automatic margins,  the
+       <EM>terminfo</EM>  file  usually assumes that this is on; i.e., <STRONG>am</STRONG>.
+       If the terminal has a command which  moves  to  the  first
+       column  of the next line, that command can be given as <STRONG>nel</STRONG>
+       (newline).  It does not matter if the command  clears  the
+       remainder  of  the current line, so if the terminal has no
+       <STRONG>cr</STRONG> and <STRONG>lf</STRONG> it may still be possible to craft a working  <STRONG>nel</STRONG>
        out of one or both of them.
 
        These  capabilities  suffice  to  describe  hard-copy  and
-       "glass-tty"  terminals.   Thus  the  model  33 teletype is
+       "glass-tty" terminals.  Thus  the  model  33  teletype  is
        described as
 
        33|tty33|tty|model 33 teletype,
@@ -1230,34 +1307,32 @@
             am, bel=^G, clear=^Z, cols#80, cr=^M, cub1=^H, cud1=^J,
             ind=^J, lines#24,
 
-
    <STRONG>Parameterized</STRONG> <STRONG>Strings</STRONG>
-       Cursor addressing and other strings  requiring  parameters
-       in  the  terminal  are described by a parameterized string
-       capability, with <STRONG><A HREF="printf.3.html">printf(3)</A></STRONG> like escapes  <STRONG>%x</STRONG>  in  it.   For
-       example,  to  address  the  cursor,  the <STRONG>cup</STRONG> capability is
+       Cursor  addressing  and other strings requiring parameters
+       in the terminal are described by  a  parameterized  string
+       capability,  with  <STRONG><A HREF="printf.3.html">printf(3)</A></STRONG>  like  escapes <STRONG>%x</STRONG> in it.  For
+       example, to address the  cursor,  the  <STRONG>cup</STRONG>  capability  is
        given, using two parameters: the row and column to address
        to.  (Rows and columns are numbered from zero and refer to
        the physical screen visible to the user, not to any unseen
-       memory.)   If  the  terminal  has  memory  relative cursor
+       memory.)  If  the  terminal  has  memory  relative  cursor
        addressing, that can be indicated by <STRONG>mrcup</STRONG>.
 
-       The parameter mechanism uses a stack and special  <STRONG>%</STRONG>  codes
-       to  manipulate  it.  Typically a sequence will push one of
-       the parameters onto the stack and then print  it  in  some
-       format.   Print  (e.g.,  "%d")  is  a special case.  Other
-       operations, including "%t"  pop  their  operand  from  the
+       The  parameter  mechanism uses a stack and special <STRONG>%</STRONG> codes
+       to manipulate it.  Typically a sequence will push  one  of
+       the  parameters  onto  the stack and then print it in some
+       format.  Print (e.g., "%d")  is  a  special  case.   Other
+       operations,  including  "%t"  pop  their  operand from the
        stack.  It is noted that more complex operations are often
        necessary, e.g., in the <STRONG>sgr</STRONG> string.
 
        The <STRONG>%</STRONG> encodings have the following meanings:
 
-
        %%   outputs `%'
 
        %<EM>[[</EM>:<EM>]flags][width[.precision]][</EM>doxXs<EM>]</EM>
-            as in <STRONG>printf</STRONG>, flags are [-+#] and space.  Use  a  `:'
-            to  allow the next character to be a `-' flag, avoid-
+            as  in  <STRONG>printf</STRONG>, flags are [-+#] and space.  Use a `:'
+            to allow the next character to be a `-' flag,  avoid-
             ing interpreting "%-" as an operator.
 
        %c   print pop() like %c in <STRONG>printf</STRONG>
@@ -1279,11 +1354,11 @@
        %g[A-Z]
             get static variable [a-z] and push it
 
-            The terms  "static"  and  "dynamic"  are  misleading.
-            Historically,  these are simply two different sets of
-            variables, whose values are not reset  between  calls
-            to  <STRONG>tparm</STRONG>.   However,  that fact is not documented in
-            other implementations.  Relying on it will  adversely
+            The  terms  "static"  and  "dynamic"  are misleading.
+            Historically, these are simply two different sets  of
+            variables,  whose  values are not reset between calls
+            to <STRONG>tparm</STRONG>.  However, that fact is  not  documented  in
+            other  implementations.  Relying on it will adversely
             impact portability to other implementations.
 
        %'<EM>c</EM>' char constant <EM>c</EM>
@@ -1307,16 +1382,16 @@
             logical AND and OR operations (for conditionals)
 
        %! %~
-            unary  operations  (logical  and   bit   complement):
+            unary   operations   (logical  and  bit  complement):
             push(op pop())
 
        %i   add 1 to first two parameters (for ANSI terminals)
 
        %? <EM>expr</EM> %t <EM>thenpart</EM> %e <EM>elsepart</EM> %;
-            This  forms  an  if-then-else.   The  %e  <EM>elsepart</EM> is
-            optional.  Usually the %? <EM>expr</EM> part  pushes  a  value
-            onto  the stack, and %t pops it from the stack, test-
-            ing if it is nonzero (true).  If it is zero  (false),
+            This forms  an  if-then-else.   The  %e  <EM>elsepart</EM>  is
+            optional.   Usually  the  %? <EM>expr</EM> part pushes a value
+            onto the stack, and %t pops it from the stack,  test-
+            ing  if it is nonzero (true).  If it is zero (false),
             control passes to the %e (else) part.
 
             It is possible to form else-if's a la Algol 68:
@@ -1342,241 +1417,238 @@
        its.  Thus its <STRONG>cup</STRONG> capability is "cup=6\E&amp;%p2%2dc%p1%2dY".
 
        The Microterm ACT-IV needs the current row and column sent
-       preceded  by  a <STRONG>^T</STRONG>, with the row and column simply encoded
-       in binary, "cup=^T%p1%c%p2%c".  Terminals which  use  "%c"
-       need  to  be  able  to backspace the cursor (<STRONG>cub1</STRONG>), and to
+       preceded by a <STRONG>^T</STRONG>, with the row and column  simply  encoded
+       in  binary,  "cup=^T%p1%c%p2%c".  Terminals which use "%c"
+       need to be able to backspace the  cursor  (<STRONG>cub1</STRONG>),  and  to
        move the cursor up one line on the screen (<STRONG>cuu1</STRONG>).  This is
-       necessary  because it is not always safe to transmit <STRONG>\n</STRONG> <STRONG>^D</STRONG>
-       and <STRONG>\r</STRONG>, as the system may change or  discard  them.   (The
-       library  routines  dealing  with terminfo set tty modes so
+       necessary because it is not always safe to transmit <STRONG>\n</STRONG>  <STRONG>^D</STRONG>
+       and  <STRONG>\r</STRONG>,  as  the system may change or discard them.  (The
+       library routines dealing with terminfo set  tty  modes  so
        that tabs are never expanded, so \t is safe to send.  This
        turns out to be essential for the Ann Arbor 4080.)
 
        A final example is the LSI ADM-3a, which uses row and col-
        umn  offset  by  a  blank  character,  thus  "cup=\E=%p1%'
-       '%+%c%p2%'  '%+%c".   After sending `\E=', this pushes the
-       first parameter, pushes the ASCII value for a space  (32),
-       adds  them  (pushing  the sum on the stack in place of the
-       two previous values) and outputs that value as  a  charac-
-       ter.   Then  the  same  is  done for the second parameter.
+       '%+%c%p2%' '%+%c".  After sending `\E=', this  pushes  the
+       first  parameter, pushes the ASCII value for a space (32),
+       adds them (pushing the sum on the stack in  place  of  the
+       two  previous  values) and outputs that value as a charac-
+       ter.  Then the same is  done  for  the  second  parameter.
        More complex arithmetic is possible using the stack.
 
-
    <STRONG>Cursor</STRONG> <STRONG>Motions</STRONG>
        If the terminal has a fast way to home the cursor (to very
-       upper  left  corner  of  screen) then this can be given as
-       <STRONG>home</STRONG>; similarly a fast way of getting to the  lower  left-
-       hand  corner can be given as <STRONG>ll</STRONG>; this may involve going up
-       with <STRONG>cuu1</STRONG> from the home position,  but  a  program  should
-       never  do this itself (unless <STRONG>ll</STRONG> does) because it can make
-       no assumption about the effect of moving up from the  home
-       position.   Note  that  the  home  position is the same as
+       upper left corner of screen) then this  can  be  given  as
+       <STRONG>home</STRONG>;  similarly  a fast way of getting to the lower left-
+       hand corner can be given as <STRONG>ll</STRONG>; this may involve going  up
+       with  <STRONG>cuu1</STRONG>  from  the  home position, but a program should
+       never do this itself (unless <STRONG>ll</STRONG> does) because it can  make
+       no  assumption about the effect of moving up from the home
+       position.  Note that the home  position  is  the  same  as
        addressing to (0,0): to the top left corner of the screen,
-       not  of  memory.   (Thus, the \EH sequence on HP terminals
+       not of memory.  (Thus, the \EH sequence  on  HP  terminals
        cannot be used for <STRONG>home</STRONG>.)
 
        If the terminal has row or column absolute cursor address-
-       ing,  these  can be given as single parameter capabilities
+       ing, these can be given as single  parameter  capabilities
        <STRONG>hpa</STRONG> (horizontal position absolute) and <STRONG>vpa</STRONG> (vertical posi-
        tion absolute).  Sometimes these are shorter than the more
-       general two parameter sequence (as with  the  hp2645)  and
-       can   be   used  in  preference  to  <STRONG>cup</STRONG>.   If  there  are
-       parameterized local motions (e.g., move <EM>n</EM>  spaces  to  the
-       right) these can be given as <STRONG>cud</STRONG>, <STRONG>cub</STRONG>, <STRONG>cuf</STRONG>, and <STRONG>cuu</STRONG> with a
-       single parameter  indicating  how  many  spaces  to  move.
-       These  are  primarily useful if the terminal does not have
-       <STRONG>cup</STRONG>, such as the TEKTRONIX 4025.
+       general  two  parameter  sequence (as with the hp2645) and
+       can be used in preference to <STRONG>cup</STRONG>.  If there are parameter-
+       ized  local  motions  (e.g.,  move  <EM>n</EM> spaces to the right)
+       these can be given as <STRONG>cud</STRONG>, <STRONG>cub</STRONG>, <STRONG>cuf</STRONG>, and <STRONG>cuu</STRONG> with a single
+       parameter  indicating  how many spaces to move.  These are
+       primarily useful if the terminal does not have  <STRONG>cup</STRONG>,  such
+       as the TEKTRONIX 4025.
 
        If the terminal needs to be in a special mode when running
        a program that uses these capabilities, the codes to enter
-       and exit this mode can be given as <STRONG>smcup</STRONG> and <STRONG>rmcup</STRONG>.   This
-       arises,  for example, from terminals like the Concept with
-       more than one page of memory.  If the  terminal  has  only
-       memory  relative cursor addressing and not screen relative
+       and  exit this mode can be given as <STRONG>smcup</STRONG> and <STRONG>rmcup</STRONG>.  This
+       arises, for example, from terminals like the Concept  with
+       more  than  one  page of memory.  If the terminal has only
+       memory relative cursor addressing and not screen  relative
        cursor addressing, a one screen-sized window must be fixed
-       into  the terminal for cursor addressing to work properly.
+       into the terminal for cursor addressing to work  properly.
        This is also used for the TEKTRONIX 4025, where <STRONG>smcup</STRONG> sets
-       the  command character to be the one used by terminfo.  If
-       the <STRONG>smcup</STRONG> sequence will not restore the  screen  after  an
+       the command character to be the one used by terminfo.   If
+       the  <STRONG>smcup</STRONG>  sequence  will not restore the screen after an
        <STRONG>rmcup</STRONG> sequence is output (to the state prior to outputting
        <STRONG>rmcup</STRONG>), specify <STRONG>nrrmc</STRONG>.
 
-
    <STRONG>Area</STRONG> <STRONG>Clears</STRONG>
        If the terminal can clear from the current position to the
-       end  of  the  line,  leaving  the cursor where it is, this
+       end of the line, leaving the  cursor  where  it  is,  this
        should be given as <STRONG>el</STRONG>.  If the terminal can clear from the
-       beginning  of  the line to the current position inclusive,
-       leaving the cursor where it is, this should  be  given  as
-       <STRONG>el1</STRONG>.   If the terminal can clear from the current position
-       to the end of the display, then this should  be  given  as
-       <STRONG>ed</STRONG>.   <STRONG>Ed</STRONG>  is only defined from the first column of a line.
-       (Thus, it can be simulated by a request to delete a  large
+       beginning of the line to the current  position  inclusive,
+       leaving  the  cursor  where it is, this should be given as
+       <STRONG>el1</STRONG>.  If the terminal can clear from the current  position
+       to  the  end  of the display, then this should be given as
+       <STRONG>ed</STRONG>.  <STRONG>Ed</STRONG> is only defined from the first column of  a  line.
+       (Thus,  it can be simulated by a request to delete a large
        number of lines, if a true <STRONG>ed</STRONG> is not available.)
 
-
    <STRONG>Insert/delete</STRONG> <STRONG>line</STRONG> <STRONG>and</STRONG> <STRONG>vertical</STRONG> <STRONG>motions</STRONG>
-       If  the terminal can open a new blank line before the line
-       where the cursor is, this should be given as <STRONG>il1</STRONG>; this  is
-       done  only  from the first position of a line.  The cursor
+       If the terminal can open a new blank line before the  line
+       where  the cursor is, this should be given as <STRONG>il1</STRONG>; this is
+       done only from the first position of a line.   The  cursor
        must then appear on the newly blank line.  If the terminal
-       can  delete  the  line  which  the cursor is on, then this
-       should be given as <STRONG>dl1</STRONG>; this is done only from  the  first
-       position  on  the line to be deleted.  Versions of <STRONG>il1</STRONG> and
-       <STRONG>dl1</STRONG> which take a single parameter  and  insert  or  delete
+       can delete the line which the  cursor  is  on,  then  this
+       should  be  given as <STRONG>dl1</STRONG>; this is done only from the first
+       position on the line to be deleted.  Versions of  <STRONG>il1</STRONG>  and
+       <STRONG>dl1</STRONG>  which  take  a  single parameter and insert or delete
        that many lines can be given as <STRONG>il</STRONG> and <STRONG>dl</STRONG>.
 
-       If  the terminal has a settable scrolling region (like the
-       vt100) the command to set this can be described  with  the
-       <STRONG>csr</STRONG>  capability,  which  takes two parameters: the top and
+       If the terminal has a settable scrolling region (like  the
+       vt100)  the  command to set this can be described with the
+       <STRONG>csr</STRONG> capability, which takes two parameters:  the  top  and
        bottom lines of the scrolling region.  The cursor position
        is, alas, undefined after using this command.
 
-       It  is possible to get the effect of insert or delete line
+       It is possible to get the effect of insert or delete  line
        using <STRONG>csr</STRONG> on a properly chosen region; the <STRONG>sc</STRONG> and <STRONG>rc</STRONG> (save
-       and  restore  cursor)  commands may be useful for ensuring
-       that your synthesized insert/delete string does  not  move
-       the  cursor.  (Note that the <STRONG><A HREF="ncurses.3x.html">ncurses(3x)</A></STRONG> library does this
-       synthesis  automatically,  so   you   need   not   compose
+       and restore cursor) commands may be  useful  for  ensuring
+       that  your  synthesized insert/delete string does not move
+       the cursor.  (Note that the <STRONG><A HREF="ncurses.3x.html">ncurses(3x)</A></STRONG> library does  this
+       synthesis   automatically,   so   you   need  not  compose
        insert/delete strings for an entry with <STRONG>csr</STRONG>).
 
        Yet another way to construct insert and delete might be to
-       use a combination of index with  the  memory-lock  feature
-       found  on some terminals (like the HP-700/90 series, which
+       use  a  combination  of index with the memory-lock feature
+       found on some terminals (like the HP-700/90 series,  which
        however also has insert/delete).
 
-       Inserting lines at the top or bottom  of  the  screen  can
-       also  be  done using <STRONG>ri</STRONG> or <STRONG>ind</STRONG> on many terminals without a
-       true insert/delete line, and is often faster even on  ter-
+       Inserting  lines  at  the  top or bottom of the screen can
+       also be done using <STRONG>ri</STRONG> or <STRONG>ind</STRONG> on many terminals  without  a
+       true  insert/delete line, and is often faster even on ter-
        minals with those features.
 
-       The  boolean  <STRONG>non_dest_scroll_region</STRONG> should be set if each
-       scrolling window is effectively a view port on  a  screen-
-       sized  canvas.   To  test  for  this  capability, create a
-       scrolling region in the middle of the screen, write  some-
-       thing  to  the  bottom line, move the cursor to the top of
+       The boolean <STRONG>non_dest_scroll_region</STRONG> should be set  if  each
+       scrolling  window  is effectively a view port on a screen-
+       sized canvas.  To  test  for  this  capability,  create  a
+       scrolling  region in the middle of the screen, write some-
+       thing to the bottom line, move the cursor to  the  top  of
        the region, and do <STRONG>ri</STRONG> followed by <STRONG>dl1</STRONG> or <STRONG>ind</STRONG>.  If the data
-       scrolled  off  the  bottom  of  the  region  by the <STRONG>ri</STRONG> re-
-       appears, then scrolling is non-destructive.  System V  and
-       XSI  Curses  expect that <STRONG>ind</STRONG>, <STRONG>ri</STRONG>, <STRONG>indn</STRONG>, and <STRONG>rin</STRONG> will simu-
-       late destructive scrolling; their  documentation  cautions
-       you  not  to  define <STRONG>csr</STRONG> unless this is true.  This <STRONG>curses</STRONG>
+       scrolled off the bottom  of  the  region  by  the  <STRONG>ri</STRONG>  re-
+       appears,  then scrolling is non-destructive.  System V and
+       XSI Curses expect that <STRONG>ind</STRONG>, <STRONG>ri</STRONG>, <STRONG>indn</STRONG>, and <STRONG>rin</STRONG>  will  simu-
+       late  destructive  scrolling; their documentation cautions
+       you not to define <STRONG>csr</STRONG> unless this is  true.   This  <STRONG>curses</STRONG>
        implementation is more liberal and will do explicit erases
        after scrolling if <STRONG>ndstr</STRONG> is defined.
 
        If the terminal has the ability to define a window as part
-       of memory, which all commands affect, it should  be  given
+       of  memory,  which all commands affect, it should be given
        as the parameterized string <STRONG>wind</STRONG>.  The four parameters are
-       the starting and ending lines in memory and  the  starting
+       the  starting  and ending lines in memory and the starting
        and ending columns in memory, in that order.
 
-       If  the terminal can retain display memory above, then the
-       <STRONG>da</STRONG> capability should be given; if display  memory  can  be
-       retained  below,  then <STRONG>db</STRONG> should be given.  These indicate
-       that deleting a line  or  scrolling  may  bring  non-blank
-       lines  up  from  below  or that scrolling back with <STRONG>ri</STRONG> may
+       If the terminal can retain display memory above, then  the
+       <STRONG>da</STRONG>  capability  should  be given; if display memory can be
+       retained below, then <STRONG>db</STRONG> should be given.   These  indicate
+       that  deleting  a  line  or  scrolling may bring non-blank
+       lines up from below or that scrolling  back  with  <STRONG>ri</STRONG>  may
        bring down non-blank lines.
 
-
    <STRONG>Insert/Delete</STRONG> <STRONG>Character</STRONG>
-       There are two basic kinds of  intelligent  terminals  with
-       respect  to insert/delete character which can be described
-       using <EM>terminfo.</EM>  The most common  insert/delete  character
-       operations  affect only the characters on the current line
-       and shift characters off the  end  of  the  line  rigidly.
-       Other  terminals,  such  as the Concept 100 and the Perkin
-       Elmer Owl, make a distinction between  typed  and  untyped
-       blanks  on  the  screen, shifting upon an insert or delete
-       only to an untyped blank on the  screen  which  is  either
-       eliminated,  or  expanded  to two untyped blanks.  You can
-       determine the kind of terminal you have  by  clearing  the
-       screen  and  then typing text separated by cursor motions.
-       Type "abc    def" using local cursor motions (not  spaces)
-       between the "abc" and the "def".  Then position the cursor
-       before the "abc" and put the terminal in insert mode.   If
-       typing  characters  causes  the  rest of the line to shift
-       rigidly and characters to fall off the end, then your ter-
-       minal  does  not  distinguish  between  blanks and untyped
-       positions.  If the "abc" shifts over to  the  "def"  which
-       then  move together around the end of the current line and
-       onto the next as you insert, you have the second  type  of
-       terminal,  and should give the capability <STRONG>in</STRONG>, which stands
-       for "insert null".  While these are two logically separate
-       attributes  (one  line  versus multi-line insert mode, and
-       special treatment of untyped spaces) we have seen no  ter-
-       minals whose insert mode cannot be described with the sin-
-       gle attribute.
+       There  are  two  basic kinds of intelligent terminals with
+       respect to insert/delete character which can be  described
+       using  <EM>terminfo.</EM>   The most common insert/delete character
+       operations affect only the characters on the current  line
+       and  shift  characters  off  the  end of the line rigidly.
+       Other terminals, such as the Concept 100  and  the  Perkin
+       Elmer  Owl,  make  a distinction between typed and untyped
+       blanks on the screen, shifting upon an  insert  or  delete
+       only  to  an  untyped  blank on the screen which is either
+       eliminated, or expanded to two untyped blanks.
+
+       You can determine the kind of terminal you have by  clear-
+       ing  the  screen  and then typing text separated by cursor
+       motions.  Type "abc    def"  using  local  cursor  motions
+       (not  spaces) between the "abc" and the "def".  Then posi-
+       tion the cursor before the "abc" and put the  terminal  in
+       insert  mode.  If typing characters causes the rest of the
+       line to shift rigidly and characters to fall off the  end,
+       then your terminal does not distinguish between blanks and
+       untyped positions.  If the "abc" shifts over to the  "def"
+       which  then  move  together  around the end of the current
+       line and onto the next as you insert, you have the  second
+       type of terminal, and should give the capability <STRONG>in</STRONG>, which
+       stands for "insert null".
+
+       While these are two  logically  separate  attributes  (one
+       line  versus multi-line insert mode, and special treatment
+       of untyped spaces) we have seen no terminals whose  insert
+       mode cannot be described with the single attribute.
 
-       Terminfo can describe both terminals which have an  insert
+       Terminfo  can describe both terminals which have an insert
        mode, and terminals which send a simple sequence to open a
-       blank position on the current  line.   Give  as  <STRONG>smir</STRONG>  the
-       sequence  to  get  into  insert  mode.   Give  as <STRONG>rmir</STRONG> the
-       sequence to leave insert  mode.   Now  give  as  <STRONG>ich1</STRONG>  any
-       sequence  needed  to  be  sent  just  before  sending  the
-       character to be inserted.   Most  terminals  with  a  true
-       insert  mode  will  not  give <STRONG>ich1</STRONG>; terminals which send a
-       sequence to open a screen position should give it here.
-
-       If your terminal has both, insert mode is usually  prefer-
-       able  to  <STRONG>ich1</STRONG>.   Technically,  you  should  not give both
-       unless the terminal actually requires both to be  used  in
-       combination.   Accordingly,  some  non-curses applications
-       get confused if both are present; the symptom  is  doubled
+       blank  position  on  the  current  line.  Give as <STRONG>smir</STRONG> the
+       sequence to get  into  insert  mode.   Give  as  <STRONG>rmir</STRONG>  the
+       sequence  to  leave  insert  mode.   Now  give as <STRONG>ich1</STRONG> any
+       sequence needed to be sent just before sending the charac-
+       ter  to  be  inserted.   Most terminals with a true insert
+       mode will not give <STRONG>ich1</STRONG>; terminals which send  a  sequence
+       to open a screen position should give it here.
+
+       If  your terminal has both, insert mode is usually prefer-
+       able to <STRONG>ich1</STRONG>.   Technically,  you  should  not  give  both
+       unless  the  terminal actually requires both to be used in
+       combination.  Accordingly,  some  non-curses  applications
+       get  confused  if both are present; the symptom is doubled
        characters in an update using insert.  This requirement is
        now rare; most <STRONG>ich</STRONG> sequences do not require previous smir,
        and most smir insert modes do not require <STRONG>ich1</STRONG> before each
-       character.  Therefore, the  new  <STRONG>curses</STRONG>  actually  assumes
-       this  is the case and uses either <STRONG>rmir</STRONG>/<STRONG>smir</STRONG> or <STRONG>ich</STRONG>/<STRONG>ich1</STRONG> as
+       character.   Therefore,  the  new  <STRONG>curses</STRONG> actually assumes
+       this is the case and uses either <STRONG>rmir</STRONG>/<STRONG>smir</STRONG> or <STRONG>ich</STRONG>/<STRONG>ich1</STRONG>  as
        appropriate (but not both).  If you have to write an entry
-       to  be  used under new curses for a terminal old enough to
+       to be used under new curses for a terminal old  enough  to
        need both, include the <STRONG>rmir</STRONG>/<STRONG>smir</STRONG> sequences in <STRONG>ich1</STRONG>.
 
        If post insert padding is needed, give this as a number of
-       milliseconds  in <STRONG>ip</STRONG> (a string option).  Any other sequence
-       which may need to be sent after  an  insert  of  a  single
+       milliseconds in <STRONG>ip</STRONG> (a string option).  Any other  sequence
+       which  may  need  to  be  sent after an insert of a single
        character may also be given in <STRONG>ip</STRONG>.  If your terminal needs
        both to be placed into an `insert mode' and a special code
-       to  precede  each  inserted character, then both <STRONG>smir</STRONG>/<STRONG>rmir</STRONG>
-       and <STRONG>ich1</STRONG> can be given, and both will  be  used.   The  <STRONG>ich</STRONG>
+       to precede each inserted character,  then  both  <STRONG>smir</STRONG>/<STRONG>rmir</STRONG>
+       and  <STRONG>ich1</STRONG>  can  be  given, and both will be used.  The <STRONG>ich</STRONG>
        capability, with one parameter, <EM>n</EM>, will repeat the effects
        of <STRONG>ich1</STRONG> <EM>n</EM> times.
 
        If padding is necessary between characters typed while not
-       in  insert  mode,  give  this  as a number of milliseconds
-       padding in <STRONG>rmp</STRONG>.
+       in insert mode, give this as a number of milliseconds pad-
+       ding in <STRONG>rmp</STRONG>.
 
-       It is occasionally  necessary  to  move  around  while  in
-       insert  mode  to delete characters on the same line (e.g.,
-       if there is a tab after the insertion position).  If  your
-       terminal  allows  motion while in insert mode you can give
-       the capability <STRONG>mir</STRONG> to speed up  inserting  in  this  case.
-       Omitting  <STRONG>mir</STRONG>  will  affect  only  speed.   Some terminals
+       It  is  occasionally  necessary  to  move  around while in
+       insert mode to delete characters on the same  line  (e.g.,
+       if  there is a tab after the insertion position).  If your
+       terminal allows motion while in insert mode you  can  give
+       the  capability  <STRONG>mir</STRONG>  to  speed up inserting in this case.
+       Omitting <STRONG>mir</STRONG>  will  affect  only  speed.   Some  terminals
        (notably Datamedia's) must not have <STRONG>mir</STRONG> because of the way
        their insert mode works.
 
-       Finally,  you  can specify <STRONG>dch1</STRONG> to delete a single charac-
-       ter, <STRONG>dch</STRONG> with one parameter, <EM>n</EM>, to  delete  <EM>n</EM>  <EM>characters,</EM>
-       and  delete mode by giving <STRONG>smdc</STRONG> and <STRONG>rmdc</STRONG> to enter and exit
-       delete mode (any mode the terminal needs to be  placed  in
+       Finally, you can specify <STRONG>dch1</STRONG> to delete a  single  charac-
+       ter,  <STRONG>dch</STRONG>  with  one parameter, <EM>n</EM>, to delete <EM>n</EM> <EM>characters,</EM>
+       and delete mode by giving <STRONG>smdc</STRONG> and <STRONG>rmdc</STRONG> to enter and  exit
+       delete  mode  (any mode the terminal needs to be placed in
        for <STRONG>dch1</STRONG> to work).
 
-       A  command to erase <EM>n</EM> characters (equivalent to outputting
-       <EM>n</EM> blanks without moving the cursor) can be  given  as  <STRONG>ech</STRONG>
+       A command to erase <EM>n</EM> characters (equivalent to  outputting
+       <EM>n</EM>  blanks  without  moving the cursor) can be given as <STRONG>ech</STRONG>
        with one parameter.
 
-
    <STRONG>Highlighting,</STRONG> <STRONG>Underlining,</STRONG> <STRONG>and</STRONG> <STRONG>Visible</STRONG> <STRONG>Bells</STRONG>
        If  your  terminal  has  one  or  more  kinds  of  display
-       attributes, these can be represented in a number  of  dif-
+       attributes,  these  can be represented in a number of dif-
        ferent ways.  You should choose one display form as <EM>stand-</EM>
        <EM>out</EM> <EM>mode</EM>, representing a good, high contrast, easy-on-the-
-       eyes,  format  for  highlighting  error messages and other
-       attention getters.  (If you have a choice,  reverse  video
-       plus  half-bright  is  good, or reverse video alone.)  The
-       sequences to enter and exit standout  mode  are  given  as
-       <STRONG>smso</STRONG>  and  <STRONG>rmso</STRONG>, respectively.  If the code to change into
-       or out of standout mode  leaves  one  or  even  two  blank
-       spaces  on the screen, as the TVI 912 and Teleray 1061 do,
+       eyes, format for highlighting  error  messages  and  other
+       attention  getters.   (If you have a choice, reverse video
+       plus half-bright is good, or reverse  video  alone.)   The
+       sequences  to  enter  and  exit standout mode are given as
+       <STRONG>smso</STRONG> and <STRONG>rmso</STRONG>, respectively.  If the code to  change  into
+       or  out of standout mode leaves one or even two blank spa-
+       ces on the screen, as the TVI 912  and  Teleray  1061  do,
        then <STRONG>xmc</STRONG> should be given to tell how many spaces are left.
 
        Codes  to  begin  underlining  and  end underlining can be
@@ -1605,19 +1677,18 @@
 
        For example, the DEC vt220 supports most of the modes:
 
+        <STRONG>tparm</STRONG> <STRONG>parameter</STRONG>      <STRONG>attribute</STRONG>        <STRONG>escape</STRONG> <STRONG>sequence</STRONG>
 
-            <STRONG>tparm</STRONG> <STRONG>parameter</STRONG>   <STRONG>attribute</STRONG>    <STRONG>escape</STRONG> <STRONG>sequence</STRONG>
-
-            none              none         \E[0m
-            p1                standout     \E[0;1;7m
-            p2                underline    \E[0;4m
-            p3                reverse      \E[0;7m
-            p4                blink        \E[0;5m
-            p5                dim          not available
-            p6                bold         \E[0;1m
-            p7                invis        \E[0;8m
-            p8                protect      not used
-            p9                altcharset   ^O (off) ^N (on)
+        none                 none             \E[0m
+        p1                   standout         \E[0;1;7m
+        p2                   underline        \E[0;4m
+        p3                   reverse          \E[0;7m
+        p4                   blink            \E[0;5m
+        p5                   dim              not available
+        p6                   bold             \E[0;1m
+        p7                   invis            \E[0;8m
+        p8                   protect          not used
+        p9                   altcharset       ^O (off) ^N (on)
 
        We  begin each escape sequence by turning off any existing
        modes, since there is no quick way  to  determine  whether
@@ -1637,18 +1708,17 @@
        Writing out the above sequences, along with  their  depen-
        dencies yields
 
+      <STRONG>sequence</STRONG>             <STRONG>when</STRONG> <STRONG>to</STRONG> <STRONG>output</STRONG>      <STRONG>terminfo</STRONG> <STRONG>translation</STRONG>
 
-          <STRONG>sequence</STRONG>   <STRONG>when</STRONG> <STRONG>to</STRONG> <STRONG>output</STRONG>      <STRONG>terminfo</STRONG> <STRONG>translation</STRONG>
 
-          \E[0       always              \E[0
-          ;1         if p1 or p6         %?%p1%p6%|%t;1%;
-          ;4         if p2               %?%p2%|%t;4%;
-          ;5         if p4               %?%p4%|%t;5%;
-
-          ;7         if p1 or p3         %?%p1%p3%|%t;7%;
-          ;8         if p7               %?%p7%|%t;8%;
-          m          always              m
-          ^N or ^O   if p9 ^N, else ^O   %?%p9%t^N%e^O%;
+      \E[0                 always              \E[0
+      ;1                   if p1 or p6         %?%p1%p6%|%t;1%;
+      ;4                   if p2               %?%p2%|%t;4%;
+      ;5                   if p4               %?%p4%|%t;5%;
+      ;7                   if p1 or p3         %?%p1%p3%|%t;7%;
+      ;8                   if p7               %?%p7%|%t;8%;
+      m                    always              m
+      ^N or ^O             if p9 ^N, else ^O   %?%p9%t^N%e^O%;
 
        Putting this all together into the sgr sequence gives:
 
@@ -1664,8 +1734,8 @@
        assumes  that  sgr0  does not exit alternate character set
        mode.
 
-       Terminals with the ``magic cookie'' glitch  (<STRONG>xmc</STRONG>)  deposit
-       special   ``cookies''   when   they  receive  mode-setting
+       Terminals with the "magic  cookie"  glitch  (<STRONG>xmc</STRONG>)  deposit
+       special   "cookies"   when   they   receive   mode-setting
        sequences, which affect the display algorithm rather  than
        having  extra  bits  for  each character.  Some terminals,
        such as the HP 2621,  automatically  leave  standout  mode
@@ -1695,7 +1765,6 @@
        erasable with a blank, then this should  be  indicated  by
        giving <STRONG>eo</STRONG>.
 
-
    <STRONG>Keypad</STRONG> <STRONG>and</STRONG> <STRONG>Function</STRONG> <STRONG>Keys</STRONG>
        If the terminal has a keypad that transmits codes when the
        keys are pressed, this information  can  be  given.   Note
@@ -1704,27 +1773,57 @@
        unshifted  HP  2621  keys).   If  the keypad can be set to
        transmit or not transmit, give these  codes  as  <STRONG>smkx</STRONG>  and
        <STRONG>rmkx</STRONG>.  Otherwise the keypad is assumed to always transmit.
-       The codes sent by the left arrow, right arrow,  up  arrow,
-       down  arrow,  and  home keys can be given as <STRONG>kcub1,</STRONG> <STRONG>kcuf1,</STRONG>
-       <STRONG>kcuu1,</STRONG> <STRONG>kcud1,</STRONG> and <STRONG>khome</STRONG> respectively.  If there are  func-
-       tion  keys  such  as f0, f1, ..., f10, the codes they send
-       can be given as <STRONG>kf0,</STRONG> <STRONG>kf1,</STRONG> <STRONG>...,</STRONG> <STRONG>kf10</STRONG>.  If these  keys  have
-       labels  other  than the default f0 through f10, the labels
-       can  be  given  as  <STRONG>lf0,</STRONG>  <STRONG>lf1,</STRONG>  <STRONG>...,</STRONG>  <STRONG>lf10</STRONG>.    The   codes
-       transmitted  by  certain  other special keys can be given:
-       <STRONG>kll</STRONG> (home down), <STRONG>kbs</STRONG> (backspace), <STRONG>ktbc</STRONG> (clear  all  tabs),
-       <STRONG>kctab</STRONG>  (clear  the  tab  stop in this column), <STRONG>kclr</STRONG> (clear
-       screen or  erase  key),  <STRONG>kdch1</STRONG>  (delete  character),  <STRONG>kdl1</STRONG>
-       (delete line), <STRONG>krmir</STRONG> (exit insert mode), <STRONG>kel</STRONG> (clear to end
-       of line), <STRONG>ked</STRONG> (clear to  end  of  screen),  <STRONG>kich1</STRONG>  (insert
-       character  or  enter insert mode), <STRONG>kil1</STRONG> (insert line), <STRONG>knp</STRONG>
-       (next  page),  <STRONG>kpp</STRONG>  (previous  page),  <STRONG>kind</STRONG>  (scroll  for-
-       ward/down), <STRONG>kri</STRONG> (scroll backward/up), <STRONG>khts</STRONG> (set a tab stop
-       in this column).  In addition, if the keypad has a 3 by  3
-       array  of  keys  including  the four arrow keys, the other
-       five keys can be given as <STRONG>ka1</STRONG>, <STRONG>ka3</STRONG>,  <STRONG>kb2</STRONG>,  <STRONG>kc1</STRONG>,  and  <STRONG>kc3</STRONG>.
-       These  keys are useful when the effects of a 3 by 3 direc-
-       tional pad are needed.
+
+       The  codes  sent by the left arrow, right arrow, up arrow,
+       down arrow, and home keys can be given  as  <STRONG>kcub1,</STRONG>  <STRONG>kcuf1,</STRONG>
+       <STRONG>kcuu1,</STRONG>  <STRONG>kcud1,</STRONG> and <STRONG>khome</STRONG> respectively.  If there are func-
+       tion keys such as f0, f1, ..., f10, the  codes  they  send
+       can  be  given as <STRONG>kf0,</STRONG> <STRONG>kf1,</STRONG> <STRONG>...,</STRONG> <STRONG>kf10</STRONG>.  If these keys have
+       labels other than the default f0 through f10,  the  labels
+       can be given as <STRONG>lf0,</STRONG> <STRONG>lf1,</STRONG> <STRONG>...,</STRONG> <STRONG>lf10</STRONG>.
+
+       The codes transmitted by certain other special keys can be
+       given:
+
+       <STRONG>o</STRONG>   <STRONG>kll</STRONG> (home down),
+
+       <STRONG>o</STRONG>   <STRONG>kbs</STRONG> (backspace),
+
+       <STRONG>o</STRONG>   <STRONG>ktbc</STRONG> (clear all tabs),
+
+       <STRONG>o</STRONG>   <STRONG>kctab</STRONG> (clear the tab stop in this column),
+
+       <STRONG>o</STRONG>   <STRONG>kclr</STRONG> (clear screen or erase key),
+
+       <STRONG>o</STRONG>   <STRONG>kdch1</STRONG> (delete character),
+
+       <STRONG>o</STRONG>   <STRONG>kdl1</STRONG> (delete line),
+
+       <STRONG>o</STRONG>   <STRONG>krmir</STRONG> (exit insert mode),
+
+       <STRONG>o</STRONG>   <STRONG>kel</STRONG> (clear to end of line),
+
+       <STRONG>o</STRONG>   <STRONG>ked</STRONG> (clear to end of screen),
+
+       <STRONG>o</STRONG>   <STRONG>kich1</STRONG> (insert character or enter insert mode),
+
+       <STRONG>o</STRONG>   <STRONG>kil1</STRONG> (insert line),
+
+       <STRONG>o</STRONG>   <STRONG>knp</STRONG> (next page),
+
+       <STRONG>o</STRONG>   <STRONG>kpp</STRONG> (previous page),
+
+       <STRONG>o</STRONG>   <STRONG>kind</STRONG> (scroll forward/down),
+
+       <STRONG>o</STRONG>   <STRONG>kri</STRONG> (scroll backward/up),
+
+       <STRONG>o</STRONG>   <STRONG>khts</STRONG> (set a tab stop in this column).
+
+       In addition, if the keypad has a 3  by  3  array  of  keys
+       including  the four arrow keys, the other five keys can be
+       given as <STRONG>ka1</STRONG>, <STRONG>ka3</STRONG>, <STRONG>kb2</STRONG>, <STRONG>kc1</STRONG>, and <STRONG>kc3</STRONG>.  These keys are use-
+       ful  when  the  effects  of  a  3 by 3 directional pad are
+       needed.
 
        Strings to program function keys can be  given  as  <STRONG>pfkey</STRONG>,
        <STRONG>pfloc</STRONG>,  and <STRONG>pfx</STRONG>.  A string to program screen labels should
@@ -1746,12 +1845,11 @@
        or more pln sequences to make sure that the change becomes
        visible.
 
-
    <STRONG>Tabs</STRONG> <STRONG>and</STRONG> <STRONG>Initialization</STRONG>
        If the terminal has hardware tabs, the command to  advance
        to  the  next tab stop can be given as <STRONG>ht</STRONG> (usually control
-       I).  A ``back-tab'' command which moves  leftward  to  the
-       preceding tab stop can be given as <STRONG>cbt</STRONG>.  By convention, if
+       I).  A "back-tab" command which moves leftward to the pre-
+       ceding  tab  stop  can be given as <STRONG>cbt</STRONG>.  By convention, if
        the teletype modes indicate that tabs are  being  expanded
        by  the  computer  rather than being sent to the terminal,
        programs should not  use  <STRONG>ht</STRONG>  or  <STRONG>cbt</STRONG>  even  if  they  are
@@ -1851,7 +1949,6 @@
        ter as a pad, then this can be given  as  <STRONG>pad</STRONG>.   Only  the
        first character of the <STRONG>pad</STRONG> string is used.
 
-
    <STRONG>Status</STRONG> <STRONG>Lines</STRONG>
        Some  terminals  have  an extra `status line' which is not
        normally used by software (and thus  not  counted  in  the
@@ -1883,110 +1980,105 @@
        The  boolean  capability  <STRONG>eslok</STRONG>  specifies   that   escape
        sequences, tabs, etc., work ordinarily in the status line.
 
-       The <STRONG>ncurses</STRONG> implementation does not yet use any  of  these
-       capabilities.   They are documented here in case they ever
+       The  <STRONG>ncurses</STRONG>  implementation does not yet use any of these
+       capabilities.  They are documented here in case they  ever
        become important.
 
-
    <STRONG>Line</STRONG> <STRONG>Graphics</STRONG>
-       Many terminals have alternate character  sets  useful  for
-       forms-drawing.   Terminfo  and <STRONG>curses</STRONG> build in support for
-       the drawing characters supported by the VT100,  with  some
-       characters  from  the  AT&amp;T  4410v1 added.  This alternate
+       Many  terminals  have  alternate character sets useful for
+       forms-drawing.  Terminfo and <STRONG>curses</STRONG> build in  support  for
+       the  drawing  characters supported by the VT100, with some
+       characters from the AT&amp;T  4410v1  added.   This  alternate
        character set may be specified by the <STRONG>acsc</STRONG> capability.
 
-
-       <STRONG>Glyph</STRONG>                      <STRONG>ACS</STRONG>            <STRONG>Ascii</STRONG>      <STRONG>VT100</STRONG>
-       <STRONG>Name</STRONG>                       <STRONG>Name</STRONG>           <STRONG>Default</STRONG>    <STRONG>Name</STRONG>
-       UK pound sign              ACS_STERLING   f          }
-       arrow pointing down        ACS_DARROW     v          .
-       arrow pointing left        ACS_LARROW     &lt;          ,
-       arrow pointing right       ACS_RARROW     &gt;          +
-       arrow pointing up          ACS_UARROW     ^          -
-       board of squares           ACS_BOARD      #          h
-       bullet                     ACS_BULLET     o          ~
-       checker board (stipple)    ACS_CKBOARD    :          a
-       degree symbol              ACS_DEGREE     \          f
-       diamond                    ACS_DIAMOND    +          `
-       greater-than-or-equal-to   ACS_GEQUAL     &gt;          z
-       greek pi                   ACS_PI         *          {
-       horizontal line            ACS_HLINE      -          q
-       lantern symbol             ACS_LANTERN    #          i
-       large plus or crossover    ACS_PLUS       +          n
-       less-than-or-equal-to      ACS_LEQUAL     &lt;          y
-
-       lower left corner          ACS_LLCORNER   +          m
-       lower right corner         ACS_LRCORNER   +          j
-       not-equal                  ACS_NEQUAL     !          |
-       plus/minus                 ACS_PLMINUS    #          g
-       scan line 1                ACS_S1         ~          o
-       scan line 3                ACS_S3         -          p
-       scan line 7                ACS_S7         -          r
-       scan line 9                ACS_S9         _          s
-       solid square block         ACS_BLOCK      #          0
-       tee pointing down          ACS_TTEE       +          w
-       tee pointing left          ACS_RTEE       +          u
-       tee pointing right         ACS_LTEE       +          t
-       tee pointing up            ACS_BTEE       +          v
-       upper left corner          ACS_ULCORNER   +          l
-       upper right corner         ACS_URCORNER   +          k
-       vertical line              ACS_VLINE      |          x
-
-       The best way to define a new device's graphics set  is  to
-       add  a  column  to a copy of this table for your terminal,
-       giving  the  character   which   (when   emitted   between
-       <STRONG>smacs</STRONG>/<STRONG>rmacs</STRONG>  switches) will be rendered as the correspond-
-       ing graphic.  Then read off the VT100/your terminal  char-
-       acter  pairs  right  to left in sequence; these become the
+       <STRONG>Glyph</STRONG>                       <STRONG>ACS</STRONG>           <STRONG>Ascii</STRONG>     <STRONG>VT100</STRONG>
+       <STRONG>Name</STRONG>                        <STRONG>Name</STRONG>          <STRONG>Default</STRONG>   <STRONG>Name</STRONG>
+       UK pound sign               ACS_STERLING  f         }
+       arrow pointing down         ACS_DARROW    v         .
+       arrow pointing left         ACS_LARROW    &lt;         ,
+       arrow pointing right        ACS_RARROW    &gt;         +
+       arrow pointing up           ACS_UARROW    ^         -
+       board of squares            ACS_BOARD     #         h
+       bullet                      ACS_BULLET    o         ~
+       checker board (stipple)     ACS_CKBOARD   :         a
+       degree symbol               ACS_DEGREE    \         f
+       diamond                     ACS_DIAMOND   +         `
+       greater-than-or-equal-to    ACS_GEQUAL    &gt;         z
+       greek pi                    ACS_PI        *         {
+       horizontal line             ACS_HLINE     -         q
+       lantern symbol              ACS_LANTERN   #         i
+       large plus or crossover     ACS_PLUS      +         n
+       less-than-or-equal-to       ACS_LEQUAL    &lt;         y
+       lower left corner           ACS_LLCORNER  +         m
+       lower right corner          ACS_LRCORNER  +         j
+       not-equal                   ACS_NEQUAL    !         |
+       plus/minus                  ACS_PLMINUS   #         g
+       scan line 1                 ACS_S1        ~         o
+       scan line 3                 ACS_S3        -         p
+       scan line 7                 ACS_S7        -         r
+       scan line 9                 ACS_S9        _         s
+       solid square block          ACS_BLOCK     #         0
+       tee pointing down           ACS_TTEE      +         w
+       tee pointing left           ACS_RTEE      +         u
+       tee pointing right          ACS_LTEE      +         t
+       tee pointing up             ACS_BTEE      +         v
+       upper left corner           ACS_ULCORNER  +         l
+       upper right corner          ACS_URCORNER  +         k
+       vertical line               ACS_VLINE     |         x
+
+       The  best  way to define a new device's graphics set is to
+       add a column to a copy of this table  for  your  terminal,
+       giving   the   character   which   (when  emitted  between
+       <STRONG>smacs</STRONG>/<STRONG>rmacs</STRONG> switches) will be rendered as the  correspond-
+       ing  graphic.  Then read off the VT100/your terminal char-
+       acter pairs right to left in sequence;  these  become  the
        ACSC string.
 
-
    <STRONG>Color</STRONG> <STRONG>Handling</STRONG>
-       Most color terminals are either `Tektronix-like'  or  `HP-
-       like'.   Tektronix-like terminals have a predefined set of
-       N colors (where N usually 8), and can  set  character-cell
+       Most  color  terminals are either `Tektronix-like' or `HP-
+       like'.  Tektronix-like terminals have a predefined set  of
+       N  colors  (where N usually 8), and can set character-cell
        foreground and background characters independently, mixing
-       them into N * N color-pairs.  On  HP-like  terminals,  the
+       them  into  N * N  color-pairs.  On HP-like terminals, the
        use must set each color pair up separately (foreground and
-       background are  not  independently  settable).   Up  to  M
-       color-pairs  may  be  set  up  from  2*M different colors.
+       background  are  not  independently  settable).   Up  to M
+       color-pairs may be  set  up  from  2*M  different  colors.
        ANSI-compatible terminals are Tektronix-like.
 
        Some basic color capabilities are independent of the color
        method.  The numeric capabilities <STRONG>colors</STRONG> and <STRONG>pairs</STRONG> specify
-       the maximum numbers of colors and color-pairs that can  be
-       displayed  simultaneously.   The <STRONG>op</STRONG> (original pair) string
-       resets foreground and background colors to  their  default
-       values  for the terminal.  The <STRONG>oc</STRONG> string resets all colors
-       or color-pairs to their default values for  the  terminal.
-       Some  terminals  (including  many  PC  terminal emulators)
-       erase screen  areas  with  the  current  background  color
-       rather  than the power-up default background; these should
+       the  maximum numbers of colors and color-pairs that can be
+       displayed simultaneously.  The <STRONG>op</STRONG> (original  pair)  string
+       resets  foreground  and background colors to their default
+       values for the terminal.  The <STRONG>oc</STRONG> string resets all  colors
+       or  color-pairs  to their default values for the terminal.
+       Some terminals  (including  many  PC  terminal  emulators)
+       erase  screen  areas  with  the  current  background color
+       rather than the power-up default background; these  should
        have the boolean capability <STRONG>bce</STRONG>.
 
-       To change the current foreground or background color on  a
-       Tektronix-type  terminal,  use <STRONG>setaf</STRONG> (set ANSI foreground)
-       and <STRONG>setab</STRONG> (set ANSI background) or <STRONG>setf</STRONG>  (set  foreground)
-       and  <STRONG>setb</STRONG> (set background).  These take one parameter, the
+       To  change the current foreground or background color on a
+       Tektronix-type terminal, use <STRONG>setaf</STRONG> (set  ANSI  foreground)
+       and  <STRONG>setab</STRONG>  (set ANSI background) or <STRONG>setf</STRONG> (set foreground)
+       and <STRONG>setb</STRONG> (set background).  These take one parameter,  the
        color  number.   The  SVr4  documentation  describes  only
-       <STRONG>setaf</STRONG>/<STRONG>setab</STRONG>;  the  XPG4  draft  says that "If the terminal
+       <STRONG>setaf</STRONG>/<STRONG>setab</STRONG>; the XPG4 draft says  that  "If  the  terminal
        supports ANSI escape sequences to set background and fore-
-       ground,  they  should be coded as <STRONG>setaf</STRONG> and <STRONG>setab</STRONG>, respec-
-       tively.  If the terminal supports other  escape  sequences
-       to  set background and foreground, they should be coded as
-       <STRONG>setf</STRONG> and <STRONG>setb</STRONG>, respectively.  The <EM>vidputs()</EM>  function  and
-       the  refresh  functions  use  <STRONG>setaf</STRONG>  and <STRONG>setab</STRONG> if they are
+       ground, they should be coded as <STRONG>setaf</STRONG> and  <STRONG>setab</STRONG>,  respec-
+       tively.   If  the terminal supports other escape sequences
+       to set background and foreground, they should be coded  as
+       <STRONG>setf</STRONG>  and  <STRONG>setb</STRONG>, respectively.  The <EM>vidputs()</EM> function and
+       the refresh functions use <STRONG>setaf</STRONG>  and  <STRONG>setab</STRONG>  if  they  are
        defined."
 
-       The <STRONG>setaf</STRONG>/<STRONG>setab</STRONG> and <STRONG>setf</STRONG>/<STRONG>setb</STRONG> capabilities take  a  single
+       The  <STRONG>setaf</STRONG>/<STRONG>setab</STRONG>  and <STRONG>setf</STRONG>/<STRONG>setb</STRONG> capabilities take a single
        numeric argument each.  Argument values 0-7 of <STRONG>setaf</STRONG>/<STRONG>setab</STRONG>
-       are portably defined as follows (the middle column is  the
+       are  portably defined as follows (the middle column is the
        symbolic #define available in the header for the <STRONG>curses</STRONG> or
-       <STRONG>ncurses</STRONG> libraries).  The terminal hardware is free to  map
-       these  as  it  likes,  but  the RGB values indicate normal
+       <STRONG>ncurses</STRONG>  libraries).  The terminal hardware is free to map
+       these as it likes, but  the  RGB  values  indicate  normal
        locations in color space.
 
-
              <STRONG>Color</STRONG>       <STRONG>#define</STRONG>       <STRONG>Value</STRONG>       <STRONG>RGB</STRONG>
              black     <STRONG>COLOR_BLACK</STRONG>       0     0, 0, 0
              red       <STRONG>COLOR_RED</STRONG>         1     max,0,0
@@ -1997,7 +2089,7 @@
              cyan      <STRONG>COLOR_CYAN</STRONG>        6     0,max,max
              white     <STRONG>COLOR_WHITE</STRONG>       7     max,max,max
 
-       The argument values of <STRONG>setf</STRONG>/<STRONG>setb</STRONG>  historically  correspond
+       The  argument  values of <STRONG>setf</STRONG>/<STRONG>setb</STRONG> historically correspond
        to a different mapping, i.e.,
 
              <STRONG>Color</STRONG>       <STRONG>#define</STRONG>       <STRONG>Value</STRONG>       <STRONG>RGB</STRONG>
@@ -2009,132 +2101,130 @@
              magenta   <STRONG>COLOR_MAGENTA</STRONG>     5     max,0,max
              yellow    <STRONG>COLOR_YELLOW</STRONG>      6     max,max,0
              white     <STRONG>COLOR_WHITE</STRONG>       7     max,max,max
+
        It is important to not confuse the two sets of color capa-
-       bilities; otherwise red/blue will be interchanged  on  the
+       bilities;  otherwise  red/blue will be interchanged on the
        display.
 
-       On  an  HP-like terminal, use <STRONG>scp</STRONG> with a color-pair number
+       On an HP-like terminal, use <STRONG>scp</STRONG> with a  color-pair  number
        parameter to set which color pair is current.
 
-       On a Tektronix-like terminal, the capability  <STRONG>ccc</STRONG>  may  be
-       present  to  indicate that colors can be modified.  If so,
+       On  a  Tektronix-like  terminal, the capability <STRONG>ccc</STRONG> may be
+       present to indicate that colors can be modified.   If  so,
        the <STRONG>initc</STRONG> capability will take a color number (0 to <STRONG>colors</STRONG>
-       -  1)and  three  more parameters which describe the color.
+       - 1)and three more parameters which  describe  the  color.
        These three parameters default to being interpreted as RGB
-       (Red,  Green, Blue) values.  If the boolean capability <STRONG>hls</STRONG>
+       (Red, Green, Blue) values.  If the boolean capability  <STRONG>hls</STRONG>
        is present, they are instead as HLS (Hue, Lightness, Satu-
        ration) indices.  The ranges are terminal-dependent.
 
-       On  an  HP-like  terminal, <STRONG>initp</STRONG> may give a capability for
-       changing a color-pair value.  It will take  seven  parame-
-       ters;  a  color-pair  number (0 to <STRONG>max_pairs</STRONG> - 1), and two
-       triples describing first background  and  then  foreground
-       colors.   These  parameters  must be (Red, Green, Blue) or
+       On an HP-like terminal, <STRONG>initp</STRONG> may give  a  capability  for
+       changing  a  color-pair value.  It will take seven parame-
+       ters; a color-pair number (0 to <STRONG>max_pairs</STRONG> -  1),  and  two
+       triples  describing  first  background and then foreground
+       colors.  These parameters must be (Red,  Green,  Blue)  or
        (Hue, Lightness, Saturation) depending on <STRONG>hls</STRONG>.
 
-       On some color terminals, colors collide  with  highlights.
+       On  some  color terminals, colors collide with highlights.
        You can register these collisions with the <STRONG>ncv</STRONG> capability.
-       This is a bit-mask of attributes not to be used when  col-
-       ors  are  enabled.  The correspondence with the attributes
+       This  is a bit-mask of attributes not to be used when col-
+       ors are enabled.  The correspondence with  the  attributes
        understood by <STRONG>curses</STRONG> is as follows:
 
-
-                      <STRONG>Attribute</STRONG>      <STRONG>Bit</STRONG>   <STRONG>Decimal</STRONG>
-                      A_STANDOUT     0     1
-                      A_UNDERLINE    1     2
-                      A_REVERSE      2     4
-                      A_BLINK        3     8
-                      A_DIM          4     16
-                      A_BOLD         5     32
-                      A_INVIS        6     64
-                      A_PROTECT      7     128
-                      A_ALTCHARSET   8     256
-
-       For example,  on  many  IBM  PC  consoles,  the  underline
-       attribute  collides  with the foreground color blue and is
-       not available in color mode.  These  should  have  an  <STRONG>ncv</STRONG>
+              <STRONG>Attribute</STRONG>                   <STRONG>Bit</STRONG>    <STRONG>Decimal</STRONG>
+              A_STANDOUT                  0     1
+              A_UNDERLINE                 1     2
+              A_REVERSE                   2     4
+              A_BLINK                     3     8
+              A_DIM                       4     16
+              A_BOLD                      5     32
+              A_INVIS                     6     64
+              A_PROTECT                   7     128
+              A_ALTCHARSET                8     256
+
+       For  example,  on  many  IBM  PC  consoles,  the underline
+       attribute collides with the foreground color blue  and  is
+       not  available  in  color  mode.  These should have an <STRONG>ncv</STRONG>
        capability of 2.
 
-       SVr4  curses  does nothing with <STRONG>ncv</STRONG>, ncurses recognizes it
+       SVr4 curses does nothing with <STRONG>ncv</STRONG>, ncurses  recognizes  it
        and optimizes the output in favor of colors.
 
-
    <STRONG>Miscellaneous</STRONG>
-       If the terminal requires other than a null (zero)  charac-
-       ter  as  a  pad,  then this can be given as pad.  Only the
-       first character of the pad string is used.  If the  termi-
+       If  the terminal requires other than a null (zero) charac-
+       ter as a pad, then this can be given  as  pad.   Only  the
+       first  character of the pad string is used.  If the termi-
        nal does not have a pad character, specify npc.  Note that
-       ncurses implements  the  termcap-compatible  <STRONG>PC</STRONG>  variable;
-       though  the  application  may  set this value to something
-       other than a null, ncurses will test  <STRONG>npc</STRONG>  first  and  use
+       ncurses  implements  the  termcap-compatible  <STRONG>PC</STRONG> variable;
+       though the application may set  this  value  to  something
+       other  than  a  null,  ncurses will test <STRONG>npc</STRONG> first and use
        napms if the terminal has no pad character.
 
-       If  the terminal can move up or down half a line, this can
-       be indicated with <STRONG>hu</STRONG>  (half-line  up)  and  <STRONG>hd</STRONG>  (half-line
+       If the terminal can move up or down half a line, this  can
+       be  indicated  with  <STRONG>hu</STRONG>  (half-line  up) and <STRONG>hd</STRONG> (half-line
        down).  This is primarily useful for superscripts and sub-
-       scripts on hard-copy terminals.  If a  hard-copy  terminal
-       can  eject  to  the next page (form feed), give this as <STRONG>ff</STRONG>
+       scripts  on  hard-copy terminals.  If a hard-copy terminal
+       can eject to the next page (form feed), give  this  as  <STRONG>ff</STRONG>
        (usually control L).
 
-       If there is a command to repeat a given character a  given
-       number  of times (to save time transmitting a large number
-       of identical characters) this can be  indicated  with  the
-       parameterized  string  <STRONG>rep</STRONG>.   The  first  parameter is the
-       character to be repeated and the second is the  number  of
-       times  to repeat it.  Thus, tparm(repeat_char, 'x', 10) is
+       If  there is a command to repeat a given character a given
+       number of times (to save time transmitting a large  number
+       of  identical  characters)  this can be indicated with the
+       parameterized string <STRONG>rep</STRONG>.   The  first  parameter  is  the
+       character  to  be repeated and the second is the number of
+       times to repeat it.  Thus, tparm(repeat_char, 'x', 10)  is
        the same as `xxxxxxxxxx'.
 
-       If the terminal has a settable command character, such  as
-       the  TEKTRONIX  4025, this can be indicated with <STRONG>cmdch</STRONG>.  A
+       If  the terminal has a settable command character, such as
+       the TEKTRONIX 4025, this can be indicated with  <STRONG>cmdch</STRONG>.   A
        prototype command character is chosen which is used in all
-       capabilities.   This character is given in the <STRONG>cmdch</STRONG> capa-
-       bility to identify it.  The following convention  is  sup-
-       ported  on  some  UNIX  systems:  The environment is to be
-       searched for a <STRONG>CC</STRONG> variable, and if found, all  occurrences
+       capabilities.  This character is given in the <STRONG>cmdch</STRONG>  capa-
+       bility  to  identify it.  The following convention is sup-
+       ported on some UNIX systems:  The  environment  is  to  be
+       searched  for a <STRONG>CC</STRONG> variable, and if found, all occurrences
        of the prototype character are replaced with the character
        in the environment variable.
 
-       Terminal descriptions that do  not  represent  a  specific
+       Terminal  descriptions  that  do  not represent a specific
        kind of known terminal, such as <EM>switch</EM>, <EM>dialup</EM>, <EM>patch</EM>, and
-       <EM>network</EM>, should include the  <STRONG>gn</STRONG>  (generic)  capability  so
-       that  programs  can  complain that they do not know how to
-       talk to the terminal.  (This capability does not apply  to
-       <EM>virtual</EM>   terminal   descriptions  for  which  the  escape
+       <EM>network</EM>,  should  include  the  <STRONG>gn</STRONG> (generic) capability so
+       that programs can complain that they do not  know  how  to
+       talk  to the terminal.  (This capability does not apply to
+       <EM>virtual</EM>  terminal  descriptions  for  which   the   escape
        sequences are known.)
 
-       If the terminal has a ``meta key'' which acts as  a  shift
-       key,  setting  the  8th  bit of any character transmitted,
-       this fact can be indicated with <STRONG>km</STRONG>.   Otherwise,  software
+       If  the  terminal  has  a "meta key" which acts as a shift
+       key, setting the 8th bit  of  any  character  transmitted,
+       this  fact  can be indicated with <STRONG>km</STRONG>.  Otherwise, software
        will assume that the 8th bit is parity and it will usually
-       be cleared.  If strings exist to turn this  ``meta  mode''
-       on and off, they can be given as <STRONG>smm</STRONG> and <STRONG>rmm</STRONG>.
+       be  cleared.  If strings exist to turn this "meta mode" on
+       and off, they can be given as <STRONG>smm</STRONG> and <STRONG>rmm</STRONG>.
 
-       If  the terminal has more lines of memory than will fit on
-       the screen at once, the number of lines of memory  can  be
-       indicated  with  <STRONG>lm</STRONG>.   A  value of <STRONG>lm</STRONG>#0 indicates that the
+       If the terminal has more lines of memory than will fit  on
+       the  screen  at once, the number of lines of memory can be
+       indicated with <STRONG>lm</STRONG>.  A value of  <STRONG>lm</STRONG>#0  indicates  that  the
        number of lines is not fixed, but that there is still more
        memory than fits on the screen.
 
        If the terminal is one of those supported by the UNIX vir-
-       tual terminal protocol, the terminal number can  be  given
+       tual  terminal  protocol, the terminal number can be given
        as <STRONG>vt</STRONG>.
 
        Media copy strings which control an auxiliary printer con-
        nected to the terminal can be given as <STRONG>mc0</STRONG>: print the con-
-       tents  of  the screen, <STRONG>mc4</STRONG>: turn off the printer, and <STRONG>mc5</STRONG>:
-       turn on the printer.  When the printer  is  on,  all  text
-       sent  to  the terminal will be sent to the printer.  It is
+       tents of the screen, <STRONG>mc4</STRONG>: turn off the printer,  and  <STRONG>mc5</STRONG>:
+       turn  on  the  printer.   When the printer is on, all text
+       sent to the terminal will be sent to the printer.   It  is
        undefined whether the text is also displayed on the termi-
        nal screen when the printer is on.  A variation <STRONG>mc5p</STRONG> takes
        one parameter, and leaves the printer on for as many char-
-       acters  as  the  value  of  the  parameter, then turns the
-       printer off.  The parameter should not  exceed  255.   All
+       acters as the value  of  the  parameter,  then  turns  the
+       printer  off.   The  parameter should not exceed 255.  All
        text,  including  <STRONG>mc4</STRONG>,  is  transparently  passed  to  the
        printer while an <STRONG>mc5p</STRONG> is in effect.
 
-
    <STRONG>Glitches</STRONG> <STRONG>and</STRONG> <STRONG>Braindamage</STRONG>
-       Hazeltine terminals, which do not allow `~' characters  to
+       Hazeltine  terminals, which do not allow `~' characters to
        be displayed should indicate <STRONG>hz</STRONG>.
 
        Terminals which ignore a line-feed immediately after an <STRONG>am</STRONG>
@@ -2149,8 +2239,8 @@
        Note:    the    variable    indicating    this    is   now
        `dest_tabs_magic_smso'; in older  versions,  it  was  tel-
        eray_glitch.  This glitch is also taken to mean that it is
-       not possible to position the cursor on top  of  a  ``magic
-       cookie'', that to erase standout mode it is instead neces-
+       not possible to position the cursor on  top  of  a  "magic
+       cookie",  that to erase standout mode it is instead neces-
        sary to use delete and insert line.  The ncurses implemen-
        tation ignores this glitch.
 
@@ -2165,7 +2255,6 @@
        Other  specific  terminal  problems  may  be  corrected by
        adding more capabilities of the form <STRONG>x</STRONG><EM>x</EM>.
 
-
    <STRONG>Similar</STRONG> <STRONG>Terminals</STRONG>
        If there are two very similar terminals, one (the variant)
        can  be  defined  as  being just like the other (the base)
@@ -2183,14 +2272,13 @@
        the  use  reference that imports it, where <EM>xx</EM> is the capa-
        bility.  For example, the entry
 
-                   2621-nl, smkx@, rmkx@, use=2621,
+              2621-nl, smkx@, rmkx@, use=2621,
 
        defines a 2621-nl that does not  have  the  <STRONG>smkx</STRONG>  or  <STRONG>rmkx</STRONG>
        capabilities,  and hence does not turn on the function key
        labels when in visual mode.  This is useful for  different
        modes for a terminal, or for different user preferences.
 
-
    <STRONG>Pitfalls</STRONG> <STRONG>of</STRONG> <STRONG>Long</STRONG> <STRONG>Entries</STRONG>
        Long  terminfo  entries  are  unlikely to be a problem; to
        date, no entry has even  approached  terminfo's  4096-byte
@@ -2229,21 +2317,21 @@
        libraries  strip  off  the final newline, too (GNU termcap
        does not).  Now suppose:
 
-       *    a termcap entry before expansion is  more  than  1023
-            bytes long,
+       <STRONG>o</STRONG>   a termcap entry before expansion  is  more  than  1023
+           bytes long,
 
-       *    and the application has only allocated a 1k buffer,
+       <STRONG>o</STRONG>   and the application has only allocated a 1k buffer,
 
-       *    and  the  termcap library (like the one in BSD/OS 1.1
-            and GNU) reads the whole entry into  the  buffer,  no
-            matter  what its length, to see if it is the entry it
-            wants,
-
-       *    and <STRONG>tgetent()</STRONG> is searching for a terminal  type  that
-            either is the long entry, appears in the termcap file
-            after the long entry, or does not appear in the  file
-            at  all  (so  that  <STRONG>tgetent()</STRONG> has to search the whole
-            termcap file).
+       <STRONG>o</STRONG>   and  the  termcap  library (like the one in BSD/OS 1.1
+           and GNU) reads the whole entry  into  the  buffer,  no
+           matter  what  its length, to see if it is the entry it
+           wants,
+
+       <STRONG>o</STRONG>   and <STRONG>tgetent()</STRONG> is searching for a  terminal  type  that
+           either  is the long entry, appears in the termcap file
+           after the long entry, or does not appear in  the  file
+           at  all  (so  that  <STRONG>tgetent()</STRONG>  has to search the whole
+           termcap file).
 
        Then <STRONG>tgetent()</STRONG> will overwrite memory, perhaps  its  stack,
        and  probably core dump the program.  Programs like telnet
@@ -2288,61 +2376,64 @@
 
 </PRE>
 <H2>EXTENSIONS</H2><PRE>
-       Some  SVr4  <STRONG>curses</STRONG>  implementations,  and  all previous to
-       SVr4, do not interpret the %A and %O operators in  parame-
+       Searching for terminal descriptions in <STRONG>$HOME/.terminfo</STRONG> and
+       TERMINFO_DIRS is not supported by older implementations.
+
+       Some SVr4 <STRONG>curses</STRONG>  implementations,  and  all  previous  to
+       SVr4,  do not interpret the %A and %O operators in parame-
        ter strings.
 
-       SVr4/XPG4  do  not  specify whether <STRONG>msgr</STRONG> licenses movement
-       while in an alternate-character-set mode (such modes  may,
-       among  other  things,  map CR and NL to characters that do
-       not trigger local motions).   The  <STRONG>ncurses</STRONG>  implementation
-       ignores  <STRONG>msgr</STRONG>  in <STRONG>ALTCHARSET</STRONG> mode.  This raises the possi-
-       bility that an XPG4  implementation  making  the  opposite
-       interpretation  may need terminfo entries made for <STRONG>ncurses</STRONG>
+       SVr4/XPG4 do not specify whether  <STRONG>msgr</STRONG>  licenses  movement
+       while  in an alternate-character-set mode (such modes may,
+       among other things, map CR and NL to  characters  that  do
+       not  trigger  local  motions).  The <STRONG>ncurses</STRONG> implementation
+       ignores <STRONG>msgr</STRONG> in <STRONG>ALTCHARSET</STRONG> mode.  This raises  the  possi-
+       bility  that  an  XPG4  implementation making the opposite
+       interpretation may need terminfo entries made for  <STRONG>ncurses</STRONG>
        to have <STRONG>msgr</STRONG> turned off.
 
-       The <STRONG>ncurses</STRONG> library handles insert-character  and  insert-
+       The  <STRONG>ncurses</STRONG>  library handles insert-character and insert-
        character modes in a slightly non-standard way to get bet-
-       ter update efficiency.  See  the  <STRONG>Insert/Delete</STRONG>  <STRONG>Character</STRONG>
+       ter  update  efficiency.   See the <STRONG>Insert/Delete</STRONG> <STRONG>Character</STRONG>
        subsection above.
 
-       The   parameter   substitutions  for  <STRONG>set_clock</STRONG>  and  <STRONG>dis-</STRONG>
-       <STRONG>play_clock</STRONG> are not documented in SVr4 or  the  XSI  Curses
+       The  parameter  substitutions  for  <STRONG>set_clock</STRONG>   and   <STRONG>dis-</STRONG>
+       <STRONG>play_clock</STRONG>  are  not  documented in SVr4 or the XSI Curses
        standard.  They are deduced from the documentation for the
        AT&amp;T 505 terminal.
 
-       Be careful assigning the <STRONG>kmous</STRONG>  capability.   The  <STRONG>ncurses</STRONG>
-       wants  to  interpret it as <STRONG>KEY_MOUSE</STRONG>, for use by terminals
-       and emulators like xterm that  can  return  mouse-tracking
+       Be  careful  assigning  the <STRONG>kmous</STRONG> capability.  The <STRONG>ncurses</STRONG>
+       wants to interpret it as <STRONG>KEY_MOUSE</STRONG>, for use  by  terminals
+       and  emulators  like  xterm that can return mouse-tracking
        information in the keyboard-input stream.
 
-       Different  commercial ports of terminfo and curses support
-       different subsets of the XSI Curses standard and (in  some
+       Different commercial ports of terminfo and curses  support
+       different  subsets of the XSI Curses standard and (in some
        cases) different extension sets.  Here is a summary, accu-
        rate as of October 1995:
 
        <STRONG>SVR4,</STRONG> <STRONG>Solaris,</STRONG> <STRONG>ncurses</STRONG> -- These support all SVr4 capabili-
        ties.
 
-       <STRONG>SGI</STRONG>  --  Supports  the  SVr4  set,  adds  one undocumented
+       <STRONG>SGI</STRONG> --  Supports  the  SVr4  set,  adds  one  undocumented
        extended string capability (<STRONG>set_pglen</STRONG>).
 
-       <STRONG>SVr1,</STRONG> <STRONG>Ultrix</STRONG> -- These support a restricted subset of  ter-
-       minfo  capabilities.   The booleans end with <STRONG>xon_xoff</STRONG>; the
-       numerics with  <STRONG>width_status_line</STRONG>;  and  the  strings  with
+       <STRONG>SVr1,</STRONG>  <STRONG>Ultrix</STRONG> -- These support a restricted subset of ter-
+       minfo capabilities.  The booleans end with  <STRONG>xon_xoff</STRONG>;  the
+       numerics  with  <STRONG>width_status_line</STRONG>;  and  the  strings with
        <STRONG>prtr_non</STRONG>.
 
-       <STRONG>HP/UX</STRONG>  --  Supports  the  SVr1  subset,  plus the SVr[234]
+       <STRONG>HP/UX</STRONG> -- Supports  the  SVr1  subset,  plus  the  SVr[234]
        numerics <STRONG>num_labels</STRONG>, <STRONG>label_height</STRONG>, <STRONG>label_width</STRONG>, plus func-
-       tion  keys  11  through  63, plus <STRONG>plab_norm</STRONG>, <STRONG>label_on</STRONG>, and
+       tion keys 11 through 63,  plus  <STRONG>plab_norm</STRONG>,  <STRONG>label_on</STRONG>,  and
        <STRONG>label_off</STRONG>, plus some incompatible extensions in the string
        table.
 
-       <STRONG>AIX</STRONG>  --  Supports  the  SVr1 subset, plus function keys 11
-       through 63, plus a number  of  incompatible  string  table
+       <STRONG>AIX</STRONG> -- Supports the SVr1 subset,  plus  function  keys  11
+       through  63,  plus  a  number of incompatible string table
        extensions.
 
-       <STRONG>OSF</STRONG>  -- Supports both the SVr4 set and the AIX extensions.
+       <STRONG>OSF</STRONG> -- Supports both the SVr4 set and the AIX extensions.
 
 
 </PRE>
Index: doc/html/man/tic.1m.html
--- ncurses-5.9/doc/html/man/tic.1m.html	2011-04-04 22:46:51.000000000 +0000
+++ ncurses-5.9-20130504/doc/html/man/tic.1m.html	2013-03-09 22:12:05.000000000 +0000
@@ -1,7 +1,7 @@
 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
 <!-- 
   ****************************************************************************
-  * Copyright (c) 1998-2006,2010 Free Software Foundation, Inc.              *
+  * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc.              *
   *                                                                          *
   * Permission is hereby granted, free of charge, to any person obtaining a  *
   * copy of this software and associated documentation files (the            *
@@ -27,7 +27,7 @@
   * sale, use or other dealings in this Software without prior written       *
   * authorization.                                                           *
   ****************************************************************************
-  * @Id: tic.1m,v 1.47 2010/12/04 18:38:55 tom Exp @
+  * @Id: tic.1m,v 1.57 2013/02/02 22:09:02 tom Exp @
 -->
 <HTML>
 <HEAD>
@@ -52,84 +52,141 @@
 
 </PRE>
 <H2>SYNOPSIS</H2><PRE>
-       <STRONG>tic</STRONG>  [<STRONG>-1CGILNTUVacfgrstx</STRONG>]  [<STRONG>-e</STRONG> <EM>names</EM>] [<STRONG>-o</STRONG> <EM>dir</EM>] [<STRONG>-R</STRONG> <EM>subset</EM>]
-       [<STRONG>-v</STRONG>[<EM>n</EM>]] [<STRONG>-w</STRONG>[<EM>n</EM>]] <EM>file</EM>
+       <STRONG>tic</STRONG>  [<STRONG>-01CDGIKLNTUVacfgrstx</STRONG>]  [<STRONG>-e</STRONG> <EM>names</EM>] [<STRONG>-o</STRONG> <EM>dir</EM>] [<STRONG>-R</STRONG> <EM>sub-</EM>
+       <EM>set</EM>] [<STRONG>-v</STRONG>[<EM>n</EM>]] [<STRONG>-w</STRONG>[<EM>n</EM>]] <EM>file</EM>
 
 
 </PRE>
 <H2>DESCRIPTION</H2><PRE>
-       The command <STRONG>tic</STRONG> translates a  <STRONG>terminfo</STRONG>  file  from  source
+       The <STRONG>tic</STRONG> command translates a  <STRONG>terminfo</STRONG>  file  from  source
        format  into compiled format.  The compiled format is nec-
        essary for use with the library routines in <STRONG><A HREF="ncurses.3x.html">ncurses(3x)</A></STRONG>.
 
-       The results are normally placed  in  the  system  terminfo
-       directory  <STRONG>/usr/share/terminfo</STRONG>.   There  are  two  ways to
-       change this behavior.
+       As described in <STRONG><A HREF="term.5.html">term(5)</A></STRONG>, the  database  may  be  either  a
+       directory  tree  (one file per terminal entry) or a hashed
+       database (one record per entry).  The <STRONG>tic</STRONG>  command  writes
+       only one type of entry, depending on how it was built:
+
+       <STRONG>o</STRONG>   For  directory  trees,  the top-level directory, e.g.,
+           /usr/share/terminfo, specifies  the  location  of  the
+           database.
+
+       <STRONG>o</STRONG>   For  hashed  databases,  a filename is needed.  If the
+           given file is not found by that name, but can be found
+           by adding the suffix ".db", then that is used.
+
+           The  default  name for the hashed database is the same
+           as the default directory name  (only  adding  a  ".db"
+           suffix).
+
+       In  either  case  (directory or hashed database), <STRONG>tic</STRONG> will
+       create the container if it does not exist.  For  a  direc-
+       tory,  this  would  be the "terminfo" leaf, versus a "ter-
+       minfo.db" file.
 
-       First, you may override the system default by setting  the
-       variable  <STRONG>TERMINFO</STRONG>  in  your  shell environment to a valid
-       (existing) directory name.
-
-       Secondly, if <STRONG>tic</STRONG> cannot get access to  <EM>/usr/share/terminfo</EM>
-       or  your  TERMINFO  directory,  it looks for the directory
-       <EM>$HOME/.terminfo</EM>; if that directory exists,  the  entry  is
-       placed there.
+       The results are normally placed  in  the  system  terminfo
+       database   <STRONG>/usr/share/terminfo</STRONG>.    The  compiled  terminal
+       description can be placed in a  different  terminfo  data-
+       base.  There are two ways to achieve this:
+
+       <STRONG>o</STRONG>   First,  you  may override the system default either by
+           using the <STRONG>-o</STRONG> option, or by setting the  variable  <STRONG>TER-</STRONG>
+           <STRONG>MINFO</STRONG>  in  your  shell environment to a valid database
+           location.
+
+       <STRONG>o</STRONG>   Secondly, if <STRONG>tic</STRONG> cannot write  in  <EM>/usr/share/terminfo</EM>
+           or  the  location  specified using your TERMINFO vari-
+           able, it looks for the directory  <EM>$HOME/.terminfo</EM>  (or
+           hashed  database <EM>$HOME/.terminfo.db)</EM>; if that location
+           exists, the entry is placed there.
 
        Libraries that read terminfo entries are expected to check
-       for a TERMINFO directory first, look at <EM>$HOME/.terminfo</EM> if
-       TERMINFO  is  not set, and finally look in <EM>/usr/share/ter-</EM>
-       <EM>minfo</EM>.
+       in succession
+
+       <STRONG>o</STRONG>   a  location  specified  with  the TERMINFO environment
+           variable,
+
+       <STRONG>o</STRONG>   <EM>$HOME/.terminfo</EM>,
+
+       <STRONG>o</STRONG>   directories listed in  the  TERMINFO_DIRS  environment
+           variable,
+
+       <STRONG>o</STRONG>   a       compiled-in      list      of      directories
+           (/usr/local/ncurses/share/terminfo:/usr/share/ter-
+           minfo), and
+
+       <STRONG>o</STRONG>   the system terminfo database (<EM>/usr/share/terminfo</EM>).
+
+   <STRONG>OPTIONS</STRONG>
+       <STRONG>-0</STRONG>     restricts the output to a single line
 
        <STRONG>-1</STRONG>     restricts the output to a single column
 
        <STRONG>-a</STRONG>     tells  <STRONG>tic</STRONG>  to  retain  commented-out  capabilities
               rather than discarding them.  Capabilities are com-
-              mented by prefixing them with a period.  This  sets
-              the  <STRONG>-x</STRONG> option, because it treats the commented-out
-              entries as user-defined names.  If  the  source  is
-              termcap,  accept  the 2-character names required by
+              mented  by prefixing them with a period.  This sets
+              the <STRONG>-x</STRONG> option, because it treats the  commented-out
+              entries  as  user-defined  names.  If the source is
+              termcap, accept the 2-character names  required  by
               version 6.  Otherwise these are ignored.
 
-       <STRONG>-C</STRONG>     Force source translation to termcap format.   Note:
-              this  differs  from the <STRONG>-C</STRONG> option of <STRONG><A HREF="infocmp.1m.html">infocmp(1m)</A></STRONG> in
+       <STRONG>-C</STRONG>     Force  source translation to termcap format.  Note:
+              this differs from the <STRONG>-C</STRONG> option of  <STRONG><A HREF="infocmp.1m.html">infocmp(1m)</A></STRONG>  in
               that it does not merely translate capability names,
-              but  also  translates  terminfo  strings to termcap
+              but also translates  terminfo  strings  to  termcap
               format.  Capabilities that are not translatable are
-              left  in  the  entry under their terminfo names but
-              commented out with two preceding dots.
+              left in the entry under their  terminfo  names  but
+              commented  out with two preceding dots.  The actual
+              format  used  incorporates  some  improvements  for
+              escaped  characters  from  terminfo  format.  For a
+              stricter BSD-compatible  translation,  add  the  <STRONG>-K</STRONG>
+              option.
 
-       <STRONG>-c</STRONG>     tells <STRONG>tic</STRONG> to only check <EM>file</EM> for errors,  including
-              syntax  problems and bad use links.  If you specify
+       <STRONG>-c</STRONG>     tells  <STRONG>tic</STRONG> to only check <EM>file</EM> for errors, including
+              syntax problems and bad use links.  If you  specify
               <STRONG>-C</STRONG> (<STRONG>-I</STRONG>) with this option, the code will print warn-
               ings about entries which, after use resolution, are
-              more than 1023 (4096) bytes long.  Due to  a  fixed
-              buffer  length  in  older  termcap libraries (and a
-              documented limit in terminfo),  these  entries  may
-              cause core dumps.
+              more  than  1023 (4096) bytes long.  Due to a fixed
+              buffer length in older termcap libraries,  as  well
+              as buggy checking for the buffer length (and a doc-
+              umented limit in terminfo), these entries may cause
+              core dumps with other implementations.
+
+       <STRONG>-D</STRONG>     tells  <STRONG>tic</STRONG>  to print the database locations that it
+              knows about, and exit.  The first location shown is
+              the  one  to which it would write compiled terminal
+              descriptions.   If  <STRONG>tic</STRONG>  is  not  able  to  find  a
+              writable  database  location according to the rules
+              summarized above, it will print  a  diagnostic  and
+              exit  with  an error rather than printing a list of
+              database locations.
 
        <STRONG>-e</STRONG> <EM>names</EM>
-              Limit  writes  and  translations  to  the following
-              comma-separated list of terminals.  If any name  or
+              Limit writes  and  translations  to  the  following
+              comma-separated  list of terminals.  If any name or
               alias of a terminal matches one of the names in the
-              list, the entry will be written  or  translated  as
-              normal.   Otherwise no output will be generated for
+              list,  the  entry  will be written or translated as
+              normal.  Otherwise no output will be generated  for
               it.  The option value is interpreted as a file con-
-              taining  the  list  if  it  contains a '/'.  (Note:
-              depending on how tic was compiled, this option  may
+              taining the list if  it  contains  a  '/'.   (Note:
+              depending  on how tic was compiled, this option may
               require <STRONG>-I</STRONG> or <STRONG>-C</STRONG>.)
 
        <STRONG>-f</STRONG>     Display  complex  terminfo  strings  which  contain
-              if/then/else/endif expressions indented  for  read-
+              if/then/else/endif  expressions  indented for read-
               ability.
 
-       <STRONG>-G</STRONG>     Display  constant  literals  in decimal form rather
+       <STRONG>-G</STRONG>     Display constant literals in  decimal  form  rather
               than their character equivalents.
 
-       <STRONG>-g</STRONG>     Display constant character literals in quoted  form
+       <STRONG>-g</STRONG>     Display  constant character literals in quoted form
               rather than their decimal equivalents.
 
        <STRONG>-I</STRONG>     Force source translation to terminfo format.
 
+       <STRONG>-K</STRONG>     Suppress some longstanding  ncurses  extensions  to
+              termcap format, e.g., "\s" for space.
+
        <STRONG>-L</STRONG>     Force  source  translation to terminfo format using
               the long C variable names listed in &lt;<STRONG>term.h</STRONG>&gt;
 
@@ -145,8 +202,8 @@
               This  option forces a more literal translation that
               also preserves the obsolete capabilities.
 
-       <STRONG>-o</STRONG><EM>dir</EM>  Write compiled entries to given  directory.   Over-
-              rides the TERMINFO environment variable.
+       <STRONG>-o</STRONG><EM>dir</EM>  Write compiled entries to given database  location.
+              Overrides the TERMINFO environment variable.
 
        <STRONG>-R</STRONG><EM>subset</EM>
               Restrict  output to a given subset.  This option is
@@ -160,15 +217,15 @@
 
        <STRONG>-r</STRONG>     Force entry resolution (so there are  no  remaining
               tc  capabilities)  even  when  doing translation to
-              termcap format.  This may  be  needed  if  you  are
-              preparing  a  termcap  file  for  a termcap library
-              (such as GNU termcap through  version  1.3  or  BSD
-              termcap through 4.3BSD) that does not handle multi-
-              ple tc capabilities per entry.
-
-       <STRONG>-s</STRONG>     Summarize the compile by showing the directory into
-              which  entries  are  written,  and  the  number  of
-              entries which are compiled.
+              termcap format.  This may be needed if you are pre-
+              paring  a  termcap file for a termcap library (such
+              as GNU termcap through version 1.3 or  BSD  termcap
+              through  4.3BSD)  that  does not handle multiple tc
+              capabilities per entry.
+
+       <STRONG>-s</STRONG>     Summarize the compile by showing the database loca-
+              tion into which entries are written, and the number
+              of entries which are compiled.
 
        <STRONG>-T</STRONG>     eliminates size-restrictions on the generated text.
               This  is  mainly  useful  for testing and analysis,
@@ -195,41 +252,48 @@
             1.  If <EM>n</EM> is specified and greater than 1,  the  level
             of detail is increased.
 
-       <STRONG>-w</STRONG><EM>n</EM>  specifies  the width of the output.  The parameter is
-            optional.  If it is omitted, it defaults to 60.
+            The debug flag levels are as follows:
 
-       <STRONG>-x</STRONG>   Treat unknown capabilities as user-defined.  That is,
-            if  you  supply  a capability name which <STRONG>tic</STRONG> does not
-            recognize, it will infer its type (boolean, number or
-            string)  from  the  syntax and make an extended table
-            entry  for  that.   User-defined  capability  strings
-            whose  name begins with ``k'' are treated as function
-            keys.
+            1      Names of files created and linked
 
-       <EM>file</EM> contains one or more <STRONG>terminfo</STRONG>  terminal  descriptions
-            in source format [see <STRONG><A HREF="terminfo.5.html">terminfo(5)</A></STRONG>].  Each description
-            in the file describes the capabilities of a  particu-
-            lar terminal.
+            2      Information related to the ``use'' facility
 
-       The debug flag levels are as follows:
+            3      Statistics from the hashing algorithm
 
-       1      Names of files created and linked
+            5      String-table memory allocations
 
-       2      Information related to the ``use'' facility
+            7      Entries into the string-table
 
-       3      Statistics from the hashing algorithm
+            8      List of tokens encountered by scanner
 
-       5      String-table memory allocations
+            9      All  values  computed  in  construction of the
+                   hash table
 
-       7      Entries into the string-table
+            If the debug level <EM>n</EM> is not given, it is taken to  be
+            one.
 
-       8      List of tokens encountered by scanner
+       <STRONG>-w</STRONG><EM>n</EM>  specifies  the width of the output.  The parameter is
+            optional.  If it is omitted, it defaults to 60.
 
-       9      All values computed in construction of the hash ta-
-              ble
+       <STRONG>-x</STRONG>   Treat unknown capabilities as user-defined.  That is,
+            if  you  supply  a capability name which <STRONG>tic</STRONG> does not
+            recognize, it will infer its type (boolean, number or
+            string)  from  the  syntax and make an extended table
+            entry  for  that.   User-defined  capability  strings
+            whose  name begins with ``k'' are treated as function
+            keys.
 
-       If the debug level <EM>n</EM> is not given, it is taken to be  one.
+   <STRONG>PARAMETERS</STRONG>
+       <EM>file</EM>   contains one or more <STRONG>terminfo</STRONG> terminal descriptions
+              in  source format [see <STRONG><A HREF="terminfo.5.html">terminfo(5)</A></STRONG>].  Each descrip-
+              tion in the file describes the  capabilities  of  a
+              particular terminal.
+
+              If  <EM>file</EM>  is  ``-'', then the data is read from the
+              standard input.  The <EM>file</EM> parameter may also be the
+              path of a character-device.
 
+   <STRONG>PROCESSING</STRONG>
        All but one of the capabilities recognized by <STRONG>tic</STRONG> are doc-
        umented in <STRONG><A HREF="terminfo.5.html">terminfo(5)</A></STRONG>.  The exception is the <STRONG>use</STRONG> capabil-
        ity.
@@ -237,10 +301,8 @@
        When  a  <STRONG>use</STRONG>=<EM>entry</EM>-<EM>name</EM>  field is discovered in a terminal
        entry currently being compiled, <STRONG>tic</STRONG> reads  in  the  binary
        from  <STRONG>/usr/share/terminfo</STRONG> to complete the entry.  (Entries
-       created from <EM>file</EM> will be used first.  If the  environment
-       variable  <STRONG>TERMINFO</STRONG>  is  set,  that  directory  is searched
-       instead of <STRONG>/usr/share/terminfo</STRONG>.)  <STRONG>tic</STRONG> duplicates the capa-
-       bilities  in  <EM>entry</EM>-<EM>name</EM>  for  the current entry, with the
+       created from <EM>file</EM> will be used first.  <STRONG>tic</STRONG> duplicates  the
+       capabilities in <EM>entry</EM>-<EM>name</EM> for the current entry, with the
        exception  of  those  capabilities  that  explicitly   are
        defined in the current entry.
 
@@ -249,52 +311,49 @@
        <EM>entry</EM>_<EM>name</EM>_<EM>2</EM>  must also appear in <STRONG>entry_name_1</STRONG> before <STRONG>use=</STRONG>
        for these capabilities to be canceled in <STRONG>entry_name_1</STRONG>.
 
-       If the environment variable <STRONG>TERMINFO</STRONG> is set, the  compiled
-       results are placed there instead of <STRONG>/usr/share/terminfo</STRONG>.
-
        Total compiled entries cannot exceed 4096 bytes.  The name
-       field cannot exceed 512 bytes.  Terminal  names  exceeding
-       the  maximum  alias  length (32 characters on systems with
+       field  cannot  exceed 512 bytes.  Terminal names exceeding
+       the maximum alias length (32 characters  on  systems  with
        long filenames, 14 characters otherwise) will be truncated
-       to  the maximum alias length and a warning message will be
+       to the maximum alias length and a warning message will  be
        printed.
 
 
 </PRE>
 <H2>COMPATIBILITY</H2><PRE>
-       There is some evidence that historic  <STRONG>tic</STRONG>  implementations
-       treated  description  fields with no whitespace in them as
-       additional aliases or short names.  This <STRONG>tic</STRONG> does  not  do
-       that,  but  it  does  warn  when description fields may be
-       treated that way and check them for dangerous  characters.
+       There  is  some evidence that historic <STRONG>tic</STRONG> implementations
+       treated description fields with no whitespace in  them  as
+       additional  aliases  or short names.  This <STRONG>tic</STRONG> does not do
+       that, but it does warn  when  description  fields  may  be
+       treated that way and check them for dangerous characters.
 
 
 </PRE>
 <H2>EXTENSIONS</H2><PRE>
-       Unlike the stock SVr4 <STRONG>tic</STRONG> command, this implementation can
-       actually compile termcap sources.   In  fact,  entries  in
-       terminfo  and  termcap  syntax  can  be  mixed in a single
-       source file.  See <STRONG><A HREF="terminfo.5.html">terminfo(5)</A></STRONG>  for  the  list  of  termcap
-       names taken to be equivalent to terminfo names.
+       Unlike the SVr4 <STRONG>tic</STRONG> command, this implementation can actu-
+       ally compile termcap sources.  In fact,  entries  in  ter-
+       minfo  and  termcap syntax can be mixed in a single source
+       file.  See <STRONG><A HREF="terminfo.5.html">terminfo(5)</A></STRONG> for the list of termcap names taken
+       to be equivalent to terminfo names.
 
        The  SVr4  manual  pages  are  not clear on the resolution
        rules for <STRONG>use</STRONG> capabilities.  This  implementation  of  <STRONG>tic</STRONG>
        will find <STRONG>use</STRONG> targets anywhere in the source file, or any-
        where in the file tree rooted at <STRONG>TERMINFO</STRONG> (if <STRONG>TERMINFO</STRONG>  is
-       defined),  or  in the user's <EM>$HOME/.terminfo</EM> directory (if
-       it exists), or (finally) anywhere  in  the  system's  file
-       tree of compiled entries.
+       defined), or in the user's <EM>$HOME/.terminfo</EM> database (if it
+       exists), or (finally) anywhere in the system's  file  tree
+       of compiled entries.
 
        The  error  messages from this <STRONG>tic</STRONG> have the same format as
        GNU C error messages, and can be  parsed  by  GNU  Emacs's
        compile facility.
 
-       The  <STRONG>-C</STRONG>,  <STRONG>-G</STRONG>,  <STRONG>-I</STRONG>, <STRONG>-N</STRONG>, <STRONG>-R</STRONG>, <STRONG>-T</STRONG>, <STRONG>-V</STRONG>, <STRONG>-a</STRONG>, <STRONG>-e</STRONG>, <STRONG>-f</STRONG>, <STRONG>-g</STRONG>, <STRONG>-o</STRONG>, <STRONG>-r</STRONG>,
-       <STRONG>-s</STRONG>, <STRONG>-t</STRONG> and <STRONG>-x</STRONG> options are not supported under  SVr4.   The
-       SVr4 <STRONG>-c</STRONG> mode does not report bad use links.
+       The  <STRONG>-0</STRONG>,  <STRONG>-1</STRONG>,  <STRONG>-C</STRONG>, <STRONG>-G</STRONG>, <STRONG>-I</STRONG>, <STRONG>-N</STRONG>, <STRONG>-R</STRONG>, <STRONG>-T</STRONG>, <STRONG>-V</STRONG>, <STRONG>-a</STRONG>, <STRONG>-e</STRONG>, <STRONG>-f</STRONG>, <STRONG>-g</STRONG>,
+       <STRONG>-o</STRONG>, <STRONG>-r</STRONG>, <STRONG>-s</STRONG>, <STRONG>-t</STRONG> and <STRONG>-x</STRONG>  options  are  not  supported  under
+       SVr4.  The SVr4 <STRONG>-c</STRONG> mode does not report bad use links.
 
        System  V does not compile entries to or read entries from
-       your <EM>$HOME/.terminfo</EM> directory unless TERMINFO is  explic-
+       your <EM>$HOME/.terminfo</EM> database unless TERMINFO  is  explic-
        itly set to it.
 
 
@@ -307,9 +366,9 @@
 </PRE>
 <H2>SEE ALSO</H2><PRE>
        <STRONG><A HREF="infocmp.1m.html">infocmp(1m)</A></STRONG>,    <STRONG><A HREF="captoinfo.1m.html">captoinfo(1m)</A></STRONG>,   <STRONG><A HREF="infotocap.1m.html">infotocap(1m)</A></STRONG>,   <STRONG><A HREF="toe.1m.html">toe(1m)</A></STRONG>,
-       <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>, <STRONG><A HREF="terminfo.5.html">terminfo(5)</A></STRONG>.
+       <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>, <STRONG><A HREF="term.5.html">term(5)</A></STRONG>.  <STRONG><A HREF="terminfo.5.html">terminfo(5)</A></STRONG>.
 
-       This describes <STRONG>ncurses</STRONG> version 5.9 (patch 20110404).
+       This describes <STRONG>ncurses</STRONG> version 5.9 (patch 20130309).
 
 
 </PRE>
Index: doc/html/man/toe.1m.html
--- ncurses-5.9/doc/html/man/toe.1m.html	2011-04-04 22:46:51.000000000 +0000
+++ ncurses-5.9-20130504/doc/html/man/toe.1m.html	2013-03-09 22:12:05.000000000 +0000
@@ -1,7 +1,7 @@
 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
 <!-- 
   ****************************************************************************
-  * Copyright (c) 1998-2008,2010 Free Software Foundation, Inc.              *
+  * Copyright (c) 1998-2010,2011 Free Software Foundation, Inc.              *
   *                                                                          *
   * Permission is hereby granted, free of charge, to any person obtaining a  *
   * copy of this software and associated documentation files (the            *
@@ -27,7 +27,7 @@
   * sale, use or other dealings in this Software without prior written       *
   * authorization.                                                           *
   ****************************************************************************
-  * @Id: toe.1m,v 1.23 2010/12/04 18:40:45 tom Exp @
+  * @Id: toe.1m,v 1.26 2012/01/01 00:40:51 tom Exp @
 -->
 <HTML>
 <HEAD>
@@ -52,7 +52,7 @@
 
 </PRE>
 <H2>SYNOPSIS</H2><PRE>
-       <STRONG>toe</STRONG> [<STRONG>-v</STRONG>[<EM>n</EM>]] [<STRONG>-ahuUV</STRONG>] <EM>file...</EM>
+       <STRONG>toe</STRONG> [<STRONG>-v</STRONG>[<EM>n</EM>]] [<STRONG>-ahsuUV</STRONG>] <EM>file...</EM>
 
 
 </PRE>
@@ -71,6 +71,14 @@
               ncurses would search, rather than  only  the  first
               one that it finds.
 
+              If  the  <STRONG>-s</STRONG> is also given, <STRONG>toe</STRONG> adds a column to the
+              report, showing (like  <STRONG><A HREF="conflict.1.html">conflict(1)</A></STRONG>)  which  entries
+              which  belong to a given terminal database.  An "*"
+              marks entries which differ, and "+"  marks  equiva-
+              lent entries.
+
+       <STRONG>-s</STRONG>     sort the output by the entry names.
+
        <STRONG>-u</STRONG> <EM>file</EM>
               says  to  write  a  report  to the standard output,
               listing dependencies in the given  terminfo/termcap
@@ -111,7 +119,7 @@
        <STRONG><A HREF="tic.1m.html">tic(1m)</A></STRONG>,    <STRONG><A HREF="infocmp.1m.html">infocmp(1m)</A></STRONG>,   <STRONG><A HREF="captoinfo.1m.html">captoinfo(1m)</A></STRONG>,   <STRONG><A HREF="infotocap.1m.html">infotocap(1m)</A></STRONG>,
        <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>, <STRONG><A HREF="terminfo.5.html">terminfo(5)</A></STRONG>.
 
-       This describes <STRONG>ncurses</STRONG> version 5.9 (patch 20110404).
+       This describes <STRONG>ncurses</STRONG> version 5.9 (patch 20130309).
 
 
 
Index: doc/html/man/tput.1.html
--- ncurses-5.9/doc/html/man/tput.1.html	2011-04-04 22:46:51.000000000 +0000
+++ ncurses-5.9-20130504/doc/html/man/tput.1.html	2013-03-09 22:12:05.000000000 +0000
@@ -2,7 +2,7 @@
 <!-- 
   * t
   ****************************************************************************
-  * Copyright (c) 1998-2006,2010 Free Software Foundation, Inc.              *
+  * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc.              *
   *                                                                          *
   * Permission is hereby granted, free of charge, to any person obtaining a  *
   * copy of this software and associated documentation files (the            *
@@ -28,7 +28,7 @@
   * sale, use or other dealings in this Software without prior written       *
   * authorization.                                                           *
   ****************************************************************************
-  * @Id: tput.1,v 1.29 2010/12/04 18:41:07 tom Exp @
+  * @Id: tput.1,v 1.32 2012/07/14 21:06:45 tom Exp @
 -->
 <HTML>
 <HEAD>
@@ -95,54 +95,53 @@
               option is unnecessary, because the default is taken
               from the environment variable <STRONG>TERM</STRONG>.  If <STRONG>-T</STRONG> is spec-
               ified,  then  the shell variables <STRONG>LINES</STRONG> and <STRONG>COLUMNS</STRONG>
-              will be ignored,and the operating system  will  not
-              be queried for the actual screen size.
+              will also be ignored.
 
        <EM>capname</EM>
-              indicates   the   capability   from   the  <STRONG>terminfo</STRONG>
-              database.  When <STRONG>termcap</STRONG> support is compiled in, the
+              indicates the capability from  the  <STRONG>terminfo</STRONG>  data-
+              base.   When  <STRONG>termcap</STRONG>  support  is compiled in, the
               <STRONG>termcap</STRONG> name for the capability is also accepted.
 
-       <EM>parms</EM>  If  the  capability  is a string that takes parame-
+       <EM>parms</EM>  If the capability is a string  that  takes  parame-
               ters, the arguments <EM>parms</EM> will be instantiated into
               the string.
 
-              Most  parameters  are numbers.  Only a few terminfo
+              Most parameters are numbers.  Only a  few  terminfo
               capabilities require string parameters; <STRONG>tput</STRONG> uses a
               table to decide which to pass as strings.  Normally
-              <STRONG>tput</STRONG> uses <STRONG>tparm</STRONG> (3x) to perform  the  substitution.
+              <STRONG>tput</STRONG>  uses  <STRONG>tparm</STRONG> (3x) to perform the substitution.
               If no parameters are given for the capability, <STRONG>tput</STRONG>
-              writes   the   string   without   performing    the
-              substitution.
+              writes  the string without performing the substitu-
+              tion.
 
-       <STRONG>-S</STRONG>     allows  more  than one capability per invocation of
+       <STRONG>-S</STRONG>     allows more than one capability per  invocation  of
               <STRONG>tput</STRONG>.  The capabilities must be passed to <STRONG>tput</STRONG> from
               the standard input instead of from the command line
-              (see example).  Only one  <EM>capname</EM>  is  allowed  per
-              line.   The  <STRONG>-S</STRONG> option changes the meaning of the <STRONG>0</STRONG>
-              and <STRONG>1</STRONG> boolean and string exit codes (see  the  EXIT
+              (see  example).   Only  one  <EM>capname</EM> is allowed per
+              line.  The <STRONG>-S</STRONG> option changes the meaning of  the  <STRONG>0</STRONG>
+              and  <STRONG>1</STRONG>  boolean and string exit codes (see the EXIT
               CODES section).
 
               Again, <STRONG>tput</STRONG> uses a table and the presence of param-
-              eters in its input to decide whether to  use  <STRONG>tparm</STRONG>
+              eters  in  its input to decide whether to use <STRONG>tparm</STRONG>
               (3x), and how to interpret the parameters.
 
-       <STRONG>-V</STRONG>     reports  the  version  of ncurses which was used in
+       <STRONG>-V</STRONG>     reports the version of ncurses which  was  used  in
               this program, and exits.
 
-       <STRONG>init</STRONG>   If the <STRONG>terminfo</STRONG> database is present  and  an  entry
+       <STRONG>init</STRONG>   If  the  <STRONG>terminfo</STRONG>  database is present and an entry
               for the user's terminal exists (see <STRONG>-T</STRONG><EM>type</EM>, above),
               the following will occur:
 
-              (1)    if present,  the  terminal's  initialization
-                     strings  will  be  output as detailed in the
-                     <STRONG><A HREF="terminfo.5.html">terminfo(5)</A></STRONG> section on <EM>Tabs</EM> <EM>and</EM>  <EM>Initializa-</EM>
+              (1)    if  present,  the  terminal's initialization
+                     strings will be output as  detailed  in  the
+                     <STRONG><A HREF="terminfo.5.html">terminfo(5)</A></STRONG>  section on <EM>Tabs</EM> <EM>and</EM> <EM>Initializa-</EM>
                      <EM>tion</EM>,
 
-              (2)    any  delays (e.g., newline) specified in the
+              (2)    any delays (e.g., newline) specified in  the
                      entry will be set in the tty driver,
 
-              (3)    tabs expansion will  be  turned  on  or  off
+              (3)    tabs  expansion  will  be  turned  on or off
                      according to the specification in the entry,
                      and
 
@@ -153,22 +152,22 @@
               for any of the four above activities, that activity
               will silently be skipped.
 
-       <STRONG>reset</STRONG>  Instead  of putting out initialization strings, the
-              terminal's reset strings will be output if  present
-              (<STRONG>rs1</STRONG>,  <STRONG>rs2</STRONG>, <STRONG>rs3</STRONG>, <STRONG>rf</STRONG>).  If the reset strings are not
-              present, but initialization strings are,  the  ini-
-              tialization  strings  will  be  output.  Otherwise,
+       <STRONG>reset</STRONG>  Instead of putting out initialization strings,  the
+              terminal's  reset strings will be output if present
+              (<STRONG>rs1</STRONG>, <STRONG>rs2</STRONG>, <STRONG>rs3</STRONG>, <STRONG>rf</STRONG>).  If the reset strings are  not
+              present,  but  initialization strings are, the ini-
+              tialization strings  will  be  output.   Otherwise,
               <STRONG>reset</STRONG> acts identically to <STRONG>init</STRONG>.
 
        <STRONG>longname</STRONG>
-              If the <STRONG>terminfo</STRONG> database is present  and  an  entry
-              for  the user's terminal exists (see <STRONG>-T</STRONG><EM>type</EM> above),
+              If  the  <STRONG>terminfo</STRONG>  database is present and an entry
+              for the user's terminal exists (see <STRONG>-T</STRONG><EM>type</EM>  above),
               then the long name of the terminal will be put out.
               The long name is the last name in the first line of
               the terminal's description in the <STRONG>terminfo</STRONG> database
               [see <STRONG><A HREF="term.5.html">term(5)</A></STRONG>].
 
-       If  <STRONG>tput</STRONG>  is  invoked  by a link named <STRONG>reset</STRONG>, this has the
+       If <STRONG>tput</STRONG> is invoked by a link named  <STRONG>reset</STRONG>,  this  has  the
        same effect as <STRONG>tput</STRONG> <STRONG>reset</STRONG>.  See <STRONG>tset</STRONG> for comparison, which
        has similar behavior.
 
@@ -177,13 +176,13 @@
 <H2>EXAMPLES</H2><PRE>
        <STRONG>tput</STRONG> <STRONG>init</STRONG>
             Initialize the terminal according to the type of ter-
-            minal in the environmental variable <STRONG>TERM</STRONG>.  This  com-
-            mand  should be included in everyone's .profile after
+            minal  in the environmental variable <STRONG>TERM</STRONG>.  This com-
+            mand should be included in everyone's .profile  after
             the environmental variable <STRONG>TERM</STRONG> has been exported, as
             illustrated on the <STRONG><A HREF="profile.5.html">profile(5)</A></STRONG> manual page.
 
        <STRONG>tput</STRONG> <STRONG>-T5620</STRONG> <STRONG>reset</STRONG>
-            Reset  an  AT&amp;T 5620 terminal, overriding the type of
+            Reset an AT&amp;T 5620 terminal, overriding the  type  of
             terminal in the environmental variable <STRONG>TERM</STRONG>.
 
        <STRONG>tput</STRONG> <STRONG>cup</STRONG> <STRONG>0</STRONG> <STRONG>0</STRONG>
@@ -263,29 +262,29 @@
        type of <EM>capname</EM>:
 
             <EM>boolean</EM>
-                   a value of <STRONG>0</STRONG> is set for TRUE and <STRONG>1</STRONG> for  FALSE.
+                   a value of <STRONG>0</STRONG> is set for TRUE and <STRONG>1</STRONG> for FALSE.
 
-            <EM>string</EM> a  value of <STRONG>0</STRONG> is set if the <EM>capname</EM> is defined
-                   for this terminal <EM>type</EM> (the value  of  <EM>capname</EM>
-                   is  returned on standard output); a value of <STRONG>1</STRONG>
+            <EM>string</EM> a value of <STRONG>0</STRONG> is set if the <EM>capname</EM> is  defined
+                   for  this  terminal <EM>type</EM> (the value of <EM>capname</EM>
+                   is returned on standard output); a value of  <STRONG>1</STRONG>
                    is set if <EM>capname</EM> is not defined for this ter-
-                   minal  <EM>type</EM>  (nothing  is  written to standard
+                   minal <EM>type</EM> (nothing  is  written  to  standard
                    output).
 
             <EM>integer</EM>
-                   a value of <STRONG>0</STRONG> is always  set,  whether  or  not
+                   a  value  of  <STRONG>0</STRONG>  is always set, whether or not
                    <EM>capname</EM> is defined for this terminal <EM>type</EM>.  To
-                   determine if <EM>capname</EM> is defined for this  ter-
+                   determine  if <EM>capname</EM> is defined for this ter-
                    minal <EM>type</EM>, the user must test the value writ-
-                   ten to standard output.  A value of  <STRONG>-1</STRONG>  means
-                   that  <EM>capname</EM> is not defined for this terminal
+                   ten  to  standard output.  A value of <STRONG>-1</STRONG> means
+                   that <EM>capname</EM> is not defined for this  terminal
                    <EM>type</EM>.
 
-            <EM>other</EM>  <STRONG>reset</STRONG> or <STRONG>init</STRONG> may fail to find  their  respec-
-                   tive  files.   In  that case, the exit code is
+            <EM>other</EM>  <STRONG>reset</STRONG>  or  <STRONG>init</STRONG> may fail to find their respec-
+                   tive files.  In that case, the  exit  code  is
                    set to 4 + <STRONG>errno</STRONG>.
 
-       Any other exit code indicates an error; see  the  DIAGNOS-
+       Any  other  exit code indicates an error; see the DIAGNOS-
        TICS section.
 
 
@@ -294,11 +293,10 @@
        <STRONG>tput</STRONG> prints the following error messages and sets the cor-
        responding exit codes.
 
-
        exit code   error message
        ---------------------------------------------------------------------
-       <STRONG>0</STRONG>           (<EM>capname</EM> is a numeric variable that is not specified  in
-                   the  <STRONG><A HREF="terminfo.5.html">terminfo(5)</A></STRONG>  database  for this terminal type, e.g.
+       <STRONG>0</STRONG>           (<EM>capname</EM>  is a numeric variable that is not specified in
+                   the <STRONG><A HREF="terminfo.5.html">terminfo(5)</A></STRONG> database for this  terminal  type,  e.g.
                    <STRONG>tput</STRONG> <STRONG>-T450</STRONG> <STRONG>lines</STRONG> and <STRONG>tput</STRONG> <STRONG>-T2621</STRONG> <STRONG>xmc</STRONG>)
        <STRONG>1</STRONG>           no error message is printed, see the <STRONG>EXIT</STRONG> <STRONG>CODES</STRONG> section.
        <STRONG>2</STRONG>           usage error
@@ -310,25 +308,37 @@
 
 </PRE>
 <H2>PORTABILITY</H2><PRE>
-       The <STRONG>longname</STRONG> and <STRONG>-S</STRONG> options, and  the  parameter-substitu-
-       tion  features  used in the <STRONG>cup</STRONG> example, are not supported
+       The  <STRONG>longname</STRONG>  and <STRONG>-S</STRONG> options, and the parameter-substitu-
+       tion features used in the <STRONG>cup</STRONG> example, are  not  supported
        in BSD curses or in AT&amp;T/USL curses before SVr4.
 
-       X/Open documents only the operands  for  <STRONG>clear</STRONG>,  <STRONG>init</STRONG>  and
-       <STRONG>reset</STRONG>.   In this implementation, <STRONG>clear</STRONG> is part of the <EM>cap-</EM>
+       X/Open  documents  only  the  operands for <STRONG>clear</STRONG>, <STRONG>init</STRONG> and
+       <STRONG>reset</STRONG>.  In this implementation, <STRONG>clear</STRONG> is part of the  <EM>cap-</EM>
        <EM>name</EM> support.  Other implementations of <STRONG>tput</STRONG> on SVr4-based
        systems such as Solaris, IRIX64 and HPUX as well as others
-       such  as  AIX  and  Tru64  provide  support  for   <EM>capname</EM>
-       operands.  A few platforms such as FreeBSD and NetBSD rec-
-       ognize termcap names rather than terminfo capability names
-       in their respective <STRONG>tput</STRONG> commands.
+       such  as  AIX  and Tru64 provide support for <EM>capname</EM> oper-
+       ands.
+
+       A few platforms such as FreeBSD and NetBSD recognize term-
+       cap  names  rather than terminfo capability names in their
+       respective <STRONG>tput</STRONG> commands.
+
+       Most implementations which provide support for <EM>capname</EM> op-
+       erands  use the <EM>tparm</EM> function to expand parameters in it.
+       That function expects a  mixture  of  numeric  and  string
+       parameters,  requiring  <STRONG>tput</STRONG>  to  know  which type to use.
+       This implementation uses a table to determine that for the
+       standard  <EM>capname</EM>  operands, and an internal library func-
+       tion  to  analyze  nonstandard  <EM>capname</EM>  operands.   Other
+       implementations  may simply guess that an operand contain-
+       ing only digits is intended to be a number.
 
 
 </PRE>
 <H2>SEE ALSO</H2><PRE>
-       <STRONG><A HREF="clear.1.html">clear(1)</A></STRONG>, <STRONG><A HREF="stty.1.html">stty(1)</A></STRONG>, <STRONG><A HREF="tabs.1.html">tabs(1)</A></STRONG>, <STRONG><A HREF="terminfo.5.html">terminfo(5)</A></STRONG>.
+       <STRONG><A HREF="clear.1.html">clear(1)</A></STRONG>, <STRONG><A HREF="stty.1.html">stty(1)</A></STRONG>, <STRONG><A HREF="tabs.1.html">tabs(1)</A></STRONG>, <STRONG><A HREF="terminfo.5.html">terminfo(5)</A></STRONG>, <STRONG><A HREF="curs_termcap.3x.html">curs_termcap(3x)</A></STRONG>.
 
-       This describes <STRONG>ncurses</STRONG> version 5.9 (patch 20110404).
+       This describes <STRONG>ncurses</STRONG> version 5.9 (patch 20130309).
 
 
 
Index: doc/html/man/tset.1.html
--- ncurses-5.9/doc/html/man/tset.1.html	2011-04-04 22:46:52.000000000 +0000
+++ ncurses-5.9-20130504/doc/html/man/tset.1.html	2013-03-09 22:12:05.000000000 +0000
@@ -1,7 +1,7 @@
 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
 <!-- 
   ****************************************************************************
-  * Copyright (c) 1998-2008,2010 Free Software Foundation, Inc.              *
+  * Copyright (c) 1998-2010,2011 Free Software Foundation, Inc.              *
   *                                                                          *
   * Permission is hereby granted, free of charge, to any person obtaining a  *
   * copy of this software and associated documentation files (the            *
@@ -27,7 +27,7 @@
   * sale, use or other dealings in this Software without prior written       *
   * authorization.                                                           *
   ****************************************************************************
-  * @Id: tset.1,v 1.25 2010/12/04 18:38:55 tom Exp @
+  * @Id: tset.1,v 1.27 2011/12/17 23:20:35 tom Exp @
 -->
 <HTML>
 <HEAD>
@@ -116,8 +116,9 @@
 
        The options are as follows:
 
-       <STRONG>-c</STRONG>   Set  control  characters and modes.  <STRONG>-e</STRONG> Set the erase
-            character to <EM>ch</EM>.
+       <STRONG>-c</STRONG>   Set control characters and modes.
+
+       <STRONG>-e</STRONG>   Set the erase character to <EM>ch</EM>.
 
        <STRONG>-I</STRONG>   Do  not  send  the  terminal  or  tab  initialization
             strings to the terminal.
@@ -126,51 +127,51 @@
 
        <STRONG>-k</STRONG>   Set the line kill character to <EM>ch</EM>.
 
-       <STRONG>-m</STRONG>   Specify  a  mapping  from  a port type to a terminal.
+       <STRONG>-m</STRONG>   Specify a mapping from a port  type  to  a  terminal.
             See the section <STRONG>TERMINAL</STRONG> <STRONG>TYPE</STRONG> <STRONG>MAPPING</STRONG> for more infor-
             mation.
 
-       <STRONG>-Q</STRONG>   Do  not  display  any values for the erase, interrupt
+       <STRONG>-Q</STRONG>   Do not display any values for  the  erase,  interrupt
             and line kill characters.  Normally <STRONG>tset</STRONG> displays the
-            values  for  control characters which differ from the
+            values for control characters which differ  from  the
             system's default values.
 
-       <STRONG>-q</STRONG>   The terminal type is displayed to the  standard  out-
-            put,  and the terminal is not initialized in any way.
+       <STRONG>-q</STRONG>   The  terminal  type is displayed to the standard out-
+            put, and the terminal is not initialized in any  way.
             The option `-' by itself is equivalent but archaic.
 
        <STRONG>-r</STRONG>   Print the terminal type to the standard error output.
 
        <STRONG>-s</STRONG>   Print  the  sequence  of shell commands to initialize
             the environment variable <STRONG>TERM</STRONG> to the standard output.
-            See  the section <STRONG>SETTING</STRONG> <STRONG>THE</STRONG> <STRONG>ENVIRONMENT</STRONG> for details.
+            See the section <STRONG>SETTING</STRONG> <STRONG>THE</STRONG> <STRONG>ENVIRONMENT</STRONG> for details.
 
        <STRONG>-V</STRONG>   reports the version of ncurses which was used in this
             program, and exits.
 
-       <STRONG>-w</STRONG>   Resize  the  window  to  match  the  size deduced via
+       <STRONG>-w</STRONG>   Resize the window  to  match  the  size  deduced  via
             <STRONG>setupterm</STRONG>.   Normally  this  has  no  effect,  unless
             <STRONG>setupterm</STRONG> is not able to detect the window size.
 
        The arguments for the <STRONG>-e</STRONG>, <STRONG>-i</STRONG>, and <STRONG>-k</STRONG> options may either be
-       entered as actual characters or by using the  `hat'  nota-
-       tion,  i.e.,  control-h  may  be  specified  as  ``^H'' or
+       entered  as  actual characters or by using the `hat' nota-
+       tion, i.e.,  control-h  may  be  specified  as  ``^H''  or
        ``^h''.
 
 
 </PRE>
 <H2>SETTING THE ENVIRONMENT</H2><PRE>
-       It is often desirable  to  enter  the  terminal  type  and
-       information  about  the  terminal's  capabilities into the
+       It  is  often  desirable  to  enter  the terminal type and
+       information about the  terminal's  capabilities  into  the
        shell's environment.  This is done using the <STRONG>-s</STRONG> option.
 
        When the <STRONG>-s</STRONG> option is specified, the commands to enter the
-       information  into  the  shell's environment are written to
-       the standard output.  If the <STRONG>SHELL</STRONG> environmental  variable
+       information into the shell's environment  are  written  to
+       the  standard output.  If the <STRONG>SHELL</STRONG> environmental variable
        ends in ``csh'', the commands are for <STRONG>csh</STRONG>, otherwise, they
-       are for <STRONG>sh</STRONG>.  Note, the <STRONG>csh</STRONG>  commands  set  and  unset  the
-       shell  variable  <STRONG>noglob</STRONG>,  leaving it unset.  The following
-       line in the <STRONG>.login</STRONG> or <STRONG>.profile</STRONG> files will  initialize  the
+       are  for  <STRONG>sh</STRONG>.   Note,  the  <STRONG>csh</STRONG> commands set and unset the
+       shell variable <STRONG>noglob</STRONG>, leaving it  unset.   The  following
+       line  in  the <STRONG>.login</STRONG> or <STRONG>.profile</STRONG> files will initialize the
        environment correctly:
 
            eval `tset -s options ... `
@@ -180,107 +181,107 @@
 <H2>TERMINAL TYPE MAPPING</H2><PRE>
        When the terminal is not hardwired into the system (or the
        current system information is incorrect) the terminal type
-       derived  from the <EM>/etc/ttys</EM> file or the <STRONG>TERM</STRONG> environmental
-       variable is often something generic like <STRONG>network</STRONG>,  <STRONG>dialup</STRONG>,
-       or  <STRONG>unknown</STRONG>.   When <STRONG>tset</STRONG> is used in a startup script it is
-       often desirable to provide information about the  type  of
+       derived from the <EM>/etc/ttys</EM> file or the <STRONG>TERM</STRONG>  environmental
+       variable  is often something generic like <STRONG>network</STRONG>, <STRONG>dialup</STRONG>,
+       or <STRONG>unknown</STRONG>.  When <STRONG>tset</STRONG> is used in a startup script  it  is
+       often  desirable  to provide information about the type of
        terminal used on such ports.
 
-       The  purpose  of  the <STRONG>-m</STRONG> option is to map from some set of
-       conditions to a terminal type, that is, to tell <STRONG>tset</STRONG>  ``If
-       I'm  on this port at a particular speed, guess that I'm on
+       The purpose of the <STRONG>-m</STRONG> option is to map from  some  set  of
+       conditions  to a terminal type, that is, to tell <STRONG>tset</STRONG> ``If
+       I'm on this port at a particular speed, guess that I'm  on
        that kind of terminal''.
 
        The argument to the <STRONG>-m</STRONG> option consists of an optional port
        type, an optional operator, an optional baud rate specifi-
        cation, an optional colon (``:'') character and a terminal
-       type.   The port type is a string (delimited by either the
+       type.  The port type is a string (delimited by either  the
        operator or the colon character).  The operator may be any
        combination of ``&gt;'', ``&lt;'', ``@'', and ``!''; ``&gt;'' means
-       greater than, ``&lt;'' means less than, ``@'' means equal  to
+       greater  than, ``&lt;'' means less than, ``@'' means equal to
        and ``!'' inverts the sense of the test.  The baud rate is
-       specified as a number and is compared with  the  speed  of
-       the  standard  error  output  (which should be the control
+       specified  as  a  number and is compared with the speed of
+       the standard error output (which  should  be  the  control
        terminal).  The terminal type is a string.
 
        If the terminal type is not specified on the command line,
-       the  <STRONG>-m</STRONG> mappings are applied to the terminal type.  If the
-       port type and baud rate match the  mapping,  the  terminal
-       type  specified  in the mapping replaces the current type.
-       If more than one mapping is specified, the first  applica-
+       the <STRONG>-m</STRONG> mappings are applied to the terminal type.  If  the
+       port  type  and  baud rate match the mapping, the terminal
+       type specified in the mapping replaces the  current  type.
+       If  more than one mapping is specified, the first applica-
        ble mapping is used.
 
-       For    example,    consider    the    following   mapping:
+       For   example,    consider    the    following    mapping:
        <STRONG>dialup&gt;9600:vt100</STRONG>.  The port type is dialup , the operator
-       is  &gt;, the baud rate specification is 9600, and the termi-
+       is &gt;, the baud rate specification is 9600, and the  termi-
        nal type is vt100.  The result of this mapping is to spec-
        ify that if the terminal type is <STRONG>dialup</STRONG>, and the baud rate
-       is greater than 9600 baud, a terminal type of  <STRONG>vt100</STRONG>  will
+       is  greater  than 9600 baud, a terminal type of <STRONG>vt100</STRONG> will
        be used.
 
        If no baud rate is specified, the terminal type will match
        any baud rate.  If no port type is specified, the terminal
-       type   will   match   any  port  type.   For  example,  <STRONG>-m</STRONG>
+       type  will  match  any  port  type.    For   example,   <STRONG>-m</STRONG>
        <STRONG>dialup:vt100</STRONG>  <STRONG>-m</STRONG>  <STRONG>:?xterm</STRONG>  will  cause  any  dialup  port,
        regardless of baud rate, to match the terminal type vt100,
-       and any non-dialup port type to match  the  terminal  type
-       ?xterm.   Note,  because of the leading question mark, the
-       user will be queried on a default port as to whether  they
+       and  any  non-dialup  port type to match the terminal type
+       ?xterm.  Note, because of the leading question  mark,  the
+       user  will be queried on a default port as to whether they
        are actually using an xterm terminal.
 
-       No  whitespace  characters  are permitted in the <STRONG>-m</STRONG> option
-       argument.  Also, to avoid problems  with  meta-characters,
-       it  is  suggested  that  the  entire <STRONG>-m</STRONG> option argument be
-       placed within single quote characters, and that <STRONG>csh</STRONG>  users
-       insert  a  backslash character (``\'') before any exclama-
+       No whitespace characters are permitted in  the  <STRONG>-m</STRONG>  option
+       argument.   Also,  to avoid problems with meta-characters,
+       it is suggested that the  entire  <STRONG>-m</STRONG>  option  argument  be
+       placed  within single quote characters, and that <STRONG>csh</STRONG> users
+       insert a backslash character (``\'') before  any  exclama-
        tion marks (``!'').
 
 
 </PRE>
 <H2>HISTORY</H2><PRE>
-       The <STRONG>tset</STRONG> command appeared in BSD 3.0.  The <STRONG>ncurses</STRONG>  imple-
-       mentation  was lightly adapted from the 4.4BSD sources for
+       The  <STRONG>tset</STRONG> command appeared in BSD 3.0.  The <STRONG>ncurses</STRONG> imple-
+       mentation was lightly adapted from the 4.4BSD sources  for
        a terminfo environment by Eric S. Raymond &lt;esr@snark.thyr-
        sus.com&gt;.
 
 
 </PRE>
 <H2>COMPATIBILITY</H2><PRE>
-       The  <STRONG>tset</STRONG>  utility has been provided for backward-compati-
-       bility with BSD environments (under  most  modern  UNIXes,
-       <STRONG>/etc/inittab</STRONG>  and  <STRONG><A HREF="getty.1.html">getty(1)</A></STRONG> can set <STRONG>TERM</STRONG> appropriately for
-       each dial-up line; this  obviates  what  was  <STRONG>tset</STRONG>'s  most
-       important  use).   This implementation behaves like 4.4BSD
+       The <STRONG>tset</STRONG> utility has been provided  for  backward-compati-
+       bility  with  BSD  environments (under most modern UNIXes,
+       <STRONG>/etc/inittab</STRONG> and <STRONG><A HREF="getty.1.html">getty(1)</A></STRONG> can set <STRONG>TERM</STRONG>  appropriately  for
+       each  dial-up  line;  this  obviates  what was <STRONG>tset</STRONG>'s most
+       important use).  This implementation behaves  like  4.4BSD
        tset, with a few exceptions specified here.
 
-       The <STRONG>-S</STRONG> option of BSD tset no longer works;  it  prints  an
+       The  <STRONG>-S</STRONG>  option  of BSD tset no longer works; it prints an
        error message to stderr and dies.  The <STRONG>-s</STRONG> option only sets
-       <STRONG>TERM</STRONG>, not <STRONG>TERMCAP</STRONG>.  Both these  changes  are  because  the
-       <STRONG>TERMCAP</STRONG>  variable  is  no longer supported under terminfo-
+       <STRONG>TERM</STRONG>,  not  <STRONG>TERMCAP</STRONG>.   Both  these changes are because the
+       <STRONG>TERMCAP</STRONG> variable is no longer  supported  under  terminfo-
        based <STRONG>ncurses</STRONG>, which makes <STRONG>tset</STRONG> <STRONG>-S</STRONG> useless (we made it die
        noisily rather than silently induce lossage).
 
-       There  was  an  undocumented  4.4BSD feature that invoking
+       There was an undocumented  4.4BSD  feature  that  invoking
        tset via a link named `TSET` (or via any other name begin-
-       ning  with  an  upper-case letter) set the terminal to use
+       ning with an upper-case letter) set the  terminal  to  use
        upper-case only.  This feature has been omitted.
 
-       The <STRONG>-A</STRONG>, <STRONG>-E</STRONG>, <STRONG>-h</STRONG>, <STRONG>-u</STRONG> and <STRONG>-v</STRONG> options were  deleted  from  the
-       <STRONG>tset</STRONG>  utility  in 4.4BSD.  None of them were documented in
-       4.3BSD and all are of limited utility at  best.   The  <STRONG>-a</STRONG>,
+       The  <STRONG>-A</STRONG>,  <STRONG>-E</STRONG>,  <STRONG>-h</STRONG>, <STRONG>-u</STRONG> and <STRONG>-v</STRONG> options were deleted from the
+       <STRONG>tset</STRONG> utility in 4.4BSD.  None of them were  documented  in
+       4.3BSD  and  all  are of limited utility at best.  The <STRONG>-a</STRONG>,
        <STRONG>-d</STRONG>, and <STRONG>-p</STRONG> options are similarly not documented or useful,
-       but were retained as they appear to be in widespread  use.
-       It  is  strongly recommended that any usage of these three
-       options be changed to use the <STRONG>-m</STRONG> option instead.   The  <STRONG>-n</STRONG>
-       option  remains, but has no effect.  The <STRONG>-adnp</STRONG> options are
+       but  were retained as they appear to be in widespread use.
+       It is strongly recommended that any usage of  these  three
+       options  be  changed to use the <STRONG>-m</STRONG> option instead.  The <STRONG>-n</STRONG>
+       option remains, but has no effect.  The <STRONG>-adnp</STRONG> options  are
        therefore omitted from the usage summary above.
 
-       It is still permissible to specify  the  <STRONG>-e</STRONG>,  <STRONG>-i</STRONG>,  and  <STRONG>-k</STRONG>
-       options  without arguments, although it is strongly recom-
-       mended that such usage be fixed to explicitly specify  the
+       It  is  still  permissible  to  specify the <STRONG>-e</STRONG>, <STRONG>-i</STRONG>, and <STRONG>-k</STRONG>
+       options without arguments, although it is strongly  recom-
+       mended  that such usage be fixed to explicitly specify the
        character.
 
-       As  of  4.4BSD,  executing <STRONG>tset</STRONG> as <STRONG>reset</STRONG> no longer implies
+       As of 4.4BSD, executing <STRONG>tset</STRONG> as <STRONG>reset</STRONG>  no  longer  implies
        the <STRONG>-Q</STRONG> option.  Also, the interaction between the - option
        and the <EM>terminal</EM> argument in some historic implementations
        of <STRONG>tset</STRONG> has been removed.
@@ -294,7 +295,7 @@
             tells <STRONG>tset</STRONG> whether to initialize <STRONG>TERM</STRONG> using <STRONG>sh</STRONG> or <STRONG>csh</STRONG>
             syntax.
 
-       TERM Denotes  your  terminal  type.  Each terminal type is
+       TERM Denotes your terminal type.  Each  terminal  type  is
             distinct, though many are similar.
 
        TERMCAP
@@ -307,7 +308,7 @@
 </PRE>
 <H2>FILES</H2><PRE>
        /etc/ttys
-            system  port  name  to terminal type mapping database
+            system port name to terminal  type  mapping  database
             (BSD versions only).
 
        /usr/share/terminfo
@@ -316,10 +317,10 @@
 
 </PRE>
 <H2>SEE ALSO</H2><PRE>
-       <STRONG><A HREF="csh.1.html">csh(1)</A></STRONG>, <STRONG><A HREF="sh.1.html">sh(1)</A></STRONG>, <STRONG><A HREF="stty.1.html">stty(1)</A></STRONG>,  <STRONG><A HREF="curs_terminfo.3x.html">curs_terminfo(3x)</A></STRONG>,  <STRONG><A HREF="tty.4.html">tty(4)</A></STRONG>,  ter-
+       <STRONG><A HREF="csh.1.html">csh(1)</A></STRONG>,  <STRONG><A HREF="sh.1.html">sh(1)</A></STRONG>,  <STRONG><A HREF="stty.1.html">stty(1)</A></STRONG>,  <STRONG><A HREF="curs_terminfo.3x.html">curs_terminfo(3x)</A></STRONG>, <STRONG><A HREF="tty.4.html">tty(4)</A></STRONG>, ter-
        <STRONG><A HREF="minfo.5.html">minfo(5)</A></STRONG>, <STRONG><A HREF="ttys.5.html">ttys(5)</A></STRONG>, <STRONG><A HREF="environ.7.html">environ(7)</A></STRONG>
 
-       This describes <STRONG>ncurses</STRONG> version 5.9 (patch 20110404).
+       This describes <STRONG>ncurses</STRONG> version 5.9 (patch 20130309).
 
 
 
Index: doc/html/ncurses-intro.html
Prereq:  1.44 
--- ncurses-5.9/doc/html/ncurses-intro.html	2010-12-04 16:46:22.000000000 +0000
+++ ncurses-5.9-20130504/doc/html/ncurses-intro.html	2012-04-28 21:39:17.000000000 +0000
@@ -1,8 +1,8 @@
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 <!--
-  $Id: ncurses-intro.html,v 1.44 2010/12/04 16:46:22 tom Exp $
+  $Id: ncurses-intro.html,v 1.45 2012/04/28 21:39:17 Paul.Waring Exp $
   ****************************************************************************
-  * Copyright (c) 1998-2007,2010 Free Software Foundation, Inc.              *
+  * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc.              *
   *                                                                          *
   * Permission is hereby granted, free of charge, to any person obtaining a  *
   * copy of this software and associated documentation files (the            *
@@ -431,6 +431,7 @@
 Here is a sample program to motivate the discussion:
 
 <PRE>
+#include &lt;stdlib.h&gt;
 #include &lt;curses.h&gt;
 #include &lt;signal.h&gt;
 
Index: doc/ncurses-intro.doc
--- ncurses-5.9/doc/ncurses-intro.doc	2007-03-03 23:45:04.000000000 +0000
+++ ncurses-5.9-20130504/doc/ncurses-intro.doc	2012-04-28 22:48:33.000000000 +0000
@@ -333,6 +333,7 @@
 
    Here is a sample program to motivate the discussion:
 #include <curses.h>
+#include <curses.h>
 #include <signal.h>
 
 static void finish(int sig);
Index: form/Makefile.in
Prereq:  1.53 
--- ncurses-5.9/form/Makefile.in	2010-11-27 21:45:27.000000000 +0000
+++ ncurses-5.9-20130504/form/Makefile.in	2012-09-29 19:37:34.000000000 +0000
@@ -1,6 +1,6 @@
-# $Id: Makefile.in,v 1.53 2010/11/27 21:45:27 tom Exp $
+# $Id: Makefile.in,v 1.55 2012/09/29 19:37:34 tom Exp $
 ##############################################################################
-# Copyright (c) 1998-2009,2010 Free Software Foundation, Inc.                #
+# Copyright (c) 1998-2011,2012 Free Software Foundation, Inc.                #
 #                                                                            #
 # Permission is hereby granted, free of charge, to any person obtaining a    #
 # copy of this software and associated documentation files (the "Software"), #
@@ -102,6 +102,7 @@
 SHLIB_DIRS	= -L../lib
 SHLIB_LIST	= $(SHLIB_DIRS) -lncurses@LIB_SUFFIX@ @SHLIB_LIST@
 
+RPATH_LIST	= @RPATH_LIST@
 MK_SHARED_LIB	= @MK_SHARED_LIB@
 
 NCURSES_MAJOR	= @NCURSES_MAJOR@
@@ -111,7 +112,7 @@
 
 RANLIB		= @LIB_PREP@
 
-LIBRARIES	= @LIBS_TO_MAKE@
+LIBRARIES	= @Libs_To_Make@
 
 LINT		= @LINT@
 LINT_OPTS	= @LINT_OPTS@
Index: form/fld_arg.c
Prereq:  1.12 
--- ncurses-5.9/form/fld_arg.c	2010-01-23 21:14:35.000000000 +0000
+++ ncurses-5.9-20130504/form/fld_arg.c	2012-06-10 00:27:49.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2004,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -32,7 +32,7 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: fld_arg.c,v 1.12 2010/01/23 21:14:35 tom Exp $")
+MODULE_ID("$Id: fld_arg.c,v 1.13 2012/06/10 00:27:49 tom Exp $")
 
 /*---------------------------------------------------------------------------
 |   Facility      :  libnform
@@ -71,7 +71,7 @@
 
   if (typ != 0 && make_arg != (void *)0)
     {
-      typ->status |= _HAS_ARGS;
+      SetStatus(typ, _HAS_ARGS);
       typ->makearg = make_arg;
       typ->copyarg = copy_arg;
       typ->freearg = free_arg;
Index: form/fld_def.c
Prereq:  1.38 
--- ncurses-5.9/form/fld_def.c	2010-01-23 21:14:35.000000000 +0000
+++ ncurses-5.9-20130504/form/fld_def.c	2012-03-11 00:37:16.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2007,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -32,7 +32,7 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: fld_def.c,v 1.38 2010/01/23 21:14:35 tom Exp $")
+MODULE_ID("$Id: fld_def.c,v 1.40 2012/03/11 00:37:16 tom Exp $")
 
 /* this can't be readonly */
 static FIELD default_field =
@@ -65,8 +65,7 @@
   NCURSES_FIELD_EXTENSION
 };
 
-NCURSES_EXPORT_VAR(FIELD *)
-_nc_Default_Field = &default_field;
+NCURSES_EXPORT_VAR(FIELD *) _nc_Default_Field = &default_field;
 
 /*---------------------------------------------------------------------------
 |   Facility      :  libnform
@@ -186,10 +185,12 @@
     {
       if ((typ->status & _LINKED_TYPE) != 0)
 	{
-	  assert(argp != 0);
-	  _nc_Free_Argument(typ->left, argp->left);
-	  _nc_Free_Argument(typ->right, argp->right);
-	  free(argp);
+	  if (argp != 0)
+	    {
+	      _nc_Free_Argument(typ->left, argp->left);
+	      _nc_Free_Argument(typ->right, argp->right);
+	      free(argp);
+	    }
 	}
       else
 	{
@@ -293,14 +294,14 @@
     {
       T((T_CREATE("field %p"), (void *)New_Field));
       *New_Field = default_field;
-      New_Field->rows = rows;
-      New_Field->cols = cols;
+      New_Field->rows = (short) rows;
+      New_Field->cols = (short) cols;
       New_Field->drows = rows + nrow;
       New_Field->dcols = cols;
-      New_Field->frow = frow;
-      New_Field->fcol = fcol;
+      New_Field->frow = (short) frow;
+      New_Field->fcol = (short) fcol;
       New_Field->nrow = nrow;
-      New_Field->nbuf = nbuf;
+      New_Field->nbuf = (short) nbuf;
       New_Field->link = New_Field;
 
 #if USE_WIDEC_SUPPORT
Index: form/fld_dup.c
Prereq:  1.13 
--- ncurses-5.9/form/fld_dup.c	2010-01-23 21:14:35.000000000 +0000
+++ ncurses-5.9-20130504/form/fld_dup.c	2012-03-11 00:37:16.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2007,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -32,7 +32,7 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: fld_dup.c,v 1.13 2010/01/23 21:14:35 tom Exp $")
+MODULE_ID("$Id: fld_dup.c,v 1.14 2012/03/11 00:37:16 tom Exp $")
 
 /*---------------------------------------------------------------------------
 |   Facility      :  libnform
@@ -60,8 +60,8 @@
     {
       T((T_CREATE("field %p"), (void *)New_Field));
       *New_Field = *_nc_Default_Field;
-      New_Field->frow = frow;
-      New_Field->fcol = fcol;
+      New_Field->frow = (short) frow;
+      New_Field->fcol = (short) fcol;
       New_Field->link = New_Field;
       New_Field->rows = field->rows;
       New_Field->cols = field->cols;
Index: form/fld_ftchoice.c
Prereq:  1.12 
--- ncurses-5.9/form/fld_ftchoice.c	2010-01-23 21:14:35.000000000 +0000
+++ ncurses-5.9-20130504/form/fld_ftchoice.c	2012-06-10 00:27:49.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -32,7 +32,7 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: fld_ftchoice.c,v 1.12 2010/01/23 21:14:35 tom Exp $")
+MODULE_ID("$Id: fld_ftchoice.c,v 1.13 2012/06/10 00:27:49 tom Exp $")
 
 /*---------------------------------------------------------------------------
 |   Facility      :  libnform  
@@ -56,7 +56,7 @@
   if (!typ || !next_choice || !prev_choice)
     RETURN(E_BAD_ARGUMENT);
 
-  typ->status |= _HAS_CHOICE;
+  SetStatus(typ, _HAS_CHOICE);
 #if NCURSES_INTEROP_FUNCS
   typ->enum_next.onext = next_choice;
   typ->enum_prev.oprev = prev_choice;
Index: form/fld_ftlink.c
Prereq:  1.14 
--- ncurses-5.9/form/fld_ftlink.c	2010-01-23 21:14:35.000000000 +0000
+++ ncurses-5.9-20130504/form/fld_ftlink.c	2012-06-10 00:27:49.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2007,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -32,7 +32,7 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: fld_ftlink.c,v 1.14 2010/01/23 21:14:35 tom Exp $")
+MODULE_ID("$Id: fld_ftlink.c,v 1.15 2012/06/10 00:27:49 tom Exp $")
 
 /*---------------------------------------------------------------------------
 |   Facility      :  libnform  
@@ -62,11 +62,11 @@
 	{
 	  T((T_CREATE("fieldtype %p"), (void *)nftyp));
 	  *nftyp = *_nc_Default_FieldType;
-	  nftyp->status |= _LINKED_TYPE;
+	  SetStatus(nftyp, _LINKED_TYPE);
 	  if ((type1->status & _HAS_ARGS) || (type2->status & _HAS_ARGS))
-	    nftyp->status |= _HAS_ARGS;
+	    SetStatus(nftyp, _HAS_ARGS);
 	  if ((type1->status & _HAS_CHOICE) || (type2->status & _HAS_CHOICE))
-	    nftyp->status |= _HAS_CHOICE;
+	    SetStatus(nftyp, _HAS_CHOICE);
 	  nftyp->left = type1;
 	  nftyp->right = type2;
 	  type1->ref++;
Index: form/fld_just.c
Prereq:  1.12 
--- ncurses-5.9/form/fld_just.c	2010-01-23 21:14:35.000000000 +0000
+++ ncurses-5.9-20130504/form/fld_just.c	2012-03-11 00:37:16.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2004,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -32,7 +32,7 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: fld_just.c,v 1.12 2010/01/23 21:14:35 tom Exp $")
+MODULE_ID("$Id: fld_just.c,v 1.13 2012/03/11 00:37:16 tom Exp $")
 
 /*---------------------------------------------------------------------------
 |   Facility      :  libnform  
@@ -59,7 +59,7 @@
       Normalize_Field(field);
       if (field->just != just)
 	{
-	  field->just = just;
+	  field->just = (short) just;
 	  res = _nc_Synchronize_Attributes(field);
 	}
       else
Index: form/fld_link.c
Prereq:  1.12 
--- ncurses-5.9/form/fld_link.c	2010-01-23 21:14:35.000000000 +0000
+++ ncurses-5.9-20130504/form/fld_link.c	2012-03-11 00:37:16.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2007,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -32,7 +32,7 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: fld_link.c,v 1.12 2010/01/23 21:14:35 tom Exp $")
+MODULE_ID("$Id: fld_link.c,v 1.13 2012/03/11 00:37:16 tom Exp $")
 
 /*---------------------------------------------------------------------------
 |   Facility      :  libnform  
@@ -61,8 +61,8 @@
     {
       T((T_CREATE("field %p"), (void *)New_Field));
       *New_Field = *_nc_Default_Field;
-      New_Field->frow = frow;
-      New_Field->fcol = fcol;
+      New_Field->frow = (short) frow;
+      New_Field->fcol = (short) fcol;
 
       New_Field->link = field->link;
       field->link = New_Field;
Index: form/fld_max.c
Prereq:  1.10 
--- ncurses-5.9/form/fld_max.c	2010-01-23 21:14:36.000000000 +0000
+++ ncurses-5.9-20130504/form/fld_max.c	2012-06-10 00:21:24.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2004,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -32,7 +32,7 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: fld_max.c,v 1.10 2010/01/23 21:14:36 tom Exp $")
+MODULE_ID("$Id: fld_max.c,v 1.12 2012/06/10 00:21:24 tom Exp $")
 
 /*---------------------------------------------------------------------------
 |   Facility      :  libnform  
@@ -62,13 +62,13 @@
 	    RETURN(E_BAD_ARGUMENT);
 	}
       field->maxgrow = maxgrow;
-      field->status &= ~_MAY_GROW;
+      ClrStatus(field, _MAY_GROW);
       if (!(field->opts & O_STATIC))
 	{
 	  if ((maxgrow == 0) ||
 	      (single_line_field && (field->dcols < maxgrow)) ||
 	      (!single_line_field && (field->drows < maxgrow)))
-	    field->status |= _MAY_GROW;
+	    SetStatus(field, _MAY_GROW);
 	}
     }
   RETURN(E_OK);
Index: form/fld_move.c
Prereq:  1.10 
--- ncurses-5.9/form/fld_move.c	2010-01-23 21:14:36.000000000 +0000
+++ ncurses-5.9-20130504/form/fld_move.c	2012-03-11 00:37:16.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2004,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -32,7 +32,7 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: fld_move.c,v 1.10 2010/01/23 21:14:36 tom Exp $")
+MODULE_ID("$Id: fld_move.c,v 1.11 2012/03/11 00:37:16 tom Exp $")
 
 /*---------------------------------------------------------------------------
 |   Facility      :  libnform  
@@ -56,8 +56,8 @@
   if (field->form)
     RETURN(E_CONNECTED);
 
-  field->frow = frow;
-  field->fcol = fcol;
+  field->frow = (short) frow;
+  field->fcol = (short) fcol;
   RETURN(E_OK);
 }
 
Index: form/fld_page.c
Prereq:  1.10 
--- ncurses-5.9/form/fld_page.c	2010-01-23 21:14:36.000000000 +0000
+++ ncurses-5.9-20130504/form/fld_page.c	2012-06-10 00:12:47.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2004,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -32,7 +32,7 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: fld_page.c,v 1.10 2010/01/23 21:14:36 tom Exp $")
+MODULE_ID("$Id: fld_page.c,v 1.12 2012/06/10 00:12:47 tom Exp $")
 
 /*---------------------------------------------------------------------------
 |   Facility      :  libnform  
@@ -54,9 +54,9 @@
     RETURN(E_CONNECTED);
 
   if (new_page_flag)
-    field->status |= _NEWPAGE;
+    SetStatus(field, _NEWPAGE);
   else
-    field->status &= ~_NEWPAGE;
+    ClrStatus(field, _NEWPAGE);
 
   RETURN(E_OK);
 }
Index: form/fld_stat.c
Prereq:  1.12 
--- ncurses-5.9/form/fld_stat.c	2010-01-23 21:14:36.000000000 +0000
+++ ncurses-5.9-20130504/form/fld_stat.c	2012-06-10 00:13:09.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2004,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -32,7 +32,7 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: fld_stat.c,v 1.12 2010/01/23 21:14:36 tom Exp $")
+MODULE_ID("$Id: fld_stat.c,v 1.14 2012/06/10 00:13:09 tom Exp $")
 
 /*---------------------------------------------------------------------------
 |   Facility      :  libnform  
@@ -51,9 +51,9 @@
   Normalize_Field(field);
 
   if (status)
-    field->status |= _CHANGED;
+    SetStatus(field, _CHANGED);
   else
-    field->status &= ~_CHANGED;
+    ClrStatus(field, _CHANGED);
 
   RETURN(E_OK);
 }
Index: form/form.priv.h
Prereq:  0.32 
--- ncurses-5.9/form/form.priv.h	2009-11-07 21:26:43.000000000 +0000
+++ ncurses-5.9-20130504/form/form.priv.h	2012-03-11 00:37:46.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2008,2009 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2009,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -30,11 +30,11 @@
  *   Author:  Juergen Pfeifer, 1995,1997                                    *
  ****************************************************************************/
 
-/* $Id: form.priv.h,v 0.32 2009/11/07 21:26:43 tom Exp $ */
+/* $Id: form.priv.h,v 0.33 2012/03/11 00:37:46 tom Exp $ */
 
 #ifndef FORM_PRIV_H
 #define FORM_PRIV_H 1
-
+/* *INDENT-OFF*/
 #include "curses.priv.h"
 #include "mf_common.h"
 
@@ -119,7 +119,7 @@
 
 /* Calculate the total size of all buffers for this field */
 #define Total_Buffer_Size(field) \
-   ( (Buffer_Length(field) + 1) * (1+(field)->nbuf) * sizeof(FIELD_CELL) )
+   ( (size_t)(Buffer_Length(field) + 1) * (size_t)(1+(field)->nbuf) * sizeof(FIELD_CELL) )
 
 /* Logic to determine whether or not a field is single lined */
 #define Single_Line_Field(field) \
@@ -293,5 +293,6 @@
       result = ((*buffer || (l < width)) ? FALSE : TRUE); \
     }
 #endif
+/* *INDENT-ON*/
 
 #endif /* FORM_PRIV_H */
Index: form/frm_def.c
Prereq:  1.25 
--- ncurses-5.9/form/frm_def.c	2010-01-23 21:14:36.000000000 +0000
+++ ncurses-5.9-20130504/form/frm_def.c	2012-03-11 00:37:16.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -32,7 +32,7 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: frm_def.c,v 1.25 2010/01/23 21:14:36 tom Exp $")
+MODULE_ID("$Id: frm_def.c,v 1.26 2012/03/11 00:37:16 tom Exp $")
 
 /* this can't be readonly */
 static FORM default_form =
@@ -199,14 +199,14 @@
   for (j = 0; j < field_cnt; j++)
     {
       if (j == 0)
-	pg->pmin = j;
+	pg->pmin = (short) j;
       else
 	{
 	  if (fields[j]->status & _NEWPAGE)
 	    {
-	      pg->pmax = j - 1;
+	      pg->pmax = (short) (j - 1);
 	      pg++;
-	      pg->pmin = j;
+	      pg->pmin = (short) j;
 	    }
 	}
 
@@ -214,14 +214,14 @@
       maximum_col_in_field = fields[j]->fcol + fields[j]->cols;
 
       if (form->rows < maximum_row_in_field)
-	form->rows = maximum_row_in_field;
+	form->rows = (short) maximum_row_in_field;
       if (form->cols < maximum_col_in_field)
-	form->cols = maximum_col_in_field;
+	form->cols = (short) maximum_col_in_field;
     }
 
-  pg->pmax = field_cnt - 1;
-  form->maxfield = field_cnt;
-  form->maxpage = page_nr;
+  pg->pmax = (short) (field_cnt - 1);
+  form->maxfield = (short) field_cnt;
+  form->maxpage = (short) page_nr;
 
   /* Sort fields on form pages */
   for (page_nr = 0; page_nr < form->maxpage; page_nr++)
@@ -230,8 +230,8 @@
 
       for (j = form->page[page_nr].pmin; j <= form->page[page_nr].pmax; j++)
 	{
-	  fields[j]->index = j;
-	  fields[j]->page = page_nr;
+	  fields[j]->index = (short) j;
+	  fields[j]->page = (short) page_nr;
 	  fld = Insert_Field_By_Position(fields[j], fld);
 	}
       if (fld)
Index: form/frm_driver.c
Prereq:  1.98 
--- ncurses-5.9/form/frm_driver.c	2010-05-01 21:11:43.000000000 +0000
+++ ncurses-5.9-20130504/form/frm_driver.c	2013-03-09 22:48:47.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -32,7 +32,7 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: frm_driver.c,v 1.98 2010/05/01 21:11:43 tom Exp $")
+MODULE_ID("$Id: frm_driver.c,v 1.103 2013/03/09 22:48:47 tom Exp $")
 
 /*----------------------------------------------------------------------------
   This is the core module of the form library. It contains the majority
@@ -172,7 +172,7 @@
    instead of a derived window because it contains invisible parts.
    This is true for non-public fields and for scrollable fields. */
 #define Has_Invisible_Parts(field)     \
-  (!((field)->opts & O_PUBLIC)      || \
+  (!((unsigned)(field)->opts & O_PUBLIC) || \
    Is_Scroll_Field(field))
 
 /* Logic to decide whether or not a field needs justification */
@@ -180,7 +180,7 @@
    (((field)->just != NO_JUSTIFICATION)  && \
     (Single_Line_Field(field))           && \
     (((field)->dcols == (field)->cols)   && \
-    ((field)->opts & O_STATIC))             )
+    ((unsigned)(field)->opts & O_STATIC)))
 
 /* Logic to determine whether or not a dynamic field may still grow */
 #define Growable(field) ((field)->status & _MAY_GROW)
@@ -188,13 +188,13 @@
 /* Macro to set the attributes for a fields window */
 #define Set_Field_Window_Attributes(field,win) \
 (  wbkgdset((win),(chtype)((field)->pad | (field)->back)), \
-   (void) wattrset((win),(field)->fore) )
+   (void) wattrset((win), (int)(field)->fore) )
 
 /* Logic to decide whether or not a field really appears on the form */
 #define Field_Really_Appears(field)         \
   ((field->form)                          &&\
    (field->form->status & _POSTED)        &&\
-   (field->opts & O_VISIBLE)              &&\
+   ((unsigned)field->opts & O_VISIBLE)    &&\
    (field->page == field->form->curpage))
 
 /* Logic to determine whether or not we are on the first position in the
@@ -601,8 +601,8 @@
 {
   if (form->status & _WINDOW_MODIFIED)
     {
-      form->status &= ~_WINDOW_MODIFIED;
-      form->status |= _FCHECK_REQUIRED;
+      ClrStatus(form, _WINDOW_MODIFIED);
+      SetStatus(form, _FCHECK_REQUIRED);
       Window_To_Buffer(form, form->current);
       wmove(form->w, form->currow, form->curcol);
     }
@@ -653,7 +653,7 @@
 	    growth = Minimum(field->maxgrow - field->dcols, growth);
 	  field->dcols += growth;
 	  if (field->dcols == field->maxgrow)
-	    field->status &= ~_MAY_GROW;
+	    ClrStatus(field, _MAY_GROW);
 	}
       else
 	{
@@ -662,7 +662,7 @@
 	    growth = Minimum(field->maxgrow - field->drows, growth);
 	  field->drows += growth;
 	  if (field->drows == field->maxgrow)
-	    field->status &= ~_MAY_GROW;
+	    ClrStatus(field, _MAY_GROW);
 	}
       /* drows, dcols changed, so we get really the new buffer length */
       new_buflen = Buffer_Length(field);
@@ -674,7 +674,7 @@
 	  field->drows = old_drows;
 	  if ((single_line_field && (field->dcols != field->maxgrow)) ||
 	      (!single_line_field && (field->drows != field->maxgrow)))
-	    field->status |= _MAY_GROW;
+	    SetStatus(field, _MAY_GROW);
 	}
       else
 	{
@@ -753,7 +753,7 @@
 		   (field->dcols != field->maxgrow)) ||
 		  (!single_line_field &&
 		   (field->drows != field->maxgrow)))
-		field->status |= _MAY_GROW;
+		SetStatus(field, _MAY_GROW);
 	      free(newbuf);
 	    }
 	}
@@ -860,7 +860,7 @@
   field = form->current;
   formwin = Get_Form_Window(form);
 
-  if (field->opts & O_PUBLIC)
+  if ((unsigned)field->opts & O_PUBLIC)
     {
       if (Is_Scroll_Field(field))
 	{
@@ -897,19 +897,19 @@
 		  if (form->currow < form->toprow)
 		    {
 		      form->toprow = form->currow;
-		      field->status |= _NEWTOP;
+		      SetStatus(field, _NEWTOP);
 		    }
 		  if (form->currow >= row_after_bottom)
 		    {
 		      form->toprow = form->currow - field->rows + 1;
-		      field->status |= _NEWTOP;
+		      SetStatus(field, _NEWTOP);
 		    }
 		  if (field->status & _NEWTOP)
 		    {
 		      /* means we have to copy whole range */
 		      first_modified_row = form->toprow;
 		      first_unmodified_row = first_modified_row + field->rows;
-		      field->status &= ~_NEWTOP;
+		      ClrStatus(field, _NEWTOP);
 		    }
 		  else
 		    {
@@ -1111,27 +1111,27 @@
     return E_SYSTEM_ERROR;
   else
     {
-      if (field->opts & O_VISIBLE)
+      if ((unsigned)field->opts & O_VISIBLE)
 	{
 	  Set_Field_Window_Attributes(field, win);
 	}
       else
 	{
-	  (void)wattrset(win, WINDOW_ATTRS(fwin));
+	  (void)wattrset(win, (int)WINDOW_ATTRS(fwin));
 	}
       werase(win);
     }
 
   if (!bEraseFlag)
     {
-      if (field->opts & O_PUBLIC)
+      if ((unsigned)field->opts & O_PUBLIC)
 	{
 	  if (Justification_Allowed(field))
 	    Perform_Justification(field, win);
 	  else
 	    Buffer_To_Window(field, win);
 	}
-      field->status &= ~_NEWTOP;
+      ClrStatus(field, _NEWTOP);
     }
   wsyncup(win);
   delwin(win);
@@ -1170,18 +1170,18 @@
 	  form->currow = form->curcol = form->toprow = form->begincol = 0;
 	  werase(form->w);
 
-	  if ((field->opts & O_PUBLIC) && Justification_Allowed(field))
+	  if (((unsigned)field->opts & O_PUBLIC) && Justification_Allowed(field))
 	    Undo_Justification(field, form->w);
 	  else
 	    Buffer_To_Window(field, form->w);
 
-	  field->status |= _NEWTOP;
+	  SetStatus(field, _NEWTOP);
 	  res = _nc_Refresh_Current_Field(form);
 	}
       else
 	res = Display_Field(field);
     }
-  field->status |= _CHANGED;
+  SetStatus(field, _CHANGED);
   return (res);
 }
 
@@ -1211,7 +1211,7 @@
     return (E_SYSTEM_ERROR);
 
   for (linked_field = field->link;
-       linked_field != field;
+       (linked_field != field) && (linked_field != 0);
        linked_field = linked_field->link)
     {
       if (((syncres = Synchronize_Field(linked_field)) != E_OK) &&
@@ -1256,7 +1256,7 @@
 	  werase(form->w);
 	  wmove(form->w, form->currow, form->curcol);
 
-	  if (field->opts & O_PUBLIC)
+	  if ((unsigned)field->opts & O_PUBLIC)
 	    {
 	      if (Justification_Allowed(field))
 		Undo_Justification(field, form->w);
@@ -1272,7 +1272,7 @@
 		      field->rows - 1, field->cols - 1, 0);
 	      wsyncup(formwin);
 	      Buffer_To_Window(field, form->w);
-	      field->status |= _NEWTOP;		/* fake refresh to paint all */
+	      SetStatus(field, _NEWTOP);	/* fake refresh to paint all */
 	      _nc_Refresh_Current_Field(form);
 	    }
 	}
@@ -1326,34 +1326,34 @@
 	      field->opts = oldopts;
 	      returnCode(E_CURRENT);
 	    }
-	  if ((form->curpage == field->page))
+	  if (form->curpage == field->page)
 	    {
-	      if (changed_opts & O_VISIBLE)
+	      if ((unsigned)changed_opts & O_VISIBLE)
 		{
-		  if (newopts & O_VISIBLE)
+		  if ((unsigned)newopts & O_VISIBLE)
 		    res = Display_Field(field);
 		  else
 		    res = Erase_Field(field);
 		}
 	      else
 		{
-		  if ((changed_opts & O_PUBLIC) &&
-		      (newopts & O_VISIBLE))
+		  if (((unsigned)changed_opts & O_PUBLIC) &&
+		      ((unsigned)newopts & O_VISIBLE))
 		    res = Display_Field(field);
 		}
 	    }
 	}
     }
 
-  if (changed_opts & O_STATIC)
+  if ((unsigned)changed_opts & O_STATIC)
     {
       bool single_line_field = Single_Line_Field(field);
       int res2 = E_OK;
 
-      if (newopts & O_STATIC)
+      if ((unsigned)newopts & O_STATIC)
 	{
 	  /* the field becomes now static */
-	  field->status &= ~_MAY_GROW;
+	  ClrStatus(field, _MAY_GROW);
 	  /* if actually we have no hidden columns, justification may
 	     occur again */
 	  if (single_line_field &&
@@ -1371,7 +1371,7 @@
 	      (single_line_field && (field->dcols < field->maxgrow)) ||
 	      (!single_line_field && (field->drows < field->maxgrow)))
 	    {
-	      field->status |= _MAY_GROW;
+	      SetStatus(field, _MAY_GROW);
 	      /* a field with justification now changes its behavior,
 	         so we must redisplay it */
 	      if (single_line_field &&
@@ -1424,18 +1424,18 @@
       !(form->status & _POSTED))
     {
       if ((form->w) &&
-	  (field->opts & O_VISIBLE) &&
+	  ((unsigned)field->opts & O_VISIBLE) &&
 	  (field->form->curpage == field->page))
 	{
 	  _nc_Refresh_Current_Field(form);
-	  if (field->opts & O_PUBLIC)
+	  if ((unsigned)field->opts & O_PUBLIC)
 	    {
 	      if (field->drows > field->rows)
 		{
 		  if (form->toprow == 0)
-		    field->status &= ~_NEWTOP;
+		    ClrStatus(field, _NEWTOP);
 		  else
-		    field->status |= _NEWTOP;
+		    SetStatus(field, _NEWTOP);
 		}
 	      else
 		{
@@ -1469,7 +1469,7 @@
 	delwin(form->w);
       form->w = new_window;
 
-      form->status &= ~_WINDOW_MODIFIED;
+      ClrStatus(form, _WINDOW_MODIFIED);
       Set_Field_Window_Attributes(field, form->w);
 
       if (Has_Invisible_Parts(field))
@@ -1998,7 +1998,7 @@
     {
       res = fct(form);
       if (res == E_OK)
-	form->current->status |= _NEWTOP;
+	SetStatus(form, _NEWTOP);
     }
   return (res);
 }
@@ -2430,7 +2430,7 @@
   int result = E_REQUEST_DENIED;
   bool Last_Row = ((field->drows - 1) == form->currow);
 
-  if ((field->opts & O_WRAP) &&	/* wrapping wanted     */
+  if (((unsigned)field->opts & O_WRAP) &&	/* wrapping wanted     */
       (!Single_Line_Field(field)) &&	/* must be multi-line  */
       (There_Is_No_Room_For_A_Char_In_Line(form)) &&	/* line is full        */
       (!Last_Row || Growable(field)))	/* there are more lines */
@@ -2513,7 +2513,7 @@
      editable fields.
    */
   if ((fct == FE_Delete_Previous) &&
-      (form->opts & O_BS_OVERLOAD) &&
+      ((unsigned)form->opts & O_BS_OVERLOAD) &&
       First_Position_In_Current_Field(form))
     {
       res = Inter_Field_Navigation(FN_Previous_Field, form);
@@ -2522,7 +2522,7 @@
     {
       if (fct == FE_New_Line)
 	{
-	  if ((form->opts & O_NL_OVERLOAD) &&
+	  if (((unsigned)form->opts & O_NL_OVERLOAD) &&
 	      First_Position_In_Current_Field(form))
 	    {
 	      res = Inter_Field_Navigation(FN_Next_Field, form);
@@ -2534,11 +2534,11 @@
       else
 	{
 	  /* From now on, everything must be editable */
-	  if (form->current->opts & O_EDIT)
+	  if ((unsigned)form->current->opts & O_EDIT)
 	    {
 	      res = fct(form);
 	      if (res == E_OK)
-		form->status |= _WINDOW_MODIFIED;
+		SetStatus(form, _WINDOW_MODIFIED);
 	    }
 	}
     }
@@ -2571,7 +2571,7 @@
       if (Last_Row &&
 	  (!(Growable(field) && !Single_Line_Field(field))))
 	{
-	  if (!(form->opts & O_NL_OVERLOAD))
+	  if (!((unsigned)form->opts & O_NL_OVERLOAD))
 	    returnCode(E_REQUEST_DENIED);
 	  wmove(form->w, form->currow, form->curcol);
 	  wclrtoeol(form->w);
@@ -2579,7 +2579,7 @@
 	     handled in the generic routine. The reason is,
 	     that FN_Next_Field may fail, but the form is
 	     definitively changed */
-	  form->status |= _WINDOW_MODIFIED;
+	  SetStatus(form, _WINDOW_MODIFIED);
 	  returnCode(Inter_Field_Navigation(FN_Next_Field, form));
 	}
       else
@@ -2595,7 +2595,7 @@
 	  wclrtoeol(form->w);
 	  form->currow++;
 	  form->curcol = 0;
-	  form->status |= _WINDOW_MODIFIED;
+	  SetStatus(form, _WINDOW_MODIFIED);
 	  returnCode(E_OK);
 	}
     }
@@ -2605,7 +2605,7 @@
       if (Last_Row &&
 	  !(Growable(field) && !Single_Line_Field(field)))
 	{
-	  if (!(form->opts & O_NL_OVERLOAD))
+	  if (!((unsigned)form->opts & O_NL_OVERLOAD))
 	    returnCode(E_REQUEST_DENIED);
 	  returnCode(Inter_Field_Navigation(FN_Next_Field, form));
 	}
@@ -2627,7 +2627,7 @@
 	  wmove(form->w, form->currow, form->curcol);
 	  winsertln(form->w);
 	  myADDNSTR(form->w, bp, (int)(t - bp));
-	  form->status |= _WINDOW_MODIFIED;
+	  SetStatus(form, _WINDOW_MODIFIED);
 	  returnCode(E_OK);
 	}
     }
@@ -2926,7 +2926,7 @@
 EM_Overlay_Mode(FORM *form)
 {
   T((T_CALLED("EM_Overlay_Mode(%p)"), (void *)form));
-  form->status |= _OVLMODE;
+  SetStatus(form, _OVLMODE);
   returnCode(E_OK);
 }
 
@@ -2942,7 +2942,7 @@
 EM_Insert_Mode(FORM *form)
 {
   T((T_CALLED("EM_Insert_Mode(%p)"), (void *)form));
-  form->status &= ~_OVLMODE;
+  ClrStatus(form, _OVLMODE);
   returnCode(E_OK);
 }
 
@@ -3111,7 +3111,7 @@
 {
   if (typ)
     {
-      if (field->opts & O_NULLOK)
+      if ((unsigned)field->opts & O_NULLOK)
 	{
 	  FIELD_CELL *bp = field->buf;
 
@@ -3168,12 +3168,12 @@
 
   Synchronize_Buffer(form);
   if ((form->status & _FCHECK_REQUIRED) ||
-      (!(field->opts & O_PASSOK)))
+      (!((unsigned)field->opts & O_PASSOK)))
     {
       if (!Check_Field(form, field->type, field, (TypeArgument *)(field->arg)))
 	return FALSE;
-      form->status &= ~_FCHECK_REQUIRED;
-      field->status |= _CHANGED;
+      ClrStatus(form, _FCHECK_REQUIRED);
+      SetStatus(field, _CHANGED);
       Synchronize_Linked_Fields(field);
     }
   return TRUE;
@@ -3273,14 +3273,15 @@
 	  do
 	    {
 	      field = (field == last_on_page) ? first : field + 1;
-	      if (((*field)->opts & O_VISIBLE))
+	      if (((unsigned)(*field)->opts & O_VISIBLE))
 		break;
 	    }
 	  while (proposed != (*field));
 
 	  proposed = *field;
 
-	  if ((proposed == *last_on_page) && !(proposed->opts & O_VISIBLE))
+	  if ((proposed == *last_on_page) &&
+	      !((unsigned)proposed->opts & O_VISIBLE))
 	    {
 	      /* This means, there is also no visible field on the page.
 	         So we propose the first one and hope the very best...
@@ -3816,11 +3817,11 @@
       FIELD *last_field, *field_on_page;
 
       werase(Get_Form_Window(form));
-      form->curpage = page;
+      form->curpage = (short)page;
       last_field = field_on_page = form->field[form->page[page].smin];
       do
 	{
-	  if (field_on_page->opts & O_VISIBLE)
+	  if ((unsigned)field_on_page->opts & O_VISIBLE)
 	    if ((res = Display_Field(field_on_page)) != E_OK)
 	      return (res);
 	  field_on_page = field_on_page->snext;
@@ -3999,13 +4000,13 @@
   int result = E_REQUEST_DENIED;
 
   T((T_CALLED("Data_Entry(%p,%s)"), (void *)form, _tracechtype((chtype)c)));
-  if ((field->opts & O_EDIT)
+  if (((unsigned)field->opts & O_EDIT)
 #if FIX_FORM_INACTIVE_BUG
-      && (field->opts & O_ACTIVE)
+      && ((unsigned)field->opts & O_ACTIVE)
 #endif
     )
     {
-      if ((field->opts & O_BLANK) &&
+      if (((unsigned)field->opts & O_BLANK) &&
 	  First_Position_In_Current_Field(form) &&
 	  !(form->status & _FCHECK_REQUIRED) &&
 	  !(form->status & _WINDOW_MODIFIED))
@@ -4035,8 +4036,8 @@
 	  bool End_Of_Field = (((field->drows - 1) == form->currow) &&
 			       ((field->dcols - 1) == form->curcol));
 
-	  form->status |= _WINDOW_MODIFIED;
-	  if (End_Of_Field && !Growable(field) && (field->opts & O_AUTOSKIP))
+	  SetStatus(form, _WINDOW_MODIFIED);
+	  if (End_Of_Field && !Growable(field) && ((unsigned)field->opts & O_AUTOSKIP))
 	    result = Inter_Field_Navigation(FN_Next_Field, form);
 	  else
 	    {
@@ -4228,7 +4229,10 @@
 
   if ((c >= MIN_FORM_COMMAND && c <= MAX_FORM_COMMAND) &&
       ((bindings[c - MIN_FORM_COMMAND].keycode & Key_Mask) == c))
-    BI = &(bindings[c - MIN_FORM_COMMAND]);
+    {
+      TR(TRACE_CALLS, ("form_request %s", form_request_name(c)));
+      BI = &(bindings[c - MIN_FORM_COMMAND]);
+    }
 
   if (BI)
     {
@@ -4246,7 +4250,7 @@
 	NULL			/* Choice Request is generic           */
       };
       size_t nMethods = (sizeof(Generic_Methods) / sizeof(Generic_Methods[0]));
-      size_t method = (BI->keycode >> ID_Shft) & 0xffff;	/* see ID_Mask */
+      size_t method = (size_t) ((BI->keycode >> ID_Shft) & 0xffff);	/* see ID_Mask */
 
       if ((method >= nMethods) || !(BI->cmd))
 	res = E_SYSTEM_ERROR;
@@ -4255,9 +4259,13 @@
 	  Generic_Method fct = Generic_Methods[method];
 
 	  if (fct)
-	    res = fct(BI->cmd, form);
+	    {
+	      res = fct(BI->cmd, form);
+	    }
 	  else
-	    res = (BI->cmd) (form);
+	    {
+	      res = (BI->cmd) (form);
+	    }
 	}
     }
 #ifdef NCURSES_MOUSE_VERSION
@@ -4401,14 +4409,14 @@
   if (!field || !value || ((buffer < 0) || (buffer > field->nbuf)))
     RETURN(E_BAD_ARGUMENT);
 
-  len = Buffer_Length(field);
+  len = (unsigned)Buffer_Length(field);
 
   if (Growable(field))
     {
       /* for a growable field we must assume zero terminated strings, because
          somehow we have to detect the length of what should be copied.
        */
-      unsigned int vlen = strlen(value);
+      unsigned vlen = (unsigned)strlen(value);
 
       if (vlen > len)
 	{
@@ -4438,7 +4446,7 @@
       delwin(field->working);
       field->working = newpad(1, Buffer_Length(field) + 1);
     }
-  len = Buffer_Length(field);
+  len = (unsigned)Buffer_Length(field);
   wclear(field->working);
   (void)mvwaddstr(field->working, 0, 0, value);
 
@@ -4450,8 +4458,8 @@
     {
       for (i = 0; i < (unsigned)field->drows; ++i)
 	{
-	  (void)mvwin_wchnstr(field->working, 0, i * field->dcols,
-			      widevalue + (i * field->dcols),
+	  (void)mvwin_wchnstr(field->working, 0, (int)i * field->dcols,
+			      widevalue + ((int)i * field->dcols),
 			      field->dcols);
 	}
       for (i = 0; i < len; ++i)
@@ -4512,7 +4520,7 @@
     {
 #if USE_WIDEC_SUPPORT
       FIELD_CELL *data = Address_Of_Nth_Buffer(field, buffer);
-      unsigned need = 0;
+      size_t need = 0;
       int size = Buffer_Length(field);
       int n;
 
@@ -4613,7 +4621,7 @@
 		{
 		  result[need] = wch;
 		}
-	      passed += status;
+	      passed += (size_t) status;
 	      ++need;
 	    }
 	  else
@@ -4633,7 +4641,7 @@
 	    break;
 	  result = typeCalloc(wchar_t, need);
 
-	  *lengthp = need;
+	  *lengthp = (int)need;
 	  if (result == 0)
 	    break;
 	}
Index: form/frm_hook.c
Prereq:  1.15 
--- ncurses-5.9/form/frm_hook.c	2010-01-23 21:12:08.000000000 +0000
+++ ncurses-5.9-20130504/form/frm_hook.c	2012-03-11 00:37:16.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2004,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -32,13 +32,13 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: frm_hook.c,v 1.15 2010/01/23 21:12:08 tom Exp $")
+MODULE_ID("$Id: frm_hook.c,v 1.16 2012/03/11 00:37:16 tom Exp $")
 
 /* "Template" macro to generate function to set application specific hook */
 #define GEN_HOOK_SET_FUNCTION( typ, name ) \
 NCURSES_IMPEXP int NCURSES_API set_ ## typ ## _ ## name (FORM *form, Form_Hook func)\
 {\
-   T((T_CALLED("set_" #typ"_"#name"(%p,%p)"), form, func));\
+   T((T_CALLED("set_" #typ"_"#name"(%p,%p)"), (void *) form, func));\
    (Normalize_Form( form ) -> typ ## name) = func ;\
    RETURN(E_OK);\
 }
Index: form/frm_opts.c
Prereq:  1.15 
--- ncurses-5.9/form/frm_opts.c	2010-01-23 21:14:36.000000000 +0000
+++ ncurses-5.9-20130504/form/frm_opts.c	2012-06-09 20:29:33.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2005,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -32,7 +32,7 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: frm_opts.c,v 1.15 2010/01/23 21:14:36 tom Exp $")
+MODULE_ID("$Id: frm_opts.c,v 1.16 2012/06/09 20:29:33 tom Exp $")
 
 /*---------------------------------------------------------------------------
 |   Facility      :  libnform  
@@ -49,7 +49,7 @@
 {
   T((T_CALLED("set_form_opts(%p,%d)"), (void *)form, opts));
 
-  opts &= ALL_FORM_OPTS;
+  opts &= (Form_Options) ALL_FORM_OPTS;
   if (opts & ~ALL_FORM_OPTS)
     RETURN(E_BAD_ARGUMENT);
   else
@@ -89,7 +89,7 @@
 {
   T((T_CALLED("form_opts_on(%p,%d)"), (void *)form, opts));
 
-  opts &= ALL_FORM_OPTS;
+  opts &= (Form_Options) ALL_FORM_OPTS;
   if (opts & ~ALL_FORM_OPTS)
     RETURN(E_BAD_ARGUMENT);
   else
@@ -114,7 +114,7 @@
 {
   T((T_CALLED("form_opts_off(%p,%d)"), (void *)form, opts));
 
-  opts &= ALL_FORM_OPTS;
+  opts &= (Form_Options) ALL_FORM_OPTS;
   if (opts & ~ALL_FORM_OPTS)
     RETURN(E_BAD_ARGUMENT);
   else
Index: form/frm_page.c
Prereq:  1.11 
--- ncurses-5.9/form/frm_page.c	2010-01-23 21:14:36.000000000 +0000
+++ ncurses-5.9-20130504/form/frm_page.c	2012-06-10 00:28:04.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2004,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -32,7 +32,7 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: frm_page.c,v 1.11 2010/01/23 21:14:36 tom Exp $")
+MODULE_ID("$Id: frm_page.c,v 1.12 2012/06/10 00:28:04 tom Exp $")
 
 /*---------------------------------------------------------------------------
 |   Facility      :  libnform  
@@ -58,7 +58,7 @@
 
   if (!(form->status & _POSTED))
     {
-      form->curpage = page;
+      form->curpage = (short)page;
       form->current = _nc_First_Active_Field(form);
     }
   else
Index: form/frm_post.c
Prereq:  1.10 
--- ncurses-5.9/form/frm_post.c	2010-01-23 21:14:36.000000000 +0000
+++ ncurses-5.9-20130504/form/frm_post.c	2012-06-10 00:27:49.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2004,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -32,7 +32,7 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: frm_post.c,v 1.10 2010/01/23 21:14:36 tom Exp $")
+MODULE_ID("$Id: frm_post.c,v 1.11 2012/06/10 00:27:49 tom Exp $")
 
 /*---------------------------------------------------------------------------
 |   Facility      :  libnform  
@@ -77,7 +77,7 @@
   if ((err = _nc_Set_Form_Page(form, page, form->current)) != E_OK)
     RETURN(err);
 
-  form->status |= _POSTED;
+  SetStatus(form, _POSTED);
 
   Call_Hook(form, forminit);
   Call_Hook(form, fieldinit);
@@ -117,7 +117,7 @@
   werase(Get_Form_Window(form));
   delwin(form->w);
   form->w = (WINDOW *)0;
-  form->status &= ~_POSTED;
+  ClrStatus(form, _POSTED);
   RETURN(E_OK);
 }
 
Index: form/frm_req_name.c
Prereq:  1.17 
--- ncurses-5.9/form/frm_req_name.c	2009-10-10 16:17:01.000000000 +0000
+++ ncurses-5.9-20130504/form/frm_req_name.c	2012-07-21 23:17:23.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2008,2009 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2009,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -37,7 +37,7 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: frm_req_name.c,v 1.17 2009/10/10 16:17:01 tom Exp $")
+MODULE_ID("$Id: frm_req_name.c,v 1.18 2012/07/21 23:17:23 tom Exp $")
 
 static const char *request_names[MAX_FORM_COMMAND - MIN_FORM_COMMAND + 1] =
 {
@@ -144,23 +144,26 @@
   /* because the table is so small, it doesn't really hurt
      to run sequentially through it.
    */
-  unsigned int i = 0;
-  char buf[16];
+  size_t i = 0;
+  char buf[16];			/* longest name is 10 chars */
 
   T((T_CALLED("form_request_by_name(%s)"), _nc_visbuf(str)));
 
-  if (str)
+  if (str != 0 && (i = strlen(str)) != 0)
     {
-      strncpy(buf, str, sizeof(buf));
-      while ((i < sizeof(buf)) && (buf[i] != '\0'))
+      if (i > sizeof(buf) - 2)
+	i = sizeof(buf) - 2;
+      memcpy(buf, str, i);
+      buf[i] = '\0';
+
+      for (i = 0; buf[i] != '\0'; ++i)
 	{
 	  buf[i] = (char)toupper(UChar(buf[i]));
-	  i++;
 	}
 
       for (i = 0; i < A_SIZE; i++)
 	{
-	  if (strncmp(request_names[i], buf, sizeof(buf)) == 0)
+	  if (strcmp(request_names[i], buf) == 0)
 	    returnCode(MIN_FORM_COMMAND + (int)i);
 	}
     }
Index: form/fty_generic.c
Prereq:  1.5 
--- ncurses-5.9/form/fty_generic.c	2010-01-23 21:14:36.000000000 +0000
+++ ncurses-5.9-20130504/form/fty_generic.c	2012-06-10 00:27:49.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 2008-2009,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 2008-2010,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -34,7 +34,7 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: fty_generic.c,v 1.5 2010/01/23 21:14:36 tom Exp $")
+MODULE_ID("$Id: fty_generic.c,v 1.6 2012/06/10 00:27:49 tom Exp $")
 
 /*
  * This is not a full implementation of a field type, but adds some
@@ -119,7 +119,7 @@
       if (res)
 	{
 	  *res = *_nc_Default_FieldType;
-	  res->status |= (_HAS_ARGS | _GENERIC);
+	  SetStatus(res, (_HAS_ARGS | _GENERIC));
 	  res->fieldcheck.gfcheck = field_check;
 	  res->charcheck.gccheck = char_check;
 	  res->genericarg = Generic_This_Type;
Index: form/fty_int.c
Prereq:  1.25 
--- ncurses-5.9/form/fty_int.c	2010-01-23 21:14:36.000000000 +0000
+++ ncurses-5.9-20130504/form/fty_int.c	2012-02-23 10:02:15.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -34,7 +34,7 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: fty_int.c,v 1.25 2010/01/23 21:14:36 tom Exp $")
+MODULE_ID("$Id: fty_int.c,v 1.26 2012/02/23 10:02:15 tom Exp $")
 
 #if USE_WIDEC_SUPPORT
 #define isDigit(c) (iswdigit((wint_t)(c)) || isdigit(UChar(c)))
@@ -233,7 +233,8 @@
 	    }
 	  if (result)
 	    {
-	      sprintf(buf, "%.*ld", (prec > 0 ? prec : 0), val);
+	      _nc_SPRINTF(buf, _nc_SLIMIT(sizeof(buf))
+			  "%.*ld", (prec > 0 ? prec : 0), val);
 	      set_field_buffer(field, 0, buf);
 	    }
 	}
Index: form/fty_num.c
Prereq:  1.28 
--- ncurses-5.9/form/fty_num.c	2010-01-23 21:14:36.000000000 +0000
+++ ncurses-5.9-20130504/form/fty_num.c	2012-02-23 10:02:15.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -34,7 +34,7 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: fty_num.c,v 1.28 2010/01/23 21:14:36 tom Exp $")
+MODULE_ID("$Id: fty_num.c,v 1.29 2012/02/23 10:02:15 tom Exp $")
 
 #if HAVE_LOCALE_H
 #include <locale.h>
@@ -271,7 +271,8 @@
 	    }
 	  if (result)
 	    {
-	      sprintf(buf, "%.*f", (prec > 0 ? prec : 0), val);
+	      _nc_SPRINTF(buf, _nc_SLIMIT(sizeof(buf))
+			  "%.*f", (prec > 0 ? prec : 0), val);
 	      set_field_buffer(field, 0, buf);
 	    }
 	}
Index: form/fty_regex.c
Prereq:  1.24 
--- ncurses-5.9/form/fty_regex.c	2010-01-23 21:14:37.000000000 +0000
+++ ncurses-5.9-20130504/form/fty_regex.c	2012-10-27 20:12:53.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -34,7 +34,7 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: fty_regex.c,v 1.24 2010/01/23 21:14:37 tom Exp $")
+MODULE_ID("$Id: fty_regex.c,v 1.25 2012/10/27 20:12:53 tom Exp $")
 
 #if HAVE_REGEX_H_FUNCS		/* We prefer POSIX regex */
 #include <regex.h>
@@ -123,9 +123,8 @@
 			  (REG_EXTENDED | REG_NOSUB | REG_NEWLINE)))
 	    {
 	      T((T_CREATE("regex_t %p"), (void *)preg->pRegExp));
-	      preg->refCount = typeMalloc(unsigned long, 1);
-
-	      *(preg->refCount) = 1;
+	      if ((preg->refCount = typeMalloc(unsigned long, 1)) != 0)
+		 *(preg->refCount) = 1;
 	    }
 	  else
 	    {
@@ -151,9 +150,8 @@
 
 	  T((T_CREATE("RegExp_Arg %p"), pArg));
 	  pArg->compiled_expression = NULL;
-	  pArg->refCount = typeMalloc(unsigned long, 1);
-
-	  *(pArg->refCount) = 1;
+	  if ((pArg->refCount = typeMalloc(unsigned long, 1)) != 0)
+	     *(pArg->refCount) = 1;
 
 	  do
 	    {
Index: include/Caps
Prereq:  1.37 
--- ncurses-5.9/include/Caps	2010-12-04 18:47:13.000000000 +0000
+++ ncurses-5.9-20130504/include/Caps	2011-10-15 23:10:18.000000000 +0000
@@ -1,5 +1,5 @@
 ##############################################################################
-# Copyright (c) 1998-2006,2010 Free Software Foundation, Inc.                #
+# Copyright (c) 1998-2010,2011 Free Software Foundation, Inc.                #
 #                                                                            #
 # Permission is hereby granted, free of charge, to any person obtaining a    #
 # copy of this software and associated documentation files (the "Software"), #
@@ -29,7 +29,7 @@
 # Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995
 #    and: Eric S. Raymond <esr@snark.thyrsus.com>
 #
-# $Id: Caps,v 1.37 2010/12/04 18:47:13 tom Exp $
+# $Id: Caps,v 1.38 2011/10/15 23:10:18 tom Exp $
 #
 # This is the master termcap/terminfo capability table.
 #
@@ -738,11 +738,13 @@
 #%.ad
 #%
 #%.in .8i
-#%The XSI Curses standard added these.  They are some post-4.1 
-#%versions of System V curses, e.g., Solaris 2.5 and IRIX 6.x.
-#%The \fBncurses\fR termcap names for them are invented; according to the
-#%XSI Curses standard, they have no termcap names.  If your compiled terminfo
-#%entries use these, they may not be binary-compatible with System V terminfo
+#%The XSI Curses standard added these hardcopy capabilities.
+#%They were used in some post-4.1 versions of System V curses,
+#%e.g., Solaris 2.5 and IRIX 6.x.
+#%Except for \fBYI\fP, the \fBncurses\fR termcap names for them are invented.
+#%According to the XSI Curses standard, they have no termcap names.
+#%If your compiled terminfo entries use these,
+#%they may not be binary-compatible with System V terminfo
 #%entries after SVr4.1; beware!
 #%
 #%.na
@@ -760,7 +762,7 @@
 enter_top_hl_mode		ethlm	str	Xt	-		-	-----	Enter top highlight mode
 enter_vertical_hl_mode		evhlm	str	Xv	-		-	-----	Enter vertical highlight mode
 set_a_attributes		sgr1	str	sA	-		-	-----	Define second set of video attributes #1-#6
-set_pglen_inch			slength	str	sL	-		-	-----	YI Set page length to #1 hundredth of an inch
+set_pglen_inch			slength	str	YI	-		-	-----	Set page length to #1 hundredth of an inch (some implementations use sL for termcap).
 #%.TE
 #%.ad
 #
Index: include/Caps.aix4
Prereq:  1.8 
--- ncurses-5.9/include/Caps.aix4	2010-12-04 18:47:13.000000000 +0000
+++ ncurses-5.9-20130504/include/Caps.aix4	2011-10-15 23:19:16.000000000 +0000
@@ -1,5 +1,5 @@
 ##############################################################################
-# Copyright (c) 2001-2006,2010 Free Software Foundation, Inc.                #
+# Copyright (c) 2001-2010,2011 Free Software Foundation, Inc.                #
 #                                                                            #
 # Permission is hereby granted, free of charge, to any person obtaining a    #
 # copy of this software and associated documentation files (the "Software"), #
@@ -28,7 +28,7 @@
 #
 # Author: Thomas Dickey
 #
-# $Id: Caps.aix4,v 1.8 2010/12/04 18:47:13 tom Exp $
+# $Id: Caps.aix4,v 1.9 2011/10/15 23:19:16 tom Exp $
 #
 # This is an adaptation of ncurses' termcap/terminfo capability table, which
 # is designed to align with AIX 4.x's terminfo.
@@ -840,11 +840,13 @@
 #%.ad
 #%
 #%.in .8i
-#%The XSI Curses standard added these.  They are some post-4.1 
-#%versions of System V curses, e.g., Solaris 2.5 and IRIX 6.x.
-#%The \fBncurses\fR termcap names for them are invented; according to the
-#%XSI Curses standard, they have no termcap names.  If your compiled terminfo
-#%entries use these, they may not be binary-compatible with System V terminfo
+#%The XSI Curses standard added these hardcopy capabilities.
+#%They were used in some post-4.1 versions of System V curses,
+#%e.g., Solaris 2.5 and IRIX 6.x.
+#%Except for \fBYI\fP, the \fBncurses\fR termcap names for them are invented.
+#%According to the XSI Curses standard, they have no termcap names.
+#%If your compiled terminfo entries use these,
+#%they may not be binary-compatible with System V terminfo
 #%entries after SVr4.1; beware!
 #%
 #%.na
@@ -862,7 +864,7 @@
 enter_top_hl_mode		ethlm	str	Xt	-		-	-----	Enter top highlight mode
 enter_vertical_hl_mode		evhlm	str	Xv	-		-	-----	Enter vertical highlight mode
 set_a_attributes		sgr1	str	sA	-		-	-----	Define second set of video attributes #1-#6
-set_pglen_inch			slength	str	sL	-		-	-----	YI Set page length to #1 hundredth of an inch
+set_pglen_inch			slength	str	YI	-		-	-----	Set page length to #1 hundredth of an inch (some implementations use sL for termcap).
 #%.TE
 #%.ad
 #
Index: include/Caps.hpux11
Prereq:  1.5 
--- ncurses-5.9/include/Caps.hpux11	2010-12-04 18:47:13.000000000 +0000
+++ ncurses-5.9-20130504/include/Caps.hpux11	2011-10-15 23:20:04.000000000 +0000
@@ -1,5 +1,5 @@
 ##############################################################################
-# Copyright (c) 2002-2006,2010 Free Software Foundation, Inc.                #
+# Copyright (c) 2002-2010,2011 Free Software Foundation, Inc.                #
 #                                                                            #
 # Permission is hereby granted, free of charge, to any person obtaining a    #
 # copy of this software and associated documentation files (the "Software"), #
@@ -28,7 +28,7 @@
 #
 # Author: Thomas Dickey
 #
-# $Id: Caps.hpux11,v 1.5 2010/12/04 18:47:13 tom Exp $
+# $Id: Caps.hpux11,v 1.6 2011/10/15 23:20:04 tom Exp $
 #
 # This is an adaptation of ncurses' termcap/terminfo capability table, which
 # is designed to align with HPUX 11.x's terminfo.
@@ -746,11 +746,13 @@
 #%.ad
 #%
 #%.in .8i
-#%The XSI Curses standard added these.  They are some post-4.1 
-#%versions of System V curses, e.g., Solaris 2.5 and IRIX 6.x.
-#%The \fBncurses\fR termcap names for them are invented; according to the
-#%XSI Curses standard, they have no termcap names.  If your compiled terminfo
-#%entries use these, they may not be binary-compatible with System V terminfo
+#%The XSI Curses standard added these hardcopy capabilities.
+#%They were used in some post-4.1 versions of System V curses,
+#%e.g., Solaris 2.5 and IRIX 6.x.
+#%Except for \fBYI\fP, the \fBncurses\fR termcap names for them are invented.
+#%According to the XSI Curses standard, they have no termcap names.
+#%If your compiled terminfo entries use these,
+#%they may not be binary-compatible with System V terminfo
 #%entries after SVr4.1; beware!
 #%
 #%.na
@@ -761,7 +763,7 @@
 #%lw25 lw6 lw2 lw20.
 #%\fBVariable	Cap-	TCap	Description\fR
 #%\fBString	name	Code\fR
-set_pglen_inch			slength	str	sL	-		-	-----	YI Set page length to #1 hundredth of an inch
+set_pglen_inch			slength	str	YI	-		-	-----	Set page length to #1 hundredth of an inch (some implementations use sL for termcap).
 enter_horizontal_hl_mode	ehhlm	str	Xh	-		-	-----	Enter horizontal highlight mode
 enter_left_hl_mode		elhlm	str	Xl	-		-	-----	Enter left highlight mode
 enter_low_hl_mode		elohlm	str	Xo	-		-	-----	Enter low highlight mode
Index: include/Caps.keys
Prereq:  1.4 
--- ncurses-5.9/include/Caps.keys	2010-12-04 18:47:13.000000000 +0000
+++ ncurses-5.9-20130504/include/Caps.keys	2011-10-15 23:19:52.000000000 +0000
@@ -1,5 +1,5 @@
 ##############################################################################
-# Copyright (c) 2001-2006,2010 Free Software Foundation, Inc.                #
+# Copyright (c) 2001-2010,2011 Free Software Foundation, Inc.                #
 #                                                                            #
 # Permission is hereby granted, free of charge, to any person obtaining a    #
 # copy of this software and associated documentation files (the "Software"), #
@@ -29,7 +29,7 @@
 # Author: Thomas Dickey
 #    and: Ilya Zakharevich
 #
-# $Id: Caps.keys,v 1.4 2010/12/04 18:47:13 tom Exp $
+# $Id: Caps.keys,v 1.5 2011/10/15 23:19:52 tom Exp $
 #
 # This is an adaptation of ncurses' termcap/terminfo capability table, which
 # is illustrates an experimental extension to describe alt-, shift- and
@@ -828,11 +828,13 @@
 #%.ad
 #%
 #%.in .8i
-#%The XSI Curses standard added these.  They are some post-4.1 
-#%versions of System V curses, e.g., Solaris 2.5 and IRIX 6.x.
-#%The \fBncurses\fR termcap names for them are invented; according to the
-#%XSI Curses standard, they have no termcap names.  If your compiled terminfo
-#%entries use these, they may not be binary-compatible with System V terminfo
+#%The XSI Curses standard added these hardcopy capabilities.
+#%They were used in some post-4.1 versions of System V curses,
+#%e.g., Solaris 2.5 and IRIX 6.x.
+#%Except for \fBYI\fP, the \fBncurses\fR termcap names for them are invented.
+#%According to the XSI Curses standard, they have no termcap names.
+#%If your compiled terminfo entries use these,
+#%they may not be binary-compatible with System V terminfo
 #%entries after SVr4.1; beware!
 #%
 #%.na
@@ -850,7 +852,7 @@
 enter_top_hl_mode		ethlm	str	Xt	-		-	-----	Enter top highlight mode
 enter_vertical_hl_mode		evhlm	str	Xv	-		-	-----	Enter vertical highlight mode
 set_a_attributes		sgr1	str	sA	-		-	-----	Define second set of video attributes #1-#6
-set_pglen_inch			slength	str	sL	-		-	-----	YI Set page length to #1 hundredth of an inch
+set_pglen_inch			slength	str	YI	-		-	-----	Set page length to #1 hundredth of an inch (some implementations use sL for termcap).
 #%.TE
 #%.ad
 #
Index: include/Caps.osf1r5
Prereq:  1.5 
--- ncurses-5.9/include/Caps.osf1r5	2010-12-04 18:47:13.000000000 +0000
+++ ncurses-5.9-20130504/include/Caps.osf1r5	2011-10-15 22:52:09.000000000 +0000
@@ -1,5 +1,5 @@
 ##############################################################################
-# Copyright (c) 2002-2006,2010 Free Software Foundation, Inc.                #
+# Copyright (c) 2002-2010,2011 Free Software Foundation, Inc.                #
 #                                                                            #
 # Permission is hereby granted, free of charge, to any person obtaining a    #
 # copy of this software and associated documentation files (the "Software"), #
@@ -28,7 +28,7 @@
 #
 # Author: Thomas Dickey
 #
-# $Id: Caps.osf1r5,v 1.5 2010/12/04 18:47:13 tom Exp $
+# $Id: Caps.osf1r5,v 1.6 2011/10/15 22:52:09 tom Exp $
 #
 # This is an adaptation of ncurses' termcap/terminfo capability table, which
 # is designed to align with OSF/1 version 5 (Tru64) terminfo.
@@ -769,7 +769,7 @@
 xoff_character			xoffc	str	XF	-		-	-----	XOFF character
 xon_character			xonc	str	XN	-		-	-----	XON character
 zero_motion			zerom	str	Zx	-		-	-----	No motion for subsequent character
-set_pglen_inch			slength	str	sL	-		-	-----	YI Set page length to #1 hundredth of an inch
+set_pglen_inch			slength	str	YI	-		-	-----	Set page length to #1 hundredth of an inch (some implementations use sL for termcap).
 enter_horizontal_hl_mode	ehhlm	str	Xh	-		-	-----	Enter horizontal highlight mode
 enter_left_hl_mode		elhlm	str	Xl	-		-	-----	Enter left highlight mode
 enter_low_hl_mode		elohlm	str	Xo	-		-	-----	Enter low highlight mode
Index: include/MKkey_defs.sh
Prereq:  1.14 
--- ncurses-5.9/include/MKkey_defs.sh	2003-12-06 17:10:09.000000000 +0000
+++ ncurses-5.9-20130504/include/MKkey_defs.sh	2013-03-09 16:32:01.000000000 +0000
@@ -1,7 +1,7 @@
 #! /bin/sh
-# $Id: MKkey_defs.sh,v 1.14 2003/12/06 17:10:09 tom Exp $
+# $Id: MKkey_defs.sh,v 1.15 2013/03/09 16:32:01 tom Exp $
 ##############################################################################
-# Copyright (c) 2001-2002,2003 Free Software Foundation, Inc.                #
+# Copyright (c) 2001-2003,2013 Free Software Foundation, Inc.                #
 #                                                                            #
 # Permission is hereby granted, free of charge, to any person obtaining a    #
 # copy of this software and associated documentation files (the "Software"), #
@@ -65,9 +65,12 @@
 key_event	kv1	str	V1	KEY_EVENT	+	-----	We were interrupted by an event
 EOF
 
+THIS=./`basename $0`
+PARM=./`basename $DATA`
+
 cat <<EOF
 /*
- * These definitions were generated by $0 $DATA
+ * These definitions were generated by $THIS $PARM
  */
 EOF
 
Index: include/MKterm.h.awk.in
Prereq:  1.58 
--- ncurses-5.9/include/MKterm.h.awk.in	2010-01-09 19:53:26.000000000 +0000
+++ ncurses-5.9-20130504/include/MKterm.h.awk.in	2011-06-25 20:51:00.000000000 +0000
@@ -1,7 +1,7 @@
 # vile:awkmode
 BEGIN		{
 		    print  "/****************************************************************************"
-		    print  " * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc.              *"
+		    print  " * Copyright (c) 1998-2010,2011 Free Software Foundation, Inc.              *"
 		    print  " *                                                                          *"
 		    print  " * Permission is hereby granted, free of charge, to any person obtaining a  *"
 		    print  " * copy of this software and associated documentation files (the            *"
@@ -34,7 +34,7 @@
 		    print  "/*    and: Thomas E. Dickey                        1995-on                  */"
 		    print  "/****************************************************************************/"
 		    print  ""
-		    print  "/* $Id: MKterm.h.awk.in,v 1.58 2010/01/09 19:53:26 tom Exp $ */"
+		    print  "/* $Id: MKterm.h.awk.in,v 1.60 2011/06/25 20:51:00 tom Exp $ */"
 		    print  ""
 		    print  "/*"
 		    print  "**	term.h -- Definition of struct term"
@@ -93,41 +93,6 @@
 		    print  "#include <termio.h>"
 		    print  "#define TTY struct termio"
 		    print  ""
-		    print  "/* Add definitions to make termio look like termios."
-		    print  " * But ifdef it, since there are some implementations"
-		    print  " * that try to do this for us in a fake <termio.h>."
-		    print  " */"
-		    print  "#ifndef TCSANOW"
-		    print  "#define TCSANOW TCSETA"
-		    print  "#endif"
-		    print  "#ifndef TCSADRAIN"
-		    print  "#define TCSADRAIN TCSETAW"
-		    print  "#endif"
-		    print  "#ifndef TCSAFLUSH"
-		    print  "#define TCSAFLUSH TCSETAF"
-		    print  "#endif"
-		    print  "#ifndef tcsetattr"
-		    print  "#define tcsetattr(fd, cmd, arg) ioctl(fd, cmd, arg)"
-		    print  "#endif"
-		    print  "#ifndef tcgetattr"
-		    print  "#define tcgetattr(fd, arg) ioctl(fd, TCGETA, arg)"
-		    print  "#endif"
-		    print  "#ifndef cfgetospeed"
-		    print  "#define cfgetospeed(t) ((t)->c_cflag & CBAUD)"
-		    print  "#endif"
-		    print  "#ifndef TCIFLUSH "
-		    print  "#define TCIFLUSH 0"
-		    print  "#endif"
-		    print  "#ifndef TCOFLUSH "
-		    print  "#define TCOFLUSH 1"
-		    print  "#endif"
-		    print  "#ifndef TCIOFLUSH "
-		    print  "#define TCIOFLUSH 2"
-		    print  "#endif"
-		    print  "#ifndef tcflush"
-		    print  "#define tcflush(fd, arg) ioctl(fd, TCFLSH, arg)"
-		    print  "#endif"
-		    print  ""
 		    print  "#else /* !HAVE_TERMIO_H */"
 		    print  ""
 		    print  "#if __MINGW32__"
Index: include/curses.h.in
Prereq:  1.220 
--- ncurses-5.9/include/curses.h.in	2011-01-22 19:47:20.000000000 +0000
+++ ncurses-5.9-20130504/include/curses.h.in	2012-09-16 21:05:02.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2010,2011 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -32,7 +32,7 @@
  *     and: Thomas E. Dickey                        1996-on                 *
  ****************************************************************************/
 
-/* $Id: curses.h.in,v 1.220 2011/01/22 19:47:20 tom Exp $ */
+/* $Id: curses.h.in,v 1.233 2012/09/16 21:05:02 tom Exp $ */
 
 #ifndef __NCURSES_H
 #define __NCURSES_H
@@ -129,6 +129,13 @@
 #define NCURSES_TPARM_VARARGS @NCURSES_TPARM_VARARGS@
 
 /*
+ * Control type used for tparm's arguments.  While X/Open equates long and
+ * char* values, this is not always workable for 64-bit platforms.
+ */
+#undef NCURSES_TPARM_ARG
+#define NCURSES_TPARM_ARG @NCURSES_TPARM_ARG@
+
+/*
  * NCURSES_CH_T is used in building the library, but not used otherwise in
  * this header file, since that would make the normal/wide-character versions
  * of the header incompatible.
@@ -151,15 +158,21 @@
 
 /*
  * With XPG4, you must define _XOPEN_SOURCE_EXTENDED, it is redundant (or
- * conflicting) when _XOPEN_SOURCE is 500 or greater.
+ * conflicting) when _XOPEN_SOURCE is 500 or greater.  If NCURSES_WIDECHAR is
+ * not already defined, e.g., if the platform relies upon nonstandard feature
+ * test macros, define it at this point if the standard feature test macros
+ * indicate that it should be defined.
  */
-#undef NCURSES_WIDECHAR
-#if defined(_XOPEN_SOURCE_EXTENDED) || defined(_XPG5)
-#define NCURSES_WIDECHAR
+#ifndef NCURSES_WIDECHAR
+#if defined(_XOPEN_SOURCE_EXTENDED) || (defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE - 0 >= 500))
+#define NCURSES_WIDECHAR 1
+#else
+#define NCURSES_WIDECHAR 0
 #endif
+#endif /* NCURSES_WIDECHAR */
 
 #include <stdarg.h>	/* we need va_list */
-#ifdef NCURSES_WIDECHAR
+#if NCURSES_WIDECHAR
 #include <stddef.h>	/* we want wchar_t */
 #endif
 
@@ -250,7 +263,7 @@
 extern NCURSES_EXPORT_VAR(chtype) acs_map[];
 #endif
 
-#define NCURSES_ACS(c)	(acs_map[NCURSES_CAST(unsigned char,c)])
+#define NCURSES_ACS(c)	(acs_map[NCURSES_CAST(unsigned char,(c))])
 
 /* VT100 symbols begin here */
 #define ACS_ULCORNER	NCURSES_ACS('l') /* upper left corner */
@@ -342,7 +355,7 @@
 
 typedef	chtype	attr_t;		/* ...must be at least as wide as chtype */
 
-#ifdef NCURSES_WIDECHAR
+#if NCURSES_WIDECHAR
 
 #if @NCURSES_LIBUTF8@
 #ifdef mblen			/* libutf8.h defines it w/o undefining first */
@@ -366,7 +379,7 @@
 /*
  * cchar_t stores an array of CCHARW_MAX wide characters.  The first is
  * normally a spacing character.  The others are non-spacing.  If those
- * (spacing and nonspacing) do not fill the array, a null L'\0' follows. 
+ * (spacing and nonspacing) do not fill the array, a null L'\0' follows.
  * Otherwise, a null is assumed to follow when extracting via getcchar().
  */
 #define CCHARW_MAX	@NCURSES_CCHARW_MAX@
@@ -434,7 +447,7 @@
 
 	NCURSES_SIZE_T _yoffset; /* real begy is _begy + _yoffset */
 
-#ifdef NCURSES_WIDECHAR
+#if NCURSES_WIDECHAR
 	cchar_t  _bkgrnd;	/* current background char/attribute pair */
 #if @NCURSES_EXT_COLORS@
 	int	_color;		/* current color-pair for non-space character */
@@ -757,6 +770,7 @@
 extern NCURSES_EXPORT(int) ungetch (int);				/* implemented */
 extern NCURSES_EXPORT(int) untouchwin (WINDOW *);			/* generated */
 extern NCURSES_EXPORT(void) use_env (bool);				/* implemented */
+extern NCURSES_EXPORT(void) use_tioctl (bool);				/* implemented */
 extern NCURSES_EXPORT(int) vidattr (chtype);				/* implemented */
 extern NCURSES_EXPORT(int) vidputs (chtype, NCURSES_OUTC);		/* implemented */
 extern NCURSES_EXPORT(int) vline (chtype, int);				/* generated */
@@ -832,7 +846,7 @@
 #if NCURSES_TPARM_VARARGS
 extern NCURSES_EXPORT(char *) tparm (NCURSES_CONST char *, ...);	/* special */
 #else
-extern NCURSES_EXPORT(char *) tparm (NCURSES_CONST char *, long,long,long,long,long,long,long,long,long);	/* special */
+extern NCURSES_EXPORT(char *) tparm (NCURSES_CONST char *, NCURSES_TPARM_ARG,NCURSES_TPARM_ARG,NCURSES_TPARM_ARG,NCURSES_TPARM_ARG,NCURSES_TPARM_ARG,NCURSES_TPARM_ARG,NCURSES_TPARM_ARG,NCURSES_TPARM_ARG,NCURSES_TPARM_ARG);	/* special */
 extern NCURSES_EXPORT(char *) tparm_varargs (NCURSES_CONST char *, ...);	/* special */
 #endif
 
@@ -854,7 +868,7 @@
 /*
  * vid_attr() was implemented originally based on a draft of X/Open curses.
  */
-#ifndef NCURSES_WIDECHAR
+#if !NCURSES_WIDECHAR
 #define vid_attr(a,pair,opts) vidattr(a)
 #endif
 
@@ -994,6 +1008,7 @@
 extern NCURSES_EXPORT(int) NCURSES_SP_NAME(typeahead) (SCREEN*, int); /* implemented:SP_FUNC */
 extern NCURSES_EXPORT(int) NCURSES_SP_NAME(ungetch) (SCREEN*, int); /* implemented:SP_FUNC */
 extern NCURSES_EXPORT(void) NCURSES_SP_NAME(use_env) (SCREEN*, bool); /* implemented:SP_FUNC */
+extern NCURSES_EXPORT(void) NCURSES_SP_NAME(use_tioctl) (SCREEN*, bool); /* implemented:SP_FUNC */
 extern NCURSES_EXPORT(int) NCURSES_SP_NAME(vidattr) (SCREEN*, chtype);	/* implemented:SP_FUNC */
 extern NCURSES_EXPORT(int) NCURSES_SP_NAME(vidputs) (SCREEN*, chtype, NCURSES_SP_OUTC); /* implemented:SP_FUNC */
 #if @NCURSES_EXT_FUNCS@
@@ -1084,7 +1099,7 @@
  */
 
 #define wgetstr(w, s)		wgetnstr(w, s, -1)
-#define getnstr(s, n)		wgetnstr(stdscr, s, n)
+#define getnstr(s, n)		wgetnstr(stdscr, s, (n))
 
 #define setterm(term)		setupterm(term, 1, (int *)0)
 
@@ -1115,7 +1130,7 @@
 #define wattroff(win,at)	wattr_off(win, NCURSES_CAST(attr_t, at), NULL)
 
 #if !NCURSES_OPAQUE
-#if defined(NCURSES_WIDECHAR) && @NCURSES_EXT_COLORS@
+#if NCURSES_WIDECHAR && @NCURSES_EXT_COLORS@
 #define wattrset(win,at)	((win) \
 				  ? ((win)->_color = PAIR_NUMBER(at), \
                                      (win)->_attrs = NCURSES_CAST(attr_t, at), \
@@ -1137,15 +1152,15 @@
 
 #define box(win, v, h)		wborder(win, v, v, h, h, 0, 0, 0, 0)
 #define border(ls, rs, ts, bs, tl, tr, bl, br)	wborder(stdscr, ls, rs, ts, bs, tl, tr, bl, br)
-#define hline(ch, n)		whline(stdscr, ch, n)
-#define vline(ch, n)		wvline(stdscr, ch, n)
+#define hline(ch, n)		whline(stdscr, ch, (n))
+#define vline(ch, n)		wvline(stdscr, ch, (n))
 
 #define winstr(w, s)		winnstr(w, s, -1)
 #define winchstr(w, s)		winchnstr(w, s, -1)
 #define winsstr(w, s)		winsnstr(w, s, -1)
 
 #if !NCURSES_OPAQUE
-#define redrawwin(win)		wredrawln(win, 0, (win)->_maxy+1)
+#define redrawwin(win)		wredrawln(win, 0, ((win) ? (win)->_maxy+1 : -1))
 #endif /* NCURSES_OPAQUE */
 
 #define waddstr(win,str)	waddnstr(win,str,-1)
@@ -1154,55 +1169,55 @@
 /*
  * These apply to the first 256 color pairs.
  */
-#define COLOR_PAIR(n)	NCURSES_BITS(n, 0)
-#define PAIR_NUMBER(a)	(NCURSES_CAST(int,((NCURSES_CAST(unsigned long,a) & A_COLOR) >> NCURSES_ATTR_SHIFT)))
+#define COLOR_PAIR(n)	NCURSES_BITS((n), 0)
+#define PAIR_NUMBER(a)	(NCURSES_CAST(int,((NCURSES_CAST(unsigned long,(a)) & A_COLOR) >> NCURSES_ATTR_SHIFT)))
 
 /*
  * pseudo functions for standard screen
  */
 
-#define addch(ch)		waddch(stdscr,ch)
-#define addchnstr(str,n)	waddchnstr(stdscr,str,n)
-#define addchstr(str)		waddchstr(stdscr,str)
-#define addnstr(str,n)		waddnstr(stdscr,str,n)
-#define addstr(str)		waddnstr(stdscr,str,-1)
-#define attroff(at)		wattroff(stdscr,at)
-#define attron(at)		wattron(stdscr,at)
-#define attrset(at)		wattrset(stdscr,at)
-#define attr_get(ap,cp,o)	wattr_get(stdscr,ap,cp,o)
-#define attr_off(a,o)		wattr_off(stdscr,a,o)
-#define attr_on(a,o)		wattr_on(stdscr,a,o)
-#define attr_set(a,c,o)		wattr_set(stdscr,a,c,o)
-#define bkgd(ch)		wbkgd(stdscr,ch)
-#define bkgdset(ch)		wbkgdset(stdscr,ch)
-#define chgat(n,a,c,o)		wchgat(stdscr,n,a,c,o)
+#define addch(ch)		waddch(stdscr,(ch))
+#define addchnstr(str,n)	waddchnstr(stdscr,(str),(n))
+#define addchstr(str)		waddchstr(stdscr,(str))
+#define addnstr(str,n)		waddnstr(stdscr,(str),(n))
+#define addstr(str)		waddnstr(stdscr,(str),-1)
+#define attroff(at)		wattroff(stdscr,(at))
+#define attron(at)		wattron(stdscr,(at))
+#define attrset(at)		wattrset(stdscr,(at))
+#define attr_get(ap,cp,o)	wattr_get(stdscr,(ap),(cp),(o))
+#define attr_off(a,o)		wattr_off(stdscr,(a),(o))
+#define attr_on(a,o)		wattr_on(stdscr,(a),(o))
+#define attr_set(a,c,o)		wattr_set(stdscr,(a),(c),(o))
+#define bkgd(ch)		wbkgd(stdscr,(ch))
+#define bkgdset(ch)		wbkgdset(stdscr,(ch))
+#define chgat(n,a,c,o)		wchgat(stdscr,(n),(a),(c),(o))
 #define clear()			wclear(stdscr)
 #define clrtobot()		wclrtobot(stdscr)
 #define clrtoeol()		wclrtoeol(stdscr)
-#define color_set(c,o)		wcolor_set(stdscr,c,o)
+#define color_set(c,o)		wcolor_set(stdscr,(c),(o))
 #define delch()			wdelch(stdscr)
 #define deleteln()		winsdelln(stdscr,-1)
-#define echochar(c)		wechochar(stdscr,c)
+#define echochar(c)		wechochar(stdscr,(c))
 #define erase()			werase(stdscr)
 #define getch()			wgetch(stdscr)
-#define getstr(str)		wgetstr(stdscr,str)
+#define getstr(str)		wgetstr(stdscr,(str))
 #define inch()			winch(stdscr)
-#define inchnstr(s,n)		winchnstr(stdscr,s,n)
-#define inchstr(s)		winchstr(stdscr,s)
-#define innstr(s,n)		winnstr(stdscr,s,n)
-#define insch(c)		winsch(stdscr,c)
-#define insdelln(n)		winsdelln(stdscr,n)
+#define inchnstr(s,n)		winchnstr(stdscr,(s),(n))
+#define inchstr(s)		winchstr(stdscr,(s))
+#define innstr(s,n)		winnstr(stdscr,(s),(n))
+#define insch(c)		winsch(stdscr,(c))
+#define insdelln(n)		winsdelln(stdscr,(n))
 #define insertln()		winsdelln(stdscr,1)
-#define insnstr(s,n)		winsnstr(stdscr,s,n)
-#define insstr(s)		winsstr(stdscr,s)
-#define instr(s)		winstr(stdscr,s)
-#define move(y,x)		wmove(stdscr,y,x)
+#define insnstr(s,n)		winsnstr(stdscr,(s),(n))
+#define insstr(s)		winsstr(stdscr,(s))
+#define instr(s)		winstr(stdscr,(s))
+#define move(y,x)		wmove(stdscr,(y),(x))
 #define refresh()		wrefresh(stdscr)
-#define scrl(n)			wscrl(stdscr,n)
-#define setscrreg(t,b)		wsetscrreg(stdscr,t,b)
+#define scrl(n)			wscrl(stdscr,(n))
+#define setscrreg(t,b)		wsetscrreg(stdscr,(t),(b))
 #define standend()		wstandend(stdscr)
 #define standout()		wstandout(stdscr)
-#define timeout(delay)		wtimeout(stdscr,delay)
+#define timeout(delay)		wtimeout(stdscr,(delay))
 #define wdeleteln(win)		winsdelln(win,-1)
 #define winsertln(win)		winsdelln(win,1)
 
@@ -1210,70 +1225,75 @@
  * mv functions
  */
 
-#define mvwaddch(win,y,x,ch)		(wmove(win,y,x) == ERR ? ERR : waddch(win,ch))
-#define mvwaddchnstr(win,y,x,str,n)	(wmove(win,y,x) == ERR ? ERR : waddchnstr(win,str,n))
-#define mvwaddchstr(win,y,x,str)	(wmove(win,y,x) == ERR ? ERR : waddchnstr(win,str,-1))
-#define mvwaddnstr(win,y,x,str,n)	(wmove(win,y,x) == ERR ? ERR : waddnstr(win,str,n))
-#define mvwaddstr(win,y,x,str)		(wmove(win,y,x) == ERR ? ERR : waddnstr(win,str,-1))
-#define mvwdelch(win,y,x)		(wmove(win,y,x) == ERR ? ERR : wdelch(win))
-#define mvwchgat(win,y,x,n,a,c,o)	(wmove(win,y,x) == ERR ? ERR : wchgat(win,n,a,c,o))
-#define mvwgetch(win,y,x)		(wmove(win,y,x) == ERR ? ERR : wgetch(win))
-#define mvwgetnstr(win,y,x,str,n)	(wmove(win,y,x) == ERR ? ERR : wgetnstr(win,str,n))
-#define mvwgetstr(win,y,x,str)		(wmove(win,y,x) == ERR ? ERR : wgetstr(win,str))
-#define mvwhline(win,y,x,c,n)		(wmove(win,y,x) == ERR ? ERR : whline(win,c,n))
-#define mvwinch(win,y,x)		(wmove(win,y,x) == ERR ? NCURSES_CAST(chtype, ERR) : winch(win))
-#define mvwinchnstr(win,y,x,s,n)	(wmove(win,y,x) == ERR ? ERR : winchnstr(win,s,n))
-#define mvwinchstr(win,y,x,s)		(wmove(win,y,x) == ERR ? ERR : winchstr(win,s))
-#define mvwinnstr(win,y,x,s,n)		(wmove(win,y,x) == ERR ? ERR : winnstr(win,s,n))
-#define mvwinsch(win,y,x,c)		(wmove(win,y,x) == ERR ? ERR : winsch(win,c))
-#define mvwinsnstr(win,y,x,s,n)		(wmove(win,y,x) == ERR ? ERR : winsnstr(win,s,n))
-#define mvwinsstr(win,y,x,s)		(wmove(win,y,x) == ERR ? ERR : winsstr(win,s))
-#define mvwinstr(win,y,x,s)		(wmove(win,y,x) == ERR ? ERR : winstr(win,s))
-#define mvwvline(win,y,x,c,n)		(wmove(win,y,x) == ERR ? ERR : wvline(win,c,n))
-
-#define mvaddch(y,x,ch)			mvwaddch(stdscr,y,x,ch)
-#define mvaddchnstr(y,x,str,n)		mvwaddchnstr(stdscr,y,x,str,n)
-#define mvaddchstr(y,x,str)		mvwaddchstr(stdscr,y,x,str)
-#define mvaddnstr(y,x,str,n)		mvwaddnstr(stdscr,y,x,str,n)
-#define mvaddstr(y,x,str)		mvwaddstr(stdscr,y,x,str)
-#define mvchgat(y,x,n,a,c,o)		mvwchgat(stdscr,y,x,n,a,c,o)
-#define mvdelch(y,x)			mvwdelch(stdscr,y,x)
-#define mvgetch(y,x)			mvwgetch(stdscr,y,x)
-#define mvgetnstr(y,x,str,n)		mvwgetnstr(stdscr,y,x,str,n)
-#define mvgetstr(y,x,str)		mvwgetstr(stdscr,y,x,str)
-#define mvhline(y,x,c,n)		mvwhline(stdscr,y,x,c,n)
-#define mvinch(y,x)			mvwinch(stdscr,y,x)
-#define mvinchnstr(y,x,s,n)		mvwinchnstr(stdscr,y,x,s,n)
-#define mvinchstr(y,x,s)		mvwinchstr(stdscr,y,x,s)
-#define mvinnstr(y,x,s,n)		mvwinnstr(stdscr,y,x,s,n)
-#define mvinsch(y,x,c)			mvwinsch(stdscr,y,x,c)
-#define mvinsnstr(y,x,s,n)		mvwinsnstr(stdscr,y,x,s,n)
-#define mvinsstr(y,x,s)			mvwinsstr(stdscr,y,x,s)
-#define mvinstr(y,x,s)			mvwinstr(stdscr,y,x,s)
-#define mvvline(y,x,c,n)		mvwvline(stdscr,y,x,c,n)
+#define mvwaddch(win,y,x,ch)		(wmove((win),(y),(x)) == ERR ? ERR : waddch((win),(ch)))
+#define mvwaddchnstr(win,y,x,str,n)	(wmove((win),(y),(x)) == ERR ? ERR : waddchnstr((win),(str),(n)))
+#define mvwaddchstr(win,y,x,str)	(wmove((win),(y),(x)) == ERR ? ERR : waddchnstr((win),(str),-1))
+#define mvwaddnstr(win,y,x,str,n)	(wmove((win),(y),(x)) == ERR ? ERR : waddnstr((win),(str),(n)))
+#define mvwaddstr(win,y,x,str)		(wmove((win),(y),(x)) == ERR ? ERR : waddnstr((win),(str),-1))
+#define mvwdelch(win,y,x)		(wmove((win),(y),(x)) == ERR ? ERR : wdelch(win))
+#define mvwchgat(win,y,x,n,a,c,o)	(wmove((win),(y),(x)) == ERR ? ERR : wchgat((win),(n),(a),(c),(o)))
+#define mvwgetch(win,y,x)		(wmove((win),(y),(x)) == ERR ? ERR : wgetch(win))
+#define mvwgetnstr(win,y,x,str,n)	(wmove((win),(y),(x)) == ERR ? ERR : wgetnstr((win),(str),(n)))
+#define mvwgetstr(win,y,x,str)		(wmove((win),(y),(x)) == ERR ? ERR : wgetstr((win),(str)))
+#define mvwhline(win,y,x,c,n)		(wmove((win),(y),(x)) == ERR ? ERR : whline((win),(c),(n)))
+#define mvwinch(win,y,x)		(wmove((win),(y),(x)) == ERR ? NCURSES_CAST(chtype, ERR) : winch(win))
+#define mvwinchnstr(win,y,x,s,n)	(wmove((win),(y),(x)) == ERR ? ERR : winchnstr((win),(s),(n)))
+#define mvwinchstr(win,y,x,s)		(wmove((win),(y),(x)) == ERR ? ERR : winchstr((win),(s)))
+#define mvwinnstr(win,y,x,s,n)		(wmove((win),(y),(x)) == ERR ? ERR : winnstr((win),(s),(n)))
+#define mvwinsch(win,y,x,c)		(wmove((win),(y),(x)) == ERR ? ERR : winsch((win),(c)))
+#define mvwinsnstr(win,y,x,s,n)		(wmove((win),(y),(x)) == ERR ? ERR : winsnstr((win),(s),(n)))
+#define mvwinsstr(win,y,x,s)		(wmove((win),(y),(x)) == ERR ? ERR : winsstr((win),(s)))
+#define mvwinstr(win,y,x,s)		(wmove((win),(y),(x)) == ERR ? ERR : winstr((win),(s)))
+#define mvwvline(win,y,x,c,n)		(wmove((win),(y),(x)) == ERR ? ERR : wvline((win),(c),(n)))
+
+#define mvaddch(y,x,ch)			mvwaddch(stdscr,(y),(x),(ch))
+#define mvaddchnstr(y,x,str,n)		mvwaddchnstr(stdscr,(y),(x),(str),(n))
+#define mvaddchstr(y,x,str)		mvwaddchstr(stdscr,(y),(x),(str))
+#define mvaddnstr(y,x,str,n)		mvwaddnstr(stdscr,(y),(x),(str),(n))
+#define mvaddstr(y,x,str)		mvwaddstr(stdscr,(y),(x),(str))
+#define mvchgat(y,x,n,a,c,o)		mvwchgat(stdscr,(y),(x),(n),(a),(c),(o))
+#define mvdelch(y,x)			mvwdelch(stdscr,(y),(x))
+#define mvgetch(y,x)			mvwgetch(stdscr,(y),(x))
+#define mvgetnstr(y,x,str,n)		mvwgetnstr(stdscr,(y),(x),(str),(n))
+#define mvgetstr(y,x,str)		mvwgetstr(stdscr,(y),(x),(str))
+#define mvhline(y,x,c,n)		mvwhline(stdscr,(y),(x),(c),(n))
+#define mvinch(y,x)			mvwinch(stdscr,(y),(x))
+#define mvinchnstr(y,x,s,n)		mvwinchnstr(stdscr,(y),(x),(s),(n))
+#define mvinchstr(y,x,s)		mvwinchstr(stdscr,(y),(x),(s))
+#define mvinnstr(y,x,s,n)		mvwinnstr(stdscr,(y),(x),(s),(n))
+#define mvinsch(y,x,c)			mvwinsch(stdscr,(y),(x),(c))
+#define mvinsnstr(y,x,s,n)		mvwinsnstr(stdscr,(y),(x),(s),(n))
+#define mvinsstr(y,x,s)			mvwinsstr(stdscr,(y),(x),(s))
+#define mvinstr(y,x,s)			mvwinstr(stdscr,(y),(x),(s))
+#define mvvline(y,x,c,n)		mvwvline(stdscr,(y),(x),(c),(n))
 
 /*
  * Some wide-character functions can be implemented without the extensions.
  */
 #if !NCURSES_OPAQUE
-#define getbkgd(win)                    ((win)->_bkgd)
+#define getbkgd(win)                    ((win) ? ((win)->_bkgd) : 0)
 #endif /* NCURSES_OPAQUE */
 
 #define slk_attr_off(a,v)		((v) ? ERR : slk_attroff(a))
 #define slk_attr_on(a,v)		((v) ? ERR : slk_attron(a))
 
 #if !NCURSES_OPAQUE
-#if defined(NCURSES_WIDECHAR) && @NCURSES_EXT_COLORS@
-#define wattr_set(win,a,p,opts)		((win)->_attrs = ((a) & ~A_COLOR), \
-					 (win)->_color = (p), \
+#if NCURSES_WIDECHAR && @NCURSES_EXT_COLORS@
+#define wattr_set(win,a,p,opts)		(((win) \
+					  ? ((win)->_attrs = ((a) & ~A_COLOR), \
+					     (win)->_color = (p)) \
+					  : OK), \
 					 OK)
-#define wattr_get(win,a,p,opts)		((void)((a) != (void *)0 && (*(a) = (win)->_attrs)), \
-					 (void)((p) != (void *)0 && (*(p) = (short)(win)->_color)), \
+#define wattr_get(win,a,p,opts)		((void)(((a) != (void *)0) ? (*(a) = (win) ? (win)->_attrs : 0) : OK), \
+					 (void)(((p) != (void *)0) ? (*(p) = (win) ? (short)(win)->_color : 0) : OK), \
 					 OK)
 #else
-#define wattr_set(win,a,p,opts)		((win)->_attrs = (((a) & ~A_COLOR) | (attr_t)COLOR_PAIR(p)), OK)
-#define wattr_get(win,a,p,opts)		((void)((a) != (void *)0 && (*(a) = (win)->_attrs)), \
-					 (void)((p) != (void *)0 && (*(p) = (short)PAIR_NUMBER((win)->_attrs))), \
+#define wattr_set(win,a,p,opts)		(((win) \
+					  ? ((win)->_attrs = (((a) & ~A_COLOR) | (attr_t)COLOR_PAIR(p))) \
+					  : OK), \
+					 OK)
+#define wattr_get(win,a,p,opts)		((void)(((a) != (void *)0) ? (*(a) = (win) ? (win)->_attrs : 0) : OK), \
+					 (void)(((p) != (void *)0) ? (*(p) = (win) ? (short)PAIR_NUMBER((win)->_attrs) : 0) : OK), \
 					 OK)
 #endif
 #endif /* NCURSES_OPAQUE */
Index: include/curses.tail
Prereq:  1.20 
--- ncurses-5.9/include/curses.tail	2010-03-28 19:10:55.000000000 +0000
+++ ncurses-5.9-20130504/include/curses.tail	2011-10-29 20:03:22.000000000 +0000
@@ -1,4 +1,4 @@
-/* $Id: curses.tail,v 1.20 2010/03/28 19:10:55 tom Exp $ */
+/* $Id: curses.tail,v 1.21 2011/10/29 20:03:22 tom Exp $ */
 /*
  * vile:cmode:
  * This file is part of ncurses, designed to be appended after curses.h.in
@@ -133,7 +133,7 @@
 extern NCURSES_EXPORT(char *) _tracechar (int);
 extern NCURSES_EXPORT(char *) _tracechtype (chtype);
 extern NCURSES_EXPORT(char *) _tracechtype2 (int, chtype);
-#ifdef NCURSES_WIDECHAR
+#if NCURSES_WIDECHAR
 #define _tracech_t		_tracecchar_t
 extern NCURSES_EXPORT(char *) _tracecchar_t (const cchar_t *);
 #define _tracech_t2		_tracecchar_t2
Index: include/curses.wide
Prereq:  1.42 
--- ncurses-5.9/include/curses.wide	2010-03-30 00:39:41.000000000 +0000
+++ ncurses-5.9-20130504/include/curses.wide	2012-07-28 18:10:02.000000000 +0000
@@ -1,4 +1,4 @@
-/* $Id: curses.wide,v 1.42 2010/03/30 00:39:41 tom Exp $ */
+/* $Id: curses.wide,v 1.45 2012/07/28 18:10:02 tom Exp $ */
 /*
  * vile:cmode:
  * This file is part of ncurses, designed to be appended after curses.h.in
@@ -6,11 +6,11 @@
  */
 #define _XOPEN_CURSES 1
 
-#ifdef NCURSES_WIDECHAR
+#if NCURSES_WIDECHAR
 
 extern NCURSES_EXPORT_VAR(cchar_t *) _nc_wacs;
 
-#define NCURSES_WACS(c)	(&_nc_wacs[(unsigned char)c])
+#define NCURSES_WACS(c)	(&_nc_wacs[NCURSES_CAST(unsigned char,(c))])
 
 #define WACS_BSSB	NCURSES_WACS('l')
 #define WACS_SSBB	NCURSES_WACS('m')
@@ -230,77 +230,77 @@
 /*
  * XSI curses macros for XPG4 conformance.
  */
-#define add_wch(c)			wadd_wch(stdscr,c)
-#define add_wchnstr(str,n)		wadd_wchnstr(stdscr,str,n)
-#define add_wchstr(str)			wadd_wchstr(stdscr,str)
-#define addnwstr(wstr,n)		waddnwstr(stdscr,wstr,n)
-#define addwstr(wstr)			waddwstr(stdscr,wstr)
-#define bkgrnd(c)			wbkgrnd(stdscr,c)
-#define bkgrndset(c)			wbkgrndset(stdscr,c)
-#define border_set(l,r,t,b,tl,tr,bl,br) wborder_set(stdscr,l,r,t,b,tl,tr,bl,br)
-#define box_set(w,v,h)			wborder_set(w,v,v,h,h,0,0,0,0)
-#define echo_wchar(c)			wecho_wchar(stdscr,c)
-#define get_wch(c)			wget_wch(stdscr,c)
-#define get_wstr(t)			wget_wstr(stdscr,t)
-#define getbkgrnd(wch)			wgetbkgrnd(stdscr,wch)
-#define getn_wstr(t,n)			wgetn_wstr(stdscr,t,n)
-#define hline_set(c,n)			whline_set(stdscr,c,n)
-#define in_wch(c)			win_wch(stdscr,c)
-#define in_wchnstr(c,n)			win_wchnstr(stdscr,c,n)
-#define in_wchstr(c)			win_wchstr(stdscr,c)
-#define innwstr(c,n)			winnwstr(stdscr,c,n)
-#define ins_nwstr(t,n)			wins_nwstr(stdscr,t,n)
-#define ins_wch(c)			wins_wch(stdscr,c)
-#define ins_wstr(t)			wins_wstr(stdscr,t)
-#define inwstr(c)			winwstr(stdscr,c)
-#define vline_set(c,n)			wvline_set(stdscr,c,n)
-#define wadd_wchstr(win,str)		wadd_wchnstr(win,str,-1)
-#define waddwstr(win,wstr)		waddnwstr(win,wstr,-1)
-#define wget_wstr(w,t)			wgetn_wstr(w,t,-1)
-#define win_wchstr(w,c)			win_wchnstr(w,c,-1)
-#define wins_wstr(w,t)			wins_nwstr(w,t,-1)
+#define add_wch(c)			wadd_wch(stdscr,(c))
+#define add_wchnstr(str,n)		wadd_wchnstr(stdscr,(str),(n))
+#define add_wchstr(str)			wadd_wchstr(stdscr,(str))
+#define addnwstr(wstr,n)		waddnwstr(stdscr,(wstr),(n))
+#define addwstr(wstr)			waddwstr(stdscr,(wstr))
+#define bkgrnd(c)			wbkgrnd(stdscr,(c))
+#define bkgrndset(c)			wbkgrndset(stdscr,(c))
+#define border_set(l,r,t,b,tl,tr,bl,br) wborder_set(stdscr,(l),(r),(t),(b),tl,tr,bl,br)
+#define box_set(w,v,h)			wborder_set((w),(v),(v),(h),(h),0,0,0,0)
+#define echo_wchar(c)			wecho_wchar(stdscr,(c))
+#define get_wch(c)			wget_wch(stdscr,(c))
+#define get_wstr(t)			wget_wstr(stdscr,(t))
+#define getbkgrnd(wch)			wgetbkgrnd(stdscr,(wch))
+#define getn_wstr(t,n)			wgetn_wstr(stdscr,(t),(n))
+#define hline_set(c,n)			whline_set(stdscr,(c),(n))
+#define in_wch(c)			win_wch(stdscr,(c))
+#define in_wchnstr(c,n)			win_wchnstr(stdscr,(c),(n))
+#define in_wchstr(c)			win_wchstr(stdscr,(c))
+#define innwstr(c,n)			winnwstr(stdscr,(c),(n))
+#define ins_nwstr(t,n)			wins_nwstr(stdscr,(t),(n))
+#define ins_wch(c)			wins_wch(stdscr,(c))
+#define ins_wstr(t)			wins_wstr(stdscr,(t))
+#define inwstr(c)			winwstr(stdscr,(c))
+#define vline_set(c,n)			wvline_set(stdscr,(c),(n))
+#define wadd_wchstr(win,str)		wadd_wchnstr((win),(str),-1)
+#define waddwstr(win,wstr)		waddnwstr((win),(wstr),-1)
+#define wget_wstr(w,t)			wgetn_wstr((w),(t),-1)
+#define win_wchstr(w,c)			win_wchnstr((w),(c),-1)
+#define wins_wstr(w,t)			wins_nwstr((w),(t),-1)
 
 #if !NCURSES_OPAQUE
-#define wgetbkgrnd(win,wch)		(*wch = win->_bkgrnd, OK)
+#define wgetbkgrnd(win,wch)		((win) ? (*(wch) = (win)->_bkgrnd) : *(wch), OK)
 #endif
 
-#define mvadd_wch(y,x,c)		mvwadd_wch(stdscr,y,x,c)
-#define mvadd_wchnstr(y,x,s,n)		mvwadd_wchnstr(stdscr,y,x,s,n)
-#define mvadd_wchstr(y,x,s)		mvwadd_wchstr(stdscr,y,x,s)
-#define mvaddnwstr(y,x,wstr,n)		mvwaddnwstr(stdscr,y,x,wstr,n)
-#define mvaddwstr(y,x,wstr)		mvwaddwstr(stdscr,y,x,wstr)
-#define mvget_wch(y,x,c)		mvwget_wch(stdscr,y,x,c)
-#define mvget_wstr(y,x,t)		mvwget_wstr(stdscr,y,x,t)
-#define mvgetn_wstr(y,x,t,n)		mvwgetn_wstr(stdscr,y,x,t,n)
-#define mvhline_set(y,x,c,n)		mvwhline_set(stdscr,y,x,c,n)
-#define mvin_wch(y,x,c)			mvwin_wch(stdscr,y,x,c)
-#define mvin_wchnstr(y,x,c,n)		mvwin_wchnstr(stdscr,y,x,c,n)
-#define mvin_wchstr(y,x,c)		mvwin_wchstr(stdscr,y,x,c)
-#define mvinnwstr(y,x,c,n)		mvwinnwstr(stdscr,y,x,c,n)
-#define mvins_nwstr(y,x,t,n)		mvwins_nwstr(stdscr,y,x,t,n)
-#define mvins_wch(y,x,c)		mvwins_wch(stdscr,y,x,c)
-#define mvins_wstr(y,x,t)		mvwins_wstr(stdscr,y,x,t)
-#define mvinwstr(y,x,c)			mvwinwstr(stdscr,y,x,c)
-#define mvvline_set(y,x,c,n)		mvwvline_set(stdscr,y,x,c,n)
-
-#define mvwadd_wch(win,y,x,c)		(wmove(win,y,x) == ERR ? ERR : wadd_wch(win,c))
-#define mvwadd_wchnstr(win,y,x,s,n)	(wmove(win,y,x) == ERR ? ERR : wadd_wchnstr(win,s,n))
-#define mvwadd_wchstr(win,y,x,s)	(wmove(win,y,x) == ERR ? ERR : wadd_wchstr(win,s))
-#define mvwaddnwstr(win,y,x,wstr,n)	(wmove(win,y,x) == ERR ? ERR : waddnwstr(win,wstr,n))
-#define mvwaddwstr(win,y,x,wstr)	(wmove(win,y,x) == ERR ? ERR : waddwstr(win,wstr))
-#define mvwget_wch(win,y,x,c)		(wmove(win,y,x) == ERR ? ERR : wget_wch(win,c))
-#define mvwget_wstr(win,y,x,t)		(wmove(win,y,x) == ERR ? ERR : wget_wstr(win,t))
-#define mvwgetn_wstr(win,y,x,t,n)	(wmove(win,y,x) == ERR ? ERR : wgetn_wstr(win,t,n))
-#define mvwhline_set(win,y,x,c,n)	(wmove(win,y,x) == ERR ? ERR : whline_set(win,c,n))
-#define mvwin_wch(win,y,x,c)		(wmove(win,y,x) == ERR ? ERR : win_wch(win,c))
-#define mvwin_wchnstr(win,y,x,c,n)	(wmove(win,y,x) == ERR ? ERR : win_wchnstr(win,c,n))
-#define mvwin_wchstr(win,y,x,c)		(wmove(win,y,x) == ERR ? ERR : win_wchstr(win,c))
-#define mvwinnwstr(win,y,x,c,n)		(wmove(win,y,x) == ERR ? ERR : winnwstr(win,c,n))
-#define mvwins_nwstr(win,y,x,t,n)	(wmove(win,y,x) == ERR ? ERR : wins_nwstr(win,t,n))
-#define mvwins_wch(win,y,x,c)		(wmove(win,y,x) == ERR ? ERR : wins_wch(win,c))
-#define mvwins_wstr(win,y,x,t)		(wmove(win,y,x) == ERR ? ERR : wins_wstr(win,t))
-#define mvwinwstr(win,y,x,c)		(wmove(win,y,x) == ERR ? ERR : winwstr(win,c))
-#define mvwvline_set(win,y,x,c,n)	(wmove(win,y,x) == ERR ? ERR : wvline_set(win,c,n))
+#define mvadd_wch(y,x,c)		mvwadd_wch(stdscr,(y),(x),(c))
+#define mvadd_wchnstr(y,x,s,n)		mvwadd_wchnstr(stdscr,(y),(x),(s),(n))
+#define mvadd_wchstr(y,x,s)		mvwadd_wchstr(stdscr,(y),(x),(s))
+#define mvaddnwstr(y,x,wstr,n)		mvwaddnwstr(stdscr,(y),(x),(wstr),(n))
+#define mvaddwstr(y,x,wstr)		mvwaddwstr(stdscr,(y),(x),(wstr))
+#define mvget_wch(y,x,c)		mvwget_wch(stdscr,(y),(x),(c))
+#define mvget_wstr(y,x,t)		mvwget_wstr(stdscr,(y),(x),(t))
+#define mvgetn_wstr(y,x,t,n)		mvwgetn_wstr(stdscr,(y),(x),(t),(n))
+#define mvhline_set(y,x,c,n)		mvwhline_set(stdscr,(y),(x),(c),(n))
+#define mvin_wch(y,x,c)			mvwin_wch(stdscr,(y),(x),(c))
+#define mvin_wchnstr(y,x,c,n)		mvwin_wchnstr(stdscr,(y),(x),(c),(n))
+#define mvin_wchstr(y,x,c)		mvwin_wchstr(stdscr,(y),(x),(c))
+#define mvinnwstr(y,x,c,n)		mvwinnwstr(stdscr,(y),(x),(c),(n))
+#define mvins_nwstr(y,x,t,n)		mvwins_nwstr(stdscr,(y),(x),(t),(n))
+#define mvins_wch(y,x,c)		mvwins_wch(stdscr,(y),(x),(c))
+#define mvins_wstr(y,x,t)		mvwins_wstr(stdscr,(y),(x),(t))
+#define mvinwstr(y,x,c)			mvwinwstr(stdscr,(y),(x),(c))
+#define mvvline_set(y,x,c,n)		mvwvline_set(stdscr,(y),(x),(c),(n))
+
+#define mvwadd_wch(win,y,x,c)		(wmove(win,(y),(x)) == ERR ? ERR : wadd_wch((win),(c)))
+#define mvwadd_wchnstr(win,y,x,s,n)	(wmove(win,(y),(x)) == ERR ? ERR : wadd_wchnstr((win),(s),(n)))
+#define mvwadd_wchstr(win,y,x,s)	(wmove(win,(y),(x)) == ERR ? ERR : wadd_wchstr((win),(s)))
+#define mvwaddnwstr(win,y,x,wstr,n)	(wmove(win,(y),(x)) == ERR ? ERR : waddnwstr((win),(wstr),(n)))
+#define mvwaddwstr(win,y,x,wstr)	(wmove(win,(y),(x)) == ERR ? ERR : waddwstr((win),(wstr)))
+#define mvwget_wch(win,y,x,c)		(wmove(win,(y),(x)) == ERR ? ERR : wget_wch((win),(c)))
+#define mvwget_wstr(win,y,x,t)		(wmove(win,(y),(x)) == ERR ? ERR : wget_wstr((win),(t)))
+#define mvwgetn_wstr(win,y,x,t,n)	(wmove(win,(y),(x)) == ERR ? ERR : wgetn_wstr((win),(t),(n)))
+#define mvwhline_set(win,y,x,c,n)	(wmove(win,(y),(x)) == ERR ? ERR : whline_set((win),(c),(n)))
+#define mvwin_wch(win,y,x,c)		(wmove(win,(y),(x)) == ERR ? ERR : win_wch((win),(c)))
+#define mvwin_wchnstr(win,y,x,c,n)	(wmove(win,(y),(x)) == ERR ? ERR : win_wchnstr((win),(c),(n)))
+#define mvwin_wchstr(win,y,x,c)		(wmove(win,(y),(x)) == ERR ? ERR : win_wchstr((win),(c)))
+#define mvwinnwstr(win,y,x,c,n)		(wmove(win,(y),(x)) == ERR ? ERR : winnwstr((win),(c),(n)))
+#define mvwins_nwstr(win,y,x,t,n)	(wmove(win,(y),(x)) == ERR ? ERR : wins_nwstr((win),(t),(n)))
+#define mvwins_wch(win,y,x,c)		(wmove(win,(y),(x)) == ERR ? ERR : wins_wch((win),(c)))
+#define mvwins_wstr(win,y,x,t)		(wmove(win,(y),(x)) == ERR ? ERR : wins_wstr((win),(t)))
+#define mvwinwstr(win,y,x,c)		(wmove(win,(y),(x)) == ERR ? ERR : winwstr((win),(c)))
+#define mvwvline_set(win,y,x,c,n)	(wmove(win,(y),(x)) == ERR ? ERR : wvline_set((win),(c),(n)))
 
 #endif /* NCURSES_NOMACROS */
 
Index: include/headers
Prereq:  1.10 
--- ncurses-5.9/include/headers	2009-09-05 17:46:30.000000000 +0000
+++ ncurses-5.9-20130504/include/headers	2012-07-28 22:41:34.000000000 +0000
@@ -1,6 +1,6 @@
-# $Id: headers,v 1.10 2009/09/05 17:46:30 tom Exp $
+# $Id: headers,v 1.12 2012/07/28 22:41:34 Roumen.Petrov Exp $
 ##############################################################################
-# Copyright (c) 1998-2007,2009 Free Software Foundation, Inc.                #
+# Copyright (c) 1998-2009,2012 Free Software Foundation, Inc.                #
 #                                                                            #
 # Permission is hereby granted, free of charge, to any person obtaining a    #
 # copy of this software and associated documentation files (the "Software"), #
@@ -29,14 +29,23 @@
 #
 # Author: Thomas E. Dickey	1996-on
 #
-term.h
 curses.h
 unctrl.h
-termcap.h
 ncurses_dll.h
+
+# Support for termcap (and tic, etc.), which can be a separate library
+@ termlib
+term.h
+termcap.h
+
+# Headers used only for tic, other programs using internal interfaces
 @ ticlib
 $(srcdir)/tic.h
 $(srcdir)/term_entry.h
 $(srcdir)/nc_tparm.h
 
+# Porting
+@ port_win32con
+$(srcdir)/ncurses_mingw.h
+
 # vile:makemode
Index: include/nc_alloc.h
Prereq:  1.18 
--- ncurses-5.9/include/nc_alloc.h	2010-11-20 22:59:49.000000000 +0000
+++ ncurses-5.9-20130504/include/nc_alloc.h	2013-01-26 21:56:51.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -29,10 +29,11 @@
 /****************************************************************************
  *  Author: Thomas E. Dickey                    1996-on                     *
  ****************************************************************************/
-/* $Id: nc_alloc.h,v 1.18 2010/11/20 22:59:49 tom Exp $ */
+/* $Id: nc_alloc.h,v 1.22 2013/01/26 21:56:51 tom Exp $ */
 
 #ifndef NC_ALLOC_included
 #define NC_ALLOC_included 1
+/* *INDENT-OFF* */
 
 #ifdef __cplusplus
 extern "C" {
@@ -94,6 +95,7 @@
 /* doalloc.c */
 extern NCURSES_EXPORT(void *) _nc_doalloc(void *, size_t);
 #if !HAVE_STRDUP
+#undef strdup
 #define strdup _nc_strdup
 extern NCURSES_EXPORT(char *) _nc_strdup(const char *);
 #endif
@@ -101,12 +103,14 @@
 /* entries.c */
 extern NCURSES_EXPORT(void) _nc_leaks_tinfo(void);
 
-#define typeMalloc(type,elts) (type *)malloc((elts)*sizeof(type))
-#define typeCalloc(type,elts) (type *)calloc((elts),sizeof(type))
-#define typeRealloc(type,elts,ptr) (type *)_nc_doalloc(ptr, (elts)*sizeof(type))
+#define typeMalloc(type,elts) (type *)malloc((size_t)(elts)*sizeof(type))
+#define typeCalloc(type,elts) (type *)calloc((size_t)(elts),sizeof(type))
+#define typeRealloc(type,elts,ptr) (type *)_nc_doalloc(ptr, (size_t)(elts)*sizeof(type))
 
 #ifdef __cplusplus
 }
 #endif
 
+/* *INDENT-ON* */
+
 #endif /* NC_ALLOC_included */
Index: include/nc_string.h
--- /dev/null	2013-05-05 10:34:48.558701642 +0000
+++ ncurses-5.9-20130504/include/nc_string.h	2012-02-23 10:21:17.000000000 +0000
@@ -0,0 +1,77 @@
+/****************************************************************************
+ * Copyright (c) 2012 Free Software Foundation, Inc.                        *
+ *                                                                          *
+ * Permission is hereby granted, free of charge, to any person obtaining a  *
+ * copy of this software and associated documentation files (the            *
+ * "Software"), to deal in the Software without restriction, including      *
+ * without limitation the rights to use, copy, modify, merge, publish,      *
+ * distribute, distribute with modifications, sublicense, and/or sell       *
+ * copies of the Software, and to permit persons to whom the Software is    *
+ * furnished to do so, subject to the following conditions:                 *
+ *                                                                          *
+ * The above copyright notice and this permission notice shall be included  *
+ * in all copies or substantial portions of the Software.                   *
+ *                                                                          *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
+ * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
+ *                                                                          *
+ * Except as contained in this notice, the name(s) of the above copyright   *
+ * holders shall not be used in advertising or otherwise to promote the     *
+ * sale, use or other dealings in this Software without prior written       *
+ * authorization.                                                           *
+ ****************************************************************************/
+
+/****************************************************************************
+ *  Author: Thomas E. Dickey                        2012                    *
+ ****************************************************************************/
+
+#ifndef STRING_HACKS_H
+#define STRING_HACKS_H 1
+
+#include <ncurses_cfg.h>
+
+/*
+ * $Id: nc_string.h,v 1.3 2012/02/23 10:21:17 tom Exp $
+ *
+ * String-hacks.  Use these macros to stifle warnings on (presumably) correct
+ * uses of strcat, strcpy and sprintf.
+ *
+ * By the way -
+ * A fundamental limitation of the interfaces (and frequent issue in bug
+ * reports using these functions) is that sizes are passed as unsigned values
+ * (with associated sign-extension problems), limiting their effectiveness
+ * when checking for buffer overflow.
+ */
+
+#ifdef __cplusplus
+#define NCURSES_VOID /* nothing */
+#else
+#define NCURSES_VOID (void)
+#endif
+
+#if USE_STRING_HACKS && HAVE_STRLCAT
+#define _nc_STRCAT(d,s,n)	NCURSES_VOID strlcat((d),(s),(n))
+#else
+#define _nc_STRCAT(d,s,n)	NCURSES_VOID strcat((d),(s))
+#endif
+
+#if USE_STRING_HACKS && HAVE_STRLCPY
+#define _nc_STRCPY(d,s,n)	NCURSES_VOID strlcpy((d),(s),(n))
+#else
+#define _nc_STRCPY(d,s,n)	NCURSES_VOID strcpy((d),(s))
+#endif
+
+#if USE_STRING_HACKS && HAVE_SNPRINTF
+#define _nc_SPRINTF             NCURSES_VOID snprintf
+#define _nc_SLIMIT(n)           (n),
+#else
+#define _nc_SPRINTF             NCURSES_VOID sprintf
+#define _nc_SLIMIT(n)		/* nothing */
+#endif
+
+#endif /* STRING_HACKS_H */
Index: include/nc_termios.h
--- /dev/null	2013-05-05 10:34:48.558701642 +0000
+++ ncurses-5.9-20130504/include/nc_termios.h	2011-06-25 20:44:05.000000000 +0000
@@ -0,0 +1,171 @@
+/****************************************************************************
+ * Copyright (c) 2011 Free Software Foundation, Inc.                        *
+ *                                                                          *
+ * Permission is hereby granted, free of charge, to any person obtaining a  *
+ * copy of this software and associated documentation files (the            *
+ * "Software"), to deal in the Software without restriction, including      *
+ * without limitation the rights to use, copy, modify, merge, publish,      *
+ * distribute, distribute with modifications, sublicense, and/or sell       *
+ * copies of the Software, and to permit persons to whom the Software is    *
+ * furnished to do so, subject to the following conditions:                 *
+ *                                                                          *
+ * The above copyright notice and this permission notice shall be included  *
+ * in all copies or substantial portions of the Software.                   *
+ *                                                                          *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
+ * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
+ *                                                                          *
+ * Except as contained in this notice, the name(s) of the above copyright   *
+ * holders shall not be used in advertising or otherwise to promote the     *
+ * sale, use or other dealings in this Software without prior written       *
+ * authorization.                                                           *
+ ****************************************************************************/
+
+/****************************************************************************
+ *  Author: Thomas E. Dickey                        2011                    *
+ ****************************************************************************/
+
+/* $Id: nc_termios.h,v 1.2 2011/06/25 20:44:05 tom Exp $ */
+
+#ifndef NC_TERMIOS_included
+#define NC_TERMIOS_included 1
+
+#if HAVE_TERMIOS_H && HAVE_TCGETATTR
+
+#else /* !HAVE_TERMIOS_H */
+
+#if HAVE_TERMIO_H
+
+/* Add definitions to make termio look like termios.
+ * But ifdef it, since there are some implementations
+ * that try to do this for us in a fake <termio.h>.
+ */
+#ifndef TCSADRAIN
+#define TCSADRAIN TCSETAW
+#endif
+#ifndef TCSAFLUSH
+#define TCSAFLUSH TCSETAF
+#endif
+#ifndef tcsetattr
+#define tcsetattr(fd, cmd, arg) ioctl(fd, cmd, arg)
+#endif
+#ifndef tcgetattr
+#define tcgetattr(fd, arg) ioctl(fd, TCGETA, arg)
+#endif
+#ifndef cfgetospeed
+#define cfgetospeed(t) ((t)->c_cflag & CBAUD)
+#endif
+#ifndef TCIFLUSH
+#define TCIFLUSH 0
+#endif
+#ifndef tcflush
+#define tcflush(fd, arg) ioctl(fd, TCFLSH, arg)
+#endif
+
+#else /* !HAVE_TERMIO_H */
+
+#if __MINGW32__
+
+/* c_cc chars */
+#define VINTR     0
+#define VQUIT     1
+#define VERASE    2
+#define VKILL     3
+#define VEOF      4
+#define VTIME     5
+#define VMIN      6
+
+/* c_iflag bits */
+#define ISTRIP	0000040
+#define INLCR	0000100
+#define IGNCR	0000200
+#define ICRNL	0000400
+#define BRKINT	0000002
+#define PARMRK	0000010
+#define IXON	0002000
+#define IGNBRK	0000001
+#define IGNPAR	0000004
+#define INPCK	0000020
+#define IXOFF	0010000
+
+/* c_oflag bits */
+#define OPOST	0000001
+
+/* c_cflag bit meaning */
+#define CBAUD	   0010017
+#define CSIZE	   0000060
+#define CS8	   0000060
+#define B0	   0000000
+#define B50	   0000001
+#define B75	   0000002
+#define B110	   0000003
+#define B134	   0000004
+#define B150	   0000005
+#define B200	   0000006
+#define B300	   0000007
+#define B600	   0000010
+#define B1200	   0000011
+#define B1800	   0000012
+#define B2400	   0000013
+#define B4800	   0000014
+#define B9600	   0000015
+#define CLOCAL	   0004000
+#define CREAD	   0000200
+#define CSTOPB	   0000100
+#define HUPCL	   0002000
+#define PARENB	   0000400
+#define PARODD	   0001000
+
+/* c_lflag bits */
+#define ECHO	0000010
+#define ECHONL	0000100
+#define ISIG	0000001
+#define IEXTEN	0100000
+#define ICANON	0000002
+#define NOFLSH	0000200
+#define ECHOE	0000020
+#define ECHOK	0000040
+
+/* tcflush() */
+#define	TCIFLUSH	0
+
+/* tcsetattr uses these */
+#define	TCSADRAIN	1
+
+/* ioctls */
+#define TCGETA		0x5405
+#define TCFLSH		0x540B
+#define TIOCGWINSZ	0x5413
+
+#ifndef cfgetospeed
+#define cfgetospeed(t) ((t)->c_cflag & CBAUD)
+#endif
+
+#ifndef tcsetattr
+#define tcsetattr(fd, cmd, arg) _nc_mingw_ioctl(fd, cmd, arg)
+#endif
+
+#ifndef tcgetattr
+#define tcgetattr(fd, arg) _nc_mingw_ioctl(fd, TCGETA, arg)
+#endif
+
+#ifndef tcflush
+#define tcflush(fd, arg) _nc_mingw_ioctl(fd, TCFLSH, arg)
+#endif
+
+#undef  ttyname
+#define ttyname(fd) NULL
+
+#else
+
+#endif /* __MINGW32__ */
+#endif /* HAVE_TERMIO_H */
+
+#endif /* HAVE_TERMIOS_H */
+
+#endif /* NC_TERMIOS_included */
Index: include/nc_tparm.h
Prereq:  1.5 
--- ncurses-5.9/include/nc_tparm.h	2010-12-25 20:27:22.000000000 +0000
+++ ncurses-5.9-20130504/include/nc_tparm.h	2012-02-18 21:34:42.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 2006,2010 Free Software Foundation, Inc.                   *
+ * Copyright (c) 2006-2010,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -30,7 +30,7 @@
  *  Author: Thomas E. Dickey                        2006                    *
  ****************************************************************************/
 
-/* $Id: nc_tparm.h,v 1.5 2010/12/25 20:27:22 tom Exp $ */
+/* $Id: nc_tparm.h,v 1.6 2012/02/18 21:34:42 tom Exp $ */
 
 #ifndef NC_TPARM_included
 #define NC_TPARM_included 1
@@ -40,8 +40,12 @@
  * assumption of the varargs code.
  */
 #ifndef TPARM_ARG
+#ifdef NCURSES_TPARM_ARG
+#define TPARM_ARG NCURSES_TPARM_ARG
+#else
 #define TPARM_ARG long
 #endif
+#endif /* TPARAM_ARG */
 
 #define TPARM_N(n) (TPARM_ARG)(n)
 
Index: include/ncurses_defs
Prereq:  1.46 
--- ncurses-5.9/include/ncurses_defs	2011-03-22 09:17:59.000000000 +0000
+++ ncurses-5.9-20130504/include/ncurses_defs	2013-04-27 19:46:53.000000000 +0000
@@ -1,6 +1,6 @@
-# $Id: ncurses_defs,v 1.46 2011/03/22 09:17:59 tom Exp $
+# $Id: ncurses_defs,v 1.59 2013/04/27 19:46:53 tom Exp $
 ##############################################################################
-# Copyright (c) 2000-2010,2011 Free Software Foundation, Inc.                #
+# Copyright (c) 2000-2012,2013 Free Software Foundation, Inc.                #
 #                                                                            #
 # Permission is hereby granted, free of charge, to any person obtaining a    #
 # copy of this software and associated documentation files (the "Software"), #
@@ -33,7 +33,7 @@
 
 BROKEN_LINKER
 BSD_TPUTS
-CC_HAS_PROTOS
+CGETENT_CONST	/* nothing */
 CPP_HAS_PARAM_INIT
 CURSES_ACS_ARRAY	acs_map
 CURSES_WACS_ARRAY	_nc_wacs
@@ -41,6 +41,7 @@
 ETIP_NEEDS_MATH_H
 GCC_NORETURN	/* nothing */
 GCC_UNUSED	/* nothing */
+HAVE_ASSUME_DEFAULT_COLORS
 HAVE_BIG_CORE
 HAVE_BSD_CGETENT
 HAVE_BSD_SIGNAL_H
@@ -102,6 +103,7 @@
 HAVE_POLL
 HAVE_POLL_H
 HAVE_PURIFY
+HAVE_PUTENV
 HAVE_PUTWC 
 HAVE_PUTWIN	1
 HAVE_REGEXPR_H_FUNCS
@@ -115,6 +117,7 @@
 HAVE_SELECT
 HAVE_SETBUF
 HAVE_SETBUFFER
+HAVE_SETENV
 HAVE_SETUPTERM	1
 HAVE_SETVBUF
 HAVE_SGTTY_H
@@ -123,7 +126,11 @@
 HAVE_SIZECHANGE
 HAVE_SLK_COLOR
 HAVE_SLK_INIT	1
+HAVE_SNPRINTF
+HAVE_STDINT_H
 HAVE_STRDUP
+HAVE_STRLCAT
+HAVE_STRLCPY
 HAVE_STRSTR
 HAVE_SYMLINK
 HAVE_SYS_BSDTYPES_H
@@ -153,9 +160,12 @@
 HAVE_TYPEINFO
 HAVE_TYPE_ATTR_T
 HAVE_TYPE_SIGACTION
+HAVE_UNCTRL_H	1
 HAVE_UNISTD_H
 HAVE_UNLINK
 HAVE_USE_DEFAULT_COLORS
+HAVE_USE_SCREEN
+HAVE_USE_WINDOW
 HAVE_VFSCANF
 HAVE_VSNPRINTF
 HAVE_VSSCANF
@@ -176,10 +186,10 @@
 NCURSES_EXT_FUNCS
 NCURSES_NO_PADDING
 NCURSES_PATHSEP	':'
+NCURSES_WIDECHAR
 NEED_PTEM_H
 NO_LEAKS
 PURE_TERMINFO
-RETSIGTYPE
 STDC_HEADERS
 SVR4_ACTION
 SVR4_TERMIO
@@ -205,6 +215,7 @@
 USE_SAFE_SPRINTF
 USE_SCROLL_HINTS
 USE_SIGWINCH
+USE_STRING_HACKS
 USE_SYMLINKS
 USE_SYSMOUSE
 USE_TERMCAP
Index: include/ncurses_mingw.h
Prereq:  1.1 
--- ncurses-5.9/include/ncurses_mingw.h	2008-12-14 19:22:16.000000000 +0000
+++ ncurses-5.9-20130504/include/ncurses_mingw.h	2011-06-25 20:51:00.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2008,2011 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -31,10 +31,10 @@
  *                                                                          *
  ****************************************************************************/
 
-/* $Id: ncurses_mingw.h,v 1.1 2008/12/14 19:22:16 juergen Exp $ */
+/* $Id: ncurses_mingw.h,v 1.2 2011/06/25 20:51:00 tom Exp $ */
 
 /*
- * This is a placholder up to now and describes what needs to be implemented
+ * This is a placeholder up to now and describes what needs to be implemented
  * to support I/O to external terminals with ncurses on the Windows OS.
  */
 
@@ -67,98 +67,8 @@
   speed_t    c_ospeed;    /* c_ospeed           */
 };
 
-/* c_cc chars */
-#define VINTR     0
-#define VQUIT     1
-#define VERASE    2
-#define VKILL     3
-#define VEOF      4
-#define VTIME     5
-#define VMIN      6
-
-/* c_iflag bits */
-#define ISTRIP	0000040
-#define INLCR	0000100
-#define IGNCR	0000200
-#define ICRNL	0000400
-#define BRKINT	0000002
-#define PARMRK	0000010
-#define IXON	0002000
-#define IGNBRK	0000001
-#define IGNPAR	0000004
-#define INPCK	0000020
-#define IXOFF	0010000
-
-/* c_oflag bits */
-#define OPOST	0000001
-
-/* c_cflag bit meaning */
-#define CBAUD	   0010017
-#define CSIZE	   0000060
-#define CS8	   0000060
-#define B0	   0000000
-#define B50	   0000001
-#define B75	   0000002
-#define B110	   0000003
-#define B134	   0000004
-#define B150	   0000005
-#define B200	   0000006
-#define B300	   0000007
-#define B600	   0000010
-#define B1200	   0000011
-#define B1800	   0000012
-#define B2400	   0000013
-#define B4800	   0000014
-#define B9600	   0000015
-#define CLOCAL	   0004000
-#define CREAD	   0000200
-#define CSTOPB	   0000100
-#define HUPCL	   0002000
-#define PARENB	   0000400
-#define PARODD	   0001000
-
-/* c_lflag bits */
-#define ECHO	0000010
-#define ECHONL	0000100
-#define ISIG	0000001
-#define IEXTEN	0100000
-#define ICANON	0000002
-#define NOFLSH	0000200
-#define ECHOE	0000020
-#define ECHOK	0000040
-
-/* tcflush() */
-#define	TCIFLUSH	0
-
-/* tcsetattr uses these */
-#define	TCSADRAIN	1
-
-/* ioctls */
-#define TCGETA		0x5405
-#define TCFLSH		0x540B
-#define TIOCGWINSZ	0x5413
-
 extern int _nc_mingw_ioctl(int fd, long int request, struct termios* arg);
 extern void _nc_set_term_driver(void* term);
 
-#ifndef cfgetospeed
-#define cfgetospeed(t) ((t)->c_cflag & CBAUD)
-#endif
-
-#ifndef tcsetattr
-#define tcsetattr(fd, cmd, arg) _nc_mingw_ioctl(fd, cmd, arg)
-#endif
-
-#ifndef tcgetattr
-#define tcgetattr(fd, arg) _nc_mingw_ioctl(fd, TCGETA, arg)
-#endif
-
-#ifndef tcflush
-#define tcflush(fd, arg) _nc_mingw_ioctl(fd, TCFLSH, arg)
-#endif
-
-#undef  ttyname
-#define ttyname(fd) NULL
-
-#endif
-#endif
+#endif /* _NC_MINGWH */
+#endif /* __MINGW32__ */
Index: include/term_entry.h
Prereq:  1.37 
--- ncurses-5.9/include/term_entry.h	2009-07-11 16:52:29.000000000 +0000
+++ ncurses-5.9-20130504/include/term_entry.h	2013-02-02 20:07:23.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2008,2009 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -32,7 +32,7 @@
  *     and: Thomas E. Dickey                        1998-on                 *
  ****************************************************************************/
 
-/* $Id: term_entry.h,v 1.37 2009/07/11 16:52:29 tom Exp $ */
+/* $Id: term_entry.h,v 1.43 2013/02/02 20:07:23 tom Exp $ */
 
 /*
  *	term_entry.h -- interface to entry-manipulation code
@@ -47,28 +47,46 @@
 
 #include <term.h>
 
+    /*
+     * see db_iterator.c - this enumeration lists the places searched for a
+     * terminal description and defines the order in which they are searched.
+     */
+    typedef enum {
+	dbdTIC = 0,		/* special, used by tic when writing entry */
+#if USE_DATABASE
+	dbdEnvOnce,		/* the $TERMINFO environment variable */
+	dbdHome,		/* $HOME/.terminfo */
+	dbdEnvList,		/* the $TERMINFO_DIRS environment variable */
+	dbdCfgList,		/* the compiled-in TERMINFO_DIRS value */
+	dbdCfgOnce,		/* the compiled-in TERMINFO value */
+#endif
+#if USE_TERMCAP
+	dbdEnvOnce2,		/* the $TERMCAP environment variable */
+	dbdEnvList2,		/* the $TERMPATH environment variable */
+	dbdCfgList2,		/* the compiled-in TERMPATH */
+#endif
+	dbdLAST
+    } DBDIRS;
+
 #define MAX_USES	32
 #define MAX_CROSSLINKS	16
 
-typedef struct entry {
-	TERMTYPE	tterm;
-	unsigned	nuses;
-	struct
-        {
-	    char		*name;
-	    struct entry	*link;
-	    long		line;
-        }
-	uses[MAX_USES];
-	int		ncrosslinks;
-	struct entry	*crosslinks[MAX_CROSSLINKS];
-	long		cstart, cend;
-	long		startline;
-	struct entry	*next;
-	struct entry	*last;
-}
-ENTRY;
-
+    typedef struct entry {
+	TERMTYPE tterm;
+	unsigned nuses;
+	struct {
+	    char *name;
+	    struct entry *link;
+	    long line;
+	} uses[MAX_USES];
+	int ncrosslinks;
+	struct entry *crosslinks[MAX_CROSSLINKS];
+	long cstart, cend;
+	long startline;
+	struct entry *next;
+	struct entry *last;
+    } ENTRY;
+/* *INDENT-OFF* */
 #if NCURSES_XNAMES
 #define NUM_BOOLEANS(tp) (tp)->num_Booleans
 #define NUM_NUMBERS(tp)  (tp)->num_Numbers
@@ -132,7 +150,7 @@
 
 /* alloc_ttype.c: elementary allocation code */
 extern NCURSES_EXPORT(void) _nc_align_termtype (TERMTYPE *, TERMTYPE *);
-extern NCURSES_EXPORT(void) _nc_copy_termtype (TERMTYPE *, TERMTYPE *);
+extern NCURSES_EXPORT(void) _nc_copy_termtype (TERMTYPE *, const TERMTYPE *);
 
 /* free_ttype.c: elementary allocation code */
 extern NCURSES_EXPORT(void) _nc_free_termtype (TERMTYPE *);
@@ -166,9 +184,9 @@
 
 /* trace_xnames.c */
 extern NCURSES_EXPORT(void) _nc_trace_xnames (TERMTYPE *);
+/* *INDENT-ON* */
 
 #ifdef __cplusplus
 }
 #endif
-
-#endif /* NCURSES_TERM_ENTRY_H_incl */
+#endif				/* NCURSES_TERM_ENTRY_H_incl */
Index: include/tic.h
Prereq:  1.65 
--- ncurses-5.9/include/tic.h	2009-08-08 17:52:46.000000000 +0000
+++ ncurses-5.9-20130504/include/tic.h	2012-03-17 18:22:10.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2007,2009 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -33,14 +33,14 @@
  ****************************************************************************/
 
 /*
- * $Id: tic.h,v 1.65 2009/08/08 17:52:46 tom Exp $
+ * $Id: tic.h,v 1.69 2012/03/17 18:22:10 tom Exp $
  *	tic.h - Global variables and structures for the terminfo
  *			compiler.
  */
 
 #ifndef __TIC_H
 #define __TIC_H
-
+/* *INDENT-OFF* */
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -224,6 +224,12 @@
 
 #define NOTFOUND	((struct name_table_entry *) 0)
 
+/*
+ * The casts are required for correct sign-propagation with systems such as
+ * AIX, IRIX64, Solaris which default to unsigned characters.  The C standard
+ * leaves this detail unspecified.
+ */
+
 /* out-of-band values for representing absent capabilities */
 #define ABSENT_BOOLEAN		((signed char)-1)	/* 255 */
 #define ABSENT_NUMERIC		(-1)
@@ -248,6 +254,8 @@
 #define TERMINFO "/usr/share/terminfo"
 #endif
 
+#ifdef NCURSES_TERM_ENTRY_H_incl
+
 /* access.c */
 extern NCURSES_EXPORT(unsigned) _nc_pathlast (const char *);
 extern NCURSES_EXPORT(bool) _nc_is_abs_path (const char *);
@@ -270,6 +278,7 @@
 extern NCURSES_EXPORT_VAR(int) _nc_curr_col;
 extern NCURSES_EXPORT_VAR(int) _nc_curr_line;
 extern NCURSES_EXPORT_VAR(int) _nc_syntax;
+extern NCURSES_EXPORT_VAR(int) _nc_strict_bsd;
 extern NCURSES_EXPORT_VAR(long) _nc_comment_end;
 extern NCURSES_EXPORT_VAR(long) _nc_comment_start;
 extern NCURSES_EXPORT_VAR(long) _nc_curr_file_pos;
@@ -314,23 +323,6 @@
 extern const char * _nc_progname;
 
 /* db_iterator.c */
-typedef enum {
-    dbdTIC = 0,
-#if USE_DATABASE
-    dbdEnvOnce,
-    dbdHome,
-    dbdEnvList,
-    dbdCfgList,
-    dbdCfgOnce,
-#endif
-#if USE_TERMCAP
-    dbdEnvOnce2,
-    dbdEnvList2,
-    dbdCfgList2,
-#endif
-    dbdLAST
-} DBDIRS;
-
 extern NCURSES_EXPORT(const char *) _nc_next_db(DBDIRS *, int *);
 extern NCURSES_EXPORT(const char *) _nc_tic_dir (const char *);
 extern NCURSES_EXPORT(void) _nc_first_db(DBDIRS *, int *);
@@ -339,8 +331,11 @@
 /* write_entry.c */
 extern NCURSES_EXPORT(int) _nc_tic_written (void);
 
+#endif /* NCURSES_TERM_ENTRY_H_incl */
+
 #ifdef __cplusplus
 }
 #endif
 
+/* *INDENT-ON* */
 #endif /* __TIC_H */
Index: man/Makefile.in
Prereq:  1.45 
--- ncurses-5.9/man/Makefile.in	2010-11-27 21:45:27.000000000 +0000
+++ ncurses-5.9-20130504/man/Makefile.in	2012-08-11 21:31:56.000000000 +0000
@@ -1,4 +1,4 @@
-# $Id: Makefile.in,v 1.45 2010/11/27 21:45:27 tom Exp $
+# $Id: Makefile.in,v 1.46 2012/08/11 21:31:56 tom Exp $
 ##############################################################################
 # Copyright (c) 1998-2007,2010 Free Software Foundation, Inc.                #
 #                                                                            #
@@ -41,6 +41,7 @@
 srcdir		= @srcdir@
 prefix		= @prefix@
 exec_prefix	= @exec_prefix@
+datarootdir	= @datarootdir@
 datadir		= @datadir@
 mandir		= @mandir@
 
Index: man/curs_add_wch.3x
Prereq:  1.14 
--- ncurses-5.9/man/curs_add_wch.3x	2011-01-15 15:27:43.000000000 +0000
+++ ncurses-5.9-20130504/man/curs_add_wch.3x	2012-11-03 23:03:59.000000000 +0000
@@ -1,5 +1,5 @@
 .\"***************************************************************************
-.\" Copyright (c) 2001-2010,2011 Free Software Foundation, Inc.              *
+.\" Copyright (c) 2001-2011,2012 Free Software Foundation, Inc.              *
 .\"                                                                          *
 .\" Permission is hereby granted, free of charge, to any person obtaining a  *
 .\" copy of this software and associated documentation files (the            *
@@ -26,7 +26,7 @@
 .\" authorization.                                                           *
 .\"***************************************************************************
 .\"
-.\" $Id: curs_add_wch.3x,v 1.14 2011/01/15 15:27:43 tom Exp $
+.\" $Id: curs_add_wch.3x,v 1.15 2012/11/03 23:03:59 tom Exp $
 .TH curs_add_wch 3X ""
 .de bP
 .IP \(bu 4
@@ -176,7 +176,7 @@
 WACS_D_VLINE	0x2551	|	double vertical line
 WACS_D_PLUS	0x256c	+	double large plus or crossover
 .TE
-.SH RETURN VALUES
+.SH RETURN VALUE
 .PP
 All routines return the integer \fBERR\fR upon failure and \fBOK\fR on success.
 .PP
Index: man/curs_add_wchstr.3x
Prereq:  1.9 
--- ncurses-5.9/man/curs_add_wchstr.3x	2010-12-04 18:36:44.000000000 +0000
+++ ncurses-5.9-20130504/man/curs_add_wchstr.3x	2012-11-03 22:54:43.000000000 +0000
@@ -1,5 +1,5 @@
 .\"***************************************************************************
-.\" Copyright (c) 2002-2005,2010 Free Software Foundation, Inc.              *
+.\" Copyright (c) 2002-2010,2012 Free Software Foundation, Inc.              *
 .\"                                                                          *
 .\" Permission is hereby granted, free of charge, to any person obtaining a  *
 .\" copy of this software and associated documentation files (the            *
@@ -26,8 +26,13 @@
 .\" authorization.                                                           *
 .\"***************************************************************************
 .\"
-.\" $Id: curs_add_wchstr.3x,v 1.9 2010/12/04 18:36:44 tom Exp $
+.\" $Id: curs_add_wchstr.3x,v 1.10 2012/11/03 22:54:43 tom Exp $
 .TH curs_add_wchstr 3X ""
+.de bP
+.IP \(bu 4
+..
+.na
+.hy 0
 .SH NAME
 \fBadd_wchstr\fR,
 \fBadd_wchnstr\fR,
@@ -37,10 +42,12 @@
 \fBmvadd_wchnstr\fR,
 \fBmvwadd_wchstr\fR,
 \fBmvwadd_wchnstr\fR \- add an array of complex characters (and attributes) to a curses window
+.ad
+.hy
 .SH SYNOPSIS
-.B #include <curses.h>
-.PP
 .nf
+\fB#include <curses.h>\fR
+.PP
 \fBint add_wchstr(const cchar_t *\fR\fIwchstr\fR\fB);\fR
 .br
 \fBint add_wchnstr(const cchar_t *\fR\fIwchstr\fR\fB, int \fR\fIn\fR\fB);\fR
@@ -58,38 +65,53 @@
 \fBint mvwadd_wchnstr(WINDOW *\fR\fIwin\fR\fB, int \fR\fIy\fR\fB, int \fR\fIx\fR\fB, const cchar_t *\fR\fIwchstr\fR\fB, int \fR\fIn\fR\fB);\fR
 .fi
 .SH DESCRIPTION
-These routines copy the array of complex characters \fIwchstr\fR
-into the window image structure at and after the current cursor position.
-The four routines with \fIn\fR as the last
-argument copy at most \fIn\fR elements, but no more than will fit on the line.
+These functions copy the (null-terminated)
+array of complex characters \fIwchstr\fR
+into the window image structure
+starting at the current cursor position.
+The four functions with \fIn\fR as the last
+argument copy at most \fIn\fR elements,
+but no more than will fit on the line.
 If \fBn\fR=\fB\-1\fR then the whole array is copied,
 to the maximum number of characters that will fit on the line.
 .PP
 The window cursor is \fInot\fR advanced.
-These routines work faster than \fBwaddnstr\fR.
-On the other hand, they do not perform checking
+These functions work faster than \fBwaddnstr\fR.
+On the other hand:
+.bP
+they do not perform checking
 (such as for the newline, backspace, or carriage return characters),
+.bP
 they do not advance the current cursor position,
-they do not expand other control characters to ^-escapes,
-and they truncate the string if it crosses the right margin,
+.bP
+they do not expand other control characters to ^-escapes, and
+.bP
+they truncate the string if it crosses the right margin,
 rather than wrapping it around to the new line.
 .PP
-These routines end successfully
+These functions end successfully
 on encountering a null \fIcchar_t\fR, or
 when they have filled the current line.
 If a complex character cannot completely fit at the end of the current line,
 the remaining columns are filled with the background character and rendition.
-.SH NOTES
-All functions except \fBwadd_wchnstr\fR may be macros.
-.SH RETURN VALUES
-All routines return the integer \fBERR\fR upon failure and \fBOK\fR on success.
+.SH RETURN VALUE
+All functions return the integer \fBERR\fR upon failure and \fBOK\fR on success.
+.PP
+X/Open does not define any error conditions.
+This implementation returns an error
+if the window pointer is null.
 .PP
 Functions with a "mv" prefix first perform a cursor movement using
 \fBwmove\fP, and return an error if the position is outside the window,
 or if the window pointer is null.
+.SH NOTES
+All functions except \fBwadd_wchnstr\fR may be macros.
 .SH PORTABILITY
-All these entry points are described in the XSI Curses standard, Issue 4.
+These entry points are described in the XSI Curses standard, Issue 4.
 .SH SEE ALSO
-\fBcurses\fR(3X),
-\fBcurs_addchstr\fR(3X),
-\fBcurs_addwstr\fR(3X)
+\fBcurs_addwstr\fR(3X),
+\fBcurses\fR(3X).
+.PP
+Comparable functions in the narrow-character (ncurses) library are
+described in
+\fBcurs_addchstr\fR(3X).
Index: man/curs_addchstr.3x
Prereq:  1.15 
--- ncurses-5.9/man/curs_addchstr.3x	2010-12-04 18:36:44.000000000 +0000
+++ ncurses-5.9-20130504/man/curs_addchstr.3x	2012-11-03 22:54:43.000000000 +0000
@@ -1,5 +1,5 @@
 .\"***************************************************************************
-.\" Copyright (c) 1998-2006,2010 Free Software Foundation, Inc.              *
+.\" Copyright (c) 1998-2010,2012 Free Software Foundation, Inc.              *
 .\"                                                                          *
 .\" Permission is hereby granted, free of charge, to any person obtaining a  *
 .\" copy of this software and associated documentation files (the            *
@@ -26,8 +26,11 @@
 .\" authorization.                                                           *
 .\"***************************************************************************
 .\"
-.\" $Id: curs_addchstr.3x,v 1.15 2010/12/04 18:36:44 tom Exp $
+.\" $Id: curs_addchstr.3x,v 1.16 2012/11/03 22:54:43 tom Exp $
 .TH curs_addchstr 3X ""
+.de bP
+.IP \(bu 4
+..
 .na
 .hy 0
 .SH NAME
@@ -42,6 +45,7 @@
 .ad
 .hy
 .SH SYNOPSIS
+.nf
 \fB#include <curses.h>\fR
 .PP
 \fBint addchstr(const chtype *chstr);\fR
@@ -59,24 +63,33 @@
 \fBint mvwaddchstr(WINDOW *win, int y, int x, const chtype *chstr);\fR
 .br
 \fBint mvwaddchnstr(WINDOW *win, int y, int x, const chtype *chstr, int n);\fR
+.fi
 .SH DESCRIPTION
-These routines copy \fIchstr\fR into the window image structure at and after
-the current cursor position.  The four routines with \fIn\fR as the last
-argument copy at most \fIn\fR elements, but no more than will fit on the line.
-If \fBn\fR=\fB\-1\fR then the whole string is copied, to the maximum number of
-characters that will fit on the line.
+These functions copy the (null-terminated)
+\fIchstr\fR array
+into the window image structure
+starting at the current cursor position.
+The four functions with \fIn\fR as the last
+argument copy at most \fIn\fR elements,
+but no more than will fit on the line.
+If \fBn\fR=\fB\-1\fR then the whole array is copied,
+to the maximum number of characters that will fit on the line.
 .PP
-The window cursor is \fInot\fR advanced, and these routines work faster than
-\fBwaddnstr\fR.  On the other hand, they do not perform any kind of checking
-(such as for the newline, backspace, or carriage return characters), they do not
-advance the current cursor position, they do not expand other control characters
-to ^-escapes, and they truncate the string if it crosses the right margin,
+The window cursor is \fInot\fR advanced.
+These functions work faster than \fBwaddnstr\fR.
+On the other hand:
+.bP
+they do not perform checking
+(such as for the newline, backspace, or carriage return characters),
+.bP
+they do not advance the current cursor position,
+.bP
+they do not expand other control characters to ^-escapes, and
+.bP
+they truncate the string if it crosses the right margin,
 rather than wrapping it around to the new line.
-.SH RETURN VALUES
-All routines return the integer \fBERR\fR upon failure and \fBOK\fR on success
-(the SVr4 manuals specify only "an integer value other than \fBERR\fR") upon
-successful completion, unless otherwise noted in the preceding routine
-descriptions.
+.SH RETURN VALUE
+All functions return the integer \fBERR\fR upon failure and \fBOK\fR on success.
 .PP
 X/Open does not define any error conditions.
 This implementation returns an error
@@ -86,10 +99,11 @@
 \fBwmove\fP, and return an error if the position is outside the window,
 or if the window pointer is null.
 .SH NOTES
-Note that all routines except \fBwaddchnstr\fR may be macros.
+All functions except \fBwaddchnstr\fR may be macros.
 .SH PORTABILITY
 These entry points are described in the XSI Curses standard, Issue 4.
 .SH SEE ALSO
+\fBcurs_addstr\fR(3X),
 \fBcurses\fR(3X).
 .PP
 Comparable functions in the wide-character (ncursesw) library are
Index: man/curs_addstr.3x
Prereq:  1.16 
--- ncurses-5.9/man/curs_addstr.3x	2010-12-04 18:36:44.000000000 +0000
+++ ncurses-5.9-20130504/man/curs_addstr.3x	2012-11-03 22:57:31.000000000 +0000
@@ -1,5 +1,5 @@
 .\"***************************************************************************
-.\" Copyright (c) 1998-2005,2010 Free Software Foundation, Inc.              *
+.\" Copyright (c) 1998-2010,2012 Free Software Foundation, Inc.              *
 .\"                                                                          *
 .\" Permission is hereby granted, free of charge, to any person obtaining a  *
 .\" copy of this software and associated documentation files (the            *
@@ -26,8 +26,11 @@
 .\" authorization.                                                           *
 .\"***************************************************************************
 .\"
-.\" $Id: curs_addstr.3x,v 1.16 2010/12/04 18:36:44 tom Exp $
+.\" $Id: curs_addstr.3x,v 1.17 2012/11/03 22:57:31 tom Exp $
 .TH curs_addstr 3X ""
+.de bP
+.IP \(bu 4
+..
 .na
 .hy 0
 .SH NAME
@@ -62,34 +65,37 @@
 \fBint mvwaddnstr(WINDOW *\fR\fIwin\fR\fB, int \fR\fIy\fR\fB, int \fR\fIx\fR\fB, const char *\fR\fIstr, int \fR\fIn\fR\fB);\fR
 .fi
 .SH DESCRIPTION
-These routines write the characters of the (null-terminated) character string
+These functions write the (null-terminated) character string
 \fIstr\fR on the given window.
 It is similar to calling \fBwaddch\fR once for each character in the string.
-The four routines with \fIn\fR as the last argument
-write at most \fIn\fR characters.
-If \fIn\fR is \-1, then the entire string will be added,
-up to the maximum number of characters that will fit on the line,
+.PP
+The \fImv\fR functions perform cursor movement once, before writing any
+characters.
+Thereafter, the cursor is advanced as a side-effect of writing to the window.
+.PP
+The four functions with \fIn\fR as the last argument
+write at most \fIn\fR characters,
 or until a terminating null is reached.
+If \fIn\fR is \-1, then the entire string will be added.
 .SH RETURN VALUE
-All routines return the integer \fBERR\fR upon failure and \fBOK\fR on success
-(the SVr4 manuals specify only "an integer value other than \fBERR\fR") upon
-successful completion.
+All functions return the integer \fBERR\fR upon failure and \fBOK\fR on success.
 .PP
 X/Open does not define any error conditions.
 This implementation returns an error
+.bP
 if the window pointer is null or
+.bP
 if the string pointer is null or
+.bP
 if the corresponding calls to \fBwaddch\fP return an error.
 .PP
 Functions with a "mv" prefix first perform a cursor movement using
 \fBwmove\fP, and return an error if the position is outside the window,
 or if the window pointer is null.
 .SH NOTES
-Note that all of these routines except \fBwaddstr\fR and \fBwaddnstr\fR may be
-macros.
+All of these functions except \fBwaddnstr\fR may be macros.
 .SH PORTABILITY
-All these entry points are described in the XSI Curses standard, Issue 4.  The
-XSI errors EILSEQ and EOVERFLOW, associated with extended-level conformance,
-are not yet detected.
+These functions are described in the XSI Curses standard, Issue 4.
 .SH SEE ALSO
-\fBcurses\fR(3X), \fBcurs_addch\fR(3X).
+\fBcurses\fR(3X),
+\fBcurs_addch\fR(3X).
Index: man/curs_addwstr.3x
Prereq:  1.10 
--- ncurses-5.9/man/curs_addwstr.3x	2010-12-04 18:36:44.000000000 +0000
+++ ncurses-5.9-20130504/man/curs_addwstr.3x	2012-11-03 22:57:31.000000000 +0000
@@ -1,5 +1,5 @@
 .\"***************************************************************************
-.\" Copyright (c) 2002-2006,2010 Free Software Foundation, Inc.              *
+.\" Copyright (c) 2002-2010,2012 Free Software Foundation, Inc.              *
 .\"                                                                          *
 .\" Permission is hereby granted, free of charge, to any person obtaining a  *
 .\" copy of this software and associated documentation files (the            *
@@ -26,8 +26,11 @@
 .\" authorization.                                                           *
 .\"***************************************************************************
 .\"
-.\" $Id: curs_addwstr.3x,v 1.10 2010/12/04 18:36:44 tom Exp $
+.\" $Id: curs_addwstr.3x,v 1.11 2012/11/03 22:57:31 tom Exp $
 .TH curs_addwstr 3X ""
+.de bP
+.IP \(bu 4
+..
 .na
 .hy 0
 .SH NAME
@@ -62,31 +65,39 @@
 \fBint mvwaddnwstr(WINDOW *\fR\fIwin\fR\fB, int \fR\fIy\fR\fB, int \fR\fIx\fR\fB, const wchar_t *\fR\fIwstr\fR\fB, int \fR\fIn\fR\fB);\fR
 .fi
 .SH DESCRIPTION
-These routines write the characters of the
+These functions write the characters of the
 (null-terminated) \fBwchar_t\fR character string
 \fIwstr\fR on the given window.
 It is similar to constructing a \fBcchar_t\fR for each wchar_t in the string,
 then calling \fBwadd_wch\fR for the resulting \fBcchar_t\fR.
 .PP
-The \fImv\fR routines perform cursor movement once, before writing any
+The \fImv\fR functions perform cursor movement once, before writing any
 characters.
 Thereafter, the cursor is advanced as a side-effect of writing to the window.
 .PP
-The four routines with \fIn\fR as the last argument
-write at most \fIn\fR \fBwchar_t\fR characters.
-If \fIn\fR is \-1, then the entire string will be added,
-up to the maximum number of characters that will fit on the line,
+The four functions with \fIn\fR as the last argument
+write at most \fIn\fR \fBwchar_t\fR characters,
 or until a terminating null is reached.
-.SH RETURN VALUES
-All routines return the integer \fBERR\fR upon failure and \fBOK\fR on success.
+If \fIn\fR is \-1, then the entire string will be added.
+.SH RETURN VALUE
+All functions return the integer \fBERR\fR upon failure and \fBOK\fR on success.
+.PP
+X/Open does not define any error conditions.
+This implementation returns an error
+.bP
+if the window pointer is null or
+.bP
+if the string pointer is null or
+.bP
+if the corresponding calls to \fBwadd_wch\fP return an error.
 .PP
 Functions with a "mv" prefix first perform a cursor movement using
 \fBwmove\fP, and return an error if the position is outside the window,
 or if the window pointer is null.
 .SH NOTES
-Note that all of these routines except \fBwaddnwstr\fR may be macros.
+All of these functions except \fBwaddnwstr\fR may be macros.
 .SH PORTABILITY
-All these entry points are described in the XSI Curses standard, Issue 4.
+These functions are described in the XSI Curses standard, Issue 4.
 .SH SEE ALSO
 \fBcurses\fR(3X),
 \fBcurs_add_wch\fR(3X)
Index: man/curs_bkgrnd.3x
Prereq:  1.4 
--- ncurses-5.9/man/curs_bkgrnd.3x	2010-12-04 18:49:20.000000000 +0000
+++ ncurses-5.9-20130504/man/curs_bkgrnd.3x	2012-11-03 23:03:59.000000000 +0000
@@ -1,5 +1,5 @@
 .\"***************************************************************************
-.\" Copyright (c) 2002-2006,2010 Free Software Foundation, Inc.              *
+.\" Copyright (c) 2002-2010,2012 Free Software Foundation, Inc.              *
 .\"                                                                          *
 .\" Permission is hereby granted, free of charge, to any person obtaining a  *
 .\" copy of this software and associated documentation files (the            *
@@ -26,7 +26,7 @@
 .\" authorization.                                                           *
 .\"***************************************************************************
 .\"
-.\" $Id: curs_bkgrnd.3x,v 1.4 2010/12/04 18:49:20 tom Exp $
+.\" $Id: curs_bkgrnd.3x,v 1.5 2012/11/03 23:03:59 tom Exp $
 .TH curs_bkgrnd 3X ""
 .SH NAME
 \fBbkgrnd\fR,
@@ -89,7 +89,7 @@
 \fBbkgrndset\fR, and
 \fBgetbkgrnd\fR
 may be macros.
-.SH RETURN VALUES
+.SH RETURN VALUE
 The \fBbkgrndset\fR and \fBwbkgrndset\fR routines do not return a value.
 .PP
 Upon successful completion, the other functions return \fBOK\fR.
Index: man/curs_border_set.3x
Prereq:  1.10 
--- ncurses-5.9/man/curs_border_set.3x	2011-01-15 12:56:18.000000000 +0000
+++ ncurses-5.9-20130504/man/curs_border_set.3x	2012-11-03 23:03:59.000000000 +0000
@@ -1,5 +1,5 @@
 .\"***************************************************************************
-.\" Copyright (c) 2002-2010,2011 Free Software Foundation, Inc.              *
+.\" Copyright (c) 2002-2011,2012 Free Software Foundation, Inc.              *
 .\"                                                                          *
 .\" Permission is hereby granted, free of charge, to any person obtaining a  *
 .\" copy of this software and associated documentation files (the            *
@@ -26,7 +26,7 @@
 .\" authorization.                                                           *
 .\"***************************************************************************
 .\"
-.\" $Id: curs_border_set.3x,v 1.10 2011/01/15 12:56:18 tom Exp $
+.\" $Id: curs_border_set.3x,v 1.11 2012/11/03 23:03:59 tom Exp $
 .TH curs_border_set 3X ""
 .na
 .hy 0
@@ -187,7 +187,7 @@
 \fBvline_set\fR
 may be macros.
 .br
-.SH RETURN VALUES
+.SH RETURN VALUE
 .PP
 Upon successful completion, these functions return
 \fBOK\fR.
Index: man/curs_get_wch.3x
Prereq:  1.7 
--- ncurses-5.9/man/curs_get_wch.3x	2010-08-14 23:31:42.000000000 +0000
+++ ncurses-5.9-20130504/man/curs_get_wch.3x	2012-11-03 23:03:59.000000000 +0000
@@ -1,5 +1,5 @@
 .\"***************************************************************************
-.\" Copyright (c) 2002-2006,2010 Free Software Foundation, Inc.              *
+.\" Copyright (c) 2002-2010,2012 Free Software Foundation, Inc.              *
 .\"                                                                          *
 .\" Permission is hereby granted, free of charge, to any person obtaining a  *
 .\" copy of this software and associated documentation files (the            *
@@ -26,7 +26,7 @@
 .\" authorization.                                                           *
 .\"***************************************************************************
 .\"
-.\" $Id: curs_get_wch.3x,v 1.7 2010/08/14 23:31:42 tom Exp $
+.\" $Id: curs_get_wch.3x,v 1.8 2012/11/03 23:03:59 tom Exp $
 .TH curs_get_wch 3X ""
 .SH NAME
 \fBget_wch\fR,
@@ -132,7 +132,7 @@
 .PP
 All functions except \fBwget_wch\fR and \fBunget_wch\fR
 may be macros.
-.SH RETURN VALUES
+.SH RETURN VALUE
 When
 \fBget_wch\fR,
 \fBwget_wch\fR,
Index: man/curs_get_wstr.3x
Prereq:  1.8 
--- ncurses-5.9/man/curs_get_wstr.3x	2010-12-04 18:36:44.000000000 +0000
+++ ncurses-5.9-20130504/man/curs_get_wstr.3x	2012-11-03 23:03:59.000000000 +0000
@@ -1,5 +1,5 @@
 .\"***************************************************************************
-.\" Copyright (c) 2002-2006,2010 Free Software Foundation, Inc.              *
+.\" Copyright (c) 2002-2010,2012 Free Software Foundation, Inc.              *
 .\"                                                                          *
 .\" Permission is hereby granted, free of charge, to any person obtaining a  *
 .\" copy of this software and associated documentation files (the            *
@@ -26,7 +26,7 @@
 .\" authorization.                                                           *
 .\"***************************************************************************
 .\"
-.\" $Id: curs_get_wstr.3x,v 1.8 2010/12/04 18:36:44 tom Exp $
+.\" $Id: curs_get_wstr.3x,v 1.9 2012/11/03 23:03:59 tom Exp $
 .TH curs_get_wstr 3X ""
 .na
 .hy 0
@@ -144,7 +144,7 @@
 is no way to distinguish a \fBKEY_\fR value from a valid \fBwchar_t\fR value.
 .PP
 All of these routines except \fBwgetn_wstr\fR may be macros.
-.SH RETURN VALUES
+.SH RETURN VALUE
 All of these functions return \fBOK\fR upon successful completion.
 Otherwise, they return \fBERR\fR.
 .PP
Index: man/curs_getcchar.3x
Prereq:  1.15 
--- ncurses-5.9/man/curs_getcchar.3x	2010-12-04 18:36:44.000000000 +0000
+++ ncurses-5.9-20130504/man/curs_getcchar.3x	2012-11-03 23:03:59.000000000 +0000
@@ -1,5 +1,5 @@
 .\"***************************************************************************
-.\" Copyright (c) 2001-2009,2010 Free Software Foundation, Inc.              *
+.\" Copyright (c) 2001-2010,2012 Free Software Foundation, Inc.              *
 .\"                                                                          *
 .\" Permission is hereby granted, free of charge, to any person obtaining a  *
 .\" copy of this software and associated documentation files (the            *
@@ -26,7 +26,7 @@
 .\" authorization.                                                           *
 .\"***************************************************************************
 .\"
-.\" $Id: curs_getcchar.3x,v 1.15 2010/12/04 18:36:44 tom Exp $
+.\" $Id: curs_getcchar.3x,v 1.16 2012/11/03 23:03:59 tom Exp $
 .TH curs_getcchar 3X ""
 .de bP
 .IP \(bu 4
@@ -116,7 +116,7 @@
 The \fIwcval\fP argument may be a value generated by a call to
 \fBsetcchar\fP or by a function that has a \fBcchar_t\fP output argument.
 If \fIwcval\fP is constructed by any other means, the effect is unspecified.
-.SH RETURN VALUES
+.SH RETURN VALUE
 .PP
 When \fIwch\fP is a null pointer,
 \fBgetcchar\fP returns the number of wide characters referenced by
Index: man/curs_getch.3x
Prereq:  1.36 
--- ncurses-5.9/man/curs_getch.3x	2011-01-22 19:38:51.000000000 +0000
+++ ncurses-5.9-20130504/man/curs_getch.3x	2012-07-07 20:04:56.000000000 +0000
@@ -1,6 +1,6 @@
 '\" t
 .\"***************************************************************************
-.\" Copyright (c) 1998-2010,2011 Free Software Foundation, Inc.              *
+.\" Copyright (c) 1998-2011,2012 Free Software Foundation, Inc.              *
 .\"                                                                          *
 .\" Permission is hereby granted, free of charge, to any person obtaining a  *
 .\" copy of this software and associated documentation files (the            *
@@ -27,7 +27,7 @@
 .\" authorization.                                                           *
 .\"***************************************************************************
 .\"
-.\" $Id: curs_getch.3x,v 1.36 2011/01/22 19:38:51 tom Exp $
+.\" $Id: curs_getch.3x,v 1.37 2012/07/07 20:04:56 tom Exp $
 .TH curs_getch 3X ""
 .na
 .hy 0
@@ -237,14 +237,14 @@
 All routines return the integer \fBERR\fR upon failure and an integer value
 other than \fBERR\fR (\fBOK\fR in the case of ungetch()) upon successful
 completion.
-.RS
+.RS 3
 .TP 5
 \fBungetch\fP
-returns an error
+returns ERR
 if there is no more room in the FIFO.
-.TP 5
+.TP
 \fBwgetch\fP
-returns an error
+returns ERR
 if the window pointer is null, or
 if its timeout expires without having any data.
 .RE
Index: man/curs_in_wchstr.3x
Prereq:  1.8 
--- ncurses-5.9/man/curs_in_wchstr.3x	2010-12-04 18:36:44.000000000 +0000
+++ ncurses-5.9-20130504/man/curs_in_wchstr.3x	2012-11-03 23:03:59.000000000 +0000
@@ -1,5 +1,5 @@
 .\"***************************************************************************
-.\" Copyright (c) 2002-2006,2010 Free Software Foundation, Inc.              *
+.\" Copyright (c) 2002-2010,2012 Free Software Foundation, Inc.              *
 .\"                                                                          *
 .\" Permission is hereby granted, free of charge, to any person obtaining a  *
 .\" copy of this software and associated documentation files (the            *
@@ -26,7 +26,7 @@
 .\" authorization.                                                           *
 .\"***************************************************************************
 .\"
-.\" $Id: curs_in_wchstr.3x,v 1.8 2010/12/04 18:36:44 tom Exp $
+.\" $Id: curs_in_wchstr.3x,v 1.9 2012/11/03 23:03:59 tom Exp $
 .TH curs_in_wchstr 3X ""
 .na
 .hy 0
@@ -98,7 +98,7 @@
 \fBmvwin_wchnstr\fR, or
 \fBwin_wchnstr\fR
 is recommended.
-.SH RETURN VALUES
+.SH RETURN VALUE
 Upon successful completion, these functions return
 \fBOK\fR.
 Otherwise, they return
Index: man/curs_inopts.3x
Prereq:  1.15 
--- ncurses-5.9/man/curs_inopts.3x	2010-12-04 18:40:45.000000000 +0000
+++ ncurses-5.9-20130504/man/curs_inopts.3x	2012-04-28 19:09:15.000000000 +0000
@@ -1,5 +1,5 @@
 .\"***************************************************************************
-.\" Copyright (c) 1998-2005,2010 Free Software Foundation, Inc.              *
+.\" Copyright (c) 1998-2010,2012 Free Software Foundation, Inc.              *
 .\"                                                                          *
 .\" Permission is hereby granted, free of charge, to any person obtaining a  *
 .\" copy of this software and associated documentation files (the            *
@@ -26,7 +26,7 @@
 .\" authorization.                                                           *
 .\"***************************************************************************
 .\"
-.\" $Id: curs_inopts.3x,v 1.15 2010/12/04 18:40:45 tom Exp $
+.\" $Id: curs_inopts.3x,v 1.17 2012/04/28 19:09:15 tom Exp $
 .TH curs_inopts 3X ""
 .na
 .hy 0
@@ -223,6 +223,42 @@
 left the echo bit on at initialization, but the BSD \fBraw\fR call turned it
 off as a side-effect.  For best portability, set echo or noecho explicitly
 just after initialization, even if your program remains in cooked mode.
+.PP
+When \fBkeypad\fP is first enabled,
+ncurses loads the key-definitions for the current terminal description.
+If the terminal description includes extended string capabilities,
+e.g., from using the \fB\-x\fP option of @TIC@,
+then ncurses also defines keys for the capabilities whose names
+begin with "k".
+The corresponding keycodes are generated and (depending on previous
+loads of terminal descriptions) may differ from one execution of a
+program to the next.
+The generated keycodes are recognized by the \fBkeyname\fP function
+(which will then return a name beginning with "k" denoting the
+terminfo capability name rather than "K", used for curses key-names).
+On the other hand, an application can use \fBdefine_key\fP to establish
+a specific keycode for a given string.
+This makes it possible for an application to check for an extended
+capability's presence with \fItigetstr\fP,
+and reassign the keycode to match its own needs.
+.PP
+Low-level applications can use \fBtigetstr\fP to obtain the definition
+of any particular string capability.
+Higher-level applications which use the curses \fBwgetch\fP
+and similar functions to return keycodes rely upon the order in which
+the strings are loaded.
+If more than one key definition has the same string value,
+then \fBwgetch\fP can return only one keycode.
+Most curses implementations (including ncurses)
+load key definitions in the order
+defined by the array of string capability names.
+The last key to be loaded determines the keycode which will be returned.
+In ncurses, you may also have extended capabilities interpreted as
+key definitions.
+These are loaded after the predefined keys,
+and if a capability's value is the same as a previously-loaded
+key definition,
+the later definition is the one used.
 .SH NOTES
 Note that \fBecho\fR, \fBnoecho\fR, \fBhalfdelay\fR, \fBintrflush\fR,
 \fBmeta\fR, \fBnodelay\fR, \fBnotimeout\fR, \fBnoqiflush\fR,
@@ -233,4 +269,9 @@
 respectively.  Mixing raw/noraw and cbreak/nocbreak calls leads to tty driver
 control states that are hard to predict or understand; it is not recommended.
 .SH SEE ALSO
-\fBcurses\fR(3X), \fBcurs_getch\fR(3X), \fBcurs_initscr\fR(3X), \fBtermio\fR(7)
+\fBcurses\fR(3X),
+\fBcurs_getch\fR(3X),
+\fBcurs_initscr\fR(3X),
+\fBcurs_util\fR(3X),
+\fBdefine_key\fR(3X),
+\fBtermio\fR(7)
Index: man/curs_ins_wstr.3x
Prereq:  1.6 
--- ncurses-5.9/man/curs_ins_wstr.3x	2010-12-04 18:38:55.000000000 +0000
+++ ncurses-5.9-20130504/man/curs_ins_wstr.3x	2012-11-03 23:03:59.000000000 +0000
@@ -1,5 +1,5 @@
 .\"***************************************************************************
-.\" Copyright (c) 2002-2005,2010 Free Software Foundation, Inc.              *
+.\" Copyright (c) 2002-2010,2012 Free Software Foundation, Inc.              *
 .\"                                                                          *
 .\" Permission is hereby granted, free of charge, to any person obtaining a  *
 .\" copy of this software and associated documentation files (the            *
@@ -26,7 +26,7 @@
 .\" authorization.                                                           *
 .\"***************************************************************************
 .\"
-.\" $Id: curs_ins_wstr.3x,v 1.6 2010/12/04 18:38:55 tom Exp $
+.\" $Id: curs_ins_wstr.3x,v 1.7 2012/11/03 23:03:59 tom Exp $
 .TH curs_ins_wstr 3X ""
 .na
 .hy 0
@@ -92,7 +92,7 @@
 functions will fail.
 XSI does not define what will happen if a nonspacing character follows
 a control character.
-.SH RETURN VALUES
+.SH RETURN VALUE
 Upon successful completion, these functions return OK.
 Otherwise, they return ERR.
 .PP
Index: man/curs_inwstr.3x
Prereq:  1.7 
--- ncurses-5.9/man/curs_inwstr.3x	2010-12-04 18:38:55.000000000 +0000
+++ ncurses-5.9-20130504/man/curs_inwstr.3x	2012-11-03 23:03:59.000000000 +0000
@@ -1,5 +1,5 @@
 .\"***************************************************************************
-.\" Copyright (c) 2002-2006,2010 Free Software Foundation, Inc.              *
+.\" Copyright (c) 2002-2010,2012 Free Software Foundation, Inc.              *
 .\"                                                                          *
 .\" Permission is hereby granted, free of charge, to any person obtaining a  *
 .\" copy of this software and associated documentation files (the            *
@@ -26,7 +26,7 @@
 .\" authorization.                                                           *
 .\"***************************************************************************
 .\"
-.\" $Id: curs_inwstr.3x,v 1.7 2010/12/04 18:38:55 tom Exp $
+.\" $Id: curs_inwstr.3x,v 1.8 2012/11/03 23:03:59 tom Exp $
 .TH curs_inwstr 3X ""
 .SH NAME
 \fBinwstr\fR,
@@ -72,7 +72,7 @@
 Note that all routines except
 \fBwinnwstr\fR
 may be macros.
-.SH RETURN VALUES
+.SH RETURN VALUE
 All routines return
 \fBERR\fR
 upon failure. Upon
Index: man/curs_overlay.3x
Prereq:  1.16 
--- ncurses-5.9/man/curs_overlay.3x	2010-12-04 18:40:45.000000000 +0000
+++ ncurses-5.9-20130504/man/curs_overlay.3x	2013-04-06 23:48:51.000000000 +0000
@@ -1,5 +1,5 @@
 .\"***************************************************************************
-.\" Copyright (c) 1998-2006,2010 Free Software Foundation, Inc.              *
+.\" Copyright (c) 1998-2010,2013 Free Software Foundation, Inc.              *
 .\"                                                                          *
 .\" Permission is hereby granted, free of charge, to any person obtaining a  *
 .\" copy of this software and associated documentation files (the            *
@@ -26,7 +26,7 @@
 .\" authorization.                                                           *
 .\"***************************************************************************
 .\"
-.\" $Id: curs_overlay.3x,v 1.16 2010/12/04 18:40:45 tom Exp $
+.\" $Id: curs_overlay.3x,v 1.17 2013/04/06 23:48:51 tom Exp $
 .TH curs_overlay 3X ""
 .na
 .hy 0
@@ -48,18 +48,21 @@
       \fBint dmaxcol, int overlay);\fR
 .SH DESCRIPTION
 The \fBoverlay\fR and \fBoverwrite\fR routines overlay \fIsrcwin\fR on
-top of \fIdstwin\fR.  \fIscrwin\fR and \fIdstwin\fR are not required
-to be the same size; only text where the two windows overlap is
-copied.  The difference is that \fBoverlay\fR is non-destructive
+top of \fIdstwin\fR.
+\fIscrwin\fR and \fIdstwin\fR are not required
+to be the same size; only text where the two windows overlap is copied.
+The difference is that \fBoverlay\fR is non-destructive
 (blanks are not copied) whereas \fBoverwrite\fR is destructive.
 .PP
 The \fBcopywin\fR routine provides a finer granularity of control over the
-\fBoverlay\fR and \fBoverwrite\fR routines.  Like in the \fBprefresh\fR
-routine, a rectangle is specified in the destination window, (\fIdminrow\fR,
+\fBoverlay\fR and \fBoverwrite\fR routines.
+As in the \fBprefresh\fR routine,
+a rectangle is specified in the destination window, (\fIdminrow\fR,
 \fIdmincol\fR) and (\fIdmaxrow\fR, \fIdmaxcol\fR), and the upper-left-corner
-coordinates of the source window, (\fIsminrow\fR, \fIsmincol\fR).  If the
-argument \fIoverlay\fR is \fBtrue\fR, then copying is non-destructive, as in
-\fBoverlay\fR.
+coordinates of the source window, (\fIsminrow\fR, \fIsmincol\fR).
+If the argument \fIoverlay\fR is \fBtrue\fR,
+then copying is non-destructive,
+as in \fBoverlay\fR.
 .SH RETURN VALUE
 Routines that return an integer return \fBERR\fR upon failure, and \fBOK\fR
 (SVr4 only specifies "an integer value other than \fBERR\fR") upon successful
@@ -75,7 +78,8 @@
 Note that \fBoverlay\fR and \fBoverwrite\fR may be macros.
 .SH PORTABILITY
 The XSI Curses standard, Issue 4 describes these functions (adding the const
-qualifiers).  It further specifies their behavior in the presence of characters
+qualifiers).
+It further specifies their behavior in the presence of characters
 with multibyte renditions (not yet supported in this implementation).
 .SH SEE ALSO
 \fBcurses\fR(3X), \fBcurs_pad\fR(3X), \fBcurs_refresh\fR(3X)
Index: man/curs_termcap.3x
Prereq:  1.26 
--- ncurses-5.9/man/curs_termcap.3x	2010-12-04 18:38:55.000000000 +0000
+++ ncurses-5.9-20130504/man/curs_termcap.3x	2013-01-19 15:58:48.000000000 +0000
@@ -1,5 +1,5 @@
 .\"***************************************************************************
-.\" Copyright (c) 1998-2007,2010 Free Software Foundation, Inc.              *
+.\" Copyright (c) 1998-2012,2013 Free Software Foundation, Inc.              *
 .\"                                                                          *
 .\" Permission is hereby granted, free of charge, to any person obtaining a  *
 .\" copy of this software and associated documentation files (the            *
@@ -26,8 +26,11 @@
 .\" authorization.                                                           *
 .\"***************************************************************************
 .\"
-.\" $Id: curs_termcap.3x,v 1.26 2010/12/04 18:38:55 tom Exp $
+.\" $Id: curs_termcap.3x,v 1.30 2013/01/19 15:58:48 tom Exp $
 .TH curs_termcap 3X ""
+.de bP
+.IP \(bu 4
+..
 .na
 .hy 0
 .ds n 5
@@ -75,11 +78,39 @@
 routines are emulated using the \fIterminfo\fR database.  Thus, they
 can only be used to query the capabilities of entries for which a
 terminfo entry has been compiled.
+.SS INITIALIZATION
 .PP
 The \fBtgetent\fR routine loads the entry for \fIname\fR.
-It returns 1 on success, 0 if there is no such entry, and \-1 if the
-terminfo database could not be found.
+It returns:
+.RS 3
+.TP 3
+1
+on success,
+.TP 3
+0
+if there is no such entry
+(or that it is a generic type, having too little information for curses
+applications to run), and
+.TP 3
+\-1
+if the terminfo database could not be found.
+.RE
+.PP
+This differs from the \fItermcap\fP library in two ways:
+.RS 3
+.bP
 The emulation ignores the buffer pointer \fIbp\fR.
+The \fItermcap\fP library would store a copy of the terminal
+description in the area referenced by this pointer.
+However, ncurses stores its terminal descriptions in compiled
+binary form, which is not the same thing.
+.bP
+There is a difference in return codes.
+The \fItermcap\fP library does not check if the terminal
+description is marked with the \fIgeneric\fP capability,
+or if the terminal description has cursor-addressing.
+.RE
+.SS CAPABILITY VALUES
 .PP
 The \fBtgetflag\fR routine gets the boolean entry for \fIid\fR,
 or zero if it is not available.
@@ -98,12 +129,14 @@
 \fBtgetflag\fR,
 \fBtgetnum\fR and
 \fBtgetstr\fR are compared in lookups.
+.SS FORMATTING CAPABILITIES
 .PP
 The \fBtgoto\fR routine instantiates the parameters into the given capability.
 The output from this routine is to be passed to \fBtputs\fR.
 .PP
 The \fBtputs\fR routine is described on the \fBcurs_terminfo\fR(3X) manual
 page.  It can retrieve capabilities by either termcap or terminfo name.
+.SS GLOBAL VARIABLES
 .PP
 The variables
 \fBPC\fR,
@@ -165,8 +198,28 @@
 e.g., not distinguishing between input and output.
 In particular, some applications are reported to declare and/or
 modify \fBospeed\fR.
+.PP
+The comment that only the first two characters of the \fBid\fR parameter
+are used escapes many application developers.
+The original BSD 4.2 termcap library (and historical relics thereof)
+did not require a trailing null NUL on the parameter name passed
+to \fBtgetstr\fP, \fBtgetnum\fP and \fBtgetflag\fP.
+Some applications assume that the termcap interface does not require
+the trailing NUL for the parameter name.
+Taking into account these issues:
+.bP
+As a special case,
+\fBtgetflag\fP matched against a single-character identifier
+provided that was at the end of the terminal description.
+You should not rely upon this behavior in portable programs.
+This implementation disallows matches against single-character capability names.
+.bP
+This implementation disallows matches by the termcap interface against
+extended capability names which are longer than two characters.
 .SH SEE ALSO
 \fBcurses\fR(3X),
 \fBterminfo\fR(\*n),
 \fBterm_variables\fR(3X),
 \fBputc\fR(3).
+.sp
+http://invisible-island.net/ncurses/tctest.html
Index: man/curs_terminfo.3x
Prereq:  1.35 
--- ncurses-5.9/man/curs_terminfo.3x	2010-12-04 18:38:55.000000000 +0000
+++ ncurses-5.9-20130504/man/curs_terminfo.3x	2013-01-12 18:11:40.000000000 +0000
@@ -1,5 +1,5 @@
 .\"***************************************************************************
-.\" Copyright (c) 1999-2008,2010 Free Software Foundation, Inc.              *
+.\" Copyright (c) 1999-2011,2013 Free Software Foundation, Inc.              *
 .\"                                                                          *
 .\" Permission is hereby granted, free of charge, to any person obtaining a  *
 .\" copy of this software and associated documentation files (the            *
@@ -26,7 +26,7 @@
 .\" authorization.                                                           *
 .\"***************************************************************************
 .\"
-.\" $Id: curs_terminfo.3x,v 1.35 2010/12/04 18:38:55 tom Exp $
+.\" $Id: curs_terminfo.3x,v 1.37 2013/01/12 18:11:40 tom Exp $
 .TH curs_terminfo 3X ""
 .ds n 5
 .na
@@ -77,7 +77,7 @@
 .br
 \fBint vidattr(chtype \fR\fIattrs\fR\fB);\fR
 .br
-\fBint vid_puts(attr_t \fR\fIattrs\fR\fB, short \fR\fIpair\fR\fB, void *\fR\fIopts\fR\fB, int (*\fR\fIputc\fR\fB)(char));\fR
+\fBint vid_puts(attr_t \fR\fIattrs\fR\fB, short \fR\fIpair\fR\fB, void *\fR\fIopts\fR\fB, int (*\fR\fIputc\fR\fB)(int));\fR
 .br
 \fBint vid_attr(attr_t \fR\fIattrs\fR\fB, short \fR\fIpair\fR\fB, void *\fR\fIopts\fR\fB);\fR
 .br
@@ -346,7 +346,7 @@
 This implementation allows the caller to use \-1's for the old ordinates.
 In that case, the old location is unknown.
 .PP
-Extended terminal capability names, e.g., as defined by \fBtic\ \-x\fP,
+Extended terminal capability names, e.g., as defined by \fB@TIC@\ \-x\fP,
 are not stored in the arrays described in this section.
 .SH SEE ALSO
 \fBcurses\fR(3X),
Index: man/curs_threads.3x
Prereq:  1.18 
--- ncurses-5.9/man/curs_threads.3x	2010-12-04 18:38:55.000000000 +0000
+++ ncurses-5.9-20130504/man/curs_threads.3x	2012-05-26 17:03:26.000000000 +0000
@@ -1,5 +1,5 @@
 .\"***************************************************************************
-.\" Copyright (c) 2008,2010 Free Software Foundation, Inc.                   *
+.\" Copyright (c) 2008-2010,2012 Free Software Foundation, Inc.              *
 .\"                                                                          *
 .\" Permission is hereby granted, free of charge, to any person obtaining a  *
 .\" copy of this software and associated documentation files (the            *
@@ -26,7 +26,7 @@
 .\" authorization.                                                           *
 .\"***************************************************************************
 .\"
-.\" $Id: curs_threads.3x,v 1.18 2010/12/04 18:38:55 tom Exp $
+.\" $Id: curs_threads.3x,v 1.19 2012/05/26 17:03:26 tom Exp $
 .TH curs_threads 3X ""
 .de bP
 .IP \(bu 4
@@ -51,9 +51,9 @@
 .br
 \fBint set_tabsize(int size);\fR
 .br
-\fBint use_screen(SCREEN *scr, NCURSES_WINDOW_CB func, void *data);\fR
+\fBint use_screen(SCREEN *scr, NCURSES_SCREEN_CB func, void *data);\fR
 .br
-\fBint use_window(WINDOW *win, NCURSES_SCREEN_CB func, void *data);\fR
+\fBint use_window(WINDOW *win, NCURSES_WINDOW_CB func, void *data);\fR
 .br
 .SH DESCRIPTION
 This implementation can be configured to provide rudimentary support
Index: man/curs_util.3x
Prereq:  1.32 
--- ncurses-5.9/man/curs_util.3x	2010-12-04 18:38:55.000000000 +0000
+++ ncurses-5.9-20130504/man/curs_util.3x	2012-07-21 18:51:10.000000000 +0000
@@ -1,5 +1,6 @@
+'\" t
 .\"***************************************************************************
-.\" Copyright (c) 1998-2008,2010 Free Software Foundation, Inc.              *
+.\" Copyright (c) 1998-2011,2012 Free Software Foundation, Inc.              *
 .\"                                                                          *
 .\" Permission is hereby granted, free of charge, to any person obtaining a  *
 .\" copy of this software and associated documentation files (the            *
@@ -26,7 +27,7 @@
 .\" authorization.                                                           *
 .\"***************************************************************************
 .\"
-.\" $Id: curs_util.3x,v 1.32 2010/12/04 18:38:55 tom Exp $
+.\" $Id: curs_util.3x,v 1.36 2012/07/21 18:51:10 tom Exp $
 .TH curs_util 3X ""
 .de bP
 .IP \(bu 4
@@ -44,6 +45,7 @@
 \fBputwin\fR,
 \fBunctrl\fR,
 \fBuse_env\fR,
+\fBuse_tioctl\fR,
 \fBwunctrl\fR \- miscellaneous \fBcurses\fR utility routines
 .ad
 .hy
@@ -64,6 +66,8 @@
 .br
 \fBvoid use_env(bool f);\fR
 .br
+\fBvoid use_tioctl(bool f);\fR
+.br
 \fBint putwin(WINDOW *win, FILE *filep);\fR
 .br
 \fBWINDOW *getwin(FILE *filep);\fR
@@ -123,16 +127,70 @@
 The limitation arises because the \fBfilter\fP routine modifies the
 in-memory copy of the terminal information.
 .PP
-The \fBuse_env\fR routine, if used, is called before \fBinitscr\fR or
-\fBnewterm\fR are called.  When called with \fBFALSE\fR as an
-argument, the values of \fBlines\fR and \fBcolumns\fR specified in the
-\fIterminfo\fR database will be used, even if environment variables
-\fBLINES\fR and \fBCOLUMNS\fR (used by default) are set, or if
-\fBcurses\fR is running in a window (in which case default behavior
-would be to use the window size if \fBLINES\fR and \fBCOLUMNS\fR are
-not set).
-Note that setting \fBLINES\fR or \fBCOLUMNS\fR overrides the
-corresponding size which may be obtained from the operating system.
+The \fBuse_env\fR routine, if used,
+should be called before \fBinitscr\fR or
+\fBnewterm\fR are called
+(because those compute the screen size).
+It modifies the way \fBncurses\fP treats environment variables
+when determining the screen size.
+.bP
+Normally ncurses looks first at the terminal database for the screen size.
+.IP
+If \fBuse_env\fP was called with \fBFALSE\fP for parameter,
+it stops here unless
+If \fBuse_tioctl\fP was also called with \fBTRUE\fP for parameter.
+.bP
+Then it asks for the screen size via operating system calls.
+If successful,
+it overrides the values from the terminal database.
+.bP
+Finally (unless \fBuse_env\fP was called with \fBFALSE\fP parameter),
+ncurses examines the \fBLINES\fR or \fBCOLUMNS\fR environment variables,
+using a value in those to override the results
+from the operating system or terminal database.
+.IP
+Ncurses also updates the screen size in response to SIGWINCH,
+unless overridden by the \fBLINES\fR or \fBCOLUMNS\fR environment variables,
+.PP
+The \fBuse_tioctl\fR routine, if used,
+should be called before \fBinitscr\fR or \fBnewterm\fR are called
+(because those compute the screen size).
+After \fBuse_tioctl\fR is called with \fBTRUE\fR as an argument,
+ncurses modifies the last step in its computation of screen size as follows:
+.bP
+checks if the \fBLINES\fR and \fBCOLUMNS\fR environment variables
+are set to a number greater than zero.
+.bP
+for each, ncurses updates the corresponding environment variable
+with the value that it has obtained via operating system call
+or from the terminal database.
+.bP
+ncurses re-fetches the value of the environment variables so that
+it is still the environment variables which set the screen size.
+.PP
+The \fBuse_env\fP and \fBuse_tioctl\fP routines combine as
+summarized here:
+.TS
+center tab(/);
+l l l
+_ _ _
+lw7 lw7 lw40.
+\fIuse_env\fR/\fIuse_tioctl\fR/\fISummary\fR
+TRUE/FALSE/T{
+This is the default behavior.
+ncurses uses operating system calls
+unless overridden by $LINES or $COLUMNS environment variables.
+T}
+TRUE/TRUE/T{
+ncurses updates $LINES and $COLUMNS based on operating system calls.
+T}
+FALSE/TRUE/T{
+ncurses ignores $LINES and $COLUMNS, uses operating system calls to obtain size.
+T}
+FALSE/FALSE/T{
+ncurses relies on the terminal database to determine size.
+T}
+.TE
 .PP
 The \fBputwin\fR routine writes all data associated with window \fIwin\fR into
 the file to which \fIfilep\fR points.  This information can be later retrieved
@@ -224,7 +282,7 @@
 .PP
 The \fBkeyname\fP function may return the names of user-defined
 string capabilities which are defined in the terminfo entry via the \fB\-x\fP
-option of \fBtic\fP.
+option of \fB@TIC@\fP.
 This implementation automatically assigns at run-time keycodes to 
 user-defined strings which begin with "k".
 The keycodes start at KEY_MAX, but are not guaranteed to be 
@@ -233,8 +291,8 @@
 The \fBuse_extended_names\fP function controls whether this data is
 loaded when the terminal description is read by the library.
 .PP
-The \fBnofilter\fP routine is specific to ncurses.
-It was not supported on Version 7, BSD or System V implementations.
+The \fBnofilter\fP and \fBuse_tioctl\fP routines are specific to ncurses.
+They were not supported on Version 7, BSD or System V implementations.
 It is recommended that any code depending on ncurses extensions
 be conditioned using NCURSES_VERSION.
 .SH SEE ALSO
Index: man/form_field.3x
Prereq:  1.10 
--- ncurses-5.9/man/form_field.3x	2010-12-04 18:40:45.000000000 +0000
+++ ncurses-5.9-20130504/man/form_field.3x	2012-11-03 23:03:59.000000000 +0000
@@ -1,6 +1,6 @@
 '\" t
 .\"***************************************************************************
-.\" Copyright (c) 1998-2006,2010 Free Software Foundation, Inc.              *
+.\" Copyright (c) 1998-2010,2012 Free Software Foundation, Inc.              *
 .\"                                                                          *
 .\" Permission is hereby granted, free of charge, to any person obtaining a  *
 .\" copy of this software and associated documentation files (the            *
@@ -27,7 +27,7 @@
 .\" authorization.                                                           *
 .\"***************************************************************************
 .\"
-.\" $Id: form_field.3x,v 1.10 2010/12/04 18:40:45 tom Exp $
+.\" $Id: form_field.3x,v 1.11 2012/11/03 23:03:59 tom Exp $
 .TH form_field 3X ""
 .SH NAME
 \fBform_field\fR \- make and break connections between fields and forms
@@ -52,7 +52,7 @@
 .PP
 The function \fBmove_field\fR moves the given field (which must be disconnected)
 to a specified location on the screen.
-.SH RETURN VALUES
+.SH RETURN VALUE
 The function \fBform_fields\fR returns a pointer (which may be \fBNULL\fR).
 It does not set errno.
 .PP
Index: man/infocmp.1m
Prereq:  1.46 
--- ncurses-5.9/man/infocmp.1m	2010-12-04 18:40:45.000000000 +0000
+++ ncurses-5.9-20130504/man/infocmp.1m	2013-02-02 22:07:35.000000000 +0000
@@ -1,6 +1,6 @@
 '\" t
 .\"***************************************************************************
-.\" Copyright (c) 1998-2006,2010 Free Software Foundation, Inc.              *
+.\" Copyright (c) 1998-2012,2013 Free Software Foundation, Inc.              *
 .\"                                                                          *
 .\" Permission is hereby granted, free of charge, to any person obtaining a  *
 .\" copy of this software and associated documentation files (the            *
@@ -27,9 +27,12 @@
 .\" authorization.                                                           *
 .\"***************************************************************************
 .\"
-.\" $Id: infocmp.1m,v 1.46 2010/12/04 18:40:45 tom Exp $
+.\" $Id: infocmp.1m,v 1.53 2013/02/02 22:07:35 tom Exp $
 .TH @INFOCMP@ 1M ""
 .ds n 5
+.de bP
+.IP \(bu 4
+..
 .ds d @TERMINFO@
 .SH NAME
 \fB@INFOCMP@\fR \- compare or print out \fIterminfo\fR descriptions
@@ -37,10 +40,12 @@
 \fB@INFOCMP@\fR [\fB\-\
 1\
 C\
+D\
 E\
 F\
 G\
 I\
+K\
 L\
 T\
 U\
@@ -69,32 +74,40 @@
 \fB@INFOCMP@\fR can be used to compare a binary \fBterminfo\fR entry with other
 terminfo entries, rewrite a \fBterminfo\fR description to take advantage of the
 \fBuse=\fR terminfo field, or print out a \fBterminfo\fR description from the
-binary file (\fBterm\fR) in a variety of formats.  In all cases, the boolean
+binary file (\fBterm\fR) in a variety of formats.
+In all cases, the boolean
 fields will be printed first, followed by the numeric fields, followed by the
 string fields.
 .SS Default Options
 If no options are specified and zero or one \fItermnames\fR are specified, the
-\fB\-I\fR option will be assumed.  If more than one \fItermname\fR is specified,
+\fB\-I\fR option will be assumed.
+If more than one \fItermname\fR is specified,
 the \fB\-d\fR option will be assumed.
 .SS Comparison Options [\-d] [\-c] [\-n]
 \fB@INFOCMP@\fR compares the \fBterminfo\fR description of the first terminal
 \fItermname\fR with each of the descriptions given by the entries for the other
-terminal's \fItermnames\fR.  If a capability is defined for only one of the
+terminal's \fItermnames\fR.
+If a capability is defined for only one of the
 terminals, the value returned will depend on the type of the capability:
 \fBF\fR for boolean variables, \fB\-1\fR for integer variables, and \fBNULL\fR
 for string variables.
 .PP
 The \fB\-d\fR option produces a list of each capability that is different
-between two entries.  This option is useful to show the difference between two
+between two entries.
+This option is useful to show the difference between two
 entries, created by different people, for the same or similar terminals.
 .PP
 The \fB\-c\fR option produces a list of each capability that is common between
-two entries.  Capabilities that are not set are ignored.  This option can be
+two or more entries.
+Capabilities that are not set are ignored.
+This option can be
 used as a quick check to see if the \fB\-u\fR option is worth using.
 .PP
-The \fB\-n\fR option produces a list of each capability that is in neither
-entry.  If no \fItermnames\fR are given, the environment variable \fBTERM\fR
-will be used for both of the \fItermnames\fR.  This can be used as a quick
+The \fB\-n\fR option produces a list of each capability that is in none of
+the given entries.
+If no \fItermnames\fR are given, the environment variable \fBTERM\fR
+will be used for both of the \fItermnames\fR.
+This can be used as a quick
 check to see if anything was left out of a description.
 .SS Source Listing Options [\-I] [\-L] [\-C] [\-r]
 The \fB\-I\fR, \fB\-L\fR, and \fB\-C\fR options will produce a source listing for
@@ -107,6 +120,7 @@
 \fB\-L\fR/use the long C variable name listed in <\fBterm.h\fR>
 \fB\-C\fR/use the \fBtermcap\fR names
 \fB\-r\fR/when using \fB\-C\fR, put out all capabilities in \fBtermcap\fR form
+\fB\-K\fR/modifies the \fB\-C\fP option, improving BSD-compatibility.
 .TE
 .PP
 If no \fItermnames\fR are given, the environment variable \fBTERM\fR will be
@@ -114,26 +128,48 @@
 .PP
 The source produced by the \fB\-C\fR option may be used directly as a
 \fBtermcap\fR entry, but not all parameterized strings can be changed to
-the \fBtermcap\fR format.  \fB@INFOCMP@\fR will attempt to convert most of the
+the \fBtermcap\fR format.
+\fB@INFOCMP@\fR will attempt to convert most of the
 parameterized information, and anything not converted will be plainly marked in
-the output and commented out.  These should be edited by hand.
+the output and commented out.
+These should be edited by hand.
+.PP
+For best results when converting to \fBtermcap\fP format,
+you should use both \fB\-C\fP and \fB\-r\fP.
+Normally a termcap description is limited to 1023 bytes.
+@INFOCMP@ trims away less essential parts to make it fit.
+If you are converting to one of the (rare) termcap implementations
+which accept an unlimited size of termcap,
+you may want to add the \fB\-T\fP option.
+More often however, you must help the termcap implementation,
+and trim excess whitespace (use the \fB\-0\fP option for that).
 .PP
 All padding information for strings will be collected together and placed
-at the beginning of the string where \fBtermcap\fR expects it.  Mandatory
+at the beginning of the string where \fBtermcap\fR expects it.
+Mandatory
 padding (padding information with a trailing '/') will become optional.
 .PP
 All \fBtermcap\fR variables no longer supported by \fBterminfo\fR, but which
-are derivable from other \fBterminfo\fR variables, will be output.  Not all
+are derivable from other \fBterminfo\fR variables, will be output.
+Not all
 \fBterminfo\fR capabilities will be translated; only those variables which were
-part of \fBtermcap\fR will normally be output.  Specifying the \fB\-r\fR option
+part of \fBtermcap\fR will normally be output.
+Specifying the \fB\-r\fR option
 will take off this restriction, allowing all capabilities to be output in
 \fItermcap\fR form.
+Normally you would use both the \fB\-C\fP and \fB\-r\fP options.
+The actual format used incorporates some improvements for escaped characters
+from terminfo format.
+For a stricter BSD-compatible translation, use the \fB\-K\fR option
+rather than \fB\-C\fP.
 .PP
 Note that because padding is collected to the beginning of the capability, not
-all capabilities are output.  Mandatory padding is not supported.  Because
+all capabilities are output.
+Mandatory padding is not supported.
+Because
 \fBtermcap\fR strings are not as flexible, it is not always possible to convert
-a \fBterminfo\fR string capability into an equivalent \fBtermcap\fR format.  A
-subsequent conversion of the \fBtermcap\fR file back into \fBterminfo\fR format
+a \fBterminfo\fR string capability into an equivalent \fBtermcap\fR format.
+A subsequent conversion of the \fBtermcap\fR file back into \fBterminfo\fR format
 will not necessarily reproduce the original \fBterminfo\fR
 source.
 .PP
@@ -156,27 +192,33 @@
 .SS Use= Option [\-u]
 The \fB\-u\fR option produces a \fBterminfo\fR source description of the first
 terminal \fItermname\fR which is relative to the sum of the descriptions given
-by the entries for the other terminals \fItermnames\fR.  It does this by
+by the entries for the other terminals \fItermnames\fR.
+It does this by
 analyzing the differences between the first \fItermname\fR and the other
 \fItermnames\fR and producing a description with \fBuse=\fR fields for the
-other terminals.  In this manner, it is possible to retrofit generic terminfo
-entries into a terminal's description.  Or, if two similar terminals exist, but
+other terminals.
+In this manner, it is possible to retrofit generic terminfo
+entries into a terminal's description.
+Or, if two similar terminals exist, but
 were coded at different times or by different people so that each description
 is a full description, using \fB@INFOCMP@\fR will show what can be done to change
 one description to be relative to the other.
 .PP
 A capability will get printed with an at-sign (@) if it no longer exists in the
 first \fItermname\fR, but one of the other \fItermname\fR entries contains a
-value for it.  A capability's value gets printed if the value in the first
+value for it.
+A capability's value gets printed if the value in the first
 \fItermname\fR is not found in any of the other \fItermname\fR entries, or if
 the first of the other \fItermname\fR entries that has this capability gives a
 different value for the capability than that in the first \fItermname\fR.
 .PP
-The order of the other \fItermname\fR entries is significant.  Since the
-terminfo compiler \fBtic\fR does a left-to-right scan of the capabilities,
+The order of the other \fItermname\fR entries is significant.
+Since the
+terminfo compiler \fB@TIC@\fR does a left-to-right scan of the capabilities,
 specifying two \fBuse=\fR entries that contain differing entries for the same
 capabilities will produce different results depending on the order that the
-entries are given in.  \fB@INFOCMP@\fR will flag any such inconsistencies between
+entries are given in.
+\fB@INFOCMP@\fR will flag any such inconsistencies between
 the other \fItermname\fR entries as they are found.
 .PP
 Alternatively, specifying a capability \fIafter\fR a \fBuse=\fR entry that
@@ -187,29 +229,48 @@
 .PP
 Another error that does not cause incorrect compiled files, but will slow down
 the compilation time, is specifying extra \fBuse=\fR fields that are
-superfluous.  \fB@INFOCMP@\fR will flag any other \fItermname use=\fR fields that
+superfluous.
+\fB@INFOCMP@\fR will flag any other \fItermname use=\fR fields that
 were not needed.
 .SS Changing Databases [\-A \fIdirectory\fR] [\-B \fIdirectory\fR]
-The location of the compiled \fBterminfo\fR database is taken from the
-environment variable \fBTERMINFO\fR .  If the variable is not defined, or the
-terminal is not found in that location, the system \fBterminfo\fR database,
-in \fB@TERMINFO@\fR, will be used.  The options \fB\-A\fR
-and \fB\-B\fR may be used to override this location.  The \fB\-A\fR option will
-set \fBTERMINFO\fR for the first \fItermname\fR and the \fB\-B\fR option will
-set \fBTERMINFO\fR for the other \fItermnames\fR.  With this, it is possible to
+Like other \fBncurses\fP utilities,
+@INFOCMP@ looks for the terminal descriptions in several places.
+You can use the \fBTERMINFO\fP and \fBTERMINFO_DIRS\fP environment variables
+to override the compiled-in default list of places to search
+(see \fBcurses\fP(3X) for details).
+.PP
+You can also use the options \fB\-A\fR
+and \fB\-B\fR to override the list of places to search
+when comparing terminal descriptions:
+.bP
+The \fB\-A\fR option sets the location for the first \fItermname\fR
+.bP
+The \fB\-B\fR option sets the location for the other \fItermnames\fR.
+.PP
+Using these options, it is possible to
 compare descriptions for a terminal with the same name located in two different
-databases.  This is useful for comparing descriptions for the same terminal
+databases.
+For instance,
+you can use this feature for comparing descriptions for the same terminal
 created by different people.
 .SS Other Options
 .TP 5
+\fB\-0\fR
+causes the fields to be printed on one line, without wrapping.
+.TP 5
 \fB\-1\fR
-causes the fields to be printed out one to a line.  Otherwise,
+causes the fields to be printed out one to a line.
+Otherwise,
 the fields will be printed several to a line to a maximum width
 of 60 characters.
 .TP
 \fB\-a\fR
 tells \fB@INFOCMP@\fP to retain commented-out capabilities rather than discarding
-them.  Capabilities are commented by prefixing them with a period.
+them.
+Capabilities are commented by prefixing them with a period.
+.TP
+\fB\-D\fR
+tells \fB@INFOCMP@\fP to print the database locations that it knows about, and exit.
 .TP 5
 \fB\-E\fR
 Dump the capabilities of the given terminal as tables, needed in
@@ -231,12 +292,15 @@
 for a given terminal type.
 .TP 5
 \fB\-F\fR
-compare terminfo files.  This assumes that two following arguments are
-filenames.  The files are searched for pairwise matches between
+compare terminfo files.
+This assumes that two following arguments are filenames.
+The files are searched for pairwise matches between
 entries, with two entries considered to match if any of their names do.
 The report printed to standard output lists entries with no matches in
-the other file, and entries with more than one match.  For entries
-with exactly one match it includes a difference report.  Normally,
+the other file, and entries with more than one match.
+For entries
+with exactly one match it includes a difference report.
+Normally,
 to reduce the volume of the report, use references are
 not resolved before looking for differences, but resolution can be forced
 by also specifying \fB\-r\fR.
@@ -255,14 +319,17 @@
 .TP 5
 \fB\-i\fR
 Analyze the initialization (\fBis1\fR, \fBis2\fR, \fBis3\fR), and reset
-(\fBrs1\fR, \fBrs2\fR, \fBrs3\fR), strings in the entry.  For each string, the
+(\fBrs1\fR, \fBrs2\fR, \fBrs3\fR), strings in the entry.
+For each string, the
 code tries to analyze it into actions in terms of the other capabilities in the
 entry, certain X3.64/ISO 6429/ECMA\-48 capabilities, and certain DEC VT-series
 private modes (the set of recognized special sequences has been selected for
-completeness over the existing terminfo database).  Each report line consists
+completeness over the existing terminfo database).
+Each report line consists
 of the capability name, followed by a colon and space, followed by a printable
 expansion of the capability string with sections matching recognized actions
-translated into {}-bracketed descriptions.  Here is a list of the DEC/ANSI
+translated into {}-bracketed descriptions.
+Here is a list of the DEC/ANSI
 special sequences recognized:
 i.
 .TS
@@ -308,7 +375,8 @@
 .sp
 It also recognizes a SGR action corresponding to ANSI/ISO 6429/ECMA Set
 Graphics Rendition, with the values NORMAL, BOLD, UNDERLINE, BLINK, and
-REVERSE.  All but NORMAL may be prefixed with `+' (turn on) or `\-' (turn off).
+REVERSE.
+All but NORMAL may be prefixed with `+' (turn on) or `\-' (turn off).
 .PP
 An SGR0 designates an empty highlight sequence (equivalent to {SGR:NORMAL}).
 .TP 5
@@ -323,12 +391,15 @@
 "\-" for absent capabilities, "@" for canceled rather than "NULL".
 .TP 5
 \fB\-R\fR\fIsubset\fR
-Restrict output to a given subset.  This option is for use with archaic
+Restrict output to a given subset.
+This option is for use with archaic
 versions of terminfo like those on SVr1, Ultrix, or HP/UX that do not support
 the full set of SVR4/XSI Curses terminfo; and variants such as AIX
-that have their own extensions incompatible with SVr4/XSI.  Available terminfo
+that have their own extensions incompatible with SVr4/XSI.
+Available terminfo
 subsets are "SVr1", "Ultrix", "HP", and "AIX"; see \fBterminfo\fR(\*n) for
-details.  You can also choose the subset "BSD" which selects only capabilities
+details.
+You can also choose the subset "BSD" which selects only capabilities
 with termcap equivalents recognized by 4.4BSD.
 .TP
 \fB\-s \fR\fI[d|i|l|c]\fR
@@ -362,7 +433,7 @@
 descriptions are limited (e.g., 1023 for termcap, 4096 for terminfo).
 .TP
 \fB\-t\fR
-tells \fBtic\fP to discard commented-out capabilities.
+tells \fB@TIC@\fP to discard commented-out capabilities.
 Normally when translating from terminfo to termcap,
 untranslatable capabilities are commented-out.
 .TP 5
@@ -385,13 +456,15 @@
 \fB\-x\fR
 print information for user-defined capabilities.
 These are extensions to the terminfo repertoire which can be loaded
-using the \fB\-x\fR option of \fBtic\fP.
+using the \fB\-x\fR option of \fB@TIC@\fP.
 .SH FILES
 .TP 20
 \*d
 Compiled terminal description database.
 .SH EXTENSIONS
 The
+\fB\-0\fR,
+\fB\-1\fR,
 \fB\-E\fR,
 \fB\-F\fR,
 \fB\-G\fR,
@@ -410,7 +483,8 @@
 options are not supported in SVr4 curses.
 .PP
 The \fB\-r\fR option's notion of `termcap' capabilities is System V Release 4's.
-Actual BSD curses versions will have a more restricted set.  To see only the
+Actual BSD curses versions will have a more restricted set.
+To see only the
 4.4BSD set, use \fB\-r\fR \fB\-RBSD\fR.
 .SH BUGS
 The \fB\-F\fR option of \fB@INFOCMP@\fR(1M) should be a \fB@TOE@\fR(1M) mode.
@@ -421,6 +495,8 @@
 \fB@TOE@\fR(1M),
 \fBcurses\fR(3X),
 \fBterminfo\fR(\*n).
+.sp
+http://invisible-island.net/ncurses/tctest.html
 .PP
 This describes \fBncurses\fR
 version @NCURSES_MAJOR@.@NCURSES_MINOR@ (patch @NCURSES_PATCH@).
Index: man/menu_items.3x
Prereq:  1.9 
--- ncurses-5.9/man/menu_items.3x	2010-12-04 18:40:45.000000000 +0000
+++ ncurses-5.9-20130504/man/menu_items.3x	2012-11-03 23:03:59.000000000 +0000
@@ -1,6 +1,6 @@
 '\" t
 .\"***************************************************************************
-.\" Copyright (c) 1998-2006,2010 Free Software Foundation, Inc.              *
+.\" Copyright (c) 1998-2010,2012 Free Software Foundation, Inc.              *
 .\"                                                                          *
 .\" Permission is hereby granted, free of charge, to any person obtaining a  *
 .\" copy of this software and associated documentation files (the            *
@@ -27,7 +27,7 @@
 .\" authorization.                                                           *
 .\"***************************************************************************
 .\"
-.\" $Id: menu_items.3x,v 1.9 2010/12/04 18:40:45 tom Exp $
+.\" $Id: menu_items.3x,v 1.10 2012/11/03 23:03:59 tom Exp $
 .TH menu_items 3X ""
 .SH NAME
 \fBmenu_items\fR \- make and break connections between items and menus
@@ -47,7 +47,7 @@
 The function \fBmenu_items\fR returns the item array of the given menu.
 .PP
 The function \fBitem_count\fR returns the count of items in \fImenu\fR.
-.SH RETURN VALUES
+.SH RETURN VALUE
 The function \fBmenu_items\fR returns a pointer (which may be \fBNULL\fR).
 It does not set errno.
 .PP
Index: man/ncurses.3x
Prereq:  1.103 
--- ncurses-5.9/man/ncurses.3x	2011-02-05 23:21:29.000000000 +0000
+++ ncurses-5.9-20130504/man/ncurses.3x	2013-03-02 22:15:25.000000000 +0000
@@ -1,6 +1,6 @@
 '\" t
 .\"***************************************************************************
-.\" Copyright (c) 1998-2010,2011 Free Software Foundation, Inc.              *
+.\" Copyright (c) 1998-2012,2013 Free Software Foundation, Inc.              *
 .\"                                                                          *
 .\" Permission is hereby granted, free of charge, to any person obtaining a  *
 .\" copy of this software and associated documentation files (the            *
@@ -27,7 +27,7 @@
 .\" authorization.                                                           *
 .\"***************************************************************************
 .\"
-.\" $Id: ncurses.3x,v 1.103 2011/02/05 23:21:29 tom Exp $
+.\" $Id: ncurses.3x,v 1.111 2013/03/02 22:15:25 tom Exp $
 .hy 0
 .TH ncurses 3X ""
 .de bP
@@ -55,8 +55,10 @@
 XSI stands for X/Open System Interfaces Extension.
 The \fBncurses\fR library is freely redistributable in source form.
 Differences from the SVr4
-curses are summarized under the \fBEXTENSIONS\fP and \fBPORTABILITY\fP sections below and
-described in detail in the respective \fBEXTENSIONS\fP, \fBPORTABILITY\fP and \fBBUGS\fP sections
+curses are summarized under the
+\fBEXTENSIONS\fP and \fBPORTABILITY\fP sections below and
+described in detail in the respective
+\fBEXTENSIONS\fP, \fBPORTABILITY\fP and \fBBUGS\fP sections
 of individual man pages.
 .PP
 The \fBncurses\fR library also provides many useful extensions,
@@ -108,9 +110,9 @@
 .sp
 Before a \fBcurses\fR program is run, the tab stops of the terminal
 should be set and its initialization strings, if defined, must be output.
-This can be done by executing the \fBtput init\fR command
+This can be done by executing the \fB@TPUT@ init\fR command
 after the shell environment variable \fBTERM\fR has been exported.
-\fBtset(1)\fR is usually responsible for doing this.
+\fB@TSET@(1)\fR is usually responsible for doing this.
 [See \fBterminfo\fR(\*n) for further details.]
 .PP
 The \fBncurses\fR library permits manipulation of data structures,
@@ -637,6 +639,7 @@
 use_env/\fBcurs_util\fR(3X)
 use_extended_names/\fBcurs_extend\fR(3X)*
 use_legacy_coding/\fBlegacy_coding\fR(3X)*
+use_tioctl/\fBcurs_util\fR(3X)
 vid_attr/\fBcurs_terminfo\fR(3X)
 vid_puts/\fBcurs_terminfo\fR(3X)
 vidattr/\fBcurs_terminfo\fR(3X)
@@ -734,9 +737,16 @@
 integer value other than \fBERR\fR upon successful completion, unless
 otherwise noted in the routine descriptions.
 .PP
+As a general rule, routines check for null pointers passed as parameters,
+and handle this as an error.
+.PP
 All macros return the value of the \fBw\fR version, except \fBsetscrreg\fR,
 \fBwsetscrreg\fR, \fBgetyx\fR, \fBgetbegyx\fR, and \fBgetmaxyx\fR.
-The return values of \fBsetscrreg\fR, \fBwsetscrreg\fR, \fBgetyx\fR, \fBgetbegyx\fR, and
+The return values of
+\fBsetscrreg\fR,
+\fBwsetscrreg\fR,
+\fBgetyx\fR,
+\fBgetbegyx\fR, and
 \fBgetmaxyx\fR are undefined (i.e., these should not be used as the
 right-hand side of assignment statements).
 .PP
@@ -747,9 +757,9 @@
 The most important ones have been already discussed in detail.
 .TP 5
 BAUDRATE
-The debugging library checks this environment symbol when the application
+The debugging library checks this environment variable when the application
 has redirected output to a file.
-The symbol's numeric value is used for the baudrate.
+The variable's numeric value is used for the baudrate.
 If no value is found, \fBncurses\fR uses 9600.
 This allows testers to construct repeatable test-cases
 that take into account costs that depend on baudrate.
@@ -757,7 +767,7 @@
 CC
 When set, change occurrences of the command_character
 (i.e., the \fBcmdch\fP capability)
-of the loaded terminfo entries to the value of this symbol.
+of the loaded terminfo entries to the value of this variable.
 Very few terminfo entries provide this feature.
 .IP
 Because this name is also used in development environments to represent
@@ -786,7 +796,9 @@
 a terminal description for terminals which are run as emulations.
 .IP
 Use the \fBuse_env\fR function to disable all use of external environment
-(including system calls) to determine the screen size.
+(but not including system calls) to determine the screen size.
+Use the \fBuse_tioctl\fR function to update \fBCOLUMNS\fP or \fBLINES\fP
+to match the screen size obtained from system calls or the terminal database.
 .TP 5
 ESCDELAY
 Specifies the total time, in milliseconds, for which ncurses will
@@ -837,8 +849,8 @@
 .br
 3 = middle.
 .sp
-This symbol lets you customize the mouse.
-The symbol must be three numeric digits 1\-3 in any order, e.g., 123 or 321.
+This variable lets you customize the mouse.
+The variable must be three numeric digits 1\-3 in any order, e.g., 123 or 321.
 If it is not specified, \fBncurses\fR uses 132.
 .TP 5
 NCURSES_ASSUMED_COLORS
@@ -899,19 +911,44 @@
 You may wish to use these descriptions,
 but not want to pay the performance penalty.
 .IP
-Set the NCURSES_NO_PADDING symbol to disable all but mandatory
+Set the NCURSES_NO_PADDING environment variable to disable all but mandatory
 padding.
 Mandatory padding is used as a part of special control
 sequences such as \fIflash\fR.
 .TP 5
 NCURSES_NO_SETBUF
-Normally \fBncurses\fR enables buffered output during terminal initialization.
-This is done (as in SVr4 curses) for performance reasons.
+This setting is obsolete.
+Before changes
+.RS
+.bP
+started with 5.9 patch 20120825 
+and
+.bP
+continued
+though 5.9 patch 20130126
+.RE
+.IP
+\fBncurses\fR enabled buffered output during terminal initialization.
+This was done (as in SVr4 curses) for performance reasons.
 For testing purposes, both of \fBncurses\fR and certain applications,
-this feature is made optional.
+this feature was made optional.
 Setting the NCURSES_NO_SETBUF variable
-disables output buffering, leaving the output in the original (usually
+disabled output buffering, leaving the output in the original (usually
 line buffered) mode.
+.IP
+In the current implementation,
+ncurses performs its own buffering and does not require this workaround.
+It does not modify the buffering of the standard output.
+.IP
+The reason for the change was to make the behavior for interrupts and
+other signals more robust.
+One drawback is that certain nonconventional programs would mix
+ordinary stdio calls with ncurses calls and (usually) work.
+This is no longer possible since ncurses is not using
+the buffered standard output but its own output (to the same file descriptor).
+As a special case, the low-level calls such as \fBputp\fP still use the
+standard output.
+But high-level curses calls do not.
 .TP 5
 NCURSES_NO_UTF8_ACS
 During initialization, the \fBncurses\fR library
@@ -933,20 +970,22 @@
 .IP
 As an alternative to the environment variable,
 ncurses checks for an extended terminfo capability \fBU8\fP.
-This is a numeric capability which can be compiled using \fBtic\ \-x\fP.
+This is a numeric capability which can be compiled using \fB@TIC@\ \-x\fP.
 For example
 .RS 5
+.ft CW
 .sp
 .nf
 # linux console, if patched to provide working
 # VT100 shift-in/shift-out, with corresponding font.
 linux-vt100|linux console with VT100 line-graphics,
-	U8#0, use=linux,
+        U8#0, use=linux,
 .sp
 # uxterm with vt100Graphics resource set to false
 xterm-utf8|xterm relying on UTF-8 line-graphics,
-	U8#1, use=xterm,
+        U8#1, use=xterm,
 .fi
+.ft
 .RE
 .IP
 The name "U8" is chosen to be two characters,
@@ -955,7 +994,7 @@
 .TP 5
 NCURSES_TRACE
 During initialization, the \fBncurses\fR debugging library
-checks the NCURSES_TRACE symbol.
+checks the NCURSES_TRACE environment variable.
 If it is defined, to a numeric value, \fBncurses\fR calls the \fBtrace\fR
 function, using that value as the argument.
 .IP
@@ -973,9 +1012,10 @@
 support, \fBncurses\fR will check for a terminal's description in
 termcap form if it is not available in the terminfo database.
 .IP
-The TERMCAP symbol contains either a terminal description (with
+The TERMCAP environment variable contains either a terminal description (with
 newlines stripped out),
-or a file name telling where the information denoted by the TERM symbol exists.
+or a file name telling where the information denoted by
+the TERM environment variable exists.
 In either case, setting it directs \fBncurses\fR to ignore
 the usual place for this information, e.g., /etc/termcap.
 .TP 5
@@ -988,33 +1028,51 @@
 .bP
 the last directory to which \fBncurses\fR wrote, if any, is searched first
 .bP
-the directory specified by the TERMINFO symbol
+the directory specified by the TERMINFO environment variable
 .bP
 $HOME/.terminfo
 .bP
-directories listed in the TERMINFO_DIRS symbol
+directories listed in the TERMINFO_DIRS environment variable
 .bP
 one or more directories whose names are configured and compiled into the
-ncurses library, e.g.,
-@TERMINFO@
+ncurses library, i.e.,
+.RS
+.bP
+@TERMINFO_DIRS@ (corresponding to the TERMINFO_DIRS variable)
+.bP
+@TERMINFO@ (corresponding to the TERMINFO variable)
+.RE
 .RE
 .TP 5
 TERMINFO_DIRS
 Specifies a list of directories to search for terminal descriptions.
 The list is separated by colons (i.e., ":") on Unix, semicolons on OS/2 EMX.
-All of the terminal descriptions are in terminfo form, which makes
-a subdirectory named for the first letter of the terminal names therein.
+.IP
+All of the terminal descriptions are in terminfo form.
+Normally these are stored in a directory tree,
+using subdirectories named by the first letter of the terminal names therein.
+.IP
+If \fBncurses\fP is built with a hashed database,
+then each entry in this list can also be the path of the corresponding
+database file.
+.IP
+If \fBncurses\fP is built with a support for reading termcap files
+directly, then an entry in this list may be the path of a termcap file.
 .TP 5
 TERMPATH
 If TERMCAP does not hold a file name then \fBncurses\fR checks
-the TERMPATH symbol.
-This is a list of filenames separated by spaces or colons (i.e., ":") on Unix, semicolons on OS/2 EMX.
-If the TERMPATH symbol is not set, \fBncurses\fR looks in the files
+the TERMPATH environment variable.
+This is a list of filenames separated by spaces or colons (i.e., ":") on Unix,
+semicolons on OS/2 EMX.
+.IP
+If the TERMPATH environment variable is not set,
+\fBncurses\fR looks in the files
 /etc/termcap, /usr/share/misc/termcap and $HOME/.termcap, in that order.
 .PP
 The library may be configured to disregard the following variables when the
 current user is the superuser (root), or if the application uses setuid or
 setgid permissions:
+.IP
 $TERMINFO, $TERMINFO_DIRS, $TERMPATH, as well as $HOME.
 .SH ALTERNATE CONFIGURATIONS
 Several different configurations are possible,
@@ -1042,8 +1100,9 @@
 to build executables.
 .TP 5
 \-\-enable\-widec
-The configure script renames the library and (if the \fB\-\-disable\-overwrite\fP
-option is used) puts the header files in a different subdirectory.
+The configure script renames the library and
+(if the \fB\-\-disable\-overwrite\fP option is used)
+puts the header files in a different subdirectory.
 All of the library names have a "w" appended to them,
 i.e., instead of
 .RS
@@ -1093,8 +1152,8 @@
 @TERMINFO@
 terminal capability database
 .SH SEE ALSO
-\fBterminfo\fR(\*n) and related pages whose names begin "curs_" for detailed routine
-descriptions.
+\fBterminfo\fR(\*n) and related pages whose names begin
+"curs_" for detailed routine descriptions.
 .br
 \fBcurs_variables\fR(3X) 
 .SH EXTENSIONS
@@ -1144,6 +1203,15 @@
 the XSI Curses and \fBncurses\fR calls) are described in \fBPORTABILITY\fR
 sections of the library man pages.
 .PP
+Unlike other implementations, this one checks parameters such as pointers
+to WINDOW structures to ensure they are not null.
+The main reason for providing this behavior is to guard against programmer
+error.
+The standard interface does not provide a way for the library
+to tell an application which of several possible errors were detected.
+Relying on this (or some other) extension will adversely affect the
+portability of curses applications.
+.PP
 This implementation also contains several extensions:
 .bP
 The routine \fBhas_key\fR is not part of XPG4, nor is it present in SVr4.
Index: man/resizeterm.3x
Prereq:  1.14 
--- ncurses-5.9/man/resizeterm.3x	2010-12-04 18:38:55.000000000 +0000
+++ ncurses-5.9-20130504/man/resizeterm.3x	2012-07-07 18:38:21.000000000 +0000
@@ -1,5 +1,5 @@
 .\"***************************************************************************
-.\" Copyright (c) 1998-2005,2010 Free Software Foundation, Inc.              *
+.\" Copyright (c) 1998-2010,2012 Free Software Foundation, Inc.              *
 .\"                                                                          *
 .\" Permission is hereby granted, free of charge, to any person obtaining a  *
 .\" copy of this software and associated documentation files (the            *
@@ -28,7 +28,7 @@
 .\"
 .\" Author: Thomas E. Dickey 1996-2005
 .\"
-.\" $Id: resizeterm.3x,v 1.14 2010/12/04 18:38:55 tom Exp $
+.\" $Id: resizeterm.3x,v 1.15 2012/07/07 18:38:21 tom Exp $
 .TH resizeterm 3X ""
 .SH NAME
 \fBis_term_resized\fR,
@@ -86,8 +86,6 @@
 the operating system.
 Thus, even if a SIGWINCH is received,
 no screen size change may be recorded.
-In that case, no \fBKEY_RESIZE\fP is queued for the next call to \fBgetch\fP;
-an \fBERR\fP will be returned instead.
 .SH SEE ALSO
 \fBcurs_variables\fR(3X),
 \fBwresize\fR(3X).
Index: man/tabs.1
Prereq:  1.8 
--- ncurses-5.9/man/tabs.1	2010-12-04 18:40:45.000000000 +0000
+++ ncurses-5.9-20130504/man/tabs.1	2011-12-17 23:31:59.000000000 +0000
@@ -1,5 +1,5 @@
 .\"***************************************************************************
-.\" Copyright (c) 2008-2009,2010 Free Software Foundation, Inc.              *
+.\" Copyright (c) 2008-2010,2011 Free Software Foundation, Inc.              *
 .\"                                                                          *
 .\" Permission is hereby granted, free of charge, to any person obtaining a  *
 .\" copy of this software and associated documentation files (the            *
@@ -26,19 +26,19 @@
 .\" authorization.                                                           *
 .\"***************************************************************************
 .\"
-.\" $Id: tabs.1,v 1.8 2010/12/04 18:40:45 tom Exp $
+.\" $Id: tabs.1,v 1.9 2011/12/17 23:31:59 tom Exp $
 .TH @TABS@ 1 ""
 .ds n 5
 .SH NAME
-\fBtabs\fR \- set tabs on a terminal
+\fB@TABS@\fR \- set tabs on a terminal
 .SH SYNOPSIS
-\fBtabs\fR [\fB\-v\fR[\fIn\fR]] [\fB\-ahuUV\fR] \fIfile...\fR
+\fB@TABS@\fR [\fB\-v\fR[\fIn\fR]] [\fB\-ahuUV\fR] \fIfile...\fR
 .br
 .SH DESCRIPTION
 .PP
-The \fBtabs\fP program clears and sets tab-stops on the terminal.
+The \fB@TABS@\fP program clears and sets tab-stops on the terminal.
 This uses the terminfo \fIclear_all_tabs\fP and \fIset_tab\fP capabilities.
-If either is absent, \fBtabs\fP is unable to clear/set tab-stops.
+If either is absent, \fB@TABS@\fP is unable to clear/set tab-stops.
 The terminal should be configured to use hard tabs, e.g.,
 .sp
 .RS
@@ -48,8 +48,8 @@
 .SS General Options
 .TP 5
 .BI \-T "name"
-Tell \fBtabs\fP which terminal type to use.
-If this option is not given, \fBtabs\fP will use the \fB$TERM\fP
+Tell \fB@TABS@\fP which terminal type to use.
+If this option is not given, \fB@TABS@\fP will use the \fB$TERM\fP
 environment variable.
 If that is not set, it will use the \fIansi+tabs\fP entry.
 .TP 5
@@ -59,10 +59,10 @@
 The second data line shows the actual tab-stops, marked with asterisks.
 .TP 5
 .B \-n
-This option tells \fBtabs\fP to check the options and run any debugging
+This option tells \fB@TABS@\fP to check the options and run any debugging
 option, but not to modify the terminal settings.
 .PP
-The \fBtabs\fP program processes a single list of tab stops.
+The \fB@TABS@\fP program processes a single list of tab stops.
 The last option to be processed which defines a list is the one that
 determines the list to be processed.
 .SS Implicit Lists
Index: man/term.7
Prereq:  1.22 
--- ncurses-5.9/man/term.7	2010-12-04 18:41:07.000000000 +0000
+++ ncurses-5.9-20130504/man/term.7	2011-12-17 23:32:17.000000000 +0000
@@ -1,5 +1,5 @@
 .\"***************************************************************************
-.\" Copyright (c) 1998-2007,2010 Free Software Foundation, Inc.              *
+.\" Copyright (c) 1998-2010,2011 Free Software Foundation, Inc.              *
 .\"                                                                          *
 .\" Permission is hereby granted, free of charge, to any person obtaining a  *
 .\" copy of this software and associated documentation files (the            *
@@ -26,7 +26,7 @@
 .\" authorization.                                                           *
 .\"***************************************************************************
 .\"
-.\" $Id: term.7,v 1.22 2010/12/04 18:41:07 tom Exp $
+.\" $Id: term.7,v 1.23 2011/12/17 23:32:17 tom Exp $
 .TH term 7
 .ds n 5
 .ds d @TERMINFO@
@@ -55,7 +55,7 @@
 are in fact using a VT100-superset console, terminal, or terminal emulator.)
 .PP
 In any case, you are free to override the system \fBTERM\fR setting to your
-taste in your shell profile.  The \fBtset\fP(1) utility may be of assistance;
+taste in your shell profile.  The \fB@TSET@\fP(1) utility may be of assistance;
 you can give it a set of rules for deducing or requesting a terminal type based
 on the tty device and baud rate.
 .PP
Index: man/term_variables.3x
Prereq:  1.2 
--- ncurses-5.9/man/term_variables.3x	2010-12-04 18:38:55.000000000 +0000
+++ ncurses-5.9-20130504/man/term_variables.3x	2011-12-17 23:31:50.000000000 +0000
@@ -1,5 +1,5 @@
 .\"***************************************************************************
-.\" Copyright (c) 2010 Free Software Foundation, Inc.                        *
+.\" Copyright (c) 2010,2011 Free Software Foundation, Inc.                   *
 .\"                                                                          *
 .\" Permission is hereby granted, free of charge, to any person obtaining a  *
 .\" copy of this software and associated documentation files (the            *
@@ -26,7 +26,7 @@
 .\" authorization.                                                           *
 .\"***************************************************************************
 .\"
-.\" $Id: term_variables.3x,v 1.2 2010/12/04 18:38:55 tom Exp $
+.\" $Id: term_variables.3x,v 1.3 2011/12/17 23:31:50 tom Exp $
 .TH term_variables 3X ""
 .ds n 5
 .na
@@ -110,7 +110,7 @@
 Alternatively, one can save the return value from \fBnewterm\fP
 or \fBsetupterm\fP to reuse in \fBset_term\fP.
 .SS Terminfo Names
-The \fBtic\fP(1) and \fBinfocmp\fP(1) programs use lookup tables for
+The \fB@TIC@\fP(1) and \fB@INFOCMP@\fP(1) programs use lookup tables for
 the long and short names of terminfo capabilities,
 as well as the corresponding names for termcap capabilities.
 These are available to other applications,
Index: man/terminfo.head
Prereq:  1.18 
--- ncurses-5.9/man/terminfo.head	2010-07-31 16:08:48.000000000 +0000
+++ ncurses-5.9-20130504/man/terminfo.head	2013-03-09 22:11:36.000000000 +0000
@@ -1,5 +1,5 @@
 .\"***************************************************************************
-.\" Copyright (c) 1998-2009,2010 Free Software Foundation, Inc.              *
+.\" Copyright (c) 1998-2012,2013 Free Software Foundation, Inc.              *
 .\"                                                                          *
 .\" Permission is hereby granted, free of charge, to any person obtaining a  *
 .\" copy of this software and associated documentation files (the            *
@@ -26,10 +26,17 @@
 .\" authorization.                                                           *
 .\"***************************************************************************
 .\"
-.\" $Id: terminfo.head,v 1.18 2010/07/31 16:08:48 tom Exp $
+.\" $Id: terminfo.head,v 1.21 2013/03/09 22:11:36 tom Exp $
 .TH terminfo 5 "" "" "File Formats"
 .ds n 5
 .ds d @TERMINFO@
+.ie \n(.g .ds `` \(lq
+.el       .ds `` ``
+.ie \n(.g .ds '' \(rq
+.el       .ds '' ''
+.de bP
+.IP \(bu 4
+..
 .SH NAME
 terminfo \- terminal capability data base
 .SH SYNOPSIS
@@ -74,7 +81,7 @@
 Terminal names (except for the last, verbose entry) should
 be chosen using the following conventions.
 The particular piece of hardware making up the terminal should
-have a root name, thus ``hp2621''.
+have a root name, thus \*(``hp2621\*(''.
 This name should not contain hyphens.
 Modes that the hardware can be in, or user preferences, should
 be indicated by appending a hyphen and a mode suffix.
@@ -102,6 +109,6 @@
 .TE
 .PP
 For more on terminal naming conventions, see the \fBterm(7)\fR manual page.
-.SS Capabilities
+.SS Predefined Capabilities
 .\" Head of terminfo man page ends here
 .ps -1
Index: man/terminfo.tail
Prereq:  1.53 
--- ncurses-5.9/man/terminfo.tail	2010-12-04 18:38:55.000000000 +0000
+++ ncurses-5.9-20130504/man/terminfo.tail	2013-03-03 00:06:39.000000000 +0000
@@ -1,8 +1,51 @@
-.\" $Id: terminfo.tail,v 1.53 2010/12/04 18:38:55 tom Exp $
+.\" $Id: terminfo.tail,v 1.61 2013/03/03 00:06:39 tom Exp $
 .\" Beginning of terminfo.tail file
 .\" This file is part of ncurses.
 .\" See "terminfo.head" for copyright.
 .ps +1
+.SS User-Defined Capabilities
+.
+The preceding section listed the \fIpredefined\fP capabilities.
+They deal with some special features for terminals no longer
+(or possibly never) produced.
+Occasionally there are special features of newer terminals which
+are awkward or impossible to represent by reusing the predefined
+capabilities.
+.PP
+\fBncurses\fP addresses this limitation by allowing user-defined capabilities.
+The \fB@TIC@\fP and \fB@INFOCMP@\fP programs provide
+the \fB\-x\fP option for this purpose.
+When \fB\-x\fP is set,
+\fB@TIC@\fP treats unknown capabilities as user-defined.
+That is, if \fB@TIC@\fP encounters a capability name
+which it does not recognize,
+it infers its type (boolean, number or string) from the syntax
+and makes an extended table entry for that capability.
+The \fBuse_extended_names\fP function makes this information
+conditionally available to applications.
+The ncurses library provides the data leaving most of the behavior
+to applications:
+.bP
+User-defined capability strings whose name begins
+with \*(``k\*('' are treated as function keys.
+.bP
+The types (boolean, number, string) determined by \fB@TIC@\fP
+can be inferred by successful calls on \fBtigetflag\fP, etc.
+.bP
+If the capability name happens to be two characters,
+the capability is also available through the termcap interface.
+.PP
+While termcap is said to be extensible because it does not use a predefined set
+of capabilities,
+in practice it has been limited to the capabilities defined by
+terminfo implementations.
+As a rule,
+user-defined capabilities intended for use by termcap applications should
+be limited to booleans and numbers to avoid running past the 1023 byte
+limit assumed by termcap implementations and their applications.
+In particular, providing extended sets of function keys (past the 60
+numbered keys and the handful of special named keys) is best done using
+the longer names available using terminfo.
 .
 .SS A Sample Entry
 .
@@ -39,13 +82,18 @@
 .PP
 Entries may continue onto multiple lines by placing white space at
 the beginning of each line except the first.
-Comments may be included on lines beginning with ``#''.
+Comments may be included on lines beginning with \*(``#\*(''.
 Capabilities in
 .I terminfo
 are of three types:
+.bP
 Boolean capabilities which indicate that the terminal has
-some particular feature, numeric capabilities giving the size of the terminal
-or the size of particular delays, and string
+some particular feature,
+.bP
+numeric capabilities giving the size of the terminal
+or the size of particular delays, and
+.bP
+string
 capabilities, which give a sequence which can be used to perform particular
 terminal operations.
 .PP
@@ -75,14 +123,29 @@
 \fB^x\fR maps to a control-x for any appropriate x, and the sequences
 \fB\en \el \er \et \eb \ef \es\fR give
 a newline, line-feed, return, tab, backspace, form-feed, and space.
-Other escapes include \fB\e^\fR for \fB^\fR,
+Other escapes include
+.bP
+\fB\e^\fR for \fB^\fR,
+.bP
 \fB\e\e\fR for \fB\e\fR,
+.bP
 \fB\e\fR, for comma,
+.bP
 \fB\e:\fR for \fB:\fR,
+.bP
 and \fB\e0\fR for null.
-(\fB\e0\fR will produce \e200, which does not terminate a string but behaves
+.IP
+\fB\e0\fR will produce \e200, which does not terminate a string but behaves
 as a null character on most terminals, providing CS7 is specified.
-See stty(1).)
+See stty(1).
+.IP
+The reason for this quirk is to maintain binary compatibility of the
+compiled terminfo files with other implementations,
+e.g., the SVr4 systems, which document this.
+Compiled terminfo files use null-terminated strings, with no lengths.
+Modifying this would require a new binary format, 
+which would not work with other implementations.
+.PP
 Finally, characters may be given as three octal digits after a \fB\e\fR.
 .PP
 A delay in milliseconds may appear anywhere in a string capability, enclosed in
@@ -115,27 +178,36 @@
 .PP
 .SS Fetching Compiled Descriptions
 .PP
+The \fBncurses\fP library searches for terminal descriptions in several places.
+It uses only the first description found.
+The library has a compiled-in list of places to search
+which can be overridden by environment variables.
+Before starting to search,
+\fBncurses\fP eliminates duplicates in its search list.
+.bP
 If the environment variable TERMINFO is set, it is interpreted as the pathname
 of a directory containing the compiled description you are working on.
-Only
-that directory is searched.
-.PP
-If TERMINFO is not set, the \fBncurses\fR version of the terminfo reader code
-will instead look in the directory \fB$HOME/.terminfo\fR
+Only that directory is searched.
+.bP
+If TERMINFO is not set,
+\fBncurses\fR will instead look in the directory \fB$HOME/.terminfo\fR
 for a compiled description.
-If it fails to find one there, and the environment variable TERMINFO_DIRS is
-set, it will interpret the contents of that variable as a list of colon-
-separated directories to be searched (an empty entry is interpreted as a
-command to search \fI\*d\fR).
-If no description is found in any of the
-TERMINFO_DIRS directories, the fetch fails.
-.PP
-If neither TERMINFO nor TERMINFO_DIRS is set, the last place tried will be the
-system terminfo directory, \fI\*d\fR.
-.PP
-(Neither the \fB$HOME/.terminfo\fR lookups nor TERMINFO_DIRS extensions are
-supported under stock System V terminfo/curses.)
-.PP
+.bP
+Next, if the environment variable TERMINFO_DIRS is set,
+\fBncurses\fR will interpret the contents of that variable
+as a list of colon-separated directories (or database files) to be searched.
+.IP
+An empty directory name (i.e., if the variable begins or ends
+with a colon, or contains adacent colons)
+is interpreted as the system location \fI\*d\fR.
+.bP
+Finally, \fBncurses\fP searches these compiled-in locations:
+.RS
+.bP
+a list of directories (@TERMINFO_DIRS@), and
+.bP
+the system terminfo directory, \fI\*d\fR (the compiled-in default).
+.RE
 .SS Preparing Descriptions
 .PP
 We now outline how to prepare descriptions of terminals.
@@ -397,7 +469,7 @@
 .IP
 where c\di\u are conditions, b\di\u are bodies.
 .IP
-Use the \fB\-f\fP option of \fBtic\fP or \fB@INFOCMP@\fP to see
+Use the \fB\-f\fP option of \fB@TIC@\fP or \fB@INFOCMP@\fP to see
 the structure of if-then-else's.
 Some strings, e.g., \fBsgr\fP can be very complicated when written
 on one line.
@@ -593,6 +665,7 @@
 a distinction between typed and untyped blanks on the screen, shifting
 upon an insert or delete only to an untyped blank on the screen which is
 either eliminated, or expanded to two untyped blanks.
+.PP
 You can determine the
 kind of terminal you have by clearing the screen and then typing
 text separated by cursor motions.
@@ -608,6 +681,7 @@
 current line and onto the next as you insert, you have the second type of
 terminal, and should give the capability \fBin\fR, which stands for
 \*(lqinsert null\*(rq.
+.PP
 While these are two logically separate attributes (one line versus multi-line
 insert mode, and special treatment of untyped spaces) we have seen no
 terminals whose insert mode cannot be described with the single attribute.
@@ -824,9 +898,9 @@
 The only drawback to adding an sgr string is that termcap also
 assumes that sgr0 does not exit alternate character set mode.
 .PP
-Terminals with the ``magic cookie'' glitch
+Terminals with the \*(``magic cookie\*('' glitch
 .RB ( xmc )
-deposit special ``cookies'' when they receive mode-setting sequences,
+deposit special \*(``cookies\*('' when they receive mode-setting sequences,
 which affect the display algorithm rather than having extra bits for
 each character.
 Some terminals, such as the HP 2621, automatically leave standout
@@ -871,6 +945,7 @@
 If the keypad can be set to transmit or not transmit,
 give these codes as \fBsmkx\fR and \fBrmkx\fR.
 Otherwise the keypad is assumed to always transmit.
+.PP
 The codes sent by the left arrow, right arrow, up arrow, down arrow,
 and home keys can be given as
 \fBkcub1, kcuf1, kcuu1, kcud1, \fRand\fB khome\fR respectively.
@@ -878,41 +953,60 @@
 can be given as \fBkf0, kf1, ..., kf10\fR.
 If these keys have labels other than the default f0 through f10, the labels
 can be given as \fBlf0, lf1, ..., lf10\fR.
+.PP
 The codes transmitted by certain other special keys can be given:
+.bP
 .B kll
 (home down),
+.bP
 .B kbs
 (backspace),
+.bP
 .B ktbc
 (clear all tabs),
+.bP
 .B kctab
 (clear the tab stop in this column),
+.bP
 .B kclr
 (clear screen or erase key),
+.bP
 .B kdch1
 (delete character),
+.bP
 .B kdl1
 (delete line),
+.bP
 .B krmir
 (exit insert mode),
+.bP
 .B kel
 (clear to end of line),
+.bP
 .B ked
 (clear to end of screen),
+.bP
 .B kich1
 (insert character or enter insert mode),
+.bP
 .B kil1
 (insert line),
+.bP
 .B knp
 (next page),
+.bP
 .B kpp
 (previous page),
+.bP
 .B kind
 (scroll forward/down),
+.bP
 .B kri
 (scroll backward/up),
+.bP
 .B khts
 (set a tab stop in this column).
+.PP
 In addition, if the keypad has a 3 by 3 array of keys including the four
 arrow keys, the other five keys can be given as
 .BR ka1 ,
@@ -956,7 +1050,7 @@
 tab stop can be given as
 .B ht
 (usually control I).
-A ``back-tab'' command which moves leftward to the preceding tab stop can
+A \*(``back-tab\*('' command which moves leftward to the preceding tab stop can
 be given as
 .BR cbt .
 By convention, if the teletype modes indicate that tabs are being
@@ -974,7 +1068,7 @@
 .B it
 is given, showing the number of spaces the tabs are set to.
 This is normally used by the
-.IR tset
+.IR @TSET@
 command to determine whether to set the mode for hardware tab expansion,
 and whether to set the tab stops.
 If the terminal has tab stops that can be saved in non-volatile memory,
@@ -1303,6 +1397,7 @@
 yellow	\fBCOLOR_YELLOW\fR	6	max,max,0
 white	\fBCOLOR_WHITE\fR	7	max,max,max
 .TE
+.PP
 It is important to not confuse the two sets of color capabilities;
 otherwise red/blue will be interchanged on the display.
 .PP
@@ -1420,13 +1515,13 @@
 .I virtual
 terminal descriptions for which the escape sequences are known.)
 .PP
-If the terminal has a ``meta key'' which acts as a shift key,
+If the terminal has a \*(``meta key\*('' which acts as a shift key,
 setting the 8th bit of any character transmitted, this fact can
 be indicated with
 .BR km .
 Otherwise, software will assume that the 8th bit is parity and it
 will usually be cleared.
-If strings exist to turn this ``meta mode'' on and off, they
+If strings exist to turn this \*(``meta mode\*('' on and off, they
 can be given as
 .B smm
 and
@@ -1488,7 +1583,7 @@
 Note: the variable indicating this is now `dest_tabs_magic_smso'; in
 older versions, it was teleray_glitch.
 This glitch is also taken to mean that it is not possible to position
-the cursor on top of a ``magic cookie'',
+the cursor on top of a \*(``magic cookie\*('',
 that to erase standout mode it is instead necessary to use
 delete and insert line.
 The ncurses implementation ignores this glitch.
@@ -1524,8 +1619,10 @@
 A capability can be canceled by placing \fBxx@\fR to the left of the
 use reference that imports it, where \fIxx\fP is the capability.
 For example, the entry
+.RS
 .PP
-	2621\-nl, smkx@, rmkx@, use=2621,
+2621\-nl, smkx@, rmkx@, use=2621,
+.RE
 .PP
 defines a 2621\-nl that does not have the \fBsmkx\fR or \fBrmkx\fR capabilities,
 and hence does not turn on the function key labels when in visual mode.
@@ -1570,19 +1667,15 @@
 backslash-newline pairs, which \fBtgetent()\fP strips out while reading it.
 Some termcap libraries strip off the final newline, too (GNU termcap does not).
 Now suppose:
-.TP 5
-*
+.bP
 a termcap entry before expansion is more than 1023 bytes long,
-.TP 5
-*
+.bP
 and the application has only allocated a 1k buffer,
-.TP 5
-*
+.bP
 and the termcap library (like the one in BSD/OS 1.1 and GNU) reads
 the whole entry into the buffer, no matter what its length, to see
 if it is the entry it wants,
-.TP 5
-*
+.bP
 and \fBtgetent()\fP is searching for a terminal type that either is the
 long entry, appears in the termcap file after the long entry, or
 does not appear in the file at all (so that \fBtgetent()\fP has to search
@@ -1625,6 +1718,11 @@
 SVr1, and have added extension capabilities to the string table that (in the
 binary format) collide with System V and XSI Curses extensions.
 .SH EXTENSIONS
+.PP
+Searching for terminal descriptions in
+\fB$HOME/.terminfo\fR and TERMINFO_DIRS 
+is not supported by older implementations.
+.PP
 Some SVr4 \fBcurses\fR implementations, and all previous to SVr4, do not
 interpret the %A and %O operators in parameter strings.
 .PP
@@ -1666,9 +1764,9 @@
 .PP
 \fBSVr1, Ultrix\fR \-\-
 These support a restricted subset of terminfo capabilities.
-The booleans
-end with \fBxon_xoff\fR; the numerics with \fBwidth_status_line\fR; and the
-strings with \fBprtr_non\fR.
+The booleans end with \fBxon_xoff\fR;
+the numerics with \fBwidth_status_line\fR;
+and the strings with \fBprtr_non\fR.
 .PP
 \fBHP/UX\fR \-\-
 Supports the SVr1 subset, plus the SVr[234] numerics \fBnum_labels\fR,
Index: man/tic.1m
Prereq:  1.47 
--- ncurses-5.9/man/tic.1m	2010-12-04 18:38:55.000000000 +0000
+++ ncurses-5.9-20130504/man/tic.1m	2013-02-02 22:09:02.000000000 +0000
@@ -1,5 +1,5 @@
 .\"***************************************************************************
-.\" Copyright (c) 1998-2006,2010 Free Software Foundation, Inc.              *
+.\" Copyright (c) 1998-2012,2013 Free Software Foundation, Inc.              *
 .\"                                                                          *
 .\" Permission is hereby granted, free of charge, to any person obtaining a  *
 .\" copy of this software and associated documentation files (the            *
@@ -26,19 +26,25 @@
 .\" authorization.                                                           *
 .\"***************************************************************************
 .\"
-.\" $Id: tic.1m,v 1.47 2010/12/04 18:38:55 tom Exp $
+.\" $Id: tic.1m,v 1.57 2013/02/02 22:09:02 tom Exp $
 .TH @TIC@ 1M ""
 .ds n 5
 .ds d @TERMINFO@
+.de bP
+.IP \(bu 4
+..
 .SH NAME
-\fBtic\fR \- the \fIterminfo\fR entry-description compiler
+\fB@TIC@\fR \- the \fIterminfo\fR entry-description compiler
 .SH SYNOPSIS
-\fBtic\fR
+\fB@TIC@\fR
 [\fB\-\
+0\
 1\
 C\
+D\
 G\
 I\
+K\
 L\
 N\
 T\
@@ -61,31 +67,69 @@
 \fIfile\fR
 .br
 .SH DESCRIPTION
-The command \fBtic\fR translates a \fBterminfo\fR file from source
+The \fB@TIC@\fR command translates a \fBterminfo\fR file from source
 format into compiled format.
 The compiled format is necessary for use with
 the library routines in \fBncurses\fR(3X).
 .PP
-The results are normally placed in the system terminfo
-directory \fB\*d\fR.
-There are two ways to change this behavior.
-.PP
-First, you may override the system default by setting the variable
-\fBTERMINFO\fR in your shell environment to a valid (existing) directory name.
-.PP
-Secondly, if \fBtic\fR cannot get access to \fI\*d\fR or your TERMINFO
-directory, it looks for the directory \fI$HOME/.terminfo\fR; if that directory
-exists, the entry is placed there.
-.PP
-Libraries that read terminfo entries are expected to check for a TERMINFO
-directory first, look at \fI$HOME/.terminfo\fR if TERMINFO is not set, and
-finally look in \fI\*d\fR.
+As described in \fBterm\fR(\*n), the database may be either a directory
+tree (one file per terminal entry) or a hashed database (one record per entry).
+The \fB@TIC@\fR command writes only one type of entry,
+depending on how it was built:
+.bP
+For directory trees, the top-level directory, e.g., /usr/share/terminfo,
+specifies the location of the database.
+.bP
+For hashed databases, a filename is needed.
+If the given file is not found by that name,
+but can be found by adding the suffix ".db",
+then that is used.
+.IP
+The default name for the hashed database is the same as the
+default directory name (only adding a ".db" suffix).
+.PP
+In either case (directory or hashed database),
+\fB@TIC@\fP will create the container if it does not exist.
+For a directory, this would be the "terminfo" leaf,
+versus a "terminfo.db" file.
+.PP
+The results are normally placed in the system terminfo database \fB\*d\fR.
+The compiled terminal description can be placed
+in a different terminfo database.
+There are two ways to achieve this:
+.bP
+First, you may override the system default either by
+using the \fB\-o\fP option,
+or by setting the variable \fBTERMINFO\fR
+in your shell environment to a valid database location.
+.bP
+Secondly, if \fB@TIC@\fR cannot write in \fI\*d\fR
+or the location specified using your TERMINFO variable,
+it looks for the directory \fI$HOME/.terminfo\fR
+(or hashed database \fI$HOME/.terminfo.db)\fR;
+if that location exists, the entry is placed there.
+.PP
+Libraries that read terminfo entries are expected to check in succession
+.bP
+a location specified with the TERMINFO environment variable,
+.bP
+\fI$HOME/.terminfo\fR,
+.bP
+directories listed in the TERMINFO_DIRS environment variable,
+.bP
+a compiled-in list of directories (@TERMINFO_DIRS@), and
+.bP
+the system terminfo database (\fI\*d\fR).
+.SS OPTIONS
+.TP
+\fB\-0\fR
+restricts the output to a single line
 .TP
 \fB\-1\fR
 restricts the output to a single column
 .TP
 \fB\-a\fR
-tells \fBtic\fP to retain commented-out capabilities rather than discarding
+tells \fB@TIC@\fP to retain commented-out capabilities rather than discarding
 them.
 Capabilities are commented by prefixing them with a period.
 This sets the \fB\-x\fR option, because it treats the commented-out
@@ -101,16 +145,30 @@
 Capabilities
 that are not translatable are left in the entry under their terminfo names
 but commented out with two preceding dots.
+The actual format used incorporates some improvements for escaped characters
+from terminfo format.
+For a stricter BSD-compatible translation, add the \fB\-K\fR option.
 .TP
 \fB\-c\fR
-tells \fBtic\fP to only check \fIfile\fR for errors, including syntax problems and
+tells \fB@TIC@\fP to only check \fIfile\fR for errors, including syntax problems and
 bad use links.
 If you specify \fB\-C\fR (\fB\-I\fR) with this option, the code
 will print warnings about entries which, after use resolution, are more than
 1023 (4096) bytes long.
-Due to a fixed buffer length in older termcap
-libraries (and a documented limit in terminfo), these entries may cause core
-dumps.
+Due to a fixed buffer length in older termcap libraries,
+as well as buggy checking for the buffer length
+(and a documented limit in terminfo),
+these entries may cause core
+dumps with other implementations.
+.TP
+\fB\-D\fR
+tells \fB@TIC@\fP to print the database locations that it knows about, and exit.
+The first location shown is the one to which it would write compiled
+terminal descriptions.
+If \fB@TIC@\fP is not able to find a writable database location
+according to the rules summarized above,
+it will print a diagnostic and exit with an error rather than
+printing a list of database locations.
 .TP
 \fB\-e \fR\fInames\fR
 Limit writes and translations to the following comma-separated list of
@@ -137,6 +195,10 @@
 \fB\-I\fR
 Force source translation to terminfo format.
 .TP
+\fB\-K\fR
+Suppress some longstanding ncurses extensions to termcap format,
+e.g., "\\s" for space.
+.TP
 \fB\-L\fR
 Force source translation to terminfo format
 using the long C variable names listed in <\fBterm.h\fR>
@@ -155,9 +217,8 @@
 obsolete capabilities.
 .TP
 \fB\-o\fR\fIdir\fR
-Write compiled entries to given directory.
-Overrides the TERMINFO environment
-variable.
+Write compiled entries to given database location.
+Overrides the TERMINFO environment variable.
 .TP
 \fB\-R\fR\fIsubset\fR
 Restrict output to a given subset.
@@ -177,7 +238,7 @@
 tc capabilities per entry.
 .TP
 \fB\-s\fR
-Summarize the compile by showing the directory into which entries
+Summarize the compile by showing the database location into which entries
 are written, and the number of entries which are compiled.
 .TP
 \fB\-T\fR
@@ -186,12 +247,12 @@
 descriptions are limited (e.g., 1023 for termcap, 4096 for terminfo).
 .TP
 \fB\-t\fR
-tells \fBtic\fP to discard commented-out capabilities.
+tells \fB@TIC@\fP to discard commented-out capabilities.
 Normally when translating from terminfo to termcap,
 untranslatable capabilities are commented-out.
 .TP 5
 \fB\-U\fR
-tells \fBtic\fP to not post-process the data after parsing the source file.
+tells \fB@TIC@\fP to not post-process the data after parsing the source file.
 Normally, it infers data which is commonly missing in older terminfo data,
 or in termcaps.
 .TP
@@ -200,31 +261,13 @@
 .TP
 \fB\-v\fR\fIn\fR
 specifies that (verbose) output be written to standard error trace
-information showing \fBtic\fR's progress.
+information showing \fB@TIC@\fR's progress.
 The optional parameter \fIn\fR is a number from 1 to 10, inclusive,
 indicating the desired level of detail of information.
 If \fIn\fR is omitted, the default level is 1.
 If \fIn\fR is specified and greater than 1, the level of
 detail is increased.
-.TP
-\fB\-w\fR\fIn\fR
-specifies the width of the output.
-The parameter is optional.
-If it is omitted, it defaults to 60.
-.TP
-\fB\-x\fR
-Treat unknown capabilities as user-defined.
-That is, if you supply a capability name which \fBtic\fP does not recognize,
-it will infer its type (boolean, number or string) from the syntax and
-make an extended table entry for that.
-User-defined capability strings
-whose name begins with ``k'' are treated as function keys.
-.TP
-\fIfile\fR
-contains one or more \fBterminfo\fR terminal descriptions in source
-format [see \fBterminfo\fR(\*n)].
-Each description in the file
-describes the capabilities of a particular terminal.
+.RS
 .PP
 The debug flag levels are as follows:
 .TP
@@ -250,19 +293,42 @@
 All values computed in construction of the hash table
 .LP
 If the debug level \fIn\fR is not given, it is taken to be one.
+.RE
+.TP
+\fB\-w\fR\fIn\fR
+specifies the width of the output.
+The parameter is optional.
+If it is omitted, it defaults to 60.
+.TP
+\fB\-x\fR
+Treat unknown capabilities as user-defined.
+That is, if you supply a capability name which \fB@TIC@\fP does not recognize,
+it will infer its type (boolean, number or string) from the syntax and
+make an extended table entry for that.
+User-defined capability strings
+whose name begins with ``k'' are treated as function keys.
+.SS PARAMETERS
+.TP
+\fIfile\fR
+contains one or more \fBterminfo\fR terminal descriptions in source
+format [see \fBterminfo\fR(\*n)].
+Each description in the file
+describes the capabilities of a particular terminal.
+.IP
+If \fIfile\fR is ``-'', then the data is read from the standard input.
+The \fIfile\fR parameter may also be the path of a character-device.
+.SS PROCESSING
 .PP
-All but one of the capabilities recognized by \fBtic\fR are documented
+All but one of the capabilities recognized by \fB@TIC@\fR are documented
 in \fBterminfo\fR(\*n).
 The exception is the \fBuse\fR capability.
 .PP
 When a \fBuse\fR=\fIentry\fR\-\fIname\fR field is discovered in a
-terminal entry currently being compiled, \fBtic\fR reads in the binary
+terminal entry currently being compiled, \fB@TIC@\fR reads in the binary
 from \fB\*d\fR to complete the entry.
 (Entries created from
 \fIfile\fR will be used first.
-If the environment variable
-\fBTERMINFO\fR is set, that directory is searched instead of
-\fB\*d\fR.)  \fBtic\fR duplicates the capabilities in
+\fB@TIC@\fR duplicates the capabilities in
 \fIentry\fR\-\fIname\fR for the current entry, with the exception of
 those capabilities that explicitly are defined in the current entry.
 .PP
@@ -272,9 +338,6 @@
 \fBentry_name_1\fR before \fBuse=\fR for these capabilities to be
 canceled in \fBentry_name_1\fR.
 .PP
-If the environment variable \fBTERMINFO\fR is set, the compiled
-results are placed there instead of \fB\*d\fR.
-.PP
 Total compiled entries cannot exceed 4096 bytes.
 The name field cannot
 exceed 512 bytes.
@@ -282,14 +345,14 @@
 (32 characters on systems with long filenames, 14 characters otherwise)
 will be truncated to the maximum alias length and a warning message will be printed.
 .SH COMPATIBILITY
-There is some evidence that historic \fBtic\fR implementations treated
+There is some evidence that historic \fB@TIC@\fR implementations treated
 description fields with no whitespace in them as additional aliases or
 short names.
-This \fBtic\fR does not do that, but it does warn when
+This \fB@TIC@\fR does not do that, but it does warn when
 description fields may be treated that way and check them for dangerous
 characters.
 .SH EXTENSIONS
-Unlike the stock SVr4 \fBtic\fR command, this implementation can actually
+Unlike the SVr4 \fB@TIC@\fR command, this implementation can actually
 compile termcap sources.
 In fact, entries in terminfo and termcap syntax can
 be mixed in a single source file.
@@ -298,16 +361,20 @@
 .PP
 The SVr4 manual pages are not clear on the resolution rules for \fBuse\fR
 capabilities.
-This implementation of \fBtic\fR will find \fBuse\fR targets anywhere
+This implementation of \fB@TIC@\fR will find \fBuse\fR targets anywhere
 in the source file, or anywhere in the file tree rooted at \fBTERMINFO\fR (if
-\fBTERMINFO\fR is defined), or in the user's \fI$HOME/.terminfo\fR directory
-(if it exists), or (finally) anywhere in the system's file tree of
+\fBTERMINFO\fR is defined),
+or in the user's \fI$HOME/.terminfo\fR database
+(if it exists),
+or (finally) anywhere in the system's file tree of
 compiled entries.
 .PP
-The error messages from this \fBtic\fR have the same format as GNU C
+The error messages from this \fB@TIC@\fR have the same format as GNU C
 error messages, and can be parsed by GNU Emacs's compile facility.
 .PP
 The
+\fB\-0\fR,
+\fB\-1\fR,
 \fB\-C\fR,
 \fB\-G\fR,
 \fB\-I\fR,
@@ -329,7 +396,7 @@
 The SVr4 \fB\-c\fR mode does not report bad use links.
 .PP
 System V does not compile entries to or read entries from your
-\fI$HOME/.terminfo\fR directory unless TERMINFO is explicitly set to it.
+\fI$HOME/.terminfo\fR database unless TERMINFO is explicitly set to it.
 .SH FILES
 .TP 5
 \fB\*d/?/*\fR
@@ -340,6 +407,7 @@
 \fB@INFOTOCAP@\fR(1M),
 \fB@TOE@\fR(1M),
 \fBcurses\fR(3X),
+\fBterm\fR(\*n).
 \fBterminfo\fR(\*n).
 .PP
 This describes \fBncurses\fR
Index: man/toe.1m
Prereq:  1.23 
--- ncurses-5.9/man/toe.1m	2010-12-04 18:40:45.000000000 +0000
+++ ncurses-5.9-20130504/man/toe.1m	2012-01-01 00:40:51.000000000 +0000
@@ -1,5 +1,5 @@
 .\"***************************************************************************
-.\" Copyright (c) 1998-2008,2010 Free Software Foundation, Inc.              *
+.\" Copyright (c) 1998-2010,2011 Free Software Foundation, Inc.              *
 .\"                                                                          *
 .\" Permission is hereby granted, free of charge, to any person obtaining a  *
 .\" copy of this software and associated documentation files (the            *
@@ -26,19 +26,19 @@
 .\" authorization.                                                           *
 .\"***************************************************************************
 .\"
-.\" $Id: toe.1m,v 1.23 2010/12/04 18:40:45 tom Exp $
+.\" $Id: toe.1m,v 1.26 2012/01/01 00:40:51 tom Exp $
 .TH @TOE@ 1M ""
 .ds n 5
 .ds d @TERMINFO@
 .SH NAME
-\fBtoe\fR \- table of (terminfo) entries
+\fB@TOE@\fR \- table of (terminfo) entries
 .SH SYNOPSIS
-\fBtoe\fR [\fB\-v\fR[\fIn\fR]] [\fB\-ahuUV\fR] \fIfile...\fR
+\fB@TOE@\fR [\fB\-v\fR[\fIn\fR]] [\fB\-ahsuUV\fR] \fIfile...\fR
 .br
 .SH DESCRIPTION
 .PP
 With no options,
-\fBtoe\fR lists all available terminal types by primary name
+\fB@TOE@\fR lists all available terminal types by primary name
 with descriptions.
 File arguments specify the directories to be scanned; if no
 such arguments are given,
@@ -52,6 +52,15 @@
 \fB\-a\fR
 report on all of the terminal databases which ncurses would search,
 rather than only the first one that it finds.
+.IP
+If the \fB\-s\fR is also given, \fB@TOE@\fR
+adds a column to the report,
+showing (like \fBconflict\fP(1)) which entries which 
+belong to a given terminal database.
+An "*" marks entries which differ, and "+" marks equivalent entries.
+.TP
+\fB\-s\fR
+sort the output by the entry names.
 .TP
 \fB\-u\fR \fIfile\fR
 says to write a report to the standard output,
@@ -78,7 +87,7 @@
 .TP
 \fB\-v\fR\fIn\fR
 specifies that (verbose) output be written to standard error,
-showing \fBtoe\fR's progress.
+showing \fB@TOE@\fR's progress.
 The optional parameter \fIn\fR is a number from 1 to 10,
 interpreted as for \fB@TIC@\fR(1M).
 .TP
Index: man/tput.1
Prereq:  1.29 
--- ncurses-5.9/man/tput.1	2010-12-04 18:41:07.000000000 +0000
+++ ncurses-5.9-20130504/man/tput.1	2012-07-14 21:06:45.000000000 +0000
@@ -1,6 +1,6 @@
 '\" t
 .\"***************************************************************************
-.\" Copyright (c) 1998-2006,2010 Free Software Foundation, Inc.              *
+.\" Copyright (c) 1998-2011,2012 Free Software Foundation, Inc.              *
 .\"                                                                          *
 .\" Permission is hereby granted, free of charge, to any person obtaining a  *
 .\" copy of this software and associated documentation files (the            *
@@ -27,7 +27,7 @@
 .\" authorization.                                                           *
 .\"***************************************************************************
 .\"
-.\" $Id: tput.1,v 1.29 2010/12/04 18:41:07 tom Exp $
+.\" $Id: tput.1,v 1.32 2012/07/14 21:06:45 tom Exp $
 .TH @TPUT@ 1 ""
 .ds d @TERMINFO@
 .ds n 1
@@ -77,11 +77,12 @@
 and the \fIcapname\fR associated with each, see \fBterminfo\fR(5).
 .TP
 \fB\-T\fR\fItype\fR
-indicates the \fItype\fR of terminal.  Normally this option is
+indicates the \fItype\fR of terminal.
+Normally this option is
 unnecessary, because the default is taken from the environment
-variable \fBTERM\fR.  If \fB\-T\fR is specified, then the shell
-variables \fBLINES\fR and \fBCOLUMNS\fR will be ignored,and the
-operating system will not be queried for the actual screen size.
+variable \fBTERM\fR.
+If \fB\-T\fR is specified, then the shell
+variables \fBLINES\fR and \fBCOLUMNS\fR will also be ignored.
 .TP
 \fIcapname\fR
 indicates the capability from the \fBterminfo\fR database.  When
@@ -159,7 +160,7 @@
 .PP
 If \fB@TPUT@\fR is invoked by a link named \fBreset\fR, this has the
 same effect as \fB@TPUT@ reset\fR.
-See \fBtset\fR for comparison, which has similar behavior.
+See \fB@TSET@\fR for comparison, which has similar behavior.
 .SH EXAMPLES
 .TP 5
 \fB@TPUT@ init\fR
@@ -275,7 +276,7 @@
 .PP
 Any other exit code indicates an error; see the DIAGNOSTICS section.
 .SH DIAGNOSTICS
-\fBtput\fR prints the following error messages and sets the corresponding exit
+\fB@TPUT@\fR prints the following error messages and sets the corresponding exit
 codes.
 .PP
 .ne 15
@@ -303,17 +304,29 @@
 .PP
 X/Open documents only the operands for \fBclear\fP, \fBinit\fP and \fBreset\fP.
 In this implementation, \fBclear\fP is part of the \fIcapname\fR support.
-Other implementations of \fBtput\fP on
+Other implementations of \fB@TPUT@\fP on
 SVr4-based systems such as Solaris, IRIX64 and HPUX
 as well as others such as AIX and Tru64
 provide support for \fIcapname\fR operands.
+.PP
 A few platforms such as FreeBSD and NetBSD recognize termcap names rather
-than terminfo capability names in their respective \fBtput\fP commands.
+than terminfo capability names in their respective \fB@TPUT@\fP commands.
+.PP
+Most implementations which provide support for \fIcapname\fR operands
+use the \fItparm\fP function to expand parameters in it.
+That function expects a mixture of numeric and string parameters,
+requiring \fB@TPUT@\fP to know which type to use.
+This implementation uses a table to determine that for
+the standard \fIcapname\fR operands, and an internal library
+function to analyze nonstandard \fIcapname\fR operands.
+Other implementations may simply guess that an operand containing only digits
+is intended to be a number.
 .SH SEE ALSO
 \fB@CLEAR@\fR(1),
 \fBstty\fR(1),
 \fBtabs\fR(\*n),
-\fBterminfo\fR(5).
+\fBterminfo\fR(5),
+\fBcurs_termcap\fR(3X).
 .PP
 This describes \fBncurses\fR
 version @NCURSES_MAJOR@.@NCURSES_MINOR@ (patch @NCURSES_PATCH@).
Index: man/tset.1
Prereq:  1.25 
--- ncurses-5.9/man/tset.1	2010-12-04 18:38:55.000000000 +0000
+++ ncurses-5.9-20130504/man/tset.1	2011-12-17 23:20:35.000000000 +0000
@@ -1,5 +1,5 @@
 .\"***************************************************************************
-.\" Copyright (c) 1998-2008,2010 Free Software Foundation, Inc.              *
+.\" Copyright (c) 1998-2010,2011 Free Software Foundation, Inc.              *
 .\"                                                                          *
 .\" Permission is hereby granted, free of charge, to any person obtaining a  *
 .\" copy of this software and associated documentation files (the            *
@@ -26,12 +26,12 @@
 .\" authorization.                                                           *
 .\"***************************************************************************
 .\"
-.\" $Id: tset.1,v 1.25 2010/12/04 18:38:55 tom Exp $
+.\" $Id: tset.1,v 1.27 2011/12/17 23:20:35 tom Exp $
 .TH @TSET@ 1 ""
 .SH NAME
-\fBtset\fR, \fBreset\fR \- terminal initialization
+\fB@TSET@\fR, \fBreset\fR \- terminal initialization
 .SH SYNOPSIS
-\fBtset\fR [\fB\-IQVcqrsw\fR] [\fB\-\fR] [\fB\-e\fR \fIch\fR] [\fB\-i\fR \fIch\fR] [\fB\-k\fR \fIch\fR] [\fB\-m\fR \fImapping\fR] [\fIterminal\fR]
+\fB@TSET@\fR [\fB\-IQVcqrsw\fR] [\fB\-\fR] [\fB\-e\fR \fIch\fR] [\fB\-i\fR \fIch\fR] [\fB\-k\fR \fIch\fR] [\fB\-m\fR \fImapping\fR] [\fIterminal\fR]
 .br
 \fBreset\fR [\fB\-IQVcqrsw\fR] [\fB\-\fR] [\fB\-e\fR \fIch\fR] [\fB\-i\fR \fIch\fR] [\fB\-k\fR \fIch\fR] [\fB\-m\fR \fImapping\fR] [\fIterminal\fR]
 .SH DESCRIPTION
@@ -72,7 +72,7 @@
 versus the other initialization.
 If neither option is given, both are assumed.
 .PP
-When invoked as \fBreset\fR, \fBtset\fR sets cooked and echo modes,
+When invoked as \fBreset\fR, \fB@TSET@\fR sets cooked and echo modes,
 turns off cbreak and raw modes, turns on newline translation and
 resets any unset special characters to their default values before
 doing the terminal initialization described above.  This is useful
@@ -89,6 +89,7 @@
 .TP 5
 .B \-c
 Set control characters and modes.
+.TP 5
 .B \-e
 Set the erase character to \fIch\fR.
 .TP
@@ -109,7 +110,7 @@
 .TP
 .B \-Q
 Do not display any values for the erase, interrupt and line kill characters.
-Normally \fBtset\fR displays the values for control characters which
+Normally \fB@TSET@\fR displays the values for control characters which
 differ from the system's default values.
 .TP
 .B \-q
@@ -152,19 +153,19 @@
 \fBnoglob\fR, leaving it unset.  The following line in the \fB.login\fR
 or \fB.profile\fR files will initialize the environment correctly:
 .sp
-    eval \`tset \-s options ... \`
+    eval \`@TSET@ \-s options ... \`
 .
 .SH TERMINAL TYPE MAPPING
 When the terminal is not hardwired into the system (or the current
 system information is incorrect) the terminal type derived from the
 \fI/etc/ttys\fR file or the \fBTERM\fR environmental variable is often
 something generic like \fBnetwork\fR, \fBdialup\fR, or \fBunknown\fR.
-When \fBtset\fR is used in a startup script it is often desirable to
+When \fB@TSET@\fR is used in a startup script it is often desirable to
 provide information about the type of terminal used on such ports.
 .PP
 The purpose of the \fB\-m\fR option is to map
 from some set of conditions to a terminal type, that is, to
-tell \fBtset\fR
+tell \fB@TSET@\fR
 ``If I'm on this port at a particular speed, guess that I'm on that
 kind of terminal''.
 .PP
@@ -207,20 +208,20 @@
 and that \fBcsh\fR users insert a backslash character (``\e'') before
 any exclamation marks (``!'').
 .SH HISTORY
-The \fBtset\fR command appeared in BSD 3.0.  The \fBncurses\fR implementation
+The \fB@TSET@\fR command appeared in BSD 3.0.  The \fBncurses\fR implementation
 was lightly adapted from the 4.4BSD sources for a terminfo environment by Eric
 S. Raymond <esr@snark.thyrsus.com>.
 .SH COMPATIBILITY
-The \fBtset\fR utility has been provided for backward-compatibility with BSD
+The \fB@TSET@\fR utility has been provided for backward-compatibility with BSD
 environments (under most modern UNIXes, \fB/etc/inittab\fR and \fIgetty\fR(1)
 can set \fBTERM\fR appropriately for each dial-up line; this obviates what was
-\fBtset\fR's most important use).  This implementation behaves like 4.4BSD
+\fB@TSET@\fR's most important use).  This implementation behaves like 4.4BSD
 tset, with a few exceptions specified here.
 .PP
 The \fB\-S\fR option of BSD tset no longer works; it prints an error message to stderr
 and dies.  The \fB\-s\fR option only sets \fBTERM\fR, not \fBTERMCAP\fP.  Both these
 changes are because the \fBTERMCAP\fR variable is no longer supported under
-terminfo-based \fBncurses\fR, which makes \fBtset \-S\fR useless (we made it die
+terminfo-based \fBncurses\fR, which makes \fB@TSET@ \-S\fR useless (we made it die
 noisily rather than silently induce lossage).
 .PP
 There was an undocumented 4.4BSD feature that invoking tset via a link named
@@ -228,7 +229,7 @@
 terminal to use upper-case only.  This feature has been omitted.
 .PP
 The \fB\-A\fR, \fB\-E\fR, \fB\-h\fR, \fB\-u\fR and \fB\-v\fR
-options were deleted from the \fBtset\fR
+options were deleted from the \fB@TSET@\fR
 utility in 4.4BSD.
 None of them were documented in 4.3BSD and all are
 of limited utility at best.
@@ -243,14 +244,14 @@
 arguments, although it is strongly recommended that such usage be fixed to
 explicitly specify the character.
 .PP
-As of 4.4BSD, executing \fBtset\fR as \fBreset\fR no longer implies the \fB\-Q\fR
+As of 4.4BSD, executing \fB@TSET@\fR as \fBreset\fR no longer implies the \fB\-Q\fR
 option.  Also, the interaction between the \- option and the \fIterminal\fR
-argument in some historic implementations of \fBtset\fR has been removed.
+argument in some historic implementations of \fB@TSET@\fR has been removed.
 .SH ENVIRONMENT
-The \fBtset\fR command uses these environment variables:
+The \fB@TSET@\fR command uses these environment variables:
 .TP 5
 SHELL
-tells \fBtset\fP whether to initialize \fBTERM\fP using \fBsh\fP or
+tells \fB@TSET@\fP whether to initialize \fBTERM\fP using \fBsh\fP or
 \fBcsh\fP syntax.
 .TP 5
 TERM
@@ -260,7 +261,7 @@
 TERMCAP
 may denote the location of a termcap database.
 If it is not an absolute pathname, e.g., begins with a `/',
-\fBtset\fP removes the variable from the environment before looking
+\fB@TSET@\fP removes the variable from the environment before looking
 for the terminal description.
 .SH FILES
 .TP 5
Index: menu/Makefile.in
Prereq:  1.54 
--- ncurses-5.9/menu/Makefile.in	2010-11-27 21:45:27.000000000 +0000
+++ ncurses-5.9-20130504/menu/Makefile.in	2012-09-29 19:37:34.000000000 +0000
@@ -1,6 +1,6 @@
-# $Id: Makefile.in,v 1.54 2010/11/27 21:45:27 tom Exp $
+# $Id: Makefile.in,v 1.56 2012/09/29 19:37:34 tom Exp $
 ##############################################################################
-# Copyright (c) 1998-2009,2010 Free Software Foundation, Inc.                #
+# Copyright (c) 1998-2011,2012 Free Software Foundation, Inc.                #
 #                                                                            #
 # Permission is hereby granted, free of charge, to any person obtaining a    #
 # copy of this software and associated documentation files (the "Software"), #
@@ -102,6 +102,7 @@
 SHLIB_DIRS	= -L../lib
 SHLIB_LIST	= $(SHLIB_DIRS) -lncurses@LIB_SUFFIX@ @SHLIB_LIST@
 
+RPATH_LIST	= @RPATH_LIST@
 MK_SHARED_LIB	= @MK_SHARED_LIB@
 
 NCURSES_MAJOR	= @NCURSES_MAJOR@
@@ -111,7 +112,7 @@
 
 RANLIB		= @LIB_PREP@
 
-LIBRARIES	= @LIBS_TO_MAKE@
+LIBRARIES	= @Libs_To_Make@
 
 LINT		= @LINT@
 LINT_OPTS	= @LINT_OPTS@
Index: menu/m_attribs.c
Prereq:  1.16 
--- ncurses-5.9/menu/m_attribs.c	2010-01-23 21:16:54.000000000 +0000
+++ ncurses-5.9-20130504/menu/m_attribs.c	2012-03-10 23:43:41.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2004,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -37,7 +37,7 @@
 
 #include "menu.priv.h"
 
-MODULE_ID("$Id: m_attribs.c,v 1.16 2010/01/23 21:16:54 tom Exp $")
+MODULE_ID("$Id: m_attribs.c,v 1.17 2012/03/10 23:43:41 tom Exp $")
 
 /* Macro to redraw menu if it is posted and changed */
 #define Refresh_Menu(menu) \
@@ -51,7 +51,7 @@
 #define GEN_MENU_ATTR_SET_FCT( name ) \
 NCURSES_IMPEXP int NCURSES_API set_menu_ ## name (MENU* menu, chtype attr) \
 {\
-  T((T_CALLED("set_menu_" #name "(%p,%s)"), menu, _traceattr(attr))); \
+  T((T_CALLED("set_menu_" #name "(%p,%s)"), (void *) menu, _traceattr(attr))); \
    if (!(attr==A_NORMAL || (attr & A_ATTRIBUTES)==attr))\
       RETURN(E_BAD_ARGUMENT);\
    if (menu && ( menu -> name != attr))\
Index: menu/m_driver.c
Prereq:  1.29 
--- ncurses-5.9/menu/m_driver.c	2010-01-23 21:20:10.000000000 +0000
+++ ncurses-5.9-20130504/menu/m_driver.c	2012-03-10 23:43:41.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -37,7 +37,7 @@
 
 #include "menu.priv.h"
 
-MODULE_ID("$Id: m_driver.c,v 1.29 2010/01/23 21:20:10 tom Exp $")
+MODULE_ID("$Id: m_driver.c,v 1.31 2012/03/10 23:43:41 tom Exp $")
 
 /* Macros */
 
@@ -47,7 +47,7 @@
 
 /* Add a new character to the match pattern buffer */
 #define Add_Character_To_Pattern(menu,ch) \
-  { (menu)->pattern[((menu)->pindex)++] = (ch);\
+  { (menu)->pattern[((menu)->pindex)++] = (char) (ch);\
     (menu)->pattern[(menu)->pindex] = '\0'; }
 
 /*---------------------------------------------------------------------------
@@ -537,7 +537,11 @@
 	result = E_UNKNOWN_COMMAND;
     }
 
-  if (E_OK == result)
+  if (item == 0)
+    {
+      result = E_BAD_STATE;
+    }
+  else if (E_OK == result)
     {
       /* Adjust the top row if it turns out that the current item unfortunately
          doesn't appear in the menu window */
Index: menu/m_format.c
Prereq:  1.16 
--- ncurses-5.9/menu/m_format.c	2010-01-23 21:20:10.000000000 +0000
+++ ncurses-5.9-20130504/menu/m_format.c	2012-06-09 23:54:02.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2004,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -37,7 +37,7 @@
 
 #include "menu.priv.h"
 
-MODULE_ID("$Id: m_format.c,v 1.16 2010/01/23 21:20:10 tom Exp $")
+MODULE_ID("$Id: m_format.c,v 1.18 2012/06/09 23:54:02 tom Exp $")
 
 #define minimum(a,b) ((a)<(b) ? (a): (b))
 
@@ -81,8 +81,8 @@
       if (menu->pattern)
 	Reset_Pattern(menu);
 
-      menu->frows = rows;
-      menu->fcols = cols;
+      menu->frows = (short)rows;
+      menu->fcols = (short)cols;
 
       assert(rows > 0 && cols > 0);
       total_rows = (menu->nitems - 1) / cols + 1;
@@ -90,21 +90,21 @@
 	minimum(menu->nitems, cols) :
 	(menu->nitems - 1) / total_rows + 1;
 
-      menu->rows = total_rows;
-      menu->cols = total_cols;
-      menu->arows = minimum(total_rows, rows);
+      menu->rows = (short)total_rows;
+      menu->cols = (short)total_cols;
+      menu->arows = (short)minimum(total_rows, rows);
       menu->toprow = 0;
       menu->curitem = *(menu->items);
       assert(menu->curitem);
-      menu->status |= _LINK_NEEDED;
+      SetStatus(menu, _LINK_NEEDED);
       _nc_Calculate_Item_Length_and_Width(menu);
     }
   else
     {
       if (rows > 0)
-	_nc_Default_Menu.frows = rows;
+	_nc_Default_Menu.frows = (short)rows;
       if (cols > 0)
-	_nc_Default_Menu.fcols = cols;
+	_nc_Default_Menu.fcols = (short)cols;
     }
 
   RETURN(E_OK);
Index: menu/m_global.c
Prereq:  1.25 
--- ncurses-5.9/menu/m_global.c	2010-01-23 21:20:10.000000000 +0000
+++ ncurses-5.9-20130504/menu/m_global.c	2012-06-10 00:09:15.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -37,7 +37,7 @@
 
 #include "menu.priv.h"
 
-MODULE_ID("$Id: m_global.c,v 1.25 2010/01/23 21:20:10 tom Exp $")
+MODULE_ID("$Id: m_global.c,v 1.27 2012/06/10 00:09:15 tom Exp $")
 
 static char mark[] = "-";
 /* *INDENT-OFF* */
@@ -117,17 +117,17 @@
   assert(menu && menu->items);
   for (items = menu->items; *items; items++)
     {
-      check = _nc_Calculate_Text_Width(&((*items)->name));
+      check = (unsigned)_nc_Calculate_Text_Width(&((*items)->name));
       if (check > MaximumNameLength)
 	MaximumNameLength = check;
 
-      check = _nc_Calculate_Text_Width(&((*items)->description));
+      check = (unsigned)_nc_Calculate_Text_Width(&((*items)->description));
       if (check > MaximumDescriptionLength)
 	MaximumDescriptionLength = check;
     }
 
-  menu->namelen = MaximumNameLength;
-  menu->desclen = MaximumDescriptionLength;
+  menu->namelen = (short)MaximumNameLength;
+  menu->desclen = (short)MaximumDescriptionLength;
   T(("ComputeMaximum_NameDesc_Lengths %d,%d", menu->namelen, menu->desclen));
 }
 
@@ -195,7 +195,7 @@
 		{
 		  (*item)->value = FALSE;
 		}
-	      (*item)->index = ItemCount++;
+	      (*item)->index = (short)ItemCount++;
 	      (*item)->imenu = menu;
 	    }
 	}
@@ -206,7 +206,7 @@
   if (ItemCount != 0)
     {
       menu->items = items;
-      menu->nitems = ItemCount;
+      menu->nitems = (short)ItemCount;
       ComputeMaximum_NameDesc_Lengths(menu);
       if ((menu->pattern = typeMalloc(char, (unsigned)(1 + menu->namelen))))
 	{
@@ -256,7 +256,7 @@
   T((T_CALLED("_nc_menu_text_width(%p)"), (const void *)item));
   if (result != 0 && item->str != 0)
     {
-      int count = mbstowcs(0, item->str, 0);
+      int count = (int)mbstowcs(0, item->str, 0);
       wchar_t *temp = 0;
 
       if (count > 0
@@ -343,7 +343,7 @@
 
   assert(menu);
 
-  menu->height = 1 + menu->spc_rows * (menu->arows - 1);
+  menu->height = (short)(1 + menu->spc_rows * (menu->arows - 1));
 
   l = calculate_actual_width(menu, TRUE);
   l += menu->marklen;
@@ -354,10 +354,10 @@
       l += menu->spc_desc;
     }
 
-  menu->itemlen = l;
+  menu->itemlen = (short)l;
   l *= menu->cols;
   l += (menu->cols - 1) * menu->spc_cols;	/* for the padding between the columns */
-  menu->width = l;
+  menu->width = (short)l;
 
   T(("_nc_CalculateItem_Length_and_Width columns %d, item %d, width %d",
      menu->cols,
@@ -388,7 +388,7 @@
       int Last_in_Column;
       bool cycle = (menu->opt & O_NONCYCLIC) ? FALSE : TRUE;
 
-      menu->status &= ~_LINK_NEEDED;
+      ClrStatus(menu, _LINK_NEEDED);
 
       if (menu->opt & O_ROWMAJOR)
 	{
@@ -431,8 +431,8 @@
 		(cycle ? menu->items[(row + 1) < menu->rows ?
 				     Number_Of_Items - 1 : col] :
 		 (ITEM *) 0);
-	      item->x = col;
-	      item->y = row;
+	      item->x = (short)col;
+	      item->y = (short)row;
 	      if (++col == Number_Of_Columns)
 		{
 		  row++;
@@ -482,8 +482,8 @@
 		 (ITEM *) 0
 		);
 
-	      item->x = col;
-	      item->y = row;
+	      item->x = (short)col;
+	      item->y = (short)row;
 	      if ((++row) == Number_Of_Rows)
 		{
 		  col++;
@@ -568,7 +568,7 @@
 
       cur_item = menu->curitem;
       assert(cur_item);
-      menu->toprow = new_toprow;
+      menu->toprow = (short)new_toprow;
       menu->curitem = new_current_item;
 
       if (mterm_called)
@@ -590,7 +590,7 @@
     }
   else
     {				/* if we are not posted, this is quite simple */
-      menu->toprow = new_toprow;
+      menu->toprow = (short)new_toprow;
       menu->curitem = new_current_item;
     }
 }
Index: menu/m_hook.c
Prereq:  1.15 
--- ncurses-5.9/menu/m_hook.c	2010-01-23 21:16:54.000000000 +0000
+++ ncurses-5.9-20130504/menu/m_hook.c	2012-03-10 23:43:41.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2004,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -37,13 +37,13 @@
 
 #include "menu.priv.h"
 
-MODULE_ID("$Id: m_hook.c,v 1.15 2010/01/23 21:16:54 tom Exp $")
+MODULE_ID("$Id: m_hook.c,v 1.16 2012/03/10 23:43:41 tom Exp $")
 
 /* "Template" macro to generate function to set application specific hook */
 #define GEN_HOOK_SET_FUNCTION( typ, name ) \
 NCURSES_IMPEXP int NCURSES_API set_ ## typ ## _ ## name (MENU *menu, Menu_Hook func )\
 {\
-   T((T_CALLED("set_" #typ "_" #name "(%p,%p)"), menu, func));\
+   T((T_CALLED("set_" #typ "_" #name "(%p,%p)"), (void *) menu, func));\
    (Normalize_Menu(menu) -> typ ## name = func );\
    RETURN(E_OK);\
 }
Index: menu/m_item_new.c
Prereq:  1.30 
--- ncurses-5.9/menu/m_item_new.c	2010-01-23 21:20:11.000000000 +0000
+++ ncurses-5.9-20130504/menu/m_item_new.c	2012-06-09 23:55:15.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -44,7 +44,7 @@
 #endif
 #endif
 
-MODULE_ID("$Id: m_item_new.c,v 1.30 2010/01/23 21:20:11 tom Exp $")
+MODULE_ID("$Id: m_item_new.c,v 1.33 2012/06/09 23:55:15 tom Exp $")
 
 /*---------------------------------------------------------------------------
 |   Facility      :  libnmenu  
@@ -62,7 +62,7 @@
   int result = TRUE;
 
 #if USE_WIDEC_SUPPORT
-  int count = mbstowcs(0, s, 0);
+  int count = (int)mbstowcs(0, s, 0);
   wchar_t *temp = 0;
 
   assert(s);
@@ -127,13 +127,13 @@
 	{
 	  *item = _nc_Default_Item;	/* hope we have struct assignment */
 
-	  item->name.length = strlen(name);
+	  item->name.length = (unsigned short)strlen(name);
 	  item->name.str = name;
 
 	  if (description && (*description != '\0') &&
 	      Is_Printable_String(description))
 	    {
-	      item->description.length = strlen(description);
+	      item->description.length = (unsigned short)strlen(description);
 	      item->description.str = description;
 	    }
 	  else
@@ -195,12 +195,12 @@
 NCURSES_EXPORT(int)
 set_menu_mark(MENU * menu, const char *mark)
 {
-  unsigned l;
+  short l;
 
   T((T_CALLED("set_menu_mark(%p,%s)"), (void *)menu, _nc_visbuf(mark)));
 
   if (mark && (*mark != '\0') && Is_Printable_String(mark))
-    l = strlen(mark);
+    l = (short)strlen(mark);
   else
     l = 0;
 
@@ -213,7 +213,7 @@
 	{
 	  /* If the menu is already posted, the geometry is fixed. Then
 	     we can only accept a mark with exactly the same length */
-	  if (menu->marklen != (int)l)
+	  if (menu->marklen != l)
 	    RETURN(E_BAD_ARGUMENT);
 	}
       menu->marklen = l;
@@ -222,14 +222,13 @@
 	  menu->mark = strdup(mark);
 	  if (menu->mark)
 	    {
-	      strcpy(menu->mark, mark);
 	      if (menu != &_nc_Default_Menu)
-		menu->status |= _MARK_ALLOCATED;
+		SetStatus(menu, _MARK_ALLOCATED);
 	    }
 	  else
 	    {
 	      menu->mark = old_mark;
-	      menu->marklen = (old_mark != 0) ? strlen(old_mark) : 0;
+	      menu->marklen = (short)((old_mark != 0) ? strlen(old_mark) : 0);
 	      RETURN(E_SYSTEM_ERROR);
 	    }
 	}
Index: menu/m_pad.c
Prereq:  1.12 
--- ncurses-5.9/menu/m_pad.c	2010-01-23 21:20:10.000000000 +0000
+++ ncurses-5.9-20130504/menu/m_pad.c	2012-03-10 23:43:41.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2004,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -37,7 +37,7 @@
 
 #include "menu.priv.h"
 
-MODULE_ID("$Id: m_pad.c,v 1.12 2010/01/23 21:20:10 tom Exp $")
+MODULE_ID("$Id: m_pad.c,v 1.13 2012/03/10 23:43:41 tom Exp $")
 
 /* Macro to redraw menu if it is posted and changed */
 #define Refresh_Menu(menu) \
@@ -69,7 +69,7 @@
     RETURN(E_BAD_ARGUMENT);
 
   Normalize_Menu(menu);
-  menu->pad = pad;
+  menu->pad = (unsigned char)pad;
 
   if (do_refresh)
     Refresh_Menu(menu);
Index: menu/m_post.c
Prereq:  1.29 
--- ncurses-5.9/menu/m_post.c	2010-05-01 19:18:27.000000000 +0000
+++ ncurses-5.9-20130504/menu/m_post.c	2012-06-09 23:54:35.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -37,7 +37,7 @@
 
 #include "menu.priv.h"
 
-MODULE_ID("$Id: m_post.c,v 1.29 2010/05/01 19:18:27 tom Exp $")
+MODULE_ID("$Id: m_post.c,v 1.31 2012/06/09 23:54:35 tom Exp $")
 
 /*---------------------------------------------------------------------------
 |   Facility      :  libnmenu
@@ -67,7 +67,7 @@
      - it is a onevalued menu and it is the current item
      - or it has a selection value
    */
-  wattron(menu->win, menu->back);
+  wattron(menu->win, (int)menu->back);
   if (item->value || (item == menu->curitem))
     {
       if (menu->marklen)
@@ -79,13 +79,13 @@
 	     item. */
 	  if (!(menu->opt & O_ONEVALUE) && item->value && item != menu->curitem)
 	    {
-	      wattron(menu->win, menu->fore);
+	      wattron(menu->win, (int)menu->fore);
 	      isfore = TRUE;
 	    }
 	  waddstr(menu->win, menu->mark);
 	  if (isfore)
 	    {
-	      wattron(menu->win, menu->fore);
+	      wattron(menu->win, (int)menu->fore);
 	      isfore = FALSE;
 	    }
 	}
@@ -93,7 +93,7 @@
   else				/* otherwise we have to wipe out the marker area */
     for (ch = ' ', i = menu->marklen; i > 0; i--)
       waddch(menu->win, ch);
-  wattroff(menu->win, menu->back);
+  wattroff(menu->win, (int)menu->back);
   count += menu->marklen;
 
   /* First we have to calculate the attribute depending on selectability
@@ -101,19 +101,19 @@
    */
   if (!(item->opt & O_SELECTABLE))
     {
-      wattron(menu->win, menu->grey);
+      wattron(menu->win, (int)menu->grey);
       isgrey = TRUE;
     }
   else
     {
       if (item->value || item == menu->curitem)
 	{
-	  wattron(menu->win, menu->fore);
+	  wattron(menu->win, (int)menu->fore);
 	  isfore = TRUE;
 	}
       else
 	{
-	  wattron(menu->win, menu->back);
+	  wattron(menu->win, (int)menu->back);
 	  isback = TRUE;
 	}
     }
@@ -158,10 +158,10 @@
 	  assert(cx >= 0 && cy >= 0);
 	  getyx(menu->win, ncy, ncx);
 	  if (isgrey)
-	    wattroff(menu->win, menu->grey);
+	    wattroff(menu->win, (int)menu->grey);
 	  else if (isfore)
-	    wattroff(menu->win, menu->fore);
-	  wattron(menu->win, menu->back);
+	    wattroff(menu->win, (int)menu->fore);
+	  wattron(menu->win, (int)menu->back);
 	  for (j = 1; j < menu->spc_rows; j++)
 	    {
 	      if ((item_y + j) < getmaxy(menu->win))
@@ -175,17 +175,17 @@
 	    }
 	  wmove(menu->win, ncy, ncx);
 	  if (!isback)
-	    wattroff(menu->win, menu->back);
+	    wattroff(menu->win, (int)menu->back);
 	}
     }
 
   /* Remove attributes */
   if (isfore)
-    wattroff(menu->win, menu->fore);
+    wattroff(menu->win, (int)menu->fore);
   if (isback)
-    wattroff(menu->win, menu->back);
+    wattroff(menu->win, (int)menu->back);
   if (isgrey)
-    wattroff(menu->win, menu->grey);
+    wattroff(menu->win, (int)menu->grey);
 }
 
 /*---------------------------------------------------------------------------
@@ -225,7 +225,7 @@
 	{
 	  _nc_Post_Item(menu, hitem);
 
-	  wattron(menu->win, menu->back);
+	  wattron(menu->win, (int)menu->back);
 	  if (((hitem = hitem->right) != lasthor) && hitem)
 	    {
 	      int i, j, cy, cx;
@@ -244,7 +244,7 @@
 	    }
 	}
       while (hitem && (hitem != lasthor));
-      wattroff(menu->win, menu->back);
+      wattroff(menu->win, (int)menu->back);
 
       item = item->down;
       y += menu->spc_rows;
@@ -305,7 +305,7 @@
   else
     RETURN(E_NOT_CONNECTED);
 
-  menu->status |= _POSTED;
+  SetStatus(menu, _POSTED);
 
   if (!(menu->opt & O_ONEVALUE))
     {
@@ -369,7 +369,7 @@
   delwin(menu->win);
   menu->win = (WINDOW *)0;
 
-  menu->status &= ~_POSTED;
+  ClrStatus(menu, _POSTED);
 
   RETURN(E_OK);
 }
Index: menu/m_req_name.c
Prereq:  1.21 
--- ncurses-5.9/menu/m_req_name.c	2009-10-10 16:17:23.000000000 +0000
+++ ncurses-5.9-20130504/menu/m_req_name.c	2012-07-21 23:27:32.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2008,2009 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2009,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -37,7 +37,7 @@
 
 #include "menu.priv.h"
 
-MODULE_ID("$Id: m_req_name.c,v 1.21 2009/10/10 16:17:23 tom Exp $")
+MODULE_ID("$Id: m_req_name.c,v 1.22 2012/07/21 23:27:32 tom Exp $")
 
 static const char *request_names[MAX_MENU_COMMAND - MIN_MENU_COMMAND + 1] =
 {
@@ -99,23 +99,26 @@
   /* because the table is so small, it doesn't really hurt
      to run sequentially through it.
    */
-  unsigned int i = 0;
+  size_t i = 0;
   char buf[16];
 
   T((T_CALLED("menu_request_by_name(%s)"), _nc_visbuf(str)));
 
-  if (str)
+  if (str != 0 && (i = strlen(str)) != 0)
     {
-      strncpy(buf, str, sizeof(buf));
-      while ((i < sizeof(buf)) && (buf[i] != '\0'))
+      if (i > sizeof(buf) - 2)
+	i = sizeof(buf) - 2;
+      memcpy(buf, str, i);
+      buf[i] = '\0';
+
+      for (i = 0; buf[i] != '\0'; ++i)
 	{
 	  buf[i] = (char)toupper(UChar(buf[i]));
-	  i++;
 	}
 
       for (i = 0; i < A_SIZE; i++)
 	{
-	  if (strncmp(request_names[i], buf, sizeof(buf)) == 0)
+	  if (strcmp(request_names[i], buf) == 0)
 	    returnCode(MIN_MENU_COMMAND + (int)i);
 	}
     }
Index: menu/m_spacing.c
Prereq:  1.18 
--- ncurses-5.9/menu/m_spacing.c	2010-01-23 21:20:10.000000000 +0000
+++ ncurses-5.9-20130504/menu/m_spacing.c	2012-03-10 23:43:41.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2004,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -37,7 +37,7 @@
 
 #include "menu.priv.h"
 
-MODULE_ID("$Id: m_spacing.c,v 1.18 2010/01/23 21:20:10 tom Exp $")
+MODULE_ID("$Id: m_spacing.c,v 1.19 2012/03/10 23:43:41 tom Exp $")
 
 #define MAX_SPC_DESC ((TABSIZE) ? (TABSIZE) : 8)
 #define MAX_SPC_COLS ((TABSIZE) ? (TABSIZE) : 8)
@@ -70,9 +70,9 @@
       ((s_col < 0) || (s_col > MAX_SPC_COLS)))
     RETURN(E_BAD_ARGUMENT);
 
-  m->spc_desc = s_desc ? s_desc : 1;
-  m->spc_rows = s_row ? s_row : 1;
-  m->spc_cols = s_col ? s_col : 1;
+  m->spc_desc = (short)(s_desc ? s_desc : 1);
+  m->spc_rows = (short)(s_row ? s_row : 1);
+  m->spc_cols = (short)(s_col ? s_col : 1);
   _nc_Calculate_Item_Length_and_Width(m);
 
   RETURN(E_OK);
Index: menu/menu.priv.h
Prereq:  1.23 
--- ncurses-5.9/menu/menu.priv.h	2009-02-28 21:02:57.000000000 +0000
+++ ncurses-5.9-20130504/menu/menu.priv.h	2012-03-10 23:43:41.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2005,2009 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2009,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -30,7 +30,7 @@
  *   Author:  Juergen Pfeifer, 1995,1997                                    *
  ****************************************************************************/
 
-/* $Id: menu.priv.h,v 1.23 2009/02/28 21:02:57 juergen Exp $ */
+/* $Id: menu.priv.h,v 1.24 2012/03/10 23:43:41 tom Exp $ */
 
 /***************************************************************************
 * Module menu.priv.h                                                       *
@@ -39,6 +39,7 @@
 
 #ifndef MENU_PRIV_H_incl
 #define MENU_PRIV_H_incl 1
+/* *INDENT-OFF* */
 
 #include "curses.priv.h"
 #include "mf_common.h"
@@ -99,10 +100,11 @@
 */
 #define Adjust_Current_Item(menu,row,item) \
   { if ((item)->y < row) \
-      row = (item)->y;\
-    if ( (item)->y >= (row + (menu)->arows) )\
-      row = ( (item)->y < ((menu)->rows - row) ) ? \
-            (item)->y : (menu)->rows - (menu)->arows;\
+      row = (short) (item)->y; \
+    if ( (item)->y >= (row + (menu)->arows) ) \
+      row = (short) (( (item)->y < ((menu)->rows - row) ) \
+                     ? (item)->y \
+		     : (menu)->rows - (menu)->arows); \
     _nc_New_TopRow_and_CurrentItem(menu,row,item); }
 
 /* Reset the match pattern buffer */
@@ -152,5 +154,6 @@
 #define returnMenuOpts(code)	return code
 
 #endif /* TRACE/!TRACE */
+/* *INDENT-ON* */
 
 #endif /* MENU_PRIV_H_incl */
Index: menu/mf_common.h
Prereq:  0.22 
--- ncurses-5.9/menu/mf_common.h	2005-11-26 15:26:52.000000000 +0000
+++ ncurses-5.9-20130504/menu/mf_common.h	2012-06-10 00:06:54.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2004,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -30,7 +30,7 @@
  *   Author:  Juergen Pfeifer, 1995,1997                                    *
  ****************************************************************************/
 
-/* $Id: mf_common.h,v 0.22 2005/11/26 15:26:52 tom Exp $ */
+/* $Id: mf_common.h,v 0.24 2012/06/10 00:06:54 tom Exp $ */
 
 /* Common internal header for menu and form library */
 
@@ -63,10 +63,9 @@
 #if USE_RCS_IDS
 #define MODULE_ID(id) static const char Ident[] = id;
 #else
-#define MODULE_ID(id) /*nothing*/
+#define MODULE_ID(id)		/*nothing */
 #endif
 
-
 /* Maximum regular 8-bit character code */
 #define MAX_REGULAR_CHARACTER (0xff)
 
@@ -80,16 +79,19 @@
 #endif
 
 /* The few common values in the status fields for menus and forms */
-#define _POSTED         (0x01U)  /* menu or form is posted                  */
-#define _IN_DRIVER      (0x02U)  /* menu or form is processing hook routine */
+#define _POSTED         (0x01U)	/* menu or form is posted                  */
+#define _IN_DRIVER      (0x02U)	/* menu or form is processing hook routine */
+
+#define SetStatus(target,mask) (target)->status |= (unsigned short) (mask)
+#define ClrStatus(target,mask) (target)->status = (unsigned short) (target->status & (~mask))
 
 /* Call object hook */
 #define Call_Hook( object, handler ) \
    if ( (object) != 0 && ((object)->handler) != (void *) 0 )\
    {\
-	(object)->status |= _IN_DRIVER;\
+	SetStatus(object, _IN_DRIVER);\
 	(object)->handler(object);\
-	(object)->status &= ~_IN_DRIVER;\
+	ClrStatus(object, _IN_DRIVER);\
    }
 
 #endif /* MF_COMMON_H_incl */
Index: misc/Makefile.in
Prereq:  1.56 
--- ncurses-5.9/misc/Makefile.in	2011-02-21 01:09:31.000000000 +0000
+++ ncurses-5.9-20130504/misc/Makefile.in	2012-08-11 21:31:56.000000000 +0000
@@ -1,6 +1,6 @@
-# $Id: Makefile.in,v 1.56 2011/02/21 01:09:31 tom Exp $
+# $Id: Makefile.in,v 1.60 2012/08/11 21:31:56 tom Exp $
 ##############################################################################
-# Copyright (c) 1998-2010,2011 Free Software Foundation, Inc.                #
+# Copyright (c) 1998-2011,2012 Free Software Foundation, Inc.                #
 #                                                                            #
 # Permission is hereby granted, free of charge, to any person obtaining a    #
 # copy of this software and associated documentation files (the "Software"), #
@@ -56,6 +56,7 @@
 exec_prefix	= @exec_prefix@
 bindir		= @bindir@
 libdir		= @libdir@
+datarootdir	= @datarootdir@
 datadir		= @datadir@
 
 tabsetdir	= $(datadir)/tabset
@@ -120,7 +121,8 @@
 
 run_tic.sed :
 	WHICH_XTERM=@WHICH_XTERM@ \
-	ticdir=${ticdir} \
+	XTERM_KBS=@XTERM_KBS@ \
+	datadir=${datadir} \
 	$(SHELL) $(srcdir)/gen_edit.sh >$@
 
 $(DESTDIR)$(bindir) \
@@ -139,7 +141,7 @@
 
 uninstall.libs :
 	-rm -f $(DESTDIR)$(bindir)/$(NCURSES_CONFIG)
-@MAKE_PC_FILES@	$(SHELL) 'for name in *.pc; do rm -f $(DESTDIR)$(PKG_CONFIG_LIBDIR)/$$name; done'
+@MAKE_PC_FILES@	$(SHELL) -c 'for name in *.pc; do rm -f $(DESTDIR)$(PKG_CONFIG_LIBDIR)/$$name; done'
 
 tags :
 
Index: misc/gen-pkgconfig.in
Prereq:  1.8 
--- ncurses-5.9/misc/gen-pkgconfig.in	2010-02-06 22:12:07.000000000 +0000
+++ ncurses-5.9-20130504/misc/gen-pkgconfig.in	2013-03-16 23:33:34.000000000 +0000
@@ -1,7 +1,7 @@
 #!@SHELL@
-# $Id: gen-pkgconfig.in,v 1.8 2010/02/06 22:12:07 Miroslav.Lichvar Exp $
+# $Id: gen-pkgconfig.in,v 1.15 2013/03/16 23:33:34 tom Exp $
 ##############################################################################
-# Copyright (c) 2009,2010 Free Software Foundation, Inc.                     #
+# Copyright (c) 2009-2012,2013 Free Software Foundation, Inc.                #
 #                                                                            #
 # Permission is hereby granted, free of charge, to any person obtaining a    #
 # copy of this software and associated documentation files (the "Software"), #
@@ -28,7 +28,7 @@
 # authorization.                                                             #
 ##############################################################################
 #
-# Author: Thomas E. Dickey, 2009
+# Author: Thomas E. Dickey
 #
 # The complete configure script for ncurses is the ncurses5-config (or similar
 # name, depending on the flavor, e.g., ncursesw5-config, ncurses6-config, etc).
@@ -39,10 +39,10 @@
 # library, except that the tinfo library does not depend on ncurses.
 LIB_NAME=@LIB_NAME@
 TINFO_NAME=@TINFO_NAME@
-PANEL_NAME=panel # @PANEL_NAME@
-MENU_NAME=menu # @MENU_NAME@
-FORM_NAME=form # @FORM_NAME@
-CXX_NAME=ncurses++ # @CXX_NAME@
+PANEL_NAME=@PANEL_NAME@
+MENU_NAME=@MENU_NAME@
+FORM_NAME=@FORM_NAME@
+CXX_NAME=@CXX_NAME@
 DFT_DEP_SUFFIX=@DFT_DEP_SUFFIX@
 TINFO_ARG_SUFFIX=@TINFO_ARG_SUFFIX@
 CXX_LIB_SUFFIX=@CXX_LIB_SUFFIX@
@@ -63,63 +63,48 @@
 MENU_LIBRARY="${MENU_NAME}@DFT_ARG_SUFFIX@"
 FORM_LIBRARY="${FORM_NAME}@DFT_ARG_SUFFIX@"
 
-SUB_LIBRARY_REQ=${SUB_LIBRARY}
-if test $TINFO_NAME = $LIB_NAME ; then
-	SUB_LIBRARY_REQ=
+if test "$includedir" = "/usr/include" ; then
+	CFLAGS=
+else
+	CFLAGS="-I\${includedir}"
 fi
 
-for lib in ../lib/*
-do
-	name=`basename $lib`
-	if test "$name" = "*" ; then
-		break
-	fi
-
-	root=`basename $name "$DFT_DEP_SUFFIX"`
-	if test "$name" = "$root" ; then
-		root=`basename $name "$CXX_LIB_SUFFIX"`
-		if test "$name" = "$root" ; then
-			continue
-		fi
-	fi
+if test "$libdir" = "/usr/lib" ; then
+	LDFLAGS=
+else
+	LDFLAGS="-L\${libdir}"
+fi
 
-	name=`echo "$name" | sed -e 's/^lib//' -e 's/\..*$//'`
+for name in @PC_MODULES_TO_MAKE@
+do
+	name="${name}"
 
 	desc="ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@"
+	reqs=
+
 	if test $name = $MAIN_LIBRARY ; then
-		reqs=$SUB_LIBRARY_REQ
 		desc="$desc library"
 	elif test $name = $SUB_LIBRARY ; then
-		reqs=
 		desc="$desc terminal interface library"
 	elif expr $name : ".*${CXX_NAME}.*" >/dev/null ; then
-		reqs="$PANEL_LIBRARY $MENU_LIBRARY $FORM_LIBRARY $MAIN_LIBRARY $SUB_LIBRARY_REQ"
+		reqs="$PANEL_LIBRARY, $MENU_LIBRARY, $FORM_LIBRARY, $MAIN_LIBRARY"
 		desc="$desc add-on library"
 	else
-		reqs="$MAIN_LIBRARY $SUB_LIBRARY_REQ"
+		reqs="$MAIN_LIBRARY"
 		desc="$desc add-on library"
 	fi
 
-	if test "$includedir" = "/usr/include" ; then
-		cflags=
-	else
-		cflags="-I\${includedir}"
-	fi
-
-	if test "$libdir" = "/usr/lib" ; then
-		libs=
-	else
-		libs="-L\${libdir}"
-	fi
-	libs="$libs -l$name"
-
-	# add dependencies that pkg-config cannot guess about
-	if test -z "$reqs" ; then
-		libs="$libs @LIBS@"
+	if test $name != $SUB_LIBRARY && test $SUB_LIBRARY != $MAIN_LIBRARY ; then
+		if test $name != $TINFO_NAME ; then
+			test -n "$reqs" && reqs="$reqs, "
+			reqs="${reqs}${SUB_LIBRARY}"
+		fi
 	fi
 
 	echo "** creating ${name}.pc"
 	cat >${name}.pc <<EOF
+# vile:makemode
+
 prefix=$show_prefix
 exec_prefix=$show_exec_prefix
 libdir=$show_libdir
@@ -130,10 +115,13 @@
 Name: $name
 Description: $desc
 Version: \${version}
-Requires: $reqs
-Libs: $libs
-Cflags: $cflags
+URL: http://invisible-island.net/ncurses
+Requires.private: $reqs
+Libs: $LDFLAGS -l$name
+Libs.private: @LIBS@
+Cflags: $CFLAGS
 EOF
-	# pr -f ${name}.pc
+
+	#pr -f ${name}.pc
 done
 # vile:shmode
Index: misc/gen_edit.sh
Prereq:  1.1 
--- ncurses-5.9/misc/gen_edit.sh	2004-07-11 15:01:29.000000000 +0000
+++ ncurses-5.9-20130504/misc/gen_edit.sh	2012-04-01 15:04:37.000000000 +0000
@@ -1,6 +1,6 @@
 #!/bin/sh
 ##############################################################################
-# Copyright (c) 2004 Free Software Foundation, Inc.                          #
+# Copyright (c) 2004-2011,2012 Free Software Foundation, Inc.                #
 #                                                                            #
 # Permission is hereby granted, free of charge, to any person obtaining a    #
 # copy of this software and associated documentation files (the "Software"), #
@@ -29,7 +29,7 @@
 #
 # Author: Thomas E. Dickey
 #
-# $Id: gen_edit.sh,v 1.1 2004/07/11 15:01:29 tom Exp $
+# $Id: gen_edit.sh,v 1.5 2012/04/01 15:04:37 tom Exp $
 # Generate a sed-script for converting the terminfo.src to the form which will
 # be installed.
 #
@@ -37,22 +37,82 @@
 #	The leaf directory names (lib, tabset, terminfo)
 #
 
-: ${ticdir=@TERMINFO@}
-: ${xterm_new=@WHICH_XTERM@}
+linux_dft=linux2.2
+
+: ${datadir=/usr/share}
+: ${WHICH_LINUX=$linux_dft}
+: ${WHICH_XTERM=xterm-new}
+: ${XTERM_KBS=BS}
 
 # If we're not installing into /usr/share/, we'll have to adjust the location
 # of the tabset files in terminfo.src (which are in a parallel directory).
-TABSET=`echo $ticdir | sed -e 's%/terminfo$%/tabset%'`
+TABSET=${datadir}/tabset
 if test "x$TABSET" != "x/usr/share/tabset" ; then
 cat <<EOF
 s%/usr/share/tabset%$TABSET%g
 EOF
 fi
 
-if test "$xterm_new" != "xterm-new" ; then
+if test "$WHICH_XTERM" != "xterm-new" ; then
+echo "** using $WHICH_XTERM terminal description for XTerm entry" >&2
 cat <<EOF
 /^# This is xterm for ncurses/,/^$/{
 	s/use=xterm-new,/use=$WHICH_XTERM,/
 }
 EOF
 fi
+
+if test "$XTERM_KBS" != "BS" ; then
+echo "** using DEL for XTerm backspace-key" >&2
+cat <<EOF
+/^xterm+kbs|fragment for backspace key/,/^#/{
+	s/kbs=^H,/kbs=^?,/
+}
+EOF
+fi
+
+# Work around incompatibities built into Linux console.  The 2.6 series added
+# a patch to fixup the SI/SO behavior, which is closer to vt100, but the older
+# kernels do not recognize those controls.  All of the kernels recognize the
+# older flavor of rmacs/smacs, but beginning in the late 1990s, changes made
+# as part of implementing UTF-8 prevent using those for line-drawing when the
+# console is in UTF-8 mode.  Taking into account the fact that it took about
+# ten years to provide (and distribute) the 2.6 series' change for SI/SO, the
+# default remains "linux2.2".
+case x$WHICH_LINUX in #(vi
+xauto)
+	system=`uname -s 2>/dev/null`
+	if test "x$system" = xLinux
+	then
+		case x`uname -r` in
+		x1.*)
+			WHICH_LINUX=linux-c
+			;;
+		x2.[0-4]*)
+			WHICH_LINUX=linux2.2
+			;;
+		*)
+			WHICH_LINUX=linux3.0
+			;;
+		esac
+	else
+		WHICH_LINUX=$linux_dft
+	fi
+	;;
+xlinux*)
+	# allow specific setting
+	;;
+*)
+	WHICH_LINUX=$linux_dft
+	;;
+esac
+
+if test $WHICH_LINUX != $linux_dft
+then
+echo "** using $WHICH_LINUX terminal description for Linux console" >&2
+cat <<EOF
+/^# This is Linux console for ncurses/,/^$/{
+	s/use=$linux_dft,/use=$WHICH_LINUX,/
+}
+EOF
+fi
Index: misc/ncurses-config.in
Prereq:  1.25 
--- ncurses-5.9/misc/ncurses-config.in	2011-03-19 22:43:38.000000000 +0000
+++ ncurses-5.9-20130504/misc/ncurses-config.in	2012-11-11 00:14:28.000000000 +0000
@@ -1,7 +1,7 @@
 #!@SHELL@
-# $Id: ncurses-config.in,v 1.25 2011/03/19 22:43:38 tom Exp $
+# $Id: ncurses-config.in,v 1.30 2012/11/11 00:14:28 tom Exp $
 ##############################################################################
-# Copyright (c) 2006-2010,2011 Free Software Foundation, Inc.                #
+# Copyright (c) 2006-2011,2012 Free Software Foundation, Inc.                #
 #                                                                            #
 # Permission is hereby granted, free of charge, to any person obtaining a    #
 # copy of this software and associated documentation files (the "Software"), #
@@ -30,22 +30,48 @@
 #
 # Author: Thomas E. Dickey, 2006-on
 
+LANG=C;		export LANG
+LANGUAGE=C;	export LANGUAGE
+LC_ALL=C;	export LC_ALL
+LC_CTYPE=C;	export LC_CTYPE
+
 prefix="@prefix@"
 exec_prefix="@exec_prefix@"
 
 bindir="@bindir@"
 includedir="@includedir@"
 libdir="@libdir@"
+datarootdir="@datarootdir@"
 datadir="@datadir@"
 mandir="@mandir@"
 
 THIS="@LIB_NAME@@DFT_ARG_SUFFIX@"
 TINFO_LIB="@TINFO_ARG_SUFFIX@"
+RPATH_LIST="@RPATH_LIST@"
 
-LANG=C;		export LANG
-LANGUAGE=C;	export LANGUAGE
-LC_ALL=C;	export LC_ALL
-LC_CTYPE=C;	export LC_CTYPE
+# Ensure that RPATH_LIST contains only absolute pathnames, if it is nonempty.
+# We cannot filter it out within the build-process since the variable is used
+# in some special cases of installation using a relative path.
+if test -n "$RPATH_LIST"
+then
+	save_IFS="$IFS"
+	IFS='@PATH_SEPARATOR@'
+	filtered=
+	for item in $RPATH_LIST
+	do
+		case "$item" in
+		./*|../*|*/..|*/../*)
+			;;
+		*)
+			test -n "$filtered" && filtered="${filtered}@PATH_SEPARATOR@"
+			filtered="${filtered}${item}"
+			;;
+		esac
+	done
+	IFS="$save_IFS"
+	# if the result is empty, there is little we can do to fix it
+	RPATH_LIST="$filtered"
+fi
 
 # with --disable-overwrite, we installed into a subdirectory, but transformed
 # the headers to include like this:
@@ -83,13 +109,19 @@
 ENDECHO
 		;;
 	--libs)
+		if test "$libdir" = /usr/lib
+		then
+			LIBDIR=
+		else
+			LIBDIR=-L$libdir
+		fi
 		if test @TINFO_NAME@ = @LIB_NAME@ ; then
 		sed -e 's,^[ ]*,,' -e 's, [ ]*, ,g' -e 's,[ ]*$,,' <<-ENDECHO
-			-L$libdir @EXTRA_LDFLAGS@ -l${THIS} @LIBS@
+			$LIBDIR @EXTRA_LDFLAGS@ -l${THIS} @LIBS@
 ENDECHO
 		else
 		sed -e 's,^[ ]*,,' -e 's, [ ]*, ,g' -e 's,[ ]*$,,' <<-ENDECHO
-			-L$libdir @EXTRA_LDFLAGS@ -l${THIS} -l${TINFO_LIB} @LIBS@
+			$LIBDIR @EXTRA_LDFLAGS@ -l${THIS} -l${TINFO_LIB} @LIBS@
 ENDECHO
 		fi
 		;;
@@ -163,4 +195,5 @@
 	esac
 	shift
 done
+# vi:ts=4 sw=4
 # vile:shmode
Index: misc/run_tic.in
Prereq:  1.32 
--- ncurses-5.9/misc/run_tic.in	2011-02-23 23:30:15.000000000 +0000
+++ ncurses-5.9-20130504/misc/run_tic.in	2012-10-06 19:00:51.000000000 +0000
@@ -1,7 +1,7 @@
 #!@SHELL@
-# $Id: run_tic.in,v 1.32 2011/02/23 23:30:15 tom Exp $
+# $Id: run_tic.in,v 1.34 2012/10/06 19:00:51 tom Exp $
 ##############################################################################
-# Copyright (c) 1998-2010,2011 Free Software Foundation, Inc.                #
+# Copyright (c) 1998-2011,2012 Free Software Foundation, Inc.                #
 #                                                                            #
 # Permission is hereby granted, free of charge, to any person obtaining a    #
 # copy of this software and associated documentation files (the "Software"), #
@@ -41,13 +41,14 @@
 # The script is designed to be run from the misc/Makefile as
 #	make install.data
 
-: ${suffix:=@PROG_EXT@}
+: ${suffix:=@EXEEXT@}
 : ${DESTDIR:=@DESTDIR@}
 : ${prefix:=@prefix@}
 : ${exec_prefix:=@exec_prefix@}
 : ${bindir:=@bindir@}
 : ${top_srcdir:=@top_srcdir@}
 : ${srcdir:=@srcdir@}
+: ${datarootdir:=@datarootdir@}
 : ${datadir:=@datadir@}
 : ${TIC_PATH:=@TIC_PATH@}
 : ${ticdir:=@TERMINFO@}
Index: misc/terminfo.src
--- ncurses-5.9/misc/terminfo.src	2011-02-20 20:46:53.000000000 +0000
+++ ncurses-5.9-20130504/misc/terminfo.src	2013-03-30 19:51:04.000000000 +0000
@@ -6,8 +6,8 @@
 # Report bugs and new terminal descriptions to
 #	bug-ncurses@gnu.org
 #
-#	$Revision: 1.383 $
-#	$Date: 2011/02/20 20:46:53 $
+#	$Revision: 1.475 $
+#	$Date: 2013/03/30 19:51:04 $
 #
 # The original header is preserved below for reference.  It is noted that there
 # is a "newer" version which differs in some cosmetic details (but actually
@@ -321,7 +321,7 @@
 # DEL and ^C are hardcoded to act as kill characters.
 # ^D acts as a line break (just like newline).
 # It also interprets
-#      \033];xxx\007 
+#      \033];xxx\007
 # for compatibility with xterm -TD
 9term|Plan9 terminal emulator for X,
 	am,
@@ -376,11 +376,19 @@
 	dim=\E[2m,
 	sgr=\E[%?%p1%t7;%;%?%p2%t4;%;%?%p3%t7;%;%?%p4%t5;%;%?%p5%t2;%;%?%p7%t8;%;m,
 	use=ansi+sgr, use=ansi+sgrso, use=ansi+sgrul,
-ansi+pp|ansi printer port,
-	mc0=\E[0i, mc4=\E[4i, mc5=\E[5i,
 ansi+csr|ansi scroll-region plus cursor save & restore,
 	csr=\E[%i%p1%d;%p2%dr, rc=\E8, sc=\E7,
 
+# The normal (ANSI) flavor of "media copy" building block asserts that
+# characters sent to the printer do not echo on the screen. DEC terminals
+# can also be put into autoprinter mode, where each line is sent to the
+# printer as you move off that line, e.g., by a carriage return.
+ansi+pp|ansi printer port,
+	mc5i,
+	mc0=\E[i, mc4=\E[4i, mc5=\E[5i,
+dec+pp|DEC autoprinter mode,
+	mc0=\E[i, mc4=\E[?4i, mc5=\E[?5i,
+
 # The IBM PC alternate character set.  Plug this into any Intel console entry.
 # We use \E[11m for rmacs rather than \E[12m so the <acsc> string can use the
 # ROM graphics for control characters such as the diamond, up- and down-arrow.
@@ -456,9 +464,10 @@
 	cud=\E[%p1%dB, cud1=\E[1B, cuf=\E[%p1%dC, cuf1=\E[1C,
 	cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[1A,
 	dch=\E[%p1%dP, dispc=\E=%p1%dg, ech=\E[%p1%dX,
-	hpa=\E[%i%p1%dG, hts=\EH, ich=\E[%p1%d@, il=\E[%p1%dL,
-	indn=\E[%p1%dS, rc=\E7, rin=\E[%p1%dT, rmam=\E[?7l, sc=\E7,
-	smam=\E[?7h, tbc=\E[g, vpa=\E[%i%p1%dd,
+	hpa=\E[%i%p1%dG, hts=\EH, ich=\E[%p1%d@, ich1=\E[@,
+	il=\E[%p1%dL, indn=\E[%p1%dS, rc=\E7, rin=\E[%p1%dT,
+	rmam=\E[?7l, sc=\E7, smam=\E[?7h, tbc=\E[g,
+	vpa=\E[%i%p1%dd,
 
 #### ANSI/ECMA-48 terminals and terminal emulators
 #
@@ -488,7 +497,7 @@
 # ansi-mtabs adds relative addressing and minimal tab support
 ansi-mtabs|any ansi terminal with pessimistic assumptions,
 	it#8,
-	ht=^I, use=ansi+local1, use=ansi-mini,
+	ht=^I, use=ansi-mini, use=ansi+local1,
 
 # ANSI X3.64 from emory!mlhhh (Hugh Hansard) via BRL
 #
@@ -690,9 +699,7 @@
 	use=ansi.sysk,
 
 #### ANSI console types
-#
 
-#############################################################################
 #
 # Atari ST terminals.
 # From Guido Flohr <gufl0000@stud.uni-sb.de>.
@@ -909,7 +916,7 @@
 	khome=\E[1~, kich1=\E[2~, kmous=\E[M, knp=\E[6~, kpp=\E[5~,
 	kspd=^Z, nel=^M^J, rc=\E8, rev=\E[7m, ri=\EM, rmam=\E[?7l,
 	rmir=\E[4l, rmso=\E[27m, rmul=\E[24m, rs1=\Ec\E]R, sc=\E7,
-	sgr=\E[0;10%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p5%t;2%;%?%p6%t;1%;%?%p7%t;8%;%?%p9%t;11%;m,
+	sgr=\E[0;10%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p5%t;2%;%?%p6%t;1%;%?%p9%t;11%;m,
 	smam=\E[?7h, smir=\E[4h, smul=\E[4m, tbc=\E[3g,
 	vpa=\E[%i%p1%dd, use=vt102+enq, use=klone+sgr,
 	use=ecma+color,
@@ -936,10 +943,30 @@
 # The 2.2.x kernels add a private mode that sets the cursor type; use that to
 # get a block cursor for cvvis.
 # reported by Frank Heckenbach <frank@g-n-u.de>.
-linux|linux console,
+linux2.2|linux 2.2.x console,
 	civis=\E[?25l\E[?1c, cnorm=\E[?25h\E[?0c,
 	cvvis=\E[?25h\E[?8c, use=linux-c-nc,
 
+# Linux 2.6.x has a fix for SI/SO to work with UTF-8 encoding added here:
+#	http://lkml.indiana.edu/hypermail/linux/kernel/0602.2/0868.html
+# Using SI/SO has the drawback that it confuses screen.  SCS would work.
+# However, SCS is buggy (see comment in Debian #515609) -TD
+# Further, this breaks longstanding workarounds for Linux console's line
+# drawing (see Debian 665959) -TD
+linux2.6|linux 2.6.x console,
+	rmacs=^O,
+	sgr=\E[0;10%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p5%t;2%;%?%p6%t;1%;m%?%p9%t\016%e\017%;,
+	sgr0=\E[m\017, smacs=^N, use=linux2.2,
+
+# The 3.0 kernel adds support for clearing scrollback buffer (capability E3).
+# It is the same as xterm's erase-saved-lines feature.
+linux3.0|linux 3.0 kernels,
+	E3=\E[3;J, use=linux2.6,
+
+# This is Linux console for ncurses.
+linux|linux console,
+	use=linux2.2,
+
 # Subject: linux 2.6.26 vt back_color_erase
 # Changes to the Linux console driver broke bce model as reported in
 #	https://bugzilla.novell.com/show_bug.cgi?id=418613
@@ -947,7 +974,7 @@
 #	http://lkml.org/lkml/2008/4/26/305
 #	http://groups.google.com/group/fa.linux.kernel/browse_thread/thread/87f98338f0d636bb/aa96e8b86cee0d1e?lnk=st&q=#aa96e8b86cee0d1e
 linux2.6.26|linux console w/o bce,
-	bce@, use=linux,
+	bce@, use=linux2.6,
 
 # See the note on ICH/ICH1 VERSUS RMIR/SMIR near the end of file
 linux-nic|linux with ich/ich1 suppressed for non-curses programs,
@@ -998,9 +1025,9 @@
 # you use a 512-character console font. This uses bold for bright
 # foreground colors and blink for bright background colors.
 linux-16color|linux console with 16 colors,
-	colors#16, ncv#54, pairs#256,
-	setab=\E[4%p1%{8}%m%d%?%p1%{8}%>%t;5%e%p1%{8}%=%t;2%e;25%;m,
-	setaf=\E[3%p1%{8}%m%d%?%p1%{8}%>%t;1%e%p1%{8}%=%t;2%e;21%;m,
+	colors#16, ncv#63, pairs#256,
+	setab=\E[4%p1%{8}%m%d%?%p1%{7}%>%t;5%e;25%;m,
+	setaf=\E[3%p1%{8}%m%d%?%p1%{7}%>%t;1%e;21%;m,
 	use=linux,
 
 # bterm (bogl 0.1.18)
@@ -1024,7 +1051,7 @@
 	kf3=\E[[C, kf4=\E[[D, kf5=\E[[E, kf6=\E[17~, kf7=\E[18~,
 	kf8=\E[19~, kf9=\E[20~, khome=\E[1~, kich1=\E[2~,
 	kmous=\E[M, knp=\E[6~, kpp=\E[5~, kspd=^Z, nel=^M^J,
-	op=\E49;39m, rev=\E[7m, ri=\EM, rmacs=^O, rmso=\E[27m,
+	op=\E[49m\E[39m, rev=\E[7m, ri=\EM, rmacs=^O, rmso=\E[27m,
 	rmul=\E[24m, setab=\E[4%p1%dm, setaf=\E[3%p1%dm,
 	sgr0=\E[0m, smacs=^N, smso=\E[7m, smul=\E[4m,
 
@@ -1053,6 +1080,24 @@
 	dim=\E[2m, invis=\E[8m, op=\E[37;40m, rmso=\E[27m,
 	setab=\E[4%p1%dm, setaf=\E[3%p1%dm, use=mach,
 
+# From: Samuel Thibault
+# Source: git://git.sv.gnu.org/hurd/gnumach.git
+# Files: i386/i386at/kd.c
+#
+# Added nel, hpa, sgr and removed rmacs, smacs based on source -TD
+mach-gnu|GNU Mach,
+	acsc=+>\,<-\^.v0\333`+a\261f\370g\361h\260i#j\331k\277l\332m\300n\305o~p\304q\304r\304s_t\303u\264v\301w\302x\263y\363z\362{\343|\330}\234~\376,
+	dch=\E[%p1%dP, dch1=\E[P, dim=\E[2m, ech=\E[%p1%dX,
+	el1=\E[1K, hpa=\E[%i%p1%dG, ich=\E[%p1%d@, ich1=\E[@,
+	indn=\E[%p1%dS, invis=\E[8m, nel=\EE, rin=\E[%p1%dT,
+	sgr=\E[0%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p5%t;2%;%?%p6%t;1%;%?%p7%t;8%;m,
+	use=mach,
+
+mach-gnu-color|Mach Console with ANSI color,
+	colors#8, pairs#64,
+	op=\E[37;40m, rmso=\E[27m, setab=\E[4%p1%dm,
+	setaf=\E[3%p1%dm, use=mach-gnu,
+
 # From: Marcus Brinkmann
 # http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/hurd/hurd/console/
 #
@@ -1183,7 +1228,7 @@
 	civis=\E[=0c, cnorm=\E[=1c, csr=\E[%i%p1%d;%p2%dr,
 	cvvis=\E[=2c, mgc=\E[=r, oc=\E[51m, op=\E[50m,
 	rep=\E[%p1%d;%p2%db, rmm=\E[=11L,
-	sgr=\E[0%?%p1%p3%|%t;7%;%?%p2%t;4%;%?%p4%t;5%;%?%p6%t;1%;%?%p7%t;8%;%?%p9%t;12%;m,
+	sgr=\E[0%?%p1%p3%|%t;7%;%?%p2%t;4%;%?%p4%t;5%;%?%p6%t;1%;%?%p7%t;8%;%?%p9%t;12%e;10%;m,
 	smgb=\E[=1;0m, smgbp=\E[=1;%i%p1%dm,
 	smglp=\E[=2;%i%p1%dm, smgr=\E[=3;0m,
 	smgrp=\E[=3;%i%p1%dm, smgt=\E[=0;0m,
@@ -1649,6 +1694,56 @@
 qansi-w|QNX ansi for windows,
 	xvpa, use=qansi-m,
 
+#### OpenBSD consoles
+#
+# From: Alexei Malinin <Alexei.Malinin@mail.ru>; October, 2011.
+#
+# The following terminal descriptions for the  AMD/Intel PC console
+# were prepared  based on information contained in  the OpenBSD-4.9
+# termtypes.master and wscons(4) & vga(4) manuals (2010, November).
+#
+# Added bce based on testing with tack -TD
+# Added several capabilities to pccon+base, reading wsemul_vt100_subr.c -TD
+# Changed kbs to DEL and removed keys that duplicate stty settings -TD
+#
+pccon+keys|OpenBSD PC keyboard keys,
+	kbs=\177, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A,
+	kdch1=\E[3~, kend=\E[8~, kent=^M, kf1=\E[11~, kf10=\E[21~,
+	kf11=\E[23~, kf12=\E[24~, kf2=\E[12~, kf3=\E[13~,
+	kf4=\E[14~, kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~,
+	kf9=\E[20~, khome=\E[7~, kich1=\E[2~, knp=\E[6~, kpp=\E[5~,
+	krfr=^R,
+pccon+sgr+acs0|sgr and simple ASCII pseudographics for OpenBSD PC console,
+	acsc=+>\,<-\^.v0#`+a\:f\\h#i#j+k+l+m+n+o~p-q-r-s_t+u+v+w+x|y#z#{*|!}#~o,
+	sgr=\E[0%?%p1%p3%|%t;7%;m, sgr0=\E[m,
+pccon+sgr+acs|sgr and default ASCII pseudographics for OpenBSD PC console,
+	acsc=++\,\,--..00``aaffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~,
+	enacs=\E)0$<5>, rmacs=\E(B$<5>,
+	sgr=\E[0%?%p1%p3%|%t;7%;m%?%p9%t\E(0%e\E(B%;$<5>,
+	sgr0=\E[m\E(B$<5>, smacs=\E(0$<5>,
+pccon+colors|ANSI colors for OpenBSD PC console,
+	bce,
+	colors#8, pairs#64,
+	op=\E[m, setab=\E[4%p1%dm, setaf=\E[3%p1%dm,
+pccon+base|base capabilities for OpenBSD PC console,
+	am, km, mc5i, msgr, npc, nxon, xenl, xon,
+	cols#80, it#8, lines#24,
+	bel=^G, clear=\E[H\E[J, cr=^M, cub1=^H, cud1=^J, cuf1=\E[C,
+	cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, dch=\E[%p1%dP,
+	dch1=\E[P, dl1=\E[M, ech=\E[%p1%dX, ed=\E[J, el=\E[K,
+	el1=\E[1K, home=\E[H, ht=^I, hts=\EH, ich=\E[%p1%d@,
+	il1=\E[L, ind=\ED, nel=\EE, rev=\E[7m, ri=\EM, rmam=\E[?7l,
+	rmso=\E[m, rs2=\Ec$<50>, smam=\E[?7h, smso=\E[7m,
+	tbc=\E[3g, u6=\E[%i%d;%dR, u7=\E[6n,
+pccon0-m|OpenBSD PC console without colors & with simple ASCII pseudographics,
+	use=pccon+base, use=pccon+sgr+acs0, use=pccon+keys,
+pccon0|OpenBSD PC console with simple ASCII pseudographics,
+	use=pccon0-m, use=pccon+colors,
+pccon-m|OpenBSD PC console without colors,
+	use=pccon+base, use=pccon+sgr+acs, use=pccon+keys,
+pccon|OpenBSD PC console,
+	use=pccon-m, use=pccon+colors,
+
 #### NetBSD consoles
 #
 # pcvt termcap database entries (corresponding to release 3.31)
@@ -1786,7 +1881,7 @@
 ofcons|DNARD OpenFirmware console,
 	bw,
 	cols#80, lines#30,
-	bel=^G, blink=\2337;2m, bold=\2331m, clear=^L, cr=^M,
+	bel=^G, blink=\2335m, bold=\2331m, clear=^L, cr=^M,
 	cub=\233%p1%dD, cub1=\233D, cud=\233%p1%dB, cud1=\233B,
 	cuf=\233%p1%dC, cuf1=\233C, cup=\233%i%p1%d;%p2%dH,
 	cuu=\233%p1%dA, cuu1=\233A, dch=\233%p1%dP, dch1=\233P,
@@ -1798,8 +1893,8 @@
 	kf4=\2330x, kf5=\2330t, kf6=\2330u, kf7=\2330q, kf8=\2330r,
 	kf9=\2330p, knp=\233/, kpp=\233?, nel=^M^J, rev=\2337m,
 	rmso=\2330m, rmul=\2330m,
-	sgr=\2330%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;m,
-	sgr0=\2330m,
+	sgr=\2330%?%p6%t;1%;%?%p2%t;4%;%?%p4%t;5%;%?%p5%t2%;%?%p7%t8%;%?%p1%p3%|%t;7%;m,
+	sgr0=\2330m, smso=\2337m, smul=\2334m,
 
 # NetBSD "wscons" emulator in vt220 mode.
 # This entry is based on the NetBSD termcap entry, correcting the ncv value.
@@ -1816,7 +1911,8 @@
 wsvt25|NetBSD wscons in 25 line DEC VT220 mode,
 	bce, msgr,
 	colors#8, cols#80, it#8, lines#25, ncv#2, pairs#64,
-	is2=\E[r\E[25;1H, kend=\E[8~, kf1=\E[11~, kf10=\E[21~,
+	civis=\E[?25l, cnorm=\E[?25h, is2=\E[r\E[25;1H,
+	kdch1=\E[3~, kend=\E[8~, kf1=\E[11~, kf10=\E[21~,
 	kf11=\E[23~, kf12=\E[24~, kf2=\E[12~, kf3=\E[13~,
 	kf4=\E[14~, kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~,
 	kf9=\E[20~, khome=\E[7~, op=\E[m, rs1=\Ec,
@@ -2377,8 +2473,9 @@
 # with the key marked (ESC) on the vt220.  See vt220d for an alternate mapping.
 # PF1--PF4 are used as F1--F4.
 #
+# added msgr -TD
 vt220-old|vt200-old|DEC VT220 in vt100 emulation mode,
-	OTbs, OTpt, am, mir, xenl, xon,
+	OTbs, OTpt, am, mir, msgr, xenl, xon,
 	cols#80, lines#24, vt#3,
 	OTnl=^J,
 	acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~,
@@ -2404,8 +2501,15 @@
 # A much better description of the VT200/220; used to be vt220-8
 # changed rmacs/smacs from shift-in/shift-out to vt200-old's explicit G0/G1
 # designation to accommodate bug in pcvt -TD
+#
+# Here's a picture of the VT220 editing keypad:
+#	+--------+--------+--------+
+#	| Find   | Insert | Remove |
+#	+--------+--------+--------+
+#	| Select | Prev   | Next   |
+#	+--------+--------+--------+
 vt220|vt200|dec vt220,
-	OTbs, am, mc5i, mir, msgr, xenl, xon,
+	OTbs, am, mir, msgr, xenl, xon,
 	cols#80, it#8, lines#24, vt#3,
 	acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~,
 	bel=^G, blink=\E[5m, bold=\E[1m, clear=\E[H\E[J, cr=^M,
@@ -2417,20 +2521,21 @@
 	flash=\E[?5h$<200/>\E[?5l, home=\E[H, ht=^I, hts=\EH,
 	ich=\E[%p1%d@, if=/usr/share/tabset/vt100,
 	il=\E[%p1%dL, il1=\E[L, ind=\ED,
-	is2=\E[?7h\E[>\E[?1h\E F\E[?4l, kbs=^H, kcub1=\E[D,
-	kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kf1=\EOP, kf10=\E[21~,
-	kf11=\E[23~, kf12=\E[24~, kf13=\E[25~, kf14=\E[26~,
-	kf17=\E[31~, kf18=\E[32~, kf19=\E[33~, kf2=\EOQ,
-	kf20=\E[34~, kf3=\EOR, kf4=\EOS, kf6=\E[17~, kf7=\E[18~,
-	kf8=\E[19~, kf9=\E[20~, kfnd=\E[1~, khlp=\E[28~,
-	kich1=\E[2~, knp=\E[6~, kpp=\E[5~, krdo=\E[29~, kslt=\E[4~,
-	lf1=pf1, lf2=pf2, lf3=pf3, lf4=pf4, mc0=\E[i, mc4=\E[4i,
-	mc5=\E[5i, nel=\EE, rc=\E8, rev=\E[7m, ri=\EM,
-	rmacs=\E(B$<4>, rmam=\E[?7l, rmir=\E[4l, rmso=\E[27m,
-	rmul=\E[24m, rs1=\E[?3l, sc=\E7,
+	is2=\E[?7h\E[>\E[?1l\E F\E[?4l, kbs=^H, kcub1=\E[D,
+	kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[3~, kf1=\EOP,
+	kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, kf13=\E[25~,
+	kf14=\E[26~, kf17=\E[31~, kf18=\E[32~, kf19=\E[33~,
+	kf2=\EOQ, kf20=\E[34~, kf3=\EOR, kf4=\EOS, kf6=\E[17~,
+	kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, kfnd=\E[1~,
+	khlp=\E[28~, kich1=\E[2~, knp=\E[6~, kpp=\E[5~,
+	krdo=\E[29~, kslt=\E[4~, lf1=pf1, lf2=pf2, lf3=pf3, lf4=pf4,
+	nel=\EE, rc=\E8, rev=\E[7m, ri=\EM, rmacs=\E(B$<4>,
+	rmam=\E[?7l, rmir=\E[4l, rmso=\E[27m, rmul=\E[24m,
+	rs1=\E[?3l, sc=\E7,
 	sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p4%t;5%;%?%p1%p3%|%t;7%;m%?%p9%t\E(0%e\E(B%;$<2>,
 	sgr0=\E[m\E(B, smacs=\E(0$<2>, smam=\E[?7h, smir=\E[4h,
-	smso=\E[7m, smul=\E[4m, tbc=\E[3g,
+	smso=\E[7m, smul=\E[4m, tbc=\E[3g, use=ansi+pp,
+	use=ansi+enq,
 vt220-w|vt200-w|DEC vt220 in wide mode,
 	cols#132,
 	rs3=\E[?3h, use=vt220,
@@ -2447,18 +2552,18 @@
 	flash=\233?5h$<200/>\233?5l, home=\233H, ht=^I, hts=\EH,
 	ich=\233%p1%d@, if=/usr/share/tabset/vt100,
 	il=\233%p1%dL, il1=\233L, ind=\ED,
-	is2=\233?7h\233>\233?1h\E F\233?4l, kbs=^H,
+	is2=\233?7h\233>\233?1l\E F\233?4l, kbs=^H,
 	kcub1=\233D, kcud1=\233B, kcuf1=\233C, kcuu1=\233A,
-	kf1=\EOP, kf10=\23321~, kf11=\23323~, kf12=\23324~,
-	kf13=\23325~, kf14=\23326~, kf17=\23331~, kf18=\23332~,
-	kf19=\23333~, kf2=\EOQ, kf20=\23334~, kf3=\EOR, kf4=\EOS,
-	kf6=\23317~, kf7=\23318~, kf8=\23319~, kf9=\23320~,
-	kfnd=\2331~, khlp=\23328~, khome=\233H, kich1=\2332~,
-	knp=\2336~, kpp=\2335~, krdo=\23329~, kslt=\2334~, lf1=pf1,
-	lf2=pf2, lf3=pf3, lf4=pf4, mc0=\233i, mc4=\2334i, mc5=\2335i,
-	nel=\EE, rc=\E8, rev=\2337m, ri=\EM, rmacs=\E(B,
-	rmam=\233?7l, rmir=\2334l, rmso=\23327m, rmul=\23324m,
-	rs1=\233?3l, sc=\E7,
+	kdch1=\2333~, kf1=\EOP, kf10=\23321~, kf11=\23323~,
+	kf12=\23324~, kf13=\23325~, kf14=\23326~, kf17=\23331~,
+	kf18=\23332~, kf19=\23333~, kf2=\EOQ, kf20=\23334~,
+	kf3=\EOR, kf4=\EOS, kf6=\23317~, kf7=\23318~, kf8=\23319~,
+	kf9=\23320~, kfnd=\2331~, khlp=\23328~, khome=\233H,
+	kich1=\2332~, knp=\2336~, kpp=\2335~, krdo=\23329~,
+	kslt=\2334~, lf1=pf1, lf2=pf2, lf3=pf3, lf4=pf4, mc0=\233i,
+	mc4=\2334i, mc5=\2335i, nel=\EE, rc=\E8, rev=\2337m, ri=\EM,
+	rmacs=\E(B, rmam=\233?7l, rmir=\2334l, rmso=\23327m,
+	rmul=\23324m, rs1=\233?3l, sc=\E7,
 	sgr=\2330%?%p6%t;1%;%?%p2%t;4%;%?%p4%t;5%;%?%p1%p3%|%t;7%;m%?%p9%t\E(0%e\E(B%;$<2>,
 	sgr0=\2330m\E(B, smacs=\E(0, smam=\233?7h, smir=\2334h,
 	smso=\2337m, smul=\2334m, tbc=\2333g,
@@ -2495,14 +2600,15 @@
 #
 # From: Alexander Latzko <latzko@marsenius.rutgers.edu>, 30 Dec 1996
 # (Added vt100 <rc>,<sc> to quiet a tic warning -- esr)
+# added msgr -TD
 vt200-js|vt220-js|dec vt200 series with jump scroll,
-	am,
+	am, msgr,
 	cols#80,
 	bel=^G, clear=\E[H\E[J, cr=^M, csr=\E[%i%p1%d;%p2%dr,
 	cub1=^H, cud1=^J, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH,
 	cuu1=\E[A, dch1=\E[P, dl1=\E[M, ed=\E[J, el=\E[K, home=\E[H,
 	ht=^I, il1=\E[L, ind=\ED,
-	is2=\E[61"p\E[H\E[?3l\E[?4l\E[?1l\E[?5l\E[?6l\E[?7h\E[?8h\E[?25h\E>\E[m,
+	is2=\E[61"p\E[H\E[?3l\E[?4l\E[?1h\E[?5l\E[?6l\E[?7h\E[?8h\E[?25h\E>\E[m,
 	kbs=^H, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA,
 	kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, nel=^M\ED, rc=\E8,
 	rf=/usr/share/tabset/vt100, ri=\EM, rmdc=, rmir=\E[4l,
@@ -2534,7 +2640,7 @@
 # From: Adam Thompson <athompso@pangea.ca> Sept 10 1995
 # (vt320: uncommented <fsl> --esr)
 vt320|vt300|dec vt320 7 bit terminal,
-	am, eslok, hs, mir, msgr, xenl,
+	am, hs, mir, msgr, xenl,
 	cols#80, lines#24, wsl#80,
 	acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~,
 	bel=^G, blink=\E[5m, bold=\E[1m, civis=\E[?25l,
@@ -2543,9 +2649,8 @@
 	cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C,
 	cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A,
 	dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M,
-	ech=\E[%p1%dX, ed=\E[J, el=\E[K, el1=\E[1K, fsl=\E[0$},
-	home=\E[H, ht=^I, hts=\EH, ich=\E[%p1%d@, il=\E[%p1%dL,
-	il1=\E[L, ind=\ED,
+	ech=\E[%p1%dX, ed=\E[J, el=\E[K, el1=\E[1K, home=\E[H, ht=^I,
+	hts=\EH, ich=\E[%p1%d@, il=\E[%p1%dL, il1=\E[L, ind=\ED,
 	is2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h\E[1;24r\E[24;1H,
 	kbs=\177, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA,
 	kdch1=\E[3~, kel=\E[4~, kf10=\E[21~, kf11=\E[23~,
@@ -2553,8 +2658,7 @@
 	kf16=\E[29~, kf17=\E[31~, kf18=\E[32~, kf19=\E[33~,
 	kf20=\E[34~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~,
 	kf9=\E[20~, khome=\E[1~, kich1=\E[2~, knp=\E[6~, knxt=^I,
-	kpp=\E[5~, kprv=\E[Z, kslt=\E[4~, mc0=\E[i, mc4=\E[?4i,
-	mc5=\E[?5i, nel=\EE, rc=\E8, rev=\E[7m,
+	kpp=\E[5~, kprv=\E[Z, kslt=\E[4~, nel=\EE, rc=\E8, rev=\E[7m,
 	rf=/usr/share/tabset/vt300, ri=\EM, rmacs=\E(B,
 	rmam=\E[?7l, rmir=\E[4l, rmkx=\E[?1l\E>, rmso=\E[m,
 	rmul=\E[m,
@@ -2563,7 +2667,7 @@
 	sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p4%t;5%;%?%p1%p3%|%t;7%;m%?%p9%t\E(0%e\E(B%;$<2>,
 	sgr0=\E[m\E(B, smacs=\E(0, smam=\E[?7h, smir=\E[4h,
 	smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, tbc=\E[3g,
-	tsl=\E[1$}\E[H\E[K, use=vt220+keypad,
+	use=dec+pp, use=vt220+keypad, use=dec+sl, use=ansi+enq,
 vt320-nam|vt300-nam|dec vt320 7 bit terminal with no am to make SAS happy,
 	am@,
 	is2=\E>\E[?3l\E[?4l\E[?5l\E[?7l\E[?8h\E[1;24r\E[24;1H,
@@ -2673,33 +2777,38 @@
 	sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p4%t;5%;%?%p1%p3%|%t;7%;m%?%p9%t\E(0%e\E(B%;$<2>,
 	sgr0=\E[m\E(B, smacs=\E(0, smam=\E[?7h, smir=\E[4h,
 	smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, tbc=\E[3g,
-	tsl=\E[2$~\E[1$}\E[1;%dH,
+	tsl=\E[2$~\E[1$}\E[1;%dH, use=dec+sl,
 
 # (vt420: I removed <kf0>, it collided with <kf10>.  I also restored
 # a missing <sc> -- esr)
+# add msgr and other capabilities from vt220 -TD
 vt420|DEC VT420,
-	am, mir, xenl, xon,
-	cols#80, lines#24, vt#3,
+	am, mir, msgr, xenl, xon,
+	cols#80, it#8, lines#24, vt#3,
 	acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~,
-	bel=^G, blink=\E[5m$<2>, bold=\E[1m$<2>,
-	clear=\E[H\E[2J$<50>, cr=^M, csr=\E[%i%p1%d;%p2%dr,
-	cub1=^H, cud1=\E[B, cuf1=\E[C,
-	cup=\E[%i%p1%d;%p2%dH$<10>, cuu1=\E[A, dch1=\E[P,
-	dl1=\E[M, ed=\E[J$<50>, el=\E[K$<3>, home=\E[H, ht=^I,
-	if=/usr/share/tabset/vt300, il1=\E[L, ind=\ED,
-	is2=\E[1;24r\E[24;1H, is3=\E[?67h\E[64;1"p, kbs=^H,
-	kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A,
-	kdch1=\E[3~, kf1=\EOP, kf10=\E[29~, kf2=\EOQ, kf3=\EOR,
-	kf4=\EOS, kf5=\E[17~, kf6=\E[18~, kf7=\E[19~, kf8=\E[20~,
-	kf9=\E[21~, kfnd=\E[1~, kich1=\E[2~, knp=\E[6~, kpp=\E[5~,
-	kslt=\E[4~, rc=\E8, rev=\E[7m$<2>,
-	rf=/usr/share/tabset/vt300, ri=\EM, rmacs=\E(B$<4>,
-	rmam=\E[?7l, rmir=\E[4l, rmkx=\E>,
+	bel=^G, blink=\E[5m$<2>, bold=\E[1m$<2>, civis=\E[?25l,
+	clear=\E[H\E[2J$<50>, cnorm=\E[?25h, cr=^M,
+	csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H,
+	cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C,
+	cup=\E[%i%p1%d;%p2%dH$<10>, cuu=\E[%p1%dA, cuu1=\E[A,
+	dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M,
+	ech=\E[%p1%dX, ed=\E[J$<50>, el=\E[K$<3>, el1=\E[1K,
+	enacs=\E)0, flash=\E[?5h$<200/>\E[?5l, home=\E[H, ht=^I,
+	hts=\EH, ich=\E[%p1%d@, if=/usr/share/tabset/vt300,
+	il=\E[%p1%dL, il1=\E[L, ind=\ED, is2=\E[1;24r\E[24;1H,
+	is3=\E[?67h\E[64;1"p, kbs=^H, kcub1=\E[D, kcud1=\E[B,
+	kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[3~, kf1=\EOP, kf10=\E[29~,
+	kf2=\EOQ, kf3=\EOR, kf4=\EOS, kf5=\E[17~, kf6=\E[18~,
+	kf7=\E[19~, kf8=\E[20~, kf9=\E[21~, kfnd=\E[1~,
+	kich1=\E[2~, knp=\E[6~, kpp=\E[5~, kslt=\E[4~, nel=\EE,
+	rc=\E8, rev=\E[7m$<2>, rf=/usr/share/tabset/vt300,
+	ri=\EM, rmacs=\E(B$<4>, rmam=\E[?7l, rmir=\E[4l, rmkx=\E>,
 	rmsc=\E[?0;0r\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h,
-	rmso=\E[m, rmul=\E[m, rs3=\E[?67h\E[64;1"p, sc=\E7,
+	rmso=\E[27m, rmul=\E[24m, rs3=\E[?67h\E[64;1"p, sc=\E7,
 	sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p4%t;5%;%?%p1%p3%|%t;7%;m%?%p9%t\E(0%e\E(B%;$<2>,
-	sgr0=\E[m$<2>, smacs=\E(0$<2>, smam=\E[?7h, smir=\E[4h,
-	smkx=\E=, smso=\E[7m, smul=\E[4m,
+	sgr0=\E[m\E(B$<2>, smacs=\E(0$<2>, smam=\E[?7h,
+	smir=\E[4h, smkx=\E=, smso=\E[7m, smul=\E[4m, tbc=\E[3g,
+	use=ansi+pp, use=dec+sl, use=ansi+enq,
 
 # DEC VT220 and up support DECUDK (user-defined keys).  DECUDK (i.e., pfx)
 # takes two parameters, the key and the string.  Translating the key is
@@ -2772,58 +2881,11 @@
 # terminal mode is being used.  If Set-Up has been disabled or
 # assigned to an unknown key, Set-Up may be entered by pressing
 # [F3] as the first key after power up, regardless of keyboard type.
-# (vt520: I added <rmam>/<smam> based on the init string, also <sc> -- esr)
 vt520|DEC VT520,
-	am, mir, xenl, xon,
-	cols#80, lines#24, vt#3,
-	acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~,
-	bel=^G, blink=\E[5m$<2>, bold=\E[1m$<2>,
-	clear=\E[H\E[2J$<50>, cr=^M, csr=\E[%i%p1%d;%p2%dr,
-	cub1=^H, cud1=\E[B, cuf1=\E[C,
-	cup=\E[%i%p1%d;%p2%dH$<10>, cuu1=\E[A, dch1=\E[P,
-	dl1=\E[M, ed=\E[J$<50>, el=\E[K$<3>, home=\E[H, ht=^I,
-	if=/usr/share/tabset/vt300, il1=\E[L, ind=\ED,
-	is2=\E[1;24r\E[24;1H, is3=\E[?67h\E[64;1"p, kbs=^H,
-	kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A,
-	kdch1=\E[3~, kf1=\EOP, kf10=\E[29~, kf2=\EOQ, kf3=\EOR,
-	kf4=\EOS, kf5=\E[17~, kf6=\E[18~, kf7=\E[19~, kf8=\E[20~,
-	kf9=\E[21~, kfnd=\E[1~, kich1=\E[2~, knp=\E[6~, kpp=\E[5~,
-	kslt=\E[4~,
-	pfx=\EP1;1|%?%{16}%p1%>%t%{0}%e%{21}%p1%>%t%{1}%e%{25}%p1%>%t%{2}%e%{27}%p1%>%t%{3}%e%{30}%p1%>%t%{4}%e%{5}%;%p1%+%d/%p2%s\E\\,
-	rc=\E8, rev=\E[7m$<2>, rf=/usr/share/tabset/vt300,
-	ri=\EM, rmacs=\E(B$<4>, rmam=\E[?7l, rmir=\E[4l,
-	rmsc=\E[?0;0r\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h,
-	rmso=\E[m, rmul=\E[m, rs3=\E[?67h\E[64;1"p, sc=\E7,
-	sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p4%t;5%;%?%p1%p3%|%t;7%;m%?%p9%t\E(0%e\E(B%;$<2>,
-	sgr0=\E[m$<2>, smacs=\E(0$<2>, smam=\E[?7h, smir=\E[4h,
-	smso=\E[7m, smul=\E[4m,
+	use=ansi+rca, use=vt420, use=ansi+tabs,
 
-# (vt525: I added <rmam>/<smam> based on the init string;
-# removed <rmso>=\E[m, <rmul>=\E[m, added <sc> -- esr)
 vt525|DEC VT525,
-	am, mir, xenl, xon,
-	cols#80, lines#24, vt#3,
-	acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~,
-	bel=^G, blink=\E[5m$<2>, bold=\E[1m$<2>,
-	clear=\E[H\E[2J$<50>, cr=^M, csr=\E[%i%p1%d;%p2%dr,
-	cub1=^H, cud1=\E[B, cuf1=\E[C,
-	cup=\E[%i%p1%d;%p2%dH$<10>, cuu1=\E[A, dch1=\E[P,
-	dl1=\E[M, ed=\E[J$<50>, el=\E[K$<3>, home=\E[H, ht=^I,
-	if=/usr/share/tabset/vt300, il1=\E[L, ind=\ED,
-	is2=\E[1;24r\E[24;1H, is3=\E[?67h\E[64;1"p, kbs=^H,
-	kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A,
-	kdch1=\E[3~, kf1=\EOP, kf10=\E[29~, kf2=\EOQ, kf3=\EOR,
-	kf4=\EOS, kf5=\E[17~, kf6=\E[18~, kf7=\E[19~, kf8=\E[20~,
-	kf9=\E[21~, kfnd=\E[1~, kich1=\E[2~, knp=\E[6~, kpp=\E[5~,
-	kslt=\E[4~,
-	pfx=\EP1;1|%?%{16}%p1%>%t%{0}%e%{21}%p1%>%t%{1}%e%{25}%p1%>%t%{2}%e%{27}%p1%>%t%{3}%e%{30}%p1%>%t%{4}%e%{5}%;%p1%+%d/%p2%s\E\\,
-	rc=\E8, rev=\E[7m$<2>, rf=/usr/share/tabset/vt300,
-	ri=\EM, rmacs=\E(B$<4>, rmam=\E[?7l, rmir=\E[4l,
-	rmsc=\E[?0;0r\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h,
-	rmso=\E[m, rmul=\E[m, rs3=\E[?67h\E[64;1"p, sc=\E7,
-	sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p4%t;5%;%?%p1%p3%|%t;7%;m%?%p9%t\E(0%e\E(B%;$<2>,
-	sgr0=\E[m$<2>, smacs=\E(0$<2>, smam=\E[?7h, smir=\E[4h,
-	smso=\E[7m, smul=\E[4m,
+	use=vt520,
 
 #### VT100 emulations
 #
@@ -2887,7 +2949,7 @@
 # the default behavior -TD
 
 putty|PuTTY terminal emulator,
-	am, bce, bw, ccc, hs, mir, msgr, xenl, xon, XT,
+	am, bce, bw, ccc, mir, msgr, xenl, xon, XT,
 	colors#8, it#8, ncv#22, pairs#64, U8#1,
 	acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~,
 	bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[?25l,
@@ -2897,11 +2959,10 @@
 	cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\EM,
 	dch=\E[%p1%dP, dch1=\E[P,
 	dispc=%?%p1%{8}%=%t\E%%G\342\227\230\E%%@%e%p1%{10}%=%t\E%%G\342\227\231\E%%@%e%p1%{12}%=%t\E%%G\342\231\0\E%%@%e%p1%{13}%=%t\E%%G\342\231\252\E%%@%e%p1%{14}%=%t\E%%G\342\231\253\E%%@%e%p1%{15}%=%t\E%%G\342\230\274\E%%@%e%p1%{27}%=%t\E%%G\342\206\220\E%%@%e%p1%{155}%=%t\E%%G\340\202\242\E%%@%e%p1%c%;,
-	dl=\E[%p1%dM, dl1=\E[M, dsl=\E]0;\007, ech=\E[%p1%dX,
-	ed=\E[J, el=\E[K, el1=\E[1K, enacs=\E(B\E)0,
-	flash=\E[?5h\E[?5l, fsl=^G, home=\E[H, hpa=\E[%i%p1%dG,
-	ht=^I, hts=\EH, il=\E[%p1%dL, il1=\E[L, ind=^J,
-	indn=\E[%p1%dS,
+	dl=\E[%p1%dM, dl1=\E[M, ech=\E[%p1%dX, ed=\E[J, el=\E[K,
+	el1=\E[1K, enacs=\E(B\E)0, flash=\E[?5h\E[?5l, home=\E[H,
+	hpa=\E[%i%p1%dG, ht=^I, hts=\EH, il=\E[%p1%dL, il1=\E[L,
+	ind=^J, indn=\E[%p1%dS,
 	initc=\E]P%p1%x%p2%{255}%*%{1000}%/%02x%p3%{255}%*%{1000}%/%02x%p4%{255}%*%{1000}%/%02x,
 	is2=\E7\E[r\E[m\E[?7h\E[?1;4;6l\E[4l\E8\E>\E]R,
 	kb2=\E[G, kbs=\177, kcbt=\E[Z, kcub1=\E[D, kcud1=\E[B,
@@ -2922,7 +2983,8 @@
 	sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t\016%e\017%;,
 	sgr0=\E[m\017, smacs=^N, smam=\E[?7h, smcup=\E[?47h,
 	smir=\E[4h, smpch=\E[11m, smso=\E[7m, smul=\E[4m,
-	tbc=\E[3g, tsl=\E]0;, vpa=\E[%i%p1%dd, use=vt102+enq,
+	tbc=\E[3g, vpa=\E[%i%p1%dd, E3=\E[3;J, use=vt102+enq,
+	use=xterm+sl,
 vt100-putty|Reset PuTTY to pure vt100,
 	rs2=\E<\E["p\Ec\E[?3l\E]R\E[40"p\E[61"p\E[50;1;2"p,
 	use=vt100,
@@ -2937,6 +2999,28 @@
 	kf3=\EOR, kf4=\EOS, kf5=\EOT, kf6=\EOU, kf7=\EOV, kf8=\EOW,
 	kf9=\EOX, use=putty,
 
+# Unlike xterm-sco, this leaves kmous ambiguous with kf1.
+#
+# Use modifiers to obtain function keys past 12:
+# F1-F12 - normal
+# F13-F24 - shift
+# F25-F36 - control/alt
+# F37-F48 - control/shift
+#
+putty-sco|putty with SCO function keys,
+	kbeg=\E[E, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A,
+	kdch1=\177, kend=\E[F, kf1=\E[M, kf10=\E[V, kf11=\E[W,
+	kf12=\E[X, kf13=\E[Y, kf14=\E[Z, kf15=\E[a, kf16=\E[b,
+	kf17=\E[c, kf18=\E[d, kf19=\E[e, kf2=\E[N, kf20=\E[f,
+	kf21=\E[g, kf22=\E[h, kf23=\E[i, kf24=\E[j, kf25=\E[k,
+	kf26=\E[l, kf27=\E[m, kf28=\E[n, kf29=\E[o, kf3=\E[O,
+	kf30=\E[p, kf31=\E[q, kf32=\E[r, kf33=\E[s, kf34=\E[t,
+	kf35=\E[u, kf36=\E[v, kf37=\E[w, kf38=\E[x, kf39=\E[y,
+	kf4=\E[P, kf40=\E[z, kf41=\E[@, kf42=\E[[, kf43=\E[\\,
+	kf44=\E[], kf45=\E[\^, kf46=\E[_, kf47=\E[`, kf48=\E[{,
+	kf5=\E[Q, kf6=\E[R, kf7=\E[S, kf8=\E[T, kf9=\E[U, khome=\E[H,
+	kich1=\E[L, knp=\E[G, kpp=\E[I, use=putty,
+
 # This entry is for Tera Term Pro version 2.3, for MS-Windows 95/NT written by
 # T. Teranishi dated Mar 10, 1998.  It is a free software terminal emulator
 # (communication program) which supports:
@@ -3091,7 +3175,8 @@
 	kf9=\EOX, rmkx=\E[?1l\E>, rmso=\E[m, smkx=\E[?1h\E,
 	smso=\E[7m,
 
-#### X terminal emulators
+######## X TERMINAL EMULATORS
+#### XTERM
 #
 # You can add the following line to your .Xdefaults to change the terminal type
 # set by the xterms you start up to my-xterm:
@@ -3154,7 +3239,7 @@
 # added khome/kend, hts based on the R6 xterm code - TD
 # (khome/kend do not actually work in X11R5 or X11R6, but many people use this
 # for compatibility with other emulators).
-xterm-r6|xterm-old|xterm X11R6 version,
+xterm-r6|xterm X11R6 version,
 	OTbs, am, km, mir, msgr, xenl,
 	cols#80, it#8, lines#24,
 	acsc=``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~,
@@ -3180,10 +3265,12 @@
 	sgr0=\E[m, smacs=^N, smcup=\E7\E[?47h, smir=\E[4h,
 	smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, tbc=\E[3g,
 	use=vt100+enq,
+xterm-old|antique xterm version,
+	use=xterm-r6,
 # This is the base xterm entry for the xterm supplied with XFree86 3.2 & up.
 # The name has been changed and some aliases have been removed.
 xterm-xf86-v32|xterm terminal emulator (XFree86 3.2 Window System),
-	OTbs, am, bce, km, mir, msgr, xenl,
+	OTbs, am, bce, km, mir, msgr, xenl, XT,
 	cols#80, it#8, lines#24, ncv@,
 	acsc=``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~,
 	bel=^G, bold=\E[1m, cbt=\E[Z, civis=\E[?25l,
@@ -3227,13 +3314,13 @@
 # xterm to use terminfo-based descriptions with the titeInhibit resource.
 # -- the distribution contained incorrect khome/kend values -TD
 xterm-xf86-v333|xterm terminal emulator (XFree86 3.3.3 Window System),
-	mc5i,
 	blink=\E[5m, ich1@, invis=\E[8m,
 	is2=\E[!p\E[?3;4l\E[4l\E>, kdch1=\E[3~, kfnd@, kslt@,
-	mc0=\E[i, mc4=\E[4i, mc5=\E[5i, rmcup=\E[?1047l\E[?1048l,
-	rs1=\Ec, rs2=\E[!p\E[?3;4l\E[4l\E>,
+	rmcup=\E[?1047l\E[?1048l, rs1=\Ec,
+	rs2=\E[!p\E[?3;4l\E[4l\E>,
 	sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%?%p7%t;8%;m%?%p9%t\016%e\017%;,
-	smcup=\E[?1048h\E[?1047h, use=xterm-xf86-v33,
+	smcup=\E[?1048h\E[?1047h, use=ansi+pp,
+	use=xterm-xf86-v33,
 
 # This version was released in XFree86 4.0.
 xterm-xf86-v40|xterm terminal emulator (XFree86 4.0 Window System),
@@ -3274,12 +3361,14 @@
 # This version reflects the current xterm features.
 xterm-new|modern xterm terminal emulator,
 	npc,
-	indn=\E[%p1%dS, kDC=\E[3;2~, kEND=\E[1;2F, kHOM=\E[1;2H,
-	kIC=\E[2;2~, kNXT=\E[6;2~, kPRV=\E[5;2~, kb2=\EOE,
-	kcbt=\E[Z, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA,
-	kend=\EOF, kent=\EOM, khome=\EOH, kich1=\E[2~, kmous=\E[M,
-	knp=\E[6~, kpp=\E[5~, rin=\E[%p1%dT, use=xterm+pcfkeys,
+	indn=\E[%p1%dS, kb2=\EOE, kcbt=\E[Z, kent=\EOM,
+	rin=\E[%p1%dT, use=xterm+pcfkeys, use=xterm+tmux,
 	use=xterm-basic,
+
+# This fragment is for people who cannot agree on what the backspace key
+# should send.
+xterm+kbs|fragment for backspace key,
+	kbs=^H,
 #
 # This fragment describes as much of XFree86 xterm's "pc-style" function
 # keys as will fit into terminfo's 60 function keys.
@@ -3445,7 +3534,7 @@
 #
 # This chunk is used for building the VT220/Sun/PC keyboard variants.
 xterm-basic|modern xterm terminal emulator - common,
-	OTbs, am, bce, km, mc5i, mir, msgr, xenl, AX,
+	OTbs, am, bce, km, mir, msgr, xenl, AX, XT,
 	colors#8, cols#80, it#8, lines#24, pairs#64,
 	acsc=``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~,
 	bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[?25l,
@@ -3457,19 +3546,20 @@
 	dl1=\E[M, ech=\E[%p1%dX, ed=\E[J, el=\E[K, el1=\E[1K,
 	flash=\E[?5h$<100/>\E[?5l, home=\E[H, hpa=\E[%i%p1%dG,
 	ht=^I, hts=\EH, ich=\E[%p1%d@, il=\E[%p1%dL, il1=\E[L,
-	ind=^J, invis=\E[8m, is2=\E[!p\E[?3;4l\E[4l\E>, kbs=^H,
-	kmous=\E[M, mc0=\E[i, mc4=\E[4i, mc5=\E[5i, meml=\El,
-	memu=\Em, op=\E[39;49m, rc=\E8, rev=\E[7m, ri=\EM,
-	rmacs=\E(B, rmam=\E[?7l, rmcup=\E[?1049l, rmir=\E[4l,
-	rmkx=\E[?1l\E>, rmm=\E[?1034l, rmso=\E[27m, rmul=\E[24m,
-	rs1=\Ec, rs2=\E[!p\E[?3;4l\E[4l\E>, sc=\E7,
-	setab=\E[4%p1%dm, setaf=\E[3%p1%dm,
+	ind=^J, invis=\E[8m, is2=\E[!p\E[?3;4l\E[4l\E>,
+	kmous=\E[M, meml=\El, memu=\Em, op=\E[39;49m, rc=\E8,
+	rev=\E[7m, ri=\EM, rmacs=\E(B, rmam=\E[?7l,
+	rmcup=\E[?1049l, rmir=\E[4l, rmkx=\E[?1l\E>,
+	rmm=\E[?1034l, rmso=\E[27m, rmul=\E[24m, rs1=\Ec,
+	rs2=\E[!p\E[?3;4l\E[4l\E>, sc=\E7, setab=\E[4%p1%dm,
+	setaf=\E[3%p1%dm,
 	setb=\E[4%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m,
 	setf=\E[3%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m,
 	sgr=%?%p9%t\E(0%e\E(B%;\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%?%p7%t;8%;m,
 	sgr0=\E(B\E[m, smacs=\E(0, smam=\E[?7h, smcup=\E[?1049h,
 	smir=\E[4h, smkx=\E[?1h\E=, smm=\E[?1034h, smso=\E[7m,
-	smul=\E[4m, tbc=\E[3g, vpa=\E[%i%p1%dd, use=vt100+enq,
+	smul=\E[4m, tbc=\E[3g, vpa=\E[%i%p1%dd, E3=\E[3;J,
+	use=ansi+pp, use=xterm+kbs, use=vt100+enq,
 
 # From: David J. MacKenzie <djm@va.pubnix.com>, 14 Nov 1997
 # In retrospect, something like xterm-r6 was intended here -TD
@@ -3527,6 +3617,28 @@
 xterm-1003|testing xterm-mouse,
 	XM=\E[?1003%?%p1%{1}%=%th%el%;, use=xterm-new,
 
+# This chunk is based on suggestions by Ailin Nemui and Nicholas Marriott, who
+# asked for some of xterm's advanced features to be added to its terminfo
+# entry.  It defines extended capabilities not found in standard terminfo or
+# termcap.  These are useful in tmux, for instance, hence the name.
+#
+# One caveat in adding extended capabilities in ncurses is that if the names
+# are longer than two characters, then they will not be visible through the
+# termcap interface.
+#
+# Ms modifies the selection/clipboard.  Its parameters are
+#	p1 = the storage unit (clipboard, selection or cut buffer)
+#	p2 = the base64-encoded clipboard content.
+#
+# Ss is used to set the cursor style as described by the DECSCUSR
+#	function to a block or underline.
+# Se resets the cursor style to the terminal power-on default.
+#
+# Cs and Cr set and reset the cursor colour.
+xterm+tmux|advanced xterm features used in tmux,
+	Cr=\E]112\007, Cs=\E]12;%p1%s\007,
+	Ms=\E]52;%p1%s;%p2%s\007, Se=\E[2 q, Ss=\E[%p1%d q,
+
 # This is another variant, for XFree86 4.0 xterm (T.Dickey)
 # This is an 8-bit version of xterm, which emulates DEC vt220 with ANSI color.
 # To use it, your decTerminalID resource must be set to 200 or above.
@@ -3552,8 +3664,8 @@
 	hpa=\233%i%p1%dG, ht=^I, hts=\210, ich=\233%p1%d@,
 	il=\233%p1%dL, il1=\233L, ind=^J, invis=\2338m,
 	is2=\E[62"p\E G\233m\233?7h\E>\E7\233?1;3;4;6l\2334l\233r\E8,
-	ka1=\217w, ka3=\217u, kb2=\217y, kbeg=\217E, kbs=^H,
-	kc1=\217q, kc3=\217s, kcbt=\233Z, kcub1=\217D, kcud1=\217B,
+	ka1=\217w, ka3=\217u, kb2=\217y, kbeg=\217E, kc1=\217q,
+	kc3=\217s, kcbt=\233Z, kcub1=\217D, kcud1=\217B,
 	kcuf1=\217C, kcuu1=\217A, kdch1=\2333~, kend=\2334~,
 	kent=\217M, kf1=\23311~, kf10=\23321~, kf11=\23323~,
 	kf12=\23324~, kf13=\23325~, kf14=\23326~, kf15=\23328~,
@@ -3575,6 +3687,7 @@
 	smcup=\233?1049h, smir=\2334h, smkx=\233?1h\E=,
 	smso=\2337m, smul=\2334m, tbc=\2333g, u6=\233[%i%d;%dR,
 	u7=\E[6n, u8=\233[?1;2c, u9=\E[c, vpa=\233%i%p1%dd,
+	use=xterm+kbs,
 
 xterm-hp|xterm with hpterm function keys,
 	kclr=\EJ, kcub1=\ED, kcud1=\EB, kcuf1=\EC, kcuu1=\EA,
@@ -3621,8 +3734,9 @@
 	acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~,
 	bel=^G, clear=\EH\EJ, cr=^M, cub1=\ED, cud1=\EB, cuf1=\EC,
 	cup=\EY%p1%' '%+%c%p2%' '%+%c, cuu1=\EA, ed=\EJ, el=\EK,
-	home=\EH, ht=^I, ind=^J, kbs=^H, kcub1=\ED, kcud1=\EB,
-	kcuf1=\EC, kcuu1=\EA, nel=^M^J, ri=\EI, rmacs=\EG, smacs=\EF,
+	home=\EH, ht=^I, ind=^J, kcub1=\ED, kcud1=\EB, kcuf1=\EC,
+	kcuu1=\EA, nel=^M^J, ri=\EI, rmacs=\EG, smacs=\EF,
+	use=xterm+kbs,
 
 xterm-noapp|xterm with cursor keys in normal mode,
 	rmcup@, rmkx=\E>, smcup@, smkx=\E=, use=xterm+noapp,
@@ -3640,25 +3754,68 @@
 xterm-utf8|xterm with no VT100 line-drawing in UTF-8 mode,
 	U8#1, use=xterm,
 
-# These entries allow access to the X titlebar and icon name as a status line.
-# Note that twm (and possibly window managers descended from it such as tvtwm,
-# ctwm, and vtwm) track windows by icon-name; thus, you don't want to mess
-# with it.
+# These building-blocks allow access to the X titlebar and icon name as a
+# status line.  There are a few problems in using them in entries:
+#
+# a) tsl should have a parameter to denote the column on which to transfer to
+#    the status line.
+# b) the "0" code for xterm updates both icon-title and window title.  Some
+#    window managers such as twm (and possibly window managers descended from
+#    it such as tvtwm, ctwm, and vtwm) track windows by icon-name. Thus, you
+#    don't want to mess with icon-name when using those window managers.
 xterm+sl|access X title line and icon name,
 	hs,
-	wsl#40,
-	dsl=\E]0;\007, fsl=^G, tsl=\E]0;, use=xterm,
+	dsl=\E]0;\007, fsl=^G, tsl=\E]0;,
 xterm+sl-twm|access X title line (pacify twm-descended window managers),
 	hs,
-	wsl#40,
-	dsl=\E]2;\007, fsl=^G, tsl=\E]2;, use=xterm,
+	dsl=\E]2;\007, fsl=^G, tsl=\E]2;,
+
+# In contrast, this block can be used for a DEC vt320 and up.  There are two
+# controls used.
+#
+# DECSASD (select active status display)
+#	\E[0$}	Main display
+#	\E[1$}	Status line
+#
+# DECSSDT (select status line type)
+#	\E[0$~	No status line
+#	\E[1$~	Indicator status line
+#	\E[2$~	Host-writable status line
+#
+# The building block assumes that the terminal always shows something at the
+# status line (either the indicator, or status line).  That is because if no
+# status line is used, then the terminal makes that line part of the user
+# window, changing its size without notice.
+#
+# Because there is no "esl" (enable status line) capability, the "tsl"
+# capability ensures that the status line is host-writable.  A DEC terminal
+# will clear the status line when changing from indicator to host-writable
+# mode.
+#
+# Once on the status line, the row part of cursor addressing is ignored.  Since
+# tsl expects a parameter (to specify the column), the shortest addressing that
+# can be used for this purpose is HPA, e.g., \E[5d to go to column 5.
+#
+dec+sl|DEC VTxx status line,
+	eslok, hs,
+	dsl=\E[1$~, fsl=\E[0$}, tsl=\E[2$~\E[1$}\E[%i%p1%d`,
 
 #
 # The following xterm variants don't depend on your base version
 #
 # xterm with bold instead of underline
 xterm-bold|xterm terminal emulator (X11R6 Window System) standout w/bold,
+	sgr=%?%p9%t\016%e\017%;B\E[0%?%p6%t;1%;%?%p2%t;1%;%?%p1%p3%|%t;7%;m,
 	smso=\E[7m, smul=\E[1m, use=xterm-old,
+
+# See the note on ICH/ICH1 VERSUS RMIR/SMIR near the end of file
+xterm-nic|xterm with ich/ich1 suppressed for non-curses programs,
+	ich@, ich1@, use=xterm,
+# From: Mark Sheppard <kimble@mistral.co.uk>, 4 May 1996
+xterm1|xterm terminal emulator ignoring the alternate screen buffer,
+	rmcup@, smcup@, use=xterm,
+
+#### KTERM
 # (kterm: this had extension capabilities ":KJ:TY=ascii:" -- esr)
 # (kterm should not invoke DEC Graphics as the alternate character set
 #  -- Kenji Rikitake)
@@ -3676,12 +3833,51 @@
 	tsl=\E[?E\E[?%i%p1%dT, use=xterm-r6, use=ecma+color,
 kterm-color|kterm-co|kterm with ANSI colors,
 	ncv@, use=kterm, use=ecma+color,
-# See the note on ICH/ICH1 VERSUS RMIR/SMIR near the end of file
-xterm-nic|xterm with ich/ich1 suppressed for non-curses programs,
-	ich@, ich1@, use=xterm,
-# From: Mark Sheppard <kimble@mistral.co.uk>, 4 May 1996
-xterm1|xterm terminal emulator ignoring the alternate screen buffer,
-	rmcup@, smcup@, use=xterm,
+
+#### Other XTERM
+# These (xtermc and xtermm) are distributed with Solaris.  They refer to a
+# variant of xterm which is apparently no longer supported, but are interesting
+# because they illustrate SVr4 curses mouse controls - T.Dickey
+xtermm|xterm terminal emulator (monocrome),
+	OTbs, am, km, mir, msgr, xenl,
+	btns#3, cols#80, it#8, lines#24,
+	acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~,
+	bel=^G, blink@, bold=\E[1m, clear=\E[H\E[2J, cr=^M,
+	csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=\E[D,
+	cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C,
+	cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A,
+	dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, ed=\E[J,
+	el=\E[K, el1=\E[1K$<3>, enacs=\E(B\E)0, getm=\E[%p1%dY,
+	home=\E[H, ht=^I, hts=\EH, ich=\E[%p1%d@, ich1=\E[@,
+	il=\E[%p1%dL, il1=\E[L, ind=^J, kbs=^H, kcub1=\EOD,
+	kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, kend=\E[Y, kf0=\EOy,
+	kf10=\EOY, kf11=\EOZ, kf12=\EOA, kf5=\EOT, kf6=\EOU,
+	kf7=\EOV, kf8=\EOW, kf9=\EOX, khome=\E[H, kmous=\E[^_,
+	knp=\E[U, kpp=\E[V, rc=\E8, reqmp=\E[492Z, rev=\E[7m, ri=\EM,
+	rmacs=^O, rmcup=\E@0\E[?4r, rmso=\E[m,
+	rs1=\E>\E[1;3;4;5;6l\E[?7h\E[m\E[r\E[2J\E[H,
+	rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, sc=\E7,
+	sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t\016%e\017%;,
+	sgr0=\E[m\017, smacs=^N, smcup=\E@0\E[?4s\E[?4h\E@1,
+	smso=\E[7m, tbc=\E[3g, use=vt100+fnkeys,
+
+xtermc|xterm terminal emulator (color),
+	colors#8, ncv#7, pairs#64,
+	op=\E[100m, setab=\E[4%p1%dm, setaf=\E[3%p1%dm,
+	setb=\E[4%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m,
+	setf=\E[3%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m,
+	use=xtermm,
+
+# From: David J. MacKenzie <djm@va.pubnix.com> 20 Apr 1995
+# Here's a termcap entry I've been using for xterm_color, which comes
+# with BSD/OS 2.0, and the X11R6 contrib tape too I think.  Besides the
+# color stuff, I also have a status line defined as the window manager
+# title bar. [I have translated it to terminfo -- ESR]
+xterm-pcolor|xterm with color used for highlights and status line,
+	wsl#40,
+	bold=\E[1;43m, rev=\E[7;34m,
+	sgr=%?%p9%t\E(0%e\E(B%;\E[0%?%p6%t;1;43%;%?%p2%t;4;42%;%?%p1%t;7;31%;%?%p3%t;7;34%;%?%p4%t;5%;%?%p7%t;8%;m,
+	smso=\E[7;31m, smul=\E[4;42m, use=xterm+sl, use=xterm-r6,
 
 # This describes the capabilities of color_xterm, an xterm variant from
 # before ECMA-64 color support was folded into the main-line xterm release.
@@ -3729,6 +3925,32 @@
 	ncv@,
 	op=\E[m, use=xterm-r6, use=klone+color,
 
+# This entry describes an xterm with Sun-style function keys enabled
+# via the X resource setting "xterm*sunFunctionKeys:true"
+# To understand <kf11>/<kf12> note that L1,L2 and F11,F12 are the same.
+# The <kf13>...<kf20> keys are L3-L10.  We don't set <kf16=\E[197z>
+# because we want it to be seen as <kcpy>.
+# The <kf31>...<kf45> keys are R1-R15.  We treat some of these in accordance
+# with their Sun keyboard labels instead.
+# From: Simon J. Gerraty <sjg@zen.void.oz.au> 10 Jan 1996
+xterm-sun|xterm with sunFunctionKeys true,
+	kb2=\E[218z, kcpy=\E[197z, kcub1=\EOD, kcud1=\EOB,
+	kcuf1=\EOC, kcuu1=\EOA, kdch1=\E[3z, kend=\E[220z,
+	kent=\EOM, kf1=\E[224z, kf10=\E[233z, kf11=\E[192z,
+	kf12=\E[193z, kf13=\E[194z, kf14=\E[195z, kf15=\E[196z,
+	kf17=\E[198z, kf18=\E[199z, kf19=\E[200z, kf2=\E[225z,
+	kf20=\E[201z, kf3=\E[226z, kf31=\E[208z, kf32=\E[209z,
+	kf33=\E[210z, kf34=\E[211z, kf35=\E[212z, kf36=\E[213z,
+	kf38=\E[215z, kf4=\E[227z, kf40=\E[217z, kf42=\E[219z,
+	kf44=\E[221z, kf45=\E[222z, kf46=\E[234z, kf47=\E[235z,
+	kf5=\E[228z, kf6=\E[229z, kf7=\E[230z, kf8=\E[231z,
+	kf9=\E[232z, kfnd=\E[200z, khlp=\E[196z, khome=\E[214z,
+	kich1=\E[2z, knp=\E[222z, kpp=\E[216z, kund=\E[195z,
+	use=xterm-basic,
+xterms-sun|small (80x24) xterm with sunFunctionKeys true,
+	cols#80, lines#24, use=xterm-sun,
+
+#### GNOME (VTE)
 # this describes the alpha-version of Gnome terminal shipped with Redhat 6.0
 gnome-rh62|Gnome terminal,
 	bce,
@@ -3782,7 +4004,7 @@
 #
 # bce and msgr are repaired.
 gnome-rh90|GNOME Terminal,
-	bce, msgr,
+	bce, msgr, XT,
 	hpa=\E[%i%p1%dG, kDC=\E[3;2~, kLFT=\EO2D, kRIT=\EO2C,
 	kb2=\E[E, kcbt=\E[Z, kend=\EOF, khome=\EOH, tbc=\E[3g,
 	vpa=\E[%i%p1%dd, use=xterm+pcf0, use=xterm+pcfkeys,
@@ -3820,6 +4042,19 @@
 gnome-2008|GNOME Terminal snapshot 2.22.3,
 	use=vte-2008,
 
+# GNOME Terminal 3.6.0 (2012)
+# VTE 0.34.1 was marked in git 2012-10-15 (three days after patch was applied
+# in ncurses).  It inherited from gnome-fc5, which broke the modified forms
+# of f1-f4 -TD
+#
+# Testing with tack shows that flash does not/has not worked -TD
+vte-2012|VTE 0.34.1,
+	flash@, ritm=\E[23m, sitm=\E[3m, use=vte-2008,
+# Version 3.6.1 sets TERM to xterm-256color (still hardcoded), which has
+# 61 differences from a correct entry for gnome terminal.
+gnome-2012|GNOME Terminal 3.6.0,
+	use=vte-2012,
+
 # GNOME terminal may automatically use the contents of the "xterm" terminfo to
 # supply key information which is not built into the program.  With 2.22.3,
 # this list is built into the program (which addresses the inadvertant use of
@@ -3848,13 +4083,13 @@
 	use=vte+pcfkeys,
 
 vte|VTE aka GNOME Terminal,
-	use=vte-2008,
+	use=vte-2012,
 gnome|GNOME Terminal,
 	use=vte,
 
 # palette is hardcoded...
 vte-256color|VTE with xterm 256-colors,
-	initc@, use=xterm+256color, use=vte,
+	use=xterm+256color, use=vte,
 gnome-256color|GNOME Terminal with xterm 256-colors,
 	use=vte-256color,
 
@@ -3865,8 +4100,9 @@
 # Since most of the terminfo-related behavior is due to the VTE library,
 # the terminfo is the same as gnome-terminal.
 xfce|Xfce Terminal,
-	use=vte,
+	use=vte-2008,
 
+#### Other GNOME
 # Multi-Gnome-Terminal 1.6.2
 #
 # This does not use VTE, and does have different behavior (compare xfce and
@@ -3874,6 +4110,7 @@
 mgt|Multi GNOME Terminal,
 	indn=\E[%p1%dS, rin=\E[%p1%dT, use=xterm-xf86-v333,
 
+#### KDE
 # This is kvt 0-18.7, shipped with Redhat 6.0 (though whether it supports bce
 # or not is debatable).
 kvt|KDE terminal,
@@ -3922,7 +4159,7 @@
 	ncv@,
 	bel@, blink=\E[5m, civis=\E[?25l, cnorm=\E[?25h,
 	ech=\E[%p1%dX, flash=\E[?5h$<100/>\E[?5l,
-	hpa=\E[%i%p1%dG, indn=\E[%p1%dS, kbs=\177, kdch1@,
+	hpa=\E[%i%p1%dG, indn=\E[%p1%dS, kbs=\177, kdch1=\E[3~,
 	kend=\E[4~, kf1@, kf10@, kf11@, kf12@, kf13@, kf14@, kf15@, kf16@,
 	kf17@, kf18@, kf19@, kf2@, kf20@, kf3@, kf4@, kf5@, kf6@, kf7@, kf8@,
 	kf9@, kfnd@, khome=\E[1~, kslt@, rin=\E[%p1%dT, rmam=\E[?7l,
@@ -3932,11 +4169,10 @@
 	sgr0=\E[0m\017, smam=\E[?7h, vpa=\E[%i%p1%dd,
 	use=ecma+color, use=xterm-r6,
 konsole-linux|KDE console window with linux keyboard,
-	kdch1=\E[3~, kf1=\E[[A, kf10=\E[21~, kf11=\E[23~,
-	kf12=\E[24~, kf13@, kf14@, kf15@, kf16@, kf17@, kf18@, kf19@,
-	kf2=\E[[B, kf20@, kf3=\E[[C, kf4=\E[[D, kf5=\E[[E,
-	kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~,
-	use=konsole-base,
+	kf1=\E[[A, kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, kf13@,
+	kf14@, kf15@, kf16@, kf17@, kf18@, kf19@, kf2=\E[[B, kf20@,
+	kf3=\E[[C, kf4=\E[[D, kf5=\E[[E, kf6=\E[17~, kf7=\E[18~,
+	kf8=\E[19~, kf9=\E[20~, use=konsole-base,
 konsole-solaris|KDE console window with Solaris keyboard,
 	kbs=^H, kend=\E[4~, khome=\E[1~, use=konsole-vt100,
 # KDE's "XFree86 3.x.x" keyboard is based on reading the xterm terminfo rather
@@ -3972,6 +4208,7 @@
 konsole-256color|KDE console window with xterm 256-colors,
 	initc@, use=xterm+256color, use=konsole,
 
+#### MLTERM
 # This is mlterm 2.9.3's mlterm.ti, with some additions/corrections -TD
 #
 # It is nominally a vt102 emulator, with features borrowed from rxvt and
@@ -4037,6 +4274,7 @@
 mlterm-256color|mlterm 3.0 with xterm 256-colors,
 	use=xterm+256color, use=rxvt,
 
+#### RXVT
 # From: Thomas Dickey <dickey@clark.net> 04 Oct 1997
 # Updated: Oezguer Kesim <kesim@math.fu-berlin.de> 02 Nov 1997
 # Notes:
@@ -4208,6 +4446,7 @@
 rxvt-16color|xterm with 16 colors like aixterm,
 	ncv#32, use=ibm+16color, use=rxvt,
 
+#### MRXVT
 # mrxvt 0.5.4
 #
 # mrxvt is based on rxvt 2.7.11, but has by default XTERM_FKEYS defined, which
@@ -4225,6 +4464,7 @@
 mrxvt-256color|multitabbed rxvt with 256 colors,
 	use=xterm+256color, use=mrxvt,
 
+#### ETERM
 # From: Michael Jennings <mej@valinux.com>
 #
 # Eterm 0.9.3
@@ -4270,11 +4510,13 @@
 Eterm-88color|Eterm with 88 colors,
 	use=xterm+88color, use=Eterm,
 
+#### ATERM
 # Based on rxvt 2.4.8, it has a few differences in key bindings
 aterm|AfterStep terminal,
 	XT,
 	kbs=\177, kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, use=rxvt,
 
+#### XITERM
 # xiterm  0.5-5.2
 # This is not based on xterm's source...
 # vttest shows several problems with keyboard, cursor-movements.
@@ -4283,48 +4525,8 @@
 	km@,
 	kbs=\177, kdch1=\E[3~, use=klone+color, use=xterm-r6,
 
-# These (xtermc and xtermm) are distributed with Solaris.  They refer to a
-# variant of xterm which is apparently no longer supported, but are interesting
-# because they illustrate SVr4 curses mouse controls - T.Dickey
-xtermm|xterm terminal emulator (monocrome),
-	OTbs, am, km, mir, msgr, xenl,
-	btns#3, cols#80, it#8, lines#24,
-	acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~,
-	bel=^G, blink@, bold=\E[1m, clear=\E[H\E[2J, cr=^M,
-	csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=\E[D,
-	cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C,
-	cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A,
-	dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, ed=\E[J,
-	el=\E[K, el1=\E[1K$<3>, enacs=\E(B\E)0, getm=\E[%p1%dY,
-	home=\E[H, ht=^I, hts=\EH, ich=\E[%p1%d@, ich1=\E[@,
-	il=\E[%p1%dL, il1=\E[L, ind=^J, kbs=^H, kcub1=\EOD,
-	kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, kend=\E[Y, kf0=\EOy,
-	kf10=\EOY, kf11=\EOZ, kf12=\EOA, kf5=\EOT, kf6=\EOU,
-	kf7=\EOV, kf8=\EOW, kf9=\EOX, khome=\E[H, kmous=\E[^_,
-	knp=\E[U, kpp=\E[V, rc=\E8, reqmp=\E[492Z, rev=\E[7m, ri=\EM,
-	rmacs=^O, rmcup=\E@0\E[?4r, rmso=\E[m,
-	rs1=\E>\E[1;3;4;5;6l\E[?7h\E[m\E[r\E[2J\E[H,
-	rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, sc=\E7,
-	sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t\016%e\017%;,
-	sgr0=\E[m\017, smacs=^N, smcup=\E@0\E[?4s\E[?4h\E@1,
-	smso=\E[7m, tbc=\E[3g, use=vt100+fnkeys,
-
-xtermc|xterm terminal emulator (color),
-	colors#8, ncv#7, pairs#64,
-	op=\E[100m, setab=\E[4%p1%dm, setaf=\E[3%p1%dm,
-	setb=\E[4%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m,
-	setf=\E[3%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m,
-	use=xtermm,
-
-# From: David J. MacKenzie <djm@va.pubnix.com> 20 Apr 1995
-# Here's a termcap entry I've been using for xterm_color, which comes
-# with BSD/OS 2.0, and the X11R6 contrib tape too I think.  Besides the
-# color stuff, I also have a status line defined as the window manager
-# title bar. [I have translated it to terminfo -- ESR]
-xterm-pcolor|xterm with color used for highlights and status line,
-	bold=\E[1m\E[43m, rev=\E[7m\E[34m, smso=\E[7m\E[31m,
-	smul=\E[4m\E[42m, use=xterm+sl, use=xterm-r6,
 
+#### HPTERM
 # HP ships this (HPUX 9 and 10), except for the pb#9600 which was merged in
 # from BSD termcap.  (hpterm:  added empty <acsc>, we have no idea what ACS
 # chars look like --esr)
@@ -4357,31 +4559,7 @@
 	initp=\E&v%p2%da%p3%db%p4%dc%p5%dx%p6%dy%p7%dz%p1%dI,
 	op=\E&v0S, scp=\E&v%p1%dS, use=hpterm,
 
-# This entry describes an xterm with Sun-style function keys enabled
-# via the X resource setting "xterm*sunFunctionKeys:true"
-# To understand <kf11>/<kf12> note that L1,L2 and F11,F12 are the same.
-# The <kf13>...<kf20> keys are L3-L10.  We don't set <kf16=\E[197z>
-# because we want it to be seen as <kcpy>.
-# The <kf31>...<kf45> keys are R1-R15.  We treat some of these in accordance
-# with their Sun keyboard labels instead.
-# From: Simon J. Gerraty <sjg@zen.void.oz.au> 10 Jan 1996
-xterm-sun|xterm with sunFunctionKeys true,
-	kb2=\E[218z, kcpy=\E[197z, kcub1=\EOD, kcud1=\EOB,
-	kcuf1=\EOC, kcuu1=\EOA, kdch1=\E[3z, kend=\E[220z,
-	kent=\EOM, kf1=\E[224z, kf10=\E[233z, kf11=\E[192z,
-	kf12=\E[193z, kf13=\E[194z, kf14=\E[195z, kf15=\E[196z,
-	kf17=\E[198z, kf18=\E[199z, kf19=\E[200z, kf2=\E[225z,
-	kf20=\E[201z, kf3=\E[226z, kf31=\E[208z, kf32=\E[209z,
-	kf33=\E[210z, kf34=\E[211z, kf35=\E[212z, kf36=\E[213z,
-	kf38=\E[215z, kf4=\E[227z, kf40=\E[217z, kf42=\E[219z,
-	kf44=\E[221z, kf45=\E[222z, kf46=\E[234z, kf47=\E[235z,
-	kf5=\E[228z, kf6=\E[229z, kf7=\E[230z, kf8=\E[231z,
-	kf9=\E[232z, kfnd=\E[200z, khlp=\E[196z, khome=\E[214z,
-	kich1=\E[2z, knp=\E[222z, kpp=\E[216z, kund=\E[195z,
-	use=xterm-basic,
-xterms-sun|small (80x24) xterm with sunFunctionKeys true,
-	cols#80, lines#24, use=xterm-sun,
-
+#### EMU
 # This is for the extensible terminal emulator on the X11R6 contrib tape.
 # It corresponds to emu's internal emulation:
 #	emu -term emu
@@ -4443,6 +4621,8 @@
 	sgr=\E[0%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p5%t;2%;%?%p6%t;1%;%?%p7%t;8%;m%?%p9%t\016%e\017%;,
 	sgr0=\E[m, smacs=^N, smcup=\E[?1l\E=, smkx=\E=,
 	smso=\E[0;7m, smul=\E[0;4m, tbc=\E[3g,
+
+#### MVTERM
 # A commercial product, Reportedly a version of Xterm with an OPEN LOOK UI,
 # print interface, ANSI X3.64 colour escape sequences, etc.  Newsgroup postings
 # indicate that it emulates more than one terminal, but incompletely.
@@ -4477,7 +4657,7 @@
 	smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, tbc=\E[3g,
 	tsl=\E[?E\E[?%i%p1%dT, use=vt100+fnkeys,
 
-### MTERM
+#### MTERM
 #
 # This application is available by email from <mouse@Rodents.Montreal.QC.CA>.
 #
@@ -4598,6 +4778,123 @@
 	kf5=\E[[E, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~,
 	khome=\E[1~, knp=\E[6~, kpp=\E[5~, use=mgr,
 
+#### SIMPLETERM
+# st.suckless.org
+# st-0.1.1
+#
+# Note:  the original terminfo description uses leading blank to persuade
+# ncurses to use "st" as its name.  Proper fix for that is to use "st" as an
+# alias.
+#
+# Reading the code shows it should work for aixterm 16-colors
+# - added st-16color
+#
+# Using tack:
+# - set eo (erase-overstrike)
+# - set xenl
+# - tbc doesn't work
+# - hts works
+# - cbt doesn't work
+# - shifted cursor-keys send sequences like rxvt
+# - sgr referred to unimplemented "invis" mode.
+# Fixes: add eo and xenl per tack, remove nonworking cbt, hts and tbc, invis
+simpleterm|st| simpleterm,
+	am, eo, mir, msgr, ul, xenl,
+	colors#8, cols#80, it#8, lines#24, ncv#3, pairs#64,
+	acsc=``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~,
+	bel=^G, bold=\E[1m, civis=\E[?25l, clear=\E[H\E[2J,
+	cnorm=\E[?12l\E[?25h, cr=^M, csr=\E[%i%p1%d;%p2%dr,
+	cub1=^H, cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C,
+	cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A,
+	dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, el=\E[K,
+	home=\E[H, hpa=\E[%i%p1%dG, ht=^I, ich=\E[%p1%d@,
+	il=\E[%p1%dL, il1=\E[L, ind=^J, indn=\E[%p1%dS, kbs=\177,
+	kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A,
+	kdch1=\E[3~, kend=\E[4~, kf1=\EOP, kf10=\E[21~,
+	kf11=\E[23~, kf12=\E[24~, kf2=\EOQ, kf3=\EOR, kf4=\EOS,
+	kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~,
+	khome=\E[1~, knp=\E[6~, kpp=\E[5~, op=\E[37;40m, rc=\E8,
+	rev=\E[7m, rmacs=\E(B, rmso=\E[m, rmul=\E[m, sc=\E7,
+	setab=\E[4%p1%dm, setaf=\E[3%p1%dm,
+	sgr=%?%p9%t\E(0%e\E(B%;\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;m,
+	sgr0=\E[0m, smacs=\E(0, smso=\E[7m, smul=\E[4m,
+st-16color|simpleterm with 16-colors,
+	use=ibm+16color, use=simpleterm,
+# 256 colors "works", but when running xterm's test-scripts, some garbage is
+# shown in the titlebar.
+st-256color|simpleterm with 256 colors,
+	ccc@,
+	initc@, use=xterm+256color, use=simpleterm,
+
+#### TERMINATOR
+# http://software.jessies.org/terminator/
+# Tested using their Debian package org.jessies.terminator 6.104.3256 on 64-bit
+# Debian/current -TD (2011/8/20)
+#
+# There are some packaging problems:
+# a) using Java, the program starts off using 50Mb, and climbs from there,
+#    up to 114Mb after testing (no scrollback).
+# b) it insists on reinstalling its terminal description in $HOME/.terminfo
+#    (two copies, just in case the host happens to be Mac OS X).
+#    I deleted this after testing with tack.
+#
+# Issues/features found with tack:
+# a) tbc does not work (implying that hts also is broken).
+#    Comparing with the tabs utility shows a problem with the last tabstop on
+#    a line.
+# b) has xterm-style shifted function-key strings
+#    meta also is used, but control is ignored.
+# c) has xterm-style modifiers for cursor keys (shift, control, shift+control, meta)
+# d) some combinations of shift/control send xterm-style sequences for
+#    insert/delete/home/end.
+# e) numeric keypad sends only numbers (compare with vttest).
+# f) meta mode (km) is not implemented.
+#
+# Issues found with ncurses test-program:
+# a) bce is inconsistently implemented
+# b) widths of Unicode values above 256 do not always agree with wcwidth.
+#
+# Checked with vttest, found low degree of compatibility there.
+#
+# Checked with xterm's scripts, found that the 256-color palette is fixed.
+#
+# Fixes:
+# a) add sgr string
+# b) corrected sgr0 to reset alternate character set
+# c) modified smacs/rmacs to use SCS rather than SI/SO
+# d) removed bce
+# e) removed km
+terminator|Terminator no line wrap,
+	eo, mir, msgr, xenl, xon,
+	colors#256, cols#80, it#8, lines#24, lm#0, pairs#32767,
+	acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~,
+	bold=\E[1m, civis=\E[?25l, clear=\E[H\E[2J,
+	cnorm=\E[?25h, cr=^M, csr=\E[%i%p1%d;%p2%dr,
+	cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=^J,
+	cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH,
+	cuu=\E[%p1%dA, cuu1=\E[A, dch=\E[%p1%dP, dch1=\E[P,
+	dl=\E[%p1%dM, dl1=\E[M, dsl=\E]2;\007, ed=\E[J, el=\E[K,
+	el1=\E[1K, enacs=\E(B\E)0, flash=^G, fsl=^G, home=\E[H,
+	hpa=\E[%i%p1%dG, ht=^I, hts=\EH, il=\E[%p1%dL, il1=\E[L,
+	ind=^J, is1=\E[?47l\E=\E[?1l,
+	is2=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;3;4;6l\E[4l, kbs=^H,
+	kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A,
+	kdch1=\E[3~, kend=\E[4~, kf1=\EOP, kf10=\E[21~,
+	kf11=\E[23~, kf12=\E[24~, kf13=\E[25~, kf14=\E[26~,
+	kf15=\E[28~, kf16=\E[29~, kf2=\EOQ, kf3=\EOR, kf4=\EOS,
+	kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~,
+	khome=\E[1~, kich1=\E[2~, knp=\E[6~, kpp=\E[5~,
+	op=\E[39;49m, rc=\E8, rev=\E[7m, ri=\EM, rmacs=\E(B,
+	rmcup=\E[?47l\E8, rmir=\E[4l, rmso=\E[27m, rmul=\E[24m,
+	rs1=\E>\E[1;3;4;5;6l\E[?7h\E[m\E[r\E[2J\E[H,
+	rs2=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;3;4;6l\E[4l\E>,
+	s0ds=\E(B, s1ds=\E(0, sc=\E7, setab=\E[48;5;%p1%dm,
+	setaf=\E[38;5;%p1%dm,
+	sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;m%?%p9%t\E(0%e\E(B%;,
+	sgr0=\E[m\E(B, smacs=\E(0, smcup=\E7\E[?47h, smir=\E[4h,
+	smso=\E[7m, smul=\E[4m, tbc=\E[3g, tsl=\E]2;%p1,
+	vpa=\E[%i%p1%dd,
+
 ######## UNIX VIRTUAL TERMINALS, VIRTUAL CONSOLES, AND TELNET CLIENTS
 #
 
@@ -4780,7 +5077,7 @@
 	bce@, bw,
 	invis@, kIC@, kNXT@, kPRV@, meml@, memu@,
 	sgr=%?%p9%t\E(0%e\E(B%;\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m,
-	use=screen+fkeys, use=xterm-new,
+	E3@, use=screen+fkeys, use=xterm-new,
 # xterm-r6 does not really support khome/kend unless it is propped up by
 # the translations resource.
 screen.xterm-r6|screen customized for X11R6 xterm,
@@ -4920,18 +5217,18 @@
 # sequences for setting the window-title.  So you must use tsl and fsl in
 # pairs, since the latter ends the string that is loaded to the window-title.
 ncsa-m|ncsa-vt220-8|NCSA Telnet 2.6 for Macintosh in vt220-8 mode,
-	am, hs, km, mir, msgr, xenl,
+	am, km, mir, msgr, xenl,
 	acsc=``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~,
 	bel=^G, blink=\E[5m, bold=\E[1m, civis=\E[?25l,
 	clear=\E[H\E[2J, cnorm=\E[?25h, cr=^M,
 	csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H,
 	cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C,
 	cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A,
-	dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M,
-	dsl=\E]0;\007, ed=\E[J, el=\E[K, el1=\E[1K, enacs=\E)0,
-	flash=\E[?5h\E[?5l, fsl=^G, home=\E[H, ht=^I, hts=\EH,
-	ich=\E[%p1%d@, if=/usr/share/tabset/vt100,
-	il=\E[%p1%dL, il1=\E[L, ind=\n$<150*>,
+	dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, ed=\E[J,
+	el=\E[K, el1=\E[1K, enacs=\E)0, flash=\E[?5h\E[?5l,
+	home=\E[H, ht=^I, hts=\EH, ich=\E[%p1%d@,
+	if=/usr/share/tabset/vt100, il=\E[%p1%dL, il1=\E[L,
+	ind=\n$<150*>,
 	is2=\E7\E[r\E[m\E[?7h\E[?1;4;6l\E[4l\E8\E>, kbs=^H,
 	kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A,
 	kdch1=\E[4~, kend=\E[5~, kf1=\E[17~, kf10=\E[28~,
@@ -4945,8 +5242,8 @@
 	rs2=\E7\E[r\E8\E[m\E[?7h\E[?1;4;6l\E[4l\E>, sc=\E7,
 	sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p4%t;5%;%?%p1%p3%|%t;7%;m%?%p9%t\E(0%e\E(B%;,
 	sgr0=\E[m\E(B, smacs=\E(0, smam=\E[?7h, smcup=\E7,
-	smir=\E[4h, smso=\E[7m, smul=\E[4m, tbc=\E[3g, tsl=\E]0;,
-	u8=\E[?62;1;6c, use=ansi+enq,
+	smir=\E[4h, smso=\E[7m, smul=\E[4m, tbc=\E[3g,
+	u8=\E[?62;1;6c, use=xterm+sl, use=ansi+enq,
 ncsa|NCSA Telnet 2.7 for Macintosh in vt220-8 mode,
 	use=ncsa-m, use=klone+color,
 ncsa-ns|NCSA Telnet 2.7 for Macintosh in vt220-8 mode,
@@ -5064,10 +5361,10 @@
 	kf10=\E[233z, kf11=\E[234z, kf12=\E[235z, kf2=\E[225z,
 	kf3=\E[226z, kf4=\E[227z, kf5=\E[228z, kf6=\E[229z,
 	kf7=\E[230z, kf8=\E[231z, kf9=\E[232z, khome=\E[214z,
-	knp=\E[222z, kopt=\E[194z, kpp=\E[216z, kres=\E[193z,
-	kund=\E[195z, rev=\E[7m, rmso=\E[m, rmul@, rs2=\E[s,
-	sgr=\E[0%?%p1%p3%|%t;7%;m, sgr0=\E[m, smso=\E[7m,
-	u8=\E[1t, u9=\E[11t,
+	kich1=\E[247z, knp=\E[222z, kopt=\E[194z, kpp=\E[216z,
+	kres=\E[193z, kund=\E[195z, rev=\E[7m, rmso=\E[m, rmul@,
+	rs2=\E[s, sgr=\E[0%?%p1%p3%|%t;7%;m, sgr0=\E[m,
+	smso=\E[7m, u8=\E[1t, u9=\E[11t,
 # On some versions of CGSIX framebuffer firmware (SparcStation 5), <il1>/<il>
 # flake out on the last line.  Unfortunately, without them the terminal has no
 # way to scroll.
@@ -5077,6 +5374,10 @@
 sun|sun1|sun2|Sun Microsystems Inc. workstation console,
 	use=sun-il,
 
+sun+sl|Sun Workstation window status line,
+	hs,
+	dsl=\E]l\E\\, fsl=\E\\, tsl=\E]l,
+
 # From: <john@ucbrenoir>  Tue Sep 24 13:14:44 1985
 sun-s|Sun Microsystems Workstation window with status line,
 	hs,
@@ -5130,12 +5431,13 @@
 # It supports bold, but not underline -TD (2009-09-19)
 sun-color|Sun Microsystems Workstation console with color support (IA systems),
 	colors#8, ncv#3, pairs#64,
-	cub=\E[%p1%dD, cud=\E[%p1%dB, cuf=\E[%p1%dC,
-	cuu=\E[%p1%dA, home=\E[H, op=\E[0m, setab=\E[4%p1%dm,
-	setaf=\E[3%p1%dm,
+	bold=\E[1m, cub=\E[%p1%dD, cud=\E[%p1%dB, cuf=\E[%p1%dC,
+	cuu=\E[%p1%dA, home=\E[H, op=\E[0m, rs2=\E[s,
+	setab=\E[4%p1%dm, setaf=\E[3%p1%dm,
 	setb=\E[4%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m,
 	setf=\E[3%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m,
-	use=sun,
+	sgr=\E[0%?%p6%t;1%;%?%p1%p3%|%t;7%;m, sgr0=\E[m,
+	smso=\E[7m, use=sun,
 
 #### Iris consoles
 #
@@ -5230,7 +5532,7 @@
 	cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, dl=\E[%p1%dM, dl1=\E[M,
 	ed=\E[J, el=\E[K, home=\E[H, ht=^I,
 	if=/usr/share/tabset/vt100, il=\E[%p1%dL, il1=\E[L,
-	is2=\E[?7h\E[?1l\E[?3l\E7\E8, kbs=^H, kcub1=\EOD,
+	is2=\E[?7h\E[?1h\E[?3l\E7\E8, kbs=^H, kcub1=\EOD,
 	kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, kf0=\EOY, kf1=\EOP,
 	kf2=\EOQ, kf3=\EOR, kf4=\EOS, kf5=\EOT, kf6=\EOU, kf7=\EOV,
 	kf8=\EOW, kf9=\EOX, rc=\E8, rev=\E[7m, ri=\EM,
@@ -5278,7 +5580,7 @@
 	cr=^M, csr=\E[%i%p1%d;%p2%dr, cub1=^H, cud1=^J, cuf1=\E[C,
 	cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, ed=\E[J, el=\E[K,
 	home=\E[H, ht=^I, if=/usr/share/tabset/vt100, kbs=^H,
-	kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, kf1=\EOP,
+	kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kf1=\EOP,
 	kf2=\EOQ, kf3=\EOR, kf4=\EOS, rc=\E8, rev=\E[7m, ri=\EM,
 	rmkx=\E[?1l\E>, rmso=\E[m, rmul=\E[m,
 	rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, sc=\E7,
@@ -5405,7 +5707,7 @@
 #### Non-Unix Consoles
 #
 
-### EMX termcap.dat compatibility modes
+#### EMX termcap.dat compatibility modes
 #
 # Also (possibly only EMX, so we don't put it in ansi.sys, etc): set the
 # no_color_video to inform the application that standout(1), underline(2)
@@ -5544,7 +5846,7 @@
 	rmacs=\E[10m, rmcup=\E[2J\E[?47l\E8, rmir=\E[4l,
 	rmpch=\E[10m, rmso=\E[27m, rmul=\E[24m, rs1=\Ec\E]R,
 	sc=\E7, setab=\E[4%p1%dm, setaf=\E[3%p1%dm,
-	sgr=\E[0;10%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;%?%p7%t;8%;%?%p9%t;11%;m,
+	sgr=\E[0;10%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p6%t;1%;%?%p7%t;8%;%?%p9%t;11%;m,
 	sgr0=\E[0;10m, smacs=\E[11m, smcup=\E7\E[?47h,
 	smir=\E[4h, smpch=\E[11m, smso=\E[7m, smul=\E[4m, tsl=\E];,
 	vpa=\E[%i%p1%dd, use=vt102+enq,
@@ -5579,7 +5881,7 @@
 	rc=\E8, rev=\E[7m, ri=\EM, rmacs=\E[10m, rmir=\E[4l,
 	rmso=\E[m, rmul=\E[m, rs1=\Ec\E]R, sc=\E7,
 	setab=\E[4%p1%dm, setaf=\E[3%p1%dm,
-	sgr=\E[0;10%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;%?%p7%t;8%;%?%p9%t;12%;m,
+	sgr=\E[0;10%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p5%t;2%;%?%p6%t;1%;%?%p7%t;8%;%?%p9%t;12%;m,
 	sgr0=\E[0;10m, smacs=\E[11m, smir=\E[4h, smso=\E[7m,
 	smul=\E[4m, tbc=\E[3g, vpa=\E[%i%p1%dd, use=vt102+enq,
 
@@ -5825,7 +6127,7 @@
 	ht=^I, hts=\EH$<2/>, ind=\ED$<5/>, is2=\E[1;24r\E[24;1H,
 	kbs=^H, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA,
 	kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, nel=\r\ED$<5/>,
-	rc=\E8, rev=\E[7m$<2/>, rf=/usr/share/lib/tabset/vt100,
+	rc=\E8, rev=\E[7m$<2/>, rf=/usr/share/tabset/vt100,
 	ri=\EM$<5/>, rmso=\E[m$<2/>, rmul=\E[m$<2/>,
 	rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, sc=\E7,
 	sgr0=\E[m$<2/>, smso=\E[7m$<2/>, smul=\E[4m$<2/>,
@@ -5968,7 +6270,7 @@
 #	:cC=^Al\r:cD=^Am\r:cE=^An\r:cF=^Ao\r:
 #	:XU=^Aq\r:XD=^Ar\r:XR=^As\r:XL=^At\r:\
 #	:HL=^AP\r:SP=\E[i:\
-#	:IS=\E[@:DE=\E[P:IL=\E[L:NS=\E[S:PS=\E[T:\
+#	:IS=\E[@:DE=\E[P:IL=\E[L:NS=\E[S:PS=\E[T:
 altos3|altos5|alt3|alt5|altos-3|altos-5|altos III or V,
 	blink=\E[5p, ri=\EM, sgr0=\E[p, use=altos2,
 altos4|alt4|altos-4|altos IV,
@@ -6183,7 +6485,7 @@
 	da, db,
 	lm#0, pb#19200,
 	ed=\ED\EJ$<500>\EC, indn=\E&r%p1%dD, ip=$<4>,
-	is2=\E&j@\r, rin=\E&r%p1%dU, use=hp+pfk+cr,
+	is2=\E&j@\r, rin=\E&r%p1%dU, use=hp+pfk-cr,
 	use=hp+labels, use=scrhp,
 
 # This entry is for sysline. It allocates a 23 line window with
@@ -6384,7 +6686,7 @@
 hp2622|hp2622a|hp 2622,
 	da, db,
 	lm#0, pb#19200,
-	is2=\E&dj@\r, use=hp+pfk+cr, use=hp+labels, use=scrhp,
+	is2=\E&dj@\r, use=hp+pfk-cr, use=hp+labels, use=scrhp,
 
 # The 2623 is a 2622 with extra graphics hardware.
 hp2623|hp2623a|hp 2623,
@@ -7088,6 +7390,9 @@
 # What seems to be going on here is that this entry was designed so that
 # the normal highlight is bold and standout is dim plus something else
 # (reverse-video maybe?  But then, are there two <rev> sequences?)
+#
+# Added kdch1, kil1, kdl1 based on screenshot -TD:
+#	http://www.vintagecomputer.net/qume/qvt-108/qume_qvt-108_keyboard.jpg
 qvt101+|qvt101p|qume qvt 101 PLUS product,
 	am, bw, hs, ul,
 	cols#80, lines#24, xmc#0,
@@ -7096,11 +7401,11 @@
 	dch1=\EW, dl1=\ER, dsl=\Eg\Ef\r, ed=\EY, el=\ET,
 	flash=\Eb$<200>\Ed, fsl=^M, home=^^, ht=^I, hts=\E1,
 	ich1=\EQ, il1=\EE, ind=^J, invis@, kbs=^H, kcbt=\EI, kcub1=^H,
-	kcud1=^J, kcuf1=^L, kcuu1=^K, kdl1=\ER, ked=\EY, kel=\ET,
-	kf1=^A@\r, kf10=^AI\r, kf2=^AA\r, kf3=^AB\r, kf4=^AC\r,
-	kf5=^AD\r, kf6=^AE\r, kf7=^AF\r, kf8=^AG\r, kf9=^AH\r,
-	khome=^^, kich1=\EQ, kil1=\EE, mc4=\EA, mc5=\E@, rmso=\E(,
-	smso=\E0P\E), tbc=\E3, tsl=\Eg\Ef, use=adm+sgr,
+	kcud1=^J, kcuf1=^L, kcuu1=^K, kdch1=\EW, kdl1=\ER, ked=\EY,
+	kel=\ET, kf1=^A@\r, kf10=^AI\r, kf2=^AA\r, kf3=^AB\r,
+	kf4=^AC\r, kf5=^AD\r, kf6=^AE\r, kf7=^AF\r, kf8=^AG\r,
+	kf9=^AH\r, khome=^^, kich1=\EQ, kil1=\EE, mc4=\EA, mc5=\E@,
+	rmso=\E(, smso=\E0P\E), tbc=\E3, tsl=\Eg\Ef, use=adm+sgr,
 qvt102|qume qvt 102,
 	cnorm=\E., use=qvt101,
 # (qvt103: added <rmam>/<smam> based on init string -- esr)
@@ -8212,8 +8517,8 @@
 	rmxon=^N, rs1=\EC\EDF\E[0;0v\E[8;1v\E[=65l,
 	rs2=\E.b\E[10;20v\E[14;1v\E[3;0v\E[7;0v\E[=11.h\E[=12.h\E[=13.h\E[=14.h\E[=15l\E[=20h\E[=60l\E[=61h\E[=9l\E[=10l\E[=21l\E[=23l\E[=3l\E_40\E_50\En\Ew\Ee \Ex0\0\0\Ex1\0\0\Ex2\0\0\Ex3\0\0\Ex4\0\0\E1,
 	rs3=\E[=19h\E.3\E9\E0O\0\0\0\0\0\E0o\0\0\0\0\0\E0J\177\0\0\0\0,
-	sgr=\EG0%?%p1%t\EGt%;%?%p2%t\EG8%;%?%p3%t\EG4%;%?%p4%t\EG2%;%?%p5%t\EGp%;%?%p6%t\EG\,%;%?%p7%t\EG1%;%?%p9%t\E$%e\E%%%;,
-	sgr0=\EG0, smacs=\E$, smam=\E=7h, smcup=\E.2, smdc=\Er,
+	sgr=\EG0%?%p1%t\EGt%;%?%p2%t\EG8%;%?%p3%t\EG4%;%?%p4%t\EG2%;%?%p5%t\EGp%;%?%p6%t\EG\,%;%?%p7%t\EG1%;%?%p8%t\E&%;%?%p9%t\E$%e\E%%%;,
+	sgr0=\EG0\E%, smacs=\E$, smam=\E=7h, smcup=\E.2, smdc=\Er,
 	smir=\Eq, smln=\E[4;2v, smso=\EGt, smul=\EG8, smxon=^O,
 	tbc=\E3, tsl=\E[4;1v\E_30, uc=\EG8\EG0,
 
@@ -9726,7 +10031,7 @@
 	flash=\E[?5h\E[?5l\E[?5h\E[?5l\E[?5h\E[?5l,
 	fsl=\E[0$}, home=\E[H, hpa=\E[%i%p1%dG, ht=^I, hts=\EH,
 	ich=\E[%p1%d@, il=\E[%p1%dL, il1=\E[L, ind=^J,
-	is2=\E>\E F\E[?1l\E[?7h\E[r\E[2$~, kbs=^H, kcub1=\EOD,
+	is2=\E>\E F\E[?1h\E[?7h\E[r\E[2$~, kbs=^H, kcub1=\EOD,
 	kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, kdl1=\E[3~, kf0=\E[21~,
 	kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, kf6=\E[17~,
 	kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, kich1=\E[2~, knp=\E[6~,
@@ -9980,7 +10285,7 @@
 	pln=\E[%p1%d;00q%p2%:-16s, rc=\E8, rev=\E[7m, ri=\EM,
 	rmacs=^O, rmso=\E[m, rmul=\E[m, rs2=\Ec\E[?3l\E[2;0y,
 	sc=\E7,
-	sgr=\E[0%?%p1%p5%|%t;2%;%?%p2%p6%|%t;4%;%?%p4%t;5%;%?%p3%p1%|%p6%|%t;7%;%?%p7%t;8%;m%?%p9%t\016%e\017%;,
+	sgr=\E[0%?%p1%p5%|%p6%|%t;2%;%?%p2%t;4%;%?%p4%t;5%;%?%p3%p1%|%p6%|%t;7%;%?%p7%t;8%;m%?%p9%t\016%e\017%;,
 	sgr0=\E[m\017, smacs=^N, smso=\E[7m, smul=\E[4m,
 	tsl=\E7\E[25;%p1%{1}%+%dH,
 
@@ -10078,7 +10383,7 @@
 	pln=\E[%p1%d;0;0;0q%p2%:-16.16s, prot=\EV,
 	rin=\E[%p1%dF, rmam=\E[?7l, rmir=\E[4l,
 	rmkx=\E[19;0j\E[21;1j\212, rmln=\E|,
-	sgr=\E[0%?%p1%p5%|%t;2%;%?%p2%p6%|%t;4%;%?%p4%t;5%;%?%p3%p1%|%p6%|%t;7%;%?%p7%t;8%;m%?%p9%t\016%e\017%;,
+	sgr=\E[0%?%p1%p5%|%p6%|%t;2%;%?%p2%t;4%;%?%p4%t;5%;%?%p3%p1%|%p6%|%t;7%;%?%p7%t;8%;m%?%p8%t\EV%;%?%p9%t\016%e\017%;,
 	sgr0=\E[m\017, smam=\E[?7h, smir=\E[4h,
 	smkx=\E[19;1j\E[21;4j\Eent, smln=\E~, tbc=\E[3g,
 	tsl=\E7\E[25;%p1%{8}%+%dH, vpa=\E[%p1%{1}%+%dd,
@@ -10284,7 +10589,7 @@
 	rev=\E[7m, ri=\EM, rin=\E[%p1%dF, rmacs=^O, rmam=\E[?7l,
 	rmir=\E[4l, rmkx=\E[21;0j\E[25;1j\212, rmln=\E|,
 	rmso=\E[m, rmul=\E[m, rs2=\Ec\E[?3l\E[2;0y, sc=\E7,
-	sgr=\E[0%?%p1%p5%|%t;2%;%?%p2%p6%|%t;4%;%?%p4%t;5%;%?%p3%p1%|%p6%|%t;7%;%?%p7%t;8%;m%?%p9%t\016%e\017%;,
+	sgr=\E[0%?%p5%p6%|%t;2%;%?%p2%t;4%;%?%p4%t;5%;%?%p3%p1%|%p6%|%t;7%;%?%p7%t;8%;m%?%p8%t\EV%;%?%p9%t\016%e\017%;,
 	sgr0=\E[m\017, smacs=^N, smam=\E[?7h, smir=\E[4h,
 	smkx=\E[21;1j\E[25;4j\Eent\E~, smln=\E~, smso=\E[7m,
 	smul=\E[4m, tbc=\E[3g, tsl=\E7\E[25;%p1%{8}%+%dH,
@@ -10681,7 +10986,7 @@
 	ri=\EM, rin=\E[%p1%dT, rmacs=\E(B\017, rmam=\E[?7l,
 	rmir=\E[4l, rmln=\E[2p, rmso=\E[m, rmul=\E[m,
 	rs2=\Ec\E[?3l, sc=\E7,
-	sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p4%t;5%;%?%p3%p1%|%t;7%;%?%p7%t;8%;m%?%p9%t\016%e\017%;,
+	sgr=\E[0%?%p6%t;1%;%?%p5%t;2%;%?%p2%t;4%;%?%p4%t;5%;%?%p3%p1%|%t;7%;%?%p7%t;8%;m%?%p9%t\E)0\016%e\E(B\017%;,
 	sgr0=\E[m\E(B\017, smacs=\E)0\016, smam=\E[?7h,
 	smir=\E[4h, smln=\E[p, smso=\E[7m, smul=\E[4m,
 	tsl=\E7\E[25;%i%p1%dx,
@@ -10741,7 +11046,7 @@
 	mc5=\E[?5i, nel=^M^J, pfx=\E[%p1%d;%p2%l%dq%p2%s, rc=\E8,
 	rev=\E[7m, ri=\EM, rin=\E[%p1%dT, rmir=\E[4l, rmso=\E[m,
 	rmul=\E[m, rs2=\Ec, sc=\E7,
-	sgr=\E[0%?%p2%t;4%;%?%p1%p3%|%p4%|%p5%|%t;7%;m,
+	sgr=\E[0%?%p5%t;2%;%?%p2%t;4%;%?%p4%t;5%;%?%p1%p3%|%p4%|%t;7%;m,
 	sgr0=\E[m, smir=\E[4h, smso=\E[7m, smul=\E[4m,
 att630-24|5630-24|5630DMD-24|630MTG-24|AT&T 630 windowing terminal 24 lines,
 	lines#24, use=att630,
@@ -11391,7 +11696,7 @@
 	rep=%p1%c\E[%p2%{1}%-%db, rev=\E[7m,
 	rmkx=\EP`>y~[[J`8xy~[[A`4xy~[[D`6xy~[[C`2xy~[[B\E\\,
 	rmm=\E[>52l, rmso=\E[m, rmul=\E[m, sc=\E7,
-	sgr=\E[%?%p1%t7;%;%?%p2%t4;%;%?%p3%t7;%;%?%p4%t5;%;%?%p6%t1;%;m,
+	sgr=\E[%?%p1%t7;%;%?%p2%t4;%;%?%p3%t7;%;%?%p4%t5;%;%?%p6%t1;%;%?%p7%t8;%;m,
 	sgr0=\E[m,
 	smkx=\EP`>z~[[J`8xz~[[A`4xz~[[D`6xz~[[C`2xz~[[B\E\\,
 	smm=\E[>52h, smso=\E[7m, smul=\E[4m, tbc=\E[3g,
@@ -11401,13 +11706,13 @@
 	blink=\E[5;7m, bold=\E[1;7m, invis=\E[7;8m,
 	is1=\E[7m\E7\E[H\E9\E8, rev=\E[m, rmso=\E[7m, rmul=\E[7m,
 	rs1=\E[H\E[7m\E[J$<156>,
-	sgr=\E[%?%p1%p3%|%!%t7;%;%?%p2%t4;%;%?%p4%t5;%;%?%p6%t1;%;%?%p7%t8;%;m,
+	sgr=\E[%?%p2%t4;%;%?%p4%t5;%;%?%p6%t1;%;%?%p1%p2%|%p3%!%t7;%;%?%p7%t8;%;m\016,
 	sgr0=\E[7m\016, smso=\E[m, smul=\E[4;7m,
 # Ambassador with the DEC option, for partial vt100 compatibility.
 aaa+dec|ann arbor ambassador in dec vt100 mode,
 	acsc=aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}},
 	csr=\E[%i%p1%d;%p2%dr, enacs=\E(0, rmacs=^N,
-	sgr=\E[%?%p1%p3%|%!%t7;%;%?%p2%t4;%;%?%p4%t5;%;%?%p6%t1;%;%?%p7%t8;%;m%?%p9%t\017%e\016%;,
+	sgr=\E[%?%p2%t4;%;%?%p4%t5;%;%?%p6%t1;%;%?%p1%p3%|%!%t7;%;%?%p7%t8;%;m%?%p9%t\017%e\016%;,
 	smacs=^O,
 aaa-18|ann arbor ambassador/18 lines,
 	lines#18,
@@ -11574,7 +11879,7 @@
 	blink=\E[5;7m, bold=\E[1;7m, home=\E[H, invis=\E[7;8m,
 	is1=\E[7m\E7\E[H\E9\E8, rev=\E[m, rmso=\E[7m, rmul=\E[7m,
 	rs1=\E[H\E[7m\E[J,
-	sgr=\E[%?%p1%!%t7;%;%?%p2%t4;%;%?%p3%t7;%;%?%p4%t5;%;%?%p6%t1;%;%?%p7%t8;%;m,
+	sgr=\E[%?%p6%t1;%;%?%p2%t4;%;%?%p3%t7;%;%?%p4%t5;%;%?%p1%!%t7;%;%?%p7%t8;%;m,
 	sgr0=\E[7m, smso=\E[m, smul=\E[4;7m,
 
 #### Applied Digital Data Systems (adds)
@@ -12416,7 +12721,7 @@
 #	 and mc5= should use the \E[?4i and \E[?5i strings instead).
 
 hds200|Human Designed Systems HDS200,
-	am, bw, eslok, hs, km, mc5i, mir, msgr, xenl, xon,
+	am, bw, eslok, hs, km, mir, msgr, xenl, xon,
 	cols#80, it#8, lines#24, lm#0,
 	acsc=``aaffggjjkkllmmnnooqqssttuuvvwwxx~~, bel=^G,
 	blink=\E[0;5m, bold=\E[0;1m, cbt=\E[Z, civis=\E[6+{,
@@ -12445,13 +12750,12 @@
 	kf51=^\051\r, kf52=^\052\r, kf53=^\053\r, kf6=^\006\r,
 	kf7=^\007\r, kf8=^\008\r, kf9=^\009\r, khome=\E[H,
 	kind=\E[T, knp=\E[U, kpp=\E[V, kri=\E[S, ll=\E[H\E[A,
-	mc0=\E[i, mc4=\E[4i, mc5=\E[5i, nel=\E[E, rc=\E8,
-	rev=\E[0;7m, ri=\EM, rmacs=^O, rmir=\E[4l, rmso=\E[m\017,
-	rmul=\E[m\017, sc=\E7,
+	nel=\E[E, rc=\E8, rev=\E[0;7m, ri=\EM, rmacs=^O, rmir=\E[4l,
+	rmso=\E[m\017, rmul=\E[m\017, sc=\E7,
 	sgr=\E[0%?%p1%p6%O%t;1%;%?%p2%t;4%;%?%p4%t;5%;%?%p1%p3%O%t;7%;%?%p7%t;8%;m%?%p9%t\016%e\017%;,
 	sgr0=\E[m\017, smacs=^N, smir=\E[4h, smso=\E[0;1;7m,
 	smul=\E[0;4m, tbc=\E[3g, tsl=\E[2!w\E[%i%p1%dG,
-	vpa=\E[%i%p1%dd,
+	vpa=\E[%i%p1%dd, use=ansi+pp,
 
 # <ht> through <el> included to specify padding needed in raw mode.
 # (avt-ns: added empty <acsc> to suppress a tic warning --esr)
@@ -12478,10 +12782,11 @@
 	ri=\EM$<4>, rmacs=\016$<1>, rmcup=\E[w\E2\r\n,
 	rmir=\E[4l, rmkx=\E[!z\E[0;2u, rmso=\E[7!{, rmul=\E[4!{,
 	sc=\E7,
-	sgr=\E[%?%p1%t7;%;%?%p2%t4;%;%?%p3%t7;%;%?%p4%t5;%;%?%p6%t1;%;m,
-	sgr0=\E[m, smacs=\017$<1>, smcup=\E[=4l\E[1;24w\E2\r,
-	smir=\E[4h, smkx=\E[1!z\E[0;3u, smso=\E[7m, smul=\E[4m,
-	tbc=\E[3g, vpa=\E[%p1%{1}%+%dd,
+	sgr=\E[%?%p1%t7;%;%?%p2%t4;%;%?%p3%t7;%;%?%p4%t5;%;%?%p6%t1;%;%?%p7%t8;%;%?%p8%t99;%;m%?%p5%t\E[1!{%;%?%p9%t\017%e\016%;$<1>,
+	sgr0=\E[m\016$<1>, smacs=\017$<1>,
+	smcup=\E[=4l\E[1;24w\E2\r, smir=\E[4h,
+	smkx=\E[1!z\E[0;3u, smso=\E[7m, smul=\E[4m, tbc=\E[3g,
+	vpa=\E[%p1%{1}%+%dd,
 avt-rv-ns|concept avt in reverse video mode/no status line,
 	flash=\E[=205l$<200>\E[=205h, is1=\E[=103l\E[=205h,
 	use=avt-ns,
@@ -12763,7 +13068,6 @@
 # backspace on all terminals.  This is not so in DG mode.
 # (dg460-ansi: removed obsolete ":kn#6:"; also removed ":mu=\EW:", on the
 # grounds that there is no matching ":ml:"
-# fixed garbled ":k9=\E[00\:z:" capability -- esr)
 dg460-ansi|Data General Dasher 460 in ANSI-mode,
 	OTbs, am, msgr, ul,
 	cols#80, it#8, lines#24,
@@ -12774,10 +13078,12 @@
 	kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A,
 	kf0=\E[001z, kf1=\E[002z, kf2=\E[003z, kf3=\E[004z,
 	kf4=\E[005z, kf5=\E[006z, kf6=\E[007z, kf7=\E[008z,
-	kf8=\E[009z, kf9=\E[010z, khome=\E[H, lf0=f1, lf1=f2, lf2=f3,
-	lf3=f4, lf4=f5, lf5=f6, lf6=f7, lf7=f8, lf9=f10, rev=\E[7m,
-	ri=\E[T, rmso=\E[m, rmul=\E[05, sgr0=\E[m, smso=\E[7m,
-	smul=\E[4m,
+	kf8=\E[009z, kf9=\E[00\:z, khome=\E[H, lf0=f1, lf1=f2,
+	lf2=f3, lf3=f4, lf4=f5, lf5=f6, lf6=f7, lf7=f8, lf9=f10,
+	mc0=\E[i, rev=\E[7m, ri=\E[T, rmso=\E[m, rmul=\E[05,
+	sgr=%?%p9%t\E(0%e\E(B%;\E[0%?%p5%t;2%;%?%p2%t;4%;%?%p4%t;5%;%?%p1%p3%|%t;7%;m,
+	sgr0=\E(B\E[m, smso=\E[7m, smul=\E[4m, u6=\E[%d;%dR,
+	u7=\E[6n, u8=\E[5n, u9=\E[0n,
 # From: Wayne Throop <mcnc!rti-sel!rtp47!throopw> (not official)
 # Data General 605x
 # Ought to work for a Model 6242, Type D210 as well as a 605x.
@@ -12824,7 +13130,7 @@
 	cuu=\E[%p1%dA, cuu1=\E[A, dim=\E[2m, ed=\E[J, el=\E[K,
 	el1=\E[1K, home=\E[H, ind=^J, is1=\E[<0;<1;<4l,
 	ll=\E[H\E[A, nel=^J, rev=\E[7m, rmso=\E[m, rmul=\E[m,
-	sgr=\E[%?%p1%p3%|%p6%|%t7;%;%?%p4%t5;%;%?%p2%p6%|%t4;%;%?%p1%p5%|%t2;%;m,
+	sgr=\E[%?%p4%t5;%;%?%p2%p6%|%t4;%;%?%p1%p5%|%t2;%;%?%p1%p3%|%p6%|%t7;%;m,
 	sgr0=\E[m, smso=\E[2;7m, smul=\E[4m, use=dgkeys+7b,
 
 # DASHER D210 series terminals in DG mode.
@@ -13026,7 +13332,7 @@
 	is2=\E[3;2;2;1;1;1v\E(B\E)4\017, mc4=\E[4i, mc5=\E[5i,
 	ri=\EM, rmacs=\E)4\017, rs1=\Ec\E[<2h,
 	rs2=\E[4;0;2;1;1;1v\E(B\E)4,
-	sgr=\E[%?%p1%p3%|%p6%|%t7;%;%?%p4%t5;%;%?%p2%p6%|%t4;%;%?%p1%p5%|%t2;%;m\E)%?%p9%t6\016%e4\017%;,
+	sgr=\E[%?%p1%t2;7%;%?%p3%t7;%;%?%p4%t5;%;%?%p2%t4;%;%?%p1%p5%|%t2;%;%?%p6%t4;7;%;m\E)%?%p9%t6\016%e4\017%;,
 	sgr0=\E[m\E)4\017, smacs=\E)6\016, use=d211,
 
 # Initialization string 2 sets:
@@ -13196,12 +13502,12 @@
 #
 d470c|d470|Data General DASHER D470C,
 	is1=\E[<0;<1;<2;<4l\E[1;1;80w\E[1;6;<2h,
-	sgr=\E[%?%p1%p3%|%p6%|%t7;%{1}%e%{0}%;%PR%?%p4%t5;%{1}%e%{0}%;%PB%?%p2%p6%|%t4;%{1}%e%{0}%;%PU%?%p1%p5%|%t2;%{1}%e%{0}%;%PDm\E)%?%p9%t6\016%e4\017%;,
+	sgr=\E[%?%p3%t7;%;%?%p4%t5;%;%?%p2%t4;%;%?%p6%t4;7;%;%?%p1%t2;7;%;%?%p5%t2;%;m\E)%?%p9%t6\016%e4\017%;,
 	use=dg+color, use=d460,
 
 d470c-7b|d470-7b|Data General DASHER D470C in 7 bit mode,
 	is1=\E[<0;<1;<2;<4l\E[1;1;80w\E[1;6;<2h,
-	sgr=\E[%?%p1%p3%|%p6%|%t7;%{1}%e%{0}%;%PR%?%p4%t5;%{1}%e%{0}%;%PB%?%p2%p6%|%t4;%{1}%e%{0}%;%PU%?%p1%p5%|%t2;%{1}%e%{0}%;%PDm%?%p9%t\016%e\017%;,
+	sgr=\E[%?%p3%t7;%;%?%p4%t5;%;%?%p2%t4;%;%?%p6%t4;7;%;%?%p1%t2;7;%;%?%p5%t2;%;m%?%p9%t\016%e\017%;,
 	use=dg+color, use=d460-7b,
 
 # Initialization string 2 sets:
@@ -13757,7 +14063,7 @@
 sb2|sb3|fixed superbee,
 	xsb@, use=superbee,
 
-####  Beehive Medical Electronics
+#### Beehive Medical Electronics
 #
 # Steve Seymour <srseymour@mindspring.com> writes (Wed, 03 Feb 1999):
 # Regarding your question though; Beehive terminals weren't made by Harris.
@@ -14224,6 +14530,8 @@
 	sgr=\E[%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;%?%p7%t;8%;m%?%p9%t\E(0%e\E(B%;,
 	sgr0=\E[0m, smacs=\E(0, smir=\E[4h, smso=\E[7m, smul=\E[4m,
 	tbc=\E[3g,
+# "Megapel" refers to the display adapter, which was used with the IBM RT
+# aka IBM 6150.
 ibm5081|hft|IBM Megapel Color display,
 	acsc=jjkkllmmnnqqttuuvvwwxx, blink@, bold@, s0ds=\E(B,
 	s1ds=\E(0, sgr0=\E[0m\E(B, use=ibm5154,
@@ -14578,7 +14886,7 @@
 	is1=\EC\E.3\EDF\EV1\Eg\E[0ZZ, nel=^_, rev=\E[4ZZ,
 	rmir=\Er, rmso=\E[%gh%{4}%^%Ph%gh%dZZ,
 	rmul=\E[%gh%{8}%^%Ph%gh%dZZ, rs2=\Eo1,
-	sgr=\E[%{0}%?%p1%t%{4}%|%;%?%p2%t%{8}%|%;%?%p3%t%{4}%|%;%?%p4%t%{2}%|%;%?%p7%t%{1}%|%;ZZ,
+	sgr=\E[%'0'%?%p1%t%'8'%|%;%?%p2%t%'8'%|%;%?%p3%t%'4'%|%;%?%p4%t%'2'%|%;%?%p7%t%'1'%|%;%cZZ,
 	sgr0=\E[0ZZ, smir=\Eq, smso=\E[8ZZ, smul=\E[8ZZ, tbc=\E3,
 icl6404-w|kds7372-w|ICL 6404 aka Kokusai Display Systems 7372 132 cols,
 	rs2=\Eo1, use=icl6404,
@@ -14895,7 +15203,7 @@
 # (esr: commented out <smacs>/<rmacs> because there's no <acsc>)
 #
 prism9|p9|P9|MDC Prism-9 in ANSII mode,
-	am, bw, hs, mc5i, msgr, xenl, xon,
+	am, bw, hs, msgr, xenl, xon,
 	cols#80, it#8, lines#24, vt#3, wsl#72,
 	bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[<4l,
 	clear=^L, cnorm=\E[<4h, cr=^M, csr=\E[%i%p1%d;%p2%d%%v,
@@ -14911,14 +15219,15 @@
 	kf14=\E[26~, kf15=\E[28~, kf16=\E[29~, kf17=\E[31~,
 	kf18=\E[32~, kf2=\E[12~, kf3=\E[13~, kf4=\E[14~,
 	kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~,
-	khome=\E[H, mc0=\E[i, mc4=\E[4i, mc5=\E[5i, nel=^M^J,
-	prot=\E[32%{, rc=\E[%z, rep=\E[%p2%db%p1%c, rev=\E[7m,
-	ri=\E[L, rmir=\E[4l, rmso=\E[27m, rmul=\E[24m,
+	khome=\E[H, nel=^M^J, prot=\E[32%{, rc=\E[%z,
+	rep=\E[%p2%db%p1%c, rev=\E[7m, ri=\E[L, rmir=\E[4l,
+	rmso=\E[27m, rmul=\E[24m,
 	rs2=\E[&p\E[<12l\E F\E[3g\E[9;17;25;33;41;49;57;65;73 N,
 	sc=\E[%y,
-	sgr=\E[%{0}%?%p1%p3%|%t%{7}%+%;%?%p2%t%{2}%+%;%?%p4%t%{5}%+%;%?%p6%t%{1}%+%;m%?%p8%t\E[%{32}%+%d%%{%;%?%p9%t\016%e\017%;,
+	sgr=\E[0%?%p1%p3%|%t;7%;%?%p2%t;4%;%?%p4%t;5%;%?%p6%t;1%;m%?%p8%t\E[32%%{%;%?%p9%t\016%e\017%;,
 	sgr0=\E[0m\017, smir=\E[4h, smso=\E[7m, smul=\E[4m,
 	tbc=\E[3g, tsl=\E[%i%p1%d%%}, vpa=\E[%i%p1%dd,
+	use=ansi+pp,
 
 # p9-w: Prism-9 in 132 column mode
 # --------------------------------
@@ -15282,7 +15591,7 @@
 	rmkx=\E[?1l\E>, rmso=\E[0m, rmul=\E[0m,
 	rs2=\E[!p\E[?7;19;67h\E[?1;3;4l\E(B\E)0\017\E[2J\E[1;1H\E>$<200>,
 	sc=\E7,
-	sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t\016%e\017%;$<20>,
+	sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%?%p7%t;8%;m%?%p9%t\016%e\017%;$<20>,
 	sgr0=\E[0m\017$<20>, smacs=^N, smir=\E[4h,
 	smkx=\E[?1h\E=, smso=\E[1;7m, smul=\E[4m, tbc=\E[3g,
 	tsl=\E[2$~\E[1$}, vpa=\E[%p1%dd$<40>, use=vt220+keypad,
@@ -15339,7 +15648,7 @@
 	rmkx=\E[?1l\E>, rmso=\E[27m, rmul=\E[24m,
 	rs2=\E[!p\E[?7;19;67h\E[?1;3;4l\E(B\E)0\017\E[2J\E[1;1H\E>$<200>,
 	sc=\E7,
-	sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t\016%e\017%;$<20>,
+	sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%?%p7%t;8%;m%?%p9%t\016%e\017%;$<20>,
 	sgr0=\E[0m\017$<20>, smacs=\016$<20>, smam=\E[?7h,
 	smir=\E[4h, smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m,
 	tbc=\E[3g, tsl=\E[2$~\E[1$}, vpa=\E[%p1%dd$<40>,
@@ -15395,7 +15704,7 @@
 	rmul=\E[24m,
 	rs2=\E[!p\E[?7;19;67h\E[?1;3;4l\E[1;0%w\E(B\E)0\017\E[2J\E[1;1H\E>$<200>,
 	sc=\E7,
-	sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t\016%e\017%;$<20>,
+	sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%?%p7%t;8%;m%?%p9%t\016%e\017%;$<20>,
 	sgr0=\E[0m\017$<20>, smacs=\016$<20>, smam=\E[?7h,
 	smir=\E[4h, smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m,
 	tbc=\E[3g, tsl=\E[2$~\E[1$}, vpa=\E[%p1%dd$<40>,
@@ -15785,7 +16094,7 @@
 # Manufactured in the early/mid eighties, behaves almost the same as a
 # Televideo 950.  Take a 950, change its cabinet for a more 80s-ish one (but
 # keep the same keyboard layout), add an optional 25-line mode, replace the DIP
-# switches with a menu and remove the "lock line" feature (ESC !  1 and ESC ! 
+# switches with a menu and remove the "lock line" feature (ESC !  1 and ESC !
 # 2), here is the NDR 9500.  Even the line-lock, albeit disabled, is
 # recognized:  if you type in "ESC !", the next (third) character is not
 # echoed, showing that the terminal was actually waiting for a parameter!
@@ -15809,7 +16118,7 @@
 	pfloc=\E|%{48}%p1%+%c2%p2\031,
 	pfx=\E|%{48}%p1%+%c1%p2\031, prot=\E), ri=\Ej,
 	rmacs=\E%%, rmir=\Er, rmso=\E(, rmxon=^N,
-	sgr=\E%%\E(%?%p1%p5%p8%|%|%t\E)%;%?%p9%t\E$%;,
+	sgr=\EG0\E%%%%\E(%?%p1%p5%p8%|%|%t\E)%;%?%p9%t\E$%;,
 	sgr0=\EG0\E%%\E(, smacs=\E$, smir=\Eq, smso=\E), smxon=^O,
 	tbc=\E3, tsl=\Eg\Ef\011%p1%{32}%+%c, .kbs=^H,
 
@@ -16279,7 +16588,7 @@
 	kbs=^H, kcub1=\ED, kcud1=\EB, kcuf1=\EC, kcuu1=\EA,
 	rev=\E%!1\E[7m$<2>\E%!0, ri=\EI,
 	rmso=\E%!1\E[m$<2>\E%!0, rmul=\E%!1\E[m$<2>\E%!0,
-	sgr=\E%%!1\E[%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;m$<2>\E%%!0,
+	sgr=\E%%!1\E[%?%p1%t;7;5%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p5%t<0%;%?%p6%t;1%;m$<2>\E%%!0,
 	sgr0=\E%!1\E[m$<2>\E%!0, smso=\E%!1\E[7;5m$<2>\E%!0,
 	smul=\E%!1\E[4m$<2>\E%!0,
 # Tektronix 4207 with sysline.  In the ancestral termcap file this was 4107-s;
@@ -16466,9 +16775,10 @@
 	clear=\E[2J\E[H, cr=^M, cub=\E[%p1%dD, cub1=\E[D,
 	cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, cuf1=\E[C,
 	cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A,
-	dch1=\E[1P, dim=\E[=1;<6m, dl1=\E[1M, ech=\E%p1%dX,
-	ed=\E[J, el=\E[K, el1=\E[1K, enacs=\E)0, home=\E[H, ht=^I,
-	ich=\E[%p1%d@, il=\E[%p1%dL, il1=\E[1L, ind=\ED,
+	dch1=\E[1P, dim=\E[=1;<6m, dl=\E[%p1%dM, dl1=\E[1M,
+	ech=\E%p1%dX, ed=\E[J, el=\E[K, el1=\E[1K, enacs=\E)0,
+	home=\E[H, ht=^I, ich=\E[%p1%d@, il=\E[%p1%dL, il1=\E[1L,
+	ind=\ED,
 	initc=\E%%!0\ETF4%?%p1%{0}%=%t0%e%p1%{1}%=%t4%e%p1%{2}%=%t3%e%p1%{3}%=%t5%e%p1%{4}%=%t2%e%p1%{5}%=%t6%e%p1%{6}%=%t7%e1%;%?%p2%{125}%<%t0%e%p2%{250}%<%tA2%e%p2%{375}%<%tA?%e%p2%{500}%<%tC8%e%p2%{625}%<%tD4%e%p2%{750}%<%tE1%e%p2%{875}%<%tE\:%eF4%;%?%p3%{125}%<%t0%e%p3%{250}%<%tA2%e%p3%{375}%<%tA?%e%p3%{500}%<%tC8%e%p3%{625}%<%tD4%e%p3%{750}%<%tE1%e%p3%{875}%<%tE\:%eF4%;%?%p4%{125}%<%t0%e%p4%{250}%<%tA2%e%p4%{375}%<%tA?%e%p4%{500}%<%tC8%e%p4%{625}%<%tD4%e%p4%{750}%<%tE1%e%p4%{875}%<%tE\:%eF4%;\E%%!1,
 	invis=\E[=6;<5, is1=\E%!0\ETM1\E%!1\E[m, kbs=^H,
 	kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kf0=\EOA,
@@ -16639,7 +16949,7 @@
 	kf9=\250, khome=\E[H, kich1=\E[^H, knp=\E[U, kpp=\E[V,
 	ll=\E[24;1H, nel=^M, rev=\E[7m, ri=\E[T\E[A,
 	rin=\E[%p1%dT\E[%p1%dA, rmso=\E[m, rmul=\E[m,
-	sgr=\E[%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;m,
+	sgr=\E[%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;%?%p7%t30;40%;m,
 	sgr0=\E[m, smso=\E[7m, smul=\E[4m,
 
 #### Apple II
@@ -16885,6 +17195,8 @@
 #
 #     echo "$TERM_PROGRAM" "$TERM_PROGRAM_VERSION"
 #
+# For Apple_Terminal v309+, use "nsterm-256color" (or "nsterm-bce")
+#
 # For Apple_Terminal v200+, use "nsterm-16color" (a.k.a. "nsterm")
 #
 # For Apple_Terminal v71+/v100+, use "nsterm-bce".
@@ -17101,6 +17413,7 @@
 	sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%?%p7%t;8%;m%?%p9%t\016%e\017%;,
 	sgr0=\E[m\017, smacs=^N, use=nsterm+7,
 
+# compare with xterm+sl-twm
 nsterm+s|AppKit Terminal.app v41+ status-line (window titlebar) support,
 	hs,
 	wsl#50,
@@ -17186,6 +17499,10 @@
 # and it is still not settable from the preferences dialog. This is
 # tracked under rdar://problem/7365108 and rdar://problem/7365134
 # in Apple's bug reporter.
+#
+# In OS X 10.7 (Leopard) the TERM which can be set in the preferences dialog
+# defaults to xterm-color.  Alternative selections are ansi, dtterm, rxvt,
+# vt52, vt100, vt102 and xterm.
 nsterm-16color|AppKit Terminal.app v240.2+ with Mac OS X version 10.5,
 	bw@, mir, npc,
 	civis=\E[?25l, cnorm=\E[?25h, dch=\E[%p1%dP, dch1=\E[P,
@@ -17197,10 +17514,10 @@
 	kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, khome=\E[H,
 	knp=\E[6~, kpp=\E[5~, rmcup=\E[2J\E[?47l\E8, rmir=\E[4l,
 	smcup=\E7\E[?47h, smir=\E[4h, vpa=\E[%i%p1%dd,
-	use=nsterm-c-s-acs,
+	kLFT5=\E[5D, kRIT5=\E[5C, use=nsterm-c-s-acs,
 
 # The versions of Terminal.app in Mac OS X version 10.3.x seem to have
-# the background color erase bug. The newer version 240.2 in Mac OS X
+# the background color erase feature. The newer version 240.2 in Mac OS X
 # version 10.5 does not.
 #
 # This entry is based on newsgroup comments by Alain Bench, Christian Ebert,
@@ -17212,12 +17529,40 @@
 #	defaults write com.apple.Terminal TermCapString nsterm-bce
 #
 # and that it is not set in Terminal's preferences dialog.
+#
+# Modified for OS X 10.8, omitting bw based on testing with tack -TD
+#
+# Notes:
+# * The terminal description matches the default settings.
+# * The keyboard is configurable via a dialog.
+# * By default khome, kend, knext and kprev are honored only with a
+#   shift-modifier.
+# * There are bindings for control left/right arrow (but not up/down).
+#   Added those to nsterm-16color, which is the version used for OS X 10.6
+# * "Allow VT100 application keypage mode" is by default disabled.
+#   There is no way to press keypad-comma unless application mode is enabled
+#   and used.
+# * 132-column mode stopped working during vttest's tests.  Consider it broken.
+# * CHT, REP, SU, SD are buggy.
+# * ECH works (also in Leopard), but is not used here for compatibility.
+# * The terminal preferences dialog replaces xterm-color by xterm-16color and
+#   xterm-256color.  However, it adds "nsterm", so it is possible to use the
+#   nsterm entry from this file to override the MacPorts (20110404) or
+#   system (20081102) copy of this file.
 nsterm-bce|AppKit Terminal.app v71+/v100.1.8+ with Mac OS X version 10.3/10.4 (bce),
-	bce, bw, use=nsterm-16color,
+	bce, use=nsterm-16color,
+
+# This is tested with OS X 10.8 (Mountain Lion), 2012/08/11
+#	TERM_PROGRAM_VERSION=309
+# Earlier reports state that these differences also apply to OS X 10.7 (Lion),
+#	TERM_PROGRAM_VERSION=303
+nsterm-256color|Terminal.app in OS X 10.8,
+	ccc@,
+	initc@, use=xterm+256color, use=nsterm-bce,
 
 # This is an alias which should always point to the "current" version
 nsterm|Apple_Terminal|AppKit Terminal.app,
-	use=nsterm-16color,
+	use=nsterm-256color,
 
 # iTerm.app from http://iterm.sourceforge.net/ is an alternative (and
 # more featureful) terminal emulator for Mac OS X. It is similar
@@ -17752,6 +18097,23 @@
 # See
 #	http://www.minix3.org/manpages/man4/console.4.html
 minix|minix console (v3),
+	acsc=+\020\,\021-\030.^Y0\333`\004a\261f\370g\361h\260j\331k\277l\332m\300n\305o~p\304q\304r\304s_t\303u\264v\301w\302x\263y\363z\362{\343|\330}\234~\376,
+	kdch1=\177, kend=\E[Y, kf0=\E[21~, kf1=\E[11~, kf10=\E[21~,
+	kf11=\E[11;2~, kf12=\E[12;2~, kf13=\E[13;2~,
+	kf14=\E[14;2~, kf15=\E[15;2~, kf16=\E[17;2~,
+	kf17=\E[18;2~, kf18=\E[19;2~, kf19=\E[20;2~, kf2=\E[12~,
+	kf20=\E[21;2~, kf21=\E[11;5~, kf22=\E[12;5~,
+	kf23=\E[13;5~, kf24=\E[14;5~, kf25=\E[15;5~,
+	kf26=\E[17;5~, kf27=\E[18;5~, kf28=\E[19;5~,
+	kf29=\E[20;5~, kf3=\E[13~, kf30=\E[21;5~, kf31=\E[11;6~,
+	kf32=\E[12;6~, kf33=\E[13;6~, kf34=\E[14;6~,
+	kf35=\E[15;6~, kf36=\E[17;6~, kf37=\E[18;6~,
+	kf38=\E[19;6~, kf39=\E[20;6~, kf4=\E[14~, kf40=\E[21;6~,
+	kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~,
+	kich1=\E[@, knp=\E[U, kpp=\E[V, lf0@, lf1@, lf2@, lf3@, lf4@, lf5@,
+	use=minix-3.0,
+
+minix-3.0|minix console (v3.0),
 	use=ecma+color, use=minix-1.7,
 
 # See
@@ -17792,7 +18154,7 @@
 	am, use=minix-old,
 
 pc-minix|minix console on an Intel box,
-	use=klone+acs, use=minix,
+	use=klone+acs, use=minix-3.0,
 
 # According to the Coherent 2.3 manual, the PC console is similar
 # to a z19. The differences seem to be (1) 25 lines, (2) no status
@@ -18195,6 +18557,7 @@
 	use=tws-generic,
 dku7202|BULL Questar 200 DKU7202 (colour/character attributes),
 	blink=\E[0;2;4m, dim=\E[0;5m, ht=^I, is3=\E[?3h\Eb,
+	sgr=\E[0%?%p1%t;2;4;5;7%;%?%p3%t;7%;%?%p2%t;2%;%?%p4%t;2;4%;%?%p5%t;5%;%?%p7%t;8%;m%?%p9%t\016%e\017%;,
 	smso=\E[0;4;5;7m, smul=\E[0;2m, use=tws-generic,
 
 #=========================================================#
@@ -18274,7 +18637,7 @@
 
 # This entry covers BQ303, BQ306, BQ310, Q303, Q306, Q310
 bq300|Bull vt320 ISO Latin 1 80 columns terminal,
-	am, eo, eslok, hs, km, mc5i, mir, msgr, xenl, xon,
+	am, eo, eslok, hs, km, mir, msgr, xenl, xon,
 	cols#80, it#8, lines#24, vt#3, wsl#80,
 	acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~,
 	bel=^G, blink=\E[5m, bold=\E[1m, civis=\E[?25l,
@@ -18298,14 +18661,14 @@
 	kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, kfnd=\E[1~,
 	khlp=\E[28~, kich1=\E[2~, knp=\E[6~, kpp=\E[5~,
 	krdo=\E[29~, kslt=\E[4~, lf1=pf1, lf2=pf2, lf3=pf3, lf4=pf4,
-	mc0=\E[i, mc4=\E[4i, mc5=\E[5i, nel=\EE, rc=\E8, rev=\E[7m,
-	ri=\EM, rmacs=\E(B, rmam=\E[?7l, rmcup=\E[?7h, rmir=\E[4l,
-	rmkx=\E[?1l\E>, rmso=\E[27m, rmul=\E[24m, rs1=\E[!p,
-	rs2=\E[?3l, s0ds=\E(B, s1ds=\E(0, sc=\E7,
+	nel=\EE, rc=\E8, rev=\E[7m, ri=\EM, rmacs=\E(B, rmam=\E[?7l,
+	rmcup=\E[?7h, rmir=\E[4l, rmkx=\E[?1l\E>, rmso=\E[27m,
+	rmul=\E[24m, rs1=\E[!p, rs2=\E[?3l, s0ds=\E(B, s1ds=\E(0,
+	sc=\E7,
 	sgr=\E[%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;m%?%p9%t\E(0%e\E(B%;,
 	sgr0=\E[0m\E(B, smacs=\E(0, smam=\E[?7h,
 	smcup=\E[?7l\E[?1l\E(B, smir=\E[4h, smso=\E[7m,
-	smul=\E[4m, tbc=\E[3g, tsl=\E[1$}\E[2$~,
+	smul=\E[4m, tbc=\E[3g, tsl=\E[1$}\E[2$~, use=ansi+pp,
 bq300-rv|Bull vt320 reverse 80 columns,
 	flash=\E[?5l$<50>\E[?5h,
 	is2=\E[?2h\E[?3l\E[?5h\E[?7h\E[?8h\E>\E[?1l\E F\E[?42l\E[?4l,
@@ -18383,12 +18746,12 @@
 	csr=\233%i%p1%d;%p2%dr, cub=\233%p1%dD, cub1=\2331D,
 	cud=\233%p1%dB, cud1=\2331B, cuf=\233%p1%dC, cuf1=\2331C,
 	cup=\233%i%p1%d;%p2%dH, cuu=\233%p1%dA, cuu1=\2331A,
-	dch=\233%p1%dP, dch1=\233P, dl=\233%p1%dM,
+	dch=\233%p1%dP, dch1=\233P, dl=\233%p1%dM, dl1=\233M,
 	dsl=\2331$}\2332$~\n\2330$}, ech=\233%p1%dX, ed=\233J,
 	el=\233K, el1=\2331K, enacs=\E(B\E)0,
 	flash=\233?5h$<50>\233?5l, fsl=\2330$}, home=\233H,
-	ht=^I, hts=\EH, ich=\233%p1%d@, il=\233%p1%dL, ind=\ED,
-	is1=\E[63;2"p\E[2h,
+	ht=^I, hts=\EH, ich=\233%p1%d@, il=\233%p1%dL, il1=\233L,
+	ind=\ED, is1=\E[63;2"p\E[2h,
 	is2=\E[?2h\E[?3l\E[?5l\E[?7h\E[?8h\E>\E[?1l\E G\E[?42l\E[?4l,
 	is3=\2330$}\233?25h\2332l\233H\233J, ka1=\217w,
 	ka3=\217y, kb2=\217u, kbs=^H, kc1=\217q, kc3=\217s,
@@ -18401,11 +18764,12 @@
 	khlp=\23328~, kich1=\2332~, knp=\2336~, kpp=\2335~,
 	krdo=\23329~, kslt=\2334~, lf1=pf1, lf2=pf2, lf3=pf3,
 	lf4=pf4, mc0=\233i, mc4=\2334i, mc5=\2335i, nel=\EE, rc=\E8,
-	rev=\2337m, ri=\EM, rmacs=^O, rmam=\233?7l, rmcup=\233?7h,
-	rmir=\2334l, rmkx=\233?1l\E>, rmso=\23327m, rmul=\23324m,
-	rs1=\E[!p, rs2=\E[?3l, s0ds=\E(B, s1ds=\E(0, sc=\E7,
+	rev=\2337m, ri=\EM, rmacs=\E(B, rmam=\233?7l,
+	rmcup=\233?7h, rmir=\2334l, rmkx=\233?1l\E>,
+	rmso=\23327m, rmul=\23324m, rs1=\E[!p, rs2=\E[?3l,
+	s0ds=\E(B, s1ds=\E(0, sc=\E7,
 	sgr=\233%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;m%?%p9%t\E(0%e\E(B%;,
-	sgr0=\2330m\E(B, smacs=^N, smam=\233?7h,
+	sgr0=\2330m\E(B, smacs=\E(0, smam=\233?7h,
 	smcup=\233?7l\233?1l\E(B, smir=\2334h, smso=\2337m,
 	smul=\2334m, tbc=\2333g, tsl=\2331$}\2332$~,
 bq300-8rv|Bull vt320 8-bit reverse mode 80 columns,
@@ -19010,14 +19374,14 @@
 	cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C,
 	cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A,
 	dch=\E[%p1%dP, dch1=\E[1P, dim=\E[2m, dl=\E[%p1%dM,
-	dsl=\E[>1l, ed=\E[J, el=\E[K, fsl=\E[u\E[>5l, home=\E[H,
-	ht=^I, hts=\EH, if=/usr/share/tabset/vt100, il=\E[%p1%dL,
-	ind=\ED, kbs=^H, kclr=\E[J, kcub1=\EOD, kcud1=\EOB,
-	kcuf1=\EOC, kcuu1=\EOA, ked=\E[J, kf0=\E[~, kf1=\EOS,
-	kf2=\EOT, kf3=\EOU, kf4=\EOV, kf5=\EOW, kf6=\EOP, kf7=\EOQ,
-	kf8=\EOR, kf9=\EOX, khome=\E[H, lf0=help, mc0=\E#7,
-	nel=^M\ED, rc=\E[r, rev=\E[7m, ri=\EM, rmcup=\E[?7h,
-	rmso=\E[m, rmul=\E[m,
+	dl1=\E[M, dsl=\E[>1l, ed=\E[J, el=\E[K, fsl=\E[u\E[>5l,
+	home=\E[H, ht=^I, hts=\EH, if=/usr/share/tabset/vt100,
+	il=\E[%p1%dL, il1=\E[L, ind=\ED, kbs=^H, kclr=\E[J,
+	kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, ked=\E[J,
+	kf0=\E[~, kf1=\EOS, kf2=\EOT, kf3=\EOU, kf4=\EOV, kf5=\EOW,
+	kf6=\EOP, kf7=\EOQ, kf8=\EOR, kf9=\EOX, khome=\E[H, lf0=help,
+	mc0=\E#7, nel=^M\ED, rc=\E[r, rev=\E[7m, ri=\EM,
+	rmcup=\E[?7h, rmso=\E[m, rmul=\E[m,
 	rs1=\E<\E[1;24r\E[24;1H\E[?7h\E[>4h\E[>1;2;3;5;6;7;8;9l\E[m\E[11m,
 	sc=\E[s, sgr0=\E[m, smcup=\E[?7l, smso=\E[7;2m, smul=\E[4m,
 	tbc=\E[3g, tsl=\E[s\E[>5;1h\E[25;%i%dH\E[1K,
@@ -20217,9 +20581,9 @@
 	sgr0=\EX, smacs=\EF, smso=\ET,
 env230|envision230|envision 230 graphics terminal,
 	xenl@,
-	mc0=\E[0i, mc4=\E[4i, mc5=\E[5i,
-	sgr=\E[%?%p1%t;1%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;m$<2>,
-	use=vt100,
+	enacs@, mc0=\E[0i, mc4=\E[4i, mc5=\E[5i, rmacs@,
+	sgr=\E[0%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;m$<2>,
+	sgr0=\E[0m$<2>, smacs@, use=vt100,
 # These execuports were impact-printer ttys with a 30- or maybe 15-cps acoustic
 # coupler attached, the whole rig fitting in a suitcase and more or less
 # portable.  Hot stuff for c.1977 :-) -- esr
@@ -20274,7 +20638,7 @@
 	rmacs=\EH^C, rmam=\Ed., rmcup=, rmir=\Er, rmln=\EA11,
 	rmxon=\Ec20, rs1=\E~!\E~4$<150>, rs2=\EeF$<150>,
 	rs3=\EwG\Ee($<150>,
-	sgr=%?%p8%t\E)%e\E(%;%?%p9%t\EH\002%e\EH\003%;\EG%{48}%?%p2%p6%|%t%{8}%|%;%?%p1%p3%|%p6%|%t%{4}%|%;%?%p4%t%{2}%|%;%?%p1%p5%|%t%{64}%|%;%?%p7%t%{1}%|%;%c,
+	sgr=%?%p8%t\E)%e\E(%;%?%p9%t\EH\002%e\EH\003%;\EG%{48}%?%p2%t%{8}%|%;%?%p1%p3%|%t%{4}%|%;%?%p4%t%{2}%|%;%?%p1%p5%|%t%{64}%|%;%?%p7%t%{1}%|%;%c,
 	sgr0=\E(\EH\003\EG0\EcD, smacs=\EH^B, smam=\Ed/,
 	smcup=\Ezz&\E[A\177\Ezz'\E[B\177\Ezz(\E[D\177\Ezz)\E[C\177\Ezz<\E[Q\177,
 	smir=\Eq, smln=\EA10, smxon=\Ec21, tbc=\E0, tsl=\Ez(,
@@ -20881,7 +21245,7 @@
 # assigned in System V terminfo.  There are some variant extension sets out
 # there.  We try to describe them here.
 #
-# XENIX extensions:
+#### XENIX extensions:
 #
 # The XENIX extensions include a set of function-key capabilities as follows:
 #
@@ -20946,7 +21310,7 @@
 # When translating a termcap file, ncurses tic will do this automatically.
 # The double forms characters don't fit the SVr4 terminfo model.
 #
-# AT&T Extensions:
+#### AT&T Extensions:
 #
 # The old AT&T 5410, 5420, 5425, pc6300plus, 610, and s4 entries used a set of
 # nonstandard capabilities.  Its signature is the KM capability, used to name
@@ -20957,7 +21321,7 @@
 # FL=:LO: (enable soft labels), FE=:LF: (disable soft labels), CI=:vi: (make
 # cursor invisible), and CV=:ve: (make cursor normal).
 #
-# HP Extensions
+#### HP Extensions
 #
 # The HP library (as of mid-1995, their term.h file version 70.1) appears to
 # have the System V capabilities up to SVr1 level.  After that, it supports
@@ -20966,7 +21330,7 @@
 # label_off, and key_f11..key_f63 capabilities like SVr4's.  This makes the
 # HP binary format incompatible with SVr4's.
 #
-# IBM Extensions
+#### IBM Extensions
 #
 # There is a set of nonstandard terminfos used by IBM's AIX operating system.
 # The AIX terminfo library diverged from SVr1 terminfo, and replaces all
@@ -20994,7 +21358,7 @@
 # The box2 characters are the double-line versions of these forms graphics.
 # The AIX binary terminfo format is incompatible with SVr4's.
 #
-# Iris console extensions:
+#### Iris console extensions:
 #
 # HS is half-intensity start; HE is half-intensity end
 # CT is color terminal type (for Curses & rogue)
@@ -21003,7 +21367,7 @@
 #
 # The ncurses tic utility recognizes HS as an alias for mh <dim>.
 #
-# TC Extensions:
+#### TC Extensions:
 #
 # There is a set of extended termcaps associated with something
 # called the "Terminal Control" or TC package created by MainStream Systems,
@@ -21011,11 +21375,110 @@
 # CF for civis and CO for cvvis.  Finally, they define a boolean :ct:
 # that flags color terminals.
 #
+######## NCURSES USER-DEFINABLE CAPABILITIES
+#
+# Extensions added after ncurses 5.0 generally use the "-x" option of tic and
+# infocmp to manipulate user-definable capabilities.  Those that are intended
+# for use in either terminfo or termcap use 2-character names.  Extended
+# function keys do not use 2-character names, and are available only with
+# terminfo.
+#
+# As of mid-2012, no other terminfo/termcap implementation than ncurses
+# supports this extension; termcap libraries can as noted above make limited
+# use of the feature.
+#
+# ncurses makes explicit checks for a few user-definable capabilities:  AX, U8,
+# XM.
+#
+#### SCREEN Extensions:
+#
+# The screen program uses the termcap interface.  It recognizes a few useful
+# nonstandard capabilities.  Those are used in this file.
+#
+#       AX   (bool)  Does  understand  ANSI  set  default fg/bg color (\E[39m /
+#                    \E[49m).
+#       G0   (bool)  Terminal can deal with ISO 2022  font  selection sequences.
+#       E0   (str)   Switch charset 'G0' back to standard charset.
+#       S0   (str)   Switch charset 'G0' to the specified charset.
+#       XT   (bool)  Terminal understands special xterm sequences  (OSC,  mouse
+#                    tracking).
+#
+# AX is relatively straightforward; it is interpreted by ncurses to say that
+# SGR 39/49 reset the terminal's foreground and background colors to their
+# "default".
+#
+# XT is harder, since screen's manpage does not give more details.  For that,
+# we must read screen's source-code.  When XT is set, screen assumes
+#
+# a) OSC 1 sets the title string, e.g., for the icon.  Recent versions of
+#    screen may also set the terminal's name, which is (for xterm) distinct
+#    from the icon name.
+# b) OSC 20 sets the background pixmap.  This is an rxvt feature.
+# c) OSC 39 and OSC 49 set the default foreground/background colors.  Again
+#    this is an rxvt feature.
+# d) certain mode settings enable the mouse: 9, 1000, 1001, 1002, 1003.
+#    These are from xterm, although xterm accepts mouse codes that may not be
+#    recognized by screen, e.g., 1005, 1006.
+# e) colors beyond 0..7 are implemented by xterm's aixterm-like 16-color
+#    sequence.  However, because screen uses only termcap, the values returned
+#    by Af/Ab are not usable because they rely on expressions that termcap
+#    does not support.  Therefore, screen uses a hardcoded string to work
+#    around the limitation.
+# f) all entries named "*xterm*" or "*rxvt*" have the bce flag set.
+#
+# The other ISO-2022 features are rarely used, but provided here to make
+# screen's termcap features available.
+#
+#### XTERM Extensions:
+#
+# Most of the xterm extensions are for function-keys.  Since patch #94 (in
+# 1999), xterm has supported shift/control/alt/meta modifiers which produce
+# additional function-key strings.  Some other developers copied the feature,
+# though they did not follow xterm's lead in patch #167 (in 2002), to make
+# these key definitions less ambiguous.
+#
+# A few terminals provide similar functionality (sending distinct keys when
+# a modifier is used), including rxvt.
+#
+# These are the extended keys defined in this file:
+#
+# kDC3 kDC4 kDC5 kDC6 kDC7 kDN kDN3 kDN4 kDN5 kDN6 kDN7 kEND3 kEND4 kEND5 kEND6
+# kEND7 kHOM3 kHOM4 kHOM5 kHOM6 kHOM7 kIC3 kIC4 kIC5 kIC6 kIC7 kLFT3 kLFT4
+# kLFT5 kLFT6 kLFT7 kNXT3 kNXT4 kNXT5 kNXT6 kNXT7 kPRV3 kPRV4 kPRV5 kPRV6 kPRV7
+# kRIT3 kRIT4 kRIT5 kRIT6 kRIT7 kUP kUP3 kUP4 kUP5 kUP6 kUP7 ka2 kb1 kb3 kc2
+#
+# Here are the other xterm-related extensions which are used in this file:
+#
+# Cr is a string capability which resets the cursor color
+# Cs is a string capability which sets the cursor color to a given value.
+#    The single string parameter is the color name/number, according to the
+#    implementation.
+# Ms modifies the selection/clipboard.  Its parameters are
+#	p1 = the storage unit (clipboard, selection or cut buffer)
+#	p2 = the base64-encoded clipboard content.
+# Se resets the cursor style to the terminal power-on default.
+# Ss is a string capability with one numeric parameter.  It is used to set the
+#    cursor style as described by the DECSCUSR function to a block or
+#    underline.
+# XM is a string capability which overrides ncurses's built-in string which
+#    enables xterm mouse mode.
+#
+#### Miscellaneous extensions:
+#
+# gsbom/grbom are used to enable/disable real bold (not intensity bright) mode.
+#    This was implemented for the Hurd.
+# E3 clears the terminal's scrollback buffer.  This was implemented in the
+#    Linux 3.0 kernel as a security feature.  It matches a feature which was
+#    added in xterm patch #107.
+# U8 is a numeric capability which denotes a terminal emulator which does not
+#    support VT100 SI/SO when processing UTF-8 encoding.  Set this to a nonzero
+#    value to enable it.
+#
 ######## CHANGE HISTORY
 #
 # The last /etc/termcap version maintained by John Kunze was 8.3, dated 8/5/94.
-# Releases 9 and up are maintained by Eric S. Raymond as part of the ncurses
-# project.
+# Releases 9 and 10 (up until the release of ncurses 4.2 in 1998) were
+# maintained by Eric S. Raymond as part of the ncurses project.
 #
 # This file contains all the capability information present in John Kunze's
 # last version of the termcap master file, except as noted in the change
@@ -21115,7 +21578,7 @@
 #	* Replaced HP entries up to hpsub with purpose-built ones.
 #	* Blank rmir/smir/rmdc/smdc capabilities removed.
 #	* Small fixes merged in from SCO entries for lpr, fos, tvi910+, tvi924.
-# 9.4.8 (Fri Apr  7 09:36:34 EDT 199):
+# 9.4.8 (Fri Apr  7 09:36:34 EDT 1995):
 #	* Replaced the Ann Arbor entries with SCO's, the init strings are
 #	  more efficient (but the entries otherwise identical).
 #	* Added dg211 from Shuford archive.
@@ -22224,7 +22687,7 @@
 #	* add screen.rxvt -TD
 #
 # 2008-04-28
-#	* add screen+fkeys (prompted by Debian # 478094) -TD
+#	* add screen+fkeys (prompted by Debian #478094) -TD
 #
 # 2008-06-28
 #	* add screen.mlterm -TD
@@ -22280,7 +22743,7 @@
 # 2009-12-12
 #	* updated nsterm* entries (Benjamin Sittler, Emanuele Giaquinta)
 #
-# 2009-12-12
+# 2009-12-19
 #	* add bw (auto-left-margin) to nsterm* entries (Benjamin Sittler)
 #	* rename minix to minix-1.7, add minix entry for Minux3 -TD
 #
@@ -22354,6 +22817,162 @@
 #	* add xterm-utf8 as a demo of the U8 feature -TD
 #
 # 2011-02-20
-#	* add cons25-debian entry (Brian M Carlson, Debina #607662).
+#	* add cons25-debian entry (Brian M Carlson, Debian #607662).
+#
+# 2011-06-11
+#	* update minix entry to minix 3.2 (Thomas Cort).
+#
+# 2011-07-09
+#	* fix inconsistent tabset path in pcmw (Todd C. Miller).
+#	* remove a backslash which continued comment, obscuring altos3
+#	  definition with OpenBSD toolset (Nicholas Marriott).
+#
+# 2011-07-16
+#	* add/use xterm+tmux chunk from xterm #271 -TD
+#	* resync xterm-new entry from xterm #271 -TD
+#	* add E3 extended capability to linux-basic (Miroslav Lichvar)
+#	* add linux2.2, linux2.6, linux3.0 entries to give context for E3 -TD
+#	* add SI/SO change to linux2.6 entry (Debian #515609) -TD
+#
+# 2011-07-21
+#	* add kich1 to sun (Yuri Pankov)
+#	* use bold rather than reverse for smso in sun-color (Yuri Pankov).
+#
+# 2011-08-06
+#	* corrected k9 in dg460-ansi, add other features based on manuals -TD
+#
+# 2011-08-20
+#	* minor cleanup of X-terminal emulator section -TD
+#	* add terminator entry -TD
+#	* add simpleterm entry -TD
+#
+# 2011-09-10
+#	* add xterm+kbs fragment from xterm #272 -TD
+#
+# 2011-11-12
+#	* add pccon entries for OpenBSD console (Alexei Malinin)
+#
+# 2011-12-17
+#	* corrected old changelog comments -TD
+#
+# 2011-11-24
+#	* add putty-sco -TD
+#
+# 2012-01-28
+#	* add mach-gnu (Samuel Thibault)
+#	* add mach-gnu-color, tweaks to mach-gnu -TD
+#	* make sgr for sun-color agree with smso -TD
+#	* make sgr for prism9 agree with other caps -TD
+#	* make sgr for icl6404 agree with other caps -TD
+#	* make sgr for ofcons agree with other caps -TD
+#	* make sgr for att5410v1, att4415, att620 agree with other caps -TD
+#	* make sgr for aaa-unk, aaa-rv agree with other caps -TD
+#	* make sgr for avt-ns agree with other caps -TD
+#
+# 2012-02-11
+#	* make sgr for xterm-pcolor agree with other caps -TD
+#	* make sgr for att5425 agree with other caps -TD
+#	* make sgr for att630 agree with other caps -TD
+#	* make sgr for linux entries agree with other caps -TD
+#	* make sgr for tvi9065 agree with other caps -TD
+#	* make sgr for ncr260vt200an agree with other caps -TD
+#	* make sgr for ncr160vt100pp agree with other caps -TD
+#	* make sgr for ncr260vt300an agree with other caps -TD
+#	* make sgr for aaa-60-dec-rv, aaa+dec agree with other caps -TD
+#	* make sgr for cygwin, cygwinDBG agree with other caps -TD
+#
+# 2012-03-31
+#	* correct order of use-clauses in st-256color -TD
+#
+# 2012-04-01
+#	* revert 2011-07-16 change to "linux" alias, return to "linux2.2" -TD
+#
+# 2012-04-14
+#	* document all of the user-defined capabilities in one place -TD
+#	* add XT to some places to improve usefulness for other applications
+#	  than screen, which would like to pretend that xterm's title is
+#	  a status-line. -TD
+#	* change use-clauses in ansi-mtabs, hp2626, and hp2622 based on review
+#	  of ordering and overrides -TD
+#
+# 2012-04-21
+#	* add msgr to vt420, similar DEC vtXXX entries -TD
+#	* add several missing vt420 capabilities from vt220 -TD
+#	* factor out ansi+pp from several entries -TD
+#	* change xterm+sl and xterm+sl-twm to include only the status-line
+#	  capabilities and not "use=xterm", making them more generally useful
+#	  as building-blocks -TD
+#	* add dec+sl building block, as example -TD
+#
+# 2012-04-28
+#	* fix some inconsistencies between vt320/vt420, e.g., cnorm/civis -TD
+#	* add eslok flag to dec+sl -TD
+#	* dec+sl applies to vt320 and up -TD
+#	* drop wsl width from xterm+sl -TD
+#	* reuse xterm+sl in putty and nsca-m -TD
+#	* add ansi+tabs to vt520 -TD
+#	* add ansi+enq to vt220-vt520 -TD
+#
+# 2012-05-05
+#	* remove p6 (bold) from opus3n1+ for consistency -TD
+#	* remove acs stuff from env230 per clues in Ingres termcap -TD
+#	* modify env230 sgr/sgr0 to match other capabilities -TD
+#	* modify smacs/rmacs in bq300-8 to match sgr/sgr0 -TD
+#	* make sgr for dku7202 agree with other caps -TD
+#	* make sgr for ibmpc agree with other caps -TD
+#	* make sgr for tek4107 agree with other caps -TD
+#	* make sgr for ndr9500 agree with other caps -TD
+#	* make sgr for sco-ansi agree with other caps -TD
+#	* make sgr for d410 agree with other caps -TD
+#	* make sgr for d210 agree with other caps -TD
+#	* make sgr for d470c, d470c-7b agree with other caps -TD
+#
+# 2012-05-12
+#	* rewrite vt520 entry based on vt420 -TD
+#	* corrected 'op' for bterm (report by Samuel Thibault) -TD
+#
+# 2012-06-02
+#	* add kdch1 to wsvt25 entry from NetBSD CVS (reported by David Lord,
+#	  analysis by Martin Husemann).
+#	* add cnorm/civis to wsvt25 entry from NetBSD CVS (report/analysis by
+#	  Onno van der Linden).
+#	* add kdch1 aka "Remove" to vt220 and vt220-8 entries -TD
+#	* add kdch1, etc., to qvt108 -TD
+#	* add dl1/il1 to some entries based on dl/il values -TD
+#	* add dl to simpleterm -TD
+#
+# 2012-06-10
+#	* modify some older xterm entries to align with xterm source -TD
+#	* separate "xterm-old" alias from "xterm-r6" -TD
+#
+# 2012-07-28
+#	* add E3 to xterm-basic and putty -TD
+#
+# 2012-08-11
+#	* add nsterm-256color, make this the default nsterm -TD
+#	* remove bw from nsterm-bce, per testing with tack -TD
+#
+# 2012-10-12
+#       * add vte-2012, gnome-2012, making these the defaults for vte/gnome
+#	  (patch by Christian Persch).
+#
+# 2012-11-02
+#	* reviewed vte-2012, reverted most of the change since it was incorrect
+#	  based on testing with tack -TD
+#	* un-cancel the initc in vte-256color, since this was implemented
+#	  starting with version 0.20 in 2009 -TD
+#
+# 2013-03-16
+#	* correct typo in sgr string for sun-color,
+#	  add bold for consistency with sgr,
+#	  change smso for consistency with sgr -TD
+#	* correct typo in sgr string for terminator -TD
+#	* add blink to the attributes masked by ncv in linux-16color (report
+#	  by Benjamin Sittler)
+#
+# 2013-03-23
+#	* change initialization for vt220, similar entries for consistency
+#	  with cursor-key strings (NetBSD #47674) -TD
+#	* further improvements to linux-16color (Benjamin Sittler)
 #
 ######## SHANTIH!  SHANTIH!  SHANTIH!
Index: mk-0th.awk
Prereq:  1.18 
--- ncurses-5.9/mk-0th.awk	2010-01-09 21:45:41.000000000 +0000
+++ ncurses-5.9-20130504/mk-0th.awk	2012-06-30 20:56:11.000000000 +0000
@@ -1,6 +1,6 @@
-# $Id: mk-0th.awk,v 1.18 2010/01/09 21:45:41 tom Exp $
+# $Id: mk-0th.awk,v 1.22 2012/06/30 20:56:11 tom Exp $
 ##############################################################################
-# Copyright (c) 1998-2005,2010 Free Software Foundation, Inc.                #
+# Copyright (c) 1998-2010,2012 Free Software Foundation, Inc.                #
 #                                                                            #
 # Permission is hereby granted, free of charge, to any person obtaining a    #
 # copy of this software and associated documentation files (the "Software"), #
@@ -34,14 +34,62 @@
 # Variables:
 #	libname (library name, e.g., "ncurses", "panel", "forms", "menus")
 #	subsets (is used here to decide if wide-character code is used)
+#	ticlib (library name for libtic, e.g., "tic")
+#	termlib (library name for libtinfo, e.g., "tinfo")
 #
+function make_lintlib(name,sources) {
+	print  ""
+	print  "clean ::"
+	printf "\trm -f llib-l%s.*\n", name
+	print  ""
+	print  "realclean ::"
+	printf "\trm -f llib-l%s\n", name
+	print  ""
+	printf "llib-l%s : %s\n", name, sources
+	printf "\tcproto -a -l -DNCURSES_ENABLE_STDBOOL_H=0 -DLINT $(CPPFLAGS) %s >$@\n", sources
+	print  ""
+	print  "lintlib ::"
+	printf "\tsh $(srcdir)/../misc/makellib %s $(CPPFLAGS)\n", name
+	print ""
+	print "lint ::"
+	printf "\t$(LINT) $(LINT_OPTS) $(CPPFLAGS) %s $(LINT_LIBS)\n", sources
+}
+
+# A blank in "subsets" indicates a split-off of the library into a separate
+# file, e.g., for libtic or libtinfo.  They are all logical parts of the same
+# library.
+function which_library() {
+	if ( ( which == "ticlib" ) && ( subsets ~ /ticlib / ) ) {
+		return ticlib;
+	} else if ( ( which == "termlib" || which == "ext_tinfo" ) && ( subsets ~ /[[:space:]]base/ ) ) {
+		return termlib;
+	} else {
+		return libname;
+	}
+}
+
+function show_list(name, len, list) {
+	if ( len > 0 ) {
+		printf "\n%s_SRC =", toupper(name);
+		for (n = 0; n < len; ++n)
+			printf " \\\n\t%s", list[n];
+		print "";
+		make_lintlib(name, sprintf("$(%s_SRC)", toupper(name)));
+	}
+}
+
 BEGIN	{
 		which = libname;
 		using = 0;
 		found = 0;
+		count_ticlib = 0;
+		count_termlib = 0;
+		count_library = 0;
 	}
 	/^@/ {
 		which = $0;
+		sub(/^@[[:blank:]]+/, "", which);
+		sub(/[[:blank:]]+$/, "", which);
 	}
 	!/^[@#]/ {
 		if (using == 0)
@@ -50,6 +98,10 @@
 			print  "# generated by mk-0th.awk"
 			printf "#   libname:    %s\n", libname
 			printf "#   subsets:    %s\n", subsets
+			if ( libname ~ /ncurses/ ) {
+				printf "#   ticlib:     %s\n", ticlib
+				printf "#   termlib:    %s\n", termlib
+			}
 			print  ""
 			print  ".SUFFIXES: .c .cc .h .i .ii"
 			print  ".c.i :"
@@ -80,9 +132,18 @@
 					found = 2
 			}
 			if ( libname == "c++" || libname == "c++w" ) {
-				printf " \\\n\t%s/%s.cc", $3, $1
+				srcname = sprintf("%s/%s.cc", $3, $1);
+				printf " \\\n\t%s", srcname;
 			} else if ( widechar == 1 || $3 != "$(wide)" ) {
-				printf " \\\n\t%s/%s.c", $3, $1
+				srcname = sprintf("%s/%s.c", $3, $1);
+				printf " \\\n\t%s", srcname;
+				if ( which_library() == libname ) {
+					list_library[count_library++] = srcname;
+				} else if ( which_library() == ticlib ) {
+					list_ticlib[count_ticlib++] = srcname;
+				} else {
+					list_termlib[count_termlib++] = srcname;
+				}
 			}
 		}
 	}
@@ -91,22 +152,11 @@
 		if ( found == 1 )
 		{
 			print  ""
-			printf "# Producing llib-l%s is time-consuming, so there's no direct-dependency for\n", libname
-			print  "# it in the lintlib rule.  We'll only remove in the cleanest setup."
-			print  "clean ::"
-			printf "\trm -f llib-l%s.*\n", libname
-			print  ""
-			print  "realclean ::"
-			printf "\trm -f llib-l%s\n", libname
-			print  ""
-			printf "llib-l%s : $(C_SRC)\n", libname
-			printf "\tcproto -a -l -DNCURSES_ENABLE_STDBOOL_H=0 -DLINT $(CPPFLAGS) $(C_SRC) >$@\n"
-			print  ""
-			print  "lintlib :"
-			printf "\tsh $(srcdir)/../misc/makellib %s $(CPPFLAGS)", libname
-			print ""
-			print "lint :"
-			print "\t$(LINT) $(LINT_OPTS) $(CPPFLAGS) $(C_SRC) $(LINT_LIBS)"
+			printf "# Producing llib-l%s is time-consuming, so there's no direct-dependency for\n", libname;
+			print  "# it in the lintlib rule.  We'll only remove in the cleanest setup.";
+			show_list(libname, count_library, list_library);
+			show_list(ticlib, count_ticlib, list_ticlib);
+			show_list(termlib, count_termlib, list_termlib);
 		}
 		else
 		{
@@ -115,3 +165,4 @@
 			print  "\t@echo no action needed"
 		}
 	}
+# vile:ts=4 sw=4
Index: mk-1st.awk
Prereq:  1.85 
--- ncurses-5.9/mk-1st.awk	2010-08-07 20:42:30.000000000 +0000
+++ ncurses-5.9-20130504/mk-1st.awk	2013-03-12 11:09:40.000000000 +0000
@@ -1,6 +1,6 @@
-# $Id: mk-1st.awk,v 1.85 2010/08/07 20:42:30 Gabriele.Balducci Exp $
+# $Id: mk-1st.awk,v 1.95 2013/03/12 11:09:40 tom Exp $
 ##############################################################################
-# Copyright (c) 1998-2009,2010 Free Software Foundation, Inc.                #
+# Copyright (c) 1998-2012,2013 Free Software Foundation, Inc.                #
 #                                                                            #
 # Permission is hereby granted, free of charge, to any person obtaining a    #
 # copy of this software and associated documentation files (the "Software"), #
@@ -34,10 +34,12 @@
 #	name		  (library name, e.g., "ncurses", "panel", "forms", "menus")
 #	traces		  ("all" or "DEBUG", to control whether tracing is compiled in)
 #	MODEL		  (e.g., "DEBUG", uppercase; toupper is not portable)
+#	CXX_MODEL	  (e.g., "DEBUG", uppercase)
 #	model		  (directory into which we compile, e.g., "obj")
 #	prefix		  (e.g., "lib", for Unix-style libraries)
 #	suffix		  (e.g., "_g.a", for debug libraries)
 #	subset		  ("none", "base", "base+ext_funcs" or "termlib", etc.)
+#	driver		  ("yes" or "no", depends on --enable-term-driver)
 #	ShlibVer	  ("rel", "abi" or "auto", to augment DoLinks variable)
 #	ShlibVerInfix ("yes" or "no", determines location of version #)
 #	SymLink		  ("ln -s", etc)
@@ -69,7 +71,7 @@
 	}
 # see imp_name
 function imp_name_of(a_name) {
-		if (ShlibVerInfix == "cygdll") {
+		if (ShlibVerInfix == "cygdll" || ShlibVerInfix == "mingw") {
 			result = sprintf("%s%s%s.a", prefix, a_name, suffix);
 		} else {
 			result = "";
@@ -80,6 +82,8 @@
 function abi_name_of(a_name) {
 		if (ShlibVerInfix == "cygdll") {
 			result = sprintf("%s%s$(ABI_VERSION)%s", "cyg", a_name, suffix);
+		} else if (ShlibVerInfix == "mingw") {
+			result = sprintf("%s%s$(ABI_VERSION)%s", prefix, a_name, suffix);
 		} else if (ShlibVerInfix == "yes") {
 			result = sprintf("%s%s.$(ABI_VERSION)%s", prefix, a_name, suffix);
 		} else {
@@ -91,6 +95,8 @@
 function rel_name_of(a_name) {
 		if (ShlibVerInfix == "cygdll") {
 			result = sprintf("%s%s$(REL_VERSION)%s", "cyg", a_name, suffix);
+		} else if (ShlibVerInfix == "mingw") {
+			result = sprintf("%s%s$(REL_VERSION)%s", prefix, a_name, suffix);
 		} else if (ShlibVerInfix == "yes") {
 			result = sprintf("%s%s.$(REL_VERSION)%s", prefix, a_name, suffix);
 		} else {
@@ -107,7 +113,7 @@
 		} else {
 			if ( ShlibVer == "rel" ) {
 				result = rel_name_of(a_name);
-			} else if ( ShlibVer == "abi" || ShlibVer == "cygdll" ) {
+			} else if ( ShlibVer == "abi" || ShlibVer == "cygdll" || ShlibVer == "mingw" ) {
 				result = abi_name_of(a_name);
 			} else {
 				result = lib_name_of(a_name);
@@ -124,23 +130,38 @@
 		}
 	}
 function rmlink(directory, dst) {
-		printf "\t-rm -f %s/%s\n", directory, dst
+		if ( dst != "" ) {
+			printf "\t-rm -f %s/%s\n", directory, dst
+		}
 	}
 function removelinks(directory) {
-		rmlink(directory, end_name);
+		nlinks = 0;
+		links[nlinks++] = end_name;
 		if ( DoLinks == "reverse" ) {
 			if ( ShlibVer == "rel" ) {
-				rmlink(directory, abi_name);
-				rmlink(directory, rel_name);
+				links[nlinks++] = abi_name;
+				links[nlinks++] = rel_name;
 			} else if ( ShlibVer == "abi" ) {
-				rmlink(directory, abi_name);
+				links[nlinks++] = abi_name;
 			}
 		} else {
 			if ( ShlibVer == "rel" ) {
-				rmlink(directory, abi_name);
-				rmlink(directory, lib_name);
+				links[nlinks++] = abi_name;
+				links[nlinks++] = lib_name;
 			} else if ( ShlibVer == "abi" ) {
-				rmlink(directory, lib_name);
+				links[nlinks++] = lib_name;
+			}
+		}
+		for (j = 0; j < nlinks; ++j) {
+			found = 0;
+			for (k = 0; k < j; ++k ) {
+				if ( links[j] == links[k] ) {
+					found = 1;
+					break;
+				}
+			}
+			if ( !found ) {
+				rmlink(directory, links[j]);
 			}
 		}
 	}
@@ -148,7 +169,7 @@
 		printf "\t$(MK_SHARED_LIB) $(%s_OBJS) $(%s) $(LDFLAGS)\n", objs, shlib_list
 	}
 function sharedlinks(directory) {
-		if ( ShlibVer != "auto" && ShlibVer != "cygdll" ) {
+		if ( ShlibVer != "auto" && ShlibVer != "cygdll" && ShlibVer != "mingw" ) {
 			printf "\tcd %s && (", directory
 			if ( DoLinks == "reverse" ) {
 				if ( ShlibVer == "rel" ) {
@@ -181,6 +202,11 @@
 		dst_libs = sprintf("%s/%s", directory, end_name);
 		printf "%s : \\\n", dst_libs
 		printf "\t\t%s \\\n", directory
+		if (subset == "ticlib" && driver == "yes" ) {
+			base = name;
+			sub(/^tic/, "ncurses", base); # workaround for "w"
+			printf "\t\t%s/%s \\\n", directory, end_name_of(base);
+		}
 		if (subset ~ /^base/ || subset == "ticlib" ) {
 			save_suffix = suffix
 			sub(/^[^.]\./,".",suffix)
@@ -223,8 +249,9 @@
 		printf "\t%s %s %s\n", program, src_name, dst_name
 	}
 BEGIN	{
-		found = 0
-		using = 0
+		TOOL_PREFIX = "";
+		found = 0;
+		using = 0;
 	}
 	/^@/ {
 		using = 0
@@ -233,15 +260,26 @@
 		} else if (index(subset,$2) > 0) {
 			if (using == 0) {
 				if (found == 0) {
+					if ( name ~ /^.*\+\+.*/ ) {
+						if ( CXX_MODEL == "NORMAL" && MODEL == "SHARED" ) {
+							print  ""
+							printf "# overriding model from %s to match CXX_MODEL\n", MODEL;
+							MODEL = "NORMAL";
+							suffix = ".a";
+							DoLinks = "no";
+						}
+					}
 					print  ""
 					printf "# generated by mk-1st.awk (subset=%s)\n", subset
 					printf "#  name:          %s\n", name 
 					printf "#  traces:        %s\n", traces 
 					printf "#  MODEL:         %s\n", MODEL 
+					printf "#  CXX_MODEL:     %s\n", CXX_MODEL 
 					printf "#  model:         %s\n", model 
 					printf "#  prefix:        %s\n", prefix 
 					printf "#  suffix:        %s\n", suffix 
 					printf "#  subset:        %s\n", subset 
+					printf "#  driver:        %s\n", driver 
 					printf "#  ShlibVer:      %s\n", ShlibVer 
 					printf "#  ShlibVerInfix: %s\n", ShlibVerInfix 
 					printf "#  SymLink:       %s\n", SymLink 
@@ -285,12 +323,23 @@
 			if ( found == 0 )
 			{
 				printf "%s_OBJS =", OBJS
-				if ( $2 == "lib" )
-					found = 1
-				else
-					found = 2
+				if ( $2 == "lib" ) {
+					found = 1;
+				} else if ( $2 == "c++" ) {
+					TOOL_PREFIX = "CXX_";
+					found = 1;
+				} else {
+					found = 2;
+				}
+				if ( $2 == "c++" ) {
+					CC_NAME="CXX"
+					CC_FLAG="CXXFLAGS"
+				} else {
+					CC_NAME="CC"
+					CC_FLAG="CFLAGS"
+				}
 			}
-			printf " \\\n\t../%s/%s$o", model, $1
+			printf " \\\n\t../%s/%s$o", model, $1;
 		}
 	}
 END	{
@@ -316,7 +365,7 @@
 				print  "install \\"
 				print  "install.libs \\"
 
-				if ( ShlibVer == "cygdll" ) {
+				if ( ShlibVer == "cygdll" || ShlibVer == "mingw") {
 
 					dst_dirs = "$(DESTDIR)$(bindir) $(DESTDIR)$(libdir)";
 					printf "install.%s :: %s $(LIBRARIES)\n", name, dst_dirs
@@ -337,7 +386,7 @@
 
 				if ( overwrite == "yes" && name == "ncurses" )
 				{
-					if ( ShlibVer == "cygdll" ) {
+					if ( ShlibVer == "cygdll" || ShlibVer == "mingw") {
 						ovr_name = sprintf("libcurses%s.a", suffix)
 						printf "\t@echo linking %s to %s\n", imp_name, ovr_name
 						printf "\tcd $(DESTDIR)$(libdir) && ("
@@ -358,7 +407,7 @@
 				print  "uninstall \\"
 				print  "uninstall.libs \\"
 				printf "uninstall.%s ::\n", name
-				if ( ShlibVer == "cygdll" ) {
+				if ( ShlibVer == "cygdll" || ShlibVer == "mingw") {
 
 					printf "\t@echo uninstalling $(DESTDIR)$(bindir)/%s\n", end_name
 					printf "\t-@rm -f $(DESTDIR)$(bindir)/%s\n", end_name
@@ -371,11 +420,7 @@
 					removelinks("$(DESTDIR)$(libdir)")
 					if ( overwrite == "yes" && name == "ncurses" )
 					{
-						if ( ShlibVer == "cygdll" ) {
-							ovr_name = sprintf("libcurses%s.a", suffix)
-						} else {
-							ovr_name = sprintf("libcurses%s", suffix)
-						}
+						ovr_name = sprintf("libcurses%s", suffix)
 						printf "\t-@rm -f $(DESTDIR)$(libdir)/%s\n", ovr_name
 					}
 				}
@@ -388,20 +433,19 @@
 			}
 			else if ( MODEL == "LIBTOOL" )
 			{
-				if ( $2 == "c++" ) {
-					compile="CXX"
-				} else {
-					compile="CC"
-				}
 				end_name = lib_name;
 				printf "../lib/%s : $(%s_OBJS)\n", lib_name, OBJS
 				if ( is_ticlib() ) {
-					printf "\tcd ../lib && $(LIBTOOL_LINK) $(%s) -o %s $(%s_OBJS:$o=.lo) -rpath $(DESTDIR)$(libdir) %s $(NCURSES_MAJOR):$(NCURSES_MINOR) $(LT_UNDEF) $(TICS_LIST)\n", compile, lib_name, OBJS, libtool_version
+					which_list = "TICS_LIST";
 				} else if ( is_termlib() ) {
-					printf "\tcd ../lib && $(LIBTOOL_LINK) $(%s) -o %s $(%s_OBJS:$o=.lo) -rpath $(DESTDIR)$(libdir) %s $(NCURSES_MAJOR):$(NCURSES_MINOR) $(LT_UNDEF) $(TINFO_LIST)\n", compile, lib_name, OBJS, libtool_version
+					which_list = "TINFO_LIST";
 				} else {
-					printf "\tcd ../lib && $(LIBTOOL_LINK) $(%s) -o %s $(%s_OBJS:$o=.lo) -rpath $(DESTDIR)$(libdir) %s $(NCURSES_MAJOR):$(NCURSES_MINOR) $(LT_UNDEF) $(SHLIB_LIST)\n", compile, lib_name, OBJS, libtool_version
+					which_list = "SHLIB_LIST";
 				}
+				printf "\tcd ../lib && $(LIBTOOL_LINK) $(%s) $(%s) \\\n", CC_NAME, CC_FLAG;
+				printf "\t\t-o %s $(%s_OBJS:$o=.lo) \\\n", lib_name, OBJS;
+				printf "\t\t-rpath $(DESTDIR)$(libdir) \\\n";
+				printf "\t\t%s $(NCURSES_MAJOR):$(NCURSES_MINOR) $(LT_UNDEF) $(%s) $(LDFLAGS)\n", libtool_version, which_list;
 				print  ""
 				print  "install \\"
 				print  "install.libs \\"
@@ -419,7 +463,7 @@
 			{
 				end_name = lib_name;
 				printf "../lib/%s : $(%s_OBJS)\n", lib_name, OBJS
-				printf "\t$(AR) $(ARFLAGS) $@ $?\n"
+				printf "\t$(%sAR) $(%sARFLAGS) $@ $?\n", TOOL_PREFIX, TOOL_PREFIX;
 				printf "\t$(RANLIB) $@\n"
 				if ( host == "vxworks" )
 				{
Index: ncurses/Makefile.in
Prereq:  1.130 
--- ncurses-5.9/ncurses/Makefile.in	2010-11-27 21:45:27.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/Makefile.in	2012-12-22 23:34:40.000000000 +0000
@@ -1,6 +1,6 @@
-# $Id: Makefile.in,v 1.130 2010/11/27 21:45:27 tom Exp $
+# $Id: Makefile.in,v 1.136 2012/12/22 23:34:40 tom Exp $
 ##############################################################################
-# Copyright (c) 1998-2009,2010 Free Software Foundation, Inc.                #
+# Copyright (c) 1998-2011,2012 Free Software Foundation, Inc.                #
 #                                                                            #
 # Permission is hereby granted, free of charge, to any person obtaining a    #
 # copy of this software and associated documentation files (the "Software"), #
@@ -64,6 +64,7 @@
 bindir		= @bindir@
 libdir		= @libdir@
 includedir	= @includedir@
+datarootdir	= @datarootdir@
 datadir		= @datadir@
 
 LIBTOOL		= @LIBTOOL@
@@ -107,7 +108,7 @@
 # is compiled into the build, or are test-programs that are not installed.
 
 BUILD_EXEEXT	= @BUILD_EXEEXT@
-x		= @PROG_EXT@
+x		= @EXEEXT@
 
 CFLAGS_LIBTOOL	= $(CCFLAGS)
 CFLAGS_NORMAL	= $(CCFLAGS)
@@ -125,6 +126,7 @@
 TINFO_LIST	= $(SHLIB_DIRS) @TINFO_LIST@
 TICS_LIST	= $(SHLIB_DIRS) @TICS_LIST@
 
+RPATH_LIST	= @RPATH_LIST@
 MK_SHARED_LIB	= @MK_SHARED_LIB@
 
 NCURSES_MAJOR	= @NCURSES_MAJOR@
@@ -134,7 +136,7 @@
 
 RANLIB		= @LIB_PREP@
 
-LIBRARIES	= @LIBS_TO_MAKE@
+LIBRARIES	= @Libs_To_Make@
 
 LINT		= @LINT@
 LINT_OPTS	= @LINT_OPTS@
@@ -262,7 +264,7 @@
 	-rm -f $(AUTO_SRC)
 	-rm -f make_keys$(BUILD_EXEEXT)
 	-rm -f make_hash$(BUILD_EXEEXT)
-	-rm -rf .libs
+	-rm -rf .libs *.dSYM
 
 distclean :: clean
 	-rm -f Makefile
@@ -282,21 +284,21 @@
 	sh -e $(base)/MKlib_gen.sh "$(CPP) $(CPPFLAGS)" "$(AWK)" implemented <../include/curses.h >$@
 
 captoinfo$x : $(tinfo)/captoinfo.c $(TEST_DEPS)
-	@ECHO_LINK@ $(LIBTOOL_LINK) -o $@ $(CFLAGS_DEFAULT) -DMAIN $(tinfo)/captoinfo.c $(TEST_LDFLAGS)
+	@ECHO_LD@ $(LIBTOOL_LINK) -o $@ $(CFLAGS_DEFAULT) -DMAIN $(tinfo)/captoinfo.c $(TEST_LDFLAGS)
 
 hardscroll$x : $(serial)/hardscroll.c $(TEST_DEPS)
-	@ECHO_LINK@ $(LIBTOOL_LINK) -o $@ $(CFLAGS_DEFAULT) -DSCROLLDEBUG $(serial)/hardscroll.c $(TEST_LDFLAGS)
+	@ECHO_LD@ $(LIBTOOL_LINK) -o $@ $(CFLAGS_DEFAULT) -DSCROLLDEBUG $(serial)/hardscroll.c $(TEST_LDFLAGS)
 
 hashmap$x : $(serial)/hashmap.c $(serial)/hardscroll.c $(TEST_DEPS)
-	@ECHO_LINK@ $(LIBTOOL_LINK) -o $@ $(CFLAGS_DEFAULT) -DHASHDEBUG $(serial)/hashmap.c $(serial)/hardscroll.c $(TEST_LDFLAGS)
+	@ECHO_LD@ $(LIBTOOL_LINK) -o $@ $(CFLAGS_DEFAULT) -DHASHDEBUG $(serial)/hashmap.c $(serial)/hardscroll.c $(TEST_LDFLAGS)
 
 lib_mvcur$x : $(serial)/lib_mvcur.c $(TEST_DEPS) \
 		../@DFT_OBJ_SUBDIR@/dump_entry$o
-	@ECHO_LINK@ $(LIBTOOL_LINK) -o $@ $(CFLAGS_DEFAULT) -DNCURSES_TEST -I$(serial)/../../progs $(serial)/lib_mvcur.c ../@DFT_OBJ_SUBDIR@/dump_entry$o $(TEST_LDFLAGS)
+	@ECHO_LD@ $(LIBTOOL_LINK) -o $@ $(CFLAGS_DEFAULT) -DNCURSES_TEST -I$(serial)/../../progs $(serial)/lib_mvcur.c ../@DFT_OBJ_SUBDIR@/dump_entry$o $(TEST_LDFLAGS)
 
 link_test$x : ./link_test.c $(TEST_DEPS) \
 		../@DFT_OBJ_SUBDIR@/link_test$o
-	@ECHO_LINK@ $(CC) -o $@ $(CFLAGS_DEFAULT) ../@DFT_OBJ_SUBDIR@/link_test$o $(TEST_LDFLAGS)
+	@ECHO_LD@ $(CC) -o $@ $(CFLAGS_DEFAULT) ../@DFT_OBJ_SUBDIR@/link_test$o $(TEST_LDFLAGS)
 
 ../@DFT_OBJ_SUBDIR@/dump_entry$o:
 	cd ../progs && $(MAKE) ../@DFT_OBJ_SUBDIR@/dump_entry$o
Index: ncurses/base/MKkeyname.awk
Prereq:  1.45 
--- ncurses-5.9/ncurses/base/MKkeyname.awk	2010-12-19 01:36:14.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/base/MKkeyname.awk	2012-02-22 22:35:41.000000000 +0000
@@ -1,6 +1,6 @@
-# $Id: MKkeyname.awk,v 1.45 2010/12/19 01:36:14 tom Exp $
+# $Id: MKkeyname.awk,v 1.47 2012/02/22 22:35:41 tom Exp $
 ##############################################################################
-# Copyright (c) 1999-2009,2010 Free Software Foundation, Inc.                #
+# Copyright (c) 1999-2010,2012 Free Software Foundation, Inc.                #
 #                                                                            #
 # Permission is hereby granted, free of charge, to any person obtaining a    #
 # copy of this software and associated documentation files (the "Software"), #
@@ -100,17 +100,18 @@
 	print "				if (MyTable[c] == 0) {"
 	print "					int cc = c;"
 	print "					p = name;"
+	print "#define P_LIMIT (sizeof(name) - (size_t) (p - name))"
 	print "					if (cc >= 128 && (sp == 0 || sp->_use_meta)) {"
-	print "						strcpy(p, \"M-\");"
+	print "						_nc_STRCPY(p, \"M-\", P_LIMIT);"
 	print "						p += 2;"
 	print "						cc -= 128;"
 	print "					}"
 	print "					if (cc < 32)"
-	print "						sprintf(p, \"^%c\", cc + '@');"
+	print "						_nc_SPRINTF(p, _nc_SLIMIT(P_LIMIT) \"^%c\", cc + '@');"
 	print "					else if (cc == 127)"
-	print "						strcpy(p, \"^?\");"
+	print "						_nc_STRCPY(p, \"^?\", P_LIMIT);"
 	print "					else"
-	print "						sprintf(p, \"%c\", cc);"
+	print "						_nc_SPRINTF(p, _nc_SLIMIT(P_LIMIT) \"%c\", cc);"
 	print "					MyTable[c] = strdup(name);"
 	print "				}"
 	print "				result = MyTable[c];"
Index: ncurses/base/MKlib_gen.sh
Prereq:  1.43 
--- ncurses-5.9/ncurses/base/MKlib_gen.sh	2011-01-22 19:47:29.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/base/MKlib_gen.sh	2011-06-04 19:14:08.000000000 +0000
@@ -2,7 +2,7 @@
 #
 # MKlib_gen.sh -- generate sources from curses.h macro definitions
 #
-# ($Id: MKlib_gen.sh,v 1.43 2011/01/22 19:47:29 tom Exp $)
+# ($Id: MKlib_gen.sh,v 1.46 2011/06/04 19:14:08 tom Exp $)
 #
 ##############################################################################
 # Copyright (c) 1998-2010,2011 Free Software Foundation, Inc.                #
@@ -410,10 +410,45 @@
 		print "#undef vwprintw"
 		}
 /^DECLARATIONS/	{start = 1; next;}
-		{if (start) print \$0;}
+		{
+		if (start) {
+			if ( "$USE" == "generated" ) {
+				print \$0;
+			} else if ( \$0 ~ /^[{}]?\$/ ) {
+				print \$0;
+			} else if ( \$0 ~ /;/ ) {
+				print \$0;
+			} else {
+				calls[start] = \$0;
+				print \$0;
+				start++;
+			}
+		}
+		}
 END		{
 		if ( "$USE" != "generated" ) {
-			print "int main(void) { return 0; }"
+			print "int main(void)"
+			print "{"
+			for (n = 1; n < start; ++n) {
+				value = calls[n];
+				if ( value !~ /P_POUNDC/ ) {
+					gsub(/[[:blank:]]+/," ",value);
+					sub(/^[[:alnum:]_]+ /,"",value);
+					sub(/^\* /,"",value);
+					gsub(/[[:alnum:]_]+ \* /,"",value);
+					gsub(/ (const) /," ",value);
+					gsub(/ (int|short|attr_t|chtype|wchar_t|NCURSES_BOOL|NCURSES_OUTC|NCURSES_OUTC_sp|va_list) /," ",value);
+					gsub(/ void /,"",value);
+					sub(/^/,"call_",value);
+					gsub(/ (a[[:digit:]]|z) /, " 0 ", value);
+					gsub(/ int[[:blank:]]*[(][^)]+[)][(][^)]+[)]/, "0", value);
+					printf "\t%s;\n", value;
+				} else {
+					print value;
+				}
+			}
+			print "	return 0;"
+			print "}"
 		}
 		}
 EOF1
@@ -422,6 +457,8 @@
 #include <ncurses_cfg.h>
 #undef NCURSES_NOMACROS
 #include <curses.h>
+#include <term.h>
+#include <unctrl.h>
 
 DECLARATIONS
 
Index: ncurses/base/MKunctrl.awk
Prereq:  1.26 
--- ncurses-5.9/ncurses/base/MKunctrl.awk	2009-07-04 22:05:15.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/base/MKunctrl.awk	2012-06-09 20:29:33.000000000 +0000
@@ -1,6 +1,6 @@
-# $Id: MKunctrl.awk,v 1.26 2009/07/04 22:05:15 Clemens.Ladisch Exp $
+# $Id: MKunctrl.awk,v 1.27 2012/06/09 20:29:33 tom Exp $
 ##############################################################################
-# Copyright (c) 1998-2008,2009 Free Software Foundation, Inc.                #
+# Copyright (c) 1998-2009,2012 Free Software Foundation, Inc.                #
 #                                                                            #
 # Permission is hereby granted, free of charge, to any person obtaining a    #
 # copy of this software and associated documentation files (the "Software"), #
@@ -140,7 +140,7 @@
 		} else {
 			stringname = "unctrl"
 		}
-		print  "\tint check = ChCharOf(ch);"
+		print  "\tint check = (int) ChCharOf(ch);"
 		print  "\tconst char *result;"
 		print  ""
 		print  "\tif (check >= 0 && check < (int)SIZEOF(unctrl_table)) {"
Index: ncurses/base/keybound.c
Prereq:  1.10 
--- ncurses-5.9/ncurses/base/keybound.c	2009-10-24 22:15:47.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/base/keybound.c	2011-10-22 16:47:05.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1999-2006,2009 Free Software Foundation, Inc.              *
+ * Copyright (c) 1999-2009,2011 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -33,7 +33,7 @@
 
 #include <curses.priv.h>
 
-MODULE_ID("$Id: keybound.c,v 1.10 2009/10/24 22:15:47 tom Exp $")
+MODULE_ID("$Id: keybound.c,v 1.11 2011/10/22 16:47:05 tom Exp $")
 
 /*
  * Returns the count'th string definition which is associated with the
@@ -46,7 +46,10 @@
 
     T((T_CALLED("keybound(%p, %d,%d)"), (void *) SP_PARM, code, count));
     if (SP_PARM != 0 && code >= 0) {
-	result = _nc_expand_try(SP_PARM->_keytry, (unsigned) code, &count, 0);
+	result = _nc_expand_try(SP_PARM->_keytry,
+				(unsigned) code,
+				&count,
+				(size_t) 0);
     }
     returnPtr(result);
 }
Index: ncurses/base/keyok.c
Prereq:  1.10 
--- ncurses-5.9/ncurses/base/keyok.c	2009-10-24 22:15:47.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/base/keyok.c	2012-11-18 02:14:35.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2006,2009 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -33,7 +33,7 @@
 
 #include <curses.priv.h>
 
-MODULE_ID("$Id: keyok.c,v 1.10 2009/10/24 22:15:47 tom Exp $")
+MODULE_ID("$Id: keyok.c,v 1.13 2012/11/18 02:14:35 tom Exp $")
 
 /*
  * Enable (or disable) ncurses' interpretation of a keycode by adding (or
@@ -50,37 +50,47 @@
 {
     int code = ERR;
 
-    T((T_CALLED("keyok(%p, %d,%d)"), (void *) SP_PARM, c, flag));
+    if (HasTerminal(SP_PARM)) {
+	T((T_CALLED("keyok(%p, %d,%d)"), (void *) SP_PARM, c, flag));
 #ifdef USE_TERM_DRIVER
-    code = CallDriver_2(sp, kyOk, c, flag);
+	code = CallDriver_2(sp, kyOk, c, flag);
 #else
-    T((T_CALLED("keyok(%d,%d)"), c, flag));
-    if (c >= 0) {
-	int count = 0;
-	char *s;
-	unsigned ch = (unsigned) c;
-
-	if (flag) {
-	    while ((s = _nc_expand_try(SP_PARM->_key_ok, ch, &count, 0)) != 0
-		   && _nc_remove_key(&(SP_PARM->_key_ok), ch)) {
-		code = _nc_add_to_try(&(SP_PARM->_keytry), s, ch);
-		free(s);
-		count = 0;
-		if (code != OK)
-		    break;
-	    }
-	} else {
-	    while ((s = _nc_expand_try(SP_PARM->_keytry, ch, &count, 0)) != 0
-		   && _nc_remove_key(&(SP_PARM->_keytry), ch)) {
-		code = _nc_add_to_try(&(SP_PARM->_key_ok), s, ch);
-		free(s);
-		count = 0;
-		if (code != OK)
-		    break;
+	T((T_CALLED("keyok(%d,%d)"), c, flag));
+	if (c >= 0) {
+	    int count = 0;
+	    char *s;
+	    unsigned ch = (unsigned) c;
+
+	    if (flag) {
+		while ((s = _nc_expand_try(SP_PARM->_key_ok,
+					   ch, &count, (size_t) 0)) != 0) {
+		    if (_nc_remove_key(&(SP_PARM->_key_ok), ch)) {
+			code = _nc_add_to_try(&(SP_PARM->_keytry), s, ch);
+			free(s);
+			count = 0;
+			if (code != OK)
+			    break;
+		    } else {
+			free(s);
+		    }
+		}
+	    } else {
+		while ((s = _nc_expand_try(SP_PARM->_keytry,
+					   ch, &count, (size_t) 0)) != 0) {
+		    if (_nc_remove_key(&(SP_PARM->_keytry), ch)) {
+			code = _nc_add_to_try(&(SP_PARM->_key_ok), s, ch);
+			free(s);
+			count = 0;
+			if (code != OK)
+			    break;
+		    } else {
+			free(s);
+		    }
+		}
 	    }
 	}
-    }
 #endif
+    }
     returnCode(code);
 }
 
Index: ncurses/base/lib_addch.c
Prereq:  1.124 
--- ncurses-5.9/ncurses/base/lib_addch.c	2010-04-24 22:41:05.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/base/lib_addch.c	2013-03-17 00:30:29.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2011,2013 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -36,7 +36,7 @@
 #include <curses.priv.h>
 #include <ctype.h>
 
-MODULE_ID("$Id: lib_addch.c,v 1.124 2010/04/24 22:41:05 tom Exp $")
+MODULE_ID("$Id: lib_addch.c,v 1.127 2013/03/17 00:30:29 tom Exp $")
 
 static const NCURSES_CH_T blankchar = NewChar(BLANK_TEXT);
 
@@ -209,7 +209,8 @@
     buffer[WINDOW_EXT(win, addch_used)] = '\0';
     if ((len = (int) mbrtowc(&result,
 			     buffer,
-			     WINDOW_EXT(win, addch_used), &state)) > 0) {
+			     (size_t) WINDOW_EXT(win, addch_used),
+			     &state)) > 0) {
 	attr_t attrs = AttrOf(CHDEREF(ch));
 	if_EXT_COLORS(int pair = GetPair(CHDEREF(ch)));
 	SetChar(CHDEREF(ch), result, attrs);
@@ -411,10 +412,12 @@
 #endif
     const char *s = NCURSES_SP_NAME(unctrl) (NCURSES_SP_ARGx t);
     int tabsize = 8;
+
     /*
      * If we are using the alternate character set, forget about locale.
      * Otherwise, if unctrl() returns a single-character or the locale
-     * claims the code is printable, treat it that way.
+     * claims the code is printable (and not also a control character),
+     * treat it that way.
      */
     if ((AttrOf(ch) & A_ALTCHARSET)
 	|| (
@@ -424,14 +427,15 @@
 	       s[1] == 0
 	)
 	|| (
-	       isprint(t)
+	       (isprint(t) && !iscntrl(t))
 #if USE_WIDEC_SUPPORT
 	       || ((sp == 0 || !sp->_legacy_coding) &&
 		   (WINDOW_EXT(win, addch_used)
 		    || !_nc_is_charable(CharOf(ch))))
 #endif
-	))
+	)) {
 	return waddch_literal(win, ch);
+    }
 
     /*
      * Handle carriage control and other codes that are not printable, or are
Index: ncurses/base/lib_addstr.c
Prereq:  1.51 
--- ncurses-5.9/ncurses/base/lib_addstr.c	2010-12-19 01:22:58.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/base/lib_addstr.c	2011-05-28 23:02:09.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2010,2011 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -44,7 +44,7 @@
 
 #include <curses.priv.h>
 
-MODULE_ID("$Id: lib_addstr.c,v 1.51 2010/12/19 01:22:58 tom Exp $")
+MODULE_ID("$Id: lib_addstr.c,v 1.52 2011/05/28 23:02:09 tom Exp $")
 
 NCURSES_EXPORT(int)
 waddnstr(WINDOW *win, const char *astr, int n)
@@ -119,8 +119,10 @@
 _nc_wchstrlen(const cchar_t *s)
 {
     int result = 0;
-    while (CharOf(s[result]) != L'\0') {
-	result++;
+    if (s != 0) {
+	while (CharOf(s[result]) != L'\0') {
+	    result++;
+	}
     }
     return result;
 }
Index: ncurses/base/lib_beep.c
Prereq:  1.15 
--- ncurses-5.9/ncurses/base/lib_beep.c	2009-10-24 22:02:14.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/base/lib_beep.c	2013-01-12 17:26:25.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2008,2009 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2009,2013 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -46,7 +46,7 @@
 #define CUR SP_TERMTYPE
 #endif
 
-MODULE_ID("$Id: lib_beep.c,v 1.15 2009/10/24 22:02:14 tom Exp $")
+MODULE_ID("$Id: lib_beep.c,v 1.16 2013/01/12 17:26:25 tom Exp $")
 
 /*
  *	beep()
@@ -71,12 +71,9 @@
     if (cur_term == 0) {
 	res = ERR;
     } else if (bell) {
-	TPUTS_TRACE("bell");
-	res = putp(bell);
-	_nc_flush();
+	res = NCURSES_PUTP2_FLUSH("bell", bell);
     } else if (flash_screen) {
-	TPUTS_TRACE("flash_screen");
-	res = putp(flash_screen);
+	res = NCURSES_PUTP2_FLUSH("flash_screen", flash_screen);
 	_nc_flush();
     }
 #endif
Index: ncurses/base/lib_bkgd.c
Prereq:  1.43 
--- ncurses-5.9/ncurses/base/lib_bkgd.c	2011-01-22 19:47:37.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/base/lib_bkgd.c	2012-12-09 01:01:19.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2010,2011 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -36,7 +36,7 @@
 
 #include <curses.priv.h>
 
-MODULE_ID("$Id: lib_bkgd.c,v 1.43 2011/01/22 19:47:37 tom Exp $")
+MODULE_ID("$Id: lib_bkgd.c,v 1.48 2012/12/09 01:01:19 tom Exp $")
 
 /*
  * Set the window's background information.
@@ -85,6 +85,7 @@
 	    cchar_t wch;
 	    int tmp;
 
+	    memset(&wch, 0, sizeof(wch));
 	    (void) wgetbkgrnd(win, &wch);
 	    tmp = _nc_to_char((wint_t) CharOf(wch));
 
@@ -118,16 +119,18 @@
 {
     int code = ERR;
     int x, y;
-    NCURSES_CH_T new_bkgd = CHDEREF(ch);
 
     T((T_CALLED("wbkgd(%p,%s)"), (void *) win, _tracech_t(ch)));
 
     if (win) {
+	NCURSES_CH_T new_bkgd = CHDEREF(ch);
 	NCURSES_CH_T old_bkgrnd;
+
+	memset(&old_bkgrnd, 0, sizeof(old_bkgrnd));
 	wgetbkgrnd(win, &old_bkgrnd);
 
 	(void) wbkgrndset(win, CHREF(new_bkgd));
-	(void) wattrset(win, AttrOf(win->_nc_bkgd));
+	(void) wattrset(win, (int) AttrOf(win->_nc_bkgd));
 
 	for (y = 0; y <= win->_maxy; y++) {
 	    for (x = 0; x <= win->_maxx; x++) {
Index: ncurses/base/lib_color.c
Prereq:  1.98 
--- ncurses-5.9/ncurses/base/lib_color.c	2010-04-24 22:57:53.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/base/lib_color.c	2013-03-09 22:33:38.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -45,7 +45,7 @@
 #define CUR SP_TERMTYPE
 #endif
 
-MODULE_ID("$Id: lib_color.c,v 1.98 2010/04/24 22:57:53 tom Exp $")
+MODULE_ID("$Id: lib_color.c,v 1.108 2013/03/09 22:33:38 tom Exp $")
 
 #ifdef USE_TERM_DRIVER
 #define CanChange      InfoOf(SP_PARM).canchange
@@ -264,8 +264,7 @@
 
     (void) SP_PARM;
     if (orig_pair != 0) {
-	TPUTS_TRACE("orig_pair");
-	putp(orig_pair);
+	(void) NCURSES_PUTP2("orig_pair", orig_pair);
 	result = TRUE;
     }
     return result;
@@ -292,8 +291,7 @@
     result = CallDriver(SP_PARM, rescolors);
 #else
     if (orig_colors != 0) {
-	TPUTS_TRACE("orig_colors");
-	putp(orig_colors);
+	NCURSES_PUTP2("orig_colors", orig_colors);
 	result = TRUE;
     }
 #endif
@@ -331,6 +329,13 @@
 				 default_bg(NCURSES_SP_ARG),
 				 NCURSES_SP_NAME(_nc_outch));
 	}
+#if !NCURSES_EXT_COLORS
+	/*
+	 * Without ext-colors, we cannot represent more than 256 color pairs.
+	 */
+	if (maxpairs > 256)
+	    maxpairs = 256;
+#endif
 
 	if (maxpairs > 0 && maxcolors > 0) {
 	    SP_PARM->_pair_limit = maxpairs;
@@ -383,10 +388,10 @@
 
 /* This function was originally written by Daniel Weaver <danw@znyx.com> */
 static void
-rgb2hls(short r, short g, short b, short *h, short *l, short *s)
+rgb2hls(int r, int g, int b, short *h, short *l, short *s)
 /* convert RGB to HLS system */
 {
-    short min, max, t;
+    int min, max, t;
 
     if ((min = g < r ? g : r) > b)
 	min = b;
@@ -416,7 +421,7 @@
     else
 	t = (short) (360 + ((r - g) * 60) / (max - min));
 
-    *h = t % 360;
+    *h = (short) (t % 360);
 }
 
 /*
@@ -439,7 +444,7 @@
 
     previous = SP_PARM->_color_pairs[pair];
 #if NCURSES_EXT_FUNCS
-    if (SP_PARM->_default_color) {
+    if (SP_PARM->_default_color || SP_PARM->_assumed_color) {
 	bool isDefault = FALSE;
 	bool wasDefault = FALSE;
 	int default_pairs = SP_PARM->_default_pairs;
@@ -498,8 +503,9 @@
     {
 	if ((f < 0) || !OkColorHi(f)
 	    || (b < 0) || !OkColorHi(b)
-	    || (pair < 1))
+	    || (pair < 1)) {
 	    returnCode(ERR);
+	}
     }
 
     /*
@@ -545,11 +551,11 @@
 	    tp[f].red, tp[f].green, tp[f].blue,
 	    tp[b].red, tp[b].green, tp[b].blue));
 
-	TPUTS_TRACE("initialize_pair");
-	putp(TPARM_7(initialize_pair,
-		     pair,
-		     tp[f].red, tp[f].green, tp[f].blue,
-		     tp[b].red, tp[b].green, tp[b].blue));
+	NCURSES_PUTP2("initialize_pair",
+		      TPARM_7(initialize_pair,
+			      pair,
+			      tp[f].red, tp[f].green, tp[f].blue,
+			      tp[b].red, tp[b].green, tp[b].blue));
     }
 #endif
 
@@ -607,8 +613,8 @@
 #ifdef USE_TERM_DRIVER
 	CallDriver_4(SP_PARM, initcolor, color, r, g, b);
 #else
-	TPUTS_TRACE("initialize_color");
-	putp(TPARM_4(initialize_color, color, r, g, b));
+	NCURSES_PUTP2("initialize_color",
+		      TPARM_4(initialize_color, color, r, g, b));
 #endif
 	SP_PARM->_color_defs = max(color + 1, SP_PARM->_color_defs);
 
@@ -628,8 +634,15 @@
 NCURSES_EXPORT(bool)
 NCURSES_SP_NAME(can_change_color) (NCURSES_SP_DCL)
 {
+    int result = FALSE;
+
     T((T_CALLED("can_change_color(%p)"), (void *) SP_PARM));
-    returnCode((CanChange != 0) ? TRUE : FALSE);
+
+    if (HasTerminal(SP_PARM) && (CanChange != 0)) {
+	result = TRUE;
+    }
+
+    returnCode(result);
 }
 
 #if NCURSES_SP_FUNCS
@@ -643,20 +656,22 @@
 NCURSES_EXPORT(bool)
 NCURSES_SP_NAME(has_colors) (NCURSES_SP_DCL0)
 {
-    int code;
+    int code = FALSE;
 
     (void) SP_PARM;
     T((T_CALLED("has_colors()")));
+    if (HasTerminal(SP_PARM)) {
 #ifdef USE_TERM_DRIVER
-    code = HasColor;
+	code = HasColor;
 #else
-    code = ((VALID_NUMERIC(max_colors) && VALID_NUMERIC(max_pairs)
-	     && (((set_foreground != NULL)
-		  && (set_background != NULL))
-		 || ((set_a_foreground != NULL)
-		     && (set_a_background != NULL))
-		 || set_color_pair)) ? TRUE : FALSE);
+	code = ((VALID_NUMERIC(max_colors) && VALID_NUMERIC(max_pairs)
+		 && (((set_foreground != NULL)
+		      && (set_background != NULL))
+		     || ((set_a_foreground != NULL)
+			 && (set_a_background != NULL))
+		     || set_color_pair)) ? TRUE : FALSE);
 #endif
+    }
     returnCode(code);
 }
 
@@ -731,8 +746,8 @@
     if (!ValidPair(pair)) {
 	result = ERR;
     } else {
-	NCURSES_COLOR_T fg = FORE_OF(SP_PARM->_color_pairs[pair]);
-	NCURSES_COLOR_T bg = BACK_OF(SP_PARM->_color_pairs[pair]);
+	NCURSES_COLOR_T fg = (NCURSES_COLOR_T) FORE_OF(SP_PARM->_color_pairs[pair]);
+	NCURSES_COLOR_T bg = (NCURSES_COLOR_T) BACK_OF(SP_PARM->_color_pairs[pair]);
 
 #if NCURSES_EXT_FUNCS
 	if (fg == COLOR_DEFAULT)
@@ -765,9 +780,9 @@
 
 NCURSES_EXPORT(void)
 NCURSES_SP_NAME(_nc_do_color) (NCURSES_SP_DCLx
-			       short old_pair,
-			       short pair,
-			       bool reverse,
+			       int old_pair,
+			       int pair,
+			       int reverse,
 			       NCURSES_SP_OUTC outc)
 {
 #ifdef USE_TERM_DRIVER
@@ -775,7 +790,8 @@
 #else
     NCURSES_COLOR_T fg = COLOR_DEFAULT;
     NCURSES_COLOR_T bg = COLOR_DEFAULT;
-    NCURSES_COLOR_T old_fg, old_bg;
+    NCURSES_COLOR_T old_fg = -1;
+    NCURSES_COLOR_T old_bg = -1;
 
     if (!ValidPair(pair)) {
 	return;
@@ -787,13 +803,14 @@
 				    1, outc);
 	    return;
 	} else if (SP_PARM != 0) {
-	    pair_content((short) pair, &fg, &bg);
+	    if (pair_content((short) pair, &fg, &bg) == ERR)
+		return;
 	}
     }
 
     if (old_pair >= 0
 	&& SP_PARM != 0
-	&& pair_content(old_pair, &old_fg, &old_bg) != ERR) {
+	&& pair_content((short) old_pair, &old_fg, &old_bg) != ERR) {
 	if ((isDefaultColor(fg) && !isDefaultColor(old_fg))
 	    || (isDefaultColor(bg) && !isDefaultColor(old_bg))) {
 #if NCURSES_EXT_FUNCS
@@ -847,7 +864,7 @@
 
 #if NCURSES_SP_FUNCS
 NCURSES_EXPORT(void)
-_nc_do_color(short old_pair, short pair, bool reverse, NCURSES_OUTC outc)
+_nc_do_color(int old_pair, int pair, int reverse, NCURSES_OUTC outc)
 {
     SetSafeOutcWrapper(outc);
     NCURSES_SP_NAME(_nc_do_color) (CURRENT_SCREEN,
Index: ncurses/base/lib_dft_fgbg.c
Prereq:  1.25 
--- ncurses-5.9/ncurses/base/lib_dft_fgbg.c	2009-10-24 22:15:00.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/base/lib_dft_fgbg.c	2011-04-23 18:28:18.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2005,2009 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2009,2011 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -37,7 +37,7 @@
 #define CUR SP_TERMTYPE
 #endif
 
-MODULE_ID("$Id: lib_dft_fgbg.c,v 1.25 2009/10/24 22:15:00 tom Exp $")
+MODULE_ID("$Id: lib_dft_fgbg.c,v 1.26 2011/04/23 18:28:18 tom Exp $")
 
 /*
  * Modify the behavior of color-pair 0 so that the library doesn't assume that
@@ -80,6 +80,7 @@
 	SP_PARM->_default_bg = isDefaultColor(bg) ? COLOR_DEFAULT : (bg & C_MASK);
 	if (SP_PARM->_color_pairs != 0) {
 	    bool save = SP_PARM->_default_color;
+	    SP_PARM->_assumed_color = TRUE;
 	    SP_PARM->_default_color = TRUE;
 	    init_pair(0, (short) fg, (short) bg);
 	    SP_PARM->_default_color = save;
Index: ncurses/base/lib_driver.c
Prereq:  1.3 
--- ncurses-5.9/ncurses/base/lib_driver.c	2010-12-20 00:29:17.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/base/lib_driver.c	2012-09-22 19:32:46.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 2008-2009,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 2008-2010,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -33,7 +33,7 @@
 
 #include <curses.priv.h>
 
-MODULE_ID("$Id: lib_driver.c,v 1.3 2010/12/20 00:29:17 tom Exp $")
+MODULE_ID("$Id: lib_driver.c,v 1.4 2012/09/22 19:32:46 tom Exp $")
 
 typedef struct DriverEntry {
     const char *name;
@@ -43,9 +43,9 @@
 static DRIVER_ENTRY DriverTable[] =
 {
 #ifdef __MINGW32__
-    {"win", &_nc_WIN_DRIVER},
+    {"win32con", &_nc_WIN_DRIVER},
 #endif
-    {"tinfo", &_nc_TINFO_DRIVER}
+    {"tinfo", &_nc_TINFO_DRIVER}	/* must be last */
 };
 
 NCURSES_EXPORT(int)
@@ -63,6 +63,20 @@
 
     for (i = 0; i < SIZEOF(DriverTable); i++) {
 	res = DriverTable[i].driver;
+	/*
+	 * Use "#" (a character which cannot begin a terminal's name) to
+	 * select specific driver from the table.
+	 *
+	 * In principle, we could have more than one non-terminfo driver,
+	 * e.g., "win32gui".
+	 */
+	if (name != 0 && *name == '#') {
+	    size_t n = strlen(name + 1);
+	    if (n != 0
+		&& strncmp(name + 1, DriverTable[i].name, n)) {
+		continue;
+	    }
+	}
 	if (res->CanHandle(TCB, name, errret)) {
 	    use = res;
 	    break;
Index: ncurses/base/lib_flash.c
Prereq:  1.11 
--- ncurses-5.9/ncurses/base/lib_flash.c	2009-10-24 22:02:14.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/base/lib_flash.c	2013-01-12 17:26:07.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2000,2009 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2011,2013 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -46,7 +46,7 @@
 #define CUR SP_TERMTYPE
 #endif
 
-MODULE_ID("$Id: lib_flash.c,v 1.11 2009/10/24 22:02:14 tom Exp $")
+MODULE_ID("$Id: lib_flash.c,v 1.13 2013/01/12 17:26:07 tom Exp $")
 
 /*
  *	flash()
@@ -66,15 +66,13 @@
     if (SP_PARM != 0)
 	res = CallDriver_1(SP_PARM, doBeepOrFlash, FALSE);
 #else
-    /* FIXME: should make sure that we are not in altchar mode */
-    if (flash_screen) {
-	TPUTS_TRACE("flash_screen");
-	res = putp(flash_screen);
-	_nc_flush();
-    } else if (bell) {
-	TPUTS_TRACE("bell");
-	res = putp(bell);
-	_nc_flush();
+    if (HasTerminal(SP_PARM)) {
+	/* FIXME: should make sure that we are not in altchar mode */
+	if (flash_screen) {
+	    res = NCURSES_PUTP2_FLUSH("flash_screen", flash_screen);
+	} else if (bell) {
+	    res = NCURSES_PUTP2_FLUSH("bell", bell);
+	}
     }
 #endif
     returnCode(res);
Index: ncurses/base/lib_freeall.c
Prereq:  1.59 
--- ncurses-5.9/ncurses/base/lib_freeall.c	2010-01-23 17:57:43.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/base/lib_freeall.c	2012-11-17 23:53:03.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -39,7 +39,7 @@
 extern int malloc_errfd;	/* FIXME */
 #endif
 
-MODULE_ID("$Id: lib_freeall.c,v 1.59 2010/01/23 17:57:43 tom Exp $")
+MODULE_ID("$Id: lib_freeall.c,v 1.62 2012/11/17 23:53:03 tom Exp $")
 
 /*
  * Free all ncurses data.  This is used for testing only (there's no practical
@@ -70,19 +70,21 @@
 
 	    /* Delete only windows that're not a parent */
 	    for (each_window(SP_PARM, p)) {
+		WINDOW *p_win = &(p->win);
 		bool found = FALSE;
 
 		for (each_window(SP_PARM, q)) {
+		    WINDOW *q_win = &(q->win);
 		    if ((p != q)
-			&& (q->win._flags & _SUBWIN)
-			&& (&(p->win) == q->win._parent)) {
+			&& (q_win->_flags & _SUBWIN)
+			&& (p_win == q_win->_parent)) {
 			found = TRUE;
 			break;
 		    }
 		}
 
 		if (!found) {
-		    if (delwin(&(p->win)) != ERR)
+		    if (delwin(p_win) != ERR)
 			deleted = TRUE;
 		    break;
 		}
@@ -100,7 +102,7 @@
 
     (void) _nc_printf_string(0, empty_va);
 #ifdef TRACE
-    (void) _nc_trace_buf(-1, 0);
+    (void) _nc_trace_buf(-1, (size_t) 0);
 #endif
 #if USE_WIDEC_SUPPORT
     FreeIfNeeded(_nc_wacs);
@@ -129,8 +131,9 @@
 NCURSES_EXPORT(void)
 NCURSES_SP_NAME(_nc_free_and_exit) (NCURSES_SP_DCLx int code)
 {
-    char *last_setbuf = (SP_PARM != 0) ? SP_PARM->_setbuf : 0;
+    char *last_buffer = (SP_PARM != 0) ? SP_PARM->out_buffer : 0;
 
+    NCURSES_SP_NAME(_nc_flush) (NCURSES_SP_ARG);
     NCURSES_SP_NAME(_nc_freeall) (NCURSES_SP_ARG);
 #ifdef TRACE
     trace(0);			/* close trace file, freeing its setbuf */
@@ -139,8 +142,7 @@
 	free(_nc_varargs("?", fake));
     }
 #endif
-    fclose(stdout);
-    FreeIfNeeded(last_setbuf);
+    FreeIfNeeded(last_buffer);
     exit(code);
 }
 
Index: ncurses/base/lib_getch.c
Prereq:  1.121 
--- ncurses-5.9/ncurses/base/lib_getch.c	2010-12-25 23:24:04.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/base/lib_getch.c	2013-02-16 18:30:37.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -42,7 +42,7 @@
 
 #include <curses.priv.h>
 
-MODULE_ID("$Id: lib_getch.c,v 1.121 2010/12/25 23:24:04 tom Exp $")
+MODULE_ID("$Id: lib_getch.c,v 1.126 2013/02/16 18:30:37 tom Exp $")
 
 #include <fifo_defs.h>
 
@@ -133,7 +133,7 @@
     int rc;
 
 #ifdef USE_TERM_DRIVER
-    rc = TCBOf(sp)->drv->testmouse(TCBOf(sp), delay);
+    rc = TCBOf(sp)->drv->testmouse(TCBOf(sp), delay EVENTLIST_2nd(evl));
 #else
 #if USE_SYSMOUSE
     if ((sp->_mouse_type == M_SYSMOUSE)
@@ -163,7 +163,7 @@
 static NCURSES_INLINE int
 fifo_peek(SCREEN *sp)
 {
-    int ch = sp->_fifo[peek];
+    int ch = (peek >= 0) ? sp->_fifo[peek] : ERR;
     TR(TRACE_IEVENT, ("peeking at %d", peek));
 
     p_inc();
@@ -173,15 +173,16 @@
 static NCURSES_INLINE int
 fifo_pull(SCREEN *sp)
 {
-    int ch;
-    ch = sp->_fifo[head];
+    int ch = (head >= 0) ? sp->_fifo[head] : ERR;
+
     TR(TRACE_IEVENT, ("pulling %s from %d", _nc_tracechar(sp, ch), head));
 
     if (peek == head) {
 	h_inc();
 	peek = head;
-    } else
+    } else {
 	h_inc();
+    }
 
 #ifdef TRACE
     if (USE_TRACEF(TRACE_IEVENT)) {
@@ -200,7 +201,7 @@
     int mask = 0;
 
     (void) mask;
-    if (tail == -1)
+    if (tail < 0)
 	return ERR;
 
 #ifdef HIDE_EINTR
@@ -257,6 +258,13 @@
 	n = 1;
     } else
 #endif
+#if USE_KLIBC_KBD
+    if (isatty(sp->_ifd) && sp->_cbreak) {
+	ch = _read_kbd(0, 1, !sp->_raw);
+	n = (ch == -1) ? -1 : 1;
+	sp->_extended_key = (ch == 0);
+    } else
+#endif
     {				/* Can block... */
 #ifdef USE_TERM_DRIVER
 	int buf;
@@ -270,7 +278,7 @@
 #  endif
 	    _nc_globals.read_thread = pthread_self();
 # endif
-	n = (int) read(sp->_ifd, &c2, 1);
+	n = (int) read(sp->_ifd, &c2, (size_t) 1);
 #if USE_PTHREADS_EINTR
 	_nc_globals.read_thread = 0;
 #endif
@@ -431,11 +439,11 @@
 	/* ungetch in reverse order */
 #ifdef NCURSES_WGETCH_EVENTS
 	rc = recur_wgetnstr(win, buf);
-	if (rc != KEY_EVENT)
+	if (rc != KEY_EVENT && rc != ERR)
 	    safe_ungetch(sp, '\n');
 #else
-	(void) recur_wgetnstr(win, buf);
-	safe_ungetch(sp, '\n');
+	if (recur_wgetnstr(win, buf) != ERR)
+	    safe_ungetch(sp, '\n');
 #endif
 	for (bufp = buf + strlen(buf); bufp > buf; bufp--)
 	    safe_ungetch(sp, bufp[-1]);
@@ -569,7 +577,7 @@
      *
      * If carriage return is defined as a function key in the
      * terminfo, e.g., kent, then Solaris may return either ^J (or ^M
-     * if nonl() is set) or KEY_ENTER depending on the echo() mode. 
+     * if nonl() is set) or KEY_ENTER depending on the echo() mode.
      * We echo before translating carriage return based on nonl(),
      * since the visual result simply moves the cursor to column 0.
      *
@@ -709,10 +717,11 @@
 
 	if (ptr->value != 0) {	/* sequence terminated */
 	    TR(TRACE_IEVENT, ("end of sequence"));
-	    if (peek == tail)
+	    if (peek == tail) {
 		fifo_clear(sp);
-	    else
+	    } else {
 		head = peek;
+	    }
 	    return (ptr->value);
 	}
 
Index: ncurses/base/lib_getstr.c
Prereq:  1.29 
--- ncurses-5.9/ncurses/base/lib_getstr.c	2009-10-24 21:59:02.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/base/lib_getstr.c	2011-10-22 16:31:35.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2008,2009 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2009,2011 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -40,14 +40,14 @@
 
 #include <curses.priv.h>
 
-MODULE_ID("$Id: lib_getstr.c,v 1.29 2009/10/24 21:59:02 tom Exp $")
+MODULE_ID("$Id: lib_getstr.c,v 1.30 2011/10/22 16:31:35 tom Exp $")
 
 /*
  * This wipes out the last character, no matter whether it was a tab, control
  * or other character, and handles reverse wraparound.
  */
 static char *
-WipeOut(WINDOW *win, int y, int x, char *first, char *last, bool echoed)
+WipeOut(WINDOW *win, int y, int x, char *first, char *last, int echoed)
 {
     if (last > first) {
 	*--last = '\0';
Index: ncurses/base/lib_insch.c
Prereq:  1.32 
--- ncurses-5.9/ncurses/base/lib_insch.c	2009-10-24 22:04:35.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/base/lib_insch.c	2012-12-15 22:51:12.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2008,2009 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2009,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -43,7 +43,7 @@
 #include <curses.priv.h>
 #include <ctype.h>
 
-MODULE_ID("$Id: lib_insch.c,v 1.32 2009/10/24 22:04:35 tom Exp $")
+MODULE_ID("$Id: lib_insch.c,v 1.33 2012/12/15 22:51:12 tom Exp $")
 
 /*
  * Insert the given character, updating the current location to simplify
@@ -82,7 +82,7 @@
 #if USE_WIDEC_SUPPORT
 	       WINDOW_EXT(win, addch_used) == 0 &&
 #endif
-	       is8bits(ChCharOf(ch)) &&
+	       is8bits(ch) &&
 	       (isprint(ChCharOf(ch)) ||
 		(ChAttrOf(ch) & A_ALTCHARSET) ||
 		(sp != 0 && sp->_legacy_coding && !iscntrl(ChCharOf(ch))))) {
@@ -101,7 +101,7 @@
 		*temp1 = _nc_render(win, wch);
 		win->_curx++;
 	    }
-	} else if (is8bits(ChCharOf(ch)) && iscntrl(ChCharOf(ch))) {
+	} else if (is8bits(ch) && iscntrl(ChCharOf(ch))) {
 	    s = NCURSES_SP_NAME(unctrl) (NCURSES_SP_ARGx ChCharOf(ch));
 	    while (*s != '\0') {
 		code = _nc_insert_ch(sp, win, ChAttrOf(ch) | UChar(*s));
Index: ncurses/base/lib_instr.c
Prereq:  1.17 
--- ncurses-5.9/ncurses/base/lib_instr.c	2009-10-24 22:55:45.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/base/lib_instr.c	2013-01-20 01:58:13.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2007,2009 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2011,2013 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -41,7 +41,7 @@
 
 #include <curses.priv.h>
 
-MODULE_ID("$Id: lib_instr.c,v 1.17 2009/10/24 22:55:45 tom Exp $")
+MODULE_ID("$Id: lib_instr.c,v 1.20 2013/01/20 01:58:13 tom Exp $")
 
 NCURSES_EXPORT(int)
 winnstr(WINDOW *win, char *str, int n)
@@ -78,11 +78,15 @@
 		    if (getcchar(cell, wch, &attrs, &pair, 0) == OK) {
 
 			init_mb(state);
-			n3 = wcstombs(0, wch, 0);
+			n3 = wcstombs(0, wch, (size_t) 0);
 			if (!isEILSEQ(n3) && (n3 != 0)) {
-			    if (((int) n3 + i) > n) {
+			    size_t need = n3 + 10 + (size_t) i;
+			    int have = (int) n3 + i;
+
+			    /* check for loop-done as well as overflow */
+			    if (have > n || (int) need <= 0) {
 				done = TRUE;
-			    } else if ((tmp = typeCalloc(char, n3 + 10)) == 0) {
+			    } else if ((tmp = typeCalloc(char, need)) == 0) {
 				done = TRUE;
 			    } else {
 				init_mb(state);
Index: ncurses/base/lib_mouse.c
Prereq:  1.121 
--- ncurses-5.9/ncurses/base/lib_mouse.c	2011-01-22 19:47:47.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/base/lib_mouse.c	2013-01-12 16:35:34.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2010,2011 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -84,7 +84,7 @@
 #define CUR SP_TERMTYPE
 #endif
 
-MODULE_ID("$Id: lib_mouse.c,v 1.121 2011/01/22 19:47:47 tom Exp $")
+MODULE_ID("$Id: lib_mouse.c,v 1.140 2013/01/12 16:35:34 tom Exp $")
 
 #include <tic.h>
 
@@ -120,6 +120,17 @@
 #endif
 #endif				/* use_SYSMOUSE */
 
+#if USE_KLIBC_MOUSE
+#include <sys/socket.h>
+#define pipe(handles) socketpair(AF_LOCAL, SOCK_STREAM, 0, handles)
+#define DosWrite(hfile, pbuffer, cbwrite, pcbactual) \
+		write(hfile, pbuffer, cbwrite)
+#define DosExit(action, result )	/* do nothing */
+#define DosCreateThread(ptid, pfn, param, flag, cbStack) \
+		(*(ptid) = _beginthread(pfn, NULL, cbStack, \
+					(void *)param), (*(ptid) == -1))
+#endif
+
 #define MY_TRACE TRACE_ICALLS|TRACE_IEVENT
 
 #define	MASK_RELEASE(x)		(mmask_t) NCURSES_MOUSE_MASK(x, 001)
@@ -148,6 +159,9 @@
 #define INVALID_EVENT	-1
 #define NORMAL_EVENT	0
 
+#define ValidEvent(ep) ((ep)->id != INVALID_EVENT)
+#define Invalidate(ep) (ep)->id = INVALID_EVENT
+
 #if USE_GPM_SUPPORT
 
 #ifndef LIBGPM_SONAME
@@ -211,7 +225,7 @@
     char buf[6];
     unsigned long ignore;
 
-    strncpy(buf, key_mouse, 3);	/* should be "\033[M" */
+    strcpy(buf, "\033[M");	/* should be the same as key_mouse */
     buf[3] = ' ' + (button - 1) + (down ? 0 : 0x40);
     buf[4] = ' ' + x - LEFT_COL + 1;
     buf[5] = ' ' + y - TOP_ROW + 1;
@@ -219,7 +233,11 @@
 }
 
 static void
+#if USE_KLIBC_MOUSE
+mouse_server(void *param)
+#else
 mouse_server(unsigned long param)
+#endif
 {
     SCREEN *sp = (SCREEN *) param;
     unsigned short fWait = MOU_WAIT;
@@ -245,7 +263,8 @@
 		/* sit and wait on the event queue */
 		rc = MouReadEventQue(&mouev, &fWait, hmou);
 		if (rc) {
-		    sprintf(err, "Error reading mouse queue, rc=%lu.\r\n", rc);
+		    _nc_SPRINTF(err, _nc_SLIMIT(sizeof(err))
+				"Error reading mouse queue, rc=%lu.\r\n", rc);
 		    break;
 		}
 		if (!sp->_emxmouse_activated)
@@ -271,9 +290,11 @@
 	      finish:
 		oldstate = mouev.fs;
 	    }
-	} else
-	    sprintf(err, "Error setting event mask, buttons=%d, rc=%lu.\r\n",
-		    nbuttons, rc);
+	} else {
+	    _nc_SPRINTF(err, _nc_SLIMIT(sizeof(err))
+			"Error setting event mask, buttons=%d, rc=%lu.\r\n",
+			nbuttons, rc);
+	}
 
 	DosWrite(2, err, strlen(err), &rc);
 	MouClose(hmou);
@@ -367,20 +388,26 @@
 #if USE_EMX_MOUSE
     sp->_emxmouse_activated = enable;
 #else
-    NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx
-			       "xterm-mouse",
-			       TPARM_1(sp->_mouse_xtermcap, enable));
+    NCURSES_PUTP2("xterm-mouse", TPARM_1(sp->_mouse_xtermcap, enable));
 #endif
     sp->_mouse_active = enable;
 }
 
 #if USE_GPM_SUPPORT
 static bool
-allow_gpm_mouse(void)
+allow_gpm_mouse(SCREEN *sp)
 {
     bool result = FALSE;
 
-    /* GPM does printf's without checking if stdout is a terminal */
+#if USE_WEAK_SYMBOLS
+    /* Danger Robinson: do not use dlopen for libgpm if already loaded */
+    if ((Gpm_Wgetch)) {
+	if (!sp->_mouse_gpm_loaded) {
+	    T(("GPM library was already dlopen'd, not by us"));
+	}
+    } else
+#endif
+	/* GPM does printf's without checking if stdout is a terminal */
     if (isatty(fileno(stdout))) {
 	char *list = getenv("NCURSES_GPM_TERMS");
 	char *env = getenv("TERM");
@@ -506,7 +533,7 @@
 
     /* Try gpm first, because gpm may be configured to run in xterm */
 #if USE_GPM_SUPPORT
-    if (allow_gpm_mouse()) {
+    if (allow_gpm_mouse(sp)) {
 	if (!sp->_mouse_gpm_loaded) {
 #ifdef HAVE_LIBDL
 	    load_gpm_library(sp);
@@ -673,7 +700,7 @@
 
 	    sp->_mouse_eventp = FirstEV(sp);
 	    for (i = 0; i < EV_MAX; i++)
-		sp->_mouse_events[i].id = INVALID_EVENT;
+		Invalidate(sp->_mouse_events + i);
 
 	    initialize_mousetype(sp);
 
@@ -750,6 +777,7 @@
 			eventp->bstate |= BUTTON3_RELEASED;
 		    break;
 		default:
+		    eventp->bstate |= REPORT_MOUSE_POSITION;
 		    break;
 		}
 
@@ -830,7 +858,6 @@
 
     if (sp->_mouse_type == M_XTERM) {
 	unsigned char kbuf[4];
-	mmask_t prev;
 	size_t grabbed;
 	int res;
 
@@ -896,35 +923,51 @@
 
 	/* processing code goes here */
 	eventp->bstate = 0;
-	prev = PREV(eventp)->bstate;
 
 #if USE_EMX_MOUSE
 #define PRESS_POSITION(n) \
-	eventp->bstate = MASK_PRESS(n); \
-	if (kbuf[0] & 0x40) \
-	    eventp->bstate = MASK_RELEASE(n)
+	do { \
+		eventp->bstate = MASK_PRESS(n); \
+		sp->_mouse_bstate |= MASK_PRESS(n); \
+		if (kbuf[0] & 0x40) { \
+			eventp->bstate = MASK_RELEASE(n); \
+			sp->_mouse_bstate &= ~MASK_PRESS(n); \
+		} \
+	} while (0)
 #else
 #define PRESS_POSITION(n) \
-	eventp->bstate = (mmask_t) (prev & MASK_PRESS(n) \
-				    ? REPORT_MOUSE_POSITION \
-				    : MASK_PRESS(n))
+	do { \
+		eventp->bstate = (mmask_t) (sp->_mouse_bstate & MASK_PRESS(n) \
+					? REPORT_MOUSE_POSITION \
+					: MASK_PRESS(n)); \
+		sp->_mouse_bstate |= MASK_PRESS(n); \
+	} while (0)
 #endif
 
 	switch (kbuf[0] & 0x3) {
 	case 0x0:
-	    if (kbuf[0] & 64)
+	    if ((kbuf[0] & 96) == 96) {
 		eventp->bstate = MASK_PRESS(4);
-	    else
+		/* Do not record in sp->_mouse_bstate; there will be no
+		 * corresponding release event.
+		 */
+	    } else {
 		PRESS_POSITION(1);
+	    }
 	    break;
 
 	case 0x1:
+	    if ((kbuf[0] & 96) == 96) {
 #if NCURSES_MOUSE_VERSION == 2
-	    if (kbuf[0] & 64)
 		eventp->bstate = MASK_PRESS(5);
-	    else
+		/* See comment above for button 4 */
+#else
+		/* Ignore this event as it is not a true press of the button */
+		eventp->bstate = REPORT_MOUSE_POSITION;
 #endif
+	    } else {
 		PRESS_POSITION(2);
+	    }
 	    break;
 
 	case 0x2:
@@ -939,12 +982,13 @@
 	     * release, we can infer the button actually released by looking at
 	     * the previous event.
 	     */
-	    if (prev & (BUTTON_PRESSED | BUTTON_RELEASED)) {
+	    if (sp->_mouse_bstate & BUTTON_PRESSED) {
 		eventp->bstate = BUTTON_RELEASED;
 		for (b = 1; b <= MAX_BUTTONS; ++b) {
-		    if (!(prev & MASK_PRESS(b)))
+		    if (!(sp->_mouse_bstate & MASK_PRESS(b)))
 			eventp->bstate &= ~MASK_RELEASE(b);
 		}
+		sp->_mouse_bstate = 0;
 	    } else {
 		/*
 		 * XFree86 xterm will return a stream of release-events to
@@ -985,7 +1029,7 @@
 }
 
 static void
-mouse_activate(SCREEN *sp, bool on)
+mouse_activate(SCREEN *sp, int on)
 {
     if (!on && !sp->_mouse_initialized)
 	return;
@@ -994,7 +1038,7 @@
 	return;
 
     if (on) {
-
+	sp->_mouse_bstate = 0;
 	switch (sp->_mouse_type) {
 	case M_XTERM:
 #if NCURSES_EXT_FUNCS
@@ -1074,10 +1118,13 @@
 /* parse a run of atomic mouse events into a gesture */
 {
     MEVENT *eventp = sp->_mouse_eventp;
-    MEVENT *ep, *runp, *next, *prev = PREV(eventp);
+    MEVENT *next, *ep;
+    MEVENT *first_valid = NULL;
+    MEVENT *first_invalid = NULL;
     int n;
     int b;
     bool merge;
+    bool endLoop;
 
     TR(MY_TRACE, ("_nc_mouse_parse(%d) called", runcount));
 
@@ -1094,7 +1141,8 @@
      *
      * It's possible that the run may not resolve to a single event (for
      * example, if the user quadruple-clicks).  If so, leading events
-     * in the run are ignored.
+     * in the run are ignored if user does not call getmouse in a loop (getting
+     * them from newest to older).
      *
      * Note that this routine is independent of the format of the specific
      * format of the pointing-device's reports.  We can use it to parse
@@ -1102,79 +1150,110 @@
      * button basis, as long as the device-dependent mouse code puts stuff
      * on the queue in MEVENT format.
      */
-    if (runcount == 1) {
-	TR(MY_TRACE,
-	   ("_nc_mouse_parse: returning simple mouse event %s at slot %ld",
-	    _nc_tracemouse(sp, prev),
-	    (long) IndexEV(sp, prev)));
-	return (prev->id >= NORMAL_EVENT)
-	    ? ((prev->bstate & sp->_mouse_mask) ? TRUE : FALSE)
-	    : FALSE;
-    }
 
-    /* find the start of the run */
-    runp = eventp;
-    for (n = runcount; n > 0; n--) {
-	runp = PREV(runp);
+    /*
+     * Reset all events that were not set, in case the user sometimes calls
+     * getmouse only once and other times until there are no more events in
+     * queue.
+     *
+     * This also allows reaching the beginning of the run.
+     */
+    ep = eventp;
+    for (n = runcount; n < EV_MAX; n++) {
+	Invalidate(ep);
+	ep = NEXT(ep);
     }
 
 #ifdef TRACE
     if (USE_TRACEF(TRACE_IEVENT)) {
 	_trace_slot(sp, "before mouse press/release merge:");
 	_tracef("_nc_mouse_parse: run starts at %ld, ends at %ld, count %d",
-		RunParams(sp, eventp, runp),
+		RunParams(sp, eventp, ep),
 		runcount);
 	_nc_unlock_global(tracef);
     }
 #endif /* TRACE */
 
     /* first pass; merge press/release pairs */
-    do {
-	merge = FALSE;
-	for (ep = runp; (next = NEXT(ep)) != eventp; ep = next) {
+    endLoop = FALSE;
+    while (!endLoop) {
+	next = NEXT(ep);
+	if (next == eventp) {
+	    /* Will end the loop, but compact before */
+	    endLoop = TRUE;
+	} else {
 
 #define MASK_CHANGED(x) (!(ep->bstate & MASK_PRESS(x)) \
 		      == !(next->bstate & MASK_RELEASE(x)))
 
-	    if (ep->x == next->x && ep->y == next->y
+	    if (ValidEvent(ep) && ValidEvent(next)
+		&& ep->x == next->x && ep->y == next->y
 		&& (ep->bstate & BUTTON_PRESSED)
-		&& MASK_CHANGED(1)
-		&& MASK_CHANGED(2)
-		&& MASK_CHANGED(3)
-		&& MASK_CHANGED(4)
-#if NCURSES_MOUSE_VERSION == 2
-		&& MASK_CHANGED(5)
-#endif
-		) {
+		&& (!(next->bstate & BUTTON_PRESSED))) {
+		bool changed = TRUE;
+
 		for (b = 1; b <= MAX_BUTTONS; ++b) {
-		    if ((sp->_mouse_mask & MASK_CLICK(b))
-			&& (ep->bstate & MASK_PRESS(b))) {
-			ep->bstate &= ~MASK_PRESS(b);
-			ep->bstate |= MASK_CLICK(b);
-			merge = TRUE;
+		    if (!MASK_CHANGED(b)) {
+			changed = FALSE;
+			break;
+		    }
+		}
+
+		if (changed) {
+		    merge = FALSE;
+		    for (b = 1; b <= MAX_BUTTONS; ++b) {
+			if ((sp->_mouse_mask & MASK_CLICK(b))
+			    && (ep->bstate & MASK_PRESS(b))) {
+			    next->bstate &= ~MASK_RELEASE(b);
+			    next->bstate |= MASK_CLICK(b);
+			    merge = TRUE;
+			}
+		    }
+		    if (merge) {
+			Invalidate(ep);
 		    }
 		}
-		if (merge)
-		    next->id = INVALID_EVENT;
 	    }
 	}
-    } while
-	(merge);
 
+	/* Compact valid events */
+	if (!ValidEvent(ep)) {
+	    if ((first_valid != NULL) && (first_invalid == NULL)) {
+		first_invalid = ep;
+	    }
+	} else {
+	    if (first_valid == NULL) {
+		first_valid = ep;
+	    } else if (first_invalid != NULL) {
+		*first_invalid = *ep;
+		Invalidate(ep);
+		first_invalid = NEXT(first_invalid);
+	    }
+	}
+
+	ep = next;
+    }
+
+    if (first_invalid != NULL) {
+	eventp = first_invalid;
+    }
 #ifdef TRACE
     if (USE_TRACEF(TRACE_IEVENT)) {
 	_trace_slot(sp, "before mouse click merge:");
-	_tracef("_nc_mouse_parse: run starts at %ld, ends at %ld, count %d",
-		RunParams(sp, eventp, runp),
-		runcount);
-	_nc_unlock_global(tracef);
+	if (first_valid == NULL) {
+	    _tracef("_nc_mouse_parse: no valid event");
+	} else {
+	    _tracef("_nc_mouse_parse: run starts at %ld, ends at %ld, count %d",
+		    RunParams(sp, eventp, first_valid),
+		    runcount);
+	    _nc_unlock_global(tracef);
+	}
     }
 #endif /* TRACE */
 
     /*
-     * Second pass; merge click runs.  At this point, click events are
-     * each followed by one invalid event. We merge click events
-     * forward in the queue.
+     * Second pass; merge click runs.  We merge click events forward in the
+     * queue.  For example, double click can be changed to triple click.
      *
      * NOTE: There is a problem with this design!  If the application
      * allows enough click events to pile up in the circular queue so
@@ -1187,87 +1266,102 @@
      * but the timer element would have to have sub-second resolution,
      * which would get us into portability trouble.
      */
-    do {
-	MEVENT *follower;
-
-	merge = FALSE;
-	for (ep = runp; (next = NEXT(ep)) != eventp; ep = next)
-	    if (ep->id != INVALID_EVENT) {
-		if (next->id != INVALID_EVENT)
-		    continue;
-		follower = NEXT(next);
-		if (follower->id == INVALID_EVENT)
-		    continue;
-
-		/* merge click events forward */
-		if ((ep->bstate & BUTTON_CLICKED)
-		    && (follower->bstate & BUTTON_CLICKED)) {
-		    for (b = 1; b <= MAX_BUTTONS; ++b) {
-			if ((sp->_mouse_mask & MASK_DOUBLE_CLICK(b))
-			    && (follower->bstate & MASK_CLICK(b))) {
-			    follower->bstate &= ~MASK_CLICK(b);
-			    follower->bstate |= MASK_DOUBLE_CLICK(b);
-			    merge = TRUE;
-			}
+    first_invalid = NULL;
+    endLoop = (first_valid == NULL);
+    ep = first_valid;
+    while (!endLoop) {
+	next = NEXT(ep);
+
+	if (next == eventp) {
+	    /* Will end the loop, but check event type and compact before */
+	    endLoop = TRUE;
+	} else if (!ValidEvent(next)) {
+	    continue;
+	} else {
+	    /* merge click events forward */
+	    if ((ep->bstate & BUTTON_CLICKED)
+		&& (next->bstate & BUTTON_CLICKED)) {
+		merge = FALSE;
+		for (b = 1; b <= MAX_BUTTONS; ++b) {
+		    if ((sp->_mouse_mask & MASK_DOUBLE_CLICK(b))
+			&& (ep->bstate & MASK_CLICK(b))
+			&& (next->bstate & MASK_CLICK(b))) {
+			next->bstate &= ~MASK_CLICK(b);
+			next->bstate |= MASK_DOUBLE_CLICK(b);
+			merge = TRUE;
 		    }
-		    if (merge)
-			ep->id = INVALID_EVENT;
 		}
+		if (merge) {
+		    Invalidate(ep);
+		}
+	    }
 
-		/* merge double-click events forward */
-		if ((ep->bstate & BUTTON_DOUBLE_CLICKED)
-		    && (follower->bstate & BUTTON_CLICKED)) {
-		    for (b = 1; b <= MAX_BUTTONS; ++b) {
-			if ((sp->_mouse_mask & MASK_TRIPLE_CLICK(b))
-			    && (follower->bstate & MASK_CLICK(b))) {
-			    follower->bstate &= ~MASK_CLICK(b);
-			    follower->bstate |= MASK_TRIPLE_CLICK(b);
-			    merge = TRUE;
-			}
+	    /* merge double-click events forward */
+	    if ((ep->bstate & BUTTON_DOUBLE_CLICKED)
+		&& (next->bstate & BUTTON_CLICKED)) {
+		merge = FALSE;
+		for (b = 1; b <= MAX_BUTTONS; ++b) {
+		    if ((sp->_mouse_mask & MASK_TRIPLE_CLICK(b))
+			&& (ep->bstate & MASK_DOUBLE_CLICK(b))
+			&& (next->bstate & MASK_CLICK(b))) {
+			next->bstate &= ~MASK_CLICK(b);
+			next->bstate |= MASK_TRIPLE_CLICK(b);
+			merge = TRUE;
 		    }
-		    if (merge)
-			ep->id = INVALID_EVENT;
+		}
+		if (merge) {
+		    Invalidate(ep);
 		}
 	    }
-    } while
-	(merge);
+	}
 
-#ifdef TRACE
-    if (USE_TRACEF(TRACE_IEVENT)) {
-	_trace_slot(sp, "before mouse event queue compaction:");
-	_tracef("_nc_mouse_parse: run starts at %ld, ends at %ld, count %d",
-		RunParams(sp, eventp, runp),
-		runcount);
-	_nc_unlock_global(tracef);
-    }
-#endif /* TRACE */
+	/* Discard event if it does not match event mask */
+	if (!(ep->bstate & sp->_mouse_mask2)) {
+	    Invalidate(ep);
+	}
 
-    /*
-     * Now try to throw away trailing events flagged invalid, or that
-     * don't match the current event mask.
-     */
-    for (; runcount; prev = PREV(eventp), runcount--)
-	if (prev->id == INVALID_EVENT || !(prev->bstate & sp->_mouse_mask)) {
-	    sp->_mouse_eventp = eventp = prev;
+	/* Compact valid events */
+	if (!ValidEvent(ep)) {
+	    if (ep == first_valid) {
+		first_valid = next;
+	    } else if (first_invalid == NULL) {
+		first_invalid = ep;
+	    }
+	} else if (first_invalid != NULL) {
+	    *first_invalid = *ep;
+	    Invalidate(ep);
+	    first_invalid = NEXT(first_invalid);
 	}
+
+	ep = next;
+    }
+
+    if (first_invalid == NULL) {
+	first_invalid = eventp;
+    }
+    sp->_mouse_eventp = first_invalid;
+
 #ifdef TRACE
-    if (USE_TRACEF(TRACE_IEVENT)) {
-	_trace_slot(sp, "after mouse event queue compaction:");
-	_tracef("_nc_mouse_parse: run starts at %ld, ends at %ld, count %d",
-		RunParams(sp, eventp, runp),
-		runcount);
-	_nc_unlock_global(tracef);
+    if (first_valid != NULL) {
+	if (USE_TRACEF(TRACE_IEVENT)) {
+	    _trace_slot(sp, "after mouse event queue compaction:");
+	    _tracef("_nc_mouse_parse: run starts at %ld, ends at %ld, count %d",
+		    RunParams(sp, first_invalid, first_valid),
+		    runcount);
+	    _nc_unlock_global(tracef);
+	}
+	for (ep = first_valid; ep != first_invalid; ep = NEXT(ep)) {
+	    if (ValidEvent(ep))
+		TR(MY_TRACE,
+		   ("_nc_mouse_parse: returning composite mouse event %s at slot %ld",
+		    _nc_tracemouse(sp, ep),
+		    (long) IndexEV(sp, ep)));
+	}
     }
-    for (ep = runp; ep != eventp; ep = NEXT(ep))
-	if (ep->id != INVALID_EVENT)
-	    TR(MY_TRACE,
-	       ("_nc_mouse_parse: returning composite mouse event %s at slot %ld",
-		_nc_tracemouse(sp, ep),
-		(long) IndexEV(sp, ep)));
 #endif /* TRACE */
 
     /* after all this, do we have a valid event? */
-    return (PREV(eventp)->id != INVALID_EVENT);
+    return ValidEvent(PREV(first_invalid));
 }
 
 static void
@@ -1359,7 +1453,16 @@
 	/* compute the current-event pointer */
 	MEVENT *prev = PREV(eventp);
 
-	if (prev->id != INVALID_EVENT) {
+	/*
+	 * Discard events not matching mask (there could be still some if
+	 * _nc_mouse_parse was not called, e.g., when _nc_mouse_inline returns
+	 * false).
+	 */
+	while (ValidEvent(prev) && (!(prev->bstate & SP_PARM->_mouse_mask2))) {
+	    Invalidate(prev);
+	    prev = PREV(prev);
+	}
+	if (ValidEvent(prev)) {
 	    /* copy the event we find there */
 	    *aevent = *prev;
 
@@ -1367,9 +1470,16 @@
 			      _nc_tracemouse(SP_PARM, prev),
 			      (long) IndexEV(SP_PARM, prev)));
 
-	    prev->id = INVALID_EVENT;	/* so the queue slot becomes free */
-	    SP_PARM->_mouse_eventp = PREV(prev);
+	    Invalidate(prev);	/* so the queue slot becomes free */
+	    SP_PARM->_mouse_eventp = prev;
 	    result = OK;
+	} else {
+	    /* Reset the provided event */
+	    aevent->bstate = 0;
+	    Invalidate(aevent);
+	    aevent->x = 0;
+	    aevent->y = 0;
+	    aevent->z = 0;
 	}
     }
     returnCode(result);
@@ -1420,6 +1530,7 @@
 /* set the mouse event mask */
 {
     mmask_t result = 0;
+    int b;
 
     T((T_CALLED("mousemask(%p,%#lx,%p)"),
        (void *) SP_PARM,
@@ -1447,6 +1558,22 @@
 		mouse_activate(SP_PARM, (bool) (result != 0));
 
 		SP_PARM->_mouse_mask = result;
+		SP_PARM->_mouse_mask2 = result;
+
+		/*
+		 * Make a mask corresponding to the states we will need to
+		 * retain (temporarily) while building up the state that the
+		 * user asked for.
+		 */
+		for (b = 1; b <= MAX_BUTTONS; ++b) {
+		    if (SP_PARM->_mouse_mask2 & MASK_TRIPLE_CLICK(b))
+			SP_PARM->_mouse_mask2 |= MASK_DOUBLE_CLICK(b);
+		    if (SP_PARM->_mouse_mask2 & MASK_DOUBLE_CLICK(b))
+			SP_PARM->_mouse_mask2 |= MASK_CLICK(b);
+		    if (SP_PARM->_mouse_mask2 & MASK_CLICK(b))
+			SP_PARM->_mouse_mask2 |= (MASK_PRESS(b) |
+						  MASK_RELEASE(b));
+		}
 	    }
 	}
     }
Index: ncurses/base/lib_newterm.c
Prereq:  1.86 
--- ncurses-5.9/ncurses/base/lib_newterm.c	2010-05-20 23:25:18.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/base/lib_newterm.c	2012-01-21 19:21:29.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -42,17 +42,13 @@
 
 #include <curses.priv.h>
 
-#if SVR4_TERMIO && !defined(_POSIX_SOURCE)
-#define _POSIX_SOURCE
-#endif
-
 #ifndef CUR
 #define CUR SP_TERMTYPE
 #endif
 
 #include <tic.h>
 
-MODULE_ID("$Id: lib_newterm.c,v 1.86 2010/05/20 23:25:18 tom Exp $")
+MODULE_ID("$Id: lib_newterm.c,v 1.88 2012/01/21 19:21:29 KO.Myung-Hun Exp $")
 
 #ifdef USE_TERM_DRIVER
 #define NumLabels      InfoOf(SP_PARM).numlabels
@@ -283,7 +279,8 @@
 	    NCURSES_SP_NAME(typeahead) (NCURSES_SP_ARGx fileno(_ifp));
 #ifdef TERMIOS
 	    SP_PARM->_use_meta = ((new_term->Ottyb.c_cflag & CSIZE) == CS8 &&
-				  !(new_term->Ottyb.c_iflag & ISTRIP));
+				  !(new_term->Ottyb.c_iflag & ISTRIP)) ||
+		USE_KLIBC_KBD;
 #else
 	    SP_PARM->_use_meta = FALSE;
 #endif
Index: ncurses/base/lib_newwin.c
Prereq:  1.69 
--- ncurses-5.9/ncurses/base/lib_newwin.c	2011-03-07 21:58:17.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/base/lib_newwin.c	2011-05-28 21:32:51.000000000 +0000
@@ -43,7 +43,7 @@
 #include <curses.priv.h>
 #include <stddef.h>
 
-MODULE_ID("$Id: lib_newwin.c,v 1.69 2011/03/07 21:58:17 tom Exp $")
+MODULE_ID("$Id: lib_newwin.c,v 1.71 2011/05/28 21:32:51 tom Exp $")
 
 #define window_is(name) ((sp)->_##name == win)
 
@@ -141,7 +141,11 @@
     T((T_CALLED("newwin(%p, %d,%d,%d,%d)"), (void *) SP_PARM, num_lines, num_columns,
        begy, begx));
 
-    if (begy < 0 || begx < 0 || num_lines < 0 || num_columns < 0)
+    if (begy < 0
+	|| begx < 0
+	|| num_lines < 0
+	|| num_columns < 0
+	|| SP_PARM == 0)
 	returnWin(0);
 
     if (num_lines == 0)
@@ -235,10 +239,15 @@
 NCURSES_EXPORT(WINDOW *)
 subwin(WINDOW *w, int l, int c, int y, int x)
 {
+    WINDOW *result = 0;
+
     T((T_CALLED("subwin(%p, %d, %d, %d, %d)"), (void *) w, l, c, y, x));
-    T(("parent has begy = %ld, begx = %ld", (long) w->_begy, (long) w->_begx));
+    if (w != 0) {
+	T(("parent has begy = %ld, begx = %ld", (long) w->_begy, (long) w->_begx));
 
-    returnWin(derwin(w, l, c, y - w->_begy, x - w->_begx));
+	result = derwin(w, l, c, y - w->_begy, x - w->_begx);
+    }
+    returnWin(result);
 }
 
 static bool
Index: ncurses/base/lib_overlay.c
Prereq:  1.29 
--- ncurses-5.9/ncurses/base/lib_overlay.c	2009-10-24 23:21:31.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/base/lib_overlay.c	2013-04-06 23:47:13.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2008,2009 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2009,2013 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -40,7 +40,7 @@
 
 #include <curses.priv.h>
 
-MODULE_ID("$Id: lib_overlay.c,v 1.29 2009/10/24 23:21:31 tom Exp $")
+MODULE_ID("$Id: lib_overlay.c,v 1.31 2013/04/06 23:47:13 tom Exp $")
 
 static int
 overlap(const WINDOW *const src, WINDOW *const dst, int const flag)
@@ -151,7 +151,10 @@
        dminrow, dmincol,
        dmaxrow, dmaxcol, over));
 
-    if (src && dst) {
+    if (src != 0
+	&& dst != 0
+	&& dmaxrow >= dminrow
+	&& dmaxcol >= dmincol) {
 	_nc_lock_global(curses);
 
 	bk = AttrOf(dst->_nc_bkgd);
@@ -160,6 +163,7 @@
 	/* make sure rectangle exists in source */
 	if ((sminrow + dmaxrow - dminrow) <= (src->_maxy + 1) &&
 	    (smincol + dmaxcol - dmincol) <= (src->_maxx + 1)) {
+	    bool copied = FALSE;
 
 	    T(("rectangle exists in source"));
 
@@ -172,10 +176,18 @@
 		     dy <= dmaxrow;
 		     sy++, dy++) {
 
+		    if (dy < 0 || sy < 0)
+			continue;
+
 		    touched = FALSE;
 		    for (dx = dmincol, sx = smincol;
 			 dx <= dmaxcol;
 			 sx++, dx++) {
+
+			if (dx < 0 || sx < 0)
+			    continue;
+			copied = TRUE;
+
 			if (over) {
 			    if ((CharOf(src->_line[sy].text[sx]) != L(' ')) &&
 				(!CharEq(dst->_line[dy].text[dx],
@@ -201,7 +213,8 @@
 		    }
 		}
 		T(("finished copywin"));
-		rc = OK;
+		if (copied)
+		    rc = OK;
 	    }
 	}
 	_nc_unlock_global(curses);
Index: ncurses/base/lib_printw.c
Prereq:  1.20 
--- ncurses-5.9/ncurses/base/lib_printw.c	2009-10-24 22:07:03.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/base/lib_printw.c	2012-09-03 17:55:28.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2005,2009 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2009,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -27,7 +27,7 @@
  ****************************************************************************/
 
 /****************************************************************************
- *  Author: Thomas E. Dickey <dickey@clark.net> 1997                        *
+ *  Author: Thomas E. Dickey            1997-on                             *
  ****************************************************************************/
 
 /*
@@ -39,7 +39,7 @@
 
 #include <curses.priv.h>
 
-MODULE_ID("$Id: lib_printw.c,v 1.20 2009/10/24 22:07:03 tom Exp $")
+MODULE_ID("$Id: lib_printw.c,v 1.23 2012/09/03 17:55:28 tom Exp $")
 
 NCURSES_EXPORT(int)
 printw(const char *fmt,...)
@@ -48,10 +48,11 @@
     int code;
 
 #ifdef TRACE
-    va_start(argp, fmt);
+    va_list argq;
+    va_start(argq, fmt);
     T((T_CALLED("printw(%s%s)"),
-       _nc_visbuf(fmt), _nc_varargs(fmt, argp)));
-    va_end(argp);
+       _nc_visbuf(fmt), _nc_varargs(fmt, argq)));
+    va_end(argq);
 #endif
 
     va_start(argp, fmt);
@@ -68,10 +69,11 @@
     int code;
 
 #ifdef TRACE
-    va_start(argp, fmt);
+    va_list argq;
+    va_start(argq, fmt);
     T((T_CALLED("wprintw(%p,%s%s)"),
-       (void *) win, _nc_visbuf(fmt), _nc_varargs(fmt, argp)));
-    va_end(argp);
+       (void *) win, _nc_visbuf(fmt), _nc_varargs(fmt, argq)));
+    va_end(argq);
 #endif
 
     va_start(argp, fmt);
@@ -88,10 +90,11 @@
     int code;
 
 #ifdef TRACE
-    va_start(argp, fmt);
+    va_list argq;
+    va_start(argq, fmt);
     T((T_CALLED("mvprintw(%d,%d,%s%s)"),
-       y, x, _nc_visbuf(fmt), _nc_varargs(fmt, argp)));
-    va_end(argp);
+       y, x, _nc_visbuf(fmt), _nc_varargs(fmt, argq)));
+    va_end(argq);
 #endif
 
     if ((code = move(y, x)) != ERR) {
@@ -109,10 +112,11 @@
     int code;
 
 #ifdef TRACE
-    va_start(argp, fmt);
+    va_list argq;
+    va_start(argq, fmt);
     T((T_CALLED("mvwprintw(%d,%d,%p,%s%s)"),
-       y, x, (void *) win, _nc_visbuf(fmt), _nc_varargs(fmt, argp)));
-    va_end(argp);
+       y, x, (void *) win, _nc_visbuf(fmt), _nc_varargs(fmt, argq)));
+    va_end(argq);
 #endif
 
     if ((code = wmove(win, y, x)) != ERR) {
Index: ncurses/base/lib_refresh.c
Prereq:  1.44 
--- ncurses-5.9/ncurses/base/lib_refresh.c	2010-12-19 01:22:58.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/base/lib_refresh.c	2011-06-25 19:02:22.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2010,2011 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -42,7 +42,7 @@
 
 #include <curses.priv.h>
 
-MODULE_ID("$Id: lib_refresh.c,v 1.44 2010/12/19 01:22:58 tom Exp $")
+MODULE_ID("$Id: lib_refresh.c,v 1.45 2011/06/25 19:02:22 Vassili.Courzakis Exp $")
 
 NCURSES_EXPORT(int)
 wrefresh(WINDOW *win)
@@ -90,12 +90,6 @@
 #endif
 
     T((T_CALLED("wnoutrefresh(%p)"), (void *) win));
-#ifdef TRACE
-    if (USE_TRACEF(TRACE_UPDATE)) {
-	_tracedump("...win", win);
-	_nc_unlock_global(tracef);
-    }
-#endif /* TRACE */
 
     /*
      * This function will break badly if we try to refresh a pad.
@@ -104,6 +98,13 @@
 	|| (win->_flags & _ISPAD))
 	returnCode(ERR);
 
+#ifdef TRACE
+    if (USE_TRACEF(TRACE_UPDATE)) {
+	_tracedump("...win", win);
+	_nc_unlock_global(tracef);
+    }
+#endif /* TRACE */
+
     /* put them here so "win == 0" won't break our code */
     begx = win->_begx;
     begy = win->_begy;
Index: ncurses/base/lib_restart.c
Prereq:  1.13 
--- ncurses-5.9/ncurses/base/lib_restart.c	2009-10-24 22:47:43.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/base/lib_restart.c	2012-12-08 20:40:06.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2008,2009 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -41,11 +41,7 @@
 
 #include <curses.priv.h>
 
-#if SVR4_TERMIO && !defined(_POSIX_SOURCE)
-#define _POSIX_SOURCE
-#endif
-
-MODULE_ID("$Id: lib_restart.c,v 1.13 2009/10/24 22:47:43 tom Exp $")
+MODULE_ID("$Id: lib_restart.c,v 1.15 2012/12/08 20:40:06 tom Exp $")
 
 NCURSES_EXPORT(int)
 NCURSES_SP_NAME(restartterm) (NCURSES_SP_DCLx
@@ -55,7 +51,7 @@
 {
     int result;
 #ifdef USE_TERM_DRIVER
-    TERMINAL *new_term;
+    TERMINAL *new_term = 0;
 #endif
 
     T((T_CALLED("restartterm(%p,%s,%d,%p)"),
Index: ncurses/base/lib_scanw.c
Prereq:  1.12 
--- ncurses-5.9/ncurses/base/lib_scanw.c	2009-10-24 22:35:14.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/base/lib_scanw.c	2011-10-22 16:31:35.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2001,2009 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2009,2011 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -40,14 +40,14 @@
 
 #include <curses.priv.h>
 
-MODULE_ID("$Id: lib_scanw.c,v 1.12 2009/10/24 22:35:14 tom Exp $")
+MODULE_ID("$Id: lib_scanw.c,v 1.13 2011/10/22 16:31:35 tom Exp $")
 
 NCURSES_EXPORT(int)
 vwscanw(WINDOW *win, NCURSES_CONST char *fmt, va_list argp)
 {
     char buf[BUFSIZ];
 
-    if (wgetnstr(win, buf, sizeof(buf) - 1) == ERR)
+    if (wgetnstr(win, buf, (int) sizeof(buf) - 1) == ERR)
 	return (ERR);
 
     return (vsscanf(buf, fmt, argp));
Index: ncurses/base/lib_screen.c
Prereq:  1.38 
--- ncurses-5.9/ncurses/base/lib_screen.c	2009-10-24 22:08:55.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/base/lib_screen.c	2011-10-22 15:03:11.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2008,2009 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2009,2011 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -39,7 +39,7 @@
 #define CUR SP_TERMTYPE
 #endif
 
-MODULE_ID("$Id: lib_screen.c,v 1.38 2009/10/24 22:08:55 tom Exp $")
+MODULE_ID("$Id: lib_screen.c,v 1.41 2011/10/22 15:03:11 tom Exp $")
 
 #define MAX_SIZE 0x3fff		/* 16k is big enough for a window or pad */
 
@@ -51,8 +51,11 @@
 
     T((T_CALLED("getwin(%p)"), (void *) filep));
 
+    if (filep == 0) {
+	returnWin(0);
+    }
     clearerr(filep);
-    if (fread(&tmp, 1, sizeof(WINDOW), filep) < sizeof(WINDOW)
+    if (fread(&tmp, (size_t) 1, sizeof(WINDOW), filep) < sizeof(WINDOW)
 	|| ferror(filep)
 	|| tmp._maxy == 0
 	|| tmp._maxy > MAX_SIZE
@@ -110,7 +113,7 @@
 
 	for (n = 0; n <= nwin->_maxy; n++) {
 	    clearerr(filep);
-	    if (fread(nwin->_line[n].text, 1, linesize, filep) < linesize
+	    if (fread(nwin->_line[n].text, (size_t) 1, linesize, filep) < linesize
 		|| ferror(filep)) {
 		delwin(nwin);
 		returnWin(0);
@@ -141,7 +144,7 @@
 	size_t len = (size_t) (win->_maxx + 1);
 
 	clearerr(filep);
-	if (fwrite(win, sizeof(WINDOW), 1, filep) != 1
+	if (fwrite(win, sizeof(WINDOW), (size_t) 1, filep) != 1
 	    || ferror(filep))
 	      returnCode(code);
 
@@ -189,18 +192,20 @@
 NCURSES_EXPORT(int)
 scr_dump(const char *file)
 {
+    int result;
     FILE *fp = 0;
 
     T((T_CALLED("scr_dump(%s)"), _nc_visbuf(file)));
 
     if (_nc_access(file, W_OK) < 0
 	|| (fp = fopen(file, "wb")) == 0) {
-	returnCode(ERR);
+	result = ERR;
     } else {
 	(void) putwin(newscr, fp);
 	(void) fclose(fp);
-	returnCode(OK);
+	result = OK;
     }
+    returnCode(result);
 }
 
 NCURSES_EXPORT(int)
Index: ncurses/base/lib_scroll.c
Prereq:  1.28 
--- ncurses-5.9/ncurses/base/lib_scroll.c	2010-12-19 01:48:09.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/base/lib_scroll.c	2011-10-22 16:34:50.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2010,2011 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -43,13 +43,13 @@
 
 #include <curses.priv.h>
 
-MODULE_ID("$Id: lib_scroll.c,v 1.28 2010/12/19 01:48:09 tom Exp $")
+MODULE_ID("$Id: lib_scroll.c,v 1.29 2011/10/22 16:34:50 tom Exp $")
 
 NCURSES_EXPORT(void)
 _nc_scroll_window(WINDOW *win,
 		  int const n,
-		  NCURSES_SIZE_T const top,
-		  NCURSES_SIZE_T const bottom,
+		  int const top,
+		  int const bottom,
 		  NCURSES_CH_T blank)
 {
     int limit;
Index: ncurses/base/lib_set_term.c
Prereq:  1.138 
--- ncurses-5.9/ncurses/base/lib_set_term.c	2010-12-20 00:42:20.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/base/lib_set_term.c	2012-12-22 21:30:04.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -47,7 +47,7 @@
 #define CUR SP_TERMTYPE
 #endif
 
-MODULE_ID("$Id: lib_set_term.c,v 1.138 2010/12/20 00:42:20 tom Exp $")
+MODULE_ID("$Id: lib_set_term.c,v 1.147 2012/12/22 21:30:04 tom Exp $")
 
 #ifdef USE_TERM_DRIVER
 #define MaxColors      InfoOf(sp).maxcolors
@@ -188,18 +188,7 @@
 	FreeIfNeeded(sp->_acs_map);
 	FreeIfNeeded(sp->_screen_acs_map);
 
-	/*
-	 * If the associated output stream has been closed, we can discard the
-	 * set-buffer.  Limit the error check to EBADF, since fflush may fail
-	 * for other reasons than trying to operate upon a closed stream.
-	 */
-	if (sp->_ofp != 0
-	    && sp->_setbuf != 0
-	    && fflush(sp->_ofp) != 0
-	    && errno == EBADF) {
-	    free(sp->_setbuf);
-	}
-
+	NCURSES_SP_NAME(_nc_flush) (NCURSES_SP_ARG);
 	NCURSES_SP_NAME(del_curterm) (NCURSES_SP_ARGx sp->_term);
 	free(sp);
 
@@ -272,8 +261,8 @@
 }
 #endif
 
-#define ReturnScreenError() _nc_set_screen(0); \
-                            returnCode(ERR)
+#define ReturnScreenError() { _nc_set_screen(0); \
+                            returnCode(ERR); } while (0)
 
 /* OS-independent screen initializations */
 NCURSES_EXPORT(int)
@@ -284,7 +273,7 @@
 				     int slines,
 				     int scolumns,
 				     FILE *output,
-				     bool filtered,
+				     int filtered,
 				     int slk_format)
 {
     char *env;
@@ -383,7 +372,15 @@
     sp->_lines = (NCURSES_SIZE_T) slines;
     sp->_lines_avail = (NCURSES_SIZE_T) slines;
     sp->_columns = (NCURSES_SIZE_T) scolumns;
+
+    fflush(output);
+    sp->_ofd = output ? fileno(output) : -1;
     sp->_ofp = output;
+    sp->out_limit = (size_t) ((2 + slines) * (6 + scolumns));
+    if ((sp->out_buffer = malloc(sp->out_limit)) == 0)
+	sp->out_limit = 0;
+    sp->out_inuse = 0;
+
     SP_PRE_INIT(sp);
     SetNoPadding(sp);
 
@@ -584,9 +581,13 @@
 
     NCURSES_SP_NAME(_nc_init_acs) (NCURSES_SP_ARG);
 #if USE_WIDEC_SUPPORT
+    sp->_screen_unicode = _nc_unicode_locale();
     _nc_init_wacs();
+    if (_nc_wacs == 0) {
+	ReturnScreenError();
+    }
 
-    sp->_screen_acs_fix = (_nc_unicode_locale()
+    sp->_screen_acs_fix = (sp->_screen_unicode
 			   && _nc_locale_breaks_acs(sp->_term));
 #endif
     env = _nc_get_locale();
@@ -619,6 +620,7 @@
 #endif
 #if USE_SIZECHANGE
     sp->_resize = NCURSES_SP_NAME(resizeterm);
+    sp->_ungetch = safe_ungetch;
 #endif
 
     NewScreen(sp)->_clear = TRUE;
@@ -695,7 +697,7 @@
 _nc_setupscreen(int slines GCC_UNUSED,
 		int scolumns GCC_UNUSED,
 		FILE *output,
-		bool filtered,
+		int filtered,
 		int slk_format)
 {
     SCREEN *sp = 0;
@@ -759,6 +761,7 @@
 			     int line,
 			     int (*init) (WINDOW *, int))
 {
+    START_TRACE();
     return NCURSES_SP_NAME(_nc_ripoffline) (NCURSES_SP_ARGx
 					    (line < 0) ? -1 : 1,
 					    init);
Index: ncurses/base/lib_slkrefr.c
Prereq:  1.26 
--- ncurses-5.9/ncurses/base/lib_slkrefr.c	2010-05-01 19:17:28.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/base/lib_slkrefr.c	2013-01-12 17:25:48.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -43,7 +43,7 @@
 #define CUR SP_TERMTYPE
 #endif
 
-MODULE_ID("$Id: lib_slkrefr.c,v 1.26 2010/05/01 19:17:28 tom Exp $")
+MODULE_ID("$Id: lib_slkrefr.c,v 1.29 2013/01/12 17:25:48 tom Exp $")
 
 #ifdef USE_TERM_DRIVER
 #define NumLabels    InfoOf(SP_PARM).numlabels
@@ -100,22 +100,22 @@
 		    CallDriver_2(sp, hwlabel, i + 1, slk->ent[i].form_text);
 #else
 		    if (i < num_labels) {
-			TPUTS_TRACE("plab_norm");
-			putp(TPARM_2(plab_norm, i + 1, slk->ent[i].form_text));
+			NCURSES_PUTP2("plab_norm",
+				      TPARM_2(plab_norm,
+					      i + 1,
+					      slk->ent[i].form_text));
 		    }
 #endif
 		} else {
 		    if (fmt == 4)
 			slk_paint_info(slk->win);
 		    wmove(slk->win, SLK_LINES(fmt) - 1, slk->ent[i].ent_x);
-		    if (sp->_slk) {
-			(void) wattrset(slk->win, AttrOf(sp->_slk->attr));
-		    }
+		    (void) wattrset(slk->win, (int) AttrOf(slk->attr));
 		    waddstr(slk->win, slk->ent[i].form_text);
 		    /* if we simulate SLK's, it's looking much more
 		       natural to use the current ATTRIBUTE also
 		       for the label window */
-		    (void) wattrset(slk->win, WINDOW_ATTRS(StdScreen(sp)));
+		    (void) wattrset(slk->win, (int) WINDOW_ATTRS(StdScreen(sp)));
 		}
 	    }
 	    slk->ent[i].dirty = FALSE;
@@ -128,11 +128,9 @@
 	CallDriver_1(sp, hwlabelOnOff, slk->hidden ? FALSE : TRUE);
 #else
 	if (slk->hidden) {
-	    TPUTS_TRACE("label_off");
-	    putp(label_off);
+	    NCURSES_PUTP2("label_off", label_off);
 	} else {
-	    TPUTS_TRACE("label_on");
-	    putp(label_on);
+	    NCURSES_PUTP2("label_on", label_on);
 	}
 #endif
     }
Index: ncurses/base/lib_slkset.c
Prereq:  1.21 
--- ncurses-5.9/ncurses/base/lib_slkset.c	2010-12-25 23:43:58.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/base/lib_slkset.c	2012-12-08 23:09:25.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -44,13 +44,13 @@
 #endif
 #endif
 
-MODULE_ID("$Id: lib_slkset.c,v 1.21 2010/12/25 23:43:58 tom Exp $")
+MODULE_ID("$Id: lib_slkset.c,v 1.24 2012/12/08 23:09:25 tom Exp $")
 
 NCURSES_EXPORT(int)
 NCURSES_SP_NAME(slk_set) (NCURSES_SP_DCLx int i, const char *astr, int format)
 {
     SLK *slk;
-    int offset;
+    int offset = 0;
     int numchrs;
     int numcols;
     int limit;
@@ -111,13 +111,12 @@
     slk->ent[i].ent_text[numchrs] = '\0';
 
     if ((slk->ent[i].form_text = (char *) _nc_doalloc(slk->ent[i].form_text,
-						      (unsigned) (limit +
-								  numchrs + 1))
+						      (size_t) (limit +
+								numchrs + 1))
 	) == 0)
 	returnCode(ERR);
 
     switch (format) {
-    default:
     case 0:			/* left-justified */
 	offset = 0;
 	break;
@@ -131,16 +130,16 @@
     if (offset <= 0)
 	offset = 0;
     else
-	memset(slk->ent[i].form_text, ' ', (unsigned) offset);
+	memset(slk->ent[i].form_text, ' ', (size_t) offset);
 
     memcpy(slk->ent[i].form_text + offset,
 	   slk->ent[i].ent_text,
-	   (unsigned) numchrs);
+	   (size_t) numchrs);
 
     if (offset < limit) {
 	memset(slk->ent[i].form_text + offset + numchrs,
 	       ' ',
-	       (unsigned) (limit - (offset + numcols)));
+	       (size_t) (limit - (offset + numcols)));
     }
 
     slk->ent[i].form_text[numchrs - numcols + limit] = 0;
Index: ncurses/base/lib_touch.c
Prereq:  1.11 
--- ncurses-5.9/ncurses/base/lib_touch.c	2010-12-19 01:22:58.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/base/lib_touch.c	2012-06-09 20:29:33.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -43,7 +43,7 @@
 
 #include <curses.priv.h>
 
-MODULE_ID("$Id: lib_touch.c,v 1.11 2010/12/19 01:22:58 tom Exp $")
+MODULE_ID("$Id: lib_touch.c,v 1.12 2012/06/09 20:29:33 tom Exp $")
 
 NCURSES_EXPORT(bool)
 is_linetouched(WINDOW *win, int line)
@@ -84,7 +84,7 @@
     for (i = y; i < y + n; i++) {
 	if (i > win->_maxy)
 	    break;
-	win->_line[i].firstchar = changed ? 0 : _NOCHANGE;
+	win->_line[i].firstchar = (NCURSES_SIZE_T) (changed ? 0 : _NOCHANGE);
 	win->_line[i].lastchar = (NCURSES_SIZE_T) (changed
 						   ? win->_maxx
 						   : _NOCHANGE);
Index: ncurses/base/lib_ungetch.c
Prereq:  1.14 
--- ncurses-5.9/ncurses/base/lib_ungetch.c	2009-10-24 22:12:21.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/base/lib_ungetch.c	2012-08-04 17:38:53.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2008,2009 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -42,7 +42,7 @@
 
 #include <curses.priv.h>
 
-MODULE_ID("$Id: lib_ungetch.c,v 1.14 2009/10/24 22:12:21 tom Exp $")
+MODULE_ID("$Id: lib_ungetch.c,v 1.16 2012/08/04 17:38:53 tom Exp $")
 
 #include <fifo_defs.h>
 
@@ -64,13 +64,14 @@
 
     T((T_CALLED("ungetch(%p,%s)"), (void *) sp, _nc_tracechar(sp, ch)));
 
-    if (tail != -1) {
-	if (head == -1) {
+    if (sp != 0 && tail >= 0) {
+	if (head < 0) {
 	    head = 0;
 	    t_inc();
 	    peek = tail;	/* no raw keys */
-	} else
+	} else {
 	    h_dec();
+	}
 
 	sp->_fifo[head] = ch;
 	T(("ungetch %s ok", _nc_tracechar(sp, ch)));
Index: ncurses/base/resizeterm.c
Prereq:  1.43 
--- ncurses-5.9/ncurses/base/resizeterm.c	2011-01-10 01:34:49.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/base/resizeterm.c	2012-07-07 17:07:23.000000000 +0000
@@ -45,7 +45,7 @@
 #define CUR SP_TERMTYPE
 #endif
 
-MODULE_ID("$Id: resizeterm.c,v 1.43 2011/01/10 01:34:49 tom Exp $")
+MODULE_ID("$Id: resizeterm.c,v 1.45 2012/07/07 17:07:23 tom Exp $")
 
 /*
  * If we're trying to be reentrant, do not want any local statics.
@@ -365,58 +365,71 @@
 	}
 #endif
 	if (ToLines > screen_lines(SP_PARM)) {
-	    increase_size(NCURSES_SP_ARGx
-			  myLines = ToLines, myCols, was_stolen EXTRA_ARGS);
+	    result = increase_size(NCURSES_SP_ARGx
+				   myLines = ToLines,
+				   myCols,
+				   was_stolen EXTRA_ARGS);
 	    CurLines = myLines;
 	    CurCols = myCols;
 	}
 
-	if (ToCols > screen_columns(SP_PARM)) {
-	    increase_size(NCURSES_SP_ARGx
-			  myLines, myCols = ToCols, was_stolen EXTRA_ARGS);
+	if ((result == OK)
+	    && (ToCols > screen_columns(SP_PARM))) {
+	    result = increase_size(NCURSES_SP_ARGx
+				   myLines,
+				   myCols = ToCols,
+				   was_stolen EXTRA_ARGS);
 	    CurLines = myLines;
 	    CurCols = myCols;
 	}
 
-	if (ToLines < myLines ||
-	    ToCols < myCols) {
-	    decrease_size(NCURSES_SP_ARGx ToLines, ToCols, was_stolen EXTRA_ARGS);
+	if ((result == OK)
+	    && (ToLines < myLines ||
+		ToCols < myCols)) {
+	    result = decrease_size(NCURSES_SP_ARGx
+				   ToLines,
+				   ToCols,
+				   was_stolen EXTRA_ARGS);
 	}
 
-	screen_lines(SP_PARM) = (NCURSES_SIZE_T) ToLines;
-	screen_columns(SP_PARM) = (NCURSES_SIZE_T) ToCols;
+	if (result == OK) {
+	    screen_lines(SP_PARM) = (NCURSES_SIZE_T) ToLines;
+	    screen_columns(SP_PARM) = (NCURSES_SIZE_T) ToCols;
 
 #ifdef USE_TERM_DRIVER
-	CallDriver_2(SP_PARM, setsize, ToLines, ToCols);
+	    CallDriver_2(SP_PARM, setsize, ToLines, ToCols);
 #else
-	lines = (NCURSES_SIZE_T) ToLines;
-	columns = (NCURSES_SIZE_T) ToCols;
+	    lines = (NCURSES_SIZE_T) ToLines;
+	    columns = (NCURSES_SIZE_T) ToCols;
 #endif
 
-	SP_PARM->_lines_avail = (NCURSES_SIZE_T) (ToLines - was_stolen);
+	    SP_PARM->_lines_avail = (NCURSES_SIZE_T) (ToLines - was_stolen);
 
-	if (SP_PARM->oldhash) {
-	    FreeAndNull(SP_PARM->oldhash);
-	}
-	if (SP_PARM->newhash) {
-	    FreeAndNull(SP_PARM->newhash);
-	}
+	    if (SP_PARM->oldhash) {
+		FreeAndNull(SP_PARM->oldhash);
+	    }
+	    if (SP_PARM->newhash) {
+		FreeAndNull(SP_PARM->newhash);
+	    }
 #ifdef TRACE
-	if (USE_TRACEF(TRACE_UPDATE)) {
-	    SET_LINES(ToLines - was_stolen);
-	    SET_COLS(ToCols);
-	    show_window_sizes("after");
-	    _nc_unlock_global(tracef);
-	}
+	    if (USE_TRACEF(TRACE_UPDATE)) {
+		SET_LINES(ToLines - was_stolen);
+		SET_COLS(ToCols);
+		show_window_sizes("after");
+		_nc_unlock_global(tracef);
+	    }
 #endif
+	}
     }
 
-    /*
-     * Always update LINES, to allow for call from lib_doupdate.c which
-     * needs to have the count adjusted by the stolen (ripped off) lines.
-     */
-    SET_LINES(ToLines - was_stolen);
-    SET_COLS(ToCols);
+    if (result == OK) {
+	/*
+	 * Always update LINES, to allow for call from lib_doupdate.c which
+	 * needs to have the count adjusted by the stolen (ripped off) lines.
+	 */
+	SET_LINES(ToLines - was_stolen);
+	SET_COLS(ToCols);
+    }
 
     _nc_nonsp_unlock_global(curses);
 
@@ -471,7 +484,6 @@
 	    result = NCURSES_SP_NAME(resize_term) (NCURSES_SP_ARGx ToLines, ToCols);
 
 #if USE_SIGWINCH
-	    safe_ungetch(SP_PARM, KEY_RESIZE);	/* so application can know this */
 	    clearok(CurScreen(SP_PARM), TRUE);	/* screen contents are unknown */
 
 	    /* ripped-off lines are a special case: if we did not lengthen
@@ -501,6 +513,9 @@
 	    }
 #endif
 	}
+#if USE_SIGWINCH
+	safe_ungetch(SP_PARM, KEY_RESIZE);	/* so application can know this */
+#endif
     }
 
     returnCode(result);
Index: ncurses/base/safe_sprintf.c
Prereq:  1.24 
--- ncurses-5.9/ncurses/base/safe_sprintf.c	2010-06-05 22:22:27.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/base/safe_sprintf.c	2013-01-20 01:04:32.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -27,13 +27,13 @@
  ****************************************************************************/
 
 /****************************************************************************
- *  Author: Thomas E. Dickey <dickey@clark.net> 1997                        *
+ *  Author: Thomas E. Dickey        1997-on                                 *
  ****************************************************************************/
 
 #include <curses.priv.h>
 #include <ctype.h>
 
-MODULE_ID("$Id: safe_sprintf.c,v 1.24 2010/06/05 22:22:27 tom Exp $")
+MODULE_ID("$Id: safe_sprintf.c,v 1.27 2013/01/20 01:04:32 tom Exp $")
 
 #if USE_SAFE_SPRINTF
 
@@ -109,12 +109,16 @@
 		    } else if (state == Prec) {
 			prec = ival;
 		    }
-		    sprintf(fmt_arg, "%d", ival);
+		    _nc_SPRINTF(fmt_arg,
+				_nc_SLIMIT(sizeof(fmt_arg))
+				"%d", ival);
 		    fmt_len += strlen(fmt_arg);
 		    if ((format = _nc_doalloc(format, fmt_len)) == 0) {
+			free(buffer);
 			return -1;
 		    }
-		    strcpy(&format[--f], fmt_arg);
+		    --f;
+		    _nc_STRCPY(&format[f], fmt_arg, fmt_len - f);
 		    f = strlen(format);
 		} else if (isalpha(UChar(*fmt))) {
 		    done = TRUE;
@@ -185,13 +189,13 @@
 	    format[f] = '\0';
 	    switch (used) {
 	    case 'i':
-		sprintf(buffer, format, ival);
+		_nc_SPRINTF(buffer, _nc_SLIMIT(length) format, ival);
 		break;
 	    case 'f':
-		sprintf(buffer, format, fval);
+		_nc_SPRINTF(buffer, _nc_SLIMIT(length) format, fval);
 		break;
 	    default:
-		sprintf(buffer, format, pval);
+		_nc_SPRINTF(buffer, _nc_SLIMIT(length) format, pval);
 		break;
 	    }
 	    len += (int) strlen(buffer);
Index: ncurses/base/vsscanf.c
Prereq:  1.18 
--- ncurses-5.9/ncurses/base/vsscanf.c	2004-04-03 20:27:02.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/base/vsscanf.c	2012-02-22 22:26:58.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2004,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -38,7 +38,7 @@
 
 #if !HAVE_VSSCANF
 
-MODULE_ID("$Id: vsscanf.c,v 1.18 2004/04/03 20:27:02 tom Exp $")
+MODULE_ID("$Id: vsscanf.c,v 1.20 2012/02/22 22:26:58 tom Exp $")
 
 #if !(HAVE_VFSCANF || HAVE__DOSCAN)
 
@@ -293,12 +293,12 @@
 
 		/* add %n, if the format was not that */
 		if (chunk != cAssigned) {
-		    strcat(my_fmt, "%n");
+		    _nc_STRCAT(my_fmt, "%n", len_fmt);
 		}
 
 		switch (chunk) {
 		case cAssigned:
-		    strcat(my_fmt, "%n");
+		    _nc_STRCAT(my_fmt, "%n", len_fmt);
 		    pointer = &eaten;
 		    break;
 		case cInt:
Index: ncurses/base/wresize.c
Prereq:  1.34 
--- ncurses-5.9/ncurses/base/wresize.c	2010-06-05 22:36:26.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/base/wresize.c	2011-05-21 18:55:07.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2010,2011 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -33,7 +33,7 @@
 
 #include <curses.priv.h>
 
-MODULE_ID("$Id: wresize.c,v 1.34 2010/06/05 22:36:26 tom Exp $")
+MODULE_ID("$Id: wresize.c,v 1.35 2011/05/21 18:55:07 tom Exp $")
 
 static int
 cleanup_lines(struct ldat *data, int length)
@@ -175,9 +175,10 @@
 		for (col = 0; col <= ToCols; ++col)
 		    s[col] = win->_nc_bkgd;
 	    }
-	} else {
-	    assert(pline != 0);
+	} else if (pline != 0 && pline[win->_pary + row].text != 0) {
 	    s = &pline[win->_pary + row].text[win->_parx];
+	} else {
+	    s = 0;
 	}
 
 	if_USE_SCROLL_HINTS(new_lines[row].oldindex = row);
Index: ncurses/build.priv.h
Prereq:  1.6 
--- ncurses-5.9/ncurses/build.priv.h	2010-05-22 20:30:35.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/build.priv.h	2012-02-22 22:17:02.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 2010 Free Software Foundation, Inc.                        *
+ * Copyright (c) 2010,2012 Free Software Foundation, Inc.                   *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -30,9 +30,8 @@
  *  Author: Thomas E. Dickey                        2010                    *
  ****************************************************************************/
 
-
 /*
- * $Id: build.priv.h,v 1.6 2010/05/22 20:30:35 tom Exp $
+ * $Id: build.priv.h,v 1.9 2012/02/22 22:17:02 tom Exp $
  *
  *	build.priv.h
  *
@@ -83,6 +82,7 @@
 #define SIZEOF(v)        (sizeof(v) / sizeof(v[0]))
 
 #include <nc_alloc.h>
+#include <nc_string.h>
 
 /* declare these, to avoid needing term.h */
 #if BROKEN_LINKER || USE_REENTRANT
Index: ncurses/curses.priv.h
Prereq:  1.475 
--- ncurses-5.9/ncurses/curses.priv.h	2011-01-22 21:10:19.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/curses.priv.h	2013-01-26 21:51:56.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2010,2011 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -34,7 +34,7 @@
  ****************************************************************************/
 
 /*
- * $Id: curses.priv.h,v 1.475 2011/01/22 21:10:19 tom Exp $
+ * $Id: curses.priv.h,v 1.523 2013/01/26 21:51:56 tom Exp $
  *
  *	curses.priv.h
  *
@@ -65,6 +65,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <sys/types.h>
+#include <sys/stat.h>
 
 #if HAVE_UNISTD_H
 #include <unistd.h>
@@ -85,6 +86,12 @@
 
 #include <errno.h>
 
+#if defined __hpux
+#  ifndef EILSEQ
+#    define EILSEQ 47
+#  endif
+#endif
+
 #ifndef PATH_MAX
 # if defined(_POSIX_PATH_MAX)
 #  define PATH_MAX _POSIX_PATH_MAX
@@ -111,6 +118,14 @@
 #define USE_FUNC_POLL 0
 #endif
 
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
 /* include signal.h before curses.h to work-around defect in glibc 2.1.3 */
 #include <signal.h>
 
@@ -135,6 +150,15 @@
 #define USE_EMX_MOUSE 0
 #endif
 
+/* kLIBC keyboard/mouse support */
+#if defined(__OS2__) && defined(__KLIBC__)
+#define USE_KLIBC_KBD   1
+#define USE_KLIBC_MOUSE 1
+#else
+#define USE_KLIBC_KBD   0
+#define USE_KLIBC_MOUSE 0
+#endif
+
 #define DEFAULT_MAXCLICK 166
 #define EV_MAX		8	/* size of mouse circular event queue */
 
@@ -192,6 +216,18 @@
 #endif
 
 /*
+ * Either/both S_ISxxx and/or S_IFxxx are defined in sys/types.h; some systems
+ * lack one or the other.
+ */
+#ifndef S_ISDIR
+#define S_ISDIR(mode) ((mode & S_IFMT) == S_IFDIR)
+#endif
+
+#ifndef S_ISREG
+#define S_ISREG(mode) ((mode & S_IFMT) == S_IFREG)
+#endif
+
+/*
  * Scroll hints are useless when hashmap is used
  */
 #if !USE_SCROLL_HINTS
@@ -208,6 +244,8 @@
 #define if_USE_SCROLL_HINTS(stmt) /*nothing*/
 #endif
 
+#include <nc_string.h>
+
 /*
  * Options for terminal drivers, etc...
  */
@@ -325,6 +363,7 @@
 #endif
 
 #include <term.h>
+#include <nc_termios.h>
 
 /*
  * Reduce dependency on cur_term global by using terminfo data from SCREEN's
@@ -365,7 +404,7 @@
 #define if_EXT_COLORS(stmt)	stmt
 #define SetPair(value,p)	SetPair2((value).ext_color, AttrOf(value), p)
 #define SetPair2(c,a,p)		c = (p), \
-				a = (unColor2(a) | (A_COLOR & ColorPair(oldColor(c))))
+				a = (unColor2(a) | (A_COLOR & (unsigned) ColorPair(oldColor(c))))
 #define GetPair(value)		GetPair2((value).ext_color, AttrOf(value))
 #define GetPair2(c,a)		((c) ? (c) : PairNumber(a))
 #define oldColor(p)		(((p) > 255) ? 255 : (p))
@@ -373,11 +412,7 @@
 #define SET_WINDOW_PAIR(w,p)	(w)->_color = (p)
 #define SameAttrOf(a,b)		(AttrOf(a) == AttrOf(b) && GetPair(a) == GetPair(b))
 
-#if NCURSES_SP_FUNCS
-#define VIDATTR(sp,attr,pair)	NCURSES_SP_NAME(vid_attr)(sp, attr, pair, 0)
-#else
-#define VIDATTR(sp,attr,pair)	vid_attr(attr, pair, 0)
-#endif
+#define VIDATTR(sp,attr,pair)	NCURSES_SP_NAME(vid_puts)(NCURSES_SP_ARGx attr, (short) pair, 0, NCURSES_OUTC_FUNC)
 
 #else /* !NCURSES_EXT_COLORS */
 
@@ -390,14 +425,14 @@
 				WINDOW_ATTRS(w) |= (A_COLOR & (attr_t) ColorPair(p))
 #define SameAttrOf(a,b)		(AttrOf(a) == AttrOf(b))
 
-#if NCURSES_SP_FUNCS
-#define VIDATTR(sp,attr,pair)	NCURSES_SP_NAME(vidattr)(sp, attr)
-#else
-#define VIDATTR(sp,attr,pair)	vidattr(attr)
-#endif
+#define VIDATTR(sp,attr,pair)	NCURSES_SP_NAME(vidputs)(NCURSES_SP_ARGx attr, NCURSES_OUTC_FUNC)
 
 #endif /* NCURSES_EXT_COLORS */
 
+#define NCURSES_OUTC_FUNC       NCURSES_SP_NAME(_nc_outch)
+#define NCURSES_PUTP2(name,value)    NCURSES_SP_NAME(_nc_putp)(NCURSES_SP_ARGx name, value)
+#define NCURSES_PUTP2_FLUSH(name,value)    NCURSES_SP_NAME(_nc_putp_flush)(NCURSES_SP_ARGx name, value)
+
 #if NCURSES_NO_PADDING
 #define GetNoPadding(sp)	((sp) ? (sp)->_no_padding : _nc_prescreen._no_padding)
 #define SetNoPadding(sp)	_nc_set_no_padding(sp)
@@ -467,6 +502,9 @@
 #  endif
 #  define _declare(name)	__extension__ extern __typeof__(name) name
 #  define weak_symbol(name)	_weak_pragma(name) _declare(name) __attribute__((weak))
+#else
+#  undef USE_WEAK_SYMBOLS
+#  define USE_WEAK_SYMBOLS 0
 #endif
 #endif
 
@@ -665,6 +703,9 @@
 #if USE_GPM_SUPPORT
 #undef buttons			/* term.h defines this, and gpm uses it! */
 #include <gpm.h>
+#if USE_WEAK_SYMBOLS
+weak_symbol(Gpm_Wgetch);
+#endif
 
 #ifdef HAVE_LIBDL
 /* link dynamically to GPM */
@@ -766,17 +807,23 @@
 #define INIT_TERM_DRIVER()	/* nothing */
 #endif
 
+typedef struct {
+    const char *name;
+    char *value;
+} ITERATOR_VARS;
+
 /*
  * Global data which is not specific to a screen.
  */
 typedef struct {
+	SIG_ATOMIC_T	have_sigtstp;
 	SIG_ATOMIC_T	have_sigwinch;
 	SIG_ATOMIC_T	cleanup_nested;
 
 	bool		init_signals;
 	bool		init_screen;
 
-	const char	*comp_sourcename;
+	char		*comp_sourcename;
 	char		*comp_termtype;
 
 	bool		have_tic_directory;
@@ -798,6 +845,12 @@
 	int		tgetent_index;
 	long		tgetent_sequence;
 
+	char		*dbd_blob;	/* string-heap for dbd_list[] */
+	char		**dbd_list;	/* distinct places to look for data */
+	int		dbd_size;	/* length of dbd_list[] */
+	time_t		dbd_time;	/* cache last updated */
+	ITERATOR_VARS	dbd_vars[dbdLAST];
+
 #ifndef USE_SP_WINDOWLIST
 	WINDOWLIST	*_nc_windowlist;
 #define WindowList(sp)	_nc_globals._nc_windowlist
@@ -891,6 +944,7 @@
 	const char	*_tputs_trace;
 #endif
 #endif
+	bool		use_tioctl;
 } NCURSES_PRESCREEN;
 
 /*
@@ -911,11 +965,13 @@
  */
 
 struct screen {
-	int		_ifd;		/* input file ptr for screen	    */
+	int		_ifd;		/* input file descriptor for screen */
+	int		_ofd;		/* output file descriptor for screen */
 	FILE		*_ofp;		/* output file ptr for screen	    */
-	char		*_setbuf;	/* buffered I/O for output	    */
+	char		*out_buffer;	/* output buffer		    */
+	size_t		out_limit;	/* output buffer size		    */
+	size_t		out_inuse;	/* output buffer current use	    */
 	bool		_filtered;	/* filter() was called		    */
-	bool		_buffered;	/* setvbuf uses _setbuf data	    */
 	bool		_prescreen;	/* is in prescreen phase	    */
 	bool		_use_env;	/* LINES & COLS from environment?   */
 	int		_checkfd;	/* filedesc for typeahead check	    */
@@ -1015,6 +1071,7 @@
 	int		_pair_count;	/* count of color pairs		     */
 	int		_pair_limit;	/* actual limit of color-pairs       */
 #if NCURSES_EXT_FUNCS
+	bool		_assumed_color; /* use assumed colors		     */
 	bool		_default_color; /* use default colors		     */
 	bool		_has_sgr_39_49; /* has ECMA default color support    */
 	int		_default_fg;	/* assumed default foreground	     */
@@ -1032,6 +1089,10 @@
 	bool		_use_rmso;	/* true if we may use 'rmso'	     */
 	bool		_use_rmul;	/* true if we may use 'rmul'	     */
 
+#if USE_KLIBC_KBD
+	bool		_extended_key;	/* true if an extended key	     */
+#endif
+
 	/*
 	 * These data correspond to the state of the idcok() and idlok()
 	 * functions.  A caveat is in order here:  the XSI and SVr4
@@ -1055,7 +1116,9 @@
 	void		(*_mouse_wrap)	(SCREEN *);
 	int		_mouse_fd;	/* file-descriptor, if any */
 	bool		_mouse_active;	/* true if initialized */
-	mmask_t		_mouse_mask;
+	mmask_t		_mouse_mask;	/* set via mousemask() */
+	mmask_t		_mouse_mask2;	/* OR's in press/release bits */
+	mmask_t		_mouse_bstate;
 	NCURSES_CONST char *_mouse_xtermcap; /* string to enable/disable mouse */
 	MEVENT		_mouse_events[EV_MAX];	/* hold the last mouse event seen */
 	MEVENT		*_mouse_eventp;	/* next free slot in event queue */
@@ -1102,6 +1165,7 @@
 	 */
 #if USE_SIZECHANGE
 	int		(*_resize)(NCURSES_SP_DCLx int y, int x);
+	int		(*_ungetch)(SCREEN *, int);
 #endif
 
 	/*
@@ -1120,7 +1184,6 @@
 	int		*_oldnum_list;
 	int		_oldnum_size;
 
-	bool		_cleanup;	/* cleanup after int/quit signal */
 	NCURSES_SP_OUTC	_outch;		/* output handler if not putc */
 
 	int		_legacy_coding;	/* see use_legacy_coding() */
@@ -1158,7 +1221,10 @@
 	 * UTF-8, but do not permit ACS at the same time (see tty_update.c).
 	 */
 	bool		_screen_acs_fix;
+	bool		_screen_unicode;
 #endif
+
+	bool		_use_tioctl;
 };
 
 extern NCURSES_EXPORT_VAR(SCREEN *) _nc_screen_chain;
@@ -1168,7 +1234,7 @@
 	WINDOWLIST *next;
 	SCREEN *screen;		/* screen containing the window */
 	WINDOW	win;		/* WINDOW_EXT() needs to account for offset */
-#ifdef NCURSES_WIDECHAR
+#if NCURSES_WIDECHAR
 	char addch_work[(MB_LEN_MAX * 9) + 1];
 	unsigned addch_used;	/* number of bytes in addch_work[] */
 	int addch_x;		/* x-position for addch_work[] */
@@ -1189,7 +1255,7 @@
     sp->_endwin = TRUE;                         \
     sp->_cursor = -1;                           \
     WindowList(sp) = 0;                         \
-    sp->_outch = NCURSES_SP_NAME(_nc_outch);    \
+    sp->_outch = NCURSES_OUTC_FUNC;             \
     sp->jump = 0                                \
 
 /* usually in <limits.h> */
@@ -1322,9 +1388,9 @@
 #define PUTC_DATA	char PUTC_buf[MB_LEN_MAX]; int PUTC_i, PUTC_n; \
 			mbstate_t PUT_st; wchar_t PUTC_ch
 #define PUTC_INIT	init_mb (PUT_st)
-#define PUTC(ch,b)	do { if(!isWidecExt(ch)) {				    \
+#define PUTC(ch)	do { if(!isWidecExt(ch)) {				    \
 			if (Charable(ch)) {					    \
-			    fputc(CharOf(ch), b);				    \
+			    NCURSES_OUTC_FUNC (NCURSES_SP_ARGx CharOf(ch)); \
 			    COUNT_OUTCHARS(1);					    \
 			} else {						    \
 			    PUTC_INIT;						    \
@@ -1336,10 +1402,14 @@
 						       (ch).chars[PUTC_i], &PUT_st); \
 				if (PUTC_n <= 0) {				    \
 				    if (PUTC_ch && is8bits(PUTC_ch) && PUTC_i == 0) \
-					putc(PUTC_ch,b);			    \
+					NCURSES_OUTC_FUNC (NCURSES_SP_ARGx CharOf(ch)); \
 				    break;					    \
+				} else {					    \
+				    int PUTC_j;					    \
+				    for (PUTC_j = 0; PUTC_j < PUTC_n; ++PUTC_j) {   \
+					NCURSES_OUTC_FUNC (NCURSES_SP_ARGx PUTC_buf[PUTC_j]); \
+				    }						    \
 				}						    \
-				IGNORE_RC(fwrite(PUTC_buf, (unsigned) PUTC_n, 1, b)); \
 			    }							    \
 			    COUNT_OUTCHARS(PUTC_i);				    \
 			} } } while (0)
@@ -1362,7 +1432,7 @@
 				AttrOf(dst) |= (attr_t) (ext + 1)
 
 #define if_WIDEC(code)  code
-#define Charable(ch)	((SP_PARM != 0 && SP_PARM->_legacy_coding)	\
+#define Charable(ch)	((SP_PARM->_legacy_coding)			\
 			 || (AttrOf(ch) & A_ALTCHARSET)			\
 			 || (!isWidecExt(ch) &&				\
 			     (ch).chars[1] == L'\0' &&			\
@@ -1383,8 +1453,8 @@
 #define CHDEREF(wch)	wch
 #define ARG_CH_T	NCURSES_CH_T
 #define CARG_CH_T	NCURSES_CH_T
-#define PUTC_DATA	int data = 0
-#define PUTC(ch,b)	do { data = CharOf(ch); putc(data,b); } while (0)
+#define PUTC_DATA	/* nothing */
+#define PUTC(ch)	NCURSES_OUTC_FUNC (NCURSES_SP_ARGx (int) ch)
 
 #define BLANK		(' '|A_NORMAL)
 #define ZEROS		('\0'|A_NORMAL)
@@ -1412,25 +1482,25 @@
 
 #define CHANGED_CELL(line,col) \
 	if (line->firstchar == _NOCHANGE) \
-		line->firstchar = line->lastchar = (NCURSES_SIZE_T) col; \
+		line->firstchar = line->lastchar = (NCURSES_SIZE_T) (col); \
 	else if ((col) < line->firstchar) \
-		line->firstchar = (NCURSES_SIZE_T) col; \
+		line->firstchar = (NCURSES_SIZE_T) (col); \
 	else if ((col) > line->lastchar) \
-		line->lastchar = (NCURSES_SIZE_T) col
+		line->lastchar = (NCURSES_SIZE_T) (col)
 
 #define CHANGED_RANGE(line,start,end) \
 	if (line->firstchar == _NOCHANGE \
 	 || line->firstchar > (start)) \
-		line->firstchar = (NCURSES_SIZE_T) start; \
+		line->firstchar = (NCURSES_SIZE_T) (start); \
 	if (line->lastchar == _NOCHANGE \
 	 || line->lastchar < (end)) \
-		line->lastchar = (NCURSES_SIZE_T) end
+		line->lastchar = (NCURSES_SIZE_T) (end)
 
 #define CHANGED_TO_EOL(line,start,end) \
 	if (line->firstchar == _NOCHANGE \
 	 || line->firstchar > (start)) \
-		line->firstchar = (NCURSES_SIZE_T) start; \
-	line->lastchar = (NCURSES_SIZE_T) end
+		line->firstchar = (NCURSES_SIZE_T) (start); \
+	line->lastchar = (NCURSES_SIZE_T) (end)
 
 #define SIZEOF(v) (sizeof(v)/sizeof(v[0]))
 
@@ -1444,6 +1514,20 @@
 #include <nc_alloc.h>
 
 /*
+ * Use these for tic/infocmp malloc failures.  Generally the ncurses library
+ * tries to limp along after a failure.
+ */
+#define TYPE_MALLOC(type, size, name) \
+	name = typeMalloc(type, size); \
+	if (name == 0) \
+	    _nc_err_abort(MSG_NO_MEMORY)
+
+#define TYPE_REALLOC(type, size, name) \
+	name = typeRealloc(type, size, name); \
+	if (name == 0) \
+	    _nc_err_abort(MSG_NO_MEMORY)
+
+/*
  * TTY bit definition for converting tabs to spaces.
  */
 #ifdef TAB3
@@ -1528,7 +1612,7 @@
 #define returnVoidPtr(code)	TRACE_RETURN(code,void_ptr)
 #define returnWin(code)		TRACE_RETURN(code,win)
 
-extern NCURSES_EXPORT(NCURSES_BOOL)     _nc_retrace_bool (NCURSES_BOOL);
+extern NCURSES_EXPORT(NCURSES_BOOL)     _nc_retrace_bool (int);
 extern NCURSES_EXPORT(NCURSES_CONST void *) _nc_retrace_cvoid_ptr (NCURSES_CONST void *);
 extern NCURSES_EXPORT(SCREEN *)         _nc_retrace_sp (SCREEN *);
 extern NCURSES_EXPORT(WINDOW *)         _nc_retrace_win (WINDOW *);
@@ -1539,7 +1623,7 @@
 extern NCURSES_EXPORT(chtype)           _nc_retrace_chtype (chtype);
 extern NCURSES_EXPORT(const char *)     _nc_altcharset_name(attr_t, chtype);
 extern NCURSES_EXPORT(const char *)     _nc_retrace_cptr (const char *);
-extern NCURSES_EXPORT(char)             _nc_retrace_char (char);
+extern NCURSES_EXPORT(char)             _nc_retrace_char (int);
 extern NCURSES_EXPORT(int)              _nc_retrace_int (int);
 extern NCURSES_EXPORT(int)              _nc_retrace_int_attr_t (attr_t);
 extern NCURSES_EXPORT(mmask_t)          _nc_retrace_mmask_t (SCREEN *, mmask_t);
@@ -1795,6 +1879,8 @@
 /* lib_mvcur.c */
 #define INFINITY	1000000	/* cost: too high to use */
 
+extern NCURSES_EXPORT(int) _nc_mvcur(int yold, int xold, int ynew, int xnew);
+
 extern NCURSES_EXPORT(void) _nc_mvcur_init (void);
 extern NCURSES_EXPORT(void) _nc_mvcur_resume (void);
 extern NCURSES_EXPORT(void) _nc_mvcur_wrap (void);
@@ -1816,12 +1902,31 @@
 extern NCURSES_EXPORT(char *) _nc_get_locale(void);
 extern NCURSES_EXPORT(int)    _nc_unicode_locale(void);
 extern NCURSES_EXPORT(int)    _nc_locale_breaks_acs(TERMINAL *);
-extern NCURSES_EXPORT(int)    _nc_setupterm(NCURSES_CONST char *, int, int *, bool);
-extern NCURSES_EXPORT(void)   _nc_tinfo_cmdch(TERMINAL *, char);
+extern NCURSES_EXPORT(int)    _nc_setupterm(NCURSES_CONST char *, int, int *, int);
+extern NCURSES_EXPORT(void)   _nc_tinfo_cmdch(TERMINAL *, int);
 
 /* lib_set_term.c */
 extern NCURSES_EXPORT(int)    _nc_ripoffline(int, int(*)(WINDOW*, int));
 
+/* lib_setup.c */
+#define ret_error(code, fmt, arg)	if (errret) {\
+					    *errret = code;\
+					    returnCode(ERR);\
+					} else {\
+					    fprintf(stderr, fmt, arg);\
+					    exit(EXIT_FAILURE);\
+					}
+
+#define ret_error1(code, fmt, arg)	ret_error(code, "'%s': " fmt, arg)
+
+#define ret_error0(code, msg)		if (errret) {\
+					    *errret = code;\
+					    returnCode(ERR);\
+					} else {\
+					    fprintf(stderr, msg);\
+					    exit(EXIT_FAILURE);\
+					}
+
 /* lib_tstp.c */
 #if USE_SIGWINCH
 extern NCURSES_EXPORT(int) _nc_handle_sigwinch(SCREEN *);
@@ -1875,16 +1980,17 @@
 extern NCURSES_EXPORT(int) _nc_baudrate (int);
 extern NCURSES_EXPORT(int) _nc_freewin (WINDOW *);
 extern NCURSES_EXPORT(int) _nc_getenv_num (const char *);
-extern NCURSES_EXPORT(int) _nc_keypad (SCREEN *, bool);
+extern NCURSES_EXPORT(int) _nc_keypad (SCREEN *, int);
 extern NCURSES_EXPORT(int) _nc_ospeed (int);
 extern NCURSES_EXPORT(int) _nc_outch (int);
+extern NCURSES_EXPORT(int) _nc_putchar (int);
 extern NCURSES_EXPORT(int) _nc_putp(const char *, const char *);
 extern NCURSES_EXPORT(int) _nc_putp_flush(const char *, const char *);
 extern NCURSES_EXPORT(int) _nc_read_termcap_entry (const char *const, TERMTYPE *const);
-extern NCURSES_EXPORT(int) _nc_setupscreen (int, int, FILE *, bool, int);
 extern NCURSES_EXPORT(int) _nc_setup_tinfo(const char *, TERMTYPE *);
+extern NCURSES_EXPORT(int) _nc_setupscreen (int, int, FILE *, int, int);
 extern NCURSES_EXPORT(int) _nc_timed_wait (SCREEN *, int, int, int * EVENTLIST_2nd(_nc_eventlist *));
-extern NCURSES_EXPORT(void) _nc_do_color (short, short, bool, NCURSES_OUTC);
+extern NCURSES_EXPORT(void) _nc_do_color (int, int, int, NCURSES_OUTC);
 extern NCURSES_EXPORT(void) _nc_flush (void);
 extern NCURSES_EXPORT(void) _nc_free_and_exit (int) GCC_NORETURN;
 extern NCURSES_EXPORT(void) _nc_free_entry (ENTRY *, TERMTYPE *);
@@ -1895,8 +2001,9 @@
 extern NCURSES_EXPORT(void) _nc_make_oldhash (int i);
 extern NCURSES_EXPORT(void) _nc_scroll_oldhash (int n, int top, int bot);
 extern NCURSES_EXPORT(void) _nc_scroll_optimize (void);
-extern NCURSES_EXPORT(void) _nc_set_buffer (FILE *, bool);
-extern NCURSES_EXPORT(void) _nc_signal_handler (bool);
+extern NCURSES_EXPORT(void) _nc_set_buffer (FILE *, int);
+extern NCURSES_EXPORT(void) _nc_setenv_num (const char *, int);
+extern NCURSES_EXPORT(void) _nc_signal_handler (int);
 extern NCURSES_EXPORT(void) _nc_synchook (WINDOW *);
 extern NCURSES_EXPORT(void) _nc_trace_tries (TRIES *);
 
@@ -1905,7 +2012,9 @@
 extern NCURSES_EXPORT(void) _nc_captoinfo_leaks(void);
 extern NCURSES_EXPORT(void) _nc_codes_leaks(void);
 extern NCURSES_EXPORT(void) _nc_comp_captab_leaks(void);
+extern NCURSES_EXPORT(void) _nc_comp_error_leaks(void);
 extern NCURSES_EXPORT(void) _nc_comp_scan_leaks(void);
+extern NCURSES_EXPORT(void) _nc_db_iterator_leaks(void);
 extern NCURSES_EXPORT(void) _nc_keyname_leaks(void);
 extern NCURSES_EXPORT(void) _nc_names_leaks(void);
 extern NCURSES_EXPORT(void) _nc_tgetent_leaks(void);
@@ -1914,7 +2023,7 @@
 #if !(defined(USE_TERMLIB) || defined(USE_BUILD_CC))
 extern NCURSES_EXPORT(NCURSES_CH_T) _nc_render (WINDOW *, NCURSES_CH_T);
 extern NCURSES_EXPORT(int) _nc_waddch_nosync (WINDOW *, const NCURSES_CH_T);
-extern NCURSES_EXPORT(void) _nc_scroll_window (WINDOW *, int const, NCURSES_SIZE_T const, NCURSES_SIZE_T const, NCURSES_CH_T);
+extern NCURSES_EXPORT(void) _nc_scroll_window (WINDOW *, int const, int const, int const, NCURSES_CH_T);
 #endif
 
 #if USE_WIDEC_SUPPORT
@@ -1946,8 +2055,26 @@
  * Wide-character macros to hide some platform-differences.
  */
 #if USE_WIDEC_SUPPORT
+
+#if defined(__MINGW32__)
+/*
+ * MinGW has wide-character functions, but they do not work correctly.
+ */
+
+extern int __MINGW_NOTHROW _nc_wctomb(char *, wchar_t);
+#define wctomb(s,wc) _nc_wctomb(s,wc)
+#define wcrtomb(s,wc,n) _nc_wctomb(s,wc)
+
+extern int __MINGW_NOTHROW _nc_mbtowc(wchar_t *, const char *, size_t);
+#define mbtowc(pwc,s,n) _nc_mbtowc(pwc,s,n)
+
+extern int __MINGW_NOTHROW _nc_mblen(const char *, size_t);
+#define mblen(s,n) _nc_mblen(s, n)
+
+#endif /* __MINGW32__ */
+
 #if HAVE_MBTOWC && HAVE_MBLEN
-#define reset_mbytes(state) IGNORE_RC(mblen(NULL, 0)), IGNORE_RC(mbtowc(NULL, NULL, 0))
+#define reset_mbytes(state) IGNORE_RC(mblen(NULL, (size_t) 0)), IGNORE_RC(mbtowc(NULL, NULL, (size_t) 0))
 #define count_mbytes(buffer,length,state) mblen(buffer,length)
 #define check_mbytes(wch,buffer,length,state) \
 	(int) mbtowc(&wch, buffer, length)
@@ -1960,7 +2087,8 @@
 #else
 make an error
 #endif
-#endif
+
+#endif /* USE_WIDEC_SUPPORT */
 
 /*
  * Not everyone has vsscanf(), but we'd like to use it for scanw().
@@ -2049,9 +2177,9 @@
 
 #define SetSafeOutcWrapper(outc)	    \
     SCREEN* sp = CURRENT_SCREEN;            \
+    struct screen outc_wrapper;		    \
     if (sp==0) {                            \
-	struct screen dummy;		    \
-	sp = &dummy;                        \
+	sp = &outc_wrapper;                 \
 	memset(sp,0,sizeof(struct screen)); \
 	sp->_outch = _nc_outc_wrapper;      \
     }\
@@ -2084,39 +2212,39 @@
 
 typedef struct term_driver {
     bool   isTerminfo;
-    bool   (*CanHandle)(struct DriverTCB*,const char*,int*);
+    bool   (*CanHandle)(struct DriverTCB*, const char*, int*);
     void   (*init)(struct DriverTCB*);
     void   (*release)(struct DriverTCB*);
     int    (*size)(struct DriverTCB*, int* Line, int *Cols);
-    int    (*sgmode)(struct DriverTCB*, bool setFlag, TTY*);
+    int    (*sgmode)(struct DriverTCB*, int setFlag, TTY*);
     chtype (*conattr)(struct DriverTCB*);
     int    (*hwcur)(struct DriverTCB*, int yold, int xold, int y, int x);
-    int    (*mode)(struct DriverTCB*, bool progFlag, bool defFlag);
+    int    (*mode)(struct DriverTCB*, int progFlag, int defFlag);
     bool   (*rescol)(struct DriverTCB*);
     bool   (*rescolors)(struct DriverTCB*);
-    void   (*color)(struct DriverTCB*,bool fore, int color, int(*)(SCREEN*,int));
-    int    (*doBeepOrFlash)(struct DriverTCB*, bool);
-    void   (*initpair)(struct DriverTCB*,short,short,short);
-    void   (*initcolor)(struct DriverTCB*,short,short,short,short);
-    void   (*docolor)(struct DriverTCB*,short,short,bool,int(*)(SCREEN*,int));
+    void   (*color)(struct DriverTCB*, int fore, int color, int(*)(SCREEN*, int));
+    int    (*doBeepOrFlash)(struct DriverTCB*, int);
+    void   (*initpair)(struct DriverTCB*, int, int, int);
+    void   (*initcolor)(struct DriverTCB*, int, int, int, int);
+    void   (*docolor)(struct DriverTCB*, int, int, int, int(*)(SCREEN*, int));
     void   (*initmouse)(struct DriverTCB*);
-    int    (*testmouse)(struct DriverTCB*,int);
+    int    (*testmouse)(struct DriverTCB*, int EVENTLIST_2nd(_nc_eventlist*));
     void   (*setfilter)(struct DriverTCB*);
-    void   (*hwlabel)(struct DriverTCB*,int,char*);
-    void   (*hwlabelOnOff)(struct DriverTCB*,bool);
+    void   (*hwlabel)(struct DriverTCB*, int, char*);
+    void   (*hwlabelOnOff)(struct DriverTCB*, int);
     int    (*update)(struct DriverTCB*);
-    int    (*defaultcolors)(struct DriverTCB*,int,int);
-    int    (*print)(struct DriverTCB*,char*,int);
-    int    (*getsize)(struct DriverTCB*,int*,int*);
-    int    (*setsize)(struct DriverTCB*,int,int);
-    void   (*initacs)(struct DriverTCB*,chtype*,chtype*);
+    int    (*defaultcolors)(struct DriverTCB*, int, int);
+    int    (*print)(struct DriverTCB*, char*, int);
+    int    (*getsize)(struct DriverTCB*, int*, int*);
+    int    (*setsize)(struct DriverTCB*, int, int);
+    void   (*initacs)(struct DriverTCB*, chtype*, chtype*);
     void   (*scinit)(SCREEN *);
     void   (*scexit)(SCREEN *);
-    int    (*twait)(struct DriverTCB*,int,int,int* EVENTLIST_2nd(_nc_eventlist*));
-    int    (*read)(struct DriverTCB*,int*);
-    int    (*nap)(struct DriverTCB*,int);
-    int    (*kpad)(struct DriverTCB*, bool);
-    int    (*kyOk)(struct DriverTCB*, int, bool);
+    int    (*twait)(struct DriverTCB*, int, int, int* EVENTLIST_2nd(_nc_eventlist*));
+    int    (*read)(struct DriverTCB*, int*);
+    int    (*nap)(struct DriverTCB*, int);
+    int    (*kpad)(struct DriverTCB*, int);
+    int    (*kyOk)(struct DriverTCB*, int, int);
     bool   (*kyExist)(struct DriverTCB*, int);
 } TERM_DRIVER;
 
@@ -2166,7 +2294,7 @@
 #else
 #define TINFO_HAS_KEY           NCURSES_SP_NAME(has_key)
 #define TINFO_DOUPDATE          NCURSES_SP_NAME(doupdate)
-#define TINFO_MVCUR             NCURSES_SP_NAME(mvcur)
+#define TINFO_MVCUR             NCURSES_SP_NAME(_nc_mvcur)
 #endif
 
 /*
@@ -2174,7 +2302,7 @@
  */
 #ifdef USE_TERM_DRIVER
 extern NCURSES_EXPORT(void)   _nc_get_screensize(SCREEN *, TERMINAL *, int *, int *);
-extern NCURSES_EXPORT(int)    _nc_setupterm_ex(TERMINAL **, NCURSES_CONST char *, int , int *, bool);
+extern NCURSES_EXPORT(int)    _nc_setupterm_ex(TERMINAL **, NCURSES_CONST char *, int , int *, int);
 #define TINFO_GET_SIZE(sp, tp, lp, cp) \
 	_nc_get_screensize(sp, tp, lp, cp)
 #define TINFO_SET_CURTERM(sp, tp) \
@@ -2239,7 +2367,9 @@
 extern NCURSES_EXPORT(int)      NCURSES_SP_NAME(_nc_get_tty_mode)(SCREEN*,TTY*);
 extern NCURSES_EXPORT(int)      NCURSES_SP_NAME(_nc_mcprint)(SCREEN*,char*, int);
 extern NCURSES_EXPORT(int)      NCURSES_SP_NAME(_nc_msec_cost)(SCREEN*, const char *, int);
+extern NCURSES_EXPORT(int)      NCURSES_SP_NAME(_nc_mvcur)(SCREEN*, int, int, int, int);
 extern NCURSES_EXPORT(int)      NCURSES_SP_NAME(_nc_outch)(SCREEN*, int);
+extern NCURSES_EXPORT(int)      NCURSES_SP_NAME(_nc_putchar)(SCREEN*, int);
 extern NCURSES_EXPORT(int)      NCURSES_SP_NAME(_nc_putp)(SCREEN*, const char *, const char*);
 extern NCURSES_EXPORT(int)      NCURSES_SP_NAME(_nc_putp_flush)(SCREEN*, const char *, const char *);
 extern NCURSES_EXPORT(int)      NCURSES_SP_NAME(_nc_resetty)(SCREEN*);
@@ -2250,12 +2380,12 @@
 extern NCURSES_EXPORT(int)      NCURSES_SP_NAME(_nc_scr_restore)(SCREEN*, const char*);
 extern NCURSES_EXPORT(int)      NCURSES_SP_NAME(_nc_scrolln)(SCREEN*, int, int, int, int);
 extern NCURSES_EXPORT(int)      NCURSES_SP_NAME(_nc_set_tty_mode)(SCREEN*, TTY*);
-extern NCURSES_EXPORT(int)      NCURSES_SP_NAME(_nc_setupscreen)(SCREEN**, int, int, FILE *, bool, int);
+extern NCURSES_EXPORT(int)      NCURSES_SP_NAME(_nc_setupscreen)(SCREEN**, int, int, FILE *, int, int);
 extern NCURSES_EXPORT(int)      NCURSES_SP_NAME(_nc_tgetent)(SCREEN*,char*,const char *);
 extern NCURSES_EXPORT(int)      NCURSES_SP_NAME(_nc_tigetnum)(SCREEN*,NCURSES_CONST char*);
 extern NCURSES_EXPORT(int)      NCURSES_SP_NAME(_nc_vid_attr)(SCREEN *, attr_t, short, void *);
 extern NCURSES_EXPORT(int)      NCURSES_SP_NAME(_nc_vidputs)(SCREEN*,chtype,int(*) (SCREEN*, int));
-extern NCURSES_EXPORT(void)     NCURSES_SP_NAME(_nc_do_color)(SCREEN*, short, short, bool, NCURSES_SP_OUTC);
+extern NCURSES_EXPORT(void)     NCURSES_SP_NAME(_nc_do_color)(SCREEN*, int, int, int, NCURSES_SP_OUTC);
 extern NCURSES_EXPORT(void)     NCURSES_SP_NAME(_nc_do_xmc_glitch)(SCREEN*, attr_t);
 extern NCURSES_EXPORT(void)     NCURSES_SP_NAME(_nc_flush)(SCREEN*);
 extern NCURSES_EXPORT(void)     NCURSES_SP_NAME(_nc_free_and_exit)(SCREEN*, int) GCC_NORETURN;
@@ -2271,7 +2401,7 @@
 extern NCURSES_EXPORT(void)     NCURSES_SP_NAME(_nc_screen_wrap)(SCREEN*);
 extern NCURSES_EXPORT(void)     NCURSES_SP_NAME(_nc_scroll_oldhash)(SCREEN*, int n, int top, int bot);
 extern NCURSES_EXPORT(void)     NCURSES_SP_NAME(_nc_scroll_optimize)(SCREEN*);
-extern NCURSES_EXPORT(void)     NCURSES_SP_NAME(_nc_set_buffer)(SCREEN*, FILE *, bool);
+extern NCURSES_EXPORT(void)     NCURSES_SP_NAME(_nc_set_buffer)(SCREEN*, FILE *, int);
 
 extern NCURSES_EXPORT(void)     _nc_cookie_init(SCREEN *sp);
 
Index: ncurses/fifo_defs.h
Prereq:  1.6 
--- ncurses-5.9/ncurses/fifo_defs.h	2008-06-28 15:52:32.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/fifo_defs.h	2012-08-04 15:59:17.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2002,2008 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2008,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -34,7 +34,7 @@
 /*
  * Common macros for lib_getch.c, lib_ungetch.c
  *
- * $Id: fifo_defs.h,v 1.6 2008/06/28 15:52:32 tom Exp $
+ * $Id: fifo_defs.h,v 1.7 2012/08/04 15:59:17 tom Exp $
  */
 
 #ifndef FIFO_DEFS_H
@@ -45,14 +45,42 @@
 /* peek points to next uninterpreted character */
 #define peek	sp->_fifopeek
 
-#define h_inc() { head == FIFO_SIZE-1 ? head = 0 : head++; if (head == tail) head = -1, tail = 0;}
-#define h_dec() { head == 0 ? head = FIFO_SIZE-1 : head--; if (head == tail) tail = -1;}
-#define t_inc() { tail == FIFO_SIZE-1 ? tail = 0 : tail++; if (tail == head) tail = -1;}
-#define t_dec() { tail == 0 ? tail = FIFO_SIZE-1 : tail--; if (head == tail) fifo_clear(sp);}
-#define p_inc() { peek == FIFO_SIZE-1 ? peek = 0 : peek++;}
+#define h_inc() { \
+	    (head >= FIFO_SIZE-1) \
+		? head = 0 \
+		: head++; \
+	    if (head == tail) \
+		head = -1, tail = 0; \
+	}
+#define h_dec() { \
+	    (head <= 0) \
+		? head = FIFO_SIZE-1 \
+		: head--; \
+	    if (head == tail) \
+		tail = -1; \
+	}
+#define t_inc() { \
+	    (tail >= FIFO_SIZE-1) \
+		? tail = 0 \
+		: tail++; \
+	    if (tail == head) \
+		tail = -1; \
+	    }
+#define t_dec() { \
+	    (tail <= 0) \
+		? tail = FIFO_SIZE-1 \
+		: tail--; \
+	    if (head == tail) \
+		fifo_clear(sp); \
+	    }
+#define p_inc() { \
+	    (peek >= FIFO_SIZE-1) \
+		? peek = 0 \
+		: peek++; \
+	    }
 
-#define cooked_key_in_fifo()	((head != -1) && (peek != head))
-#define raw_key_in_fifo()	((head != -1) && (peek != tail))
+#define cooked_key_in_fifo()	((head >= 0) && (peek != head))
+#define raw_key_in_fifo()	((head >= 0) && (peek != tail))
 
 #undef HIDE_EINTR
 
Index: ncurses/llib-lncurses
--- ncurses-5.9/ncurses/llib-lncurses	2011-01-08 18:57:00.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/llib-lncurses	2012-07-14 17:39:00.000000000 +0000
@@ -3369,6 +3369,17 @@
 		NCURSES_BOOL f)
 		{ /* void */ }
 
+#undef use_tioctl_sp
+void	use_tioctl_sp(
+		SCREEN	*sp, 
+		NCURSES_BOOL f)
+		{ /* void */ }
+
+#undef use_tioctl
+void	use_tioctl(
+		NCURSES_BOOL f)
+		{ /* void */ }
+
 #undef _nc_get_screensize
 void	_nc_get_screensize(
 		SCREEN	*sp, 
Index: ncurses/llib-lncursest
--- ncurses-5.9/ncurses/llib-lncursest	2011-01-08 19:03:20.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/llib-lncursest	2012-07-14 17:39:00.000000000 +0000
@@ -3449,6 +3449,17 @@
 		NCURSES_BOOL f)
 		{ /* void */ }
 
+#undef use_tioctl_sp
+void	use_tioctl_sp(
+		SCREEN	*sp, 
+		NCURSES_BOOL f)
+		{ /* void */ }
+
+#undef use_tioctl
+void	use_tioctl(
+		NCURSES_BOOL f)
+		{ /* void */ }
+
 #undef _nc_get_screensize
 void	_nc_get_screensize(
 		SCREEN	*sp, 
Index: ncurses/llib-lncursestw
--- ncurses-5.9/ncurses/llib-lncursestw	2011-01-08 19:11:35.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/llib-lncursestw	2012-07-14 17:39:00.000000000 +0000
@@ -4234,6 +4234,17 @@
 		NCURSES_BOOL f)
 		{ /* void */ }
 
+#undef use_tioctl_sp
+void	use_tioctl_sp(
+		SCREEN	*sp, 
+		NCURSES_BOOL f)
+		{ /* void */ }
+
+#undef use_tioct
+void	use_tioct(
+		NCURSES_BOOL f)
+		{ /* void */ }
+
 #undef _nc_get_screensize
 void	_nc_get_screensize(
 		SCREEN	*sp, 
Index: ncurses/llib-lncursesw
--- ncurses-5.9/ncurses/llib-lncursesw	2011-01-08 19:01:11.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/llib-lncursesw	2012-07-14 17:39:00.000000000 +0000
@@ -4154,6 +4154,17 @@
 		NCURSES_BOOL f)
 		{ /* void */ }
 
+#undef use_tioctl_sp
+void	use_tioctl_sp(
+		SCREEN	*sp, 
+		NCURSES_BOOL f)
+		{ /* void */ }
+
+#undef use_tioctl
+void	use_tioctl(
+		NCURSES_BOOL f)
+		{ /* void */ }
+
 #undef _nc_get_screensize
 void	_nc_get_screensize(
 		SCREEN	*sp, 
Index: ncurses/llib-ltic
--- /dev/null	2013-05-05 10:34:48.558701642 +0000
+++ ncurses-5.9-20130504/ncurses/llib-ltic	2012-06-30 20:16:16.000000000 +0000
@@ -0,0 +1,212 @@
+/****************************************************************************
+ * Copyright (c) 2012 Free Software Foundation, Inc.                        *
+ *                                                                          *
+ * Permission is hereby granted, free of charge, to any person obtaining a  *
+ * copy of this software and associated documentation files (the            *
+ * "Software"), to deal in the Software without restriction, including      *
+ * without limitation the rights to use, copy, modify, merge, publish,      *
+ * distribute, distribute with modifications, sublicense, and/or sell       *
+ * copies of the Software, and to permit persons to whom the Software is    *
+ * furnished to do so, subject to the following conditions:                 *
+ *                                                                          *
+ * The above copyright notice and this permission notice shall be included  *
+ * in all copies or substantial portions of the Software.                   *
+ *                                                                          *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
+ * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
+ *                                                                          *
+ * Except as contained in this notice, the name(s) of the above copyright   *
+ * holders shall not be used in advertising or otherwise to promote the     *
+ * sale, use or other dealings in this Software without prior written       *
+ * authorization.                                                           *
+ ****************************************************************************/
+
+/****************************************************************************
+ *  Author: Thomas E. Dickey 2012                                           *
+ ****************************************************************************/
+/* LINTLIBRARY */
+
+/* ./tinfo/alloc_entry.c */
+
+#include <curses.priv.h>
+#include <tic.h>
+
+#undef _nc_init_entry
+void	_nc_init_entry(
+		TERMTYPE *const tp)
+		{ /* void */ }
+
+#undef _nc_copy_entry
+ENTRY	*_nc_copy_entry(
+		ENTRY	*oldp)
+		{ return(*(ENTRY **)0); }
+
+#undef _nc_save_str
+char	*_nc_save_str(
+		const char *const string)
+		{ return(*(char **)0); }
+
+#undef _nc_wrap_entry
+void	_nc_wrap_entry(
+		ENTRY	*const ep, 
+		NCURSES_BOOL copy_strings)
+		{ /* void */ }
+
+#undef _nc_merge_entry
+void	_nc_merge_entry(
+		TERMTYPE *const to, 
+		TERMTYPE *const from)
+		{ /* void */ }
+
+/* ./tinfo/captoinfo.c */
+
+#include <ctype.h>
+
+#undef _nc_captoinfo
+char	*_nc_captoinfo(
+		const char *cap, 
+		const char *s, 
+		int const parameterized)
+		{ return(*(char **)0); }
+
+#undef _nc_infotocap
+char	*_nc_infotocap(
+		const char *cap, 
+		const char *str, 
+		int const parameterized)
+		{ return(*(char **)0); }
+
+/* ./tinfo/comp_expand.c */
+
+#undef _nc_tic_expand
+char	*_nc_tic_expand(
+		const char *srcp, 
+		NCURSES_BOOL tic_format, 
+		int	numbers)
+		{ return(*(char **)0); }
+
+/* ./tinfo/comp_parse.c */
+
+#undef _nc_check_termtype2
+void	(*_nc_check_termtype2)(
+		TERMTYPE *p1, 
+		NCURSES_BOOL p2);
+#undef _nc_check_termtype
+void	(*_nc_check_termtype)(
+		TERMTYPE *p1);
+
+#undef _nc_entry_match
+NCURSES_BOOL _nc_entry_match(
+		char	*n1, 
+		char	*n2)
+		{ return(*(NCURSES_BOOL *)0); }
+
+#undef _nc_read_entry_source
+void	_nc_read_entry_source(
+		FILE	*fp, 
+		char	*buf, 
+		int	literal, 
+		NCURSES_BOOL silent, 
+		NCURSES_BOOL (*hook)(
+		ENTRY	*p1))
+		{ /* void */ }
+
+#undef _nc_resolve_uses2
+int	_nc_resolve_uses2(
+		NCURSES_BOOL fullresolve, 
+		NCURSES_BOOL literal)
+		{ return(*(int *)0); }
+
+#undef _nc_resolve_uses
+int	_nc_resolve_uses(
+		NCURSES_BOOL fullresolve)
+		{ return(*(int *)0); }
+
+/* ./tinfo/comp_scan.c */
+
+#undef _nc_syntax
+int	_nc_syntax;
+#undef _nc_strict_bsd
+int	_nc_strict_bsd;
+#undef _nc_curr_file_pos
+long	_nc_curr_file_pos;
+#undef _nc_comment_start
+long	_nc_comment_start;
+#undef _nc_comment_end
+long	_nc_comment_end;
+#undef _nc_start_line
+long	_nc_start_line;
+#undef _nc_curr_token
+struct token _nc_curr_token;
+#undef _nc_disable_period
+NCURSES_BOOL _nc_disable_period;
+
+#undef _nc_reset_input
+void	_nc_reset_input(
+		FILE	*fp, 
+		char	*buf)
+		{ /* void */ }
+
+#undef _nc_get_token
+int	_nc_get_token(
+		NCURSES_BOOL silent)
+		{ return(*(int *)0); }
+
+#undef _nc_trans_string
+int	_nc_trans_string(
+		char	*ptr, 
+		char	*last)
+		{ return(*(int *)0); }
+
+#undef _nc_push_token
+void	_nc_push_token(
+		int	tokclass)
+		{ /* void */ }
+
+#undef _nc_panic_mode
+void	_nc_panic_mode(
+		char	ch)
+		{ /* void */ }
+
+/* ./tinfo/parse_entry.c */
+
+#undef _nc_parse_entry
+int	_nc_parse_entry(
+		struct entry *entryp, 
+		int	literal, 
+		NCURSES_BOOL silent)
+		{ return(*(int *)0); }
+
+#undef _nc_capcmp
+int	_nc_capcmp(
+		const char *s, 
+		const char *t)
+		{ return(*(int *)0); }
+
+typedef struct {
+    const char *from;
+    const char *to;
+} assoc;
+
+/* ./tinfo/write_entry.c */
+
+#include <hashed_db.h>
+
+#undef _nc_set_writedir
+void	_nc_set_writedir(
+		char	*dir)
+		{ /* void */ }
+
+#undef _nc_write_entry
+void	_nc_write_entry(
+		TERMTYPE *const tp)
+		{ /* void */ }
+
+#undef _nc_tic_written
+int	_nc_tic_written(void)
+		{ return(*(int *)0); }
Index: ncurses/llib-ltictw
--- /dev/null	2013-05-05 10:34:48.558701642 +0000
+++ ncurses-5.9-20130504/ncurses/llib-ltictw	2012-06-30 21:24:08.000000000 +0000
@@ -0,0 +1,212 @@
+/****************************************************************************
+ * Copyright (c) 2012 Free Software Foundation, Inc.                        *
+ *                                                                          *
+ * Permission is hereby granted, free of charge, to any person obtaining a  *
+ * copy of this software and associated documentation files (the            *
+ * "Software"), to deal in the Software without restriction, including      *
+ * without limitation the rights to use, copy, modify, merge, publish,      *
+ * distribute, distribute with modifications, sublicense, and/or sell       *
+ * copies of the Software, and to permit persons to whom the Software is    *
+ * furnished to do so, subject to the following conditions:                 *
+ *                                                                          *
+ * The above copyright notice and this permission notice shall be included  *
+ * in all copies or substantial portions of the Software.                   *
+ *                                                                          *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
+ * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
+ *                                                                          *
+ * Except as contained in this notice, the name(s) of the above copyright   *
+ * holders shall not be used in advertising or otherwise to promote the     *
+ * sale, use or other dealings in this Software without prior written       *
+ * authorization.                                                           *
+ ****************************************************************************/
+
+/****************************************************************************
+ *  Author: Thomas E. Dickey 2012                                           *
+ ****************************************************************************/
+/* LINTLIBRARY */
+
+/* ./tinfo/alloc_entry.c */
+
+#include <curses.priv.h>
+#include <tic.h>
+
+#undef _nc_init_entry
+void	_nc_init_entry(
+		TERMTYPE *const tp)
+		{ /* void */ }
+
+#undef _nc_copy_entry
+ENTRY	*_nc_copy_entry(
+		ENTRY	*oldp)
+		{ return(*(ENTRY **)0); }
+
+#undef _nc_save_str
+char	*_nc_save_str(
+		const char *const string)
+		{ return(*(char **)0); }
+
+#undef _nc_wrap_entry
+void	_nc_wrap_entry(
+		ENTRY	*const ep, 
+		NCURSES_BOOL copy_strings)
+		{ /* void */ }
+
+#undef _nc_merge_entry
+void	_nc_merge_entry(
+		TERMTYPE *const to, 
+		TERMTYPE *const from)
+		{ /* void */ }
+
+/* ./tinfo/captoinfo.c */
+
+#include <ctype.h>
+
+#undef _nc_captoinfo
+char	*_nc_captoinfo(
+		const char *cap, 
+		const char *s, 
+		int const parameterized)
+		{ return(*(char **)0); }
+
+#undef _nc_infotocap
+char	*_nc_infotocap(
+		const char *cap, 
+		const char *str, 
+		int const parameterized)
+		{ return(*(char **)0); }
+
+/* ./tinfo/comp_expand.c */
+
+#undef _nc_tic_expand
+char	*_nc_tic_expand(
+		const char *srcp, 
+		NCURSES_BOOL tic_format, 
+		int	numbers)
+		{ return(*(char **)0); }
+
+/* ./tinfo/comp_parse.c */
+
+#undef _nc_check_termtype2
+void	(*_nc_check_termtype2)(
+		TERMTYPE *p1, 
+		NCURSES_BOOL p2);
+#undef _nc_check_termtype
+void	(*_nc_check_termtype)(
+		TERMTYPE *p1);
+
+#undef _nc_entry_match
+NCURSES_BOOL _nc_entry_match(
+		char	*n1, 
+		char	*n2)
+		{ return(*(NCURSES_BOOL *)0); }
+
+#undef _nc_read_entry_source
+void	_nc_read_entry_source(
+		FILE	*fp, 
+		char	*buf, 
+		int	literal, 
+		NCURSES_BOOL silent, 
+		NCURSES_BOOL (*hook)(
+		ENTRY	*p1))
+		{ /* void */ }
+
+#undef _nc_resolve_uses2
+int	_nc_resolve_uses2(
+		NCURSES_BOOL fullresolve, 
+		NCURSES_BOOL literal)
+		{ return(*(int *)0); }
+
+#undef _nc_resolve_uses
+int	_nc_resolve_uses(
+		NCURSES_BOOL fullresolve)
+		{ return(*(int *)0); }
+
+/* ./tinfo/comp_scan.c */
+
+#undef _nc_syntax
+int	_nc_syntax;
+#undef _nc_strict_bsd
+int	_nc_strict_bsd;
+#undef _nc_curr_file_pos
+long	_nc_curr_file_pos;
+#undef _nc_comment_start
+long	_nc_comment_start;
+#undef _nc_comment_end
+long	_nc_comment_end;
+#undef _nc_start_line
+long	_nc_start_line;
+#undef _nc_curr_token
+struct token _nc_curr_token;
+#undef _nc_disable_period
+NCURSES_BOOL _nc_disable_period;
+
+#undef _nc_reset_input
+void	_nc_reset_input(
+		FILE	*fp, 
+		char	*buf)
+		{ /* void */ }
+
+#undef _nc_get_token
+int	_nc_get_token(
+		NCURSES_BOOL silent)
+		{ return(*(int *)0); }
+
+#undef _nc_trans_string
+int	_nc_trans_string(
+		char	*ptr, 
+		char	*last)
+		{ return(*(int *)0); }
+
+#undef _nc_push_token
+void	_nc_push_token(
+		int	tokclass)
+		{ /* void */ }
+
+#undef _nc_panic_mode
+void	_nc_panic_mode(
+		char	ch)
+		{ /* void */ }
+
+/* ./tinfo/parse_entry.c */
+
+#undef _nc_parse_entry
+int	_nc_parse_entry(
+		struct entry *entryp, 
+		int	literal, 
+		NCURSES_BOOL silent)
+		{ return(*(int *)0); }
+
+#undef _nc_capcmp
+int	_nc_capcmp(
+		const char *s, 
+		const char *t)
+		{ return(*(int *)0); }
+
+typedef struct {
+    const char *from;
+    const char *to;
+} assoc;
+
+/* ./tinfo/write_entry.c */
+
+#include <hashed_db.h>
+
+#undef _nc_set_writedir
+void	_nc_set_writedir(
+		char	*dir)
+		{ /* void */ }
+
+#undef _nc_write_entry
+void	_nc_write_entry(
+		TERMTYPE *const tp)
+		{ /* void */ }
+
+#undef _nc_tic_written
+int	_nc_tic_written(void)
+		{ return(*(int *)0); }
Index: ncurses/llib-lticw
--- /dev/null	2013-05-05 10:34:48.558701642 +0000
+++ ncurses-5.9-20130504/ncurses/llib-lticw	2012-06-30 21:00:26.000000000 +0000
@@ -0,0 +1,212 @@
+/****************************************************************************
+ * Copyright (c) 2012 Free Software Foundation, Inc.                        *
+ *                                                                          *
+ * Permission is hereby granted, free of charge, to any person obtaining a  *
+ * copy of this software and associated documentation files (the            *
+ * "Software"), to deal in the Software without restriction, including      *
+ * without limitation the rights to use, copy, modify, merge, publish,      *
+ * distribute, distribute with modifications, sublicense, and/or sell       *
+ * copies of the Software, and to permit persons to whom the Software is    *
+ * furnished to do so, subject to the following conditions:                 *
+ *                                                                          *
+ * The above copyright notice and this permission notice shall be included  *
+ * in all copies or substantial portions of the Software.                   *
+ *                                                                          *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
+ * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
+ *                                                                          *
+ * Except as contained in this notice, the name(s) of the above copyright   *
+ * holders shall not be used in advertising or otherwise to promote the     *
+ * sale, use or other dealings in this Software without prior written       *
+ * authorization.                                                           *
+ ****************************************************************************/
+
+/****************************************************************************
+ *  Author: Thomas E. Dickey 2012                                           *
+ ****************************************************************************/
+/* LINTLIBRARY */
+
+/* ./tinfo/alloc_entry.c */
+
+#include <curses.priv.h>
+#include <tic.h>
+
+#undef _nc_init_entry
+void	_nc_init_entry(
+		TERMTYPE *const tp)
+		{ /* void */ }
+
+#undef _nc_copy_entry
+ENTRY	*_nc_copy_entry(
+		ENTRY	*oldp)
+		{ return(*(ENTRY **)0); }
+
+#undef _nc_save_str
+char	*_nc_save_str(
+		const char *const string)
+		{ return(*(char **)0); }
+
+#undef _nc_wrap_entry
+void	_nc_wrap_entry(
+		ENTRY	*const ep, 
+		NCURSES_BOOL copy_strings)
+		{ /* void */ }
+
+#undef _nc_merge_entry
+void	_nc_merge_entry(
+		TERMTYPE *const to, 
+		TERMTYPE *const from)
+		{ /* void */ }
+
+/* ./tinfo/captoinfo.c */
+
+#include <ctype.h>
+
+#undef _nc_captoinfo
+char	*_nc_captoinfo(
+		const char *cap, 
+		const char *s, 
+		int const parameterized)
+		{ return(*(char **)0); }
+
+#undef _nc_infotocap
+char	*_nc_infotocap(
+		const char *cap, 
+		const char *str, 
+		int const parameterized)
+		{ return(*(char **)0); }
+
+/* ./tinfo/comp_expand.c */
+
+#undef _nc_tic_expand
+char	*_nc_tic_expand(
+		const char *srcp, 
+		NCURSES_BOOL tic_format, 
+		int	numbers)
+		{ return(*(char **)0); }
+
+/* ./tinfo/comp_parse.c */
+
+#undef _nc_check_termtype2
+void	(*_nc_check_termtype2)(
+		TERMTYPE *p1, 
+		NCURSES_BOOL p2);
+#undef _nc_check_termtype
+void	(*_nc_check_termtype)(
+		TERMTYPE *p1);
+
+#undef _nc_entry_match
+NCURSES_BOOL _nc_entry_match(
+		char	*n1, 
+		char	*n2)
+		{ return(*(NCURSES_BOOL *)0); }
+
+#undef _nc_read_entry_source
+void	_nc_read_entry_source(
+		FILE	*fp, 
+		char	*buf, 
+		int	literal, 
+		NCURSES_BOOL silent, 
+		NCURSES_BOOL (*hook)(
+		ENTRY	*p1))
+		{ /* void */ }
+
+#undef _nc_resolve_uses2
+int	_nc_resolve_uses2(
+		NCURSES_BOOL fullresolve, 
+		NCURSES_BOOL literal)
+		{ return(*(int *)0); }
+
+#undef _nc_resolve_uses
+int	_nc_resolve_uses(
+		NCURSES_BOOL fullresolve)
+		{ return(*(int *)0); }
+
+/* ./tinfo/comp_scan.c */
+
+#undef _nc_syntax
+int	_nc_syntax;
+#undef _nc_strict_bsd
+int	_nc_strict_bsd;
+#undef _nc_curr_file_pos
+long	_nc_curr_file_pos;
+#undef _nc_comment_start
+long	_nc_comment_start;
+#undef _nc_comment_end
+long	_nc_comment_end;
+#undef _nc_start_line
+long	_nc_start_line;
+#undef _nc_curr_token
+struct token _nc_curr_token;
+#undef _nc_disable_period
+NCURSES_BOOL _nc_disable_period;
+
+#undef _nc_reset_input
+void	_nc_reset_input(
+		FILE	*fp, 
+		char	*buf)
+		{ /* void */ }
+
+#undef _nc_get_token
+int	_nc_get_token(
+		NCURSES_BOOL silent)
+		{ return(*(int *)0); }
+
+#undef _nc_trans_string
+int	_nc_trans_string(
+		char	*ptr, 
+		char	*last)
+		{ return(*(int *)0); }
+
+#undef _nc_push_token
+void	_nc_push_token(
+		int	tokclass)
+		{ /* void */ }
+
+#undef _nc_panic_mode
+void	_nc_panic_mode(
+		char	ch)
+		{ /* void */ }
+
+/* ./tinfo/parse_entry.c */
+
+#undef _nc_parse_entry
+int	_nc_parse_entry(
+		struct entry *entryp, 
+		int	literal, 
+		NCURSES_BOOL silent)
+		{ return(*(int *)0); }
+
+#undef _nc_capcmp
+int	_nc_capcmp(
+		const char *s, 
+		const char *t)
+		{ return(*(int *)0); }
+
+typedef struct {
+    const char *from;
+    const char *to;
+} assoc;
+
+/* ./tinfo/write_entry.c */
+
+#include <hashed_db.h>
+
+#undef _nc_set_writedir
+void	_nc_set_writedir(
+		char	*dir)
+		{ /* void */ }
+
+#undef _nc_write_entry
+void	_nc_write_entry(
+		TERMTYPE *const tp)
+		{ /* void */ }
+
+#undef _nc_tic_written
+int	_nc_tic_written(void)
+		{ return(*(int *)0); }
Index: ncurses/llib-ltinfo
--- /dev/null	2013-05-05 10:34:48.558701642 +0000
+++ ncurses-5.9-20130504/ncurses/llib-ltinfo	2012-07-14 17:39:00.000000000 +0000
@@ -0,0 +1,1504 @@
+/****************************************************************************
+ * Copyright (c) 2012 Free Software Foundation, Inc.                        *
+ *                                                                          *
+ * Permission is hereby granted, free of charge, to any person obtaining a  *
+ * copy of this software and associated documentation files (the            *
+ * "Software"), to deal in the Software without restriction, including      *
+ * without limitation the rights to use, copy, modify, merge, publish,      *
+ * distribute, distribute with modifications, sublicense, and/or sell       *
+ * copies of the Software, and to permit persons to whom the Software is    *
+ * furnished to do so, subject to the following conditions:                 *
+ *                                                                          *
+ * The above copyright notice and this permission notice shall be included  *
+ * in all copies or substantial portions of the Software.                   *
+ *                                                                          *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
+ * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
+ *                                                                          *
+ * Except as contained in this notice, the name(s) of the above copyright   *
+ * holders shall not be used in advertising or otherwise to promote the     *
+ * sale, use or other dealings in this Software without prior written       *
+ * authorization.                                                           *
+ ****************************************************************************/
+
+/****************************************************************************
+ *  Author: Thomas E. Dickey 2012                                           *
+ ****************************************************************************/
+/* LINTLIBRARY */
+
+/* ./tinfo/access.c */
+
+#include <curses.priv.h>
+#include <ctype.h>
+#include <tic.h>
+
+#undef _nc_rootname
+char	*_nc_rootname(
+		char	*path)
+		{ return(*(char **)0); }
+
+#undef _nc_is_abs_path
+NCURSES_BOOL _nc_is_abs_path(
+		const char *path)
+		{ return(*(NCURSES_BOOL *)0); }
+
+#undef _nc_pathlast
+unsigned _nc_pathlast(
+		const char *path)
+		{ return(*(unsigned *)0); }
+
+#undef _nc_basename
+char	*_nc_basename(
+		char	*path)
+		{ return(*(char **)0); }
+
+#undef _nc_access
+int	_nc_access(
+		const char *path, 
+		int	mode)
+		{ return(*(int *)0); }
+
+#undef _nc_is_dir_path
+NCURSES_BOOL _nc_is_dir_path(
+		const char *path)
+		{ return(*(NCURSES_BOOL *)0); }
+
+#undef _nc_is_file_path
+NCURSES_BOOL _nc_is_file_path(
+		const char *path)
+		{ return(*(NCURSES_BOOL *)0); }
+
+#undef _nc_env_access
+int	_nc_env_access(void)
+		{ return(*(int *)0); }
+
+/* ./tinfo/add_tries.c */
+
+#undef _nc_add_to_try
+int	_nc_add_to_try(
+		TRIES	**tree, 
+		const char *str, 
+		unsigned code)
+		{ return(*(int *)0); }
+
+/* ./tinfo/alloc_ttype.c */
+
+#undef _nc_align_termtype
+void	_nc_align_termtype(
+		TERMTYPE *to, 
+		TERMTYPE *from)
+		{ /* void */ }
+
+#undef _nc_copy_termtype
+void	_nc_copy_termtype(
+		TERMTYPE *dst, 
+		const TERMTYPE *src)
+		{ /* void */ }
+
+/* ./codes.c */
+
+#undef boolcodes
+char	*const boolcodes[] = {0};
+#undef numcodes
+char	*const numcodes[] = {0};
+#undef strcodes
+char	*const strcodes[] = {0};
+
+/* ./comp_captab.c */
+
+#include <hashsize.h>
+
+#undef _nc_get_table
+const struct name_table_entry *_nc_get_table(
+		NCURSES_BOOL termcap)
+		{ return(*(const struct name_table_entry **)0); }
+
+#undef _nc_get_hash_table
+const HashValue *_nc_get_hash_table(
+		NCURSES_BOOL termcap)
+		{ return(*(const HashValue **)0); }
+
+#undef _nc_get_alias_table
+const struct alias *_nc_get_alias_table(
+		NCURSES_BOOL termcap)
+		{ return(*(const struct alias **)0); }
+
+#undef _nc_get_hash_info
+const HashData *_nc_get_hash_info(
+		NCURSES_BOOL termcap)
+		{ return(*(const HashData **)0); }
+
+/* ./tinfo/comp_error.c */
+
+#undef _nc_suppress_warnings
+NCURSES_BOOL _nc_suppress_warnings;
+#undef _nc_curr_line
+int	_nc_curr_line;
+#undef _nc_curr_col
+int	_nc_curr_col;
+
+#undef _nc_get_source
+const char *_nc_get_source(void)
+		{ return(*(const char **)0); }
+
+#undef _nc_set_source
+void	_nc_set_source(
+		const char *const name)
+		{ /* void */ }
+
+#undef _nc_set_type
+void	_nc_set_type(
+		const char *const name)
+		{ /* void */ }
+
+#undef _nc_get_type
+void	_nc_get_type(
+		char	*name)
+		{ /* void */ }
+
+#undef _nc_warning
+void	_nc_warning(
+		const char *const fmt, 
+		...)
+		{ /* void */ }
+
+#undef _nc_err_abort
+void	_nc_err_abort(
+		const char *const fmt, 
+		...)
+		{ /* void */ }
+
+#undef _nc_syserr_abort
+void	_nc_syserr_abort(
+		const char *const fmt, 
+		...)
+		{ /* void */ }
+
+/* ./tinfo/comp_hash.c */
+
+#undef _nc_find_entry
+struct name_table_entry const *_nc_find_entry(
+		const char *string, 
+		const HashValue *hash_table)
+		{ return(*(struct name_table_entry const **)0); }
+
+#undef _nc_find_type_entry
+struct name_table_entry const *_nc_find_type_entry(
+		const char *string, 
+		int	type, 
+		NCURSES_BOOL termcap)
+		{ return(*(struct name_table_entry const **)0); }
+
+/* ./tinfo/db_iterator.c */
+
+#include <time.h>
+
+#undef _nc_tic_dir
+const char *_nc_tic_dir(
+		const char *path)
+		{ return(*(const char **)0); }
+
+#undef _nc_keep_tic_dir
+void	_nc_keep_tic_dir(
+		const char *path)
+		{ /* void */ }
+
+#undef _nc_last_db
+void	_nc_last_db(void)
+		{ /* void */ }
+
+#undef _nc_next_db
+const char *_nc_next_db(
+		DBDIRS	*state, 
+		int	*offset)
+		{ return(*(const char **)0); }
+
+#undef _nc_first_db
+void	_nc_first_db(
+		DBDIRS	*state, 
+		int	*offset)
+		{ /* void */ }
+
+/* ./tinfo/doalloc.c */
+
+#undef _nc_doalloc
+void	*_nc_doalloc(
+		void	*oldp, 
+		size_t	amount)
+		{ return(*(void **)0); }
+
+/* ./tinfo/entries.c */
+
+#undef _nc_head
+ENTRY	*_nc_head;
+#undef _nc_tail
+ENTRY	*_nc_tail;
+
+#undef _nc_free_entry
+void	_nc_free_entry(
+		ENTRY	*headp, 
+		TERMTYPE *tterm)
+		{ /* void */ }
+
+#undef _nc_free_entries
+void	_nc_free_entries(
+		ENTRY	*headp)
+		{ /* void */ }
+
+#undef _nc_delink_entry
+ENTRY	*_nc_delink_entry(
+		ENTRY	*headp, 
+		TERMTYPE *tterm)
+		{ return(*(ENTRY **)0); }
+
+#undef _nc_leaks_tinfo
+void	_nc_leaks_tinfo(void)
+		{ /* void */ }
+
+/* ./fallback.c */
+
+#undef _nc_fallback
+const TERMTYPE *_nc_fallback(
+		const char *name)
+		{ return(*(const TERMTYPE **)0); }
+
+/* ./tinfo/free_ttype.c */
+
+#undef _nc_free_termtype
+void	_nc_free_termtype(
+		TERMTYPE *ptr)
+		{ /* void */ }
+
+#undef _nc_user_definable
+NCURSES_BOOL _nc_user_definable;
+
+#undef use_extended_names
+int	use_extended_names(
+		NCURSES_BOOL flag)
+		{ return(*(int *)0); }
+
+/* ./tinfo/getenv_num.c */
+
+#undef _nc_getenv_num
+int	_nc_getenv_num(
+		const char *name)
+		{ return(*(int *)0); }
+
+/* ./tinfo/home_terminfo.c */
+
+#undef _nc_home_terminfo
+char	*_nc_home_terminfo(void)
+		{ return(*(char **)0); }
+
+/* ./tinfo/init_keytry.c */
+
+#if 0
+
+#include <init_keytry.h>
+
+#undef _nc_tinfo_fkeys
+const struct tinfo_fkeys _nc_tinfo_fkeys[] = {0};
+
+#endif
+
+#undef _nc_init_keytry
+void	_nc_init_keytry(
+		SCREEN	*sp)
+		{ /* void */ }
+
+/* ./tinfo/lib_acs.c */
+
+#undef acs_map
+chtype	acs_map[128];
+
+#undef _nc_init_acs_sp
+void	_nc_init_acs_sp(
+		SCREEN	*sp)
+		{ /* void */ }
+
+#undef _nc_init_acs
+void	_nc_init_acs(void)
+		{ /* void */ }
+
+/* ./tinfo/lib_baudrate.c */
+
+#include <termcap.h>
+
+struct speed {
+    int s; 
+    int sp; 
+};
+
+#undef _nc_baudrate
+int	_nc_baudrate(
+		int	OSpeed)
+		{ return(*(int *)0); }
+
+#undef _nc_ospeed
+int	_nc_ospeed(
+		int	BaudRate)
+		{ return(*(int *)0); }
+
+#undef baudrate_sp
+int	baudrate_sp(
+		SCREEN	*sp)
+		{ return(*(int *)0); }
+
+#undef baudrate
+int	baudrate(void)
+		{ return(*(int *)0); }
+
+/* ./tinfo/lib_cur_term.c */
+
+#undef cur_term
+TERMINAL *cur_term;
+
+#undef set_curterm_sp
+TERMINAL *set_curterm_sp(
+		SCREEN	*sp, 
+		TERMINAL *termp)
+		{ return(*(TERMINAL **)0); }
+
+#undef set_curterm
+TERMINAL *set_curterm(
+		TERMINAL *termp)
+		{ return(*(TERMINAL **)0); }
+
+#undef del_curterm_sp
+int	del_curterm_sp(
+		SCREEN	*sp, 
+		TERMINAL *termp)
+		{ return(*(int *)0); }
+
+#undef del_curterm
+int	del_curterm(
+		TERMINAL *termp)
+		{ return(*(int *)0); }
+
+/* ./tinfo/lib_data.c */
+
+#undef stdscr
+WINDOW	*stdscr;
+#undef curscr
+WINDOW	*curscr;
+#undef newscr
+WINDOW	*newscr;
+#undef _nc_screen_chain
+SCREEN	*_nc_screen_chain;
+#undef SP
+SCREEN	*SP;
+#undef _nc_globals
+NCURSES_GLOBALS _nc_globals;
+#undef _nc_prescreen
+NCURSES_PRESCREEN _nc_prescreen;
+
+#undef _nc_screen_of
+SCREEN	*_nc_screen_of(
+		WINDOW	*win)
+		{ return(*(SCREEN **)0); }
+
+/* ./tinfo/lib_has_cap.c */
+
+#undef has_ic_sp
+NCURSES_BOOL has_ic_sp(
+		SCREEN	*sp)
+		{ return(*(NCURSES_BOOL *)0); }
+
+#undef has_ic
+NCURSES_BOOL has_ic(void)
+		{ return(*(NCURSES_BOOL *)0); }
+
+#undef has_il_sp
+NCURSES_BOOL has_il_sp(
+		SCREEN	*sp)
+		{ return(*(NCURSES_BOOL *)0); }
+
+#undef has_il
+NCURSES_BOOL has_il(void)
+		{ return(*(NCURSES_BOOL *)0); }
+
+/* ./tinfo/lib_kernel.c */
+
+#undef erasechar_sp
+char	erasechar_sp(
+		SCREEN	*sp)
+		{ return(*(char *)0); }
+
+#undef erasechar
+char	erasechar(void)
+		{ return(*(char *)0); }
+
+#undef killchar_sp
+char	killchar_sp(
+		SCREEN	*sp)
+		{ return(*(char *)0); }
+
+#undef killchar
+char	killchar(void)
+		{ return(*(char *)0); }
+
+#undef flushinp_sp
+int	flushinp_sp(
+		SCREEN	*sp)
+		{ return(*(int *)0); }
+
+#undef flushinp
+int	flushinp(void)
+		{ return(*(int *)0); }
+
+/* ./lib_keyname.c */
+
+struct kn { short offset; int code; };
+
+#undef keyname_sp
+char	*keyname_sp(
+		SCREEN	*sp, 
+		int	c)
+		{ return(*(char **)0); }
+
+#undef keyname
+char	*keyname(
+		int	c)
+		{ return(*(char **)0); }
+
+/* ./tinfo/lib_longname.c */
+
+#undef longname
+char	*longname(void)
+		{ return(*(char **)0); }
+
+/* ./tinfo/lib_napms.c */
+
+#include <sys/time.h>
+
+#undef napms_sp
+int	napms_sp(
+		SCREEN	*sp, 
+		int	ms)
+		{ return(*(int *)0); }
+
+#undef napms
+int	napms(
+		int	ms)
+		{ return(*(int *)0); }
+
+/* ./tinfo/lib_options.c */
+
+#undef idlok
+int	idlok(
+		WINDOW	*win, 
+		NCURSES_BOOL flag)
+		{ return(*(int *)0); }
+
+#undef idcok
+void	idcok(
+		WINDOW	*win, 
+		NCURSES_BOOL flag)
+		{ /* void */ }
+
+#undef halfdelay_sp
+int	halfdelay_sp(
+		SCREEN	*sp, 
+		int	t)
+		{ return(*(int *)0); }
+
+#undef halfdelay
+int	halfdelay(
+		int	t)
+		{ return(*(int *)0); }
+
+#undef nodelay
+int	nodelay(
+		WINDOW	*win, 
+		NCURSES_BOOL flag)
+		{ return(*(int *)0); }
+
+#undef notimeout
+int	notimeout(
+		WINDOW	*win, 
+		NCURSES_BOOL f)
+		{ return(*(int *)0); }
+
+#undef wtimeout
+void	wtimeout(
+		WINDOW	*win, 
+		int	delay)
+		{ /* void */ }
+
+#undef keypad
+int	keypad(
+		WINDOW	*win, 
+		NCURSES_BOOL flag)
+		{ return(*(int *)0); }
+
+#undef meta
+int	meta(
+		WINDOW	*win, 
+		NCURSES_BOOL flag)
+		{ return(*(int *)0); }
+
+#undef curs_set_sp
+int	curs_set_sp(
+		SCREEN	*sp, 
+		int	vis)
+		{ return(*(int *)0); }
+
+#undef curs_set
+int	curs_set(
+		int	vis)
+		{ return(*(int *)0); }
+
+#undef typeahead_sp
+int	typeahead_sp(
+		SCREEN	*sp, 
+		int	fd)
+		{ return(*(int *)0); }
+
+#undef typeahead
+int	typeahead(
+		int	fd)
+		{ return(*(int *)0); }
+
+#undef has_key_sp
+int	has_key_sp(
+		SCREEN	*sp, 
+		int	keycode)
+		{ return(*(int *)0); }
+
+#undef has_key
+int	has_key(
+		int	keycode)
+		{ return(*(int *)0); }
+
+#undef _nc_putp_flush_sp
+int	_nc_putp_flush_sp(
+		SCREEN	*sp, 
+		const char *name, 
+		const char *value)
+		{ return(*(int *)0); }
+
+#undef _nc_keypad
+int	_nc_keypad(
+		SCREEN	*sp, 
+		int	flag)
+		{ return(*(int *)0); }
+
+/* ./tinfo/lib_raw.c */
+
+#undef raw_sp
+int	raw_sp(
+		SCREEN	*sp)
+		{ return(*(int *)0); }
+
+#undef raw
+int	raw(void)
+		{ return(*(int *)0); }
+
+#undef cbreak_sp
+int	cbreak_sp(
+		SCREEN	*sp)
+		{ return(*(int *)0); }
+
+#undef cbreak
+int	cbreak(void)
+		{ return(*(int *)0); }
+
+#undef qiflush_sp
+void	qiflush_sp(
+		SCREEN	*sp)
+		{ /* void */ }
+
+#undef qiflush
+void	qiflush(void)
+		{ /* void */ }
+
+#undef noraw_sp
+int	noraw_sp(
+		SCREEN	*sp)
+		{ return(*(int *)0); }
+
+#undef noraw
+int	noraw(void)
+		{ return(*(int *)0); }
+
+#undef nocbreak_sp
+int	nocbreak_sp(
+		SCREEN	*sp)
+		{ return(*(int *)0); }
+
+#undef nocbreak
+int	nocbreak(void)
+		{ return(*(int *)0); }
+
+#undef noqiflush_sp
+void	noqiflush_sp(
+		SCREEN	*sp)
+		{ /* void */ }
+
+#undef noqiflush
+void	noqiflush(void)
+		{ /* void */ }
+
+#undef intrflush_sp
+int	intrflush_sp(
+		SCREEN	*sp, 
+		WINDOW	*win, 
+		NCURSES_BOOL flag)
+		{ return(*(int *)0); }
+
+#undef intrflush
+int	intrflush(
+		WINDOW	*win, 
+		NCURSES_BOOL flag)
+		{ return(*(int *)0); }
+
+/* ./tinfo/lib_setup.c */
+
+#include <locale.h>
+#include <sys/ioctl.h>
+#include <langinfo.h>
+
+#undef ttytype
+char	ttytype[256];
+#undef LINES
+int	LINES;
+#undef COLS
+int	COLS;
+#undef TABSIZE
+int	TABSIZE;
+
+#undef set_tabsize_sp
+int	set_tabsize_sp(
+		SCREEN	*sp, 
+		int	value)
+		{ return(*(int *)0); }
+
+#undef set_tabsize
+int	set_tabsize(
+		int	value)
+		{ return(*(int *)0); }
+
+#undef _nc_handle_sigwinch
+int	_nc_handle_sigwinch(
+		SCREEN	*sp)
+		{ return(*(int *)0); }
+
+#undef use_env_sp
+void	use_env_sp(
+		SCREEN	*sp, 
+		NCURSES_BOOL f)
+		{ /* void */ }
+
+#undef use_env
+void	use_env(
+		NCURSES_BOOL f)
+		{ /* void */ }
+
+#undef use_tioctl_sp
+void	use_tioctl_sp(
+		SCREEN	*sp, 
+		NCURSES_BOOL f)
+		{ /* void */ }
+
+#undef use_tioctl
+void	use_tioctl(
+		NCURSES_BOOL f)
+		{ /* void */ }
+
+#undef _nc_get_screensize
+void	_nc_get_screensize(
+		SCREEN	*sp, 
+		int	*linep, 
+		int	*colp)
+		{ /* void */ }
+
+#undef _nc_update_screensize
+void	_nc_update_screensize(
+		SCREEN	*sp)
+		{ /* void */ }
+
+#undef _nc_setup_tinfo
+int	_nc_setup_tinfo(
+		const char *const tn, 
+		TERMTYPE *const tp)
+		{ return(*(int *)0); }
+
+#undef _nc_tinfo_cmdch
+void	_nc_tinfo_cmdch(
+		TERMINAL *termp, 
+		int	proto)
+		{ /* void */ }
+
+#undef _nc_get_locale
+char	*_nc_get_locale(void)
+		{ return(*(char **)0); }
+
+#undef _nc_unicode_locale
+int	_nc_unicode_locale(void)
+		{ return(*(int *)0); }
+
+#undef _nc_locale_breaks_acs
+int	_nc_locale_breaks_acs(
+		TERMINAL *termp)
+		{ return(*(int *)0); }
+
+#undef _nc_setupterm
+int	_nc_setupterm(
+		char	*tname, 
+		int	Filedes, 
+		int	*errret, 
+		int	reuse)
+		{ return(*(int *)0); }
+
+#undef new_prescr
+SCREEN	*new_prescr(void)
+		{ return(*(SCREEN **)0); }
+
+#undef setupterm
+int	setupterm(
+		char	*tname, 
+		int	Filedes, 
+		int	*errret)
+		{ return(*(int *)0); }
+
+/* ./tinfo/lib_termcap.c */
+
+#undef UP
+char	*UP;
+#undef BC
+char	*BC;
+
+#undef tgetent_sp
+int	tgetent_sp(
+		SCREEN	*sp, 
+		char	*bufp, 
+		const char *name)
+		{ return(*(int *)0); }
+
+#if 0
+
+#include <capdefaults.c>
+
+#endif
+
+#undef tgetent
+int	tgetent(
+		char	*bufp, 
+		const char *name)
+		{ return(*(int *)0); }
+
+#undef tgetflag_sp
+int	tgetflag_sp(
+		SCREEN	*sp, 
+		char	*id)
+		{ return(*(int *)0); }
+
+#undef tgetflag
+int	tgetflag(
+		char	*id)
+		{ return(*(int *)0); }
+
+#undef tgetnum_sp
+int	tgetnum_sp(
+		SCREEN	*sp, 
+		char	*id)
+		{ return(*(int *)0); }
+
+#undef tgetnum
+int	tgetnum(
+		char	*id)
+		{ return(*(int *)0); }
+
+#undef tgetstr_sp
+char	*tgetstr_sp(
+		SCREEN	*sp, 
+		char	*id, 
+		char	**area)
+		{ return(*(char **)0); }
+
+#undef tgetstr
+char	*tgetstr(
+		char	*id, 
+		char	**area)
+		{ return(*(char **)0); }
+
+/* ./tinfo/lib_termname.c */
+
+#undef termname_sp
+char	*termname_sp(
+		SCREEN	*sp)
+		{ return(*(char **)0); }
+
+#undef termname
+char	*termname(void)
+		{ return(*(char **)0); }
+
+/* ./tinfo/lib_tgoto.c */
+
+#undef tgoto
+char	*tgoto(
+		const char *string, 
+		int	x, 
+		int	y)
+		{ return(*(char **)0); }
+
+/* ./tinfo/lib_ti.c */
+
+#undef tigetflag_sp
+int	tigetflag_sp(
+		SCREEN	*sp, 
+		char	*str)
+		{ return(*(int *)0); }
+
+#undef tigetflag
+int	tigetflag(
+		char	*str)
+		{ return(*(int *)0); }
+
+#undef tigetnum_sp
+int	tigetnum_sp(
+		SCREEN	*sp, 
+		char	*str)
+		{ return(*(int *)0); }
+
+#undef tigetnum
+int	tigetnum(
+		char	*str)
+		{ return(*(int *)0); }
+
+#undef tigetstr_sp
+char	*tigetstr_sp(
+		SCREEN	*sp, 
+		char	*str)
+		{ return(*(char **)0); }
+
+#undef tigetstr
+char	*tigetstr(
+		char	*str)
+		{ return(*(char **)0); }
+
+/* ./tinfo/lib_tparm.c */
+
+#undef _nc_tparm_err
+int	_nc_tparm_err;
+
+#undef _nc_tparm_analyze
+int	_nc_tparm_analyze(
+		const char *string, 
+		char	*p_is_s[9], 
+		int	*popcount)
+		{ return(*(int *)0); }
+
+#undef tparm
+char	*tparm(
+		char	*string, 
+		...)
+		{ return(*(char **)0); }
+
+#undef tiparm
+char	*tiparm(
+		const char *string, 
+		...)
+		{ return(*(char **)0); }
+
+/* ./tinfo/lib_tputs.c */
+
+#undef PC
+char	PC;
+#undef ospeed
+short	ospeed;
+#undef _nc_nulls_sent
+int	_nc_nulls_sent;
+
+#undef _nc_set_no_padding
+void	_nc_set_no_padding(
+		SCREEN	*sp)
+		{ /* void */ }
+
+#undef delay_output_sp
+int	delay_output_sp(
+		SCREEN	*sp, 
+		int	ms)
+		{ return(*(int *)0); }
+
+#undef delay_output
+int	delay_output(
+		int	ms)
+		{ return(*(int *)0); }
+
+#undef _nc_flush_sp
+void	_nc_flush_sp(
+		SCREEN	*sp)
+		{ /* void */ }
+
+#undef _nc_flush
+void	_nc_flush(void)
+		{ /* void */ }
+
+#undef _nc_outch_sp
+int	_nc_outch_sp(
+		SCREEN	*sp, 
+		int	ch)
+		{ return(*(int *)0); }
+
+#undef _nc_outch
+int	_nc_outch(
+		int	ch)
+		{ return(*(int *)0); }
+
+#undef putp_sp
+int	putp_sp(
+		SCREEN	*sp, 
+		const char *string)
+		{ return(*(int *)0); }
+
+#undef _nc_putp_sp
+int	_nc_putp_sp(
+		SCREEN	*sp, 
+		const char *name, 
+		const char *string)
+		{ return(*(int *)0); }
+
+#undef putp
+int	putp(
+		const char *string)
+		{ return(*(int *)0); }
+
+#undef _nc_putp
+int	_nc_putp(
+		const char *name, 
+		const char *string)
+		{ return(*(int *)0); }
+
+#undef tputs_sp
+int	tputs_sp(
+		SCREEN	*sp, 
+		const char *string, 
+		int	affcnt, 
+		NCURSES_OUTC_sp outc)
+		{ return(*(int *)0); }
+
+#undef _nc_outc_wrapper
+int	_nc_outc_wrapper(
+		SCREEN	*sp, 
+		int	c)
+		{ return(*(int *)0); }
+
+#undef tputs
+int	tputs(
+		const char *string, 
+		int	affcnt, 
+		int	(*outc)(
+		int	p1))
+		{ return(*(int *)0); }
+
+/* ./trace/lib_trace.c */
+
+#undef _nc_tracing
+unsigned _nc_tracing;
+#undef _nc_tputs_trace
+const char *_nc_tputs_trace = {0};
+#undef _nc_outchars
+long	_nc_outchars;
+
+#undef trace
+void	trace(
+		const unsigned int tracelevel)
+		{ /* void */ }
+
+#undef _tracef
+void	_tracef(
+		const char *fmt, 
+		...)
+		{ /* void */ }
+
+#undef _nc_retrace_bool
+NCURSES_BOOL _nc_retrace_bool(
+		int	code)
+		{ return(*(NCURSES_BOOL *)0); }
+
+#undef _nc_retrace_char
+char	_nc_retrace_char(
+		int	code)
+		{ return(*(char *)0); }
+
+#undef _nc_retrace_int
+int	_nc_retrace_int(
+		int	code)
+		{ return(*(int *)0); }
+
+#undef _nc_retrace_unsigned
+unsigned _nc_retrace_unsigned(
+		unsigned code)
+		{ return(*(unsigned *)0); }
+
+#undef _nc_retrace_ptr
+char	*_nc_retrace_ptr(
+		char	*code)
+		{ return(*(char **)0); }
+
+#undef _nc_retrace_cptr
+const char *_nc_retrace_cptr(
+		const char *code)
+		{ return(*(const char **)0); }
+
+#undef _nc_retrace_cvoid_ptr
+void	*_nc_retrace_cvoid_ptr(
+		void	*code)
+		{ return(*(void **)0); }
+
+#undef _nc_retrace_void_ptr
+void	*_nc_retrace_void_ptr(
+		void	*code)
+		{ return(*(void **)0); }
+
+#undef _nc_retrace_sp
+SCREEN	*_nc_retrace_sp(
+		SCREEN	*code)
+		{ return(*(SCREEN **)0); }
+
+#undef _nc_retrace_win
+WINDOW	*_nc_retrace_win(
+		WINDOW	*code)
+		{ return(*(WINDOW **)0); }
+
+/* ./trace/lib_traceatr.c */
+
+#undef _traceattr2
+char	*_traceattr2(
+		int	bufnum, 
+		chtype	newmode)
+		{ return(*(char **)0); }
+
+#undef _traceattr
+char	*_traceattr(
+		attr_t	newmode)
+		{ return(*(char **)0); }
+
+#undef _nc_retrace_int_attr_t
+int	_nc_retrace_int_attr_t(
+		attr_t	code)
+		{ return(*(int *)0); }
+
+#undef _nc_retrace_attr_t
+attr_t	_nc_retrace_attr_t(
+		attr_t	code)
+		{ return(*(attr_t *)0); }
+
+#undef _nc_altcharset_name
+const char *_nc_altcharset_name(
+		attr_t	attr, 
+		chtype	ch)
+		{ return(*(const char **)0); }
+
+#undef _tracechtype2
+char	*_tracechtype2(
+		int	bufnum, 
+		chtype	ch)
+		{ return(*(char **)0); }
+
+#undef _tracechtype
+char	*_tracechtype(
+		chtype	ch)
+		{ return(*(char **)0); }
+
+#undef _nc_retrace_chtype
+chtype	_nc_retrace_chtype(
+		chtype	code)
+		{ return(*(chtype *)0); }
+
+/* ./trace/lib_tracebits.c */
+
+typedef struct {
+    unsigned int val;
+    const char *name;
+} BITNAMES;
+
+#undef _nc_trace_ttymode
+char	*_nc_trace_ttymode(
+		struct termios *tty)
+		{ return(*(char **)0); }
+
+#undef _nc_tracebits
+char	*_nc_tracebits(void)
+		{ return(*(char **)0); }
+
+/* ./trace/lib_tracechr.c */
+
+#undef _nc_tracechar
+char	*_nc_tracechar(
+		SCREEN	*sp, 
+		int	ch)
+		{ return(*(char **)0); }
+
+#undef _tracechar
+char	*_tracechar(
+		int	ch)
+		{ return(*(char **)0); }
+
+/* ./tinfo/lib_ttyflags.c */
+
+#undef _nc_get_tty_mode_sp
+int	_nc_get_tty_mode_sp(
+		SCREEN	*sp, 
+		struct termios *buf)
+		{ return(*(int *)0); }
+
+#undef _nc_get_tty_mode
+int	_nc_get_tty_mode(
+		struct termios *buf)
+		{ return(*(int *)0); }
+
+#undef _nc_set_tty_mode_sp
+int	_nc_set_tty_mode_sp(
+		SCREEN	*sp, 
+		struct termios *buf)
+		{ return(*(int *)0); }
+
+#undef _nc_set_tty_mode
+int	_nc_set_tty_mode(
+		struct termios *buf)
+		{ return(*(int *)0); }
+
+#undef def_shell_mode_sp
+int	def_shell_mode_sp(
+		SCREEN	*sp)
+		{ return(*(int *)0); }
+
+#undef def_shell_mode
+int	def_shell_mode(void)
+		{ return(*(int *)0); }
+
+#undef def_prog_mode_sp
+int	def_prog_mode_sp(
+		SCREEN	*sp)
+		{ return(*(int *)0); }
+
+#undef def_prog_mode
+int	def_prog_mode(void)
+		{ return(*(int *)0); }
+
+#undef reset_prog_mode_sp
+int	reset_prog_mode_sp(
+		SCREEN	*sp)
+		{ return(*(int *)0); }
+
+#undef reset_prog_mode
+int	reset_prog_mode(void)
+		{ return(*(int *)0); }
+
+#undef reset_shell_mode_sp
+int	reset_shell_mode_sp(
+		SCREEN	*sp)
+		{ return(*(int *)0); }
+
+#undef reset_shell_mode
+int	reset_shell_mode(void)
+		{ return(*(int *)0); }
+
+#undef savetty_sp
+int	savetty_sp(
+		SCREEN	*sp)
+		{ return(*(int *)0); }
+
+#undef savetty
+int	savetty(void)
+		{ return(*(int *)0); }
+
+#undef resetty_sp
+int	resetty_sp(
+		SCREEN	*sp)
+		{ return(*(int *)0); }
+
+#undef resetty
+int	resetty(void)
+		{ return(*(int *)0); }
+
+/* ./tty/lib_twait.c */
+
+#undef _nc_timed_wait
+int	_nc_timed_wait(
+		SCREEN	*sp, 
+		int	mode, 
+		int	milliseconds, 
+		int	*timeleft)
+		{ return(*(int *)0); }
+
+/* ./tinfo/name_match.c */
+
+#undef _nc_first_name
+char	*_nc_first_name(
+		const char *const sp)
+		{ return(*(char **)0); }
+
+#undef _nc_name_match
+int	_nc_name_match(
+		const char *const namelst, 
+		const char *const name, 
+		const char *const delim)
+		{ return(*(int *)0); }
+
+/* ./names.c */
+
+#undef boolnames
+char	*const boolnames[] = {0};
+#undef boolfnames
+char	*const boolfnames[] = {0};
+#undef numnames
+char	*const numnames[] = {0};
+#undef numfnames
+char	*const numfnames[] = {0};
+#undef strnames
+char	*const strnames[] = {0};
+#undef strfnames
+char	*const strfnames[] = {0};
+
+/* ./tinfo/read_entry.c */
+
+#include <hashed_db.h>
+
+#undef _nc_read_termtype
+int	_nc_read_termtype(
+		TERMTYPE *ptr, 
+		char	*buffer, 
+		int	limit)
+		{ return(*(int *)0); }
+
+#undef _nc_read_file_entry
+int	_nc_read_file_entry(
+		const char *const filename, 
+		TERMTYPE *ptr)
+		{ return(*(int *)0); }
+
+#undef _nc_read_entry
+int	_nc_read_entry(
+		const char *const name, 
+		char	*const filename, 
+		TERMTYPE *const tp)
+		{ return(*(int *)0); }
+
+/* ./tinfo/read_termcap.c */
+
+#include <sys/types.h>
+
+#undef _nc_read_termcap
+void	_nc_read_termcap(void)
+		{ /* void */ }
+
+/* ./tinfo/setbuf.c */
+
+#undef _nc_set_buffer_sp
+void	_nc_set_buffer_sp(
+		SCREEN	*sp, 
+		FILE	*ofp, 
+		int	buffered)
+		{ /* void */ }
+
+#undef _nc_set_buffer
+void	_nc_set_buffer(
+		FILE	*ofp, 
+		int	buffered)
+		{ /* void */ }
+
+/* ./tinfo/strings.c */
+
+#undef _nc_str_init
+string_desc *_nc_str_init(
+		string_desc *dst, 
+		char	*src, 
+		size_t	len)
+		{ return(*(string_desc **)0); }
+
+#undef _nc_str_null
+string_desc *_nc_str_null(
+		string_desc *dst, 
+		size_t	len)
+		{ return(*(string_desc **)0); }
+
+#undef _nc_str_copy
+string_desc *_nc_str_copy(
+		string_desc *dst, 
+		string_desc *src)
+		{ return(*(string_desc **)0); }
+
+#undef _nc_safe_strcat
+NCURSES_BOOL _nc_safe_strcat(
+		string_desc *dst, 
+		const char *src)
+		{ return(*(NCURSES_BOOL *)0); }
+
+#undef _nc_safe_strcpy
+NCURSES_BOOL _nc_safe_strcpy(
+		string_desc *dst, 
+		const char *src)
+		{ return(*(NCURSES_BOOL *)0); }
+
+/* ./trace/trace_buf.c */
+
+#undef _nc_trace_buf
+char	*_nc_trace_buf(
+		int	bufnum, 
+		size_t	want)
+		{ return(*(char **)0); }
+
+#undef _nc_trace_bufcat
+char	*_nc_trace_bufcat(
+		int	bufnum, 
+		const char *value)
+		{ return(*(char **)0); }
+
+/* ./trace/trace_tries.c */
+
+#undef _nc_trace_tries
+void	_nc_trace_tries(
+		TRIES	*tree)
+		{ /* void */ }
+
+/* ./base/tries.c */
+
+#undef _nc_expand_try
+char	*_nc_expand_try(
+		TRIES	*tree, 
+		unsigned code, 
+		int	*count, 
+		size_t	len)
+		{ return(*(char **)0); }
+
+#undef _nc_remove_key
+int	_nc_remove_key(
+		TRIES	**tree, 
+		unsigned code)
+		{ return(*(int *)0); }
+
+#undef _nc_remove_string
+int	_nc_remove_string(
+		TRIES	**tree, 
+		const char *string)
+		{ return(*(int *)0); }
+
+/* ./tinfo/trim_sgr0.c */
+
+#undef _nc_trim_sgr0
+char	*_nc_trim_sgr0(
+		TERMTYPE *tp)
+		{ return(*(char **)0); }
+
+/* ./unctrl.c */
+
+#undef unctrl_sp
+char	*unctrl_sp(
+		SCREEN	*sp, 
+		chtype	ch)
+		{ return(*(char **)0); }
+
+#undef unctrl
+char	*unctrl(
+		chtype	ch)
+		{ return(*(char **)0); }
+
+/* ./trace/visbuf.c */
+
+#undef _nc_visbuf2
+const char *_nc_visbuf2(
+		int	bufnum, 
+		const char *buf)
+		{ return(*(const char **)0); }
+
+#undef _nc_visbuf
+const char *_nc_visbuf(
+		const char *buf)
+		{ return(*(const char **)0); }
+
+#undef _nc_visbufn
+const char *_nc_visbufn(
+		const char *buf, 
+		int	len)
+		{ return(*(const char **)0); }
+
+#undef _nc_viscbuf2
+const char *_nc_viscbuf2(
+		int	bufnum, 
+		const chtype *buf, 
+		int	len)
+		{ return(*(const char **)0); }
+
+#undef _nc_viscbuf
+const char *_nc_viscbuf(
+		const chtype *buf, 
+		int	len)
+		{ return(*(const char **)0); }
+
+/* ./base/define_key.c */
+
+#undef define_key_sp
+int	define_key_sp(
+		SCREEN	*sp, 
+		const char *str, 
+		int	keycode)
+		{ return(*(int *)0); }
+
+#undef define_key
+int	define_key(
+		const char *str, 
+		int	keycode)
+		{ return(*(int *)0); }
+
+/* ./tinfo/hashed_db.c */
+
+#undef _nc_hashed_db
+void	_nc_hashed_db(void)
+		{ /* void */ }
+
+/* ./base/key_defined.c */
+
+#undef key_defined_sp
+int	key_defined_sp(
+		SCREEN	*sp, 
+		const char *str)
+		{ return(*(int *)0); }
+
+#undef key_defined
+int	key_defined(
+		const char *str)
+		{ return(*(int *)0); }
+
+/* ./base/keybound.c */
+
+#undef keybound_sp
+char	*keybound_sp(
+		SCREEN	*sp, 
+		int	code, 
+		int	count)
+		{ return(*(char **)0); }
+
+#undef keybound
+char	*keybound(
+		int	code, 
+		int	count)
+		{ return(*(char **)0); }
+
+/* ./base/keyok.c */
+
+#undef keyok_sp
+int	keyok_sp(
+		SCREEN	*sp, 
+		int	c, 
+		NCURSES_BOOL flag)
+		{ return(*(int *)0); }
+
+#undef keyok
+int	keyok(
+		int	c, 
+		NCURSES_BOOL flag)
+		{ return(*(int *)0); }
+
+/* ./base/version.c */
+
+#undef curses_version
+const char *curses_version(void)
+		{ return(*(const char **)0); }
Index: ncurses/llib-ltinfotw
--- /dev/null	2013-05-05 10:34:48.558701642 +0000
+++ ncurses-5.9-20130504/ncurses/llib-ltinfotw	2012-07-14 17:39:00.000000000 +0000
@@ -0,0 +1,1646 @@
+/****************************************************************************
+ * Copyright (c) 2012 Free Software Foundation, Inc.                        *
+ *                                                                          *
+ * Permission is hereby granted, free of charge, to any person obtaining a  *
+ * copy of this software and associated documentation files (the            *
+ * "Software"), to deal in the Software without restriction, including      *
+ * without limitation the rights to use, copy, modify, merge, publish,      *
+ * distribute, distribute with modifications, sublicense, and/or sell       *
+ * copies of the Software, and to permit persons to whom the Software is    *
+ * furnished to do so, subject to the following conditions:                 *
+ *                                                                          *
+ * The above copyright notice and this permission notice shall be included  *
+ * in all copies or substantial portions of the Software.                   *
+ *                                                                          *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
+ * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
+ *                                                                          *
+ * Except as contained in this notice, the name(s) of the above copyright   *
+ * holders shall not be used in advertising or otherwise to promote the     *
+ * sale, use or other dealings in this Software without prior written       *
+ * authorization.                                                           *
+ ****************************************************************************/
+
+/****************************************************************************
+ *  Author: Thomas E. Dickey 2012                                           *
+ ****************************************************************************/
+/* LINTLIBRARY */
+
+/* ./tinfo/access.c */
+
+#include <curses.priv.h>
+#include <ctype.h>
+#include <tic.h>
+
+#undef _nc_rootname
+char	*_nc_rootname(
+		char	*path)
+		{ return(*(char **)0); }
+
+#undef _nc_is_abs_path
+NCURSES_BOOL _nc_is_abs_path(
+		const char *path)
+		{ return(*(NCURSES_BOOL *)0); }
+
+#undef _nc_pathlast
+unsigned _nc_pathlast(
+		const char *path)
+		{ return(*(unsigned *)0); }
+
+#undef _nc_basename
+char	*_nc_basename(
+		char	*path)
+		{ return(*(char **)0); }
+
+#undef _nc_access
+int	_nc_access(
+		const char *path, 
+		int	mode)
+		{ return(*(int *)0); }
+
+#undef _nc_is_dir_path
+NCURSES_BOOL _nc_is_dir_path(
+		const char *path)
+		{ return(*(NCURSES_BOOL *)0); }
+
+#undef _nc_is_file_path
+NCURSES_BOOL _nc_is_file_path(
+		const char *path)
+		{ return(*(NCURSES_BOOL *)0); }
+
+#undef _nc_env_access
+int	_nc_env_access(void)
+		{ return(*(int *)0); }
+
+/* ./tinfo/add_tries.c */
+
+#undef _nc_add_to_try
+int	_nc_add_to_try(
+		TRIES	**tree, 
+		const char *str, 
+		unsigned code)
+		{ return(*(int *)0); }
+
+/* ./tinfo/alloc_ttype.c */
+
+#undef _nc_align_termtype
+void	_nc_align_termtype(
+		TERMTYPE *to, 
+		TERMTYPE *from)
+		{ /* void */ }
+
+#undef _nc_copy_termtype
+void	_nc_copy_termtype(
+		TERMTYPE *dst, 
+		const TERMTYPE *src)
+		{ /* void */ }
+
+/* ./codes.c */
+
+#undef _nc_boolcodes
+char	*const *_nc_boolcodes(void)
+		{ return(*(char **)0); }
+
+#undef _nc_numcodes
+char	*const *_nc_numcodes(void)
+		{ return(*(char **)0); }
+
+#undef _nc_strcodes
+char	*const *_nc_strcodes(void)
+		{ return(*(char **)0); }
+
+/* ./comp_captab.c */
+
+#include <hashsize.h>
+
+#undef _nc_get_table
+const struct name_table_entry *_nc_get_table(
+		NCURSES_BOOL termcap)
+		{ return(*(const struct name_table_entry **)0); }
+
+#undef _nc_get_hash_table
+const HashValue *_nc_get_hash_table(
+		NCURSES_BOOL termcap)
+		{ return(*(const HashValue **)0); }
+
+#undef _nc_get_alias_table
+const struct alias *_nc_get_alias_table(
+		NCURSES_BOOL termcap)
+		{ return(*(const struct alias **)0); }
+
+#undef _nc_get_hash_info
+const HashData *_nc_get_hash_info(
+		NCURSES_BOOL termcap)
+		{ return(*(const HashData **)0); }
+
+/* ./tinfo/comp_error.c */
+
+#undef _nc_suppress_warnings
+NCURSES_BOOL _nc_suppress_warnings;
+#undef _nc_curr_line
+int	_nc_curr_line;
+#undef _nc_curr_col
+int	_nc_curr_col;
+
+#undef _nc_get_source
+const char *_nc_get_source(void)
+		{ return(*(const char **)0); }
+
+#undef _nc_set_source
+void	_nc_set_source(
+		const char *const name)
+		{ /* void */ }
+
+#undef _nc_set_type
+void	_nc_set_type(
+		const char *const name)
+		{ /* void */ }
+
+#undef _nc_get_type
+void	_nc_get_type(
+		char	*name)
+		{ /* void */ }
+
+#undef _nc_warning
+void	_nc_warning(
+		const char *const fmt, 
+		...)
+		{ /* void */ }
+
+#undef _nc_err_abort
+void	_nc_err_abort(
+		const char *const fmt, 
+		...)
+		{ /* void */ }
+
+#undef _nc_syserr_abort
+void	_nc_syserr_abort(
+		const char *const fmt, 
+		...)
+		{ /* void */ }
+
+/* ./tinfo/comp_hash.c */
+
+#undef _nc_find_entry
+struct name_table_entry const *_nc_find_entry(
+		const char *string, 
+		const HashValue *hash_table)
+		{ return(*(struct name_table_entry const **)0); }
+
+#undef _nc_find_type_entry
+struct name_table_entry const *_nc_find_type_entry(
+		const char *string, 
+		int	type, 
+		NCURSES_BOOL termcap)
+		{ return(*(struct name_table_entry const **)0); }
+
+/* ./tinfo/db_iterator.c */
+
+#include <time.h>
+
+#undef _nc_tic_dir
+const char *_nc_tic_dir(
+		const char *path)
+		{ return(*(const char **)0); }
+
+#undef _nc_keep_tic_dir
+void	_nc_keep_tic_dir(
+		const char *path)
+		{ /* void */ }
+
+#undef _nc_last_db
+void	_nc_last_db(void)
+		{ /* void */ }
+
+#undef _nc_next_db
+const char *_nc_next_db(
+		DBDIRS	*state, 
+		int	*offset)
+		{ return(*(const char **)0); }
+
+#undef _nc_first_db
+void	_nc_first_db(
+		DBDIRS	*state, 
+		int	*offset)
+		{ /* void */ }
+
+/* ./tinfo/doalloc.c */
+
+#undef _nc_doalloc
+void	*_nc_doalloc(
+		void	*oldp, 
+		size_t	amount)
+		{ return(*(void **)0); }
+
+/* ./tinfo/entries.c */
+
+#undef _nc_head
+ENTRY	*_nc_head;
+#undef _nc_tail
+ENTRY	*_nc_tail;
+
+#undef _nc_free_entry
+void	_nc_free_entry(
+		ENTRY	*headp, 
+		TERMTYPE *tterm)
+		{ /* void */ }
+
+#undef _nc_free_entries
+void	_nc_free_entries(
+		ENTRY	*headp)
+		{ /* void */ }
+
+#undef _nc_delink_entry
+ENTRY	*_nc_delink_entry(
+		ENTRY	*headp, 
+		TERMTYPE *tterm)
+		{ return(*(ENTRY **)0); }
+
+#undef _nc_leaks_tinfo
+void	_nc_leaks_tinfo(void)
+		{ /* void */ }
+
+/* ./fallback.c */
+
+#undef _nc_fallback
+const TERMTYPE *_nc_fallback(
+		const char *name)
+		{ return(*(const TERMTYPE **)0); }
+
+/* ./tinfo/free_ttype.c */
+
+#undef _nc_free_termtype
+void	_nc_free_termtype(
+		TERMTYPE *ptr)
+		{ /* void */ }
+
+#undef _nc_user_definable
+NCURSES_BOOL _nc_user_definable;
+
+#undef use_extended_names
+int	use_extended_names(
+		NCURSES_BOOL flag)
+		{ return(*(int *)0); }
+
+/* ./tinfo/getenv_num.c */
+
+#undef _nc_getenv_num
+int	_nc_getenv_num(
+		const char *name)
+		{ return(*(int *)0); }
+
+/* ./tinfo/home_terminfo.c */
+
+#undef _nc_home_terminfo
+char	*_nc_home_terminfo(void)
+		{ return(*(char **)0); }
+
+/* ./tinfo/init_keytry.c */
+
+#if 0
+
+#include <init_keytry.h>
+
+#undef _nc_tinfo_fkeys
+const struct tinfo_fkeys _nc_tinfo_fkeys[] = {0};
+
+#endif
+
+#undef _nc_init_keytry
+void	_nc_init_keytry(
+		SCREEN	*sp)
+		{ /* void */ }
+
+/* ./tinfo/lib_acs.c */
+
+#undef _nc_acs_map
+chtype	*_nc_acs_map(void)
+		{ return(*(chtype **)0); }
+
+#undef _nc_init_acs_sp
+void	_nc_init_acs_sp(
+		SCREEN	*sp)
+		{ /* void */ }
+
+#undef _nc_init_acs
+void	_nc_init_acs(void)
+		{ /* void */ }
+
+/* ./tinfo/lib_baudrate.c */
+
+#include <termcap.h>
+
+struct speed {
+    int s; 
+    int sp; 
+};
+
+#undef _nc_baudrate
+int	_nc_baudrate(
+		int	OSpeed)
+		{ return(*(int *)0); }
+
+#undef _nc_ospeed
+int	_nc_ospeed(
+		int	BaudRate)
+		{ return(*(int *)0); }
+
+#undef baudrate_sp
+int	baudrate_sp(
+		SCREEN	*sp)
+		{ return(*(int *)0); }
+
+#undef baudrate
+int	baudrate(void)
+		{ return(*(int *)0); }
+
+/* ./tinfo/lib_cur_term.c */
+
+#undef _nc_get_cur_term_sp
+TERMINAL *_nc_get_cur_term_sp(
+		SCREEN	*sp)
+		{ return(*(TERMINAL **)0); }
+
+#undef _nc_get_cur_term
+TERMINAL *_nc_get_cur_term(void)
+		{ return(*(TERMINAL **)0); }
+
+#undef _nc_cur_term
+TERMINAL *_nc_cur_term(void)
+		{ return(*(TERMINAL **)0); }
+
+#undef set_curterm_sp
+TERMINAL *set_curterm_sp(
+		SCREEN	*sp, 
+		TERMINAL *termp)
+		{ return(*(TERMINAL **)0); }
+
+#undef set_curterm
+TERMINAL *set_curterm(
+		TERMINAL *termp)
+		{ return(*(TERMINAL **)0); }
+
+#undef del_curterm_sp
+int	del_curterm_sp(
+		SCREEN	*sp, 
+		TERMINAL *termp)
+		{ return(*(int *)0); }
+
+#undef del_curterm
+int	del_curterm(
+		TERMINAL *termp)
+		{ return(*(int *)0); }
+
+/* ./tinfo/lib_data.c */
+
+#undef _nc_stdscr
+WINDOW	*_nc_stdscr(void)
+		{ return(*(WINDOW **)0); }
+
+#undef _nc_curscr
+WINDOW	*_nc_curscr(void)
+		{ return(*(WINDOW **)0); }
+
+#undef _nc_newscr
+WINDOW	*_nc_newscr(void)
+		{ return(*(WINDOW **)0); }
+
+#undef _nc_screen_chain
+SCREEN	*_nc_screen_chain;
+#undef SP
+SCREEN	*SP;
+#undef _nc_globals
+NCURSES_GLOBALS _nc_globals;
+#undef _nc_prescreen
+NCURSES_PRESCREEN _nc_prescreen;
+
+#undef _nc_screen_of
+SCREEN	*_nc_screen_of(
+		WINDOW	*win)
+		{ return(*(SCREEN **)0); }
+
+#undef _nc_init_pthreads
+void	_nc_init_pthreads(void)
+		{ /* void */ }
+
+#undef _nc_mutex_init
+void	_nc_mutex_init(
+		pthread_mutex_t *obj)
+		{ /* void */ }
+
+#undef _nc_mutex_lock
+int	_nc_mutex_lock(
+		pthread_mutex_t *obj)
+		{ return(*(int *)0); }
+
+#undef _nc_mutex_trylock
+int	_nc_mutex_trylock(
+		pthread_mutex_t *obj)
+		{ return(*(int *)0); }
+
+#undef _nc_mutex_unlock
+int	_nc_mutex_unlock(
+		pthread_mutex_t *obj)
+		{ return(*(int *)0); }
+
+/* ./tinfo/lib_has_cap.c */
+
+#undef has_ic_sp
+NCURSES_BOOL has_ic_sp(
+		SCREEN	*sp)
+		{ return(*(NCURSES_BOOL *)0); }
+
+#undef has_ic
+NCURSES_BOOL has_ic(void)
+		{ return(*(NCURSES_BOOL *)0); }
+
+#undef has_il_sp
+NCURSES_BOOL has_il_sp(
+		SCREEN	*sp)
+		{ return(*(NCURSES_BOOL *)0); }
+
+#undef has_il
+NCURSES_BOOL has_il(void)
+		{ return(*(NCURSES_BOOL *)0); }
+
+/* ./tinfo/lib_kernel.c */
+
+#undef erasechar_sp
+char	erasechar_sp(
+		SCREEN	*sp)
+		{ return(*(char *)0); }
+
+#undef erasechar
+char	erasechar(void)
+		{ return(*(char *)0); }
+
+#undef killchar_sp
+char	killchar_sp(
+		SCREEN	*sp)
+		{ return(*(char *)0); }
+
+#undef killchar
+char	killchar(void)
+		{ return(*(char *)0); }
+
+#undef flushinp_sp
+int	flushinp_sp(
+		SCREEN	*sp)
+		{ return(*(int *)0); }
+
+#undef flushinp
+int	flushinp(void)
+		{ return(*(int *)0); }
+
+/* ./lib_keyname.c */
+
+struct kn { short offset; int code; };
+
+#undef keyname_sp
+char	*keyname_sp(
+		SCREEN	*sp, 
+		int	c)
+		{ return(*(char **)0); }
+
+#undef keyname
+char	*keyname(
+		int	c)
+		{ return(*(char **)0); }
+
+/* ./tinfo/lib_longname.c */
+
+#undef longname_sp
+char	*longname_sp(
+		SCREEN	*sp)
+		{ return(*(char **)0); }
+
+#undef longname
+char	*longname(void)
+		{ return(*(char **)0); }
+
+/* ./tinfo/lib_napms.c */
+
+#undef napms_sp
+int	napms_sp(
+		SCREEN	*sp, 
+		int	ms)
+		{ return(*(int *)0); }
+
+#undef napms
+int	napms(
+		int	ms)
+		{ return(*(int *)0); }
+
+/* ./tinfo/lib_options.c */
+
+#undef idlok
+int	idlok(
+		WINDOW	*win, 
+		NCURSES_BOOL flag)
+		{ return(*(int *)0); }
+
+#undef idcok
+void	idcok(
+		WINDOW	*win, 
+		NCURSES_BOOL flag)
+		{ /* void */ }
+
+#undef halfdelay_sp
+int	halfdelay_sp(
+		SCREEN	*sp, 
+		int	t)
+		{ return(*(int *)0); }
+
+#undef halfdelay
+int	halfdelay(
+		int	t)
+		{ return(*(int *)0); }
+
+#undef nodelay
+int	nodelay(
+		WINDOW	*win, 
+		NCURSES_BOOL flag)
+		{ return(*(int *)0); }
+
+#undef notimeout
+int	notimeout(
+		WINDOW	*win, 
+		NCURSES_BOOL f)
+		{ return(*(int *)0); }
+
+#undef wtimeout
+void	wtimeout(
+		WINDOW	*win, 
+		int	delay)
+		{ /* void */ }
+
+#undef keypad
+int	keypad(
+		WINDOW	*win, 
+		NCURSES_BOOL flag)
+		{ return(*(int *)0); }
+
+#undef meta
+int	meta(
+		WINDOW	*win, 
+		NCURSES_BOOL flag)
+		{ return(*(int *)0); }
+
+#undef curs_set_sp
+int	curs_set_sp(
+		SCREEN	*sp, 
+		int	vis)
+		{ return(*(int *)0); }
+
+#undef curs_set
+int	curs_set(
+		int	vis)
+		{ return(*(int *)0); }
+
+#undef typeahead_sp
+int	typeahead_sp(
+		SCREEN	*sp, 
+		int	fd)
+		{ return(*(int *)0); }
+
+#undef typeahead
+int	typeahead(
+		int	fd)
+		{ return(*(int *)0); }
+
+#undef has_key_sp
+int	has_key_sp(
+		SCREEN	*sp, 
+		int	keycode)
+		{ return(*(int *)0); }
+
+#undef has_key
+int	has_key(
+		int	keycode)
+		{ return(*(int *)0); }
+
+#undef _nc_putp_flush_sp
+int	_nc_putp_flush_sp(
+		SCREEN	*sp, 
+		const char *name, 
+		const char *value)
+		{ return(*(int *)0); }
+
+#undef _nc_keypad
+int	_nc_keypad(
+		SCREEN	*sp, 
+		int	flag)
+		{ return(*(int *)0); }
+
+/* ./tinfo/lib_raw.c */
+
+#undef raw_sp
+int	raw_sp(
+		SCREEN	*sp)
+		{ return(*(int *)0); }
+
+#undef raw
+int	raw(void)
+		{ return(*(int *)0); }
+
+#undef cbreak_sp
+int	cbreak_sp(
+		SCREEN	*sp)
+		{ return(*(int *)0); }
+
+#undef cbreak
+int	cbreak(void)
+		{ return(*(int *)0); }
+
+#undef qiflush_sp
+void	qiflush_sp(
+		SCREEN	*sp)
+		{ /* void */ }
+
+#undef qiflush
+void	qiflush(void)
+		{ /* void */ }
+
+#undef noraw_sp
+int	noraw_sp(
+		SCREEN	*sp)
+		{ return(*(int *)0); }
+
+#undef noraw
+int	noraw(void)
+		{ return(*(int *)0); }
+
+#undef nocbreak_sp
+int	nocbreak_sp(
+		SCREEN	*sp)
+		{ return(*(int *)0); }
+
+#undef nocbreak
+int	nocbreak(void)
+		{ return(*(int *)0); }
+
+#undef noqiflush_sp
+void	noqiflush_sp(
+		SCREEN	*sp)
+		{ /* void */ }
+
+#undef noqiflush
+void	noqiflush(void)
+		{ /* void */ }
+
+#undef intrflush_sp
+int	intrflush_sp(
+		SCREEN	*sp, 
+		WINDOW	*win, 
+		NCURSES_BOOL flag)
+		{ return(*(int *)0); }
+
+#undef intrflush
+int	intrflush(
+		WINDOW	*win, 
+		NCURSES_BOOL flag)
+		{ return(*(int *)0); }
+
+/* ./tinfo/lib_setup.c */
+
+#include <locale.h>
+#include <sys/ioctl.h>
+#include <langinfo.h>
+
+#undef _nc_ttytype
+char	*_nc_ttytype(void)
+		{ return(*(char **)0); }
+
+#undef _nc_ptr_Lines
+int	*_nc_ptr_Lines(
+		SCREEN	*sp)
+		{ return(*(int **)0); }
+
+#undef _nc_LINES
+int	_nc_LINES(void)
+		{ return(*(int *)0); }
+
+#undef _nc_ptr_Cols
+int	*_nc_ptr_Cols(
+		SCREEN	*sp)
+		{ return(*(int **)0); }
+
+#undef _nc_COLS
+int	_nc_COLS(void)
+		{ return(*(int *)0); }
+
+#undef _nc_ptr_Tabsize
+int	*_nc_ptr_Tabsize(
+		SCREEN	*sp)
+		{ return(*(int **)0); }
+
+#undef _nc_TABSIZE
+int	_nc_TABSIZE(void)
+		{ return(*(int *)0); }
+
+#undef set_tabsize_sp
+int	set_tabsize_sp(
+		SCREEN	*sp, 
+		int	value)
+		{ return(*(int *)0); }
+
+#undef set_tabsize
+int	set_tabsize(
+		int	value)
+		{ return(*(int *)0); }
+
+#undef _nc_handle_sigwinch
+int	_nc_handle_sigwinch(
+		SCREEN	*sp)
+		{ return(*(int *)0); }
+
+#undef use_env_sp
+void	use_env_sp(
+		SCREEN	*sp, 
+		NCURSES_BOOL f)
+		{ /* void */ }
+
+#undef use_env
+void	use_env(
+		NCURSES_BOOL f)
+		{ /* void */ }
+
+#undef use_tioctl_sp
+void	use_tioctl_sp(
+		SCREEN	*sp, 
+		NCURSES_BOOL f)
+		{ /* void */ }
+
+#undef use_tioctl
+void	use_tioctl(
+		NCURSES_BOOL f)
+		{ /* void */ }
+
+#undef _nc_get_screensize
+void	_nc_get_screensize(
+		SCREEN	*sp, 
+		int	*linep, 
+		int	*colp)
+		{ /* void */ }
+
+#undef _nc_update_screensize
+void	_nc_update_screensize(
+		SCREEN	*sp)
+		{ /* void */ }
+
+#undef _nc_setup_tinfo
+int	_nc_setup_tinfo(
+		const char *const tn, 
+		TERMTYPE *const tp)
+		{ return(*(int *)0); }
+
+#undef _nc_tinfo_cmdch
+void	_nc_tinfo_cmdch(
+		TERMINAL *termp, 
+		int	proto)
+		{ /* void */ }
+
+#undef _nc_get_locale
+char	*_nc_get_locale(void)
+		{ return(*(char **)0); }
+
+#undef _nc_unicode_locale
+int	_nc_unicode_locale(void)
+		{ return(*(int *)0); }
+
+#undef _nc_locale_breaks_acs
+int	_nc_locale_breaks_acs(
+		TERMINAL *termp)
+		{ return(*(int *)0); }
+
+#undef _nc_setupterm
+int	_nc_setupterm(
+		char	*tname, 
+		int	Filedes, 
+		int	*errret, 
+		int	reuse)
+		{ return(*(int *)0); }
+
+#undef new_prescr
+SCREEN	*new_prescr(void)
+		{ return(*(SCREEN **)0); }
+
+#undef setupterm
+int	setupterm(
+		char	*tname, 
+		int	Filedes, 
+		int	*errret)
+		{ return(*(int *)0); }
+
+/* ./tinfo/lib_termcap.c */
+
+#undef UP
+char	*UP;
+#undef BC
+char	*BC;
+
+#undef tgetent_sp
+int	tgetent_sp(
+		SCREEN	*sp, 
+		char	*bufp, 
+		const char *name)
+		{ return(*(int *)0); }
+
+#if 0
+
+#include <capdefaults.c>
+
+#endif
+
+#undef tgetent
+int	tgetent(
+		char	*bufp, 
+		const char *name)
+		{ return(*(int *)0); }
+
+#undef tgetflag_sp
+int	tgetflag_sp(
+		SCREEN	*sp, 
+		char	*id)
+		{ return(*(int *)0); }
+
+#undef tgetflag
+int	tgetflag(
+		char	*id)
+		{ return(*(int *)0); }
+
+#undef tgetnum_sp
+int	tgetnum_sp(
+		SCREEN	*sp, 
+		char	*id)
+		{ return(*(int *)0); }
+
+#undef tgetnum
+int	tgetnum(
+		char	*id)
+		{ return(*(int *)0); }
+
+#undef tgetstr_sp
+char	*tgetstr_sp(
+		SCREEN	*sp, 
+		char	*id, 
+		char	**area)
+		{ return(*(char **)0); }
+
+#undef tgetstr
+char	*tgetstr(
+		char	*id, 
+		char	**area)
+		{ return(*(char **)0); }
+
+/* ./tinfo/lib_termname.c */
+
+#undef termname_sp
+char	*termname_sp(
+		SCREEN	*sp)
+		{ return(*(char **)0); }
+
+#undef termname
+char	*termname(void)
+		{ return(*(char **)0); }
+
+/* ./tinfo/lib_tgoto.c */
+
+#undef tgoto
+char	*tgoto(
+		const char *string, 
+		int	x, 
+		int	y)
+		{ return(*(char **)0); }
+
+/* ./tinfo/lib_ti.c */
+
+#undef tigetflag_sp
+int	tigetflag_sp(
+		SCREEN	*sp, 
+		char	*str)
+		{ return(*(int *)0); }
+
+#undef tigetflag
+int	tigetflag(
+		char	*str)
+		{ return(*(int *)0); }
+
+#undef tigetnum_sp
+int	tigetnum_sp(
+		SCREEN	*sp, 
+		char	*str)
+		{ return(*(int *)0); }
+
+#undef tigetnum
+int	tigetnum(
+		char	*str)
+		{ return(*(int *)0); }
+
+#undef tigetstr_sp
+char	*tigetstr_sp(
+		SCREEN	*sp, 
+		char	*str)
+		{ return(*(char **)0); }
+
+#undef tigetstr
+char	*tigetstr(
+		char	*str)
+		{ return(*(char **)0); }
+
+/* ./tinfo/lib_tparm.c */
+
+#undef _nc_tparm_err
+int	_nc_tparm_err;
+
+#undef _nc_tparm_analyze
+int	_nc_tparm_analyze(
+		const char *string, 
+		char	*p_is_s[9], 
+		int	*popcount)
+		{ return(*(int *)0); }
+
+#undef tparm
+char	*tparm(
+		char	*string, 
+		...)
+		{ return(*(char **)0); }
+
+#undef tiparm
+char	*tiparm(
+		const char *string, 
+		...)
+		{ return(*(char **)0); }
+
+/* ./tinfo/lib_tputs.c */
+
+#undef PC
+char	PC;
+#undef ospeed
+short	ospeed;
+#undef _nc_nulls_sent
+int	_nc_nulls_sent;
+
+#undef _nc_set_no_padding
+void	_nc_set_no_padding(
+		SCREEN	*sp)
+		{ /* void */ }
+
+#undef delay_output_sp
+int	delay_output_sp(
+		SCREEN	*sp, 
+		int	ms)
+		{ return(*(int *)0); }
+
+#undef delay_output
+int	delay_output(
+		int	ms)
+		{ return(*(int *)0); }
+
+#undef _nc_flush_sp
+void	_nc_flush_sp(
+		SCREEN	*sp)
+		{ /* void */ }
+
+#undef _nc_flush
+void	_nc_flush(void)
+		{ /* void */ }
+
+#undef _nc_outch_sp
+int	_nc_outch_sp(
+		SCREEN	*sp, 
+		int	ch)
+		{ return(*(int *)0); }
+
+#undef _nc_outch
+int	_nc_outch(
+		int	ch)
+		{ return(*(int *)0); }
+
+#undef putp_sp
+int	putp_sp(
+		SCREEN	*sp, 
+		const char *string)
+		{ return(*(int *)0); }
+
+#undef _nc_putp_sp
+int	_nc_putp_sp(
+		SCREEN	*sp, 
+		const char *name, 
+		const char *string)
+		{ return(*(int *)0); }
+
+#undef putp
+int	putp(
+		const char *string)
+		{ return(*(int *)0); }
+
+#undef _nc_putp
+int	_nc_putp(
+		const char *name, 
+		const char *string)
+		{ return(*(int *)0); }
+
+#undef tputs_sp
+int	tputs_sp(
+		SCREEN	*sp, 
+		const char *string, 
+		int	affcnt, 
+		NCURSES_OUTC_sp outc)
+		{ return(*(int *)0); }
+
+#undef _nc_outc_wrapper
+int	_nc_outc_wrapper(
+		SCREEN	*sp, 
+		int	c)
+		{ return(*(int *)0); }
+
+#undef tputs
+int	tputs(
+		const char *string, 
+		int	affcnt, 
+		int	(*outc)(
+		int	p1))
+		{ return(*(int *)0); }
+
+/* ./trace/lib_trace.c */
+
+#undef _nc_tracing
+unsigned _nc_tracing;
+
+#undef _nc__nc_tputs_trace
+const char *_nc__nc_tputs_trace(void)
+		{ return(*(const char **)0); }
+
+#undef _nc__nc_outchars
+long	_nc__nc_outchars(void)
+		{ return(*(long *)0); }
+
+#undef _nc_set_tputs_trace
+void	_nc_set_tputs_trace(
+		const char *s)
+		{ /* void */ }
+
+#undef _nc_count_outchars
+void	_nc_count_outchars(
+		long	increment)
+		{ /* void */ }
+
+#undef trace
+void	trace(
+		const unsigned int tracelevel)
+		{ /* void */ }
+
+#undef _tracef
+void	_tracef(
+		const char *fmt, 
+		...)
+		{ /* void */ }
+
+#undef _nc_retrace_bool
+NCURSES_BOOL _nc_retrace_bool(
+		int	code)
+		{ return(*(NCURSES_BOOL *)0); }
+
+#undef _nc_retrace_char
+char	_nc_retrace_char(
+		int	code)
+		{ return(*(char *)0); }
+
+#undef _nc_retrace_int
+int	_nc_retrace_int(
+		int	code)
+		{ return(*(int *)0); }
+
+#undef _nc_retrace_unsigned
+unsigned _nc_retrace_unsigned(
+		unsigned code)
+		{ return(*(unsigned *)0); }
+
+#undef _nc_retrace_ptr
+char	*_nc_retrace_ptr(
+		char	*code)
+		{ return(*(char **)0); }
+
+#undef _nc_retrace_cptr
+const char *_nc_retrace_cptr(
+		const char *code)
+		{ return(*(const char **)0); }
+
+#undef _nc_retrace_cvoid_ptr
+void	*_nc_retrace_cvoid_ptr(
+		void	*code)
+		{ return(*(void **)0); }
+
+#undef _nc_retrace_void_ptr
+void	*_nc_retrace_void_ptr(
+		void	*code)
+		{ return(*(void **)0); }
+
+#undef _nc_retrace_sp
+SCREEN	*_nc_retrace_sp(
+		SCREEN	*code)
+		{ return(*(SCREEN **)0); }
+
+#undef _nc_retrace_win
+WINDOW	*_nc_retrace_win(
+		WINDOW	*code)
+		{ return(*(WINDOW **)0); }
+
+#undef _nc_use_tracef
+int	_nc_use_tracef(
+		unsigned mask)
+		{ return(*(int *)0); }
+
+#undef _nc_locked_tracef
+void	_nc_locked_tracef(
+		const char *fmt, 
+		...)
+		{ /* void */ }
+
+/* ./trace/lib_traceatr.c */
+
+#undef _traceattr2
+char	*_traceattr2(
+		int	bufnum, 
+		chtype	newmode)
+		{ return(*(char **)0); }
+
+#undef _traceattr
+char	*_traceattr(
+		attr_t	newmode)
+		{ return(*(char **)0); }
+
+#undef _nc_retrace_int_attr_t
+int	_nc_retrace_int_attr_t(
+		attr_t	code)
+		{ return(*(int *)0); }
+
+#undef _nc_retrace_attr_t
+attr_t	_nc_retrace_attr_t(
+		attr_t	code)
+		{ return(*(attr_t *)0); }
+
+#undef _nc_altcharset_name
+const char *_nc_altcharset_name(
+		attr_t	attr, 
+		chtype	ch)
+		{ return(*(const char **)0); }
+
+#undef _tracechtype2
+char	*_tracechtype2(
+		int	bufnum, 
+		chtype	ch)
+		{ return(*(char **)0); }
+
+#undef _tracechtype
+char	*_tracechtype(
+		chtype	ch)
+		{ return(*(char **)0); }
+
+#undef _nc_retrace_chtype
+chtype	_nc_retrace_chtype(
+		chtype	code)
+		{ return(*(chtype *)0); }
+
+#undef _tracecchar_t2
+char	*_tracecchar_t2(
+		int	bufnum, 
+		const cchar_t *ch)
+		{ return(*(char **)0); }
+
+#undef _tracecchar_t
+char	*_tracecchar_t(
+		const cchar_t *ch)
+		{ return(*(char **)0); }
+
+/* ./trace/lib_tracebits.c */
+
+typedef struct {
+    unsigned int val;
+    const char *name;
+} BITNAMES;
+
+#undef _nc_trace_ttymode
+char	*_nc_trace_ttymode(
+		struct termios *tty)
+		{ return(*(char **)0); }
+
+#undef _nc_tracebits
+char	*_nc_tracebits(void)
+		{ return(*(char **)0); }
+
+/* ./trace/lib_tracechr.c */
+
+#undef _nc_tracechar
+char	*_nc_tracechar(
+		SCREEN	*sp, 
+		int	ch)
+		{ return(*(char **)0); }
+
+#undef _tracechar
+char	*_tracechar(
+		int	ch)
+		{ return(*(char **)0); }
+
+/* ./tinfo/lib_ttyflags.c */
+
+#undef _nc_get_tty_mode_sp
+int	_nc_get_tty_mode_sp(
+		SCREEN	*sp, 
+		struct termios *buf)
+		{ return(*(int *)0); }
+
+#undef _nc_get_tty_mode
+int	_nc_get_tty_mode(
+		struct termios *buf)
+		{ return(*(int *)0); }
+
+#undef _nc_set_tty_mode_sp
+int	_nc_set_tty_mode_sp(
+		SCREEN	*sp, 
+		struct termios *buf)
+		{ return(*(int *)0); }
+
+#undef _nc_set_tty_mode
+int	_nc_set_tty_mode(
+		struct termios *buf)
+		{ return(*(int *)0); }
+
+#undef def_shell_mode_sp
+int	def_shell_mode_sp(
+		SCREEN	*sp)
+		{ return(*(int *)0); }
+
+#undef def_shell_mode
+int	def_shell_mode(void)
+		{ return(*(int *)0); }
+
+#undef def_prog_mode_sp
+int	def_prog_mode_sp(
+		SCREEN	*sp)
+		{ return(*(int *)0); }
+
+#undef def_prog_mode
+int	def_prog_mode(void)
+		{ return(*(int *)0); }
+
+#undef reset_prog_mode_sp
+int	reset_prog_mode_sp(
+		SCREEN	*sp)
+		{ return(*(int *)0); }
+
+#undef reset_prog_mode
+int	reset_prog_mode(void)
+		{ return(*(int *)0); }
+
+#undef reset_shell_mode_sp
+int	reset_shell_mode_sp(
+		SCREEN	*sp)
+		{ return(*(int *)0); }
+
+#undef reset_shell_mode
+int	reset_shell_mode(void)
+		{ return(*(int *)0); }
+
+#undef savetty_sp
+int	savetty_sp(
+		SCREEN	*sp)
+		{ return(*(int *)0); }
+
+#undef savetty
+int	savetty(void)
+		{ return(*(int *)0); }
+
+#undef resetty_sp
+int	resetty_sp(
+		SCREEN	*sp)
+		{ return(*(int *)0); }
+
+#undef resetty
+int	resetty(void)
+		{ return(*(int *)0); }
+
+/* ./tty/lib_twait.c */
+
+#include <sys/time.h>
+
+#undef _nc_timed_wait
+int	_nc_timed_wait(
+		SCREEN	*sp, 
+		int	mode, 
+		int	milliseconds, 
+		int	*timeleft)
+		{ return(*(int *)0); }
+
+/* ./tinfo/name_match.c */
+
+#undef _nc_first_name
+char	*_nc_first_name(
+		const char *const sp)
+		{ return(*(char **)0); }
+
+#undef _nc_name_match
+int	_nc_name_match(
+		const char *const namelst, 
+		const char *const name, 
+		const char *const delim)
+		{ return(*(int *)0); }
+
+/* ./names.c */
+
+#undef _nc_boolnames
+char	*const *_nc_boolnames(void)
+		{ return(*(char **)0); }
+
+#undef _nc_boolfnames
+char	*const *_nc_boolfnames(void)
+		{ return(*(char **)0); }
+
+#undef _nc_numnames
+char	*const *_nc_numnames(void)
+		{ return(*(char **)0); }
+
+#undef _nc_numfnames
+char	*const *_nc_numfnames(void)
+		{ return(*(char **)0); }
+
+#undef _nc_strnames
+char	*const *_nc_strnames(void)
+		{ return(*(char **)0); }
+
+#undef _nc_strfnames
+char	*const *_nc_strfnames(void)
+		{ return(*(char **)0); }
+
+/* ./tinfo/read_entry.c */
+
+#include <hashed_db.h>
+
+#undef _nc_read_termtype
+int	_nc_read_termtype(
+		TERMTYPE *ptr, 
+		char	*buffer, 
+		int	limit)
+		{ return(*(int *)0); }
+
+#undef _nc_read_file_entry
+int	_nc_read_file_entry(
+		const char *const filename, 
+		TERMTYPE *ptr)
+		{ return(*(int *)0); }
+
+#undef _nc_read_entry
+int	_nc_read_entry(
+		const char *const name, 
+		char	*const filename, 
+		TERMTYPE *const tp)
+		{ return(*(int *)0); }
+
+/* ./tinfo/read_termcap.c */
+
+#include <sys/types.h>
+
+#undef _nc_read_termcap
+void	_nc_read_termcap(void)
+		{ /* void */ }
+
+/* ./tinfo/setbuf.c */
+
+#undef _nc_set_buffer_sp
+void	_nc_set_buffer_sp(
+		SCREEN	*sp, 
+		FILE	*ofp, 
+		int	buffered)
+		{ /* void */ }
+
+#undef _nc_set_buffer
+void	_nc_set_buffer(
+		FILE	*ofp, 
+		int	buffered)
+		{ /* void */ }
+
+/* ./tinfo/strings.c */
+
+#undef _nc_str_init
+string_desc *_nc_str_init(
+		string_desc *dst, 
+		char	*src, 
+		size_t	len)
+		{ return(*(string_desc **)0); }
+
+#undef _nc_str_null
+string_desc *_nc_str_null(
+		string_desc *dst, 
+		size_t	len)
+		{ return(*(string_desc **)0); }
+
+#undef _nc_str_copy
+string_desc *_nc_str_copy(
+		string_desc *dst, 
+		string_desc *src)
+		{ return(*(string_desc **)0); }
+
+#undef _nc_safe_strcat
+NCURSES_BOOL _nc_safe_strcat(
+		string_desc *dst, 
+		const char *src)
+		{ return(*(NCURSES_BOOL *)0); }
+
+#undef _nc_safe_strcpy
+NCURSES_BOOL _nc_safe_strcpy(
+		string_desc *dst, 
+		const char *src)
+		{ return(*(NCURSES_BOOL *)0); }
+
+/* ./trace/trace_buf.c */
+
+#undef _nc_trace_buf
+char	*_nc_trace_buf(
+		int	bufnum, 
+		size_t	want)
+		{ return(*(char **)0); }
+
+#undef _nc_trace_bufcat
+char	*_nc_trace_bufcat(
+		int	bufnum, 
+		const char *value)
+		{ return(*(char **)0); }
+
+/* ./trace/trace_tries.c */
+
+#undef _nc_trace_tries
+void	_nc_trace_tries(
+		TRIES	*tree)
+		{ /* void */ }
+
+/* ./base/tries.c */
+
+#undef _nc_expand_try
+char	*_nc_expand_try(
+		TRIES	*tree, 
+		unsigned code, 
+		int	*count, 
+		size_t	len)
+		{ return(*(char **)0); }
+
+#undef _nc_remove_key
+int	_nc_remove_key(
+		TRIES	**tree, 
+		unsigned code)
+		{ return(*(int *)0); }
+
+#undef _nc_remove_string
+int	_nc_remove_string(
+		TRIES	**tree, 
+		const char *string)
+		{ return(*(int *)0); }
+
+/* ./tinfo/trim_sgr0.c */
+
+#undef _nc_trim_sgr0
+char	*_nc_trim_sgr0(
+		TERMTYPE *tp)
+		{ return(*(char **)0); }
+
+/* ./unctrl.c */
+
+#undef unctrl_sp
+char	*unctrl_sp(
+		SCREEN	*sp, 
+		chtype	ch)
+		{ return(*(char **)0); }
+
+#undef unctrl
+char	*unctrl(
+		chtype	ch)
+		{ return(*(char **)0); }
+
+/* ./trace/visbuf.c */
+
+#undef _nc_visbuf2
+const char *_nc_visbuf2(
+		int	bufnum, 
+		const char *buf)
+		{ return(*(const char **)0); }
+
+#undef _nc_visbuf
+const char *_nc_visbuf(
+		const char *buf)
+		{ return(*(const char **)0); }
+
+#undef _nc_visbufn
+const char *_nc_visbufn(
+		const char *buf, 
+		int	len)
+		{ return(*(const char **)0); }
+
+#undef _nc_viswbuf2
+const char *_nc_viswbuf2(
+		int	bufnum, 
+		const wchar_t *buf)
+		{ return(*(const char **)0); }
+
+#undef _nc_viswbuf
+const char *_nc_viswbuf(
+		const wchar_t *buf)
+		{ return(*(const char **)0); }
+
+#undef _nc_viswbufn
+const char *_nc_viswbufn(
+		const wchar_t *buf, 
+		int	len)
+		{ return(*(const char **)0); }
+
+#undef _nc_viswibuf
+const char *_nc_viswibuf(
+		const wint_t *buf)
+		{ return(*(const char **)0); }
+
+#undef _nc_viscbuf2
+const char *_nc_viscbuf2(
+		int	bufnum, 
+		const cchar_t *buf, 
+		int	len)
+		{ return(*(const char **)0); }
+
+#undef _nc_viscbuf
+const char *_nc_viscbuf(
+		const cchar_t *buf, 
+		int	len)
+		{ return(*(const char **)0); }
+
+/* ./base/define_key.c */
+
+#undef define_key_sp
+int	define_key_sp(
+		SCREEN	*sp, 
+		const char *str, 
+		int	keycode)
+		{ return(*(int *)0); }
+
+#undef define_key
+int	define_key(
+		const char *str, 
+		int	keycode)
+		{ return(*(int *)0); }
+
+/* ./tinfo/hashed_db.c */
+
+#undef _nc_hashed_db
+void	_nc_hashed_db(void)
+		{ /* void */ }
+
+/* ./base/key_defined.c */
+
+#undef key_defined_sp
+int	key_defined_sp(
+		SCREEN	*sp, 
+		const char *str)
+		{ return(*(int *)0); }
+
+#undef key_defined
+int	key_defined(
+		const char *str)
+		{ return(*(int *)0); }
+
+/* ./base/keybound.c */
+
+#undef keybound_sp
+char	*keybound_sp(
+		SCREEN	*sp, 
+		int	code, 
+		int	count)
+		{ return(*(char **)0); }
+
+#undef keybound
+char	*keybound(
+		int	code, 
+		int	count)
+		{ return(*(char **)0); }
+
+/* ./base/keyok.c */
+
+#undef keyok_sp
+int	keyok_sp(
+		SCREEN	*sp, 
+		int	c, 
+		NCURSES_BOOL flag)
+		{ return(*(int *)0); }
+
+#undef keyok
+int	keyok(
+		int	c, 
+		NCURSES_BOOL flag)
+		{ return(*(int *)0); }
+
+/* ./base/version.c */
+
+#undef curses_version
+const char *curses_version(void)
+		{ return(*(const char **)0); }
Index: ncurses/llib-ltinfow
--- /dev/null	2013-05-05 10:34:48.558701642 +0000
+++ ncurses-5.9-20130504/ncurses/llib-ltinfow	2012-07-14 17:39:00.000000000 +0000
@@ -0,0 +1,1537 @@
+/****************************************************************************
+ * Copyright (c) 2012 Free Software Foundation, Inc.                        *
+ *                                                                          *
+ * Permission is hereby granted, free of charge, to any person obtaining a  *
+ * copy of this software and associated documentation files (the            *
+ * "Software"), to deal in the Software without restriction, including      *
+ * without limitation the rights to use, copy, modify, merge, publish,      *
+ * distribute, distribute with modifications, sublicense, and/or sell       *
+ * copies of the Software, and to permit persons to whom the Software is    *
+ * furnished to do so, subject to the following conditions:                 *
+ *                                                                          *
+ * The above copyright notice and this permission notice shall be included  *
+ * in all copies or substantial portions of the Software.                   *
+ *                                                                          *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
+ * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
+ *                                                                          *
+ * Except as contained in this notice, the name(s) of the above copyright   *
+ * holders shall not be used in advertising or otherwise to promote the     *
+ * sale, use or other dealings in this Software without prior written       *
+ * authorization.                                                           *
+ ****************************************************************************/
+
+/****************************************************************************
+ *  Author: Thomas E. Dickey 2012                                           *
+ ****************************************************************************/
+/* LINTLIBRARY */
+
+/* ./tinfo/access.c */
+
+#include <curses.priv.h>
+#include <ctype.h>
+#include <tic.h>
+
+#undef _nc_rootname
+char	*_nc_rootname(
+		char	*path)
+		{ return(*(char **)0); }
+
+#undef _nc_is_abs_path
+NCURSES_BOOL _nc_is_abs_path(
+		const char *path)
+		{ return(*(NCURSES_BOOL *)0); }
+
+#undef _nc_pathlast
+unsigned _nc_pathlast(
+		const char *path)
+		{ return(*(unsigned *)0); }
+
+#undef _nc_basename
+char	*_nc_basename(
+		char	*path)
+		{ return(*(char **)0); }
+
+#undef _nc_access
+int	_nc_access(
+		const char *path, 
+		int	mode)
+		{ return(*(int *)0); }
+
+#undef _nc_is_dir_path
+NCURSES_BOOL _nc_is_dir_path(
+		const char *path)
+		{ return(*(NCURSES_BOOL *)0); }
+
+#undef _nc_is_file_path
+NCURSES_BOOL _nc_is_file_path(
+		const char *path)
+		{ return(*(NCURSES_BOOL *)0); }
+
+#undef _nc_env_access
+int	_nc_env_access(void)
+		{ return(*(int *)0); }
+
+/* ./tinfo/add_tries.c */
+
+#undef _nc_add_to_try
+int	_nc_add_to_try(
+		TRIES	**tree, 
+		const char *str, 
+		unsigned code)
+		{ return(*(int *)0); }
+
+/* ./tinfo/alloc_ttype.c */
+
+#undef _nc_align_termtype
+void	_nc_align_termtype(
+		TERMTYPE *to, 
+		TERMTYPE *from)
+		{ /* void */ }
+
+#undef _nc_copy_termtype
+void	_nc_copy_termtype(
+		TERMTYPE *dst, 
+		const TERMTYPE *src)
+		{ /* void */ }
+
+/* ./codes.c */
+
+#undef boolcodes
+char	*const boolcodes[] = {0};
+#undef numcodes
+char	*const numcodes[] = {0};
+#undef strcodes
+char	*const strcodes[] = {0};
+
+/* ./comp_captab.c */
+
+#include <hashsize.h>
+
+#undef _nc_get_table
+const struct name_table_entry *_nc_get_table(
+		NCURSES_BOOL termcap)
+		{ return(*(const struct name_table_entry **)0); }
+
+#undef _nc_get_hash_table
+const HashValue *_nc_get_hash_table(
+		NCURSES_BOOL termcap)
+		{ return(*(const HashValue **)0); }
+
+#undef _nc_get_alias_table
+const struct alias *_nc_get_alias_table(
+		NCURSES_BOOL termcap)
+		{ return(*(const struct alias **)0); }
+
+#undef _nc_get_hash_info
+const HashData *_nc_get_hash_info(
+		NCURSES_BOOL termcap)
+		{ return(*(const HashData **)0); }
+
+/* ./tinfo/comp_error.c */
+
+#undef _nc_suppress_warnings
+NCURSES_BOOL _nc_suppress_warnings;
+#undef _nc_curr_line
+int	_nc_curr_line;
+#undef _nc_curr_col
+int	_nc_curr_col;
+
+#undef _nc_get_source
+const char *_nc_get_source(void)
+		{ return(*(const char **)0); }
+
+#undef _nc_set_source
+void	_nc_set_source(
+		const char *const name)
+		{ /* void */ }
+
+#undef _nc_set_type
+void	_nc_set_type(
+		const char *const name)
+		{ /* void */ }
+
+#undef _nc_get_type
+void	_nc_get_type(
+		char	*name)
+		{ /* void */ }
+
+#undef _nc_warning
+void	_nc_warning(
+		const char *const fmt, 
+		...)
+		{ /* void */ }
+
+#undef _nc_err_abort
+void	_nc_err_abort(
+		const char *const fmt, 
+		...)
+		{ /* void */ }
+
+#undef _nc_syserr_abort
+void	_nc_syserr_abort(
+		const char *const fmt, 
+		...)
+		{ /* void */ }
+
+/* ./tinfo/comp_hash.c */
+
+#undef _nc_find_entry
+struct name_table_entry const *_nc_find_entry(
+		const char *string, 
+		const HashValue *hash_table)
+		{ return(*(struct name_table_entry const **)0); }
+
+#undef _nc_find_type_entry
+struct name_table_entry const *_nc_find_type_entry(
+		const char *string, 
+		int	type, 
+		NCURSES_BOOL termcap)
+		{ return(*(struct name_table_entry const **)0); }
+
+/* ./tinfo/db_iterator.c */
+
+#include <time.h>
+
+#undef _nc_tic_dir
+const char *_nc_tic_dir(
+		const char *path)
+		{ return(*(const char **)0); }
+
+#undef _nc_keep_tic_dir
+void	_nc_keep_tic_dir(
+		const char *path)
+		{ /* void */ }
+
+#undef _nc_last_db
+void	_nc_last_db(void)
+		{ /* void */ }
+
+#undef _nc_next_db
+const char *_nc_next_db(
+		DBDIRS	*state, 
+		int	*offset)
+		{ return(*(const char **)0); }
+
+#undef _nc_first_db
+void	_nc_first_db(
+		DBDIRS	*state, 
+		int	*offset)
+		{ /* void */ }
+
+/* ./tinfo/doalloc.c */
+
+#undef _nc_doalloc
+void	*_nc_doalloc(
+		void	*oldp, 
+		size_t	amount)
+		{ return(*(void **)0); }
+
+/* ./tinfo/entries.c */
+
+#undef _nc_head
+ENTRY	*_nc_head;
+#undef _nc_tail
+ENTRY	*_nc_tail;
+
+#undef _nc_free_entry
+void	_nc_free_entry(
+		ENTRY	*headp, 
+		TERMTYPE *tterm)
+		{ /* void */ }
+
+#undef _nc_free_entries
+void	_nc_free_entries(
+		ENTRY	*headp)
+		{ /* void */ }
+
+#undef _nc_delink_entry
+ENTRY	*_nc_delink_entry(
+		ENTRY	*headp, 
+		TERMTYPE *tterm)
+		{ return(*(ENTRY **)0); }
+
+#undef _nc_leaks_tinfo
+void	_nc_leaks_tinfo(void)
+		{ /* void */ }
+
+/* ./fallback.c */
+
+#undef _nc_fallback
+const TERMTYPE *_nc_fallback(
+		const char *name)
+		{ return(*(const TERMTYPE **)0); }
+
+/* ./tinfo/free_ttype.c */
+
+#undef _nc_free_termtype
+void	_nc_free_termtype(
+		TERMTYPE *ptr)
+		{ /* void */ }
+
+#undef _nc_user_definable
+NCURSES_BOOL _nc_user_definable;
+
+#undef use_extended_names
+int	use_extended_names(
+		NCURSES_BOOL flag)
+		{ return(*(int *)0); }
+
+/* ./tinfo/getenv_num.c */
+
+#undef _nc_getenv_num
+int	_nc_getenv_num(
+		const char *name)
+		{ return(*(int *)0); }
+
+/* ./tinfo/home_terminfo.c */
+
+#undef _nc_home_terminfo
+char	*_nc_home_terminfo(void)
+		{ return(*(char **)0); }
+
+/* ./tinfo/init_keytry.c */
+
+#if 0
+
+#include <init_keytry.h>
+
+#undef _nc_tinfo_fkeys
+const struct tinfo_fkeys _nc_tinfo_fkeys[] = {0};
+
+#endif
+
+#undef _nc_init_keytry
+void	_nc_init_keytry(
+		SCREEN	*sp)
+		{ /* void */ }
+
+/* ./tinfo/lib_acs.c */
+
+#undef acs_map
+chtype	acs_map[128];
+
+#undef _nc_init_acs_sp
+void	_nc_init_acs_sp(
+		SCREEN	*sp)
+		{ /* void */ }
+
+#undef _nc_init_acs
+void	_nc_init_acs(void)
+		{ /* void */ }
+
+/* ./tinfo/lib_baudrate.c */
+
+#include <termcap.h>
+
+struct speed {
+    int s; 
+    int sp; 
+};
+
+#undef _nc_baudrate
+int	_nc_baudrate(
+		int	OSpeed)
+		{ return(*(int *)0); }
+
+#undef _nc_ospeed
+int	_nc_ospeed(
+		int	BaudRate)
+		{ return(*(int *)0); }
+
+#undef baudrate_sp
+int	baudrate_sp(
+		SCREEN	*sp)
+		{ return(*(int *)0); }
+
+#undef baudrate
+int	baudrate(void)
+		{ return(*(int *)0); }
+
+/* ./tinfo/lib_cur_term.c */
+
+#undef cur_term
+TERMINAL *cur_term;
+
+#undef set_curterm_sp
+TERMINAL *set_curterm_sp(
+		SCREEN	*sp, 
+		TERMINAL *termp)
+		{ return(*(TERMINAL **)0); }
+
+#undef set_curterm
+TERMINAL *set_curterm(
+		TERMINAL *termp)
+		{ return(*(TERMINAL **)0); }
+
+#undef del_curterm_sp
+int	del_curterm_sp(
+		SCREEN	*sp, 
+		TERMINAL *termp)
+		{ return(*(int *)0); }
+
+#undef del_curterm
+int	del_curterm(
+		TERMINAL *termp)
+		{ return(*(int *)0); }
+
+/* ./tinfo/lib_data.c */
+
+#undef stdscr
+WINDOW	*stdscr;
+#undef curscr
+WINDOW	*curscr;
+#undef newscr
+WINDOW	*newscr;
+#undef _nc_screen_chain
+SCREEN	*_nc_screen_chain;
+#undef SP
+SCREEN	*SP;
+#undef _nc_globals
+NCURSES_GLOBALS _nc_globals;
+#undef _nc_prescreen
+NCURSES_PRESCREEN _nc_prescreen;
+
+#undef _nc_screen_of
+SCREEN	*_nc_screen_of(
+		WINDOW	*win)
+		{ return(*(SCREEN **)0); }
+
+/* ./tinfo/lib_has_cap.c */
+
+#undef has_ic_sp
+NCURSES_BOOL has_ic_sp(
+		SCREEN	*sp)
+		{ return(*(NCURSES_BOOL *)0); }
+
+#undef has_ic
+NCURSES_BOOL has_ic(void)
+		{ return(*(NCURSES_BOOL *)0); }
+
+#undef has_il_sp
+NCURSES_BOOL has_il_sp(
+		SCREEN	*sp)
+		{ return(*(NCURSES_BOOL *)0); }
+
+#undef has_il
+NCURSES_BOOL has_il(void)
+		{ return(*(NCURSES_BOOL *)0); }
+
+/* ./tinfo/lib_kernel.c */
+
+#undef erasechar_sp
+char	erasechar_sp(
+		SCREEN	*sp)
+		{ return(*(char *)0); }
+
+#undef erasechar
+char	erasechar(void)
+		{ return(*(char *)0); }
+
+#undef killchar_sp
+char	killchar_sp(
+		SCREEN	*sp)
+		{ return(*(char *)0); }
+
+#undef killchar
+char	killchar(void)
+		{ return(*(char *)0); }
+
+#undef flushinp_sp
+int	flushinp_sp(
+		SCREEN	*sp)
+		{ return(*(int *)0); }
+
+#undef flushinp
+int	flushinp(void)
+		{ return(*(int *)0); }
+
+/* ./lib_keyname.c */
+
+struct kn { short offset; int code; };
+
+#undef keyname_sp
+char	*keyname_sp(
+		SCREEN	*sp, 
+		int	c)
+		{ return(*(char **)0); }
+
+#undef keyname
+char	*keyname(
+		int	c)
+		{ return(*(char **)0); }
+
+/* ./tinfo/lib_longname.c */
+
+#undef longname
+char	*longname(void)
+		{ return(*(char **)0); }
+
+/* ./tinfo/lib_napms.c */
+
+#include <sys/time.h>
+
+#undef napms_sp
+int	napms_sp(
+		SCREEN	*sp, 
+		int	ms)
+		{ return(*(int *)0); }
+
+#undef napms
+int	napms(
+		int	ms)
+		{ return(*(int *)0); }
+
+/* ./tinfo/lib_options.c */
+
+#undef idlok
+int	idlok(
+		WINDOW	*win, 
+		NCURSES_BOOL flag)
+		{ return(*(int *)0); }
+
+#undef idcok
+void	idcok(
+		WINDOW	*win, 
+		NCURSES_BOOL flag)
+		{ /* void */ }
+
+#undef halfdelay_sp
+int	halfdelay_sp(
+		SCREEN	*sp, 
+		int	t)
+		{ return(*(int *)0); }
+
+#undef halfdelay
+int	halfdelay(
+		int	t)
+		{ return(*(int *)0); }
+
+#undef nodelay
+int	nodelay(
+		WINDOW	*win, 
+		NCURSES_BOOL flag)
+		{ return(*(int *)0); }
+
+#undef notimeout
+int	notimeout(
+		WINDOW	*win, 
+		NCURSES_BOOL f)
+		{ return(*(int *)0); }
+
+#undef wtimeout
+void	wtimeout(
+		WINDOW	*win, 
+		int	delay)
+		{ /* void */ }
+
+#undef keypad
+int	keypad(
+		WINDOW	*win, 
+		NCURSES_BOOL flag)
+		{ return(*(int *)0); }
+
+#undef meta
+int	meta(
+		WINDOW	*win, 
+		NCURSES_BOOL flag)
+		{ return(*(int *)0); }
+
+#undef curs_set_sp
+int	curs_set_sp(
+		SCREEN	*sp, 
+		int	vis)
+		{ return(*(int *)0); }
+
+#undef curs_set
+int	curs_set(
+		int	vis)
+		{ return(*(int *)0); }
+
+#undef typeahead_sp
+int	typeahead_sp(
+		SCREEN	*sp, 
+		int	fd)
+		{ return(*(int *)0); }
+
+#undef typeahead
+int	typeahead(
+		int	fd)
+		{ return(*(int *)0); }
+
+#undef has_key_sp
+int	has_key_sp(
+		SCREEN	*sp, 
+		int	keycode)
+		{ return(*(int *)0); }
+
+#undef has_key
+int	has_key(
+		int	keycode)
+		{ return(*(int *)0); }
+
+#undef _nc_putp_flush_sp
+int	_nc_putp_flush_sp(
+		SCREEN	*sp, 
+		const char *name, 
+		const char *value)
+		{ return(*(int *)0); }
+
+#undef _nc_keypad
+int	_nc_keypad(
+		SCREEN	*sp, 
+		int	flag)
+		{ return(*(int *)0); }
+
+/* ./tinfo/lib_raw.c */
+
+#undef raw_sp
+int	raw_sp(
+		SCREEN	*sp)
+		{ return(*(int *)0); }
+
+#undef raw
+int	raw(void)
+		{ return(*(int *)0); }
+
+#undef cbreak_sp
+int	cbreak_sp(
+		SCREEN	*sp)
+		{ return(*(int *)0); }
+
+#undef cbreak
+int	cbreak(void)
+		{ return(*(int *)0); }
+
+#undef qiflush_sp
+void	qiflush_sp(
+		SCREEN	*sp)
+		{ /* void */ }
+
+#undef qiflush
+void	qiflush(void)
+		{ /* void */ }
+
+#undef noraw_sp
+int	noraw_sp(
+		SCREEN	*sp)
+		{ return(*(int *)0); }
+
+#undef noraw
+int	noraw(void)
+		{ return(*(int *)0); }
+
+#undef nocbreak_sp
+int	nocbreak_sp(
+		SCREEN	*sp)
+		{ return(*(int *)0); }
+
+#undef nocbreak
+int	nocbreak(void)
+		{ return(*(int *)0); }
+
+#undef noqiflush_sp
+void	noqiflush_sp(
+		SCREEN	*sp)
+		{ /* void */ }
+
+#undef noqiflush
+void	noqiflush(void)
+		{ /* void */ }
+
+#undef intrflush_sp
+int	intrflush_sp(
+		SCREEN	*sp, 
+		WINDOW	*win, 
+		NCURSES_BOOL flag)
+		{ return(*(int *)0); }
+
+#undef intrflush
+int	intrflush(
+		WINDOW	*win, 
+		NCURSES_BOOL flag)
+		{ return(*(int *)0); }
+
+/* ./tinfo/lib_setup.c */
+
+#include <locale.h>
+#include <sys/ioctl.h>
+#include <langinfo.h>
+
+#undef ttytype
+char	ttytype[256];
+#undef LINES
+int	LINES;
+#undef COLS
+int	COLS;
+#undef TABSIZE
+int	TABSIZE;
+
+#undef set_tabsize_sp
+int	set_tabsize_sp(
+		SCREEN	*sp, 
+		int	value)
+		{ return(*(int *)0); }
+
+#undef set_tabsize
+int	set_tabsize(
+		int	value)
+		{ return(*(int *)0); }
+
+#undef _nc_handle_sigwinch
+int	_nc_handle_sigwinch(
+		SCREEN	*sp)
+		{ return(*(int *)0); }
+
+#undef use_env_sp
+void	use_env_sp(
+		SCREEN	*sp, 
+		NCURSES_BOOL f)
+		{ /* void */ }
+
+#undef use_env
+void	use_env(
+		NCURSES_BOOL f)
+		{ /* void */ }
+
+#undef use_tioctl_sp
+void	use_tioctl_sp(
+		SCREEN	*sp, 
+		NCURSES_BOOL f)
+		{ /* void */ }
+
+#undef use_tioctl
+void	use_tioctl(
+		NCURSES_BOOL f)
+		{ /* void */ }
+
+#undef _nc_get_screensize
+void	_nc_get_screensize(
+		SCREEN	*sp, 
+		int	*linep, 
+		int	*colp)
+		{ /* void */ }
+
+#undef _nc_update_screensize
+void	_nc_update_screensize(
+		SCREEN	*sp)
+		{ /* void */ }
+
+#undef _nc_setup_tinfo
+int	_nc_setup_tinfo(
+		const char *const tn, 
+		TERMTYPE *const tp)
+		{ return(*(int *)0); }
+
+#undef _nc_tinfo_cmdch
+void	_nc_tinfo_cmdch(
+		TERMINAL *termp, 
+		int	proto)
+		{ /* void */ }
+
+#undef _nc_get_locale
+char	*_nc_get_locale(void)
+		{ return(*(char **)0); }
+
+#undef _nc_unicode_locale
+int	_nc_unicode_locale(void)
+		{ return(*(int *)0); }
+
+#undef _nc_locale_breaks_acs
+int	_nc_locale_breaks_acs(
+		TERMINAL *termp)
+		{ return(*(int *)0); }
+
+#undef _nc_setupterm
+int	_nc_setupterm(
+		char	*tname, 
+		int	Filedes, 
+		int	*errret, 
+		int	reuse)
+		{ return(*(int *)0); }
+
+#undef new_prescr
+SCREEN	*new_prescr(void)
+		{ return(*(SCREEN **)0); }
+
+#undef setupterm
+int	setupterm(
+		char	*tname, 
+		int	Filedes, 
+		int	*errret)
+		{ return(*(int *)0); }
+
+/* ./tinfo/lib_termcap.c */
+
+#undef UP
+char	*UP;
+#undef BC
+char	*BC;
+
+#undef tgetent_sp
+int	tgetent_sp(
+		SCREEN	*sp, 
+		char	*bufp, 
+		const char *name)
+		{ return(*(int *)0); }
+
+#if 0
+
+#include <capdefaults.c>
+
+#endif
+
+#undef tgetent
+int	tgetent(
+		char	*bufp, 
+		const char *name)
+		{ return(*(int *)0); }
+
+#undef tgetflag_sp
+int	tgetflag_sp(
+		SCREEN	*sp, 
+		char	*id)
+		{ return(*(int *)0); }
+
+#undef tgetflag
+int	tgetflag(
+		char	*id)
+		{ return(*(int *)0); }
+
+#undef tgetnum_sp
+int	tgetnum_sp(
+		SCREEN	*sp, 
+		char	*id)
+		{ return(*(int *)0); }
+
+#undef tgetnum
+int	tgetnum(
+		char	*id)
+		{ return(*(int *)0); }
+
+#undef tgetstr_sp
+char	*tgetstr_sp(
+		SCREEN	*sp, 
+		char	*id, 
+		char	**area)
+		{ return(*(char **)0); }
+
+#undef tgetstr
+char	*tgetstr(
+		char	*id, 
+		char	**area)
+		{ return(*(char **)0); }
+
+/* ./tinfo/lib_termname.c */
+
+#undef termname_sp
+char	*termname_sp(
+		SCREEN	*sp)
+		{ return(*(char **)0); }
+
+#undef termname
+char	*termname(void)
+		{ return(*(char **)0); }
+
+/* ./tinfo/lib_tgoto.c */
+
+#undef tgoto
+char	*tgoto(
+		const char *string, 
+		int	x, 
+		int	y)
+		{ return(*(char **)0); }
+
+/* ./tinfo/lib_ti.c */
+
+#undef tigetflag_sp
+int	tigetflag_sp(
+		SCREEN	*sp, 
+		char	*str)
+		{ return(*(int *)0); }
+
+#undef tigetflag
+int	tigetflag(
+		char	*str)
+		{ return(*(int *)0); }
+
+#undef tigetnum_sp
+int	tigetnum_sp(
+		SCREEN	*sp, 
+		char	*str)
+		{ return(*(int *)0); }
+
+#undef tigetnum
+int	tigetnum(
+		char	*str)
+		{ return(*(int *)0); }
+
+#undef tigetstr_sp
+char	*tigetstr_sp(
+		SCREEN	*sp, 
+		char	*str)
+		{ return(*(char **)0); }
+
+#undef tigetstr
+char	*tigetstr(
+		char	*str)
+		{ return(*(char **)0); }
+
+/* ./tinfo/lib_tparm.c */
+
+#undef _nc_tparm_err
+int	_nc_tparm_err;
+
+#undef _nc_tparm_analyze
+int	_nc_tparm_analyze(
+		const char *string, 
+		char	*p_is_s[9], 
+		int	*popcount)
+		{ return(*(int *)0); }
+
+#undef tparm
+char	*tparm(
+		char	*string, 
+		...)
+		{ return(*(char **)0); }
+
+#undef tiparm
+char	*tiparm(
+		const char *string, 
+		...)
+		{ return(*(char **)0); }
+
+/* ./tinfo/lib_tputs.c */
+
+#undef PC
+char	PC;
+#undef ospeed
+short	ospeed;
+#undef _nc_nulls_sent
+int	_nc_nulls_sent;
+
+#undef _nc_set_no_padding
+void	_nc_set_no_padding(
+		SCREEN	*sp)
+		{ /* void */ }
+
+#undef delay_output_sp
+int	delay_output_sp(
+		SCREEN	*sp, 
+		int	ms)
+		{ return(*(int *)0); }
+
+#undef delay_output
+int	delay_output(
+		int	ms)
+		{ return(*(int *)0); }
+
+#undef _nc_flush_sp
+void	_nc_flush_sp(
+		SCREEN	*sp)
+		{ /* void */ }
+
+#undef _nc_flush
+void	_nc_flush(void)
+		{ /* void */ }
+
+#undef _nc_outch_sp
+int	_nc_outch_sp(
+		SCREEN	*sp, 
+		int	ch)
+		{ return(*(int *)0); }
+
+#undef _nc_outch
+int	_nc_outch(
+		int	ch)
+		{ return(*(int *)0); }
+
+#undef putp_sp
+int	putp_sp(
+		SCREEN	*sp, 
+		const char *string)
+		{ return(*(int *)0); }
+
+#undef _nc_putp_sp
+int	_nc_putp_sp(
+		SCREEN	*sp, 
+		const char *name, 
+		const char *string)
+		{ return(*(int *)0); }
+
+#undef putp
+int	putp(
+		const char *string)
+		{ return(*(int *)0); }
+
+#undef _nc_putp
+int	_nc_putp(
+		const char *name, 
+		const char *string)
+		{ return(*(int *)0); }
+
+#undef tputs_sp
+int	tputs_sp(
+		SCREEN	*sp, 
+		const char *string, 
+		int	affcnt, 
+		NCURSES_OUTC_sp outc)
+		{ return(*(int *)0); }
+
+#undef _nc_outc_wrapper
+int	_nc_outc_wrapper(
+		SCREEN	*sp, 
+		int	c)
+		{ return(*(int *)0); }
+
+#undef tputs
+int	tputs(
+		const char *string, 
+		int	affcnt, 
+		int	(*outc)(
+		int	p1))
+		{ return(*(int *)0); }
+
+/* ./trace/lib_trace.c */
+
+#undef _nc_tracing
+unsigned _nc_tracing;
+#undef _nc_tputs_trace
+const char *_nc_tputs_trace = {0};
+#undef _nc_outchars
+long	_nc_outchars;
+
+#undef trace
+void	trace(
+		const unsigned int tracelevel)
+		{ /* void */ }
+
+#undef _tracef
+void	_tracef(
+		const char *fmt, 
+		...)
+		{ /* void */ }
+
+#undef _nc_retrace_bool
+NCURSES_BOOL _nc_retrace_bool(
+		int	code)
+		{ return(*(NCURSES_BOOL *)0); }
+
+#undef _nc_retrace_char
+char	_nc_retrace_char(
+		int	code)
+		{ return(*(char *)0); }
+
+#undef _nc_retrace_int
+int	_nc_retrace_int(
+		int	code)
+		{ return(*(int *)0); }
+
+#undef _nc_retrace_unsigned
+unsigned _nc_retrace_unsigned(
+		unsigned code)
+		{ return(*(unsigned *)0); }
+
+#undef _nc_retrace_ptr
+char	*_nc_retrace_ptr(
+		char	*code)
+		{ return(*(char **)0); }
+
+#undef _nc_retrace_cptr
+const char *_nc_retrace_cptr(
+		const char *code)
+		{ return(*(const char **)0); }
+
+#undef _nc_retrace_cvoid_ptr
+void	*_nc_retrace_cvoid_ptr(
+		void	*code)
+		{ return(*(void **)0); }
+
+#undef _nc_retrace_void_ptr
+void	*_nc_retrace_void_ptr(
+		void	*code)
+		{ return(*(void **)0); }
+
+#undef _nc_retrace_sp
+SCREEN	*_nc_retrace_sp(
+		SCREEN	*code)
+		{ return(*(SCREEN **)0); }
+
+#undef _nc_retrace_win
+WINDOW	*_nc_retrace_win(
+		WINDOW	*code)
+		{ return(*(WINDOW **)0); }
+
+/* ./trace/lib_traceatr.c */
+
+#undef _traceattr2
+char	*_traceattr2(
+		int	bufnum, 
+		chtype	newmode)
+		{ return(*(char **)0); }
+
+#undef _traceattr
+char	*_traceattr(
+		attr_t	newmode)
+		{ return(*(char **)0); }
+
+#undef _nc_retrace_int_attr_t
+int	_nc_retrace_int_attr_t(
+		attr_t	code)
+		{ return(*(int *)0); }
+
+#undef _nc_retrace_attr_t
+attr_t	_nc_retrace_attr_t(
+		attr_t	code)
+		{ return(*(attr_t *)0); }
+
+#undef _nc_altcharset_name
+const char *_nc_altcharset_name(
+		attr_t	attr, 
+		chtype	ch)
+		{ return(*(const char **)0); }
+
+#undef _tracechtype2
+char	*_tracechtype2(
+		int	bufnum, 
+		chtype	ch)
+		{ return(*(char **)0); }
+
+#undef _tracechtype
+char	*_tracechtype(
+		chtype	ch)
+		{ return(*(char **)0); }
+
+#undef _nc_retrace_chtype
+chtype	_nc_retrace_chtype(
+		chtype	code)
+		{ return(*(chtype *)0); }
+
+#undef _tracecchar_t2
+char	*_tracecchar_t2(
+		int	bufnum, 
+		const cchar_t *ch)
+		{ return(*(char **)0); }
+
+#undef _tracecchar_t
+char	*_tracecchar_t(
+		const cchar_t *ch)
+		{ return(*(char **)0); }
+
+/* ./trace/lib_tracebits.c */
+
+typedef struct {
+    unsigned int val;
+    const char *name;
+} BITNAMES;
+
+#undef _nc_trace_ttymode
+char	*_nc_trace_ttymode(
+		struct termios *tty)
+		{ return(*(char **)0); }
+
+#undef _nc_tracebits
+char	*_nc_tracebits(void)
+		{ return(*(char **)0); }
+
+/* ./trace/lib_tracechr.c */
+
+#undef _nc_tracechar
+char	*_nc_tracechar(
+		SCREEN	*sp, 
+		int	ch)
+		{ return(*(char **)0); }
+
+#undef _tracechar
+char	*_tracechar(
+		int	ch)
+		{ return(*(char **)0); }
+
+/* ./tinfo/lib_ttyflags.c */
+
+#undef _nc_get_tty_mode_sp
+int	_nc_get_tty_mode_sp(
+		SCREEN	*sp, 
+		struct termios *buf)
+		{ return(*(int *)0); }
+
+#undef _nc_get_tty_mode
+int	_nc_get_tty_mode(
+		struct termios *buf)
+		{ return(*(int *)0); }
+
+#undef _nc_set_tty_mode_sp
+int	_nc_set_tty_mode_sp(
+		SCREEN	*sp, 
+		struct termios *buf)
+		{ return(*(int *)0); }
+
+#undef _nc_set_tty_mode
+int	_nc_set_tty_mode(
+		struct termios *buf)
+		{ return(*(int *)0); }
+
+#undef def_shell_mode_sp
+int	def_shell_mode_sp(
+		SCREEN	*sp)
+		{ return(*(int *)0); }
+
+#undef def_shell_mode
+int	def_shell_mode(void)
+		{ return(*(int *)0); }
+
+#undef def_prog_mode_sp
+int	def_prog_mode_sp(
+		SCREEN	*sp)
+		{ return(*(int *)0); }
+
+#undef def_prog_mode
+int	def_prog_mode(void)
+		{ return(*(int *)0); }
+
+#undef reset_prog_mode_sp
+int	reset_prog_mode_sp(
+		SCREEN	*sp)
+		{ return(*(int *)0); }
+
+#undef reset_prog_mode
+int	reset_prog_mode(void)
+		{ return(*(int *)0); }
+
+#undef reset_shell_mode_sp
+int	reset_shell_mode_sp(
+		SCREEN	*sp)
+		{ return(*(int *)0); }
+
+#undef reset_shell_mode
+int	reset_shell_mode(void)
+		{ return(*(int *)0); }
+
+#undef savetty_sp
+int	savetty_sp(
+		SCREEN	*sp)
+		{ return(*(int *)0); }
+
+#undef savetty
+int	savetty(void)
+		{ return(*(int *)0); }
+
+#undef resetty_sp
+int	resetty_sp(
+		SCREEN	*sp)
+		{ return(*(int *)0); }
+
+#undef resetty
+int	resetty(void)
+		{ return(*(int *)0); }
+
+/* ./tty/lib_twait.c */
+
+#undef _nc_timed_wait
+int	_nc_timed_wait(
+		SCREEN	*sp, 
+		int	mode, 
+		int	milliseconds, 
+		int	*timeleft)
+		{ return(*(int *)0); }
+
+/* ./tinfo/name_match.c */
+
+#undef _nc_first_name
+char	*_nc_first_name(
+		const char *const sp)
+		{ return(*(char **)0); }
+
+#undef _nc_name_match
+int	_nc_name_match(
+		const char *const namelst, 
+		const char *const name, 
+		const char *const delim)
+		{ return(*(int *)0); }
+
+/* ./names.c */
+
+#undef boolnames
+char	*const boolnames[] = {0};
+#undef boolfnames
+char	*const boolfnames[] = {0};
+#undef numnames
+char	*const numnames[] = {0};
+#undef numfnames
+char	*const numfnames[] = {0};
+#undef strnames
+char	*const strnames[] = {0};
+#undef strfnames
+char	*const strfnames[] = {0};
+
+/* ./tinfo/read_entry.c */
+
+#include <hashed_db.h>
+
+#undef _nc_read_termtype
+int	_nc_read_termtype(
+		TERMTYPE *ptr, 
+		char	*buffer, 
+		int	limit)
+		{ return(*(int *)0); }
+
+#undef _nc_read_file_entry
+int	_nc_read_file_entry(
+		const char *const filename, 
+		TERMTYPE *ptr)
+		{ return(*(int *)0); }
+
+#undef _nc_read_entry
+int	_nc_read_entry(
+		const char *const name, 
+		char	*const filename, 
+		TERMTYPE *const tp)
+		{ return(*(int *)0); }
+
+/* ./tinfo/read_termcap.c */
+
+#include <sys/types.h>
+
+#undef _nc_read_termcap
+void	_nc_read_termcap(void)
+		{ /* void */ }
+
+/* ./tinfo/setbuf.c */
+
+#undef _nc_set_buffer_sp
+void	_nc_set_buffer_sp(
+		SCREEN	*sp, 
+		FILE	*ofp, 
+		int	buffered)
+		{ /* void */ }
+
+#undef _nc_set_buffer
+void	_nc_set_buffer(
+		FILE	*ofp, 
+		int	buffered)
+		{ /* void */ }
+
+/* ./tinfo/strings.c */
+
+#undef _nc_str_init
+string_desc *_nc_str_init(
+		string_desc *dst, 
+		char	*src, 
+		size_t	len)
+		{ return(*(string_desc **)0); }
+
+#undef _nc_str_null
+string_desc *_nc_str_null(
+		string_desc *dst, 
+		size_t	len)
+		{ return(*(string_desc **)0); }
+
+#undef _nc_str_copy
+string_desc *_nc_str_copy(
+		string_desc *dst, 
+		string_desc *src)
+		{ return(*(string_desc **)0); }
+
+#undef _nc_safe_strcat
+NCURSES_BOOL _nc_safe_strcat(
+		string_desc *dst, 
+		const char *src)
+		{ return(*(NCURSES_BOOL *)0); }
+
+#undef _nc_safe_strcpy
+NCURSES_BOOL _nc_safe_strcpy(
+		string_desc *dst, 
+		const char *src)
+		{ return(*(NCURSES_BOOL *)0); }
+
+/* ./trace/trace_buf.c */
+
+#undef _nc_trace_buf
+char	*_nc_trace_buf(
+		int	bufnum, 
+		size_t	want)
+		{ return(*(char **)0); }
+
+#undef _nc_trace_bufcat
+char	*_nc_trace_bufcat(
+		int	bufnum, 
+		const char *value)
+		{ return(*(char **)0); }
+
+/* ./trace/trace_tries.c */
+
+#undef _nc_trace_tries
+void	_nc_trace_tries(
+		TRIES	*tree)
+		{ /* void */ }
+
+/* ./base/tries.c */
+
+#undef _nc_expand_try
+char	*_nc_expand_try(
+		TRIES	*tree, 
+		unsigned code, 
+		int	*count, 
+		size_t	len)
+		{ return(*(char **)0); }
+
+#undef _nc_remove_key
+int	_nc_remove_key(
+		TRIES	**tree, 
+		unsigned code)
+		{ return(*(int *)0); }
+
+#undef _nc_remove_string
+int	_nc_remove_string(
+		TRIES	**tree, 
+		const char *string)
+		{ return(*(int *)0); }
+
+/* ./tinfo/trim_sgr0.c */
+
+#undef _nc_trim_sgr0
+char	*_nc_trim_sgr0(
+		TERMTYPE *tp)
+		{ return(*(char **)0); }
+
+/* ./unctrl.c */
+
+#undef unctrl_sp
+char	*unctrl_sp(
+		SCREEN	*sp, 
+		chtype	ch)
+		{ return(*(char **)0); }
+
+#undef unctrl
+char	*unctrl(
+		chtype	ch)
+		{ return(*(char **)0); }
+
+/* ./trace/visbuf.c */
+
+#undef _nc_visbuf2
+const char *_nc_visbuf2(
+		int	bufnum, 
+		const char *buf)
+		{ return(*(const char **)0); }
+
+#undef _nc_visbuf
+const char *_nc_visbuf(
+		const char *buf)
+		{ return(*(const char **)0); }
+
+#undef _nc_visbufn
+const char *_nc_visbufn(
+		const char *buf, 
+		int	len)
+		{ return(*(const char **)0); }
+
+#undef _nc_viswbuf2
+const char *_nc_viswbuf2(
+		int	bufnum, 
+		const wchar_t *buf)
+		{ return(*(const char **)0); }
+
+#undef _nc_viswbuf
+const char *_nc_viswbuf(
+		const wchar_t *buf)
+		{ return(*(const char **)0); }
+
+#undef _nc_viswbufn
+const char *_nc_viswbufn(
+		const wchar_t *buf, 
+		int	len)
+		{ return(*(const char **)0); }
+
+#undef _nc_viswibuf
+const char *_nc_viswibuf(
+		const wint_t *buf)
+		{ return(*(const char **)0); }
+
+#undef _nc_viscbuf2
+const char *_nc_viscbuf2(
+		int	bufnum, 
+		const cchar_t *buf, 
+		int	len)
+		{ return(*(const char **)0); }
+
+#undef _nc_viscbuf
+const char *_nc_viscbuf(
+		const cchar_t *buf, 
+		int	len)
+		{ return(*(const char **)0); }
+
+/* ./base/define_key.c */
+
+#undef define_key_sp
+int	define_key_sp(
+		SCREEN	*sp, 
+		const char *str, 
+		int	keycode)
+		{ return(*(int *)0); }
+
+#undef define_key
+int	define_key(
+		const char *str, 
+		int	keycode)
+		{ return(*(int *)0); }
+
+/* ./tinfo/hashed_db.c */
+
+#undef _nc_hashed_db
+void	_nc_hashed_db(void)
+		{ /* void */ }
+
+/* ./base/key_defined.c */
+
+#undef key_defined_sp
+int	key_defined_sp(
+		SCREEN	*sp, 
+		const char *str)
+		{ return(*(int *)0); }
+
+#undef key_defined
+int	key_defined(
+		const char *str)
+		{ return(*(int *)0); }
+
+/* ./base/keybound.c */
+
+#undef keybound_sp
+char	*keybound_sp(
+		SCREEN	*sp, 
+		int	code, 
+		int	count)
+		{ return(*(char **)0); }
+
+#undef keybound
+char	*keybound(
+		int	code, 
+		int	count)
+		{ return(*(char **)0); }
+
+/* ./base/keyok.c */
+
+#undef keyok_sp
+int	keyok_sp(
+		SCREEN	*sp, 
+		int	c, 
+		NCURSES_BOOL flag)
+		{ return(*(int *)0); }
+
+#undef keyok
+int	keyok(
+		int	c, 
+		NCURSES_BOOL flag)
+		{ return(*(int *)0); }
+
+/* ./base/version.c */
+
+#undef curses_version
+const char *curses_version(void)
+		{ return(*(const char **)0); }
Index: ncurses/modules
Prereq:  1.117 
--- ncurses-5.9/ncurses/modules	2010-08-07 18:41:02.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/modules	2013-01-26 22:17:55.000000000 +0000
@@ -1,6 +1,6 @@
-# $Id: modules,v 1.117 2010/08/07 18:41:02 tom Exp $
+# $Id: modules,v 1.120 2013/01/26 22:17:55 tom Exp $
 ##############################################################################
-# Copyright (c) 1998-2009,2010 Free Software Foundation, Inc.                #
+# Copyright (c) 1998-2012,2013 Free Software Foundation, Inc.                #
 #                                                                            #
 # Permission is hereby granted, free of charge, to any person obtaining a    #
 # copy of this software and associated documentation files (the "Software"), #
@@ -115,7 +115,6 @@
 varargs		lib		$(trace)	$(HEADER_DEPS)
 
 # Modules for porting
-memmove		lib		$(base)		$(HEADER_DEPS)
 vsscanf 	lib		$(base)		$(HEADER_DEPS)
 
 # actually an extension, but with its own configure option (--disable-leaks)
@@ -199,9 +198,9 @@
 lib_twait	lib		$(serial)	$(HEADER_DEPS)
 name_match	lib		$(tinfo)	$(HEADER_DEPS)	$(INCDIR)/tic.h
 names		lib		.		$(HEADER_DEPS)
+obsolete	lib		$(tinfo)	$(HEADER_DEPS)
 read_entry	lib		$(tinfo)	$(HEADER_DEPS)	$(INCDIR)/tic.h $(INCDIR)/hashed_db.h
 read_termcap	lib		$(tinfo)	$(HEADER_DEPS)	$(INCDIR)/tic.h
-setbuf		lib		$(tinfo)	$(HEADER_DEPS)
 strings		lib		$(tinfo)	$(HEADER_DEPS)
 trace_buf	lib		$(trace)	$(HEADER_DEPS)
 trace_tries	lib		$(trace)	$(HEADER_DEPS)
@@ -236,6 +235,7 @@
 @ port_win32con
 gettimeofday	lib		$(win32con)	$(HEADER_DEPS)
 wcwidth		lib             $(win32con)	$(HEADER_DEPS)
+widechars	lib             $(wide)		$(HEADER_DEPS)
 win_driver	lib             $(win32con)	$(HEADER_DEPS)
 
 @ port_tinfo
Index: ncurses/tinfo/MKcaptab.sh
Prereq:  1.13 
--- ncurses-5.9/ncurses/tinfo/MKcaptab.sh	2010-12-25 23:43:58.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/tinfo/MKcaptab.sh	2011-10-22 16:34:50.000000000 +0000
@@ -1,6 +1,6 @@
 #!/bin/sh
 ##############################################################################
-# Copyright (c) 2007-2009,2010 Free Software Foundation, Inc.                #
+# Copyright (c) 2007-2010,2011 Free Software Foundation, Inc.                #
 #                                                                            #
 # Permission is hereby granted, free of charge, to any person obtaining a    #
 # copy of this software and associated documentation files (the "Software"), #
@@ -26,7 +26,7 @@
 # use or other dealings in this Software without prior written               #
 # authorization.                                                             #
 ##############################################################################
-# $Id: MKcaptab.sh,v 1.13 2010/12/25 23:43:58 tom Exp $
+# $Id: MKcaptab.sh,v 1.14 2011/10/22 16:34:50 tom Exp $
 AWK=${1-awk}
 OPT1=${2-0}
 OPT2=${3-tinfo/MKcaptab.awk}
@@ -99,12 +99,12 @@
 _nc_build_alias(struct alias **actual,
 		const alias_table_data *source,
 		const char *strings,
-		unsigned tablesize)
+		size_t tablesize)
 {
     if (*actual == 0) {
 	*actual = typeCalloc(struct alias, tablesize + 1);
 	if (*actual != 0) {
-	    unsigned n;
+	    size_t n;
 	    for (n = 0; n < tablesize; ++n) {
 		add_alias(from);
 		add_alias(to);
@@ -178,7 +178,7 @@
 static int
 compare_tcap_names(const char *a, const char *b)
 {
-    return !strncmp(a, b, TCAP_LEN);
+    return !strncmp(a, b, (size_t) TCAP_LEN);
 }
 
 static int
Index: ncurses/tinfo/access.c
Prereq:  1.16 
--- ncurses-5.9/ncurses/tinfo/access.c	2010-01-23 17:57:43.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/tinfo/access.c	2012-09-01 19:21:29.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -33,11 +33,18 @@
 #include <curses.priv.h>
 
 #include <ctype.h>
-#include <sys/stat.h>
 
 #include <tic.h>
 
-MODULE_ID("$Id: access.c,v 1.16 2010/01/23 17:57:43 tom Exp $")
+MODULE_ID("$Id: access.c,v 1.23 2012/09/01 19:21:29 tom Exp $")
+
+#ifdef __TANDEM
+#define ROOT_UID 65535
+#endif
+
+#ifndef ROOT_UID
+#define ROOT_UID 0
+#endif
 
 #define LOWERCASE(c) ((isalpha(UChar(c)) && isupper(UChar(c))) ? tolower(UChar(c)) : (c))
 
@@ -53,7 +60,7 @@
     result = temp;
 #if !MIXEDCASE_FILENAMES
     for (s = result; *s != '\0'; ++s) {
-	*s = LOWERCASE(*s);
+	*s = (char) LOWERCASE(*s);
     }
 #endif
 #if defined(PROG_EXT)
@@ -108,24 +115,33 @@
 NCURSES_EXPORT(int)
 _nc_access(const char *path, int mode)
 {
-    if (access(path, mode) < 0) {
+    int result;
+
+    if (path == 0) {
+	result = -1;
+    } else if (access(path, mode) < 0) {
 	if ((mode & W_OK) != 0
 	    && errno == ENOENT
 	    && strlen(path) < PATH_MAX) {
 	    char head[PATH_MAX];
-	    char *leaf = _nc_basename(strcpy(head, path));
+	    char *leaf;
 
+	    _nc_STRCPY(head, path, sizeof(head));
+	    leaf = _nc_basename(head);
 	    if (leaf == 0)
 		leaf = head;
 	    *leaf = '\0';
 	    if (head == leaf)
-		(void) strcpy(head, ".");
+		_nc_STRCPY(head, ".", sizeof(head));
 
-	    return access(head, R_OK | W_OK | X_OK);
+	    result = access(head, R_OK | W_OK | X_OK);
+	} else {
+	    result = -1;
 	}
-	return -1;
+    } else {
+	result = 0;
     }
-    return 0;
+    return result;
 }
 
 NCURSES_EXPORT(bool)
@@ -135,7 +151,7 @@
     struct stat sb;
 
     if (stat(path, &sb) == 0
-	&& (sb.st_mode & S_IFMT) == S_IFDIR) {
+	&& S_ISDIR(sb.st_mode)) {
 	result = TRUE;
     }
     return result;
@@ -148,7 +164,7 @@
     struct stat sb;
 
     if (stat(path, &sb) == 0
-	&& (sb.st_mode & S_IFMT) == S_IFREG) {
+	&& S_ISREG(sb.st_mode)) {
 	result = TRUE;
     }
     return result;
@@ -170,6 +186,7 @@
 	|| getgid() != getegid())
 	return FALSE;
 #endif
-    return getuid() != 0 && geteuid() != 0;	/* ...finally, disallow root */
+    /* ...finally, disallow root */
+    return (getuid() != ROOT_UID) && (geteuid() != ROOT_UID);
 }
 #endif
Index: ncurses/tinfo/alloc_entry.c
Prereq:  1.51 
--- ncurses-5.9/ncurses/tinfo/alloc_entry.c	2010-12-25 23:06:01.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/tinfo/alloc_entry.c	2012-10-27 21:32:23.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2008,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -47,7 +47,7 @@
 
 #include <tic.h>
 
-MODULE_ID("$Id: alloc_entry.c,v 1.51 2010/12/25 23:06:01 tom Exp $")
+MODULE_ID("$Id: alloc_entry.c,v 1.57 2012/10/27 21:32:23 tom Exp $")
 
 #define ABSENT_OFFSET    -1
 #define CANCELLED_OFFSET -2
@@ -73,7 +73,7 @@
 #endif
 
     if (stringbuf == 0)
-	stringbuf = (char *) malloc(MAX_STRTAB);
+	TYPE_MALLOC(char, (size_t) MAX_STRTAB, stringbuf);
 
 #if NCURSES_XNAMES
     tp->num_Booleans = BOOLCOUNT;
@@ -84,11 +84,11 @@
     tp->ext_Strings = 0;
 #endif
     if (tp->Booleans == 0)
-	tp->Booleans = typeMalloc(NCURSES_SBOOL, BOOLCOUNT);
+	TYPE_MALLOC(NCURSES_SBOOL, BOOLCOUNT, tp->Booleans);
     if (tp->Numbers == 0)
-	tp->Numbers = typeMalloc(short, NUMCOUNT);
+	TYPE_MALLOC(short, NUMCOUNT, tp->Numbers);
     if (tp->Strings == 0)
-	tp->Strings = typeMalloc(char *, STRCOUNT);
+	TYPE_MALLOC(char *, STRCOUNT, tp->Strings);
 
     for_each_boolean(i, tp)
 	tp->Booleans[i] = FALSE;
@@ -131,7 +131,7 @@
 	    result = (stringbuf + next_free - 1);
 	}
     } else if (next_free + len < MAX_STRTAB) {
-	strcpy(&stringbuf[next_free], string);
+	_nc_STRCPY(&stringbuf[next_free], string, MAX_STRTAB);
 	DEBUG(7, ("Saved string %s", _nc_visbuf(string)));
 	DEBUG(7, ("at location %d", (int) next_free));
 	next_free += len;
@@ -194,8 +194,7 @@
 	    useoffsets[i] = (int) (ep->uses[i].name - stringbuf);
     }
 
-    if ((tp->str_table = typeMalloc(char, next_free)) == (char *) 0)
-	  _nc_err_abort(MSG_NO_MEMORY);
+    TYPE_MALLOC(char, next_free, tp->str_table);
     (void) memcpy(tp->str_table, stringbuf, next_free);
 
     tp->term_names = tp->str_table + n;
@@ -216,16 +215,18 @@
 	if ((n = (unsigned) NUM_EXT_NAMES(tp)) != 0) {
 	    if (n < SIZEOF(offsets)) {
 		size_t length = 0;
+		size_t offset;
 		for (i = 0; i < n; i++) {
 		    length += strlen(tp->ext_Names[i]) + 1;
 		    offsets[i] = (int) (tp->ext_Names[i] - stringbuf);
 		}
-		if ((tp->ext_str_table = typeMalloc(char, length)) == 0)
-		      _nc_err_abort(MSG_NO_MEMORY);
-		for (i = 0, length = 0; i < n; i++) {
-		    tp->ext_Names[i] = tp->ext_str_table + length;
-		    strcpy(tp->ext_Names[i], stringbuf + offsets[i]);
-		    length += strlen(tp->ext_Names[i]) + 1;
+		TYPE_MALLOC(char, length, tp->ext_str_table);
+		for (i = 0, offset = 0; i < n; i++) {
+		    tp->ext_Names[i] = tp->ext_str_table + offset;
+		    _nc_STRCPY(tp->ext_Names[i],
+			       stringbuf + offsets[i],
+			       length - offset);
+		    offset += strlen(tp->ext_Names[i]) + 1;
 		}
 	    }
 	}
Index: ncurses/tinfo/alloc_ttype.c
Prereq:  1.22 
--- ncurses-5.9/ncurses/tinfo/alloc_ttype.c	2010-12-19 00:24:09.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/tinfo/alloc_ttype.c	2012-10-27 21:23:17.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1999-2009,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 1999-2010,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -42,7 +42,7 @@
 
 #include <tic.h>
 
-MODULE_ID("$Id: alloc_ttype.c,v 1.22 2010/12/19 00:24:09 tom Exp $")
+MODULE_ID("$Id: alloc_ttype.c,v 1.26 2012/10/27 21:23:17 tom Exp $")
 
 #if NCURSES_XNAMES
 /*
@@ -104,7 +104,7 @@
 
     if (to->ext_Booleans != ext_Booleans) {
 	EXTEND_NUM(num_Booleans, ext_Booleans);
-	to->Booleans = typeRealloc(NCURSES_SBOOL, to->num_Booleans, to->Booleans);
+	TYPE_REALLOC(NCURSES_SBOOL, to->num_Booleans, to->Booleans);
 	for (n = to->ext_Booleans - 1,
 	     m = ext_Booleans - 1,
 	     base = to->num_Booleans - (m + 1); m >= 0; m--) {
@@ -116,9 +116,10 @@
 	}
 	to->ext_Booleans = UShort(ext_Booleans);
     }
+
     if (to->ext_Numbers != ext_Numbers) {
 	EXTEND_NUM(num_Numbers, ext_Numbers);
-	to->Numbers = typeRealloc(short, to->num_Numbers, to->Numbers);
+	TYPE_REALLOC(short, to->num_Numbers, to->Numbers);
 	for (n = to->ext_Numbers - 1,
 	     m = ext_Numbers - 1,
 	     base = to->num_Numbers - (m + 1); m >= 0; m--) {
@@ -132,7 +133,7 @@
     }
     if (to->ext_Strings != ext_Strings) {
 	EXTEND_NUM(num_Strings, ext_Strings);
-	to->Strings = typeRealloc(char *, to->num_Strings, to->Strings);
+	TYPE_REALLOC(char *, to->num_Strings, to->Strings);
 	for (n = to->ext_Strings - 1,
 	     m = ext_Strings - 1,
 	     base = to->num_Strings - (m + 1); m >= 0; m--) {
@@ -301,7 +302,7 @@
 	}
     }
 
-    tp->ext_Names = typeRealloc(char *, total, tp->ext_Names);
+    TYPE_REALLOC(char *, total, tp->ext_Names);
     for (k = total - 1; k > j; k--)
 	tp->ext_Names[k] = tp->ext_Names[k - 1];
     tp->ext_Names[j] = name;
@@ -311,21 +312,21 @@
     case BOOLEAN:
 	tp->ext_Booleans++;
 	tp->num_Booleans++;
-	tp->Booleans = typeRealloc(NCURSES_SBOOL, tp->num_Booleans, tp->Booleans);
+	TYPE_REALLOC(NCURSES_SBOOL, tp->num_Booleans, tp->Booleans);
 	for (k = (unsigned) (tp->num_Booleans - 1); k > j; k--)
 	    tp->Booleans[k] = tp->Booleans[k - 1];
 	break;
     case NUMBER:
 	tp->ext_Numbers++;
 	tp->num_Numbers++;
-	tp->Numbers = typeRealloc(short, tp->num_Numbers, tp->Numbers);
+	TYPE_REALLOC(short, tp->num_Numbers, tp->Numbers);
 	for (k = (unsigned) (tp->num_Numbers - 1); k > j; k--)
 	    tp->Numbers[k] = tp->Numbers[k - 1];
 	break;
     case STRING:
 	tp->ext_Strings++;
 	tp->num_Strings++;
-	tp->Strings = typeRealloc(char *, tp->num_Strings, tp->Strings);
+	TYPE_REALLOC(char *, tp->num_Strings, tp->Strings);
 	for (k = (unsigned) (tp->num_Strings - 1); k > j; k--)
 	    tp->Strings[k] = tp->Strings[k - 1];
 	break;
@@ -417,7 +418,7 @@
 	 * into it, updating to's counts for booleans, etc.  Fortunately we do
 	 * this only for the terminfo compiler (tic) and comparer (infocmp).
 	 */
-	ext_Names = typeMalloc(char *, (size_t)(na + nb));
+	TYPE_MALLOC(char *, (size_t)(na + nb), ext_Names);
 
 	if (to->ext_Strings && (from->ext_Booleans + from->ext_Numbers))
 	    adjust_cancels(to, from);
@@ -461,7 +462,7 @@
 	if (nb != (ext_Booleans + ext_Numbers + ext_Strings)) {
 	    nb = (ext_Booleans + ext_Numbers + ext_Strings);
 	    realign_data(from, ext_Names, ext_Booleans, ext_Numbers, ext_Strings);
-	    from->ext_Names = typeRealloc(char *, (size_t) nb, from->ext_Names);
+	    TYPE_REALLOC(char *, (size_t) nb, from->ext_Names);
 	    memcpy(from->ext_Names, ext_Names, sizeof(char *) * (size_t) nb);
 	    DEBUG(2, ("realigned %d extended names for '%s' (from)",
 		      NUM_EXT_NAMES(from), from->term_names));
@@ -473,22 +474,25 @@
 #endif
 
 NCURSES_EXPORT(void)
-_nc_copy_termtype(TERMTYPE *dst, TERMTYPE *src)
+_nc_copy_termtype(TERMTYPE *dst, const TERMTYPE *src)
 {
     unsigned i;
 
     *dst = *src;		/* ...to copy the sizes and string-tables */
-    dst->Booleans = typeMalloc(NCURSES_SBOOL, NUM_BOOLEANS(dst));
-    dst->Numbers = typeMalloc(short, NUM_NUMBERS(dst));
-    dst->Strings = typeMalloc(char *, NUM_STRINGS(dst));
-
-    /* FIXME: use memcpy for these and similar loops */
-    for_each_boolean(i, dst)
-	dst->Booleans[i] = src->Booleans[i];
-    for_each_number(i, dst)
-	dst->Numbers[i] = src->Numbers[i];
-    for_each_string(i, dst)
-	dst->Strings[i] = src->Strings[i];
+
+    TYPE_MALLOC(NCURSES_SBOOL, NUM_BOOLEANS(dst), dst->Booleans);
+    TYPE_MALLOC(short, NUM_NUMBERS(dst), dst->Numbers);
+    TYPE_MALLOC(char *, NUM_STRINGS(dst), dst->Strings);
+
+    memcpy(dst->Booleans,
+	   src->Booleans,
+	   NUM_BOOLEANS(dst) * sizeof(dst->Booleans[0]));
+    memcpy(dst->Numbers,
+	   src->Numbers,
+	   NUM_NUMBERS(dst) * sizeof(dst->Numbers[0]));
+    memcpy(dst->Strings,
+	   src->Strings,
+	   NUM_STRINGS(dst) * sizeof(dst->Strings[0]));
 
     /* FIXME: we probably should also copy str_table and ext_str_table,
      * but tic and infocmp are not written to exploit that (yet).
@@ -496,7 +500,7 @@
 
 #if NCURSES_XNAMES
     if ((i = NUM_EXT_NAMES(src)) != 0) {
-	dst->ext_Names = typeMalloc(char *, i);
+	TYPE_MALLOC(char *, i, dst->ext_Names);
 	memcpy(dst->ext_Names, src->ext_Names, i * sizeof(char *));
     } else {
 	dst->ext_Names = 0;
Index: ncurses/tinfo/captoinfo.c
Prereq:  1.58 
--- ncurses-5.9/ncurses/tinfo/captoinfo.c	2010-12-04 20:08:19.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/tinfo/captoinfo.c	2012-12-30 00:50:40.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -93,7 +93,7 @@
 #include <ctype.h>
 #include <tic.h>
 
-MODULE_ID("$Id: captoinfo.c,v 1.58 2010/12/04 20:08:19 tom Exp $")
+MODULE_ID("$Id: captoinfo.c,v 1.77 2012/12/30 00:50:40 tom Exp $")
 
 #define MAX_PUSHED	16	/* max # args we can push onto the stack */
 
@@ -114,9 +114,7 @@
 /* initialize 'my_string', 'my_length' */
 {
     if (my_string == 0)
-	my_string = typeMalloc(char, my_length = 256);
-    if (my_string == 0)
-	_nc_err_abort(MSG_NO_MEMORY);
+	TYPE_MALLOC(char, my_length = 256, my_string);
 
     *my_string = '\0';
     return my_string;
@@ -133,7 +131,7 @@
 	    _nc_err_abort(MSG_NO_MEMORY);
 	d = my_string + have;
     }
-    (void) strcpy(d, s);
+    _nc_STRCPY(d, s, my_length - have);
     return d + strlen(d);
 }
 
@@ -240,6 +238,12 @@
 	else if (parm == 2)
 	    parm = 1;
     }
+
+    while (n--) {
+	dp = save_string(dp, "%p");
+	dp = save_char(dp, '0' + parm);
+    }
+
     if (onstack == parm) {
 	if (n > 1) {
 	    _nc_warning("string may not be optimal");
@@ -255,11 +259,6 @@
 
     onstack = parm;
 
-    while (n--) {
-	dp = save_string(dp, "%p");
-	dp = save_char(dp, '0' + parm);
-    }
-
     if (seenn && parm < 3) {
 	dp = save_string(dp, "%{96}%^");
     }
@@ -469,73 +468,9 @@
 		break;
 	    }
 	    break;
-#ifdef REVISIBILIZE
-	case '\\':
-	    dp = save_char(dp, *s++);
-	    dp = save_char(dp, *s++);
-	    break;
-	case '\n':
-	    dp = save_string(dp, "\\n");
-	    s++;
-	    break;
-	case '\t':
-	    dp = save_string(dp, "\\t");
-	    s++;
-	    break;
-	case '\r':
-	    dp = save_string(dp, "\\r");
-	    s++;
-	    break;
-	case '\200':
-	    dp = save_string(dp, "\\0");
-	    s++;
-	    break;
-	case '\f':
-	    dp = save_string(dp, "\\f");
-	    s++;
-	    break;
-	case '\b':
-	    dp = save_string(dp, "\\b");
-	    s++;
-	    break;
-	case ' ':
-	    dp = save_string(dp, "\\s");
-	    s++;
-	    break;
-	case '^':
-	    dp = save_string(dp, "\\^");
-	    s++;
-	    break;
-	case ':':
-	    dp = save_string(dp, "\\:");
-	    s++;
-	    break;
-	case ',':
-	    dp = save_string(dp, "\\,");
-	    s++;
-	    break;
-	default:
-	    if (*s == '\033') {
-		dp = save_string(dp, "\\E");
-		s++;
-	    } else if (*s > 0 && *s < 32) {
-		dp = save_char(dp, '^');
-		dp = save_char(dp, *s + '@');
-		s++;
-	    } else if (*s <= 0 || *s >= 127) {
-		dp = save_char(dp, '\\');
-		dp = save_char(dp, ((*s & 0300) >> 6) + '0');
-		dp = save_char(dp, ((*s & 0070) >> 3) + '0');
-		dp = save_char(dp, (*s & 0007) + '0');
-		s++;
-	    } else
-		dp = save_char(dp, *s++);
-	    break;
-#else
 	default:
 	    dp = save_char(dp, *s++);
 	    break;
-#endif
 	}
     }
 
@@ -578,7 +513,7 @@
 	{
 	    char buffer[80];
 	    int tst;
-	    sprintf(buffer, fmt, ch1, ch2);
+	    _nc_SPRINTF(buffer, _nc_SLIMIT(sizeof(buffer)) fmt, ch1, ch2);
 	    tst = strlen(buffer) - 1;
 	    assert(len == tst);
 	}
@@ -597,10 +532,13 @@
 	    bufptr = save_char(bufptr, '\\');
 	bufptr = save_char(bufptr, c1);
     } else {
-	if (c1 == (c1 & 0x1f))	/* iscntrl() returns T on 255 */
-	    (void) strcpy(temp, unctrl((chtype) c1));
-	else
-	    (void) sprintf(temp, "\\%03o", c1);
+	if (c1 == (c1 & 0x1f)) {	/* iscntrl() returns T on 255 */
+	    _nc_SPRINTF(temp, _nc_SLIMIT(sizeof(temp))
+			"%.20s", unctrl((chtype) c1));
+	} else {
+	    _nc_SPRINTF(temp, _nc_SLIMIT(sizeof(temp))
+			"\\%03o", c1);
+	}
 	bufptr = save_string(bufptr, temp);
     }
     return bufptr;
@@ -646,13 +584,15 @@
     int in0, in1, in2;
     char ch1 = 0, ch2 = 0;
     char *bufptr = init_string();
+    char octal[4];
     int len;
     bool syntax_error = FALSE;
 
     /* we may have to move some trailing mandatory padding up front */
     padding = str + strlen(str) - 1;
-    if (padding > str && *padding == '>' && *--padding == '/') {
-	--padding;
+    if (padding > str && *padding == '>') {
+	if (*--padding == '/')
+	    --padding;
 	while (isdigit(UChar(*padding)) || *padding == '.' || *padding == '*')
 	    padding--;
 	if (padding > str && *padding == '<' && *--padding == '$')
@@ -663,7 +603,7 @@
 	    bufptr = save_char(bufptr, *padding++);
     }
 
-    for (; *str && str != trimmed; str++) {
+    for (; *str && ((trimmed == 0) || (str < trimmed)); str++) {
 	int c1, c2;
 	char *cp = 0;
 
@@ -685,8 +625,72 @@
 	    } else if (str[1] == ',') {
 		bufptr = save_char(bufptr, *++str);
 	    } else {
+		int xx1, xx2;
+
 		bufptr = save_char(bufptr, *str++);
-		bufptr = save_char(bufptr, *str);
+		xx1 = *str;
+		if (_nc_strict_bsd) {
+		    if (isdigit(UChar(xx1))) {
+			int pad = 0;
+
+			if (!isdigit(UChar(str[1])))
+			    pad = 2;
+			else if (str[1] && !isdigit(UChar(str[2])))
+			    pad = 1;
+
+			/*
+			 * Test for "\0", "\00" or "\000" and transform those
+			 * into "\200".
+			 */
+			if (xx1 == '0'
+			    && ((pad == 2) || (str[1] == '0'))
+			    && ((pad >= 1) || (str[2] == '0'))) {
+			    xx2 = '2';
+			} else {
+			    xx2 = '0';
+			    pad = 0;	/* FIXME - optionally pad to 3 digits */
+			}
+			while (pad-- > 0) {
+			    bufptr = save_char(bufptr, xx2);
+			    xx2 = '0';
+			}
+		    } else if (strchr("E\\nrtbf", xx1) == 0) {
+			switch (xx1) {
+			case 'e':
+			    xx1 = 'E';
+			    break;
+			case 'l':
+			    xx1 = 'n';
+			    break;
+			case 's':
+			    bufptr = save_char(bufptr, '0');
+			    bufptr = save_char(bufptr, '4');
+			    xx1 = '0';
+			    break;
+			case ':':
+			    /*
+			     * Note: termcap documentation claims that ":"
+			     * must be escaped as "\072", however the
+			     * documentation is incorrect - read the code.
+			     * The replacement does not work reliably,
+			     * so the advice is not helpful.
+			     */
+			    bufptr = save_char(bufptr, '0');
+			    bufptr = save_char(bufptr, '7');
+			    xx1 = '2';
+			    break;
+			default:
+			    /* should not happen, but handle this anyway */
+			    _nc_SPRINTF(octal, _nc_SLIMIT(sizeof(octal))
+					"%03o", UChar(xx1));
+			    bufptr = save_char(bufptr, octal[0]);
+			    bufptr = save_char(bufptr, octal[1]);
+			    xx1 = octal[2];
+			    break;
+			}
+		    }
+		}
+		bufptr = save_char(bufptr, xx1);
 	    }
 	} else if (str[0] == '$' && str[1] == '<') {	/* discard padding */
 	    str += 2;
@@ -703,7 +707,8 @@
 		   && ((in0 == 4 && in1 == 10 && in2 == 48)
 		       || (in0 == 3 && in1 == 9 && in2 == 38))) {
 	    /* dumb-down an optimized case from xterm-256color for termcap */
-	    str = strstr(str, ";m");
+	    if ((str = strstr(str, ";m")) == 0)
+		break;		/* cannot happen */
 	    ++str;
 	    if (in2 == 48) {
 		bufptr = save_string(bufptr, "[48;5;%dm");
@@ -720,13 +725,13 @@
 	    bufptr = save_tc_inequality(bufptr, c1, c2);
 	} else if (sscanf(str, "%%?%%{%d}%%>%%t%%'%c'%%+%%;", &c1, &ch2) == 2) {
 	    str = strchr(str, ';');
-	    bufptr = save_tc_inequality(bufptr, c1, c2);
+	    bufptr = save_tc_inequality(bufptr, c1, ch2);
 	} else if (sscanf(str, "%%?%%'%c'%%>%%t%%{%d}%%+%%;", &ch1, &c2) == 2) {
 	    str = strchr(str, ';');
-	    bufptr = save_tc_inequality(bufptr, c1, c2);
+	    bufptr = save_tc_inequality(bufptr, ch1, c2);
 	} else if (sscanf(str, "%%?%%'%c'%%>%%t%%'%c'%%+%%;", &ch1, &ch2) == 2) {
 	    str = strchr(str, ';');
-	    bufptr = save_tc_inequality(bufptr, c1, c2);
+	    bufptr = save_tc_inequality(bufptr, ch1, ch2);
 	} else if ((len = bcd_expression(str)) != 0) {
 	    str += len;
 	    bufptr = save_string(bufptr, "%B");
@@ -741,15 +746,15 @@
 	    bufptr = save_tc_char(bufptr, c1);
 	}
 	/* FIXME: this "works" for 'delta' */
-	else if (strncmp(str, "%{2}%*%-", 8) == 0) {
+	else if (strncmp(str, "%{2}%*%-", (size_t) 8) == 0) {
 	    str += 7;
 	    bufptr = save_string(bufptr, "%D");
-	} else if (strncmp(str, "%{96}%^", 7) == 0) {
+	} else if (strncmp(str, "%{96}%^", (size_t) 7) == 0) {
 	    str += 6;
 	    if (saw_m++ == 0) {
 		bufptr = save_string(bufptr, "%n");
 	    }
-	} else if (strncmp(str, "%{127}%^", 8) == 0) {
+	} else if (strncmp(str, "%{127}%^", (size_t) 8) == 0) {
 	    str += 7;
 	    if (saw_n++ == 0) {
 		bufptr = save_string(bufptr, "%m");
@@ -772,8 +777,25 @@
 	    case '8':
 	    case '9':
 		bufptr = save_char(bufptr, '%');
-		while (isdigit(UChar(*str)))
-		    bufptr = save_char(bufptr, *str++);
+		ch1 = 0;
+		ch2 = 0;
+		while (isdigit(UChar(*str))) {
+		    ch2 = ch1;
+		    ch1 = *str++;
+		    if (_nc_strict_bsd) {
+			if (ch1 > '3')
+			    return 0;
+		    } else {
+			bufptr = save_char(bufptr, ch1);
+		    }
+		}
+		if (_nc_strict_bsd) {
+		    if (ch2 != 0 && ch2 != '0')
+			return 0;
+		    if (ch1 < '2')
+			ch1 = 'd';
+		    bufptr = save_char(bufptr, ch1);
+		}
 		if (strchr("doxX.", *str)) {
 		    if (*str != 'd')	/* termcap doesn't have octal, hex */
 			return 0;
@@ -794,6 +816,8 @@
 		 * termcap notation.
 		 */
 	    case 's':
+		if (_nc_strict_bsd)
+		    return 0;
 		bufptr = save_string(bufptr, "%s");
 		break;
 
@@ -826,7 +850,7 @@
 	 * but that may not be the end of the string.
 	 */
 	assert(str != 0);
-	if (*str == '\0')
+	if (str == 0 || *str == '\0')
 	    break;
 
     }				/* endwhile (*str) */
Index: ncurses/tinfo/comp_error.c
Prereq:  1.31 
--- ncurses-5.9/ncurses/tinfo/comp_error.c	2007-04-21 23:38:32.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/tinfo/comp_error.c	2012-02-22 22:34:31.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2005,2007 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -41,7 +41,7 @@
 
 #include <tic.h>
 
-MODULE_ID("$Id: comp_error.c,v 1.31 2007/04/21 23:38:32 tom Exp $")
+MODULE_ID("$Id: comp_error.c,v 1.36 2012/02/22 22:34:31 tom Exp $")
 
 NCURSES_EXPORT_VAR(bool) _nc_suppress_warnings = FALSE;
 NCURSES_EXPORT_VAR(int) _nc_curr_line = 0; /* current line # in input */
@@ -59,7 +59,8 @@
 NCURSES_EXPORT(void)
 _nc_set_source(const char *const name)
 {
-    SourceName = name;
+    FreeIfNeeded(SourceName);
+    SourceName = strdup(name);
 }
 
 NCURSES_EXPORT(void)
@@ -70,7 +71,7 @@
     if (TermType != 0) {
 	TermType[0] = '\0';
 	if (name)
-	    strncat(TermType, name, MAX_NAME_SIZE);
+	    strncat(TermType, name, (size_t) MAX_NAME_SIZE);
     }
 }
 
@@ -84,7 +85,7 @@
     }
 #endif
     if (name != 0)
-	strcpy(name, TermType != 0 ? TermType : "");
+	_nc_STRCPY(name, TermType != 0 ? TermType : "", MAX_NAME_SIZE);
 }
 
 static NCURSES_INLINE void
@@ -151,3 +152,12 @@
     exit(EXIT_FAILURE);
 #endif
 }
+
+#if NO_LEAKS
+NCURSES_EXPORT(void)
+_nc_comp_error_leaks(void)
+{
+    FreeAndNull(SourceName);
+    FreeAndNull(TermType);
+}
+#endif
Index: ncurses/tinfo/comp_expand.c
Prereq:  1.21 
--- ncurses-5.9/ncurses/tinfo/comp_expand.c	2010-01-16 17:11:23.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/tinfo/comp_expand.c	2012-03-24 18:37:17.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2008,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -35,7 +35,7 @@
 #include <ctype.h>
 #include <tic.h>
 
-MODULE_ID("$Id: comp_expand.c,v 1.21 2010/01/16 17:11:23 tom Exp $")
+MODULE_ID("$Id: comp_expand.c,v 1.25 2012/03/24 18:37:17 tom Exp $")
 
 static int
 trailing_spaces(const char *src)
@@ -49,6 +49,8 @@
 #define REALCTL(s) (UChar(*(s)) < 127 && iscntrl(UChar(*(s))))
 #define REALPRINT(s) (UChar(*(s)) < 127 && isprint(UChar(*(s))))
 
+#define P_LIMIT(p) (length - (size_t)(p))
+
 NCURSES_EXPORT(char *)
 _nc_tic_expand(const char *srcp, bool tic_format, int numbers)
 {
@@ -61,15 +63,15 @@
     size_t need = (2 + strlen(str)) * 4;
     int ch;
 
-#if NO_LEAKS
     if (srcp == 0) {
+#if NO_LEAKS
 	if (buffer != 0) {
 	    FreeAndNull(buffer);
 	    length = 0;
 	}
+#endif
 	return 0;
     }
-#endif
     if (buffer == 0 || need > length) {
 	if ((buffer = typeRealloc(char, length = need, buffer)) == 0)
 	      return 0;
@@ -90,7 +92,8 @@
 		    && str[1] != '\\'
 		    && REALPRINT(str + 1)
 		    && str[2] == S_QUOTE) {
-		    sprintf(buffer + bufp, "{%d}", str[1]);
+		    _nc_SPRINTF(buffer + bufp, _nc_SLIMIT(P_LIMIT(bufp))
+				"{%d}", str[1]);
 		    bufp += (int) strlen(buffer + bufp);
 		    str += 2;
 		} else {
@@ -177,10 +180,12 @@
 #define UnCtl(c) ((c) + '@')
 	else if (REALCTL(str) && ch != '\\'
 		 && (!islong || isdigit(UChar(str[1])))) {
-	    (void) sprintf(&buffer[bufp], "^%c", UnCtl(ch));
+	    _nc_SPRINTF(&buffer[bufp], _nc_SLIMIT(P_LIMIT(bufp))
+			"^%c", UnCtl(ch));
 	    bufp += 2;
 	} else {
-	    (void) sprintf(&buffer[bufp], "\\%03o", ch);
+	    _nc_SPRINTF(&buffer[bufp], _nc_SLIMIT(P_LIMIT(bufp))
+			"\\%03o", ch);
 	    bufp += 4;
 	}
 
Index: ncurses/tinfo/comp_parse.c
Prereq:  1.73 
--- ncurses-5.9/ncurses/tinfo/comp_parse.c	2010-12-25 23:06:37.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/tinfo/comp_parse.c	2012-10-27 21:48:03.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -35,15 +35,10 @@
 /*
  *	comp_parse.c -- parser driver loop and use handling.
  *
- *	_nc_read_entry_source(FILE *, literal, bool, bool (*hook)())
- *	_nc_resolve_uses2(void)
- *	_nc_free_entries(void)
- *
  *	Use this code by calling _nc_read_entry_source() on as many source
  *	files as you like (either terminfo or termcap syntax).  If you
  *	want use-resolution, call _nc_resolve_uses2().  To free the list
  *	storage, do _nc_free_entries().
- *
  */
 
 #include <curses.priv.h>
@@ -52,7 +47,7 @@
 
 #include <tic.h>
 
-MODULE_ID("$Id: comp_parse.c,v 1.73 2010/12/25 23:06:37 tom Exp $")
+MODULE_ID("$Id: comp_parse.c,v 1.86 2012/10/27 21:48:03 tom Exp $")
 
 static void sanity_check2(TERMTYPE *, bool);
 NCURSES_IMPEXP void NCURSES_API(*_nc_check_termtype2) (TERMTYPE *, bool) = sanity_check2;
@@ -61,6 +56,8 @@
 static void sanity_check(TERMTYPE *);
 NCURSES_IMPEXP void NCURSES_API(*_nc_check_termtype) (TERMTYPE *) = sanity_check;
 
+static void fixup_acsc(TERMTYPE *, int);
+
 static void
 enqueue(ENTRY * ep)
 /* add an entry to the in-core list */
@@ -86,16 +83,28 @@
 	if (len > MAX_NAME_SIZE)
 	    len = MAX_NAME_SIZE;
 	(void) strncpy(dst, src, len);
-	(void) strcpy(dst + len, "|");
+	_nc_STRCPY(dst + len, "|", MAX_NAME_SIZE);
 	src = dst;
     }
     return src;
 }
 #define ForceBar(dst, src) ((strchr(src, '|') == 0) ? force_bar(dst, src) : src)
 
-NCURSES_EXPORT(bool)
-_nc_entry_match(char *n1, char *n2)
-/* do any of the aliases in a pair of terminal names match? */
+#if USE_TERMCAP && NCURSES_XNAMES
+static char *
+skip_index(char *name)
+{
+    char *bar = strchr(name, '|');
+
+    if (bar != 0 && (bar - name) == 2)
+	name = bar + 1;
+
+    return name;
+}
+#endif
+
+static bool
+check_collisions(char *n1, char *n2, int counter)
 {
     char *pstart, *qstart, *pend, *qend;
     char nc1[MAX_NAME_SIZE + 2];
@@ -104,15 +113,98 @@
     n1 = ForceBar(nc1, n1);
     n2 = ForceBar(nc2, n2);
 
-    for (pstart = n1; (pend = strchr(pstart, '|')); pstart = pend + 1)
-	for (qstart = n2; (qend = strchr(qstart, '|')); qstart = qend + 1)
+#if USE_TERMCAP && NCURSES_XNAMES
+    if ((_nc_syntax == SYN_TERMCAP) && _nc_user_definable) {
+	n1 = skip_index(n1);
+	n2 = skip_index(n2);
+    }
+#endif
+
+    for (pstart = n1; (pend = strchr(pstart, '|')); pstart = pend + 1) {
+	for (qstart = n2; (qend = strchr(qstart, '|')); qstart = qend + 1) {
 	    if ((pend - pstart == qend - qstart)
-		&& memcmp(pstart, qstart, (size_t) (pend - pstart)) == 0)
+		&& memcmp(pstart, qstart, (size_t) (pend - pstart)) == 0) {
+		if (counter > 0)
+		    (void) fprintf(stderr, "Name collision '%.*s' between\n",
+				   (int) (pend - pstart), pstart);
 		return (TRUE);
+	    }
+	}
+    }
 
     return (FALSE);
 }
 
+static char *
+next_name(char *name)
+{
+    if (*name != '\0')
+	++name;
+    return name;
+}
+
+static char *
+name_ending(char *name)
+{
+    if (*name == '\0') {
+	name = 0;
+    } else {
+	while (*name != '\0' && *name != '|')
+	    ++name;
+    }
+    return name;
+}
+
+/*
+ * Essentially, find the conflict reported in check_collisions() and remove
+ * it from the second name, unless that happens to be the last alias.
+ */
+static bool
+remove_collision(char *n1, char *n2)
+{
+    char *p1 = n1;
+    char *p2 = n2;
+    char *pstart, *qstart, *pend, *qend;
+    bool removed = FALSE;
+
+#if USE_TERMCAP && NCURSES_XNAMES
+    if ((_nc_syntax == SYN_TERMCAP) && _nc_user_definable) {
+	p1 = n1 = skip_index(n1);
+	p2 = n2 = skip_index(n2);
+    }
+#else
+    (void) p1;
+#endif
+
+    for (pstart = n1; (pend = name_ending(pstart)); pstart = next_name(pend)) {
+	for (qstart = n2; (qend = name_ending(qstart)); qstart = next_name(qend)) {
+	    if ((pend - pstart == qend - qstart)
+		&& memcmp(pstart, qstart, (size_t) (pend - pstart)) == 0) {
+		if (qstart != p2 || *qend == '|') {
+		    if (*qend == '|')
+			++qend;
+		    while ((*qstart++ = *qend++) != '\0') ;
+		    fprintf(stderr, "...now\t%s\n", p2);
+		} else {
+		    fprintf(stderr, "Cannot remove alias '%.*s'\n",
+			    (int) (qend - qstart), qstart);
+		}
+		removed = TRUE;
+		break;
+	    }
+	}
+    }
+
+    return removed;
+}
+
+/* do any of the aliases in a pair of terminal names match? */
+NCURSES_EXPORT(bool)
+_nc_entry_match(char *n1, char *n2)
+{
+    return check_collisions(n1, n2, 0);
+}
+
 /****************************************************************************
  *
  * Entry compiler and resolution logic
@@ -198,19 +290,19 @@
 
 	for_entry_list(rp) {
 	    if (qp > rp
-		&& _nc_entry_match(qp->tterm.term_names, rp->tterm.term_names)) {
-		matchcount++;
-		if (matchcount == 1) {
-		    (void) fprintf(stderr, "Name collision between %s",
-				   _nc_first_name(qp->tterm.term_names));
-		    multiples++;
+		&& check_collisions(qp->tterm.term_names,
+				    rp->tterm.term_names,
+				    matchcount + 1)) {
+		if (!matchcount++) {
+		    (void) fprintf(stderr, "\t%s\n", rp->tterm.term_names);
+		}
+		(void) fprintf(stderr, "and\t%s\n", qp->tterm.term_names);
+		if (!remove_collision(rp->tterm.term_names,
+				      qp->tterm.term_names)) {
+		    ++multiples;
 		}
-		if (matchcount >= 1)
-		    (void) fprintf(stderr, " %s", _nc_first_name(rp->tterm.term_names));
 	    }
 	}
-	if (matchcount >= 1)
-	    (void) putc('\n', stderr);
     }
     if (multiples > 0)
 	return (FALSE);
@@ -256,9 +348,7 @@
 		    DEBUG(2, ("%s: resolving use=%s (compiled)",
 			      child, lookfor));
 
-		    rp = typeMalloc(ENTRY, 1);
-		    if (rp == 0)
-			_nc_err_abort(MSG_NO_MEMORY);
+		    TYPE_MALLOC(ENTRY, 1, rp);
 		    rp->tterm = thisterm;
 		    rp->nuses = 0;
 		    rp->next = lastread;
@@ -378,7 +468,34 @@
 	    for_entry_list(qp) {
 		_nc_curr_line = (int) qp->startline;
 		_nc_set_type(_nc_first_name(qp->tterm.term_names));
-		_nc_check_termtype2(&qp->tterm, literal);
+		/*
+		 * tic overrides this function pointer to provide more verbose
+		 * checking.
+		 */
+		if (_nc_check_termtype2 != sanity_check2) {
+		    SCREEN *save_SP = SP;
+		    SCREEN fake_sp;
+		    TERMINAL fake_tm;
+		    TERMINAL *save_tm = cur_term;
+
+		    /*
+		     * Setup so that tic can use ordinary terminfo interface
+		     * to obtain capability information.
+		     */
+		    memset(&fake_sp, 0, sizeof(fake_sp));
+		    memset(&fake_tm, 0, sizeof(fake_tm));
+		    fake_sp._term = &fake_tm;
+		    fake_tm.type = qp->tterm;
+		    SP = &fake_sp;
+		    set_curterm(&fake_tm);
+
+		    _nc_check_termtype2(&qp->tterm, literal);
+
+		    SP = save_SP;
+		    set_curterm(save_tm);
+		} else {
+		    fixup_acsc(&qp->tterm, literal);
+		}
 	    }
 	    DEBUG(2, ("SANITY CHECK FINISHED"));
 	}
@@ -403,6 +520,17 @@
 #define CUR tp->
 
 static void
+fixup_acsc(TERMTYPE *tp, int literal)
+{
+    if (!literal) {
+	if (acs_chars == 0
+	    && enter_alt_charset_mode != 0
+	    && exit_alt_charset_mode != 0)
+	    acs_chars = strdup(VT_ACSC);
+    }
+}
+
+static void
 sanity_check2(TERMTYPE *tp, bool literal)
 {
     if (!PRESENT(exit_attribute_mode)) {
@@ -428,10 +556,7 @@
      * prefer to bypass it...
      */
     if (!literal) {
-	if (acs_chars == 0
-	    && enter_alt_charset_mode != 0
-	    && exit_alt_charset_mode != 0)
-	    acs_chars = strdup(VT_ACSC);
+	fixup_acsc(tp, literal);
 	ANDMISSING(enter_alt_charset_mode, acs_chars);
 	ANDMISSING(exit_alt_charset_mode, acs_chars);
     }
Index: ncurses/tinfo/comp_scan.c
Prereq:  1.89 
--- ncurses-5.9/ncurses/tinfo/comp_scan.c	2010-12-25 23:06:37.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/tinfo/comp_scan.c	2012-12-08 22:19:25.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2008,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -50,7 +50,7 @@
 #include <ctype.h>
 #include <tic.h>
 
-MODULE_ID("$Id: comp_scan.c,v 1.89 2010/12/25 23:06:37 tom Exp $")
+MODULE_ID("$Id: comp_scan.c,v 1.101 2012/12/08 22:19:25 tom Exp $")
 
 /*
  * Maximum length of string capability we'll accept before raising an error.
@@ -61,6 +61,7 @@
 #define iswhite(ch)	(ch == ' '  ||  ch == '\t')
 
 NCURSES_EXPORT_VAR (int) _nc_syntax = 0;         /* termcap or terminfo? */
+NCURSES_EXPORT_VAR (int) _nc_strict_bsd = 1;  /* ncurses extended termcap? */
 NCURSES_EXPORT_VAR (long) _nc_curr_file_pos = 0; /* file offset of current line */
 NCURSES_EXPORT_VAR (long) _nc_comment_start = 0; /* start of comment range before name */
 NCURSES_EXPORT_VAR (long) _nc_comment_end = 0;   /* end of comment range before name */
@@ -127,14 +128,19 @@
  *	Returns the final nonblank character on the current input buffer
  */
 static int
-last_char(void)
+last_char(int from_end)
 {
     size_t len = strlen(bufptr);
+    int result = 0;
+
     while (len--) {
-	if (!isspace(UChar(bufptr[len])))
-	    return bufptr[len];
+	if (!isspace(UChar(bufptr[len]))) {
+	    if (from_end < (int) len)
+		result = bufptr[(int) len - from_end];
+	    break;
+	}
     }
-    return 0;
+    return result;
 }
 
 /*
@@ -195,7 +201,8 @@
 		    result = typeRealloc(char, allocated, result);
 		    if (result == 0)
 			return (EOF);
-		    bufstart = result;
+		    if (bufstart)
+			bufstart = result;
 		}
 		if (used == 0)
 		    _nc_curr_file_pos = ftell(yyin);
@@ -212,7 +219,7 @@
 		    }
 		} else {
 		    if (used != 0)
-			strcat(result, "\n");
+			_nc_STRCAT(result, "\n", allocated);
 		}
 		if ((bufptr = bufstart) != 0) {
 		    used = strlen(bufptr);
@@ -256,12 +263,12 @@
 }
 
 static void
-push_back(char c)
+push_back(int c)
 /* push a character back onto the input stream */
 {
     if (bufptr == bufstart)
 	_nc_syserr_abort("Can't backspace off beginning of line");
-    *--bufptr = c;
+    *--bufptr = (char) c;
     _nc_curr_col--;
 }
 
@@ -299,6 +306,8 @@
 	*tok_ptr++ = (char) ch; \
 	*tok_ptr = '\0'
 
+static char *tok_buf;
+
 /*
  *	int
  *	get_token()
@@ -336,15 +345,14 @@
 _nc_get_token(bool silent)
 {
     static const char terminfo_punct[] = "@%&*!#";
-    static char *tok_buf;
 
-    char *after_list;
-    char *after_name;
+    char *after_name;		/* after primary name */
+    char *after_list;		/* after primary and alias list */
     char *numchk;
     char *tok_ptr;
     char *s;
     char numbuf[80];
-    int ch;
+    int ch, c0, c1;
     int dot_flag = FALSE;
     int type;
     long number;
@@ -372,11 +380,10 @@
 
     if (end_of_stream()) {
 	yyin = 0;
-	next_char();		/* frees its allocated memory */
+	(void) next_char();		/* frees its allocated memory */
 	if (tok_buf != 0) {
 	    if (_nc_curr_token.tk_name == tok_buf)
 		_nc_curr_token.tk_name = 0;
-	    FreeAndNull(tok_buf);
 	}
 	return (EOF);
     }
@@ -390,6 +397,7 @@
     }
 
     ch = eat_escaped_newline(ch);
+    _nc_curr_token.tk_valstring = 0;
 
 #ifdef TRACE
     old_line = _nc_curr_line;
@@ -457,7 +465,7 @@
 		    after_list = tok_ptr;
 		    if (after_name == 0)
 			after_name = tok_ptr;
-		} else if (ch == ':' && last_char() != ',') {
+		} else if (ch == ':' && last_char(0) != ',') {
 		    _nc_syntax = SYN_TERMCAP;
 		    separator = ':';
 		    break;
@@ -471,12 +479,64 @@
 		    if (after_name == 0)
 			break;
 		    /*
-		     * If we see a comma, we assume this is terminfo unless we
-		     * subsequently run into a colon.  But we don't stop
-		     * looking for a colon until hitting a newline.  This
-		     * allows commas to be embedded in description fields of
-		     * either syntax.
+		     * We saw a comma, but are not entirely sure this is
+		     * terminfo format, since we can still be parsing the
+		     * description field (for either syntax).
+		     *
+		     * A properly formatted termcap line ends with either a
+		     * colon, or a backslash after a colon.  It is possible
+		     * to have a backslash in the middle of a capability, but
+		     * then there would be no leading whitespace on the next
+		     * line - something we want to discourage.
 		     */
+		    c0 = last_char(0);
+		    c1 = last_char(1);
+		    if (c1 != ':' && c0 != '\\' && c0 != ':') {
+			bool capability = FALSE;
+
+			/*
+			 * Since it is not termcap, assume the line is terminfo
+			 * format.  However, the comma can be embedded in a
+			 * description field.  It also can be a separator
+			 * between a description field and a capability.
+			 *
+			 * Improve the guess by checking if the next word after
+			 * the comma does not look like a capability.  In that
+			 * case, extend the description past the comma.
+			 */
+			for (s = bufptr; isspace(UChar(*s)); ++s) {
+			    ;
+			}
+			if (islower(UChar(*s))) {
+			    char *name = s;
+			    while (isalnum(UChar(*s))) {
+				++s;
+			    }
+			    if (*s == '#' || *s == '=' || *s == '@') {
+				/*
+				 * Checking solely with syntax allows us to
+				 * support extended capabilities with string
+				 * values.
+				 */
+				capability = TRUE;
+			    } else if (*s == ',') {
+				c0 = *s;
+				*s = '\0';
+				/*
+				 * Otherwise, we can handle predefined boolean
+				 * capabilities, still aided by syntax.
+				 */
+				if (_nc_find_entry(name,
+						   _nc_get_hash_table(FALSE))) {
+				    capability = TRUE;
+				}
+				*s = (char) c0;
+			    }
+			}
+			if (capability) {
+			    break;
+			}
+		    }
 		} else
 		    ch = eat_escaped_newline(ch);
 
@@ -748,7 +808,7 @@
 	    if (!(is7bits(c) && isprint(c))) {
 		_nc_warning("Illegal ^ character - '%s'", unctrl(UChar(c)));
 	    }
-	    if (c == '?') {
+	    if (c == '?' && (_nc_syntax != SYN_TERMCAP)) {
 		*(ptr++) = '\177';
 		if (_nc_tracing)
 		    _nc_warning("Allow ^? as synonym for \\177");
@@ -758,23 +818,29 @@
 		*(ptr++) = (char) (c);
 	    }
 	} else if (c == '\\') {
+	    bool strict_bsd = ((_nc_syntax == SYN_TERMCAP) && _nc_strict_bsd);
+
 	    c = next_char();
 	    if (c == EOF)
 		_nc_err_abort(MSG_NO_INPUTS);
 
-	    if (c >= '0' && c <= '7') {
+#define isoctal(c) ((c) >= '0' && (c) <= '7')
+
+	    if (isoctal(c) || (strict_bsd && isdigit(c))) {
 		number = c - '0';
 		for (i = 0; i < 2; i++) {
 		    c = next_char();
 		    if (c == EOF)
 			_nc_err_abort(MSG_NO_INPUTS);
 
-		    if (c < '0' || c > '7') {
+		    if (!isoctal(c)) {
 			if (isdigit(c)) {
-			    _nc_warning("Non-octal digit `%c' in \\ sequence", c);
-			    /* allow the digit; it'll do less harm */
+			    if (!strict_bsd) {
+				_nc_warning("Non-octal digit `%c' in \\ sequence", c);
+				/* allow the digit; it'll do less harm */
+			    }
 			} else {
-			    push_back((char) c);
+			    push_back(c);
 			    break;
 			}
 		    }
@@ -782,21 +848,16 @@
 		    number = number * 8 + c - '0';
 		}
 
-		if (number == 0)
+		number = UChar(number);
+		if (number == 0 && !strict_bsd)
 		    number = 0200;
 		*(ptr++) = (char) number;
 	    } else {
 		switch (c) {
 		case 'E':
-		case 'e':
 		    *(ptr++) = '\033';
 		    break;
 
-		case 'a':
-		    *(ptr++) = '\007';
-		    break;
-
-		case 'l':
 		case 'n':
 		    *(ptr++) = '\n';
 		    break;
@@ -809,10 +870,6 @@
 		    *(ptr++) = '\010';
 		    break;
 
-		case 's':
-		    *(ptr++) = ' ';
-		    break;
-
 		case 'f':
 		    *(ptr++) = '\014';
 		    break;
@@ -833,16 +890,33 @@
 		    *(ptr++) = ',';
 		    break;
 
-		case ':':
-		    *(ptr++) = ':';
-		    break;
-
 		case '\n':
 		    continue;
 
 		default:
-		    _nc_warning("Illegal character '%s' in \\ sequence",
-				unctrl(UChar(c)));
+		    if ((_nc_syntax == SYN_TERMINFO) || !_nc_strict_bsd) {
+			switch (c) {
+			case 'a':
+			    c = '\007';
+			    break;
+			case 'e':
+			    c = '\033';
+			    break;
+			case 'l':
+			    c = '\n';
+			    break;
+			case 's':
+			    c = ' ';
+			    break;
+			case ':':
+			    c = ':';
+			    break;
+			default:
+			    _nc_warning("Illegal character '%s' in \\ sequence",
+					unctrl(UChar(c)));
+			    break;
+			}
+		    }
 		    /* FALLTHRU */
 		case '|':
 		    *(ptr++) = (char) c;
@@ -862,7 +936,7 @@
 
 	if (!ignored) {
 	    if (_nc_curr_col <= 1) {
-		push_back((char) c);
+		push_back(c);
 		c = '\n';
 		break;
 	    }
@@ -934,5 +1008,8 @@
     if (pushname != 0) {
 	FreeAndNull(pushname);
     }
+    if (tok_buf != 0) {
+	FreeAndNull(tok_buf);
+    }
 }
 #endif
Index: ncurses/tinfo/db_iterator.c
Prereq:  1.9 
--- ncurses-5.9/ncurses/tinfo/db_iterator.c	2010-12-25 23:00:25.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/tinfo/db_iterator.c	2012-08-25 21:55:00.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 2006-2007,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 2006-2011,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -36,13 +36,142 @@
 
 #include <curses.priv.h>
 
+#include <time.h>
 #include <tic.h>
 
-MODULE_ID("$Id: db_iterator.c,v 1.9 2010/12/25 23:00:25 tom Exp $")
+#if USE_HASHED_DB
+#include <hashed_db.h>
+#endif
+
+MODULE_ID("$Id: db_iterator.c,v 1.35 2012/08/25 21:55:00 tom Exp $")
 
 #define HaveTicDirectory _nc_globals.have_tic_directory
 #define KeepTicDirectory _nc_globals.keep_tic_directory
 #define TicDirectory     _nc_globals.tic_directory
+#define my_blob          _nc_globals.dbd_blob
+#define my_list          _nc_globals.dbd_list
+#define my_size          _nc_globals.dbd_size
+#define my_time          _nc_globals.dbd_time
+#define my_vars          _nc_globals.dbd_vars
+
+static void
+add_to_blob(const char *text, size_t limit)
+{
+    (void) limit;
+
+    if (*text != '\0') {
+	char *last = my_blob + strlen(my_blob);
+	if (last != my_blob)
+	    *last++ = NCURSES_PATHSEP;
+	_nc_STRCPY(last, text, limit);
+    }
+}
+
+static bool
+check_existence(const char *name, struct stat *sb)
+{
+    bool result = FALSE;
+
+    if (stat(name, sb) == 0
+	&& (S_ISDIR(sb->st_mode) || S_ISREG(sb->st_mode))) {
+	result = TRUE;
+    }
+#if USE_HASHED_DB
+    else if (strlen(name) < PATH_MAX - sizeof(DBM_SUFFIX)) {
+	char temp[PATH_MAX];
+	_nc_SPRINTF(temp, _nc_SLIMIT(sizeof(temp)) "%s%s", name, DBM_SUFFIX);
+	if (stat(temp, sb) == 0 && S_ISREG(sb->st_mode)) {
+	    result = TRUE;
+	}
+    }
+#endif
+    return result;
+}
+
+/*
+ * Store the latest value of an environment variable in my_vars[] so we can
+ * detect if one changes, invalidating the cached search-list.
+ */
+static bool
+update_getenv(const char *name, DBDIRS which)
+{
+    bool result = FALSE;
+
+    if (which < dbdLAST) {
+	char *value;
+
+	if ((value = getenv(name)) == 0 || (value = strdup(value)) == 0) {
+	    ;
+	} else if (my_vars[which].name == 0 || strcmp(my_vars[which].name, name)) {
+	    FreeIfNeeded(my_vars[which].value);
+	    my_vars[which].name = name;
+	    my_vars[which].value = value;
+	    result = TRUE;
+	} else if ((my_vars[which].value != 0) ^ (value != 0)) {
+	    FreeIfNeeded(my_vars[which].value);
+	    my_vars[which].value = value;
+	    result = TRUE;
+	} else if (value != 0 && strcmp(value, my_vars[which].value)) {
+	    FreeIfNeeded(my_vars[which].value);
+	    my_vars[which].value = value;
+	    result = TRUE;
+	} else {
+	    free(value);
+	}
+    }
+    return result;
+}
+
+static char *
+cache_getenv(const char *name, DBDIRS which)
+{
+    char *result = 0;
+
+    (void) update_getenv(name, which);
+    if (which < dbdLAST) {
+	result = my_vars[which].value;
+    }
+    return result;
+}
+
+/*
+ * The cache expires if at least a second has passed since the initial lookup,
+ * or if one of the environment variables changed.
+ *
+ * Only a few applications use multiple lookups of terminal entries, seems that
+ * aside from bulk I/O such as tic and toe, that leaves interactive programs
+ * which should not be modifying the terminal databases in a way that would
+ * invalidate the search-list.
+ *
+ * The "1-second" is to allow for user-directed changes outside the program.
+ */
+static bool
+cache_expired(void)
+{
+    bool result = FALSE;
+    time_t now = time((time_t *) 0);
+
+    if (now > my_time) {
+	result = TRUE;
+    } else {
+	DBDIRS n;
+	for (n = (DBDIRS) 0; n < dbdLAST; ++n) {
+	    if (my_vars[n].name != 0
+		&& update_getenv(my_vars[n].name, n)) {
+		result = TRUE;
+		break;
+	    }
+	}
+    }
+    return result;
+}
+
+static void
+free_cache(void)
+{
+    FreeAndNull(my_blob);
+    FreeAndNull(my_list);
+}
 
 /*
  * Record the "official" location of the terminfo directory, according to
@@ -51,6 +180,7 @@
 NCURSES_EXPORT(const char *)
 _nc_tic_dir(const char *path)
 {
+    T(("_nc_tic_dir %s", NonNull(path)));
     if (!KeepTicDirectory) {
 	if (path != 0) {
 	    TicDirectory = path;
@@ -61,7 +191,7 @@
 		return _nc_tic_dir(envp);
 	}
     }
-    return TicDirectory;
+    return TicDirectory ? TicDirectory : TERMINFO;
 }
 
 /*
@@ -77,61 +207,16 @@
 }
 
 /*
- * Process the list of :-separated directories, looking for the terminal type.
- * We don't use strtok because it does not show us empty tokens.
- */
-#define ThisDbList	_nc_globals.dbi_list
-#define ThisDbSize	_nc_globals.dbi_size
-
-/*
  * Cleanup.
  */
 NCURSES_EXPORT(void)
 _nc_last_db(void)
 {
-    if (ThisDbList != 0) {
-	FreeAndNull(ThisDbList);
-    }
-    ThisDbSize = 0;
-}
-
-/* The TERMINFO_DIRS value, if defined by the configure script, begins with a
- * ":", which will be interpreted as TERMINFO.
- */
-static const char *
-next_list_item(const char *source, int *offset)
-{
-    if (source != 0) {
-	FreeIfNeeded(ThisDbList);
-	ThisDbList = strdup(source);
-	ThisDbSize = (int) strlen(source);
-    }
-
-    if (ThisDbList != 0 && ThisDbSize && *offset < ThisDbSize) {
-	static char system_db[] = TERMINFO;
-	char *result = ThisDbList + *offset;
-	char *marker = strchr(result, NCURSES_PATHSEP);
-
-	/*
-	 * Put a null on the marker if a separator was found.  Set the offset
-	 * to the next position after the marker so we can call this function
-	 * again, using the data at the offset.
-	 */
-	if (marker == 0) {
-	    *offset += (int) strlen(result);
-	} else {
-	    *marker++ = 0;
-	    *offset = (int) (marker - ThisDbList);
-	}
-	if (*result == 0 && result != (ThisDbList + ThisDbSize))
-	    result = system_db;
-	return result;
+    if (my_blob != 0 && cache_expired()) {
+	free_cache();
     }
-    return 0;
 }
 
-#define NEXT_DBD(var, offset) next_list_item((*offset == 0) ? var : 0, offset)
-
 /*
  * This is a simple iterator which allows the caller to step through the
  * possible locations for a terminfo directory.  ncurses uses this to find
@@ -141,84 +226,186 @@
 _nc_next_db(DBDIRS * state, int *offset)
 {
     const char *result;
-    char *envp;
-
-    while (*state < dbdLAST) {
-	DBDIRS next = (DBDIRS) ((int) (*state) + 1);
 
+    (void) offset;
+    if ((int) *state < my_size
+	&& my_list != 0
+	&& my_list[*state] != 0) {
+	result = my_list[*state];
+	(*state)++;
+    } else {
 	result = 0;
+    }
+    if (result != 0) {
+	T(("_nc_next_db %d %s", *state, result));
+    }
+    return result;
+}
+
+NCURSES_EXPORT(void)
+_nc_first_db(DBDIRS * state, int *offset)
+{
+    bool cache_has_expired = FALSE;
+    *state = dbdTIC;
+    *offset = 0;
+
+    T(("_nc_first_db"));
+
+    /* build a blob containing all of the strings we will use for a lookup
+     * table.
+     */
+    if (my_blob == 0 || (cache_has_expired = cache_expired())) {
+	size_t blobsize = 0;
+	const char *values[dbdLAST];
+	struct stat *my_stat;
+	int j, k;
+
+	if (cache_has_expired)
+	    free_cache();
+
+	for (j = 0; j < dbdLAST; ++j)
+	    values[j] = 0;
+
+	/*
+	 * This is the first item in the list, and is used only when tic is
+	 * writing to the database, as a performance improvement.
+	 */
+	values[dbdTIC] = TicDirectory;
 
-	switch (*state) {
-	case dbdTIC:
-	    if (HaveTicDirectory)
-		result = _nc_tic_dir(0);
-	    break;
 #if USE_DATABASE
-	case dbdEnvOnce:
-	    if (use_terminfo_vars()) {
-		if ((envp = getenv("TERMINFO")) != 0)
-		    result = _nc_tic_dir(envp);
-	    }
-	    break;
-	case dbdHome:
-	    if (use_terminfo_vars()) {
-		result = _nc_home_terminfo();
-	    }
-	    break;
-	case dbdEnvList:
-	    if (use_terminfo_vars()) {
-		if ((result = NEXT_DBD(getenv("TERMINFO_DIRS"), offset)) != 0)
-		    next = *state;
-	    }
-	    break;
-	case dbdCfgList:
 #ifdef TERMINFO_DIRS
-	    if ((result = NEXT_DBD(TERMINFO_DIRS, offset)) != 0)
-		next = *state;
+	values[dbdCfgList] = TERMINFO_DIRS;
+#endif
+#ifdef TERMINFO
+	values[dbdCfgOnce] = TERMINFO;
 #endif
-	    break;
-	case dbdCfgOnce:
-#ifndef TERMINFO_DIRS
-	    result = TERMINFO;
 #endif
-	    break;
-#endif /* USE_DATABASE */
+
 #if USE_TERMCAP
-	case dbdEnvOnce2:
-	    if (use_terminfo_vars()) {
-		if ((envp = getenv("TERMCAP")) != 0)
-		    result = _nc_tic_dir(envp);
-	    }
-	    break;
-	case dbdEnvList2:
-	    if (use_terminfo_vars()) {
-		if ((result = NEXT_DBD(getenv("TERMPATH"), offset)) != 0)
-		    next = *state;
+	values[dbdCfgList2] = TERMPATH;
+#endif
+
+	if (use_terminfo_vars()) {
+#if USE_DATABASE
+	    values[dbdEnvOnce] = cache_getenv("TERMINFO", dbdEnvOnce);
+	    values[dbdHome] = _nc_home_terminfo();
+	    (void) cache_getenv("HOME", dbdHome);
+	    values[dbdEnvList] = cache_getenv("TERMINFO_DIRS", dbdEnvList);
+
+#endif
+#if USE_TERMCAP
+	    values[dbdEnvOnce2] = cache_getenv("TERMCAP", dbdEnvOnce2);
+	    /* only use $TERMCAP if it is an absolute path */
+	    if (values[dbdEnvOnce2] != 0
+		&& *values[dbdEnvOnce2] != '/') {
+		values[dbdEnvOnce2] = 0;
 	    }
-	    break;
-	case dbdCfgList2:
-	    if ((result = NEXT_DBD(TERMPATH, offset)) != 0)
-		next = *state;
-	    break;
+	    values[dbdEnvList2] = cache_getenv("TERMPATH", dbdEnvList2);
 #endif /* USE_TERMCAP */
-	case dbdLAST:
-	    break;
 	}
-	if (*state != next) {
-	    *state = next;
-	    *offset = 0;
-	    _nc_last_db();
+
+	for (j = 0; j < dbdLAST; ++j) {
+	    if (values[j] == 0)
+		values[j] = "";
+	    blobsize += 2 + strlen(values[j]);
 	}
-	if (result != 0) {
-	    return result;
+
+	my_blob = malloc(blobsize);
+	if (my_blob != 0) {
+	    *my_blob = '\0';
+	    for (j = 0; j < dbdLAST; ++j) {
+		add_to_blob(values[j], blobsize);
+	    }
+
+	    /* Now, build an array which will be pointers to the distinct
+	     * strings in the blob.
+	     */
+	    blobsize = 2;
+	    for (j = 0; my_blob[j] != '\0'; ++j) {
+		if (my_blob[j] == NCURSES_PATHSEP)
+		    ++blobsize;
+	    }
+	    my_list = typeCalloc(char *, blobsize);
+	    my_stat = typeCalloc(struct stat, blobsize);
+	    if (my_list != 0 && my_stat != 0) {
+		k = 0;
+		my_list[k++] = my_blob;
+		for (j = 0; my_blob[j] != '\0'; ++j) {
+		    if (my_blob[j] == NCURSES_PATHSEP) {
+			my_blob[j] = '\0';
+			my_list[k++] = &my_blob[j + 1];
+		    }
+		}
+
+		/*
+		 * Eliminate duplicates from the list.
+		 */
+		for (j = 0; my_list[j] != 0; ++j) {
+#ifdef TERMINFO
+		    if (*my_list[j] == '\0')
+			my_list[j] = strdup(TERMINFO);
+#endif
+		    for (k = 0; k < j; ++k) {
+			if (!strcmp(my_list[j], my_list[k])) {
+			    k = j - 1;
+			    while ((my_list[j] = my_list[j + 1]) != 0) {
+				++j;
+			    }
+			    j = k;
+			    break;
+			}
+		    }
+		}
+
+		/*
+		 * Eliminate non-existent databases, and those that happen to
+		 * be symlinked to another location.
+		 */
+		for (j = 0; my_list[j] != 0; ++j) {
+		    bool found = check_existence(my_list[j], &my_stat[j]);
+#if HAVE_LINK
+		    if (found) {
+			for (k = 0; k < j; ++k) {
+			    if (my_stat[j].st_dev == my_stat[k].st_dev
+				&& my_stat[j].st_ino == my_stat[k].st_ino) {
+				found = FALSE;
+				break;
+			    }
+			}
+		    }
+#endif
+		    if (!found) {
+			k = j;
+			while ((my_list[k] = my_list[k + 1]) != 0) {
+			    ++k;
+			}
+			--j;
+		    }
+		}
+		my_size = j;
+		my_time = time((time_t *) 0);
+	    } else {
+		FreeAndNull(my_blob);
+	    }
+	    free(my_stat);
 	}
     }
-    return 0;
 }
 
-NCURSES_EXPORT(void)
-_nc_first_db(DBDIRS * state, int *offset)
+#if NO_LEAKS
+void
+_nc_db_iterator_leaks(void)
 {
-    *state = dbdTIC;
-    *offset = 0;
+    DBDIRS which;
+
+    if (my_blob != 0)
+	FreeAndNull(my_blob);
+    if (my_list != 0)
+	FreeAndNull(my_list);
+    for (which = 0; (int) which < dbdLAST; ++which) {
+	my_vars[which].name = 0;
+	FreeIfNeeded(my_vars[which].value);
+	my_vars[which].value = 0;
+    }
 }
+#endif
Index: ncurses/tinfo/doalloc.c
Prereq:  1.8 
--- ncurses-5.9/ncurses/tinfo/doalloc.c	2002-08-31 21:48:11.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/tinfo/doalloc.c	2012-11-03 19:27:41.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998,2000 Free Software Foundation, Inc.                   *
+ * Copyright (c) 1998-2000,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -39,7 +39,7 @@
 
 #include <curses.priv.h>
 
-MODULE_ID("$Id: doalloc.c,v 1.8 2002/08/31 21:48:11 Philippe.Blain Exp $")
+MODULE_ID("$Id: doalloc.c,v 1.11 2012/11/03 19:27:41 tom Exp $")
 
 NCURSES_EXPORT(void *)
 _nc_doalloc(void *oldp, size_t amount)
@@ -56,20 +56,3 @@
     }
     return newp;
 }
-
-#if !HAVE_STRDUP
-NCURSES_EXPORT(char *)
-_nc_strdup(const char *src)
-{
-    char *dst;
-    if (src != 0) {
-	dst = typeMalloc(char, strlen(src) + 1);
-	if (dst != 0) {
-	    (void) strcpy(dst, src);
-	}
-    } else {
-	dst = 0;
-    }
-    return dst;
-}
-#endif
Index: ncurses/tinfo/entries.c
Prereq:  1.17 
--- ncurses-5.9/ncurses/tinfo/entries.c	2010-01-23 17:57:43.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/tinfo/entries.c	2012-05-05 20:33:44.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 2006-2009,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 2006-2011,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -37,7 +37,7 @@
 
 #include <tic.h>
 
-MODULE_ID("$Id: entries.c,v 1.17 2010/01/23 17:57:43 tom Exp $")
+MODULE_ID("$Id: entries.c,v 1.21 2012/05/05 20:33:44 tom Exp $")
 
 /****************************************************************************
  *
@@ -96,6 +96,9 @@
 	    if (last != 0) {
 		last->next = ep->next;
 	    }
+	    if (ep->next != 0) {
+		ep->next->last = last;
+	    }
 	    if (ep == _nc_head) {
 		_nc_head = ep->next;
 	    }
@@ -128,19 +131,21 @@
     _nc_free_entries(_nc_head);
     _nc_get_type(0);
     _nc_first_name(0);
+    _nc_db_iterator_leaks();
     _nc_keyname_leaks();
 #if BROKEN_LINKER || USE_REENTRANT
     _nc_names_leaks();
     _nc_codes_leaks();
     FreeIfNeeded(_nc_prescreen.real_acs_map);
 #endif
+    _nc_comp_error_leaks();
 
     if ((s = _nc_home_terminfo()) != 0)
 	free(s);
 
 #ifdef TRACE
     trace(0);
-    _nc_trace_buf(-1, 0);
+    _nc_trace_buf(-1, (size_t) 0);
 #endif
 
 #endif /* NO_LEAKS */
Index: ncurses/tinfo/getenv_num.c
Prereq:  1.3 
--- ncurses-5.9/ncurses/tinfo/getenv_num.c	2000-12-10 02:55:07.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/tinfo/getenv_num.c	2012-07-14 21:17:19.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998,2000 Free Software Foundation, Inc.                   *
+ * Copyright (c) 1998-2000,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -36,7 +36,7 @@
 
 #include <curses.priv.h>
 
-MODULE_ID("$Id: getenv_num.c,v 1.3 2000/12/10 02:55:07 tom Exp $")
+MODULE_ID("$Id: getenv_num.c,v 1.4 2012/07/14 21:17:19 tom Exp $")
 
 NCURSES_EXPORT(int)
 _nc_getenv_num(const char *name)
@@ -54,3 +54,20 @@
 
     return (int) value;
 }
+
+NCURSES_EXPORT(void)
+_nc_setenv_num(const char *name, int value)
+{
+    if (name != 0 && value >= 0) {
+	char buffer[128];
+#if HAVE_SETENV
+	sprintf(buffer, "%d", value);
+	setenv(name, buffer, 1);
+#elif HAVE_PUTENV
+	char *s;
+	sprintf(buffer, "%s=%d", name, value);
+	if ((s = strdup(buffer)) != 0)
+	    putenv(s);
+#endif
+    }
+}
Index: ncurses/tinfo/hashed_db.c
Prereq:  1.14 
--- ncurses-5.9/ncurses/tinfo/hashed_db.c	2008-12-13 20:59:02.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/tinfo/hashed_db.c	2013-02-16 21:50:03.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 2006,2008 Free Software Foundation, Inc.                   *
+ * Copyright (c) 2006-2011,2013 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -36,12 +36,81 @@
 
 #if USE_HASHED_DB
 
-MODULE_ID("$Id: hashed_db.c,v 1.14 2008/12/13 20:59:02 tom Exp $")
+MODULE_ID("$Id: hashed_db.c,v 1.16 2013/02/16 21:50:03 tom Exp $")
 
 #if HASHED_DB_API >= 2
 static DBC *cursor;
 #endif
 
+typedef struct _myconn {
+    struct _myconn *next;
+    DB *db;
+    char *path;
+    bool modify;
+} MYCONN;
+
+static MYCONN *connections;
+
+static void
+cleanup(void)
+{
+    while (connections != 0) {
+	_nc_db_close(connections->db);
+    }
+}
+
+static DB *
+find_connection(const char *path, bool modify)
+{
+    DB *result = 0;
+    MYCONN *p;
+
+    for (p = connections; p != 0; p = p->next) {
+	if (!strcmp(p->path, path) && p->modify == modify) {
+	    result = p->db;
+	    break;
+	}
+    }
+
+    return result;
+}
+
+static void
+drop_connection(DB * db)
+{
+    MYCONN *p, *q;
+
+    for (p = connections, q = 0; p != 0; q = p, p = p->next) {
+	if (p->db == db) {
+	    if (q != 0)
+		q->next = p->next;
+	    else
+		connections = p->next;
+	    free(p->path);
+	    free(p);
+	    break;
+	}
+    }
+}
+
+static void
+make_connection(DB * db, const char *path, bool modify)
+{
+    MYCONN *p = typeCalloc(MYCONN, 1);
+
+    if (p != 0) {
+	p->db = db;
+	p->path = strdup(path);
+	p->modify = modify;
+	if (p->path != 0) {
+	    p->next = connections;
+	    connections = p;
+	} else {
+	    free(p);
+	}
+    }
+}
+
 /*
  * Open the database.
  */
@@ -51,50 +120,57 @@
     DB *result = 0;
     int code;
 
+    if (connections == 0)
+	atexit(cleanup);
+
+    if ((result = find_connection(path, modify)) == 0) {
+
 #if HASHED_DB_API >= 4
-    db_create(&result, NULL, 0);
-    if ((code = result->open(result,
-			     NULL,
-			     path,
-			     NULL,
-			     DB_HASH,
-			     modify ? DB_CREATE : DB_RDONLY,
-			     0644)) != 0) {
-	result = 0;
-    }
+	db_create(&result, NULL, 0);
+	if ((code = result->open(result,
+				 NULL,
+				 path,
+				 NULL,
+				 DB_HASH,
+				 modify ? DB_CREATE : DB_RDONLY,
+				 0644)) != 0) {
+	    result = 0;
+	}
 #elif HASHED_DB_API >= 3
-    db_create(&result, NULL, 0);
-    if ((code = result->open(result,
-			     path,
-			     NULL,
-			     DB_HASH,
-			     modify ? DB_CREATE : DB_RDONLY,
-			     0644)) != 0) {
-	result = 0;
-    }
+	db_create(&result, NULL, 0);
+	if ((code = result->open(result,
+				 path,
+				 NULL,
+				 DB_HASH,
+				 modify ? DB_CREATE : DB_RDONLY,
+				 0644)) != 0) {
+	    result = 0;
+	}
 #elif HASHED_DB_API >= 2
-    if ((code = db_open(path,
-			DB_HASH,
-			modify ? DB_CREATE : DB_RDONLY,
-			0644,
-			(DB_ENV *) 0,
-			(DB_INFO *) 0,
-			&result)) != 0) {
-	result = 0;
-    }
+	if ((code = db_open(path,
+			    DB_HASH,
+			    modify ? DB_CREATE : DB_RDONLY,
+			    0644,
+			    (DB_ENV *) 0,
+			    (DB_INFO *) 0,
+			    &result)) != 0) {
+	    result = 0;
+	}
 #else
-    if ((result = dbopen(path,
-			 modify ? (O_CREAT | O_RDWR) : O_RDONLY,
-			 0644,
-			 DB_HASH,
-			 NULL)) == 0) {
-	code = errno;
-    }
+	if ((result = dbopen(path,
+			     modify ? (O_CREAT | O_RDWR) : O_RDONLY,
+			     0644,
+			     DB_HASH,
+			     NULL)) == 0) {
+	    code = errno;
+	}
 #endif
-    if (result != 0) {
-	T(("opened %s", path));
-    } else {
-	T(("cannot open %s: %s", path, strerror(code)));
+	if (result != 0) {
+	    make_connection(result, path, modify);
+	    T(("opened %s", path));
+	} else {
+	    T(("cannot open %s: %s", path, strerror(code)));
+	}
     }
     return result;
 }
@@ -107,6 +183,7 @@
 {
     int result;
 
+    drop_connection(db);
 #if HASHED_DB_API >= 2
     result = db->close(db, 0);
 #else
Index: ncurses/tinfo/home_terminfo.c
Prereq:  1.12 
--- ncurses-5.9/ncurses/tinfo/home_terminfo.c	2010-12-25 23:43:58.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/tinfo/home_terminfo.c	2012-10-27 21:49:14.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2008,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -37,7 +37,7 @@
 #include <curses.priv.h>
 #include <tic.h>
 
-MODULE_ID("$Id: home_terminfo.c,v 1.12 2010/12/25 23:43:58 tom Exp $")
+MODULE_ID("$Id: home_terminfo.c,v 1.15 2012/10/27 21:49:14 tom Exp $")
 
 /* ncurses extension...fall back on user's private directory */
 
@@ -54,10 +54,8 @@
 	if (MyBuffer == 0) {
 	    if ((home = getenv("HOME")) != 0) {
 		size_t want = (strlen(home) + sizeof(PRIVATE_INFO));
-		MyBuffer = typeMalloc(char, want);
-		if (MyBuffer == 0)
-		    _nc_err_abort(MSG_NO_MEMORY);
-		(void) sprintf(MyBuffer, PRIVATE_INFO, home);
+		TYPE_MALLOC(char, want, MyBuffer);
+		_nc_SPRINTF(MyBuffer, _nc_SLIMIT(want) PRIVATE_INFO, home);
 	    }
 	}
 	result = MyBuffer;
Index: ncurses/tinfo/lib_acs.c
Prereq:  1.43 
--- ncurses-5.9/ncurses/tinfo/lib_acs.c	2010-12-25 23:00:45.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/tinfo/lib_acs.c	2013-01-12 17:24:42.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2010,2013 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -39,7 +39,7 @@
 #define CUR SP_TERMTYPE
 #endif
 
-MODULE_ID("$Id: lib_acs.c,v 1.43 2010/12/25 23:00:45 tom Exp $")
+MODULE_ID("$Id: lib_acs.c,v 1.44 2013/01/12 17:24:42 tom Exp $")
 
 #if BROKEN_LINKER || USE_REENTRANT
 #define MyBuffer _nc_prescreen.real_acs_map
@@ -169,8 +169,7 @@
     CallDriver_2(SP_PARM, initacs, real_map, fake_map);
 #else
     if (ena_acs != NULL) {
-	TPUTS_TRACE("ena_acs");
-	putp(ena_acs);
+	NCURSES_PUTP2("ena_acs", ena_acs);
     }
 #if NCURSES_EXT_FUNCS
     /*
Index: ncurses/tinfo/lib_cur_term.c
Prereq:  1.30 
--- ncurses-5.9/ncurses/tinfo/lib_cur_term.c	2010-12-19 01:38:45.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/tinfo/lib_cur_term.c	2012-11-18 02:12:43.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -39,7 +39,7 @@
 #include <curses.priv.h>
 #include <termcap.h>		/* ospeed */
 
-MODULE_ID("$Id: lib_cur_term.c,v 1.30 2010/12/19 01:38:45 tom Exp $")
+MODULE_ID("$Id: lib_cur_term.c,v 1.31 2012/11/18 02:12:43 tom Exp $")
 
 #undef CUR
 #define CUR termp->type.
@@ -148,8 +148,9 @@
 
 	FreeIfNeeded(termp->_termname);
 #if USE_HOME_TERMINFO
-	if (_nc_globals.home_terminfo != 0)
+	if (_nc_globals.home_terminfo != 0) {
 	    FreeAndNull(_nc_globals.home_terminfo);
+	}
 #endif
 #ifdef USE_TERM_DRIVER
 	if (TCB->drv)
Index: ncurses/tinfo/lib_data.c
Prereq:  1.61 
--- ncurses-5.9/ncurses/tinfo/lib_data.c	2010-05-15 22:06:56.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/tinfo/lib_data.c	2012-08-25 18:38:43.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -42,7 +42,7 @@
 
 #include <curses.priv.h>
 
-MODULE_ID("$Id: lib_data.c,v 1.61 2010/05/15 22:06:56 tom Exp $")
+MODULE_ID("$Id: lib_data.c,v 1.65 2012/08/25 18:38:43 tom Exp $")
 
 /*
  * OS/2's native linker complains if we don't initialize public data when
@@ -114,6 +114,7 @@
 #define TGETENT_0s { TGETENT_0, TGETENT_0, TGETENT_0, TGETENT_0 }
 
 NCURSES_EXPORT_VAR(NCURSES_GLOBALS) _nc_globals = {
+    0,				/* have_sigtstp */
     0,				/* have_sigwinch */
     0,				/* cleanup_nested */
 
@@ -125,7 +126,7 @@
 
     FALSE,			/* have_tic_directory */
     FALSE,			/* keep_tic_directory */
-    TERMINFO,			/* tic_directory */
+    0,				/* tic_directory */
 
     NULL,			/* dbi_list */
     0,				/* dbi_size */
@@ -142,6 +143,12 @@
     0,				/* tgetent_index */
     0,				/* tgetent_sequence */
 
+    0,				/* dbd_blob */
+    0,				/* dbd_list */
+    0,				/* dbd_size */
+    0,				/* dbd_time */
+    { { 0, 0 } },		/* dbd_vars */
+
 #ifndef USE_SP_WINDOWLIST
     0,				/* _nc_windowlist */
 #endif
@@ -249,6 +256,7 @@
     NULL,			/* _tputs_trace */
 #endif
 #endif
+    FALSE,			/* use_tioctl */
 };
 /* *INDENT-ON* */
 
Index: ncurses/tinfo/lib_napms.c
Prereq:  1.20 
--- ncurses-5.9/ncurses/tinfo/lib_napms.c	2009-11-07 20:37:30.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/tinfo/lib_napms.c	2012-06-30 22:08:24.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2008,2009 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -51,17 +51,21 @@
 #endif
 #endif
 
-MODULE_ID("$Id: lib_napms.c,v 1.20 2009/11/07 20:37:30 tom Exp $")
+MODULE_ID("$Id: lib_napms.c,v 1.23 2012/06/30 22:08:24 tom Exp $")
 
 NCURSES_EXPORT(int)
 NCURSES_SP_NAME(napms) (NCURSES_SP_DCLx int ms)
 {
-    (void) SP_PARM;
     T((T_CALLED("napms(%d)"), ms));
 
 #ifdef USE_TERM_DRIVER
-    CallDriver_1(SP_PARM, nap, ms);
+    if (HasTerminal(SP_PARM)) {
+	CallDriver_1(SP_PARM, nap, ms);
+    }
 #else /* !USE_TERM_DRIVER */
+#if NCURSES_SP_FUNCS
+    (void) sp;
+#endif
 #if HAVE_NANOSLEEP
     {
 	struct timespec request, remaining;
Index: ncurses/tinfo/lib_options.c
Prereq:  1.71 
--- ncurses-5.9/ncurses/tinfo/lib_options.c	2009-10-24 21:56:15.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/tinfo/lib_options.c	2013-01-12 16:44:17.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2008,2009 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2011,2013 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -46,7 +46,7 @@
 #define CUR SP_TERMTYPE
 #endif
 
-MODULE_ID("$Id: lib_options.c,v 1.71 2009/10/24 21:56:15 tom Exp $")
+MODULE_ID("$Id: lib_options.c,v 1.74 2013/01/12 16:44:17 tom Exp $")
 
 NCURSES_EXPORT(int)
 idlok(WINDOW *win, bool flag)
@@ -165,16 +165,16 @@
 #ifdef USE_TERM_DRIVER
 	if (IsTermInfo(sp)) {
 	    if (flag) {
-		NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx "meta_on", meta_on);
+		NCURSES_PUTP2("meta_on", meta_on);
 	    } else {
-		NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx "meta_off", meta_off);
+		NCURSES_PUTP2("meta_off", meta_off);
 	    }
 	}
 #else
 	if (flag) {
-	    NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx "meta_on", meta_on);
+	    NCURSES_PUTP2("meta_on", meta_on);
 	} else {
-	    NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx "meta_off", meta_off);
+	    NCURSES_PUTP2("meta_off", meta_off);
 	}
 #endif
 	result = OK;
@@ -199,19 +199,16 @@
 	    if (!bBuiltIn) {
 		switch (vis) {
 		case 2:
-		    code = NCURSES_SP_NAME(_nc_putp_flush) (NCURSES_SP_ARGx
-							    "cursor_visible",
-							    cursor_visible);
+		    code = NCURSES_PUTP2_FLUSH("cursor_visible",
+					       cursor_visible);
 		    break;
 		case 1:
-		    code = NCURSES_SP_NAME(_nc_putp_flush) (NCURSES_SP_ARGx
-							    "cursor_normal",
-							    cursor_normal);
+		    code = NCURSES_PUTP2_FLUSH("cursor_normal",
+					       cursor_normal);
 		    break;
 		case 0:
-		    code = NCURSES_SP_NAME(_nc_putp_flush) (NCURSES_SP_ARGx
-							    "cursor_invisible",
-							    cursor_invisible);
+		    code = NCURSES_PUTP2_FLUSH("cursor_invisible",
+					       cursor_invisible);
 		    break;
 		}
 	    } else
@@ -301,7 +298,7 @@
 NCURSES_SP_NAME(_nc_putp_flush) (NCURSES_SP_DCLx
 				 const char *name, const char *value)
 {
-    int rc = NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx name, value);
+    int rc = NCURSES_PUTP2(name, value);
     if (rc != ERR) {
 	_nc_flush();
     }
@@ -324,7 +321,7 @@
  * the terminal state _before_ switching modes.
  */
 NCURSES_EXPORT(int)
-_nc_keypad(SCREEN *sp, bool flag)
+_nc_keypad(SCREEN *sp, int flag)
 {
     int rc = ERR;
 
@@ -354,13 +351,9 @@
 		sp->_keypad_on = flag;
 #else
 	    if (flag) {
-		(void) NCURSES_SP_NAME(_nc_putp_flush) (NCURSES_SP_ARGx
-							"keypad_xmit",
-							keypad_xmit);
+		(void) NCURSES_PUTP2_FLUSH("keypad_xmit", keypad_xmit);
 	    } else if (!flag && keypad_local) {
-		(void) NCURSES_SP_NAME(_nc_putp_flush) (NCURSES_SP_ARGx
-							"keypad_local",
-							keypad_local);
+		(void) NCURSES_PUTP2_FLUSH("keypad_local", keypad_local);
 	    }
 
 	    if (flag && !sp->_tried) {
Index: ncurses/tinfo/lib_print.c
Prereq:  1.20 
--- ncurses-5.9/ncurses/tinfo/lib_print.c	2010-06-05 22:18:35.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/tinfo/lib_print.c	2012-02-22 22:34:31.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -39,7 +39,7 @@
 #define CUR SP_TERMTYPE
 #endif
 
-MODULE_ID("$Id: lib_print.c,v 1.20 2010/06/05 22:18:35 tom Exp $")
+MODULE_ID("$Id: lib_print.c,v 1.23 2012/02/22 22:34:31 tom Exp $")
 
 NCURSES_EXPORT(int)
 NCURSES_SP_NAME(mcprint) (NCURSES_SP_DCLx char *data, int len)
@@ -76,10 +76,10 @@
 	return (ERR);
     }
 
-    (void) strcpy(mybuf, switchon);
-    memcpy(mybuf + onsize, data, (unsigned) len);
+    _nc_STRCPY(mybuf, switchon, need);
+    memcpy(mybuf + onsize, data, (size_t) len);
     if (offsize)
-	(void) strcpy(mybuf + onsize + len, prtr_off);
+	_nc_STRCPY(mybuf + onsize + len, prtr_off, need);
 
     /*
      * We're relying on the atomicity of UNIX writes here.  The
Index: ncurses/tinfo/lib_raw.c
Prereq:  1.19 
--- ncurses-5.9/ncurses/tinfo/lib_raw.c	2010-04-24 23:49:12.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/tinfo/lib_raw.c	2012-01-21 19:21:29.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -49,11 +49,7 @@
 
 #include <curses.priv.h>
 
-MODULE_ID("$Id: lib_raw.c,v 1.19 2010/04/24 23:49:12 tom Exp $")
-
-#if SVR4_TERMIO && !defined(_POSIX_SOURCE)
-#define _POSIX_SOURCE
-#endif
+MODULE_ID("$Id: lib_raw.c,v 1.21 2012/01/21 19:21:29 KO.Myung-Hun Exp $")
 
 #if HAVE_SYS_TERMIO_H
 #include <sys/termio.h>		/* needed for ISC */
@@ -66,6 +62,11 @@
 #define _nc_setmode(mode)	/* nothing */
 #endif
 
+#if USE_KLIBC_KBD
+#define INCL_KBD
+#include <os2.h>
+#endif
+
 #define COOKED_INPUT	(IXON|BRKINT|PARMRK)
 
 #ifdef TRACE
@@ -100,6 +101,17 @@
 #endif
 	result = NCURSES_SP_NAME(_nc_set_tty_mode) (NCURSES_SP_ARGx &buf);
 	if (result == OK) {
+#if USE_KLIBC_KBD
+	    KBDINFO kbdinfo;
+
+	    kbdinfo.cb = sizeof(kbdinfo);
+	    KbdGetStatus(&kbdinfo, 0);
+
+	    kbdinfo.cb = sizeof(kbdinfo);
+	    kbdinfo.fsMask &= ~KEYBOARD_ASCII_MODE;
+	    kbdinfo.fsMask |= KEYBOARD_BINARY_MODE;
+	    KbdSetStatus(&kbdinfo, 0);
+#endif
 	    SP_PARM->_raw = TRUE;
 	    SP_PARM->_cbreak = 1;
 	    termp->Nttyb = buf;
@@ -218,6 +230,17 @@
 #endif
 	result = NCURSES_SP_NAME(_nc_set_tty_mode) (NCURSES_SP_ARGx &buf);
 	if (result == OK) {
+#if USE_KLIBC_KBD
+	    KBDINFO kbdinfo;
+
+	    kbdinfo.cb = sizeof(kbdinfo);
+	    KbdGetStatus(&kbdinfo, 0);
+
+	    kbdinfo.cb = sizeof(kbdinfo);
+	    kbdinfo.fsMask &= ~KEYBOARD_BINARY_MODE;
+	    kbdinfo.fsMask |= KEYBOARD_ASCII_MODE;
+	    KbdSetStatus(&kbdinfo, 0);
+#endif
 	    SP_PARM->_raw = FALSE;
 	    SP_PARM->_cbreak = 0;
 	    termp->Nttyb = buf;
Index: ncurses/tinfo/lib_setup.c
Prereq:  1.135 
--- ncurses-5.9/ncurses/tinfo/lib_setup.c	2011-02-06 01:04:21.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/tinfo/lib_setup.c	2012-12-15 19:04:54.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2010,2011 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -37,21 +37,18 @@
  * Terminal setup routines common to termcap and terminfo:
  *
  *		use_env(bool)
+ *		use_tioctl(bool)
  *		setupterm(char *, int, int *)
  */
 
 #include <curses.priv.h>
 #include <tic.h>		/* for MAX_NAME_SIZE */
 
-#if SVR4_TERMIO && !defined(_POSIX_SOURCE)
-#define _POSIX_SOURCE
-#endif
-
 #if HAVE_LOCALE_H
 #include <locale.h>
 #endif
 
-MODULE_ID("$Id: lib_setup.c,v 1.135 2011/02/06 01:04:21 tom Exp $")
+MODULE_ID("$Id: lib_setup.c,v 1.155 2012/12/15 19:04:54 tom Exp $")
 
 /****************************************************************************
  *
@@ -225,6 +222,7 @@
 {
     T((T_CALLED("use_env(%p,%d)"), (void *) SP_PARM, (int) f));
 #if NCURSES_SP_FUNCS
+    START_TRACE();
     if (IsPreScreen(SP_PARM)) {
 	SP_PARM->_use_env = f;
     }
@@ -234,14 +232,39 @@
     returnVoid;
 }
 
+NCURSES_EXPORT(void)
+NCURSES_SP_NAME(use_tioctl) (NCURSES_SP_DCLx bool f)
+{
+    T((T_CALLED("use_tioctl(%p,%d)"), (void *) SP_PARM, (int) f));
+#if NCURSES_SP_FUNCS
+    START_TRACE();
+    if (IsPreScreen(SP_PARM)) {
+	SP_PARM->_use_tioctl = f;
+    }
+#else
+    _nc_prescreen.use_tioctl = f;
+#endif
+    returnVoid;
+}
+
 #if NCURSES_SP_FUNCS
 NCURSES_EXPORT(void)
 use_env(bool f)
 {
     T((T_CALLED("use_env(%d)"), (int) f));
+    START_TRACE();
     _nc_prescreen.use_env = f;
     returnVoid;
 }
+
+NCURSES_EXPORT(void)
+use_tioctl(bool f)
+{
+    T((T_CALLED("use_tioctl(%d)"), (int) f));
+    START_TRACE();
+    _nc_prescreen.use_tioctl = f;
+    returnVoid;
+}
 #endif
 
 NCURSES_EXPORT(void)
@@ -281,7 +304,7 @@
     *linep = (int) lines;
     *colp = (int) columns;
 
-    if (_nc_prescreen.use_env) {
+    if (_nc_prescreen.use_env || _nc_prescreen.use_tioctl) {
 	int value;
 
 #ifdef __EMX__
@@ -289,7 +312,9 @@
 	    int screendata[2];
 	    _scrsize(screendata);
 	    *colp = screendata[0];
-	    *linep = screendata[1];
+	    *linep = ((sp != 0 && sp->_filtered)
+		      ? 1
+		      : screendata[1]);
 	    T(("EMX screen size: environment LINES = %d COLUMNS = %d",
 	       *linep, *colp));
 	}
@@ -315,19 +340,33 @@
 	}
 #endif /* HAVE_SIZECHANGE */
 
-	/*
-	 * Finally, look for environment variables.
-	 *
-	 * Solaris lets users override either dimension with an environment
-	 * variable.
-	 */
-	if ((value = _nc_getenv_num("LINES")) > 0) {
-	    *linep = value;
-	    T(("screen size: environment LINES = %d", *linep));
-	}
-	if ((value = _nc_getenv_num("COLUMNS")) > 0) {
-	    *colp = value;
-	    T(("screen size: environment COLUMNS = %d", *colp));
+	if (_nc_prescreen.use_env) {
+	    if (_nc_prescreen.use_tioctl) {
+		/*
+		 * If environment variables are used, update them.
+		 */
+		if ((sp == 0 || !sp->_filtered) && _nc_getenv_num("LINES") > 0) {
+		    _nc_setenv_num("LINES", *linep);
+		}
+		if (_nc_getenv_num("COLUMNS") > 0) {
+		    _nc_setenv_num("COLUMNS", *colp);
+		}
+	    }
+
+	    /*
+	     * Finally, look for environment variables.
+	     *
+	     * Solaris lets users override either dimension with an environment
+	     * variable.
+	     */
+	    if ((value = _nc_getenv_num("LINES")) > 0) {
+		*linep = value;
+		T(("screen size: environment LINES = %d", *linep));
+	    }
+	    if ((value = _nc_getenv_num("COLUMNS")) > 0) {
+		*colp = value;
+		T(("screen size: environment COLUMNS = %d", *colp));
+	    }
 	}
 
 	/* if we can't get dynamic info about the size, use static */
@@ -399,10 +438,12 @@
      * We're doing it this way because those functions belong to the upper
      * ncurses library, while this resides in the lower terminfo library.
      */
-    if (sp != 0
-	&& sp->_resize != 0) {
-	if ((new_lines != old_lines) || (new_cols != old_cols))
+    if (sp != 0 && sp->_resize != 0) {
+	if ((new_lines != old_lines) || (new_cols != old_cols)) {
 	    sp->_resize(NCURSES_SP_ARGx new_lines, new_cols);
+	} else if (sp->_sig_winch && (sp->_ungetch != 0)) {
+	    sp->_ungetch(SP_PARM, KEY_RESIZE);	/* so application can know this */
+	}
 	sp->_sig_winch = FALSE;
     }
 }
@@ -414,22 +455,6 @@
  *
  ****************************************************************************/
 
-#define ret_error(code, fmt, arg)	if (errret) {\
-					    *errret = code;\
-					    returnCode(ERR);\
-					} else {\
-					    fprintf(stderr, fmt, arg);\
-					    exit(EXIT_FAILURE);\
-					}
-
-#define ret_error0(code, msg)		if (errret) {\
-					    *errret = code;\
-					    returnCode(ERR);\
-					} else {\
-					    fprintf(stderr, msg);\
-					    exit(EXIT_FAILURE);\
-					}
-
 #if USE_DATABASE || USE_TERMCAP
 /*
  * Return 1 if entry found, 0 if not found, -1 if database not accessible,
@@ -467,7 +492,7 @@
 **	and substitute it in for the prototype given in 'command_character'.
 */
 void
-_nc_tinfo_cmdch(TERMINAL * termp, char proto)
+_nc_tinfo_cmdch(TERMINAL * termp, int proto)
 {
     unsigned i;
     char CC;
@@ -481,8 +506,8 @@
     if ((tmp = getenv("CC")) != 0 && strlen(tmp) == 1) {
 	CC = *tmp;
 	for_each_string(i, &(termp->type)) {
-	    for (tmp = termp->type.Strings[i]; *tmp; tmp++) {
-		if (*tmp == proto)
+	    for (tmp = termp->type.Strings[i]; tmp && *tmp; tmp++) {
+		if (UChar(*tmp) == proto)
 		    *tmp = CC;
 	    }
 	}
@@ -520,7 +545,9 @@
 _nc_unicode_locale(void)
 {
     int result = 0;
-#if HAVE_LANGINFO_CODESET
+#if defined(__MINGW32__) && USE_WIDEC_SUPPORT
+    result = 1;
+#elif HAVE_LANGINFO_CODESET
     char *env = nl_langinfo(CODESET);
     result = !strcmp(env, "UTF-8");
     T(("_nc_unicode_locale(%s) ->%d", env, result));
@@ -551,7 +578,7 @@
     int value;
     int result = 0;
 
-    if ((env = getenv(env_name)) != 0) {
+    if (getenv(env_name) != 0) {
 	result = _nc_getenv_num(env_name);
     } else if ((value = tigetnum("U8")) >= 0) {
 	result = value;		/* use extension feature */
@@ -578,7 +605,7 @@
 		 NCURSES_CONST char *tname,
 		 int Filedes,
 		 int *errret,
-		 bool reuse)
+		 int reuse)
 {
 #ifdef USE_TERM_DRIVER
     TERMINAL_CONTROL_BLOCK *TCB = 0;
@@ -608,7 +635,11 @@
     if (tname == 0) {
 	tname = getenv("TERM");
 	if (tname == 0 || *tname == '\0') {
+#ifdef USE_TERM_DRIVER
+	    tname = "unknown";
+#else
 	    ret_error0(TGETENT_ERR, "TERM environment variable not set.\n");
+#endif
 	}
     }
 
@@ -651,6 +682,9 @@
 	&& _nc_name_match(termp->type.term_names, tname, "|")) {
 	T(("reusing existing terminal information and mode-settings"));
 	code = OK;
+#ifdef USE_TERM_DRIVER
+	TCB = (TERMINAL_CONTROL_BLOCK *) termp;
+#endif
     } else {
 #ifdef USE_TERM_DRIVER
 	termp = (TERMINAL *) typeCalloc(TERMINAL_CONTROL_BLOCK, 1);
@@ -684,7 +718,7 @@
 	    const TERMTYPE *fallback = _nc_fallback(tname);
 
 	    if (fallback) {
-		termp->type = *fallback;
+		_nc_copy_termtype(&(termp->type), fallback);
 		status = TGETENT_YES;
 	    }
 	}
@@ -694,11 +728,11 @@
 	    if (status == TGETENT_ERR) {
 		ret_error0(status, "terminals database is inaccessible\n");
 	    } else if (status == TGETENT_NO) {
-		ret_error(status, "'%s': unknown terminal type.\n", tname);
+		ret_error1(status, "unknown terminal type.\n", tname);
 	    }
 	}
 #if !USE_REENTRANT
-	strncpy(ttytype, termp->type.term_names, NAMESIZE - 1);
+	strncpy(ttytype, termp->type.term_names, (size_t) (NAMESIZE - 1));
 	ttytype[NAMESIZE - 1] = '\0';
 #endif
 
@@ -708,7 +742,7 @@
 	set_curterm(termp);
 
 	if (command_character)
-	    _nc_tinfo_cmdch(termp, *command_character);
+	    _nc_tinfo_cmdch(termp, UChar(*command_character));
 
 	/*
 	 * If an application calls setupterm() rather than initscr() or
@@ -742,10 +776,22 @@
 
 #ifndef USE_TERM_DRIVER
     if (generic_type) {
-	ret_error(TGETENT_NO, "'%s': I need something more specific.\n", tname);
-    }
-    if (hard_copy) {
-	ret_error(TGETENT_YES, "'%s': I can't handle hardcopy terminals.\n", tname);
+	/*
+	 * BSD 4.3's termcap contains mis-typed "gn" for wy99.  Do a sanity
+	 * check before giving up.
+	 */
+	if ((VALID_STRING(cursor_address)
+	     || (VALID_STRING(cursor_down) && VALID_STRING(cursor_home)))
+	    && VALID_STRING(clear_screen)) {
+	    free(termp);
+	    ret_error1(TGETENT_YES, "terminal is not really generic.\n", tname);
+	} else {
+	    free(termp);
+	    ret_error1(TGETENT_NO, "I need something more specific.\n", tname);
+	}
+    } else if (hard_copy) {
+	free(termp);
+	ret_error1(TGETENT_YES, "I can't handle hardcopy terminals.\n", tname);
     }
 #endif
     returnCode(code);
@@ -798,10 +844,10 @@
 _nc_setupterm(NCURSES_CONST char *tname,
 	      int Filedes,
 	      int *errret,
-	      bool reuse)
+	      int reuse)
 {
     int res;
-    TERMINAL *termp;
+    TERMINAL *termp = 0;
     res = TINFO_SETUP_TERM(&termp, tname, Filedes, errret, reuse);
     if (ERR != res)
 	NCURSES_SP_NAME(set_curterm) (CURRENT_SCREEN_PRE, termp);
Index: ncurses/tinfo/lib_termcap.c
Prereq:  1.73 
--- ncurses-5.9/ncurses/tinfo/lib_termcap.c	2010-12-25 19:27:12.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/tinfo/lib_termcap.c	2013-01-19 18:20:05.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -48,7 +48,7 @@
 #define CUR SP_TERMTYPE
 #endif
 
-MODULE_ID("$Id: lib_termcap.c,v 1.73 2010/12/25 19:27:12 tom Exp $")
+MODULE_ID("$Id: lib_termcap.c,v 1.79 2013/01/19 18:20:05 tom Exp $")
 
 NCURSES_EXPORT_VAR(char *) UP = 0;
 NCURSES_EXPORT_VAR(char *) BC = 0;
@@ -63,6 +63,15 @@
 #define LAST_USE MyCache[CacheInx].last_used
 #define LAST_SEQ MyCache[CacheInx].sequence
 
+/*
+ * Termcap names are matched only using the first two bytes.
+ * Ignore any extended names longer than two bytes, to avoid problems
+ * with legacy code which passes in parameters whose use is long forgotten.
+ */
+#define ValidCap(cap) (((cap)[0] != '\0') && ((cap)[1] != '\0'))
+#define SameCap(a,b)  (((a)[0] == (b)[0]) && ((a)[1] == (b)[1]))
+#define ValidExt(ext) (ValidCap(ext) && (ext)[2] == '\0')
+
 /***************************************************************************
  *
  * tgetent(bufp, term)
@@ -97,7 +106,7 @@
 #ifdef USE_TERM_DRIVER
     if (termp == 0 ||
 	!((TERMINAL_CONTROL_BLOCK *) termp)->drv->isTerminfo)
-	return (rc);
+	returnCode(rc);
 #endif
 
     /*
@@ -202,11 +211,13 @@
 static bool
 same_tcname(const char *a, const char *b)
 {
-    fprintf(stderr, "compare(%s,%s)\n", a, b);
-    return !strncmp(a, b, 2);
+    bool code = SameCap(a, b);
+    fprintf(stderr, "compare(%s,%s) %s\n", a, b, code ? "same" : "diff");
+    return code;
 }
+
 #else
-#define same_tcname(a,b) !strncmp(a,b,2)
+#define same_tcname(a,b) SameCap(a,b)
 #endif
 
 /***************************************************************************
@@ -225,7 +236,7 @@
     int i, j;
 
     T((T_CALLED("tgetflag(%p, %s)"), (void *) SP_PARM, id));
-    if (HasTInfoTerminal(SP_PARM)) {
+    if (HasTInfoTerminal(SP_PARM) && ValidCap(id)) {
 	TERMTYPE *tp = &(TerminalOf(SP_PARM)->type);
 	struct name_table_entry const *entry_ptr;
 
@@ -238,7 +249,7 @@
 	    j = -1;
 	    for_each_ext_boolean(i, tp) {
 		const char *capname = ExtBoolname(tp, i, boolcodes);
-		if (same_tcname(id, capname)) {
+		if (same_tcname(id, capname) && ValidExt(capname)) {
 		    j = i;
 		    break;
 		}
@@ -277,7 +288,7 @@
     int i, j;
 
     T((T_CALLED("tgetnum(%p, %s)"), (void *) SP_PARM, id));
-    if (HasTInfoTerminal(SP_PARM)) {
+    if (HasTInfoTerminal(SP_PARM) && ValidCap(id)) {
 	TERMTYPE *tp = &(TerminalOf(SP_PARM)->type);
 	struct name_table_entry const *entry_ptr;
 
@@ -290,7 +301,7 @@
 	    j = -1;
 	    for_each_ext_number(i, tp) {
 		const char *capname = ExtNumname(tp, i, numcodes);
-		if (same_tcname(id, capname)) {
+		if (same_tcname(id, capname) && ValidExt(capname)) {
 		    j = i;
 		    break;
 		}
@@ -329,7 +340,7 @@
     int i, j;
 
     T((T_CALLED("tgetstr(%s,%p)"), id, (void *) area));
-    if (HasTInfoTerminal(SP_PARM)) {
+    if (HasTInfoTerminal(SP_PARM) && ValidCap(id)) {
 	TERMTYPE *tp = &(TerminalOf(SP_PARM)->type);
 	struct name_table_entry const *entry_ptr;
 
@@ -342,7 +353,7 @@
 	    j = -1;
 	    for_each_ext_string(i, tp) {
 		const char *capname = ExtStrname(tp, i, strcodes);
-		if (same_tcname(id, capname)) {
+		if (same_tcname(id, capname) && ValidExt(capname)) {
 		    j = i;
 		    break;
 		}
@@ -351,7 +362,7 @@
 #endif
 	if (j >= 0) {
 	    result = tp->Strings[j];
-	    TR(TRACE_DATABASE, ("found match : %s", _nc_visbuf(result)));
+	    TR(TRACE_DATABASE, ("found match %d: %s", j, _nc_visbuf(result)));
 	    /* setupterm forces canceled strings to null */
 	    if (VALID_STRING(result)) {
 		if (result == exit_attribute_mode
@@ -361,7 +372,7 @@
 		}
 		if (area != 0
 		    && *area != 0) {
-		    (void) strcpy(*area, result);
+		    _nc_STRCPY(*area, result, 1024);
 		    result = *area;
 		    *area += strlen(*area) + 1;
 		}
Index: ncurses/tinfo/lib_tgoto.c
Prereq:  1.13 
--- ncurses-5.9/ncurses/tinfo/lib_tgoto.c	2008-08-16 19:29:32.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/tinfo/lib_tgoto.c	2012-02-24 02:08:08.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 2000-2006,2008 Free Software Foundation, Inc.              *
+ * Copyright (c) 2000-2008,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -35,7 +35,7 @@
 #include <ctype.h>
 #include <termcap.h>
 
-MODULE_ID("$Id: lib_tgoto.c,v 1.13 2008/08/16 19:29:32 tom Exp $")
+MODULE_ID("$Id: lib_tgoto.c,v 1.16 2012/02/24 02:08:08 tom Exp $")
 
 #if !PURE_TERMINFO
 static bool
@@ -159,7 +159,8 @@
 		break;
 	    }
 	    if (fmt != 0) {
-		sprintf(result + used, fmt, *value++);
+		_nc_SPRINTF(result + used, _nc_SLIMIT(length - used)
+			    fmt, *value++);
 		used += strlen(result + used);
 		fmt = 0;
 	    }
@@ -174,7 +175,7 @@
     }
     if (result != 0) {
 	if (need_BC) {
-	    strcpy(result + used, BC);
+	    _nc_STRCPY(result + used, BC, length - used);
 	    used += strlen(BC);
 	}
 	result[used] = '\0';
Index: ncurses/tinfo/lib_tparm.c
Prereq:  1.82 
--- ncurses-5.9/ncurses/tinfo/lib_tparm.c	2011-01-15 22:19:12.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/tinfo/lib_tparm.c	2013-01-26 17:07:05.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2010,2011 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -42,7 +42,7 @@
 #include <ctype.h>
 #include <tic.h>
 
-MODULE_ID("$Id: lib_tparm.c,v 1.82 2011/01/15 22:19:12 tom Exp $")
+MODULE_ID("$Id: lib_tparm.c,v 1.88 2013/01/26 17:07:05 tom Exp $")
 
 /*
  *	char *
@@ -128,9 +128,7 @@
     need += TPS(out_used);
     if (need > TPS(out_size)) {
 	TPS(out_size) = need * 2;
-	TPS(out_buff) = typeRealloc(char, TPS(out_size), TPS(out_buff));
-	if (TPS(out_buff) == 0)
-	    _nc_err_abort(MSG_NO_MEMORY);
+	TYPE_REALLOC(char, TPS(out_size), TPS(out_buff));
     }
 }
 
@@ -143,7 +141,9 @@
 
     get_space(s_len + 1);
 
-    (void) sprintf(TPS(out_buff) + TPS(out_used), fmt, s);
+    _nc_SPRINTF(TPS(out_buff) + TPS(out_used),
+		_nc_SLIMIT(TPS(out_size) - TPS(out_used))
+		fmt, s);
     TPS(out_used) += strlen(TPS(out_buff) + TPS(out_used));
 }
 
@@ -153,9 +153,11 @@
     if (len < 30)
 	len = 30;		/* actually log10(MAX_INT)+1 */
 
-    get_space((unsigned) len + 1);
+    get_space((size_t) len + 1);
 
-    (void) sprintf(TPS(out_buff) + TPS(out_used), fmt, number);
+    _nc_SPRINTF(TPS(out_buff) + TPS(out_used),
+		_nc_SLIMIT(TPS(out_size) - TPS(out_used))
+		fmt, number);
     TPS(out_used) += strlen(TPS(out_buff) + TPS(out_used));
 }
 
@@ -164,7 +166,7 @@
 {
     if (c == 0)
 	c = 0200;
-    get_space(1);
+    get_space((size_t) 1);
     TPS(out_buff)[TPS(out_used)++] = (char) c;
 }
 
@@ -450,7 +452,7 @@
 }
 
 static NCURSES_INLINE char *
-tparam_internal(bool use_TPARM_ARG, const char *string, va_list ap)
+tparam_internal(int use_TPARM_ARG, const char *string, va_list ap)
 {
     char *p_is_s[NUM_PARM];
     TPARM_ARG param[NUM_PARM];
@@ -522,7 +524,7 @@
     }
 #ifdef TRACE
     if (USE_TRACEF(TRACE_CALLS)) {
-	for (i = 0; i < popcount; i++) {
+	for (i = 0; i < num_args; i++) {
 	    if (p_is_s[i] != 0)
 		save_text(", %s", _nc_visbuf(p_is_s[i]), 0);
 	    else
@@ -559,7 +561,7 @@
 		break;
 
 	    case 'l':
-		save_number("%d", (int) strlen(spop()), 0);
+		npush((int) strlen(spop()));
 		break;
 
 	    case 's':
@@ -757,7 +759,7 @@
 	cp++;
     }				/* endwhile (*cp) */
 
-    get_space(1);
+    get_space((size_t) 1);
     TPS(out_buff)[TPS(out_used)] = '\0';
 
     T((T_RETURN("%s"), _nc_visbuf(TPS(out_buff))));
Index: ncurses/tinfo/lib_tputs.c
Prereq:  1.81 
--- ncurses-5.9/ncurses/tinfo/lib_tputs.c	2010-12-20 00:42:50.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/tinfo/lib_tputs.c	2013-01-12 20:57:32.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -51,7 +51,7 @@
 #include <termcap.h>		/* ospeed */
 #include <tic.h>
 
-MODULE_ID("$Id: lib_tputs.c,v 1.81 2010/12/20 00:42:50 tom Exp $")
+MODULE_ID("$Id: lib_tputs.c,v 1.93 2013/01/12 20:57:32 tom Exp $")
 
 NCURSES_EXPORT_VAR(char) PC = 0;              /* used by termcap library */
 NCURSES_EXPORT_VAR(NCURSES_OSPEED) ospeed = 0;        /* used by termcap library */
@@ -119,7 +119,17 @@
 NCURSES_EXPORT(void)
 NCURSES_SP_NAME(_nc_flush) (NCURSES_SP_DCL0)
 {
-    (void) fflush(NC_OUTPUT(SP_PARM));
+    if (SP_PARM != 0 && SP_PARM->_ofd >= 0) {
+	if (SP_PARM->out_inuse) {
+	    size_t amount = SP->out_inuse;
+	    /*
+	     * Help a little, if the write is interrupted, by first resetting
+	     * our amount.
+	     */
+	    SP->out_inuse = 0;
+	    IGNORE_RC(write(SP_PARM->_ofd, SP_PARM->out_buffer, amount));
+	}
+    }
 }
 
 #if NCURSES_SP_FUNCS
@@ -138,17 +148,23 @@
     COUNT_OUTCHARS(1);
 
     if (HasTInfoTerminal(SP_PARM)
-	&& SP_PARM != 0
-	&& SP_PARM->_cleanup) {
-	char tmp = (char) ch;
-	/*
-	 * POSIX says write() is safe in a signal handler, but the
-	 * buffered I/O is not.
-	 */
-	if (write(fileno(NC_OUTPUT(SP_PARM)), &tmp, 1) == -1)
-	    rc = ERR;
+	&& SP_PARM != 0) {
+	if (SP_PARM->out_buffer != 0) {
+	    if (SP_PARM->out_inuse + 1 >= SP_PARM->out_limit)
+		NCURSES_SP_NAME(_nc_flush) (NCURSES_SP_ARG);
+	    SP_PARM->out_buffer[SP_PARM->out_inuse++] = (char) ch;
+	} else {
+	    char tmp = (char) ch;
+	    /*
+	     * POSIX says write() is safe in a signal handler, but the
+	     * buffered I/O is not.
+	     */
+	    if (write(fileno(NC_OUTPUT(SP_PARM)), &tmp, (size_t) 1) == -1)
+		rc = ERR;
+	}
     } else {
-	if (putc(ch, NC_OUTPUT(SP_PARM)) == EOF)
+	char tmp = (char) ch;
+	if (write(fileno(stdout), &tmp, (size_t) 1) == -1)
 	    rc = ERR;
     }
     return rc;
@@ -162,13 +178,48 @@
 }
 #endif
 
+/*
+ * This is used for the putp special case.
+ */
+NCURSES_EXPORT(int)
+NCURSES_SP_NAME(_nc_putchar) (NCURSES_SP_DCLx int ch)
+{
+    (void) SP_PARM;
+    return putchar(ch);
+}
+
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(int)
+_nc_putchar(int ch)
+{
+    return putchar(ch);
+}
+#endif
+
+/*
+ * putp is special - per documentation it calls tputs with putchar as the
+ * parameter for outputting characters.  This means that it uses stdio, which
+ * is not signal-safe.  Applications call this entrypoint; we do not call it
+ * from within the library.
+ */
 NCURSES_EXPORT(int)
 NCURSES_SP_NAME(putp) (NCURSES_SP_DCLx const char *string)
 {
     return NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx
-				   string, 1, NCURSES_SP_NAME(_nc_outch));
+				   string, 1, NCURSES_SP_NAME(_nc_putchar));
 }
 
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(int)
+putp(const char *string)
+{
+    return NCURSES_SP_NAME(putp) (CURRENT_SCREEN, string);
+}
+#endif
+
+/*
+ * Use these entrypoints rather than "putp" within the library.
+ */
 NCURSES_EXPORT(int)
 NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_DCLx
 			   const char *name GCC_UNUSED,
@@ -178,19 +229,14 @@
 
     if (string != 0) {
 	TPUTS_TRACE(name);
-	rc = NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx string);
+	rc = NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx
+				     string, 1, NCURSES_SP_NAME(_nc_outch));
     }
     return rc;
 }
 
 #if NCURSES_SP_FUNCS
 NCURSES_EXPORT(int)
-putp(const char *string)
-{
-    return NCURSES_SP_NAME(putp) (CURRENT_SCREEN, string);
-}
-
-NCURSES_EXPORT(int)
 _nc_putp(const char *name, const char *string)
 {
     return NCURSES_SP_NAME(_nc_putp) (CURRENT_SCREEN, name, string);
@@ -216,9 +262,9 @@
 
     if (USE_TRACEF(TRACE_TPUTS)) {
 	if (outc == NCURSES_SP_NAME(_nc_outch))
-	    (void) strcpy(addrbuf, "_nc_outch");
+	    _nc_STRCPY(addrbuf, "_nc_outch", sizeof(addrbuf));
 	else
-	    (void) sprintf(addrbuf, "%p", outc);
+	    _nc_SPRINTF(addrbuf, _nc_SLIMIT(sizeof(addrbuf)) "%p", outc);
 	if (_nc_tputs_trace) {
 	    _tracef("tputs(%s = %s, %d, %s) called", _nc_tputs_trace,
 		    _nc_visbuf(string), affcnt, addrbuf);
Index: ncurses/tinfo/lib_ttyflags.c
Prereq:  1.27 
--- ncurses-5.9/ncurses/tinfo/lib_ttyflags.c	2010-12-25 23:43:58.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/tinfo/lib_ttyflags.c	2012-01-21 19:21:29.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -41,7 +41,7 @@
 #define CUR SP_TERMTYPE
 #endif
 
-MODULE_ID("$Id: lib_ttyflags.c,v 1.27 2010/12/25 23:43:58 tom Exp $")
+MODULE_ID("$Id: lib_ttyflags.c,v 1.28 2012/01/21 19:21:29 KO.Myung-Hun Exp $")
 
 NCURSES_EXPORT(int)
 NCURSES_SP_NAME(_nc_get_tty_mode) (NCURSES_SP_DCLx TTY * buf)
@@ -105,7 +105,11 @@
 	    result = CallDriver_2(SP_PARM, sgmode, TRUE, buf);
 #else
 	    for (;;) {
-		if (SET_TTY(termp->Filedes, buf) != 0) {
+		if ((SET_TTY(termp->Filedes, buf) != 0)
+#if USE_KLIBC_KBD
+		    && !isatty(termp->Filedes)
+#endif
+		    ) {
 		    if (errno == EINTR)
 			continue;
 		    if ((errno == ENOTTY) && (SP_PARM != 0))
Index: ncurses/tinfo/make_hash.c
Prereq:  1.3 
--- ncurses-5.9/ncurses/tinfo/make_hash.c	2010-05-22 18:02:50.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/tinfo/make_hash.c	2013-02-16 21:27:50.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -44,7 +44,7 @@
 
 #include <ctype.h>
 
-MODULE_ID("$Id: make_hash.c,v 1.3 2010/05/22 18:02:50 tom Exp $")
+MODULE_ID("$Id: make_hash.c,v 1.12 2013/02/16 21:27:50 tom Exp $")
 
 /*
  *	_nc_make_hash_table()
@@ -59,6 +59,23 @@
 #define MODULE_ID(id)		/*nothing */
 #include <tinfo/doalloc.c>
 
+static void
+failed(const char *s)
+{
+    perror(s);
+    exit(EXIT_FAILURE);
+}
+
+static char *
+strmalloc(char *s)
+{
+    char *result = malloc(strlen(s) + 1);
+    if (result == 0)
+    	failed("strmalloc");
+    strcpy(result, s);
+    return result;
+}
+
 /*
  *	int hash_function(string)
  *
@@ -119,6 +136,18 @@
 
 #define MAX_COLUMNS BUFSIZ	/* this _has_ to be worst-case */
 
+static int
+count_columns(char **list)
+{
+    int result = 0;
+    if (list != 0) {
+	while (*list++) {
+	    ++result;
+	}
+    }
+    return result;
+}
+
 static char **
 parse_columns(char *buffer)
 {
@@ -126,7 +155,7 @@
 
     int col = 0;
 
-    if (list == 0 && (list = typeCalloc(char *, MAX_COLUMNS)) == 0)
+    if (list == 0 && (list = typeCalloc(char *, (MAX_COLUMNS + 1))) == 0)
 	  return (0);
 
     if (*buffer != '#') {
@@ -201,8 +230,15 @@
 	list = parse_columns(buffer);
 	if (list == 0)		/* blank or comment */
 	    continue;
+	if (column > count_columns(list)) {
+	    fprintf(stderr, "expected %d columns, have %d:\n%s\n",
+		    column,
+		    count_columns(list),
+		    buffer);
+	    exit(EXIT_FAILURE);
+	}
 	name_table[n].nte_link = -1;	/* end-of-hash */
-	name_table[n].nte_name = strdup(list[column]);
+	name_table[n].nte_name = strmalloc(list[column]);
 	if (!strcmp(list[2], "bool")) {
 	    name_table[n].nte_type = BOOLEAN;
 	    name_table[n].nte_index = BoolCount++;
@@ -256,13 +292,12 @@
 	printf("static struct name_table_entry *_nc_%s_table = 0;\n\n", root_name);
     } else {
 
-	printf("static struct name_table_entry %s _nc_%s_table[] =\n",
-	       bigstring ? "" : "const",
+	printf("static struct name_table_entry const _nc_%s_table[] =\n",
 	       root_name);
 	printf("{\n");
 	for (n = 0; n < CAPTABSIZE; n++) {
-	    sprintf(buffer, "\"%s\"",
-		    name_table[n].nte_name);
+	    _nc_SPRINTF(buffer, _nc_SLIMIT(sizeof(buffer)) "\"%s\"",
+			name_table[n].nte_name);
 	    printf("\t{ %15s,\t%10s,\t%3d, %3d }%c\n",
 		   buffer,
 		   typenames[name_table[n].nte_type],
Index: ncurses/tinfo/make_keys.c
Prereq:  1.19 
--- ncurses-5.9/ncurses/tinfo/make_keys.c	2010-06-05 22:08:00.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/tinfo/make_keys.c	2011-10-22 16:34:50.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2008,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2010,2011 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -39,7 +39,7 @@
 #define USE_TERMLIB 1
 #include <build.priv.h>
 
-MODULE_ID("$Id: make_keys.c,v 1.19 2010/06/05 22:08:00 tom Exp $")
+MODULE_ID("$Id: make_keys.c,v 1.20 2011/10/22 16:34:50 tom Exp $")
 
 #include <names.c>
 
@@ -76,7 +76,7 @@
     unsigned maxlen = 16;
     int scanned;
 
-    while (fgets(buffer, sizeof(buffer), ifp) != 0) {
+    while (fgets(buffer, (int) sizeof(buffer), ifp) != 0) {
 	if (*buffer == '#')
 	    continue;
 
Index: ncurses/tinfo/name_match.c
Prereq:  1.18 
--- ncurses-5.9/ncurses/tinfo/name_match.c	2008-11-16 00:19:59.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/tinfo/name_match.c	2012-11-18 02:10:17.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1999-2007,2008 Free Software Foundation, Inc.              *
+ * Copyright (c) 1999-2011,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -33,25 +33,38 @@
 #include <curses.priv.h>
 #include <tic.h>
 
-MODULE_ID("$Id: name_match.c,v 1.18 2008/11/16 00:19:59 juergen Exp $")
+MODULE_ID("$Id: name_match.c,v 1.22 2012/11/18 02:10:17 tom Exp $")
 
-/*
- *	_nc_first_name(char *names)
- *
- *	Extract the primary name from a compiled entry.
- */
 #define FirstName _nc_globals.first_name
 
+#if USE_TERMCAP && NCURSES_XNAMES
+static const char *
+skip_index(const char *name)
+{
+    if ((_nc_syntax == SYN_TERMCAP) && _nc_user_definable) {
+	const char *bar = strchr(name, '|');
+	if (bar != 0 && (bar - name) == 2)
+	    name = bar + 1;
+    }
+    return name;
+}
+#endif
+
+/*
+ * Get the primary name from the given name list.  For terminfo, this is the
+ * first name.  For termcap, this may be the second name, if the first one
+ * happens to be two characters.
+ */
 NCURSES_EXPORT(char *)
 _nc_first_name(const char *const sp)
-/* get the first name from the given name list */
 {
     unsigned n;
 
 #if NO_LEAKS
     if (sp == 0) {
-	if (FirstName != 0)
+	if (FirstName != 0) {
 	    FreeAndNull(FirstName);
+	}
     } else
 #endif
     {
@@ -59,8 +72,12 @@
 	    FirstName = typeMalloc(char, MAX_NAME_SIZE + 1);
 
 	if (FirstName != 0) {
+	    const char *src = sp;
+#if USE_TERMCAP && NCURSES_XNAMES
+	    src = skip_index(sp);
+#endif
 	    for (n = 0; n < MAX_NAME_SIZE; n++) {
-		if ((FirstName[n] = sp[n]) == '\0'
+		if ((FirstName[n] = src[n]) == '\0'
 		    || (FirstName[n] == '|'))
 		    break;
 	    }
@@ -71,11 +88,8 @@
 }
 
 /*
- *	int _nc_name_match(namelist, name, delim)
- *
- *	Is the given name matched in namelist?
+ * Is the given name matched in namelist?
  */
-
 NCURSES_EXPORT(int)
 _nc_name_match(const char *const namelst, const char *const name, const char *const delim)
 {
Index: ncurses/tinfo/obsolete.c
--- /dev/null	2013-05-05 10:34:48.558701642 +0000
+++ ncurses-5.9-20130504/ncurses/tinfo/obsolete.c	2013-01-26 22:07:51.000000000 +0000
@@ -0,0 +1,102 @@
+/****************************************************************************
+ * Copyright (c) 2013 Free Software Foundation, Inc.                        *
+ *                                                                          *
+ * Permission is hereby granted, free of charge, to any person obtaining a  *
+ * copy of this software and associated documentation files (the            *
+ * "Software"), to deal in the Software without restriction, including      *
+ * without limitation the rights to use, copy, modify, merge, publish,      *
+ * distribute, distribute with modifications, sublicense, and/or sell       *
+ * copies of the Software, and to permit persons to whom the Software is    *
+ * furnished to do so, subject to the following conditions:                 *
+ *                                                                          *
+ * The above copyright notice and this permission notice shall be included  *
+ * in all copies or substantial portions of the Software.                   *
+ *                                                                          *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
+ * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
+ *                                                                          *
+ * Except as contained in this notice, the name(s) of the above copyright   *
+ * holders shall not be used in advertising or otherwise to promote the     *
+ * sale, use or other dealings in this Software without prior written       *
+ * authorization.                                                           *
+ ****************************************************************************/
+
+/****************************************************************************
+ *  Author: Thomas E. Dickey                        2013                    *
+ ****************************************************************************/
+
+/*
+**	Support for obsolete features.
+*/
+
+#include <curses.priv.h>
+
+MODULE_ID("$Id: obsolete.c,v 1.1 2013/01/26 22:07:51 tom Exp $")
+
+/*
+ * Obsolete entrypoint retained for binary compatbility.
+ */
+NCURSES_EXPORT(void)
+NCURSES_SP_NAME(_nc_set_buffer) (NCURSES_SP_DCLx FILE *ofp, int buffered)
+{
+#if NCURSES_SP_FUNCS
+    (void) SP_PARM;
+#endif
+    (void) ofp;
+    (void) buffered;
+}
+
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(void)
+_nc_set_buffer(FILE *ofp, int buffered)
+{
+    NCURSES_SP_NAME(_nc_set_buffer) (CURRENT_SCREEN, ofp, buffered);
+}
+#endif
+
+#if !HAVE_STRDUP
+NCURSES_EXPORT(char *)
+_nc_strdup(const char *s)
+{
+    char *result = 0;
+    if (s != 0) {
+	size_t need = strlen(s);
+	result = malloc(need + 1);
+	if (result != 0) {
+	    strcpy(result, s);
+	}
+    }
+    return result;
+}
+#endif
+
+#if USE_MY_MEMMOVE
+#define DST ((char *)s1)
+#define SRC ((const char *)s2)
+NCURSES_EXPORT(void *)
+_nc_memmove(void *s1, const void *s2, size_t n)
+{
+    if (n != 0) {
+	if ((DST + n > SRC) && (SRC + n > DST)) {
+	    static char *bfr;
+	    static size_t length;
+	    register size_t j;
+	    if (length < n) {
+		length = (n * 3) / 2;
+		bfr = typeRealloc(char, length, bfr);
+	    }
+	    for (j = 0; j < n; j++)
+		bfr[j] = SRC[j];
+	    s2 = bfr;
+	}
+	while (n-- != 0)
+	    DST[n] = SRC[n];
+    }
+    return s1;
+}
+#endif /* USE_MY_MEMMOVE */
Index: ncurses/tinfo/parse_entry.c
Prereq:  1.75 
--- ncurses-5.9/ncurses/tinfo/parse_entry.c	2010-05-01 19:35:09.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/tinfo/parse_entry.c	2012-10-27 21:43:45.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -47,7 +47,7 @@
 #include <ctype.h>
 #include <tic.h>
 
-MODULE_ID("$Id: parse_entry.c,v 1.75 2010/05/01 19:35:09 tom Exp $")
+MODULE_ID("$Id: parse_entry.c,v 1.79 2012/10/27 21:43:45 tom Exp $")
 
 #ifdef LINT
 static short const parametrized[] =
@@ -145,27 +145,27 @@
 	case BOOLEAN:
 	    tp->ext_Booleans++;
 	    tp->num_Booleans++;
-	    tp->Booleans = typeRealloc(NCURSES_SBOOL, tp->num_Booleans, tp->Booleans);
+	    TYPE_REALLOC(NCURSES_SBOOL, tp->num_Booleans, tp->Booleans);
 	    for_each_value(tp->num_Booleans)
 		tp->Booleans[last] = tp->Booleans[last - 1];
 	    break;
 	case NUMBER:
 	    tp->ext_Numbers++;
 	    tp->num_Numbers++;
-	    tp->Numbers = typeRealloc(short, tp->num_Numbers, tp->Numbers);
+	    TYPE_REALLOC(short, tp->num_Numbers, tp->Numbers);
 	    for_each_value(tp->num_Numbers)
 		tp->Numbers[last] = tp->Numbers[last - 1];
 	    break;
 	case STRING:
 	    tp->ext_Strings++;
 	    tp->num_Strings++;
-	    tp->Strings = typeRealloc(char *, tp->num_Strings, tp->Strings);
+	    TYPE_REALLOC(char *, tp->num_Strings, tp->Strings);
 	    for_each_value(tp->num_Strings)
 		tp->Strings[last] = tp->Strings[last - 1];
 	    break;
 	}
 	actual = NUM_EXT_NAMES(tp);
-	tp->ext_Names = typeRealloc(char *, actual, tp->ext_Names);
+	TYPE_REALLOC(char *, actual, tp->ext_Names);
 	while (--actual > offset)
 	    tp->ext_Names[actual] = tp->ext_Names[actual - 1];
 	tp->ext_Names[offset] = _nc_save_str(name);
@@ -203,6 +203,8 @@
  	{ bad_tc_usage = TRUE; \
 	 _nc_warning("Legacy termcap allows only a trailing tc= clause"); }
 
+#define MAX_NUMBER 0x7fff	/* positive shorts only */
+
 NCURSES_EXPORT(int)
 _nc_parse_entry(struct entry *entryp, int literal, bool silent)
 {
@@ -444,8 +446,12 @@
 		break;
 
 	    case NUMBER:
-		entryp->tterm.Numbers[entry_ptr->nte_index] =
-		    (short) _nc_curr_token.tk_valnumber;
+		if (_nc_curr_token.tk_valnumber > MAX_NUMBER) {
+		    entryp->tterm.Numbers[entry_ptr->nte_index] = MAX_NUMBER;
+		} else {
+		    entryp->tterm.Numbers[entry_ptr->nte_index] =
+			(short) _nc_curr_token.tk_valnumber;
+		}
 		break;
 
 	    case STRING:
@@ -654,14 +660,16 @@
 
 	if (WANTED(carriage_return)) {
 	    if (carriage_return_delay > 0) {
-		sprintf(buf, "%s$<%d>", C_CR, carriage_return_delay);
+		_nc_SPRINTF(buf, _nc_SLIMIT(sizeof(buf))
+			    "%s$<%d>", C_CR, carriage_return_delay);
 		carriage_return = _nc_save_str(buf);
 	    } else
 		carriage_return = _nc_save_str(C_CR);
 	}
 	if (WANTED(cursor_left)) {
 	    if (backspace_delay > 0) {
-		sprintf(buf, "%s$<%d>", C_BS, backspace_delay);
+		_nc_SPRINTF(buf, _nc_SLIMIT(sizeof(buf))
+			    "%s$<%d>", C_BS, backspace_delay);
 		cursor_left = _nc_save_str(buf);
 	    } else if (backspaces_with_bs == 1)
 		cursor_left = _nc_save_str(C_BS);
@@ -674,7 +682,8 @@
 		cursor_down = linefeed_if_not_lf;
 	    else if (linefeed_is_newline != 1) {
 		if (new_line_delay > 0) {
-		    sprintf(buf, "%s$<%d>", C_LF, new_line_delay);
+		    _nc_SPRINTF(buf, _nc_SLIMIT(sizeof(buf))
+				"%s$<%d>", C_LF, new_line_delay);
 		    cursor_down = _nc_save_str(buf);
 		} else
 		    cursor_down = _nc_save_str(C_LF);
@@ -685,7 +694,8 @@
 		cursor_down = linefeed_if_not_lf;
 	    else if (linefeed_is_newline != 1) {
 		if (new_line_delay > 0) {
-		    sprintf(buf, "%s$<%d>", C_LF, new_line_delay);
+		    _nc_SPRINTF(buf, _nc_SLIMIT(sizeof(buf))
+				"%s$<%d>", C_LF, new_line_delay);
 		    scroll_forward = _nc_save_str(buf);
 		} else
 		    scroll_forward = _nc_save_str(C_LF);
@@ -694,7 +704,8 @@
 	if (WANTED(newline)) {
 	    if (linefeed_is_newline == 1) {
 		if (new_line_delay > 0) {
-		    sprintf(buf, "%s$<%d>", C_LF, new_line_delay);
+		    _nc_SPRINTF(buf, _nc_SLIMIT(sizeof(buf))
+				"%s$<%d>", C_LF, new_line_delay);
 		    newline = _nc_save_str(buf);
 		} else
 		    newline = _nc_save_str(C_LF);
@@ -736,7 +747,8 @@
 	 */
 	if (WANTED(tab)) {
 	    if (horizontal_tab_delay > 0) {
-		sprintf(buf, "%s$<%d>", C_HT, horizontal_tab_delay);
+		_nc_SPRINTF(buf, _nc_SLIMIT(sizeof(buf))
+			    "%s$<%d>", C_HT, horizontal_tab_delay);
 		tab = _nc_save_str(buf);
 	    } else
 		tab = _nc_save_str(C_HT);
Index: ncurses/tinfo/read_entry.c
Prereq:  1.108 
--- ncurses-5.9/ncurses/tinfo/read_entry.c	2011-02-26 15:36:06.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/tinfo/read_entry.c	2013-05-04 22:53:42.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2010,2011 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -41,7 +41,7 @@
 
 #include <tic.h>
 
-MODULE_ID("$Id: read_entry.c,v 1.108 2011/02/26 15:36:06 tom Exp $")
+MODULE_ID("$Id: read_entry.c,v 1.122 2013/05/04 22:53:42 tom Exp $")
 
 #define TYPE_CALLOC(type,elts) typeCalloc(type, (unsigned)(elts))
 
@@ -99,7 +99,7 @@
     if (have > 0) {
 	if ((int) want > have)
 	    want = (unsigned) have;
-	memcpy(dst, src + *offset, want);
+	memcpy(dst, src + *offset, (size_t) want);
 	*offset += (int) want;
     } else {
 	want = 0;
@@ -107,22 +107,24 @@
     return (int) want;
 }
 
-#define Read(buf, count) fake_read(buffer, &offset, limit, buf, count)
+#define Read(buf, count) fake_read(buffer, &offset, limit, buf, (unsigned) count)
 
 #define read_shorts(buf, count) \
-	(Read(buf, (unsigned) (count)*2) == (int) (count)*2)
+	(Read(buf, (count)*2) == (int) (count)*2)
 
 #define even_boundary(value) \
     if ((value) % 2 != 0) Read(buf, 1)
 
+/*
+ * Return TGETENT_YES if read, TGETENT_NO if not found or garbled.
+ */
 NCURSES_EXPORT(int)
 _nc_read_termtype(TERMTYPE *ptr, char *buffer, int limit)
-/* return 1 if read, 0 if not found or garbled */
 {
     int offset = 0;
     int name_size, bool_count, num_count, str_count, str_size;
     int i;
-    char buf[MAX_ENTRY_SIZE + 1];
+    char buf[MAX_ENTRY_SIZE + 2];
     char *string_table;
     unsigned want, have;
 
@@ -157,7 +159,7 @@
     want = (unsigned) (str_size + name_size + 1);
     if (str_size) {
 	/* try to allocate space for the string table */
-	if (str_count * 2 >= (int) sizeof(buf)
+	if (str_count * 2 >= MAX_ENTRY_SIZE
 	    || (string_table = typeMalloc(char, want)) == 0) {
 	    return (TGETENT_NO);
 	}
@@ -173,7 +175,7 @@
     ptr->str_table = string_table;
     ptr->term_names = string_table;
     if ((have = (unsigned) Read(ptr->term_names, want)) != want) {
-	memset(ptr->term_names + have, 0, want - have);
+	memset(ptr->term_names + have, 0, (size_t) (want - have));
     }
     ptr->term_names[want] = '\0';
     string_table += (want + 1);
@@ -236,9 +238,9 @@
 	unsigned need = (unsigned) (ext_bool_count + ext_num_count + ext_str_count);
 	int base = 0;
 
-	if (need >= sizeof(buf)
-	    || ext_str_size >= (int) sizeof(buf)
-	    || ext_str_limit >= (int) sizeof(buf)
+	if (need >= (MAX_ENTRY_SIZE / 2)
+	    || ext_str_size >= MAX_ENTRY_SIZE
+	    || ext_str_limit >= MAX_ENTRY_SIZE
 	    || ext_bool_count < 0
 	    || ext_num_count < 0
 	    || ext_str_count < 0
@@ -250,9 +252,9 @@
 	ptr->num_Numbers = UShort(NUMCOUNT + ext_num_count);
 	ptr->num_Strings = UShort(STRCOUNT + ext_str_count);
 
-	ptr->Booleans = typeRealloc(NCURSES_SBOOL, ptr->num_Booleans, ptr->Booleans);
-	ptr->Numbers = typeRealloc(short, ptr->num_Numbers, ptr->Numbers);
-	ptr->Strings = typeRealloc(char *, ptr->num_Strings, ptr->Strings);
+	TYPE_REALLOC(NCURSES_SBOOL, ptr->num_Booleans, ptr->Booleans);
+	TYPE_REALLOC(short, ptr->num_Numbers, ptr->Numbers);
+	TYPE_REALLOC(char *, ptr->num_Strings, ptr->Strings);
 
 	TR(TRACE_DATABASE, ("extended header is %d/%d/%d(%d:%d)",
 			    ext_bool_count, ext_num_count, ext_str_count,
@@ -277,6 +279,8 @@
 	}
 
 	TR(TRACE_DATABASE, ("READ extended-offsets @%d", offset));
+	if ((unsigned) (ext_str_count + (int) need) >= (MAX_ENTRY_SIZE / 2))
+	    return (TGETENT_NO);
 	if ((ext_str_count || need)
 	    && !read_shorts(buf, ext_str_count + (int) need))
 	    return (TGETENT_NO);
@@ -313,7 +317,7 @@
 	}
 
 	if (need) {
-	    if (ext_str_count >= (MAX_ENTRY_SIZE * 2))
+	    if (ext_str_count >= (MAX_ENTRY_SIZE / 2))
 		return (TGETENT_NO);
 	    if ((ptr->ext_Names = TYPE_CALLOC(char *, need)) == 0)
 		  return (TGETENT_NO);
@@ -326,17 +330,18 @@
 			    ext_str_limit, ptr->ext_str_table + base);
 	}
 
-	T(("...done reading terminfo bool %d(%d) num %d(%d) str %d(%d)",
-	   ptr->num_Booleans, ptr->ext_Booleans,
-	   ptr->num_Numbers, ptr->ext_Numbers,
-	   ptr->num_Strings, ptr->ext_Strings));
+	TR(TRACE_DATABASE,
+	   ("...done reading terminfo bool %d(%d) num %d(%d) str %d(%d)",
+	    ptr->num_Booleans, ptr->ext_Booleans,
+	    ptr->num_Numbers, ptr->ext_Numbers,
+	    ptr->num_Strings, ptr->ext_Strings));
 
 	TR(TRACE_DATABASE, ("extend: num_Booleans:%d", ptr->num_Booleans));
     } else
 #endif /* NCURSES_XNAMES */
     {
-	T(("...done reading terminfo bool %d num %d str %d",
-	   bool_count, num_count, str_count));
+	TR(TRACE_DATABASE, ("...done reading terminfo bool %d num %d str %d",
+			    bool_count, num_count, str_count));
 #if NCURSES_XNAMES
 	TR(TRACE_DATABASE, ("normal: num_Booleans:%d", ptr->num_Booleans));
 #endif
@@ -371,13 +376,13 @@
 
     if (_nc_access(filename, R_OK) < 0
 	|| (fp = fopen(filename, "rb")) == 0) {
-	T(("cannot open terminfo %s (errno=%d)", filename, errno));
+	TR(TRACE_DATABASE, ("cannot open terminfo %s (errno=%d)", filename, errno));
 	code = TGETENT_NO;
     } else {
 	if ((limit = (int) fread(buffer, sizeof(char), sizeof(buffer), fp))
 	    > 0) {
 
-	    T(("read terminfo %s", filename));
+	    TR(TRACE_DATABASE, ("read terminfo %s", filename));
 	    if ((code = _nc_read_termtype(ptr, buffer, limit)) == TGETENT_NO) {
 		_nc_free_termtype(ptr);
 	    }
@@ -390,6 +395,58 @@
     return (code);
 }
 
+#if USE_HASHED_DB
+/*
+ * Return if if we can build the filename of a ".db" file.
+ */
+static bool
+make_db_filename(char *filename, unsigned limit, const char *const path)
+{
+    static const char suffix[] = DBM_SUFFIX;
+
+    unsigned lens = sizeof(suffix) - 1;
+    unsigned size = strlen(path);
+    unsigned test = lens + size;
+    bool result = FALSE;
+
+    if (test < limit) {
+	if (size >= lens
+	    && !strcmp(path + size - lens, suffix))
+	    _nc_STRCPY(filename, path, limit);
+	else
+	    _nc_SPRINTF(filename, _nc_SLIMIT(limit) "%s%s", path, suffix);
+	result = TRUE;
+    }
+    return result;
+}
+#endif
+
+/*
+ * Return true if we can build the name of a filesystem entry.
+ */
+static bool
+make_dir_filename(char *filename,
+		  unsigned limit,
+		  const char *const path,
+		  const char *name)
+{
+    bool result = FALSE;
+
+#if USE_TERMCAP
+    if (_nc_is_dir_path(path))
+#endif
+    {
+	unsigned need = (unsigned) (LEAF_LEN + 3 + strlen(path) + strlen(name));
+
+	if (need <= limit) {
+	    _nc_SPRINTF(filename, _nc_SLIMIT(limit)
+			"%s/" LEAF_FMT "/%s", path, *name, name);
+	    result = TRUE;
+	}
+    }
+    return result;
+}
+
 /*
  * Build a terminfo pathname and try to read the data.  Returns TGETENT_YES on
  * success, TGETENT_NO on failure.
@@ -401,101 +458,80 @@
 		   const char *name,
 		   TERMTYPE *const tp)
 {
-    int result = TGETENT_NO;
-
-    /*
-     * If we are looking in a directory, assume the entry is a file under that,
-     * according to the normal rules.
-     */
-    unsigned need = (unsigned) (LEAF_LEN + 3 + strlen(path) + strlen(name));
-    if (need <= limit)
-	(void) sprintf(filename, "%s/" LEAF_FMT "/%s", path, *name, name);
+    int code = TGETENT_NO;
 
-    if (_nc_is_dir_path(path))
-	result = _nc_read_file_entry(filename, tp);
 #if USE_HASHED_DB
-    else {
-	static const char suffix[] = DBM_SUFFIX;
-	DB *capdbp;
-	unsigned lens = sizeof(suffix) - 1;
-	unsigned size = strlen(path);
-	unsigned test = lens + size;
-
-	if (test < limit) {
-	    if (size >= lens
-		&& !strcmp(path + size - lens, suffix))
-		(void) strcpy(filename, path);
-	    else
-		(void) sprintf(filename, "%s%s", path, suffix);
+    DB *capdbp;
 
-	    /*
-	     * It would be nice to optimize the dbopen/close activity, as
-	     * done in the cgetent implementation for tc= clauses.  However,
-	     * since we support multiple database locations, we cannot do
-	     * that.
-	     */
-	    if ((capdbp = _nc_db_open(filename, FALSE)) != 0) {
-		DBT key, data;
-		int reccnt = 0;
-		char *save = strdup(name);
-
-		memset(&key, 0, sizeof(key));
-		key.data = save;
-		key.size = strlen(save);
-
-		/*
-		 * This lookup could return termcap data, which we do not want. 
-		 * We are looking for compiled (binary) terminfo data.
-		 *
-		 * cgetent uses a two-level lookup.  On the first it uses the
-		 * given name to return a record containing only the aliases
-		 * for an entry.  On the second (using that list of aliases as
-		 * a key), it returns the content of the terminal description. 
-		 * We expect second lookup to return data beginning with the
-		 * same set of aliases.
-		 *
-		 * For compiled terminfo, the list of aliases in the second
-		 * case will be null-terminated.  A termcap entry will not be,
-		 * and will run on into the description.  So we can easily
-		 * distinguish between the two (source/binary) by checking the
-		 * lengths.
-		 */
-		while (_nc_db_get(capdbp, &key, &data) == 0) {
-		    int used = data.size - 1;
-		    char *have = (char *) data.data;
-
-		    if (*have++ == 0) {
-			if (data.size > key.size
-			    && IS_TIC_MAGIC(have)) {
-			    result = _nc_read_termtype(tp, have, used);
-			    if (result == TGETENT_NO) {
-				_nc_free_termtype(tp);
-			    }
-			}
-			break;
-		    }
+    if (make_db_filename(filename, limit, path)
+	&& (capdbp = _nc_db_open(filename, FALSE)) != 0) {
 
-		    /*
-		     * Just in case we have a corrupt database, do not waste
-		     * time with it.
-		     */
-		    if (++reccnt >= 3)
-			break;
-
-		    /*
-		     * Prepare for the second level.
-		     */
-		    key.data = have;
-		    key.size = used;
+	DBT key, data;
+	int reccnt = 0;
+	char *save = strdup(name);
+
+	memset(&key, 0, sizeof(key));
+	key.data = save;
+	key.size = strlen(save);
+
+	/*
+	 * This lookup could return termcap data, which we do not want.  We are
+	 * looking for compiled (binary) terminfo data.
+	 *
+	 * cgetent uses a two-level lookup.  On the first it uses the given
+	 * name to return a record containing only the aliases for an entry. 
+	 * On the second (using that list of aliases as a key), it returns the
+	 * content of the terminal description.  We expect second lookup to
+	 * return data beginning with the same set of aliases.
+	 *
+	 * For compiled terminfo, the list of aliases in the second case will
+	 * be null-terminated.  A termcap entry will not be, and will run on
+	 * into the description.  So we can easily distinguish between the two
+	 * (source/binary) by checking the lengths.
+	 */
+	while (_nc_db_get(capdbp, &key, &data) == 0) {
+	    int used = data.size - 1;
+	    char *have = (char *) data.data;
+
+	    if (*have++ == 0) {
+		if (data.size > key.size
+		    && IS_TIC_MAGIC(have)) {
+		    code = _nc_read_termtype(tp, have, used);
+		    if (code == TGETENT_NO) {
+			_nc_free_termtype(tp);
+		    }
 		}
-
-		_nc_db_close(capdbp);
-		free(save);
+		break;
 	    }
+
+	    /*
+	     * Just in case we have a corrupt database, do not waste time with
+	     * it.
+	     */
+	    if (++reccnt >= 3)
+		break;
+
+	    /*
+	     * Prepare for the second level.
+	     */
+	    key.data = have;
+	    key.size = used;
 	}
+
+	free(save);
+    } else			/* may be either filesystem or flat file */
+#endif
+    if (make_dir_filename(filename, limit, path, name)) {
+	code = _nc_read_file_entry(filename, tp);
+    }
+#if USE_TERMCAP
+    else if (code != TGETENT_YES) {
+	code = _nc_read_termcap_entry(name, tp);
+	_nc_SPRINTF(filename, _nc_SLIMIT(PATH_MAX)
+		    "%.*s", PATH_MAX - 1, _nc_get_source());
     }
 #endif
-    return result;
+    return code;
 }
 #endif /* USE_DATABASE */
 
@@ -513,31 +549,35 @@
 {
     int code = TGETENT_NO;
 
-    sprintf(filename, "%.*s", PATH_MAX - 1, name);
+    _nc_SPRINTF(filename, _nc_SLIMIT(PATH_MAX)
+		"%.*s", PATH_MAX - 1, name);
+
     if (strlen(name) == 0
 	|| strcmp(name, ".") == 0
 	|| strcmp(name, "..") == 0
 	|| _nc_pathlast(name) != 0
 	|| strchr(name, NCURSES_PATHSEP) != 0) {
-	T(("illegal or missing entry name '%s'", name));
+	TR(TRACE_DATABASE, ("illegal or missing entry name '%s'", name));
     } else {
 #if USE_DATABASE
-	DBDIRS state = dbdTIC;
-	int offset = 0;
+	DBDIRS state;
+	int offset;
 	const char *path;
 
+	_nc_first_db(&state, &offset);
 	while ((path = _nc_next_db(&state, &offset)) != 0) {
+	    TR(TRACE_DATABASE, ("_nc_read_tic_entry path=%s, name=%s", path, name));
 	    code = _nc_read_tic_entry(filename, PATH_MAX, path, name, tp);
 	    if (code == TGETENT_YES) {
 		_nc_last_db();
 		break;
 	    }
 	}
-#endif
-#if USE_TERMCAP
+#elif USE_TERMCAP
 	if (code != TGETENT_YES) {
 	    code = _nc_read_termcap_entry(name, tp);
-	    sprintf(filename, "%.*s", PATH_MAX - 1, _nc_get_source());
+	    _nc_SPRINTF(filename, _nc_SLIMIT(PATH_MAX)
+			"%.*s", PATH_MAX - 1, _nc_get_source());
 	}
 #endif
     }
Index: ncurses/tinfo/read_termcap.c
Prereq:  1.74 
--- ncurses-5.9/ncurses/tinfo/read_termcap.c	2010-01-23 17:57:43.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/tinfo/read_termcap.c	2012-05-05 19:40:50.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -54,10 +54,9 @@
 
 #include <ctype.h>
 #include <sys/types.h>
-#include <sys/stat.h>
 #include <tic.h>
 
-MODULE_ID("$Id: read_termcap.c,v 1.74 2010/01/23 17:57:43 tom Exp $")
+MODULE_ID("$Id: read_termcap.c,v 1.87 2012/05/05 19:40:50 tom Exp $")
 
 #if !PURE_TERMINFO
 
@@ -74,7 +73,7 @@
 
     if (!use_terminfo_vars() || (result = getenv("TERMPATH")) == 0)
 	result = TERMPATH;
-    T(("TERMPATH is %s", result));
+    TR(TRACE_DATABASE, ("TERMPATH is %s", result));
     return result;
 }
 
@@ -162,7 +161,7 @@
 	return (-1);
     }
     gottoprec = 0;
-    (void) strcpy(toprec, ent);
+    _nc_STRCPY(toprec, ent, topreclen);
     return (0);
 }
 
@@ -295,7 +294,7 @@
 	    errno = ENOMEM;
 	    return (TC_SYS_ERR);
 	}
-	(void) strcpy(record, toprec);
+	_nc_STRCPY(record, toprec, topreclen + BFRAG);
 	rp = record + topreclen + 1;
 	r_end = rp + BFRAG;
 	current = in_array;
@@ -384,7 +383,14 @@
 			c = *bp++;
 			if (c == '\n') {
 			    lineno++;
-			    if (rp == record || *(rp - 1) != '\\')
+			    /*
+			     * Unlike BSD 4.3, this ignores a backslash at the
+			     * end of a comment-line.  That makes it consistent
+			     * with the rest of ncurses -TD
+			     */
+			    if (rp == record
+				|| *record == '#'
+				|| *(rp - 1) != '\\')
 				break;
 			}
 			*rp++ = c;
@@ -442,8 +448,10 @@
 		break;
 	}
 
-	if (!foundit)
+	if (!foundit) {
+	    free(record);
 	    return (TC_NOT_FOUND);
+	}
     }
 
     /*
@@ -455,7 +463,7 @@
 	register int newilen;
 	unsigned ilen;
 	int diff, iret, tclen, oline;
-	char *icap, *scan, *tc, *tcstart, *tcend;
+	char *icap = 0, *scan, *tc, *tcstart, *tcend;
 
 	/*
 	 * Loop invariants:
@@ -468,8 +476,9 @@
 	scan = record;
 	tc_not_resolved = FALSE;
 	for (;;) {
-	    if ((tc = _nc_cgetcap(scan, "tc", '=')) == 0)
+	    if ((tc = _nc_cgetcap(scan, "tc", '=')) == 0) {
 		break;
+	    }
 
 	    /*
 	     * Find end of tc=name and stomp on the trailing `:'
@@ -486,6 +495,7 @@
 	    tclen = s - tcstart;
 	    tcend = s;
 
+	    icap = 0;
 	    iret = _nc_getent(&icap, &ilen, &oline, current, db_array, fd,
 			      tc, depth + 1, 0);
 	    newicap = icap;	/* Put into a register. */
@@ -496,12 +506,13 @@
 		    if (myfd)
 			(void) close(fd);
 		    free(record);
+		    FreeIfNeeded(icap);
 		    return (iret);
 		}
-		if (iret == TC_UNRESOLVED)
+		if (iret == TC_UNRESOLVED) {
 		    tc_not_resolved = TRUE;
-		/* couldn't resolve tc */
-		if (iret == TC_NOT_FOUND) {
+		    /* couldn't resolve tc */
+		} else if (iret == TC_NOT_FOUND) {
 		    *(s - 1) = ':';
 		    scan = s - 1;
 		    tc_not_resolved = TRUE;
@@ -581,8 +592,9 @@
     }
 
     *cap = record;
-    if (tc_not_resolved)
+    if (tc_not_resolved) {
 	return (TC_UNRESOLVED);
+    }
     return (current);
 }
 
@@ -697,8 +709,6 @@
 #define	PVECSIZ		32	/* max number of names in path */
 #define TBUFSIZ (2048*2)
 
-static char *tbuf;
-
 /*
  * On entry, srcp points to a non ':' character which is the beginning of the
  * token, if any.  We'll try to return a string that doesn't end with a ':'.
@@ -776,18 +786,18 @@
     register char *p;
     register char *cp;
     char *dummy = NULL;
-    char **fname;
+    CGETENT_CONST char **fname;
     char *home;
     int i;
     char pathbuf[PBUFSIZ];	/* holds raw path of filenames */
-    char *pathvec[PVECSIZ];	/* to point to names in pathbuf */
-    char **pvec;		/* holds usable tail of path vector */
+    CGETENT_CONST char *pathvec[PVECSIZ];	/* point to names in pathbuf */
+    CGETENT_CONST char **pvec;	/* holds usable tail of path vector */
     NCURSES_CONST char *termpath;
     string_desc desc;
 
+    *lineno = 1;
     fname = pathvec;
     pvec = pathvec;
-    tbuf = bp;
     p = pathbuf;
     cp = use_terminfo_vars()? getenv("TERMCAP") : NULL;
 
@@ -812,10 +822,11 @@
 	    if ((home = getenv("HOME")) != 0 && *home != '\0'
 		&& strchr(home, ' ') == 0
 		&& strlen(home) < sizeof(temp) - 10) {	/* setup path */
-		sprintf(temp, "%s/", home);	/* $HOME first */
+		_nc_SPRINTF(temp, _nc_SLIMIT(sizeof(temp))
+			    "%s/", home);	/* $HOME first */
 	    }
 	    /* if no $HOME look in current directory */
-	    strcat(temp, ".termcap");
+	    _nc_STRCAT(temp, ".termcap", sizeof(temp));
 	    _nc_safe_strcat(&desc, temp);
 	    _nc_safe_strcat(&desc, " ");
 	    _nc_safe_strcat(&desc, get_termpath());
@@ -841,6 +852,9 @@
 	}
     }
     *fname = 0;			/* mark end of vector */
+#if !HAVE_BSD_CGETENT
+    (void) _nc_cgetset(0);
+#endif
     if (_nc_is_abs_path(cp)) {
 	if (_nc_cgetset(cp) < 0) {
 	    return (TC_SYS_ERR);
@@ -853,6 +867,7 @@
      * empty fields, and mistakenly use the last valid cap entry instead of
      * the first (breaks tc= includes)
      */
+    *bp = '\0';
     if (i >= 0) {
 	char *pd, *ps, *tok;
 	int endflag = FALSE;
@@ -932,7 +947,7 @@
     if (count < MAXPATHS
 	&& _nc_access(path, R_OK) == 0) {
 	termpaths[count++] = path;
-	T(("Adding termpath %s", path));
+	TR(TRACE_DATABASE, ("Adding termpath %s", path));
     }
     termpaths[count] = 0;
     if (save != 0)
@@ -956,13 +971,13 @@
     static char *source;
     static int lineno;
 
-    T(("read termcap entry for %s", tn));
+    TR(TRACE_DATABASE, ("read termcap entry for %s", tn));
 
     if (strlen(tn) == 0
 	|| strcmp(tn, ".") == 0
 	|| strcmp(tn, "..") == 0
 	|| _nc_pathlast(tn) != 0) {
-	T(("illegal or missing entry name '%s'", tn));
+	TR(TRACE_DATABASE, ("illegal or missing entry name '%s'", tn));
 	return TGETENT_NO;
     }
 
@@ -980,7 +995,7 @@
 	_nc_curr_line = lineno;
 	_nc_set_source(source);
     }
-    _nc_read_entry_source((FILE *) 0, tc, FALSE, FALSE, NULLHOOK);
+    _nc_read_entry_source((FILE *) 0, tc, FALSE, TRUE, NULLHOOK);
 #else
     /*
      * Here is what the 4.4BSD termcap(3) page prescribes:
@@ -1027,7 +1042,9 @@
 	    normal = FALSE;
 	} else if (_nc_name_match(tc, tn, "|:")) {	/* treat as a capability file */
 	    use_buffer = TRUE;
-	    (void) sprintf(tc_buf, "%.*s\n", (int) sizeof(tc_buf) - 2, tc);
+	    _nc_SPRINTF(tc_buf,
+			_nc_SLIMIT(sizeof(tc_buf))
+			"%.*s\n", (int) sizeof(tc_buf) - 2, tc);
 	    normal = FALSE;
 	}
     }
@@ -1049,8 +1066,9 @@
 	if (use_terminfo_vars() && (h = getenv("HOME")) != NULL && *h != '\0'
 	    && (strlen(h) + sizeof(PRIVATE_CAP)) < PATH_MAX) {
 	    /* user's .termcap, if any, should override it */
-	    (void) strcpy(envhome, h);
-	    (void) sprintf(pathbuf, PRIVATE_CAP, envhome);
+	    _nc_STRCPY(envhome, h, sizeof(envhome));
+	    _nc_SPRINTF(pathbuf, _nc_SLIMIT(sizeof(pathbuf))
+			PRIVATE_CAP, envhome);
 	    ADD_TC(pathbuf, filecount);
 	}
     }
@@ -1063,7 +1081,7 @@
     for (j = 0; j < filecount; j++) {
 	bool omit = FALSE;
 	if (stat(termpaths[j], &test_stat[j]) != 0
-	    || (test_stat[j].st_mode & S_IFMT) != S_IFREG) {
+	    || !S_ISREG(test_stat[j].st_mode)) {
 	    omit = TRUE;
 	} else {
 	    for (k = 0; k < j; k++) {
@@ -1075,7 +1093,7 @@
 	    }
 	}
 	if (omit) {
-	    T(("Path %s is a duplicate", termpaths[j]));
+	    TR(TRACE_DATABASE, ("Path %s is a duplicate", termpaths[j]));
 	    for (k = j + 1; k < filecount; k++) {
 		termpaths[k - 1] = termpaths[k];
 		test_stat[k - 1] = test_stat[k];
@@ -1100,7 +1118,7 @@
 
 	for (i = 0; i < filecount; i++) {
 
-	    T(("Looking for %s in %s", tn, termpaths[i]));
+	    TR(TRACE_DATABASE, ("Looking for %s in %s", tn, termpaths[i]));
 	    if (_nc_access(termpaths[i], R_OK) == 0
 		&& (fp = fopen(termpaths[i], "r")) != (FILE *) 0) {
 		_nc_set_source(termpaths[i]);
@@ -1138,8 +1156,7 @@
 		 * from the list.
 		 */
 		*tp = ep->tterm;
-		_nc_delink_entry(_nc_head, &(ep->tterm));
-		free(ep);
+		_nc_free_entry(_nc_head, &(ep->tterm));
 
 		/*
 		 * OK, now try to write the type to user's terminfo directory. 
Index: ncurses/tinfo/strings.c
Prereq:  1.6 
--- ncurses-5.9/ncurses/tinfo/strings.c	2007-08-11 17:12:17.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/tinfo/strings.c	2012-02-22 22:34:31.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 2000-2003,2007 Free Software Foundation, Inc.              *
+ * Copyright (c) 2000-2007,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -36,7 +36,7 @@
 
 #include <curses.priv.h>
 
-MODULE_ID("$Id: strings.c,v 1.6 2007/08/11 17:12:17 tom Exp $")
+MODULE_ID("$Id: strings.c,v 1.8 2012/02/22 22:34:31 tom Exp $")
 
 /****************************************************************************
  * Useful string functions (especially for mvcur)
@@ -110,7 +110,7 @@
 
 	if (len < dst->s_size) {
 	    if (dst->s_tail != 0) {
-		strcpy(dst->s_tail, src);
+		_nc_STRCPY(dst->s_tail, src, dst->s_size);
 		dst->s_tail += len;
 	    }
 	    dst->s_size -= len;
@@ -131,7 +131,7 @@
 
 	if (len < dst->s_size) {
 	    if (dst->s_head != 0) {
-		strcpy(dst->s_head, src);
+		_nc_STRCPY(dst->s_head, src, dst->s_size);
 		dst->s_tail = dst->s_head + len;
 	    }
 	    dst->s_size = dst->s_init - len;
Index: ncurses/tinfo/tinfo_driver.c
Prereq:  1.13 
--- ncurses-5.9/ncurses/tinfo/tinfo_driver.c	2010-12-20 01:47:09.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/tinfo/tinfo_driver.c	2013-01-12 22:01:43.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 2008-2009,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 2008-2012,2013 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -50,7 +50,7 @@
 # endif
 #endif
 
-MODULE_ID("$Id: tinfo_driver.c,v 1.13 2010/12/20 01:47:09 tom Exp $")
+MODULE_ID("$Id: tinfo_driver.c,v 1.29 2013/01/12 22:01:43 tom Exp $")
 
 /*
  * SCO defines TIOCGSIZE and the corresponding struct.  Other systems (SunOS,
@@ -93,7 +93,7 @@
 
 #define TCBMAGIC NCDRV_MAGIC(NCDRV_TINFO)
 #define AssertTCB() assert(TCB!=0 && TCB->magic==TCBMAGIC)
-#define SetSP() assert(TCB->csp!=0); sp = TCB->csp
+#define SetSP() assert(TCB->csp!=0); sp = TCB->csp; (void) sp
 
 /*
  * This routine needs to do all the work to make curscr look
@@ -106,22 +106,6 @@
     return TINFO_DOUPDATE(TCB->csp);
 }
 
-#define ret_error(code, fmt, arg)	if (errret) {\
-					    *errret = code;\
-					    return(FALSE); \
-					} else {\
-					    fprintf(stderr, fmt, arg);\
-					    exit(EXIT_FAILURE);\
-					}
-
-#define ret_error0(code, msg)		if (errret) {\
-					    *errret = code;\
-					    return(FALSE);\
-					} else {\
-					    fprintf(stderr, msg);\
-					    exit(EXIT_FAILURE);\
-					}
-
 static bool
 drv_CanHandle(TERMINAL_CONTROL_BLOCK * TCB, const char *tname, int *errret)
 {
@@ -156,12 +140,12 @@
 	if (status == TGETENT_ERR) {
 	    ret_error0(status, "terminals database is inaccessible\n");
 	} else if (status == TGETENT_NO) {
-	    ret_error(status, "'%s': unknown terminal type.\n", tname);
+	    ret_error1(status, "unknown terminal type.\n", tname);
 	}
     }
     result = TRUE;
 #if !USE_REENTRANT
-    strncpy(ttytype, termp->type.term_names, NAMESIZE - 1);
+    strncpy(ttytype, termp->type.term_names, (size_t) NAMESIZE - 1);
     ttytype[NAMESIZE - 1] = '\0';
 #endif
 
@@ -169,17 +153,27 @@
 	_nc_tinfo_cmdch(termp, *command_character);
 
     if (generic_type) {
-	ret_error(TGETENT_NO, "'%s': I need something more specific.\n", tname);
+	/*
+	 * BSD 4.3's termcap contains mis-typed "gn" for wy99.  Do a sanity
+	 * check before giving up.
+	 */
+	if ((VALID_STRING(cursor_address)
+	     || (VALID_STRING(cursor_down) && VALID_STRING(cursor_home)))
+	    && VALID_STRING(clear_screen)) {
+	    ret_error1(TGETENT_YES, "terminal is not really generic.\n", tname);
+	} else {
+	    ret_error1(TGETENT_NO, "I need something more specific.\n", tname);
+	}
     }
     if (hard_copy) {
-	ret_error(TGETENT_YES, "'%s': I can't handle hardcopy terminals.\n", tname);
+	ret_error1(TGETENT_YES, "I can't handle hardcopy terminals.\n", tname);
     }
 
     return result;
 }
 
 static int
-drv_dobeepflash(TERMINAL_CONTROL_BLOCK * TCB, bool beepFlag)
+drv_dobeepflash(TERMINAL_CONTROL_BLOCK * TCB, int beepFlag)
 {
     SCREEN *sp;
     int res = ERR;
@@ -190,22 +184,18 @@
     /* FIXME: should make sure that we are not in altchar mode */
     if (beepFlag) {
 	if (bell) {
-	    res = NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx "bell", bell);
+	    res = NCURSES_PUTP2("bell", bell);
 	    NCURSES_SP_NAME(_nc_flush) (sp);
 	} else if (flash_screen) {
-	    res = NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx
-					     "flash_screen",
-					     flash_screen);
+	    res = NCURSES_PUTP2("flash_screen", flash_screen);
 	    NCURSES_SP_NAME(_nc_flush) (sp);
 	}
     } else {
 	if (flash_screen) {
-	    res = NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx
-					     "flash_screen",
-					     flash_screen);
+	    res = NCURSES_PUTP2("flash_screen", flash_screen);
 	    NCURSES_SP_NAME(_nc_flush) (sp);
 	} else if (bell) {
-	    res = NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx "bell", bell);
+	    res = NCURSES_PUTP2("bell", bell);
 	    NCURSES_SP_NAME(_nc_flush) (sp);
 	}
     }
@@ -277,7 +267,7 @@
 
 static void
 drv_setcolor(TERMINAL_CONTROL_BLOCK * TCB,
-	     bool fore,
+	     int fore,
 	     int color,
 	     NCURSES_SP_OUTC outc)
 {
@@ -321,7 +311,7 @@
     SetSP();
 
     if (orig_pair != 0) {
-	NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx "orig_pair", orig_pair);
+	NCURSES_PUTP2("orig_pair", orig_pair);
 	result = TRUE;
     }
     return result;
@@ -337,7 +327,7 @@
     SetSP();
 
     if (orig_colors != 0) {
-	NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx "orig_colors", orig_colors);
+	NCURSES_PUTP2("orig_colors", orig_colors);
 	result = TRUE;
     }
     return result;
@@ -348,14 +338,18 @@
 {
     SCREEN *sp;
     bool useEnv = TRUE;
+    bool useTioctl = TRUE;
 
     AssertTCB();
     sp = TCB->csp;		/* can be null here */
 
     if (sp) {
 	useEnv = sp->_use_env;
-    } else
+	useTioctl = sp->_use_tioctl;
+    } else {
 	useEnv = _nc_prescreen.use_env;
+	useTioctl = _nc_prescreen.use_tioctl;
+    }
 
     /* figure out the size of the screen */
     T(("screen size: terminfo lines = %d columns = %d", lines, columns));
@@ -363,7 +357,7 @@
     *linep = (int) lines;
     *colp = (int) columns;
 
-    if (useEnv) {
+    if (useEnv || useTioctl) {
 	int value;
 
 #ifdef __EMX__
@@ -371,7 +365,9 @@
 	    int screendata[2];
 	    _scrsize(screendata);
 	    *colp = screendata[0];
-	    *linep = screendata[1];
+	    *linep = ((sp != 0 && sp->_filtered)
+		      ? 1
+		      : screendata[1]);
 	    T(("EMX screen size: environment LINES = %d COLUMNS = %d",
 	       *linep, *colp));
 	}
@@ -400,19 +396,33 @@
 	}
 #endif /* HAVE_SIZECHANGE */
 
-	/*
-	 * Finally, look for environment variables.
-	 *
-	 * Solaris lets users override either dimension with an environment
-	 * variable.
-	 */
-	if ((value = _nc_getenv_num("LINES")) > 0) {
-	    *linep = value;
-	    T(("screen size: environment LINES = %d", *linep));
-	}
-	if ((value = _nc_getenv_num("COLUMNS")) > 0) {
-	    *colp = value;
-	    T(("screen size: environment COLUMNS = %d", *colp));
+	if (useEnv) {
+	    if (useTioctl) {
+		/*
+		 * If environment variables are used, update them.
+		 */
+		if ((sp == 0 || !sp->_filtered) && _nc_getenv_num("LINES") > 0) {
+		    _nc_setenv_num("LINES", *linep);
+		}
+		if (_nc_getenv_num("COLUMNS") > 0) {
+		    _nc_setenv_num("COLUMNS", *colp);
+		}
+	    }
+
+	    /*
+	     * Finally, look for environment variables.
+	     *
+	     * Solaris lets users override either dimension with an environment
+	     * variable.
+	     */
+	    if ((value = _nc_getenv_num("LINES")) > 0) {
+		*linep = value;
+		T(("screen size: environment LINES = %d", *linep));
+	    }
+	    if ((value = _nc_getenv_num("COLUMNS")) > 0) {
+		*colp = value;
+		T(("screen size: environment COLUMNS = %d", *colp));
+	    }
 	}
 
 	/* if we can't get dynamic info about the size, use static */
@@ -463,7 +473,7 @@
 }
 
 static int
-drv_sgmode(TERMINAL_CONTROL_BLOCK * TCB, bool setFlag, TTY * buf)
+drv_sgmode(TERMINAL_CONTROL_BLOCK * TCB, int setFlag, TTY * buf)
 {
     SCREEN *sp = TCB->csp;
     TERMINAL *_term = (TERMINAL *) TCB;
@@ -497,7 +507,7 @@
 }
 
 static int
-drv_mode(TERMINAL_CONTROL_BLOCK * TCB, bool progFlag, bool defFlag)
+drv_mode(TERMINAL_CONTROL_BLOCK * TCB, int progFlag, int defFlag)
 {
     SCREEN *sp;
     TERMINAL *_term = (TERMINAL *) TCB;
@@ -620,15 +630,13 @@
 static void
 drv_init(TERMINAL_CONTROL_BLOCK * TCB)
 {
-    SCREEN *sp;
     TERMINAL *trm;
 
     AssertTCB();
 
     trm = (TERMINAL *) TCB;
-    sp = TCB->csp;
 
-    TCB->info.initcolor = initialize_color;
+    TCB->info.initcolor = VALID_STRING(initialize_color);
     TCB->info.canchange = can_change;
     TCB->info.hascolor = ((VALID_NUMERIC(max_colors) && VALID_NUMERIC(max_pairs)
 			   && (((set_foreground != NULL)
@@ -665,7 +673,7 @@
 #define InPalette(n)	((n) >= 0 && (n) < MAX_PALETTE)
 
 static void
-drv_initpair(TERMINAL_CONTROL_BLOCK * TCB, short pair, short f, short b)
+drv_initpair(TERMINAL_CONTROL_BLOCK * TCB, int pair, int f, int b)
 {
     SCREEN *sp;
 
@@ -681,12 +689,11 @@
 	    tp[f].red, tp[f].green, tp[f].blue,
 	    tp[b].red, tp[b].green, tp[b].blue));
 
-	NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx
-				   "initialize_pair",
-				   TPARM_7(initialize_pair,
-					   pair,
-					   tp[f].red, tp[f].green, tp[f].blue,
-					   tp[b].red, tp[b].green, tp[b].blue));
+	NCURSES_PUTP2("initialize_pair",
+		      TPARM_7(initialize_pair,
+			      pair,
+			      tp[f].red, tp[f].green, tp[f].blue,
+			      tp[b].red, tp[b].green, tp[b].blue));
     }
 }
 
@@ -712,23 +719,22 @@
 
 static void
 drv_initcolor(TERMINAL_CONTROL_BLOCK * TCB,
-	      short color, short r, short g, short b)
+	      int color, int r, int g, int b)
 {
     SCREEN *sp = TCB->csp;
 
     AssertTCB();
     if (initialize_color != NULL) {
-	NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx
-				   "initialize_color",
-				   TPARM_4(initialize_color, color, r, g, b));
+	NCURSES_PUTP2("initialize_color",
+		      TPARM_4(initialize_color, color, r, g, b));
     }
 }
 
 static void
 drv_do_color(TERMINAL_CONTROL_BLOCK * TCB,
-	     short old_pair,
-	     short pair,
-	     bool reverse,
+	     int old_pair,
+	     int pair,
+	     int reverse,
 	     NCURSES_SP_OUTC outc)
 {
     SCREEN *sp = TCB->csp;
@@ -759,7 +765,7 @@
     if (old_pair >= 0
 	&& sp != 0
 	&& NCURSES_SP_NAME(pair_content) (NCURSES_SP_ARGx
-					  old_pair,
+					  (short) old_pair,
 					  &old_fg,
 					  &old_bg) !=ERR) {
 	if ((isDefaultColor(fg) && !isDefaultColor(old_fg))
@@ -845,7 +851,9 @@
 }
 
 static int
-drv_testmouse(TERMINAL_CONTROL_BLOCK * TCB, int delay)
+drv_testmouse(TERMINAL_CONTROL_BLOCK * TCB,
+	      int delay
+	      EVENTLIST_2nd(_nc_eventlist * evl))
 {
     int rc = 0;
     SCREEN *sp;
@@ -882,7 +890,7 @@
 {
     SCREEN *sp = TCB->csp;
     AssertTCB();
-    return TINFO_MVCUR(sp, yold, xold, ynew, xnew);
+    return NCURSES_SP_NAME(_nc_mvcur) (sp, yold, xold, ynew, xnew);
 }
 
 static void
@@ -892,22 +900,21 @@
 
     AssertTCB();
     if (labnum > 0 && labnum <= num_labels) {
-	NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx
-				   "plab_norm",
-				   TPARM_2(plab_norm, labnum, text));
+	NCURSES_PUTP2("plab_norm",
+		      TPARM_2(plab_norm, labnum, text));
     }
 }
 
 static void
-drv_hwlabelOnOff(TERMINAL_CONTROL_BLOCK * TCB, bool OnFlag)
+drv_hwlabelOnOff(TERMINAL_CONTROL_BLOCK * TCB, int OnFlag)
 {
     SCREEN *sp = TCB->csp;
 
     AssertTCB();
     if (OnFlag) {
-	NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx "label_on", label_on);
+	NCURSES_PUTP2("label_on", label_on);
     } else {
-	NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx "label_off", label_off);
+	NCURSES_PUTP2("label_off", label_off);
     }
 }
 
@@ -972,7 +979,7 @@
     AssertTCB();
     assert(sp != 0);
     if (ena_acs != NULL) {
-	NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx "ena_acs", ena_acs);
+	NCURSES_PUTP2("ena_acs", ena_acs);
     }
 #if NCURSES_EXT_FUNCS
     /*
@@ -1176,7 +1183,7 @@
     if ((pthread_self) && (pthread_kill) && (pthread_equal))
 	_nc_globals.read_thread = pthread_self();
 # endif
-    n = read(sp->_ifd, &c2, 1);
+    n = read(sp->_ifd, &c2, (size_t) 1);
 #if USE_PTHREADS_EINTR
     _nc_globals.read_thread = 0;
 #endif
@@ -1209,7 +1216,7 @@
     int rc = ERR;
 
     if (value) {
-	rc = NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx name, value);
+	rc = NCURSES_PUTP2(name, value);
     }
     return rc;
 }
@@ -1225,7 +1232,7 @@
 }
 
 static int
-drv_kpad(TERMINAL_CONTROL_BLOCK * TCB, bool flag)
+drv_kpad(TERMINAL_CONTROL_BLOCK * TCB, int flag)
 {
     int ret = ERR;
     SCREEN *sp;
@@ -1251,7 +1258,7 @@
 }
 
 static int
-drv_keyok(TERMINAL_CONTROL_BLOCK * TCB, int c, bool flag)
+drv_keyok(TERMINAL_CONTROL_BLOCK * TCB, int c, int flag)
 {
     SCREEN *sp;
     int code = ERR;
@@ -1264,7 +1271,8 @@
     if (c >= 0) {
 	unsigned ch = (unsigned) c;
 	if (flag) {
-	    while ((s = _nc_expand_try(sp->_key_ok, ch, &count, 0)) != 0
+	    while ((s = _nc_expand_try(sp->_key_ok,
+				       ch, &count, (size_t) 0)) != 0
 		   && _nc_remove_key(&(sp->_key_ok), ch)) {
 		code = _nc_add_to_try(&(sp->_keytry), s, ch);
 		free(s);
@@ -1273,7 +1281,8 @@
 		    break;
 	    }
 	} else {
-	    while ((s = _nc_expand_try(sp->_keytry, ch, &count, 0)) != 0
+	    while ((s = _nc_expand_try(sp->_keytry,
+				       ch, &count, (size_t) 0)) != 0
 		   && _nc_remove_key(&(sp->_keytry), ch)) {
 		code = _nc_add_to_try(&(sp->_key_ok), s, ch);
 		free(s);
Index: ncurses/tinfo/trim_sgr0.c
Prereq:  1.12 
--- ncurses-5.9/ncurses/tinfo/trim_sgr0.c	2010-12-25 23:03:57.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/tinfo/trim_sgr0.c	2012-12-15 20:57:17.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 2005-2007,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 2005-2010,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -36,7 +36,7 @@
 
 #include <tic.h>
 
-MODULE_ID("$Id: trim_sgr0.c,v 1.12 2010/12/25 23:03:57 tom Exp $")
+MODULE_ID("$Id: trim_sgr0.c,v 1.15 2012/12/15 20:57:17 tom Exp $")
 
 #undef CUR
 #define CUR tp->
@@ -48,21 +48,28 @@
 static char *
 set_attribute_9(TERMTYPE *tp, int flag)
 {
-    const char *result;
+    const char *value;
+    char *result;
 
-    if ((result = tparm(set_attributes, 0, 0, 0, 0, 0, 0, 0, 0, flag)) == 0)
-	result = "";
-    return strdup(result);
+    value = tparm(set_attributes, 0, 0, 0, 0, 0, 0, 0, 0, flag);
+    if (PRESENT(value))
+	result = strdup(value);
+    else
+	result = 0;
+    return result;
 }
 
 static int
 is_csi(const char *s)
 {
-    if (UChar(s[0]) == CSI)
-	return 1;
-    else if (s[0] == ESC && s[1] == L_BRACK)
-	return 2;
-    return 0;
+    int result = 0;
+    if (s != 0) {
+	if (UChar(s[0]) == CSI)
+	    result = 1;
+	else if (s[0] == ESC && s[1] == L_BRACK)
+	    result = 2;
+    }
+    return result;
 }
 
 static char *
@@ -97,7 +104,7 @@
 static bool
 rewrite_sgr(char *s, char *attr)
 {
-    if (PRESENT(s)) {
+    if (s != 0) {
 	if (PRESENT(attr)) {
 	    size_t len_s = strlen(s);
 	    size_t len_a = strlen(attr);
@@ -108,7 +115,7 @@
 		for (n = 0; n < len_s - len_a; ++n) {
 		    s[n] = s[n + len_a];
 		}
-		strcpy(s + n, attr);
+		_nc_STRCPY(s + n, attr, strlen(s) + 1);
 		TR(TRACE_DATABASE, ("to:\n\t%s", s));
 	    }
 	}
@@ -121,33 +128,35 @@
 similar_sgr(char *a, char *b)
 {
     bool result = FALSE;
-    int csi_a = is_csi(a);
-    int csi_b = is_csi(b);
-    size_t len_a;
-    size_t len_b;
-
-    TR(TRACE_DATABASE, ("similar_sgr:\n\t%s\n\t%s",
-			_nc_visbuf2(1, a),
-			_nc_visbuf2(2, b)));
-    if (csi_a != 0 && csi_b != 0 && csi_a == csi_b) {
-	a += csi_a;
-	b += csi_b;
-	if (*a != *b) {
-	    a = skip_zero(a);
-	    b = skip_zero(b);
+    if (a != 0 && b != 0) {
+	int csi_a = is_csi(a);
+	int csi_b = is_csi(b);
+	size_t len_a;
+	size_t len_b;
+
+	TR(TRACE_DATABASE, ("similar_sgr:\n\t%s\n\t%s",
+			    _nc_visbuf2(1, a),
+			    _nc_visbuf2(2, b)));
+	if (csi_a != 0 && csi_b != 0 && csi_a == csi_b) {
+	    a += csi_a;
+	    b += csi_b;
+	    if (*a != *b) {
+		a = skip_zero(a);
+		b = skip_zero(b);
+	    }
 	}
+	len_a = strlen(a);
+	len_b = strlen(b);
+	if (len_a && len_b) {
+	    if (len_a > len_b)
+		result = (strncmp(a, b, len_b) == 0);
+	    else
+		result = (strncmp(a, b, len_a) == 0);
+	}
+	TR(TRACE_DATABASE, ("...similar_sgr: %d\n\t%s\n\t%s", result,
+			    _nc_visbuf2(1, a),
+			    _nc_visbuf2(2, b)));
     }
-    len_a = strlen(a);
-    len_b = strlen(b);
-    if (len_a && len_b) {
-	if (len_a > len_b)
-	    result = (strncmp(a, b, len_b) == 0);
-	else
-	    result = (strncmp(a, b, len_a) == 0);
-    }
-    TR(TRACE_DATABASE, ("...similar_sgr: %d\n\t%s\n\t%s", result,
-			_nc_visbuf2(1, a),
-			_nc_visbuf2(2, b)));
     return result;
 }
 
Index: ncurses/tinfo/write_entry.c
Prereq:  1.78 
--- ncurses-5.9/ncurses/tinfo/write_entry.c	2010-12-25 23:23:08.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/tinfo/write_entry.c	2012-12-29 23:12:22.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -39,21 +39,15 @@
 #include <curses.priv.h>
 #include <hashed_db.h>
 
-#include <sys/stat.h>
-
 #include <tic.h>
 
-#ifndef S_ISDIR
-#define S_ISDIR(mode) ((mode & S_IFMT) == S_IFDIR)
-#endif
-
 #if 1
 #define TRACE_OUT(p) DEBUG(2, p)
 #else
 #define TRACE_OUT(p)		/*nothing */
 #endif
 
-MODULE_ID("$Id: write_entry.c,v 1.78 2010/12/25 23:23:08 tom Exp $")
+MODULE_ID("$Id: write_entry.c,v 1.87 2012/12/29 23:12:22 tom Exp $")
 
 static int total_written;
 
@@ -76,7 +70,7 @@
     DEBUG(1, ("Created %s", filename));
 
     if (write_object(tp, buffer, &offset, limit) == ERR
-	|| fwrite(buffer, sizeof(char), offset, fp) != offset) {
+	|| fwrite(buffer, sizeof(char), (size_t) offset, fp) != offset) {
 	_nc_syserr_abort("error writing %s/%s", _nc_tic_dir(0), filename);
     }
 
@@ -105,7 +99,7 @@
     if (verified[s - dirnames])
 	return;
 
-    sprintf(dir, LEAF_FMT, code);
+    _nc_SPRINTF(dir, _nc_SLIMIT(sizeof(dir)) LEAF_FMT, code);
     if (make_db_root(dir) < 0) {
 	_nc_err_abort("%s/%s: permission denied", _nc_tic_dir(0), dir);
     }
@@ -115,36 +109,35 @@
 #endif /* !USE_HASHED_DB */
 
 static int
-make_db_path(char *dst, const char *src, unsigned limit)
+make_db_path(char *dst, const char *src, size_t limit)
 {
     int rc = -1;
     const char *top = _nc_tic_dir(0);
 
     if (src == top || _nc_is_abs_path(src)) {
 	if (strlen(src) + 1 <= limit) {
-	    (void) strcpy(dst, src);
+	    _nc_STRCPY(dst, src, limit);
 	    rc = 0;
 	}
     } else {
 	if (strlen(top) + strlen(src) + 2 <= limit) {
-	    (void) sprintf(dst, "%s/%s", top, src);
+	    _nc_SPRINTF(dst, _nc_SLIMIT(limit) "%s/%s", top, src);
 	    rc = 0;
 	}
     }
 #if USE_HASHED_DB
     if (rc == 0) {
-	if (_nc_is_dir_path(dst)) {
-	    rc = -1;
-	} else {
-	    static const char suffix[] = DBM_SUFFIX;
-	    unsigned have = strlen(dst);
-	    unsigned need = strlen(suffix);
-	    if (have > need && strcmp(dst + have - need, suffix)) {
-		if (have + need <= limit)
-		    strcat(dst, suffix);
-		else
-		    rc = -1;
+	static const char suffix[] = DBM_SUFFIX;
+	size_t have = strlen(dst);
+	size_t need = strlen(suffix);
+	if (have > need && strcmp(dst + (int) (have - need), suffix)) {
+	    if (have + need <= limit) {
+		_nc_STRCAT(dst, suffix, limit);
+	    } else {
+		rc = -1;
 	    }
+	} else if (_nc_is_dir_path(dst)) {
+	    rc = -1;
 	}
     }
 #endif
@@ -164,10 +157,11 @@
 #if USE_HASHED_DB
 	DB *capdbp;
 
-	if ((capdbp = _nc_db_open(fullpath, TRUE)) == NULL)
+	if ((capdbp = _nc_db_open(fullpath, TRUE)) == NULL) {
 	    rc = -1;
-	else if (_nc_db_close(capdbp) < 0)
+	} else if (_nc_db_close(capdbp) < 0) {
 	    rc = -1;
+	}
 #else
 	struct stat statbuf;
 
@@ -279,16 +273,21 @@
     char name_list[MAX_TERMINFO_LENGTH];
     char *first_name, *other_names;
     char *ptr;
+    const char *term_names = tp->term_names;
+    size_t name_size = strlen(term_names);
 
-    assert(strlen(tp->term_names) != 0);
-    assert(strlen(tp->term_names) < sizeof(name_list));
+    if (name_size == 0) {
+	_nc_syserr_abort("no terminal name found.");
+    } else if (name_size >= sizeof(name_list) - 1) {
+	_nc_syserr_abort("terminal name too long: %s", term_names);
+    }
 
-    (void) strcpy(name_list, tp->term_names);
+    _nc_STRCPY(name_list, term_names, sizeof(name_list));
     DEBUG(7, ("Name list = '%s'", name_list));
 
     first_name = name_list;
 
-    ptr = &name_list[strlen(name_list) - 1];
+    ptr = &name_list[name_size - 1];
     other_names = ptr + 1;
 
     while (ptr > name_list && *ptr != '|')
@@ -322,8 +321,8 @@
 	    buffer[0] = 0;
 
 	    memset(&key, 0, sizeof(key));
-	    key.data = tp->term_names;
-	    key.size = strlen(tp->term_names);
+	    key.data = term_names;
+	    key.size = name_size;
 
 	    memset(&data, 0, sizeof(data));
 	    data.data = buffer;
@@ -334,10 +333,12 @@
 	    buffer[0] = 2;
 
 	    key.data = name_list;
-	    key.size = strlen(name_list);
+	    key.size = name_size;
 
-	    strcpy(buffer + 1, tp->term_names);
-	    data.size = strlen(tp->term_names) + 1;
+	    _nc_STRCPY(buffer + 1,
+		       term_names,
+		       sizeof(buffer) - 1);
+	    data.size = name_size + 1;
 
 	    _nc_db_put(capdb, &key, &data);
 
@@ -355,7 +356,6 @@
 
 		_nc_db_put(capdb, &key, &data);
 	    }
-	    _nc_db_close(capdb);
 	}
     }
 #else /* !USE_HASHED_DB */
@@ -366,7 +366,8 @@
     if (strlen(first_name) >= sizeof(filename) - (2 + LEAF_LEN))
 	_nc_warning("terminal name too long.");
 
-    sprintf(filename, LEAF_FMT "/%s", first_name[0], first_name);
+    _nc_SPRINTF(filename, _nc_SLIMIT(sizeof(filename))
+		LEAF_FMT "/%s", first_name[0], first_name);
 
     /*
      * Has this primary name been written since the first call to
@@ -376,7 +377,22 @@
     if (start_time > 0 &&
 	stat(filename, &statbuf) >= 0
 	&& statbuf.st_mtime >= start_time) {
+#if HAVE_LINK && !USE_SYMLINKS
+	/*
+	 * If the file has more than one link, the reason for the previous
+	 * write could be that the current primary name used to be an alias for
+	 * the previous entry.  In that case, unlink the file so that we will
+	 * not modify the previous entry as we write this one.
+	 */
+	if (statbuf.st_nlink > 1) {
+	    _nc_warning("name redefined.");
+	    unlink(filename);
+	} else {
+	    _nc_warning("name multiply defined.");
+	}
+#else
 	_nc_warning("name multiply defined.");
+#endif
     }
 
     check_writeable(first_name[0]);
@@ -407,7 +423,8 @@
 	}
 
 	check_writeable(ptr[0]);
-	sprintf(linkname, LEAF_FMT "/%s", ptr[0], ptr);
+	_nc_SPRINTF(linkname, _nc_SLIMIT(sizeof(linkname))
+		    LEAF_FMT "/%s", ptr[0], ptr);
 
 	if (strcmp(filename, linkname) == 0) {
 	    _nc_warning("self-synonym ignored");
@@ -422,7 +439,7 @@
 	    if (first_name[0] == linkname[0])
 		strncpy(symlinkname, first_name, sizeof(symlinkname) - 1);
 	    else {
-		strcpy(symlinkname, "../");
+		_nc_STRCPY(symlinkname, "../", sizeof(suymlinkname));
 		strncat(symlinkname, filename, sizeof(symlinkname) - 4);
 	    }
 	    symlinkname[sizeof(symlinkname) - 1] = '\0';
@@ -491,7 +508,7 @@
     return (want / size);
 }
 
-#define Write(buf, size, count) fake_write(buffer, offset, limit, (char *) buf, count, size)
+#define Write(buf, size, count) fake_write(buffer, offset, (size_t) limit, (char *) buf, (size_t) count, (size_t) size)
 
 #undef LITTLE_ENDIAN		/* BSD/OS defines this as a feature macro */
 #define HI(x)			((x) / 256)
@@ -706,7 +723,7 @@
 	    return (ERR);
 
 	nextfree = compute_offsets(tp->Strings + STRCOUNT,
-				   tp->ext_Strings,
+				   (size_t) tp->ext_Strings,
 				   offsets);
 	TRACE_OUT(("after extended string capabilities, nextfree=%d", nextfree));
 
@@ -714,7 +731,7 @@
 	    return (ERR);
 
 	nextfree += compute_offsets(tp->ext_Names,
-				    extcnt,
+				    (size_t) extcnt,
 				    offsets + tp->ext_Strings);
 	TRACE_OUT(("after extended capnames, nextfree=%d", nextfree));
 	strmax = tp->ext_Strings + extcnt;
@@ -742,7 +759,7 @@
 
 	TRACE_OUT(("WRITE %d numbers @%d", tp->ext_Numbers, *offset));
 	if (tp->ext_Numbers) {
-	    convert_shorts(buf, tp->Numbers + NUMCOUNT, tp->ext_Numbers);
+	    convert_shorts(buf, tp->Numbers + NUMCOUNT, (size_t) tp->ext_Numbers);
 	    if (Write(buf, 2, tp->ext_Numbers) != tp->ext_Numbers)
 		return (ERR);
 	}
Index: ncurses/trace/lib_trace.c
Prereq:  1.76 
--- ncurses-5.9/ncurses/trace/lib_trace.c	2010-12-19 01:21:19.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/trace/lib_trace.c	2012-04-29 00:20:43.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -47,7 +47,7 @@
 
 #include <ctype.h>
 
-MODULE_ID("$Id: lib_trace.c,v 1.76 2010/12/19 01:21:19 tom Exp $")
+MODULE_ID("$Id: lib_trace.c,v 1.81 2012/04/29 00:20:43 tom Exp $")
 
 NCURSES_EXPORT_VAR(unsigned) _nc_tracing = 0; /* always define this */
 
@@ -103,9 +103,9 @@
 	    }
 	    TracePath[size] = '\0';
 	    assert(strlen(TracePath) <= size);
-	    strcat(TracePath, "/trace");
+	    _nc_STRCAT(TracePath, "/trace", sizeof(TracePath));
 	    if (_nc_is_dir_path(TracePath)) {
-		strcat(TracePath, ".log");
+		_nc_STRCAT(TracePath, ".log", sizeof(TracePath));
 	    }
 	}
 
@@ -121,7 +121,7 @@
 	 * end of each line.  This is useful in case the program dies. 
 	 */
 #if HAVE_SETVBUF		/* ANSI */
-	(void) setvbuf(TraceFP, (char *) 0, _IOLBF, 0);
+	(void) setvbuf(TraceFP, (char *) 0, _IOLBF, (size_t) 0);
 #elif HAVE_SETBUF /* POSIX */
 	(void) setbuffer(TraceFP, (char *) 0);
 #endif
@@ -185,9 +185,9 @@
 	if ((pthread_self))
 # endif
 #ifdef __MINGW32__
-	    fprintf(TraceFP, "%#lx:", (long) (void *) pthread_self().p);
+	    fprintf(TraceFP, "%#lx:", (long) (intptr_t) pthread_self().p);
 #else
-	    fprintf(TraceFP, "%#lx:", (long) (void *) pthread_self());
+	    fprintf(TraceFP, "%#lx:", (long) (intptr_t) pthread_self());
 #endif
 #endif
 	if (before || after) {
@@ -218,7 +218,7 @@
 
 /* Trace 'bool' return-values */
 NCURSES_EXPORT(NCURSES_BOOL)
-_nc_retrace_bool(NCURSES_BOOL code)
+_nc_retrace_bool(int code)
 {
     T((T_RETURN("%s"), code ? "TRUE" : "FALSE"));
     return code;
@@ -226,10 +226,10 @@
 
 /* Trace 'char' return-values */
 NCURSES_EXPORT(char)
-_nc_retrace_char(char code)
+_nc_retrace_char(int code)
 {
     T((T_RETURN("%c"), code));
-    return code;
+    return (char) code;
 }
 
 /* Trace 'int' return-values */
Index: ncurses/trace/lib_traceatr.c
Prereq:  1.74 
--- ncurses-5.9/ncurses/trace/lib_traceatr.c	2011-01-22 19:48:01.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/trace/lib_traceatr.c	2012-02-22 22:40:24.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2010,2011 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -43,10 +43,13 @@
 #define CUR SP_TERMTYPE
 #endif
 
-MODULE_ID("$Id: lib_traceatr.c,v 1.74 2011/01/22 19:48:01 tom Exp $")
+MODULE_ID("$Id: lib_traceatr.c,v 1.79 2012/02/22 22:40:24 tom Exp $")
 
 #define COLOR_OF(c) ((c < 0) ? "default" : (c > 7 ? color_of(c) : colors[c].name))
 
+#define TRACE_BUF_SIZE(num) (_nc_globals.tracebuf_ptr[num].size)
+#define COLOR_BUF_SIZE(num) (sizeof(my_buffer[num]))
+
 #ifdef TRACE
 
 static const char l_brace[] = StringOf(L_BRACE);
@@ -65,9 +68,12 @@
 	my_cached = c;
 	my_select = !my_select;
 	if (c == COLOR_DEFAULT)
-	    strcpy(my_buffer[my_select], "default");
+	    _nc_STRCPY(my_buffer[my_select], "default",
+		       COLOR_BUF_SIZE(my_select));
 	else
-	    sprintf(my_buffer[my_select], "color%d", c);
+	    _nc_SPRINTF(my_buffer[my_select],
+			_nc_SLIMIT(COLOR_BUF_SIZE(my_select))
+			"color%d", c);
     }
     return my_buffer[my_select];
 }
@@ -120,14 +126,14 @@
     ;
     size_t n;
     char temp[80];
-    char *result = _nc_trace_buf(bufnum, BUFSIZ);
+    char *result = _nc_trace_buf(bufnum, (size_t) BUFSIZ);
 
     if (result != 0) {
 	unsigned save_nc_tracing = _nc_tracing;
 
 	_nc_tracing = 0;
 
-	strcpy(result, l_brace);
+	_nc_STRCPY(result, l_brace, TRACE_BUF_SIZE(bufnum));
 
 	for (n = 0; n < SIZEOF(names); n++) {
 	    if ((newmode & names[n].val) != 0) {
@@ -139,18 +145,20 @@
 		    short pairnum = (short) PairNumber(newmode);
 #ifdef USE_TERMLIB
 		    /* pair_content lives in libncurses */
-		    (void) sprintf(temp, "{%d}", pairnum);
+		    _nc_SPRINTF(temp, _nc_SLIMIT(sizeof(temp))
+				"{%d}", pairnum);
 #else
 		    short fg, bg;
 
 		    if (pair_content(pairnum, &fg, &bg) == OK) {
-			(void) sprintf(temp,
-				       "{%d = {%s, %s}}",
-				       pairnum,
-				       COLOR_OF(fg),
-				       COLOR_OF(bg));
+			_nc_SPRINTF(temp, _nc_SLIMIT(sizeof(temp))
+				    "{%d = {%s, %s}}",
+				    pairnum,
+				    COLOR_OF(fg),
+				    COLOR_OF(bg));
 		    } else {
-			(void) sprintf(temp, "{%d}", pairnum);
+			_nc_SPRINTF(temp, _nc_SLIMIT(sizeof(temp))
+				    "{%d}", pairnum);
 		    }
 #endif
 		    result = _nc_trace_bufcat(bufnum, temp);
@@ -243,7 +251,7 @@
 #if NCURSES_SP_FUNCS
     (void) sp;
 #endif
-    if ((attr & A_ALTCHARSET) && (acs_chars != 0)) {
+    if (SP_PARM != 0 && (attr & A_ALTCHARSET) && (acs_chars != 0)) {
 	char *cp;
 	char *found = 0;
 	const ALT_NAMES *strp;
@@ -271,10 +279,10 @@
 _tracechtype2(int bufnum, chtype ch)
 {
     const char *found;
-    char *result = _nc_trace_buf(bufnum, BUFSIZ);
+    char *result = _nc_trace_buf(bufnum, (size_t) BUFSIZ);
 
     if (result != 0) {
-	strcpy(result, l_brace);
+	_nc_STRCPY(result, l_brace, TRACE_BUF_SIZE(bufnum));
 	if ((found = _nc_altcharset_name(ChAttrOf(ch), ch)) != 0) {
 	    (void) _nc_trace_bufcat(bufnum, found);
 	} else
@@ -311,12 +319,12 @@
 NCURSES_EXPORT(char *)
 _tracecchar_t2(int bufnum, const cchar_t *ch)
 {
-    char *result = _nc_trace_buf(bufnum, BUFSIZ);
+    char *result = _nc_trace_buf(bufnum, (size_t) BUFSIZ);
     attr_t attr;
     const char *found;
 
     if (result != 0) {
-	strcpy(result, l_brace);
+	_nc_STRCPY(result, l_brace, TRACE_BUF_SIZE(bufnum));
 	if (ch != 0) {
 	    attr = AttrOfD(ch);
 	    if ((found = _nc_altcharset_name(attr, (chtype) CharOfD(ch))) != 0) {
Index: ncurses/trace/lib_tracebits.c
Prereq:  1.19 
--- ncurses-5.9/ncurses/trace/lib_tracebits.c	2011-01-09 00:23:03.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/trace/lib_tracebits.c	2012-06-09 19:55:46.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2008,2011 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -34,11 +34,7 @@
 
 #include <curses.priv.h>
 
-MODULE_ID("$Id: lib_tracebits.c,v 1.19 2011/01/09 00:23:03 tom Exp $")
-
-#if SVR4_TERMIO && !defined(_POSIX_SOURCE)
-#define _POSIX_SOURCE
-#endif
+MODULE_ID("$Id: lib_tracebits.c,v 1.23 2012/06/09 19:55:46 tom Exp $")
 
 #if HAVE_SYS_TERMIO_H
 #include <sys/termio.h>		/* needed for ISC */
@@ -80,22 +76,24 @@
     const char *name;
 } BITNAMES;
 
+#define TRACE_BUF_SIZE(num) (_nc_globals.tracebuf_ptr[num].size)
+
 static void
 lookup_bits(char *buf, const BITNAMES * table, const char *label, unsigned int val)
 {
     const BITNAMES *sp;
 
-    (void) strcat(buf, label);
-    (void) strcat(buf, ": {");
+    _nc_STRCAT(buf, label, TRACE_BUF_SIZE(0));
+    _nc_STRCAT(buf, ": {", TRACE_BUF_SIZE(0));
     for (sp = table; sp->name; sp++)
 	if (sp->val != 0
 	    && (val & sp->val) == sp->val) {
-	    (void) strcat(buf, sp->name);
-	    (void) strcat(buf, ", ");
+	    _nc_STRCAT(buf, sp->name, TRACE_BUF_SIZE(0));
+	    _nc_STRCAT(buf, ", ", TRACE_BUF_SIZE(0));
 	}
     if (buf[strlen(buf) - 2] == ',')
 	buf[strlen(buf) - 2] = '\0';
-    (void) strcat(buf, "} ");
+    _nc_STRCAT(buf, "} ", TRACE_BUF_SIZE(0));
 }
 
 NCURSES_EXPORT(char *)
@@ -192,7 +190,7 @@
 		    CS_DATA(CS8),
 	    };
 	    const char *result = "CSIZE? ";
-	    int value = (tty->c_cflag & CSIZE);
+	    int value = (int) (tty->c_cflag & CSIZE);
 	    unsigned n;
 
 	    if (value != 0) {
@@ -203,7 +201,7 @@
 		    }
 		}
 	    }
-	    strcat(buf, result);
+	    _nc_STRCAT(buf, result, TRACE_BUF_SIZE(0));
 	}
 #endif
 
Index: ncurses/trace/lib_tracechr.c
Prereq:  1.20 
--- ncurses-5.9/ncurses/trace/lib_tracechr.c	2009-04-18 22:48:29.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/trace/lib_tracechr.c	2012-02-22 22:40:24.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2008,2009 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2009,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -39,10 +39,12 @@
 
 #include <ctype.h>
 
-MODULE_ID("$Id: lib_tracechr.c,v 1.20 2009/04/18 22:48:29 tom Exp $")
+MODULE_ID("$Id: lib_tracechr.c,v 1.22 2012/02/22 22:40:24 tom Exp $")
 
 #ifdef TRACE
 
+#define MyBufSize sizeof(_nc_globals.tracechr_buf)
+
 NCURSES_EXPORT(char *)
 _nc_tracechar(SCREEN *sp, int ch)
 {
@@ -55,19 +57,22 @@
 	name = safe_keyname(SP_PARM, ch);
 	if (name == 0 || *name == '\0')
 	    name = "NULL";
-	(void) sprintf(MyBuffer, "'%.30s' = %#03o", name, ch);
+	_nc_SPRINTF(MyBuffer, _nc_SLIMIT(MyBufSize)
+		    "'%.30s' = %#03o", name, ch);
     } else if (!is8bits(ch) || !isprint(UChar(ch))) {
 	/*
 	 * workaround for glibc bug:
 	 * sprintf changes the result from unctrl() to an empty string if it
 	 * does not correspond to a valid multibyte sequence.
 	 */
-	(void) sprintf(MyBuffer, "%#03o", ch);
+	_nc_SPRINTF(MyBuffer, _nc_SLIMIT(MyBufSize)
+		    "%#03o", ch);
     } else {
 	name = safe_unctrl(SP_PARM, (chtype) ch);
 	if (name == 0 || *name == 0)
 	    name = "null";	/* shouldn't happen */
-	(void) sprintf(MyBuffer, "'%.30s' = %#03o", name, ch);
+	_nc_SPRINTF(MyBuffer, _nc_SLIMIT(MyBufSize)
+		    "'%.30s' = %#03o", name, ch);
     }
     return (MyBuffer);
 }
Index: ncurses/trace/lib_tracedmp.c
Prereq:  1.32 
--- ncurses-5.9/ncurses/trace/lib_tracedmp.c	2009-04-18 21:01:38.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/trace/lib_tracedmp.c	2012-10-27 20:54:42.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2008,2009 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2009,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -39,7 +39,7 @@
 #include <curses.priv.h>
 #include <ctype.h>
 
-MODULE_ID("$Id: lib_tracedmp.c,v 1.32 2009/04/18 21:01:38 tom Exp $")
+MODULE_ID("$Id: lib_tracedmp.c,v 1.34 2012/10/27 20:54:42 tom Exp $")
 
 #ifdef TRACE
 
@@ -70,6 +70,8 @@
     if (++width + 1 > (int) my_length) {
 	my_length = (unsigned) (2 * (width + 1));
 	my_buffer = typeRealloc(char, my_length, my_buffer);
+	if (my_buffer == 0)
+	    return;
     }
 
     for (n = 0; n <= win->_maxy; ++n) {
@@ -111,7 +113,7 @@
 	    if (multicolumn) {
 		ep = my_buffer;
 		for (j = 0; j < width; ++j) {
-		    chtype test = WidecExt(win->_line[n].text[j]);
+		    int test = WidecExt(win->_line[n].text[j]);
 		    if (test) {
 			ep[j] = (char) (test + '0');
 		    } else {
Index: ncurses/trace/lib_tracemse.c
Prereq:  1.18 
--- ncurses-5.9/ncurses/trace/lib_tracemse.c	2011-01-22 19:48:08.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/trace/lib_tracemse.c	2012-12-15 23:51:19.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2010,2011 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -38,7 +38,7 @@
 
 #include <curses.priv.h>
 
-MODULE_ID("$Id: lib_tracemse.c,v 1.18 2011/01/22 19:48:08 tom Exp $")
+MODULE_ID("$Id: lib_tracemse.c,v 1.21 2012/12/15 23:51:19 tom Exp $")
 
 #ifdef TRACE
 
@@ -47,7 +47,11 @@
 static char *
 _trace_mmask_t(SCREEN *sp, mmask_t code)
 {
-#define SHOW(m, s) if ((code & m) == m) strcat(strcat(my_buffer, s), ", ")
+#define SHOW(m, s) \
+    if ((code & m) == m) { \
+	_nc_STRCAT(my_buffer, s, sizeof(my_buffer)); \
+	_nc_STRCAT(my_buffer, ", ", sizeof(my_buffer)); \
+    }
 
     SHOW(BUTTON1_RELEASED, "release-1");
     SHOW(BUTTON1_PRESSED, "press-1");
@@ -110,23 +114,33 @@
 NCURSES_EXPORT(char *)
 _nc_tracemouse(SCREEN *sp, MEVENT const *ep)
 {
-    (void) sprintf(my_buffer, TRACEMSE_FMT,
-		   ep->id,
-		   ep->x,
-		   ep->y,
-		   ep->z,
-		   (unsigned long) ep->bstate);
+    char *result = 0;
 
-    (void) _trace_mmask_t(sp, ep->bstate);
-    (void) strcat(my_buffer, "}");
-    return (my_buffer);
+    if (sp != 0) {
+	_nc_SPRINTF(my_buffer, _nc_SLIMIT(sizeof(my_buffer))
+		    TRACEMSE_FMT,
+		    ep->id,
+		    ep->x,
+		    ep->y,
+		    ep->z,
+		    (unsigned long) ep->bstate);
+
+	(void) _trace_mmask_t(sp, ep->bstate);
+	_nc_STRCAT(my_buffer, "}", sizeof(my_buffer));
+	result = (my_buffer);
+    }
+    return result;
 }
 
 NCURSES_EXPORT(mmask_t)
 _nc_retrace_mmask_t(SCREEN *sp, mmask_t code)
 {
-    *my_buffer = '\0';
-    T((T_RETURN("{%s}"), _trace_mmask_t(sp, code)));
+    if (sp != 0) {
+	*my_buffer = '\0';
+	T((T_RETURN("{%s}"), _trace_mmask_t(sp, code)));
+    } else {
+	T((T_RETURN("{?}")));
+    }
     return code;
 }
 
Index: ncurses/trace/trace_buf.c
Prereq:  1.17 
--- ncurses-5.9/ncurses/trace/trace_buf.c	2011-01-22 19:48:16.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/trace/trace_buf.c	2012-02-22 22:34:31.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2010,2011 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -35,7 +35,7 @@
 
 #include <curses.priv.h>
 
-MODULE_ID("$Id: trace_buf.c,v 1.17 2011/01/22 19:48:16 tom Exp $")
+MODULE_ID("$Id: trace_buf.c,v 1.20 2012/02/22 22:34:31 tom Exp $")
 
 #ifdef TRACE
 
@@ -103,13 +103,14 @@
 NCURSES_EXPORT(char *)
 _nc_trace_bufcat(int bufnum, const char *value)
 {
-    char *buffer = _nc_trace_alloc(bufnum, 0);
+    char *buffer = _nc_trace_alloc(bufnum, (size_t) 0);
     if (buffer != 0) {
 	size_t have = strlen(buffer);
+	size_t need = strlen(value) + have;
 
-	buffer = _nc_trace_alloc(bufnum, 1 + have + strlen(value));
+	buffer = _nc_trace_alloc(bufnum, 1 + need);
 	if (buffer != 0)
-	    (void) strcpy(buffer + have, value);
+	    _nc_STRCPY(buffer + have, value, need);
 
     }
     return buffer;
Index: ncurses/trace/trace_tries.c
Prereq:  1.16 
--- ncurses-5.9/ncurses/trace/trace_tries.c	2011-01-09 00:23:27.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/trace/trace_tries.c	2012-10-27 20:50:50.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1999-2009,2011 Free Software Foundation, Inc.              *
+ * Copyright (c) 1999-2011,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -35,7 +35,7 @@
 
 #include <curses.priv.h>
 
-MODULE_ID("$Id: trace_tries.c,v 1.16 2011/01/09 00:23:27 tom Exp $")
+MODULE_ID("$Id: trace_tries.c,v 1.17 2012/10/27 20:50:50 tom Exp $")
 
 #ifdef TRACE
 #define my_buffer _nc_globals.tracetry_buf
@@ -49,28 +49,31 @@
 	my_buffer = (unsigned char *) _nc_doalloc(my_buffer, my_length);
     }
 
-    while (tree != 0) {
-	if ((my_buffer[level] = tree->ch) == 0)
-	    my_buffer[level] = 128;
-	my_buffer[level + 1] = 0;
-	if (tree->value != 0) {
-	    _tracef("%5d: %s (%s)", tree->value,
-		    _nc_visbuf((char *) my_buffer), keyname(tree->value));
+    if (my_buffer != 0) {
+	while (tree != 0) {
+	    if ((my_buffer[level] = tree->ch) == 0)
+		my_buffer[level] = 128;
+	    my_buffer[level + 1] = 0;
+	    if (tree->value != 0) {
+		_tracef("%5d: %s (%s)", tree->value,
+			_nc_visbuf((char *) my_buffer), keyname(tree->value));
+	    }
+	    if (tree->child)
+		recur_tries(tree->child, level + 1);
+	    tree = tree->sibling;
 	}
-	if (tree->child)
-	    recur_tries(tree->child, level + 1);
-	tree = tree->sibling;
     }
 }
 
 NCURSES_EXPORT(void)
 _nc_trace_tries(TRIES * tree)
 {
-    my_buffer = typeMalloc(unsigned char, my_length = 80);
-    _tracef("BEGIN tries %p", (void *) tree);
-    recur_tries(tree, 0);
-    _tracef(". . . tries %p", (void *) tree);
-    free(my_buffer);
+    if ((my_buffer = typeMalloc(unsigned char, my_length = 80)) != 0) {
+	_tracef("BEGIN tries %p", (void *) tree);
+	recur_tries(tree, 0);
+	_tracef(". . . tries %p", (void *) tree);
+	free(my_buffer);
+    }
 }
 
 #else
Index: ncurses/trace/varargs.c
Prereq:  1.8 
--- ncurses-5.9/ncurses/trace/varargs.c	2008-11-16 00:19:59.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/trace/varargs.c	2012-10-27 21:03:28.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 2001-2007,2008 Free Software Foundation, Inc.              *
+ * Copyright (c) 2001-2008,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -34,7 +34,7 @@
 
 #include <ctype.h>
 
-MODULE_ID("$Id: varargs.c,v 1.8 2008/11/16 00:19:59 juergen Exp $")
+MODULE_ID("$Id: varargs.c,v 1.11 2012/10/27 21:03:28 tom Exp $")
 
 #ifdef TRACE
 
@@ -149,25 +149,32 @@
 			param = buffer;
 			switch (used) {
 			case atInteger:
-			    sprintf(buffer, "%d", ival);
+			    _nc_SPRINTF(buffer, _nc_SLIMIT(sizeof(buffer))
+					"%d", ival);
 			    break;
 			case atFloat:
-			    sprintf(buffer, "%f", fval);
+			    _nc_SPRINTF(buffer, _nc_SLIMIT(sizeof(buffer))
+					"%f", fval);
 			    break;
 			case atPoint:
-			    sprintf(buffer, "%p", pval);
+			    _nc_SPRINTF(buffer, _nc_SLIMIT(sizeof(buffer))
+					"%p", pval);
 			    break;
 			case atString:
 			    param = _nc_visbuf2(1, sval);
 			    break;
 			case atUnknown:
 			default:
-			    strcpy(buffer, "?");
+			    _nc_STRCPY(buffer, "?", sizeof(buffer));
 			    break;
 			}
 			MyLength += strlen(param) + 2;
 			MyBuffer = typeRealloc(char, MyLength, MyBuffer);
-			sprintf(MyBuffer + strlen(MyBuffer), ", %s", param);
+			if (MyBuffer != 0) {
+			    _nc_SPRINTF(MyBuffer + strlen(MyBuffer),
+					_nc_SLIMIT(MyLength - strlen(MyBuffer))
+					", %s", param);
+			}
 		    }
 		}
 		used = atUnknown;
@@ -177,7 +184,7 @@
 	}
     }
 
-    return (MyBuffer);
+    return (MyBuffer ? MyBuffer : dummy);
 }
 #else
 EMPTY_MODULE(_nc_varargs)
Index: ncurses/trace/visbuf.c
Prereq:  1.37 
--- ncurses-5.9/ncurses/trace/visbuf.c	2010-05-29 18:51:41.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/trace/visbuf.c	2012-10-27 20:58:50.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 2001-2009,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 2001-2011,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -42,7 +42,7 @@
 #include <tic.h>
 #include <ctype.h>
 
-MODULE_ID("$Id: visbuf.c,v 1.37 2010/05/29 18:51:41 tom Exp $")
+MODULE_ID("$Id: visbuf.c,v 1.42 2012/10/27 20:58:50 tom Exp $")
 
 #define NUM_VISBUFS 4
 
@@ -55,8 +55,16 @@
 static const char r_brace[] = StringOf(R_BRACE);
 #endif
 
+#if USE_STRING_HACKS && HAVE_SNPRINTF
+#define VisChar(tp, chr, limit) _nc_vischar(tp, chr, limit)
+#define LIMIT_ARG ,size_t limit
+#else
+#define VisChar(tp, chr, limit) _nc_vischar(tp, chr)
+#define LIMIT_ARG		/* nothing */
+#endif
+
 static char *
-_nc_vischar(char *tp, unsigned c)
+_nc_vischar(char *tp, unsigned c LIMIT_ARG)
 {
     if (c == '"' || c == '\\') {
 	*tp++ = '\\';
@@ -84,7 +92,8 @@
 	*tp++ = '^';
 	*tp++ = (char) ('@' + c);
     } else {
-	sprintf(tp, "\\%03lo", (unsigned long) ChCharOf(c));
+	_nc_SPRINTF(tp, _nc_SLIMIT(limit)
+		    "\\%03lo", (unsigned long) ChCharOf(c));
 	tp += strlen(tp);
     }
     *tp = 0;
@@ -97,6 +106,7 @@
     const char *vbuf = 0;
     char *tp;
     int c;
+    int count;
 
     if (buf == 0)
 	return ("(null)");
@@ -106,6 +116,7 @@
     if (len < 0)
 	len = (int) strlen(buf);
 
+    count = len;
 #ifdef TRACE
     vbuf = tp = _nc_trace_buf(bufnum, NormalLen(len));
 #else
@@ -124,8 +135,8 @@
 #endif
     if (tp != 0) {
 	*tp++ = D_QUOTE;
-	while ((--len >= 0) && (c = *buf++) != '\0') {
-	    tp = _nc_vischar(tp, UChar(c));
+	while ((--count >= 0) && (c = *buf++) != '\0') {
+	    tp = VisChar(tp, UChar(c), NormalLen(len));
 	}
 	*tp++ = D_QUOTE;
 	*tp = '\0';
@@ -175,6 +186,7 @@
     const char *vbuf;
     char *tp;
     wchar_t c;
+    int count;
 
     if (buf == 0)
 	return ("(null)");
@@ -182,6 +194,7 @@
     if (len < 0)
 	len = (int) wcslen(buf);
 
+    count = len;
 #ifdef TRACE
     vbuf = tp = _nc_trace_buf(bufnum, WideLen(len));
 #else
@@ -193,15 +206,16 @@
 #endif
     if (tp != 0) {
 	*tp++ = D_QUOTE;
-	while ((--len >= 0) && (c = *buf++) != '\0') {
+	while ((--count >= 0) && (c = *buf++) != '\0') {
 	    char temp[CCHARW_MAX + 80];
 	    int j = wctomb(temp, c), k;
 	    if (j <= 0) {
-		sprintf(temp, "\\u%08X", (unsigned) c);
+		_nc_SPRINTF(temp, _nc_SLIMIT(sizeof(temp))
+			    "\\u%08X", (unsigned) c);
 		j = (int) strlen(temp);
 	    }
 	    for (k = 0; k < j; ++k) {
-		tp = _nc_vischar(tp, UChar(temp[k]));
+		tp = VisChar(tp, UChar(temp[k]), WideLen(len));
 	    }
 	}
 	*tp++ = D_QUOTE;
@@ -248,10 +262,12 @@
 	else
 	    mybuf = typeMalloc(wchar_t, mylen);
     }
-    for (n = 0; buf[n] != 0; ++n) {
-	mybuf[n] = (wchar_t) buf[n];
+    if (mybuf != 0) {
+	for (n = 0; buf[n] != 0; ++n) {
+	    mybuf[n] = (wchar_t) buf[n];
+	}
+	mybuf[n] = L'\0';
     }
-    mybuf[n] = L'\0';
 
     return _nc_viswbuf2(0, mybuf);
 }
@@ -261,7 +277,7 @@
 NCURSES_EXPORT(const char *)
 _nc_viscbuf2(int bufnum, const NCURSES_CH_T * buf, int len)
 {
-    char *result = _nc_trace_buf(bufnum, BUFSIZ);
+    char *result = _nc_trace_buf(bufnum, (size_t) BUFSIZ);
     int first;
     const char *found;
 
@@ -315,7 +331,7 @@
 			    break;
 			for (k = 0; k < PUTC_n; k++) {
 			    char temp[80];
-			    _nc_vischar(temp, UChar(PUTC_buf[k]));
+			    VisChar(temp, UChar(PUTC_buf[k]), sizeof(temp));
 			    (void) _nc_trace_bufcat(bufnum, temp);
 			}
 		    }
@@ -323,8 +339,8 @@
 #else
 		{
 		    char temp[80];
-		    _nc_vischar(temp, UChar(buf[j]));
-		    result = _nc_trace_bufcat(bufnum, temp);
+		    VisChar(temp, UChar(buf[j]), sizeof(temp));
+		    (void) _nc_trace_bufcat(bufnum, temp);
 		}
 #endif /* USE_WIDEC_SUPPORT */
 	    }
Index: ncurses/tty/hardscroll.c
Prereq:  1.47 
--- ncurses-5.9/ncurses/tty/hardscroll.c	2010-04-24 23:46:47.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/tty/hardscroll.c	2012-10-17 09:01:10.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -147,7 +147,7 @@
 
 #include <curses.priv.h>
 
-MODULE_ID("$Id: hardscroll.c,v 1.47 2010/04/24 23:46:47 tom Exp $")
+MODULE_ID("$Id: hardscroll.c,v 1.51 2012/10/17 09:01:10 tom Exp $")
 
 #if defined(SCROLLDEBUG) || defined(HASHDEBUG)
 
@@ -173,9 +173,9 @@
 # if USE_HASHMAP
 #  define oldnums(sp)   (sp)->_oldnum_list
 #  define OLDNUM(sp,n)	oldnums(sp)[n]
-# else				/* !USE_HASHMAP */
+# else /* !USE_HASHMAP */
 #  define OLDNUM(sp,n)	NewScreen(sp)->_line[n].oldindex
-# endif				/* !USE_HASHMAP */
+# endif	/* !USE_HASHMAP */
 
 #define OLDNUM_SIZE(sp) (sp)->_oldnum_size
 
@@ -193,14 +193,20 @@
 #if !defined(SCROLLDEBUG) && !defined(HASHDEBUG)
 #if USE_HASHMAP
     /* get enough storage */
-    if (OLDNUM_SIZE(SP_PARM) < screen_lines(SP_PARM)) {
+    assert(OLDNUM_SIZE(SP_PARM) >= 0);
+    assert(screen_lines(SP_PARM) > 0);
+    if ((oldnums(SP_PARM) == 0)
+	|| (OLDNUM_SIZE(SP_PARM) < screen_lines(SP_PARM))) {
+	int need_lines = ((OLDNUM_SIZE(SP_PARM) < screen_lines(SP_PARM))
+			  ? screen_lines(SP_PARM)
+			  : OLDNUM_SIZE(SP_PARM));
 	int *new_oldnums = typeRealloc(int,
-				       (size_t) screen_lines(SP_PARM),
+				       (size_t) need_lines,
 				       oldnums(SP_PARM));
 	if (!new_oldnums)
 	    return;
 	oldnums(SP_PARM) = new_oldnums;
-	OLDNUM_SIZE(SP_PARM) = screen_lines(SP_PARM);
+	OLDNUM_SIZE(SP_PARM) = need_lines;
     }
     /* calculate the indices */
     NCURSES_SP_NAME(_nc_hash_map) (NCURSES_SP_ARG);
@@ -302,7 +308,9 @@
 
 	*buf = '\0';
 	for (n = 0; n < screen_lines(SP_PARM); n++)
-	    (void) sprintf(buf + strlen(buf), " %02d", OLDNUM(SP_PARM, n));
+	    _nc_SPRINTF(buf + strlen(buf),
+			_nc_SLIMIT(want - strlen(buf))
+			" %02d", OLDNUM(SP_PARM, n));
 	TR(TRACE_UPDATE | TRACE_MOVE, ("virt %s", buf));
 	free(buf);
     }
Index: ncurses/tty/hashmap.c
Prereq:  1.62 
--- ncurses-5.9/ncurses/tty/hashmap.c	2010-04-24 23:46:07.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/tty/hashmap.c	2011-10-22 16:34:50.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2010,2011 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -73,7 +73,7 @@
 #define CUR SP_TERMTYPE
 #endif
 
-MODULE_ID("$Id: hashmap.c,v 1.62 2010/04/24 23:46:07 tom Exp $")
+MODULE_ID("$Id: hashmap.c,v 1.63 2011/10/22 16:34:50 tom Exp $")
 
 #ifdef HASHDEBUG
 
@@ -163,7 +163,7 @@
  * effective. 'blank' indicates whether the line 'to' would become blank.
  */
 static NCURSES_INLINE bool
-cost_effective(SCREEN *sp, const int from, const int to, const bool blank)
+cost_effective(SCREEN *sp, const int from, const int to, const int blank)
 {
     int new_from;
 
Index: ncurses/tty/lib_mvcur.c
Prereq:  1.126 
--- ncurses-5.9/ncurses/tty/lib_mvcur.c	2011-01-22 19:48:21.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/tty/lib_mvcur.c	2013-01-27 01:40:01.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2010,2011 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -159,7 +159,7 @@
 #define CUR SP_TERMTYPE
 #endif
 
-MODULE_ID("$Id: lib_mvcur.c,v 1.126 2011/01/22 19:48:21 tom Exp $")
+MODULE_ID("$Id: lib_mvcur.c,v 1.132 2013/01/27 01:40:01 tom Exp $")
 
 #define WANT_CHAR(sp, y, x) NewScreen(sp)->_line[y].text[x]	/* desired state */
 
@@ -176,6 +176,9 @@
 static float diff;
 #endif /* MAIN */
 
+#undef NCURSES_OUTC_FUNC
+#define NCURSES_OUTC_FUNC myOutCh
+
 #define OPT_SIZE 512
 
 static int normalized_cost(NCURSES_SP_DCLx const char *const cap, int affcnt);
@@ -274,10 +277,9 @@
 /* Set the scroll-region to a known state (the default) */
 {
     if (change_scroll_region) {
-	NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx
-				   "change_scroll_region",
-				   TPARM_2(change_scroll_region,
-					   0, screen_lines(SP_PARM) - 1));
+	NCURSES_PUTP2("change_scroll_region",
+		      TPARM_2(change_scroll_region,
+			      0, screen_lines(SP_PARM) - 1));
     }
 }
 
@@ -285,14 +287,12 @@
 NCURSES_SP_NAME(_nc_mvcur_resume) (NCURSES_SP_DCL0)
 /* what to do at initialization time and after each shellout */
 {
-    if (SP_PARM && !IsTermInfo(SP_PARM))
+    if (!SP_PARM || !IsTermInfo(SP_PARM))
 	return;
 
     /* initialize screen for cursor access */
     if (enter_ca_mode) {
-	NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx
-				   "enter_ca_mode",
-				   enter_ca_mode);
+	NCURSES_PUTP2("enter_ca_mode", enter_ca_mode);
     }
 
     /*
@@ -327,13 +327,14 @@
 NCURSES_SP_NAME(_nc_mvcur_init) (NCURSES_SP_DCL0)
 /* initialize the cost structure */
 {
-    if (SP_PARM->_ofp && isatty(fileno(SP_PARM->_ofp)))
+    if (SP_PARM->_ofp && isatty(fileno(SP_PARM->_ofp))) {
 	SP_PARM->_char_padding = ((BAUDBYTE * 1000 * 10)
 				  / (BAUDRATE(SP_PARM) > 0
 				     ? BAUDRATE(SP_PARM)
 				     : 9600));
-    else
+    } else {
 	SP_PARM->_char_padding = 1;	/* must be nonzero */
+    }
     if (SP_PARM->_char_padding <= 0)
 	SP_PARM->_char_padding = 1;	/* must be nonzero */
     TR(TRACE_CHARPUT | TRACE_MOVE, ("char_padding %d msecs", SP_PARM->_char_padding));
@@ -481,9 +482,7 @@
     }
 
     if (exit_ca_mode) {
-	NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx
-				   "exit_ca_mode",
-				   exit_ca_mode);
+	NCURSES_PUTP2("exit_ca_mode", exit_ca_mode);
     }
     /*
      * Reset terminal's tab counter.  There's a long-time bug that
@@ -549,7 +548,7 @@
 	      int from_x,
 	      int to_y,
 	      int to_x,
-	      bool ovw)
+	      int ovw)
 /* move via local motions (cuu/cuu1/cud/cud1/cub1/cub/cuf1/cuf/vpa/hpa) */
 {
     string_desc save;
@@ -770,7 +769,10 @@
  */
 
 static NCURSES_INLINE int
-onscreen_mvcur(NCURSES_SP_DCLx int yold, int xold, int ynew, int xnew, bool ovw)
+onscreen_mvcur(NCURSES_SP_DCLx
+	       int yold, int xold,
+	       int ynew, int xnew, int ovw,
+	       NCURSES_SP_OUTC myOutCh)
 /* onscreen move from (yold, xold) to (ynew, xnew) */
 {
     string_desc result;
@@ -935,7 +937,7 @@
     if (usecost != INFINITY) {
 	TPUTS_TRACE("mvcur");
 	NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx
-				buffer, 1, NCURSES_SP_NAME(_nc_outch));
+				buffer, 1, myOutCh);
 	SP_PARM->_cursrow = ynew;
 	SP_PARM->_curscol = xnew;
 	return (OK);
@@ -943,9 +945,14 @@
 	return (ERR);
 }
 
-NCURSES_EXPORT(int)
-TINFO_MVCUR(NCURSES_SP_DCLx int yold, int xold, int ynew, int xnew)
-/* optimized cursor move from (yold, xold) to (ynew, xnew) */
+/*
+ * optimized cursor move from (yold, xold) to (ynew, xnew)
+ */
+static int
+_nc_real_mvcur(NCURSES_SP_DCLx
+	       int yold, int xold,
+	       int ynew, int xnew,
+	       NCURSES_SP_OUTC myOutCh)
 {
     NCURSES_CH_T oldattr;
     int code;
@@ -994,20 +1001,16 @@
 
 		if (l > 0) {
 		    if (carriage_return) {
-			NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx
-						   "carriage_return",
-						   carriage_return);
+			NCURSES_PUTP2("carriage_return", carriage_return);
 		    } else
-			NCURSES_SP_NAME(_nc_outch) (NCURSES_SP_ARGx '\r');
+			myOutCh(NCURSES_SP_ARGx '\r');
 		    xold = 0;
 
 		    while (l > 0) {
 			if (newline) {
-			    NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx
-						       "newline",
-						       newline);
+			    NCURSES_PUTP2("newline", newline);
 			} else
-			    NCURSES_SP_NAME(_nc_outch) (NCURSES_SP_ARGx '\n');
+			    myOutCh(NCURSES_SP_ARGx '\n');
 			l--;
 		    }
 		}
@@ -1027,7 +1030,7 @@
 	    ynew = screen_lines(SP_PARM) - 1;
 
 	/* destination location is on screen now */
-	code = onscreen_mvcur(NCURSES_SP_ARGx yold, xold, ynew, xnew, TRUE);
+	code = onscreen_mvcur(NCURSES_SP_ARGx yold, xold, ynew, xnew, TRUE, myOutCh);
 
 	/*
 	 * Restore attributes if we disabled them before moving.
@@ -1042,13 +1045,63 @@
     returnCode(code);
 }
 
-#if NCURSES_SP_FUNCS && !defined(USE_TERM_DRIVER)
+/*
+ * These entrypoints are used within the library.
+ */
+NCURSES_EXPORT(int)
+NCURSES_SP_NAME(_nc_mvcur) (NCURSES_SP_DCLx
+			    int yold, int xold,
+			    int ynew, int xnew)
+{
+    return _nc_real_mvcur(NCURSES_SP_ARGx yold, xold, ynew, xnew,
+			  NCURSES_SP_NAME(_nc_outch));
+}
+
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(int)
+_nc_mvcur(int yold, int xold,
+	  int ynew, int xnew)
+{
+    return NCURSES_SP_NAME(_nc_mvcur) (CURRENT_SCREEN, yold, xold, ynew, xnew);
+}
+#endif
+
+#if defined(USE_TERM_DRIVER)
+/*
+ * The terminal driver does not support the external "mvcur()".
+ */
+NCURSES_EXPORT(int)
+TINFO_MVCUR(NCURSES_SP_DCLx int yold, int xold, int ynew, int xnew)
+{
+    return _nc_real_mvcur(NCURSES_SP_ARGx
+			  yold, xold,
+			  ynew, xnew,
+			  NCURSES_SP_NAME(_nc_outch));
+}
+
+#else /* !USE_TERM_DRIVER */
+
+/*
+ * These entrypoints support users of the library.
+ */
+NCURSES_EXPORT(int)
+NCURSES_SP_NAME(mvcur) (NCURSES_SP_DCLx int yold, int xold, int ynew,
+			int xnew)
+{
+    return _nc_real_mvcur(NCURSES_SP_ARGx
+			  yold, xold,
+			  ynew, xnew,
+			  NCURSES_SP_NAME(_nc_putchar));
+}
+
+#if NCURSES_SP_FUNCS
 NCURSES_EXPORT(int)
 mvcur(int yold, int xold, int ynew, int xnew)
 {
     return NCURSES_SP_NAME(mvcur) (CURRENT_SCREEN, yold, xold, ynew, xnew);
 }
 #endif
+#endif /* USE_TERM_DRIVER */
 
 #if defined(TRACE) || defined(NCURSES_TEST)
 NCURSES_EXPORT_VAR(int) _nc_optimize_enable = OPTIMIZE_ALL;
Index: ncurses/tty/lib_tstp.c
Prereq:  1.41 
--- ncurses-5.9/ncurses/tty/lib_tstp.c	2010-05-15 21:31:12.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/tty/lib_tstp.c	2013-04-27 19:50:17.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -42,11 +42,7 @@
 
 #include <SigAction.h>
 
-#if SVR4_ACTION && !defined(_POSIX_SOURCE)
-#define _POSIX_SOURCE
-#endif
-
-MODULE_ID("$Id: lib_tstp.c,v 1.41 2010/05/15 21:31:12 tom Exp $")
+MODULE_ID("$Id: lib_tstp.c,v 1.47 2013/04/27 19:50:17 tom Exp $")
 
 #if defined(SIGTSTP) && (HAVE_SIGACTION || HAVE_SIGVEC)
 #define USE_SIGTSTP 1
@@ -138,7 +134,7 @@
 
 #if USE_SIGTSTP
 static void
-tstp(int dummy GCC_UNUSED)
+handle_SIGTSTP(int dummy GCC_UNUSED)
 {
     SCREEN *sp = CURRENT_SCREEN;
     sigset_t mask, omask;
@@ -148,7 +144,8 @@
     int sigttou_blocked;
 #endif
 
-    T(("tstp() called"));
+    _nc_globals.have_sigtstp = 1;
+    T(("handle_SIGTSTP() called"));
 
     /*
      * The user may have changed the prog_mode tty bits, so save them.
@@ -239,21 +236,24 @@
 #endif /* USE_SIGTSTP */
 
 static void
-cleanup(int sig)
+handle_SIGINT(int sig)
 {
     SCREEN *sp = CURRENT_SCREEN;
 
     /*
-     * Actually, doing any sort of I/O from within an signal handler is
-     * "unsafe".  But we'll _try_ to clean up the screen and terminal
-     * settings on the way out.
+     * Much of this is unsafe from a signal handler.  But we'll _try_ to clean
+     * up the screen and terminal settings on the way out.
+     *
+     * There are at least the following problems:
+     * 1) Walking the SCREEN list is unsafe, since all list management
+     *    is done without any signal blocking.
+     * 2) On systems which have REENTRANT turned on, set_term() uses
+     *    _nc_lock_global() which could deadlock or misbehave in other ways.
+     * 3) endwin() calls all sorts of stuff, many of which use stdio or
+     *    other library functions which are clearly unsafe.
      */
     if (!_nc_globals.cleanup_nested++
-	&& (sig == SIGINT
-#ifdef SIGQUIT
-	    || sig == SIGQUIT
-#endif
-	)) {
+	&& (sig == SIGINT || sig == SIGTERM)) {
 #if HAVE_SIGACTION || HAVE_SIGVEC
 	sigaction_t act;
 	sigemptyset(&act.sa_mask);
@@ -268,22 +268,21 @@
 	    for (each_screen(scan)) {
 		if (scan->_ofp != 0
 		    && isatty(fileno(scan->_ofp))) {
-		    scan->_cleanup = TRUE;
 		    scan->_outch = NCURSES_SP_NAME(_nc_outch);
 		}
 		set_term(scan);
 		NCURSES_SP_NAME(endwin) (NCURSES_SP_ARG);
 		if (sp)
-		    sp->_endwin = FALSE;	/* in case we have an atexit! */
+		    sp->_endwin = FALSE;	/* in case of reuse */
 	    }
 	}
     }
-    exit(EXIT_FAILURE);
+    _exit(EXIT_FAILURE);
 }
 
 #if USE_SIGWINCH
 static void
-sigwinch(int sig GCC_UNUSED)
+handle_SIGWINCH(int sig GCC_UNUSED)
 {
     _nc_globals.have_sigwinch = 1;
 # if USE_PTHREADS_EINTR
@@ -301,7 +300,7 @@
  * handler.
  */
 static int
-CatchIfDefault(int sig, RETSIGTYPE (*handler) (int))
+CatchIfDefault(int sig, void (*handler) (int))
 {
     int result;
 #if HAVE_SIGACTION || HAVE_SIGVEC
@@ -331,7 +330,7 @@
 	result = FALSE;
     }
 #else /* !HAVE_SIGACTION */
-    RETSIGTYPE (*ohandler) (int);
+    void (*ohandler) (int);
 
     ohandler = signal(sig, SIG_IGN);
     if (ohandler == SIG_DFL
@@ -364,7 +363,7 @@
  * the caller later changes its mind, but that doesn't seem correct.
  */
 NCURSES_EXPORT(void)
-_nc_signal_handler(bool enable)
+_nc_signal_handler(int enable)
 {
     T((T_CALLED("_nc_signal_handler(%d)"), enable));
 #if USE_SIGTSTP			/* Xenix 2.x doesn't have SIGTSTP, for example */
@@ -385,7 +384,7 @@
 #ifdef SA_RESTART
 		new_sigaction.sa_flags |= SA_RESTART;
 #endif /* SA_RESTART */
-		new_sigaction.sa_handler = tstp;
+		new_sigaction.sa_handler = handle_SIGTSTP;
 		(void) sigaction(SIGTSTP, &new_sigaction, NULL);
 	    } else {
 		ignore_tstp = TRUE;
@@ -396,10 +395,10 @@
 
     if (!_nc_globals.init_signals) {
 	if (enable) {
-	    CatchIfDefault(SIGINT, cleanup);
-	    CatchIfDefault(SIGTERM, cleanup);
+	    CatchIfDefault(SIGINT, handle_SIGINT);
+	    CatchIfDefault(SIGTERM, handle_SIGINT);
 #if USE_SIGWINCH
-	    CatchIfDefault(SIGWINCH, sigwinch);
+	    CatchIfDefault(SIGWINCH, handle_SIGWINCH);
 #endif
 	    _nc_globals.init_signals = TRUE;
 	}
Index: ncurses/tty/lib_twait.c
Prereq:  1.61 
--- ncurses-5.9/ncurses/tty/lib_twait.c	2010-12-25 23:43:58.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/tty/lib_twait.c	2013-02-18 09:22:27.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -53,6 +53,11 @@
 #include <OS.h>
 #endif
 
+#if USE_KLIBC_KBD
+#define INCL_KBD
+#include <os2.h>
+#endif
+
 #if USE_FUNC_POLL
 # if HAVE_SYS_TIME_H
 #  include <sys/time.h>
@@ -70,10 +75,10 @@
 #endif
 #undef CUR
 
-MODULE_ID("$Id: lib_twait.c,v 1.61 2010/12/25 23:43:58 tom Exp $")
+MODULE_ID("$Id: lib_twait.c,v 1.67 2013/02/18 09:22:27 tom Exp $")
 
 static long
-_nc_gettime(TimeType * t0, bool first)
+_nc_gettime(TimeType * t0, int first)
 {
     long res;
 
@@ -184,6 +189,12 @@
     fd_set set;
 #endif
 
+#if USE_KLIBC_KBD
+    fd_set saved_set;
+    KBDKEYINFO ki;
+    struct timeval tv;
+#endif
+
     long starttime, returntime;
 
     TR(TRACE_IEVENT, ("start twait: %d milliseconds, mode: %d",
@@ -207,6 +218,7 @@
     starttime = _nc_gettime(&t0, TRUE);
 
     count = 0;
+    (void) count;
 
 #ifdef NCURSES_WGETCH_EVENTS
     if ((mode & TW_EVENT) && evl)
@@ -217,8 +229,11 @@
     memset(fd_list, 0, sizeof(fd_list));
 
 #ifdef NCURSES_WGETCH_EVENTS
-    if ((mode & TW_EVENT) && evl)
+    if ((mode & TW_EVENT) && evl) {
 	fds = typeMalloc(struct pollfd, MIN_FDS + evl->count);
+	if (fds == 0)
+	    return TW_NONE;
+    }
 #endif
 
     if (mode & TW_INPUT) {
@@ -247,7 +262,7 @@
     }
 #endif
 
-    result = poll(fds, (unsigned) count, milliseconds);
+    result = poll(fds, (size_t) count, milliseconds);
 
 #ifdef NCURSES_WGETCH_EVENTS
     if ((mode & TW_EVENT) && evl) {
@@ -274,10 +289,6 @@
 	    }
 	}
     }
-
-    if (fds != fd_list)
-	free((char *) fds);
-
 #endif
 
 #elif defined(__BEOS__)
@@ -329,10 +340,12 @@
      */
     FD_ZERO(&set);
 
+#if !USE_KLIBC_KBD
     if (mode & TW_INPUT) {
 	FD_SET(sp->_ifd, &set);
 	count = sp->_ifd + 1;
     }
+#endif
     if ((mode & TW_MOUSE)
 	&& (fd = sp->_mouse_fd) >= 0) {
 	FD_SET(fd, &set);
@@ -352,6 +365,31 @@
     }
 #endif
 
+#if USE_KLIBC_KBD
+    for (saved_set = set;; set = saved_set) {
+	if ((mode & TW_INPUT)
+	    && (sp->_extended_key
+		|| (KbdPeek(&ki, 0) == 0
+		    && (ki.fbStatus & KBDTRF_FINAL_CHAR_IN)))) {
+	    FD_ZERO(&set);
+	    FD_SET(sp->_ifd, &set);
+	    result = 1;
+	    break;
+	}
+
+	tv.tv_sec = 0;
+	tv.tv_usec = (milliseconds == 0) ? 0 : (10 * 1000);
+
+	if ((result = select(count, &set, NULL, NULL, &tv)) != 0)
+	    break;
+
+	/* Time out ? */
+	if (milliseconds >= 0 && _nc_gettime(&t0, FALSE) >= milliseconds) {
+	    result = 0;
+	    break;
+	}
+    }
+#else
     if (milliseconds >= 0) {
 	struct timeval ntimeout;
 	ntimeout.tv_sec = milliseconds / 1000;
@@ -360,6 +398,7 @@
     } else {
 	result = select(count, &set, NULL, NULL, NULL);
     }
+#endif
 
 #ifdef NCURSES_WGETCH_EVENTS
     if ((mode & TW_EVENT) && evl) {
@@ -462,5 +501,12 @@
 	result |= TW_EVENT;
 #endif
 
+#if USE_FUNC_POLL
+#ifdef NCURSES_WGETCH_EVENTS
+    if (fds != fd_list)
+	free((char *) fds);
+#endif
+#endif
+
     return (result);
 }
Index: ncurses/tty/lib_vidattr.c
Prereq:  1.61 
--- ncurses-5.9/ncurses/tty/lib_vidattr.c	2010-06-05 22:22:04.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/tty/lib_vidattr.c	2013-01-12 18:00:54.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2011,2013 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -69,7 +69,7 @@
 #define CUR SP_TERMTYPE
 #endif
 
-MODULE_ID("$Id: lib_vidattr.c,v 1.61 2010/06/05 22:22:04 tom Exp $")
+MODULE_ID("$Id: lib_vidattr.c,v 1.63 2013/01/12 18:00:54 tom Exp $")
 
 #define doPut(mode) \
 	TPUTS_TRACE(#mode); \
@@ -324,7 +324,7 @@
     T((T_CALLED("vidattr(%p,%s)"), (void *) SP_PARM, _traceattr(newmode)));
     returnCode(NCURSES_SP_NAME(vidputs) (NCURSES_SP_ARGx
 					 newmode,
-					 NCURSES_SP_NAME(_nc_outch)));
+					 NCURSES_SP_NAME(_nc_putchar)));
 }
 
 #if NCURSES_SP_FUNCS
@@ -341,42 +341,44 @@
     chtype attrs = A_NORMAL;
 
     T((T_CALLED("termattrs(%p)"), (void *) SP_PARM));
+
+    if (HasTerminal(SP_PARM)) {
 #ifdef USE_TERM_DRIVER
-    if (HasTerminal(SP_PARM))
 	attrs = CallDriver(SP_PARM, conattr);
 #else
 
-    if (enter_alt_charset_mode)
-	attrs |= A_ALTCHARSET;
+	if (enter_alt_charset_mode)
+	    attrs |= A_ALTCHARSET;
 
-    if (enter_blink_mode)
-	attrs |= A_BLINK;
+	if (enter_blink_mode)
+	    attrs |= A_BLINK;
 
-    if (enter_bold_mode)
-	attrs |= A_BOLD;
+	if (enter_bold_mode)
+	    attrs |= A_BOLD;
 
-    if (enter_dim_mode)
-	attrs |= A_DIM;
+	if (enter_dim_mode)
+	    attrs |= A_DIM;
 
-    if (enter_reverse_mode)
-	attrs |= A_REVERSE;
+	if (enter_reverse_mode)
+	    attrs |= A_REVERSE;
 
-    if (enter_standout_mode)
-	attrs |= A_STANDOUT;
+	if (enter_standout_mode)
+	    attrs |= A_STANDOUT;
 
-    if (enter_protected_mode)
-	attrs |= A_PROTECT;
+	if (enter_protected_mode)
+	    attrs |= A_PROTECT;
 
-    if (enter_secure_mode)
-	attrs |= A_INVIS;
+	if (enter_secure_mode)
+	    attrs |= A_INVIS;
 
-    if (enter_underline_mode)
-	attrs |= A_UNDERLINE;
+	if (enter_underline_mode)
+	    attrs |= A_UNDERLINE;
 
-    if (SP_PARM->_coloron)
-	attrs |= A_COLOR;
+	if (SP_PARM->_coloron)
+	    attrs |= A_COLOR;
 
 #endif
+    }
     returnChtype(attrs);
 }
 
Index: ncurses/tty/tty_update.c
Prereq:  1.264 
--- ncurses-5.9/ncurses/tty/tty_update.c	2010-12-19 01:21:02.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/tty/tty_update.c	2013-02-16 21:12:02.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -82,7 +82,7 @@
 
 #include <ctype.h>
 
-MODULE_ID("$Id: tty_update.c,v 1.264 2010/12/19 01:21:02 tom Exp $")
+MODULE_ID("$Id: tty_update.c,v 1.276 2013/02/16 21:12:02 tom Exp $")
 
 /*
  * This define controls the line-breakout optimization.  Every once in a
@@ -145,8 +145,7 @@
 
     NCURSES_SP_NAME(_nc_flush) (NCURSES_SP_ARG);
     memset(buf, '\0', sizeof(buf));
-    NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx "\033[6n");	/* only works on ANSI-compatibles */
-    NCURSES_SP_NAME(_nc_flush) (NCURSES_SP_ARG);
+    NCURSES_PUTP2_FLUSH("cpr", "\033[6n");	/* only works on ANSI-compatibles */
     *(s = buf) = 0;
     do {
 	int ask = sizeof(buf) - 1 - (s - buf);
@@ -209,7 +208,9 @@
 {
     int chlen = 1;
     NCURSES_CH_T my_ch;
+#if USE_WIDEC_SUPPORT
     PUTC_DATA;
+#endif
     NCURSES_CH_T tilde;
     NCURSES_CH_T attr = CHDEREF(ch);
 
@@ -276,6 +277,11 @@
 	    && SP_PARM->_screen_acs_map[CharOf(my_ch)]) {
 	    RemAttr(attr, A_ALTCHARSET);
 	    my_ch = _nc_wacs[CharOf(my_ch)];
+	} else if (SP_PARM->_screen_unicode
+		   && !SP_PARM->_screen_acs_map[CharOf(my_ch)]
+		   && _nc_wacs[CharOf(my_ch)].chars[0]) {
+	    RemAttr(attr, A_ALTCHARSET);
+	    my_ch = _nc_wacs[CharOf(my_ch)];
 	}
 #endif
 	/*
@@ -288,13 +294,12 @@
 	    int j = CharOfD(ch);
 	    chtype temp = UChar(SP_PARM->_acs_map[j]);
 
-	    if (!(SP_PARM->_screen_acs_map[j])) {
+	    if (temp != 0) {
+		SetChar(my_ch, temp, AttrOf(attr));
+	    } else {
+		my_ch = CHDEREF(ch);
 		RemAttr(attr, A_ALTCHARSET);
-		if (temp == 0)
-		    temp = ' ';
 	    }
-	    if (temp != 0)
-		SetChar(my_ch, temp, AttrOf(attr));
 	}
 	ch = CHREF(my_ch);
     }
@@ -304,22 +309,13 @@
     }
 
     UpdateAttrs(SP_PARM, attr);
+    PUTC(CHDEREF(ch));
 #if !USE_WIDEC_SUPPORT
-    /* FIXME - we do this special case for signal handling, should see how to
-     * make it work for wide characters.
-     */
-    if (SP_PARM->_outch != 0) {
-	SP_PARM->_outch(NCURSES_SP_ARGx UChar(ch));
-    } else
+    COUNT_OUTCHARS(1);
 #endif
-    {
-	PUTC(CHDEREF(ch), SP_PARM->_ofp);	/* macro's fastest... */
-	COUNT_OUTCHARS(1);
-    }
     SP_PARM->_curscol += chlen;
     if (char_padding) {
-	TPUTS_TRACE("char_padding");
-	NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx char_padding);
+	NCURSES_PUTP2("char_padding", char_padding);
     }
 }
 
@@ -342,7 +338,7 @@
 	struct pollfd fds[1];
 	fds[0].fd = SP_PARM->_checkfd;
 	fds[0].events = POLLIN;
-	if (poll(fds, 1, 0) > 0) {
+	if (poll(fds, (size_t) 1, 0) > 0) {
 	    have_pending = TRUE;
 	}
 #elif defined(__BEOS__)
@@ -390,8 +386,7 @@
 	PutAttrChar(NCURSES_SP_ARGx ch);
     } else if (enter_am_mode && exit_am_mode) {
 	/* we can suppress automargin */
-	TPUTS_TRACE("exit_am_mode");
-	NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx exit_am_mode);
+	NCURSES_PUTP2("exit_am_mode", exit_am_mode);
 
 	PutAttrChar(NCURSES_SP_ARGx ch);
 	SP_PARM->_curscol--;
@@ -400,8 +395,7 @@
 		       SP_PARM->_curscol,
 		       "exit_am_mode");
 
-	TPUTS_TRACE("enter_am_mode");
-	NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx enter_am_mode);
+	NCURSES_PUTP2("enter_am_mode", enter_am_mode);
     } else if ((enter_insert_mode && exit_insert_mode)
 	       || insert_character || parm_ich) {
 	GoTo(NCURSES_SP_ARGx
@@ -497,11 +491,12 @@
 	    return FALSE;
 	if ((pair = GetPair(CHDEREF(ch))) != 0) {
 	    short fg, bg;
-	    NCURSES_SP_NAME(pair_content) (NCURSES_SP_ARGx
-					   (short) pair,
-					   &fg, &bg);
-	    if (fg != C_MASK || bg != C_MASK)
+	    if (NCURSES_SP_NAME(pair_content) (NCURSES_SP_ARGx
+					       (short) pair,
+					       &fg, &bg) == ERR
+		|| (fg != C_MASK || bg != C_MASK)) {
 		return FALSE;
+	    }
 	}
 #else
 	if (AttrOfD(ch) & A_COLOR)
@@ -563,8 +558,7 @@
 		&& runcount > SP_PARM->_ech_cost + SP_PARM->_cup_ch_cost
 		&& can_clear_with(NCURSES_SP_ARGx CHREF(ntext0))) {
 		UpdateAttrs(SP_PARM, ntext0);
-		NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx
-				       TPARM_1(erase_chars, runcount));
+		NCURSES_PUTP2("erase_chars", TPARM_1(erase_chars, runcount));
 
 		/*
 		 * If this is the last part of the given interval,
@@ -677,6 +671,9 @@
 
     T((T_CALLED("_nc_tinfo:doupdate(%p)"), (void *) SP_PARM));
 
+    if (SP_PARM == 0)
+	returnCode(ERR);
+
 #if !USE_REENTRANT
     /*
      * It is "legal" but unlikely that an application could assign a new
@@ -1076,32 +1073,29 @@
 */
 
 static void
-ClrToEOL(NCURSES_SP_DCLx NCURSES_CH_T blank, bool needclear)
+ClrToEOL(NCURSES_SP_DCLx NCURSES_CH_T blank, int needclear)
 {
     int j;
 
-    if (SP_PARM != 0) {
-	if (CurScreen(SP_PARM) != 0
-	    && SP_PARM->_cursrow >= 0) {
-	    for (j = SP_PARM->_curscol; j < screen_columns(SP_PARM); j++) {
-		if (j >= 0) {
-		    NCURSES_CH_T *cp =
-		    &(CurScreen(SP_PARM)->_line[SP_PARM->_cursrow].text[j]);
-
-		    if (!CharEq(*cp, blank)) {
-			*cp = blank;
-			needclear = TRUE;
-		    }
+    if (CurScreen(SP_PARM) != 0
+	&& SP_PARM->_cursrow >= 0) {
+	for (j = SP_PARM->_curscol; j < screen_columns(SP_PARM); j++) {
+	    if (j >= 0) {
+		NCURSES_CH_T *cp =
+		&(CurScreen(SP_PARM)->_line[SP_PARM->_cursrow].text[j]);
+
+		if (!CharEq(*cp, blank)) {
+		    *cp = blank;
+		    needclear = TRUE;
 		}
 	    }
 	}
     }
 
-    if (needclear && (SP_PARM != 0)) {
+    if (needclear) {
 	UpdateAttrs(SP_PARM, blank);
-	TPUTS_TRACE("clr_eol");
 	if (clr_eol && SP_PARM->_el_cost <= (screen_columns(SP_PARM) - SP_PARM->_curscol)) {
-	    NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx clr_eol);
+	    NCURSES_PUTP2("clr_eol", clr_eol);
 	} else {
 	    int count = (screen_columns(SP_PARM) - SP_PARM->_curscol);
 	    while (count-- > 0)
@@ -1121,12 +1115,14 @@
 {
     int row, col;
 
-    if (0 == SP_PARM)
-	return;
-
     row = SP_PARM->_cursrow;
     col = SP_PARM->_curscol;
 
+    if (row < 0)
+	row = 0;
+    if (col < 0)
+	col = 0;
+
     UpdateAttrs(SP_PARM, blank);
     TPUTS_TRACE("clr_eos");
     NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx
@@ -1370,13 +1366,11 @@
 			&& SP_PARM->_el_cost <= SP_PARM->_el1_cost) {
 			GoTo(NCURSES_SP_ARGx lineno, 0);
 			UpdateAttrs(SP_PARM, blank);
-			TPUTS_TRACE("clr_eol");
-			NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx clr_eol);
+			NCURSES_PUTP2("clr_eol", clr_eol);
 		    } else {
 			GoTo(NCURSES_SP_ARGx lineno, nFirstChar - 1);
 			UpdateAttrs(SP_PARM, blank);
-			TPUTS_TRACE("clr_bol");
-			NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx clr_bol);
+			NCURSES_PUTP2("clr_bol", clr_bol);
 		    }
 
 		    while (firstChar < nFirstChar)
@@ -1574,8 +1568,7 @@
     if (fast_clear) {
 	if (clear_screen) {
 	    UpdateAttrs(SP_PARM, blank);
-	    TPUTS_TRACE("clear_screen");
-	    NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx clear_screen);
+	    NCURSES_PUTP2("clear_screen", clear_screen);
 	    SP_PARM->_cursrow = SP_PARM->_curscol = 0;
 	    position_check(SP_PARM,
 			   SP_PARM->_cursrow,
@@ -1595,8 +1588,7 @@
 	    UpdateAttrs(SP_PARM, blank);
 	    for (i = 0; i < screen_lines(SP_PARM); i++) {
 		GoTo(NCURSES_SP_ARGx i, 0);
-		TPUTS_TRACE("clr_eol");
-		NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx clr_eol);
+		NCURSES_PUTP2("clr_eol", clr_eol);
 	    }
 	    GoTo(NCURSES_SP_ARGx 0, 0);
 	}
@@ -1647,27 +1639,22 @@
 	    count--;
 	}
     } else if (enter_insert_mode && exit_insert_mode) {
-	TPUTS_TRACE("enter_insert_mode");
-	NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx enter_insert_mode);
+	NCURSES_PUTP2("enter_insert_mode", enter_insert_mode);
 	while (count) {
 	    PutAttrChar(NCURSES_SP_ARGx CHREF(*line));
 	    if (insert_padding) {
-		TPUTS_TRACE("insert_padding");
-		NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx insert_padding);
+		NCURSES_PUTP2("insert_padding", insert_padding);
 	    }
 	    line++;
 	    count--;
 	}
-	TPUTS_TRACE("exit_insert_mode");
-	NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx exit_insert_mode);
+	NCURSES_PUTP2("exit_insert_mode", exit_insert_mode);
     } else {
 	while (count) {
-	    TPUTS_TRACE("insert_character");
-	    NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx insert_character);
+	    NCURSES_PUTP2("insert_character", insert_character);
 	    PutAttrChar(NCURSES_SP_ARGx CHREF(*line));
 	    if (insert_padding) {
-		TPUTS_TRACE("insert_padding");
-		NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx insert_padding);
+		NCURSES_PUTP2("insert_padding", insert_padding);
 	    }
 	    line++;
 	    count--;
@@ -1701,8 +1688,7 @@
 				NCURSES_SP_NAME(_nc_outch));
     } else {
 	for (n = 0; n < count; n++) {
-	    TPUTS_TRACE("delete_character");
-	    NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx delete_character);
+	    NCURSES_PUTP2("delete_character", delete_character);
 	}
     }
 }
@@ -1754,13 +1740,11 @@
     if (n == 1 && scroll_forward && top == miny && bot == maxy) {
 	GoTo(NCURSES_SP_ARGx bot, 0);
 	UpdateAttrs(SP_PARM, blank);
-	TPUTS_TRACE("scroll_forward");
-	NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx scroll_forward);
+	NCURSES_PUTP2("scroll_forward", scroll_forward);
     } else if (n == 1 && delete_line && bot == maxy) {
 	GoTo(NCURSES_SP_ARGx top, 0);
 	UpdateAttrs(SP_PARM, blank);
-	TPUTS_TRACE("delete_line");
-	NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx delete_line);
+	NCURSES_PUTP2("delete_line", delete_line);
     } else if (parm_index && top == miny && bot == maxy) {
 	GoTo(NCURSES_SP_ARGx bot, 0);
 	UpdateAttrs(SP_PARM, blank);
@@ -1781,15 +1765,13 @@
 	GoTo(NCURSES_SP_ARGx bot, 0);
 	UpdateAttrs(SP_PARM, blank);
 	for (i = 0; i < n; i++) {
-	    TPUTS_TRACE("scroll_forward");
-	    NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx scroll_forward);
+	    NCURSES_PUTP2("scroll_forward", scroll_forward);
 	}
     } else if (delete_line && bot == maxy) {
 	GoTo(NCURSES_SP_ARGx top, 0);
 	UpdateAttrs(SP_PARM, blank);
 	for (i = 0; i < n; i++) {
-	    TPUTS_TRACE("delete_line");
-	    NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx delete_line);
+	    NCURSES_PUTP2("delete_line", delete_line);
 	}
     } else
 	return ERR;
@@ -1823,13 +1805,11 @@
     if (n == 1 && scroll_reverse && top == miny && bot == maxy) {
 	GoTo(NCURSES_SP_ARGx top, 0);
 	UpdateAttrs(SP_PARM, blank);
-	TPUTS_TRACE("scroll_reverse");
-	NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx scroll_reverse);
+	NCURSES_PUTP2("scroll_reverse", scroll_reverse);
     } else if (n == 1 && insert_line && bot == maxy) {
 	GoTo(NCURSES_SP_ARGx top, 0);
 	UpdateAttrs(SP_PARM, blank);
-	TPUTS_TRACE("insert_line");
-	NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx insert_line);
+	NCURSES_PUTP2("insert_line", insert_line);
     } else if (parm_rindex && top == miny && bot == maxy) {
 	GoTo(NCURSES_SP_ARGx top, 0);
 	UpdateAttrs(SP_PARM, blank);
@@ -1850,15 +1830,13 @@
 	GoTo(NCURSES_SP_ARGx top, 0);
 	UpdateAttrs(SP_PARM, blank);
 	for (i = 0; i < n; i++) {
-	    TPUTS_TRACE("scroll_reverse");
-	    NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx scroll_reverse);
+	    NCURSES_PUTP2("scroll_reverse", scroll_reverse);
 	}
     } else if (insert_line && bot == maxy) {
 	GoTo(NCURSES_SP_ARGx top, 0);
 	UpdateAttrs(SP_PARM, blank);
 	for (i = 0; i < n; i++) {
-	    TPUTS_TRACE("insert_line");
-	    NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx insert_line);
+	    NCURSES_PUTP2("insert_line", insert_line);
 	}
     } else
 	return ERR;
@@ -1889,8 +1867,7 @@
     GoTo(NCURSES_SP_ARGx del, 0);
     UpdateAttrs(SP_PARM, blank);
     if (n == 1 && delete_line) {
-	TPUTS_TRACE("delete_line");
-	NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx delete_line);
+	NCURSES_PUTP2("delete_line", delete_line);
     } else if (parm_delete_line) {
 	TPUTS_TRACE("parm_delete_line");
 	NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx
@@ -1899,16 +1876,14 @@
 				NCURSES_SP_NAME(_nc_outch));
     } else {			/* if (delete_line) */
 	for (i = 0; i < n; i++) {
-	    TPUTS_TRACE("delete_line");
-	    NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx delete_line);
+	    NCURSES_PUTP2("delete_line", delete_line);
 	}
     }
 
     GoTo(NCURSES_SP_ARGx ins, 0);
     UpdateAttrs(SP_PARM, blank);
     if (n == 1 && insert_line) {
-	TPUTS_TRACE("insert_line");
-	NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx insert_line);
+	NCURSES_PUTP2("insert_line", insert_line);
     } else if (parm_insert_line) {
 	TPUTS_TRACE("parm_insert_line");
 	NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx
@@ -1917,8 +1892,7 @@
 				NCURSES_SP_NAME(_nc_outch));
     } else {			/* if (insert_line) */
 	for (i = 0; i < n; i++) {
-	    TPUTS_TRACE("insert_line");
-	    NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx insert_line);
+	    NCURSES_PUTP2("insert_line", insert_line);
 	}
     }
 
@@ -1975,24 +1949,20 @@
 		 && (SP_PARM->_cursrow == bot || SP_PARM->_cursrow == bot - 1))
 		&& save_cursor && restore_cursor) {
 		cursor_saved = TRUE;
-		TPUTS_TRACE("save_cursor");
-		NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx save_cursor);
+		NCURSES_PUTP2("save_cursor", save_cursor);
 	    }
-	    TPUTS_TRACE("change_scroll_region");
-	    NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx
-				   TPARM_2(change_scroll_region, top, bot));
+	    NCURSES_PUTP2("change_scroll_region",
+			  TPARM_2(change_scroll_region, top, bot));
 	    if (cursor_saved) {
-		TPUTS_TRACE("restore_cursor");
-		NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx restore_cursor);
+		NCURSES_PUTP2("restore_cursor", restore_cursor);
 	    } else {
 		SP_PARM->_cursrow = SP_PARM->_curscol = -1;
 	    }
 
 	    res = scroll_csr_forward(NCURSES_SP_ARGx n, top, bot, top, bot, blank);
 
-	    TPUTS_TRACE("change_scroll_region");
-	    NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx
-				   TPARM_2(change_scroll_region, 0, maxy));
+	    NCURSES_PUTP2("change_scroll_region",
+			  TPARM_2(change_scroll_region, 0, maxy));
 	    SP_PARM->_cursrow = SP_PARM->_curscol = -1;
 	}
 
@@ -2025,15 +1995,12 @@
 		    SP_PARM->_cursrow == top - 1)
 		&& save_cursor && restore_cursor) {
 		cursor_saved = TRUE;
-		TPUTS_TRACE("save_cursor");
-		NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx save_cursor);
+		NCURSES_PUTP2("save_cursor", save_cursor);
 	    }
-	    TPUTS_TRACE("change_scroll_region");
-	    NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx
-				   TPARM_2(change_scroll_region, top, bot));
+	    NCURSES_PUTP2("change_scroll_region",
+			  TPARM_2(change_scroll_region, top, bot));
 	    if (cursor_saved) {
-		TPUTS_TRACE("restore_cursor");
-		NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx restore_cursor);
+		NCURSES_PUTP2("restore_cursor", restore_cursor);
 	    } else {
 		SP_PARM->_cursrow = SP_PARM->_curscol = -1;
 	    }
@@ -2041,9 +2008,8 @@
 	    res = scroll_csr_backward(NCURSES_SP_ARGx
 				      -n, top, bot, top, bot, blank);
 
-	    TPUTS_TRACE("change_scroll_region");
-	    NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx
-				   TPARM_2(change_scroll_region, 0, maxy));
+	    NCURSES_PUTP2("change_scroll_region",
+			  TPARM_2(change_scroll_region, 0, maxy));
 	    SP_PARM->_cursrow = SP_PARM->_curscol = -1;
 	}
 
@@ -2114,23 +2080,25 @@
     }
 
     if (exit_attribute_mode)
-	NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx exit_attribute_mode);
+	NCURSES_PUTP2("exit_attribute_mode", exit_attribute_mode);
     else {
 	/* turn off attributes */
 	if (exit_alt_charset_mode)
-	    NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx exit_alt_charset_mode);
+	    NCURSES_PUTP2("exit_alt_charset_mode", exit_alt_charset_mode);
 	if (exit_standout_mode)
-	    NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx exit_standout_mode);
+	    NCURSES_PUTP2("exit_standout_mode", exit_standout_mode);
 	if (exit_underline_mode)
-	    NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx exit_underline_mode);
+	    NCURSES_PUTP2("exit_underline_mode", exit_underline_mode);
     }
     if (exit_insert_mode)
-	NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx exit_insert_mode);
-    if (enter_am_mode && exit_am_mode)
-	NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx
-			       (auto_right_margin
-				? enter_am_mode
-				: exit_am_mode));
+	NCURSES_PUTP2("exit_insert_mode", exit_insert_mode);
+    if (enter_am_mode && exit_am_mode) {
+	if (auto_right_margin) {
+	    NCURSES_PUTP2("enter_am_mode", enter_am_mode);
+	} else {
+	    NCURSES_PUTP2("exit_am_mode", exit_am_mode);
+	}
+    }
 }
 
 #if NCURSES_SP_FUNCS
@@ -2159,33 +2127,33 @@
 NCURSES_EXPORT(void)
 NCURSES_SP_NAME(_nc_screen_wrap) (NCURSES_SP_DCL0)
 {
-    if (SP_PARM == 0)
-	return;
+    if (SP_PARM != 0) {
 
-    UpdateAttrs(SP_PARM, normal);
+	UpdateAttrs(SP_PARM, normal);
 #if NCURSES_EXT_FUNCS
-    if (SP_PARM->_coloron
-	&& !SP_PARM->_default_color) {
-	static const NCURSES_CH_T blank = NewChar(BLANK_TEXT);
-	SP_PARM->_default_color = TRUE;
-	NCURSES_SP_NAME(_nc_do_color) (NCURSES_SP_ARGx
-				       -1,
-				       0,
-				       FALSE,
-				       NCURSES_SP_NAME(_nc_outch));
-	SP_PARM->_default_color = FALSE;
-
-	TINFO_MVCUR(NCURSES_SP_ARGx
-		    SP_PARM->_cursrow,
-		    SP_PARM->_curscol,
-		    screen_lines(SP_PARM) - 1,
-		    0);
+	if (SP_PARM->_coloron
+	    && !SP_PARM->_default_color) {
+	    static const NCURSES_CH_T blank = NewChar(BLANK_TEXT);
+	    SP_PARM->_default_color = TRUE;
+	    NCURSES_SP_NAME(_nc_do_color) (NCURSES_SP_ARGx
+					   -1,
+					   0,
+					   FALSE,
+					   NCURSES_SP_NAME(_nc_outch));
+	    SP_PARM->_default_color = FALSE;
+
+	    TINFO_MVCUR(NCURSES_SP_ARGx
+			SP_PARM->_cursrow,
+			SP_PARM->_curscol,
+			screen_lines(SP_PARM) - 1,
+			0);
 
-	ClrToEOL(NCURSES_SP_ARGx blank, TRUE);
-    }
+	    ClrToEOL(NCURSES_SP_ARGx blank, TRUE);
+	}
 #endif
-    if (SP_PARM->_color_defs) {
-	NCURSES_SP_NAME(_nc_reset_colors) (NCURSES_SP_ARG);
+	if (SP_PARM->_color_defs) {
+	    NCURSES_SP_NAME(_nc_reset_colors) (NCURSES_SP_ARG);
+	}
     }
 }
 
Index: ncurses/widechar/lib_box_set.c
Prereq:  1.5 
--- ncurses-5.9/ncurses/widechar/lib_box_set.c	2009-10-24 22:36:56.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/widechar/lib_box_set.c	2011-06-25 19:02:07.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 2002-2003,2009 Free Software Foundation, Inc.              *
+ * Copyright (c) 2002-2009,2011 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -39,7 +39,7 @@
 
 #include <curses.priv.h>
 
-MODULE_ID("$Id: lib_box_set.c,v 1.5 2009/10/24 22:36:56 tom Exp $")
+MODULE_ID("$Id: lib_box_set.c,v 1.6 2011/06/25 19:02:07 Vassili.Courzakis Exp $")
 
 NCURSES_EXPORT(int)
 wborder_set(WINDOW *win,
@@ -52,7 +52,7 @@
     NCURSES_SIZE_T endx, endy;
     NCURSES_CH_T wls, wrs, wts, wbs, wtl, wtr, wbl, wbr;
 
-    T((T_CALLED("wborder(%p,%s,%s,%s,%s,%s,%s,%s,%s)"),
+    T((T_CALLED("wborder_set(%p,%s,%s,%s,%s,%s,%s,%s,%s)"),
        (void *) win,
        _tracech_t2(1, ls),
        _tracech_t2(2, rs),
Index: ncurses/widechar/lib_cchar.c
Prereq:  1.20 
--- ncurses-5.9/ncurses/widechar/lib_cchar.c	2010-12-25 23:46:26.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/widechar/lib_cchar.c	2012-03-24 18:37:17.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 2001-2009,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 2001-2011,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -35,7 +35,7 @@
 
 #include <curses.priv.h>
 
-MODULE_ID("$Id: lib_cchar.c,v 1.20 2010/12/25 23:46:26 tom Exp $")
+MODULE_ID("$Id: lib_cchar.c,v 1.26 2012/03/24 18:37:17 tom Exp $")
 
 /* 
  * The SuSv2 description leaves some room for interpretation.  We'll assume wch
@@ -58,9 +58,9 @@
 		      (void *) wcval, _nc_viswbuf(wch),
 		      (unsigned long) attrs, color_pair, opts));
 
-    len = (unsigned) wcslen(wch);
     if (opts != NULL
-	|| (len > 1 && wcwidth(wch[0]) < 0)) {
+	|| wch == NULL
+	|| ((len = (unsigned) wcslen(wch)) > 1 && wcwidth(wch[0]) < 0)) {
 	code = ERR;
     } else {
 	if (len > CCHARW_MAX)
@@ -80,7 +80,7 @@
 	memset(wcval, 0, sizeof(*wcval));
 
 	if (len != 0) {
-	    SetAttr(*wcval, attrs | (attr_t) ColorPair(color_pair));
+	    SetAttr(*wcval, attrs);
 	    SetPair(CHDEREF(wcval), color_pair);
 	    memcpy(&wcval->chars, wch, len * sizeof(wchar_t));
 	    TR(TRACE_CCALLS, ("copy %d wchars, first is %s", len,
@@ -110,8 +110,8 @@
 		      (void *) color_pair,
 		      opts));
 
-    if (opts == NULL) {
-	len = ((wp = wmemchr(wcval->chars, L'\0', CCHARW_MAX))
+    if (opts == NULL && wcval != NULL) {
+	len = ((wp = wmemchr(wcval->chars, L'\0', (size_t) CCHARW_MAX))
 	       ? (int) (wp - wcval->chars)
 	       : CCHARW_MAX);
 
@@ -126,7 +126,7 @@
 	} else if (len >= 0) {
 	    *attrs = AttrOf(*wcval) & A_ATTRIBUTES;
 	    *color_pair = (short) GetPair(*wcval);
-	    wmemcpy(wch, wcval->chars, (unsigned) len);
+	    wmemcpy(wch, wcval->chars, (size_t) len);
 	    wch[len] = L'\0';
 	    code = OK;
 	}
Index: ncurses/widechar/lib_get_wch.c
Prereq:  1.22 
--- ncurses-5.9/ncurses/widechar/lib_get_wch.c	2010-08-28 21:00:35.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/widechar/lib_get_wch.c	2011-05-28 23:00:29.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 2002-2009,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 2002-2010,2011 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -40,7 +40,7 @@
 #include <curses.priv.h>
 #include <ctype.h>
 
-MODULE_ID("$Id: lib_get_wch.c,v 1.22 2010/08/28 21:00:35 tom Exp $")
+MODULE_ID("$Id: lib_get_wch.c,v 1.23 2011/05/28 23:00:29 tom Exp $")
 
 NCURSES_EXPORT(int)
 wget_wch(WINDOW *win, wint_t *result)
@@ -106,7 +106,10 @@
     } else {
 	code = ERR;
     }
-    *result = (wint_t) value;
+
+    if (result != 0)
+	*result = (wint_t) value;
+
     _nc_unlock_global(curses);
     T(("result %#o", value));
     returnCode(code);
Index: ncurses/widechar/lib_get_wstr.c
Prereq:  1.12 
--- ncurses-5.9/ncurses/widechar/lib_get_wstr.c	2009-10-24 22:38:11.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/widechar/lib_get_wstr.c	2011-10-22 16:31:35.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 2002-2008,2009 Free Software Foundation, Inc.              *
+ * Copyright (c) 2002-2009,2011 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -39,7 +39,7 @@
 
 #include <curses.priv.h>
 
-MODULE_ID("$Id: lib_get_wstr.c,v 1.12 2009/10/24 22:38:11 tom Exp $")
+MODULE_ID("$Id: lib_get_wstr.c,v 1.13 2011/10/22 16:31:35 tom Exp $")
 
 static int
 wadd_wint(WINDOW *win, wint_t *src)
@@ -49,7 +49,7 @@
 
     wch[0] = (wchar_t) (*src);
     wch[1] = 0;
-    setcchar(&tmp, wch, A_NORMAL, 0, NULL);
+    setcchar(&tmp, wch, A_NORMAL, (short) 0, NULL);
     return wadd_wch(win, &tmp);
 }
 
@@ -58,7 +58,7 @@
  * or other character, and handles reverse wraparound.
  */
 static wint_t *
-WipeOut(WINDOW *win, int y, int x, wint_t *first, wint_t *last, bool echoed)
+WipeOut(WINDOW *win, int y, int x, wint_t *first, wint_t *last, int echoed)
 {
     if (last > first) {
 	*--last = '\0';
Index: ncurses/widechar/lib_ins_wch.c
Prereq:  1.16 
--- ncurses-5.9/ncurses/widechar/lib_ins_wch.c	2010-12-19 01:34:04.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/widechar/lib_ins_wch.c	2011-10-22 16:34:50.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 2002-2009,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 2002-2010,2011 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -39,7 +39,7 @@
 
 #include <curses.priv.h>
 
-MODULE_ID("$Id: lib_ins_wch.c,v 1.16 2010/12/19 01:34:04 tom Exp $")
+MODULE_ID("$Id: lib_ins_wch.c,v 1.17 2011/10/22 16:34:50 tom Exp $")
 
 /*
  * Insert the given character, updating the current location to simplify
@@ -132,7 +132,7 @@
 		    (void) setcchar(&tmp_cchar,
 				    &tmp_wchar,
 				    WA_NORMAL,
-				    0,
+				    (short) 0,
 				    (void *) 0);
 		    code = _nc_insert_wch(win, &tmp_cchar);
 		} else {
Index: ncurses/widechar/lib_inwstr.c
Prereq:  1.5 
--- ncurses-5.9/ncurses/widechar/lib_inwstr.c	2009-10-24 22:37:29.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/widechar/lib_inwstr.c	2011-05-28 22:49:49.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 2002-2004,2009 Free Software Foundation, Inc.              *
+ * Copyright (c) 2002-2009,2011 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -39,7 +39,7 @@
 
 #include <curses.priv.h>
 
-MODULE_ID("$Id: lib_inwstr.c,v 1.5 2009/10/24 22:37:29 tom Exp $")
+MODULE_ID("$Id: lib_inwstr.c,v 1.6 2011/05/28 22:49:49 tom Exp $")
 
 NCURSES_EXPORT(int)
 winnwstr(WINDOW *win, wchar_t *wstr, int n)
@@ -93,8 +93,13 @@
 winwstr(WINDOW *win, wchar_t *wstr)
 {
     int result = OK;
+
     T((T_CALLED("winwstr(%p,%p)"), (void *) win, (void *) wstr));
-    if (winnwstr(win, wstr, CCHARW_MAX * (win->_maxx - win->_curx + 1)) == ERR)
+    if (win == 0) {
+	result = ERR;
+    } else if (winnwstr(win, wstr,
+			CCHARW_MAX * (win->_maxx - win->_curx + 1)) == ERR) {
 	result = ERR;
+    }
     returnCode(result);
 }
Index: ncurses/widechar/lib_slk_wset.c
Prereq:  1.11 
--- ncurses-5.9/ncurses/widechar/lib_slk_wset.c	2005-01-16 01:03:53.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/widechar/lib_slk_wset.c	2011-10-22 15:52:20.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 2003-2004,2005 Free Software Foundation, Inc.              *
+ * Copyright (c) 2003-2002,2011 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -40,7 +40,7 @@
 #include <wctype.h>
 #endif
 
-MODULE_ID("$Id: lib_slk_wset.c,v 1.11 2005/01/16 01:03:53 tom Exp $")
+MODULE_ID("$Id: lib_slk_wset.c,v 1.13 2011/10/22 15:52:20 tom Exp $")
 
 NCURSES_EXPORT(int)
 slk_wset(int i, const wchar_t *astr, int format)
@@ -53,19 +53,21 @@
 
     T((T_CALLED("slk_wset(%d, %s, %d)"), i, _nc_viswbuf(astr), format));
 
-    init_mb(state);
-    str = astr;
-    if ((arglen = wcsrtombs(NULL, &str, 0, &state)) != (size_t) -1) {
-	if ((mystr = (char *) _nc_doalloc(0, arglen + 1)) != 0) {
-	    str = astr;
-	    if (wcsrtombs(mystr, &str, arglen, &state) != (size_t) -1) {
-		/* glibc documentation claims that the terminating L'\0'
-		 * is written, but it is not...
-		 */
-		mystr[arglen] = 0;
-		result = slk_set(i, mystr, format);
+    if (astr != 0) {
+	init_mb(state);
+	str = astr;
+	if ((arglen = wcsrtombs(NULL, &str, (size_t) 0, &state)) != (size_t) -1) {
+	    if ((mystr = (char *) _nc_doalloc(0, arglen + 1)) != 0) {
+		str = astr;
+		if (wcsrtombs(mystr, &str, arglen, &state) != (size_t) -1) {
+		    /* glibc documentation claims that the terminating L'\0'
+		     * is written, but it is not...
+		     */
+		    mystr[arglen] = 0;
+		    result = slk_set(i, mystr, format);
+		}
+		free(mystr);
 	    }
-	    free(mystr);
 	}
     }
     returnCode(result);
Index: ncurses/widechar/lib_unget_wch.c
Prereq:  1.14 
--- ncurses-5.9/ncurses/widechar/lib_unget_wch.c	2010-07-24 11:35:21.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/widechar/lib_unget_wch.c	2011-10-22 16:34:50.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 2002-2009,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 2002-2010,2011 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -39,7 +39,7 @@
 
 #include <curses.priv.h>
 
-MODULE_ID("$Id: lib_unget_wch.c,v 1.14 2010/07/24 11:35:21 tom Exp $")
+MODULE_ID("$Id: lib_unget_wch.c,v 1.15 2011/10/22 16:34:50 tom Exp $")
 
 /*
  * Wrapper for wcrtomb() which obtains the length needed for the given
@@ -55,7 +55,7 @@
 	const wchar_t *tempp = temp;
 	temp[0] = source;
 	temp[1] = 0;
-	result = (int) wcsrtombs(NULL, &tempp, 0, state);
+	result = (int) wcsrtombs(NULL, &tempp, (size_t) 0, state);
     } else {
 	result = (int) wcrtomb(target, source, state);
     }
Index: ncurses/widechar/lib_vid_attr.c
Prereq:  1.14 
--- ncurses-5.9/ncurses/widechar/lib_vid_attr.c	2010-12-19 01:44:24.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/widechar/lib_vid_attr.c	2013-01-12 18:01:35.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 2002-2009,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 2002-2012,2013 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -36,7 +36,7 @@
 #define CUR SP_TERMTYPE
 #endif
 
-MODULE_ID("$Id: lib_vid_attr.c,v 1.14 2010/12/19 01:44:24 tom Exp $")
+MODULE_ID("$Id: lib_vid_attr.c,v 1.17 2013/01/12 18:01:35 tom Exp $")
 
 #define doPut(mode) TPUTS_TRACE(#mode); NCURSES_SP_NAME(tputs)(NCURSES_SP_ARGx mode, 1, outc)
 
@@ -120,7 +120,7 @@
 	 * A_ALTCHARSET (256) down 2 to line up.  We use the NCURSES_BITS
 	 * macro so this will work properly for the wide-character layout.
 	 */
-	unsigned value = no_color_video;
+	unsigned value = (unsigned) no_color_video;
 	attr_t mask = NCURSES_BITS((value & 63)
 				   | ((value & 192) << 1)
 				   | ((value & 256) >> 2), 8);
@@ -278,7 +278,7 @@
 					  newmode,
 					  pair,
 					  opts,
-					  NCURSES_SP_NAME(_nc_outch)));
+					  NCURSES_SP_NAME(_nc_putchar)));
 }
 
 #if NCURSES_SP_FUNCS
@@ -296,24 +296,26 @@
 NCURSES_EXPORT(attr_t)
 NCURSES_SP_NAME(term_attrs) (NCURSES_SP_DCL0)
 {
-    attr_t attrs;
+    attr_t attrs = 0;
 
     T((T_CALLED("term_attrs()")));
-    attrs = SP_PARM ? NCURSES_SP_NAME(termattrs) (NCURSES_SP_ARG) : 0;
+    if (SP_PARM) {
+	attrs = NCURSES_SP_NAME(termattrs) (NCURSES_SP_ARG);
 
-    /* these are only supported for wide-character mode */
-    if (enter_horizontal_hl_mode)
-	attrs |= WA_HORIZONTAL;
-    if (enter_left_hl_mode)
-	attrs |= WA_LEFT;
-    if (enter_low_hl_mode)
-	attrs |= WA_LOW;
-    if (enter_right_hl_mode)
-	attrs |= WA_RIGHT;
-    if (enter_top_hl_mode)
-	attrs |= WA_TOP;
-    if (enter_vertical_hl_mode)
-	attrs |= WA_VERTICAL;
+	/* these are only supported for wide-character mode */
+	if (enter_horizontal_hl_mode)
+	    attrs |= WA_HORIZONTAL;
+	if (enter_left_hl_mode)
+	    attrs |= WA_LEFT;
+	if (enter_low_hl_mode)
+	    attrs |= WA_LOW;
+	if (enter_right_hl_mode)
+	    attrs |= WA_RIGHT;
+	if (enter_top_hl_mode)
+	    attrs |= WA_TOP;
+	if (enter_vertical_hl_mode)
+	    attrs |= WA_VERTICAL;
+    }
 
     returnAttr(attrs);
 }
Index: ncurses/widechar/lib_wacs.c
Prereq:  1.10 
--- ncurses-5.9/ncurses/widechar/lib_wacs.c	2010-12-19 01:43:19.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/widechar/lib_wacs.c	2013-02-02 17:10:48.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 2002-2009,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 2002-2012,2013 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -32,7 +32,7 @@
 
 #include <curses.priv.h>
 
-MODULE_ID("$Id: lib_wacs.c,v 1.10 2010/12/19 01:43:19 tom Exp $")
+MODULE_ID("$Id: lib_wacs.c,v 1.13 2013/02/02 17:10:48 tom Exp $")
 
 NCURSES_EXPORT_VAR(cchar_t) * _nc_wacs = 0;
 
@@ -119,22 +119,24 @@
     T(("initializing WIDE-ACS map (Unicode is%s active)",
        active ? "" : " not"));
 
-    _nc_wacs = typeCalloc(cchar_t, ACS_LEN);
-    for (n = 0; n < SIZEOF(table); ++n) {
-	int wide = wcwidth(table[n].value[active]);
-
-	m = table[n].map;
-	if (active && (wide == 1)) {
-	    SetChar(_nc_wacs[m], table[n].value[active], A_NORMAL);
-	} else if (acs_map[m] & A_ALTCHARSET) {
-	    SetChar(_nc_wacs[m], m, A_ALTCHARSET);
-	} else {
-	    SetChar(_nc_wacs[m], table[n].value[0], A_NORMAL);
-	}
+    if ((_nc_wacs = typeCalloc(cchar_t, ACS_LEN)) != 0) {
+
+	for (n = 0; n < SIZEOF(table); ++n) {
+	    int wide = wcwidth(table[n].value[active]);
 
-	T(("#%d, SetChar(%c, %#04x) = %s",
-	   n, m,
-	   table[n].value[active],
-	   _tracecchar_t(&_nc_wacs[m])));
+	    m = table[n].map;
+	    if (active && (wide == 1)) {
+		SetChar(_nc_wacs[m], table[n].value[1], A_NORMAL);
+	    } else if (acs_map[m] & A_ALTCHARSET) {
+		SetChar(_nc_wacs[m], m, A_ALTCHARSET);
+	    } else {
+		SetChar(_nc_wacs[m], table[n].value[0], A_NORMAL);
+	    }
+
+	    T(("#%d, SetChar(%c, %#04x) = %s",
+	       n, m,
+	       table[n].value[active],
+	       _tracecchar_t(&_nc_wacs[m])));
+	}
     }
 }
Index: ncurses/widechar/lib_wunctrl.c
Prereq:  1.14 
--- ncurses-5.9/ncurses/widechar/lib_wunctrl.c	2010-12-19 01:42:15.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/widechar/lib_wunctrl.c	2012-12-15 20:53:42.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 2001-2009,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 2001-2011,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -35,14 +35,17 @@
 
 #include <curses.priv.h>
 
-MODULE_ID("$Id: lib_wunctrl.c,v 1.14 2010/12/19 01:42:15 tom Exp $")
+MODULE_ID("$Id: lib_wunctrl.c,v 1.16 2012/12/15 20:53:42 tom Exp $")
 
 NCURSES_EXPORT(wchar_t *)
 NCURSES_SP_NAME(wunctrl) (NCURSES_SP_DCLx cchar_t *wc)
 {
     static wchar_t str[CCHARW_MAX + 1], *wsp;
+    wchar_t *result;
 
-    if (Charable(*wc)) {
+    if (wc == 0) {
+	result = 0;
+    } else if (SP_PARM != 0 && Charable(*wc)) {
 	const char *p =
 	NCURSES_SP_NAME(unctrl) (NCURSES_SP_ARGx
 				 (unsigned) _nc_to_char((wint_t)CharOf(*wc)));
@@ -51,9 +54,11 @@
 	    *wsp++ = (wchar_t) _nc_to_widechar(*p);
 	}
 	*wsp = 0;
-	return str;
-    } else
-	return wc->chars;
+	result = str;
+    } else {
+	result = wc->chars;
+    }
+    return result;
 }
 
 #if NCURSES_SP_FUNCS
Index: ncurses/widechar/widechars.c
--- /dev/null	2013-05-05 10:34:48.558701642 +0000
+++ ncurses-5.9-20130504/ncurses/widechar/widechars.c	2013-03-02 18:55:51.000000000 +0000
@@ -0,0 +1,152 @@
+/****************************************************************************
+ * Copyright (c) 2012,2013 Free Software Foundation, Inc.                   *
+ *                                                                          *
+ * Permission is hereby granted, free of charge, to any person obtaining a  *
+ * copy of this software and associated documentation files (the            *
+ * "Software"), to deal in the Software without restriction, including      *
+ * without limitation the rights to use, copy, modify, merge, publish,      *
+ * distribute, distribute with modifications, sublicense, and/or sell       *
+ * copies of the Software, and to permit persons to whom the Software is    *
+ * furnished to do so, subject to the following conditions:                 *
+ *                                                                          *
+ * The above copyright notice and this permission notice shall be included  *
+ * in all copies or substantial portions of the Software.                   *
+ *                                                                          *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
+ * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
+ *                                                                          *
+ * Except as contained in this notice, the name(s) of the above copyright   *
+ * holders shall not be used in advertising or otherwise to promote the     *
+ * sale, use or other dealings in this Software without prior written       *
+ * authorization.                                                           *
+ ****************************************************************************/
+
+#include <curses.priv.h>
+
+#if USE_WIDEC_SUPPORT
+
+MODULE_ID("$Id: widechars.c,v 1.5 2013/03/02 18:55:51 tom Exp $")
+
+#if defined(__MINGW32__)
+/*
+ * MinGW has wide-character functions, but they do not work correctly.
+ */
+
+int
+_nc_mbtowc(wchar_t *pwc, const char *s, size_t n)
+{
+    int result;
+    int count;
+    int try;
+
+    if (s != 0 && n != 0) {
+	/*
+	 * MultiByteToWideChar() can decide to return more than one
+	 * wide-character.  We want only one.  Ignore any trailing null, both
+	 * in the initial count and in the conversion.
+	 */
+	count = 0;
+	for (try = 1; try <= (int) n; ++try) {
+	    count = MultiByteToWideChar(CP_UTF8,
+					MB_ERR_INVALID_CHARS,
+					s,
+					try,
+					pwc,
+					0);
+	    TR(TRACE_BITS, ("...try %d:%d", try, count));
+	    if (count > 0) {
+		break;
+	    }
+	}
+	if (count < 1 || count > 2) {
+	    result = -1;
+	} else {
+	    wchar_t actual[2];
+	    memset(&actual, 0, sizeof(actual));
+	    count = MultiByteToWideChar(CP_UTF8,
+					MB_ERR_INVALID_CHARS,
+					s,
+					try,
+					actual,
+					2);
+	    TR(TRACE_BITS, ("\twin32 ->%#x, %#x", actual[0], actual[1]));
+	    *pwc = actual[0];
+	    if (actual[1] != 0)
+		result = -1;
+	    else
+		result = try;
+	}
+    } else {
+	result = 0;
+    }
+
+    return result;
+}
+
+int
+_nc_mblen(const char *s, size_t n)
+{
+    int result = -1;
+    int count;
+    wchar_t temp;
+
+    if (s != 0 && n != 0) {
+	count = _nc_mbtowc(&temp, s, n);
+	if (count == 1) {
+	    int check = WideCharToMultiByte(CP_UTF8,
+					    0,
+					    &temp,
+					    1,
+					    NULL,
+					    0,	/* compute length only */
+					    NULL,
+					    NULL);
+	    TR(TRACE_BITS, ("\tcheck ->%d\n", check));
+	    if (check > 0 && (size_t) check <= n) {
+		result = check;
+	    }
+	}
+    } else {
+	result = 0;
+    }
+
+    return result;
+}
+
+int __MINGW_NOTHROW
+_nc_wctomb(char *s, wchar_t wc)
+{
+    int result;
+    int check;
+
+    check = WideCharToMultiByte(CP_UTF8,
+				0,
+				&wc,
+				1,
+				NULL,
+				0,	/* compute length only */
+				NULL,
+				NULL);
+    if (check > 0) {
+	result = WideCharToMultiByte(CP_UTF8,
+				     0,
+				     &wc,
+				     1,
+				     s,
+				     check + 1,
+				     NULL,
+				     NULL);
+    } else {
+	result = -1;
+    }
+    return result;
+}
+
+#endif /* __MINGW32__ */
+
+#endif /* USE_WIDEC_SUPPORT */
Index: ncurses/win32con/win_driver.c
Prereq:  1.10 
--- ncurses-5.9/ncurses/win32con/win_driver.c	2010-12-25 19:28:21.000000000 +0000
+++ ncurses-5.9-20130504/ncurses/win32con/win_driver.c	2013-03-02 19:48:06.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -28,7 +28,6 @@
 
 /****************************************************************************
  *  Author: Juergen Pfeifer                                                 *
- *                                                                          *
  ****************************************************************************/
 
 /*
@@ -39,12 +38,16 @@
 #include <curses.priv.h>
 #define CUR my_term.type.
 
-MODULE_ID("$Id: win_driver.c,v 1.10 2010/12/25 19:28:21 tom Exp $")
+MODULE_ID("$Id: win_driver.c,v 1.18 2013/03/02 19:48:06 tom Exp $")
 
 #define WINMAGIC NCDRV_MAGIC(NCDRV_WINCONSOLE)
 
-#define AssertTCB() assert(TCB!=0 && TCB->magic==WINMAGIC)
-#define SetSP() assert(TCB->csp!=0); sp = TCB->csp
+#define EXP_OPTIMIZE 0
+
+#define okConsoleHandle(TCB) (TCB != 0 && !InvalidConsoleHandle(TCB->hdl))
+
+#define AssertTCB() assert(TCB != 0 && (TCB->magic == WINMAGIC))
+#define SetSP()     assert(TCB->csp != 0); sp = TCB->csp; (void) sp
 
 #define GenMap(vKey,key) MAKELONG(key, vKey)
 
@@ -69,6 +72,7 @@
 typedef struct props {
     CONSOLE_SCREEN_BUFFER_INFO SBI;
     bool progMode;
+    TERM_HANDLE lastOut;
     DWORD map[MAPSIZE];
     DWORD rmap[MAPSIZE];
     WORD pairs[NUMPAIRS];
@@ -103,7 +107,7 @@
 }
 
 static WORD
-MapAttr(TERMINAL_CONTROL_BLOCK * TCB, WORD res, chtype ch)
+MapAttr(TERMINAL_CONTROL_BLOCK * TCB, WORD res, attr_t ch)
 {
     if (ch & A_COLOR) {
 	int p;
@@ -135,8 +139,68 @@
     return res;
 }
 
+#if USE_WIDEC_SUPPORT
+/*
+ * TODO: support surrogate pairs
+ * TODO: support combining characters
+ * TODO: support acsc
+ * TODO: check wcwidth of base character, fill if needed for double-width
+ * TODO: _nc_wacs should be part of sp.
+ */
 static BOOL
-con_write(TERMINAL_CONTROL_BLOCK * TCB, int y, int x, chtype *str, int n)
+con_write16(TERMINAL_CONTROL_BLOCK * TCB, int y, int x, cchar_t *str, int limit)
+{
+    int actual = 0;
+    CHAR_INFO ci[limit];
+    COORD loc, siz;
+    SMALL_RECT rec;
+    int i;
+    cchar_t ch;
+    SCREEN *sp;
+
+    AssertTCB();
+
+    SetSP();
+
+    for (i = actual = 0; i < limit; i++) {
+	ch = str[i];
+	if (isWidecExt(ch))
+	    continue;
+	ci[actual].Char.UnicodeChar = CharOf(ch);
+	ci[actual].Attributes = MapAttr(TCB,
+					PropOf(TCB)->SBI.wAttributes,
+					AttrOf(ch));
+	if (AttrOf(ch) & A_ALTCHARSET) {
+	    if (_nc_wacs) {
+		int which = CharOf(ch);
+		if (which > 0
+		    && which < ACS_LEN
+		    && CharOf(_nc_wacs[which]) != 0) {
+		    ci[actual].Char.UnicodeChar = CharOf(_nc_wacs[which]);
+		} else {
+		    ci[actual].Char.UnicodeChar = ' ';
+		}
+	    }
+	}
+	++actual;
+    }
+
+    loc.X = (short) 0;
+    loc.Y = (short) 0;
+    siz.X = (short) actual;
+    siz.Y = 1;
+
+    rec.Left = (short) x;
+    rec.Top = (short) y;
+    rec.Right = (short) (x + limit - 1);
+    rec.Bottom = rec.Top;
+
+    return WriteConsoleOutputW(TCB->hdl, ci, siz, loc, &rec);
+}
+#define con_write(tcb, y, x, str, n) con_write16(tcb, y, x, str, n)
+#else
+static BOOL
+con_write8(TERMINAL_CONTROL_BLOCK * TCB, int y, int x, chtype *str, int n)
 {
     CHAR_INFO ci[n];
     COORD loc, siz;
@@ -147,9 +211,6 @@
 
     AssertTCB();
 
-    if (TCB == 0 || InvalidConsoleHandle(TCB->hdl))
-	return FALSE;
-
     SetSP();
 
     for (i = 0; i < n; i++) {
@@ -177,55 +238,163 @@
 
     return WriteConsoleOutput(TCB->hdl, ci, siz, loc, &rec);
 }
+#define con_write(tcb, y, x, str, n) con_write8(tcb, y, x, str, n)
+#endif
+
+#if EXP_OPTIMIZE
+/*
+ * Comparing new/current screens, determine the last column-index for a change
+ * beginning on the given row,col position.  Unlike a serial terminal, there is
+ * no cost for "moving" the "cursor" on the line as we update it.
+ */
+static int
+find_end_of_change(SCREEN *sp, int row, int col)
+{
+    int result = col;
+    struct ldat *curdat = CurScreen(sp)->_line + row;
+    struct ldat *newdat = NewScreen(sp)->_line + row;
+
+    while (col <= newdat->lastchar) {
+#if USE_WIDEC_SUPPORT
+	if (isWidecExt(curdat->text[col]) || isWidecExt(newdat->text[col])) {
+	    result = col;
+	} else if (memcmp(&curdat->text[col],
+			  &newdat->text[col],
+			  sizeof(curdat->text[0]))) {
+	    result = col;
+	} else {
+	    break;
+	}
+#else
+	if (curdat->text[col] != newdat->text[col]) {
+	    result = col;
+	} else {
+	    break;
+	}
+#endif
+	++col;
+    }
+    return result;
+}
+
+/*
+ * Given a row,col position at the end of a change-chunk, look for the
+ * beginning of the next change-chunk.
+ */
+static int
+find_next_change(SCREEN *sp, int row, int col)
+{
+    struct ldat *curdat = CurScreen(sp)->_line + row;
+    struct ldat *newdat = NewScreen(sp)->_line + row;
+    int result = newdat->lastchar + 1;
+
+    while (++col <= newdat->lastchar) {
+#if USE_WIDEC_SUPPORT
+	if (isWidecExt(curdat->text[col]) != isWidecExt(newdat->text[col])) {
+	    result = col;
+	    break;
+	} else if (memcmp(&curdat->text[col],
+			  &newdat->text[col],
+			  sizeof(curdat->text[0]))) {
+	    result = col;
+	    break;
+	}
+#else
+	if (curdat->text[col] != newdat->text[col]) {
+	    result = col;
+	    break;
+	}
+#endif
+    }
+    return result;
+}
+
+#define EndChange(first) \
+	find_end_of_change(sp, y, first)
+#define NextChange(last) \
+	find_next_change(sp, y, last)
+
+#endif /* EXP_OPTIMIZE */
 
 #define MARK_NOCHANGE(win,row) \
 		win->_line[row].firstchar = _NOCHANGE; \
 		win->_line[row].lastchar  = _NOCHANGE
 
+static void
+selectActiveHandle(TERMINAL_CONTROL_BLOCK * TCB)
+{
+    if (PropOf(TCB)->lastOut != TCB->hdl) {
+	PropOf(TCB)->lastOut = TCB->hdl;
+	SetConsoleActiveScreenBuffer(PropOf(TCB)->lastOut);
+    }
+}
+
 static int
 drv_doupdate(TERMINAL_CONTROL_BLOCK * TCB)
 {
+    int result = ERR;
     int y, nonempty, n, x0, x1, Width, Height;
     SCREEN *sp;
 
     AssertTCB();
     SetSP();
 
-    Width = screen_columns(sp);
-    Height = screen_lines(sp);
-    nonempty = min(Height, NewScreen(sp)->_maxy + 1);
-
-    if ((CurScreen(sp)->_clear || NewScreen(sp)->_clear)) {
-	int x;
-	chtype empty[Width];
+    T((T_CALLED("win32con::drv_doupdate(%p)"), TCB));
+    if (okConsoleHandle(TCB)) {
+
+	Width = screen_columns(sp);
+	Height = screen_lines(sp);
+	nonempty = min(Height, NewScreen(sp)->_maxy + 1);
+
+	if ((CurScreen(sp)->_clear || NewScreen(sp)->_clear)) {
+	    int x;
+#if USE_WIDEC_SUPPORT
+	    cchar_t empty[Width];
+	    wchar_t blank[2] =
+	    {
+		L' ', L'\0'
+	    };
 
-	for (x = 0; x < Width; x++)
-	    empty[x] = ' ';
+	    for (x = 0; x < Width; x++)
+		setcchar(&empty[x], blank, 0, 0, 0);
+#else
+	    chtype empty[Width];
+
+	    for (x = 0; x < Width; x++)
+		empty[x] = ' ';
+#endif
+
+	    for (y = 0; y < nonempty; y++) {
+		con_write(TCB, y, 0, empty, Width);
+		memcpy(empty,
+		       CurScreen(sp)->_line[y].text,
+		       Width * sizeof(empty[0]));
+	    }
+	    CurScreen(sp)->_clear = FALSE;
+	    NewScreen(sp)->_clear = FALSE;
+	    touchwin(NewScreen(sp));
+	}
 
 	for (y = 0; y < nonempty; y++) {
-	    con_write(TCB, y, 0, empty, Width);
-	    memcpy(empty,
-		   CurScreen(sp)->_line[y].text,
-		   Width * sizeof(chtype));
-	}
-	CurScreen(sp)->_clear = FALSE;
-	NewScreen(sp)->_clear = FALSE;
-	touchwin(NewScreen(sp));
-    }
-
-    for (y = 0; y < nonempty; y++) {
-	x0 = NewScreen(sp)->_line[y].firstchar;
-	if (x0 != _NOCHANGE) {
-	    x1 = NewScreen(sp)->_line[y].lastchar;
-	    n = x1 - x0 + 1;
-	    if (n > 0) {
-		memcpy(CurScreen(sp)->_line[y].text + x0,
-		       NewScreen(sp)->_line[y].text + x0,
-		       n * sizeof(chtype));
-		con_write(TCB,
-			  y,
-			  x0,
-			  ((chtype *) CurScreen(sp)->_line[y].text) + x0, n);
+	    x0 = NewScreen(sp)->_line[y].firstchar;
+	    if (x0 != _NOCHANGE) {
+#if EXP_OPTIMIZE
+		int x2;
+		int limit = NewScreen(sp)->_line[y].lastchar;
+		while ((x1 = EndChange(x0)) <= limit) {
+		    while ((x2 = NextChange(x1)) <= limit && x2 <= (x1 + 2)) {
+			x1 = x2;
+		    }
+		    n = x1 - x0 + 1;
+		    memcpy(&CurScreen(sp)->_line[y].text[x0],
+			   &NewScreen(sp)->_line[y].text[x0],
+			   n * sizeof(CurScreen(sp)->_line[y].text[x0]));
+		    con_write(TCB,
+			      y,
+			      x0,
+			      &CurScreen(sp)->_line[y].text[x0], n);
+		    x0 = NextChange(x1);
+		}
 
 		/* mark line changed successfully */
 		if (y <= NewScreen(sp)->_maxy) {
@@ -234,26 +403,50 @@
 		if (y <= CurScreen(sp)->_maxy) {
 		    MARK_NOCHANGE(CurScreen(sp), y);
 		}
+#else
+		x1 = NewScreen(sp)->_line[y].lastchar;
+		n = x1 - x0 + 1;
+		if (n > 0) {
+		    memcpy(&CurScreen(sp)->_line[y].text[x0],
+			   &NewScreen(sp)->_line[y].text[x0],
+			   n * sizeof(CurScreen(sp)->_line[y].text[x0]));
+		    con_write(TCB,
+			      y,
+			      x0,
+			      &CurScreen(sp)->_line[y].text[x0], n);
+
+		    /* mark line changed successfully */
+		    if (y <= NewScreen(sp)->_maxy) {
+			MARK_NOCHANGE(NewScreen(sp), y);
+		    }
+		    if (y <= CurScreen(sp)->_maxy) {
+			MARK_NOCHANGE(CurScreen(sp), y);
+		    }
+		}
+#endif
 	    }
 	}
-    }
 
-    /* put everything back in sync */
-    for (y = nonempty; y <= NewScreen(sp)->_maxy; y++) {
-	MARK_NOCHANGE(NewScreen(sp), y);
-    }
-    for (y = nonempty; y <= CurScreen(sp)->_maxy; y++) {
-	MARK_NOCHANGE(CurScreen(sp), y);
-    }
-
-    if (!NewScreen(sp)->_leaveok) {
-	CurScreen(sp)->_curx = NewScreen(sp)->_curx;
-	CurScreen(sp)->_cury = NewScreen(sp)->_cury;
+	/* put everything back in sync */
+	for (y = nonempty; y <= NewScreen(sp)->_maxy; y++) {
+	    MARK_NOCHANGE(NewScreen(sp), y);
+	}
+	for (y = nonempty; y <= CurScreen(sp)->_maxy; y++) {
+	    MARK_NOCHANGE(CurScreen(sp), y);
+	}
 
-	TCB->drv->hwcur(TCB, 0, 0, CurScreen(sp)->_cury, CurScreen(sp)->_curx);
+	if (!NewScreen(sp)->_leaveok) {
+	    CurScreen(sp)->_curx = NewScreen(sp)->_curx;
+	    CurScreen(sp)->_cury = NewScreen(sp)->_cury;
+
+	    TCB->drv->hwcur(TCB,
+			    0, 0,
+			    CurScreen(sp)->_cury, CurScreen(sp)->_curx);
+	}
+	selectActiveHandle(TCB);
+	result = OK;
     }
-    SetConsoleActiveScreenBuffer(TCB->hdl);
-    return OK;
+    returnCode(result);
 }
 
 static bool
@@ -269,7 +462,7 @@
     assert(tname != 0);
 
     TCB->magic = WINMAGIC;
-    if (*tname == 0 || *tname == 0) {
+    if (*tname == 0 || *tname == 0 || *tname == '#') {
 	code = TRUE;
     } else {
 	TERMINAL my_term;
@@ -308,7 +501,7 @@
 
 static int
 drv_dobeepflash(TERMINAL_CONTROL_BLOCK * TCB,
-		bool beepFlag GCC_UNUSED)
+		int beepFlag GCC_UNUSED)
 {
     SCREEN *sp;
     int res = ERR;
@@ -348,13 +541,13 @@
 
 static void
 drv_setcolor(TERMINAL_CONTROL_BLOCK * TCB,
-	     bool fore,
+	     int fore,
 	     int color,
 	     int (*outc) (SCREEN *, int) GCC_UNUSED)
 {
     AssertTCB();
 
-    if (TCB && !InvalidConsoleHandle(TCB->hdl)) {
+    if (okConsoleHandle(TCB)) {
 	WORD a = MapColor(fore, color);
 	a = ((PropOf(TCB)->SBI.wAttributes) & (fore ? 0xfff8 : 0xff8f)) | a;
 	SetConsoleTextAttribute(TCB->hdl, a);
@@ -368,7 +561,7 @@
     bool res = FALSE;
 
     AssertTCB();
-    if (TCB && !InvalidConsoleHandle(TCB->hdl)) {
+    if (okConsoleHandle(TCB)) {
 	WORD a = FOREGROUND_BLUE | FOREGROUND_RED | FOREGROUND_GREEN;
 	SetConsoleTextAttribute(TCB->hdl, a);
 	GetConsoleScreenBufferInfo(TCB->hdl, &(PropOf(TCB)->SBI));
@@ -392,14 +585,20 @@
 static int
 drv_size(TERMINAL_CONTROL_BLOCK * TCB, int *Lines, int *Cols)
 {
+    int result = ERR;
+
     AssertTCB();
 
-    if (TCB == NULL || Lines == NULL || Cols == NULL || InvalidConsoleHandle(TCB->hdl))
-	return ERR;
+    T((T_CALLED("win32con::drv_size(%p)"), TCB));
 
-    *Lines = (int) (PropOf(TCB)->SBI.dwSize.Y);
-    *Cols = (int) (PropOf(TCB)->SBI.dwSize.X);
-    return OK;
+    if (okConsoleHandle(TCB) &&
+	Lines != NULL &&
+	Cols != NULL) {
+	*Lines = (int) (PropOf(TCB)->SBI.dwSize.Y);
+	*Cols = (int) (PropOf(TCB)->SBI.dwSize.X);
+	result = OK;
+    }
+    returnCode(result);
 }
 
 static int
@@ -412,7 +611,7 @@
 }
 
 static int
-drv_sgmode(TERMINAL_CONTROL_BLOCK * TCB, bool setFlag, TTY * buf)
+drv_sgmode(TERMINAL_CONTROL_BLOCK * TCB, int setFlag, TTY * buf)
 {
     DWORD dwFlag = 0;
     tcflag_t iflag;
@@ -479,7 +678,7 @@
 }
 
 static int
-drv_mode(TERMINAL_CONTROL_BLOCK * TCB, bool progFlag, bool defFlag)
+drv_mode(TERMINAL_CONTROL_BLOCK * TCB, int progFlag, int defFlag)
 {
     SCREEN *sp;
     TERMINAL *_term = (TERMINAL *) TCB;
@@ -489,7 +688,8 @@
     sp = TCB->csp;
 
     PropOf(TCB)->progMode = progFlag;
-    SetConsoleActiveScreenBuffer(progFlag ? TCB->hdl : TCB->out);
+    PropOf(TCB)->lastOut = progFlag ? TCB->hdl : TCB->out;
+    SetConsoleActiveScreenBuffer(PropOf(TCB)->lastOut);
 
     if (progFlag) /* prog mode */  {
 	if (defFlag) {
@@ -674,9 +874,9 @@
 
 static void
 drv_initpair(TERMINAL_CONTROL_BLOCK * TCB,
-	     short pair,
-	     short f,
-	     short b)
+	     int pair,
+	     int f,
+	     int b)
 {
     SCREEN *sp;
 
@@ -691,10 +891,10 @@
 
 static void
 drv_initcolor(TERMINAL_CONTROL_BLOCK * TCB,
-	      short color GCC_UNUSED,
-	      short r GCC_UNUSED,
-	      short g GCC_UNUSED,
-	      short b GCC_UNUSED)
+	      int color GCC_UNUSED,
+	      int r GCC_UNUSED,
+	      int g GCC_UNUSED,
+	      int b GCC_UNUSED)
 {
     SCREEN *sp;
 
@@ -704,9 +904,9 @@
 
 static void
 drv_do_color(TERMINAL_CONTROL_BLOCK * TCB,
-	     short old_pair GCC_UNUSED,
-	     short pair GCC_UNUSED,
-	     bool reverse GCC_UNUSED,
+	     int old_pair GCC_UNUSED,
+	     int pair GCC_UNUSED,
+	     int reverse GCC_UNUSED,
 	     int (*outc) (SCREEN *, int) GCC_UNUSED
 )
 {
@@ -755,7 +955,7 @@
 	  int y, int x)
 {
     int ret = ERR;
-    if (TCB && !InvalidConsoleHandle(TCB->hdl)) {
+    if (okConsoleHandle(TCB)) {
 	COORD loc;
 	loc.X = (short) x;
 	loc.Y = (short) y;
@@ -778,7 +978,7 @@
 
 static void
 drv_hwlabelOnOff(TERMINAL_CONTROL_BLOCK * TCB,
-		 bool OnFlag GCC_UNUSED)
+		 int OnFlag GCC_UNUSED)
 {
     SCREEN *sp;
 
@@ -999,8 +1199,7 @@
 			    }
 			    continue;
 			default:
-			    SetConsoleActiveScreenBuffer(!PropOf(TCB)->progMode ?
-							 TCB->hdl : TCB->out);
+			    selectActiveHandle(TCB);
 			    continue;
 			}
 		    }
@@ -1080,7 +1279,6 @@
     BOOL b;
     DWORD nRead;
     WORD vk;
-    WORD sc;
 
     AssertTCB();
     assert(buf);
@@ -1096,7 +1294,6 @@
 		    continue;
 		*buf = (int) inp_rec.Event.KeyEvent.uChar.AsciiChar;
 		vk = inp_rec.Event.KeyEvent.wVirtualKeyCode;
-		sc = inp_rec.Event.KeyEvent.wVirtualScanCode;
 		if (*buf == 0) {
 		    if (sp->_keypad_on) {
 			*buf = MapKey(TCB, vk);
@@ -1124,8 +1321,9 @@
 static int
 drv_nap(TERMINAL_CONTROL_BLOCK * TCB GCC_UNUSED, int ms)
 {
+    T((T_CALLED("win32con::drv_nap(%p, %d)"), TCB, ms));
     Sleep(ms);
-    return OK;
+    returnCode(OK);
 }
 
 static bool
@@ -1142,6 +1340,7 @@
 
     AssertTCB();
 
+    T((T_CALLED("win32con::drv_kyExist(%p, %d)"), TCB, keycode));
     res = bsearch(&key,
 		  PropOf(TCB)->rmap,
 		  (size_t) (N_INI + FKEYS),
@@ -1153,11 +1352,11 @@
 	if (!(nKey & 0x8000))
 	    found = TRUE;
     }
-    return found;
+    returnCode(found);
 }
 
 static int
-drv_kpad(TERMINAL_CONTROL_BLOCK * TCB, bool flag GCC_UNUSED)
+drv_kpad(TERMINAL_CONTROL_BLOCK * TCB, int flag GCC_UNUSED)
 {
     SCREEN *sp;
     int code = ERR;
@@ -1165,14 +1364,15 @@
     AssertTCB();
     sp = TCB->csp;
 
+    T((T_CALLED("win32con::drv_kpad(%p, %d)"), TCB, flag));
     if (sp) {
 	code = OK;
     }
-    return code;
+    returnCode(code);
 }
 
 static int
-drv_keyok(TERMINAL_CONTROL_BLOCK * TCB, int keycode, bool flag)
+drv_keyok(TERMINAL_CONTROL_BLOCK * TCB, int keycode, int flag)
 {
     int code = ERR;
     SCREEN *sp;
@@ -1184,6 +1384,7 @@
     AssertTCB();
     SetSP();
 
+    T((T_CALLED("win32con::drv_keyok(%p, %d, %d)"), TCB, keycode, flag));
     if (sp) {
 	res = bsearch(&key,
 		      PropOf(TCB)->rmap,
@@ -1199,7 +1400,7 @@
 	    *(LONG *) res = GenMap(vKey, nKey);
 	}
     }
-    return code;
+    returnCode(code);
 }
 
 NCURSES_EXPORT_VAR (TERM_DRIVER) _nc_WIN_DRIVER = {
Index: package/debian/changelog
--- /dev/null	2013-05-05 10:34:48.558701642 +0000
+++ ncurses-5.9-20130504/package/debian/changelog	2013-05-04 14:56:00.000000000 +0000
@@ -0,0 +1,11 @@
+ncurses6 (5.9-20130504) unstable; urgency=low
+
+  * latest weekly patch
+
+ -- Thomas E. Dickey <dickey@invisible-island.net>  Sat, 04 May 2013 10:55:57 -0400
+
+ncurses6 (5.9-20120608) unstable; urgency=low
+
+  * initial release
+
+ -- Thomas E. Dickey <dickey@invisible-island.net>  Fri, 08 Jun 2012 07:54:29 -0400
Index: package/debian/compat
--- /dev/null	2013-05-05 10:34:48.558701642 +0000
+++ ncurses-5.9-20130504/package/debian/compat	2010-04-20 19:47:10.000000000 +0000
@@ -0,0 +1 @@
+5
Index: package/debian/control
--- /dev/null	2013-05-05 10:34:48.558701642 +0000
+++ ncurses-5.9-20130504/package/debian/control	2012-06-08 13:29:14.000000000 +0000
@@ -0,0 +1,16 @@
+Source: ncurses6
+Section: libdevel
+Priority: optional
+Maintainer: Thomas E. Dickey <dickey@invisible-island.net>
+Homepage: http://invisible-island.net/ncurses/
+Build-Depends: debhelper (>= 7)
+Standards-Version: 3.8.2
+
+Package: ncurses6
+Architecture: any
+Depends: ${misc:Depends}
+Description: shared libraries for terminal handling
+ The ncurses library routines are a terminal-independent method of
+ updating character screens with reasonable optimization.
+ .
+ This package is used for testing ABI 6.
Index: package/debian/copyright
--- /dev/null	2013-05-05 10:34:48.558701642 +0000
+++ ncurses-5.9-20130504/package/debian/copyright	2012-06-08 12:27:36.000000000 +0000
@@ -0,0 +1,112 @@
+This package is used for testing builds of ncurses.
+
+Copyright (c) 1998-2012 Free Software Foundation, Inc.
+Copyright © 2001 by Pradeep Padala
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, distribute with modifications, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
+THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name(s) of the above copyright
+holders shall not be used in advertising or otherwise to promote the
+sale, use or other dealings in this Software without prior written
+authorization.
+
+
+Copyright (C) 1994 X Consortium
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to
+deal in the Software without restriction, including without limitation the
+rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+sell copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
+TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of the X Consortium shall not
+be used in advertising or otherwise to promote the sale, use or other deal-
+ings in this Software without prior written authorization from the X Consor-
+tium.
+
+
+Copyright (c) 1980, 1991, 1992, 1993
+	The Regents of the University of California.  All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+3. Neither the name of the University nor the names of its contributors
+   may be used to endorse or promote products derived from this software
+   without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGE.
+
+
+Copyright 1996-2007 by Thomas E. Dickey
+
+                        All Rights Reserved
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name(s) of the above copyright
+holders shall not be used in advertising or otherwise to promote the
+sale, use or other dealings in this Software without prior written
+authorization.
+
+-- vile: txtmode file-encoding=utf-8
Index: package/debian/rules
--- /dev/null	2013-05-05 10:34:48.558701642 +0000
+++ ncurses-5.9-20130504/package/debian/rules	2013-03-30 18:58:01.000000000 +0000
@@ -0,0 +1,123 @@
+#!/usr/bin/make -f
+# MAde with the aid of dh_make, by Craig Small
+# Sample debian/rules that uses debhelper. GNU copyright 1997 by Joey Hess.
+# Some lines taken from debmake, by Cristoph Lameter.
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+# These are used for cross-compiling and for saving the configure script
+# from having to guess our platform (since we know it already)
+DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
+DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
+
+CC_NORMAL = -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wconversion
+CC_STRICT = $(CC_NORMAL) -W -Wbad-function-cast -Wcast-align -Wcast-qual -Wmissing-declarations -Wnested-externs -Wpointer-arith -Wwrite-strings -ansi -pedantic
+
+MY_DIR=/usr/local/ncurses6
+MYDATA=/usr/local/ncurses/share/terminfo
+BUILD_DIR=$(CURDIR)/debian/ncurses6
+
+CFLAGS = $(CC_NORMAL)
+
+ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
+        CFLAGS += -O0
+else
+        CFLAGS += -O2
+endif
+ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
+        INSTALL_PROGRAM += -s
+endif
+
+
+configure: configure-stamp
+configure-stamp:
+	dh_testdir
+
+	RPATH_LIST=../lib:$(MY_DIR)/lib \
+	CFLAGS="$(CFLAGS)" ./configure \
+		--host=$(DEB_HOST_GNU_TYPE) \
+		--build=$(DEB_BUILD_GNU_TYPE) \
+		--prefix=$(MY_DIR) \
+		--with-default-terminfo-dir=$(MYDATA) \
+		--with-terminfo-dirs=$(MYDATA):/usr/share/terminfo \
+		--disable-echo \
+		--disable-getcap \
+		--disable-leaks \
+		--disable-macros  \
+		--disable-termcap \
+		--enable-const \
+		--enable-ext-colors \
+		--enable-ext-mouse \
+		--enable-hard-tabs \
+		--enable-interop \
+		--enable-rpath \
+		--enable-sp-funcs \
+		--enable-warnings \
+		--enable-widec \
+		--verbose \
+		--with-develop \
+		--with-shared \
+		--with-termlib \
+		--with-ticlib \
+		--with-trace \
+		--with-cxx-shared \
+		--with-xterm-kbs=DEL \
+		--without-ada \
+		--without-debug \
+		--without-normal
+
+	touch configure-stamp
+
+build: build-stamp
+build-stamp: configure-stamp
+	dh_testdir
+
+	$(MAKE)
+
+	touch build-stamp
+
+clean:
+	dh_testdir
+	dh_testroot
+
+	[ ! -f makefile ] || $(MAKE) distclean
+
+	rm -f configure-stamp build-stamp install-stamp
+
+	dh_clean
+
+install: install-stamp
+install-stamp: build-stamp
+	dh_testdir
+	dh_testroot
+	dh_clean -k
+	dh_installdirs
+
+	$(MAKE) install.libs install.progs DESTDIR=$(BUILD_DIR)
+
+	( cd test && make ncurses LOCAL_LIBDIR=$(MY_DIR)/lib )
+	mv test/ncurses $(BUILD_DIR)$(MY_DIR)/bin/ncurses6
+
+	touch install-stamp
+
+# Build architecture-independent files here.
+binary-indep: build install
+# No binary-indep target.
+
+# Build architecture-dependent files here.
+binary-arch: build install
+	dh_testdir
+	dh_testroot
+	dh_installchangelogs NEWS
+	dh_strip
+	dh_compress
+	dh_fixperms
+	dh_installdeb
+	dh_shlibdeps
+	dh_gencontrol
+	dh_md5sums
+	dh_builddeb
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install install-stamp
Index: package/debian/source/format
--- /dev/null	2013-05-05 10:34:48.558701642 +0000
+++ ncurses-5.9-20130504/package/debian/source/format	2010-06-22 21:37:16.000000000 +0000
@@ -0,0 +1 @@
+3.0 (native)
Index: package/debian/watch
--- /dev/null	2013-05-05 10:34:48.558701642 +0000
+++ ncurses-5.9-20130504/package/debian/watch	2012-06-08 11:53:43.000000000 +0000
@@ -0,0 +1,4 @@
+version=3
+
+opts=passive ftp://invisible-island.net/ncurses/current/ncurses\.tar.gz \
+ debian  uupdate
Index: package/ncurses.spec
--- /dev/null	2013-05-05 10:34:48.558701642 +0000
+++ ncurses-5.9-20130504/package/ncurses.spec	2013-05-04 14:56:00.000000000 +0000
@@ -0,0 +1,92 @@
+Summary: shared libraries for terminal handling
+Name: ncurses6
+Release: 5.9
+Version: 20130504
+License: X11
+Group: Development/Libraries
+Source: ncurses-%{release}-%{version}.tgz
+# URL: http://invisible-island.net/ncurses/
+
+%define CC_NORMAL -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wconversion
+%define CC_STRICT %{CC_NORMAL} -W -Wbad-function-cast -Wcast-align -Wcast-qual -Wmissing-declarations -Wnested-externs -Wpointer-arith -Wwrite-strings -ansi -pedantic
+
+%define _prefix /usr/local/ncurses6
+%define MYDATA /usr/local/ncurses/share/terminfo
+
+%description
+The ncurses library routines are a terminal-independent method of
+updating character screens with reasonable optimization.
+
+This package is used for testing ABI 6.
+
+%prep
+
+%define debug_package %{nil}
+%setup -q -n ncurses-%{release}-%{version}
+
+%build
+CFLAGS="%{CC_NORMAL}" \
+RPATH_LIST=../lib:%{_prefix}/lib \
+%configure \
+	--target %{_target_platform} \
+	--prefix=%{_prefix} \
+	--includedir='${prefix}/include' \
+	--with-default-terminfo-dir=%{MYDATA} \
+	--with-install-prefix=$RPM_BUILD_ROOT \
+	--with-terminfo-dirs=%{MYDATA}:/usr/share/terminfo \
+	--disable-echo \
+	--disable-getcap \
+	--disable-leaks \
+	--disable-macros  \
+	--disable-overwrite  \
+	--disable-termcap \
+	--enable-const \
+	--enable-ext-colors \
+	--enable-ext-mouse \
+	--enable-hard-tabs \
+	--enable-interop \
+	--enable-rpath \
+	--enable-sp-funcs \
+	--enable-warnings \
+	--enable-widec \
+	--verbose \
+	--with-develop \
+	--with-shared \
+	--with-termlib \
+	--with-ticlib \
+	--with-trace \
+	--with-cxx-shared \
+	--with-xterm-kbs=DEL \
+	--without-ada \
+	--without-debug \
+	--without-normal
+
+make
+
+%install
+rm -rf $RPM_BUILD_ROOT
+
+make install.libs install.progs
+rm -f test/ncurses
+( cd test && make ncurses LOCAL_LIBDIR=%{_libdir} && mv ncurses $RPM_BUILD_ROOT/%{_bindir}/ncurses6 )
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%files
+%defattr(-,root,root,-)
+%{_bindir}/*
+%{_includedir}/*
+%{_libdir}/*
+#%{_datadir}/*
+
+%changelog
+
+* Sat Mar 09 2013 Thomas E. Dickey
+- add --with-cxx-shared option to demonstrate c++ binding as shared library
+
+* Sat Oct 26 2012 Thomas E. Dickey
+- add ncurses program as "ncurses6" to provide demonstration.
+
+* Fri Jun 08 2012 Thomas E. Dickey
+- initial version.
Index: panel/Makefile.in
Prereq:  1.58 
--- ncurses-5.9/panel/Makefile.in	2010-11-27 21:45:27.000000000 +0000
+++ ncurses-5.9-20130504/panel/Makefile.in	2012-09-29 19:37:34.000000000 +0000
@@ -1,6 +1,6 @@
-# $Id: Makefile.in,v 1.58 2010/11/27 21:45:27 tom Exp $
+# $Id: Makefile.in,v 1.61 2012/09/29 19:37:34 tom Exp $
 ##############################################################################
-# Copyright (c) 1998-2009,2010 Free Software Foundation, Inc.                #
+# Copyright (c) 1998-2011,2012 Free Software Foundation, Inc.                #
 #                                                                            #
 # Permission is hereby granted, free of charge, to any person obtaining a    #
 # copy of this software and associated documentation files (the "Software"), #
@@ -57,6 +57,7 @@
 bindir		= @bindir@
 libdir		= @libdir@
 includedir	= @includedir@
+datarootdir	= @datarootdir@
 datadir		= @datadir@
 
 LIBTOOL		= @LIBTOOL@
@@ -103,6 +104,7 @@
 SHLIB_DIRS	= -L../lib
 SHLIB_LIST	= $(SHLIB_DIRS) -lncurses@LIB_SUFFIX@ @SHLIB_LIST@
 
+RPATH_LIST	= @RPATH_LIST@
 MK_SHARED_LIB	= @MK_SHARED_LIB@
 
 NCURSES_MAJOR	= @NCURSES_MAJOR@
@@ -112,7 +114,7 @@
 
 RANLIB		= @LIB_PREP@
 
-LIBRARIES	= @LIBS_TO_MAKE@
+LIBRARIES	= @Libs_To_Make@
 
 LINT		= @LINT@
 LINT_OPTS	= @LINT_OPTS@
Index: panel/p_above.c
Prereq:  1.8 
--- ncurses-5.9/panel/p_above.c	2010-01-23 21:22:15.000000000 +0000
+++ ncurses-5.9-20130504/panel/p_above.c	2012-03-10 23:43:41.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -36,13 +36,13 @@
  */
 #include "panel.priv.h"
 
-MODULE_ID("$Id: p_above.c,v 1.8 2010/01/23 21:22:15 tom Exp $")
+MODULE_ID("$Id: p_above.c,v 1.9 2012/03/10 23:43:41 tom Exp $")
 
 #if NCURSES_SP_FUNCS
 NCURSES_EXPORT(PANEL *)
 ground_panel(SCREEN * sp)
 {
-  T((T_CALLED("ground_panel(%p)"), sp));
+  T((T_CALLED("ground_panel(%p)"), (void *)sp));
   if (sp)
     {
       struct panelhook *ph = NCURSES_SP_NAME(_nc_panelhook) (sp);
Index: panel/p_below.c
Prereq:  1.8 
--- ncurses-5.9/panel/p_below.c	2010-01-23 21:22:15.000000000 +0000
+++ ncurses-5.9-20130504/panel/p_below.c	2012-03-10 23:43:41.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -36,13 +36,13 @@
  */
 #include "panel.priv.h"
 
-MODULE_ID("$Id: p_below.c,v 1.8 2010/01/23 21:22:15 tom Exp $")
+MODULE_ID("$Id: p_below.c,v 1.9 2012/03/10 23:43:41 tom Exp $")
 
 #if NCURSES_SP_FUNCS
 NCURSES_EXPORT(PANEL *)
 ceiling_panel(SCREEN * sp)
 {
-  T((T_CALLED("ceiling_panel(%p)"), sp));
+  T((T_CALLED("ceiling_panel(%p)"), (void *)sp));
   if (sp)
     {
       struct panelhook *ph = NCURSES_SP_NAME(_nc_panelhook) (sp);
Index: panel/panel.c
Prereq:  1.25 
--- ncurses-5.9/panel/panel.c	2010-01-23 21:22:16.000000000 +0000
+++ ncurses-5.9-20130504/panel/panel.c	2012-02-23 10:02:15.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -36,7 +36,7 @@
 /* panel.c -- implementation of panels library, some core routines */
 #include "panel.priv.h"
 
-MODULE_ID("$Id: panel.c,v 1.25 2010/01/23 21:22:16 tom Exp $")
+MODULE_ID("$Id: panel.c,v 1.26 2012/02/23 10:02:15 tom Exp $")
 
 /*+-------------------------------------------------------------------------
 	_nc_retrace_panel (pan)
@@ -61,9 +61,9 @@
   char temp[32];
 
   if (ptr != 0)
-    sprintf(temp, "ptr:%p", ptr);
+    _nc_SPRINTF(temp, _nc_SLIMIT(sizeof(temp)) "ptr:%p", ptr);
   else
-    strcpy(temp, "<null>");
+    _nc_STRCPY(temp, "<null>", sizeof(temp));
   return _nc_visbuf(temp);
 }
 #endif
@@ -95,7 +95,7 @@
 
   GetPanelHook(pan);
 
-  sprintf(s80, fmt, num, pan);
+  _nc_SPRINTF(s80, _nc_SLIMIT(sizeof(s80)) fmt, num, pan);
   _tracef("%s b=%s t=%s", s80,
 	  (_nc_bottom_panel) ? USER_PTR(_nc_bottom_panel->user) : "--",
 	  (_nc_top_panel) ? USER_PTR(_nc_top_panel->user) : "--");
@@ -143,7 +143,7 @@
 {
   char s80[80];
 
-  sprintf(s80, "Touchline s=%d c=%d", start, count);
+  _nc_SPRINTF(s80, _nc_SLIMIT(sizeof(s80)) "Touchline s=%d c=%d", start, count);
   dPanel(s80, pan);
   touchline(pan->win, start, count);
 }
Index: panel/panel.priv.h
Prereq:  1.23 
--- ncurses-5.9/panel/panel.priv.h	2009-04-11 20:33:55.000000000 +0000
+++ ncurses-5.9-20130504/panel/panel.priv.h	2012-12-15 23:57:43.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2008,2009 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -26,7 +26,7 @@
  * authorization.                                                           *
  ****************************************************************************/
 
-/* $Id: panel.priv.h,v 1.23 2009/04/11 20:33:55 tom Exp $ */
+/* $Id: panel.priv.h,v 1.25 2012/12/15 23:57:43 tom Exp $ */
 
 #ifndef NCURSES_PANEL_PRIV_H
 #define NCURSES_PANEL_PRIV_H 1
@@ -89,7 +89,7 @@
 #define GetScreenHook(sp) \
 			struct panelhook* ph = NCURSES_SP_NAME(_nc_panelhook)(sp)
 #define GetPanelHook(pan) \
-			GetScreenHook(_nc_screen_of((pan)->win))
+			GetScreenHook(pan ? _nc_screen_of((pan)->win) : 0)
 #define GetWindowHook(win) \
 			SCREEN* sp = _nc_screen_of(win); \
 			GetScreenHook(sp)
@@ -160,7 +160,7 @@
 ---------------------------------------------------------------------------*/
 #define PANEL_UPDATE(pan,panstart)\
 {  PANEL* pan2 = ((panstart) ? (panstart) : _nc_bottom_panel);\
-   while(pan2) {\
+   while(pan2 && pan2->win) {\
       if ((pan2 != pan) && PANELS_OVERLAPPED(pan,pan2)) {\
         int y, ix1, ix2, iy1, iy2;\
         COMPUTE_INTERSECTION(pan, pan2, ix1, ix2, iy1, iy2);\
Index: progs/Makefile.in
Prereq:  1.85 
--- ncurses-5.9/progs/Makefile.in	2010-11-27 21:45:27.000000000 +0000
+++ ncurses-5.9-20130504/progs/Makefile.in	2012-08-11 21:31:56.000000000 +0000
@@ -1,6 +1,6 @@
-# $Id: Makefile.in,v 1.85 2010/11/27 21:45:27 tom Exp $
+# $Id: Makefile.in,v 1.89 2012/08/11 21:31:56 tom Exp $
 ##############################################################################
-# Copyright (c) 1998-2009,2010 Free Software Foundation, Inc.                #
+# Copyright (c) 1998-2011,2012 Free Software Foundation, Inc.                #
 #                                                                            #
 # Permission is hereby granted, free of charge, to any person obtaining a    #
 # copy of this software and associated documentation files (the "Software"), #
@@ -61,6 +61,7 @@
 bindir		= @bindir@
 libdir		= @libdir@
 includedir	= @includedir@
+datarootdir	= @datarootdir@
 datadir		= @datadir@
 
 LIBTOOL		= @LIBTOOL@
@@ -104,20 +105,21 @@
 LD		= @LD@
 LINK		= @LINK_PROGS@ $(LIBTOOL_LINK)
 LDFLAGS		= @EXTRA_LDFLAGS@ @LDFLAGS@
+RPATH_LIST	= @RPATH_LIST@
 
 LDFLAGS_LIBTOOL	= $(LDFLAGS) $(CFLAGS_LIBTOOL)
 LDFLAGS_NORMAL	= $(LDFLAGS) $(CFLAGS_NORMAL)
 LDFLAGS_DEBUG	= $(LDFLAGS) $(CFLAGS_DEBUG)
-LDFLAGS_PROFILE	= $(LDFLAGS) $(CFLAGS_PROFILE) 
+LDFLAGS_PROFILE	= $(LDFLAGS) $(CFLAGS_PROFILE)
 LDFLAGS_SHARED	= $(LDFLAGS) $(CFLAGS_SHARED) @LD_SHARED_OPTS@
 
 LDFLAGS_DEFAULT	= $(LDFLAGS_@DFT_UPR_MODEL@)
 
-LIBS_TIC	= @LDFLAGS_STATIC@ @TICS_ARGS@ @TINFO_ARGS@ @LDFLAGS_SHARED@ @LD_MODEL@ @LIBS@
-LDFLAGS_TIC	= $(LDFLAGS_@DFT_UPR_MODEL@) $(LIBS_TIC)
+LIBS_TIC	= @TINFO_LDFLAGS@ @LDFLAGS_STATIC@ @TICS_LIBS@ @TINFO_LIBS@ @LDFLAGS_SHARED@ @LD_MODEL@ @LIBS@
+LDFLAGS_TIC	= @TICS_LDFLAGS@ $(LDFLAGS_@DFT_UPR_MODEL@) $(LIBS_TIC)
 
-LIBS_TINFO	= @LDFLAGS_STATIC@ @TINFO_ARGS@ @LDFLAGS_SHARED@ @LD_MODEL@ @LIBS@
-LDFLAGS_TINFO	= $(LDFLAGS_@DFT_UPR_MODEL@) $(LIBS_TINFO)
+LIBS_TINFO	= @LDFLAGS_STATIC@ @TINFO_LIBS@ @LDFLAGS_SHARED@ @LD_MODEL@ @LIBS@
+LDFLAGS_TINFO	= @TINFO_LDFLAGS@ $(LDFLAGS_@DFT_UPR_MODEL@) $(LIBS_TINFO)
 
 LINT		= @LINT@
 LINT_OPTS	= @LINT_OPTS@
@@ -230,46 +232,46 @@
 	$(MODEL)/transform$o
 
 tic$x: $(DEPS_TIC) $(DEPS_CURSES) transform.h
-	@ECHO_LINK@ $(LINK) $(DEPS_TIC) $(LDFLAGS_TIC) -o $@
+	@ECHO_LD@ $(LINK) $(DEPS_TIC) $(LDFLAGS_TIC) -o $@
 
 DEPS_TOE = \
 	$(MODEL)/toe$o
 
 toe$x: $(DEPS_TOE) $(DEPS_CURSES)
-	@ECHO_LINK@ $(LINK) $(DEPS_TOE) $(LDFLAGS_TIC) -o $@
+	@ECHO_LD@ $(LINK) $(DEPS_TOE) $(LDFLAGS_TIC) -o $@
 
 DEPS_CLEAR = \
 	$(MODEL)/clear$o
 
 clear$x: $(DEPS_CLEAR) $(DEPS_CURSES)
-	@ECHO_LINK@ $(LINK) $(DEPS_CLEAR) $(LDFLAGS_TINFO) -o $@
+	@ECHO_LD@ $(LINK) $(DEPS_CLEAR) $(LDFLAGS_TINFO) -o $@
 
 DEPS_TABS = \
 	$(MODEL)/tabs$o
 
 tabs$x: $(DEPS_TABS) $(DEPS_TABS)
-	@ECHO_LINK@ $(LINK) $(DEPS_TABS) $(LDFLAGS_TINFO) -o $@
+	@ECHO_LD@ $(LINK) $(DEPS_TABS) $(LDFLAGS_TINFO) -o $@
 
 DEPS_TPUT = \
 	$(MODEL)/tput$o \
 	$(MODEL)/transform$o
 
 tput$x: $(DEPS_TPUT) $(DEPS_CURSES) transform.h
-	@ECHO_LINK@ $(LINK) $(DEPS_TPUT) $(LDFLAGS_TINFO) -o $@
+	@ECHO_LD@ $(LINK) $(DEPS_TPUT) $(LDFLAGS_TINFO) -o $@
 
 DEPS_INFOCMP = \
 	$(MODEL)/infocmp$o \
 	$(MODEL)/dump_entry$o
 
 infocmp$x: $(DEPS_INFOCMP) $(DEPS_CURSES)
-	@ECHO_LINK@ $(LINK) $(DEPS_INFOCMP) $(LDFLAGS_TIC) -o $@
+	@ECHO_LD@ $(LINK) $(DEPS_INFOCMP) $(LDFLAGS_TIC) -o $@
 
 DEPS_TSET = \
 	$(MODEL)/tset$o \
 	$(MODEL)/transform$o
 
 tset$x: $(DEPS_TSET) $(DEPS_CURSES) transform.h
-	@ECHO_LINK@ $(LINK) $(DEPS_TSET) $(LDFLAGS_TINFO) -o $@
+	@ECHO_LD@ $(LINK) $(DEPS_TSET) $(LDFLAGS_TINFO) -o $@
 
 termsort.c: $(srcdir)/MKtermsort.sh
 	sh $(srcdir)/MKtermsort.sh $(AWK) $(srcdir)/../include/@TERMINFO_CAPS@ >$@
Index: progs/capconvert
Prereq:  1.4 
--- ncurses-5.9/progs/capconvert	2006-04-22 21:46:17.000000000 +0000
+++ ncurses-5.9-20130504/progs/capconvert	2011-11-12 23:28:07.000000000 +0000
@@ -1,6 +1,6 @@
 #!/bin/sh
 ##############################################################################
-# Copyright (c) 1998,2006 Free Software Foundation, Inc.                     #
+# Copyright (c) 1998-2006,2011 Free Software Foundation, Inc.                #
 #                                                                            #
 # Permission is hereby granted, free of charge, to any person obtaining a    #
 # copy of this software and associated documentation files (the "Software"), #
@@ -26,7 +26,7 @@
 # use or other dealings in this Software without prior written               #
 # authorization.                                                             #
 ##############################################################################
-# $Id: capconvert,v 1.4 2006/04/22 21:46:17 tom Exp $
+# $Id: capconvert,v 1.5 2011/11/12 23:28:07 Robert.Millan Exp $
 #
 # capconvert -- automated conversion from termcap to terminfo
 #
@@ -77,16 +77,18 @@
 		# Assumes the terminfo master covers all canned terminal types
 		exit;
 	fi
-	if test "$TERM" = "xterm"
-	then
+	case $TERM in
+	xterm | xterm-*)
 		echo "You are running xterm, which usually sets TERMCAP itself."
 		echo "We can ignore this, because terminfo knows about xterm."
 		echo "So you will just use the system-wide terminfo tree."
-		exit;
-	else
+		exit
+		;;
+	*)
 		echo "We will have to make a local one for you anyway, to capture the effect"
 		echo "of your TERMCAP variable."
-	fi
+		;;
+	esac
 else
 	echo "No system-wide terminfo tree.  We will make you a local one."
 fi
@@ -109,7 +111,7 @@
 for x in $PATH .
 do
 	if test $OPT $x/tic
-	then 
+	then
 		TIC=$x/tic
 		break
 	fi
@@ -141,7 +143,7 @@
 then
 	echo "It appears you already have a private terminfo directory"
 	echo "at $HOME/.terminfo; this seems odd, because TERMINFO"
-	echo "is not defined.  I am not going to second-guess this -- if you" 
+	echo "is not defined.  I am not going to second-guess this -- if you"
 	echo "really want me to try auto-configuring for you, remove or"
 	echo "rename $HOME/terminfo and run me again."
 	exit;
@@ -214,7 +216,7 @@
 #
 echo "You now have a private tree under $HOME/.terminfo;"
 echo "the ncurses library will automatically read from it,"
-echo "and ncurses tic will automatically compile entries to it." 
+echo "and ncurses tic will automatically compile entries to it."
 
 # We're done unless user has a .termcap file or equivalent named by TERMCAP
 if test -z "$TERMCAP"
@@ -235,7 +237,7 @@
 	echo "Done."
 	echo "Note that editing $HOME/.termcap will no longer change the data curses sees."
 elif test -f "$TERMCAP"
-then 
+then
 	echo "Your TERMCAP names the file $TERMCAP.  I will compile that."
 	eval $TIC $TERMCAP
 	echo "Done."
Index: progs/dump_entry.c
Prereq:  1.89 
--- ncurses-5.9/progs/dump_entry.c	2010-05-01 22:04:08.000000000 +0000
+++ ncurses-5.9-20130504/progs/dump_entry.c	2013-05-04 18:48:56.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2008,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -39,7 +39,7 @@
 #include "termsort.c"		/* this C file is generated */
 #include <parametrized.h>	/* so is this */
 
-MODULE_ID("$Id: dump_entry.c,v 1.89 2010/05/01 22:04:08 tom Exp $")
+MODULE_ID("$Id: dump_entry.c,v 1.109 2013/05/04 18:48:56 tom Exp $")
 
 #define INDENT			8
 #define DISCARD(string) string = ABSENT_STRING
@@ -57,6 +57,7 @@
 static int outform;		/* output format to use */
 static int sortmode;		/* sort mode to use */
 static int width = 60;		/* max line width for listings */
+static int height = 65535;	/* max number of lines for listings */
 static int column;		/* current column, limited by 'width' */
 static int oldcol;		/* last value of column before wrap */
 static bool pretty;		/* true if we format if-then-else strings */
@@ -72,7 +73,7 @@
 static NCURSES_CONST char *const *num_names;
 static NCURSES_CONST char *const *str_names;
 
-static const char *separator, *trailer;
+static const char *separator = "", *trailer = "";
 
 /* cover various ports and variants of terminfo */
 #define V_ALLCAPS	0	/* all capabilities (SVr4, XSI, ncurses) */
@@ -99,6 +100,15 @@
 #define StrIndirect(j)  ((sortmode == S_NOSORT) ? (j) : str_indirect[j])
 #endif
 
+static void failed(const char *) GCC_NORETURN;
+
+static void
+failed(const char *s)
+{
+    perror(s);
+    ExitProgram(EXIT_FAILURE);
+}
+
 static void
 strncpy_DYN(DYNBUF * dst, const char *src, size_t need)
 {
@@ -106,6 +116,8 @@
     if (want > dst->size) {
 	dst->size += (want + 1024);	/* be generous */
 	dst->text = typeRealloc(char, dst->size, dst->text);
+	if (dst->text == 0)
+	    failed("strncpy_DYN");
     }
     (void) strncpy(dst->text + dst->used, src, need);
     dst->used += need;
@@ -172,11 +184,17 @@
 }
 
 void
-dump_init(const char *version, int mode, int sort, int twidth, int traceval,
+dump_init(const char *version,
+	  int mode,
+	  int sort,
+	  int twidth,
+	  int theight,
+	  unsigned traceval,
 	  bool formatted)
 /* set up for entry display */
 {
     width = twidth;
+    height = theight;
     pretty = formatted;
 
     /* versions */
@@ -201,7 +219,7 @@
 	bool_names = boolnames;
 	num_names = numnames;
 	str_names = strnames;
-	separator = twidth ? ", " : ",";
+	separator = (twidth > 0 && theight > 1) ? ", " : ",";
 	trailer = "\n\t";
 	break;
 
@@ -209,7 +227,7 @@
 	bool_names = boolfnames;
 	num_names = numfnames;
 	str_names = strfnames;
-	separator = twidth ? ", " : ",";
+	separator = (twidth > 0 && theight > 1) ? ", " : ",";
 	trailer = "\n\t";
 	break;
 
@@ -291,7 +309,11 @@
 static void set_obsolete_termcaps(TERMTYPE *tp);
 
 /* is this the index of a function key string? */
-#define FNKEY(i)	(((i)<= 65 && (i)>= 75) || ((i)<= 216 && (i)>= 268))
+#define FNKEY(i) \
+    (((i) >= STR_IDX(key_f0) && \
+      (i) <= STR_IDX(key_f9)) || \
+     ((i) >= STR_IDX(key_f11) && \
+      (i) <= STR_IDX(key_f63)))
 
 /*
  * If we configure with a different Caps file, the offsets into the arrays
@@ -393,8 +415,8 @@
 static void
 wrap_concat(const char *src)
 {
-    unsigned need = strlen(src);
-    unsigned want = strlen(separator) + need;
+    size_t need = strlen(src);
+    size_t want = strlen(separator) + need;
 
     if (column > INDENT
 	&& column + (int) want > width) {
@@ -473,7 +495,7 @@
 }
 
 static char *
-fmt_complex(char *src, int level)
+fmt_complex(TERMTYPE *tterm, const char *capability, char *src, int level)
 {
     bool percent = FALSE;
     bool params = has_params(src);
@@ -509,13 +531,15 @@
 		    strncpy_DYN(&tmpbuf, "%", 1);
 		    strncpy_DYN(&tmpbuf, src, 1);
 		    if (*src++ == '?') {
-			src = fmt_complex(src, level + 1);
+			src = fmt_complex(tterm, capability, src, level + 1);
 			if (*src != '\0' && *src != '%') {
 			    strncpy_DYN(&tmpbuf, "\n", 1);
 			    indent_DYN(&tmpbuf, level + 1);
 			}
 		    } else if (level == 1) {
-			_nc_warning("%%%c without %%?", *src);
+			_nc_warning("%s: %%%c without %%? in %s",
+				    _nc_first_name(tterm->term_names),
+				    *src, capability);
 		    }
 		}
 		continue;
@@ -529,9 +553,17 @@
 		    indent_DYN(&tmpbuf, level);
 		    strncpy_DYN(&tmpbuf, "%", 1);
 		    strncpy_DYN(&tmpbuf, src++, 1);
+		    if (src[0] == '%'
+			&& src[1] != '\0'
+			&& (strchr("?e;", src[1])) == 0) {
+			tmpbuf.text[tmpbuf.used++] = '\n';
+			indent_DYN(&tmpbuf, level);
+		    }
 		    return src;
 		}
-		_nc_warning("%%; without %%?");
+		_nc_warning("%s: %%; without %%? in %s",
+			    _nc_first_name(tterm->term_names),
+			    capability);
 	    }
 	    break;
 	case 'p':
@@ -593,14 +625,28 @@
 	column = INDENT;	/* FIXME: workaround to prevent empty lines */
     } else {
 	strcpy_DYN(&outbuf, tterm->term_names);
+
+	/*
+	 * Colon is legal in terminfo descriptions, but not in termcap.
+	 */
+	if (!infodump) {
+	    char *p = outbuf.text;
+	    while (*p) {
+		if (*p == ':') {
+		    *p = '=';
+		}
+		++p;
+	    }
+	}
 	strcpy_DYN(&outbuf, separator);
 	column = (int) outbuf.used;
-	force_wrap();
+	if (height > 1)
+	    force_wrap();
     }
 
     for_each_boolean(j, tterm) {
 	i = BoolIndirect(j);
-	name = ExtBoolname(tterm, i, bool_names);
+	name = ExtBoolname(tterm, (int) i, bool_names);
 	assert(strlen(name) < sizeof(buffer) - EXTRA_CAP);
 
 	if (!version_filter(BOOLEAN, i))
@@ -610,21 +656,21 @@
 
 	predval = pred(BOOLEAN, i);
 	if (predval != FAIL) {
-	    (void) strcpy(buffer, name);
+	    _nc_STRCPY(buffer, name, sizeof(buffer));
 	    if (predval <= 0)
-		(void) strcat(buffer, "@");
+		_nc_STRCAT(buffer, "@", sizeof(buffer));
 	    else if (i + 1 > num_bools)
 		num_bools = i + 1;
 	    WRAP_CONCAT;
 	}
     }
 
-    if (column != INDENT)
+    if (column != INDENT && height > 1)
 	force_wrap();
 
     for_each_number(j, tterm) {
 	i = NumIndirect(j);
-	name = ExtNumname(tterm, i, num_names);
+	name = ExtNumname(tterm, (int) i, num_names);
 	assert(strlen(name) < sizeof(buffer) - EXTRA_CAP);
 
 	if (!version_filter(NUMBER, i))
@@ -635,9 +681,11 @@
 	predval = pred(NUMBER, i);
 	if (predval != FAIL) {
 	    if (tterm->Numbers[i] < 0) {
-		sprintf(buffer, "%s@", name);
+		_nc_SPRINTF(buffer, _nc_SLIMIT(sizeof(buffer))
+			    "%s@", name);
 	    } else {
-		sprintf(buffer, "%s#%d", name, tterm->Numbers[i]);
+		_nc_SPRINTF(buffer, _nc_SLIMIT(sizeof(buffer))
+			    "%s#%d", name, tterm->Numbers[i]);
 		if (i + 1 > num_values)
 		    num_values = i + 1;
 	    }
@@ -645,7 +693,7 @@
 	}
     }
 
-    if (column != INDENT)
+    if (column != INDENT && height > 1)
 	force_wrap();
 
     len += (int) (num_bools
@@ -670,7 +718,7 @@
 
     for_each_string(j, tterm) {
 	i = StrIndirect(j);
-	name = ExtStrname(tterm, i, str_names);
+	name = ExtStrname(tterm, (int) i, str_names);
 	assert(strlen(name) < sizeof(buffer) - EXTRA_CAP);
 
 	capability = tterm->Strings[i];
@@ -698,14 +746,14 @@
 	    if (PRESENT(insert_character) || PRESENT(parm_ich)) {
 		if (SAME_CAP(i, enter_insert_mode)
 		    && enter_insert_mode == ABSENT_STRING) {
-		    (void) strcpy(buffer, "im=");
+		    _nc_STRCPY(buffer, "im=", sizeof(buffer));
 		    WRAP_CONCAT;
 		    continue;
 		}
 
 		if (SAME_CAP(i, exit_insert_mode)
 		    && exit_insert_mode == ABSENT_STRING) {
-		    (void) strcpy(buffer, "ei=");
+		    _nc_STRCPY(buffer, "ei=", sizeof(buffer));
 		    WRAP_CONCAT;
 		    continue;
 		}
@@ -739,7 +787,8 @@
 		num_strings = i + 1;
 
 	    if (!VALID_STRING(capability)) {
-		sprintf(buffer, "%s@", name);
+		_nc_SPRINTF(buffer, _nc_SLIMIT(sizeof(buffer))
+			    "%s@", name);
 		WRAP_CONCAT;
 	    } else if (outform == F_TERMCAP || outform == F_TCONVERR) {
 		int params = ((i < (int) SIZEOF(parametrized))
@@ -750,13 +799,14 @@
 
 		if (cv == 0) {
 		    if (outform == F_TCONVERR) {
-			sprintf(buffer, "%s=!!! %s WILL NOT CONVERT !!!",
-				name, srccap);
+			_nc_SPRINTF(buffer, _nc_SLIMIT(sizeof(buffer))
+				    "%s=!!! %s WILL NOT CONVERT !!!",
+				    name, srccap);
 		    } else if (suppress_untranslatable) {
 			continue;
 		    } else {
 			char *s = srccap, *d = buffer;
-			sprintf(d, "..%s=", name);
+			_nc_SPRINTF(d, _nc_SLIMIT(sizeof(buffer)) "..%s=", name);
 			d += strlen(d);
 			while ((*d = *s++) != 0) {
 			    if (*d == ':') {
@@ -769,7 +819,8 @@
 			}
 		    }
 		} else {
-		    sprintf(buffer, "%s=%s", name, cv);
+		    _nc_SPRINTF(buffer, _nc_SLIMIT(sizeof(buffer))
+				"%s=%s", name, cv);
 		}
 		len += (int) strlen(capability) + 1;
 		WRAP_CONCAT;
@@ -783,7 +834,7 @@
 		if (pretty
 		    && (outform == F_TERMINFO
 			|| outform == F_VARIABLE)) {
-		    fmt_complex(src, 1);
+		    fmt_complex(tterm, name, src, 1);
 		} else {
 		    strcpy_DYN(&tmpbuf, src);
 		}
@@ -793,7 +844,9 @@
 	    }
 	}
 	/* e.g., trimmed_sgr0 */
-	if (capability != tterm->Strings[i])
+	if (capability != ABSENT_STRING &&
+	    capability != CANCELLED_STRING &&
+	    capability != tterm->Strings[i])
 	    free(capability);
     }
     len += (int) (num_strings * 2);
@@ -805,11 +858,13 @@
      */
     if (tversion == V_HPUX) {
 	if (VALID_STRING(memory_lock)) {
-	    (void) sprintf(buffer, "meml=%s", memory_lock);
+	    _nc_SPRINTF(buffer, _nc_SLIMIT(sizeof(buffer))
+			"meml=%s", memory_lock);
 	    WRAP_CONCAT;
 	}
 	if (VALID_STRING(memory_unlock)) {
-	    (void) sprintf(buffer, "memu=%s", memory_unlock);
+	    _nc_SPRINTF(buffer, _nc_SLIMIT(sizeof(buffer))
+			"memu=%s", memory_unlock);
 	    WRAP_CONCAT;
 	}
     } else if (tversion == V_AIX) {
@@ -832,9 +887,41 @@
 	    tp[0] = '\0';
 
 	    if (box_ok) {
-		(void) strcpy(buffer, "box1=");
-		(void) strcat(buffer, _nc_tic_expand(boxchars,
-						     outform == F_TERMINFO, numbers));
+		char *tmp = _nc_tic_expand(boxchars,
+					   (outform == F_TERMINFO),
+					   numbers);
+		_nc_STRCPY(buffer, "box1=", sizeof(buffer));
+		while (*tmp != '\0') {
+		    size_t have = strlen(buffer);
+		    size_t next = strlen(tmp);
+		    size_t want = have + next + 1;
+		    size_t last = next;
+		    char save = '\0';
+
+		    /*
+		     * If the expanded string is too long for the buffer,
+		     * chop it off and save the location where we chopped it.
+		     */
+		    if (want >= sizeof(buffer)) {
+			save = tmp[last];
+			tmp[last] = '\0';
+		    }
+		    _nc_STRCAT(buffer, tmp, sizeof(buffer));
+
+		    /*
+		     * If we chopped the buffer, replace the missing piece and
+		     * shift everything to append the remainder.
+		     */
+		    if (save != '\0') {
+			next = 0;
+			tmp[last] = save;
+			while ((tmp[next] = tmp[last + next]) != '\0') {
+			    ++next;
+			}
+		    } else {
+			break;
+		    }
+		}
 		WRAP_CONCAT;
 	    }
 	}
@@ -846,7 +933,7 @@
      */
     if (outcount) {
 	bool trimmed = FALSE;
-	j = outbuf.used;
+	j = (PredIdx) outbuf.used;
 	if (j >= 2
 	    && outbuf.text[j - 1] == '\t'
 	    && outbuf.text[j - 2] == '\n') {
@@ -926,7 +1013,7 @@
     char name[10];
 
     for (n = 0; n <= 10; ++n) {
-	sprintf(name, "lf%d", n);
+	_nc_SPRINTF(name, _nc_SLIMIT(sizeof(name)) "lf%d", n);
 	if ((cap = find_string(tterm, name)) != ABSENT_STRING
 	    && kill_string(tterm, cap)) {
 	    target -= (int) (strlen(cap) + 5);
@@ -951,7 +1038,7 @@
     char name[10];
 
     for (n = 60; n >= 0; --n) {
-	sprintf(name, "kf%d", n);
+	_nc_SPRINTF(name, _nc_SLIMIT(sizeof(name)) "kf%d", n);
 	if ((cap = find_string(tterm, name)) != ABSENT_STRING
 	    && kill_string(tterm, cap)) {
 	    target -= (int) (strlen(cap) + 5);
@@ -1064,7 +1151,7 @@
 	     */
 	    unsigned n;
 	    for (n = STRCOUNT; n < NUM_STRINGS(tterm); n++) {
-		const char *name = ExtStrname(tterm, n, strnames);
+		const char *name = ExtStrname(tterm, (int) n, strnames);
 
 		if (VALID_STRING(tterm->Strings[n])) {
 		    set_attributes = ABSENT_STRING;
@@ -1144,21 +1231,45 @@
 
     if (outform == F_TERMCAP || outform == F_TCONVERR)
 	trim_trailing();
-    (void) sprintf(buffer, "%s%s", infodump ? "use=" : "tc=", name);
+    _nc_SPRINTF(buffer, _nc_SLIMIT(sizeof(buffer))
+		"%s%s", infodump ? "use=" : "tc=", name);
     wrap_concat(buffer);
 }
 
 int
 show_entry(void)
 {
-    trim_trailing();
+    /*
+     * Trim any remaining whitespace.
+     */
+    if (outbuf.used != 0) {
+	bool infodump = (outform != F_TERMCAP && outform != F_TCONVERR);
+	char delim = (char) (infodump ? ',' : ':');
+	int j;
+
+	for (j = (int) outbuf.used - 1; j > 0; --j) {
+	    char ch = outbuf.text[j];
+	    if (ch == '\n') {
+		;
+	    } else if (isspace(UChar(ch))) {
+		outbuf.used = (size_t) j;
+	    } else if (!infodump && ch == '\\') {
+		outbuf.used = (size_t) j;
+	    } else if (ch == delim && (j == 0 || outbuf.text[j - 1] != '\\')) {
+		outbuf.used = (size_t) (j + 1);
+	    } else {
+		break;
+	    }
+	}
+	outbuf.text[outbuf.used] = '\0';
+    }
     (void) fputs(outbuf.text, stdout);
     putchar('\n');
     return (int) outbuf.used;
 }
 
 void
-compare_entry(void (*hook) (PredType t, PredIdx i, const char *name),
+compare_entry(PredHook hook,
 	      TERMTYPE *tp GCC_UNUSED,
 	      bool quiet)
 /* compare two entries */
@@ -1170,7 +1281,7 @@
 	fputs("    comparing booleans.\n", stdout);
     for_each_boolean(j, tp) {
 	i = BoolIndirect(j);
-	name = ExtBoolname(tp, i, bool_names);
+	name = ExtBoolname(tp, (int) i, bool_names);
 
 	if (isObsolete(outform, name))
 	    continue;
@@ -1182,7 +1293,7 @@
 	fputs("    comparing numbers.\n", stdout);
     for_each_number(j, tp) {
 	i = NumIndirect(j);
-	name = ExtNumname(tp, i, num_names);
+	name = ExtNumname(tp, (int) i, num_names);
 
 	if (isObsolete(outform, name))
 	    continue;
@@ -1194,7 +1305,7 @@
 	fputs("    comparing strings.\n", stdout);
     for_each_string(j, tp) {
 	i = StrIndirect(j);
-	name = ExtStrname(tp, i, str_names);
+	name = ExtStrname(tp, (int) i, str_names);
 
 	if (isObsolete(outform, name))
 	    continue;
Index: progs/dump_entry.h
Prereq:  1.30 
--- ncurses-5.9/progs/dump_entry.h	2008-07-12 20:23:03.000000000 +0000
+++ ncurses-5.9-20130504/progs/dump_entry.h	2011-08-06 16:33:05.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2006,2008 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2008,2011 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -32,9 +32,8 @@
  *     and: Thomas E. Dickey                        1996-on                 *
  ****************************************************************************/
 
-
 /*
- * $Id: dump_entry.h,v 1.30 2008/07/12 20:23:03 tom Exp $
+ * $Id: dump_entry.h,v 1.32 2011/08/06 16:33:05 tom Exp $
  *
  * Dump control definitions and variables
  */
@@ -64,16 +63,17 @@
 
 typedef unsigned PredType;
 typedef unsigned PredIdx;
-typedef int (*PredFunc)(PredType, PredIdx);
+typedef int (*PredFunc) (PredType, PredIdx);
+typedef void (*PredHook) (PredType, PredIdx, const char *);
 
 extern NCURSES_CONST char *nametrans(const char *);
 extern int fmt_entry(TERMTYPE *, PredFunc, bool, bool, bool, int);
 extern int show_entry(void);
-extern void compare_entry(void (*)(PredType, PredIdx, const char *), TERMTYPE *, bool);
+extern void compare_entry(PredHook, TERMTYPE *, bool);
 extern void dump_entry(TERMTYPE *, bool, bool, int, PredFunc);
-extern void dump_init(const char *, int, int, int, int, bool);
+extern void dump_init(const char *, int, int, int, int, unsigned, bool);
 extern void dump_uses(const char *, bool);
-extern void repair_acsc(TERMTYPE * tp);
+extern void repair_acsc(TERMTYPE *tp);
 
 #define FAIL	-1
 
Index: progs/infocmp.c
Prereq:  1.105 
--- ncurses-5.9/progs/infocmp.c	2010-05-01 22:04:08.000000000 +0000
+++ ncurses-5.9-20130504/progs/infocmp.c	2013-04-13 22:15:14.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -42,7 +42,7 @@
 
 #include <dump_entry.h>
 
-MODULE_ID("$Id: infocmp.c,v 1.105 2010/05/01 22:04:08 tom Exp $")
+MODULE_ID("$Id: infocmp.c,v 1.124 2013/04/13 22:15:14 Miroslav.Lichvar Exp $")
 
 #define L_CURL "{"
 #define R_CURL "}"
@@ -70,8 +70,9 @@
 static const char *s_absent = "NULL";
 static const char *s_cancel = "NULL";
 static const char *tversion;	/* terminfo version selected */
-static int itrace;		/* trace flag for debugging */
+static unsigned itrace;		/* trace flag for debugging */
 static int mwidth = 60;
+static int mheight = 65535;
 static int numbers = 0;		/* format "%'char'" to/from "%{number}" */
 static int outform = F_TERMINFO;	/* output format */
 static int sortmode;		/* sort_mode */
@@ -86,27 +87,52 @@
 static bool ignorepads;		/* ignore pad prefixes when diffing */
 
 #if NO_LEAKS
+
+typedef struct {
+    ENTRY *head;
+    ENTRY *tail;
+} ENTERED;
+
+static ENTERED *entered;
+
 #undef ExitProgram
 static void ExitProgram(int code) GCC_NORETURN;
 /* prototype is to get gcc to accept the noreturn attribute */
 static void
 ExitProgram(int code)
 {
-    while (termcount-- > 0)
-	_nc_free_termtype(&entries[termcount].tterm);
+    int n;
+
+    for (n = 0; n < termcount; ++n) {
+	ENTRY *new_head = _nc_head;
+	ENTRY *new_tail = _nc_tail;
+	_nc_head = entered[n].head;
+	_nc_tail = entered[n].tail;
+	_nc_free_entries(entered[n].head);
+	_nc_head = new_head;
+	_nc_tail = new_tail;
+    }
     _nc_leaks_dump_entry();
     free(entries);
+    free(entered);
     _nc_free_tic(code);
 }
 #endif
 
+static void
+failed(const char *s)
+{
+    perror(s);
+    ExitProgram(EXIT_FAILURE);
+}
+
 static char *
 canonical_name(char *ptr, char *buf)
 /* extract the terminal type's primary name */
 {
     char *bp;
 
-    (void) strcpy(buf, ptr);
+    _nc_STRCPY(buf, ptr, NAMESIZE);
     if ((bp = strchr(buf, '|')) != 0)
 	*bp = '\0';
 
@@ -307,13 +333,13 @@
 {
     switch (val) {
     case ABSENT_NUMERIC:
-	strcpy(buf, s_absent);
+	_nc_STRCPY(buf, s_absent, MAX_STRING);
 	break;
     case CANCELLED_NUMERIC:
-	strcpy(buf, s_cancel);
+	_nc_STRCPY(buf, s_cancel, MAX_STRING);
 	break;
     default:
-	sprintf(buf, "%d", val);
+	_nc_SPRINTF(buf, _nc_SLIMIT(MAX_STRING) "%d", val);
 	break;
     }
 }
@@ -323,31 +349,90 @@
 /* display the value of a string capability */
 {
     if (val == ABSENT_STRING)
-	strcpy(buf, s_absent);
+	_nc_STRCPY(buf, s_absent, MAX_STRING);
     else if (val == CANCELLED_STRING)
-	strcpy(buf, s_cancel);
+	_nc_STRCPY(buf, s_cancel, MAX_STRING);
     else {
-	sprintf(buf, "'%.*s'", MAX_STRING - 3, TIC_EXPAND(val));
+	_nc_SPRINTF(buf, _nc_SLIMIT(MAX_STRING)
+		    "'%.*s'", MAX_STRING - 3, TIC_EXPAND(val));
+    }
+}
+
+/*
+ * Show "comparing..." message for the given terminal names.
+ */
+static void
+show_comparing(char **names)
+{
+    if (itrace) {
+	switch (compare) {
+	case C_DIFFERENCE:
+	    (void) fprintf(stderr, "%s: dumping differences\n", _nc_progname);
+	    break;
+
+	case C_COMMON:
+	    (void) fprintf(stderr, "%s: dumping common capabilities\n", _nc_progname);
+	    break;
+
+	case C_NAND:
+	    (void) fprintf(stderr, "%s: dumping differences\n", _nc_progname);
+	    break;
+	}
+    }
+    if (*names) {
+	printf("comparing %s", *names++);
+	if (*names) {
+	    printf(" to %s", *names++);
+	    while (*names) {
+		printf(", %s", *names++);
+	    }
+	}
+	printf(".\n");
     }
 }
 
+/*
+ * ncurses stores two types of non-standard capabilities:
+ * a) capabilities listed past the "STOP-HERE" comment in the Caps file. 
+ *    These are used in the terminfo source file to provide data for termcaps,
+ *    e.g., when there is no equivalent capability in terminfo, as well as for
+ *    widely-used non-standard capabilities.
+ * b) user-definable capabilities, via "tic -x".
+ *
+ * However, if "-x" is omitted from the tic command, both types of
+ * non-standard capability are not loaded into the terminfo database.  This
+ * macro is used for limit-checks against the symbols that tic uses to omit
+ * the two types of non-standard entry.
+ */
+#define check_user_definable(n,limit) if (!_nc_user_definable && (n) > (limit)) break
+
+/*
+ * Use these macros to simplify loops on C_COMMON and C_NAND:
+ */
+#define for_each_entry() while (entries[extra].tterm.term_names)
+#define next_entry           (&(entries[extra++].tterm))
+
 static void
 compare_predicate(PredType type, PredIdx idx, const char *name)
 /* predicate function to use for entry difference reports */
 {
-    register ENTRY *e1 = &entries[0];
-    register ENTRY *e2 = &entries[1];
-    char buf1[MAX_STRING], buf2[MAX_STRING];
+    ENTRY *e1 = &entries[0];
+    ENTRY *e2 = &entries[1];
+    char buf1[MAX_STRING];
+    char buf2[MAX_STRING];
     int b1, b2;
     int n1, n2;
     char *s1, *s2;
+    bool found;
+    int extra = 1;
 
     switch (type) {
     case CMP_BOOLEAN:
+	check_user_definable(idx, BOOLWRITE);
 	b1 = e1->tterm.Booleans[idx];
-	b2 = e2->tterm.Booleans[idx];
 	switch (compare) {
 	case C_DIFFERENCE:
+	    b2 = next_entry->Booleans[idx];
 	    if (!(b1 == ABSENT_BOOLEAN && b2 == ABSENT_BOOLEAN) && b1 != b2)
 		(void) printf("\t%s: %s%s%s.\n",
 			      name,
@@ -357,45 +442,93 @@
 	    break;
 
 	case C_COMMON:
-	    if (b1 == b2 && b1 != ABSENT_BOOLEAN)
-		(void) printf("\t%s= %s.\n", name, dump_boolean(b1));
+	    if (b1 != ABSENT_BOOLEAN) {
+		found = TRUE;
+		for_each_entry() {
+		    b2 = next_entry->Booleans[idx];
+		    if (b1 != b2) {
+			found = FALSE;
+			break;
+		    }
+		}
+		if (found) {
+		    (void) printf("\t%s= %s.\n", name, dump_boolean(b1));
+		}
+	    }
 	    break;
 
 	case C_NAND:
-	    if (b1 == ABSENT_BOOLEAN && b2 == ABSENT_BOOLEAN)
-		(void) printf("\t!%s.\n", name);
+	    if (b1 == ABSENT_BOOLEAN) {
+		found = TRUE;
+		for_each_entry() {
+		    b2 = next_entry->Booleans[idx];
+		    if (b1 != b2) {
+			found = FALSE;
+			break;
+		    }
+		}
+		if (found) {
+		    (void) printf("\t!%s.\n", name);
+		}
+	    }
 	    break;
 	}
 	break;
 
     case CMP_NUMBER:
+	check_user_definable(idx, NUMWRITE);
 	n1 = e1->tterm.Numbers[idx];
-	n2 = e2->tterm.Numbers[idx];
-	dump_numeric(n1, buf1);
-	dump_numeric(n2, buf2);
 	switch (compare) {
 	case C_DIFFERENCE:
-	    if (!((n1 == ABSENT_NUMERIC && n2 == ABSENT_NUMERIC)) && n1 != n2)
+	    n2 = next_entry->Numbers[idx];
+	    if (!((n1 == ABSENT_NUMERIC && n2 == ABSENT_NUMERIC)) && n1 != n2) {
+		dump_numeric(n1, buf1);
+		dump_numeric(n2, buf2);
 		(void) printf("\t%s: %s, %s.\n", name, buf1, buf2);
+	    }
 	    break;
 
 	case C_COMMON:
-	    if (n1 != ABSENT_NUMERIC && n2 != ABSENT_NUMERIC && n1 == n2)
-		(void) printf("\t%s= %s.\n", name, buf1);
+	    if (n1 != ABSENT_NUMERIC) {
+		found = TRUE;
+		for_each_entry() {
+		    n2 = next_entry->Numbers[idx];
+		    if (n1 != n2) {
+			found = FALSE;
+			break;
+		    }
+		}
+		if (found) {
+		    dump_numeric(n1, buf1);
+		    (void) printf("\t%s= %s.\n", name, buf1);
+		}
+	    }
 	    break;
 
 	case C_NAND:
-	    if (n1 == ABSENT_NUMERIC && n2 == ABSENT_NUMERIC)
-		(void) printf("\t!%s.\n", name);
+	    if (n1 == ABSENT_NUMERIC) {
+		found = TRUE;
+		for_each_entry() {
+		    n2 = next_entry->Numbers[idx];
+		    if (n1 != n2) {
+			found = FALSE;
+			break;
+		    }
+		}
+		if (found) {
+		    (void) printf("\t!%s.\n", name);
+		}
+	    }
 	    break;
 	}
 	break;
 
     case CMP_STRING:
+	check_user_definable(idx, STRWRITE);
 	s1 = e1->tterm.Strings[idx];
-	s2 = e2->tterm.Strings[idx];
 	switch (compare) {
 	case C_DIFFERENCE:
+	    s2 = next_entry->Strings[idx];
 	    if (capcmp(idx, s1, s2)) {
 		dump_string(s1, buf1);
 		dump_string(s2, buf2);
@@ -405,13 +538,35 @@
 	    break;
 
 	case C_COMMON:
-	    if (s1 && s2 && !capcmp(idx, s1, s2))
-		(void) printf("\t%s= '%s'.\n", name, TIC_EXPAND(s1));
+	    if (s1 != ABSENT_STRING) {
+		found = TRUE;
+		for_each_entry() {
+		    s2 = next_entry->Strings[idx];
+		    if (capcmp(idx, s1, s2) != 0) {
+			found = FALSE;
+			break;
+		    }
+		}
+		if (found) {
+		    (void) printf("\t%s= '%s'.\n", name, TIC_EXPAND(s1));
+		}
+	    }
 	    break;
 
 	case C_NAND:
-	    if (!s1 && !s2)
-		(void) printf("\t!%s.\n", name);
+	    if (s1 == ABSENT_STRING) {
+		found = TRUE;
+		for_each_entry() {
+		    s2 = next_entry->Strings[idx];
+		    if (s2 != s1) {
+			found = FALSE;
+			break;
+		    }
+		}
+		if (found) {
+		    (void) printf("\t!%s.\n", name);
+		}
+	    }
 	    break;
 	}
 	break;
@@ -430,16 +585,37 @@
 	    break;
 
 	case C_COMMON:
-	    if (e1->nuses && e2->nuses && useeq(e1, e2)) {
-		(void) fputs("\tuse: ", stdout);
-		print_uses(e1, stdout);
-		fputs(".\n", stdout);
+	    if (e1->nuses) {
+		found = TRUE;
+		for_each_entry() {
+		    e2 = &entries[extra++];
+		    if (e2->nuses != e1->nuses || !useeq(e1, e2)) {
+			found = FALSE;
+			break;
+		    }
+		}
+		if (found) {
+		    (void) fputs("\tuse: ", stdout);
+		    print_uses(e1, stdout);
+		    fputs(".\n", stdout);
+		}
 	    }
 	    break;
 
 	case C_NAND:
-	    if (!e1->nuses && !e2->nuses)
-		(void) printf("\t!use.\n");
+	    if (!e1->nuses) {
+		found = TRUE;
+		for_each_entry() {
+		    e2 = &entries[extra++];
+		    if (e2->nuses != e1->nuses) {
+			found = FALSE;
+			break;
+		    }
+		}
+		if (found) {
+		    (void) printf("\t!use.\n");
+		}
+	    }
 	    break;
 	}
     }
@@ -556,7 +732,7 @@
 }
 
 static bool
-same_param(const char *table, const char *param, unsigned length)
+same_param(const char *table, const char *param, size_t length)
 {
     bool result = FALSE;
     if (strncmp(table, param, length) == 0) {
@@ -581,15 +757,15 @@
 		size_t tlen = strlen(ap->from);
 
 		if (same_param(ap->from, ep, tlen)) {
-		    (void) strcat(dst, ap->to);
+		    _nc_STRCAT(dst, ap->to, MAX_TERMINFO_LENGTH);
 		    found = TRUE;
 		    break;
 		}
 	    }
 
 	    if (!found)
-		(void) strcat(dst, ep);
-	    (void) strcat(dst, ";");
+		_nc_STRCAT(dst, ep, MAX_TERMINFO_LENGTH);
+	    _nc_STRCAT(dst, ";", MAX_TERMINFO_LENGTH);
 	} while
 	    ((ep = strtok((char *) 0, ";")));
 
@@ -682,7 +858,11 @@
 	    && (next = (size_t) csi + len)
 	    && ((sp[next] == 'h') || (sp[next] == 'l'))) {
 
-	    (void) strcpy(buf2, (sp[next] == 'h') ? "ECMA+" : "ECMA-");
+	    _nc_STRCPY(buf2,
+		       ((sp[next] == 'h')
+			? "ECMA+"
+			: "ECMA-"),
+		       sizeof(buf2));
 	    (void) strncpy(buf3, sp + csi, len);
 	    buf3[len] = '\0';
 	    len += (size_t) csi + 1;
@@ -699,7 +879,11 @@
 	    && (next = (size_t) csi + 1 + len)
 	    && ((sp[next] == 'h') || (sp[next] == 'l'))) {
 
-	    (void) strcpy(buf2, (sp[next] == 'h') ? "DEC+" : "DEC-");
+	    _nc_STRCPY(buf2,
+		       ((sp[next] == 'h')
+			? "DEC+"
+			: "DEC-"),
+		       sizeof(buf2));
 	    (void) strncpy(buf3, sp + csi + 1, len);
 	    buf3[len] = '\0';
 	    len += (size_t) csi + 2;
@@ -715,7 +899,7 @@
 	    && (next = (size_t) csi + len)
 	    && sp[next] == 'm') {
 
-	    (void) strcpy(buf2, "SGR:");
+	    _nc_STRCPY(buf2, "SGR:", sizeof(buf2));
 	    (void) strncpy(buf3, sp + csi, len);
 	    buf3[len] = '\0';
 	    len += (size_t) csi + 1;
@@ -727,8 +911,8 @@
 	    && (csi = skip_csi(sp)) != 0
 	    && sp[csi] == 'm') {
 	    len = (size_t) csi + 1;
-	    (void) strcpy(buf2, "SGR:");
-	    strcat(buf2, ecma_highlights[0].to);
+	    _nc_STRCPY(buf2, "SGR:", sizeof(buf2));
+	    _nc_STRCAT(buf2, ecma_highlights[0].to, sizeof(buf2));
 	    expansion = buf2;
 	}
 
@@ -739,7 +923,7 @@
 		expansion = "RSR";
 		len = 1;
 	    } else {
-		(void) sprintf(buf2, "1;%dr", tp_lines);
+		_nc_SPRINTF(buf2, _nc_SLIMIT(sizeof(buf2)) "1;%dr", tp_lines);
 		len = strlen(buf2);
 		if (strncmp(buf2, sp + csi, len) == 0)
 		    expansion = "RSR";
@@ -750,12 +934,12 @@
 	/* now check for home-down */
 	if (!expansion
 	    && (csi = skip_csi(sp)) != 0) {
-	    (void) sprintf(buf2, "%d;1H", tp_lines);
+	    _nc_SPRINTF(buf2, _nc_SLIMIT(sizeof(buf2)) "%d;1H", tp_lines);
 	    len = strlen(buf2);
 	    if (strncmp(buf2, sp + csi, len) == 0) {
 		expansion = "LL";
 	    } else {
-		(void) sprintf(buf2, "%dH", tp_lines);
+		_nc_SPRINTF(buf2, _nc_SLIMIT(sizeof(buf2)) "%dH", tp_lines);
 		len = strlen(buf2);
 		if (strncmp(buf2, sp + csi, len) == 0) {
 		    expansion = "LL";
@@ -795,12 +979,16 @@
     int i, n;
 
     memset(heads, 0, sizeof(heads));
-    dump_init((char *) 0, F_LITERAL, S_TERMINFO, 0, itrace, FALSE);
+    dump_init((char *) 0, F_LITERAL, S_TERMINFO, 0, 65535, itrace, FALSE);
 
     for (n = 0; n < argc && n < MAXCOMPARE; n++) {
 	if (freopen(argv[n], "r", stdin) == 0)
 	    _nc_err_abort("Can't open %s", argv[n]);
 
+#if NO_LEAKS
+	entered[n].head = _nc_head;
+	entered[n].tail = _nc_tail;
+#endif
 	_nc_head = _nc_tail = 0;
 
 	/* parse entries out of the source file */
@@ -925,6 +1113,11 @@
 #endif
 	    if (!(entryeq(&qp->tterm, &rp->tterm) && useeq(qp, rp))) {
 		char name1[NAMESIZE], name2[NAMESIZE];
+		char *names[3];
+
+		names[0] = name1;
+		names[1] = name2;
+		names[2] = 0;
 
 		entries[0] = *qp;
 		entries[1] = *rp;
@@ -934,29 +1127,17 @@
 
 		switch (compare) {
 		case C_DIFFERENCE:
-		    if (itrace)
-			(void) fprintf(stderr,
-				       "%s: dumping differences\n",
-				       _nc_progname);
-		    (void) printf("comparing %s to %s.\n", name1, name2);
+		    show_comparing(names);
 		    compare_entry(compare_predicate, &entries->tterm, quiet);
 		    break;
 
 		case C_COMMON:
-		    if (itrace)
-			(void) fprintf(stderr,
-				       "%s: dumping common capabilities\n",
-				       _nc_progname);
-		    (void) printf("comparing %s to %s.\n", name1, name2);
+		    show_comparing(names);
 		    compare_entry(compare_predicate, &entries->tterm, quiet);
 		    break;
 
 		case C_NAND:
-		    if (itrace)
-			(void) fprintf(stderr,
-				       "%s: dumping differences\n",
-				       _nc_progname);
-		    (void) printf("comparing %s to %s.\n", name1, name2);
+		    show_comparing(names);
 		    compare_entry(compare_predicate, &entries->tterm, quiet);
 		    break;
 
@@ -974,7 +1155,9 @@
 	"Usage: infocmp [options] [-A directory] [-B directory] [termname...]"
 	,""
 	,"Options:"
+	,"  -0    print single-row"
 	,"  -1    print single-column"
+	,"  -K    use termcap-names and BSD syntax"
 	,"  -C    use termcap-names"
 	,"  -F    compare terminfo-files"
 	,"  -I    use terminfo-names"
@@ -982,6 +1165,7 @@
 	,"  -R subset (see manpage)"
 	,"  -T    eliminate size limits (test)"
 	,"  -U    eliminate post-processing of entries"
+	,"  -D    print database locations"
 	,"  -V    print version"
 #if NCURSES_XNAMES
 	,"  -a    with -F, list commented-out caps"
@@ -1030,19 +1214,25 @@
 any_initializer(const char *fmt, const char *type)
 {
     static char *initializer;
+    static size_t need;
     char *s;
 
-    if (initializer == 0)
-	initializer = (char *) malloc(strlen(entries->tterm.term_names) +
-				      strlen(type) + strlen(fmt));
+    if (initializer == 0) {
+	need = (strlen(entries->tterm.term_names)
+		+ strlen(type)
+		+ strlen(fmt));
+	initializer = (char *) malloc(need + 1);
+	if (initializer == 0)
+	    failed("any_initializer");
+    }
 
-    (void) strcpy(initializer, entries->tterm.term_names);
+    _nc_STRCPY(initializer, entries->tterm.term_names, need);
     for (s = initializer; *s != 0 && *s != '|'; s++) {
 	if (!isalnum(UChar(*s)))
 	    *s = '_';
     }
     *s = 0;
-    (void) sprintf(s, fmt, type);
+    _nc_SPRINTF(s, _nc_SLIMIT(need) fmt, type);
     return initializer;
 }
 
@@ -1073,9 +1263,10 @@
 
 	if (VALID_STRING(term->Strings[n])) {
 	    tp = buf;
+#define TP_LIMIT	((MAX_STRING - 5) - (size_t)(tp - buf))
 	    *tp++ = '"';
 	    for (sp = term->Strings[n];
-		 *sp != 0 && (tp - buf) < MAX_STRING - 6;
+		 *sp != 0 && TP_LIMIT > 2;
 		 sp++) {
 		if (isascii(UChar(*sp))
 		    && isprint(UChar(*sp))
@@ -1083,14 +1274,15 @@
 		    && *sp != '"')
 		    *tp++ = *sp;
 		else {
-		    (void) sprintf(tp, "\\%03o", UChar(*sp));
+		    _nc_SPRINTF(tp, _nc_SLIMIT(TP_LIMIT) "\\%03o", UChar(*sp));
 		    tp += 4;
 		}
 	    }
 	    *tp++ = '"';
 	    *tp = '\0';
 	    (void) printf("static char %-20s[] = %s;\n",
-			  string_variable(ExtStrname(term, n, strnames)), buf);
+			  string_variable(ExtStrname(term, (int) n, strnames)),
+			  buf);
 	}
     }
     printf("\n");
@@ -1116,7 +1308,7 @@
 	    break;
 	}
 	(void) printf("\t/* %3u: %-8s */\t%s,\n",
-		      n, ExtBoolname(term, n, boolnames), str);
+		      n, ExtBoolname(term, (int) n, boolnames), str);
     }
     (void) printf("%s;\n", R_CURL);
 
@@ -1132,12 +1324,12 @@
 	    str = "CANCELLED_NUMERIC";
 	    break;
 	default:
-	    sprintf(buf, "%d", term->Numbers[n]);
+	    _nc_SPRINTF(buf, _nc_SLIMIT(sizeof(buf)) "%d", term->Numbers[n]);
 	    str = buf;
 	    break;
 	}
 	(void) printf("\t/* %3u: %-8s */\t%s,\n", n,
-		      ExtNumname(term, n, numnames), str);
+		      ExtNumname(term, (int) n, numnames), str);
     }
     (void) printf("%s;\n", R_CURL);
 
@@ -1150,10 +1342,10 @@
 	else if (term->Strings[n] == CANCELLED_STRING)
 	    str = "CANCELLED_STRING";
 	else {
-	    str = string_variable(ExtStrname(term, n, strnames));
+	    str = string_variable(ExtStrname(term, (int) n, strnames));
 	}
 	(void) printf("\t/* %3u: %-8s */\t%s,\n", n,
-		      ExtStrname(term, n, strnames), str);
+		      ExtStrname(term, (int) n, strnames), str);
     }
     (void) printf("%s;\n", R_CURL);
 
@@ -1165,15 +1357,15 @@
 		      name_initializer("string_ext"), L_CURL);
 	for (n = BOOLCOUNT; n < NUM_BOOLEANS(term); ++n) {
 	    (void) printf("\t/* %3u: bool */\t\"%s\",\n",
-			  n, ExtBoolname(term, n, boolnames));
+			  n, ExtBoolname(term, (int) n, boolnames));
 	}
 	for (n = NUMCOUNT; n < NUM_NUMBERS(term); ++n) {
 	    (void) printf("\t/* %3u: num */\t\"%s\",\n",
-			  n, ExtNumname(term, n, numnames));
+			  n, ExtNumname(term, (int) n, numnames));
 	}
 	for (n = STRCOUNT; n < NUM_STRINGS(term); ++n) {
 	    (void) printf("\t/* %3u: str */\t\"%s\",\n",
-			  n, ExtStrname(term, n, strnames));
+			  n, ExtStrname(term, (int) n, strnames));
 	}
 	(void) printf("%s;\n", R_CURL);
     }
@@ -1247,6 +1439,23 @@
     return terminal;
 }
 
+/*
+ * Show the databases that infocmp knows about.  The location to which it writes is
+ */
+static void
+show_databases(void)
+{
+    DBDIRS state;
+    int offset;
+    const char *path2;
+
+    _nc_first_db(&state, &offset);
+    while ((path2 = _nc_next_db(&state, &offset)) != 0) {
+	printf("%s\n", path2);
+    }
+    _nc_last_db();
+}
+
 /***************************************************************************
  *
  * Main sequence
@@ -1269,7 +1478,7 @@
     /* Also avoid overflowing smaller stacks on systems like AmigaOS */
     path *tfile = 0;
     char **tname = 0;
-    int maxterms;
+    size_t maxterms;
 
     char **myargv;
 
@@ -1287,18 +1496,27 @@
 #if NCURSES_XNAMES
     use_extended_names(FALSE);
 #endif
+    _nc_strict_bsd = 0;
 
     _nc_progname = _nc_rootname(argv[0]);
 
     /* make sure we have enough space to add two terminal entries */
     myargv = typeCalloc(char *, (size_t) (argc + 3));
+    if (myargv == 0)
+	failed("myargv");
+
     memcpy(myargv, argv, (sizeof(char *) * (size_t) argc));
     argv = myargv;
 
     while ((c = getopt(argc,
 		       argv,
-		       "1A:aB:CcdEeFfGgIiLlnpqR:rs:TtUuVv:w:x")) != -1) {
+		       "01A:aB:CcDdEeFfGgIiKLlnpqR:rs:TtUuVv:w:x")) != -1) {
 	switch (c) {
+	case '0':
+	    mwidth = 65535;
+	    mheight = 1;
+	    break;
+
 	case '1':
 	    mwidth = 0;
 	    break;
@@ -1317,6 +1535,9 @@
 	    restdir = optarg;
 	    break;
 
+	case 'K':
+	    _nc_strict_bsd = 1;
+	    /* FALLTHRU */
 	case 'C':
 	    outform = F_TERMCAP;
 	    tversion = "BSD";
@@ -1324,6 +1545,11 @@
 		sortmode = S_TERMCAP;
 	    break;
 
+	case 'D':
+	    show_databases();
+	    ExitProgram(EXIT_SUCCESS);
+	    break;
+
 	case 'c':
 	    compare = C_COMMON;
 	    break;
@@ -1441,7 +1667,7 @@
 	    ExitProgram(EXIT_SUCCESS);
 
 	case 'v':
-	    itrace = optarg_to_number();
+	    itrace = (unsigned) optarg_to_number();
 	    set_trace_level(itrace);
 	    break;
 
@@ -1460,10 +1686,17 @@
 	}
     }
 
-    maxterms = (argc + 2 - optind);
-    tfile = typeMalloc(path, maxterms);
-    tname = typeCalloc(char *, maxterms);
-    entries = typeCalloc(ENTRY, maxterms);
+    maxterms = (size_t) (argc + 2 - optind);
+    if ((tfile = typeMalloc(path, maxterms)) == 0)
+	failed("tfile");
+    if ((tname = typeCalloc(char *, maxterms)) == 0)
+	  failed("tname");
+    if ((entries = typeCalloc(ENTRY, maxterms)) == 0)
+	failed("entries");
+#if NO_LEAKS
+    if ((entered = typeCalloc(ENTERED, maxterms)) == 0)
+	failed("entered");
+#endif
 
     if (tfile == 0
 	|| tname == 0
@@ -1476,9 +1709,6 @@
     if (sortmode == S_DEFAULT)
 	sortmode = S_TERMINFO;
 
-    /* set up for display */
-    dump_init(tversion, outform, sortmode, mwidth, itrace, formatted);
-
     /* make sure we have at least one terminal name to work with */
     if (optind >= argc)
 	argv[argc++] = terminal_env();
@@ -1487,9 +1717,23 @@
     if (compare != C_DEFAULT && optind >= argc - 1)
 	argv[argc++] = terminal_env();
 
+    /* exactly one terminal name with no options means display it */
     /* exactly two terminal names with no options means do -d */
-    if (argc - optind == 2 && compare == C_DEFAULT)
-	compare = C_DIFFERENCE;
+    if (compare == C_DEFAULT) {
+	switch (argc - optind) {
+	default:
+	    fprintf(stderr, "%s: too many names to compare\n", _nc_progname);
+	    ExitProgram(EXIT_FAILURE);
+	case 1:
+	    break;
+	case 2:
+	    compare = C_DIFFERENCE;
+	    break;
+	}
+    }
+
+    /* set up for display */
+    dump_init(tversion, outform, sortmode, mwidth, mheight, itrace, formatted);
 
     if (!filecompare) {
 	/* grab the entries */
@@ -1507,9 +1751,11 @@
 #else
 #define LEAF_FMT "%02x"
 #endif
-		(void) sprintf(tfile[termcount], "%s/" LEAF_FMT "/%s",
-			       directory,
-			       UChar(*argv[optind]), argv[optind]);
+		_nc_SPRINTF(tfile[termcount],
+			    _nc_SLIMIT(sizeof(path))
+			    "%s/" LEAF_FMT "/%s",
+			    directory,
+			    UChar(*argv[optind]), argv[optind]);
 		if (itrace)
 		    (void) fprintf(stderr,
 				   "%s: reading entry %s from file %s\n",
@@ -1599,27 +1845,17 @@
 		break;
 
 	    case C_DIFFERENCE:
-		if (itrace)
-		    (void) fprintf(stderr, "%s: dumping differences\n", _nc_progname);
-		(void) printf("comparing %s to %s.\n", tname[0], tname[1]);
+		show_comparing(tname);
 		compare_entry(compare_predicate, &entries->tterm, quiet);
 		break;
 
 	    case C_COMMON:
-		if (itrace)
-		    (void) fprintf(stderr,
-				   "%s: dumping common capabilities\n",
-				   _nc_progname);
-		(void) printf("comparing %s to %s.\n", tname[0], tname[1]);
+		show_comparing(tname);
 		compare_entry(compare_predicate, &entries->tterm, quiet);
 		break;
 
 	    case C_NAND:
-		if (itrace)
-		    (void) fprintf(stderr,
-				   "%s: dumping differences\n",
-				   _nc_progname);
-		(void) printf("comparing %s to %s.\n", tname[0], tname[1]);
+		show_comparing(tname);
 		compare_entry(compare_predicate, &entries->tterm, quiet);
 		break;
 
@@ -1640,15 +1876,16 @@
 		break;
 	    }
 	}
-    } else if (compare == C_USEALL)
+    } else if (compare == C_USEALL) {
 	(void) fprintf(stderr, "Sorry, -u doesn't work with -F\n");
-    else if (compare == C_DEFAULT)
+    } else if (compare == C_DEFAULT) {
 	(void) fprintf(stderr, "Use `tic -[CI] <file>' for this.\n");
-    else if (argc - optind != 2)
+    } else if (argc - optind != 2) {
 	(void) fprintf(stderr,
 		       "File comparison needs exactly two file arguments.\n");
-    else
+    } else {
 	file_comparison(argc - optind, argv + optind);
+    }
 
     MAIN_LEAKS();
     ExitProgram(EXIT_SUCCESS);
Index: progs/progs.priv.h
Prereq:  1.34 
--- ncurses-5.9/progs/progs.priv.h	2008-08-03 17:43:05.000000000 +0000
+++ ncurses-5.9-20130504/progs/progs.priv.h	2012-02-22 22:11:27.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -30,7 +30,7 @@
  *  Author: Thomas E. Dickey                    1997-on                     *
  ****************************************************************************/
 /*
- * $Id: progs.priv.h,v 1.34 2008/08/03 17:43:05 tom Exp $
+ * $Id: progs.priv.h,v 1.39 2012/02/22 22:11:27 tom Exp $
  *
  *	progs.priv.h
  *
@@ -42,7 +42,7 @@
 #if USE_RCS_IDS
 #define MODULE_ID(id) static const char Ident[] = id;
 #else
-#define MODULE_ID(id) /*nothing*/
+#define MODULE_ID(id)		/*nothing */
 #endif
 
 #include <stdlib.h>
@@ -90,6 +90,14 @@
 # endif
 #endif
 
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+
 #include <assert.h>
 #include <errno.h>
 
@@ -99,7 +107,7 @@
 
 #if HAVE_GETOPT_H
 #include <getopt.h>
-#else
+#elif !defined(HAVE_GETOPT_HEADER)
 /* 'getopt()' may be prototyped in <stdlib.h>, but declaring its
  * variables doesn't hurt.
  */
@@ -109,9 +117,11 @@
 
 #include <curses.h>
 #include <term_entry.h>
+#include <nc_termios.h>
 #include <tic.h>
 #include <nc_tparm.h>
 
+#include <nc_string.h>
 #include <nc_alloc.h>
 #if HAVE_NC_FREEALL
 #undef ExitProgram
@@ -171,7 +181,7 @@
 # elif defined(MAXPATHLEN)
 #  define PATH_MAX MAXPATHLEN
 # else
-#  define PATH_MAX 255	/* the Posix minimum pathsize */
+#  define PATH_MAX 255		/* the Posix minimum pathsize */
 # endif
 #endif
 
@@ -183,7 +193,7 @@
 # if ('z'-'a' == 25) && ('z' < 127) && ('Z'-'A' == 25) && ('Z' < 127) && ('9' < 127)
 #  define isascii(c) (UChar(c) <= 127)
 # else
-#  define isascii(c) 1	/* not really ascii anyway */
+#  define isascii(c) 1		/* not really ascii anyway */
 # endif
 #endif
 
Index: progs/tabs.c
Prereq:  1.19 
--- ncurses-5.9/progs/tabs.c	2010-10-23 22:26:01.000000000 +0000
+++ ncurses-5.9-20130504/progs/tabs.c	2012-11-18 01:21:47.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 2008-2009,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 2008-2011,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -37,12 +37,19 @@
 #define USE_LIBTINFO
 #include <progs.priv.h>
 
-MODULE_ID("$Id: tabs.c,v 1.19 2010/10/23 22:26:01 tom Exp $")
+MODULE_ID("$Id: tabs.c,v 1.25 2012/11/18 01:21:47 tom Exp $")
 
 static void usage(void) GCC_NORETURN;
 
 static int max_cols;
 
+static void
+failed(const char *s)
+{
+    perror(s);
+    ExitProgram(EXIT_FAILURE);
+}
+
 static int
 putch(int c)
 {
@@ -83,28 +90,29 @@
     int prior = 0;
     int ch;
 
-    if (result != 0) {
-	while ((ch = *tab_list++) != '\0') {
-	    if (isdigit(UChar(ch))) {
-		value *= 10;
-		value += (ch - '0');
-	    } else if (ch == ',') {
-		result[n] = value + prior;
-		if (n > 0 && result[n] <= result[n - 1]) {
-		    fprintf(stderr,
-			    "tab-stops are not in increasing order: %d %d\n",
-			    value, result[n - 1]);
-		    free(result);
-		    result = 0;
-		    break;
-		}
-		++n;
-		value = 0;
-		prior = 0;
-	    } else if (ch == '+') {
-		if (n)
-		    prior = result[n - 1];
+    if (result == 0)
+	failed("decode_tabs");
+
+    while ((ch = *tab_list++) != '\0') {
+	if (isdigit(UChar(ch))) {
+	    value *= 10;
+	    value += (ch - '0');
+	} else if (ch == ',') {
+	    result[n] = value + prior;
+	    if (n > 0 && result[n] <= result[n - 1]) {
+		fprintf(stderr,
+			"tab-stops are not in increasing order: %d %d\n",
+			value, result[n - 1]);
+		free(result);
+		result = 0;
+		break;
 	    }
+	    ++n;
+	    value = 0;
+	    prior = 0;
+	} else if (ch == '+') {
+	    if (n)
+		prior = result[n - 1];
 	}
     }
 
@@ -126,6 +134,7 @@
 	result[n++] = value + prior;
 	result[n] = 0;
     }
+
     return result;
 }
 
@@ -140,10 +149,11 @@
     for (n = 0; n < max_cols; n += 10) {
 	int ch = 1 + (n / 10);
 	char buffer[20];
-	sprintf(buffer, "----+----%c",
-		((ch < 10)
-		 ? (ch + '0')
-		 : (ch + 'A' - 10)));
+	_nc_SPRINTF(buffer, _nc_SLIMIT(sizeof(buffer))
+		    "----+----%c",
+		    ((ch < 10)
+		     ? (ch + '0')
+		     : (ch + 'A' - 10)));
 	printf("%.*s", ((max_cols - n) > 10) ? 10 : (max_cols - n), buffer);
     }
     putchar('\n');
@@ -227,7 +237,7 @@
     bool result = FALSE;
 
     if (source != 0) {
-	unsigned len = strlen(source);
+	size_t len = strlen(source);
 	if (len != 0)
 	    result = (source[len - 1] != ',');
     } else {
@@ -251,7 +261,7 @@
 
     if (copied != 0 && *copied != '\0') {
 	const char *comma = ",";
-	unsigned need = 1 + strlen(copied);
+	size_t need = 1 + strlen(copied);
 
 	if (*copied == ',')
 	    comma = "";
@@ -263,15 +273,16 @@
 	    need += strlen(*append);
 
 	result = malloc(need);
-	if (result != 0) {
-	    *result = '\0';
-	    if (*append != 0) {
-		strcpy(result, *append);
-		free(*append);
-	    }
-	    strcat(result, comma);
-	    strcat(result, copied);
+	if (result == 0)
+	    failed("add_to_tab_list");
+
+	*result = '\0';
+	if (*append != 0) {
+	    _nc_STRCPY(result, *append, need);
+	    free(*append);
 	}
+	_nc_STRCAT(result, comma, need);
+	_nc_STRCAT(result, copied, need);
 
 	*append = result;
     }
@@ -353,7 +364,6 @@
     bool no_op = FALSE;
     int n, ch;
     NCURSES_CONST char *term_name = 0;
-    const char *mar_list = 0;	/* ignored */
     char *append = 0;
     const char *tab_list = 0;
 
@@ -446,7 +456,11 @@
 	    while ((ch = *++option) != '\0') {
 		switch (ch) {
 		case 'm':
-		    mar_list = option;
+		    /*
+		     * The "+mXXX" option is unimplemented because only the long-obsolete
+		     * att510d implements smgl, which is needed to support
+		     * this option.
+		     */
 		    break;
 		default:
 		    /* special case of relative stops separated by spaces? */
Index: progs/tic.c
Prereq:  1.147 
--- ncurses-5.9/progs/tic.c	2011-02-12 18:39:08.000000000 +0000
+++ ncurses-5.9-20130504/progs/tic.c	2013-03-17 00:57:05.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2010,2011 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -35,6 +35,7 @@
 /*
  *	tic.c --- Main program for terminfo compiler
  *			by Eric S. Raymond
+ *			and Thomas E Dickey
  *
  */
 
@@ -42,9 +43,12 @@
 #include <sys/stat.h>
 
 #include <dump_entry.h>
+#include <hashed_db.h>
 #include <transform.h>
 
-MODULE_ID("$Id: tic.c,v 1.147 2011/02/12 18:39:08 tom Exp $")
+MODULE_ID("$Id: tic.c,v 1.185 2013/03/17 00:57:05 tom Exp $")
+
+#define STDIN_NAME "<stdin>"
 
 const char *_nc_progname = "tic";
 
@@ -53,6 +57,7 @@
 static bool capdump = FALSE;	/* running as infotocap? */
 static bool infodump = FALSE;	/* running as captoinfo? */
 static bool showsummary = FALSE;
+static char **namelst = 0;
 static const char *to_remove;
 
 static void (*save_check_termtype) (TERMTYPE *, bool);
@@ -69,11 +74,13 @@
 1\
 a\
 C\
+D\
 c\
 f\
 G\
 g\
 I\
+K\
 L\
 N\
 r\
@@ -99,8 +106,10 @@
 #endif
 
 static void
-cleanup(char **namelst GCC_UNUSED)
+cleanup(void)
 {
+    int rc;
+
 #if NO_LEAKS
     free_namelist(namelst);
 #endif
@@ -108,10 +117,12 @@
 	fclose(tmp_fp);
     if (to_remove != 0) {
 #if HAVE_REMOVE
-	remove(to_remove);
+	rc = remove(to_remove);
 #else
-	unlink(to_remove);
+	rc = unlink(to_remove);
 #endif
+	if (rc != 0)
+	    perror(to_remove);
     }
 }
 
@@ -119,7 +130,6 @@
 failed(const char *msg)
 {
     perror(msg);
-    cleanup((char **) 0);
     ExitProgram(EXIT_FAILURE);
 }
 
@@ -133,7 +143,9 @@
 #if NCURSES_XNAMES
 	"  -a         retain commented-out capabilities (sets -x also)",
 #endif
+	"  -K         translate entries to termcap source form with BSD syntax",
 	"  -C         translate entries to termcap source form",
+	"  -D         print list of tic's database locations (first must be writable)",
 	"  -c         check only, validate input without compiling or translating",
 	"  -e<names>  translate/compile only entries named by comma-separated list",
 	"  -f         format complex strings for readability",
@@ -173,7 +185,7 @@
 
 #define L_BRACE '{'
 #define R_BRACE '}'
-#define S_QUOTE '\'';
+#define S_QUOTE '\''
 
 static void
 write_it(ENTRY * ep)
@@ -216,12 +228,12 @@
 	    }
 	    *d = 0;
 	    if (strlen(result) < strlen(s))
-		strcpy(s, result);
+		_nc_STRCPY(s, result, strlen(s) + 1);
 	}
     }
 
     _nc_set_type(_nc_first_name(ep->tterm.term_names));
-    _nc_curr_line = ep->startline;
+    _nc_curr_line = (int) ep->startline;
     _nc_write_entry(&ep->tterm);
 }
 
@@ -286,8 +298,10 @@
     if (in_name) {
 	if (used + 1 >= have) {
 	    have += 132;
-	    namebuf = typeRealloc(char, have, namebuf);
-	    suffix = typeRealloc(char, have, suffix);
+	    if ((namebuf = typeRealloc(char, have, namebuf)) == 0)
+		  failed("put_translate namebuf");
+	    if ((suffix = typeRealloc(char, have, suffix)) == 0)
+		  failed("put_translate suffix");
 	}
 	if (c == '\n' || c == '@') {
 	    namebuf[used++] = '\0';
@@ -308,7 +322,7 @@
 	    if ((up = strchr(namebuf, '#')) != 0
 		|| (up = strchr(namebuf, '=')) != 0
 		|| ((up = strchr(namebuf, '@')) != 0 && up[1] == '>')) {
-		(void) strcpy(suffix, up);
+		_nc_STRCPY(suffix, up, have);
 		*up = '\0';
 	    }
 
@@ -339,39 +353,122 @@
 static char *
 stripped(char *src)
 {
+    char *dst = 0;
+
     while (isspace(UChar(*src)))
 	src++;
+
     if (*src != '\0') {
-	char *dst;
 	size_t len;
 
-	if ((dst = strdup(src)) == NULL)
+	if ((dst = strdup(src)) == NULL) {
 	    failed("strdup");
+	} else {
+	    len = strlen(dst);
+	    while (--len != 0 && isspace(UChar(dst[len])))
+		dst[len] = '\0';
+	}
+    }
+    return dst;
+}
 
-	assert(dst != 0);
+static FILE *
+open_tempfile(char *filename)
+{
+    FILE *result = 0;
 
-	len = strlen(dst);
-	while (--len != 0 && isspace(UChar(dst[len])))
-	    dst[len] = '\0';
-	return dst;
+    _nc_STRCPY(filename, "/tmp/XXXXXX", PATH_MAX);
+#if HAVE_MKSTEMP
+    {
+	int oldmask = umask(077);
+	int fd = mkstemp(filename);
+	if (fd >= 0)
+	    result = fdopen(fd, "w");
+	umask(oldmask);
     }
-    return 0;
+#else
+    if (tmpnam(filename) != 0)
+	result = fopen(filename, "w");
+#endif
+    return result;
 }
 
 static FILE *
-open_input(const char *filename)
+copy_input(FILE *source, const char *filename, char *alt_file)
 {
-    FILE *fp = fopen(filename, "r");
+    char my_altfile[PATH_MAX];
+    FILE *result = 0;
+    FILE *target = 0;
+    int ch;
+
+    if (alt_file == 0)
+	alt_file = my_altfile;
+
+    if (source == 0) {
+	failed("copy_input (source)");
+    } else if ((target = open_tempfile(alt_file)) == 0) {
+	failed("copy_input (target)");
+    } else {
+	clearerr(source);
+	for (;;) {
+	    ch = fgetc(source);
+	    if (feof(source)) {
+		break;
+	    } else if (ferror(source)) {
+		failed(filename);
+	    } else if (ch == 0) {
+		/* don't loop in case someone wants to convert /dev/zero */
+		fprintf(stderr, "%s: %s is not a text-file\n", _nc_progname, filename);
+		ExitProgram(EXIT_FAILURE);
+	    }
+	    fputc(ch, target);
+	}
+	fclose(source);
+	/*
+	 * rewind() does not force the target file's data to disk (not does
+	 * fflush()...).  So open a second stream on the data and then close
+	 * the one that we were writing on before starting to read from the
+	 * second stream.
+	 */
+	result = fopen(alt_file, "r+");
+	fclose(target);
+	to_remove = strdup(alt_file);
+    }
+    return result;
+}
+
+static FILE *
+open_input(const char *filename, char *alt_file)
+{
+    FILE *fp;
     struct stat sb;
+    int mode;
 
-    if (fp == 0) {
-	fprintf(stderr, "%s: Can't open %s\n", _nc_progname, filename);
+    if (!strcmp(filename, "-")) {
+	fp = copy_input(stdin, STDIN_NAME, alt_file);
+    } else if (stat(filename, &sb) < 0) {
+	fprintf(stderr, "%s: %s %s\n", _nc_progname, filename, strerror(errno));
 	ExitProgram(EXIT_FAILURE);
-    }
-    if (fstat(fileno(fp), &sb) < 0
-	|| (sb.st_mode & S_IFMT) != S_IFREG) {
+    } else if ((mode = (sb.st_mode & S_IFMT)) == S_IFDIR
+	       || (mode != S_IFREG && mode != S_IFCHR)) {
 	fprintf(stderr, "%s: %s is not a file\n", _nc_progname, filename);
 	ExitProgram(EXIT_FAILURE);
+    } else {
+	fp = fopen(filename, "r");
+
+	if (fp == 0) {
+	    fprintf(stderr, "%s: Can't open %s\n", _nc_progname, filename);
+	    ExitProgram(EXIT_FAILURE);
+	}
+	if (mode != S_IFREG) {
+	    if (alt_file != 0) {
+		FILE *fp2 = copy_input(fp, filename, alt_file);
+		fp = fp2;
+	    } else {
+		fprintf(stderr, "%s: %s is not a file\n", _nc_progname, filename);
+		ExitProgram(EXIT_FAILURE);
+	    }
+	}
     }
     return fp;
 }
@@ -389,7 +486,7 @@
     if (src == 0) {
 	/* EMPTY */ ;
     } else if (strchr(src, '/') != 0) {		/* a filename */
-	FILE *fp = open_input(src);
+	FILE *fp = open_input(src, (char *) 0);
 
 	for (pass = 1; pass <= 2; pass++) {
 	    nn = 0;
@@ -403,7 +500,8 @@
 		}
 	    }
 	    if (pass == 1) {
-		dst = typeCalloc(char *, nn + 1);
+		if ((dst = typeCalloc(char *, nn + 1)) == 0)
+		      failed("make_namelist");
 		rewind(fp);
 	    }
 	}
@@ -425,8 +523,10 @@
 		if (mark == '\0')
 		    break;
 	    }
-	    if (pass == 1)
-		dst = typeCalloc(char *, nn + 1);
+	    if (pass == 1) {
+		if ((dst = typeCalloc(char *, nn + 1)) == 0)
+		      failed("make_namelist");
+	    }
 	}
     }
     if (showsummary && (dst != 0)) {
@@ -456,26 +556,118 @@
     return (code);
 }
 
-static FILE *
-open_tempfile(char *name)
+static char *
+valid_db_path(const char *nominal)
 {
-    FILE *result = 0;
-#if HAVE_MKSTEMP
-    int fd = mkstemp(name);
-    if (fd >= 0)
-	result = fdopen(fd, "w");
+    struct stat sb;
+#if USE_HASHED_DB
+    char suffix[] = DBM_SUFFIX;
+    size_t need = strlen(nominal) + sizeof(suffix);
+    char *result = malloc(need);
+
+    if (result == 0)
+	failed("valid_db_path");
+    _nc_STRCPY(result, nominal, need);
+    if (strcmp(result + need - sizeof(suffix), suffix)) {
+	_nc_STRCAT(result, suffix, need);
+    }
 #else
-    if (tmpnam(name) != 0)
-	result = fopen(name, "w");
+    char *result = strdup(nominal);
 #endif
+
+    DEBUG(1, ("** stat(%s)", result));
+    if (stat(result, &sb) >= 0) {
+#if USE_HASHED_DB
+	if (!S_ISREG(sb.st_mode)
+	    || access(result, R_OK | W_OK) != 0) {
+	    DEBUG(1, ("...not a writable file"));
+	    free(result);
+	    result = 0;
+	}
+#else
+	if (!S_ISDIR(sb.st_mode)
+	    || access(result, R_OK | W_OK | X_OK) != 0) {
+	    DEBUG(1, ("...not a writable directory"));
+	    free(result);
+	    result = 0;
+	}
+#endif
+    } else {
+	/* check if parent is directory and is writable */
+	unsigned leaf = _nc_pathlast(result);
+
+	DEBUG(1, ("...not found"));
+	if (leaf) {
+	    char save = result[leaf];
+	    result[leaf] = 0;
+	    if (stat(result, &sb) >= 0
+		&& S_ISDIR(sb.st_mode)
+		&& access(result, R_OK | W_OK | X_OK) == 0) {
+		result[leaf] = save;
+	    } else {
+		DEBUG(1, ("...parent directory %s is not writable", result));
+		free(result);
+		result = 0;
+	    }
+	} else {
+	    DEBUG(1, ("... no parent directory"));
+	    free(result);
+	    result = 0;
+	}
+    }
     return result;
 }
 
+/*
+ * Show the databases to which tic could write.  The location to which it
+ * writes is always the first one.  If none are writable, print an error
+ * message.
+ */
+static void
+show_databases(const char *outdir)
+{
+    bool specific = (outdir != 0) || getenv("TERMINFO") != 0;
+    char *result;
+    const char *tried = 0;
+
+    if (outdir == 0) {
+	outdir = _nc_tic_dir(0);
+    }
+    if ((result = valid_db_path(outdir)) != 0) {
+	printf("%s\n", result);
+	free(result);
+    } else {
+	tried = outdir;
+    }
+
+    if ((outdir = _nc_home_terminfo())) {
+	if ((result = valid_db_path(outdir)) != 0) {
+	    printf("%s\n", result);
+	    free(result);
+	} else if (!specific) {
+	    tried = outdir;
+	}
+    }
+
+    /*
+     * If we can write in neither location, give an error message.
+     */
+    if (tried) {
+	fflush(stdout);
+	fprintf(stderr, "%s: %s (no permission)\n", _nc_progname, tried);
+	ExitProgram(EXIT_FAILURE);
+    }
+}
+
+#define VtoTrace(opt) (unsigned) ((opt > 0) ? opt : (opt == 0))
+
 int
 main(int argc, char *argv[])
 {
     char my_tmpname[PATH_MAX];
-    int v_opt = -1, debug_level;
+    char my_altfile[PATH_MAX];
+    int v_opt = -1;
+    unsigned debug_level;
     int smart_defaults = TRUE;
     char *termcap;
     ENTRY *qp;
@@ -486,6 +678,7 @@
     int sortmode = S_TERMINFO;	/* sort_mode */
 
     int width = 60;
+    int height = 65535;
     bool formatted = FALSE;	/* reformat complex strings? */
     bool literal = FALSE;	/* suppress post-processing? */
     int numbers = 0;		/* format "%'char'" to/from "%{number}" */
@@ -493,7 +686,6 @@
     bool limited = TRUE;
     char *tversion = (char *) NULL;
     const char *source_file = "terminfo";
-    char **namelst = 0;
     char *outdir = (char *) NULL;
     bool check_only = FALSE;
     bool suppress_untranslatable = FALSE;
@@ -501,6 +693,7 @@
     log_fp = stderr;
 
     _nc_progname = _nc_rootname(argv[0]);
+    atexit(cleanup);
 
     if ((infodump = same_program(_nc_progname, PROG_CAPTOINFO)) != FALSE) {
 	outform = F_TERMINFO;
@@ -513,6 +706,7 @@
 #if NCURSES_XNAMES
     use_extended_names(FALSE);
 #endif
+    _nc_strict_bsd = 0;
 
     /*
      * Processing arguments is a little complicated, since someone made a
@@ -520,7 +714,7 @@
      * be optional.
      */
     while ((this_opt = getopt(argc, argv,
-			      "0123456789CILNR:TUVace:fGgo:rstvwx")) != -1) {
+			      "0123456789CDIKLNR:TUVace:fGgo:rstvwx")) != -1) {
 	if (isdigit(this_opt)) {
 	    switch (last_opt) {
 	    case 'v':
@@ -530,19 +724,40 @@
 		width = (width * 10) + (this_opt - '0');
 		break;
 	    default:
-		if (this_opt != '1')
+		switch (this_opt) {
+		case '0':
+		    last_opt = this_opt;
+		    width = 65535;
+		    height = 1;
+		    break;
+		case '1':
+		    last_opt = this_opt;
+		    width = 0;
+		    break;
+		default:
 		    usage();
-		last_opt = this_opt;
-		width = 0;
+		}
 	    }
 	    continue;
 	}
 	switch (this_opt) {
+	case 'K':
+	    _nc_strict_bsd = 1;
+	    /* the initial version of -K in 20110730 fell-thru here, but the
+	     * same flag is useful when reading sources -TD
+	     */
+	    break;
 	case 'C':
 	    capdump = TRUE;
 	    outform = F_TERMCAP;
 	    sortmode = S_TERMCAP;
 	    break;
+	case 'D':
+	    debug_level = VtoTrace(v_opt);
+	    set_trace_level(debug_level);
+	    show_databases(outdir);
+	    ExitProgram(EXIT_SUCCESS);
+	    break;
 	case 'I':
 	    infodump = TRUE;
 	    outform = F_TERMINFO;
@@ -568,7 +783,6 @@
 	    break;
 	case 'V':
 	    puts(curses_version());
-	    cleanup(namelst);
 	    ExitProgram(EXIT_SUCCESS);
 	case 'c':
 	    check_only = TRUE;
@@ -618,7 +832,7 @@
 	last_opt = this_opt;
     }
 
-    debug_level = (v_opt > 0) ? v_opt : (v_opt == 0);
+    debug_level = VtoTrace(v_opt);
     set_trace_level(debug_level);
 
     if (_nc_tracing) {
@@ -638,8 +852,8 @@
      */
     if (namelst && (!infodump && !capdump)) {
 	(void) fprintf(stderr,
-		       "Sorry, -e can't be used without -I or -C\n");
-	cleanup(namelst);
+		       "%s: Sorry, -e can't be used without -I or -C\n",
+		       _nc_progname);
 	ExitProgram(EXIT_FAILURE);
     }
 #endif /* HAVE_BIG_CORE */
@@ -663,16 +877,16 @@
 		if (access(termcap, F_OK) == 0) {
 		    /* file exists */
 		    source_file = termcap;
-		} else if ((tmp_fp = open_tempfile(strcpy(my_tmpname,
-							  "/tmp/XXXXXX")))
-			   != 0) {
-		    source_file = my_tmpname;
-		    fprintf(tmp_fp, "%s\n", termcap);
-		    fclose(tmp_fp);
-		    tmp_fp = open_input(source_file);
-		    to_remove = source_file;
 		} else {
-		    failed("tmpnam");
+		    if ((tmp_fp = open_tempfile(my_tmpname)) != 0) {
+			source_file = my_tmpname;
+			fprintf(tmp_fp, "%s\n", termcap);
+			fclose(tmp_fp);
+			tmp_fp = open_input(source_file, (char *) 0);
+			to_remove = source_file;
+		    } else {
+			failed("tmpnam");
+		    }
 		}
 	    }
 	} else {
@@ -682,24 +896,28 @@
 		    _nc_progname,
 		    _nc_progname,
 		    usage_string);
-	    cleanup(namelst);
 	    ExitProgram(EXIT_FAILURE);
 	}
     }
 
-    if (tmp_fp == 0)
-	tmp_fp = open_input(source_file);
+    if (tmp_fp == 0) {
+	tmp_fp = open_input(source_file, my_altfile);
+	if (!strcmp(source_file, "-")) {
+	    source_file = STDIN_NAME;
+	}
+    }
 
-    if (infodump)
+    if (infodump) {
 	dump_init(tversion,
 		  smart_defaults
 		  ? outform
 		  : F_LITERAL,
-		  sortmode, width, debug_level, formatted);
-    else if (capdump)
+		  sortmode, width, height, debug_level, formatted);
+    } else if (capdump) {
 	dump_init(tversion,
 		  outform,
-		  sortmode, width, debug_level, FALSE);
+		  sortmode, width, height, debug_level, FALSE);
+    }
 
     /* parse entries out of the source file */
     _nc_set_source(source_file);
@@ -716,7 +934,6 @@
     /* do use resolution */
     if (check_only || (!infodump && !capdump) || forceresolve) {
 	if (!_nc_resolve_uses2(TRUE, literal) && !check_only) {
-	    cleanup(namelst);
 	    ExitProgram(EXIT_FAILURE);
 	}
     }
@@ -750,7 +967,7 @@
 
 	    for_entry_list(qp) {
 		if (matches(namelst, qp->tterm.term_names)) {
-		    int j = qp->cend - qp->cstart;
+		    long j = qp->cend - qp->cstart;
 		    int len = 0;
 
 		    /* this is in case infotocap() generates warnings */
@@ -767,7 +984,7 @@
 		    repair_acsc(&qp->tterm);
 		    dump_entry(&qp->tterm, suppress_untranslatable,
 			       limited, numbers, NULL);
-		    for (j = 0; j < (int) qp->nuses; j++)
+		    for (j = 0; j < (long) qp->nuses; j++)
 			dump_uses(qp->uses[j].name, !capdump);
 		    len = show_entry();
 		    if (debug_level != 0 && !limited)
@@ -811,7 +1028,6 @@
 	else
 	    fprintf(log_fp, "No entries written\n");
     }
-    cleanup(namelst);
     ExitProgram(EXIT_SUCCESS);
 }
 
@@ -915,18 +1131,18 @@
     return result;
 }
 
-static int
+static long
 keypad_index(const char *string)
 {
     char *test;
     const char *list = "PQRSwxymtuvlqrsPpn";	/* app-keypad except "Enter" */
     int ch;
-    int result = -1;
+    long result = -1;
 
     if ((ch = keypad_final(string)) != '\0') {
 	test = strchr(list, ch);
 	if (test != 0)
-	    result = (test - list);
+	    result = (long) (test - list);
     }
     return result;
 }
@@ -1015,13 +1231,18 @@
     int count;
     char *list[4];
 
+    /* it is rare to have an insert-line feature without a matching delete */
+    ANDMISSING(parm_insert_line, insert_line);
+    ANDMISSING(parm_delete_line, delete_line);
+    ANDMISSING(parm_insert_line, parm_delete_line);
+
     /* if we have a parameterized form, then the non-parameterized is easy */
     ANDMISSING(parm_down_cursor, cursor_down);
     ANDMISSING(parm_up_cursor, cursor_up);
     ANDMISSING(parm_left_cursor, cursor_left);
     ANDMISSING(parm_right_cursor, cursor_right);
 
-    /* Given any of a set of cursor movement, the whole set should be present. 
+    /* Given any of a set of cursor movement, the whole set should be present.
      * Technically this is not true (we could use cursor_address to fill in
      * unsupported controls), but it is likely.
      */
@@ -1097,11 +1318,11 @@
 	VALID_STRING(key_c1) &&
 	VALID_STRING(key_c3)) {
 	char final[MAX_KP + 1];
-	int list[MAX_KP];
+	long list[MAX_KP];
 	int increase = 0;
 	int j, k, kk;
-	int last;
-	int test;
+	long last;
+	long test;
 
 	final[0] = keypad_final(key_a1);
 	final[1] = keypad_final(key_a3);
@@ -1149,19 +1370,19 @@
 		assert(strlen(show) < (MAX_KP * 4));
 		switch (kk) {
 		case 0:
-		    strcat(show, " ka1");
+		    _nc_STRCAT(show, " ka1", sizeof(show));
 		    break;
 		case 1:
-		    strcat(show, " ka3");
+		    _nc_STRCAT(show, " ka3", sizeof(show));
 		    break;
 		case 2:
-		    strcat(show, " kb2");
+		    _nc_STRCAT(show, " kb2", sizeof(show));
 		    break;
 		case 3:
-		    strcat(show, " kc1");
+		    _nc_STRCAT(show, " kc1", sizeof(show));
 		    break;
 		case 4:
-		    strcat(show, " kc3");
+		    _nc_STRCAT(show, " kc3", sizeof(show));
 		    break;
 		}
 	    }
@@ -1176,18 +1397,24 @@
 	       VALID_STRING(key_c3)) {
 	show[0] = '\0';
 	if (keypad_index(key_a1) >= 0)
-	    strcat(show, " ka1");
+	    _nc_STRCAT(show, " ka1", sizeof(show));
 	if (keypad_index(key_a3) >= 0)
-	    strcat(show, " ka3");
+	    _nc_STRCAT(show, " ka3", sizeof(show));
 	if (keypad_index(key_b2) >= 0)
-	    strcat(show, " kb2");
+	    _nc_STRCAT(show, " kb2", sizeof(show));
 	if (keypad_index(key_c1) >= 0)
-	    strcat(show, " kc1");
+	    _nc_STRCAT(show, " kc1", sizeof(show));
 	if (keypad_index(key_c3) >= 0)
-	    strcat(show, " kc3");
+	    _nc_STRCAT(show, " kc3", sizeof(show));
 	if (*show != '\0')
 	    _nc_warning("vt100 keypad map incomplete:%s", show);
     }
+
+    /*
+     * These warnings are useful for consistency checks - it is possible that
+     * there are real terminals with mismatches in these 
+     */
+    ANDMISSING(key_ic, key_dc);
 }
 
 static void
@@ -1216,6 +1443,72 @@
     ANDMISSING(parm_up_micro, micro_up);
 }
 
+static bool
+uses_SGR_39_49(const char *value)
+{
+    return (strstr(value, "39;49") != 0
+	    || strstr(value, "49;39") != 0);
+}
+
+/*
+ * Check consistency of termcap extensions related to "screen".
+ */
+static void
+check_screen(TERMTYPE *tp)
+{
+    if (_nc_user_definable) {
+	int have_XT = tigetflag("XT");
+	int have_XM = tigetflag("XM");
+	int have_bce = back_color_erase;
+	bool have_kmouse = FALSE;
+	bool use_sgr_39_49 = FALSE;
+	char *name = _nc_first_name(tp->term_names);
+
+	if (!VALID_BOOLEAN(have_bce)) {
+	    have_bce = FALSE;
+	}
+	if (!VALID_BOOLEAN(have_XM)) {
+	    have_XM = FALSE;
+	}
+	if (!VALID_BOOLEAN(have_XT)) {
+	    have_XT = FALSE;
+	}
+	if (VALID_STRING(key_mouse)) {
+	    have_kmouse = !strcmp("\033[M", key_mouse);
+	}
+	if (VALID_STRING(orig_colors)) {
+	    use_sgr_39_49 = uses_SGR_39_49(orig_colors);
+	} else if (VALID_STRING(orig_pair)) {
+	    use_sgr_39_49 = uses_SGR_39_49(orig_pair);
+	}
+
+	if (have_XM && have_XT) {
+	    _nc_warning("Screen's XT capability conflicts with XM");
+	} else if (have_XT
+		   && strstr(name, "screen") != 0
+		   && strchr(name, '.') != 0) {
+	    _nc_warning("Screen's \"screen\" entries should not have XT set");
+	} else if (have_XT) {
+	    if (!have_kmouse && have_bce) {
+		if (VALID_STRING(key_mouse)) {
+		    _nc_warning("Value of kmous inconsistent with screen's usage");
+		} else {
+		    _nc_warning("Expected kmous capability with XT");
+		}
+	    }
+	    if (!have_bce && max_colors > 0)
+		_nc_warning("Expected bce capability with XT");
+	    if (!use_sgr_39_49 && have_bce && max_colors > 0)
+		_nc_warning("Expected orig_colors capability with XT to have 39/49 parameters");
+	    if (VALID_STRING(to_status_line))
+		_nc_warning("\"tsl\" capability is redundant, given XT");
+	} else {
+	    if (have_kmouse && !have_XM)
+		_nc_warning("Expected XT to be set, given kmous");
+	}
+    }
+}
+
 /*
  * Returns the expected number of parameters for the given capability.
  */
@@ -1527,7 +1820,7 @@
 show_where(unsigned level)
 {
     if (_nc_tracing >= DEBUG_LEVEL(level)) {
-	char my_name[256];
+	char my_name[MAX_NAME_SIZE];
 	_nc_get_type(my_name);
 	_tracef("\"%s\", line %d, '%s'",
 		_nc_get_source(),
@@ -1539,6 +1832,58 @@
 #define show_where(level)	/* nothing */
 #endif
 
+typedef struct {
+    int keycode;
+    const char *name;
+    const char *value;
+} NAME_VALUE;
+
+static NAME_VALUE *
+get_fkey_list(TERMTYPE *tp)
+{
+    NAME_VALUE *result = typeMalloc(NAME_VALUE, NUM_STRINGS(tp) + 1);
+    const struct tinfo_fkeys *all_fkeys = _nc_tinfo_fkeys;
+    int used = 0;
+    int j;
+
+    if (result == 0)
+	failed("get_fkey_list");
+
+    for (j = 0; all_fkeys[j].code; j++) {
+	char *a = tp->Strings[all_fkeys[j].offset];
+	if (VALID_STRING(a)) {
+	    result[used].keycode = (int) all_fkeys[j].code;
+	    result[used].name = strnames[all_fkeys[j].offset];
+	    result[used].value = a;
+	    ++used;
+	}
+    }
+#if NCURSES_XNAMES
+    for (j = STRCOUNT; j < NUM_STRINGS(tp); ++j) {
+	const char *name = ExtStrname(tp, j, strnames);
+	if (*name == 'k') {
+	    result[used].keycode = -1;
+	    result[used].name = name;
+	    result[used].value = tp->Strings[j];
+	    ++used;
+	}
+    }
+#endif
+    result[used].keycode = 0;
+    return result;
+}
+
+static void
+show_fkey_name(NAME_VALUE * data)
+{
+    if (data->keycode > 0) {
+	fprintf(stderr, " %s", keyname(data->keycode));
+	fprintf(stderr, " (capability \"%s\")", data->name);
+    } else {
+	fprintf(stderr, " capability \"%s\"", data->name);
+    }
+}
+
 /* other sanity-checks (things that we don't want in the normal
  * logic that reads a terminfo entry)
  */
@@ -1547,7 +1892,6 @@
 {
     bool conflict = FALSE;
     unsigned j, k;
-    char fkeys[STRCOUNT];
 
     /*
      * A terminal entry may contain more than one keycode assigned to
@@ -1555,44 +1899,50 @@
      * return one (the last one assigned).
      */
     if (!(_nc_syntax == SYN_TERMCAP && capdump)) {
-	memset(fkeys, 0, sizeof(fkeys));
-	for (j = 0; _nc_tinfo_fkeys[j].code; j++) {
-	    char *a = tp->Strings[_nc_tinfo_fkeys[j].offset];
+	char *check = calloc((size_t) (NUM_STRINGS(tp) + 1), sizeof(char));
+	NAME_VALUE *given = get_fkey_list(tp);
+
+	if (check == 0)
+	    failed("check_termtype");
+
+	for (j = 0; given[j].keycode; ++j) {
+	    const char *a = given[j].value;
 	    bool first = TRUE;
-	    if (!VALID_STRING(a))
-		continue;
-	    for (k = j + 1; _nc_tinfo_fkeys[k].code; k++) {
-		char *b = tp->Strings[_nc_tinfo_fkeys[k].offset];
-		if (!VALID_STRING(b)
-		    || fkeys[k])
+
+	    for (k = j + 1; given[k].keycode; k++) {
+		const char *b = given[k].value;
+		if (check[k])
 		    continue;
 		if (!_nc_capcmp(a, b)) {
-		    fkeys[j] = 1;
-		    fkeys[k] = 1;
+		    check[j] = 1;
+		    check[k] = 1;
 		    if (first) {
 			if (!conflict) {
 			    _nc_warning("Conflicting key definitions (using the last)");
 			    conflict = TRUE;
 			}
-			fprintf(stderr, "... %s is the same as %s",
-				keyname((int) _nc_tinfo_fkeys[j].code),
-				keyname((int) _nc_tinfo_fkeys[k].code));
+			fprintf(stderr, "...");
+			show_fkey_name(given + j);
+			fprintf(stderr, " is the same as");
+			show_fkey_name(given + k);
 			first = FALSE;
 		    } else {
-			fprintf(stderr, ", %s",
-				keyname((int) _nc_tinfo_fkeys[k].code));
+			fprintf(stderr, ", ");
+			show_fkey_name(given + k);
 		    }
 		}
 	    }
 	    if (!first)
 		fprintf(stderr, "\n");
 	}
+	free(given);
+	free(check);
     }
 
-    for (j = 0; j < NUM_STRINGS(tp); j++) {
+    for_each_string(j, tp) {
 	char *a = tp->Strings[j];
 	if (VALID_STRING(a))
-	    check_params(tp, ExtStrname(tp, j, strnames), a);
+	    check_params(tp, ExtStrname(tp, (int) j, strnames), a);
     }
 
     check_acs(tp);
@@ -1600,6 +1950,7 @@
     check_cursor(tp);
     check_keypad(tp);
     check_printer(tp);
+    check_screen(tp);
 
     /*
      * These may be mismatched because the terminal description relies on
Index: progs/toe.c
Prereq:  1.52 
--- ncurses-5.9/progs/toe.c	2010-05-01 22:04:08.000000000 +0000
+++ ncurses-5.9-20130504/progs/toe.c	2013-03-09 22:45:23.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2008,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -44,12 +44,23 @@
 #include <hashed_db.h>
 #endif
 
-MODULE_ID("$Id: toe.c,v 1.52 2010/05/01 22:04:08 tom Exp $")
+MODULE_ID("$Id: toe.c,v 1.71 2013/03/09 22:45:23 tom Exp $")
 
 #define isDotname(name) (!strcmp(name, ".") || !strcmp(name, ".."))
 
+typedef struct {
+    int db_index;
+    unsigned long checksum;
+    char *term_name;
+    char *description;
+} TERMDATA;
+
 const char *_nc_progname;
 
+static TERMDATA *ptr_termdata;	/* array of terminal data */
+static size_t use_termdata;	/* actual usage in ptr_termdata[] */
+static size_t len_termdata;	/* allocated size of ptr_termdata[] */
+
 #if NO_LEAKS
 #undef ExitProgram
 static void ExitProgram(int code) GCC_NORETURN;
@@ -61,6 +72,8 @@
 }
 #endif
 
+static void failed(const char *) GCC_NORETURN;
+
 static void
 failed(const char *msg)
 {
@@ -68,6 +81,150 @@
     ExitProgram(EXIT_FAILURE);
 }
 
+static char *
+strmalloc(const char *value)
+{
+    char *result = strdup(value);
+    if (result == 0) {
+	failed("strmalloc");
+    }
+    return result;
+}
+
+static TERMDATA *
+new_termdata(void)
+{
+    size_t want = use_termdata + 1;
+
+    if (want >= len_termdata) {
+	len_termdata = (2 * want) + 10;
+	ptr_termdata = typeRealloc(TERMDATA, len_termdata, ptr_termdata);
+	if (ptr_termdata == 0)
+	    failed("ptr_termdata");
+    }
+
+    return ptr_termdata + use_termdata++;
+}
+
+static int
+compare_termdata(const void *a, const void *b)
+{
+    const TERMDATA *p = (const TERMDATA *) a;
+    const TERMDATA *q = (const TERMDATA *) b;
+    int result = strcmp(p->term_name, q->term_name);
+
+    if (result == 0) {
+	result = (p->db_index - q->db_index);
+    }
+    return result;
+}
+
+/*
+ * Sort the array of TERMDATA and print it.  If more than one database is being
+ * reported, add a column to show which database has a given entry.
+ */
+static void
+show_termdata(int eargc, char **eargv)
+{
+    int j, k;
+    size_t n;
+
+    if (use_termdata) {
+	if (eargc > 1) {
+	    for (j = 0; j < eargc; ++j) {
+		for (k = 0; k <= j; ++k) {
+		    printf("--");
+		}
+		printf("> ");
+		printf("%s\n", eargv[j]);
+	    }
+	}
+	if (use_termdata > 1)
+	    qsort(ptr_termdata, use_termdata, sizeof(TERMDATA), compare_termdata);
+	for (n = 0; n < use_termdata; ++n) {
+
+	    /*
+	     * If there is more than one database, show how they differ.
+	     */
+	    if (eargc > 1) {
+		unsigned long check = 0;
+		k = 0;
+		for (;;) {
+		    for (; k < ptr_termdata[n].db_index; ++k) {
+			printf("--");
+		    }
+
+		    /*
+		     * If this is the first entry, or its checksum differs
+		     * from the first entry's checksum, print "*". Otherwise
+		     * it looks enough like a duplicate to print "+".
+		     */
+		    printf("%c-", ((check == 0
+				    || (check != ptr_termdata[n].checksum))
+				   ? '*'
+				   : '+'));
+		    check = ptr_termdata[n].checksum;
+
+		    ++k;
+		    if ((n + 1) >= use_termdata
+			|| strcmp(ptr_termdata[n].term_name,
+				  ptr_termdata[n + 1].term_name)) {
+			break;
+		    }
+		    ++n;
+		}
+		for (; k < eargc; ++k) {
+		    printf("--");
+		}
+		printf(":\t");
+	    }
+
+	    (void) printf("%-10s\t%s\n",
+			  ptr_termdata[n].term_name,
+			  ptr_termdata[n].description);
+	}
+    }
+}
+
+static void
+free_termdata(void)
+{
+    if (ptr_termdata != 0) {
+	while (use_termdata != 0) {
+	    --use_termdata;
+	    free(ptr_termdata[use_termdata].term_name);
+	    free(ptr_termdata[use_termdata].description);
+	}
+	free(ptr_termdata);
+	ptr_termdata = 0;
+    }
+    use_termdata = 0;
+    len_termdata = 0;
+}
+
+static char **
+allocArgv(size_t count)
+{
+    char **result = typeCalloc(char *, count + 1);
+    if (result == 0)
+	failed("realloc eargv");
+
+    assert(result != 0);
+    return result;
+}
+
+static void
+freeArgv(char **argv)
+{
+    if (argv) {
+	int count = 0;
+	while (argv[count]) {
+	    free(argv[count++]);
+	}
+	free(argv);
+    }
+}
+
 #if USE_HASHED_DB
 static bool
 make_db_name(char *dst, const char *src, unsigned limit)
@@ -81,61 +238,94 @@
 
     if (need <= limit) {
 	if (size >= lens
-	    && !strcmp(src + size - lens, suffix))
-	    (void) strcpy(dst, src);
-	else
-	    (void) sprintf(dst, "%s%s", src, suffix);
+	    && !strcmp(src + size - lens, suffix)) {
+	    _nc_STRCPY(dst, src, PATH_MAX);
+	} else {
+	    _nc_SPRINTF(dst, _nc_SLIMIT(PATH_MAX) "%s%s", src, suffix);
+	}
 	result = TRUE;
     }
     return result;
 }
 #endif
 
-static bool
-is_database(const char *path)
+typedef void (DescHook) (int /* db_index */ ,
+			 int /* db_limit */ ,
+			 const char * /* term_name */ ,
+			 TERMTYPE * /* term */ );
+
+static const char *
+term_description(TERMTYPE *tp)
 {
-    bool result = FALSE;
-#if USE_DATABASE
-    if (_nc_is_dir_path(path) && access(path, R_OK | X_OK) == 0) {
-	result = TRUE;
-    }
-#endif
-#if USE_TERMCAP
-    if (_nc_is_file_path(path) && access(path, R_OK) == 0) {
-	result = TRUE;
+    const char *desc;
+
+    if (tp->term_names == 0
+	|| (desc = strrchr(tp->term_names, '|')) == 0
+	|| (*++desc == '\0')) {
+	desc = "(No description)";
     }
-#endif
-#if USE_HASHED_DB
-    if (!result) {
-	char filename[PATH_MAX];
-	if (_nc_is_file_path(path) && access(path, R_OK) == 0) {
-	    result = TRUE;
-	} else if (make_db_name(filename, path, sizeof(filename))) {
-	    if (_nc_is_file_path(filename) && access(filename, R_OK) == 0) {
-		result = TRUE;
-	    }
+
+    return desc;
+}
+
+/* display a description for the type */
+static void
+deschook(int db_index, int db_limit, const char *term_name, TERMTYPE *tp)
+{
+    (void) db_index;
+    (void) db_limit;
+    (void) printf("%-10s\t%s\n", term_name, term_description(tp));
+}
+
+static unsigned long
+string_sum(const char *value)
+{
+    unsigned long result = 0;
+
+    if ((intptr_t) value == (intptr_t) (-1)) {
+	result = ~result;
+    } else if (value) {
+	while (*value) {
+	    result += UChar(*value);
+	    ++value;
 	}
     }
-#endif
     return result;
 }
 
-static void
-deschook(const char *cn, TERMTYPE *tp)
-/* display a description for the type */
+static unsigned long
+checksum_of(TERMTYPE *tp)
 {
-    const char *desc;
+    unsigned long result = string_sum(tp->term_names);
+    unsigned i;
 
-    if ((desc = strrchr(tp->term_names, '|')) == 0 || *++desc == '\0')
-	desc = "(No description)";
+    for (i = 0; i < NUM_BOOLEANS(tp); i++) {
+	result += (unsigned long) (tp->Booleans[i]);
+    }
+    for (i = 0; i < NUM_NUMBERS(tp); i++) {
+	result += (unsigned long) (tp->Numbers[i]);
+    }
+    for (i = 0; i < NUM_STRINGS(tp); i++) {
+	result += string_sum(tp->Strings[i]);
+    }
+    return result;
+}
+
+/* collect data, to sort before display */
+static void
+sorthook(int db_index, int db_limit, const char *term_name, TERMTYPE *tp)
+{
+    TERMDATA *data = new_termdata();
 
-    (void) printf("%-10s\t%s\n", cn, desc);
+    data->db_index = db_index;
+    data->checksum = ((db_limit > 1) ? checksum_of(tp) : 0);
+    data->term_name = strmalloc(term_name);
+    data->description = strmalloc(term_description(tp));
 }
 
 #if USE_TERMCAP
 static void
-show_termcap(char *buffer,
-	     void (*hook) (const char *, TERMTYPE *tp))
+show_termcap(int db_index, int db_limit, char *buffer, DescHook hook)
 {
     TERMTYPE data;
     char *next = strchr(buffer, ':');
@@ -149,20 +339,36 @@
     if (last)
 	++last;
 
-    data.term_names = strdup(buffer);
+    memset(&data, 0, sizeof(data));
+    data.term_names = strmalloc(buffer);
     while ((next = strtok(list, "|")) != 0) {
 	if (next != last)
-	    hook(next, &data);
+	    hook(db_index, db_limit, next, &data);
 	list = 0;
     }
     free(data.term_names);
 }
 #endif
 
+#if USE_DATABASE
+static char *
+copy_entryname(DIRENT * src)
+{
+    size_t len = NAMLEN(src);
+    char *result = malloc(len + 1);
+    if (result == 0)
+	failed("copy entryname");
+    memcpy(result, src->d_name, len);
+    result[len] = '\0';
+
+    return result;
+}
+#endif
+
 static int
 typelist(int eargc, char *eargv[],
 	 bool verbosity,
-	 void (*hook) (const char *, TERMTYPE *tp))
+	 DescHook hook)
 /* apply a function to each entry in given terminfo directories */
 {
     int i;
@@ -179,28 +385,35 @@
 		(void) fprintf(stderr,
 			       "%s: can't open terminfo directory %s\n",
 			       _nc_progname, eargv[i]);
-		return (EXIT_FAILURE);
-	    } else if (verbosity)
+		continue;
+	    }
+
+	    if (verbosity)
 		(void) printf("#\n#%s:\n#\n", eargv[i]);
 
 	    while ((subdir = readdir(termdir)) != 0) {
-		size_t len = NAMLEN(subdir);
-		size_t cwd_len = len + strlen(eargv[i]) + 3;
-		char name_1[PATH_MAX];
+		size_t cwd_len;
+		char *name_1;
 		DIR *entrydir;
 		DIRENT *entry;
 
+		name_1 = copy_entryname(subdir);
+		if (isDotname(name_1)) {
+		    free(name_1);
+		    continue;
+		}
+
+		cwd_len = NAMLEN(subdir) + strlen(eargv[i]) + 3;
 		cwd_buf = typeRealloc(char, cwd_len, cwd_buf);
 		if (cwd_buf == 0)
 		    failed("realloc cwd_buf");
 
 		assert(cwd_buf != 0);
 
-		strncpy(name_1, subdir->d_name, len)[len] = '\0';
-		if (isDotname(name_1))
-		    continue;
+		_nc_SPRINTF(cwd_buf, _nc_SLIMIT(cwd_len)
+			    "%s/%s/", eargv[i], name_1);
+		free(name_1);
 
-		(void) sprintf(cwd_buf, "%s/%.*s/", eargv[i], (int) len, name_1);
 		if (chdir(cwd_buf) != 0)
 		    continue;
 
@@ -210,15 +423,16 @@
 		    continue;
 		}
 		while ((entry = readdir(entrydir)) != 0) {
-		    char name_2[PATH_MAX];
+		    char *name_2;
 		    TERMTYPE lterm;
 		    char *cn;
 		    int status;
 
-		    len = NAMLEN(entry);
-		    strncpy(name_2, entry->d_name, len)[len] = '\0';
-		    if (isDotname(name_2) || !_nc_is_file_path(name_2))
+		    name_2 = copy_entryname(entry);
+		    if (isDotname(name_2) || !_nc_is_file_path(name_2)) {
+			free(name_2);
 			continue;
+		    }
 
 		    status = _nc_read_file_entry(name_2, &lterm);
 		    if (status <= 0) {
@@ -226,6 +440,10 @@
 			(void) fprintf(stderr,
 				       "%s: couldn't open terminfo file %s.\n",
 				       _nc_progname, name_2);
+			free(cwd_buf);
+			free(name_2);
+			closedir(entrydir);
+			closedir(termdir);
 			return (EXIT_FAILURE);
 		    }
 
@@ -233,21 +451,26 @@
 		    cn = _nc_first_name(lterm.term_names);
 		    if (!strcmp(cn, name_2)) {
 			/* apply the selected hook function */
-			(*hook) (cn, &lterm);
+			hook(i, eargc, cn, &lterm);
 		    }
 		    _nc_free_termtype(&lterm);
+		    free(name_2);
 		}
 		closedir(entrydir);
 	    }
 	    closedir(termdir);
 	    if (cwd_buf != 0)
 		free(cwd_buf);
+	    continue;
 	}
 #if USE_HASHED_DB
 	else {
 	    DB *capdbp;
 	    char filename[PATH_MAX];
 
+	    if (verbosity)
+		(void) printf("#\n#%s:\n#\n", eargv[i]);
+
 	    if (make_db_name(filename, eargv[i], sizeof(filename))) {
 		if ((capdbp = _nc_db_open(filename, FALSE)) != 0) {
 		    DBT key, data;
@@ -265,7 +488,7 @@
 				/* only visit things once, by primary name */
 				cn = _nc_first_name(lterm.term_names);
 				/* apply the selected hook function */
-				(*hook) (cn, &lterm);
+				hook(i, eargc, cn, &lterm);
 				_nc_free_termtype(&lterm);
 			    }
 			}
@@ -273,6 +496,7 @@
 		    }
 
 		    _nc_db_close(capdbp);
+		    continue;
 		}
 	    }
 	}
@@ -280,37 +504,43 @@
 #endif
 #if USE_TERMCAP
 #if HAVE_BSD_CGETENT
-	char *db_array[2];
-	char *buffer = 0;
+	{
+	    CGETENT_CONST char *db_array[2];
+	    char *buffer = 0;
 
-	if (verbosity)
-	    (void) printf("#\n#%s:\n#\n", eargv[i]);
+	    if (verbosity)
+		(void) printf("#\n#%s:\n#\n", eargv[i]);
 
-	db_array[0] = eargv[i];
-	db_array[1] = 0;
+	    db_array[0] = eargv[i];
+	    db_array[1] = 0;
 
-	if (cgetfirst(&buffer, db_array)) {
-	    show_termcap(buffer, hook);
-	    free(buffer);
-	    while (cgetnext(&buffer, db_array)) {
-		show_termcap(buffer, hook);
+	    if (cgetfirst(&buffer, db_array) > 0) {
+		show_termcap(i, eargc, buffer, hook);
 		free(buffer);
+		while (cgetnext(&buffer, db_array) > 0) {
+		    show_termcap(i, eargc, buffer, hook);
+		    free(buffer);
+		}
+		cgetclose();
+		continue;
 	    }
 	}
-	cgetclose();
 #else
 	/* scan termcap text-file only */
 	if (_nc_is_file_path(eargv[i])) {
 	    char buffer[2048];
 	    FILE *fp;
 
+	    if (verbosity)
+		(void) printf("#\n#%s:\n#\n", eargv[i]);
+
 	    if ((fp = fopen(eargv[i], "r")) != 0) {
 		while (fgets(buffer, sizeof(buffer), fp) != 0) {
 		    if (*buffer == '#')
 			continue;
 		    if (isspace(*buffer))
 			continue;
-		    show_termcap(buffer, hook);
+		    show_termcap(i, eargc, buffer, hook);
 		}
 		fclose(fp);
 	    }
@@ -319,13 +549,18 @@
 #endif
     }
 
+    if (hook == sorthook) {
+	show_termdata(eargc, eargv);
+	free_termdata();
+    }
+
     return (EXIT_SUCCESS);
 }
 
 static void
 usage(void)
 {
-    (void) fprintf(stderr, "usage: %s [-ahuUV] [-v n] [file...]\n", _nc_progname);
+    (void) fprintf(stderr, "usage: %s [-ahsuUV] [-v n] [file...]\n", _nc_progname);
     ExitProgram(EXIT_FAILURE);
 }
 
@@ -340,23 +575,24 @@
     unsigned i;
     int code;
     int this_opt, last_opt = '?';
-    int v_opt = 0;
+    unsigned v_opt = 0;
+    DescHook *hook = deschook;
 
     _nc_progname = _nc_rootname(argv[0]);
 
-    while ((this_opt = getopt(argc, argv, "0123456789ahu:vU:V")) != -1) {
+    while ((this_opt = getopt(argc, argv, "0123456789ahsu:vU:V")) != -1) {
 	/* handle optional parameter */
 	if (isdigit(this_opt)) {
 	    switch (last_opt) {
 	    case 'v':
-		v_opt = (this_opt - '0');
+		v_opt = (unsigned) (this_opt - '0');
 		break;
 	    default:
 		if (isdigit(last_opt))
 		    v_opt *= 10;
 		else
 		    v_opt = 0;
-		v_opt += (this_opt - '0');
+		v_opt += (unsigned) (this_opt - '0');
 		last_opt = this_opt;
 	    }
 	    continue;
@@ -368,6 +604,9 @@
 	case 'h':
 	    header = TRUE;
 	    break;
+	case 's':
+	    hook = sorthook;
+	    break;
 	case 'u':
 	    direct_dependencies = TRUE;
 	    report_file = optarg;
@@ -450,7 +689,7 @@
      * If we get this far, user wants a simple terminal type listing.
      */
     if (optind < argc) {
-	code = typelist(argc - optind, argv + optind, header, deschook);
+	code = typelist(argc - optind, argv + optind, header, hook);
     } else if (all_dirs) {
 	DBDIRS state;
 	int offset;
@@ -460,64 +699,41 @@
 
 	code = EXIT_FAILURE;
 	for (pass = 0; pass < 2; ++pass) {
-	    unsigned count = 0;
+	    size_t count = 0;
 
 	    _nc_first_db(&state, &offset);
 	    while ((path = _nc_next_db(&state, &offset)) != 0) {
-		if (!is_database(path)) {
-		    ;
-		} else if (eargv != 0) {
-		    unsigned n;
-		    int found = FALSE;
-
-		    /* eliminate duplicates */
-		    for (n = 0; n < count; ++n) {
-			if (!strcmp(path, eargv[n])) {
-			    found = TRUE;
-			    break;
-			}
-		    }
-		    if (!found) {
-			eargv[count] = strdup(path);
-			++count;
-		    }
-		} else {
-		    ++count;
+		if (pass) {
+		    eargv[count] = strmalloc(path);
 		}
+		++count;
 	    }
 	    if (!pass) {
-		eargv = typeCalloc(char *, count + 1);
+		eargv = allocArgv(count);
 		if (eargv == 0)
-		    failed("realloc eargv");
-
-		assert(eargv != 0);
+		    failed("eargv");
 	    } else {
-		code = typelist((int) count, eargv, header, deschook);
-		while (count-- > 0)
-		    free(eargv[count]);
-		free(eargv);
+		code = typelist((int) count, eargv, header, hook);
+		freeArgv(eargv);
 	    }
 	}
     } else {
 	DBDIRS state;
 	int offset;
 	const char *path;
-	char *eargv[3];
-	int count = 0;
+	char **eargv = allocArgv(2);
+	size_t count = 0;
 
+	if (eargv == 0)
+	    failed("eargv");
 	_nc_first_db(&state, &offset);
-	while ((path = _nc_next_db(&state, &offset)) != 0) {
-	    if (is_database(path)) {
-		eargv[count++] = strdup(path);
-		break;
-	    }
+	if ((path = _nc_next_db(&state, &offset)) != 0) {
+	    eargv[count++] = strmalloc(path);
 	}
-	eargv[count] = 0;
 
-	code = typelist(count, eargv, header, deschook);
+	code = typelist((int) count, eargv, header, hook);
 
-	while (count-- > 0)
-	    free(eargv[count]);
+	freeArgv(eargv);
     }
     _nc_last_db();
 
Index: progs/tput.c
Prereq:  1.46 
--- ncurses-5.9/progs/tput.c	2010-01-09 16:53:24.000000000 +0000
+++ ncurses-5.9-20130504/progs/tput.c	2012-02-18 21:51:17.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -47,7 +47,7 @@
 #endif
 #include <transform.h>
 
-MODULE_ID("$Id: tput.c,v 1.46 2010/01/09 16:53:24 tom Exp $")
+MODULE_ID("$Id: tput.c,v 1.48 2012/02/18 21:51:17 tom Exp $")
 
 #define PUTS(s)		fputs(s, stdout)
 #define PUTCHAR(c)	putchar(c)
@@ -94,9 +94,6 @@
  * Lookup the type of call we should make to tparm().  This ignores the actual
  * terminfo capability (bad, because it is not extensible), but makes this
  * code portable to platforms where sizeof(int) != sizeof(char *).
- *
- * FIXME: If we want extensibility, analyze the capability string as we do
- * in tparm() to decide how to parse the varargs list.
  */
 static TParams
 tparm_type(const char *name)
@@ -338,7 +335,7 @@
 	    case Numbers:
 	    default:
 		(void) _nc_tparm_analyze(s, p_is_s, &popcount);
-#define myParam(n) (p_is_s[n - 1] != 0 ? ((long) strings[n]) : numbers[n])
+#define myParam(n) (p_is_s[n - 1] != 0 ? ((TPARM_ARG) strings[n]) : numbers[n])
 		s = TPARM_9(s,
 			    myParam(1),
 			    myParam(2),
Index: progs/transform.c
Prereq:  1.2 
--- ncurses-5.9/progs/transform.c	2010-09-04 21:16:17.000000000 +0000
+++ ncurses-5.9-20130504/progs/transform.c	2011-05-14 22:41:17.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 2009,2010 Free Software Foundation, Inc.                   *
+ * Copyright (c) 2009-2010,2011 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -34,21 +34,21 @@
 
 #include <transform.h>
 
-MODULE_ID("$Id: transform.c,v 1.2 2010/09/04 21:16:17 tom Exp $")
+MODULE_ID("$Id: transform.c,v 1.3 2011/05/14 22:41:17 tom Exp $")
 
 #ifdef SUFFIX_IGNORED
 static void
-trim_suffix(const char *a, unsigned *len)
+trim_suffix(const char *a, size_t *len)
 {
     const char ignore[] = SUFFIX_IGNORED;
 
     if (sizeof(ignore) != 0) {
 	bool trim = FALSE;
-	unsigned need = (sizeof(ignore) - 1);
+	size_t need = (sizeof(ignore) - 1);
 
 	if (*len > need) {
-	    unsigned first = *len - need;
-	    unsigned n;
+	    size_t first = *len - need;
+	    size_t n;
 	    trim = TRUE;
 	    for (n = first; n < *len; ++n) {
 		if (tolower(UChar(a[n])) != tolower(UChar(ignore[n - first]))) {
@@ -69,8 +69,8 @@
 bool
 same_program(const char *a, const char *b)
 {
-    unsigned len_a = strlen(a);
-    unsigned len_b = strlen(b);
+    size_t len_a = strlen(a);
+    size_t len_b = strlen(b);
 
     trim_suffix(a, &len_a);
     trim_suffix(b, &len_b);
Index: progs/tset.c
Prereq:  1.82 
--- ncurses-5.9/progs/tset.c	2010-05-01 21:42:46.000000000 +0000
+++ ncurses-5.9-20130504/progs/tset.c	2013-03-23 21:38:08.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -119,7 +119,7 @@
 #include <dump_entry.h>
 #include <transform.h>
 
-MODULE_ID("$Id: tset.c,v 1.82 2010/05/01 21:42:46 tom Exp $")
+MODULE_ID("$Id: tset.c,v 1.91 2013/03/23 21:38:08 tom Exp $")
 
 /*
  * SCO defines TIOCGSIZE and the corresponding struct.  Other systems (SunOS,
@@ -148,6 +148,10 @@
 #undef CTRL
 #define CTRL(x)	((x) & 0x1f)
 
+static void failed(const char *) GCC_NORETURN;
+static void exit_error(void) GCC_NORETURN;
+static void err(const char *,...) GCC_NORETURN;
+
 const char *_nc_progname = "tset";
 
 static TTY mode, oldmode, original;
@@ -160,7 +164,10 @@
 static int terasechar = -1;	/* new erase character */
 static int intrchar = -1;	/* new interrupt character */
 static int tkillchar = -1;	/* new kill character */
+
+#if HAVE_SIZECHANGE
 static int tlines, tcolumns;	/* window size */
+#endif
 
 #define LOWERCASE(c) ((isalpha(UChar(c)) && isupper(UChar(c))) ? tolower(UChar(c)) : (c))
 
@@ -203,13 +210,13 @@
 failed(const char *msg)
 {
     char temp[BUFSIZ];
-    unsigned len = strlen(_nc_progname) + 2;
+    size_t len = strlen(_nc_progname) + 2;
 
     if ((int) len < (int) sizeof(temp) - 12) {
-	strcpy(temp, _nc_progname);
-	strcat(temp, ": ");
+	_nc_STRCPY(temp, _nc_progname, sizeof(temp));
+	_nc_STRCAT(temp, ": ", sizeof(temp));
     } else {
-	strcpy(temp, "tset: ");
+	_nc_STRCPY(temp, "tset: ", sizeof(temp));
     }
     perror(strncat(temp, msg, sizeof(temp) - strlen(temp) - 2));
     exit_error();
@@ -467,9 +474,6 @@
 	mapp->speed = tbaudrate(p);
     }
 
-    if (arg == (char *) 0)	/* Non-optional type. */
-	goto badmopt;
-
     mapp->type = arg;
 
     /* Terminate porttype, if specified. */
@@ -527,19 +531,19 @@
 		match = TRUE;
 		break;
 	    case EQ:
-		match = (ospeed == mapp->speed);
+		match = ((int) ospeed == mapp->speed);
 		break;
 	    case GE:
-		match = (ospeed >= mapp->speed);
+		match = ((int) ospeed >= mapp->speed);
 		break;
 	    case GT:
-		match = (ospeed > mapp->speed);
+		match = ((int) ospeed > mapp->speed);
 		break;
 	    case LE:
-		match = (ospeed <= mapp->speed);
+		match = ((int) ospeed <= mapp->speed);
 		break;
 	    case LT:
-		match = (ospeed < mapp->speed);
+		match = ((int) ospeed < mapp->speed);
 		break;
 	    default:
 		match = FALSE;
@@ -1043,11 +1047,18 @@
 {
     if (set_tab && clear_all_tabs) {
 	int c;
+	int lim =
+#if HAVE_SIZECHANGE
+	tcolumns
+#else
+	columns
+#endif
+	 ;
 
 	(void) putc('\r', stderr);	/* Force to left margin. */
 	tputs(clear_all_tabs, 0, outc);
 
-	for (c = 8; c < tcolumns; c += 8) {
+	for (c = 8; c < lim; c += 8) {
 	    /* Get to the right column.  In BSD tset, this
 	     * used to try a bunch of half-clever things
 	     * with cup and hpa, for an average saving of
@@ -1273,10 +1284,10 @@
     (void) get_termcap_entry(*argv);
 
     if (!noset) {
+#if HAVE_SIZECHANGE
 	tcolumns = columns;
 	tlines = lines;
 
-#if HAVE_SIZECHANGE
 	if (opt_w) {
 	    STRUCT_WINSIZE win;
 	    /* Set window size if not set already */
Index: test/Makefile.in
Prereq:  1.108 
--- ncurses-5.9/test/Makefile.in	2010-11-28 16:39:40.000000000 +0000
+++ ncurses-5.9-20130504/test/Makefile.in	2011-09-24 15:13:44.000000000 +0000
@@ -1,6 +1,6 @@
-# $Id: Makefile.in,v 1.108 2010/11/28 16:39:40 tom Exp $
+# $Id: Makefile.in,v 1.109 2011/09/24 15:13:44 nix Exp $
 ##############################################################################
-# Copyright (c) 1998-2008,2010 Free Software Foundation, Inc.                #
+# Copyright (c) 1998-2010,2011 Free Software Foundation, Inc.                #
 #                                                                            #
 # Permission is hereby granted, free of charge, to any person obtaining a    #
 # copy of this software and associated documentation files (the "Software"), #
@@ -102,7 +102,7 @@
 LDFLAGS_PROFILE	= $(LDFLAGS) $(CFLAGS_PROFILE)
 LDFLAGS_SHARED	= $(LDFLAGS) $(CFLAGS_SHARED) @LD_SHARED_OPTS@
 
-TEST_ARGS	= @LDFLAGS_STATIC@ @TEST_ARGS@ @LDFLAGS_SHARED@ 
+TEST_ARGS	= @LDFLAGS_STATIC@ @TEST_ARGS@ @LDFLAGS_SHARED@
 
 # use these for linking with all of the libraries
 LIBS_DEFAULT	= $(TEST_ARGS) @LIBS@ $(TEST_LIBS) $(MATH_LIB)
@@ -117,8 +117,8 @@
 LDFLAGS_CURSES	= $(LDFLAGS_@DFT_UPR_MODEL@) $(LIBS_CURSES)
 
 # use these for linking with the tinfo library if we have it, or curses library if not
-LIBS_TINFO	= @LDFLAGS_STATIC@ @TINFO_ARGS@ @LDFLAGS_SHARED@ @LIBS@ $(TEST_LIBS) $(MATH_LIB)
-LDFLAGS_TINFO	= $(LDFLAGS_@DFT_UPR_MODEL@) $(LIBS_TINFO)
+LIBS_TINFO	= @LDFLAGS_STATIC@ @TINFO_LIBS@ @LDFLAGS_SHARED@ @LIBS@ $(TEST_LIBS) $(MATH_LIB)
+LDFLAGS_TINFO	= @TINFO_LDFLAGS@ $(LDFLAGS_@DFT_UPR_MODEL@) $(LIBS_TINFO)
 
 LINT		= @LINT@
 LINT_OPTS	= @LINT_OPTS@
Index: test/README
Prereq:  1.44 
--- ncurses-5.9/test/README	2011-02-26 00:09:25.000000000 +0000
+++ ncurses-5.9-20130504/test/README	2013-01-19 21:30:38.000000000 +0000
@@ -1,5 +1,5 @@
 -------------------------------------------------------------------------------
--- Copyright (c) 1998-2010,2011 Free Software Foundation, Inc.               --
+-- Copyright (c) 1998-2011,2012 Free Software Foundation, Inc.               --
 --                                                                           --
 -- Permission is hereby granted, free of charge, to any person obtaining a   --
 -- copy of this software and associated documentation files (the             --
@@ -25,7 +25,7 @@
 -- sale, use or other dealings in this Software without prior written        --
 -- authorization.                                                            --
 -------------------------------------------------------------------------------
--- $Id: README,v 1.44 2011/02/26 00:09:25 tom Exp $
+-- $Id: README,v 1.47 2013/01/19 21:30:38 tom Exp $
 -------------------------------------------------------------------------------
 
 The programs in this directory are designed to test your newest toy :-)
@@ -223,18 +223,18 @@
 SP				lib: form
 TABSIZE				test: test_opaque
 UP				-
-acs_map				test: gdc ins_wide inserts knight movewindow ncurses newdemo test_add_wchstr test_addchstr test_addstr test_addwstr testcurs
+acs_map				test: background gdc ins_wide inserts knight movewindow ncurses newdemo test_add_wchstr test_addchstr test_addstr test_addwstr testcurs
 add_wch				test: demo_panels ncurses test_add_wchstr test_addwstr
 add_wchnstr			test: test_add_wchstr
 add_wchstr			test: test_add_wchstr view
-addch				test: blue bs echochar hashtest ncurses savescreen test_add_wchstr test_addchstr test_addstr test_addwstr test_opaque testaddch view worm
+addch				test: background blue bs echochar hashtest ncurses savescreen test_add_wchstr test_addchstr test_addstr test_addwstr test_opaque testaddch view worm
 addchnstr			test: test_addchstr
 addchstr			test: test_addchstr
 addnstr				test: test_addstr
 addnwstr			test: ncurses test_addwstr
 addstr				test: blue bs cardfile gdc hanoi lrtest ncurses savescreen test_addstr
 addwstr				test: ncurses test_addwstr
-assume_default_colors		test: ncurses
+assume_default_colors		test: background ncurses
 assume_default_colors_sp	-
 attr_get			test: ncurses
 attr_off			test: ncurses
@@ -271,7 +271,7 @@
 color_content_sp		-
 color_set			test: color_set ncurses
 copywin				test: ncurses testcurs
-cur_term			test: demo_terminfo dots dots_mvcur lrtest progs: clear tabs tput tset
+cur_term			test: demo_terminfo dots dots_mvcur lrtest test_vid_puts test_vidputs progs: clear tabs tput tset
 curs_set			test: echochar firework gdc hanoi lrtest ncurses newdemo rain savescreen tclock testcurs worm xmas
 curs_set_sp			lib: ncurses
 curscr				test: demo_panels edit_field knight lrtest ncurses savescreen tclock view
@@ -306,7 +306,7 @@
 erasewchar			-
 filter				test: filter
 filter_sp			-
-flash				test: cardfile lrtest ncurses tclock testcurs
+flash				test: cardfile lrtest movewindow ncurses tclock testcurs
 flash_sp			-
 flushinp			test: ncurses newdemo testcurs
 flushinp_sp			lib: ncurses
@@ -399,7 +399,7 @@
 key_name			test: key_names ncurses
 keybound			test: demo_altkeys demo_defkey
 keybound_sp			lib: ncurses
-keyname				test: demo_altkeys demo_defkey demo_keyok demo_menus edit_field foldkeys keynames movewindow ncurses redraw testcurs view progs: tic
+keyname				test: demo_altkeys demo_defkey demo_keyok demo_menus edit_field foldkeys keynames movewindow ncurses redraw test_getstr testcurs view progs: tic
 keyname_sp			lib: ncurses
 keyok				test: demo_keyok foldkeys
 keyok_sp			lib: ncurses
@@ -430,7 +430,7 @@
 mvaddwstr			test: test_addwstr
 mvchgat				test: chgat
 mvcur				test: dots_mvcur redraw
-mvcur_sp			lib: ncurses
+mvcur_sp			-
 mvdelch				-
 mvderwin			test: movewindow
 mvget_wch			-
@@ -457,7 +457,7 @@
 mvinsstr			test: inserts
 mvinstr				test: test_instr
 mvinwstr			test: test_inwstr
-mvprintw			test: bs demo_menus firework hanoi ncurses tclock view
+mvprintw			test: background bs demo_menus firework hanoi ncurses tclock view
 mvscanw				-
 mvvline				test: ncurses
 mvvline_set			test: ncurses
@@ -542,13 +542,13 @@
 prefresh			test: testcurs
 printw				test: background blue bs color_set demo_altkeys demo_defkey demo_keyok demo_menus filter foldkeys ncurses savescreen testcurs testscanw view
 putp				progs: tput
-putp_sp				lib: ncurses
+putp_sp				-
 putwin				test: ncurses
 qiflush				-
 qiflush_sp			-
 raw				test: demo_forms ncurses redraw testcurs
 raw_sp				lib: ncurses
-redrawwin			test: redraw
+redrawwin			test: redraw view
 refresh				test: blue bs demo_defkey demo_forms demo_keyok demo_menus demo_panels echochar filter firstlast gdc hanoi hashtest lrtest movewindow ncurses savescreen tclock testcurs view xmas
 reset_prog_mode			test: filter ncurses
 reset_prog_mode_sp		lib: ncurses
@@ -586,7 +586,7 @@
 set_term			lib: ncurses
 setcchar			test: demo_panels ins_wide ncurses test_add_wchstr test_addwstr view
 setscrreg			test: view
-setupterm			test: demo_termcap demo_terminfo dots progs: clear tabs tput tset
+setupterm			test: demo_termcap demo_terminfo dots test_vid_puts test_vidputs progs: clear tabs tput tset
 slk_attr			-
 slk_attr_off			-
 slk_attr_on			-
@@ -644,20 +644,20 @@
 tgetstr				test: demo_termcap railroad
 tgetstr_sp			-
 tgoto				test: railroad
-tigetflag			test: demo_terminfo progs: tput
+tigetflag			test: demo_terminfo progs: tic tput
 tigetflag_sp			-
 tigetnum			test: demo_terminfo ncurses progs: tput
 tigetnum_sp			-
-tigetstr			test: blue demo_defkey demo_terminfo foldkeys testcurs progs: tput
+tigetstr			test: demo_defkey demo_terminfo foldkeys testcurs progs: tput
 tigetstr_sp			-
 timeout				test: rain savescreen
 tiparm				-
 touchline			test: chgat clip_printw insdelln
 touchwin			test: chgat clip_printw demo_menus edit_field filter firstlast inch_wide inchs ins_wide insdelln inserts movewindow ncurses redraw test_add_wchstr test_addchstr test_addstr test_addwstr test_get_wstr test_getstr test_instr test_inwstr test_opaque xmas
 tparm				test: dots dots_mvcur progs: tabs tic tput
-tputs				test: dots dots_mvcur railroad progs: clear tabs tset
+tputs				test: dots dots_mvcur railroad test_vid_puts test_vidputs progs: clear tabs tset
 tputs_sp			lib: ncurses
-trace				test: demo_menus hanoi hashtest lrtest ncurses testcurs view worm
+trace				test: demo_menus hashtest lrtest ncurses testcurs view worm
 ttytype				lib: ncurses
 typeahead			test: testcurs
 typeahead_sp			lib: ncurses
@@ -670,22 +670,24 @@
 ungetmouse			-
 ungetmouse_sp			-
 untouchwin			lib: form
-use_default_colors		test: filter firework gdc hanoi knight ncurses rain tclock worm xmas
+use_default_colors		test: background filter firework gdc hanoi knight ncurses rain tclock worm xmas
 use_default_colors_sp		-
-use_env				progs: tput
+use_env				test: ncurses progs: tput
 use_env_sp			-
-use_extended_names		test: demo_terminfo progs: infocmp tic
+use_extended_names		test: demo_termcap demo_terminfo progs: infocmp tic
 use_legacy_coding		-
 use_legacy_coding_sp		-
 use_screen			test: ditto
+use_tioctl			test: ncurses
+use_tioctl_sp			-
 use_window			test: rain worm
-vid_attr			-
+vid_attr			test: test_vid_puts
 vid_attr_sp			-
-vid_puts			-
+vid_puts			test: test_vid_puts
 vid_puts_sp			-
-vidattr				-
-vidattr_sp			lib: ncurses
-vidputs				-
+vidattr				test: test_vidputs
+vidattr_sp			-
+vidputs				test: test_vidputs
 vidputs_sp			lib: ncurses
 vline				test: gdc ncurses
 vline_set			-
Index: test/aclocal.m4
Prereq:  1.50 
--- ncurses-5.9/test/aclocal.m4	2011-03-24 08:28:07.000000000 +0000
+++ ncurses-5.9-20130504/test/aclocal.m4	2013-03-09 21:41:33.000000000 +0000
@@ -1,5 +1,5 @@
 dnl***************************************************************************
-dnl Copyright (c) 2003-2010,2011 Free Software Foundation, Inc.              *
+dnl Copyright (c) 2003-2012,2013 Free Software Foundation, Inc.              *
 dnl                                                                          *
 dnl Permission is hereby granted, free of charge, to any person obtaining a  *
 dnl copy of this software and associated documentation files (the            *
@@ -26,7 +26,7 @@
 dnl authorization.                                                           *
 dnl***************************************************************************
 dnl
-dnl $Id: aclocal.m4,v 1.50 2011/03/24 08:28:07 tom Exp $
+dnl $Id: aclocal.m4,v 1.86 2013/03/09 21:41:33 tom Exp $
 dnl
 dnl Author: Thomas E. Dickey
 dnl
@@ -40,6 +40,32 @@
 dnl
 dnl ---------------------------------------------------------------------------
 dnl ---------------------------------------------------------------------------
+dnl CF_ACVERSION_CHECK version: 4 updated: 2013/03/04 19:52:56
+dnl ------------------
+dnl Conditionally generate script according to whether we're using a given autoconf.
+dnl
+dnl $1 = version to compare against
+dnl $2 = code to use if AC_ACVERSION is at least as high as $1.
+dnl $3 = code to use if AC_ACVERSION is older than $1.
+define([CF_ACVERSION_CHECK],
+[
+ifdef([AC_ACVERSION], ,[m4_copy([m4_PACKAGE_VERSION],[AC_ACVERSION])])dnl
+ifdef([m4_version_compare],
+[m4_if(m4_version_compare(m4_defn([AC_ACVERSION]), [$1]), -1, [$3], [$2])],
+[CF_ACVERSION_COMPARE(
+AC_PREREQ_CANON(AC_PREREQ_SPLIT([$1])),
+AC_PREREQ_CANON(AC_PREREQ_SPLIT(AC_ACVERSION)), AC_ACVERSION, [$2], [$3])])])dnl
+dnl ---------------------------------------------------------------------------
+dnl CF_ACVERSION_COMPARE version: 3 updated: 2012/10/03 18:39:53
+dnl --------------------
+dnl CF_ACVERSION_COMPARE(MAJOR1, MINOR1, TERNARY1,
+dnl                      MAJOR2, MINOR2, TERNARY2,
+dnl                      PRINTABLE2, not FOUND, FOUND)
+define([CF_ACVERSION_COMPARE],
+[ifelse(builtin([eval], [$2 < $5]), 1,
+[ifelse([$8], , ,[$8])],
+[ifelse([$9], , ,[$9])])])dnl
+dnl ---------------------------------------------------------------------------
 dnl CF_ADD_CFLAGS version: 10 updated: 2010/05/26 05:38:42
 dnl -------------
 dnl Copy non-preprocessor flags to $CFLAGS, preprocessor flags to $CPPFLAGS
@@ -272,76 +298,6 @@
 }
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_ANSI_CC_CHECK version: 10 updated: 2010/10/23 15:52:32
-dnl ----------------
-dnl This is adapted from the macros 'fp_PROG_CC_STDC' and 'fp_C_PROTOTYPES'
-dnl in the sharutils 4.2 distribution.
-AC_DEFUN([CF_ANSI_CC_CHECK],
-[
-AC_CACHE_CHECK(for ${CC:-cc} option to accept ANSI C, cf_cv_ansi_cc,[
-cf_cv_ansi_cc=no
-cf_save_CFLAGS="$CFLAGS"
-cf_save_CPPFLAGS="$CPPFLAGS"
-# Don't try gcc -ansi; that turns off useful extensions and
-# breaks some systems' header files.
-# AIX			-qlanglvl=ansi
-# Ultrix and OSF/1	-std1
-# HP-UX			-Aa -D_HPUX_SOURCE
-# SVR4			-Xc
-# UnixWare 1.2		(cannot use -Xc, since ANSI/POSIX clashes)
-for cf_arg in "-DCC_HAS_PROTOS" \
-	"" \
-	-qlanglvl=ansi \
-	-std1 \
-	-Ae \
-	"-Aa -D_HPUX_SOURCE" \
-	-Xc
-do
-	CF_ADD_CFLAGS($cf_arg)
-	AC_TRY_COMPILE(
-[
-#ifndef CC_HAS_PROTOS
-#if !defined(__STDC__) || (__STDC__ != 1)
-choke me
-#endif
-#endif
-],[
-	int test (int i, double x);
-	struct s1 {int (*f) (int a);};
-	struct s2 {int (*f) (double a);};],
-	[cf_cv_ansi_cc="$cf_arg"; break])
-done
-CFLAGS="$cf_save_CFLAGS"
-CPPFLAGS="$cf_save_CPPFLAGS"
-])
-
-if test "$cf_cv_ansi_cc" != "no"; then
-if test ".$cf_cv_ansi_cc" != ".-DCC_HAS_PROTOS"; then
-	CF_ADD_CFLAGS($cf_cv_ansi_cc)
-else
-	AC_DEFINE(CC_HAS_PROTOS)
-fi
-fi
-])dnl
-dnl ---------------------------------------------------------------------------
-dnl CF_ANSI_CC_REQD version: 4 updated: 2008/03/23 14:48:54
-dnl ---------------
-dnl For programs that must use an ANSI compiler, obtain compiler options that
-dnl will make it recognize prototypes.  We'll do preprocessor checks in other
-dnl macros, since tools such as unproto can fake prototypes, but only part of
-dnl the preprocessor.
-AC_DEFUN([CF_ANSI_CC_REQD],
-[AC_REQUIRE([CF_ANSI_CC_CHECK])
-if test "$cf_cv_ansi_cc" = "no"; then
-	AC_MSG_ERROR(
-[Your compiler does not appear to recognize prototypes.
-You have the following choices:
-	a. adjust your compiler options
-	b. get an up-to-date compiler
-	c. use a wrapper such as unproto])
-fi
-])dnl
-dnl ---------------------------------------------------------------------------
 dnl CF_ARG_DISABLE version: 3 updated: 1999/03/30 17:24:31
 dnl --------------
 dnl Allow user to disable a normally-on option.
@@ -377,7 +333,33 @@
 ])dnl
   ])])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_CHECK_CACHE version: 11 updated: 2008/03/23 14:45:59
+dnl CF_CC_ENV_FLAGS version: 1 updated: 2012/10/03 05:25:49
+dnl ---------------
+dnl Check for user's environment-breakage by stuffing CFLAGS/CPPFLAGS content
+dnl into CC.  This will not help with broken scripts that wrap the compiler with
+dnl options, but eliminates a more common category of user confusion.
+AC_DEFUN([CF_CC_ENV_FLAGS],
+[
+# This should have been defined by AC_PROG_CC
+: ${CC:=cc}
+
+AC_MSG_CHECKING(\$CC variable)
+case "$CC" in #(vi
+*[[\ \	]]-[[IUD]]*)
+	AC_MSG_RESULT(broken)
+	AC_MSG_WARN(your environment misuses the CC variable to hold CFLAGS/CPPFLAGS options)
+	# humor him...
+	cf_flags=`echo "$CC" | sed -e 's/^[[^ 	]]*[[ 	]]//'`
+	CC=`echo "$CC" | sed -e 's/[[ 	]].*//'`
+	CF_ADD_CFLAGS($cf_flags)
+	;;
+*)
+	AC_MSG_RESULT(ok)
+	;;
+esac
+])dnl
+dnl ---------------------------------------------------------------------------
+dnl CF_CHECK_CACHE version: 12 updated: 2012/10/02 20:55:03
 dnl --------------
 dnl Check if we're accidentally using a cache from a different machine.
 dnl Derive the system name, as a check for reusing the autoconf cache.
@@ -400,7 +382,7 @@
 		system_name="`(hostname) 2>/dev/null`"
 	fi
 fi
-test -n "$system_name" && AC_DEFINE_UNQUOTED(SYSTEM_NAME,"$system_name")
+test -n "$system_name" && AC_DEFINE_UNQUOTED(SYSTEM_NAME,"$system_name",[Define to the system name.])
 AC_CACHE_VAL(cf_cv_system_name,[cf_cv_system_name="$system_name"])
 
 test -z "$system_name" && system_name="$cf_cv_system_name"
@@ -434,7 +416,40 @@
 fi
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_CURSES_ACS_MAP version: 6 updated: 2010/10/23 15:54:49
+dnl CF_CLANG_COMPILER version: 1 updated: 2012/06/16 14:55:39
+dnl -----------------
+dnl Check if the given compiler is really clang.  clang's C driver defines
+dnl __GNUC__ (fooling the configure script into setting $GCC to yes) but does
+dnl not ignore some gcc options.
+dnl
+dnl This macro should be run "soon" after AC_PROG_CC or AC_PROG_CPLUSPLUS, to
+dnl ensure that it is not mistaken for gcc/g++.  It is normally invoked from
+dnl the wrappers for gcc and g++ warnings.
+dnl
+dnl $1 = GCC (default) or GXX
+dnl $2 = INTEL_COMPILER (default) or INTEL_CPLUSPLUS
+dnl $3 = CFLAGS (default) or CXXFLAGS
+AC_DEFUN([CF_CLANG_COMPILER],[
+ifelse([$2],,CLANG_COMPILER,[$2])=no
+
+if test "$ifelse([$1],,[$1],GCC)" = yes ; then
+	AC_MSG_CHECKING(if this is really Clang ifelse([$1],GXX,C++,C) compiler)
+	cf_save_CFLAGS="$ifelse([$3],,CFLAGS,[$3])"
+	ifelse([$3],,CFLAGS,[$3])="$ifelse([$3],,CFLAGS,[$3]) -Qunused-arguments"
+	AC_TRY_COMPILE([],[
+#ifdef __clang__
+#else
+make an error
+#endif
+],[ifelse([$2],,CLANG_COMPILER,[$2])=yes
+cf_save_CFLAGS="$cf_save_CFLAGS -Qunused-arguments"
+],[])
+	ifelse([$3],,CFLAGS,[$3])="$cf_save_CFLAGS"
+	AC_MSG_RESULT($ifelse([$2],,CLANG_COMPILER,[$2]))
+fi
+])
+dnl ---------------------------------------------------------------------------
+dnl CF_CURSES_ACS_MAP version: 7 updated: 2012/10/06 16:39:58
 dnl -----------------
 dnl Check for likely values of acs_map[]:
 AC_DEFUN([CF_CURSES_ACS_MAP],
@@ -452,7 +467,7 @@
 done
 ])
 
-test "$cf_cv_curses_acs_map" != unknown && AC_DEFINE_UNQUOTED(CURSES_ACS_ARRAY,$cf_cv_curses_acs_map)
+test "$cf_cv_curses_acs_map" != unknown && AC_DEFINE_UNQUOTED(CURSES_ACS_ARRAY,$cf_cv_curses_acs_map,[Define as needed to override ncurses prefix _nc_])
 ])
 dnl ---------------------------------------------------------------------------
 dnl CF_CURSES_CHECK_DATA version: 4 updated: 2011/01/15 16:39:24
@@ -499,7 +514,7 @@
 fi
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_CURSES_CHECK_TYPE version: 3 updated: 2010/10/23 15:54:49
+dnl CF_CURSES_CHECK_TYPE version: 4 updated: 2012/10/06 16:39:58
 dnl --------------------
 dnl Check if curses.h defines the given type
 AC_DEFUN([CF_CURSES_CHECK_TYPE],
@@ -515,9 +530,9 @@
 AC_MSG_RESULT($cf_result)
 if test $cf_result = yes ; then
 	CF_UPPER(cf_result,have_type_$1)
-	AC_DEFINE_UNQUOTED($cf_result)
+	AC_DEFINE_UNQUOTED($cf_result,1,[Define to 1 if we have type $1])
 else
-	AC_DEFINE_UNQUOTED($1,$2)
+	AC_DEFINE_UNQUOTED($1,$2,[Define to appropriate type if $1 is not declared])
 fi
 ])dnl
 dnl ---------------------------------------------------------------------------
@@ -533,7 +548,7 @@
 CF_CURSES_LIBS
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_CURSES_CPPFLAGS version: 10 updated: 2009/01/06 19:34:11
+dnl CF_CURSES_CPPFLAGS version: 11 updated: 2011/04/09 14:51:08
 dnl ------------------
 dnl Look for the curses headers.
 AC_DEFUN([CF_CURSES_CPPFLAGS],[
@@ -542,13 +557,19 @@
 cf_cv_curses_incdir=no
 case $host_os in #(vi
 hpux10.*) #(vi
-	test -d /usr/include/curses_colr && \
-	cf_cv_curses_incdir="-I/usr/include/curses_colr"
+	if test "x$cf_cv_screen" = "xcurses_colr"
+	then
+		test -d /usr/include/curses_colr && \
+		cf_cv_curses_incdir="-I/usr/include/curses_colr"
+	fi
 	;;
 sunos3*|sunos4*)
-	test -d /usr/5lib && \
-	test -d /usr/5include && \
-	cf_cv_curses_incdir="-I/usr/5include"
+	if test "x$cf_cv_screen" = "xcurses_5lib"
+	then
+		test -d /usr/5lib && \
+		test -d /usr/5include && \
+		cf_cv_curses_incdir="-I/usr/5include"
+	fi
 	;;
 esac
 ])
@@ -558,7 +579,7 @@
 CF_TERM_HEADER
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_CURSES_FUNCS version: 15 updated: 2010/10/23 15:52:32
+dnl CF_CURSES_FUNCS version: 17 updated: 2011/05/14 16:07:29
 dnl ---------------
 dnl Curses-functions are a little complicated, since a lot of them are macros.
 AC_DEFUN([CF_CURSES_FUNCS],
@@ -566,6 +587,7 @@
 AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl
 AC_REQUIRE([CF_XOPEN_CURSES])
 AC_REQUIRE([CF_CURSES_TERM_H])
+AC_REQUIRE([CF_CURSES_UNCTRL_H])
 for cf_func in $1
 do
 	CF_UPPER(cf_tr_func,$cf_func)
@@ -578,7 +600,8 @@
 			[
 #ifndef ${cf_func}
 long foo = (long)(&${cf_func});
-${cf_cv_main_return:-return}(foo == 0);
+if (foo + 1234 > 5678)
+	${cf_cv_main_return:-return}(foo);
 #endif
 			],
 			[cf_result=yes],
@@ -595,7 +618,7 @@
 done
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_CURSES_HEADER version: 2 updated: 2010/04/28 06:02:16
+dnl CF_CURSES_HEADER version: 3 updated: 2011/05/01 19:47:45
 dnl ----------------
 dnl Find a "curses" header file, e.g,. "curses.h", or one of the more common
 dnl variations of ncurses' installs.
@@ -605,10 +628,10 @@
 AC_CACHE_CHECK(if we have identified curses headers,cf_cv_ncurses_header,[
 cf_cv_ncurses_header=none
 for cf_header in ifelse($1,,,[ \
-    $1/curses.h \
-	$1/ncurses.h]) \
-	curses.h \
-	ncurses.h ifelse($1,,[ncurses/curses.h ncurses/ncurses.h])
+    $1/ncurses.h \
+	$1/curses.h]) \
+	ncurses.h \
+	curses.h ifelse($1,,[ncurses/ncurses.h ncurses/curses.h])
 do
 AC_TRY_COMPILE([#include <${cf_header}>],
 	[initscr(); tgoto("?", 0,0)],
@@ -624,7 +647,7 @@
 AC_CHECK_HEADERS($cf_cv_ncurses_header)
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_CURSES_LIBS version: 33 updated: 2011/03/06 12:37:18
+dnl CF_CURSES_LIBS version: 37 updated: 2013/02/09 17:33:50
 dnl --------------
 dnl Look for the curses libraries.  Older curses implementations may require
 dnl termcap/termlib to be linked as well.  Call CF_CURSES_CPPFLAGS first.
@@ -644,17 +667,24 @@
     AC_CHECK_LIB(mytinfo,tgoto,[CF_ADD_LIBS(-lmytinfo)])
     ;;
 hpux10.*) #(vi
-    AC_CHECK_LIB(cur_colr,initscr,[
-        CF_ADD_LIBS(-lcur_colr)
-        ac_cv_func_initscr=yes
-        ],[
-    AC_CHECK_LIB(Hcurses,initscr,[
-        # HP's header uses __HP_CURSES, but user claims _HP_CURSES.
-        CF_ADD_LIBS(-lHcurses)
-        CPPFLAGS="$CPPFLAGS -D__HP_CURSES -D_HP_CURSES"
-        ac_cv_func_initscr=yes
-        ])])
-    ;;
+	# Looking at HPUX 10.20, the Hcurses library is the oldest (1997), cur_colr
+	# next (1998), and xcurses "newer" (2000).  There is no header file for
+	# Hcurses; the subdirectory curses_colr has the headers (curses.h and
+	# term.h) for cur_colr
+	if test "x$cf_cv_screen" = "xcurses_colr"
+	then
+		AC_CHECK_LIB(cur_colr,initscr,[
+			CF_ADD_LIBS(-lcur_colr)
+			ac_cv_func_initscr=yes
+			],[
+		AC_CHECK_LIB(Hcurses,initscr,[
+			# HP's header uses __HP_CURSES, but user claims _HP_CURSES.
+			CF_ADD_LIBS(-lHcurses)
+			CPPFLAGS="$CPPFLAGS -D__HP_CURSES -D_HP_CURSES"
+			ac_cv_func_initscr=yes
+			])])
+	fi
+	;;
 linux*)
 	case `arch 2>/dev/null` in
 	x86_64)
@@ -669,76 +699,83 @@
 		CF_ADD_LIBDIR(/lib)
 		;;
 	esac
-    ;;
+	;;
 sunos3*|sunos4*)
-    if test -d /usr/5lib ; then
-      CF_ADD_LIBDIR(/usr/5lib)
-      CF_ADD_LIBS(-lcurses -ltermcap)
+	if test "x$cf_cv_screen" = "xcurses_5lib"
+	then
+		if test -d /usr/5lib ; then
+			CF_ADD_LIBDIR(/usr/5lib)
+			CF_ADD_LIBS(-lcurses -ltermcap)
+		fi
     fi
     ac_cv_func_initscr=yes
     ;;
 esac
 
 if test ".$ac_cv_func_initscr" != .yes ; then
-    cf_save_LIBS="$LIBS"
-    cf_term_lib=""
-    cf_curs_lib=""
+	cf_save_LIBS="$LIBS"
 
-    if test ".${cf_cv_ncurses_version:-no}" != .no
-    then
-        cf_check_list="ncurses curses cursesX"
-    else
-        cf_check_list="cursesX curses ncurses"
-    fi
+	if test ".${cf_cv_ncurses_version:-no}" != .no
+	then
+		cf_check_list="ncurses curses cursesX"
+	else
+		cf_check_list="cursesX curses ncurses"
+	fi
 
-    # Check for library containing tgoto.  Do this before curses library
-    # because it may be needed to link the test-case for initscr.
-    AC_CHECK_FUNC(tgoto,[cf_term_lib=predefined],[
-        for cf_term_lib in $cf_check_list termcap termlib unknown
-        do
-            AC_CHECK_LIB($cf_term_lib,tgoto,[break])
-        done
-    ])
+	# Check for library containing tgoto.  Do this before curses library
+	# because it may be needed to link the test-case for initscr.
+	if test "x$cf_term_lib" = x
+	then
+		AC_CHECK_FUNC(tgoto,[cf_term_lib=predefined],[
+			for cf_term_lib in $cf_check_list otermcap termcap tinfo termlib unknown
+			do
+				AC_CHECK_LIB($cf_term_lib,tgoto,[break])
+			done
+		])
+	fi
 
-    # Check for library containing initscr
-    test "$cf_term_lib" != predefined && test "$cf_term_lib" != unknown && LIBS="-l$cf_term_lib $cf_save_LIBS"
- 	for cf_curs_lib in $cf_check_list xcurses jcurses pdcurses unknown
-    do
-        AC_CHECK_LIB($cf_curs_lib,initscr,[break])
-    done
-    test $cf_curs_lib = unknown && AC_MSG_ERROR(no curses library found)
+	# Check for library containing initscr
+	test "$cf_term_lib" != predefined && test "$cf_term_lib" != unknown && LIBS="-l$cf_term_lib $cf_save_LIBS"
+	if test "x$cf_curs_lib" = x
+	then
+		for cf_curs_lib in $cf_check_list xcurses jcurses pdcurses unknown
+		do
+			AC_CHECK_LIB($cf_curs_lib,initscr,[break])
+		done
+	fi
+	test $cf_curs_lib = unknown && AC_MSG_ERROR(no curses library found)
 
-    LIBS="-l$cf_curs_lib $cf_save_LIBS"
-    if test "$cf_term_lib" = unknown ; then
-        AC_MSG_CHECKING(if we can link with $cf_curs_lib library)
-        AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>],
-            [initscr()],
-            [cf_result=yes],
-            [cf_result=no])
-        AC_MSG_RESULT($cf_result)
-        test $cf_result = no && AC_MSG_ERROR(Cannot link curses library)
-    elif test "$cf_curs_lib" = "$cf_term_lib" ; then
-        :
-    elif test "$cf_term_lib" != predefined ; then
-        AC_MSG_CHECKING(if we need both $cf_curs_lib and $cf_term_lib libraries)
-        AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>],
-            [initscr(); tgoto((char *)0, 0, 0);],
-            [cf_result=no],
-            [
-            LIBS="-l$cf_curs_lib -l$cf_term_lib $cf_save_LIBS"
-            AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>],
-                [initscr()],
-                [cf_result=yes],
-                [cf_result=error])
-            ])
-        AC_MSG_RESULT($cf_result)
-    fi
+	LIBS="-l$cf_curs_lib $cf_save_LIBS"
+	if test "$cf_term_lib" = unknown ; then
+		AC_MSG_CHECKING(if we can link with $cf_curs_lib library)
+		AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>],
+			[initscr()],
+			[cf_result=yes],
+			[cf_result=no])
+		AC_MSG_RESULT($cf_result)
+		test $cf_result = no && AC_MSG_ERROR(Cannot link curses library)
+	elif test "$cf_curs_lib" = "$cf_term_lib" ; then
+		:
+	elif test "$cf_term_lib" != predefined ; then
+		AC_MSG_CHECKING(if we need both $cf_curs_lib and $cf_term_lib libraries)
+		AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>],
+			[initscr(); tgoto((char *)0, 0, 0);],
+			[cf_result=no],
+			[
+			LIBS="-l$cf_curs_lib -l$cf_term_lib $cf_save_LIBS"
+			AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>],
+				[initscr()],
+				[cf_result=yes],
+				[cf_result=error])
+			])
+		AC_MSG_RESULT($cf_result)
+	fi
 fi
 fi
 
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_CURSES_TERM_H version: 8 updated: 2010/10/23 15:54:49
+dnl CF_CURSES_TERM_H version: 10 updated: 2012/10/06 08:57:51
 dnl ----------------
 dnl SVr4 curses should have term.h as well (where it puts the definitions of
 dnl the low-level interface).  This may not be true in old/broken implementations,
@@ -752,9 +789,17 @@
 
 # If we found <ncurses/curses.h>, look for <ncurses/term.h>, but always look
 # for <term.h> if we do not find the variant.
-for cf_header in \
-	`echo ${cf_cv_ncurses_header:-curses.h} | sed -e 's%/.*%/%'`term.h \
-	term.h
+
+cf_header_list="term.h ncurses/term.h ncursesw/term.h"
+
+case ${cf_cv_ncurses_header:-curses.h} in #(vi
+*/*)
+	cf_header_item=`echo ${cf_cv_ncurses_header:-curses.h} | sed -e 's%\..*%%' -e 's%/.*%/%'`term.h
+	cf_header_list="$cf_header_item $cf_header_list"
+	;;
+esac
+
+for cf_header in $cf_header_list
 do
 	AC_TRY_COMPILE([
 #include <${cf_cv_ncurses_header:-curses.h}>
@@ -789,18 +834,73 @@
 
 case $cf_cv_term_header in #(vi
 term.h) #(vi
-	AC_DEFINE(HAVE_TERM_H)
+	AC_DEFINE(HAVE_TERM_H,1,[Define to 1 if we have term.h])
 	;;
 ncurses/term.h) #(vi
-	AC_DEFINE(HAVE_NCURSES_TERM_H)
+	AC_DEFINE(HAVE_NCURSES_TERM_H,1,[Define to 1 if we have ncurses/term.h])
 	;;
 ncursesw/term.h)
-	AC_DEFINE(HAVE_NCURSESW_TERM_H)
+	AC_DEFINE(HAVE_NCURSESW_TERM_H,1,[Define to 1 if we have ncursesw/term.h])
+	;;
+esac
+])dnl
+dnl ---------------------------------------------------------------------------
+dnl CF_CURSES_UNCTRL_H version: 2 updated: 2012/10/06 08:57:51
+dnl ------------------
+dnl Any X/Open curses implementation must have unctrl.h, but ncurses packages
+dnl may put it in a subdirectory (along with ncurses' other headers, of
+dnl course).  Packages which put the headers in inconsistent locations are
+dnl broken).
+AC_DEFUN([CF_CURSES_UNCTRL_H],
+[
+AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl
+
+AC_CACHE_CHECK(for unctrl.h, cf_cv_unctrl_header,[
+
+# If we found <ncurses/curses.h>, look for <ncurses/unctrl.h>, but always look
+# for <unctrl.h> if we do not find the variant.
+
+cf_header_list="unctrl.h ncurses/unctrl.h ncursesw/unctrl.h"
+
+case ${cf_cv_ncurses_header:-curses.h} in #(vi
+*/*)
+	cf_header_item=`echo ${cf_cv_ncurses_header:-curses.h} | sed -e 's%\..*%%' -e 's%/.*%/%'`unctrl.h
+	cf_header_list="$cf_header_item $cf_header_list"
+	;;
+esac
+
+for cf_header in $cf_header_list
+do
+	AC_TRY_COMPILE([
+#include <${cf_cv_ncurses_header:-curses.h}>
+#include <${cf_header}>],
+	[WINDOW *x],
+	[cf_cv_unctrl_header=$cf_header
+	 break],
+	[cf_cv_unctrl_header=no])
+done
+
+case $cf_cv_unctrl_header in #(vi
+no)
+	AC_MSG_WARN(unctrl.h header not found)
+	;;
+esac
+])
+
+case $cf_cv_unctrl_header in #(vi
+unctrl.h) #(vi
+	AC_DEFINE(HAVE_UNCTRL_H,1,[Define to 1 if we have unctrl.h])
+	;;
+ncurses/unctrl.h) #(vi
+	AC_DEFINE(HAVE_NCURSES_UNCTRL_H,1,[Define to 1 if we have ncurses/unctrl.h])
+	;;
+ncursesw/unctrl.h)
+	AC_DEFINE(HAVE_NCURSESW_UNCTRL_H,1,[Define to 1 if we have ncursesw/unctrl.h])
 	;;
 esac
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_CURSES_WACS_MAP version: 5 updated: 2011/01/15 11:28:59
+dnl CF_CURSES_WACS_MAP version: 6 updated: 2012/10/06 08:57:51
 dnl ------------------
 dnl Check for likely values of wacs_map[].
 AC_DEFUN([CF_CURSES_WACS_MAP],
@@ -819,10 +919,10 @@
 	 break])
 	done])
 
-test "$cf_cv_curses_wacs_map" != unknown && AC_DEFINE_UNQUOTED(CURSES_WACS_ARRAY,$cf_cv_curses_wacs_map)
+test "$cf_cv_curses_wacs_map" != unknown && AC_DEFINE_UNQUOTED(CURSES_WACS_ARRAY,$cf_cv_curses_wacs_map,[Define to name of (n)curses wide-character array])
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_CURSES_WACS_SYMBOLS version: 1 updated: 2011/01/15 11:28:59
+dnl CF_CURSES_WACS_SYMBOLS version: 2 updated: 2012/10/06 08:57:51
 dnl ----------------------
 dnl Do a check to see if the WACS_xxx constants are defined compatibly with
 dnl X/Open Curses.  In particular, NetBSD's implementation of the WACS_xxx
@@ -854,7 +954,7 @@
 fi
 ])
 
-test "$cf_cv_curses_wacs_symbols" != no && AC_DEFINE(CURSES_WACS_SYMBOLS)
+test "$cf_cv_curses_wacs_symbols" != no && AC_DEFINE(CURSES_WACS_SYMBOLS,1,[Define to 1 if (n)curses supports wide-character WACS_ symbols])
 ])dnl
 dnl ---------------------------------------------------------------------------
 dnl CF_DIRNAME version: 4 updated: 2002/12/21 19:25:52
@@ -862,7 +962,7 @@
 dnl "dirname" is not portable, so we fake it with a shell script.
 AC_DEFUN([CF_DIRNAME],[$1=`echo $2 | sed -e 's%/[[^/]]*$%%'`])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_DISABLE_ECHO version: 11 updated: 2009/12/13 13:16:57
+dnl CF_DISABLE_ECHO version: 12 updated: 2012/10/06 16:30:28
 dnl ---------------
 dnl You can always use "make -n" to see the actual options, but it's hard to
 dnl pick out/analyze warning messages when the compile-line is long.
@@ -877,7 +977,7 @@
 AC_DEFUN([CF_DISABLE_ECHO],[
 AC_MSG_CHECKING(if you want to see long compiling messages)
 CF_ARG_DISABLE(echo,
-	[  --disable-echo          display "compiling" commands],
+	[  --disable-echo          do not display "compiling" commands],
 	[
     ECHO_LT='--silent'
     ECHO_LD='@echo linking [$]@;'
@@ -899,7 +999,7 @@
 AC_SUBST(ECHO_CC)
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_DISABLE_LEAKS version: 6 updated: 2010/07/23 04:14:32
+dnl CF_DISABLE_LEAKS version: 7 updated: 2012/10/02 20:55:03
 dnl ----------------
 dnl Combine no-leak checks with the libraries or tools that are used for the
 dnl checks.
@@ -917,11 +1017,30 @@
 AC_MSG_RESULT($with_no_leaks)
 
 if test "$with_no_leaks" = yes ; then
-	AC_DEFINE(NO_LEAKS)
-	AC_DEFINE(YY_NO_LEAKS)
+	AC_DEFINE(NO_LEAKS,1,[Define to 1 if you want to perform memory-leak testing.])
+	AC_DEFINE(YY_NO_LEAKS,1,[Define to 1 if you want to perform memory-leak testing.])
 fi
 ])dnl
 dnl ---------------------------------------------------------------------------
+dnl CF_DISABLE_RPATH_HACK version: 2 updated: 2011/02/13 13:31:33
+dnl ---------------------
+dnl The rpath-hack makes it simpler to build programs, particularly with the
+dnl *BSD ports which may have essential libraries in unusual places.  But it
+dnl can interfere with building an executable for the base system.  Use this
+dnl option in that case.
+AC_DEFUN([CF_DISABLE_RPATH_HACK],
+[
+AC_MSG_CHECKING(if rpath-hack should be disabled)
+CF_ARG_DISABLE(rpath-hack,
+	[  --disable-rpath-hack    don't add rpath options for additional libraries],
+	[cf_disable_rpath_hack=yes],
+	[cf_disable_rpath_hack=no])
+AC_MSG_RESULT($cf_disable_rpath_hack)
+if test "$cf_disable_rpath_hack" = no ; then
+	CF_RPATH_HACK
+fi
+])
+dnl ---------------------------------------------------------------------------
 dnl CF_ENABLE_WARNINGS version: 4 updated: 2009/07/26 17:53:03
 dnl ------------------
 dnl Configure-option to enable gcc warnings
@@ -1122,7 +1241,7 @@
 fi
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_FUNC_CURSES_VERSION version: 5 updated: 2010/10/23 15:54:49
+dnl CF_FUNC_CURSES_VERSION version: 6 updated: 2012/10/06 16:39:58
 dnl ----------------------
 dnl Solaris has a data item 'curses_version', which confuses AC_CHECK_FUNCS.
 dnl It's a character string "SVR4", not documented.
@@ -1141,10 +1260,10 @@
 ,[cf_cv_func_curses_version=no]
 ,[cf_cv_func_curses_version=unknown])
 rm -f core])
-test "$cf_cv_func_curses_version" = yes && AC_DEFINE(HAVE_CURSES_VERSION)
+test "$cf_cv_func_curses_version" = yes && AC_DEFINE(HAVE_CURSES_VERSION,1,[Define to 1 if we have curses_version function])
 ])
 dnl ---------------------------------------------------------------------------
-dnl CF_GCC_ATTRIBUTES version: 14 updated: 2010/10/23 15:52:32
+dnl CF_GCC_ATTRIBUTES version: 16 updated: 2012/10/02 20:55:03
 dnl -----------------
 dnl Test for availability of useful gcc __attribute__ directives to quiet
 dnl compiler warnings.  Though useful, not all are supported -- and contrary
@@ -1222,27 +1341,27 @@
 			test -n "$verbose" && AC_MSG_RESULT(... $cf_attribute)
 			cat conftest.h >>confdefs.h
 			case $cf_attribute in #(vi
+			noreturn) #(vi
+				AC_DEFINE_UNQUOTED(GCC_NORETURN,$cf_directive,[Define to noreturn-attribute for gcc])
+				;;
 			printf) #(vi
-				if test "$cf_printf_attribute" = no ; then
-					cat >>confdefs.h <<EOF
-#define GCC_PRINTFLIKE(fmt,var) /* nothing */
-EOF
-				else
-					cat >>confdefs.h <<EOF
-#define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var)))
-EOF
+				cf_value='/* nothing */'
+				if test "$cf_printf_attribute" != no ; then
+					cf_value='__attribute__((format(printf,fmt,var)))'
+					AC_DEFINE(GCC_PRINTF,1,[Define to 1 if the compiler supports gcc-like printf attribute.])
 				fi
+				AC_DEFINE_UNQUOTED(GCC_PRINTFLIKE(fmt,var),$cf_value,[Define to printf-attribute for gcc])
 				;;
 			scanf) #(vi
-				if test "$cf_scanf_attribute" = no ; then
-					cat >>confdefs.h <<EOF
-#define GCC_SCANFLIKE(fmt,var) /* nothing */
-EOF
-				else
-					cat >>confdefs.h <<EOF
-#define GCC_SCANFLIKE(fmt,var)  __attribute__((format(scanf,fmt,var)))
-EOF
+				cf_value='/* nothing */'
+				if test "$cf_scanf_attribute" != no ; then
+					cf_value='__attribute__((format(scanf,fmt,var)))'
+					AC_DEFINE(GCC_SCANF,1,[Define to 1 if the compiler supports gcc-like scanf attribute.])
 				fi
+				AC_DEFINE_UNQUOTED(GCC_SCANFLIKE(fmt,var),$cf_value,[Define to sscanf-attribute for gcc])
+				;;
+			unused) #(vi
+				AC_DEFINE_UNQUOTED(GCC_UNUSED,$cf_directive,[Define to unused-attribute for gcc])
 				;;
 			esac
 		fi
@@ -1254,7 +1373,7 @@
 fi
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_GCC_VERSION version: 5 updated: 2010/04/24 11:02:31
+dnl CF_GCC_VERSION version: 7 updated: 2012/10/18 06:46:33
 dnl --------------
 dnl Find version of gcc
 AC_DEFUN([CF_GCC_VERSION],[
@@ -1262,13 +1381,13 @@
 GCC_VERSION=none
 if test "$GCC" = yes ; then
 	AC_MSG_CHECKING(version of $CC)
-	GCC_VERSION="`${CC} --version 2>/dev/null | sed -e '2,$d' -e 's/^.*(GCC) //' -e 's/^[[^0-9.]]*//' -e 's/[[^0-9.]].*//'`"
+	GCC_VERSION="`${CC} --version 2>/dev/null | sed -e '2,$d' -e 's/^.*(GCC[[^)]]*) //' -e 's/^.*(Debian[[^)]]*) //' -e 's/^[[^0-9.]]*//' -e 's/[[^0-9.]].*//'`"
 	test -z "$GCC_VERSION" && GCC_VERSION=unknown
 	AC_MSG_RESULT($GCC_VERSION)
 fi
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_GCC_WARNINGS version: 27 updated: 2010/10/23 15:52:32
+dnl CF_GCC_WARNINGS version: 29 updated: 2012/06/16 14:55:39
 dnl ---------------
 dnl Check if the compiler supports useful warning options.  There's a few that
 dnl we don't use, simply because they're too noisy:
@@ -1291,6 +1410,7 @@
 [
 AC_REQUIRE([CF_GCC_VERSION])
 CF_INTEL_COMPILER(GCC,INTEL_COMPILER,CFLAGS)
+CF_CLANG_COMPILER(GCC,CLANG_COMPILER,CFLAGS)
 
 cat > conftest.$ac_ext <<EOF
 #line __oline__ "${as_me:-configure}"
@@ -1366,6 +1486,13 @@
 					continue;;
 				esac
 				;;
+			Wpointer-arith) #(vi
+				case $GCC_VERSION in
+				[[12]].*)
+					CF_VERBOSE(feature is broken in gcc $GCC_VERSION)
+					continue;;
+				esac
+				;;
 			esac
 			EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt"
 		fi
@@ -1377,6 +1504,29 @@
 AC_SUBST(EXTRA_CFLAGS)
 ])dnl
 dnl ---------------------------------------------------------------------------
+dnl CF_GETOPT_HEADER version: 5 updated: 2012/10/06 16:39:58
+dnl ----------------
+dnl Check for getopt's variables which are commonly defined in stdlib.h,
+dnl unistd.h or (nonstandard) in getopt.h
+AC_DEFUN([CF_GETOPT_HEADER],
+[
+AC_HAVE_HEADERS(unistd.h getopt.h)
+AC_CACHE_CHECK(for header declaring getopt variables,cf_cv_getopt_header,[
+cf_cv_getopt_header=none
+for cf_header in stdio.h stdlib.h unistd.h getopt.h
+do
+AC_TRY_COMPILE([
+#include <$cf_header>],
+[int x = optind; char *y = optarg],
+[cf_cv_getopt_header=$cf_header
+ break])
+done
+])
+if test $cf_cv_getopt_header != none ; then
+	AC_DEFINE(HAVE_GETOPT_HEADER,1,[Define to 1 if we need to include getopt.h])
+fi
+])dnl
+dnl ---------------------------------------------------------------------------
 dnl CF_GNU_SOURCE version: 6 updated: 2005/07/09 13:23:07
 dnl -------------
 dnl Check if we must define _GNU_SOURCE to get a reasonable value for
@@ -1453,6 +1603,13 @@
 $1="[$]$1 $cf_header_path_list"
 ])dnl
 dnl ---------------------------------------------------------------------------
+dnl CF_HELP_MESSAGE version: 3 updated: 1998/01/14 10:56:23
+dnl ---------------
+dnl Insert text into the help-message, for readability, from AC_ARG_WITH.
+AC_DEFUN([CF_HELP_MESSAGE],
+[AC_DIVERT_HELP([$1])dnl
+])dnl
+dnl ---------------------------------------------------------------------------
 dnl CF_INHERIT_SCRIPT version: 2 updated: 2003/03/01 23:50:42
 dnl -----------------
 dnl If we do not have a given script, look for it in the parent directory.
@@ -1461,7 +1618,7 @@
 test -f $1 || ( test -f ../$1 && cp ../$1 ./ )
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_INTEL_COMPILER version: 4 updated: 2010/05/26 05:38:42
+dnl CF_INTEL_COMPILER version: 5 updated: 2013/02/10 10:41:05
 dnl -----------------
 dnl Check if the given compiler is really the Intel compiler for Linux.  It
 dnl tries to imitate gcc, but does not return an error when it finds a mismatch
@@ -1475,6 +1632,7 @@
 dnl $2 = INTEL_COMPILER (default) or INTEL_CPLUSPLUS
 dnl $3 = CFLAGS (default) or CXXFLAGS
 AC_DEFUN([CF_INTEL_COMPILER],[
+AC_REQUIRE([AC_CANONICAL_HOST])
 ifelse([$2],,INTEL_COMPILER,[$2])=no
 
 if test "$ifelse([$1],,[$1],GCC)" = yes ; then
@@ -1498,6 +1656,60 @@
 fi
 ])dnl
 dnl ---------------------------------------------------------------------------
+dnl CF_LD_RPATH_OPT version: 5 updated: 2011/07/17 14:48:41
+dnl ---------------
+dnl For the given system and compiler, find the compiler flags to pass to the
+dnl loader to use the "rpath" feature.
+AC_DEFUN([CF_LD_RPATH_OPT],
+[
+AC_REQUIRE([CF_CHECK_CACHE])
+
+LD_RPATH_OPT=
+AC_MSG_CHECKING(for an rpath option)
+case $cf_cv_system_name in #(vi
+irix*) #(vi
+	if test "$GCC" = yes; then
+		LD_RPATH_OPT="-Wl,-rpath,"
+	else
+		LD_RPATH_OPT="-rpath "
+	fi
+	;;
+linux*|gnu*|k*bsd*-gnu) #(vi
+	LD_RPATH_OPT="-Wl,-rpath,"
+	;;
+openbsd[[2-9]].*|mirbsd*) #(vi
+	LD_RPATH_OPT="-Wl,-rpath,"
+	;;
+dragonfly*|freebsd*) #(vi
+	LD_RPATH_OPT="-rpath "
+	;;
+netbsd*) #(vi
+	LD_RPATH_OPT="-Wl,-rpath,"
+	;;
+osf*|mls+*) #(vi
+	LD_RPATH_OPT="-rpath "
+	;;
+solaris2*) #(vi
+	LD_RPATH_OPT="-R"
+	;;
+*)
+	;;
+esac
+AC_MSG_RESULT($LD_RPATH_OPT)
+
+case "x$LD_RPATH_OPT" in #(vi
+x-R*)
+	AC_MSG_CHECKING(if we need a space after rpath option)
+	cf_save_LIBS="$LIBS"
+	CF_ADD_LIBS(${LD_RPATH_OPT}$libdir)
+	AC_TRY_LINK(, , cf_rpath_space=no, cf_rpath_space=yes)
+	LIBS="$cf_save_LIBS"
+	AC_MSG_RESULT($cf_rpath_space)
+	test "$cf_rpath_space" = yes && LD_RPATH_OPT="$LD_RPATH_OPT "
+	;;
+esac
+])dnl
+dnl ---------------------------------------------------------------------------
 dnl CF_LIBRARY_PATH version: 9 updated: 2010/03/28 12:52:50
 dnl ---------------
 dnl Construct a search-list of directories for a nonstandard library-file
@@ -1588,38 +1800,7 @@
 fi
 ])
 dnl ---------------------------------------------------------------------------
-dnl CF_MIN_GETCCHAR version: 3 updated: 2010/10/23 15:54:49
-dnl ---------------
-dnl CF_MIN_GETCCHAR
-dnl Check whether getcchar's return value counts the trailing null in a wchar_t
-dnl string, or not.  X/Open says it does, but Tru64 and Solaris do not do this.
-AC_DEFUN([CF_MIN_GETCCHAR],[
-AC_CACHE_CHECK(if getcchar counts trailing null,cf_cv_min_getcchar,[
-AC_TRY_RUN([
-#include <stdlib.h>
-#include <stdarg.h>
-#include <${cf_cv_ncurses_header:-curses.h}>
-
-int main()
-{
-	wchar_t data[2];
-	cchar_t temp[2];
-	int count;
-	data[0] = L'\0';
-    setcchar(temp, data, 0, 0, (void *)0);
-	count = getcchar(temp, (wchar_t *)0, (attr_t *)0, (short *)0, (void *)0);
-	${cf_cv_main_return:-return}(count != 0);
-}],
-	[cf_cv_min_getcchar=no],
-	[cf_cv_min_getcchar=yes],
-	[cf_cv_min_getcchar=yes])
-])
-if test "$cf_cv_min_getcchar" = yes ; then
-	AC_DEFINE(MIN_GETCCHAR,1)
-fi
-])dnl
-dnl ---------------------------------------------------------------------------
-dnl CF_MIXEDCASE_FILENAMES version: 3 updated: 2003/09/20 17:07:55
+dnl CF_MIXEDCASE_FILENAMES version: 4 updated: 2012/10/02 20:55:03
 dnl ----------------------
 dnl Check if the file-system supports mixed-case filenames.  If we're able to
 dnl create a lowercase name and see it as uppercase, it doesn't support that.
@@ -1646,7 +1827,7 @@
 	rm -f conftest CONFTEST
 fi
 ])
-test "$cf_cv_mixedcase" = yes && AC_DEFINE(MIXEDCASE_FILENAMES)
+test "$cf_cv_mixedcase" = yes && AC_DEFINE(MIXEDCASE_FILENAMES,1,[Define to 1 if filesystem supports mixed-case filenames.])
 ])dnl
 dnl ---------------------------------------------------------------------------
 dnl CF_MSG_LOG version: 5 updated: 2010/10/23 15:52:32
@@ -1690,7 +1871,7 @@
 	,[$1=no])
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_NCURSES_CONFIG version: 8 updated: 2010/07/08 05:17:30
+dnl CF_NCURSES_CONFIG version: 10 updated: 2012/10/06 08:57:51
 dnl -----------------
 dnl Tie together the configure-script macros for ncurses.
 dnl Prefer the "-config" script from ncurses 6.x, to simplify analysis.
@@ -1702,7 +1883,10 @@
 cf_ncuconfig_root=ifelse($1,,ncurses,$1)
 
 echo "Looking for ${cf_ncuconfig_root}-config"
-AC_PATH_PROGS(NCURSES_CONFIG,${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}5-config,none)
+
+CF_ACVERSION_CHECK(2.52,
+	[AC_CHECK_TOOLS(NCURSES_CONFIG, ${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}5-config, none)],
+	[AC_PATH_PROGS(NCURSES_CONFIG, ${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}5-config, none)])
 
 if test "$NCURSES_CONFIG" != none ; then
 
@@ -1713,7 +1897,7 @@
 CF_CURSES_HEADER(ifelse($1,,ncurses,$1))
 
 dnl like CF_NCURSES_CPPFLAGS
-AC_DEFINE(NCURSES)
+AC_DEFINE(NCURSES,1,[Define to 1 if we are using ncurses headers/libraries])
 
 dnl like CF_NCURSES_LIBS
 CF_UPPER(cf_nculib_ROOT,HAVE_LIB$cf_ncuconfig_root)
@@ -1730,7 +1914,7 @@
 fi
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_NCURSES_CPPFLAGS version: 20 updated: 2010/11/20 17:02:38
+dnl CF_NCURSES_CPPFLAGS version: 21 updated: 2012/10/06 08:57:51
 dnl -------------------
 dnl Look for the SVr4 curses clone 'ncurses' in the standard places, adjusting
 dnl the CPPFLAGS variable so we can include its header.
@@ -1776,12 +1960,12 @@
 CF_TERM_HEADER
 
 # some applications need this, but should check for NCURSES_VERSION
-AC_DEFINE(NCURSES)
+AC_DEFINE(NCURSES,1,[Define to 1 if we are using ncurses headers/libraries])
 
 CF_NCURSES_VERSION
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_NCURSES_EXT_FUNCS version: 3 updated: 2010/11/13 19:43:23
+dnl CF_NCURSES_EXT_FUNCS version: 4 updated: 2012/10/06 16:39:58
 dnl --------------------
 dnl Since 2007/11/17, ncurses has defined NCURSES_EXT_FUNCS; earlier versions
 dnl may provide these functions.  Define the symbol if it is not defined, and
@@ -1813,10 +1997,10 @@
 	[cf_cv_ncurses_ext_funcs=no])
 ])
 ])
-test "$cf_cv_ncurses_ext_funcs" = yes && AC_DEFINE(NCURSES_EXT_FUNCS)
+test "$cf_cv_ncurses_ext_funcs" = yes && AC_DEFINE(NCURSES_EXT_FUNCS,1,[Define to 1 if we have ncurses extensions])
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_NCURSES_HEADER version: 2 updated: 2008/03/23 14:48:54
+dnl CF_NCURSES_HEADER version: 3 updated: 2012/10/06 08:57:51
 dnl -----------------
 dnl Find a "curses" header file, e.g,. "curses.h", or one of the more common
 dnl variations of ncurses' installs.
@@ -1867,16 +2051,16 @@
 
 case $cf_cv_ncurses_header in # (vi
 *ncurses.h)
-	AC_DEFINE(HAVE_NCURSES_H)
+	AC_DEFINE(HAVE_NCURSES_H,1,[Define to 1 if we have ncurses.h])
 	;;
 esac
 
 case $cf_cv_ncurses_header in # (vi
 ncurses/curses.h|ncurses/ncurses.h)
-	AC_DEFINE(HAVE_NCURSES_NCURSES_H)
+	AC_DEFINE(HAVE_NCURSES_NCURSES_H,1,[Define to 1 if we have ncurses/ncurses.h])
 	;;
 ncursesw/curses.h|ncursesw/ncurses.h)
-	AC_DEFINE(HAVE_NCURSESW_NCURSES_H)
+	AC_DEFINE(HAVE_NCURSESW_NCURSES_H,1,[Define to 1 if we have ncursesw/ncurses.h])
 	;;
 esac
 
@@ -1950,7 +2134,7 @@
 AC_DEFINE_UNQUOTED($cf_nculib_ROOT)
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_NCURSES_VERSION version: 13 updated: 2010/10/23 15:54:49
+dnl CF_NCURSES_VERSION version: 14 updated: 2012/10/06 08:57:51
 dnl ------------------
 dnl Check for the version of ncurses, to aid in reporting bugs, etc.
 dnl Call CF_CURSES_CPPFLAGS first, or CF_NCURSES_CPPFLAGS.  We don't use
@@ -2009,7 +2193,7 @@
 ])
 	rm -f $cf_tempfile
 ])
-test "$cf_cv_ncurses_version" = no || AC_DEFINE(NCURSES)
+test "$cf_cv_ncurses_version" = no || AC_DEFINE(NCURSES,1,[Define to 1 if we are using ncurses headers/libraries])
 ])dnl
 dnl ---------------------------------------------------------------------------
 dnl CF_NCURSES_WRAP_PREFIX version: 1 updated: 2009/03/28 16:08:10
@@ -2028,7 +2212,7 @@
 AC_SUBST(NCURSES_WRAP_PREFIX)
 ])
 dnl ---------------------------------------------------------------------------
-dnl CF_NETBSD_FORM_H version: 1 updated: 2011/01/15 14:59:18
+dnl CF_NETBSD_FORM_H version: 2 updated: 2012/10/06 16:39:58
 dnl ----------------
 dnl Check for NetBSD's form.h, which is incompatible with SVr4 and ncurses.
 dnl Some workarounds are needed in client programs to allow them to compile.
@@ -2045,10 +2229,10 @@
 ],[cf_cv_netbsd_form_h=no])
 ])
 
-test "$cf_cv_netbsd_form_h" = yes && AC_DEFINE(HAVE_NETBSD_FORM_H)
+test "$cf_cv_netbsd_form_h" = yes && AC_DEFINE(HAVE_NETBSD_FORM_H,1,[Define to 1 if we appear to be using NetBSD form.h])
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_NETBSD_MENU_H version: 1 updated: 2011/01/15 14:59:18
+dnl CF_NETBSD_MENU_H version: 2 updated: 2012/10/06 16:39:58
 dnl ----------------
 dnl Check for NetBSD's menu.h, which is incompatible with SVr4 and ncurses.
 dnl Some workarounds are needed in client programs to allow them to compile.
@@ -2064,17 +2248,17 @@
 ],[cf_cv_netbsd_menu_h=no])
 ])
 
-test "$cf_cv_netbsd_menu_h" = yes && AC_DEFINE(HAVE_NETBSD_MENU_H)
+test "$cf_cv_netbsd_menu_h" = yes && AC_DEFINE(HAVE_NETBSD_MENU_H,1,[Define to 1 if we appear to be using NetBSD menu.h])
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_NO_LEAKS_OPTION version: 4 updated: 2006/12/16 14:24:05
+dnl CF_NO_LEAKS_OPTION version: 5 updated: 2012/10/02 20:55:03
 dnl ------------------
 dnl see CF_WITH_NO_LEAKS
 AC_DEFUN([CF_NO_LEAKS_OPTION],[
 AC_MSG_CHECKING(if you want to use $1 for testing)
 AC_ARG_WITH($1,
 	[$2],
-	[AC_DEFINE($3)ifelse([$4],,[
+	[AC_DEFINE_UNQUOTED($3,1,"Define to 1 if you want to use $1 for testing.")ifelse([$4],,[
 	 $4
 ])
 	: ${with_cflags:=-g}
@@ -2096,7 +2280,7 @@
 esac
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_PATH_SYNTAX version: 13 updated: 2010/05/26 05:38:42
+dnl CF_PATH_SYNTAX version: 14 updated: 2012/06/19 20:58:54
 dnl --------------
 dnl Check the argument to see that it looks like a pathname.  Rewrite it if it
 dnl begins with one of the prefix/exec_prefix variables, and then again if the
@@ -2116,7 +2300,7 @@
   ;;
 .[[a-zA-Z]]:[[\\/]]*) #(vi OS/2 EMX
   ;;
-.\[$]{*prefix}*) #(vi
+.\[$]{*prefix}*|.\[$]{*dir}*) #(vi
   eval $1="[$]$1"
   case ".[$]$1" in #(vi
   .NONE/*)
@@ -2133,13 +2317,15 @@
 esac
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_PDCURSES_X11 version: 11 updated: 2011/01/15 18:45:38
+dnl CF_PDCURSES_X11 version: 13 updated: 2012/10/06 16:39:58
 dnl ---------------
 dnl Configure for PDCurses' X11 library
 AC_DEFUN([CF_PDCURSES_X11],[
 AC_REQUIRE([CF_X_ATHENA])
 
-AC_PATH_PROGS(XCURSES_CONFIG,xcurses-config,none)
+CF_ACVERSION_CHECK(2.52,
+	[AC_CHECK_TOOLS(XCURSES_CONFIG, xcurses-config, none)],
+	[AC_PATH_PROGS(XCURSES_CONFIG, xcurses-config, none)])
 
 if test "$XCURSES_CONFIG" != none ; then
 
@@ -2168,15 +2354,15 @@
 fi
 
 if test $cf_cv_lib_XCurses = yes ; then
-	AC_DEFINE(UNIX)
-	AC_DEFINE(XCURSES)
-	AC_CHECK_HEADER(xcurses.h, AC_DEFINE(HAVE_XCURSES))
+	AC_DEFINE(UNIX,1,[Define to 1 if using PDCurses on Unix])
+	AC_DEFINE(XCURSES,1,[Define to 1 if using PDCurses on Unix])
+	AC_CHECK_HEADER(xcurses.h, AC_DEFINE(HAVE_XCURSES,1,[Define to 1 if using PDCurses on Unix]))
 else
 	AC_MSG_ERROR(Cannot link with XCurses)
 fi
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_PKG_CONFIG version: 4 updated: 2011/02/18 20:26:24
+dnl CF_PKG_CONFIG version: 7 updated: 2011/04/29 04:53:22
 dnl -------------
 dnl Check for the package-config program, unless disabled by command-line.
 AC_DEFUN([CF_PKG_CONFIG],
@@ -2193,7 +2379,9 @@
 	PKG_CONFIG=none
 	;;
 yes) #(vi
-	AC_PATH_TOOL(PKG_CONFIG, pkg-config, none)
+	CF_ACVERSION_CHECK(2.52,
+		[AC_PATH_TOOL(PKG_CONFIG, pkg-config, none)],
+		[AC_PATH_PROG(PKG_CONFIG, pkg-config, none)])
 	;;
 *)
 	PKG_CONFIG=$withval
@@ -2305,29 +2493,17 @@
 
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_PROG_CC_U_D version: 1 updated: 2005/07/14 16:59:30
-dnl --------------
-dnl Check if C (preprocessor) -U and -D options are processed in the order
-dnl given rather than by type of option.  Some compilers insist on apply all
-dnl of the -U options after all of the -D options.  Others allow mixing them,
-dnl and may predefine symbols that conflict with those we define.
-AC_DEFUN([CF_PROG_CC_U_D],
-[
-AC_CACHE_CHECK(if $CC -U and -D options work together,cf_cv_cc_u_d_options,[
-	cf_save_CPPFLAGS="$CPPFLAGS"
-	CPPFLAGS="-UU_D_OPTIONS -DU_D_OPTIONS -DD_U_OPTIONS -UD_U_OPTIONS"
-	AC_TRY_COMPILE([],[
-#ifndef U_D_OPTIONS
-make an undefined-error
-#endif
-#ifdef  D_U_OPTIONS
-make a defined-error
-#endif
-	],[
-	cf_cv_cc_u_d_options=yes],[
-	cf_cv_cc_u_d_options=no])
-	CPPFLAGS="$cf_save_CPPFLAGS"
-])
+dnl CF_PROG_CC version: 3 updated: 2012/10/06 15:31:55
+dnl ----------
+dnl standard check for CC, plus followup sanity checks
+dnl $1 = optional parameter to pass to AC_PROG_CC to specify compiler name
+AC_DEFUN([CF_PROG_CC],[
+ifelse($1,,[AC_PROG_CC],[AC_PROG_CC($1)])
+CF_GCC_VERSION
+CF_ACVERSION_CHECK(2.52,
+	[AC_PROG_CC_STDC],
+	[CF_ANSI_CC_REQD])
+CF_CC_ENV_FLAGS 
 ])dnl
 dnl ---------------------------------------------------------------------------
 dnl CF_PROG_INSTALL version: 5 updated: 2002/12/21 22:46:07
@@ -2373,7 +2549,122 @@
 		-e 's/-[[UD]]'"$3"'\(=[[^ 	]]*\)\?[$]//g'`
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_SIG_ATOMIC_T version: 2 updated: 2005/09/18 17:27:12
+dnl CF_RPATH_HACK version: 9 updated: 2011/02/13 13:31:33
+dnl -------------
+AC_DEFUN([CF_RPATH_HACK],
+[
+AC_REQUIRE([CF_LD_RPATH_OPT])
+AC_MSG_CHECKING(for updated LDFLAGS)
+if test -n "$LD_RPATH_OPT" ; then
+	AC_MSG_RESULT(maybe)
+
+	AC_CHECK_PROGS(cf_ldd_prog,ldd,no)
+	cf_rpath_list="/usr/lib /lib"
+	if test "$cf_ldd_prog" != no
+	then
+		cf_rpath_oops=
+
+AC_TRY_LINK([#include <stdio.h>],
+		[printf("Hello");],
+		[cf_rpath_oops=`$cf_ldd_prog conftest$ac_exeext | fgrep ' not found' | sed -e 's% =>.*$%%' |sort -u`
+		 cf_rpath_list=`$cf_ldd_prog conftest$ac_exeext | fgrep / | sed -e 's%^.*[[ 	]]/%/%' -e 's%/[[^/]][[^/]]*$%%' |sort -u`])
+
+		# If we passed the link-test, but get a "not found" on a given library,
+		# this could be due to inept reconfiguration of gcc to make it only
+		# partly honor /usr/local/lib (or whatever).  Sometimes this behavior
+		# is intentional, e.g., installing gcc in /usr/bin and suppressing the
+		# /usr/local libraries.
+		if test -n "$cf_rpath_oops"
+		then
+			for cf_rpath_src in $cf_rpath_oops
+			do
+				for cf_rpath_dir in \
+					/usr/local \
+					/usr/pkg \
+					/opt/sfw
+				do
+					if test -f $cf_rpath_dir/lib/$cf_rpath_src
+					then
+						CF_VERBOSE(...adding -L$cf_rpath_dir/lib to LDFLAGS for $cf_rpath_src)
+						LDFLAGS="$LDFLAGS -L$cf_rpath_dir/lib"
+						break
+					fi
+				done
+			done
+		fi
+	fi
+
+	CF_VERBOSE(...checking EXTRA_LDFLAGS $EXTRA_LDFLAGS)
+
+	CF_RPATH_HACK_2(LDFLAGS)
+	CF_RPATH_HACK_2(LIBS)
+
+	CF_VERBOSE(...checked EXTRA_LDFLAGS $EXTRA_LDFLAGS)
+fi
+AC_SUBST(EXTRA_LDFLAGS)
+])dnl
+dnl ---------------------------------------------------------------------------
+dnl CF_RPATH_HACK_2 version: 6 updated: 2010/04/17 16:31:24
+dnl ---------------
+dnl Do one set of substitutions for CF_RPATH_HACK, adding an rpath option to
+dnl EXTRA_LDFLAGS for each -L option found.
+dnl
+dnl $cf_rpath_list contains a list of directories to ignore.
+dnl
+dnl $1 = variable name to update.  The LDFLAGS variable should be the only one,
+dnl      but LIBS often has misplaced -L options.
+AC_DEFUN([CF_RPATH_HACK_2],
+[
+CF_VERBOSE(...checking $1 [$]$1)
+
+cf_rpath_dst=
+for cf_rpath_src in [$]$1
+do
+	case $cf_rpath_src in #(vi
+	-L*) #(vi
+
+		# check if this refers to a directory which we will ignore
+		cf_rpath_skip=no
+		if test -n "$cf_rpath_list"
+		then
+			for cf_rpath_item in $cf_rpath_list
+			do
+				if test "x$cf_rpath_src" = "x-L$cf_rpath_item"
+				then
+					cf_rpath_skip=yes
+					break
+				fi
+			done
+		fi
+
+		if test "$cf_rpath_skip" = no
+		then
+			# transform the option
+			if test "$LD_RPATH_OPT" = "-R " ; then
+				cf_rpath_tmp=`echo "$cf_rpath_src" |sed -e "s%-L%-R %"`
+			else
+				cf_rpath_tmp=`echo "$cf_rpath_src" |sed -e "s%-L%$LD_RPATH_OPT%"`
+			fi
+
+			# if we have not already added this, add it now
+			cf_rpath_tst=`echo "$EXTRA_LDFLAGS" | sed -e "s%$cf_rpath_tmp %%"`
+			if test "x$cf_rpath_tst" = "x$EXTRA_LDFLAGS"
+			then
+				CF_VERBOSE(...Filter $cf_rpath_src ->$cf_rpath_tmp)
+				EXTRA_LDFLAGS="$cf_rpath_tmp $EXTRA_LDFLAGS"
+			fi
+		fi
+		;;
+	esac
+	cf_rpath_dst="$cf_rpath_dst $cf_rpath_src"
+done
+$1=$cf_rpath_dst
+
+CF_VERBOSE(...checked $1 [$]$1)
+AC_SUBST(EXTRA_LDFLAGS)
+])dnl
+dnl ---------------------------------------------------------------------------
+dnl CF_SIG_ATOMIC_T version: 3 updated: 2012/10/04 20:12:20
 dnl ---------------
 dnl signal handler, but there are some gcc depedencies in that recommendation.
 dnl Try anyway.
@@ -2405,7 +2696,7 @@
 	done
 	])
 AC_MSG_RESULT($cf_cv_sig_atomic_t)
-test "$cf_cv_sig_atomic_t" != no && AC_DEFINE_UNQUOTED(SIG_ATOMIC_T, $cf_cv_sig_atomic_t)
+test "$cf_cv_sig_atomic_t" != no && AC_DEFINE_UNQUOTED(SIG_ATOMIC_T, $cf_cv_sig_atomic_t,[Define to signal global datatype])
 ])dnl
 dnl ---------------------------------------------------------------------------
 dnl CF_SUBDIR_PATH version: 6 updated: 2010/04/21 06:20:50
@@ -2425,7 +2716,7 @@
 CF_ADD_SUBDIR_PATH($1,$2,$3,[$]HOME,$prefix)
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_SYS_TIME_SELECT version: 4 updated: 2000/10/04 09:18:40
+dnl CF_SYS_TIME_SELECT version: 5 updated: 2012/10/04 05:24:07
 dnl ------------------
 dnl Check if we can include <sys/time.h> with <sys/select.h>; this breaks on
 dnl older SCO configurations.
@@ -2445,10 +2736,10 @@
      [cf_cv_sys_time_select=no])
      ])
 AC_MSG_RESULT($cf_cv_sys_time_select)
-test "$cf_cv_sys_time_select" = yes && AC_DEFINE(HAVE_SYS_TIME_SELECT)
+test "$cf_cv_sys_time_select" = yes && AC_DEFINE(HAVE_SYS_TIME_SELECT,1,[Define to 1 if we can include <sys/time.h> with <sys/select.h>])
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_TERM_HEADER version: 2 updated: 2010/10/23 15:54:49
+dnl CF_TERM_HEADER version: 3 updated: 2012/10/06 08:57:51
 dnl --------------
 dnl Look for term.h, which is part of X/Open curses.  It defines the interface
 dnl to terminfo database.  Usually it is in the same include-path as curses.h,
@@ -2481,20 +2772,73 @@
 
 case $cf_cv_term_header in # (vi
 *term.h)
-	AC_DEFINE(HAVE_TERM_H)
+	AC_DEFINE(HAVE_TERM_H,1,[Define to 1 if we have term.h])
 	;;
 esac
 
 case $cf_cv_term_header in # (vi
 ncurses/term.h) #(vi
-	AC_DEFINE(HAVE_NCURSES_TERM_H)
+	AC_DEFINE(HAVE_NCURSES_TERM_H,1,[Define to 1 if we have ncurses/term.h])
 	;;
 ncursesw/term.h)
-	AC_DEFINE(HAVE_NCURSESW_TERM_H)
+	AC_DEFINE(HAVE_NCURSESW_TERM_H,1,[Define to 1 if we have ncursesw/term.h])
 	;;
 esac
 ])dnl
 dnl ---------------------------------------------------------------------------
+dnl CF_TOP_BUILDDIR version: 1 updated: 2006/10/15 16:33:23
+dnl ---------------
+dnl Define a top_builddir symbol, for applications that need an absolute path.
+AC_DEFUN([CF_TOP_BUILDDIR],
+[
+top_builddir=`pwd`
+AC_SUBST(top_builddir)
+])dnl
+dnl ---------------------------------------------------------------------------
+dnl CF_TPUTS_PROTO version: 2 updated: 2011/04/23 19:25:50
+dnl --------------
+dnl Check for type of function-pointer passed to tputs.  Some old
+dnl implementations used functions that had different prototypes, making it
+dnl hard to compile portable programs using tputs.
+AC_DEFUN([CF_TPUTS_PROTO],[
+CF_CURSES_FUNCS(tputs)
+if test x$cf_cv_func_tputs = xyes
+then
+	cf_done=no
+	for cf_arg in int char
+	do
+		for cf_ret in int void
+		do
+			if test $cf_ret = void
+			then
+				cf_return="/* nothing */"
+			else
+				cf_return="return value"
+			fi
+			AC_TRY_COMPILE([
+#include <${cf_cv_ncurses_header:-curses.h}>
+#include <$cf_cv_term_header>
+
+static $cf_ret outc($cf_arg value) { $cf_return; }
+],[
+	tputs("hello", 0, outc); 
+	${cf_cv_main_return:-return}(0);
+],[
+		CF_VERBOSE([prototype $cf_ret func($cf_arg value)])
+		cat >>confdefs.h <<EOF
+#define TPUTS_ARG               $cf_arg
+#define TPUTS_PROTO(func,value) $cf_ret func(TPUTS_ARG value)
+#define TPUTS_RETURN(value)     $cf_return
+EOF
+		cf_done=yes
+		break
+])
+		done
+		test $cf_done = yes && break
+	done
+fi
+])dnl
+dnl ---------------------------------------------------------------------------
 dnl CF_TRY_PKG_CONFIG version: 4 updated: 2010/06/14 17:42:30
 dnl -----------------
 dnl This is a simple wrapper to use for pkg-config, for libraries which may be
@@ -2520,6 +2864,45 @@
 fi
 ])
 dnl ---------------------------------------------------------------------------
+dnl CF_TRY_XOPEN_SOURCE version: 1 updated: 2011/10/30 17:09:50
+dnl -------------------
+dnl If _XOPEN_SOURCE is not defined in the compile environment, check if we
+dnl can define it successfully.
+AC_DEFUN([CF_TRY_XOPEN_SOURCE],[
+AC_CACHE_CHECK(if we should define _XOPEN_SOURCE,cf_cv_xopen_source,[
+	AC_TRY_COMPILE([
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+],[
+#ifndef _XOPEN_SOURCE
+make an error
+#endif],
+	[cf_cv_xopen_source=no],
+	[cf_save="$CPPFLAGS"
+	 CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE"
+	 AC_TRY_COMPILE([
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+],[
+#ifdef _XOPEN_SOURCE
+make an error
+#endif],
+	[cf_cv_xopen_source=no],
+	[cf_cv_xopen_source=$cf_XOPEN_SOURCE])
+	CPPFLAGS="$cf_save"
+	])
+])
+
+if test "$cf_cv_xopen_source" != no ; then
+	CF_REMOVE_DEFINE(CFLAGS,$CFLAGS,_XOPEN_SOURCE)
+	CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,_XOPEN_SOURCE)
+	cf_temp_xopen_source="-D_XOPEN_SOURCE=$cf_cv_xopen_source"
+	CF_ADD_CFLAGS($cf_temp_xopen_source)
+fi
+])
+dnl ---------------------------------------------------------------------------
 dnl CF_UPPER version: 5 updated: 2001/01/29 23:40:59
 dnl --------
 dnl Make an uppercase version of a variable
@@ -2529,7 +2912,7 @@
 $1=`echo "$2" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_UTF8_LIB version: 7 updated: 2010/06/20 09:24:28
+dnl CF_UTF8_LIB version: 8 updated: 2012/10/06 08:57:51
 dnl -----------
 dnl Check for multibyte support, and if not found, utf8 compatibility library
 AC_DEFUN([CF_UTF8_LIB],
@@ -2548,7 +2931,7 @@
 # HAVE_LIBUTF8_H is used by ncurses if curses.h is shared between
 # ncurses/ncursesw:
 if test "$cf_cv_utf8_lib" = "add-on" ; then
-	AC_DEFINE(HAVE_LIBUTF8_H)
+	AC_DEFINE(HAVE_LIBUTF8_H,1,[Define to 1 if we should include libutf8.h])
 	CF_ADD_INCDIR($cf_cv_header_path_utf8)
 	CF_ADD_LIBDIR($cf_cv_library_path_utf8)
 	CF_ADD_LIBS($cf_cv_library_file_utf8)
@@ -2563,7 +2946,7 @@
 CF_MSG_LOG([$1])
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_WCHAR_TYPE version: 3 updated: 2010/05/26 16:44:57
+dnl CF_WCHAR_TYPE version: 4 updated: 2012/10/06 16:39:58
 dnl -------------
 dnl Check if type wide-character type $1 is declared, and if so, which header
 dnl file is needed.  The second parameter is used to set a shell variable when
@@ -2595,7 +2978,7 @@
 	[cf_cv_$1=unknown])])])
 
 if test "$cf_cv_$1" = yes ; then
-	AC_DEFINE(NEED_WCHAR_H)
+	AC_DEFINE(NEED_WCHAR_H,1,[Define to 1 if we must include wchar.h])
 	NEED_WCHAR_H=1
 fi
 
@@ -2667,6 +3050,60 @@
 fi
 ])dnl
 dnl ---------------------------------------------------------------------------
+dnl CF_WITH_NCURSES_ETC version: 2 updated: 2012/01/13 10:49:00
+dnl -------------------
+dnl Use this macro for programs which use any variant of "curses", e.g.,
+dnl "ncurses", and "PDCurses".  Programs that can use curses and some unrelated
+dnl library (such as slang) should use a "--with-screen=XXX" option.
+dnl
+dnl This does not use AC_DEFUN, because that would tell autoconf to run each
+dnl of the macros inside this one - before this macro.
+define([CF_WITH_NCURSES_ETC],[
+CF_WITH_CURSES_DIR
+
+cf_cv_screen=curses
+
+AC_MSG_CHECKING(for specified curses library type)
+AC_ARG_WITH(ncursesw,
+	[  --with-ncursesw         use wide ncurses-libraries],
+	[cf_cv_screen=ncursesw],[
+
+AC_ARG_WITH(ncurses,
+	[  --with-ncurses          use ncurses-libraries],
+	[cf_cv_screen=ncurses],[
+
+AC_ARG_WITH(pdcurses,
+	[  --with-pdcurses         compile/link with pdcurses X11 library],
+	[cf_cv_screen=pdcurses],[
+
+AC_ARG_WITH(curses-colr,
+	[  --with-curses-colr      compile/link with HPUX 10.x color-curses],
+	[cf_cv_screen=curses_colr],[
+
+AC_ARG_WITH(curses-5lib,
+	[  --with-curses-5lib      compile/link with SunOS 5lib curses],
+	[cf_cv_screen=curses_5lib])])])])])
+
+AC_MSG_RESULT($cf_cv_screen)
+
+case $cf_cv_screen in #(vi
+curses|curses_*) #(vi
+	CF_CURSES_CONFIG
+	;;
+ncurses) #(vi
+	CF_NCURSES_CONFIG
+	;;
+ncursesw) #(vi
+	CF_UTF8_LIB
+	CF_NCURSES_CONFIG(ncursesw)
+	;;
+pdcurses)
+	CF_PDCURSES_X11
+	;;
+esac
+
+])dnl
+dnl ---------------------------------------------------------------------------
 dnl CF_WITH_VALGRIND version: 1 updated: 2006/12/14 18:00:21
 dnl ----------------
 AC_DEFUN([CF_WITH_VALGRIND],[
@@ -2714,7 +3151,7 @@
 test $cf_cv_need_xopen_extension = yes && CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE_EXTENDED"
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_XOPEN_SOURCE version: 35 updated: 2011/02/20 20:37:37
+dnl CF_XOPEN_SOURCE version: 43 updated: 2013/02/10 10:41:05
 dnl ---------------
 dnl Try to get _XOPEN_SOURCE defined properly that we can use POSIX functions,
 dnl or adapt to the vendor's definitions to get equivalent functionality,
@@ -2724,13 +3161,14 @@
 dnl	$1 is the nominal value for _XOPEN_SOURCE
 dnl	$2 is the nominal value for _POSIX_C_SOURCE
 AC_DEFUN([CF_XOPEN_SOURCE],[
+AC_REQUIRE([AC_CANONICAL_HOST])
 
 cf_XOPEN_SOURCE=ifelse([$1],,500,[$1])
 cf_POSIX_C_SOURCE=ifelse([$2],,199506L,[$2])
 cf_xopen_source=
 
 case $host_os in #(vi
-aix[[456]]*) #(vi
+aix[[4-7]]*) #(vi
 	cf_xopen_source="-D_ALL_SOURCE"
 	;;
 cygwin) #(vi
@@ -2741,6 +3179,7 @@
 	;;
 darwin*) #(vi
 	cf_xopen_source="-D_DARWIN_C_SOURCE"
+	cf_XOPEN_SOURCE=
 	;;
 freebsd*|dragonfly*) #(vi
 	# 5.x headers associate
@@ -2758,15 +3197,23 @@
 	;;
 irix[[56]].*) #(vi
 	cf_xopen_source="-D_SGI_SOURCE"
+	cf_XOPEN_SOURCE=
 	;;
 linux*|gnu*|mint*|k*bsd*-gnu) #(vi
 	CF_GNU_SOURCE
 	;;
 mirbsd*) #(vi
-	# setting _XOPEN_SOURCE or _POSIX_SOURCE breaks <arpa/inet.h>
+	# setting _XOPEN_SOURCE or _POSIX_SOURCE breaks <sys/select.h> and other headers which use u_int / u_short types
+	cf_XOPEN_SOURCE=
+	CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE)
 	;;
 netbsd*) #(vi
-	# setting _XOPEN_SOURCE breaks IPv6 for lynx on NetBSD 1.6, breaks xterm, is not needed for ncursesw
+	cf_xopen_source="-D_NETBSD_SOURCE" # setting _XOPEN_SOURCE breaks IPv6 for lynx on NetBSD 1.6, breaks xterm, is not needed for ncursesw
+	;;
+openbsd[[4-9]]*) #(vi
+	# setting _XOPEN_SOURCE lower than 500 breaks g++ compile with wchar.h, needed for ncursesw
+	cf_xopen_source="-D_BSD_SOURCE"
+	cf_XOPEN_SOURCE=600
 	;;
 openbsd*) #(vi
 	# setting _XOPEN_SOURCE breaks xterm on OpenBSD 2.8, is not needed for ncursesw
@@ -2780,36 +3227,11 @@
 sco*) #(vi
 	# setting _XOPEN_SOURCE breaks Lynx on SCO Unix / OpenServer
 	;;
-solaris2.1[[0-9]]) #(vi
-	cf_xopen_source="-D__EXTENSIONS__ -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE"
-	;;
-solaris2.[[1-9]]) #(vi
+solaris2.*) #(vi
 	cf_xopen_source="-D__EXTENSIONS__"
 	;;
 *)
-	AC_CACHE_CHECK(if we should define _XOPEN_SOURCE,cf_cv_xopen_source,[
-	AC_TRY_COMPILE([#include <sys/types.h>],[
-#ifndef _XOPEN_SOURCE
-make an error
-#endif],
-	[cf_cv_xopen_source=no],
-	[cf_save="$CPPFLAGS"
-	 CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE"
-	 AC_TRY_COMPILE([#include <sys/types.h>],[
-#ifdef _XOPEN_SOURCE
-make an error
-#endif],
-	[cf_cv_xopen_source=no],
-	[cf_cv_xopen_source=$cf_XOPEN_SOURCE])
-	CPPFLAGS="$cf_save"
-	])
-])
-	if test "$cf_cv_xopen_source" != no ; then
-		CF_REMOVE_DEFINE(CFLAGS,$CFLAGS,_XOPEN_SOURCE)
-		CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,_XOPEN_SOURCE)
-		cf_temp_xopen_source="-D_XOPEN_SOURCE=$cf_cv_xopen_source"
-		CF_ADD_CFLAGS($cf_temp_xopen_source)
-	fi
+	CF_TRY_XOPEN_SOURCE
 	CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE)
 	;;
 esac
@@ -2817,6 +3239,35 @@
 if test -n "$cf_xopen_source" ; then
 	CF_ADD_CFLAGS($cf_xopen_source)
 fi
+
+dnl In anything but the default case, we may have system-specific setting
+dnl which is still not guaranteed to provide all of the entrypoints that
+dnl _XOPEN_SOURCE would yield.
+if test -n "$cf_XOPEN_SOURCE" && test -z "$cf_cv_xopen_source" ; then
+	AC_MSG_CHECKING(if _XOPEN_SOURCE really is set)
+	AC_TRY_COMPILE([#include <stdlib.h>],[
+#ifndef _XOPEN_SOURCE
+make an error
+#endif],
+	[cf_XOPEN_SOURCE_set=yes],
+	[cf_XOPEN_SOURCE_set=no])
+	AC_MSG_RESULT($cf_XOPEN_SOURCE_set)
+	if test $cf_XOPEN_SOURCE_set = yes
+	then
+		AC_TRY_COMPILE([#include <stdlib.h>],[
+#if (_XOPEN_SOURCE - 0) < $cf_XOPEN_SOURCE
+make an error
+#endif],
+		[cf_XOPEN_SOURCE_set_ok=yes],
+		[cf_XOPEN_SOURCE_set_ok=no])
+		if test $cf_XOPEN_SOURCE_set_ok = no
+		then
+			AC_MSG_WARN(_XOPEN_SOURCE is lower than requested)
+		fi
+	else
+		CF_TRY_XOPEN_SOURCE
+	fi
+fi
 ])
 dnl ---------------------------------------------------------------------------
 dnl CF_X_ATHENA version: 20 updated: 2010/11/09 05:18:02
@@ -2957,7 +3408,7 @@
 fi
 ])
 dnl ---------------------------------------------------------------------------
-dnl CF_X_ATHENA_LIBS version: 10 updated: 2011/02/13 13:31:33
+dnl CF_X_ATHENA_LIBS version: 12 updated: 2011/07/17 19:55:02
 dnl ----------------
 dnl Normally invoked by CF_X_ATHENA, with $1 set to the appropriate flavor of
 dnl the Athena widgets, e.g., Xaw, Xaw3d, neXtaw.
@@ -2973,19 +3424,24 @@
 	/usr/local
 do
 	for cf_lib in \
-		"-l$cf_x_athena_root -lXmu" \
-		"-l$cf_x_athena_root -lXpm -lXmu" \
-		"-l${cf_x_athena_root}_s -lXmu_s"
+		${cf_x_athena_root} \
+		${cf_x_athena_root}7 \
+		${cf_x_athena_root}6
+	do
+	for cf_libs in \
+		"-l$cf_lib -lXmu" \
+		"-l$cf_lib -lXpm -lXmu" \
+		"-l${cf_lib}_s -lXmu_s"
 	do
 		if test -z "$cf_x_athena_lib" ; then
 			cf_save="$LIBS"
 			cf_test=XawSimpleMenuAddGlobalActions
 			if test $cf_path != default ; then
-				CF_ADD_LIBS(-L$cf_path/lib $cf_lib)
-				AC_MSG_CHECKING(for $cf_lib in $cf_path)
+				CF_ADD_LIBS(-L$cf_path/lib $cf_libs)
+				AC_MSG_CHECKING(for $cf_libs in $cf_path)
 			else
-				CF_ADD_LIBS($cf_lib)
-				AC_MSG_CHECKING(for $cf_test in $cf_lib)
+				CF_ADD_LIBS($cf_libs)
+				AC_MSG_CHECKING(for $cf_test in $cf_libs)
 			fi
 			AC_TRY_LINK([
 #include <X11/Intrinsic.h>
@@ -2996,12 +3452,14 @@
 				[cf_result=no])
 			AC_MSG_RESULT($cf_result)
 			if test "$cf_result" = yes ; then
-				cf_x_athena_lib="$cf_lib"
+				cf_x_athena_lib="$cf_libs"
 				break
 			fi
 			LIBS="$cf_save"
 		fi
-	done
+	done # cf_libs
+		test -n "$cf_x_athena_lib" && break
+	done # cf_lib
 done
 
 if test -z "$cf_x_athena_lib" ; then
@@ -3021,7 +3479,7 @@
 		[CF_ADD_LIB(Xext)])])
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_X_TOOLKIT version: 20 updated: 2010/11/19 05:43:04
+dnl CF_X_TOOLKIT version: 21 updated: 2012/10/04 06:57:36
 dnl ------------
 dnl Check for X Toolkit libraries
 dnl
@@ -3095,7 +3553,7 @@
 
 	AC_CHECK_FUNC(XtAppInitialize,,[
 	AC_CHECK_LIB(Xt, XtAppInitialize,
-		[AC_DEFINE(HAVE_LIBXT)
+		[AC_DEFINE(HAVE_LIBXT,1,[Define to 1 if we can compile with the Xt library])
 		 cf_have_X_LIBS=Xt
 		 LIBS="-lXt $X_PRE_LIBS $LIBS $X_EXTRA_LIBS"],,
 		[$X_PRE_LIBS $LIBS $X_EXTRA_LIBS])])
Index: test/background.c
Prereq:  1.3 
--- ncurses-5.9/test/background.c	2006-06-03 16:43:08.000000000 +0000
+++ ncurses-5.9-20130504/test/background.c	2012-06-09 20:30:33.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 2003,2006 Free Software Foundation, Inc.                   *
+ * Copyright (c) 2003-2011,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -26,15 +26,172 @@
  * authorization.                                                           *
  ****************************************************************************/
 /*
- * $Id: background.c,v 1.3 2006/06/03 16:43:08 tom Exp $
+ * $Id: background.c,v 1.13 2012/06/09 20:30:33 tom Exp $
  */
 
-#include <test.priv.h>
+#define NEED_COLOR_CODE 1
+#define NEED_COLOR_NAME 1
+#include <color_name.h>
+
+static int default_bg = COLOR_BLACK;
+static int default_fg = COLOR_WHITE;
+
+static void
+test_background(void)
+{
+    short f, b;
+    int row;
+    int chr;
+
+    if (pair_content(0, &f, &b) == ERR) {
+	printw("pair 0 contains no data\n");
+    } else {
+	printw("pair 0 contains (%d,%d)\n", f, b);
+    }
+    getch();
+
+    printw("Initializing pair 1 to red/%s\n", color_name(default_bg));
+    init_pair(1, COLOR_RED, (short) default_bg);
+    bkgdset((chtype) (' ' | COLOR_PAIR(1)));
+    printw("RED/BLACK\n");
+    getch();
+
+    printw("Initializing pair 2 to %s/blue\n", color_name(default_fg));
+    init_pair(2, (short) default_fg, COLOR_BLUE);
+    bkgdset((chtype) (' ' | COLOR_PAIR(2)));
+    printw("This line should be %s/blue\n", color_name(default_fg));
+    getch();
+
+    printw("Initializing pair 3 to %s/cyan (ACS_HLINE)\n", color_name(default_fg));
+    init_pair(3, (short) default_fg, COLOR_CYAN);
+    printw("...and drawing a box which should be followed by lines\n");
+    bkgdset(ACS_HLINE | COLOR_PAIR(3));
+    /*
+     * Characters from vt100 line-drawing should be mapped to line-drawing,
+     * since A_ALTCHARSET is set in the background, and the character part
+     * of the background is replaced by the nonblank characters written.
+     *
+     * Characters not in the line-drawing range are usually sent as-is.
+     *
+     * With SVr4 curses it is possible to rely on this to mix uppercase text
+     * with the (lowercase) line-drawing characters.  ncurses uses some of
+     * the uppercase characters for encoding thick- and double-lines.
+     */
+    row = 7;
+    mvprintw(row++, 10, "l");
+    for (chr = 0; chr < 32; ++chr)
+	addch(' ');
+    printw("x\n");
+    chr = 32;
+    while (chr < 128) {
+	if ((chr % 32) == 0)
+	    mvprintw(row++, 10, "x");
+	addch((chtype) ((chr == 127) ? ' ' : chr));
+	if ((++chr % 32) == 0)
+	    printw("x\n");
+    }
+    mvprintw(row++, 10, "m");
+    for (chr = 0; chr < 32; ++chr)
+	addch(' ');
+    printw("j\n");
+    getch();
+
+    bkgdset((chtype) (' ' | COLOR_PAIR(0)));
+    printw("Default Colors\n");
+    getch();
+
+    printw("Resetting colors to pair 1\n");
+    bkgdset((chtype) (' ' | COLOR_PAIR(1)));
+    printw("This line should be red/%s\n", color_name(default_bg));
+    getch();
+
+    printw("Setting screen to pair 0\n");
+    bkgd((chtype) (' ' | COLOR_PAIR(0)));
+    getch();
+
+    printw("Setting screen to pair 1\n");
+    bkgd((chtype) (' ' | COLOR_PAIR(1)));
+    getch();
+
+    printw("Setting screen to pair 2\n");
+    bkgd((chtype) (' ' | COLOR_PAIR(2)));
+    getch();
+
+    printw("Setting screen to pair 3\n");
+    bkgd((chtype) (' ' | COLOR_PAIR(3)));
+    getch();
+
+    printw("Setting screen to pair 0\n");
+    bkgd((chtype) (' ' | COLOR_PAIR(0)));
+    getch();
+}
+
+static void
+usage(void)
+{
+    static const char *msg[] =
+    {
+	"Usage: background [options]"
+	,""
+	,"Options:"
+#if HAVE_ASSUME_DEFAULT_COLORS
+	," -a       invoke assume_default_colors, repeat to use in init_pair"
+#endif
+	," -b XXX   specify background color"
+#if HAVE_USE_DEFAULT_COLORS
+	," -d       invoke use_default_colors, repeat to use in init_pair"
+#endif
+	," -f XXX   specify foreground color"
+    };
+    size_t n;
+
+    for (n = 0; n < SIZEOF(msg); n++)
+	fprintf(stderr, "%s\n", msg[n]);
+
+    ExitProgram(EXIT_FAILURE);
+}
 
 int
 main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED)
 {
-    short f, b;
+#if HAVE_ASSUME_DEFAULT_COLORS
+    int a_option = 0;
+#endif
+#if HAVE_USE_DEFAULT_COLORS
+    int d_option = 0;
+#endif
+    int n;
+
+    setlocale(LC_ALL, "");
+
+    while ((n = getopt(argc, argv, "ab:df:")) != -1) {
+	switch (n) {
+#if HAVE_ASSUME_DEFAULT_COLORS
+	case 'a':
+	    ++a_option;
+	    break;
+#endif
+	case 'b':
+	    default_bg = color_code(optarg);
+	    break;
+#if HAVE_USE_DEFAULT_COLORS
+	case 'd':
+	    ++d_option;
+	    break;
+#endif
+	case 'f':
+	    default_fg = color_code(optarg);
+	    break;
+	default:
+	    usage();
+	}
+    }
+#if HAVE_USE_DEFAULT_COLORS && HAVE_ASSUME_DEFAULT_COLORS
+    if (a_option && d_option) {
+	fprintf(stderr, "Use either -a or -d option, but not both\n");
+	ExitProgram(EXIT_FAILURE);
+    }
+#endif
 
     initscr();
     cbreak();
@@ -43,47 +200,30 @@
     if (has_colors()) {
 	start_color();
 
-	pair_content(0, &f, &b);
-	printw("pair 0 contains (%d,%d)\n", f, b);
-	getch();
+#if HAVE_USE_DEFAULT_COLORS
+	if (d_option) {
+	    printw("Using default colors...\n");
+	    use_default_colors();
+	    if (d_option > 1) {
+		default_fg = -1;
+		default_bg = -1;
+	    }
+	}
+#endif
+#if HAVE_ASSUME_DEFAULT_COLORS
+	if (a_option) {
+	    printw("Using assumed colors %s/%s...\n",
+		   color_name(default_fg),
+		   color_name(default_bg));
+	    assume_default_colors(default_fg, default_bg);
+	    if (a_option > 1) {
+		default_fg = -1;
+		default_bg = -1;
+	    }
+	}
+#endif
 
-	printw("Initializing pair 1 to red/black\n");
-	init_pair(1, COLOR_RED, COLOR_BLACK);
-	bkgdset(' ' | COLOR_PAIR(1));
-	printw("RED/BLACK\n");
-	getch();
-
-	printw("Initializing pair 2 to white/blue\n");
-	init_pair(2, COLOR_WHITE, COLOR_BLUE);
-	bkgdset(' ' | COLOR_PAIR(2));
-	printw("WHITE/BLUE\n");
-	getch();
-
-	printw("Resetting colors to pair 0\n");
-	bkgdset(' ' | COLOR_PAIR(0));
-	printw("Default Colors\n");
-	getch();
-
-	printw("Resetting colors to pair 1\n");
-	bkgdset(' ' | COLOR_PAIR(1));
-	printw("RED/BLACK\n");
-	getch();
-
-	printw("Setting screen to pair 0\n");
-	bkgd(' ' | COLOR_PAIR(0));
-	getch();
-
-	printw("Setting screen to pair 1\n");
-	bkgd(' ' | COLOR_PAIR(1));
-	getch();
-
-	printw("Setting screen to pair 2\n");
-	bkgd(' ' | COLOR_PAIR(2));
-	getch();
-
-	printw("Setting screen to pair 0\n");
-	bkgd(' ' | COLOR_PAIR(0));
-	getch();
+	test_background();
 
     } else {
 	printw("This demo requires a color terminal");
Index: test/blue.c
Prereq:  1.33 
--- ncurses-5.9/test/blue.c	2009-10-24 21:03:35.000000000 +0000
+++ ncurses-5.9-20130504/test/blue.c	2013-04-27 19:46:53.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2008,2009 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2009,2013 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -40,7 +40,7 @@
  * results, use the ncurses(3) library.  On non-Intel machines, SVr4 curses is
  * just as good.
  *
- * $Id: blue.c,v 1.33 2009/10/24 21:03:35 tom Exp $
+ * $Id: blue.c,v 1.35 2013/04/27 19:46:53 tom Exp $
  */
 
 #include <test.priv.h>
@@ -70,7 +70,7 @@
 #define BLACK_ON_WHITE  2
 #define BLUE_ON_WHITE   3
 
-static RETSIGTYPE die(int onsig) GCC_NORETURN;
+static void die(int onsig) GCC_NORETURN;
 
 static int deck_size = PACK_SIZE;	/* initial deck */
 static int deck[PACK_SIZE];
@@ -132,7 +132,7 @@
 
 static chtype *suits = letters;	/* this may change to glyphs below */
 
-static RETSIGTYPE
+static void
 die(int onsig)
 {
     (void) signal(onsig, SIG_IGN);
@@ -202,8 +202,8 @@
     if (value == NOCARD)
 	(void) addstr("   ");
     else {
-	addch(ranks[value % SUIT_LENGTH][0] | COLOR_PAIR(BLUE_ON_WHITE));
-	addch(ranks[value % SUIT_LENGTH][1] | COLOR_PAIR(BLUE_ON_WHITE));
+	addch(ranks[value % SUIT_LENGTH][0] | (chtype) COLOR_PAIR(BLUE_ON_WHITE));
+	addch(ranks[value % SUIT_LENGTH][1] | (chtype) COLOR_PAIR(BLUE_ON_WHITE));
 	addch(suits[value / SUIT_LENGTH]);
     }
     (void) addch(' ');
Index: test/bs.c
Prereq:  1.52 
--- ncurses-5.9/test/bs.c	2010-11-13 20:07:52.000000000 +0000
+++ ncurses-5.9-20130504/test/bs.c	2013-04-27 19:46:53.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -34,7 +34,7 @@
  * v2.0 featuring strict ANSI/POSIX conformance, November 1993.
  * v2.1 with ncurses mouse support, September 1995
  *
- * $Id: bs.c,v 1.52 2010/11/13 20:07:52 tom Exp $
+ * $Id: bs.c,v 1.61 2013/04/27 19:46:53 tom Exp $
  */
 
 #include <test.priv.h>
@@ -110,7 +110,7 @@
 static char destroy[] = "Destroyer";
 static char ptboat[] = "PT Boat";
 
-static char name[40];
+static char *your_name;
 static char dftname[] = "stranger";
 
 /* direction constants */
@@ -174,9 +174,9 @@
 
 #define	PR	(void)addstr
 
-static RETSIGTYPE uninitgame(int sig) GCC_NORETURN;
+static void uninitgame(int sig) GCC_NORETURN;
 
-static RETSIGTYPE
+static void
 uninitgame(int sig GCC_UNUSED)
 /* end the game, either normally or due to signal */
 {
@@ -220,11 +220,12 @@
 
     CATCHALL(uninitgame);
 
-    if ((tmpname = getlogin()) != 0) {
-	(void) strcpy(name, tmpname);
-	name[0] = (char) toupper(UChar(name[0]));
-    } else
-	(void) strcpy(name, dftname);
+    if ((tmpname = getlogin()) != 0 &&
+	(your_name = strdup(tmpname)) != 0) {
+	your_name[0] = (char) toupper(UChar(your_name[0]));
+    } else {
+	your_name = dftname;
+    }
 
     (void) initscr();
     keypad(stdscr, TRUE);
@@ -368,7 +369,7 @@
 	MvAddCh(PYBASE + i, PXBASE - 3, (chtype) (i + 'A'));
 #ifdef A_COLOR
 	if (has_colors())
-	    attron(COLOR_PAIR(COLOR_BLUE));
+	    attron((attr_t) COLOR_PAIR(COLOR_BLUE));
 #endif /* A_COLOR */
 	(void) addch(' ');
 	for (j = 0; j < BWIDTH; j++)
@@ -386,7 +387,7 @@
 	MvAddCh(CYBASE + i, CXBASE - 3, (chtype) (i + 'A'));
 #ifdef A_COLOR
 	if (has_colors())
-	    attron(COLOR_PAIR(COLOR_BLUE));
+	    attron((attr_t) COLOR_PAIR(COLOR_BLUE));
 #endif /* A_COLOR */
 	(void) addch(' ');
 	for (j = 0; j < BWIDTH; j++)
@@ -426,10 +427,11 @@
 	placeship(COMPUTER, ss, FALSE);
     }
 
-    ss = (ship_t *) NULL;
     do {
 	char c, docked[SHIPTYPES + 2], *cp = docked;
 
+	ss = (ship_t *) NULL;
+
 	/* figure which ships still wait to be placed */
 	*cp++ = 'R';
 	for (i = 0; i < SHIPTYPES; i++)
@@ -459,13 +461,14 @@
 	do {
 	    c = (char) getch();
 	} while
-	    (!(strchr("hjklrR", c) || c == FF));
+	    (!(strchr("hjkl8462rR", c) || c == FF));
 
 	if (c == FF) {
 	    (void) clearok(stdscr, TRUE);
 	    (void) refresh();
+	} else if (ss == 0) {
+	    beep();		/* simple to verify, unlikely to happen */
 	} else if (c == 'r') {
-	    assert(ss != 0);
 	    prompt(1, "Random-placing your %s", ss->name);
 	    randomplace(PLAYER, ss);
 	    placeship(PLAYER, ss, TRUE);
@@ -481,7 +484,6 @@
 		}
 	    error((char *) NULL);
 	} else if (strchr("hjkl8462", c)) {
-	    assert(ss != 0);
 	    ss->x = curx;
 	    ss->y = cury;
 
@@ -769,7 +771,7 @@
 				    cgoto(y1, x1);
 #ifdef A_COLOR
 				    if (has_colors())
-					attron(COLOR_PAIR(COLOR_GREEN));
+					attron((attr_t) COLOR_PAIR(COLOR_GREEN));
 #endif /* A_COLOR */
 				    (void) addch(MARK_MISS);
 #ifdef A_COLOR
@@ -795,7 +797,7 @@
 			pgoto(y1, x1);
 #ifdef A_COLOR
 			if (has_colors())
-			    attron(COLOR_PAIR(COLOR_RED));
+			    attron((attr_t) COLOR_PAIR(COLOR_RED));
 #endif /* A_COLOR */
 			(void) addch(SHOWHIT);
 #ifdef A_COLOR
@@ -834,9 +836,9 @@
 #ifdef A_COLOR
     if (has_colors()) {
 	if (hit)
-	    attron(COLOR_PAIR(COLOR_RED));
+	    attron((attr_t) COLOR_PAIR(COLOR_RED));
 	else
-	    attron(COLOR_PAIR(COLOR_GREEN));
+	    attron((attr_t) COLOR_PAIR(COLOR_GREEN));
     }
 #endif /* A_COLOR */
     (void) addch((chtype) hits[PLAYER][curx][cury]);
@@ -863,7 +865,9 @@
 	    m = " You'll pick up survivors from my %s, I hope...!";
 	    break;
 	}
-	(void) printw(m, ss->name);
+	if (m != 0) {
+	    (void) printw(m, ss->name);
+	}
 	(void) beep();
     }
     return (hit);
@@ -952,8 +956,8 @@
     bool hit, sunk;
     ship_t *ss = NULL;
 
-    hit = board[PLAYER][x][y] ? MARK_HIT : MARK_MISS;
-    hits[COMPUTER][x][y] = (char) hit;
+    hit = (bool) board[PLAYER][x][y];
+    hits[COMPUTER][x][y] = (hit ? MARK_HIT : MARK_MISS);
     MvPrintw(PROMPTLINE, 0,
 	     "I shoot at %c%d. I %s!", y + 'A', x, hit ? "hit" :
 	     "miss");
@@ -965,9 +969,9 @@
 #ifdef A_COLOR
     if (has_colors()) {
 	if (hit)
-	    attron(COLOR_PAIR(COLOR_RED));
+	    attron((attr_t) COLOR_PAIR(COLOR_RED));
 	else
-	    attron(COLOR_PAIR(COLOR_GREEN));
+	    attron((attr_t) COLOR_PAIR(COLOR_GREEN));
     }
 #endif /* A_COLOR */
     (void) addch((chtype) (hit ? SHOWHIT : SHOWSPLASH));
@@ -1130,16 +1134,16 @@
 	++cpuwon;
     else
 	++plywon;
-    j = 18 + (int) strlen(name);
+    j = 18 + (int) strlen(your_name);
     if (plywon >= 10)
 	++j;
     if (cpuwon >= 10)
 	++j;
     MvPrintw(1, (COLWIDTH - j) / 2,
-	     "%s: %d     Computer: %d", name, plywon, cpuwon);
+	     "%s: %d     Computer: %d", your_name, plywon, cpuwon);
 
     prompt(2, (awinna())? "Want to be humiliated again, %s [yn]? "
-	   : "Going to give me a chance for revenge, %s [yn]? ", name);
+	   : "Going to give me a chance for revenge, %s [yn]? ", your_name);
     return (sgetc("YN") == 'Y');
 }
 
Index: test/cardfile.c
Prereq:  1.38 
--- ncurses-5.9/test/cardfile.c	2010-11-14 00:58:45.000000000 +0000
+++ ncurses-5.9-20130504/test/cardfile.c	2012-11-03 19:26:50.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1999-2008,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 1999-2010,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -29,7 +29,7 @@
 /*
  * Author: Thomas E. Dickey
  *
- * $Id: cardfile.c,v 1.38 2010/11/14 00:58:45 tom Exp $
+ * $Id: cardfile.c,v 1.41 2012/11/03 19:26:50 tom Exp $
  *
  * File format: text beginning in column 1 is a title; other text is content.
  */
@@ -68,17 +68,13 @@
 static bool try_color = FALSE;
 static char default_name[] = "cardfile.dat";
 
-#if !HAVE_STRDUP
-#define strdup my_strdup
-static char *
-strdup(const char *s)
-{
-    char *p = typeMalloc(char, strlen(s) + 1);
-    if (p)
-	strcpy(p, s);
-    return (p);
+static void
+failed(const char *s)
+{
+    perror(s);
+    endwin();
+    ExitProgram(EXIT_FAILURE);
 }
-#endif /* not HAVE_STRDUP */
 
 static const char *
 skip(const char *buffer)
@@ -146,6 +142,8 @@
 	}
 	if (card->content)
 	    strcpy(card->content + offset, content);
+	else
+	    failed("add_content");
     }
 }
 
@@ -414,7 +412,7 @@
 	if ((win = newwin(panel_high, panel_wide, y, x)) == 0)
 	    break;
 
-	wbkgd(win, COLOR_PAIR(pair_2));
+	wbkgd(win, (chtype) COLOR_PAIR(pair_2));
 	keypad(win, TRUE);
 	p->panel = new_panel(win);
 	box(win, 0, 0);
@@ -588,7 +586,7 @@
 	    start_color();
 	    init_pair(pair_1, COLOR_WHITE, COLOR_BLUE);
 	    init_pair(pair_2, COLOR_WHITE, COLOR_CYAN);
-	    bkgd(COLOR_PAIR(pair_1));
+	    bkgd((chtype) COLOR_PAIR(pair_1));
 	} else {
 	    try_color = FALSE;
 	}
Index: test/chgat.c
Prereq:  1.11 
--- ncurses-5.9/test/chgat.c	2010-05-01 19:12:26.000000000 +0000
+++ ncurses-5.9-20130504/test/chgat.c	2012-11-18 01:55:35.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 2006-2009,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 2006-2010,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -26,7 +26,7 @@
  * authorization.                                                           *
  ****************************************************************************/
 /*
- * $Id: chgat.c,v 1.11 2010/05/01 19:12:26 tom Exp $
+ * $Id: chgat.c,v 1.12 2012/11/18 01:55:35 tom Exp $
  *
  * test-driver for chgat/wchgat/mvchgat/mvwchgat
  */
@@ -176,6 +176,8 @@
 	delwin(win1);
 	touchwin(win);
     } else {
+	if (win1 != 0)
+	    delwin(win1);
 	beep();
     }
 }
Index: test/clip_printw.c
Prereq:  1.7 
--- ncurses-5.9/test/clip_printw.c	2010-11-13 20:48:48.000000000 +0000
+++ ncurses-5.9-20130504/test/clip_printw.c	2012-11-18 00:39:48.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 2008-2009,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 2008-2010,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -26,7 +26,7 @@
  * authorization.                                                           *
  ****************************************************************************/
 /*
- * $Id: clip_printw.c,v 1.7 2010/11/13 20:48:48 tom Exp $
+ * $Id: clip_printw.c,v 1.9 2012/11/18 00:39:48 tom Exp $
  *
  * demonstrate how to use printw without wrapping.
  */
@@ -207,6 +207,8 @@
 	delwin(win1);
 	touchwin(win);
     } else {
+	if (win1)
+	    delwin(win1);
 	beep();
     }
 }
@@ -329,7 +331,7 @@
     do {
 	switch (st.ch) {
 	case '.':		/* change from current position */
-	    (void) wattrset(win, st.attr | (chtype) COLOR_PAIR(st.pair));
+	    (void) wattrset(win, (int) (st.attr | (chtype) COLOR_PAIR(st.pair)));
 	    if (st.count > 0) {
 		need = (unsigned) st.count + 1;
 		sprintf(fmt, "%%c%%%ds%%c", st.count);
@@ -337,12 +339,13 @@
 		need = (unsigned) getmaxx(win) - 1;
 		strcpy(fmt, "%c%s%c");
 	    }
-	    if ((buffer = typeMalloc(char, need)) != 0) {
+	    if ((buffer = typeMalloc(char, need + 1)) != 0) {
 		for (j = 0; j < need; ++j) {
 		    buffer[j] = (char) ('A' + (j % 26));
 		}
 		buffer[need - 1] = '\0';
 		st.status = clip_wprintw(win, fmt, '[', buffer, ']');
+		free(buffer);
 	    }
 	    break;
 	case 'w':
Index: test/color_name.h
--- /dev/null	2013-05-05 10:34:48.558701642 +0000
+++ ncurses-5.9-20130504/test/color_name.h	2012-11-18 01:59:32.000000000 +0000
@@ -0,0 +1,103 @@
+/****************************************************************************
+ * Copyright (c) 2011,2012 Free Software Foundation, Inc.                   *
+ *                                                                          *
+ * Permission is hereby granted, free of charge, to any person obtaining a  *
+ * copy of this software and associated documentation files (the            *
+ * "Software"), to deal in the Software without restriction, including      *
+ * without limitation the rights to use, copy, modify, merge, publish,      *
+ * distribute, distribute with modifications, sublicense, and/or sell       *
+ * copies of the Software, and to permit persons to whom the Software is    *
+ * furnished to do so, subject to the following conditions:                 *
+ *                                                                          *
+ * The above copyright notice and this permission notice shall be included  *
+ * in all copies or substantial portions of the Software.                   *
+ *                                                                          *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
+ * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
+ *                                                                          *
+ * Except as contained in this notice, the name(s) of the above copyright   *
+ * holders shall not be used in advertising or otherwise to promote the     *
+ * sale, use or other dealings in this Software without prior written       *
+ * authorization.                                                           *
+ ****************************************************************************/
+/*
+ * $Id: color_name.h,v 1.4 2012/11/18 01:59:32 tom Exp $
+ */
+
+#ifndef __COLORNAME_H
+#define __COLORNAME_H 1
+
+#ifndef __TEST_PRIV_H
+#include <test.priv.h>
+#endif
+
+static NCURSES_CONST char *the_color_names[] =
+{
+    "black",
+    "red",
+    "green",
+    "yellow",
+    "blue",
+    "magenta",
+    "cyan",
+    "white",
+    "BLACK",
+    "RED",
+    "GREEN",
+    "YELLOW",
+    "BLUE",
+    "MAGENTA",
+    "CYAN",
+    "WHITE"
+};
+
+#ifdef NEED_COLOR_CODE
+static int
+color_code(const char *color)
+{
+    int result = 0;
+    char *endp = 0;
+    size_t n;
+
+    if ((result = (int) strtol(color, &endp, 0)) >= 0
+	&& (endp == 0 || *endp == 0)) {
+	;
+    } else if (!strcmp(color, "default")) {
+	result = -1;
+    } else {
+	for (n = 0; n < SIZEOF(the_color_names); ++n) {
+	    if (!strcmp(the_color_names[n], color)) {
+		result = (int) n;
+		break;
+	    }
+	}
+    }
+    return result;
+}
+#endif /* NEED_COLOR_NAME */
+
+#ifdef NEED_COLOR_NAME
+static const char *
+color_name(int color)
+{
+    static char temp[20];
+    const char *result = 0;
+
+    if (color >= (int) SIZEOF(the_color_names)) {
+	sprintf(temp, "%d", color);
+	result = temp;
+    } else if (color < 0) {
+	result = "default";
+    } else {
+	result = the_color_names[color];
+    }
+    return result;
+}
+#endif /* NEED_COLOR_NAME */
+
+#endif /* __COLORNAME_H */
Index: test/color_set.c
Prereq:  1.6 
--- ncurses-5.9/test/color_set.c	2008-02-10 00:18:01.000000000 +0000
+++ ncurses-5.9-20130504/test/color_set.c	2012-12-15 22:04:14.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 2003-2006,2008 Free Software Foundation, Inc.              *
+ * Copyright (c) 2003-2008,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -26,7 +26,7 @@
  * authorization.                                                           *
  ****************************************************************************/
 /*
- * $Id: color_set.c,v 1.6 2008/02/10 00:18:01 tom Exp $
+ * $Id: color_set.c,v 1.7 2012/12/15 22:04:14 tom Exp $
  */
 
 #include <test.priv.h>
@@ -48,7 +48,7 @@
     if (has_colors()) {
 	start_color();
 
-	pair_content(0, &f, &b);
+	(void) pair_content(0, &f, &b);
 	printw("pair 0 contains (%d,%d)\n", f, b);
 	getch();
 
Index: test/configure
--- ncurses-5.9/test/configure	2011-03-24 08:29:40.000000000 +0000
+++ ncurses-5.9-20130504/test/configure	2013-04-27 19:51:02.000000000 +0000
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by Autoconf 2.52.20101002.
+# Generated by Autoconf 2.52.20121002.
 #
 # Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001
 # Free Software Foundation, Inc.
@@ -105,42 +105,6 @@
 : ${ac_max_here_lines=38}
 
 ac_unique_file="ncurses.c"
-# Factoring default headers for most tests.
-ac_includes_default="\
-#include <stdio.h>
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-#if STDC_HEADERS
-# include <stdlib.h>
-# include <stddef.h>
-#else
-# if HAVE_STDLIB_H
-#  include <stdlib.h>
-# endif
-#endif
-#if HAVE_STRING_H
-# if !STDC_HEADERS && HAVE_MEMORY_H
-#  include <memory.h>
-# endif
-# include <string.h>
-#endif
-#if HAVE_STRINGS_H
-# include <strings.h>
-#endif
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-#endif
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif"
 
 # Initialize some variables set by options.
 ac_init_help=
@@ -170,15 +134,16 @@
 bindir='${exec_prefix}/bin'
 sbindir='${exec_prefix}/sbin'
 libexecdir='${exec_prefix}/libexec'
-datadir='${prefix}/share'
+datarootdir='${prefix}/share'
+datadir='${datarootdir}'
 sysconfdir='${prefix}/etc'
 sharedstatedir='${prefix}/com'
 localstatedir='${prefix}/var'
 libdir='${exec_prefix}/lib'
 includedir='${prefix}/include'
 oldincludedir='/usr/include'
-infodir='${prefix}/info'
-mandir='${prefix}/man'
+infodir='${datarootdir}/info'
+mandir='${datarootdir}/man'
 
 # Identity of this package.
 PACKAGE_NAME=
@@ -229,6 +194,13 @@
   | --da=*)
     datadir=$ac_optarg ;;
 
+  -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \
+  | --dataroo | --dataro | --datar)
+    ac_prev=datarootdir ;;
+  -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \
+  | --dataroot=* | --dataroo=* | --dataro=* | --datar=*)
+    datarootdir=$ac_optarg ;;
+
   -disable-* | --disable-*)
     ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
     # Reject names that are not valid shell variable names.
@@ -504,7 +476,7 @@
 done
 
 # Be sure to have absolute paths.
-for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \
+for ac_var in bindir sbindir libexecdir datarootdir datadir sysconfdir sharedstatedir \
               localstatedir libdir includedir oldincludedir infodir mandir
 do
   eval ac_val=$`echo $ac_var`
@@ -641,15 +613,16 @@
   --bindir=DIR            user executables [EPREFIX/bin]
   --sbindir=DIR           system admin executables [EPREFIX/sbin]
   --libexecdir=DIR        program executables [EPREFIX/libexec]
-  --datadir=DIR           read-only architecture-independent data [PREFIX/share]
+  --datarootdir=DIR       read-only architecture-independent data [PREFIX/share]
+  --datadir=DIR           read-only architecture-independent data [DATAROOTDIR]
   --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
   --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
   --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
   --libdir=DIR            object code libraries [EPREFIX/lib]
   --includedir=DIR        C header files [PREFIX/include]
   --oldincludedir=DIR     C header files for non-gcc [/usr/include]
-  --infodir=DIR           info documentation [PREFIX/info]
-  --mandir=DIR            man documentation [PREFIX/man]
+  --infodir=DIR           info documentation [DATAROOTDIR/info]
+  --mandir=DIR            man documentation [DATAROOTDIR/man]
 EOF
 
   cat <<\EOF
@@ -673,31 +646,37 @@
 
   cat <<\EOF
 
-Optional Features:
-  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
-  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
-
 Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
   --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
 
-  --disable-echo          display "compiling" commands
-  --enable-warnings       test: turn on gcc compiler warnings
-  --with-dmalloc          test: use Gray Watson's dmalloc library
-  --with-dbmalloc         test: use Conor Cahill's dbmalloc library
-  --with-valgrind         test: use valgrind
-  --disable-leaks         test: free permanent memory, analyze leaks
+Optional Features:
+  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
+  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
+
+General Options:
+  --with-pkg-config{=path} enable/disable use of pkg-config
+  --disable-echo          do not display "compiling" commands
+Curses Version-dependent Options:
+  --with-ncurses-wrap-prefix naming-prefix for ncurses wrapped-variables
+  --disable-widec         disable checks for wide-character functions
   --with-curses-dir=DIR   directory in which (n)curses is installed
-  --with-5lib             use SunOS sysv-libraries
-  --with-ncursesw         use wide ncurses-libraries (installed)
-  --with-ncurses          use ncurses-libraries (installed)
+  --with-ncursesw         use wide ncurses-libraries
+  --with-ncurses          use ncurses-libraries
   --with-pdcurses         compile/link with pdcurses X11 library
+  --with-curses-colr      compile/link with HPUX 10.x color-curses
+  --with-curses-5lib      compile/link with SunOS 5lib curses
   --with-Xaw3d            link with Xaw 3d library
   --with-neXtaw           link with neXT Athena library
   --with-XawPlus          link with Athena-Plus library
-  --with-pkg-config{=path} enable/disable use of pkg-config
   --with-x                use the X Window System
-  --with-ncurses-wrap-prefix naming-prefix for ncurses wrapped-variables
+Testing/development Options:
+  --enable-warnings       test: turn on gcc compiler warnings
+  --with-dmalloc          test: use Gray Watson's dmalloc library
+  --with-dbmalloc         test: use Conor Cahill's dbmalloc library
+  --with-valgrind         test: use valgrind
+  --disable-leaks         test: free permanent memory, analyze leaks
+  --disable-rpath-hack    don't add rpath options for additional libraries
 
 Some influential environment variables:
   CC          C compiler command
@@ -767,7 +746,7 @@
 running configure, to aid debugging if configure makes a mistake.
 
 It was created by $as_me, which was
-generated by GNU Autoconf 2.52.20101002.  Invocation command line was
+generated by GNU Autoconf 2.52.20121002.  Invocation command line was
 
   $ $0 $@
 
@@ -891,7 +870,7 @@
 fi
 for ac_site_file in $CONFIG_SITE; do
   if test -r "$ac_site_file"; then
-    { echo "$as_me:894: loading site script $ac_site_file" >&5
+    { echo "$as_me:873: loading site script $ac_site_file" >&5
 echo "$as_me: loading site script $ac_site_file" >&6;}
     cat "$ac_site_file" >&5
     . "$ac_site_file"
@@ -902,7 +881,7 @@
   # Some versions of bash will fail to source /dev/null (special
   # files actually), so we avoid doing that.
   if test -f "$cache_file"; then
-    { echo "$as_me:905: loading cache $cache_file" >&5
+    { echo "$as_me:884: loading cache $cache_file" >&5
 echo "$as_me: loading cache $cache_file" >&6;}
     case $cache_file in
       [\\/]* | ?:[\\/]* ) . $cache_file;;
@@ -910,7 +889,7 @@
     esac
   fi
 else
-  { echo "$as_me:913: creating cache $cache_file" >&5
+  { echo "$as_me:892: creating cache $cache_file" >&5
 echo "$as_me: creating cache $cache_file" >&6;}
   >$cache_file
 fi
@@ -926,21 +905,21 @@
   eval ac_new_val="\$ac_env_${ac_var}_value"
   case $ac_old_set,$ac_new_set in
     set,)
-      { echo "$as_me:929: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
+      { echo "$as_me:908: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
 echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
       ac_cache_corrupted=: ;;
     ,set)
-      { echo "$as_me:933: error: \`$ac_var' was not set in the previous run" >&5
+      { echo "$as_me:912: error: \`$ac_var' was not set in the previous run" >&5
 echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
       ac_cache_corrupted=: ;;
     ,);;
     *)
       if test "x$ac_old_val" != "x$ac_new_val"; then
-        { echo "$as_me:939: error: \`$ac_var' has changed since the previous run:" >&5
+        { echo "$as_me:918: error: \`$ac_var' has changed since the previous run:" >&5
 echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
-        { echo "$as_me:941:   former value:  $ac_old_val" >&5
+        { echo "$as_me:920:   former value:  $ac_old_val" >&5
 echo "$as_me:   former value:  $ac_old_val" >&2;}
-        { echo "$as_me:943:   current value: $ac_new_val" >&5
+        { echo "$as_me:922:   current value: $ac_new_val" >&5
 echo "$as_me:   current value: $ac_new_val" >&2;}
         ac_cache_corrupted=:
       fi;;
@@ -959,9 +938,9 @@
   fi
 done
 if $ac_cache_corrupted; then
-  { echo "$as_me:962: error: changes in the environment can compromise the build" >&5
+  { echo "$as_me:941: error: changes in the environment can compromise the build" >&5
 echo "$as_me: error: changes in the environment can compromise the build" >&2;}
-  { { echo "$as_me:964: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
+  { { echo "$as_me:943: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
 echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;}
    { (exit 1); exit 1; }; }
 fi
@@ -982,10 +961,10 @@
 echo "#! $SHELL" >conftest.sh
 echo  "exit 0"   >>conftest.sh
 chmod +x conftest.sh
-if { (echo "$as_me:985: PATH=\".;.\"; conftest.sh") >&5
+if { (echo "$as_me:964: PATH=\".;.\"; conftest.sh") >&5
   (PATH=".;."; conftest.sh) 2>&5
   ac_status=$?
-  echo "$as_me:988: \$? = $ac_status" >&5
+  echo "$as_me:967: \$? = $ac_status" >&5
   (exit $ac_status); }; then
   ac_path_separator=';'
 else
@@ -1017,7 +996,7 @@
   fi
 done
 if test -z "$ac_aux_dir"; then
-  { { echo "$as_me:1020: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5
+  { { echo "$as_me:999: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5
 echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;}
    { (exit 1); exit 1; }; }
 fi
@@ -1027,11 +1006,11 @@
 
 # Make sure we can run config.sub.
 $ac_config_sub sun4 >/dev/null 2>&1 ||
-  { { echo "$as_me:1030: error: cannot run $ac_config_sub" >&5
+  { { echo "$as_me:1009: error: cannot run $ac_config_sub" >&5
 echo "$as_me: error: cannot run $ac_config_sub" >&2;}
    { (exit 1); exit 1; }; }
 
-echo "$as_me:1034: checking build system type" >&5
+echo "$as_me:1013: checking build system type" >&5
 echo $ECHO_N "checking build system type... $ECHO_C" >&6
 if test "${ac_cv_build+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -1040,16 +1019,16 @@
 test -z "$ac_cv_build_alias" &&
   ac_cv_build_alias=`$ac_config_guess`
 test -z "$ac_cv_build_alias" &&
-  { { echo "$as_me:1043: error: cannot guess build type; you must specify one" >&5
+  { { echo "$as_me:1022: error: cannot guess build type; you must specify one" >&5
 echo "$as_me: error: cannot guess build type; you must specify one" >&2;}
    { (exit 1); exit 1; }; }
 ac_cv_build=`$ac_config_sub $ac_cv_build_alias` ||
-  { { echo "$as_me:1047: error: $ac_config_sub $ac_cv_build_alias failed." >&5
+  { { echo "$as_me:1026: error: $ac_config_sub $ac_cv_build_alias failed." >&5
 echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed." >&2;}
    { (exit 1); exit 1; }; }
 
 fi
-echo "$as_me:1052: result: $ac_cv_build" >&5
+echo "$as_me:1031: result: $ac_cv_build" >&5
 echo "${ECHO_T}$ac_cv_build" >&6
 build=$ac_cv_build
 build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
@@ -1057,7 +1036,7 @@
 build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
 
 if test -f $srcdir/config.guess || test -f $ac_aux_dir/config.guess ; then
-	echo "$as_me:1060: checking host system type" >&5
+	echo "$as_me:1039: checking host system type" >&5
 echo $ECHO_N "checking host system type... $ECHO_C" >&6
 if test "${ac_cv_host+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -1066,12 +1045,12 @@
 test -z "$ac_cv_host_alias" &&
   ac_cv_host_alias=$ac_cv_build_alias
 ac_cv_host=`$ac_config_sub $ac_cv_host_alias` ||
-  { { echo "$as_me:1069: error: $ac_config_sub $ac_cv_host_alias failed" >&5
+  { { echo "$as_me:1048: error: $ac_config_sub $ac_cv_host_alias failed" >&5
 echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;}
    { (exit 1); exit 1; }; }
 
 fi
-echo "$as_me:1074: result: $ac_cv_host" >&5
+echo "$as_me:1053: result: $ac_cv_host" >&5
 echo "${ECHO_T}$ac_cv_host" >&6
 host=$ac_cv_host
 host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
@@ -1085,7 +1064,8 @@
 		system_name="`(hostname) 2>/dev/null`"
 	fi
 fi
-test -n "$system_name" && cat >>confdefs.h <<EOF
+test -n "$system_name" &&
+cat >>confdefs.h <<EOF
 #define SYSTEM_NAME "$system_name"
 EOF
 
@@ -1096,13 +1076,13 @@
 fi
 
 test -z "$system_name" && system_name="$cf_cv_system_name"
-test -n "$cf_cv_system_name" && echo "$as_me:1099: result: Configuring for $cf_cv_system_name" >&5
+test -n "$cf_cv_system_name" && echo "$as_me:1079: result: Configuring for $cf_cv_system_name" >&5
 echo "${ECHO_T}Configuring for $cf_cv_system_name" >&6
 
 if test ".$system_name" != ".$cf_cv_system_name" ; then
-	echo "$as_me:1103: result: Cached system name ($system_name) does not agree with actual ($cf_cv_system_name)" >&5
+	echo "$as_me:1083: result: Cached system name ($system_name) does not agree with actual ($cf_cv_system_name)" >&5
 echo "${ECHO_T}Cached system name ($system_name) does not agree with actual ($cf_cv_system_name)" >&6
-	{ { echo "$as_me:1105: error: \"Please remove config.cache and try again.\"" >&5
+	{ { echo "$as_me:1085: error: \"Please remove config.cache and try again.\"" >&5
 echo "$as_me: error: \"Please remove config.cache and try again.\"" >&2;}
    { (exit 1); exit 1; }; }
 fi
@@ -1120,7 +1100,7 @@
 program_transform_name=`echo $program_transform_name | sed -f conftest.sed`
 rm conftest.sed
 
-echo "$as_me:1123: checking whether ${MAKE-make} sets \${MAKE}" >&5
+echo "$as_me:1103: checking whether ${MAKE-make} sets \${MAKE}" >&5
 echo $ECHO_N "checking whether ${MAKE-make} sets \${MAKE}... $ECHO_C" >&6
 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,./+-,__p_,'`
 if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then
@@ -1140,11 +1120,11 @@
 rm -f conftest.make
 fi
 if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then
-  echo "$as_me:1143: result: yes" >&5
+  echo "$as_me:1123: result: yes" >&5
 echo "${ECHO_T}yes" >&6
   SET_MAKE=
 else
-  echo "$as_me:1147: result: no" >&5
+  echo "$as_me:1127: result: no" >&5
 echo "${ECHO_T}no" >&6
   SET_MAKE="MAKE=${MAKE-make}"
 fi
@@ -1158,7 +1138,7 @@
 if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
 set dummy ${ac_tool_prefix}gcc; ac_word=$2
-echo "$as_me:1161: checking for $ac_word" >&5
+echo "$as_me:1141: checking for $ac_word" >&5
 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
 if test "${ac_cv_prog_CC+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -1173,7 +1153,7 @@
   test -z "$ac_dir" && ac_dir=.
   $as_executable_p "$ac_dir/$ac_word" || continue
 ac_cv_prog_CC="${ac_tool_prefix}gcc"
-echo "$as_me:1176: found $ac_dir/$ac_word" >&5
+echo "$as_me:1156: found $ac_dir/$ac_word" >&5
 break
 done
 
@@ -1181,10 +1161,10 @@
 fi
 CC=$ac_cv_prog_CC
 if test -n "$CC"; then
-  echo "$as_me:1184: result: $CC" >&5
+  echo "$as_me:1164: result: $CC" >&5
 echo "${ECHO_T}$CC" >&6
 else
-  echo "$as_me:1187: result: no" >&5
+  echo "$as_me:1167: result: no" >&5
 echo "${ECHO_T}no" >&6
 fi
 
@@ -1193,7 +1173,7 @@
   ac_ct_CC=$CC
   # Extract the first word of "gcc", so it can be a program name with args.
 set dummy gcc; ac_word=$2
-echo "$as_me:1196: checking for $ac_word" >&5
+echo "$as_me:1176: checking for $ac_word" >&5
 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -1208,7 +1188,7 @@
   test -z "$ac_dir" && ac_dir=.
   $as_executable_p "$ac_dir/$ac_word" || continue
 ac_cv_prog_ac_ct_CC="gcc"
-echo "$as_me:1211: found $ac_dir/$ac_word" >&5
+echo "$as_me:1191: found $ac_dir/$ac_word" >&5
 break
 done
 
@@ -1216,10 +1196,10 @@
 fi
 ac_ct_CC=$ac_cv_prog_ac_ct_CC
 if test -n "$ac_ct_CC"; then
-  echo "$as_me:1219: result: $ac_ct_CC" >&5
+  echo "$as_me:1199: result: $ac_ct_CC" >&5
 echo "${ECHO_T}$ac_ct_CC" >&6
 else
-  echo "$as_me:1222: result: no" >&5
+  echo "$as_me:1202: result: no" >&5
 echo "${ECHO_T}no" >&6
 fi
 
@@ -1232,7 +1212,7 @@
   if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
 set dummy ${ac_tool_prefix}cc; ac_word=$2
-echo "$as_me:1235: checking for $ac_word" >&5
+echo "$as_me:1215: checking for $ac_word" >&5
 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
 if test "${ac_cv_prog_CC+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -1247,7 +1227,7 @@
   test -z "$ac_dir" && ac_dir=.
   $as_executable_p "$ac_dir/$ac_word" || continue
 ac_cv_prog_CC="${ac_tool_prefix}cc"
-echo "$as_me:1250: found $ac_dir/$ac_word" >&5
+echo "$as_me:1230: found $ac_dir/$ac_word" >&5
 break
 done
 
@@ -1255,10 +1235,10 @@
 fi
 CC=$ac_cv_prog_CC
 if test -n "$CC"; then
-  echo "$as_me:1258: result: $CC" >&5
+  echo "$as_me:1238: result: $CC" >&5
 echo "${ECHO_T}$CC" >&6
 else
-  echo "$as_me:1261: result: no" >&5
+  echo "$as_me:1241: result: no" >&5
 echo "${ECHO_T}no" >&6
 fi
 
@@ -1267,7 +1247,7 @@
   ac_ct_CC=$CC
   # Extract the first word of "cc", so it can be a program name with args.
 set dummy cc; ac_word=$2
-echo "$as_me:1270: checking for $ac_word" >&5
+echo "$as_me:1250: checking for $ac_word" >&5
 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -1282,7 +1262,7 @@
   test -z "$ac_dir" && ac_dir=.
   $as_executable_p "$ac_dir/$ac_word" || continue
 ac_cv_prog_ac_ct_CC="cc"
-echo "$as_me:1285: found $ac_dir/$ac_word" >&5
+echo "$as_me:1265: found $ac_dir/$ac_word" >&5
 break
 done
 
@@ -1290,10 +1270,10 @@
 fi
 ac_ct_CC=$ac_cv_prog_ac_ct_CC
 if test -n "$ac_ct_CC"; then
-  echo "$as_me:1293: result: $ac_ct_CC" >&5
+  echo "$as_me:1273: result: $ac_ct_CC" >&5
 echo "${ECHO_T}$ac_ct_CC" >&6
 else
-  echo "$as_me:1296: result: no" >&5
+  echo "$as_me:1276: result: no" >&5
 echo "${ECHO_T}no" >&6
 fi
 
@@ -1306,7 +1286,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 "$as_me:1309: checking for $ac_word" >&5
+echo "$as_me:1289: checking for $ac_word" >&5
 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
 if test "${ac_cv_prog_CC+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -1326,7 +1306,7 @@
   continue
 fi
 ac_cv_prog_CC="cc"
-echo "$as_me:1329: found $ac_dir/$ac_word" >&5
+echo "$as_me:1309: found $ac_dir/$ac_word" >&5
 break
 done
 
@@ -1348,10 +1328,10 @@
 fi
 CC=$ac_cv_prog_CC
 if test -n "$CC"; then
-  echo "$as_me:1351: result: $CC" >&5
+  echo "$as_me:1331: result: $CC" >&5
 echo "${ECHO_T}$CC" >&6
 else
-  echo "$as_me:1354: result: no" >&5
+  echo "$as_me:1334: result: no" >&5
 echo "${ECHO_T}no" >&6
 fi
 
@@ -1362,7 +1342,7 @@
   do
     # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
 set dummy $ac_tool_prefix$ac_prog; ac_word=$2
-echo "$as_me:1365: checking for $ac_word" >&5
+echo "$as_me:1345: checking for $ac_word" >&5
 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
 if test "${ac_cv_prog_CC+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -1377,7 +1357,7 @@
   test -z "$ac_dir" && ac_dir=.
   $as_executable_p "$ac_dir/$ac_word" || continue
 ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
-echo "$as_me:1380: found $ac_dir/$ac_word" >&5
+echo "$as_me:1360: found $ac_dir/$ac_word" >&5
 break
 done
 
@@ -1385,10 +1365,10 @@
 fi
 CC=$ac_cv_prog_CC
 if test -n "$CC"; then
-  echo "$as_me:1388: result: $CC" >&5
+  echo "$as_me:1368: result: $CC" >&5
 echo "${ECHO_T}$CC" >&6
 else
-  echo "$as_me:1391: result: no" >&5
+  echo "$as_me:1371: result: no" >&5
 echo "${ECHO_T}no" >&6
 fi
 
@@ -1401,7 +1381,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 "$as_me:1404: checking for $ac_word" >&5
+echo "$as_me:1384: checking for $ac_word" >&5
 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -1416,7 +1396,7 @@
   test -z "$ac_dir" && ac_dir=.
   $as_executable_p "$ac_dir/$ac_word" || continue
 ac_cv_prog_ac_ct_CC="$ac_prog"
-echo "$as_me:1419: found $ac_dir/$ac_word" >&5
+echo "$as_me:1399: found $ac_dir/$ac_word" >&5
 break
 done
 
@@ -1424,10 +1404,10 @@
 fi
 ac_ct_CC=$ac_cv_prog_ac_ct_CC
 if test -n "$ac_ct_CC"; then
-  echo "$as_me:1427: result: $ac_ct_CC" >&5
+  echo "$as_me:1407: result: $ac_ct_CC" >&5
 echo "${ECHO_T}$ac_ct_CC" >&6
 else
-  echo "$as_me:1430: result: no" >&5
+  echo "$as_me:1410: result: no" >&5
 echo "${ECHO_T}no" >&6
 fi
 
@@ -1439,32 +1419,32 @@
 
 fi
 
-test -z "$CC" && { { echo "$as_me:1442: error: no acceptable cc found in \$PATH" >&5
+test -z "$CC" && { { echo "$as_me:1422: error: no acceptable cc found in \$PATH" >&5
 echo "$as_me: error: no acceptable cc found in \$PATH" >&2;}
    { (exit 1); exit 1; }; }
 
 # Provide some information about the compiler.
-echo "$as_me:1447:" \
+echo "$as_me:1427:" \
      "checking for C compiler version" >&5
 ac_compiler=`set X $ac_compile; echo $2`
-{ (eval echo "$as_me:1450: \"$ac_compiler --version </dev/null >&5\"") >&5
+{ (eval echo "$as_me:1430: \"$ac_compiler --version </dev/null >&5\"") >&5
   (eval $ac_compiler --version </dev/null >&5) 2>&5
   ac_status=$?
-  echo "$as_me:1453: \$? = $ac_status" >&5
+  echo "$as_me:1433: \$? = $ac_status" >&5
   (exit $ac_status); }
-{ (eval echo "$as_me:1455: \"$ac_compiler -v </dev/null >&5\"") >&5
+{ (eval echo "$as_me:1435: \"$ac_compiler -v </dev/null >&5\"") >&5
   (eval $ac_compiler -v </dev/null >&5) 2>&5
   ac_status=$?
-  echo "$as_me:1458: \$? = $ac_status" >&5
+  echo "$as_me:1438: \$? = $ac_status" >&5
   (exit $ac_status); }
-{ (eval echo "$as_me:1460: \"$ac_compiler -V </dev/null >&5\"") >&5
+{ (eval echo "$as_me:1440: \"$ac_compiler -V </dev/null >&5\"") >&5
   (eval $ac_compiler -V </dev/null >&5) 2>&5
   ac_status=$?
-  echo "$as_me:1463: \$? = $ac_status" >&5
+  echo "$as_me:1443: \$? = $ac_status" >&5
   (exit $ac_status); }
 
 cat >conftest.$ac_ext <<_ACEOF
-#line 1467 "configure"
+#line 1447 "configure"
 #include "confdefs.h"
 
 int
@@ -1480,13 +1460,13 @@
 # Try to create an executable without -o first, disregard a.out.
 # It will help us diagnose broken compilers, and finding out an intuition
 # of exeext.
-echo "$as_me:1483: checking for C compiler default output" >&5
+echo "$as_me:1463: checking for C compiler default output" >&5
 echo $ECHO_N "checking for C compiler default output... $ECHO_C" >&6
 ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
-if { (eval echo "$as_me:1486: \"$ac_link_default\"") >&5
+if { (eval echo "$as_me:1466: \"$ac_link_default\"") >&5
   (eval $ac_link_default) 2>&5
   ac_status=$?
-  echo "$as_me:1489: \$? = $ac_status" >&5
+  echo "$as_me:1469: \$? = $ac_status" >&5
   (exit $ac_status); }; then
   # Find the output, starting from the most likely.  This scheme is
 # not robust to junk in `.', hence go to wildcards (a.*) only as a last
@@ -1509,34 +1489,34 @@
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-{ { echo "$as_me:1512: error: C compiler cannot create executables" >&5
+{ { echo "$as_me:1492: error: C compiler cannot create executables" >&5
 echo "$as_me: error: C compiler cannot create executables" >&2;}
    { (exit 77); exit 77; }; }
 fi
 
 ac_exeext=$ac_cv_exeext
-echo "$as_me:1518: result: $ac_file" >&5
+echo "$as_me:1498: result: $ac_file" >&5
 echo "${ECHO_T}$ac_file" >&6
 
 # Check the compiler produces executables we can run.  If not, either
 # the compiler is broken, or we cross compile.
-echo "$as_me:1523: checking whether the C compiler works" >&5
+echo "$as_me:1503: checking whether the C compiler works" >&5
 echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6
 # FIXME: These cross compiler hacks should be removed for Autoconf 3.0
 # If not cross compiling, check that we can run a simple program.
 if test "$cross_compiling" != yes; then
   if { ac_try='./$ac_file'
-  { (eval echo "$as_me:1529: \"$ac_try\"") >&5
+  { (eval echo "$as_me:1509: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:1532: \$? = $ac_status" >&5
+  echo "$as_me:1512: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
     cross_compiling=no
   else
     if test "$cross_compiling" = maybe; then
 	cross_compiling=yes
     else
-	{ { echo "$as_me:1539: error: cannot run C compiled programs.
+	{ { echo "$as_me:1519: error: cannot run C compiled programs.
 If you meant to cross compile, use \`--host'." >&5
 echo "$as_me: error: cannot run C compiled programs.
 If you meant to cross compile, use \`--host'." >&2;}
@@ -1544,24 +1524,24 @@
     fi
   fi
 fi
-echo "$as_me:1547: result: yes" >&5
+echo "$as_me:1527: result: yes" >&5
 echo "${ECHO_T}yes" >&6
 
 rm -f a.out a.exe conftest$ac_cv_exeext
 ac_clean_files=$ac_clean_files_save
 # Check the compiler produces executables we can run.  If not, either
 # the compiler is broken, or we cross compile.
-echo "$as_me:1554: checking whether we are cross compiling" >&5
+echo "$as_me:1534: checking whether we are cross compiling" >&5
 echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6
-echo "$as_me:1556: result: $cross_compiling" >&5
+echo "$as_me:1536: result: $cross_compiling" >&5
 echo "${ECHO_T}$cross_compiling" >&6
 
-echo "$as_me:1559: checking for executable suffix" >&5
+echo "$as_me:1539: checking for executable suffix" >&5
 echo $ECHO_N "checking for executable suffix... $ECHO_C" >&6
-if { (eval echo "$as_me:1561: \"$ac_link\"") >&5
+if { (eval echo "$as_me:1541: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:1564: \$? = $ac_status" >&5
+  echo "$as_me:1544: \$? = $ac_status" >&5
   (exit $ac_status); }; then
   # If both `conftest.exe' and `conftest' are `present' (well, observable)
 # catch `conftest.exe'.  For instance with Cygwin, `ls conftest' will
@@ -1577,25 +1557,25 @@
   esac
 done
 else
-  { { echo "$as_me:1580: error: cannot compute EXEEXT: cannot compile and link" >&5
+  { { echo "$as_me:1560: error: cannot compute EXEEXT: cannot compile and link" >&5
 echo "$as_me: error: cannot compute EXEEXT: cannot compile and link" >&2;}
    { (exit 1); exit 1; }; }
 fi
 
 rm -f conftest$ac_cv_exeext
-echo "$as_me:1586: result: $ac_cv_exeext" >&5
+echo "$as_me:1566: result: $ac_cv_exeext" >&5
 echo "${ECHO_T}$ac_cv_exeext" >&6
 
 rm -f conftest.$ac_ext
 EXEEXT=$ac_cv_exeext
 ac_exeext=$EXEEXT
-echo "$as_me:1592: checking for object suffix" >&5
+echo "$as_me:1572: checking for object suffix" >&5
 echo $ECHO_N "checking for object suffix... $ECHO_C" >&6
 if test "${ac_cv_objext+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 1598 "configure"
+#line 1578 "configure"
 #include "confdefs.h"
 
 int
@@ -1607,10 +1587,10 @@
 }
 _ACEOF
 rm -f conftest.o conftest.obj
-if { (eval echo "$as_me:1610: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:1590: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:1613: \$? = $ac_status" >&5
+  echo "$as_me:1593: \$? = $ac_status" >&5
   (exit $ac_status); }; then
   for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do
   case $ac_file in
@@ -1622,24 +1602,24 @@
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-{ { echo "$as_me:1625: error: cannot compute OBJEXT: cannot compile" >&5
+{ { echo "$as_me:1605: error: cannot compute OBJEXT: cannot compile" >&5
 echo "$as_me: error: cannot compute OBJEXT: cannot compile" >&2;}
    { (exit 1); exit 1; }; }
 fi
 
 rm -f conftest.$ac_cv_objext conftest.$ac_ext
 fi
-echo "$as_me:1632: result: $ac_cv_objext" >&5
+echo "$as_me:1612: result: $ac_cv_objext" >&5
 echo "${ECHO_T}$ac_cv_objext" >&6
 OBJEXT=$ac_cv_objext
 ac_objext=$OBJEXT
-echo "$as_me:1636: checking whether we are using the GNU C compiler" >&5
+echo "$as_me:1616: checking whether we are using the GNU C compiler" >&5
 echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6
 if test "${ac_cv_c_compiler_gnu+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 1642 "configure"
+#line 1622 "configure"
 #include "confdefs.h"
 
 int
@@ -1654,16 +1634,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:1657: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:1637: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:1660: \$? = $ac_status" >&5
+  echo "$as_me:1640: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:1663: \"$ac_try\"") >&5
+  { (eval echo "$as_me:1643: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:1666: \$? = $ac_status" >&5
+  echo "$as_me:1646: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_compiler_gnu=yes
 else
@@ -1675,19 +1655,19 @@
 ac_cv_c_compiler_gnu=$ac_compiler_gnu
 
 fi
-echo "$as_me:1678: result: $ac_cv_c_compiler_gnu" >&5
+echo "$as_me:1658: result: $ac_cv_c_compiler_gnu" >&5
 echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6
 GCC=`test $ac_compiler_gnu = yes && echo yes`
 ac_test_CFLAGS=${CFLAGS+set}
 ac_save_CFLAGS=$CFLAGS
 CFLAGS="-g"
-echo "$as_me:1684: checking whether $CC accepts -g" >&5
+echo "$as_me:1664: checking whether $CC accepts -g" >&5
 echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6
 if test "${ac_cv_prog_cc_g+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 1690 "configure"
+#line 1670 "configure"
 #include "confdefs.h"
 
 int
@@ -1699,16 +1679,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:1702: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:1682: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:1705: \$? = $ac_status" >&5
+  echo "$as_me:1685: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:1708: \"$ac_try\"") >&5
+  { (eval echo "$as_me:1688: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:1711: \$? = $ac_status" >&5
+  echo "$as_me:1691: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_prog_cc_g=yes
 else
@@ -1718,7 +1698,7 @@
 fi
 rm -f conftest.$ac_objext conftest.$ac_ext
 fi
-echo "$as_me:1721: result: $ac_cv_prog_cc_g" >&5
+echo "$as_me:1701: result: $ac_cv_prog_cc_g" >&5
 echo "${ECHO_T}$ac_cv_prog_cc_g" >&6
 if test "$ac_test_CFLAGS" = set; then
   CFLAGS=$ac_save_CFLAGS
@@ -1745,16 +1725,16 @@
 #endif
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:1748: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:1728: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:1751: \$? = $ac_status" >&5
+  echo "$as_me:1731: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:1754: \"$ac_try\"") >&5
+  { (eval echo "$as_me:1734: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:1757: \$? = $ac_status" >&5
+  echo "$as_me:1737: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   for ac_declaration in \
    ''\
@@ -1766,7 +1746,7 @@
    'void exit (int);'
 do
   cat >conftest.$ac_ext <<_ACEOF
-#line 1769 "configure"
+#line 1749 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 $ac_declaration
@@ -1779,16 +1759,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:1782: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:1762: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:1785: \$? = $ac_status" >&5
+  echo "$as_me:1765: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:1788: \"$ac_try\"") >&5
+  { (eval echo "$as_me:1768: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:1791: \$? = $ac_status" >&5
+  echo "$as_me:1771: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   :
 else
@@ -1798,7 +1778,7 @@
 fi
 rm -f conftest.$ac_objext conftest.$ac_ext
   cat >conftest.$ac_ext <<_ACEOF
-#line 1801 "configure"
+#line 1781 "configure"
 #include "confdefs.h"
 $ac_declaration
 int
@@ -1810,16 +1790,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:1813: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:1793: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:1816: \$? = $ac_status" >&5
+  echo "$as_me:1796: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:1819: \"$ac_try\"") >&5
+  { (eval echo "$as_me:1799: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:1822: \$? = $ac_status" >&5
+  echo "$as_me:1802: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   break
 else
@@ -1847,13 +1827,214 @@
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
 ac_main_return=return
 
+GCC_VERSION=none
+if test "$GCC" = yes ; then
+	echo "$as_me:1832: checking version of $CC" >&5
+echo $ECHO_N "checking version of $CC... $ECHO_C" >&6
+	GCC_VERSION="`${CC} --version 2>/dev/null | sed -e '2,$d' -e 's/^.*(GCC[^)]*) //' -e 's/^.*(Debian[^)]*) //' -e 's/^[^0-9.]*//' -e 's/[^0-9.].*//'`"
+	test -z "$GCC_VERSION" && GCC_VERSION=unknown
+	echo "$as_me:1836: result: $GCC_VERSION" >&5
+echo "${ECHO_T}$GCC_VERSION" >&6
+fi
+
+echo "$as_me:1840: checking for $CC option to accept ANSI C" >&5
+echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6
+if test "${ac_cv_prog_cc_stdc+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_prog_cc_stdc=no
+ac_save_CC=$CC
+cat >conftest.$ac_ext <<_ACEOF
+#line 1848 "configure"
+#include "confdefs.h"
+#include <stdarg.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+     char **p;
+     int i;
+{
+  return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+  char *s;
+  va_list v;
+  va_start (v,p);
+  s = g (p, va_arg (v,int));
+  va_end (v);
+  return s;
+}
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
+int argc;
+char **argv;
+int
+main ()
+{
+return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
+  ;
+  return 0;
+}
+_ACEOF
+# Don't try gcc -ansi; that turns off useful extensions and
+# breaks some systems' header files.
+# AIX			-qlanglvl=ansi
+# Ultrix and OSF/1	-std1
+# HP-UX 10.20 and later	-Ae
+# HP-UX older versions	-Aa -D_HPUX_SOURCE
+# SVR4			-Xc -D__EXTENSIONS__
+for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+  CC="$ac_save_CC $ac_arg"
+  rm -f conftest.$ac_objext
+if { (eval echo "$as_me:1897: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:1900: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:1903: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:1906: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_prog_cc_stdc=$ac_arg
+break
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+fi
+rm -f conftest.$ac_objext
+done
+rm -f conftest.$ac_ext conftest.$ac_objext
+CC=$ac_save_CC
+
+fi
+
+case "x$ac_cv_prog_cc_stdc" in
+  x|xno)
+    echo "$as_me:1923: result: none needed" >&5
+echo "${ECHO_T}none needed" >&6 ;;
+  *)
+    echo "$as_me:1926: result: $ac_cv_prog_cc_stdc" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6
+    CC="$CC $ac_cv_prog_cc_stdc" ;;
+esac
+
+# This should have been defined by AC_PROG_CC
+: ${CC:=cc}
+
+echo "$as_me:1934: checking \$CC variable" >&5
+echo $ECHO_N "checking \$CC variable... $ECHO_C" >&6
+case "$CC" in #(vi
+*[\ \	]-[IUD]*)
+	echo "$as_me:1938: result: broken" >&5
+echo "${ECHO_T}broken" >&6
+	{ echo "$as_me:1940: WARNING: your environment misuses the CC variable to hold CFLAGS/CPPFLAGS options" >&5
+echo "$as_me: WARNING: your environment misuses the CC variable to hold CFLAGS/CPPFLAGS options" >&2;}
+	# humor him...
+	cf_flags=`echo "$CC" | sed -e 's/^[^ 	]*[ 	]//'`
+	CC=`echo "$CC" | sed -e 's/[ 	].*//'`
+
+cf_fix_cppflags=no
+cf_new_cflags=
+cf_new_cppflags=
+cf_new_extra_cppflags=
+
+for cf_add_cflags in $cf_flags
+do
+case $cf_fix_cppflags in
+no)
+	case $cf_add_cflags in #(vi
+	-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi
+		case $cf_add_cflags in
+		-D*)
+			cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'`
+
+			test "${cf_add_cflags}" != "${cf_tst_cflags}" \
+				&& test -z "${cf_tst_cflags}" \
+				&& cf_fix_cppflags=yes
+
+			if test $cf_fix_cppflags = yes ; then
+				cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
+				continue
+			elif test "${cf_tst_cflags}" = "\"'" ; then
+				cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
+				continue
+			fi
+			;;
+		esac
+		case "$CPPFLAGS" in
+		*$cf_add_cflags) #(vi
+			;;
+		*) #(vi
+			case $cf_add_cflags in #(vi
+			-D*)
+				cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'`
+
+CPPFLAGS=`echo "$CPPFLAGS" | \
+	sed	-e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ 	]*\)\?[ 	]/ /g' \
+		-e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ 	]*\)\?$//g'`
+
+				;;
+			esac
+			cf_new_cppflags="$cf_new_cppflags $cf_add_cflags"
+			;;
+		esac
+		;;
+	*)
+		cf_new_cflags="$cf_new_cflags $cf_add_cflags"
+		;;
+	esac
+	;;
+yes)
+	cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
+
+	cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'`
+
+	test "${cf_add_cflags}" != "${cf_tst_cflags}" \
+		&& test -z "${cf_tst_cflags}" \
+		&& cf_fix_cppflags=no
+	;;
+esac
+done
+
+if test -n "$cf_new_cflags" ; then
+
+	CFLAGS="$CFLAGS $cf_new_cflags"
+fi
+
+if test -n "$cf_new_cppflags" ; then
+
+	CPPFLAGS="$CPPFLAGS $cf_new_cppflags"
+fi
+
+if test -n "$cf_new_extra_cppflags" ; then
+
+	EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS"
+fi
+
+	;;
+*)
+	echo "$as_me:2026: result: ok" >&5
+echo "${ECHO_T}ok" >&6
+	;;
+esac
+
 ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
 ac_main_return=return
-echo "$as_me:1856: checking how to run the C preprocessor" >&5
+echo "$as_me:2037: checking how to run the C preprocessor" >&5
 echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6
 # On Suns, sometimes $CPP names a directory.
 if test -n "$CPP" && test -d "$CPP"; then
@@ -1874,18 +2055,18 @@
   # On the NeXT, cc -E runs the code through the compiler's parser,
   # not just through cpp. "Syntax error" is here to catch this case.
   cat >conftest.$ac_ext <<_ACEOF
-#line 1877 "configure"
+#line 2058 "configure"
 #include "confdefs.h"
 #include <assert.h>
                      Syntax error
 _ACEOF
-if { (eval echo "$as_me:1882: \"$ac_cpp conftest.$ac_ext\"") >&5
+if { (eval echo "$as_me:2063: \"$ac_cpp conftest.$ac_ext\"") >&5
   (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
   ac_status=$?
   egrep -v '^ *\+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
-  echo "$as_me:1888: \$? = $ac_status" >&5
+  echo "$as_me:2069: \$? = $ac_status" >&5
   (exit $ac_status); } >/dev/null; then
   if test -s conftest.err; then
     ac_cpp_err=$ac_c_preproc_warn_flag
@@ -1908,17 +2089,17 @@
   # OK, works on sane cases.  Now check whether non-existent headers
   # can be detected and how.
   cat >conftest.$ac_ext <<_ACEOF
-#line 1911 "configure"
+#line 2092 "configure"
 #include "confdefs.h"
 #include <ac_nonexistent.h>
 _ACEOF
-if { (eval echo "$as_me:1915: \"$ac_cpp conftest.$ac_ext\"") >&5
+if { (eval echo "$as_me:2096: \"$ac_cpp conftest.$ac_ext\"") >&5
   (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
   ac_status=$?
   egrep -v '^ *\+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
-  echo "$as_me:1921: \$? = $ac_status" >&5
+  echo "$as_me:2102: \$? = $ac_status" >&5
   (exit $ac_status); } >/dev/null; then
   if test -s conftest.err; then
     ac_cpp_err=$ac_c_preproc_warn_flag
@@ -1955,7 +2136,7 @@
 else
   ac_cv_prog_CPP=$CPP
 fi
-echo "$as_me:1958: result: $CPP" >&5
+echo "$as_me:2139: result: $CPP" >&5
 echo "${ECHO_T}$CPP" >&6
 ac_preproc_ok=false
 for ac_c_preproc_warn_flag in '' yes
@@ -1965,18 +2146,18 @@
   # On the NeXT, cc -E runs the code through the compiler's parser,
   # not just through cpp. "Syntax error" is here to catch this case.
   cat >conftest.$ac_ext <<_ACEOF
-#line 1968 "configure"
+#line 2149 "configure"
 #include "confdefs.h"
 #include <assert.h>
                      Syntax error
 _ACEOF
-if { (eval echo "$as_me:1973: \"$ac_cpp conftest.$ac_ext\"") >&5
+if { (eval echo "$as_me:2154: \"$ac_cpp conftest.$ac_ext\"") >&5
   (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
   ac_status=$?
   egrep -v '^ *\+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
-  echo "$as_me:1979: \$? = $ac_status" >&5
+  echo "$as_me:2160: \$? = $ac_status" >&5
   (exit $ac_status); } >/dev/null; then
   if test -s conftest.err; then
     ac_cpp_err=$ac_c_preproc_warn_flag
@@ -1999,17 +2180,17 @@
   # OK, works on sane cases.  Now check whether non-existent headers
   # can be detected and how.
   cat >conftest.$ac_ext <<_ACEOF
-#line 2002 "configure"
+#line 2183 "configure"
 #include "confdefs.h"
 #include <ac_nonexistent.h>
 _ACEOF
-if { (eval echo "$as_me:2006: \"$ac_cpp conftest.$ac_ext\"") >&5
+if { (eval echo "$as_me:2187: \"$ac_cpp conftest.$ac_ext\"") >&5
   (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
   ac_status=$?
   egrep -v '^ *\+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
-  echo "$as_me:2012: \$? = $ac_status" >&5
+  echo "$as_me:2193: \$? = $ac_status" >&5
   (exit $ac_status); } >/dev/null; then
   if test -s conftest.err; then
     ac_cpp_err=$ac_c_preproc_warn_flag
@@ -2037,7 +2218,7 @@
 if $ac_preproc_ok; then
   :
 else
-  { { echo "$as_me:2040: error: C preprocessor \"$CPP\" fails sanity check" >&5
+  { { echo "$as_me:2221: error: C preprocessor \"$CPP\" fails sanity check" >&5
 echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check" >&2;}
    { (exit 1); exit 1; }; }
 fi
@@ -2053,7 +2234,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 "$as_me:2056: checking for $ac_word" >&5
+echo "$as_me:2237: checking for $ac_word" >&5
 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
 if test "${ac_cv_prog_AWK+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -2068,7 +2249,7 @@
   test -z "$ac_dir" && ac_dir=.
   $as_executable_p "$ac_dir/$ac_word" || continue
 ac_cv_prog_AWK="$ac_prog"
-echo "$as_me:2071: found $ac_dir/$ac_word" >&5
+echo "$as_me:2252: found $ac_dir/$ac_word" >&5
 break
 done
 
@@ -2076,10 +2257,10 @@
 fi
 AWK=$ac_cv_prog_AWK
 if test -n "$AWK"; then
-  echo "$as_me:2079: result: $AWK" >&5
+  echo "$as_me:2260: result: $AWK" >&5
 echo "${ECHO_T}$AWK" >&6
 else
-  echo "$as_me:2082: result: no" >&5
+  echo "$as_me:2263: result: no" >&5
 echo "${ECHO_T}no" >&6
 fi
 
@@ -2098,7 +2279,7 @@
 # AFS /usr/afsws/bin/install, which mishandles nonexistent args
 # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
 # ./install, which can be erroneously created by make from ./install.sh.
-echo "$as_me:2101: checking for a BSD compatible install" >&5
+echo "$as_me:2282: checking for a BSD compatible install" >&5
 echo $ECHO_N "checking for a BSD compatible install... $ECHO_C" >&6
 if test -z "$INSTALL"; then
 if test "${ac_cv_path_install+set}" = set; then
@@ -2147,7 +2328,7 @@
     INSTALL=$ac_install_sh
   fi
 fi
-echo "$as_me:2150: result: $INSTALL" >&5
+echo "$as_me:2331: result: $INSTALL" >&5
 echo "${ECHO_T}$INSTALL" >&6
 
 # Use test -z because SunOS4 sh mishandles braces in ${var-val}.
@@ -2172,7 +2353,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 "$as_me:2175: checking for $ac_word" >&5
+echo "$as_me:2356: checking for $ac_word" >&5
 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
 if test "${ac_cv_prog_LINT+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -2187,7 +2368,7 @@
   test -z "$ac_dir" && ac_dir=.
   $as_executable_p "$ac_dir/$ac_word" || continue
 ac_cv_prog_LINT="$ac_prog"
-echo "$as_me:2190: found $ac_dir/$ac_word" >&5
+echo "$as_me:2371: found $ac_dir/$ac_word" >&5
 break
 done
 
@@ -2195,17 +2376,17 @@
 fi
 LINT=$ac_cv_prog_LINT
 if test -n "$LINT"; then
-  echo "$as_me:2198: result: $LINT" >&5
+  echo "$as_me:2379: result: $LINT" >&5
 echo "${ECHO_T}$LINT" >&6
 else
-  echo "$as_me:2201: result: no" >&5
+  echo "$as_me:2382: result: no" >&5
 echo "${ECHO_T}no" >&6
 fi
 
   test -n "$LINT" && break
 done
 
-echo "$as_me:2208: checking if filesystem supports mixed-case filenames" >&5
+echo "$as_me:2389: checking if filesystem supports mixed-case filenames" >&5
 echo $ECHO_N "checking if filesystem supports mixed-case filenames... $ECHO_C" >&6
 if test "${cf_cv_mixedcase+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -2232,9 +2413,10 @@
 fi
 
 fi
-echo "$as_me:2235: result: $cf_cv_mixedcase" >&5
+echo "$as_me:2416: result: $cf_cv_mixedcase" >&5
 echo "${ECHO_T}$cf_cv_mixedcase" >&6
-test "$cf_cv_mixedcase" = yes && cat >>confdefs.h <<\EOF
+test "$cf_cv_mixedcase" = yes &&
+cat >>confdefs.h <<\EOF
 #define MIXEDCASE_FILENAMES 1
 EOF
 
@@ -2242,7 +2424,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 "$as_me:2245: checking for $ac_word" >&5
+echo "$as_me:2427: checking for $ac_word" >&5
 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
 if test "${ac_cv_prog_CTAGS+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -2257,7 +2439,7 @@
   test -z "$ac_dir" && ac_dir=.
   $as_executable_p "$ac_dir/$ac_word" || continue
 ac_cv_prog_CTAGS="$ac_prog"
-echo "$as_me:2260: found $ac_dir/$ac_word" >&5
+echo "$as_me:2442: found $ac_dir/$ac_word" >&5
 break
 done
 
@@ -2265,10 +2447,10 @@
 fi
 CTAGS=$ac_cv_prog_CTAGS
 if test -n "$CTAGS"; then
-  echo "$as_me:2268: result: $CTAGS" >&5
+  echo "$as_me:2450: result: $CTAGS" >&5
 echo "${ECHO_T}$CTAGS" >&6
 else
-  echo "$as_me:2271: result: no" >&5
+  echo "$as_me:2453: result: no" >&5
 echo "${ECHO_T}no" >&6
 fi
 
@@ -2279,7 +2461,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 "$as_me:2282: checking for $ac_word" >&5
+echo "$as_me:2464: checking for $ac_word" >&5
 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
 if test "${ac_cv_prog_ETAGS+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -2294,7 +2476,7 @@
   test -z "$ac_dir" && ac_dir=.
   $as_executable_p "$ac_dir/$ac_word" || continue
 ac_cv_prog_ETAGS="$ac_prog"
-echo "$as_me:2297: found $ac_dir/$ac_word" >&5
+echo "$as_me:2479: found $ac_dir/$ac_word" >&5
 break
 done
 
@@ -2302,10 +2484,10 @@
 fi
 ETAGS=$ac_cv_prog_ETAGS
 if test -n "$ETAGS"; then
-  echo "$as_me:2305: result: $ETAGS" >&5
+  echo "$as_me:2487: result: $ETAGS" >&5
 echo "${ECHO_T}$ETAGS" >&6
 else
-  echo "$as_me:2308: result: no" >&5
+  echo "$as_me:2490: result: no" >&5
 echo "${ECHO_T}no" >&6
 fi
 
@@ -2314,7 +2496,7 @@
 
 # Extract the first word of "${CTAGS:-ctags}", so it can be a program name with args.
 set dummy ${CTAGS:-ctags}; ac_word=$2
-echo "$as_me:2317: checking for $ac_word" >&5
+echo "$as_me:2499: checking for $ac_word" >&5
 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
 if test "${ac_cv_prog_MAKE_LOWER_TAGS+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -2329,7 +2511,7 @@
   test -z "$ac_dir" && ac_dir=.
   $as_executable_p "$ac_dir/$ac_word" || continue
 ac_cv_prog_MAKE_LOWER_TAGS="yes"
-echo "$as_me:2332: found $ac_dir/$ac_word" >&5
+echo "$as_me:2514: found $ac_dir/$ac_word" >&5
 break
 done
 
@@ -2338,17 +2520,17 @@
 fi
 MAKE_LOWER_TAGS=$ac_cv_prog_MAKE_LOWER_TAGS
 if test -n "$MAKE_LOWER_TAGS"; then
-  echo "$as_me:2341: result: $MAKE_LOWER_TAGS" >&5
+  echo "$as_me:2523: result: $MAKE_LOWER_TAGS" >&5
 echo "${ECHO_T}$MAKE_LOWER_TAGS" >&6
 else
-  echo "$as_me:2344: result: no" >&5
+  echo "$as_me:2526: result: no" >&5
 echo "${ECHO_T}no" >&6
 fi
 
 if test "$cf_cv_mixedcase" = yes ; then
 	# Extract the first word of "${ETAGS:-etags}", so it can be a program name with args.
 set dummy ${ETAGS:-etags}; ac_word=$2
-echo "$as_me:2351: checking for $ac_word" >&5
+echo "$as_me:2533: checking for $ac_word" >&5
 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
 if test "${ac_cv_prog_MAKE_UPPER_TAGS+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -2363,7 +2545,7 @@
   test -z "$ac_dir" && ac_dir=.
   $as_executable_p "$ac_dir/$ac_word" || continue
 ac_cv_prog_MAKE_UPPER_TAGS="yes"
-echo "$as_me:2366: found $ac_dir/$ac_word" >&5
+echo "$as_me:2548: found $ac_dir/$ac_word" >&5
 break
 done
 
@@ -2372,10 +2554,10 @@
 fi
 MAKE_UPPER_TAGS=$ac_cv_prog_MAKE_UPPER_TAGS
 if test -n "$MAKE_UPPER_TAGS"; then
-  echo "$as_me:2375: result: $MAKE_UPPER_TAGS" >&5
+  echo "$as_me:2557: result: $MAKE_UPPER_TAGS" >&5
 echo "${ECHO_T}$MAKE_UPPER_TAGS" >&6
 else
-  echo "$as_me:2378: result: no" >&5
+  echo "$as_me:2560: result: no" >&5
 echo "${ECHO_T}no" >&6
 fi
 
@@ -2395,14 +2577,14 @@
 	MAKE_LOWER_TAGS="#"
 fi
 
-echo "$as_me:2398: checking if -lm needed for math functions" >&5
+echo "$as_me:2580: checking if -lm needed for math functions" >&5
 echo $ECHO_N "checking if -lm needed for math functions... $ECHO_C" >&6
 if test "${cf_cv_need_libm+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
 
 	cat >conftest.$ac_ext <<_ACEOF
-#line 2405 "configure"
+#line 2587 "configure"
 #include "confdefs.h"
 
 	#include <stdio.h>
@@ -2417,16 +2599,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:2420: \"$ac_link\"") >&5
+if { (eval echo "$as_me:2602: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:2423: \$? = $ac_status" >&5
+  echo "$as_me:2605: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:2426: \"$ac_try\"") >&5
+  { (eval echo "$as_me:2608: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:2429: \$? = $ac_status" >&5
+  echo "$as_me:2611: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   cf_cv_need_libm=no
 else
@@ -2436,13 +2618,15 @@
 fi
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 fi
-echo "$as_me:2439: result: $cf_cv_need_libm" >&5
+echo "$as_me:2621: result: $cf_cv_need_libm" >&5
 echo "${ECHO_T}$cf_cv_need_libm" >&6
 if test "$cf_cv_need_libm" = yes
 then
 MATH_LIB=-lm
 fi
 
+top_builddir=`pwd`
+
 CC_G_OPT="-g"
 CC_SHARED_OPTS=unknown
 CPPFLAGS="$CPPFLAGS"
@@ -2464,427 +2648,304 @@
 TEST_ARGS=""
 TEST_DEPS=""
 TEST_LIBS=""
-TINFO_ARGS='$(LIBS_CURSES)'
+TINFO_LDFLAGS=''
+TINFO_LIBS='$(LIBS_CURSES)'
 cf_cv_abi_version=""
 cf_cv_rel_version=""
 
 cf_cv_screen=curses
 cf_cv_libtype=
 
-echo "$as_me:2474: checking for ${CC:-cc} option to accept ANSI C" >&5
-echo $ECHO_N "checking for ${CC:-cc} option to accept ANSI C... $ECHO_C" >&6
-if test "${cf_cv_ansi_cc+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
+if test "$GCC" = yes
+then
+cat > conftest.i <<EOF
+#ifndef GCC_PRINTF
+#define GCC_PRINTF 0
+#endif
+#ifndef GCC_SCANF
+#define GCC_SCANF 0
+#endif
+#ifndef GCC_NORETURN
+#define GCC_NORETURN /* nothing */
+#endif
+#ifndef GCC_UNUSED
+#define GCC_UNUSED /* nothing */
+#endif
+EOF
+if test "$GCC" = yes
+then
+	{ echo "$as_me:2677: checking for $CC __attribute__ directives..." >&5
+echo "$as_me: checking for $CC __attribute__ directives..." >&6;}
+cat > conftest.$ac_ext <<EOF
+#line 2680 "${as_me:-configure}"
+#include "confdefs.h"
+#include "conftest.h"
+#include "conftest.i"
+#if	GCC_PRINTF
+#define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var)))
+#else
+#define GCC_PRINTFLIKE(fmt,var) /*nothing*/
+#endif
+#if	GCC_SCANF
+#define GCC_SCANFLIKE(fmt,var)  __attribute__((format(scanf,fmt,var)))
+#else
+#define GCC_SCANFLIKE(fmt,var)  /*nothing*/
+#endif
+extern void wow(char *,...) GCC_SCANFLIKE(1,2);
+extern void oops(char *,...) GCC_PRINTFLIKE(1,2) GCC_NORETURN;
+extern void foo(void) GCC_NORETURN;
+int main(int argc GCC_UNUSED, char *argv[] GCC_UNUSED) { return 0; }
+EOF
+	cf_printf_attribute=no
+	cf_scanf_attribute=no
+	for cf_attribute in scanf printf unused noreturn
+	do
 
-cf_cv_ansi_cc=no
-cf_save_CFLAGS="$CFLAGS"
-cf_save_CPPFLAGS="$CPPFLAGS"
-# Don't try gcc -ansi; that turns off useful extensions and
-# breaks some systems' header files.
-# AIX			-qlanglvl=ansi
-# Ultrix and OSF/1	-std1
-# HP-UX			-Aa -D_HPUX_SOURCE
-# SVR4			-Xc
-# UnixWare 1.2		(cannot use -Xc, since ANSI/POSIX clashes)
-for cf_arg in "-DCC_HAS_PROTOS" \
-	"" \
-	-qlanglvl=ansi \
-	-std1 \
-	-Ae \
-	"-Aa -D_HPUX_SOURCE" \
-	-Xc
-do
-
-cf_fix_cppflags=no
-cf_new_cflags=
-cf_new_cppflags=
-cf_new_extra_cppflags=
-
-for cf_add_cflags in $cf_arg
-do
-case $cf_fix_cppflags in
-no)
-	case $cf_add_cflags in #(vi
-	-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi
-		case $cf_add_cflags in
-		-D*)
-			cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'`
+cf_ATTRIBUTE=`echo "$cf_attribute" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
 
-			test "${cf_add_cflags}" != "${cf_tst_cflags}" \
-				&& test -z "${cf_tst_cflags}" \
-				&& cf_fix_cppflags=yes
+		cf_directive="__attribute__(($cf_attribute))"
+		echo "checking for $CC $cf_directive" 1>&5
 
-			if test $cf_fix_cppflags = yes ; then
-				cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
-				continue
-			elif test "${cf_tst_cflags}" = "\"'" ; then
-				cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
-				continue
-			fi
+		case $cf_attribute in #(vi
+		printf) #(vi
+			cf_printf_attribute=yes
+			cat >conftest.h <<EOF
+#define GCC_$cf_ATTRIBUTE 1
+EOF
 			;;
-		esac
-		case "$CPPFLAGS" in
-		*$cf_add_cflags) #(vi
+		scanf) #(vi
+			cf_scanf_attribute=yes
+			cat >conftest.h <<EOF
+#define GCC_$cf_ATTRIBUTE 1
+EOF
 			;;
 		*) #(vi
-			case $cf_add_cflags in #(vi
-			-D*)
-				cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'`
+			cat >conftest.h <<EOF
+#define GCC_$cf_ATTRIBUTE $cf_directive
+EOF
+			;;
+		esac
 
-CPPFLAGS=`echo "$CPPFLAGS" | \
-	sed	-e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ 	]*\)\?[ 	]/ /g' \
-		-e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ 	]*\)\?$//g'`
+		if { (eval echo "$as_me:2729: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:2732: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+			test -n "$verbose" && echo "$as_me:2734: result: ... $cf_attribute" >&5
+echo "${ECHO_T}... $cf_attribute" >&6
+			cat conftest.h >>confdefs.h
+			case $cf_attribute in #(vi
+			noreturn) #(vi
+
+cat >>confdefs.h <<EOF
+#define GCC_NORETURN $cf_directive
+EOF
 
 				;;
-			esac
-			cf_new_cppflags="$cf_new_cppflags $cf_add_cflags"
-			;;
-		esac
-		;;
-	*)
-		cf_new_cflags="$cf_new_cflags $cf_add_cflags"
-		;;
-	esac
-	;;
-yes)
-	cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
+			printf) #(vi
+				cf_value='/* nothing */'
+				if test "$cf_printf_attribute" != no ; then
+					cf_value='__attribute__((format(printf,fmt,var)))'
 
-	cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'`
+cat >>confdefs.h <<\EOF
+#define GCC_PRINTF 1
+EOF
 
-	test "${cf_add_cflags}" != "${cf_tst_cflags}" \
-		&& test -z "${cf_tst_cflags}" \
-		&& cf_fix_cppflags=no
-	;;
-esac
-done
+				fi
 
-if test -n "$cf_new_cflags" ; then
+cat >>confdefs.h <<EOF
+#define GCC_PRINTFLIKE(fmt,var) $cf_value
+EOF
 
-	CFLAGS="$CFLAGS $cf_new_cflags"
-fi
+				;;
+			scanf) #(vi
+				cf_value='/* nothing */'
+				if test "$cf_scanf_attribute" != no ; then
+					cf_value='__attribute__((format(scanf,fmt,var)))'
 
-if test -n "$cf_new_cppflags" ; then
+cat >>confdefs.h <<\EOF
+#define GCC_SCANF 1
+EOF
 
-	CPPFLAGS="$CPPFLAGS $cf_new_cppflags"
-fi
+				fi
 
-if test -n "$cf_new_extra_cppflags" ; then
+cat >>confdefs.h <<EOF
+#define GCC_SCANFLIKE(fmt,var) $cf_value
+EOF
 
-	EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS"
+				;;
+			unused) #(vi
+
+cat >>confdefs.h <<EOF
+#define GCC_UNUSED $cf_directive
+EOF
+
+				;;
+			esac
+		fi
+	done
+else
+	fgrep define conftest.i >>confdefs.h
+fi
+rm -rf conftest*
 fi
 
-	cat >conftest.$ac_ext <<_ACEOF
-#line 2578 "configure"
+cf_XOPEN_SOURCE=500
+cf_POSIX_C_SOURCE=199506L
+cf_xopen_source=
+
+case $host_os in #(vi
+aix[4-7]*) #(vi
+	cf_xopen_source="-D_ALL_SOURCE"
+	;;
+cygwin) #(vi
+	cf_XOPEN_SOURCE=600
+	;;
+darwin[0-8].*) #(vi
+	cf_xopen_source="-D_APPLE_C_SOURCE"
+	;;
+darwin*) #(vi
+	cf_xopen_source="-D_DARWIN_C_SOURCE"
+	cf_XOPEN_SOURCE=
+	;;
+freebsd*|dragonfly*) #(vi
+	# 5.x headers associate
+	#	_XOPEN_SOURCE=600 with _POSIX_C_SOURCE=200112L
+	#	_XOPEN_SOURCE=500 with _POSIX_C_SOURCE=199506L
+	cf_POSIX_C_SOURCE=200112L
+	cf_XOPEN_SOURCE=600
+	cf_xopen_source="-D_BSD_TYPES -D__BSD_VISIBLE -D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE"
+	;;
+hpux11*) #(vi
+	cf_xopen_source="-D_HPUX_SOURCE -D_XOPEN_SOURCE=500"
+	;;
+hpux*) #(vi
+	cf_xopen_source="-D_HPUX_SOURCE"
+	;;
+irix[56].*) #(vi
+	cf_xopen_source="-D_SGI_SOURCE"
+	cf_XOPEN_SOURCE=
+	;;
+linux*|gnu*|mint*|k*bsd*-gnu) #(vi
+
+echo "$as_me:2831: checking if we must define _GNU_SOURCE" >&5
+echo $ECHO_N "checking if we must define _GNU_SOURCE... $ECHO_C" >&6
+if test "${cf_cv_gnu_source+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+cat >conftest.$ac_ext <<_ACEOF
+#line 2838 "configure"
 #include "confdefs.h"
+#include <sys/types.h>
+int
+main ()
+{
 
-#ifndef CC_HAS_PROTOS
-#if !defined(__STDC__) || (__STDC__ != 1)
-choke me
-#endif
+#ifndef _XOPEN_SOURCE
+make an error
 #endif
-
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:2853: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:2856: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:2859: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:2862: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  cf_cv_gnu_source=no
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+cf_save="$CPPFLAGS"
+	 CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
+	 cat >conftest.$ac_ext <<_ACEOF
+#line 2871 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
 int
 main ()
 {
 
-	int test (int i, double x);
-	struct s1 {int (*f) (int a);};
-	struct s2 {int (*f) (double a);};
+#ifdef _XOPEN_SOURCE
+make an error
+#endif
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:2599: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:2886: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:2602: \$? = $ac_status" >&5
+  echo "$as_me:2889: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:2605: \"$ac_try\"") >&5
+  { (eval echo "$as_me:2892: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:2608: \$? = $ac_status" >&5
+  echo "$as_me:2895: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  cf_cv_ansi_cc="$cf_arg"; break
+  cf_cv_gnu_source=no
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
+cf_cv_gnu_source=yes
 fi
 rm -f conftest.$ac_objext conftest.$ac_ext
-done
-CFLAGS="$cf_save_CFLAGS"
-CPPFLAGS="$cf_save_CPPFLAGS"
+	CPPFLAGS="$cf_save"
 
 fi
-echo "$as_me:2621: result: $cf_cv_ansi_cc" >&5
-echo "${ECHO_T}$cf_cv_ansi_cc" >&6
+rm -f conftest.$ac_objext conftest.$ac_ext
 
-if test "$cf_cv_ansi_cc" != "no"; then
-if test ".$cf_cv_ansi_cc" != ".-DCC_HAS_PROTOS"; then
+fi
+echo "$as_me:2910: result: $cf_cv_gnu_source" >&5
+echo "${ECHO_T}$cf_cv_gnu_source" >&6
+test "$cf_cv_gnu_source" = yes && CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
 
-cf_fix_cppflags=no
-cf_new_cflags=
-cf_new_cppflags=
-cf_new_extra_cppflags=
+	;;
+mirbsd*) #(vi
+	# setting _XOPEN_SOURCE or _POSIX_SOURCE breaks <sys/select.h> and other headers which use u_int / u_short types
+	cf_XOPEN_SOURCE=
 
-for cf_add_cflags in $cf_cv_ansi_cc
-do
-case $cf_fix_cppflags in
-no)
-	case $cf_add_cflags in #(vi
-	-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi
-		case $cf_add_cflags in
-		-D*)
-			cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'`
+cf_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE
 
-			test "${cf_add_cflags}" != "${cf_tst_cflags}" \
-				&& test -z "${cf_tst_cflags}" \
-				&& cf_fix_cppflags=yes
+cf_save_CFLAGS="$CFLAGS"
+cf_save_CPPFLAGS="$CPPFLAGS"
 
-			if test $cf_fix_cppflags = yes ; then
-				cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
-				continue
-			elif test "${cf_tst_cflags}" = "\"'" ; then
-				cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
-				continue
-			fi
-			;;
-		esac
-		case "$CPPFLAGS" in
-		*$cf_add_cflags) #(vi
-			;;
-		*) #(vi
-			case $cf_add_cflags in #(vi
-			-D*)
-				cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'`
+cf_trim_CFLAGS=`echo "$cf_save_CFLAGS" | \
+	sed	-e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ 	]*\)\?[ 	]/ /g' \
+		-e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ 	]*\)\?$//g'`
 
-CPPFLAGS=`echo "$CPPFLAGS" | \
-	sed	-e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ 	]*\)\?[ 	]/ /g' \
-		-e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ 	]*\)\?$//g'`
+cf_trim_CPPFLAGS=`echo "$cf_save_CPPFLAGS" | \
+	sed	-e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ 	]*\)\?[ 	]/ /g' \
+		-e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ 	]*\)\?$//g'`
 
-				;;
-			esac
-			cf_new_cppflags="$cf_new_cppflags $cf_add_cflags"
-			;;
-		esac
-		;;
-	*)
-		cf_new_cflags="$cf_new_cflags $cf_add_cflags"
-		;;
-	esac
-	;;
-yes)
-	cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
-
-	cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'`
-
-	test "${cf_add_cflags}" != "${cf_tst_cflags}" \
-		&& test -z "${cf_tst_cflags}" \
-		&& cf_fix_cppflags=no
-	;;
-esac
-done
-
-if test -n "$cf_new_cflags" ; then
-
-	CFLAGS="$CFLAGS $cf_new_cflags"
-fi
-
-if test -n "$cf_new_cppflags" ; then
-
-	CPPFLAGS="$CPPFLAGS $cf_new_cppflags"
-fi
-
-if test -n "$cf_new_extra_cppflags" ; then
-
-	EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS"
-fi
-
-else
-	cat >>confdefs.h <<\EOF
-#define CC_HAS_PROTOS 1
-EOF
-
-fi
-fi
-
-if test "$cf_cv_ansi_cc" = "no"; then
-	{ { echo "$as_me:2714: error: Your compiler does not appear to recognize prototypes.
-You have the following choices:
-	a. adjust your compiler options
-	b. get an up-to-date compiler
-	c. use a wrapper such as unproto" >&5
-echo "$as_me: error: Your compiler does not appear to recognize prototypes.
-You have the following choices:
-	a. adjust your compiler options
-	b. get an up-to-date compiler
-	c. use a wrapper such as unproto" >&2;}
-   { (exit 1); exit 1; }; }
-fi
-
-if test "$GCC" = yes
-then
-cat > conftest.i <<EOF
-#ifndef GCC_PRINTF
-#define GCC_PRINTF 0
-#endif
-#ifndef GCC_SCANF
-#define GCC_SCANF 0
-#endif
-#ifndef GCC_NORETURN
-#define GCC_NORETURN /* nothing */
-#endif
-#ifndef GCC_UNUSED
-#define GCC_UNUSED /* nothing */
-#endif
-EOF
-if test "$GCC" = yes
-then
-	{ echo "$as_me:2745: checking for $CC __attribute__ directives..." >&5
-echo "$as_me: checking for $CC __attribute__ directives..." >&6;}
-cat > conftest.$ac_ext <<EOF
-#line 2748 "${as_me:-configure}"
-#include "confdefs.h"
-#include "conftest.h"
-#include "conftest.i"
-#if	GCC_PRINTF
-#define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var)))
-#else
-#define GCC_PRINTFLIKE(fmt,var) /*nothing*/
-#endif
-#if	GCC_SCANF
-#define GCC_SCANFLIKE(fmt,var)  __attribute__((format(scanf,fmt,var)))
-#else
-#define GCC_SCANFLIKE(fmt,var)  /*nothing*/
-#endif
-extern void wow(char *,...) GCC_SCANFLIKE(1,2);
-extern void oops(char *,...) GCC_PRINTFLIKE(1,2) GCC_NORETURN;
-extern void foo(void) GCC_NORETURN;
-int main(int argc GCC_UNUSED, char *argv[] GCC_UNUSED) { return 0; }
-EOF
-	cf_printf_attribute=no
-	cf_scanf_attribute=no
-	for cf_attribute in scanf printf unused noreturn
-	do
-
-cf_ATTRIBUTE=`echo "$cf_attribute" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
-
-		cf_directive="__attribute__(($cf_attribute))"
-		echo "checking for $CC $cf_directive" 1>&5
-
-		case $cf_attribute in #(vi
-		printf) #(vi
-			cf_printf_attribute=yes
-			cat >conftest.h <<EOF
-#define GCC_$cf_ATTRIBUTE 1
-EOF
-			;;
-		scanf) #(vi
-			cf_scanf_attribute=yes
-			cat >conftest.h <<EOF
-#define GCC_$cf_ATTRIBUTE 1
-EOF
-			;;
-		*) #(vi
-			cat >conftest.h <<EOF
-#define GCC_$cf_ATTRIBUTE $cf_directive
-EOF
-			;;
-		esac
-
-		if { (eval echo "$as_me:2797: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
-  ac_status=$?
-  echo "$as_me:2800: \$? = $ac_status" >&5
-  (exit $ac_status); }; then
-			test -n "$verbose" && echo "$as_me:2802: result: ... $cf_attribute" >&5
-echo "${ECHO_T}... $cf_attribute" >&6
-			cat conftest.h >>confdefs.h
-			case $cf_attribute in #(vi
-			printf) #(vi
-				if test "$cf_printf_attribute" = no ; then
-					cat >>confdefs.h <<EOF
-#define GCC_PRINTFLIKE(fmt,var) /* nothing */
-EOF
-				else
-					cat >>confdefs.h <<EOF
-#define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var)))
-EOF
-				fi
-				;;
-			scanf) #(vi
-				if test "$cf_scanf_attribute" = no ; then
-					cat >>confdefs.h <<EOF
-#define GCC_SCANFLIKE(fmt,var) /* nothing */
-EOF
-				else
-					cat >>confdefs.h <<EOF
-#define GCC_SCANFLIKE(fmt,var)  __attribute__((format(scanf,fmt,var)))
-EOF
-				fi
-				;;
-			esac
-		fi
-	done
-else
-	fgrep define conftest.i >>confdefs.h
-fi
-rm -rf conftest*
-fi
-
-cf_XOPEN_SOURCE=500
-cf_POSIX_C_SOURCE=199506L
-cf_xopen_source=
-
-case $host_os in #(vi
-aix[456]*) #(vi
-	cf_xopen_source="-D_ALL_SOURCE"
-	;;
-cygwin) #(vi
-	cf_XOPEN_SOURCE=600
-	;;
-darwin[0-8].*) #(vi
-	cf_xopen_source="-D_APPLE_C_SOURCE"
-	;;
-darwin*) #(vi
-	cf_xopen_source="-D_DARWIN_C_SOURCE"
-	;;
-freebsd*|dragonfly*) #(vi
-	# 5.x headers associate
-	#	_XOPEN_SOURCE=600 with _POSIX_C_SOURCE=200112L
-	#	_XOPEN_SOURCE=500 with _POSIX_C_SOURCE=199506L
-	cf_POSIX_C_SOURCE=200112L
-	cf_XOPEN_SOURCE=600
-	cf_xopen_source="-D_BSD_TYPES -D__BSD_VISIBLE -D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE"
-	;;
-hpux11*) #(vi
-	cf_xopen_source="-D_HPUX_SOURCE -D_XOPEN_SOURCE=500"
-	;;
-hpux*) #(vi
-	cf_xopen_source="-D_HPUX_SOURCE"
-	;;
-irix[56].*) #(vi
-	cf_xopen_source="-D_SGI_SOURCE"
-	;;
-linux*|gnu*|mint*|k*bsd*-gnu) #(vi
-
-echo "$as_me:2873: checking if we must define _GNU_SOURCE" >&5
-echo $ECHO_N "checking if we must define _GNU_SOURCE... $ECHO_C" >&6
-if test "${cf_cv_gnu_source+set}" = set; then
+echo "$as_me:2932: checking if we should define _POSIX_C_SOURCE" >&5
+echo $ECHO_N "checking if we should define _POSIX_C_SOURCE... $ECHO_C" >&6
+if test "${cf_cv_posix_c_source+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
 
-cat >conftest.$ac_ext <<_ACEOF
-#line 2880 "configure"
+echo "${as_me:-configure}:2938: testing if the symbol is already defined go no further ..." 1>&5
+
+	cat >conftest.$ac_ext <<_ACEOF
+#line 2941 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 int
 main ()
 {
 
-#ifndef _XOPEN_SOURCE
+#ifndef _POSIX_C_SOURCE
 make an error
 #endif
   ;
@@ -2892,32 +2953,44 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:2895: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:2956: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:2898: \$? = $ac_status" >&5
+  echo "$as_me:2959: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:2901: \"$ac_try\"") >&5
+  { (eval echo "$as_me:2962: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:2904: \$? = $ac_status" >&5
+  echo "$as_me:2965: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  cf_cv_gnu_source=no
+  cf_cv_posix_c_source=no
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-cf_save="$CPPFLAGS"
-	 CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
-	 cat >conftest.$ac_ext <<_ACEOF
-#line 2913 "configure"
+cf_want_posix_source=no
+	 case .$cf_POSIX_C_SOURCE in #(vi
+	 .[12]??*) #(vi
+		cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE"
+		;;
+	 .2) #(vi
+		cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE"
+		cf_want_posix_source=yes
+		;;
+	 .*)
+		cf_want_posix_source=yes
+		;;
+	 esac
+	 if test "$cf_want_posix_source" = yes ; then
+		cat >conftest.$ac_ext <<_ACEOF
+#line 2986 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 int
 main ()
 {
 
-#ifdef _XOPEN_SOURCE
+#ifdef _POSIX_SOURCE
 make an error
 #endif
   ;
@@ -2925,75 +2998,42 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:2928: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:3001: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:2931: \$? = $ac_status" >&5
+  echo "$as_me:3004: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:2934: \"$ac_try\"") >&5
+  { (eval echo "$as_me:3007: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:2937: \$? = $ac_status" >&5
+  echo "$as_me:3010: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  cf_cv_gnu_source=no
+  :
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-cf_cv_gnu_source=yes
+cf_cv_posix_c_source="$cf_cv_posix_c_source -D_POSIX_SOURCE"
 fi
 rm -f conftest.$ac_objext conftest.$ac_ext
-	CPPFLAGS="$cf_save"
+	 fi
 
-fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+echo "${as_me:-configure}:3021: testing ifdef from value $cf_POSIX_C_SOURCE ..." 1>&5
 
-fi
-echo "$as_me:2952: result: $cf_cv_gnu_source" >&5
-echo "${ECHO_T}$cf_cv_gnu_source" >&6
-test "$cf_cv_gnu_source" = yes && CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
+	 CFLAGS="$cf_trim_CFLAGS"
+	 CPPFLAGS="$cf_trim_CPPFLAGS $cf_cv_posix_c_source"
 
-	;;
-mirbsd*) #(vi
-	# setting _XOPEN_SOURCE or _POSIX_SOURCE breaks <arpa/inet.h>
-	;;
-netbsd*) #(vi
-	# setting _XOPEN_SOURCE breaks IPv6 for lynx on NetBSD 1.6, breaks xterm, is not needed for ncursesw
-	;;
-openbsd*) #(vi
-	# setting _XOPEN_SOURCE breaks xterm on OpenBSD 2.8, is not needed for ncursesw
-	;;
-osf[45]*) #(vi
-	cf_xopen_source="-D_OSF_SOURCE"
-	;;
-nto-qnx*) #(vi
-	cf_xopen_source="-D_QNX_SOURCE"
-	;;
-sco*) #(vi
-	# setting _XOPEN_SOURCE breaks Lynx on SCO Unix / OpenServer
-	;;
-solaris2.1[0-9]) #(vi
-	cf_xopen_source="-D__EXTENSIONS__ -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE"
-	;;
-solaris2.[1-9]) #(vi
-	cf_xopen_source="-D__EXTENSIONS__"
-	;;
-*)
-	echo "$as_me:2982: checking if we should define _XOPEN_SOURCE" >&5
-echo $ECHO_N "checking if we should define _XOPEN_SOURCE... $ECHO_C" >&6
-if test "${cf_cv_xopen_source+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
+echo "${as_me:-configure}:3026: testing if the second compile does not leave our definition intact error ..." 1>&5
 
-	cat >conftest.$ac_ext <<_ACEOF
-#line 2989 "configure"
+	 cat >conftest.$ac_ext <<_ACEOF
+#line 3029 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 int
 main ()
 {
 
-#ifndef _XOPEN_SOURCE
+#ifndef _POSIX_C_SOURCE
 make an error
 #endif
   ;
@@ -3001,32 +3041,200 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:3004: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:3044: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:3007: \$? = $ac_status" >&5
+  echo "$as_me:3047: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:3010: \"$ac_try\"") >&5
+  { (eval echo "$as_me:3050: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:3013: \$? = $ac_status" >&5
+  echo "$as_me:3053: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  cf_cv_xopen_source=no
+  :
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-cf_save="$CPPFLAGS"
-	 CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE"
-	 cat >conftest.$ac_ext <<_ACEOF
-#line 3022 "configure"
-#include "confdefs.h"
-#include <sys/types.h>
-int
-main ()
-{
-
-#ifdef _XOPEN_SOURCE
+cf_cv_posix_c_source=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+	 CFLAGS="$cf_save_CFLAGS"
+	 CPPFLAGS="$cf_save_CPPFLAGS"
+
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+
+fi
+echo "$as_me:3069: result: $cf_cv_posix_c_source" >&5
+echo "${ECHO_T}$cf_cv_posix_c_source" >&6
+
+if test "$cf_cv_posix_c_source" != no ; then
+	CFLAGS="$cf_trim_CFLAGS"
+	CPPFLAGS="$cf_trim_CPPFLAGS"
+
+cf_fix_cppflags=no
+cf_new_cflags=
+cf_new_cppflags=
+cf_new_extra_cppflags=
+
+for cf_add_cflags in $cf_cv_posix_c_source
+do
+case $cf_fix_cppflags in
+no)
+	case $cf_add_cflags in #(vi
+	-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi
+		case $cf_add_cflags in
+		-D*)
+			cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'`
+
+			test "${cf_add_cflags}" != "${cf_tst_cflags}" \
+				&& test -z "${cf_tst_cflags}" \
+				&& cf_fix_cppflags=yes
+
+			if test $cf_fix_cppflags = yes ; then
+				cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
+				continue
+			elif test "${cf_tst_cflags}" = "\"'" ; then
+				cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
+				continue
+			fi
+			;;
+		esac
+		case "$CPPFLAGS" in
+		*$cf_add_cflags) #(vi
+			;;
+		*) #(vi
+			case $cf_add_cflags in #(vi
+			-D*)
+				cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'`
+
+CPPFLAGS=`echo "$CPPFLAGS" | \
+	sed	-e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ 	]*\)\?[ 	]/ /g' \
+		-e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ 	]*\)\?$//g'`
+
+				;;
+			esac
+			cf_new_cppflags="$cf_new_cppflags $cf_add_cflags"
+			;;
+		esac
+		;;
+	*)
+		cf_new_cflags="$cf_new_cflags $cf_add_cflags"
+		;;
+	esac
+	;;
+yes)
+	cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
+
+	cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'`
+
+	test "${cf_add_cflags}" != "${cf_tst_cflags}" \
+		&& test -z "${cf_tst_cflags}" \
+		&& cf_fix_cppflags=no
+	;;
+esac
+done
+
+if test -n "$cf_new_cflags" ; then
+
+	CFLAGS="$CFLAGS $cf_new_cflags"
+fi
+
+if test -n "$cf_new_cppflags" ; then
+
+	CPPFLAGS="$CPPFLAGS $cf_new_cppflags"
+fi
+
+if test -n "$cf_new_extra_cppflags" ; then
+
+	EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS"
+fi
+
+fi
+
+	;;
+netbsd*) #(vi
+	cf_xopen_source="-D_NETBSD_SOURCE" # setting _XOPEN_SOURCE breaks IPv6 for lynx on NetBSD 1.6, breaks xterm, is not needed for ncursesw
+	;;
+openbsd[4-9]*) #(vi
+	# setting _XOPEN_SOURCE lower than 500 breaks g++ compile with wchar.h, needed for ncursesw
+	cf_xopen_source="-D_BSD_SOURCE"
+	cf_XOPEN_SOURCE=600
+	;;
+openbsd*) #(vi
+	# setting _XOPEN_SOURCE breaks xterm on OpenBSD 2.8, is not needed for ncursesw
+	;;
+osf[45]*) #(vi
+	cf_xopen_source="-D_OSF_SOURCE"
+	;;
+nto-qnx*) #(vi
+	cf_xopen_source="-D_QNX_SOURCE"
+	;;
+sco*) #(vi
+	# setting _XOPEN_SOURCE breaks Lynx on SCO Unix / OpenServer
+	;;
+solaris2.*) #(vi
+	cf_xopen_source="-D__EXTENSIONS__"
+	;;
+*)
+
+echo "$as_me:3182: checking if we should define _XOPEN_SOURCE" >&5
+echo $ECHO_N "checking if we should define _XOPEN_SOURCE... $ECHO_C" >&6
+if test "${cf_cv_xopen_source+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+	cat >conftest.$ac_ext <<_ACEOF
+#line 3189 "configure"
+#include "confdefs.h"
+
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+
+int
+main ()
+{
+
+#ifndef _XOPEN_SOURCE
+make an error
+#endif
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:3208: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:3211: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:3214: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:3217: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  cf_cv_xopen_source=no
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+cf_save="$CPPFLAGS"
+	 CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE"
+	 cat >conftest.$ac_ext <<_ACEOF
+#line 3226 "configure"
+#include "confdefs.h"
+
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+
+int
+main ()
+{
+
+#ifdef _XOPEN_SOURCE
 make an error
 #endif
   ;
@@ -3034,16 +3242,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:3037: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:3245: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:3040: \$? = $ac_status" >&5
+  echo "$as_me:3248: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:3043: \"$ac_try\"") >&5
+  { (eval echo "$as_me:3251: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:3046: \$? = $ac_status" >&5
+  echo "$as_me:3254: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   cf_cv_xopen_source=no
 else
@@ -3058,9 +3266,10 @@
 rm -f conftest.$ac_objext conftest.$ac_ext
 
 fi
-echo "$as_me:3061: result: $cf_cv_xopen_source" >&5
+echo "$as_me:3269: result: $cf_cv_xopen_source" >&5
 echo "${ECHO_T}$cf_cv_xopen_source" >&6
-	if test "$cf_cv_xopen_source" != no ; then
+
+if test "$cf_cv_xopen_source" != no ; then
 
 CFLAGS=`echo "$CFLAGS" | \
 	sed	-e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ 	]*\)\?[ 	]/ /g' \
@@ -3070,7 +3279,7 @@
 	sed	-e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ 	]*\)\?[ 	]/ /g' \
 		-e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ 	]*\)\?$//g'`
 
-		cf_temp_xopen_source="-D_XOPEN_SOURCE=$cf_cv_xopen_source"
+	cf_temp_xopen_source="-D_XOPEN_SOURCE=$cf_cv_xopen_source"
 
 cf_fix_cppflags=no
 cf_new_cflags=
@@ -3150,7 +3359,7 @@
 	EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS"
 fi
 
-	fi
+fi
 
 cf_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE
 
@@ -3165,16 +3374,16 @@
 	sed	-e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ 	]*\)\?[ 	]/ /g' \
 		-e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ 	]*\)\?$//g'`
 
-echo "$as_me:3168: checking if we should define _POSIX_C_SOURCE" >&5
+echo "$as_me:3377: checking if we should define _POSIX_C_SOURCE" >&5
 echo $ECHO_N "checking if we should define _POSIX_C_SOURCE... $ECHO_C" >&6
 if test "${cf_cv_posix_c_source+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
 
-echo "${as_me:-configure}:3174: testing if the symbol is already defined go no further ..." 1>&5
+echo "${as_me:-configure}:3383: testing if the symbol is already defined go no further ..." 1>&5
 
 	cat >conftest.$ac_ext <<_ACEOF
-#line 3177 "configure"
+#line 3386 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 int
@@ -3189,16 +3398,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:3192: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:3401: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:3195: \$? = $ac_status" >&5
+  echo "$as_me:3404: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:3198: \"$ac_try\"") >&5
+  { (eval echo "$as_me:3407: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:3201: \$? = $ac_status" >&5
+  echo "$as_me:3410: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   cf_cv_posix_c_source=no
 else
@@ -3219,7 +3428,7 @@
 	 esac
 	 if test "$cf_want_posix_source" = yes ; then
 		cat >conftest.$ac_ext <<_ACEOF
-#line 3222 "configure"
+#line 3431 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 int
@@ -3234,16 +3443,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:3237: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:3446: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:3240: \$? = $ac_status" >&5
+  echo "$as_me:3449: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:3243: \"$ac_try\"") >&5
+  { (eval echo "$as_me:3452: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:3246: \$? = $ac_status" >&5
+  echo "$as_me:3455: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   :
 else
@@ -3254,15 +3463,15 @@
 rm -f conftest.$ac_objext conftest.$ac_ext
 	 fi
 
-echo "${as_me:-configure}:3257: testing ifdef from value $cf_POSIX_C_SOURCE ..." 1>&5
+echo "${as_me:-configure}:3466: testing ifdef from value $cf_POSIX_C_SOURCE ..." 1>&5
 
 	 CFLAGS="$cf_trim_CFLAGS"
 	 CPPFLAGS="$cf_trim_CPPFLAGS $cf_cv_posix_c_source"
 
-echo "${as_me:-configure}:3262: testing if the second compile does not leave our definition intact error ..." 1>&5
+echo "${as_me:-configure}:3471: testing if the second compile does not leave our definition intact error ..." 1>&5
 
 	 cat >conftest.$ac_ext <<_ACEOF
-#line 3265 "configure"
+#line 3474 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 int
@@ -3277,16 +3486,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:3280: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:3489: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:3283: \$? = $ac_status" >&5
+  echo "$as_me:3492: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:3286: \"$ac_try\"") >&5
+  { (eval echo "$as_me:3495: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:3289: \$? = $ac_status" >&5
+  echo "$as_me:3498: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   :
 else
@@ -3302,7 +3511,7 @@
 rm -f conftest.$ac_objext conftest.$ac_ext
 
 fi
-echo "$as_me:3305: result: $cf_cv_posix_c_source" >&5
+echo "$as_me:3514: result: $cf_cv_posix_c_source" >&5
 echo "${ECHO_T}$cf_cv_posix_c_source" >&6
 
 if test "$cf_cv_posix_c_source" != no ; then
@@ -3474,191 +3683,274 @@
 
 fi
 
-echo "$as_me:3477: checking for $CC option to accept ANSI C" >&5
-echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6
-if test "${ac_cv_prog_cc_stdc+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_cv_prog_cc_stdc=no
-ac_save_CC=$CC
-cat >conftest.$ac_ext <<_ACEOF
-#line 3485 "configure"
+if test -n "$cf_XOPEN_SOURCE" && test -z "$cf_cv_xopen_source" ; then
+	echo "$as_me:3687: checking if _XOPEN_SOURCE really is set" >&5
+echo $ECHO_N "checking if _XOPEN_SOURCE really is set... $ECHO_C" >&6
+	cat >conftest.$ac_ext <<_ACEOF
+#line 3690 "configure"
 #include "confdefs.h"
-#include <stdarg.h>
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-/* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
-struct buf { int x; };
-FILE * (*rcsopen) (struct buf *, struct stat *, int);
-static char *e (p, i)
-     char **p;
-     int i;
-{
-  return p[i];
-}
-static char *f (char * (*g) (char **, int), char **p, ...)
-{
-  char *s;
-  va_list v;
-  va_start (v,p);
-  s = g (p, va_arg (v,int));
-  va_end (v);
-  return s;
-}
-int test (int i, double x);
-struct s1 {int (*f) (int a);};
-struct s2 {int (*f) (double a);};
-int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
-int argc;
-char **argv;
+#include <stdlib.h>
 int
 main ()
 {
-return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
+
+#ifndef _XOPEN_SOURCE
+make an error
+#endif
   ;
   return 0;
 }
 _ACEOF
-# Don't try gcc -ansi; that turns off useful extensions and
-# breaks some systems' header files.
-# AIX			-qlanglvl=ansi
-# Ultrix and OSF/1	-std1
-# HP-UX 10.20 and later	-Ae
-# HP-UX older versions	-Aa -D_HPUX_SOURCE
-# SVR4			-Xc -D__EXTENSIONS__
-for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
-do
-  CC="$ac_save_CC $ac_arg"
-  rm -f conftest.$ac_objext
-if { (eval echo "$as_me:3534: \"$ac_compile\"") >&5
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:3705: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:3537: \$? = $ac_status" >&5
+  echo "$as_me:3708: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:3540: \"$ac_try\"") >&5
+  { (eval echo "$as_me:3711: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:3543: \$? = $ac_status" >&5
+  echo "$as_me:3714: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_prog_cc_stdc=$ac_arg
-break
+  cf_XOPEN_SOURCE_set=yes
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
+cf_XOPEN_SOURCE_set=no
 fi
-rm -f conftest.$ac_objext
-done
-rm -f conftest.$ac_ext conftest.$ac_objext
-CC=$ac_save_CC
-
-fi
-
-case "x$ac_cv_prog_cc_stdc" in
-  x|xno)
-    echo "$as_me:3560: result: none needed" >&5
-echo "${ECHO_T}none needed" >&6 ;;
-  *)
-    echo "$as_me:3563: result: $ac_cv_prog_cc_stdc" >&5
-echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6
-    CC="$CC $ac_cv_prog_cc_stdc" ;;
-esac
-
-echo "$as_me:3568: checking for an ANSI C-conforming const" >&5
-echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6
-if test "${ac_cv_c_const+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-#line 3574 "configure"
+rm -f conftest.$ac_objext conftest.$ac_ext
+	echo "$as_me:3723: result: $cf_XOPEN_SOURCE_set" >&5
+echo "${ECHO_T}$cf_XOPEN_SOURCE_set" >&6
+	if test $cf_XOPEN_SOURCE_set = yes
+	then
+		cat >conftest.$ac_ext <<_ACEOF
+#line 3728 "configure"
 #include "confdefs.h"
-
+#include <stdlib.h>
 int
 main ()
 {
-/* FIXME: Include the comments suggested by Paul. */
-#ifndef __cplusplus
-  /* Ultrix mips cc rejects this.  */
-  typedef int charset[2];
-  const charset x;
-  /* SunOS 4.1.1 cc rejects this.  */
-  char const *const *ccp;
-  char **p;
-  /* NEC SVR4.0.2 mips cc rejects this.  */
-  struct point {int x, y;};
-  static struct point const zero = {0,0};
-  /* AIX XL C 1.02.0.0 rejects this.
-     It does not let you subtract one const X* pointer from another in
-     an arm of an if-expression whose if-part is not a constant
-     expression */
-  const char *g = "string";
-  ccp = &g + (g ? g-g : 0);
-  /* HPUX 7.0 cc rejects these. */
-  ++ccp;
-  p = (char**) ccp;
-  ccp = (char const *const *) p;
-  { /* SCO 3.2v4 cc rejects this.  */
-    char *t;
-    char const *s = 0 ? (char *) 0 : (char const *) 0;
 
-    *t++ = 0;
-  }
-  { /* Someone thinks the Sun supposedly-ANSI compiler will reject this.  */
-    int x[] = {25, 17};
-    const int *foo = &x[0];
-    ++foo;
-  }
-  { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
-    typedef const int *iptr;
-    iptr p = 0;
-    ++p;
-  }
-  { /* AIX XL C 1.02.0.0 rejects this saying
-       "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
-    struct s { int j; const int *ap[3]; };
-    struct s *b; b->j = 5;
-  }
-  { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
-    const int foo = 10;
-  }
+#if (_XOPEN_SOURCE - 0) < $cf_XOPEN_SOURCE
+make an error
 #endif
-
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:3632: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:3743: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:3635: \$? = $ac_status" >&5
+  echo "$as_me:3746: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:3638: \"$ac_try\"") >&5
+  { (eval echo "$as_me:3749: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:3641: \$? = $ac_status" >&5
+  echo "$as_me:3752: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_c_const=yes
+  cf_XOPEN_SOURCE_set_ok=yes
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-ac_cv_c_const=no
+cf_XOPEN_SOURCE_set_ok=no
 fi
 rm -f conftest.$ac_objext conftest.$ac_ext
-fi
-echo "$as_me:3651: result: $ac_cv_c_const" >&5
-echo "${ECHO_T}$ac_cv_c_const" >&6
-if test $ac_cv_c_const = no; then
+		if test $cf_XOPEN_SOURCE_set_ok = no
+		then
+			{ echo "$as_me:3763: WARNING: _XOPEN_SOURCE is lower than requested" >&5
+echo "$as_me: WARNING: _XOPEN_SOURCE is lower than requested" >&2;}
+		fi
+	else
 
-cat >>confdefs.h <<\EOF
-#define const
-EOF
+echo "$as_me:3768: checking if we should define _XOPEN_SOURCE" >&5
+echo $ECHO_N "checking if we should define _XOPEN_SOURCE... $ECHO_C" >&6
+if test "${cf_cv_xopen_source+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+	cat >conftest.$ac_ext <<_ACEOF
+#line 3775 "configure"
+#include "confdefs.h"
+
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+
+int
+main ()
+{
+
+#ifndef _XOPEN_SOURCE
+make an error
+#endif
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:3794: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:3797: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:3800: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:3803: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  cf_cv_xopen_source=no
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+cf_save="$CPPFLAGS"
+	 CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE"
+	 cat >conftest.$ac_ext <<_ACEOF
+#line 3812 "configure"
+#include "confdefs.h"
+
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+
+int
+main ()
+{
+
+#ifdef _XOPEN_SOURCE
+make an error
+#endif
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:3831: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:3834: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:3837: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:3840: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  cf_cv_xopen_source=no
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+cf_cv_xopen_source=$cf_XOPEN_SOURCE
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+	CPPFLAGS="$cf_save"
+
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+
+fi
+echo "$as_me:3855: result: $cf_cv_xopen_source" >&5
+echo "${ECHO_T}$cf_cv_xopen_source" >&6
+
+if test "$cf_cv_xopen_source" != no ; then
+
+CFLAGS=`echo "$CFLAGS" | \
+	sed	-e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ 	]*\)\?[ 	]/ /g' \
+		-e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ 	]*\)\?$//g'`
+
+CPPFLAGS=`echo "$CPPFLAGS" | \
+	sed	-e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ 	]*\)\?[ 	]/ /g' \
+		-e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ 	]*\)\?$//g'`
+
+	cf_temp_xopen_source="-D_XOPEN_SOURCE=$cf_cv_xopen_source"
+
+cf_fix_cppflags=no
+cf_new_cflags=
+cf_new_cppflags=
+cf_new_extra_cppflags=
+
+for cf_add_cflags in $cf_temp_xopen_source
+do
+case $cf_fix_cppflags in
+no)
+	case $cf_add_cflags in #(vi
+	-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi
+		case $cf_add_cflags in
+		-D*)
+			cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'`
+
+			test "${cf_add_cflags}" != "${cf_tst_cflags}" \
+				&& test -z "${cf_tst_cflags}" \
+				&& cf_fix_cppflags=yes
+
+			if test $cf_fix_cppflags = yes ; then
+				cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
+				continue
+			elif test "${cf_tst_cflags}" = "\"'" ; then
+				cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
+				continue
+			fi
+			;;
+		esac
+		case "$CPPFLAGS" in
+		*$cf_add_cflags) #(vi
+			;;
+		*) #(vi
+			case $cf_add_cflags in #(vi
+			-D*)
+				cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'`
+
+CPPFLAGS=`echo "$CPPFLAGS" | \
+	sed	-e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ 	]*\)\?[ 	]/ /g' \
+		-e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ 	]*\)\?$//g'`
 
+				;;
+			esac
+			cf_new_cppflags="$cf_new_cppflags $cf_add_cflags"
+			;;
+		esac
+		;;
+	*)
+		cf_new_cflags="$cf_new_cflags $cf_add_cflags"
+		;;
+	esac
+	;;
+yes)
+	cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
+
+	cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'`
+
+	test "${cf_add_cflags}" != "${cf_tst_cflags}" \
+		&& test -z "${cf_tst_cflags}" \
+		&& cf_fix_cppflags=no
+	;;
+esac
+done
+
+if test -n "$cf_new_cflags" ; then
+
+	CFLAGS="$CFLAGS $cf_new_cflags"
+fi
+
+if test -n "$cf_new_cppflags" ; then
+
+	CPPFLAGS="$CPPFLAGS $cf_new_cppflags"
+fi
+
+if test -n "$cf_new_extra_cppflags" ; then
+
+	EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS"
+fi
+
+fi
+
+	fi
 fi
 
-echo "$as_me:3661: checking for signal global datatype" >&5
+echo "$as_me:3953: checking for signal global datatype" >&5
 echo $ECHO_N "checking for signal global datatype... $ECHO_C" >&6
 if test "${cf_cv_sig_atomic_t+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -3670,7 +3962,7 @@
 		"int"
 	do
 	cat >conftest.$ac_ext <<_ACEOF
-#line 3673 "configure"
+#line 3965 "configure"
 #include "confdefs.h"
 
 #include <sys/types.h>
@@ -3693,16 +3985,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:3696: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:3988: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:3699: \$? = $ac_status" >&5
+  echo "$as_me:3991: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:3702: \"$ac_try\"") >&5
+  { (eval echo "$as_me:3994: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:3705: \$? = $ac_status" >&5
+  echo "$as_me:3997: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   cf_cv_sig_atomic_t=$cf_type
 else
@@ -3716,473 +4008,535 @@
 
 fi
 
-echo "$as_me:3719: result: $cf_cv_sig_atomic_t" >&5
+echo "$as_me:4011: result: $cf_cv_sig_atomic_t" >&5
 echo "${ECHO_T}$cf_cv_sig_atomic_t" >&6
-test "$cf_cv_sig_atomic_t" != no && cat >>confdefs.h <<EOF
+test "$cf_cv_sig_atomic_t" != no &&
+cat >>confdefs.h <<EOF
 #define SIG_ATOMIC_T $cf_cv_sig_atomic_t
 EOF
 
-echo "$as_me:3725: checking if you want to see long compiling messages" >&5
-echo $ECHO_N "checking if you want to see long compiling messages... $ECHO_C" >&6
-
-# Check whether --enable-echo or --disable-echo was given.
-if test "${enable_echo+set}" = set; then
-  enableval="$enable_echo"
-  test "$enableval" != no && enableval=yes
-  if test "$enableval" != "yes" ; then
-
-    ECHO_LT='--silent'
-    ECHO_LD='@echo linking $@;'
-    RULE_CC='@echo compiling $<'
-    SHOW_CC='@echo compiling $@'
-    ECHO_CC='@'
-
-  else
-
-    ECHO_LT=''
-    ECHO_LD=''
-    RULE_CC=''
-    SHOW_CC=''
-    ECHO_CC=''
+echo "$as_me:4018: checking if you want to use pkg-config" >&5
+echo $ECHO_N "checking if you want to use pkg-config... $ECHO_C" >&6
 
-  fi
+# Check whether --with-pkg-config or --without-pkg-config was given.
+if test "${with_pkg_config+set}" = set; then
+  withval="$with_pkg_config"
+  cf_pkg_config=$withval
 else
-  enableval=yes
+  cf_pkg_config=yes
+fi;
+echo "$as_me:4028: result: $cf_pkg_config" >&5
+echo "${ECHO_T}$cf_pkg_config" >&6
 
-    ECHO_LT=''
-    ECHO_LD=''
-    RULE_CC=''
-    SHOW_CC=''
-    ECHO_CC=''
+case $cf_pkg_config in #(vi
+no) #(vi
+	PKG_CONFIG=none
+	;;
+yes) #(vi
 
-fi;
-echo "$as_me:3759: result: $enableval" >&5
-echo "${ECHO_T}$enableval" >&6
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args.
+set dummy ${ac_tool_prefix}pkg-config; ac_word=$2
+echo "$as_me:4040: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_path_PKG_CONFIG+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  case $PKG_CONFIG in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
+  ;;
+  *)
+  ac_save_IFS=$IFS; IFS=$ac_path_separator
+ac_dummy="$PATH"
+for ac_dir in $ac_dummy; do
+  IFS=$ac_save_IFS
+  test -z "$ac_dir" && ac_dir=.
+  if $as_executable_p "$ac_dir/$ac_word"; then
+   ac_cv_path_PKG_CONFIG="$ac_dir/$ac_word"
+   echo "$as_me:4057: found $ac_dir/$ac_word" >&5
+   break
+fi
+done
 
-GCC_VERSION=none
-if test "$GCC" = yes ; then
-	echo "$as_me:3764: checking version of $CC" >&5
-echo $ECHO_N "checking version of $CC... $ECHO_C" >&6
-	GCC_VERSION="`${CC} --version 2>/dev/null | sed -e '2,$d' -e 's/^.*(GCC) //' -e 's/^[^0-9.]*//' -e 's/[^0-9.].*//'`"
-	test -z "$GCC_VERSION" && GCC_VERSION=unknown
-	echo "$as_me:3768: result: $GCC_VERSION" >&5
-echo "${ECHO_T}$GCC_VERSION" >&6
+  ;;
+esac
 fi
+PKG_CONFIG=$ac_cv_path_PKG_CONFIG
 
-if ( test "$GCC" = yes || test "$GXX" = yes )
-then
-echo "$as_me:3774: checking if you want to turn on gcc warnings" >&5
-echo $ECHO_N "checking if you want to turn on gcc warnings... $ECHO_C" >&6
+if test -n "$PKG_CONFIG"; then
+  echo "$as_me:4068: result: $PKG_CONFIG" >&5
+echo "${ECHO_T}$PKG_CONFIG" >&6
+else
+  echo "$as_me:4071: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
 
-# Check whether --enable-warnings or --disable-warnings was given.
-if test "${enable_warnings+set}" = set; then
-  enableval="$enable_warnings"
-  test "$enableval" != yes && enableval=no
-  if test "$enableval" != "no" ; then
-    with_warnings=yes
-  else
-    with_warnings=no
-  fi
+fi
+if test -z "$ac_cv_path_PKG_CONFIG"; then
+  ac_pt_PKG_CONFIG=$PKG_CONFIG
+  # Extract the first word of "pkg-config", so it can be a program name with args.
+set dummy pkg-config; ac_word=$2
+echo "$as_me:4080: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_path_ac_pt_PKG_CONFIG+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  enableval=no
-  with_warnings=no
+  case $ac_pt_PKG_CONFIG in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path.
+  ;;
+  *)
+  ac_save_IFS=$IFS; IFS=$ac_path_separator
+ac_dummy="$PATH"
+for ac_dir in $ac_dummy; do
+  IFS=$ac_save_IFS
+  test -z "$ac_dir" && ac_dir=.
+  if $as_executable_p "$ac_dir/$ac_word"; then
+   ac_cv_path_ac_pt_PKG_CONFIG="$ac_dir/$ac_word"
+   echo "$as_me:4097: found $ac_dir/$ac_word" >&5
+   break
+fi
+done
 
-fi;
-echo "$as_me:3791: result: $with_warnings" >&5
-echo "${ECHO_T}$with_warnings" >&6
-if test "$with_warnings" = "yes"
-then
+  test -z "$ac_cv_path_ac_pt_PKG_CONFIG" && ac_cv_path_ac_pt_PKG_CONFIG="none"
+  ;;
+esac
+fi
+ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG
 
-if test "$GCC" = yes
-then
-cat > conftest.i <<EOF
-#ifndef GCC_PRINTF
-#define GCC_PRINTF 0
-#endif
-#ifndef GCC_SCANF
-#define GCC_SCANF 0
-#endif
-#ifndef GCC_NORETURN
-#define GCC_NORETURN /* nothing */
-#endif
-#ifndef GCC_UNUSED
-#define GCC_UNUSED /* nothing */
-#endif
-EOF
-if test "$GCC" = yes
-then
-	{ echo "$as_me:3814: checking for $CC __attribute__ directives..." >&5
-echo "$as_me: checking for $CC __attribute__ directives..." >&6;}
-cat > conftest.$ac_ext <<EOF
-#line 3817 "${as_me:-configure}"
-#include "confdefs.h"
-#include "conftest.h"
-#include "conftest.i"
-#if	GCC_PRINTF
-#define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var)))
-#else
-#define GCC_PRINTFLIKE(fmt,var) /*nothing*/
-#endif
-#if	GCC_SCANF
-#define GCC_SCANFLIKE(fmt,var)  __attribute__((format(scanf,fmt,var)))
-#else
-#define GCC_SCANFLIKE(fmt,var)  /*nothing*/
-#endif
-extern void wow(char *,...) GCC_SCANFLIKE(1,2);
-extern void oops(char *,...) GCC_PRINTFLIKE(1,2) GCC_NORETURN;
-extern void foo(void) GCC_NORETURN;
-int main(int argc GCC_UNUSED, char *argv[] GCC_UNUSED) { return 0; }
-EOF
-	cf_printf_attribute=no
-	cf_scanf_attribute=no
-	for cf_attribute in scanf printf unused noreturn
-	do
+if test -n "$ac_pt_PKG_CONFIG"; then
+  echo "$as_me:4109: result: $ac_pt_PKG_CONFIG" >&5
+echo "${ECHO_T}$ac_pt_PKG_CONFIG" >&6
+else
+  echo "$as_me:4112: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
 
-cf_ATTRIBUTE=`echo "$cf_attribute" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
+  PKG_CONFIG=$ac_pt_PKG_CONFIG
+else
+  PKG_CONFIG="$ac_cv_path_PKG_CONFIG"
+fi
 
-		cf_directive="__attribute__(($cf_attribute))"
-		echo "checking for $CC $cf_directive" 1>&5
+	;;
+*)
+	PKG_CONFIG=$withval
+	;;
+esac
 
-		case $cf_attribute in #(vi
-		printf) #(vi
-			cf_printf_attribute=yes
-			cat >conftest.h <<EOF
-#define GCC_$cf_ATTRIBUTE 1
-EOF
-			;;
-		scanf) #(vi
-			cf_scanf_attribute=yes
-			cat >conftest.h <<EOF
-#define GCC_$cf_ATTRIBUTE 1
-EOF
-			;;
-		*) #(vi
-			cat >conftest.h <<EOF
-#define GCC_$cf_ATTRIBUTE $cf_directive
-EOF
-			;;
-		esac
+test -z "$PKG_CONFIG" && PKG_CONFIG=none
+if test "$PKG_CONFIG" != none ; then
 
-		if { (eval echo "$as_me:3866: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
-  ac_status=$?
-  echo "$as_me:3869: \$? = $ac_status" >&5
-  (exit $ac_status); }; then
-			test -n "$verbose" && echo "$as_me:3871: result: ... $cf_attribute" >&5
-echo "${ECHO_T}... $cf_attribute" >&6
-			cat conftest.h >>confdefs.h
-			case $cf_attribute in #(vi
-			printf) #(vi
-				if test "$cf_printf_attribute" = no ; then
-					cat >>confdefs.h <<EOF
-#define GCC_PRINTFLIKE(fmt,var) /* nothing */
-EOF
-				else
-					cat >>confdefs.h <<EOF
-#define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var)))
-EOF
-				fi
-				;;
-			scanf) #(vi
-				if test "$cf_scanf_attribute" = no ; then
-					cat >>confdefs.h <<EOF
-#define GCC_SCANFLIKE(fmt,var) /* nothing */
-EOF
-				else
-					cat >>confdefs.h <<EOF
-#define GCC_SCANFLIKE(fmt,var)  __attribute__((format(scanf,fmt,var)))
-EOF
-				fi
-				;;
-			esac
-		fi
-	done
+if test "x$prefix" != xNONE; then
+  cf_path_syntax="$prefix"
 else
-	fgrep define conftest.i >>confdefs.h
+  cf_path_syntax="$ac_default_prefix"
 fi
-rm -rf conftest*
+
+case ".$PKG_CONFIG" in #(vi
+.\$\(*\)*|.\'*\'*) #(vi
+  ;;
+..|./*|.\\*) #(vi
+  ;;
+.[a-zA-Z]:[\\/]*) #(vi OS/2 EMX
+  ;;
+.\${*prefix}*|.\${*dir}*) #(vi
+  eval PKG_CONFIG="$PKG_CONFIG"
+  case ".$PKG_CONFIG" in #(vi
+  .NONE/*)
+    PKG_CONFIG=`echo $PKG_CONFIG | sed -e s%NONE%$cf_path_syntax%`
+    ;;
+  esac
+  ;; #(vi
+.no|.NONE/*)
+  PKG_CONFIG=`echo $PKG_CONFIG | sed -e s%NONE%$cf_path_syntax%`
+  ;;
+*)
+  { { echo "$as_me:4155: error: expected a pathname, not \"$PKG_CONFIG\"" >&5
+echo "$as_me: error: expected a pathname, not \"$PKG_CONFIG\"" >&2;}
+   { (exit 1); exit 1; }; }
+  ;;
+esac
+
 fi
 
-INTEL_COMPILER=no
+echo "$as_me:4163: checking if you want to see long compiling messages" >&5
+echo $ECHO_N "checking if you want to see long compiling messages... $ECHO_C" >&6
 
-if test "$GCC" = yes ; then
-	case $host_os in
-	linux*|gnu*)
-		echo "$as_me:3911: checking if this is really Intel C compiler" >&5
-echo $ECHO_N "checking if this is really Intel C compiler... $ECHO_C" >&6
-		cf_save_CFLAGS="$CFLAGS"
-		CFLAGS="$CFLAGS -no-gcc"
-		cat >conftest.$ac_ext <<_ACEOF
-#line 3916 "configure"
-#include "confdefs.h"
+# Check whether --enable-echo or --disable-echo was given.
+if test "${enable_echo+set}" = set; then
+  enableval="$enable_echo"
+  test "$enableval" != no && enableval=yes
+  if test "$enableval" != "yes" ; then
 
-int
-main ()
-{
+    ECHO_LT='--silent'
+    ECHO_LD='@echo linking $@;'
+    RULE_CC='@echo compiling $<'
+    SHOW_CC='@echo compiling $@'
+    ECHO_CC='@'
 
-#ifdef __INTEL_COMPILER
-#else
-make an error
-#endif
+  else
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:3933: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
-  ac_status=$?
-  echo "$as_me:3936: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:3939: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:3942: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  INTEL_COMPILER=yes
-cf_save_CFLAGS="$cf_save_CFLAGS -we147 -no-gcc"
+    ECHO_LT=''
+    ECHO_LD=''
+    RULE_CC=''
+    SHOW_CC=''
+    ECHO_CC=''
 
+  fi
 else
-  echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
-fi
-rm -f conftest.$ac_objext conftest.$ac_ext
-		CFLAGS="$cf_save_CFLAGS"
-		echo "$as_me:3953: result: $INTEL_COMPILER" >&5
-echo "${ECHO_T}$INTEL_COMPILER" >&6
-		;;
-	esac
-fi
+  enableval=yes
 
-cat > conftest.$ac_ext <<EOF
-#line 3960 "${as_me:-configure}"
-int main(int argc, char *argv[]) { return (argv[argc-1] == 0) ; }
-EOF
+    ECHO_LT=''
+    ECHO_LD=''
+    RULE_CC=''
+    SHOW_CC=''
+    ECHO_CC=''
 
-if test "$INTEL_COMPILER" = yes
-then
-# The "-wdXXX" options suppress warnings:
-# remark #1419: external declaration in primary source file
-# remark #1683: explicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem)
-# remark #1684: conversion from pointer to same-sized integral type (potential portability problem)
-# remark #193: zero used for undefined preprocessing identifier
-# remark #593: variable "curs_sb_left_arrow" was set but never used
-# remark #810: conversion from "int" to "Dimension={unsigned short}" may lose significant bits
-# remark #869: parameter "tw" was never referenced
-# remark #981: operands are evaluated in unspecified order
-# warning #279: controlling expression is constant
+fi;
+echo "$as_me:4197: result: $enableval" >&5
+echo "${ECHO_T}$enableval" >&6
 
-	{ echo "$as_me:3977: checking for $CC warning options..." >&5
-echo "$as_me: checking for $CC warning options..." >&6;}
-	cf_save_CFLAGS="$CFLAGS"
-	EXTRA_CFLAGS="-Wall"
-	for cf_opt in \
-		wd1419 \
-		wd1683 \
-		wd1684 \
-		wd193 \
-		wd593 \
-		wd279 \
-		wd810 \
-		wd869 \
-		wd981
-	do
-		CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt"
-		if { (eval echo "$as_me:3993: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
-  ac_status=$?
-  echo "$as_me:3996: \$? = $ac_status" >&5
-  (exit $ac_status); }; then
-			test -n "$verbose" && echo "$as_me:3998: result: ... -$cf_opt" >&5
-echo "${ECHO_T}... -$cf_opt" >&6
-			EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt"
-		fi
-	done
-	CFLAGS="$cf_save_CFLAGS"
-
-elif test "$GCC" = yes
-then
-	{ echo "$as_me:4007: checking for $CC warning options..." >&5
-echo "$as_me: checking for $CC warning options..." >&6;}
-	cf_save_CFLAGS="$CFLAGS"
-	EXTRA_CFLAGS=
-	cf_warn_CONST=""
-	test "$with_ext_const" = yes && cf_warn_CONST="Wwrite-strings"
-	for cf_opt in W Wall \
-		Wbad-function-cast \
-		Wcast-align \
-		Wcast-qual \
-		Winline \
-		Wmissing-declarations \
-		Wmissing-prototypes \
-		Wnested-externs \
-		Wpointer-arith \
-		Wshadow \
-		Wstrict-prototypes \
-		Wundef $cf_warn_CONST
-	do
-		CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt"
-		if { (eval echo "$as_me:4027: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
-  ac_status=$?
-  echo "$as_me:4030: \$? = $ac_status" >&5
-  (exit $ac_status); }; then
-			test -n "$verbose" && echo "$as_me:4032: result: ... -$cf_opt" >&5
-echo "${ECHO_T}... -$cf_opt" >&6
-			case $cf_opt in #(vi
-			Wcast-qual) #(vi
-				CPPFLAGS="$CPPFLAGS -DXTSTRINGDEFINES"
-				;;
-			Winline) #(vi
-				case $GCC_VERSION in
-				[34].*)
-					test -n "$verbose" && echo "	feature is broken in gcc $GCC_VERSION" 1>&6
+echo "$as_me:4200: checking for ncurses wrap-prefix" >&5
+echo $ECHO_N "checking for ncurses wrap-prefix... $ECHO_C" >&6
 
-echo "${as_me:-configure}:4043: testing feature is broken in gcc $GCC_VERSION ..." 1>&5
+# Check whether --with-ncurses-wrap-prefix or --without-ncurses-wrap-prefix was given.
+if test "${with_ncurses_wrap_prefix+set}" = set; then
+  withval="$with_ncurses_wrap_prefix"
+  NCURSES_WRAP_PREFIX=$withval
+else
+  NCURSES_WRAP_PREFIX=_nc_
+fi;
+echo "$as_me:4210: result: $NCURSES_WRAP_PREFIX" >&5
+echo "${ECHO_T}$NCURSES_WRAP_PREFIX" >&6
 
-					continue;;
-				esac
-				;;
-			esac
-			EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt"
-		fi
-	done
-	CFLAGS="$cf_save_CFLAGS"
-fi
-rm -rf conftest*
+echo "$as_me:4213: checking if you want to check for wide-character functions" >&5
+echo $ECHO_N "checking if you want to check for wide-character functions... $ECHO_C" >&6
 
-fi
-fi
+# Check whether --enable-widec or --disable-widec was given.
+if test "${enable_widec+set}" = set; then
+  enableval="$enable_widec"
+  test "$enableval" != no && enableval=yes
+  if test "$enableval" != "yes" ; then
+    cf_enable_widec=no
+  else
+    cf_enable_widec=yes
+  fi
+else
+  enableval=yes
+  cf_enable_widec=yes
 
-echo "$as_me:4059: checking if you want to use dmalloc for testing" >&5
-echo $ECHO_N "checking if you want to use dmalloc for testing... $ECHO_C" >&6
+fi;
+echo "$as_me:4230: result: $cf_enable_widec" >&5
+echo "${ECHO_T}$cf_enable_widec" >&6
 
-# Check whether --with-dmalloc or --without-dmalloc was given.
-if test "${with_dmalloc+set}" = set; then
-  withval="$with_dmalloc"
-  cat >>confdefs.h <<\EOF
-#define USE_DMALLOC 1
-EOF
+echo "$as_me:4233: checking for specific curses-directory" >&5
+echo $ECHO_N "checking for specific curses-directory... $ECHO_C" >&6
 
-	: ${with_cflags:=-g}
-	: ${with_no_leaks:=yes}
-	 with_dmalloc=yes
+# Check whether --with-curses-dir or --without-curses-dir was given.
+if test "${with_curses_dir+set}" = set; then
+  withval="$with_curses_dir"
+  cf_cv_curses_dir=$withval
 else
-  with_dmalloc=
+  cf_cv_curses_dir=no
 fi;
-echo "$as_me:4075: result: ${with_dmalloc:-no}" >&5
-echo "${ECHO_T}${with_dmalloc:-no}" >&6
+echo "$as_me:4243: result: $cf_cv_curses_dir" >&5
+echo "${ECHO_T}$cf_cv_curses_dir" >&6
 
-case .$with_cflags in #(vi
-.*-g*)
-	case .$CFLAGS in #(vi
-	.*-g*) #(vi
-		;;
-	*)
+if ( test -n "$cf_cv_curses_dir" && test "$cf_cv_curses_dir" != "no" )
+then
 
-cf_fix_cppflags=no
-cf_new_cflags=
-cf_new_cppflags=
-cf_new_extra_cppflags=
+if test "x$prefix" != xNONE; then
+  cf_path_syntax="$prefix"
+else
+  cf_path_syntax="$ac_default_prefix"
+fi
 
-for cf_add_cflags in -g
-do
-case $cf_fix_cppflags in
-no)
-	case $cf_add_cflags in #(vi
-	-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi
-		case $cf_add_cflags in
-		-D*)
-			cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'`
+case ".$withval" in #(vi
+.\$\(*\)*|.\'*\'*) #(vi
+  ;;
+..|./*|.\\*) #(vi
+  ;;
+.[a-zA-Z]:[\\/]*) #(vi OS/2 EMX
+  ;;
+.\${*prefix}*|.\${*dir}*) #(vi
+  eval withval="$withval"
+  case ".$withval" in #(vi
+  .NONE/*)
+    withval=`echo $withval | sed -e s%NONE%$cf_path_syntax%`
+    ;;
+  esac
+  ;; #(vi
+.no|.NONE/*)
+  withval=`echo $withval | sed -e s%NONE%$cf_path_syntax%`
+  ;;
+*)
+  { { echo "$as_me:4274: error: expected a pathname, not \"$withval\"" >&5
+echo "$as_me: error: expected a pathname, not \"$withval\"" >&2;}
+   { (exit 1); exit 1; }; }
+  ;;
+esac
 
-			test "${cf_add_cflags}" != "${cf_tst_cflags}" \
-				&& test -z "${cf_tst_cflags}" \
-				&& cf_fix_cppflags=yes
+	if test -d "$cf_cv_curses_dir"
+	then
 
-			if test $cf_fix_cppflags = yes ; then
-				cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
-				continue
-			elif test "${cf_tst_cflags}" = "\"'" ; then
-				cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
-				continue
+if test -n "$cf_cv_curses_dir/include" ; then
+  for cf_add_incdir in $cf_cv_curses_dir/include
+  do
+	while test $cf_add_incdir != /usr/include
+	do
+	  if test -d $cf_add_incdir
+	  then
+		cf_have_incdir=no
+		if test -n "$CFLAGS$CPPFLAGS" ; then
+		  # a loop is needed to ensure we can add subdirs of existing dirs
+		  for cf_test_incdir in $CFLAGS $CPPFLAGS ; do
+			if test ".$cf_test_incdir" = ".-I$cf_add_incdir" ; then
+			  cf_have_incdir=yes; break
 			fi
-			;;
-		esac
-		case "$CPPFLAGS" in
-		*$cf_add_cflags) #(vi
-			;;
-		*) #(vi
-			case $cf_add_cflags in #(vi
-			-D*)
-				cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'`
-
-CPPFLAGS=`echo "$CPPFLAGS" | \
-	sed	-e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ 	]*\)\?[ 	]/ /g' \
-		-e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ 	]*\)\?$//g'`
+		  done
+		fi
 
-				;;
-			esac
-			cf_new_cppflags="$cf_new_cppflags $cf_add_cflags"
-			;;
-		esac
-		;;
-	*)
-		cf_new_cflags="$cf_new_cflags $cf_add_cflags"
-		;;
-	esac
-	;;
-yes)
-	cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
+		if test "$cf_have_incdir" = no ; then
+		  if test "$cf_add_incdir" = /usr/local/include ; then
+			if test "$GCC" = yes
+			then
+			  cf_save_CPPFLAGS=$CPPFLAGS
+			  CPPFLAGS="$CPPFLAGS -I$cf_add_incdir"
+			  cat >conftest.$ac_ext <<_ACEOF
+#line 4307 "configure"
+#include "confdefs.h"
+#include <stdio.h>
+int
+main ()
+{
+printf("Hello")
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:4319: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:4322: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:4325: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:4328: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  :
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+cf_have_incdir=yes
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+			  CPPFLAGS=$cf_save_CPPFLAGS
+			fi
+		  fi
+		fi
 
-	cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'`
+		if test "$cf_have_incdir" = no ; then
+		  test -n "$verbose" && echo "	adding $cf_add_incdir to include-path" 1>&6
 
-	test "${cf_add_cflags}" != "${cf_tst_cflags}" \
-		&& test -z "${cf_tst_cflags}" \
-		&& cf_fix_cppflags=no
-	;;
-esac
-done
+echo "${as_me:-configure}:4345: testing adding $cf_add_incdir to include-path ..." 1>&5
 
-if test -n "$cf_new_cflags" ; then
+		  CPPFLAGS="$CPPFLAGS -I$cf_add_incdir"
 
-	CFLAGS="$CFLAGS $cf_new_cflags"
+		  cf_top_incdir=`echo $cf_add_incdir | sed -e 's%/include/.*$%/include%'`
+		  test "$cf_top_incdir" = "$cf_add_incdir" && break
+		  cf_add_incdir="$cf_top_incdir"
+		else
+		  break
+		fi
+	  fi
+	done
+  done
 fi
 
-if test -n "$cf_new_cppflags" ; then
-
-	CPPFLAGS="$CPPFLAGS $cf_new_cppflags"
-fi
+if test -n "$cf_cv_curses_dir/lib" ; then
+  for cf_add_libdir in $cf_cv_curses_dir/lib
+  do
+    if test $cf_add_libdir = /usr/lib ; then
+      :
+    elif test -d $cf_add_libdir
+    then
+      cf_have_libdir=no
+      if test -n "$LDFLAGS$LIBS" ; then
+        # a loop is needed to ensure we can add subdirs of existing dirs
+        for cf_test_libdir in $LDFLAGS $LIBS ; do
+          if test ".$cf_test_libdir" = ".-L$cf_add_libdir" ; then
+            cf_have_libdir=yes; break
+          fi
+        done
+      fi
+      if test "$cf_have_libdir" = no ; then
+        test -n "$verbose" && echo "	adding $cf_add_libdir to library-path" 1>&6
 
-if test -n "$cf_new_extra_cppflags" ; then
+echo "${as_me:-configure}:4379: testing adding $cf_add_libdir to library-path ..." 1>&5
 
-	EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS"
+        LDFLAGS="-L$cf_add_libdir $LDFLAGS"
+      fi
+    fi
+  done
 fi
 
-		;;
-	esac
+	fi
+fi
+
+cf_cv_screen=curses
+
+echo "$as_me:4392: checking for specified curses library type" >&5
+echo $ECHO_N "checking for specified curses library type... $ECHO_C" >&6
+
+# Check whether --with-ncursesw or --without-ncursesw was given.
+if test "${with_ncursesw+set}" = set; then
+  withval="$with_ncursesw"
+  cf_cv_screen=ncursesw
+else
+
+# Check whether --with-ncurses or --without-ncurses was given.
+if test "${with_ncurses+set}" = set; then
+  withval="$with_ncurses"
+  cf_cv_screen=ncurses
+else
+
+# Check whether --with-pdcurses or --without-pdcurses was given.
+if test "${with_pdcurses+set}" = set; then
+  withval="$with_pdcurses"
+  cf_cv_screen=pdcurses
+else
+
+# Check whether --with-curses-colr or --without-curses-colr was given.
+if test "${with_curses_colr+set}" = set; then
+  withval="$with_curses_colr"
+  cf_cv_screen=curses_colr
+else
+
+# Check whether --with-curses-5lib or --without-curses-5lib was given.
+if test "${with_curses_5lib+set}" = set; then
+  withval="$with_curses_5lib"
+  cf_cv_screen=curses_5lib
+fi;
+fi;
+fi;
+fi;
+fi;
+
+echo "$as_me:4429: result: $cf_cv_screen" >&5
+echo "${ECHO_T}$cf_cv_screen" >&6
+
+case $cf_cv_screen in #(vi
+curses|curses_*) #(vi
+
+echo "$as_me:4435: checking for extra include directories" >&5
+echo $ECHO_N "checking for extra include directories... $ECHO_C" >&6
+if test "${cf_cv_curses_incdir+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+cf_cv_curses_incdir=no
+case $host_os in #(vi
+hpux10.*) #(vi
+	if test "x$cf_cv_screen" = "xcurses_colr"
+	then
+		test -d /usr/include/curses_colr && \
+		cf_cv_curses_incdir="-I/usr/include/curses_colr"
+	fi
+	;;
+sunos3*|sunos4*)
+	if test "x$cf_cv_screen" = "xcurses_5lib"
+	then
+		test -d /usr/5lib && \
+		test -d /usr/5include && \
+		cf_cv_curses_incdir="-I/usr/5include"
+	fi
 	;;
 esac
 
-if test "$with_dmalloc" = yes ; then
-	echo "$as_me:4169: checking for dmalloc.h" >&5
-echo $ECHO_N "checking for dmalloc.h... $ECHO_C" >&6
-if test "${ac_cv_header_dmalloc_h+set}" = set; then
+fi
+echo "$as_me:4461: result: $cf_cv_curses_incdir" >&5
+echo "${ECHO_T}$cf_cv_curses_incdir" >&6
+test "$cf_cv_curses_incdir" != no && CPPFLAGS="$CPPFLAGS $cf_cv_curses_incdir"
+
+echo "$as_me:4465: checking if we have identified curses headers" >&5
+echo $ECHO_N "checking if we have identified curses headers... $ECHO_C" >&6
+if test "${cf_cv_ncurses_header+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+cf_cv_ncurses_header=none
+for cf_header in  \
+	ncurses.h \
+	curses.h ncurses/ncurses.h ncurses/curses.h
+do
+cat >conftest.$ac_ext <<_ACEOF
+#line 4477 "configure"
+#include "confdefs.h"
+#include <${cf_header}>
+int
+main ()
+{
+initscr(); tgoto("?", 0,0)
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:4489: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:4492: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:4495: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:4498: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  cf_cv_ncurses_header=$cf_header; break
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+done
+
+fi
+echo "$as_me:4509: result: $cf_cv_ncurses_header" >&5
+echo "${ECHO_T}$cf_cv_ncurses_header" >&6
+
+if test "$cf_cv_ncurses_header" = none ; then
+	{ { echo "$as_me:4513: error: No curses header-files found" >&5
+echo "$as_me: error: No curses header-files found" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+# cheat, to get the right #define's for HAVE_NCURSES_H, etc.
+
+for ac_header in $cf_cv_ncurses_header
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+echo "$as_me:4523: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 4175 "configure"
+#line 4529 "configure"
 #include "confdefs.h"
-#include <dmalloc.h>
+#include <$ac_header>
 _ACEOF
-if { (eval echo "$as_me:4179: \"$ac_cpp conftest.$ac_ext\"") >&5
+if { (eval echo "$as_me:4533: \"$ac_cpp conftest.$ac_ext\"") >&5
   (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
   ac_status=$?
   egrep -v '^ *\+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
-  echo "$as_me:4185: \$? = $ac_status" >&5
+  echo "$as_me:4539: \$? = $ac_status" >&5
   (exit $ac_status); } >/dev/null; then
   if test -s conftest.err; then
     ac_cpp_err=$ac_c_preproc_warn_flag
@@ -4193,238 +4547,316 @@
   ac_cpp_err=yes
 fi
 if test -z "$ac_cpp_err"; then
-  ac_cv_header_dmalloc_h=yes
+  eval "$as_ac_Header=yes"
 else
   echo "$as_me: failed program was:" >&5
   cat conftest.$ac_ext >&5
-  ac_cv_header_dmalloc_h=no
+  eval "$as_ac_Header=no"
 fi
 rm -f conftest.err conftest.$ac_ext
 fi
-echo "$as_me:4204: result: $ac_cv_header_dmalloc_h" >&5
-echo "${ECHO_T}$ac_cv_header_dmalloc_h" >&6
-if test $ac_cv_header_dmalloc_h = yes; then
+echo "$as_me:4558: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<EOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+EOF
 
-echo "$as_me:4208: checking for dmalloc_debug in -ldmalloc" >&5
-echo $ECHO_N "checking for dmalloc_debug in -ldmalloc... $ECHO_C" >&6
-if test "${ac_cv_lib_dmalloc_dmalloc_debug+set}" = set; then
+fi
+done
+
+echo "$as_me:4568: checking for terminfo header" >&5
+echo $ECHO_N "checking for terminfo header... $ECHO_C" >&6
+if test "${cf_cv_term_header+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-ldmalloc  $LIBS"
+
+case ${cf_cv_ncurses_header} in #(vi
+*/ncurses.h|*/ncursesw.h) #(vi
+	cf_term_header=`echo "$cf_cv_ncurses_header" | sed -e 's%ncurses[^.]*\.h$%term.h%'`
+	;;
+*)
+	cf_term_header=term.h
+	;;
+esac
+
+for cf_test in $cf_term_header "ncurses/term.h" "ncursesw/term.h"
+do
 cat >conftest.$ac_ext <<_ACEOF
-#line 4216 "configure"
+#line 4586 "configure"
 #include "confdefs.h"
+#include <stdio.h>
+#include <${cf_cv_ncurses_header:-curses.h}>
+#include <$cf_test>
 
-/* Override any gcc2 internal prototype to avoid an error.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
-char dmalloc_debug ();
 int
 main ()
 {
-dmalloc_debug ();
+int x = auto_left_margin
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:4235: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:4601: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:4238: \$? = $ac_status" >&5
+  echo "$as_me:4604: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:4241: \"$ac_try\"") >&5
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:4607: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:4244: \$? = $ac_status" >&5
+  echo "$as_me:4610: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_lib_dmalloc_dmalloc_debug=yes
+
+	cf_cv_term_header="$cf_test"
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-ac_cv_lib_dmalloc_dmalloc_debug=no
-fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-echo "$as_me:4255: result: $ac_cv_lib_dmalloc_dmalloc_debug" >&5
-echo "${ECHO_T}$ac_cv_lib_dmalloc_dmalloc_debug" >&6
-if test $ac_cv_lib_dmalloc_dmalloc_debug = yes; then
-  cat >>confdefs.h <<EOF
-#define HAVE_LIBDMALLOC 1
-EOF
 
-  LIBS="-ldmalloc $LIBS"
+	cf_cv_term_header=unknown
 
 fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+	test "$cf_cv_term_header" != unknown && break
+done
 
 fi
+echo "$as_me:4626: result: $cf_cv_term_header" >&5
+echo "${ECHO_T}$cf_cv_term_header" >&6
 
-fi
+# Set definitions to allow ifdef'ing to accommodate subdirectories
 
-echo "$as_me:4270: checking if you want to use dbmalloc for testing" >&5
-echo $ECHO_N "checking if you want to use dbmalloc for testing... $ECHO_C" >&6
+case $cf_cv_term_header in # (vi
+*term.h)
 
-# Check whether --with-dbmalloc or --without-dbmalloc was given.
-if test "${with_dbmalloc+set}" = set; then
-  withval="$with_dbmalloc"
-  cat >>confdefs.h <<\EOF
-#define USE_DBMALLOC 1
+cat >>confdefs.h <<\EOF
+#define HAVE_TERM_H 1
 EOF
 
-	: ${with_cflags:=-g}
-	: ${with_no_leaks:=yes}
-	 with_dbmalloc=yes
-else
-  with_dbmalloc=
-fi;
-echo "$as_me:4286: result: ${with_dbmalloc:-no}" >&5
-echo "${ECHO_T}${with_dbmalloc:-no}" >&6
+	;;
+esac
 
-case .$with_cflags in #(vi
-.*-g*)
-	case .$CFLAGS in #(vi
-	.*-g*) #(vi
-		;;
-	*)
+case $cf_cv_term_header in # (vi
+ncurses/term.h) #(vi
 
-cf_fix_cppflags=no
-cf_new_cflags=
-cf_new_cppflags=
-cf_new_extra_cppflags=
+cat >>confdefs.h <<\EOF
+#define HAVE_NCURSES_TERM_H 1
+EOF
 
-for cf_add_cflags in -g
-do
-case $cf_fix_cppflags in
-no)
-	case $cf_add_cflags in #(vi
-	-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi
-		case $cf_add_cflags in
-		-D*)
-			cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'`
+	;;
+ncursesw/term.h)
 
-			test "${cf_add_cflags}" != "${cf_tst_cflags}" \
-				&& test -z "${cf_tst_cflags}" \
-				&& cf_fix_cppflags=yes
+cat >>confdefs.h <<\EOF
+#define HAVE_NCURSESW_TERM_H 1
+EOF
 
-			if test $cf_fix_cppflags = yes ; then
-				cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
-				continue
-			elif test "${cf_tst_cflags}" = "\"'" ; then
-				cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
-				continue
-			fi
-			;;
-		esac
-		case "$CPPFLAGS" in
-		*$cf_add_cflags) #(vi
-			;;
-		*) #(vi
-			case $cf_add_cflags in #(vi
-			-D*)
-				cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'`
-
-CPPFLAGS=`echo "$CPPFLAGS" | \
-	sed	-e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ 	]*\)\?[ 	]/ /g' \
-		-e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ 	]*\)\?$//g'`
-
-				;;
-			esac
-			cf_new_cppflags="$cf_new_cppflags $cf_add_cflags"
-			;;
-		esac
-		;;
-	*)
-		cf_new_cflags="$cf_new_cflags $cf_add_cflags"
-		;;
-	esac
 	;;
-yes)
-	cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
+esac
 
-	cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'`
+echo "$as_me:4658: checking for ncurses version" >&5
+echo $ECHO_N "checking for ncurses version... $ECHO_C" >&6
+if test "${cf_cv_ncurses_version+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
 
-	test "${cf_add_cflags}" != "${cf_tst_cflags}" \
-		&& test -z "${cf_tst_cflags}" \
-		&& cf_fix_cppflags=no
-	;;
-esac
-done
+	cf_cv_ncurses_version=no
+	cf_tempfile=out$$
+	rm -f $cf_tempfile
+	if test "$cross_compiling" = yes; then
 
-if test -n "$cf_new_cflags" ; then
+	# This will not work if the preprocessor splits the line after the
+	# Autoconf token.  The 'unproto' program does that.
+	cat > conftest.$ac_ext <<EOF
+#include <${cf_cv_ncurses_header:-curses.h}>
+#undef Autoconf
+#ifdef NCURSES_VERSION
+Autoconf NCURSES_VERSION
+#else
+#ifdef __NCURSES_H
+Autoconf "old"
+#endif
+;
+#endif
+EOF
+	cf_try="$ac_cpp conftest.$ac_ext 2>&5 | grep '^Autoconf ' >conftest.out"
+	{ (eval echo "$as_me:4684: \"$cf_try\"") >&5
+  (eval $cf_try) 2>&5
+  ac_status=$?
+  echo "$as_me:4687: \$? = $ac_status" >&5
+  (exit $ac_status); }
+	if test -f conftest.out ; then
+		cf_out=`cat conftest.out | sed -e 's%^Autoconf %%' -e 's%^[^"]*"%%' -e 's%".*%%'`
+		test -n "$cf_out" && cf_cv_ncurses_version="$cf_out"
+		rm -f conftest.out
+	fi
 
-	CFLAGS="$CFLAGS $cf_new_cflags"
-fi
+else
+  cat >conftest.$ac_ext <<_ACEOF
+#line 4697 "configure"
+#include "confdefs.h"
 
-if test -n "$cf_new_cppflags" ; then
+#include <${cf_cv_ncurses_header:-curses.h}>
+#include <stdio.h>
+int main()
+{
+	FILE *fp = fopen("$cf_tempfile", "w");
+#ifdef NCURSES_VERSION
+# ifdef NCURSES_VERSION_PATCH
+	fprintf(fp, "%s.%d\n", NCURSES_VERSION, NCURSES_VERSION_PATCH);
+# else
+	fprintf(fp, "%s\n", NCURSES_VERSION);
+# endif
+#else
+# ifdef __NCURSES_H
+	fprintf(fp, "old\n");
+# else
+	make an error
+# endif
+#endif
+	${cf_cv_main_return:-return}(0);
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:4722: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:4725: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (eval echo "$as_me:4727: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:4730: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
 
-	CPPFLAGS="$CPPFLAGS $cf_new_cppflags"
+	cf_cv_ncurses_version=`cat $cf_tempfile`
+else
+  echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
 fi
+rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+	rm -f $cf_tempfile
 
-if test -n "$cf_new_extra_cppflags" ; then
-
-	EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS"
 fi
+echo "$as_me:4744: result: $cf_cv_ncurses_version" >&5
+echo "${ECHO_T}$cf_cv_ncurses_version" >&6
+test "$cf_cv_ncurses_version" = no ||
+cat >>confdefs.h <<\EOF
+#define NCURSES 1
+EOF
 
-		;;
-	esac
-	;;
-esac
+echo "$as_me:4751: checking if we have identified curses libraries" >&5
+echo $ECHO_N "checking if we have identified curses libraries... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line 4754 "configure"
+#include "confdefs.h"
+#include <${cf_cv_ncurses_header:-curses.h}>
+int
+main ()
+{
+initscr(); tgoto("?", 0,0)
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:4766: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:4769: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:4772: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:4775: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  cf_result=yes
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+cf_result=no
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+echo "$as_me:4784: result: $cf_result" >&5
+echo "${ECHO_T}$cf_result" >&6
 
-if test "$with_dbmalloc" = yes ; then
-	echo "$as_me:4380: checking for dbmalloc.h" >&5
-echo $ECHO_N "checking for dbmalloc.h... $ECHO_C" >&6
-if test "${ac_cv_header_dbmalloc_h+set}" = set; then
+if test "$cf_result" = no ; then
+case $host_os in #(vi
+freebsd*) #(vi
+    echo "$as_me:4790: checking for tgoto in -lmytinfo" >&5
+echo $ECHO_N "checking for tgoto in -lmytinfo... $ECHO_C" >&6
+if test "${ac_cv_lib_mytinfo_tgoto+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
-#line 4386 "configure"
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lmytinfo  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+#line 4798 "configure"
 #include "confdefs.h"
-#include <dbmalloc.h>
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char tgoto ();
+int
+main ()
+{
+tgoto ();
+  ;
+  return 0;
+}
 _ACEOF
-if { (eval echo "$as_me:4390: \"$ac_cpp conftest.$ac_ext\"") >&5
-  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:4817: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
   ac_status=$?
-  egrep -v '^ *\+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:4396: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null; then
-  if test -s conftest.err; then
-    ac_cpp_err=$ac_c_preproc_warn_flag
-  else
-    ac_cpp_err=
-  fi
-else
-  ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
-  ac_cv_header_dbmalloc_h=yes
+  echo "$as_me:4820: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:4823: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:4826: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_mytinfo_tgoto=yes
 else
   echo "$as_me: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  ac_cv_header_dbmalloc_h=no
+cat conftest.$ac_ext >&5
+ac_cv_lib_mytinfo_tgoto=no
 fi
-rm -f conftest.err conftest.$ac_ext
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:4837: result: $ac_cv_lib_mytinfo_tgoto" >&5
+echo "${ECHO_T}$ac_cv_lib_mytinfo_tgoto" >&6
+if test $ac_cv_lib_mytinfo_tgoto = yes; then
+  LIBS="-lmytinfo $LIBS"
 fi
-echo "$as_me:4415: result: $ac_cv_header_dbmalloc_h" >&5
-echo "${ECHO_T}$ac_cv_header_dbmalloc_h" >&6
-if test $ac_cv_header_dbmalloc_h = yes; then
 
-echo "$as_me:4419: checking for debug_malloc in -ldbmalloc" >&5
-echo $ECHO_N "checking for debug_malloc in -ldbmalloc... $ECHO_C" >&6
-if test "${ac_cv_lib_dbmalloc_debug_malloc+set}" = set; then
+    ;;
+hpux10.*) #(vi
+	# Looking at HPUX 10.20, the Hcurses library is the oldest (1997), cur_colr
+	# next (1998), and xcurses "newer" (2000).  There is no header file for
+	# Hcurses; the subdirectory curses_colr has the headers (curses.h and
+	# term.h) for cur_colr
+	if test "x$cf_cv_screen" = "xcurses_colr"
+	then
+		echo "$as_me:4851: checking for initscr in -lcur_colr" >&5
+echo $ECHO_N "checking for initscr in -lcur_colr... $ECHO_C" >&6
+if test "${ac_cv_lib_cur_colr_initscr+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-ldbmalloc  $LIBS"
+LIBS="-lcur_colr  $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
-#line 4427 "configure"
+#line 4859 "configure"
 #include "confdefs.h"
 
 /* Override any gcc2 internal prototype to avoid an error.  */
@@ -4433,313 +4865,115 @@
 #endif
 /* We use char because int might match the return type of a gcc2
    builtin and then its argument prototype would still apply.  */
-char debug_malloc ();
+char initscr ();
 int
 main ()
 {
-debug_malloc ();
+initscr ();
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:4446: \"$ac_link\"") >&5
+if { (eval echo "$as_me:4878: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:4449: \$? = $ac_status" >&5
+  echo "$as_me:4881: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:4452: \"$ac_try\"") >&5
+  { (eval echo "$as_me:4884: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:4455: \$? = $ac_status" >&5
+  echo "$as_me:4887: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_lib_dbmalloc_debug_malloc=yes
+  ac_cv_lib_cur_colr_initscr=yes
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-ac_cv_lib_dbmalloc_debug_malloc=no
+ac_cv_lib_cur_colr_initscr=no
 fi
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-echo "$as_me:4466: result: $ac_cv_lib_dbmalloc_debug_malloc" >&5
-echo "${ECHO_T}$ac_cv_lib_dbmalloc_debug_malloc" >&6
-if test $ac_cv_lib_dbmalloc_debug_malloc = yes; then
-  cat >>confdefs.h <<EOF
-#define HAVE_LIBDBMALLOC 1
-EOF
-
-  LIBS="-ldbmalloc $LIBS"
+echo "$as_me:4898: result: $ac_cv_lib_cur_colr_initscr" >&5
+echo "${ECHO_T}$ac_cv_lib_cur_colr_initscr" >&6
+if test $ac_cv_lib_cur_colr_initscr = yes; then
 
-fi
+			LIBS="-lcur_colr $LIBS"
+			ac_cv_func_initscr=yes
 
-fi
+else
 
-fi
+		echo "$as_me:4907: checking for initscr in -lHcurses" >&5
+echo $ECHO_N "checking for initscr in -lHcurses... $ECHO_C" >&6
+if test "${ac_cv_lib_Hcurses_initscr+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lHcurses  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+#line 4915 "configure"
+#include "confdefs.h"
 
-echo "$as_me:4481: checking if you want to use valgrind for testing" >&5
-echo $ECHO_N "checking if you want to use valgrind for testing... $ECHO_C" >&6
-
-# Check whether --with-valgrind or --without-valgrind was given.
-if test "${with_valgrind+set}" = set; then
-  withval="$with_valgrind"
-  cat >>confdefs.h <<\EOF
-#define USE_VALGRIND 1
-EOF
-
-	: ${with_cflags:=-g}
-	: ${with_no_leaks:=yes}
-	 with_valgrind=yes
-else
-  with_valgrind=
-fi;
-echo "$as_me:4497: result: ${with_valgrind:-no}" >&5
-echo "${ECHO_T}${with_valgrind:-no}" >&6
-
-case .$with_cflags in #(vi
-.*-g*)
-	case .$CFLAGS in #(vi
-	.*-g*) #(vi
-		;;
-	*)
-
-cf_fix_cppflags=no
-cf_new_cflags=
-cf_new_cppflags=
-cf_new_extra_cppflags=
-
-for cf_add_cflags in -g
-do
-case $cf_fix_cppflags in
-no)
-	case $cf_add_cflags in #(vi
-	-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi
-		case $cf_add_cflags in
-		-D*)
-			cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'`
-
-			test "${cf_add_cflags}" != "${cf_tst_cflags}" \
-				&& test -z "${cf_tst_cflags}" \
-				&& cf_fix_cppflags=yes
-
-			if test $cf_fix_cppflags = yes ; then
-				cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
-				continue
-			elif test "${cf_tst_cflags}" = "\"'" ; then
-				cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
-				continue
-			fi
-			;;
-		esac
-		case "$CPPFLAGS" in
-		*$cf_add_cflags) #(vi
-			;;
-		*) #(vi
-			case $cf_add_cflags in #(vi
-			-D*)
-				cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'`
-
-CPPFLAGS=`echo "$CPPFLAGS" | \
-	sed	-e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ 	]*\)\?[ 	]/ /g' \
-		-e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ 	]*\)\?$//g'`
-
-				;;
-			esac
-			cf_new_cppflags="$cf_new_cppflags $cf_add_cflags"
-			;;
-		esac
-		;;
-	*)
-		cf_new_cflags="$cf_new_cflags $cf_add_cflags"
-		;;
-	esac
-	;;
-yes)
-	cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
-
-	cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'`
-
-	test "${cf_add_cflags}" != "${cf_tst_cflags}" \
-		&& test -z "${cf_tst_cflags}" \
-		&& cf_fix_cppflags=no
-	;;
-esac
-done
-
-if test -n "$cf_new_cflags" ; then
-
-	CFLAGS="$CFLAGS $cf_new_cflags"
-fi
-
-if test -n "$cf_new_cppflags" ; then
-
-	CPPFLAGS="$CPPFLAGS $cf_new_cppflags"
-fi
-
-if test -n "$cf_new_extra_cppflags" ; then
-
-	EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS"
-fi
-
-		;;
-	esac
-	;;
-esac
-
-echo "$as_me:4590: checking if you want to perform memory-leak testing" >&5
-echo $ECHO_N "checking if you want to perform memory-leak testing... $ECHO_C" >&6
-
-# Check whether --enable-leaks or --disable-leaks was given.
-if test "${enable_leaks+set}" = set; then
-  enableval="$enable_leaks"
-  if test "x$enableval" = xno; then with_no_leaks=yes; else with_no_leaks=no; fi
-else
-  : ${with_no_leaks:=no}
-fi;
-echo "$as_me:4600: result: $with_no_leaks" >&5
-echo "${ECHO_T}$with_no_leaks" >&6
-
-if test "$with_no_leaks" = yes ; then
-	cat >>confdefs.h <<\EOF
-#define NO_LEAKS 1
-EOF
-
-	cat >>confdefs.h <<\EOF
-#define YY_NO_LEAKS 1
-EOF
-
-fi
-
-echo "$as_me:4614: checking for specific curses-directory" >&5
-echo $ECHO_N "checking for specific curses-directory... $ECHO_C" >&6
-
-# Check whether --with-curses-dir or --without-curses-dir was given.
-if test "${with_curses_dir+set}" = set; then
-  withval="$with_curses_dir"
-  cf_cv_curses_dir=$withval
-else
-  cf_cv_curses_dir=no
-fi;
-echo "$as_me:4624: result: $cf_cv_curses_dir" >&5
-echo "${ECHO_T}$cf_cv_curses_dir" >&6
-
-if ( test -n "$cf_cv_curses_dir" && test "$cf_cv_curses_dir" != "no" )
-then
-
-if test "x$prefix" != xNONE; then
-  cf_path_syntax="$prefix"
-else
-  cf_path_syntax="$ac_default_prefix"
-fi
-
-case ".$withval" in #(vi
-.\$\(*\)*|.\'*\'*) #(vi
-  ;;
-..|./*|.\\*) #(vi
-  ;;
-.[a-zA-Z]:[\\/]*) #(vi OS/2 EMX
-  ;;
-.\${*prefix}*) #(vi
-  eval withval="$withval"
-  case ".$withval" in #(vi
-  .NONE/*)
-    withval=`echo $withval | sed -e s%NONE%$cf_path_syntax%`
-    ;;
-  esac
-  ;; #(vi
-.no|.NONE/*)
-  withval=`echo $withval | sed -e s%NONE%$cf_path_syntax%`
-  ;;
-*)
-  { { echo "$as_me:4655: error: expected a pathname, not \"$withval\"" >&5
-echo "$as_me: error: expected a pathname, not \"$withval\"" >&2;}
-   { (exit 1); exit 1; }; }
-  ;;
-esac
-
-	if test -d "$cf_cv_curses_dir"
-	then
-
-if test -n "$cf_cv_curses_dir/include" ; then
-  for cf_add_incdir in $cf_cv_curses_dir/include
-  do
-	while test $cf_add_incdir != /usr/include
-	do
-	  if test -d $cf_add_incdir
-	  then
-		cf_have_incdir=no
-		if test -n "$CFLAGS$CPPFLAGS" ; then
-		  # a loop is needed to ensure we can add subdirs of existing dirs
-		  for cf_test_incdir in $CFLAGS $CPPFLAGS ; do
-			if test ".$cf_test_incdir" = ".-I$cf_add_incdir" ; then
-			  cf_have_incdir=yes; break
-			fi
-		  done
-		fi
-
-		if test "$cf_have_incdir" = no ; then
-		  if test "$cf_add_incdir" = /usr/local/include ; then
-			if test "$GCC" = yes
-			then
-			  cf_save_CPPFLAGS=$CPPFLAGS
-			  CPPFLAGS="$CPPFLAGS -I$cf_add_incdir"
-			  cat >conftest.$ac_ext <<_ACEOF
-#line 4688 "configure"
-#include "confdefs.h"
-#include <stdio.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char initscr ();
 int
 main ()
 {
-printf("Hello")
+initscr ();
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:4700: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:4934: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:4703: \$? = $ac_status" >&5
+  echo "$as_me:4937: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:4706: \"$ac_try\"") >&5
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:4940: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:4709: \$? = $ac_status" >&5
+  echo "$as_me:4943: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  :
+  ac_cv_lib_Hcurses_initscr=yes
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-cf_have_incdir=yes
+ac_cv_lib_Hcurses_initscr=no
 fi
-rm -f conftest.$ac_objext conftest.$ac_ext
-			  CPPFLAGS=$cf_save_CPPFLAGS
-			fi
-		  fi
-		fi
-
-		if test "$cf_have_incdir" = no ; then
-		  test -n "$verbose" && echo "	adding $cf_add_incdir to include-path" 1>&6
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:4954: result: $ac_cv_lib_Hcurses_initscr" >&5
+echo "${ECHO_T}$ac_cv_lib_Hcurses_initscr" >&6
+if test $ac_cv_lib_Hcurses_initscr = yes; then
 
-echo "${as_me:-configure}:4726: testing adding $cf_add_incdir to include-path ..." 1>&5
+			# HP's header uses __HP_CURSES, but user claims _HP_CURSES.
+			LIBS="-lHcurses $LIBS"
+			CPPFLAGS="$CPPFLAGS -D__HP_CURSES -D_HP_CURSES"
+			ac_cv_func_initscr=yes
 
-		  CPPFLAGS="$CPPFLAGS -I$cf_add_incdir"
+fi
 
-		  cf_top_incdir=`echo $cf_add_incdir | sed -e 's%/include/.*$%/include%'`
-		  test "$cf_top_incdir" = "$cf_add_incdir" && break
-		  cf_add_incdir="$cf_top_incdir"
-		else
-		  break
-		fi
-	  fi
-	done
-  done
 fi
 
-if test -n "$cf_cv_curses_dir/lib" ; then
-  for cf_add_libdir in $cf_cv_curses_dir/lib
+	fi
+	;;
+linux*)
+	case `arch 2>/dev/null` in
+	x86_64)
+		if test -d /lib64
+		then
+
+if test -n "/lib64" ; then
+  for cf_add_libdir in /lib64
   do
     if test $cf_add_libdir = /usr/lib ; then
       :
@@ -4757,7 +4991,7 @@
       if test "$cf_have_libdir" = no ; then
         test -n "$verbose" && echo "	adding $cf_add_libdir to library-path" 1>&6
 
-echo "${as_me:-configure}:4760: testing adding $cf_add_libdir to library-path ..." 1>&5
+echo "${as_me:-configure}:4994: testing adding $cf_add_libdir to library-path ..." 1>&5
 
         LDFLAGS="-L$cf_add_libdir $LDFLAGS"
       fi
@@ -4765,370 +4999,339 @@
   done
 fi
 
-	fi
-fi
+		else
 
-# Check whether --with-5lib or --without-5lib was given.
-if test "${with_5lib+set}" = set; then
-  withval="$with_5lib"
-  LIBS="-L/usr/5lib $LIBS"
-	 CPPFLAGS="$CPPFLAGS -I/usr/5include"
-fi;
+if test -n "/lib" ; then
+  for cf_add_libdir in /lib
+  do
+    if test $cf_add_libdir = /usr/lib ; then
+      :
+    elif test -d $cf_add_libdir
+    then
+      cf_have_libdir=no
+      if test -n "$LDFLAGS$LIBS" ; then
+        # a loop is needed to ensure we can add subdirs of existing dirs
+        for cf_test_libdir in $LDFLAGS $LIBS ; do
+          if test ".$cf_test_libdir" = ".-L$cf_add_libdir" ; then
+            cf_have_libdir=yes; break
+          fi
+        done
+      fi
+      if test "$cf_have_libdir" = no ; then
+        test -n "$verbose" && echo "	adding $cf_add_libdir to library-path" 1>&6
 
-# Check whether --with-ncursesw or --without-ncursesw was given.
-if test "${with_ncursesw+set}" = set; then
-  withval="$with_ncursesw"
-  cf_cv_screen=ncursesw
-else
+echo "${as_me:-configure}:5023: testing adding $cf_add_libdir to library-path ..." 1>&5
 
-# Check whether --with-ncurses or --without-ncurses was given.
-if test "${with_ncurses+set}" = set; then
-  withval="$with_ncurses"
-  cf_cv_screen=ncurses
-else
+        LDFLAGS="-L$cf_add_libdir $LDFLAGS"
+      fi
+    fi
+  done
+fi
 
-# Check whether --with-pdcurses or --without-pdcurses was given.
-if test "${with_pdcurses+set}" = set; then
-  withval="$with_pdcurses"
-  cf_cv_screen=pdcurses
-fi;
-fi;
-fi;
+		fi
+		;;
+	*)
 
-case $cf_cv_screen in
-curses)
+if test -n "/lib" ; then
+  for cf_add_libdir in /lib
+  do
+    if test $cf_add_libdir = /usr/lib ; then
+      :
+    elif test -d $cf_add_libdir
+    then
+      cf_have_libdir=no
+      if test -n "$LDFLAGS$LIBS" ; then
+        # a loop is needed to ensure we can add subdirs of existing dirs
+        for cf_test_libdir in $LDFLAGS $LIBS ; do
+          if test ".$cf_test_libdir" = ".-L$cf_add_libdir" ; then
+            cf_have_libdir=yes; break
+          fi
+        done
+      fi
+      if test "$cf_have_libdir" = no ; then
+        test -n "$verbose" && echo "	adding $cf_add_libdir to library-path" 1>&6
 
-echo "$as_me:4801: checking for extra include directories" >&5
-echo $ECHO_N "checking for extra include directories... $ECHO_C" >&6
-if test "${cf_cv_curses_incdir+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
+echo "${as_me:-configure}:5054: testing adding $cf_add_libdir to library-path ..." 1>&5
 
-cf_cv_curses_incdir=no
-case $host_os in #(vi
-hpux10.*) #(vi
-	test -d /usr/include/curses_colr && \
-	cf_cv_curses_incdir="-I/usr/include/curses_colr"
+        LDFLAGS="-L$cf_add_libdir $LDFLAGS"
+      fi
+    fi
+  done
+fi
+
+		;;
+	esac
 	;;
 sunos3*|sunos4*)
-	test -d /usr/5lib && \
-	test -d /usr/5include && \
-	cf_cv_curses_incdir="-I/usr/5include"
-	;;
-esac
+	if test "x$cf_cv_screen" = "xcurses_5lib"
+	then
+		if test -d /usr/5lib ; then
+
+if test -n "/usr/5lib" ; then
+  for cf_add_libdir in /usr/5lib
+  do
+    if test $cf_add_libdir = /usr/lib ; then
+      :
+    elif test -d $cf_add_libdir
+    then
+      cf_have_libdir=no
+      if test -n "$LDFLAGS$LIBS" ; then
+        # a loop is needed to ensure we can add subdirs of existing dirs
+        for cf_test_libdir in $LDFLAGS $LIBS ; do
+          if test ".$cf_test_libdir" = ".-L$cf_add_libdir" ; then
+            cf_have_libdir=yes; break
+          fi
+        done
+      fi
+      if test "$cf_have_libdir" = no ; then
+        test -n "$verbose" && echo "	adding $cf_add_libdir to library-path" 1>&6
 
+echo "${as_me:-configure}:5089: testing adding $cf_add_libdir to library-path ..." 1>&5
+
+        LDFLAGS="-L$cf_add_libdir $LDFLAGS"
+      fi
+    fi
+  done
 fi
-echo "$as_me:4821: result: $cf_cv_curses_incdir" >&5
-echo "${ECHO_T}$cf_cv_curses_incdir" >&6
-test "$cf_cv_curses_incdir" != no && CPPFLAGS="$CPPFLAGS $cf_cv_curses_incdir"
 
-echo "$as_me:4825: checking if we have identified curses headers" >&5
-echo $ECHO_N "checking if we have identified curses headers... $ECHO_C" >&6
-if test "${cf_cv_ncurses_header+set}" = set; then
+			LIBS="-lcurses -ltermcap $LIBS"
+		fi
+    fi
+    ac_cv_func_initscr=yes
+    ;;
+esac
+
+if test ".$ac_cv_func_initscr" != .yes ; then
+	cf_save_LIBS="$LIBS"
+
+	if test ".${cf_cv_ncurses_version:-no}" != .no
+	then
+		cf_check_list="ncurses curses cursesX"
+	else
+		cf_check_list="cursesX curses ncurses"
+	fi
+
+	# Check for library containing tgoto.  Do this before curses library
+	# because it may be needed to link the test-case for initscr.
+	if test "x$cf_term_lib" = x
+	then
+		echo "$as_me:5118: checking for tgoto" >&5
+echo $ECHO_N "checking for tgoto... $ECHO_C" >&6
+if test "${ac_cv_func_tgoto+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-
-cf_cv_ncurses_header=none
-for cf_header in  \
-	curses.h \
-	ncurses.h ncurses/curses.h ncurses/ncurses.h
-do
-cat >conftest.$ac_ext <<_ACEOF
-#line 4837 "configure"
+  cat >conftest.$ac_ext <<_ACEOF
+#line 5124 "configure"
 #include "confdefs.h"
-#include <${cf_header}>
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char tgoto (); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char tgoto ();
+char (*f) ();
+
 int
 main ()
 {
-initscr(); tgoto("?", 0,0)
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_tgoto) || defined (__stub___tgoto)
+choke me
+#else
+f = tgoto; /* workaround for ICC 12.0.3 */ if (f == 0) return 1;
+#endif
+
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:4849: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:5155: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:4852: \$? = $ac_status" >&5
+  echo "$as_me:5158: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:4855: \"$ac_try\"") >&5
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:5161: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:4858: \$? = $ac_status" >&5
+  echo "$as_me:5164: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  cf_cv_ncurses_header=$cf_header; break
+  ac_cv_func_tgoto=yes
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
+ac_cv_func_tgoto=no
 fi
-rm -f conftest.$ac_objext conftest.$ac_ext
-done
-
-fi
-echo "$as_me:4869: result: $cf_cv_ncurses_header" >&5
-echo "${ECHO_T}$cf_cv_ncurses_header" >&6
-
-if test "$cf_cv_ncurses_header" = none ; then
-	{ { echo "$as_me:4873: error: No curses header-files found" >&5
-echo "$as_me: error: No curses header-files found" >&2;}
-   { (exit 1); exit 1; }; }
-fi
-
-# cheat, to get the right #define's for HAVE_NCURSES_H, etc.
-
-for ac_header in $cf_cv_ncurses_header
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-echo "$as_me:4883: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-#line 4889 "configure"
-#include "confdefs.h"
-#include <$ac_header>
-_ACEOF
-if { (eval echo "$as_me:4893: \"$ac_cpp conftest.$ac_ext\"") >&5
-  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
-  ac_status=$?
-  egrep -v '^ *\+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:4899: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null; then
-  if test -s conftest.err; then
-    ac_cpp_err=$ac_c_preproc_warn_flag
-  else
-    ac_cpp_err=
-  fi
-else
-  ac_cpp_err=yes
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 fi
-if test -z "$ac_cpp_err"; then
-  eval "$as_ac_Header=yes"
+echo "$as_me:5174: result: $ac_cv_func_tgoto" >&5
+echo "${ECHO_T}$ac_cv_func_tgoto" >&6
+if test $ac_cv_func_tgoto = yes; then
+  cf_term_lib=predefined
 else
-  echo "$as_me: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  eval "$as_ac_Header=no"
-fi
-rm -f conftest.err conftest.$ac_ext
-fi
-echo "$as_me:4918: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  cat >>confdefs.h <<EOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-EOF
-
-fi
-done
 
-echo "$as_me:4928: checking for terminfo header" >&5
-echo $ECHO_N "checking for terminfo header... $ECHO_C" >&6
-if test "${cf_cv_term_header+set}" = set; then
+			for cf_term_lib in $cf_check_list otermcap termcap tinfo termlib unknown
+			do
+				as_ac_Lib=`echo "ac_cv_lib_$cf_term_lib''_tgoto" | $as_tr_sh`
+echo "$as_me:5183: checking for tgoto in -l$cf_term_lib" >&5
+echo $ECHO_N "checking for tgoto in -l$cf_term_lib... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Lib+set}\" = set"; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-
-case ${cf_cv_ncurses_header} in #(vi
-*/ncurses.h|*/ncursesw.h) #(vi
-	cf_term_header=`echo "$cf_cv_ncurses_header" | sed -e 's%ncurses[^.]*\.h$%term.h%'`
-	;;
-*)
-	cf_term_header=term.h
-	;;
-esac
-
-for cf_test in $cf_term_header "ncurses/term.h" "ncursesw/term.h"
-do
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-l$cf_term_lib  $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
-#line 4946 "configure"
+#line 5191 "configure"
 #include "confdefs.h"
-#include <stdio.h>
-#include <${cf_cv_ncurses_header:-curses.h}>
-#include <$cf_test>
 
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char tgoto ();
 int
 main ()
 {
-int x = auto_left_margin
+tgoto ();
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:4961: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:5210: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:4964: \$? = $ac_status" >&5
+  echo "$as_me:5213: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:4967: \"$ac_try\"") >&5
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:5216: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:4970: \$? = $ac_status" >&5
+  echo "$as_me:5219: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-
-	cf_cv_term_header="$cf_test"
+  eval "$as_ac_Lib=yes"
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-
-	cf_cv_term_header=unknown
-
+eval "$as_ac_Lib=no"
 fi
-rm -f conftest.$ac_objext conftest.$ac_ext
-	test "$cf_cv_term_header" != unknown && break
-done
-
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:5230: result: `eval echo '${'$as_ac_Lib'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Lib'}'`" >&6
+if test `eval echo '${'$as_ac_Lib'}'` = yes; then
+  break
 fi
-echo "$as_me:4986: result: $cf_cv_term_header" >&5
-echo "${ECHO_T}$cf_cv_term_header" >&6
-
-# Set definitions to allow ifdef'ing to accommodate subdirectories
-
-case $cf_cv_term_header in # (vi
-*term.h)
-	cat >>confdefs.h <<\EOF
-#define HAVE_TERM_H 1
-EOF
-
-	;;
-esac
-
-case $cf_cv_term_header in # (vi
-ncurses/term.h) #(vi
-	cat >>confdefs.h <<\EOF
-#define HAVE_NCURSES_TERM_H 1
-EOF
-
-	;;
-ncursesw/term.h)
-	cat >>confdefs.h <<\EOF
-#define HAVE_NCURSESW_TERM_H 1
-EOF
-
-	;;
-esac
 
-echo "$as_me:5015: checking for ncurses version" >&5
-echo $ECHO_N "checking for ncurses version... $ECHO_C" >&6
-if test "${cf_cv_ncurses_version+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
+			done
 
-	cf_cv_ncurses_version=no
-	cf_tempfile=out$$
-	rm -f $cf_tempfile
-	if test "$cross_compiling" = yes; then
+fi
 
-	# This will not work if the preprocessor splits the line after the
-	# Autoconf token.  The 'unproto' program does that.
-	cat > conftest.$ac_ext <<EOF
-#include <${cf_cv_ncurses_header:-curses.h}>
-#undef Autoconf
-#ifdef NCURSES_VERSION
-Autoconf NCURSES_VERSION
-#else
-#ifdef __NCURSES_H
-Autoconf "old"
-#endif
-;
-#endif
-EOF
-	cf_try="$ac_cpp conftest.$ac_ext 2>&5 | grep '^Autoconf ' >conftest.out"
-	{ (eval echo "$as_me:5041: \"$cf_try\"") >&5
-  (eval $cf_try) 2>&5
-  ac_status=$?
-  echo "$as_me:5044: \$? = $ac_status" >&5
-  (exit $ac_status); }
-	if test -f conftest.out ; then
-		cf_out=`cat conftest.out | sed -e 's%^Autoconf %%' -e 's%^[^"]*"%%' -e 's%".*%%'`
-		test -n "$cf_out" && cf_cv_ncurses_version="$cf_out"
-		rm -f conftest.out
 	fi
 
+	# Check for library containing initscr
+	test "$cf_term_lib" != predefined && test "$cf_term_lib" != unknown && LIBS="-l$cf_term_lib $cf_save_LIBS"
+	if test "x$cf_curs_lib" = x
+	then
+		for cf_curs_lib in $cf_check_list xcurses jcurses pdcurses unknown
+		do
+			as_ac_Lib=`echo "ac_cv_lib_$cf_curs_lib''_initscr" | $as_tr_sh`
+echo "$as_me:5249: checking for initscr in -l$cf_curs_lib" >&5
+echo $ECHO_N "checking for initscr in -l$cf_curs_lib... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Lib+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
-#line 5054 "configure"
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-l$cf_curs_lib  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+#line 5257 "configure"
 #include "confdefs.h"
 
-#include <${cf_cv_ncurses_header:-curses.h}>
-#include <stdio.h>
-int main()
-{
-	FILE *fp = fopen("$cf_tempfile", "w");
-#ifdef NCURSES_VERSION
-# ifdef NCURSES_VERSION_PATCH
-	fprintf(fp, "%s.%d\n", NCURSES_VERSION, NCURSES_VERSION_PATCH);
-# else
-	fprintf(fp, "%s\n", NCURSES_VERSION);
-# endif
-#else
-# ifdef __NCURSES_H
-	fprintf(fp, "old\n");
-# else
-	make an error
-# endif
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
 #endif
-	${cf_cv_main_return:-return}(0);
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char initscr ();
+int
+main ()
+{
+initscr ();
+  ;
+  return 0;
 }
 _ACEOF
-rm -f conftest$ac_exeext
-if { (eval echo "$as_me:5079: \"$ac_link\"") >&5
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:5276: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:5082: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (eval echo "$as_me:5084: \"$ac_try\"") >&5
+  echo "$as_me:5279: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:5282: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:5087: \$? = $ac_status" >&5
+  echo "$as_me:5285: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-
-	cf_cv_ncurses_version=`cat $cf_tempfile`
+  eval "$as_ac_Lib=yes"
 else
-  echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
+  echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
+eval "$as_ac_Lib=no"
 fi
-rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
 fi
-	rm -f $cf_tempfile
-
+echo "$as_me:5296: result: `eval echo '${'$as_ac_Lib'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Lib'}'`" >&6
+if test `eval echo '${'$as_ac_Lib'}'` = yes; then
+  break
 fi
-echo "$as_me:5101: result: $cf_cv_ncurses_version" >&5
-echo "${ECHO_T}$cf_cv_ncurses_version" >&6
-test "$cf_cv_ncurses_version" = no || cat >>confdefs.h <<\EOF
-#define NCURSES 1
-EOF
 
-echo "$as_me:5107: checking if we have identified curses libraries" >&5
-echo $ECHO_N "checking if we have identified curses libraries... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-#line 5110 "configure"
+		done
+	fi
+	test $cf_curs_lib = unknown && { { echo "$as_me:5304: error: no curses library found" >&5
+echo "$as_me: error: no curses library found" >&2;}
+   { (exit 1); exit 1; }; }
+
+	LIBS="-l$cf_curs_lib $cf_save_LIBS"
+	if test "$cf_term_lib" = unknown ; then
+		echo "$as_me:5310: checking if we can link with $cf_curs_lib library" >&5
+echo $ECHO_N "checking if we can link with $cf_curs_lib library... $ECHO_C" >&6
+		cat >conftest.$ac_ext <<_ACEOF
+#line 5313 "configure"
 #include "confdefs.h"
 #include <${cf_cv_ncurses_header:-curses.h}>
 int
 main ()
 {
-initscr(); tgoto("?", 0,0)
+initscr()
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:5122: \"$ac_link\"") >&5
+if { (eval echo "$as_me:5325: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:5125: \$? = $ac_status" >&5
+  echo "$as_me:5328: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:5128: \"$ac_try\"") >&5
+  { (eval echo "$as_me:5331: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:5131: \$? = $ac_status" >&5
+  echo "$as_me:5334: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   cf_result=yes
 else
@@ -5137,919 +5340,720 @@
 cf_result=no
 fi
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
-echo "$as_me:5140: result: $cf_result" >&5
+		echo "$as_me:5343: result: $cf_result" >&5
 echo "${ECHO_T}$cf_result" >&6
-
-if test "$cf_result" = no ; then
-case $host_os in #(vi
-freebsd*) #(vi
-    echo "$as_me:5146: checking for tgoto in -lmytinfo" >&5
-echo $ECHO_N "checking for tgoto in -lmytinfo... $ECHO_C" >&6
-if test "${ac_cv_lib_mytinfo_tgoto+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lmytinfo  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-#line 5154 "configure"
+		test $cf_result = no && { { echo "$as_me:5345: error: Cannot link curses library" >&5
+echo "$as_me: error: Cannot link curses library" >&2;}
+   { (exit 1); exit 1; }; }
+	elif test "$cf_curs_lib" = "$cf_term_lib" ; then
+		:
+	elif test "$cf_term_lib" != predefined ; then
+		echo "$as_me:5351: checking if we need both $cf_curs_lib and $cf_term_lib libraries" >&5
+echo $ECHO_N "checking if we need both $cf_curs_lib and $cf_term_lib libraries... $ECHO_C" >&6
+		cat >conftest.$ac_ext <<_ACEOF
+#line 5354 "configure"
 #include "confdefs.h"
-
-/* Override any gcc2 internal prototype to avoid an error.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
-char tgoto ();
+#include <${cf_cv_ncurses_header:-curses.h}>
 int
 main ()
 {
-tgoto ();
+initscr(); tgoto((char *)0, 0, 0);
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:5173: \"$ac_link\"") >&5
+if { (eval echo "$as_me:5366: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:5176: \$? = $ac_status" >&5
+  echo "$as_me:5369: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:5179: \"$ac_try\"") >&5
+  { (eval echo "$as_me:5372: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:5182: \$? = $ac_status" >&5
+  echo "$as_me:5375: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_lib_mytinfo_tgoto=yes
+  cf_result=no
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-ac_cv_lib_mytinfo_tgoto=no
-fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-echo "$as_me:5193: result: $ac_cv_lib_mytinfo_tgoto" >&5
-echo "${ECHO_T}$ac_cv_lib_mytinfo_tgoto" >&6
-if test $ac_cv_lib_mytinfo_tgoto = yes; then
-  LIBS="-lmytinfo $LIBS"
-fi
 
-    ;;
-hpux10.*) #(vi
-    echo "$as_me:5201: checking for initscr in -lcur_colr" >&5
-echo $ECHO_N "checking for initscr in -lcur_colr... $ECHO_C" >&6
-if test "${ac_cv_lib_cur_colr_initscr+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lcur_colr  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-#line 5209 "configure"
+			LIBS="-l$cf_curs_lib -l$cf_term_lib $cf_save_LIBS"
+			cat >conftest.$ac_ext <<_ACEOF
+#line 5384 "configure"
 #include "confdefs.h"
-
-/* Override any gcc2 internal prototype to avoid an error.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
-char initscr ();
+#include <${cf_cv_ncurses_header:-curses.h}>
 int
 main ()
 {
-initscr ();
+initscr()
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:5228: \"$ac_link\"") >&5
+if { (eval echo "$as_me:5396: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:5231: \$? = $ac_status" >&5
+  echo "$as_me:5399: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:5234: \"$ac_try\"") >&5
+  { (eval echo "$as_me:5402: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:5237: \$? = $ac_status" >&5
+  echo "$as_me:5405: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_lib_cur_colr_initscr=yes
+  cf_result=yes
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-ac_cv_lib_cur_colr_initscr=no
+cf_result=error
 fi
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
+
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+		echo "$as_me:5417: result: $cf_result" >&5
+echo "${ECHO_T}$cf_result" >&6
+	fi
+fi
 fi
-echo "$as_me:5248: result: $ac_cv_lib_cur_colr_initscr" >&5
-echo "${ECHO_T}$ac_cv_lib_cur_colr_initscr" >&6
-if test $ac_cv_lib_cur_colr_initscr = yes; then
 
-        LIBS="-lcur_colr $LIBS"
-        ac_cv_func_initscr=yes
+	;;
+ncurses) #(vi
 
-else
+cf_ncuconfig_root=ncurses
 
-    echo "$as_me:5257: checking for initscr in -lHcurses" >&5
-echo $ECHO_N "checking for initscr in -lHcurses... $ECHO_C" >&6
-if test "${ac_cv_lib_Hcurses_initscr+set}" = set; then
+echo "Looking for ${cf_ncuconfig_root}-config"
+
+if test -n "$ac_tool_prefix"; then
+  for ac_prog in ${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}5-config
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+echo "$as_me:5435: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_NCURSES_CONFIG+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lHcurses  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-#line 5265 "configure"
-#include "confdefs.h"
+  if test -n "$NCURSES_CONFIG"; then
+  ac_cv_prog_NCURSES_CONFIG="$NCURSES_CONFIG" # Let the user override the test.
+else
+  ac_save_IFS=$IFS; IFS=$ac_path_separator
+ac_dummy="$PATH"
+for ac_dir in $ac_dummy; do
+  IFS=$ac_save_IFS
+  test -z "$ac_dir" && ac_dir=.
+  $as_executable_p "$ac_dir/$ac_word" || continue
+ac_cv_prog_NCURSES_CONFIG="$ac_tool_prefix$ac_prog"
+echo "$as_me:5450: found $ac_dir/$ac_word" >&5
+break
+done
 
-/* Override any gcc2 internal prototype to avoid an error.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
-char initscr ();
-int
-main ()
-{
-initscr ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:5284: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
-  ac_status=$?
-  echo "$as_me:5287: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:5290: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:5293: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_lib_Hcurses_initscr=yes
-else
-  echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
-ac_cv_lib_Hcurses_initscr=no
-fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
 fi
-echo "$as_me:5304: result: $ac_cv_lib_Hcurses_initscr" >&5
-echo "${ECHO_T}$ac_cv_lib_Hcurses_initscr" >&6
-if test $ac_cv_lib_Hcurses_initscr = yes; then
-
-        # HP's header uses __HP_CURSES, but user claims _HP_CURSES.
-        LIBS="-lHcurses $LIBS"
-        CPPFLAGS="$CPPFLAGS -D__HP_CURSES -D_HP_CURSES"
-        ac_cv_func_initscr=yes
-
 fi
-
+NCURSES_CONFIG=$ac_cv_prog_NCURSES_CONFIG
+if test -n "$NCURSES_CONFIG"; then
+  echo "$as_me:5458: result: $NCURSES_CONFIG" >&5
+echo "${ECHO_T}$NCURSES_CONFIG" >&6
+else
+  echo "$as_me:5461: result: no" >&5
+echo "${ECHO_T}no" >&6
 fi
 
-    ;;
-linux*)
-	case `arch 2>/dev/null` in
-	x86_64)
-		if test -d /lib64
-		then
-
-if test -n "/lib64" ; then
-  for cf_add_libdir in /lib64
-  do
-    if test $cf_add_libdir = /usr/lib ; then
-      :
-    elif test -d $cf_add_libdir
-    then
-      cf_have_libdir=no
-      if test -n "$LDFLAGS$LIBS" ; then
-        # a loop is needed to ensure we can add subdirs of existing dirs
-        for cf_test_libdir in $LDFLAGS $LIBS ; do
-          if test ".$cf_test_libdir" = ".-L$cf_add_libdir" ; then
-            cf_have_libdir=yes; break
-          fi
-        done
-      fi
-      if test "$cf_have_libdir" = no ; then
-        test -n "$verbose" && echo "	adding $cf_add_libdir to library-path" 1>&6
-
-echo "${as_me:-configure}:5343: testing adding $cf_add_libdir to library-path ..." 1>&5
-
-        LDFLAGS="-L$cf_add_libdir $LDFLAGS"
-      fi
-    fi
+    test -n "$NCURSES_CONFIG" && break
   done
 fi
+if test -z "$NCURSES_CONFIG"; then
+  ac_ct_NCURSES_CONFIG=$NCURSES_CONFIG
+  for ac_prog in ${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}5-config
+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 "$as_me:5474: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_NCURSES_CONFIG+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_NCURSES_CONFIG"; then
+  ac_cv_prog_ac_ct_NCURSES_CONFIG="$ac_ct_NCURSES_CONFIG" # Let the user override the test.
+else
+  ac_save_IFS=$IFS; IFS=$ac_path_separator
+ac_dummy="$PATH"
+for ac_dir in $ac_dummy; do
+  IFS=$ac_save_IFS
+  test -z "$ac_dir" && ac_dir=.
+  $as_executable_p "$ac_dir/$ac_word" || continue
+ac_cv_prog_ac_ct_NCURSES_CONFIG="$ac_prog"
+echo "$as_me:5489: found $ac_dir/$ac_word" >&5
+break
+done
 
-		else
-
-if test -n "/lib" ; then
-  for cf_add_libdir in /lib
-  do
-    if test $cf_add_libdir = /usr/lib ; then
-      :
-    elif test -d $cf_add_libdir
-    then
-      cf_have_libdir=no
-      if test -n "$LDFLAGS$LIBS" ; then
-        # a loop is needed to ensure we can add subdirs of existing dirs
-        for cf_test_libdir in $LDFLAGS $LIBS ; do
-          if test ".$cf_test_libdir" = ".-L$cf_add_libdir" ; then
-            cf_have_libdir=yes; break
-          fi
-        done
-      fi
-      if test "$cf_have_libdir" = no ; then
-        test -n "$verbose" && echo "	adding $cf_add_libdir to library-path" 1>&6
-
-echo "${as_me:-configure}:5372: testing adding $cf_add_libdir to library-path ..." 1>&5
-
-        LDFLAGS="-L$cf_add_libdir $LDFLAGS"
-      fi
-    fi
-  done
 fi
-
-		fi
-		;;
-	*)
-
-if test -n "/lib" ; then
-  for cf_add_libdir in /lib
-  do
-    if test $cf_add_libdir = /usr/lib ; then
-      :
-    elif test -d $cf_add_libdir
-    then
-      cf_have_libdir=no
-      if test -n "$LDFLAGS$LIBS" ; then
-        # a loop is needed to ensure we can add subdirs of existing dirs
-        for cf_test_libdir in $LDFLAGS $LIBS ; do
-          if test ".$cf_test_libdir" = ".-L$cf_add_libdir" ; then
-            cf_have_libdir=yes; break
-          fi
-        done
-      fi
-      if test "$cf_have_libdir" = no ; then
-        test -n "$verbose" && echo "	adding $cf_add_libdir to library-path" 1>&6
-
-echo "${as_me:-configure}:5403: testing adding $cf_add_libdir to library-path ..." 1>&5
-
-        LDFLAGS="-L$cf_add_libdir $LDFLAGS"
-      fi
-    fi
-  done
+fi
+ac_ct_NCURSES_CONFIG=$ac_cv_prog_ac_ct_NCURSES_CONFIG
+if test -n "$ac_ct_NCURSES_CONFIG"; then
+  echo "$as_me:5497: result: $ac_ct_NCURSES_CONFIG" >&5
+echo "${ECHO_T}$ac_ct_NCURSES_CONFIG" >&6
+else
+  echo "$as_me:5500: result: no" >&5
+echo "${ECHO_T}no" >&6
 fi
 
-		;;
-	esac
-    ;;
-sunos3*|sunos4*)
-    if test -d /usr/5lib ; then
-
-if test -n "/usr/5lib" ; then
-  for cf_add_libdir in /usr/5lib
-  do
-    if test $cf_add_libdir = /usr/lib ; then
-      :
-    elif test -d $cf_add_libdir
-    then
-      cf_have_libdir=no
-      if test -n "$LDFLAGS$LIBS" ; then
-        # a loop is needed to ensure we can add subdirs of existing dirs
-        for cf_test_libdir in $LDFLAGS $LIBS ; do
-          if test ".$cf_test_libdir" = ".-L$cf_add_libdir" ; then
-            cf_have_libdir=yes; break
-          fi
-        done
-      fi
-      if test "$cf_have_libdir" = no ; then
-        test -n "$verbose" && echo "	adding $cf_add_libdir to library-path" 1>&6
-
-echo "${as_me:-configure}:5436: testing adding $cf_add_libdir to library-path ..." 1>&5
+  test -n "$ac_ct_NCURSES_CONFIG" && break
+done
+test -n "$ac_ct_NCURSES_CONFIG" || ac_ct_NCURSES_CONFIG="none"
 
-        LDFLAGS="-L$cf_add_libdir $LDFLAGS"
-      fi
-    fi
-  done
+  NCURSES_CONFIG=$ac_ct_NCURSES_CONFIG
 fi
 
-      LIBS="-lcurses -ltermcap $LIBS"
-    fi
-    ac_cv_func_initscr=yes
-    ;;
-esac
+if test "$NCURSES_CONFIG" != none ; then
 
-if test ".$ac_cv_func_initscr" != .yes ; then
-    cf_save_LIBS="$LIBS"
-    cf_term_lib=""
-    cf_curs_lib=""
+CPPFLAGS="$CPPFLAGS `$NCURSES_CONFIG --cflags`"
+LIBS="`$NCURSES_CONFIG --libs` $LIBS"
 
-    if test ".${cf_cv_ncurses_version:-no}" != .no
-    then
-        cf_check_list="ncurses curses cursesX"
-    else
-        cf_check_list="cursesX curses ncurses"
-    fi
+# even with config script, some packages use no-override for curses.h
 
-    # Check for library containing tgoto.  Do this before curses library
-    # because it may be needed to link the test-case for initscr.
-    echo "$as_me:5464: checking for tgoto" >&5
-echo $ECHO_N "checking for tgoto... $ECHO_C" >&6
-if test "${ac_cv_func_tgoto+set}" = set; then
+echo "$as_me:5518: checking if we have identified curses headers" >&5
+echo $ECHO_N "checking if we have identified curses headers... $ECHO_C" >&6
+if test "${cf_cv_ncurses_header+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
-#line 5470 "configure"
-#include "confdefs.h"
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char tgoto (); below.  */
-#include <assert.h>
-/* Override any gcc2 internal prototype to avoid an error.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
-char tgoto ();
-char (*f) ();
 
+cf_cv_ncurses_header=none
+for cf_header in  \
+    ncurses/ncurses.h \
+	ncurses/curses.h \
+	ncurses.h \
+	curses.h
+do
+cat >conftest.$ac_ext <<_ACEOF
+#line 5532 "configure"
+#include "confdefs.h"
+#include <${cf_header}>
 int
 main ()
 {
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined (__stub_tgoto) || defined (__stub___tgoto)
-choke me
-#else
-f = tgoto;
-#endif
-
+initscr(); tgoto("?", 0,0)
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:5501: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:5544: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:5504: \$? = $ac_status" >&5
+  echo "$as_me:5547: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:5507: \"$ac_try\"") >&5
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:5550: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:5510: \$? = $ac_status" >&5
+  echo "$as_me:5553: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_func_tgoto=yes
+  cf_cv_ncurses_header=$cf_header; break
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-ac_cv_func_tgoto=no
 fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+rm -f conftest.$ac_objext conftest.$ac_ext
+done
+
 fi
-echo "$as_me:5520: result: $ac_cv_func_tgoto" >&5
-echo "${ECHO_T}$ac_cv_func_tgoto" >&6
-if test $ac_cv_func_tgoto = yes; then
-  cf_term_lib=predefined
-else
+echo "$as_me:5564: result: $cf_cv_ncurses_header" >&5
+echo "${ECHO_T}$cf_cv_ncurses_header" >&6
 
-        for cf_term_lib in $cf_check_list termcap termlib unknown
-        do
-            as_ac_Lib=`echo "ac_cv_lib_$cf_term_lib''_tgoto" | $as_tr_sh`
-echo "$as_me:5529: checking for tgoto in -l$cf_term_lib" >&5
-echo $ECHO_N "checking for tgoto in -l$cf_term_lib... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Lib+set}\" = set"; then
+if test "$cf_cv_ncurses_header" = none ; then
+	{ { echo "$as_me:5568: error: No curses header-files found" >&5
+echo "$as_me: error: No curses header-files found" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+# cheat, to get the right #define's for HAVE_NCURSES_H, etc.
+
+for ac_header in $cf_cv_ncurses_header
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+echo "$as_me:5578: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-l$cf_term_lib  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-#line 5537 "configure"
+  cat >conftest.$ac_ext <<_ACEOF
+#line 5584 "configure"
 #include "confdefs.h"
-
-/* Override any gcc2 internal prototype to avoid an error.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
-char tgoto ();
-int
-main ()
-{
-tgoto ();
-  ;
-  return 0;
-}
+#include <$ac_header>
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:5556: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
-  ac_status=$?
-  echo "$as_me:5559: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:5562: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
+if { (eval echo "$as_me:5588: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
   ac_status=$?
-  echo "$as_me:5565: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  eval "$as_ac_Lib=yes"
+  egrep -v '^ *\+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:5594: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  eval "$as_ac_Header=yes"
 else
   echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
-eval "$as_ac_Lib=no"
+  cat conftest.$ac_ext >&5
+  eval "$as_ac_Header=no"
 fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
+rm -f conftest.err conftest.$ac_ext
 fi
-echo "$as_me:5576: result: `eval echo '${'$as_ac_Lib'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Lib'}'`" >&6
-if test `eval echo '${'$as_ac_Lib'}'` = yes; then
-  break
+echo "$as_me:5613: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<EOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+EOF
+
 fi
+done
 
-        done
+cat >>confdefs.h <<\EOF
+#define NCURSES 1
+EOF
 
-fi
+cf_nculib_ROOT=`echo "HAVE_LIB$cf_ncuconfig_root" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
 
-    # Check for library containing initscr
-    test "$cf_term_lib" != predefined && test "$cf_term_lib" != unknown && LIBS="-l$cf_term_lib $cf_save_LIBS"
- 	for cf_curs_lib in $cf_check_list xcurses jcurses pdcurses unknown
-    do
-        as_ac_Lib=`echo "ac_cv_lib_$cf_curs_lib''_initscr" | $as_tr_sh`
-echo "$as_me:5591: checking for initscr in -l$cf_curs_lib" >&5
-echo $ECHO_N "checking for initscr in -l$cf_curs_lib... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Lib+set}\" = set"; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-l$cf_curs_lib  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-#line 5599 "configure"
-#include "confdefs.h"
+cat >>confdefs.h <<EOF
+#define $cf_nculib_ROOT 1
+EOF
+
+cf_cv_ncurses_version=`$NCURSES_CONFIG --version`
 
-/* Override any gcc2 internal prototype to avoid an error.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
-char initscr ();
-int
-main ()
-{
-initscr ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:5618: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
-  ac_status=$?
-  echo "$as_me:5621: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:5624: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:5627: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  eval "$as_ac_Lib=yes"
 else
-  echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
-eval "$as_ac_Lib=no"
-fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-echo "$as_me:5638: result: `eval echo '${'$as_ac_Lib'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Lib'}'`" >&6
-if test `eval echo '${'$as_ac_Lib'}'` = yes; then
-  break
-fi
 
-    done
-    test $cf_curs_lib = unknown && { { echo "$as_me:5645: error: no curses library found" >&5
-echo "$as_me: error: no curses library found" >&2;}
-   { (exit 1); exit 1; }; }
+cf_ncuhdr_root=ncurses
 
-    LIBS="-l$cf_curs_lib $cf_save_LIBS"
-    if test "$cf_term_lib" = unknown ; then
-        echo "$as_me:5651: checking if we can link with $cf_curs_lib library" >&5
-echo $ECHO_N "checking if we can link with $cf_curs_lib library... $ECHO_C" >&6
-        cat >conftest.$ac_ext <<_ACEOF
-#line 5654 "configure"
-#include "confdefs.h"
-#include <${cf_cv_ncurses_header:-curses.h}>
-int
-main ()
-{
-initscr()
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:5666: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
-  ac_status=$?
-  echo "$as_me:5669: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:5672: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:5675: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  cf_result=yes
-else
-  echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
-cf_result=no
-fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
-        echo "$as_me:5684: result: $cf_result" >&5
-echo "${ECHO_T}$cf_result" >&6
-        test $cf_result = no && { { echo "$as_me:5686: error: Cannot link curses library" >&5
-echo "$as_me: error: Cannot link curses library" >&2;}
-   { (exit 1); exit 1; }; }
-    elif test "$cf_curs_lib" = "$cf_term_lib" ; then
-        :
-    elif test "$cf_term_lib" != predefined ; then
-        echo "$as_me:5692: checking if we need both $cf_curs_lib and $cf_term_lib libraries" >&5
-echo $ECHO_N "checking if we need both $cf_curs_lib and $cf_term_lib libraries... $ECHO_C" >&6
-        cat >conftest.$ac_ext <<_ACEOF
-#line 5695 "configure"
-#include "confdefs.h"
-#include <${cf_cv_ncurses_header:-curses.h}>
-int
-main ()
-{
-initscr(); tgoto((char *)0, 0, 0);
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:5707: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
-  ac_status=$?
-  echo "$as_me:5710: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:5713: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:5716: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  cf_result=no
-else
-  echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
+test -n "$cf_cv_curses_dir" && \
+test "$cf_cv_curses_dir" != "no" && { \
 
-            LIBS="-l$cf_curs_lib -l$cf_term_lib $cf_save_LIBS"
-            cat >conftest.$ac_ext <<_ACEOF
-#line 5725 "configure"
+if test -n "$cf_cv_curses_dir/include/$cf_ncuhdr_root" ; then
+  for cf_add_incdir in $cf_cv_curses_dir/include/$cf_ncuhdr_root
+  do
+	while test $cf_add_incdir != /usr/include
+	do
+	  if test -d $cf_add_incdir
+	  then
+		cf_have_incdir=no
+		if test -n "$CFLAGS$CPPFLAGS" ; then
+		  # a loop is needed to ensure we can add subdirs of existing dirs
+		  for cf_test_incdir in $CFLAGS $CPPFLAGS ; do
+			if test ".$cf_test_incdir" = ".-I$cf_add_incdir" ; then
+			  cf_have_incdir=yes; break
+			fi
+		  done
+		fi
+
+		if test "$cf_have_incdir" = no ; then
+		  if test "$cf_add_incdir" = /usr/local/include ; then
+			if test "$GCC" = yes
+			then
+			  cf_save_CPPFLAGS=$CPPFLAGS
+			  CPPFLAGS="$CPPFLAGS -I$cf_add_incdir"
+			  cat >conftest.$ac_ext <<_ACEOF
+#line 5666 "configure"
 #include "confdefs.h"
-#include <${cf_cv_ncurses_header:-curses.h}>
+#include <stdio.h>
 int
 main ()
 {
-initscr()
+printf("Hello")
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:5737: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:5678: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:5740: \$? = $ac_status" >&5
+  echo "$as_me:5681: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:5743: \"$ac_try\"") >&5
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:5684: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:5746: \$? = $ac_status" >&5
+  echo "$as_me:5687: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  cf_result=yes
+  :
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-cf_result=error
+cf_have_incdir=yes
 fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+rm -f conftest.$ac_objext conftest.$ac_ext
+			  CPPFLAGS=$cf_save_CPPFLAGS
+			fi
+		  fi
+		fi
 
-fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
-        echo "$as_me:5758: result: $cf_result" >&5
-echo "${ECHO_T}$cf_result" >&6
-    fi
-fi
+		if test "$cf_have_incdir" = no ; then
+		  test -n "$verbose" && echo "	adding $cf_add_incdir to include-path" 1>&6
+
+echo "${as_me:-configure}:5704: testing adding $cf_add_incdir to include-path ..." 1>&5
+
+		  CPPFLAGS="$CPPFLAGS -I$cf_add_incdir"
+
+		  cf_top_incdir=`echo $cf_add_incdir | sed -e 's%/include/.*$%/include%'`
+		  test "$cf_top_incdir" = "$cf_add_incdir" && break
+		  cf_add_incdir="$cf_top_incdir"
+		else
+		  break
+		fi
+	  fi
+	done
+  done
 fi
 
-echo "$as_me:5764: checking for NetBSD form.h" >&5
-echo $ECHO_N "checking for NetBSD form.h... $ECHO_C" >&6
-if test "${cf_cv_netbsd_form_h+set}" = set; then
+}
+
+echo "$as_me:5721: checking for $cf_ncuhdr_root header in include-path" >&5
+echo $ECHO_N "checking for $cf_ncuhdr_root header in include-path... $ECHO_C" >&6
+if test "${cf_cv_ncurses_h+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
 
-cat >conftest.$ac_ext <<_ACEOF
-#line 5771 "configure"
-#include "confdefs.h"
+	cf_header_list="$cf_ncuhdr_root/curses.h $cf_ncuhdr_root/ncurses.h"
+	( test "$cf_ncuhdr_root" = ncurses || test "$cf_ncuhdr_root" = ncursesw ) && cf_header_list="$cf_header_list curses.h ncurses.h"
+	for cf_header in $cf_header_list
+	do
 
-#include <${cf_cv_ncurses_header:-curses.h}>
-#include <form.h>
+	cat >conftest.$ac_ext <<_ACEOF
+#line 5733 "configure"
+#include "confdefs.h"
 
+#include <$cf_header>
 int
 main ()
 {
 
-	FORM *form;
-	int y = current_field(form)->cursor_ypos;
-	int x = current_field(form)->cursor_xpos;
+#ifdef NCURSES_VERSION
+
+printf("%s\n", NCURSES_VERSION);
+#else
+#ifdef __NCURSES_H
+printf("old\n");
+#else
+	make an error
+#endif
+#endif
 
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:5790: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:5757: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:5793: \$? = $ac_status" >&5
+  echo "$as_me:5760: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:5796: \"$ac_try\"") >&5
+  { (eval echo "$as_me:5763: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:5799: \$? = $ac_status" >&5
+  echo "$as_me:5766: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  cf_cv_netbsd_form_h=yes
+  cf_cv_ncurses_h=$cf_header
 
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-cf_cv_netbsd_form_h=no
+cf_cv_ncurses_h=no
 fi
 rm -f conftest.$ac_objext conftest.$ac_ext
 
+		test "$cf_cv_ncurses_h" != no && break
+	done
+
 fi
-echo "$as_me:5811: result: $cf_cv_netbsd_form_h" >&5
-echo "${ECHO_T}$cf_cv_netbsd_form_h" >&6
+echo "$as_me:5781: result: $cf_cv_ncurses_h" >&5
+echo "${ECHO_T}$cf_cv_ncurses_h" >&6
 
-test "$cf_cv_netbsd_form_h" = yes && cat >>confdefs.h <<\EOF
-#define HAVE_NETBSD_FORM_H 1
-EOF
+if test "$cf_cv_ncurses_h" != no ; then
+	cf_cv_ncurses_header=$cf_cv_ncurses_h
+else
 
-echo "$as_me:5818: checking for NetBSD menu.h" >&5
-echo $ECHO_N "checking for NetBSD menu.h... $ECHO_C" >&6
-if test "${cf_cv_netbsd_menu_h+set}" = set; then
+echo "$as_me:5788: checking for $cf_ncuhdr_root include-path" >&5
+echo $ECHO_N "checking for $cf_ncuhdr_root include-path... $ECHO_C" >&6
+if test "${cf_cv_ncurses_h2+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
 
-cat >conftest.$ac_ext <<_ACEOF
-#line 5825 "configure"
-#include "confdefs.h"
+	test -n "$verbose" && echo
 
-#include <${cf_cv_ncurses_header:-curses.h}>
-#include <menu.h>
+cf_search=
+
+# collect the current set of include-directories from compiler flags
+cf_header_path_list=""
+if test -n "${CFLAGS}${CPPFLAGS}" ; then
+	for cf_header_path in $CPPFLAGS $CFLAGS
+	do
+		case $cf_header_path in #(vi
+		-I*)
+			cf_header_path=`echo ".$cf_header_path" |sed -e 's/^...//' -e 's,/include$,,'`
+
+test "$cf_header_path" != "NONE" && \
+test -d "$cf_header_path" && \
+ {
+	test -n "$verbose" && echo "	... testing for include-directories under $cf_header_path"
+	test -d $cf_header_path/include &&          cf_search="$cf_search $cf_header_path/include"
+	test -d $cf_header_path/include/$cf_ncuhdr_root &&       cf_search="$cf_search $cf_header_path/include/$cf_ncuhdr_root"
+	test -d $cf_header_path/include/$cf_ncuhdr_root/include &&    cf_search="$cf_search $cf_header_path/include/$cf_ncuhdr_root/include"
+	test -d $cf_header_path/$cf_ncuhdr_root/include &&       cf_search="$cf_search $cf_header_path/$cf_ncuhdr_root/include"
+	test -d $cf_header_path/$cf_ncuhdr_root/include/$cf_ncuhdr_root &&    cf_search="$cf_search $cf_header_path/$cf_ncuhdr_root/include/$cf_ncuhdr_root"
+}
+
+			cf_header_path_list="$cf_header_path_list $cf_search"
+			;;
+		esac
+	done
+fi
+
+# add the variations for the package we are looking for
+
+cf_search=
+
+test "/usr" != "$prefix" && \
+test -d "/usr" && \
+(test $prefix = NONE || test "/usr" != "$prefix") && {
+	test -n "$verbose" && echo "	... testing for include-directories under /usr"
+	test -d /usr/include &&          cf_search="$cf_search /usr/include"
+	test -d /usr/include/$cf_ncuhdr_root &&       cf_search="$cf_search /usr/include/$cf_ncuhdr_root"
+	test -d /usr/include/$cf_ncuhdr_root/include &&    cf_search="$cf_search /usr/include/$cf_ncuhdr_root/include"
+	test -d /usr/$cf_ncuhdr_root/include &&       cf_search="$cf_search /usr/$cf_ncuhdr_root/include"
+	test -d /usr/$cf_ncuhdr_root/include/$cf_ncuhdr_root &&    cf_search="$cf_search /usr/$cf_ncuhdr_root/include/$cf_ncuhdr_root"
+}
+
+test "$prefix" != "NONE" && \
+test -d "$prefix" && \
+ {
+	test -n "$verbose" && echo "	... testing for include-directories under $prefix"
+	test -d $prefix/include &&          cf_search="$cf_search $prefix/include"
+	test -d $prefix/include/$cf_ncuhdr_root &&       cf_search="$cf_search $prefix/include/$cf_ncuhdr_root"
+	test -d $prefix/include/$cf_ncuhdr_root/include &&    cf_search="$cf_search $prefix/include/$cf_ncuhdr_root/include"
+	test -d $prefix/$cf_ncuhdr_root/include &&       cf_search="$cf_search $prefix/$cf_ncuhdr_root/include"
+	test -d $prefix/$cf_ncuhdr_root/include/$cf_ncuhdr_root &&    cf_search="$cf_search $prefix/$cf_ncuhdr_root/include/$cf_ncuhdr_root"
+}
+
+test "/usr/local" != "$prefix" && \
+test -d "/usr/local" && \
+(test $prefix = NONE || test "/usr/local" != "$prefix") && {
+	test -n "$verbose" && echo "	... testing for include-directories under /usr/local"
+	test -d /usr/local/include &&          cf_search="$cf_search /usr/local/include"
+	test -d /usr/local/include/$cf_ncuhdr_root &&       cf_search="$cf_search /usr/local/include/$cf_ncuhdr_root"
+	test -d /usr/local/include/$cf_ncuhdr_root/include &&    cf_search="$cf_search /usr/local/include/$cf_ncuhdr_root/include"
+	test -d /usr/local/$cf_ncuhdr_root/include &&       cf_search="$cf_search /usr/local/$cf_ncuhdr_root/include"
+	test -d /usr/local/$cf_ncuhdr_root/include/$cf_ncuhdr_root &&    cf_search="$cf_search /usr/local/$cf_ncuhdr_root/include/$cf_ncuhdr_root"
+}
+
+test "/opt" != "$prefix" && \
+test -d "/opt" && \
+(test $prefix = NONE || test "/opt" != "$prefix") && {
+	test -n "$verbose" && echo "	... testing for include-directories under /opt"
+	test -d /opt/include &&          cf_search="$cf_search /opt/include"
+	test -d /opt/include/$cf_ncuhdr_root &&       cf_search="$cf_search /opt/include/$cf_ncuhdr_root"
+	test -d /opt/include/$cf_ncuhdr_root/include &&    cf_search="$cf_search /opt/include/$cf_ncuhdr_root/include"
+	test -d /opt/$cf_ncuhdr_root/include &&       cf_search="$cf_search /opt/$cf_ncuhdr_root/include"
+	test -d /opt/$cf_ncuhdr_root/include/$cf_ncuhdr_root &&    cf_search="$cf_search /opt/$cf_ncuhdr_root/include/$cf_ncuhdr_root"
+}
+
+test "$HOME" != "$prefix" && \
+test -d "$HOME" && \
+(test $prefix = NONE || test "$HOME" != "$prefix") && {
+	test -n "$verbose" && echo "	... testing for include-directories under $HOME"
+	test -d $HOME/include &&          cf_search="$cf_search $HOME/include"
+	test -d $HOME/include/$cf_ncuhdr_root &&       cf_search="$cf_search $HOME/include/$cf_ncuhdr_root"
+	test -d $HOME/include/$cf_ncuhdr_root/include &&    cf_search="$cf_search $HOME/include/$cf_ncuhdr_root/include"
+	test -d $HOME/$cf_ncuhdr_root/include &&       cf_search="$cf_search $HOME/$cf_ncuhdr_root/include"
+	test -d $HOME/$cf_ncuhdr_root/include/$cf_ncuhdr_root &&    cf_search="$cf_search $HOME/$cf_ncuhdr_root/include/$cf_ncuhdr_root"
+}
+
+test "$includedir" != NONE && \
+test "$includedir" != "/usr/include" && \
+test -d "$includedir" && {
+	test -d $includedir &&    cf_search="$cf_search $includedir"
+	test -d $includedir/$cf_ncuhdr_root && cf_search="$cf_search $includedir/$cf_ncuhdr_root"
+}
+
+test "$oldincludedir" != NONE && \
+test "$oldincludedir" != "/usr/include" && \
+test -d "$oldincludedir" && {
+	test -d $oldincludedir    && cf_search="$cf_search $oldincludedir"
+	test -d $oldincludedir/$cf_ncuhdr_root && cf_search="$cf_search $oldincludedir/$cf_ncuhdr_root"
+}
+
+cf_search="$cf_search $cf_header_path_list"
+
+	test -n "$verbose" && echo search path $cf_search
+	cf_save2_CPPFLAGS="$CPPFLAGS"
+	for cf_incdir in $cf_search
+	do
 
+if test -n "$cf_incdir" ; then
+  for cf_add_incdir in $cf_incdir
+  do
+	while test $cf_add_incdir != /usr/include
+	do
+	  if test -d $cf_add_incdir
+	  then
+		cf_have_incdir=no
+		if test -n "$CFLAGS$CPPFLAGS" ; then
+		  # a loop is needed to ensure we can add subdirs of existing dirs
+		  for cf_test_incdir in $CFLAGS $CPPFLAGS ; do
+			if test ".$cf_test_incdir" = ".-I$cf_add_incdir" ; then
+			  cf_have_incdir=yes; break
+			fi
+		  done
+		fi
+
+		if test "$cf_have_incdir" = no ; then
+		  if test "$cf_add_incdir" = /usr/local/include ; then
+			if test "$GCC" = yes
+			then
+			  cf_save_CPPFLAGS=$CPPFLAGS
+			  CPPFLAGS="$CPPFLAGS -I$cf_add_incdir"
+			  cat >conftest.$ac_ext <<_ACEOF
+#line 5928 "configure"
+#include "confdefs.h"
+#include <stdio.h>
 int
 main ()
 {
-
-	MENU *menu;
-	int y = menu->max_item_width;
-
+printf("Hello")
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:5843: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:5940: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:5846: \$? = $ac_status" >&5
+  echo "$as_me:5943: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:5849: \"$ac_try\"") >&5
+  { (eval echo "$as_me:5946: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:5852: \$? = $ac_status" >&5
+  echo "$as_me:5949: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  cf_cv_netbsd_menu_h=yes
-
+  :
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-cf_cv_netbsd_menu_h=no
+cf_have_incdir=yes
 fi
 rm -f conftest.$ac_objext conftest.$ac_ext
+			  CPPFLAGS=$cf_save_CPPFLAGS
+			fi
+		  fi
+		fi
 
-fi
-echo "$as_me:5864: result: $cf_cv_netbsd_menu_h" >&5
-echo "${ECHO_T}$cf_cv_netbsd_menu_h" >&6
-
-test "$cf_cv_netbsd_menu_h" = yes && cat >>confdefs.h <<\EOF
-#define HAVE_NETBSD_MENU_H 1
-EOF
-
-	;;
-ncurses)
-
-cf_ncuconfig_root=ncurses
+		if test "$cf_have_incdir" = no ; then
+		  test -n "$verbose" && echo "	adding $cf_add_incdir to include-path" 1>&6
 
-echo "Looking for ${cf_ncuconfig_root}-config"
-for ac_prog in ${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}5-config
-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 "$as_me:5881: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_path_NCURSES_CONFIG+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  case $NCURSES_CONFIG in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_NCURSES_CONFIG="$NCURSES_CONFIG" # Let the user override the test with a path.
-  ;;
-  *)
-  ac_save_IFS=$IFS; IFS=$ac_path_separator
-ac_dummy="$PATH"
-for ac_dir in $ac_dummy; do
-  IFS=$ac_save_IFS
-  test -z "$ac_dir" && ac_dir=.
-  if $as_executable_p "$ac_dir/$ac_word"; then
-   ac_cv_path_NCURSES_CONFIG="$ac_dir/$ac_word"
-   echo "$as_me:5898: found $ac_dir/$ac_word" >&5
-   break
-fi
-done
+echo "${as_me:-configure}:5966: testing adding $cf_add_incdir to include-path ..." 1>&5
 
-  ;;
-esac
-fi
-NCURSES_CONFIG=$ac_cv_path_NCURSES_CONFIG
+		  CPPFLAGS="$CPPFLAGS -I$cf_add_incdir"
 
-if test -n "$NCURSES_CONFIG"; then
-  echo "$as_me:5909: result: $NCURSES_CONFIG" >&5
-echo "${ECHO_T}$NCURSES_CONFIG" >&6
-else
-  echo "$as_me:5912: result: no" >&5
-echo "${ECHO_T}no" >&6
+		  cf_top_incdir=`echo $cf_add_incdir | sed -e 's%/include/.*$%/include%'`
+		  test "$cf_top_incdir" = "$cf_add_incdir" && break
+		  cf_add_incdir="$cf_top_incdir"
+		else
+		  break
+		fi
+	  fi
+	done
+  done
 fi
 
-  test -n "$NCURSES_CONFIG" && break
-done
-test -n "$NCURSES_CONFIG" || NCURSES_CONFIG="none"
-
-if test "$NCURSES_CONFIG" != none ; then
-
-CPPFLAGS="$CPPFLAGS `$NCURSES_CONFIG --cflags`"
-LIBS="`$NCURSES_CONFIG --libs` $LIBS"
-
-# even with config script, some packages use no-override for curses.h
-
-echo "$as_me:5927: checking if we have identified curses headers" >&5
-echo $ECHO_N "checking if we have identified curses headers... $ECHO_C" >&6
-if test "${cf_cv_ncurses_header+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
+		for cf_header in \
+			ncurses.h \
+			curses.h
+		do
 
-cf_cv_ncurses_header=none
-for cf_header in  \
-    ncurses/curses.h \
-	ncurses/ncurses.h \
-	curses.h \
-	ncurses.h
-do
-cat >conftest.$ac_ext <<_ACEOF
-#line 5941 "configure"
+	cat >conftest.$ac_ext <<_ACEOF
+#line 5987 "configure"
 #include "confdefs.h"
-#include <${cf_header}>
+
+#include <$cf_header>
 int
 main ()
 {
-initscr(); tgoto("?", 0,0)
+
+#ifdef NCURSES_VERSION
+
+printf("%s\n", NCURSES_VERSION);
+#else
+#ifdef __NCURSES_H
+printf("old\n");
+#else
+	make an error
+#endif
+#endif
+
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:5953: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:6011: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:5956: \$? = $ac_status" >&5
+  echo "$as_me:6014: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:5959: \"$ac_try\"") >&5
+  { (eval echo "$as_me:6017: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:5962: \$? = $ac_status" >&5
+  echo "$as_me:6020: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  cf_cv_ncurses_header=$cf_header; break
+  cf_cv_ncurses_h2=$cf_header
+
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
+cf_cv_ncurses_h2=no
 fi
 rm -f conftest.$ac_objext conftest.$ac_ext
-done
-
-fi
-echo "$as_me:5973: result: $cf_cv_ncurses_header" >&5
-echo "${ECHO_T}$cf_cv_ncurses_header" >&6
 
-if test "$cf_cv_ncurses_header" = none ; then
-	{ { echo "$as_me:5977: error: No curses header-files found" >&5
-echo "$as_me: error: No curses header-files found" >&2;}
+			if test "$cf_cv_ncurses_h2" != no ; then
+				cf_cv_ncurses_h2=$cf_incdir/$cf_header
+				test -n "$verbose" && echo $ac_n "	... found $ac_c" 1>&6
+				break
+			fi
+			test -n "$verbose" && echo "	... tested $cf_incdir/$cf_header" 1>&6
+		done
+		CPPFLAGS="$cf_save2_CPPFLAGS"
+		test "$cf_cv_ncurses_h2" != no && break
+	done
+	test "$cf_cv_ncurses_h2" = no && { { echo "$as_me:6041: error: not found" >&5
+echo "$as_me: error: not found" >&2;}
    { (exit 1); exit 1; }; }
-fi
-
-# cheat, to get the right #define's for HAVE_NCURSES_H, etc.
-
-for ac_header in $cf_cv_ncurses_header
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-echo "$as_me:5987: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-#line 5993 "configure"
-#include "confdefs.h"
-#include <$ac_header>
-_ACEOF
-if { (eval echo "$as_me:5997: \"$ac_cpp conftest.$ac_ext\"") >&5
-  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
-  ac_status=$?
-  egrep -v '^ *\+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:6003: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null; then
-  if test -s conftest.err; then
-    ac_cpp_err=$ac_c_preproc_warn_flag
-  else
-    ac_cpp_err=
-  fi
-else
-  ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
-  eval "$as_ac_Header=yes"
-else
-  echo "$as_me: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  eval "$as_ac_Header=no"
-fi
-rm -f conftest.err conftest.$ac_ext
-fi
-echo "$as_me:6022: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  cat >>confdefs.h <<EOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-EOF
 
 fi
-done
-
-cat >>confdefs.h <<\EOF
-#define NCURSES 1
-EOF
-
-cf_nculib_ROOT=`echo "HAVE_LIB$cf_ncuconfig_root" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
-
-cat >>confdefs.h <<EOF
-#define $cf_nculib_ROOT 1
-EOF
-
-cf_cv_ncurses_version=`$NCURSES_CONFIG --version`
-
-else
-
-cf_ncuhdr_root=ncurses
+echo "$as_me:6046: result: $cf_cv_ncurses_h2" >&5
+echo "${ECHO_T}$cf_cv_ncurses_h2" >&6
 
-test -n "$cf_cv_curses_dir" && \
-test "$cf_cv_curses_dir" != "no" && { \
+	cf_1st_incdir=`echo $cf_cv_ncurses_h2 | sed -e 's%/[^/]*$%%'`
+	cf_cv_ncurses_header=`basename $cf_cv_ncurses_h2`
+	if test `basename $cf_1st_incdir` = $cf_ncuhdr_root ; then
+		cf_cv_ncurses_header=$cf_ncuhdr_root/$cf_cv_ncurses_header
+	fi
 
-if test -n "$cf_cv_curses_dir/include/$cf_ncuhdr_root" ; then
-  for cf_add_incdir in $cf_cv_curses_dir/include/$cf_ncuhdr_root
+if test -n "$cf_1st_incdir" ; then
+  for cf_add_incdir in $cf_1st_incdir
   do
 	while test $cf_add_incdir != /usr/include
 	do
@@ -6072,7 +6076,7 @@
 			  cf_save_CPPFLAGS=$CPPFLAGS
 			  CPPFLAGS="$CPPFLAGS -I$cf_add_incdir"
 			  cat >conftest.$ac_ext <<_ACEOF
-#line 6075 "configure"
+#line 6079 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 int
@@ -6084,16 +6088,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:6087: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:6091: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:6090: \$? = $ac_status" >&5
+  echo "$as_me:6094: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:6093: \"$ac_try\"") >&5
+  { (eval echo "$as_me:6097: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:6096: \$? = $ac_status" >&5
+  echo "$as_me:6100: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   :
 else
@@ -6110,7 +6114,7 @@
 		if test "$cf_have_incdir" = no ; then
 		  test -n "$verbose" && echo "	adding $cf_add_incdir to include-path" 1>&6
 
-echo "${as_me:-configure}:6113: testing adding $cf_add_incdir to include-path ..." 1>&5
+echo "${as_me:-configure}:6117: testing adding $cf_add_incdir to include-path ..." 1>&5
 
 		  CPPFLAGS="$CPPFLAGS -I$cf_add_incdir"
 
@@ -6125,1586 +6129,1504 @@
   done
 fi
 
-}
+fi
 
-echo "$as_me:6130: checking for $cf_ncuhdr_root header in include-path" >&5
-echo $ECHO_N "checking for $cf_ncuhdr_root header in include-path... $ECHO_C" >&6
-if test "${cf_cv_ncurses_h+set}" = set; then
+# Set definitions to allow ifdef'ing for ncurses.h
+
+case $cf_cv_ncurses_header in # (vi
+*ncurses.h)
+
+cat >>confdefs.h <<\EOF
+#define HAVE_NCURSES_H 1
+EOF
+
+	;;
+esac
+
+case $cf_cv_ncurses_header in # (vi
+ncurses/curses.h|ncurses/ncurses.h)
+
+cat >>confdefs.h <<\EOF
+#define HAVE_NCURSES_NCURSES_H 1
+EOF
+
+	;;
+ncursesw/curses.h|ncursesw/ncurses.h)
+
+cat >>confdefs.h <<\EOF
+#define HAVE_NCURSESW_NCURSES_H 1
+EOF
+
+	;;
+esac
+
+echo "$as_me:6163: checking for terminfo header" >&5
+echo $ECHO_N "checking for terminfo header... $ECHO_C" >&6
+if test "${cf_cv_term_header+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
 
-	cf_header_list="$cf_ncuhdr_root/curses.h $cf_ncuhdr_root/ncurses.h"
-	( test "$cf_ncuhdr_root" = ncurses || test "$cf_ncuhdr_root" = ncursesw ) && cf_header_list="$cf_header_list curses.h ncurses.h"
-	for cf_header in $cf_header_list
-	do
+case ${cf_cv_ncurses_header} in #(vi
+*/ncurses.h|*/ncursesw.h) #(vi
+	cf_term_header=`echo "$cf_cv_ncurses_header" | sed -e 's%ncurses[^.]*\.h$%term.h%'`
+	;;
+*)
+	cf_term_header=term.h
+	;;
+esac
 
-	cat >conftest.$ac_ext <<_ACEOF
-#line 6142 "configure"
+for cf_test in $cf_term_header "ncurses/term.h" "ncursesw/term.h"
+do
+cat >conftest.$ac_ext <<_ACEOF
+#line 6181 "configure"
 #include "confdefs.h"
+#include <stdio.h>
+#include <${cf_cv_ncurses_header:-curses.h}>
+#include <$cf_test>
 
-#include <$cf_header>
 int
 main ()
 {
-
-#ifdef NCURSES_VERSION
-
-printf("%s\n", NCURSES_VERSION);
-#else
-#ifdef __NCURSES_H
-printf("old\n");
-#else
-	make an error
-#endif
-#endif
-
+int x = auto_left_margin
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:6166: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:6196: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:6169: \$? = $ac_status" >&5
+  echo "$as_me:6199: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:6172: \"$ac_try\"") >&5
+  { (eval echo "$as_me:6202: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:6175: \$? = $ac_status" >&5
+  echo "$as_me:6205: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  cf_cv_ncurses_h=$cf_header
 
+	cf_cv_term_header="$cf_test"
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-cf_cv_ncurses_h=no
+
+	cf_cv_term_header=unknown
+
 fi
 rm -f conftest.$ac_objext conftest.$ac_ext
-
-		test "$cf_cv_ncurses_h" != no && break
-	done
+	test "$cf_cv_term_header" != unknown && break
+done
 
 fi
-echo "$as_me:6190: result: $cf_cv_ncurses_h" >&5
-echo "${ECHO_T}$cf_cv_ncurses_h" >&6
+echo "$as_me:6221: result: $cf_cv_term_header" >&5
+echo "${ECHO_T}$cf_cv_term_header" >&6
 
-if test "$cf_cv_ncurses_h" != no ; then
-	cf_cv_ncurses_header=$cf_cv_ncurses_h
-else
+# Set definitions to allow ifdef'ing to accommodate subdirectories
 
-echo "$as_me:6197: checking for $cf_ncuhdr_root include-path" >&5
-echo $ECHO_N "checking for $cf_ncuhdr_root include-path... $ECHO_C" >&6
-if test "${cf_cv_ncurses_h2+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
+case $cf_cv_term_header in # (vi
+*term.h)
 
-	test -n "$verbose" && echo
+cat >>confdefs.h <<\EOF
+#define HAVE_TERM_H 1
+EOF
 
-cf_search=
+	;;
+esac
 
-# collect the current set of include-directories from compiler flags
-cf_header_path_list=""
-if test -n "${CFLAGS}${CPPFLAGS}" ; then
-	for cf_header_path in $CPPFLAGS $CFLAGS
-	do
-		case $cf_header_path in #(vi
-		-I*)
-			cf_header_path=`echo ".$cf_header_path" |sed -e 's/^...//' -e 's,/include$,,'`
+case $cf_cv_term_header in # (vi
+ncurses/term.h) #(vi
 
-test "$cf_header_path" != "NONE" && \
-test -d "$cf_header_path" && \
- {
-	test -n "$verbose" && echo "	... testing for include-directories under $cf_header_path"
-	test -d $cf_header_path/include &&          cf_search="$cf_search $cf_header_path/include"
-	test -d $cf_header_path/include/$cf_ncuhdr_root &&       cf_search="$cf_search $cf_header_path/include/$cf_ncuhdr_root"
-	test -d $cf_header_path/include/$cf_ncuhdr_root/include &&    cf_search="$cf_search $cf_header_path/include/$cf_ncuhdr_root/include"
-	test -d $cf_header_path/$cf_ncuhdr_root/include &&       cf_search="$cf_search $cf_header_path/$cf_ncuhdr_root/include"
-	test -d $cf_header_path/$cf_ncuhdr_root/include/$cf_ncuhdr_root &&    cf_search="$cf_search $cf_header_path/$cf_ncuhdr_root/include/$cf_ncuhdr_root"
-}
+cat >>confdefs.h <<\EOF
+#define HAVE_NCURSES_TERM_H 1
+EOF
 
-			cf_header_path_list="$cf_header_path_list $cf_search"
-			;;
-		esac
-	done
-fi
+	;;
+ncursesw/term.h)
 
-# add the variations for the package we are looking for
+cat >>confdefs.h <<\EOF
+#define HAVE_NCURSESW_TERM_H 1
+EOF
 
-cf_search=
+	;;
+esac
 
-test "/usr" != "$prefix" && \
-test -d "/usr" && \
-(test $prefix = NONE || test "/usr" != "$prefix") && {
-	test -n "$verbose" && echo "	... testing for include-directories under /usr"
-	test -d /usr/include &&          cf_search="$cf_search /usr/include"
-	test -d /usr/include/$cf_ncuhdr_root &&       cf_search="$cf_search /usr/include/$cf_ncuhdr_root"
-	test -d /usr/include/$cf_ncuhdr_root/include &&    cf_search="$cf_search /usr/include/$cf_ncuhdr_root/include"
-	test -d /usr/$cf_ncuhdr_root/include &&       cf_search="$cf_search /usr/$cf_ncuhdr_root/include"
-	test -d /usr/$cf_ncuhdr_root/include/$cf_ncuhdr_root &&    cf_search="$cf_search /usr/$cf_ncuhdr_root/include/$cf_ncuhdr_root"
-}
+# some applications need this, but should check for NCURSES_VERSION
 
-test "$prefix" != "NONE" && \
-test -d "$prefix" && \
- {
-	test -n "$verbose" && echo "	... testing for include-directories under $prefix"
-	test -d $prefix/include &&          cf_search="$cf_search $prefix/include"
-	test -d $prefix/include/$cf_ncuhdr_root &&       cf_search="$cf_search $prefix/include/$cf_ncuhdr_root"
-	test -d $prefix/include/$cf_ncuhdr_root/include &&    cf_search="$cf_search $prefix/include/$cf_ncuhdr_root/include"
-	test -d $prefix/$cf_ncuhdr_root/include &&       cf_search="$cf_search $prefix/$cf_ncuhdr_root/include"
-	test -d $prefix/$cf_ncuhdr_root/include/$cf_ncuhdr_root &&    cf_search="$cf_search $prefix/$cf_ncuhdr_root/include/$cf_ncuhdr_root"
-}
+cat >>confdefs.h <<\EOF
+#define NCURSES 1
+EOF
 
-test "/usr/local" != "$prefix" && \
-test -d "/usr/local" && \
-(test $prefix = NONE || test "/usr/local" != "$prefix") && {
-	test -n "$verbose" && echo "	... testing for include-directories under /usr/local"
-	test -d /usr/local/include &&          cf_search="$cf_search /usr/local/include"
-	test -d /usr/local/include/$cf_ncuhdr_root &&       cf_search="$cf_search /usr/local/include/$cf_ncuhdr_root"
-	test -d /usr/local/include/$cf_ncuhdr_root/include &&    cf_search="$cf_search /usr/local/include/$cf_ncuhdr_root/include"
-	test -d /usr/local/$cf_ncuhdr_root/include &&       cf_search="$cf_search /usr/local/$cf_ncuhdr_root/include"
-	test -d /usr/local/$cf_ncuhdr_root/include/$cf_ncuhdr_root &&    cf_search="$cf_search /usr/local/$cf_ncuhdr_root/include/$cf_ncuhdr_root"
-}
+echo "$as_me:6259: checking for ncurses version" >&5
+echo $ECHO_N "checking for ncurses version... $ECHO_C" >&6
+if test "${cf_cv_ncurses_version+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
 
-test "/opt" != "$prefix" && \
-test -d "/opt" && \
-(test $prefix = NONE || test "/opt" != "$prefix") && {
-	test -n "$verbose" && echo "	... testing for include-directories under /opt"
-	test -d /opt/include &&          cf_search="$cf_search /opt/include"
-	test -d /opt/include/$cf_ncuhdr_root &&       cf_search="$cf_search /opt/include/$cf_ncuhdr_root"
-	test -d /opt/include/$cf_ncuhdr_root/include &&    cf_search="$cf_search /opt/include/$cf_ncuhdr_root/include"
-	test -d /opt/$cf_ncuhdr_root/include &&       cf_search="$cf_search /opt/$cf_ncuhdr_root/include"
-	test -d /opt/$cf_ncuhdr_root/include/$cf_ncuhdr_root &&    cf_search="$cf_search /opt/$cf_ncuhdr_root/include/$cf_ncuhdr_root"
-}
+	cf_cv_ncurses_version=no
+	cf_tempfile=out$$
+	rm -f $cf_tempfile
+	if test "$cross_compiling" = yes; then
 
-test "$HOME" != "$prefix" && \
-test -d "$HOME" && \
-(test $prefix = NONE || test "$HOME" != "$prefix") && {
-	test -n "$verbose" && echo "	... testing for include-directories under $HOME"
-	test -d $HOME/include &&          cf_search="$cf_search $HOME/include"
-	test -d $HOME/include/$cf_ncuhdr_root &&       cf_search="$cf_search $HOME/include/$cf_ncuhdr_root"
-	test -d $HOME/include/$cf_ncuhdr_root/include &&    cf_search="$cf_search $HOME/include/$cf_ncuhdr_root/include"
-	test -d $HOME/$cf_ncuhdr_root/include &&       cf_search="$cf_search $HOME/$cf_ncuhdr_root/include"
-	test -d $HOME/$cf_ncuhdr_root/include/$cf_ncuhdr_root &&    cf_search="$cf_search $HOME/$cf_ncuhdr_root/include/$cf_ncuhdr_root"
-}
+	# This will not work if the preprocessor splits the line after the
+	# Autoconf token.  The 'unproto' program does that.
+	cat > conftest.$ac_ext <<EOF
+#include <${cf_cv_ncurses_header:-curses.h}>
+#undef Autoconf
+#ifdef NCURSES_VERSION
+Autoconf NCURSES_VERSION
+#else
+#ifdef __NCURSES_H
+Autoconf "old"
+#endif
+;
+#endif
+EOF
+	cf_try="$ac_cpp conftest.$ac_ext 2>&5 | grep '^Autoconf ' >conftest.out"
+	{ (eval echo "$as_me:6285: \"$cf_try\"") >&5
+  (eval $cf_try) 2>&5
+  ac_status=$?
+  echo "$as_me:6288: \$? = $ac_status" >&5
+  (exit $ac_status); }
+	if test -f conftest.out ; then
+		cf_out=`cat conftest.out | sed -e 's%^Autoconf %%' -e 's%^[^"]*"%%' -e 's%".*%%'`
+		test -n "$cf_out" && cf_cv_ncurses_version="$cf_out"
+		rm -f conftest.out
+	fi
 
-test "$includedir" != NONE && \
-test "$includedir" != "/usr/include" && \
-test -d "$includedir" && {
-	test -d $includedir &&    cf_search="$cf_search $includedir"
-	test -d $includedir/$cf_ncuhdr_root && cf_search="$cf_search $includedir/$cf_ncuhdr_root"
-}
+else
+  cat >conftest.$ac_ext <<_ACEOF
+#line 6298 "configure"
+#include "confdefs.h"
 
-test "$oldincludedir" != NONE && \
-test "$oldincludedir" != "/usr/include" && \
-test -d "$oldincludedir" && {
-	test -d $oldincludedir    && cf_search="$cf_search $oldincludedir"
-	test -d $oldincludedir/$cf_ncuhdr_root && cf_search="$cf_search $oldincludedir/$cf_ncuhdr_root"
+#include <${cf_cv_ncurses_header:-curses.h}>
+#include <stdio.h>
+int main()
+{
+	FILE *fp = fopen("$cf_tempfile", "w");
+#ifdef NCURSES_VERSION
+# ifdef NCURSES_VERSION_PATCH
+	fprintf(fp, "%s.%d\n", NCURSES_VERSION, NCURSES_VERSION_PATCH);
+# else
+	fprintf(fp, "%s\n", NCURSES_VERSION);
+# endif
+#else
+# ifdef __NCURSES_H
+	fprintf(fp, "old\n");
+# else
+	make an error
+# endif
+#endif
+	${cf_cv_main_return:-return}(0);
 }
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:6323: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:6326: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (eval echo "$as_me:6328: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:6331: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
 
-cf_search="$cf_search $cf_header_path_list"
-
-	test -n "$verbose" && echo search path $cf_search
-	cf_save2_CPPFLAGS="$CPPFLAGS"
-	for cf_incdir in $cf_search
-	do
+	cf_cv_ncurses_version=`cat $cf_tempfile`
+else
+  echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+fi
+rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+	rm -f $cf_tempfile
 
-if test -n "$cf_incdir" ; then
-  for cf_add_incdir in $cf_incdir
-  do
-	while test $cf_add_incdir != /usr/include
-	do
-	  if test -d $cf_add_incdir
-	  then
-		cf_have_incdir=no
-		if test -n "$CFLAGS$CPPFLAGS" ; then
-		  # a loop is needed to ensure we can add subdirs of existing dirs
-		  for cf_test_incdir in $CFLAGS $CPPFLAGS ; do
-			if test ".$cf_test_incdir" = ".-I$cf_add_incdir" ; then
-			  cf_have_incdir=yes; break
-			fi
-		  done
-		fi
+fi
+echo "$as_me:6345: result: $cf_cv_ncurses_version" >&5
+echo "${ECHO_T}$cf_cv_ncurses_version" >&6
+test "$cf_cv_ncurses_version" = no ||
+cat >>confdefs.h <<\EOF
+#define NCURSES 1
+EOF
 
-		if test "$cf_have_incdir" = no ; then
-		  if test "$cf_add_incdir" = /usr/local/include ; then
-			if test "$GCC" = yes
-			then
-			  cf_save_CPPFLAGS=$CPPFLAGS
-			  CPPFLAGS="$CPPFLAGS -I$cf_add_incdir"
-			  cat >conftest.$ac_ext <<_ACEOF
-#line 6337 "configure"
+cf_nculib_root=ncurses
+	# This works, except for the special case where we find gpm, but
+	# ncurses is in a nonstandard location via $LIBS, and we really want
+	# to link gpm.
+cf_ncurses_LIBS=""
+cf_ncurses_SAVE="$LIBS"
+echo "$as_me:6358: checking for Gpm_Open in -lgpm" >&5
+echo $ECHO_N "checking for Gpm_Open in -lgpm... $ECHO_C" >&6
+if test "${ac_cv_lib_gpm_Gpm_Open+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lgpm  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+#line 6366 "configure"
 #include "confdefs.h"
-#include <stdio.h>
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char Gpm_Open ();
 int
 main ()
 {
-printf("Hello")
+Gpm_Open ();
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:6349: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:6385: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:6352: \$? = $ac_status" >&5
+  echo "$as_me:6388: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:6355: \"$ac_try\"") >&5
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:6391: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:6358: \$? = $ac_status" >&5
+  echo "$as_me:6394: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  :
+  ac_cv_lib_gpm_Gpm_Open=yes
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-cf_have_incdir=yes
+ac_cv_lib_gpm_Gpm_Open=no
 fi
-rm -f conftest.$ac_objext conftest.$ac_ext
-			  CPPFLAGS=$cf_save_CPPFLAGS
-			fi
-		  fi
-		fi
-
-		if test "$cf_have_incdir" = no ; then
-		  test -n "$verbose" && echo "	adding $cf_add_incdir to include-path" 1>&6
-
-echo "${as_me:-configure}:6375: testing adding $cf_add_incdir to include-path ..." 1>&5
-
-		  CPPFLAGS="$CPPFLAGS -I$cf_add_incdir"
-
-		  cf_top_incdir=`echo $cf_add_incdir | sed -e 's%/include/.*$%/include%'`
-		  test "$cf_top_incdir" = "$cf_add_incdir" && break
-		  cf_add_incdir="$cf_top_incdir"
-		else
-		  break
-		fi
-	  fi
-	done
-  done
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
 fi
-
-		for cf_header in \
-			ncurses.h \
-			curses.h
-		do
-
-	cat >conftest.$ac_ext <<_ACEOF
-#line 6396 "configure"
+echo "$as_me:6405: result: $ac_cv_lib_gpm_Gpm_Open" >&5
+echo "${ECHO_T}$ac_cv_lib_gpm_Gpm_Open" >&6
+if test $ac_cv_lib_gpm_Gpm_Open = yes; then
+  echo "$as_me:6408: checking for initscr in -lgpm" >&5
+echo $ECHO_N "checking for initscr in -lgpm... $ECHO_C" >&6
+if test "${ac_cv_lib_gpm_initscr+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lgpm  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+#line 6416 "configure"
 #include "confdefs.h"
 
-#include <$cf_header>
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char initscr ();
 int
 main ()
 {
-
-#ifdef NCURSES_VERSION
-
-printf("%s\n", NCURSES_VERSION);
-#else
-#ifdef __NCURSES_H
-printf("old\n");
-#else
-	make an error
-#endif
-#endif
-
+initscr ();
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:6420: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:6435: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:6423: \$? = $ac_status" >&5
+  echo "$as_me:6438: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:6426: \"$ac_try\"") >&5
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:6441: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:6429: \$? = $ac_status" >&5
+  echo "$as_me:6444: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  cf_cv_ncurses_h2=$cf_header
-
+  ac_cv_lib_gpm_initscr=yes
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-cf_cv_ncurses_h2=no
+ac_cv_lib_gpm_initscr=no
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:6455: result: $ac_cv_lib_gpm_initscr" >&5
+echo "${ECHO_T}$ac_cv_lib_gpm_initscr" >&6
+if test $ac_cv_lib_gpm_initscr = yes; then
+  LIBS="$cf_ncurses_SAVE"
+else
+  cf_ncurses_LIBS="-lgpm"
 fi
-rm -f conftest.$ac_objext conftest.$ac_ext
-
-			if test "$cf_cv_ncurses_h2" != no ; then
-				cf_cv_ncurses_h2=$cf_incdir/$cf_header
-				test -n "$verbose" && echo $ac_n "	... found $ac_c" 1>&6
-				break
-			fi
-			test -n "$verbose" && echo "	... tested $cf_incdir/$cf_header" 1>&6
-		done
-		CPPFLAGS="$cf_save2_CPPFLAGS"
-		test "$cf_cv_ncurses_h2" != no && break
-	done
-	test "$cf_cv_ncurses_h2" = no && { { echo "$as_me:6450: error: not found" >&5
-echo "$as_me: error: not found" >&2;}
-   { (exit 1); exit 1; }; }
 
 fi
-echo "$as_me:6455: result: $cf_cv_ncurses_h2" >&5
-echo "${ECHO_T}$cf_cv_ncurses_h2" >&6
-
-	cf_1st_incdir=`echo $cf_cv_ncurses_h2 | sed -e 's%/[^/]*$%%'`
-	cf_cv_ncurses_header=`basename $cf_cv_ncurses_h2`
-	if test `basename $cf_1st_incdir` = $cf_ncuhdr_root ; then
-		cf_cv_ncurses_header=$cf_ncuhdr_root/$cf_cv_ncurses_header
-	fi
-
-if test -n "$cf_1st_incdir" ; then
-  for cf_add_incdir in $cf_1st_incdir
-  do
-	while test $cf_add_incdir != /usr/include
-	do
-	  if test -d $cf_add_incdir
-	  then
-		cf_have_incdir=no
-		if test -n "$CFLAGS$CPPFLAGS" ; then
-		  # a loop is needed to ensure we can add subdirs of existing dirs
-		  for cf_test_incdir in $CFLAGS $CPPFLAGS ; do
-			if test ".$cf_test_incdir" = ".-I$cf_add_incdir" ; then
-			  cf_have_incdir=yes; break
-			fi
-		  done
-		fi
 
-		if test "$cf_have_incdir" = no ; then
-		  if test "$cf_add_incdir" = /usr/local/include ; then
-			if test "$GCC" = yes
-			then
-			  cf_save_CPPFLAGS=$CPPFLAGS
-			  CPPFLAGS="$CPPFLAGS -I$cf_add_incdir"
-			  cat >conftest.$ac_ext <<_ACEOF
-#line 6488 "configure"
+case $host_os in #(vi
+freebsd*)
+	# This is only necessary if you are linking against an obsolete
+	# version of ncurses (but it should do no harm, since it's static).
+	if test "$cf_nculib_root" = ncurses ; then
+		echo "$as_me:6470: checking for tgoto in -lmytinfo" >&5
+echo $ECHO_N "checking for tgoto in -lmytinfo... $ECHO_C" >&6
+if test "${ac_cv_lib_mytinfo_tgoto+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lmytinfo  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+#line 6478 "configure"
 #include "confdefs.h"
-#include <stdio.h>
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char tgoto ();
 int
 main ()
 {
-printf("Hello")
+tgoto ();
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:6500: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:6497: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:6503: \$? = $ac_status" >&5
+  echo "$as_me:6500: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:6506: \"$ac_try\"") >&5
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:6503: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:6509: \$? = $ac_status" >&5
+  echo "$as_me:6506: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  :
+  ac_cv_lib_mytinfo_tgoto=yes
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-cf_have_incdir=yes
+ac_cv_lib_mytinfo_tgoto=no
 fi
-rm -f conftest.$ac_objext conftest.$ac_ext
-			  CPPFLAGS=$cf_save_CPPFLAGS
-			fi
-		  fi
-		fi
-
-		if test "$cf_have_incdir" = no ; then
-		  test -n "$verbose" && echo "	adding $cf_add_incdir to include-path" 1>&6
-
-echo "${as_me:-configure}:6526: testing adding $cf_add_incdir to include-path ..." 1>&5
-
-		  CPPFLAGS="$CPPFLAGS -I$cf_add_incdir"
-
-		  cf_top_incdir=`echo $cf_add_incdir | sed -e 's%/include/.*$%/include%'`
-		  test "$cf_top_incdir" = "$cf_add_incdir" && break
-		  cf_add_incdir="$cf_top_incdir"
-		else
-		  break
-		fi
-	  fi
-	done
-  done
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
 fi
-
+echo "$as_me:6517: result: $ac_cv_lib_mytinfo_tgoto" >&5
+echo "${ECHO_T}$ac_cv_lib_mytinfo_tgoto" >&6
+if test $ac_cv_lib_mytinfo_tgoto = yes; then
+  cf_ncurses_LIBS="-lmytinfo $cf_ncurses_LIBS"
 fi
 
-# Set definitions to allow ifdef'ing for ncurses.h
-
-case $cf_cv_ncurses_header in # (vi
-*ncurses.h)
-	cat >>confdefs.h <<\EOF
-#define HAVE_NCURSES_H 1
-EOF
-
+	fi
 	;;
 esac
 
-case $cf_cv_ncurses_header in # (vi
-ncurses/curses.h|ncurses/ncurses.h)
-	cat >>confdefs.h <<\EOF
-#define HAVE_NCURSES_NCURSES_H 1
-EOF
-
-	;;
-ncursesw/curses.h|ncursesw/ncurses.h)
-	cat >>confdefs.h <<\EOF
-#define HAVE_NCURSESW_NCURSES_H 1
-EOF
+LIBS="$cf_ncurses_LIBS $LIBS"
 
-	;;
-esac
+if ( test -n "$cf_cv_curses_dir" && test "$cf_cv_curses_dir" != "no" )
+then
+	LIBS="-l$cf_nculib_root $LIBS"
+else
 
-echo "$as_me:6569: checking for terminfo header" >&5
-echo $ECHO_N "checking for terminfo header... $ECHO_C" >&6
-if test "${cf_cv_term_header+set}" = set; then
+	eval 'cf_cv_have_lib_'$cf_nculib_root'=no'
+	cf_libdir=""
+	echo "$as_me:6536: checking for initscr" >&5
+echo $ECHO_N "checking for initscr... $ECHO_C" >&6
+if test "${ac_cv_func_initscr+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
+  cat >conftest.$ac_ext <<_ACEOF
+#line 6542 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char initscr (); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char initscr ();
+char (*f) ();
 
-case ${cf_cv_ncurses_header} in #(vi
-*/ncurses.h|*/ncursesw.h) #(vi
-	cf_term_header=`echo "$cf_cv_ncurses_header" | sed -e 's%ncurses[^.]*\.h$%term.h%'`
-	;;
-*)
-	cf_term_header=term.h
-	;;
-esac
+int
+main ()
+{
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_initscr) || defined (__stub___initscr)
+choke me
+#else
+f = initscr; /* workaround for ICC 12.0.3 */ if (f == 0) return 1;
+#endif
 
-for cf_test in $cf_term_header "ncurses/term.h" "ncursesw/term.h"
-do
-cat >conftest.$ac_ext <<_ACEOF
-#line 6587 "configure"
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:6573: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:6576: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:6579: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:6582: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_func_initscr=yes
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_func_initscr=no
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:6592: result: $ac_cv_func_initscr" >&5
+echo "${ECHO_T}$ac_cv_func_initscr" >&6
+if test $ac_cv_func_initscr = yes; then
+  eval 'cf_cv_have_lib_'$cf_nculib_root'=yes'
+else
+
+		cf_save_LIBS="$LIBS"
+		echo "$as_me:6599: checking for initscr in -l$cf_nculib_root" >&5
+echo $ECHO_N "checking for initscr in -l$cf_nculib_root... $ECHO_C" >&6
+		LIBS="-l$cf_nculib_root $LIBS"
+		cat >conftest.$ac_ext <<_ACEOF
+#line 6603 "configure"
 #include "confdefs.h"
-#include <stdio.h>
 #include <${cf_cv_ncurses_header:-curses.h}>
-#include <$cf_test>
-
 int
 main ()
 {
-int x = auto_left_margin
+initscr()
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:6602: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:6615: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:6605: \$? = $ac_status" >&5
+  echo "$as_me:6618: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:6608: \"$ac_try\"") >&5
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:6621: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:6611: \$? = $ac_status" >&5
+  echo "$as_me:6624: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
+  echo "$as_me:6626: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+			 eval 'cf_cv_have_lib_'$cf_nculib_root'=yes'
 
-	cf_cv_term_header="$cf_test"
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
+echo "$as_me:6633: result: no" >&5
+echo "${ECHO_T}no" >&6
 
-	cf_cv_term_header=unknown
+cf_search=
+cf_library_path_list=""
+if test -n "${LDFLAGS}${LIBS}" ; then
+	for cf_library_path in $LDFLAGS $LIBS
+	do
+		case $cf_library_path in #(vi
+		-L*)
+			cf_library_path=`echo ".$cf_library_path" |sed -e 's/^...//' -e 's,/lib$,,'`
 
-fi
-rm -f conftest.$ac_objext conftest.$ac_ext
-	test "$cf_cv_term_header" != unknown && break
-done
+test "$cf_library_path" != "NONE" && \
+test -d "$cf_library_path" && \
+ {
+	test -n "$verbose" && echo "	... testing for lib-directories under $cf_library_path"
+	test -d $cf_library_path/lib &&          cf_search="$cf_search $cf_library_path/lib"
+	test -d $cf_library_path/lib/$cf_nculib_root &&       cf_search="$cf_search $cf_library_path/lib/$cf_nculib_root"
+	test -d $cf_library_path/lib/$cf_nculib_root/lib &&    cf_search="$cf_search $cf_library_path/lib/$cf_nculib_root/lib"
+	test -d $cf_library_path/$cf_nculib_root/lib &&       cf_search="$cf_search $cf_library_path/$cf_nculib_root/lib"
+	test -d $cf_library_path/$cf_nculib_root/lib/$cf_nculib_root &&    cf_search="$cf_search $cf_library_path/$cf_nculib_root/lib/$cf_nculib_root"
+}
 
+			cf_library_path_list="$cf_library_path_list $cf_search"
+			;;
+		esac
+	done
 fi
-echo "$as_me:6627: result: $cf_cv_term_header" >&5
-echo "${ECHO_T}$cf_cv_term_header" >&6
 
-# Set definitions to allow ifdef'ing to accommodate subdirectories
-
-case $cf_cv_term_header in # (vi
-*term.h)
-	cat >>confdefs.h <<\EOF
-#define HAVE_TERM_H 1
-EOF
-
-	;;
-esac
+cf_search=
 
-case $cf_cv_term_header in # (vi
-ncurses/term.h) #(vi
-	cat >>confdefs.h <<\EOF
-#define HAVE_NCURSES_TERM_H 1
-EOF
-
-	;;
-ncursesw/term.h)
-	cat >>confdefs.h <<\EOF
-#define HAVE_NCURSESW_TERM_H 1
-EOF
+test "/usr" != "$prefix" && \
+test -d "/usr" && \
+(test $prefix = NONE || test "/usr" != "$prefix") && {
+	test -n "$verbose" && echo "	... testing for lib-directories under /usr"
+	test -d /usr/lib &&          cf_search="$cf_search /usr/lib"
+	test -d /usr/lib/$cf_nculib_root &&       cf_search="$cf_search /usr/lib/$cf_nculib_root"
+	test -d /usr/lib/$cf_nculib_root/lib &&    cf_search="$cf_search /usr/lib/$cf_nculib_root/lib"
+	test -d /usr/$cf_nculib_root/lib &&       cf_search="$cf_search /usr/$cf_nculib_root/lib"
+	test -d /usr/$cf_nculib_root/lib/$cf_nculib_root &&    cf_search="$cf_search /usr/$cf_nculib_root/lib/$cf_nculib_root"
+}
 
-	;;
-esac
+test "$prefix" != "NONE" && \
+test -d "$prefix" && \
+ {
+	test -n "$verbose" && echo "	... testing for lib-directories under $prefix"
+	test -d $prefix/lib &&          cf_search="$cf_search $prefix/lib"
+	test -d $prefix/lib/$cf_nculib_root &&       cf_search="$cf_search $prefix/lib/$cf_nculib_root"
+	test -d $prefix/lib/$cf_nculib_root/lib &&    cf_search="$cf_search $prefix/lib/$cf_nculib_root/lib"
+	test -d $prefix/$cf_nculib_root/lib &&       cf_search="$cf_search $prefix/$cf_nculib_root/lib"
+	test -d $prefix/$cf_nculib_root/lib/$cf_nculib_root &&    cf_search="$cf_search $prefix/$cf_nculib_root/lib/$cf_nculib_root"
+}
 
-# some applications need this, but should check for NCURSES_VERSION
-cat >>confdefs.h <<\EOF
-#define NCURSES 1
-EOF
+test "/usr/local" != "$prefix" && \
+test -d "/usr/local" && \
+(test $prefix = NONE || test "/usr/local" != "$prefix") && {
+	test -n "$verbose" && echo "	... testing for lib-directories under /usr/local"
+	test -d /usr/local/lib &&          cf_search="$cf_search /usr/local/lib"
+	test -d /usr/local/lib/$cf_nculib_root &&       cf_search="$cf_search /usr/local/lib/$cf_nculib_root"
+	test -d /usr/local/lib/$cf_nculib_root/lib &&    cf_search="$cf_search /usr/local/lib/$cf_nculib_root/lib"
+	test -d /usr/local/$cf_nculib_root/lib &&       cf_search="$cf_search /usr/local/$cf_nculib_root/lib"
+	test -d /usr/local/$cf_nculib_root/lib/$cf_nculib_root &&    cf_search="$cf_search /usr/local/$cf_nculib_root/lib/$cf_nculib_root"
+}
 
-echo "$as_me:6661: checking for ncurses version" >&5
-echo $ECHO_N "checking for ncurses version... $ECHO_C" >&6
-if test "${cf_cv_ncurses_version+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
+test "/opt" != "$prefix" && \
+test -d "/opt" && \
+(test $prefix = NONE || test "/opt" != "$prefix") && {
+	test -n "$verbose" && echo "	... testing for lib-directories under /opt"
+	test -d /opt/lib &&          cf_search="$cf_search /opt/lib"
+	test -d /opt/lib/$cf_nculib_root &&       cf_search="$cf_search /opt/lib/$cf_nculib_root"
+	test -d /opt/lib/$cf_nculib_root/lib &&    cf_search="$cf_search /opt/lib/$cf_nculib_root/lib"
+	test -d /opt/$cf_nculib_root/lib &&       cf_search="$cf_search /opt/$cf_nculib_root/lib"
+	test -d /opt/$cf_nculib_root/lib/$cf_nculib_root &&    cf_search="$cf_search /opt/$cf_nculib_root/lib/$cf_nculib_root"
+}
 
-	cf_cv_ncurses_version=no
-	cf_tempfile=out$$
-	rm -f $cf_tempfile
-	if test "$cross_compiling" = yes; then
+test "$HOME" != "$prefix" && \
+test -d "$HOME" && \
+(test $prefix = NONE || test "$HOME" != "$prefix") && {
+	test -n "$verbose" && echo "	... testing for lib-directories under $HOME"
+	test -d $HOME/lib &&          cf_search="$cf_search $HOME/lib"
+	test -d $HOME/lib/$cf_nculib_root &&       cf_search="$cf_search $HOME/lib/$cf_nculib_root"
+	test -d $HOME/lib/$cf_nculib_root/lib &&    cf_search="$cf_search $HOME/lib/$cf_nculib_root/lib"
+	test -d $HOME/$cf_nculib_root/lib &&       cf_search="$cf_search $HOME/$cf_nculib_root/lib"
+	test -d $HOME/$cf_nculib_root/lib/$cf_nculib_root &&    cf_search="$cf_search $HOME/$cf_nculib_root/lib/$cf_nculib_root"
+}
 
-	# This will not work if the preprocessor splits the line after the
-	# Autoconf token.  The 'unproto' program does that.
-	cat > conftest.$ac_ext <<EOF
-#include <${cf_cv_ncurses_header:-curses.h}>
-#undef Autoconf
-#ifdef NCURSES_VERSION
-Autoconf NCURSES_VERSION
-#else
-#ifdef __NCURSES_H
-Autoconf "old"
-#endif
-;
-#endif
-EOF
-	cf_try="$ac_cpp conftest.$ac_ext 2>&5 | grep '^Autoconf ' >conftest.out"
-	{ (eval echo "$as_me:6687: \"$cf_try\"") >&5
-  (eval $cf_try) 2>&5
-  ac_status=$?
-  echo "$as_me:6690: \$? = $ac_status" >&5
-  (exit $ac_status); }
-	if test -f conftest.out ; then
-		cf_out=`cat conftest.out | sed -e 's%^Autoconf %%' -e 's%^[^"]*"%%' -e 's%".*%%'`
-		test -n "$cf_out" && cf_cv_ncurses_version="$cf_out"
-		rm -f conftest.out
-	fi
+cf_search="$cf_library_path_list $cf_search"
 
-else
-  cat >conftest.$ac_ext <<_ACEOF
-#line 6700 "configure"
+			for cf_libdir in $cf_search
+			do
+				echo "$as_me:6723: checking for -l$cf_nculib_root in $cf_libdir" >&5
+echo $ECHO_N "checking for -l$cf_nculib_root in $cf_libdir... $ECHO_C" >&6
+				LIBS="-L$cf_libdir -l$cf_nculib_root $cf_save_LIBS"
+				cat >conftest.$ac_ext <<_ACEOF
+#line 6727 "configure"
 #include "confdefs.h"
-
 #include <${cf_cv_ncurses_header:-curses.h}>
-#include <stdio.h>
-int main()
+int
+main ()
 {
-	FILE *fp = fopen("$cf_tempfile", "w");
-#ifdef NCURSES_VERSION
-# ifdef NCURSES_VERSION_PATCH
-	fprintf(fp, "%s.%d\n", NCURSES_VERSION, NCURSES_VERSION_PATCH);
-# else
-	fprintf(fp, "%s\n", NCURSES_VERSION);
-# endif
-#else
-# ifdef __NCURSES_H
-	fprintf(fp, "old\n");
-# else
-	make an error
-# endif
-#endif
-	${cf_cv_main_return:-return}(0);
+initscr()
+  ;
+  return 0;
 }
 _ACEOF
-rm -f conftest$ac_exeext
-if { (eval echo "$as_me:6725: \"$ac_link\"") >&5
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:6739: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:6728: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (eval echo "$as_me:6730: \"$ac_try\"") >&5
+  echo "$as_me:6742: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:6745: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:6733: \$? = $ac_status" >&5
+  echo "$as_me:6748: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-
-	cf_cv_ncurses_version=`cat $cf_tempfile`
+  echo "$as_me:6750: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+			 		 eval 'cf_cv_have_lib_'$cf_nculib_root'=yes'
+					 break
 else
-  echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
+  echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
+echo "$as_me:6757: result: no" >&5
+echo "${ECHO_T}no" >&6
+					 LIBS="$cf_save_LIBS"
 fi
-rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+			done
+
 fi
-	rm -f $cf_tempfile
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 
 fi
-echo "$as_me:6747: result: $cf_cv_ncurses_version" >&5
-echo "${ECHO_T}$cf_cv_ncurses_version" >&6
-test "$cf_cv_ncurses_version" = no || cat >>confdefs.h <<\EOF
-#define NCURSES 1
-EOF
 
-cf_nculib_root=ncurses
-	# This works, except for the special case where we find gpm, but
-	# ncurses is in a nonstandard location via $LIBS, and we really want
-	# to link gpm.
-cf_ncurses_LIBS=""
-cf_ncurses_SAVE="$LIBS"
-echo "$as_me:6759: checking for Gpm_Open in -lgpm" >&5
-echo $ECHO_N "checking for Gpm_Open in -lgpm... $ECHO_C" >&6
-if test "${ac_cv_lib_gpm_Gpm_Open+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lgpm  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-#line 6767 "configure"
-#include "confdefs.h"
+eval 'cf_found_library=$cf_cv_have_lib_'$cf_nculib_root
 
-/* Override any gcc2 internal prototype to avoid an error.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
-char Gpm_Open ();
+if test $cf_found_library = no ; then
+	{ { echo "$as_me:6772: error: Cannot link $cf_nculib_root library" >&5
+echo "$as_me: error: Cannot link $cf_nculib_root library" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+fi
+
+if test -n "$cf_ncurses_LIBS" ; then
+	echo "$as_me:6780: checking if we can link $cf_nculib_root without $cf_ncurses_LIBS" >&5
+echo $ECHO_N "checking if we can link $cf_nculib_root without $cf_ncurses_LIBS... $ECHO_C" >&6
+	cf_ncurses_SAVE="$LIBS"
+	for p in $cf_ncurses_LIBS ; do
+		q=`echo $LIBS | sed -e "s%$p %%" -e "s%$p$%%"`
+		if test "$q" != "$LIBS" ; then
+			LIBS="$q"
+		fi
+	done
+	cat >conftest.$ac_ext <<_ACEOF
+#line 6790 "configure"
+#include "confdefs.h"
+#include <${cf_cv_ncurses_header:-curses.h}>
 int
 main ()
 {
-Gpm_Open ();
+initscr(); mousemask(0,0); tgoto((char *)0, 0, 0);
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:6786: \"$ac_link\"") >&5
+if { (eval echo "$as_me:6802: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:6789: \$? = $ac_status" >&5
+  echo "$as_me:6805: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:6792: \"$ac_try\"") >&5
+  { (eval echo "$as_me:6808: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:6795: \$? = $ac_status" >&5
+  echo "$as_me:6811: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_lib_gpm_Gpm_Open=yes
+  echo "$as_me:6813: result: yes" >&5
+echo "${ECHO_T}yes" >&6
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-ac_cv_lib_gpm_Gpm_Open=no
+echo "$as_me:6818: result: no" >&5
+echo "${ECHO_T}no" >&6
+		 LIBS="$cf_ncurses_SAVE"
 fi
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
 fi
-echo "$as_me:6806: result: $ac_cv_lib_gpm_Gpm_Open" >&5
-echo "${ECHO_T}$ac_cv_lib_gpm_Gpm_Open" >&6
-if test $ac_cv_lib_gpm_Gpm_Open = yes; then
-  echo "$as_me:6809: checking for initscr in -lgpm" >&5
-echo $ECHO_N "checking for initscr in -lgpm... $ECHO_C" >&6
-if test "${ac_cv_lib_gpm_initscr+set}" = set; then
+
+cf_nculib_ROOT=`echo "HAVE_LIB$cf_nculib_root" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
+
+cat >>confdefs.h <<EOF
+#define $cf_nculib_ROOT 1
+EOF
+
+fi
+
+	;;
+ncursesw) #(vi
+
+echo "$as_me:6836: checking for multibyte character support" >&5
+echo $ECHO_N "checking for multibyte character support... $ECHO_C" >&6
+if test "${cf_cv_utf8_lib+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lgpm  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-#line 6817 "configure"
+
+	cf_save_LIBS="$LIBS"
+	cat >conftest.$ac_ext <<_ACEOF
+#line 6844 "configure"
 #include "confdefs.h"
 
-/* Override any gcc2 internal prototype to avoid an error.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
-char initscr ();
+#include <stdlib.h>
 int
 main ()
 {
-initscr ();
+putwc(0,0);
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:6836: \"$ac_link\"") >&5
+if { (eval echo "$as_me:6857: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:6839: \$? = $ac_status" >&5
+  echo "$as_me:6860: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:6842: \"$ac_try\"") >&5
+  { (eval echo "$as_me:6863: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:6845: \$? = $ac_status" >&5
+  echo "$as_me:6866: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_lib_gpm_initscr=yes
+  cf_cv_utf8_lib=yes
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-ac_cv_lib_gpm_initscr=no
-fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-echo "$as_me:6856: result: $ac_cv_lib_gpm_initscr" >&5
-echo "${ECHO_T}$ac_cv_lib_gpm_initscr" >&6
-if test $ac_cv_lib_gpm_initscr = yes; then
-  LIBS="$cf_ncurses_SAVE"
-else
-  cf_ncurses_LIBS="-lgpm"
-fi
 
-fi
+# If the linkage is not already in the $CPPFLAGS/$LDFLAGS configuration, these
+# will be set on completion of the AC_TRY_LINK below.
+cf_cv_header_path_utf8=
+cf_cv_library_path_utf8=
+
+echo "${as_me:-configure}:6878: testing Starting FIND_LINKAGE(utf8,) ..." 1>&5
+
+cf_save_LIBS="$LIBS"
 
-case $host_os in #(vi
-freebsd*)
-	# This is only necessary if you are linking against an obsolete
-	# version of ncurses (but it should do no harm, since it's static).
-	if test "$cf_nculib_root" = ncurses ; then
-		echo "$as_me:6871: checking for tgoto in -lmytinfo" >&5
-echo $ECHO_N "checking for tgoto in -lmytinfo... $ECHO_C" >&6
-if test "${ac_cv_lib_mytinfo_tgoto+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lmytinfo  $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
-#line 6879 "configure"
+#line 6883 "configure"
 #include "confdefs.h"
 
-/* Override any gcc2 internal prototype to avoid an error.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
-char tgoto ();
+#include <libutf8.h>
 int
 main ()
 {
-tgoto ();
+putwc(0,0);
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:6898: \"$ac_link\"") >&5
+if { (eval echo "$as_me:6896: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:6901: \$? = $ac_status" >&5
+  echo "$as_me:6899: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:6904: \"$ac_try\"") >&5
+  { (eval echo "$as_me:6902: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:6907: \$? = $ac_status" >&5
+  echo "$as_me:6905: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_lib_mytinfo_tgoto=yes
+
+	cf_cv_find_linkage_utf8=yes
+	cf_cv_header_path_utf8=/usr/include
+	cf_cv_library_path_utf8=/usr/lib
+
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-ac_cv_lib_mytinfo_tgoto=no
-fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-echo "$as_me:6918: result: $ac_cv_lib_mytinfo_tgoto" >&5
-echo "${ECHO_T}$ac_cv_lib_mytinfo_tgoto" >&6
-if test $ac_cv_lib_mytinfo_tgoto = yes; then
-  cf_ncurses_LIBS="-lmytinfo $cf_ncurses_LIBS"
-fi
-
-	fi
-	;;
-esac
-
-LIBS="$cf_ncurses_LIBS $LIBS"
 
-if ( test -n "$cf_cv_curses_dir" && test "$cf_cv_curses_dir" != "no" )
-then
-	LIBS="-l$cf_nculib_root $LIBS"
-else
+LIBS="-lutf8  $cf_save_LIBS"
 
-	eval 'cf_cv_have_lib_'$cf_nculib_root'=no'
-	cf_libdir=""
-	echo "$as_me:6937: checking for initscr" >&5
-echo $ECHO_N "checking for initscr... $ECHO_C" >&6
-if test "${ac_cv_func_initscr+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-#line 6943 "configure"
+cat >conftest.$ac_ext <<_ACEOF
+#line 6919 "configure"
 #include "confdefs.h"
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char initscr (); below.  */
-#include <assert.h>
-/* Override any gcc2 internal prototype to avoid an error.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
-char initscr ();
-char (*f) ();
 
+#include <libutf8.h>
 int
 main ()
 {
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined (__stub_initscr) || defined (__stub___initscr)
-choke me
-#else
-f = initscr;
-#endif
-
+putwc(0,0);
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:6974: \"$ac_link\"") >&5
+if { (eval echo "$as_me:6932: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:6977: \$? = $ac_status" >&5
+  echo "$as_me:6935: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:6980: \"$ac_try\"") >&5
+  { (eval echo "$as_me:6938: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:6983: \$? = $ac_status" >&5
+  echo "$as_me:6941: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_func_initscr=yes
-else
-  echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
-ac_cv_func_initscr=no
-fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
-fi
-echo "$as_me:6993: result: $ac_cv_func_initscr" >&5
-echo "${ECHO_T}$ac_cv_func_initscr" >&6
-if test $ac_cv_func_initscr = yes; then
-  eval 'cf_cv_have_lib_'$cf_nculib_root'=yes'
-else
 
-		cf_save_LIBS="$LIBS"
-		echo "$as_me:7000: checking for initscr in -l$cf_nculib_root" >&5
-echo $ECHO_N "checking for initscr in -l$cf_nculib_root... $ECHO_C" >&6
-		LIBS="-l$cf_nculib_root $LIBS"
-		cat >conftest.$ac_ext <<_ACEOF
-#line 7004 "configure"
-#include "confdefs.h"
-#include <${cf_cv_ncurses_header:-curses.h}>
-int
-main ()
-{
-initscr()
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:7016: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
-  ac_status=$?
-  echo "$as_me:7019: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:7022: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:7025: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  echo "$as_me:7027: result: yes" >&5
-echo "${ECHO_T}yes" >&6
-			 eval 'cf_cv_have_lib_'$cf_nculib_root'=yes'
+	cf_cv_find_linkage_utf8=yes
+	cf_cv_header_path_utf8=/usr/include
+	cf_cv_library_path_utf8=/usr/lib
+	cf_cv_library_file_utf8="-lutf8"
 
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-echo "$as_me:7034: result: no" >&5
-echo "${ECHO_T}no" >&6
+
+	cf_cv_find_linkage_utf8=no
+	LIBS="$cf_save_LIBS"
+
+    test -n "$verbose" && echo "	find linkage for utf8 library" 1>&6
+
+echo "${as_me:-configure}:6958: testing find linkage for utf8 library ..." 1>&5
+
+echo "${as_me:-configure}:6960: testing Searching for headers in FIND_LINKAGE(utf8,) ..." 1>&5
+
+    cf_save_CPPFLAGS="$CPPFLAGS"
+    cf_test_CPPFLAGS="$CPPFLAGS"
 
 cf_search=
-cf_library_path_list=""
-if test -n "${LDFLAGS}${LIBS}" ; then
-	for cf_library_path in $LDFLAGS $LIBS
+
+# collect the current set of include-directories from compiler flags
+cf_header_path_list=""
+if test -n "${CFLAGS}${CPPFLAGS}" ; then
+	for cf_header_path in $CPPFLAGS $CFLAGS
 	do
-		case $cf_library_path in #(vi
-		-L*)
-			cf_library_path=`echo ".$cf_library_path" |sed -e 's/^...//' -e 's,/lib$,,'`
+		case $cf_header_path in #(vi
+		-I*)
+			cf_header_path=`echo ".$cf_header_path" |sed -e 's/^...//' -e 's,/include$,,'`
 
-test "$cf_library_path" != "NONE" && \
-test -d "$cf_library_path" && \
+test "$cf_header_path" != "NONE" && \
+test -d "$cf_header_path" && \
  {
-	test -n "$verbose" && echo "	... testing for lib-directories under $cf_library_path"
-	test -d $cf_library_path/lib &&          cf_search="$cf_search $cf_library_path/lib"
-	test -d $cf_library_path/lib/$cf_nculib_root &&       cf_search="$cf_search $cf_library_path/lib/$cf_nculib_root"
-	test -d $cf_library_path/lib/$cf_nculib_root/lib &&    cf_search="$cf_search $cf_library_path/lib/$cf_nculib_root/lib"
-	test -d $cf_library_path/$cf_nculib_root/lib &&       cf_search="$cf_search $cf_library_path/$cf_nculib_root/lib"
-	test -d $cf_library_path/$cf_nculib_root/lib/$cf_nculib_root &&    cf_search="$cf_search $cf_library_path/$cf_nculib_root/lib/$cf_nculib_root"
+	test -n "$verbose" && echo "	... testing for include-directories under $cf_header_path"
+	test -d $cf_header_path/include &&          cf_search="$cf_search $cf_header_path/include"
+	test -d $cf_header_path/include/utf8 &&       cf_search="$cf_search $cf_header_path/include/utf8"
+	test -d $cf_header_path/include/utf8/include &&    cf_search="$cf_search $cf_header_path/include/utf8/include"
+	test -d $cf_header_path/utf8/include &&       cf_search="$cf_search $cf_header_path/utf8/include"
+	test -d $cf_header_path/utf8/include/utf8 &&    cf_search="$cf_search $cf_header_path/utf8/include/utf8"
 }
 
-			cf_library_path_list="$cf_library_path_list $cf_search"
+			cf_header_path_list="$cf_header_path_list $cf_search"
 			;;
 		esac
 	done
 fi
 
+# add the variations for the package we are looking for
+
 cf_search=
 
 test "/usr" != "$prefix" && \
 test -d "/usr" && \
 (test $prefix = NONE || test "/usr" != "$prefix") && {
-	test -n "$verbose" && echo "	... testing for lib-directories under /usr"
-	test -d /usr/lib &&          cf_search="$cf_search /usr/lib"
-	test -d /usr/lib/$cf_nculib_root &&       cf_search="$cf_search /usr/lib/$cf_nculib_root"
-	test -d /usr/lib/$cf_nculib_root/lib &&    cf_search="$cf_search /usr/lib/$cf_nculib_root/lib"
-	test -d /usr/$cf_nculib_root/lib &&       cf_search="$cf_search /usr/$cf_nculib_root/lib"
-	test -d /usr/$cf_nculib_root/lib/$cf_nculib_root &&    cf_search="$cf_search /usr/$cf_nculib_root/lib/$cf_nculib_root"
+	test -n "$verbose" && echo "	... testing for include-directories under /usr"
+	test -d /usr/include &&          cf_search="$cf_search /usr/include"
+	test -d /usr/include/utf8 &&       cf_search="$cf_search /usr/include/utf8"
+	test -d /usr/include/utf8/include &&    cf_search="$cf_search /usr/include/utf8/include"
+	test -d /usr/utf8/include &&       cf_search="$cf_search /usr/utf8/include"
+	test -d /usr/utf8/include/utf8 &&    cf_search="$cf_search /usr/utf8/include/utf8"
 }
 
 test "$prefix" != "NONE" && \
 test -d "$prefix" && \
  {
-	test -n "$verbose" && echo "	... testing for lib-directories under $prefix"
-	test -d $prefix/lib &&          cf_search="$cf_search $prefix/lib"
-	test -d $prefix/lib/$cf_nculib_root &&       cf_search="$cf_search $prefix/lib/$cf_nculib_root"
-	test -d $prefix/lib/$cf_nculib_root/lib &&    cf_search="$cf_search $prefix/lib/$cf_nculib_root/lib"
-	test -d $prefix/$cf_nculib_root/lib &&       cf_search="$cf_search $prefix/$cf_nculib_root/lib"
-	test -d $prefix/$cf_nculib_root/lib/$cf_nculib_root &&    cf_search="$cf_search $prefix/$cf_nculib_root/lib/$cf_nculib_root"
+	test -n "$verbose" && echo "	... testing for include-directories under $prefix"
+	test -d $prefix/include &&          cf_search="$cf_search $prefix/include"
+	test -d $prefix/include/utf8 &&       cf_search="$cf_search $prefix/include/utf8"
+	test -d $prefix/include/utf8/include &&    cf_search="$cf_search $prefix/include/utf8/include"
+	test -d $prefix/utf8/include &&       cf_search="$cf_search $prefix/utf8/include"
+	test -d $prefix/utf8/include/utf8 &&    cf_search="$cf_search $prefix/utf8/include/utf8"
 }
 
 test "/usr/local" != "$prefix" && \
 test -d "/usr/local" && \
 (test $prefix = NONE || test "/usr/local" != "$prefix") && {
-	test -n "$verbose" && echo "	... testing for lib-directories under /usr/local"
-	test -d /usr/local/lib &&          cf_search="$cf_search /usr/local/lib"
-	test -d /usr/local/lib/$cf_nculib_root &&       cf_search="$cf_search /usr/local/lib/$cf_nculib_root"
-	test -d /usr/local/lib/$cf_nculib_root/lib &&    cf_search="$cf_search /usr/local/lib/$cf_nculib_root/lib"
-	test -d /usr/local/$cf_nculib_root/lib &&       cf_search="$cf_search /usr/local/$cf_nculib_root/lib"
-	test -d /usr/local/$cf_nculib_root/lib/$cf_nculib_root &&    cf_search="$cf_search /usr/local/$cf_nculib_root/lib/$cf_nculib_root"
+	test -n "$verbose" && echo "	... testing for include-directories under /usr/local"
+	test -d /usr/local/include &&          cf_search="$cf_search /usr/local/include"
+	test -d /usr/local/include/utf8 &&       cf_search="$cf_search /usr/local/include/utf8"
+	test -d /usr/local/include/utf8/include &&    cf_search="$cf_search /usr/local/include/utf8/include"
+	test -d /usr/local/utf8/include &&       cf_search="$cf_search /usr/local/utf8/include"
+	test -d /usr/local/utf8/include/utf8 &&    cf_search="$cf_search /usr/local/utf8/include/utf8"
 }
 
 test "/opt" != "$prefix" && \
 test -d "/opt" && \
 (test $prefix = NONE || test "/opt" != "$prefix") && {
-	test -n "$verbose" && echo "	... testing for lib-directories under /opt"
-	test -d /opt/lib &&          cf_search="$cf_search /opt/lib"
-	test -d /opt/lib/$cf_nculib_root &&       cf_search="$cf_search /opt/lib/$cf_nculib_root"
-	test -d /opt/lib/$cf_nculib_root/lib &&    cf_search="$cf_search /opt/lib/$cf_nculib_root/lib"
-	test -d /opt/$cf_nculib_root/lib &&       cf_search="$cf_search /opt/$cf_nculib_root/lib"
-	test -d /opt/$cf_nculib_root/lib/$cf_nculib_root &&    cf_search="$cf_search /opt/$cf_nculib_root/lib/$cf_nculib_root"
+	test -n "$verbose" && echo "	... testing for include-directories under /opt"
+	test -d /opt/include &&          cf_search="$cf_search /opt/include"
+	test -d /opt/include/utf8 &&       cf_search="$cf_search /opt/include/utf8"
+	test -d /opt/include/utf8/include &&    cf_search="$cf_search /opt/include/utf8/include"
+	test -d /opt/utf8/include &&       cf_search="$cf_search /opt/utf8/include"
+	test -d /opt/utf8/include/utf8 &&    cf_search="$cf_search /opt/utf8/include/utf8"
 }
 
 test "$HOME" != "$prefix" && \
 test -d "$HOME" && \
 (test $prefix = NONE || test "$HOME" != "$prefix") && {
-	test -n "$verbose" && echo "	... testing for lib-directories under $HOME"
-	test -d $HOME/lib &&          cf_search="$cf_search $HOME/lib"
-	test -d $HOME/lib/$cf_nculib_root &&       cf_search="$cf_search $HOME/lib/$cf_nculib_root"
-	test -d $HOME/lib/$cf_nculib_root/lib &&    cf_search="$cf_search $HOME/lib/$cf_nculib_root/lib"
-	test -d $HOME/$cf_nculib_root/lib &&       cf_search="$cf_search $HOME/$cf_nculib_root/lib"
-	test -d $HOME/$cf_nculib_root/lib/$cf_nculib_root &&    cf_search="$cf_search $HOME/$cf_nculib_root/lib/$cf_nculib_root"
+	test -n "$verbose" && echo "	... testing for include-directories under $HOME"
+	test -d $HOME/include &&          cf_search="$cf_search $HOME/include"
+	test -d $HOME/include/utf8 &&       cf_search="$cf_search $HOME/include/utf8"
+	test -d $HOME/include/utf8/include &&    cf_search="$cf_search $HOME/include/utf8/include"
+	test -d $HOME/utf8/include &&       cf_search="$cf_search $HOME/utf8/include"
+	test -d $HOME/utf8/include/utf8 &&    cf_search="$cf_search $HOME/utf8/include/utf8"
 }
 
-cf_search="$cf_library_path_list $cf_search"
+test "$includedir" != NONE && \
+test "$includedir" != "/usr/include" && \
+test -d "$includedir" && {
+	test -d $includedir &&    cf_search="$cf_search $includedir"
+	test -d $includedir/utf8 && cf_search="$cf_search $includedir/utf8"
+}
 
-			for cf_libdir in $cf_search
-			do
-				echo "$as_me:7124: checking for -l$cf_nculib_root in $cf_libdir" >&5
-echo $ECHO_N "checking for -l$cf_nculib_root in $cf_libdir... $ECHO_C" >&6
-				LIBS="-L$cf_libdir -l$cf_nculib_root $cf_save_LIBS"
-				cat >conftest.$ac_ext <<_ACEOF
-#line 7128 "configure"
+test "$oldincludedir" != NONE && \
+test "$oldincludedir" != "/usr/include" && \
+test -d "$oldincludedir" && {
+	test -d $oldincludedir    && cf_search="$cf_search $oldincludedir"
+	test -d $oldincludedir/utf8 && cf_search="$cf_search $oldincludedir/utf8"
+}
+
+cf_search="$cf_search $cf_header_path_list"
+
+    for cf_cv_header_path_utf8 in $cf_search
+    do
+      if test -d $cf_cv_header_path_utf8 ; then
+        test -n "$verbose" && echo "	... testing $cf_cv_header_path_utf8" 1>&6
+
+echo "${as_me:-configure}:7073: testing ... testing $cf_cv_header_path_utf8 ..." 1>&5
+
+        CPPFLAGS="$cf_save_CPPFLAGS -I$cf_cv_header_path_utf8"
+        cat >conftest.$ac_ext <<_ACEOF
+#line 7077 "configure"
 #include "confdefs.h"
-#include <${cf_cv_ncurses_header:-curses.h}>
+
+#include <libutf8.h>
 int
 main ()
 {
-initscr()
+putwc(0,0);
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:7140: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:7090: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:7143: \$? = $ac_status" >&5
+  echo "$as_me:7093: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:7146: \"$ac_try\"") >&5
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:7096: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:7149: \$? = $ac_status" >&5
+  echo "$as_me:7099: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  echo "$as_me:7151: result: yes" >&5
-echo "${ECHO_T}yes" >&6
-			 		 eval 'cf_cv_have_lib_'$cf_nculib_root'=yes'
-					 break
+
+            test -n "$verbose" && echo "	... found utf8 headers in $cf_cv_header_path_utf8" 1>&6
+
+echo "${as_me:-configure}:7104: testing ... found utf8 headers in $cf_cv_header_path_utf8 ..." 1>&5
+
+            cf_cv_find_linkage_utf8=maybe
+            cf_test_CPPFLAGS="$CPPFLAGS"
+            break
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-echo "$as_me:7158: result: no" >&5
-echo "${ECHO_T}no" >&6
-					 LIBS="$cf_save_LIBS"
-fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
-			done
 
-fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+            CPPFLAGS="$cf_save_CPPFLAGS"
 
 fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+      fi
+    done
 
-eval 'cf_found_library=$cf_cv_have_lib_'$cf_nculib_root
+    if test "$cf_cv_find_linkage_utf8" = maybe ; then
 
-if test $cf_found_library = no ; then
-	{ { echo "$as_me:7173: error: Cannot link $cf_nculib_root library" >&5
-echo "$as_me: error: Cannot link $cf_nculib_root library" >&2;}
-   { (exit 1); exit 1; }; }
-fi
+echo "${as_me:-configure}:7122: testing Searching for utf8 library in FIND_LINKAGE(utf8,) ..." 1>&5
 
-fi
+      cf_save_LIBS="$LIBS"
+      cf_save_LDFLAGS="$LDFLAGS"
 
-if test -n "$cf_ncurses_LIBS" ; then
-	echo "$as_me:7181: checking if we can link $cf_nculib_root without $cf_ncurses_LIBS" >&5
-echo $ECHO_N "checking if we can link $cf_nculib_root without $cf_ncurses_LIBS... $ECHO_C" >&6
-	cf_ncurses_SAVE="$LIBS"
-	for p in $cf_ncurses_LIBS ; do
-		q=`echo $LIBS | sed -e "s%$p %%" -e "s%$p$%%"`
-		if test "$q" != "$LIBS" ; then
-			LIBS="$q"
-		fi
+      if test "$cf_cv_find_linkage_utf8" != yes ; then
+
+cf_search=
+cf_library_path_list=""
+if test -n "${LDFLAGS}${LIBS}" ; then
+	for cf_library_path in $LDFLAGS $LIBS
+	do
+		case $cf_library_path in #(vi
+		-L*)
+			cf_library_path=`echo ".$cf_library_path" |sed -e 's/^...//' -e 's,/lib$,,'`
+
+test "$cf_library_path" != "NONE" && \
+test -d "$cf_library_path" && \
+ {
+	test -n "$verbose" && echo "	... testing for lib-directories under $cf_library_path"
+	test -d $cf_library_path/lib &&          cf_search="$cf_search $cf_library_path/lib"
+	test -d $cf_library_path/lib/utf8 &&       cf_search="$cf_search $cf_library_path/lib/utf8"
+	test -d $cf_library_path/lib/utf8/lib &&    cf_search="$cf_search $cf_library_path/lib/utf8/lib"
+	test -d $cf_library_path/utf8/lib &&       cf_search="$cf_search $cf_library_path/utf8/lib"
+	test -d $cf_library_path/utf8/lib/utf8 &&    cf_search="$cf_search $cf_library_path/utf8/lib/utf8"
+}
+
+			cf_library_path_list="$cf_library_path_list $cf_search"
+			;;
+		esac
 	done
-	cat >conftest.$ac_ext <<_ACEOF
-#line 7191 "configure"
+fi
+
+cf_search=
+
+test "/usr" != "$prefix" && \
+test -d "/usr" && \
+(test $prefix = NONE || test "/usr" != "$prefix") && {
+	test -n "$verbose" && echo "	... testing for lib-directories under /usr"
+	test -d /usr/lib &&          cf_search="$cf_search /usr/lib"
+	test -d /usr/lib/utf8 &&       cf_search="$cf_search /usr/lib/utf8"
+	test -d /usr/lib/utf8/lib &&    cf_search="$cf_search /usr/lib/utf8/lib"
+	test -d /usr/utf8/lib &&       cf_search="$cf_search /usr/utf8/lib"
+	test -d /usr/utf8/lib/utf8 &&    cf_search="$cf_search /usr/utf8/lib/utf8"
+}
+
+test "$prefix" != "NONE" && \
+test -d "$prefix" && \
+ {
+	test -n "$verbose" && echo "	... testing for lib-directories under $prefix"
+	test -d $prefix/lib &&          cf_search="$cf_search $prefix/lib"
+	test -d $prefix/lib/utf8 &&       cf_search="$cf_search $prefix/lib/utf8"
+	test -d $prefix/lib/utf8/lib &&    cf_search="$cf_search $prefix/lib/utf8/lib"
+	test -d $prefix/utf8/lib &&       cf_search="$cf_search $prefix/utf8/lib"
+	test -d $prefix/utf8/lib/utf8 &&    cf_search="$cf_search $prefix/utf8/lib/utf8"
+}
+
+test "/usr/local" != "$prefix" && \
+test -d "/usr/local" && \
+(test $prefix = NONE || test "/usr/local" != "$prefix") && {
+	test -n "$verbose" && echo "	... testing for lib-directories under /usr/local"
+	test -d /usr/local/lib &&          cf_search="$cf_search /usr/local/lib"
+	test -d /usr/local/lib/utf8 &&       cf_search="$cf_search /usr/local/lib/utf8"
+	test -d /usr/local/lib/utf8/lib &&    cf_search="$cf_search /usr/local/lib/utf8/lib"
+	test -d /usr/local/utf8/lib &&       cf_search="$cf_search /usr/local/utf8/lib"
+	test -d /usr/local/utf8/lib/utf8 &&    cf_search="$cf_search /usr/local/utf8/lib/utf8"
+}
+
+test "/opt" != "$prefix" && \
+test -d "/opt" && \
+(test $prefix = NONE || test "/opt" != "$prefix") && {
+	test -n "$verbose" && echo "	... testing for lib-directories under /opt"
+	test -d /opt/lib &&          cf_search="$cf_search /opt/lib"
+	test -d /opt/lib/utf8 &&       cf_search="$cf_search /opt/lib/utf8"
+	test -d /opt/lib/utf8/lib &&    cf_search="$cf_search /opt/lib/utf8/lib"
+	test -d /opt/utf8/lib &&       cf_search="$cf_search /opt/utf8/lib"
+	test -d /opt/utf8/lib/utf8 &&    cf_search="$cf_search /opt/utf8/lib/utf8"
+}
+
+test "$HOME" != "$prefix" && \
+test -d "$HOME" && \
+(test $prefix = NONE || test "$HOME" != "$prefix") && {
+	test -n "$verbose" && echo "	... testing for lib-directories under $HOME"
+	test -d $HOME/lib &&          cf_search="$cf_search $HOME/lib"
+	test -d $HOME/lib/utf8 &&       cf_search="$cf_search $HOME/lib/utf8"
+	test -d $HOME/lib/utf8/lib &&    cf_search="$cf_search $HOME/lib/utf8/lib"
+	test -d $HOME/utf8/lib &&       cf_search="$cf_search $HOME/utf8/lib"
+	test -d $HOME/utf8/lib/utf8 &&    cf_search="$cf_search $HOME/utf8/lib/utf8"
+}
+
+cf_search="$cf_library_path_list $cf_search"
+
+        for cf_cv_library_path_utf8 in $cf_search
+        do
+          if test -d $cf_cv_library_path_utf8 ; then
+            test -n "$verbose" && echo "	... testing $cf_cv_library_path_utf8" 1>&6
+
+echo "${as_me:-configure}:7219: testing ... testing $cf_cv_library_path_utf8 ..." 1>&5
+
+            CPPFLAGS="$cf_test_CPPFLAGS"
+            LIBS="-lutf8  $cf_save_LIBS"
+            LDFLAGS="$cf_save_LDFLAGS -L$cf_cv_library_path_utf8"
+            cat >conftest.$ac_ext <<_ACEOF
+#line 7225 "configure"
 #include "confdefs.h"
-#include <${cf_cv_ncurses_header:-curses.h}>
+
+#include <libutf8.h>
 int
 main ()
 {
-initscr(); mousemask(0,0); tgoto((char *)0, 0, 0);
+putwc(0,0);
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:7203: \"$ac_link\"") >&5
+if { (eval echo "$as_me:7238: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:7206: \$? = $ac_status" >&5
+  echo "$as_me:7241: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:7209: \"$ac_try\"") >&5
+  { (eval echo "$as_me:7244: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:7212: \$? = $ac_status" >&5
+  echo "$as_me:7247: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  echo "$as_me:7214: result: yes" >&5
-echo "${ECHO_T}yes" >&6
+
+                test -n "$verbose" && echo "	... found utf8 library in $cf_cv_library_path_utf8" 1>&6
+
+echo "${as_me:-configure}:7252: testing ... found utf8 library in $cf_cv_library_path_utf8 ..." 1>&5
+
+                cf_cv_find_linkage_utf8=yes
+                cf_cv_library_file_utf8="-lutf8"
+                break
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-echo "$as_me:7219: result: no" >&5
-echo "${ECHO_T}no" >&6
-		 LIBS="$cf_ncurses_SAVE"
+
+                CPPFLAGS="$cf_save_CPPFLAGS"
+                LIBS="$cf_save_LIBS"
+                LDFLAGS="$cf_save_LDFLAGS"
+
 fi
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
-fi
+          fi
+        done
+        CPPFLAGS="$cf_save_CPPFLAGS"
+        LDFLAGS="$cf_save_LDFLAGS"
+      fi
 
-cf_nculib_ROOT=`echo "HAVE_LIB$cf_nculib_root" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
+    else
+      cf_cv_find_linkage_utf8=no
+    fi
 
-cat >>confdefs.h <<EOF
-#define $cf_nculib_ROOT 1
-EOF
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 
 fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 
-	;;
-ncursesw)
-	cf_cv_libtype=w
+LIBS="$cf_save_LIBS"
 
-echo "$as_me:7238: checking for multibyte character support" >&5
-echo $ECHO_N "checking for multibyte character support... $ECHO_C" >&6
-if test "${cf_cv_utf8_lib+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+if test "$cf_cv_find_linkage_utf8" = yes ; then
+cf_cv_utf8_lib=add-on
 else
+cf_cv_utf8_lib=no
+fi
 
-	cf_save_LIBS="$LIBS"
-	cat >conftest.$ac_ext <<_ACEOF
-#line 7246 "configure"
-#include "confdefs.h"
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:7294: result: $cf_cv_utf8_lib" >&5
+echo "${ECHO_T}$cf_cv_utf8_lib" >&6
 
-#include <stdlib.h>
+# HAVE_LIBUTF8_H is used by ncurses if curses.h is shared between
+# ncurses/ncursesw:
+if test "$cf_cv_utf8_lib" = "add-on" ; then
+
+cat >>confdefs.h <<\EOF
+#define HAVE_LIBUTF8_H 1
+EOF
+
+if test -n "$cf_cv_header_path_utf8" ; then
+  for cf_add_incdir in $cf_cv_header_path_utf8
+  do
+	while test $cf_add_incdir != /usr/include
+	do
+	  if test -d $cf_add_incdir
+	  then
+		cf_have_incdir=no
+		if test -n "$CFLAGS$CPPFLAGS" ; then
+		  # a loop is needed to ensure we can add subdirs of existing dirs
+		  for cf_test_incdir in $CFLAGS $CPPFLAGS ; do
+			if test ".$cf_test_incdir" = ".-I$cf_add_incdir" ; then
+			  cf_have_incdir=yes; break
+			fi
+		  done
+		fi
+
+		if test "$cf_have_incdir" = no ; then
+		  if test "$cf_add_incdir" = /usr/local/include ; then
+			if test "$GCC" = yes
+			then
+			  cf_save_CPPFLAGS=$CPPFLAGS
+			  CPPFLAGS="$CPPFLAGS -I$cf_add_incdir"
+			  cat >conftest.$ac_ext <<_ACEOF
+#line 7329 "configure"
+#include "confdefs.h"
+#include <stdio.h>
 int
 main ()
 {
-putwc(0,0);
+printf("Hello")
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:7259: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:7341: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:7262: \$? = $ac_status" >&5
+  echo "$as_me:7344: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:7265: \"$ac_try\"") >&5
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:7347: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:7268: \$? = $ac_status" >&5
+  echo "$as_me:7350: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  cf_cv_utf8_lib=yes
+  :
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
+cf_have_incdir=yes
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+			  CPPFLAGS=$cf_save_CPPFLAGS
+			fi
+		  fi
+		fi
 
-# If the linkage is not already in the $CPPFLAGS/$LDFLAGS configuration, these
-# will be set on completion of the AC_TRY_LINK below.
-cf_cv_header_path_utf8=
-cf_cv_library_path_utf8=
-
-echo "${as_me:-configure}:7280: testing Starting FIND_LINKAGE(utf8,) ..." 1>&5
+		if test "$cf_have_incdir" = no ; then
+		  test -n "$verbose" && echo "	adding $cf_add_incdir to include-path" 1>&6
 
-cf_save_LIBS="$LIBS"
+echo "${as_me:-configure}:7367: testing adding $cf_add_incdir to include-path ..." 1>&5
 
-cat >conftest.$ac_ext <<_ACEOF
-#line 7285 "configure"
-#include "confdefs.h"
+		  CPPFLAGS="$CPPFLAGS -I$cf_add_incdir"
 
-#include <libutf8.h>
-int
-main ()
-{
-putwc(0,0);
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:7298: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
-  ac_status=$?
-  echo "$as_me:7301: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:7304: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:7307: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+		  cf_top_incdir=`echo $cf_add_incdir | sed -e 's%/include/.*$%/include%'`
+		  test "$cf_top_incdir" = "$cf_add_incdir" && break
+		  cf_add_incdir="$cf_top_incdir"
+		else
+		  break
+		fi
+	  fi
+	done
+  done
+fi
 
-	cf_cv_find_linkage_utf8=yes
-	cf_cv_header_path_utf8=/usr/include
-	cf_cv_library_path_utf8=/usr/lib
+if test -n "$cf_cv_library_path_utf8" ; then
+  for cf_add_libdir in $cf_cv_library_path_utf8
+  do
+    if test $cf_add_libdir = /usr/lib ; then
+      :
+    elif test -d $cf_add_libdir
+    then
+      cf_have_libdir=no
+      if test -n "$LDFLAGS$LIBS" ; then
+        # a loop is needed to ensure we can add subdirs of existing dirs
+        for cf_test_libdir in $LDFLAGS $LIBS ; do
+          if test ".$cf_test_libdir" = ".-L$cf_add_libdir" ; then
+            cf_have_libdir=yes; break
+          fi
+        done
+      fi
+      if test "$cf_have_libdir" = no ; then
+        test -n "$verbose" && echo "	adding $cf_add_libdir to library-path" 1>&6
 
-else
-  echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
+echo "${as_me:-configure}:7401: testing adding $cf_add_libdir to library-path ..." 1>&5
 
-LIBS="-lutf8  $cf_save_LIBS"
+        LDFLAGS="-L$cf_add_libdir $LDFLAGS"
+      fi
+    fi
+  done
+fi
 
-cat >conftest.$ac_ext <<_ACEOF
-#line 7321 "configure"
-#include "confdefs.h"
+	LIBS="$cf_cv_library_file_utf8 $LIBS"
+fi
 
-#include <libutf8.h>
-int
-main ()
-{
-putwc(0,0);
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:7334: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
-  ac_status=$?
-  echo "$as_me:7337: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:7340: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:7343: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+cf_ncuconfig_root=ncursesw
 
-	cf_cv_find_linkage_utf8=yes
-	cf_cv_header_path_utf8=/usr/include
-	cf_cv_library_path_utf8=/usr/lib
-	cf_cv_library_file_utf8="-lutf8"
+echo "Looking for ${cf_ncuconfig_root}-config"
 
+if test -n "$ac_tool_prefix"; then
+  for ac_prog in ${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}5-config
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+echo "$as_me:7421: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_NCURSES_CONFIG+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
-
-	cf_cv_find_linkage_utf8=no
-	LIBS="$cf_save_LIBS"
-
-    test -n "$verbose" && echo "	find linkage for utf8 library" 1>&6
-
-echo "${as_me:-configure}:7360: testing find linkage for utf8 library ..." 1>&5
-
-echo "${as_me:-configure}:7362: testing Searching for headers in FIND_LINKAGE(utf8,) ..." 1>&5
-
-    cf_save_CPPFLAGS="$CPPFLAGS"
-    cf_test_CPPFLAGS="$CPPFLAGS"
-
-cf_search=
-
-# collect the current set of include-directories from compiler flags
-cf_header_path_list=""
-if test -n "${CFLAGS}${CPPFLAGS}" ; then
-	for cf_header_path in $CPPFLAGS $CFLAGS
-	do
-		case $cf_header_path in #(vi
-		-I*)
-			cf_header_path=`echo ".$cf_header_path" |sed -e 's/^...//' -e 's,/include$,,'`
-
-test "$cf_header_path" != "NONE" && \
-test -d "$cf_header_path" && \
- {
-	test -n "$verbose" && echo "	... testing for include-directories under $cf_header_path"
-	test -d $cf_header_path/include &&          cf_search="$cf_search $cf_header_path/include"
-	test -d $cf_header_path/include/utf8 &&       cf_search="$cf_search $cf_header_path/include/utf8"
-	test -d $cf_header_path/include/utf8/include &&    cf_search="$cf_search $cf_header_path/include/utf8/include"
-	test -d $cf_header_path/utf8/include &&       cf_search="$cf_search $cf_header_path/utf8/include"
-	test -d $cf_header_path/utf8/include/utf8 &&    cf_search="$cf_search $cf_header_path/utf8/include/utf8"
-}
+  if test -n "$NCURSES_CONFIG"; then
+  ac_cv_prog_NCURSES_CONFIG="$NCURSES_CONFIG" # Let the user override the test.
+else
+  ac_save_IFS=$IFS; IFS=$ac_path_separator
+ac_dummy="$PATH"
+for ac_dir in $ac_dummy; do
+  IFS=$ac_save_IFS
+  test -z "$ac_dir" && ac_dir=.
+  $as_executable_p "$ac_dir/$ac_word" || continue
+ac_cv_prog_NCURSES_CONFIG="$ac_tool_prefix$ac_prog"
+echo "$as_me:7436: found $ac_dir/$ac_word" >&5
+break
+done
 
-			cf_header_path_list="$cf_header_path_list $cf_search"
-			;;
-		esac
-	done
+fi
+fi
+NCURSES_CONFIG=$ac_cv_prog_NCURSES_CONFIG
+if test -n "$NCURSES_CONFIG"; then
+  echo "$as_me:7444: result: $NCURSES_CONFIG" >&5
+echo "${ECHO_T}$NCURSES_CONFIG" >&6
+else
+  echo "$as_me:7447: result: no" >&5
+echo "${ECHO_T}no" >&6
 fi
 
-# add the variations for the package we are looking for
-
-cf_search=
-
-test "/usr" != "$prefix" && \
-test -d "/usr" && \
-(test $prefix = NONE || test "/usr" != "$prefix") && {
-	test -n "$verbose" && echo "	... testing for include-directories under /usr"
-	test -d /usr/include &&          cf_search="$cf_search /usr/include"
-	test -d /usr/include/utf8 &&       cf_search="$cf_search /usr/include/utf8"
-	test -d /usr/include/utf8/include &&    cf_search="$cf_search /usr/include/utf8/include"
-	test -d /usr/utf8/include &&       cf_search="$cf_search /usr/utf8/include"
-	test -d /usr/utf8/include/utf8 &&    cf_search="$cf_search /usr/utf8/include/utf8"
-}
-
-test "$prefix" != "NONE" && \
-test -d "$prefix" && \
- {
-	test -n "$verbose" && echo "	... testing for include-directories under $prefix"
-	test -d $prefix/include &&          cf_search="$cf_search $prefix/include"
-	test -d $prefix/include/utf8 &&       cf_search="$cf_search $prefix/include/utf8"
-	test -d $prefix/include/utf8/include &&    cf_search="$cf_search $prefix/include/utf8/include"
-	test -d $prefix/utf8/include &&       cf_search="$cf_search $prefix/utf8/include"
-	test -d $prefix/utf8/include/utf8 &&    cf_search="$cf_search $prefix/utf8/include/utf8"
-}
-
-test "/usr/local" != "$prefix" && \
-test -d "/usr/local" && \
-(test $prefix = NONE || test "/usr/local" != "$prefix") && {
-	test -n "$verbose" && echo "	... testing for include-directories under /usr/local"
-	test -d /usr/local/include &&          cf_search="$cf_search /usr/local/include"
-	test -d /usr/local/include/utf8 &&       cf_search="$cf_search /usr/local/include/utf8"
-	test -d /usr/local/include/utf8/include &&    cf_search="$cf_search /usr/local/include/utf8/include"
-	test -d /usr/local/utf8/include &&       cf_search="$cf_search /usr/local/utf8/include"
-	test -d /usr/local/utf8/include/utf8 &&    cf_search="$cf_search /usr/local/utf8/include/utf8"
-}
+    test -n "$NCURSES_CONFIG" && break
+  done
+fi
+if test -z "$NCURSES_CONFIG"; then
+  ac_ct_NCURSES_CONFIG=$NCURSES_CONFIG
+  for ac_prog in ${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}5-config
+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 "$as_me:7460: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_NCURSES_CONFIG+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_NCURSES_CONFIG"; then
+  ac_cv_prog_ac_ct_NCURSES_CONFIG="$ac_ct_NCURSES_CONFIG" # Let the user override the test.
+else
+  ac_save_IFS=$IFS; IFS=$ac_path_separator
+ac_dummy="$PATH"
+for ac_dir in $ac_dummy; do
+  IFS=$ac_save_IFS
+  test -z "$ac_dir" && ac_dir=.
+  $as_executable_p "$ac_dir/$ac_word" || continue
+ac_cv_prog_ac_ct_NCURSES_CONFIG="$ac_prog"
+echo "$as_me:7475: found $ac_dir/$ac_word" >&5
+break
+done
 
-test "/opt" != "$prefix" && \
-test -d "/opt" && \
-(test $prefix = NONE || test "/opt" != "$prefix") && {
-	test -n "$verbose" && echo "	... testing for include-directories under /opt"
-	test -d /opt/include &&          cf_search="$cf_search /opt/include"
-	test -d /opt/include/utf8 &&       cf_search="$cf_search /opt/include/utf8"
-	test -d /opt/include/utf8/include &&    cf_search="$cf_search /opt/include/utf8/include"
-	test -d /opt/utf8/include &&       cf_search="$cf_search /opt/utf8/include"
-	test -d /opt/utf8/include/utf8 &&    cf_search="$cf_search /opt/utf8/include/utf8"
-}
+fi
+fi
+ac_ct_NCURSES_CONFIG=$ac_cv_prog_ac_ct_NCURSES_CONFIG
+if test -n "$ac_ct_NCURSES_CONFIG"; then
+  echo "$as_me:7483: result: $ac_ct_NCURSES_CONFIG" >&5
+echo "${ECHO_T}$ac_ct_NCURSES_CONFIG" >&6
+else
+  echo "$as_me:7486: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
 
-test "$HOME" != "$prefix" && \
-test -d "$HOME" && \
-(test $prefix = NONE || test "$HOME" != "$prefix") && {
-	test -n "$verbose" && echo "	... testing for include-directories under $HOME"
-	test -d $HOME/include &&          cf_search="$cf_search $HOME/include"
-	test -d $HOME/include/utf8 &&       cf_search="$cf_search $HOME/include/utf8"
-	test -d $HOME/include/utf8/include &&    cf_search="$cf_search $HOME/include/utf8/include"
-	test -d $HOME/utf8/include &&       cf_search="$cf_search $HOME/utf8/include"
-	test -d $HOME/utf8/include/utf8 &&    cf_search="$cf_search $HOME/utf8/include/utf8"
-}
+  test -n "$ac_ct_NCURSES_CONFIG" && break
+done
+test -n "$ac_ct_NCURSES_CONFIG" || ac_ct_NCURSES_CONFIG="none"
 
-test "$includedir" != NONE && \
-test "$includedir" != "/usr/include" && \
-test -d "$includedir" && {
-	test -d $includedir &&    cf_search="$cf_search $includedir"
-	test -d $includedir/utf8 && cf_search="$cf_search $includedir/utf8"
-}
+  NCURSES_CONFIG=$ac_ct_NCURSES_CONFIG
+fi
 
-test "$oldincludedir" != NONE && \
-test "$oldincludedir" != "/usr/include" && \
-test -d "$oldincludedir" && {
-	test -d $oldincludedir    && cf_search="$cf_search $oldincludedir"
-	test -d $oldincludedir/utf8 && cf_search="$cf_search $oldincludedir/utf8"
-}
+if test "$NCURSES_CONFIG" != none ; then
 
-cf_search="$cf_search $cf_header_path_list"
+CPPFLAGS="$CPPFLAGS `$NCURSES_CONFIG --cflags`"
+LIBS="`$NCURSES_CONFIG --libs` $LIBS"
 
-    for cf_cv_header_path_utf8 in $cf_search
-    do
-      if test -d $cf_cv_header_path_utf8 ; then
-        test -n "$verbose" && echo "	... testing $cf_cv_header_path_utf8" 1>&6
+# even with config script, some packages use no-override for curses.h
 
-echo "${as_me:-configure}:7475: testing ... testing $cf_cv_header_path_utf8 ..." 1>&5
+echo "$as_me:7504: checking if we have identified curses headers" >&5
+echo $ECHO_N "checking if we have identified curses headers... $ECHO_C" >&6
+if test "${cf_cv_ncurses_header+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
 
-        CPPFLAGS="$cf_save_CPPFLAGS -I$cf_cv_header_path_utf8"
-        cat >conftest.$ac_ext <<_ACEOF
-#line 7479 "configure"
+cf_cv_ncurses_header=none
+for cf_header in  \
+    ncursesw/ncurses.h \
+	ncursesw/curses.h \
+	ncurses.h \
+	curses.h
+do
+cat >conftest.$ac_ext <<_ACEOF
+#line 7518 "configure"
 #include "confdefs.h"
-
-#include <libutf8.h>
+#include <${cf_header}>
 int
 main ()
 {
-putwc(0,0);
+initscr(); tgoto("?", 0,0)
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:7492: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:7530: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:7495: \$? = $ac_status" >&5
+  echo "$as_me:7533: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:7498: \"$ac_try\"") >&5
+  { (eval echo "$as_me:7536: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:7501: \$? = $ac_status" >&5
+  echo "$as_me:7539: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-
-            test -n "$verbose" && echo "	... found utf8 headers in $cf_cv_header_path_utf8" 1>&6
-
-echo "${as_me:-configure}:7506: testing ... found utf8 headers in $cf_cv_header_path_utf8 ..." 1>&5
-
-            cf_cv_find_linkage_utf8=maybe
-            cf_test_CPPFLAGS="$CPPFLAGS"
-            break
+  cf_cv_ncurses_header=$cf_header; break
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-
-            CPPFLAGS="$cf_save_CPPFLAGS"
-
 fi
 rm -f conftest.$ac_objext conftest.$ac_ext
-      fi
-    done
-
-    if test "$cf_cv_find_linkage_utf8" = maybe ; then
-
-echo "${as_me:-configure}:7524: testing Searching for utf8 library in FIND_LINKAGE(utf8,) ..." 1>&5
-
-      cf_save_LIBS="$LIBS"
-      cf_save_LDFLAGS="$LDFLAGS"
-
-      if test "$cf_cv_find_linkage_utf8" != yes ; then
-
-cf_search=
-cf_library_path_list=""
-if test -n "${LDFLAGS}${LIBS}" ; then
-	for cf_library_path in $LDFLAGS $LIBS
-	do
-		case $cf_library_path in #(vi
-		-L*)
-			cf_library_path=`echo ".$cf_library_path" |sed -e 's/^...//' -e 's,/lib$,,'`
-
-test "$cf_library_path" != "NONE" && \
-test -d "$cf_library_path" && \
- {
-	test -n "$verbose" && echo "	... testing for lib-directories under $cf_library_path"
-	test -d $cf_library_path/lib &&          cf_search="$cf_search $cf_library_path/lib"
-	test -d $cf_library_path/lib/utf8 &&       cf_search="$cf_search $cf_library_path/lib/utf8"
-	test -d $cf_library_path/lib/utf8/lib &&    cf_search="$cf_search $cf_library_path/lib/utf8/lib"
-	test -d $cf_library_path/utf8/lib &&       cf_search="$cf_search $cf_library_path/utf8/lib"
-	test -d $cf_library_path/utf8/lib/utf8 &&    cf_search="$cf_search $cf_library_path/utf8/lib/utf8"
-}
+done
 
-			cf_library_path_list="$cf_library_path_list $cf_search"
-			;;
-		esac
-	done
 fi
+echo "$as_me:7550: result: $cf_cv_ncurses_header" >&5
+echo "${ECHO_T}$cf_cv_ncurses_header" >&6
 
-cf_search=
-
-test "/usr" != "$prefix" && \
-test -d "/usr" && \
-(test $prefix = NONE || test "/usr" != "$prefix") && {
-	test -n "$verbose" && echo "	... testing for lib-directories under /usr"
-	test -d /usr/lib &&          cf_search="$cf_search /usr/lib"
-	test -d /usr/lib/utf8 &&       cf_search="$cf_search /usr/lib/utf8"
-	test -d /usr/lib/utf8/lib &&    cf_search="$cf_search /usr/lib/utf8/lib"
-	test -d /usr/utf8/lib &&       cf_search="$cf_search /usr/utf8/lib"
-	test -d /usr/utf8/lib/utf8 &&    cf_search="$cf_search /usr/utf8/lib/utf8"
-}
-
-test "$prefix" != "NONE" && \
-test -d "$prefix" && \
- {
-	test -n "$verbose" && echo "	... testing for lib-directories under $prefix"
-	test -d $prefix/lib &&          cf_search="$cf_search $prefix/lib"
-	test -d $prefix/lib/utf8 &&       cf_search="$cf_search $prefix/lib/utf8"
-	test -d $prefix/lib/utf8/lib &&    cf_search="$cf_search $prefix/lib/utf8/lib"
-	test -d $prefix/utf8/lib &&       cf_search="$cf_search $prefix/utf8/lib"
-	test -d $prefix/utf8/lib/utf8 &&    cf_search="$cf_search $prefix/utf8/lib/utf8"
-}
-
-test "/usr/local" != "$prefix" && \
-test -d "/usr/local" && \
-(test $prefix = NONE || test "/usr/local" != "$prefix") && {
-	test -n "$verbose" && echo "	... testing for lib-directories under /usr/local"
-	test -d /usr/local/lib &&          cf_search="$cf_search /usr/local/lib"
-	test -d /usr/local/lib/utf8 &&       cf_search="$cf_search /usr/local/lib/utf8"
-	test -d /usr/local/lib/utf8/lib &&    cf_search="$cf_search /usr/local/lib/utf8/lib"
-	test -d /usr/local/utf8/lib &&       cf_search="$cf_search /usr/local/utf8/lib"
-	test -d /usr/local/utf8/lib/utf8 &&    cf_search="$cf_search /usr/local/utf8/lib/utf8"
-}
-
-test "/opt" != "$prefix" && \
-test -d "/opt" && \
-(test $prefix = NONE || test "/opt" != "$prefix") && {
-	test -n "$verbose" && echo "	... testing for lib-directories under /opt"
-	test -d /opt/lib &&          cf_search="$cf_search /opt/lib"
-	test -d /opt/lib/utf8 &&       cf_search="$cf_search /opt/lib/utf8"
-	test -d /opt/lib/utf8/lib &&    cf_search="$cf_search /opt/lib/utf8/lib"
-	test -d /opt/utf8/lib &&       cf_search="$cf_search /opt/utf8/lib"
-	test -d /opt/utf8/lib/utf8 &&    cf_search="$cf_search /opt/utf8/lib/utf8"
-}
-
-test "$HOME" != "$prefix" && \
-test -d "$HOME" && \
-(test $prefix = NONE || test "$HOME" != "$prefix") && {
-	test -n "$verbose" && echo "	... testing for lib-directories under $HOME"
-	test -d $HOME/lib &&          cf_search="$cf_search $HOME/lib"
-	test -d $HOME/lib/utf8 &&       cf_search="$cf_search $HOME/lib/utf8"
-	test -d $HOME/lib/utf8/lib &&    cf_search="$cf_search $HOME/lib/utf8/lib"
-	test -d $HOME/utf8/lib &&       cf_search="$cf_search $HOME/utf8/lib"
-	test -d $HOME/utf8/lib/utf8 &&    cf_search="$cf_search $HOME/utf8/lib/utf8"
-}
-
-cf_search="$cf_library_path_list $cf_search"
-
-        for cf_cv_library_path_utf8 in $cf_search
-        do
-          if test -d $cf_cv_library_path_utf8 ; then
-            test -n "$verbose" && echo "	... testing $cf_cv_library_path_utf8" 1>&6
+if test "$cf_cv_ncurses_header" = none ; then
+	{ { echo "$as_me:7554: error: No curses header-files found" >&5
+echo "$as_me: error: No curses header-files found" >&2;}
+   { (exit 1); exit 1; }; }
+fi
 
-echo "${as_me:-configure}:7621: testing ... testing $cf_cv_library_path_utf8 ..." 1>&5
+# cheat, to get the right #define's for HAVE_NCURSES_H, etc.
 
-            CPPFLAGS="$cf_test_CPPFLAGS"
-            LIBS="-lutf8  $cf_save_LIBS"
-            LDFLAGS="$cf_save_LDFLAGS -L$cf_cv_library_path_utf8"
-            cat >conftest.$ac_ext <<_ACEOF
-#line 7627 "configure"
+for ac_header in $cf_cv_ncurses_header
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+echo "$as_me:7564: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+#line 7570 "configure"
 #include "confdefs.h"
-
-#include <libutf8.h>
-int
-main ()
-{
-putwc(0,0);
-  ;
-  return 0;
-}
+#include <$ac_header>
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:7640: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
-  ac_status=$?
-  echo "$as_me:7643: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:7646: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
+if { (eval echo "$as_me:7574: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
   ac_status=$?
-  echo "$as_me:7649: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-
-                test -n "$verbose" && echo "	... found utf8 library in $cf_cv_library_path_utf8" 1>&6
-
-echo "${as_me:-configure}:7654: testing ... found utf8 library in $cf_cv_library_path_utf8 ..." 1>&5
-
-                cf_cv_find_linkage_utf8=yes
-                cf_cv_library_file_utf8="-lutf8"
-                break
+  egrep -v '^ *\+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:7580: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  eval "$as_ac_Header=yes"
 else
   echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
-
-                CPPFLAGS="$cf_save_CPPFLAGS"
-                LIBS="$cf_save_LIBS"
-                LDFLAGS="$cf_save_LDFLAGS"
+  cat conftest.$ac_ext >&5
+  eval "$as_ac_Header=no"
+fi
+rm -f conftest.err conftest.$ac_ext
+fi
+echo "$as_me:7599: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<EOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+EOF
 
 fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
-          fi
-        done
-        CPPFLAGS="$cf_save_CPPFLAGS"
-        LDFLAGS="$cf_save_LDFLAGS"
-      fi
+done
 
-    else
-      cf_cv_find_linkage_utf8=no
-    fi
+cat >>confdefs.h <<\EOF
+#define NCURSES 1
+EOF
 
-fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+cf_nculib_ROOT=`echo "HAVE_LIB$cf_ncuconfig_root" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
 
-fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+cat >>confdefs.h <<EOF
+#define $cf_nculib_ROOT 1
+EOF
 
-LIBS="$cf_save_LIBS"
+cf_cv_ncurses_version=`$NCURSES_CONFIG --version`
 
-if test "$cf_cv_find_linkage_utf8" = yes ; then
-cf_cv_utf8_lib=add-on
 else
-cf_cv_utf8_lib=no
-fi
 
-fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
-fi
-echo "$as_me:7696: result: $cf_cv_utf8_lib" >&5
-echo "${ECHO_T}$cf_cv_utf8_lib" >&6
+cf_ncuhdr_root=ncursesw
 
-# HAVE_LIBUTF8_H is used by ncurses if curses.h is shared between
-# ncurses/ncursesw:
-if test "$cf_cv_utf8_lib" = "add-on" ; then
-	cat >>confdefs.h <<\EOF
-#define HAVE_LIBUTF8_H 1
-EOF
+test -n "$cf_cv_curses_dir" && \
+test "$cf_cv_curses_dir" != "no" && { \
 
-if test -n "$cf_cv_header_path_utf8" ; then
-  for cf_add_incdir in $cf_cv_header_path_utf8
+if test -n "$cf_cv_curses_dir/include/$cf_ncuhdr_root" ; then
+  for cf_add_incdir in $cf_cv_curses_dir/include/$cf_ncuhdr_root
   do
 	while test $cf_add_incdir != /usr/include
 	do
@@ -7727,7 +7649,7 @@
 			  cf_save_CPPFLAGS=$CPPFLAGS
 			  CPPFLAGS="$CPPFLAGS -I$cf_add_incdir"
 			  cat >conftest.$ac_ext <<_ACEOF
-#line 7730 "configure"
+#line 7652 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 int
@@ -7739,16 +7661,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:7742: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:7664: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:7745: \$? = $ac_status" >&5
+  echo "$as_me:7667: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:7748: \"$ac_try\"") >&5
+  { (eval echo "$as_me:7670: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:7751: \$? = $ac_status" >&5
+  echo "$as_me:7673: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   :
 else
@@ -7765,7 +7687,7 @@
 		if test "$cf_have_incdir" = no ; then
 		  test -n "$verbose" && echo "	adding $cf_add_incdir to include-path" 1>&6
 
-echo "${as_me:-configure}:7768: testing adding $cf_add_incdir to include-path ..." 1>&5
+echo "${as_me:-configure}:7690: testing adding $cf_add_incdir to include-path ..." 1>&5
 
 		  CPPFLAGS="$CPPFLAGS -I$cf_add_incdir"
 
@@ -7780,305 +7702,21 @@
   done
 fi
 
-if test -n "$cf_cv_library_path_utf8" ; then
-  for cf_add_libdir in $cf_cv_library_path_utf8
-  do
-    if test $cf_add_libdir = /usr/lib ; then
-      :
-    elif test -d $cf_add_libdir
-    then
-      cf_have_libdir=no
-      if test -n "$LDFLAGS$LIBS" ; then
-        # a loop is needed to ensure we can add subdirs of existing dirs
-        for cf_test_libdir in $LDFLAGS $LIBS ; do
-          if test ".$cf_test_libdir" = ".-L$cf_add_libdir" ; then
-            cf_have_libdir=yes; break
-          fi
-        done
-      fi
-      if test "$cf_have_libdir" = no ; then
-        test -n "$verbose" && echo "	adding $cf_add_libdir to library-path" 1>&6
+}
 
-echo "${as_me:-configure}:7802: testing adding $cf_add_libdir to library-path ..." 1>&5
+echo "$as_me:7707: checking for $cf_ncuhdr_root header in include-path" >&5
+echo $ECHO_N "checking for $cf_ncuhdr_root header in include-path... $ECHO_C" >&6
+if test "${cf_cv_ncurses_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
 
-        LDFLAGS="-L$cf_add_libdir $LDFLAGS"
-      fi
-    fi
-  done
-fi
-
-	LIBS="$cf_cv_library_file_utf8 $LIBS"
-fi
-
-cf_ncuconfig_root=ncursesw
-
-echo "Looking for ${cf_ncuconfig_root}-config"
-for ac_prog in ${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}5-config
-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 "$as_me:7820: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_path_NCURSES_CONFIG+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  case $NCURSES_CONFIG in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_NCURSES_CONFIG="$NCURSES_CONFIG" # Let the user override the test with a path.
-  ;;
-  *)
-  ac_save_IFS=$IFS; IFS=$ac_path_separator
-ac_dummy="$PATH"
-for ac_dir in $ac_dummy; do
-  IFS=$ac_save_IFS
-  test -z "$ac_dir" && ac_dir=.
-  if $as_executable_p "$ac_dir/$ac_word"; then
-   ac_cv_path_NCURSES_CONFIG="$ac_dir/$ac_word"
-   echo "$as_me:7837: found $ac_dir/$ac_word" >&5
-   break
-fi
-done
-
-  ;;
-esac
-fi
-NCURSES_CONFIG=$ac_cv_path_NCURSES_CONFIG
-
-if test -n "$NCURSES_CONFIG"; then
-  echo "$as_me:7848: result: $NCURSES_CONFIG" >&5
-echo "${ECHO_T}$NCURSES_CONFIG" >&6
-else
-  echo "$as_me:7851: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
-  test -n "$NCURSES_CONFIG" && break
-done
-test -n "$NCURSES_CONFIG" || NCURSES_CONFIG="none"
-
-if test "$NCURSES_CONFIG" != none ; then
-
-CPPFLAGS="$CPPFLAGS `$NCURSES_CONFIG --cflags`"
-LIBS="`$NCURSES_CONFIG --libs` $LIBS"
-
-# even with config script, some packages use no-override for curses.h
-
-echo "$as_me:7866: checking if we have identified curses headers" >&5
-echo $ECHO_N "checking if we have identified curses headers... $ECHO_C" >&6
-if test "${cf_cv_ncurses_header+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-
-cf_cv_ncurses_header=none
-for cf_header in  \
-    ncursesw/curses.h \
-	ncursesw/ncurses.h \
-	curses.h \
-	ncurses.h
-do
-cat >conftest.$ac_ext <<_ACEOF
-#line 7880 "configure"
-#include "confdefs.h"
-#include <${cf_header}>
-int
-main ()
-{
-initscr(); tgoto("?", 0,0)
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:7892: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
-  ac_status=$?
-  echo "$as_me:7895: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:7898: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:7901: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  cf_cv_ncurses_header=$cf_header; break
-else
-  echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
-fi
-rm -f conftest.$ac_objext conftest.$ac_ext
-done
-
-fi
-echo "$as_me:7912: result: $cf_cv_ncurses_header" >&5
-echo "${ECHO_T}$cf_cv_ncurses_header" >&6
-
-if test "$cf_cv_ncurses_header" = none ; then
-	{ { echo "$as_me:7916: error: No curses header-files found" >&5
-echo "$as_me: error: No curses header-files found" >&2;}
-   { (exit 1); exit 1; }; }
-fi
-
-# cheat, to get the right #define's for HAVE_NCURSES_H, etc.
-
-for ac_header in $cf_cv_ncurses_header
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-echo "$as_me:7926: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-#line 7932 "configure"
-#include "confdefs.h"
-#include <$ac_header>
-_ACEOF
-if { (eval echo "$as_me:7936: \"$ac_cpp conftest.$ac_ext\"") >&5
-  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
-  ac_status=$?
-  egrep -v '^ *\+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:7942: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null; then
-  if test -s conftest.err; then
-    ac_cpp_err=$ac_c_preproc_warn_flag
-  else
-    ac_cpp_err=
-  fi
-else
-  ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
-  eval "$as_ac_Header=yes"
-else
-  echo "$as_me: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  eval "$as_ac_Header=no"
-fi
-rm -f conftest.err conftest.$ac_ext
-fi
-echo "$as_me:7961: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  cat >>confdefs.h <<EOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-EOF
-
-fi
-done
-
-cat >>confdefs.h <<\EOF
-#define NCURSES 1
-EOF
-
-cf_nculib_ROOT=`echo "HAVE_LIB$cf_ncuconfig_root" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
-
-cat >>confdefs.h <<EOF
-#define $cf_nculib_ROOT 1
-EOF
-
-cf_cv_ncurses_version=`$NCURSES_CONFIG --version`
-
-else
-
-cf_ncuhdr_root=ncursesw
-
-test -n "$cf_cv_curses_dir" && \
-test "$cf_cv_curses_dir" != "no" && { \
-
-if test -n "$cf_cv_curses_dir/include/$cf_ncuhdr_root" ; then
-  for cf_add_incdir in $cf_cv_curses_dir/include/$cf_ncuhdr_root
-  do
-	while test $cf_add_incdir != /usr/include
-	do
-	  if test -d $cf_add_incdir
-	  then
-		cf_have_incdir=no
-		if test -n "$CFLAGS$CPPFLAGS" ; then
-		  # a loop is needed to ensure we can add subdirs of existing dirs
-		  for cf_test_incdir in $CFLAGS $CPPFLAGS ; do
-			if test ".$cf_test_incdir" = ".-I$cf_add_incdir" ; then
-			  cf_have_incdir=yes; break
-			fi
-		  done
-		fi
-
-		if test "$cf_have_incdir" = no ; then
-		  if test "$cf_add_incdir" = /usr/local/include ; then
-			if test "$GCC" = yes
-			then
-			  cf_save_CPPFLAGS=$CPPFLAGS
-			  CPPFLAGS="$CPPFLAGS -I$cf_add_incdir"
-			  cat >conftest.$ac_ext <<_ACEOF
-#line 8014 "configure"
-#include "confdefs.h"
-#include <stdio.h>
-int
-main ()
-{
-printf("Hello")
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:8026: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
-  ac_status=$?
-  echo "$as_me:8029: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:8032: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:8035: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  :
-else
-  echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
-cf_have_incdir=yes
-fi
-rm -f conftest.$ac_objext conftest.$ac_ext
-			  CPPFLAGS=$cf_save_CPPFLAGS
-			fi
-		  fi
-		fi
-
-		if test "$cf_have_incdir" = no ; then
-		  test -n "$verbose" && echo "	adding $cf_add_incdir to include-path" 1>&6
-
-echo "${as_me:-configure}:8052: testing adding $cf_add_incdir to include-path ..." 1>&5
-
-		  CPPFLAGS="$CPPFLAGS -I$cf_add_incdir"
-
-		  cf_top_incdir=`echo $cf_add_incdir | sed -e 's%/include/.*$%/include%'`
-		  test "$cf_top_incdir" = "$cf_add_incdir" && break
-		  cf_add_incdir="$cf_top_incdir"
-		else
-		  break
-		fi
-	  fi
-	done
-  done
-fi
-
-}
-
-echo "$as_me:8069: checking for $cf_ncuhdr_root header in include-path" >&5
-echo $ECHO_N "checking for $cf_ncuhdr_root header in include-path... $ECHO_C" >&6
-if test "${cf_cv_ncurses_h+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-
-	cf_header_list="$cf_ncuhdr_root/curses.h $cf_ncuhdr_root/ncurses.h"
-	( test "$cf_ncuhdr_root" = ncurses || test "$cf_ncuhdr_root" = ncursesw ) && cf_header_list="$cf_header_list curses.h ncurses.h"
-	for cf_header in $cf_header_list
-	do
+	cf_header_list="$cf_ncuhdr_root/curses.h $cf_ncuhdr_root/ncurses.h"
+	( test "$cf_ncuhdr_root" = ncurses || test "$cf_ncuhdr_root" = ncursesw ) && cf_header_list="$cf_header_list curses.h ncurses.h"
+	for cf_header in $cf_header_list
+	do
 
 	cat >conftest.$ac_ext <<_ACEOF
-#line 8081 "configure"
+#line 7719 "configure"
 #include "confdefs.h"
 
 #define _XOPEN_SOURCE_EXTENDED
@@ -8110,16 +7748,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:8113: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:7751: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:8116: \$? = $ac_status" >&5
+  echo "$as_me:7754: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:8119: \"$ac_try\"") >&5
+  { (eval echo "$as_me:7757: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:8122: \$? = $ac_status" >&5
+  echo "$as_me:7760: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   cf_cv_ncurses_h=$cf_header
 
@@ -8134,14 +7772,14 @@
 	done
 
 fi
-echo "$as_me:8137: result: $cf_cv_ncurses_h" >&5
+echo "$as_me:7775: result: $cf_cv_ncurses_h" >&5
 echo "${ECHO_T}$cf_cv_ncurses_h" >&6
 
 if test "$cf_cv_ncurses_h" != no ; then
 	cf_cv_ncurses_header=$cf_cv_ncurses_h
 else
 
-echo "$as_me:8144: checking for $cf_ncuhdr_root include-path" >&5
+echo "$as_me:7782: checking for $cf_ncuhdr_root include-path" >&5
 echo $ECHO_N "checking for $cf_ncuhdr_root include-path... $ECHO_C" >&6
 if test "${cf_cv_ncurses_h2+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -8281,7 +7919,7 @@
 			  cf_save_CPPFLAGS=$CPPFLAGS
 			  CPPFLAGS="$CPPFLAGS -I$cf_add_incdir"
 			  cat >conftest.$ac_ext <<_ACEOF
-#line 8284 "configure"
+#line 7922 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 int
@@ -8293,16 +7931,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:8296: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:7934: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:8299: \$? = $ac_status" >&5
+  echo "$as_me:7937: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:8302: \"$ac_try\"") >&5
+  { (eval echo "$as_me:7940: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:8305: \$? = $ac_status" >&5
+  echo "$as_me:7943: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   :
 else
@@ -8319,7 +7957,7 @@
 		if test "$cf_have_incdir" = no ; then
 		  test -n "$verbose" && echo "	adding $cf_add_incdir to include-path" 1>&6
 
-echo "${as_me:-configure}:8322: testing adding $cf_add_incdir to include-path ..." 1>&5
+echo "${as_me:-configure}:7960: testing adding $cf_add_incdir to include-path ..." 1>&5
 
 		  CPPFLAGS="$CPPFLAGS -I$cf_add_incdir"
 
@@ -8340,7 +7978,7 @@
 		do
 
 	cat >conftest.$ac_ext <<_ACEOF
-#line 8343 "configure"
+#line 7981 "configure"
 #include "confdefs.h"
 
 #include <$cf_header>
@@ -8364,16 +8002,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:8367: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:8005: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:8370: \$? = $ac_status" >&5
+  echo "$as_me:8008: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:8373: \"$ac_try\"") >&5
+  { (eval echo "$as_me:8011: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:8376: \$? = $ac_status" >&5
+  echo "$as_me:8014: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   cf_cv_ncurses_h2=$cf_header
 
@@ -8394,12 +8032,12 @@
 		CPPFLAGS="$cf_save2_CPPFLAGS"
 		test "$cf_cv_ncurses_h2" != no && break
 	done
-	test "$cf_cv_ncurses_h2" = no && { { echo "$as_me:8397: error: not found" >&5
+	test "$cf_cv_ncurses_h2" = no && { { echo "$as_me:8035: error: not found" >&5
 echo "$as_me: error: not found" >&2;}
    { (exit 1); exit 1; }; }
 
 fi
-echo "$as_me:8402: result: $cf_cv_ncurses_h2" >&5
+echo "$as_me:8040: result: $cf_cv_ncurses_h2" >&5
 echo "${ECHO_T}$cf_cv_ncurses_h2" >&6
 
 	cf_1st_incdir=`echo $cf_cv_ncurses_h2 | sed -e 's%/[^/]*$%%'`
@@ -8432,7 +8070,7 @@
 			  cf_save_CPPFLAGS=$CPPFLAGS
 			  CPPFLAGS="$CPPFLAGS -I$cf_add_incdir"
 			  cat >conftest.$ac_ext <<_ACEOF
-#line 8435 "configure"
+#line 8073 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 int
@@ -8444,16 +8082,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:8447: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:8085: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:8450: \$? = $ac_status" >&5
+  echo "$as_me:8088: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:8453: \"$ac_try\"") >&5
+  { (eval echo "$as_me:8091: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:8456: \$? = $ac_status" >&5
+  echo "$as_me:8094: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   :
 else
@@ -8470,7 +8108,7 @@
 		if test "$cf_have_incdir" = no ; then
 		  test -n "$verbose" && echo "	adding $cf_add_incdir to include-path" 1>&6
 
-echo "${as_me:-configure}:8473: testing adding $cf_add_incdir to include-path ..." 1>&5
+echo "${as_me:-configure}:8111: testing adding $cf_add_incdir to include-path ..." 1>&5
 
 		  CPPFLAGS="$CPPFLAGS -I$cf_add_incdir"
 
@@ -8491,7 +8129,8 @@
 
 case $cf_cv_ncurses_header in # (vi
 *ncurses.h)
-	cat >>confdefs.h <<\EOF
+
+cat >>confdefs.h <<\EOF
 #define HAVE_NCURSES_H 1
 EOF
 
@@ -8500,20 +8139,22 @@
 
 case $cf_cv_ncurses_header in # (vi
 ncurses/curses.h|ncurses/ncurses.h)
-	cat >>confdefs.h <<\EOF
+
+cat >>confdefs.h <<\EOF
 #define HAVE_NCURSES_NCURSES_H 1
 EOF
 
 	;;
 ncursesw/curses.h|ncursesw/ncurses.h)
-	cat >>confdefs.h <<\EOF
+
+cat >>confdefs.h <<\EOF
 #define HAVE_NCURSESW_NCURSES_H 1
 EOF
 
 	;;
 esac
 
-echo "$as_me:8516: checking for terminfo header" >&5
+echo "$as_me:8157: checking for terminfo header" >&5
 echo $ECHO_N "checking for terminfo header... $ECHO_C" >&6
 if test "${cf_cv_term_header+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -8531,7 +8172,7 @@
 for cf_test in $cf_term_header "ncurses/term.h" "ncursesw/term.h"
 do
 cat >conftest.$ac_ext <<_ACEOF
-#line 8534 "configure"
+#line 8175 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 #include <${cf_cv_ncurses_header:-curses.h}>
@@ -8546,16 +8187,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:8549: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:8190: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:8552: \$? = $ac_status" >&5
+  echo "$as_me:8193: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:8555: \"$ac_try\"") >&5
+  { (eval echo "$as_me:8196: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:8558: \$? = $ac_status" >&5
+  echo "$as_me:8199: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
 
 	cf_cv_term_header="$cf_test"
@@ -8571,14 +8212,15 @@
 done
 
 fi
-echo "$as_me:8574: result: $cf_cv_term_header" >&5
+echo "$as_me:8215: result: $cf_cv_term_header" >&5
 echo "${ECHO_T}$cf_cv_term_header" >&6
 
 # Set definitions to allow ifdef'ing to accommodate subdirectories
 
 case $cf_cv_term_header in # (vi
 *term.h)
-	cat >>confdefs.h <<\EOF
+
+cat >>confdefs.h <<\EOF
 #define HAVE_TERM_H 1
 EOF
 
@@ -8587,13 +8229,15 @@
 
 case $cf_cv_term_header in # (vi
 ncurses/term.h) #(vi
-	cat >>confdefs.h <<\EOF
+
+cat >>confdefs.h <<\EOF
 #define HAVE_NCURSES_TERM_H 1
 EOF
 
 	;;
 ncursesw/term.h)
-	cat >>confdefs.h <<\EOF
+
+cat >>confdefs.h <<\EOF
 #define HAVE_NCURSESW_TERM_H 1
 EOF
 
@@ -8601,11 +8245,12 @@
 esac
 
 # some applications need this, but should check for NCURSES_VERSION
+
 cat >>confdefs.h <<\EOF
 #define NCURSES 1
 EOF
 
-echo "$as_me:8608: checking for ncurses version" >&5
+echo "$as_me:8253: checking for ncurses version" >&5
 echo $ECHO_N "checking for ncurses version... $ECHO_C" >&6
 if test "${cf_cv_ncurses_version+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -8631,10 +8276,10 @@
 #endif
 EOF
 	cf_try="$ac_cpp conftest.$ac_ext 2>&5 | grep '^Autoconf ' >conftest.out"
-	{ (eval echo "$as_me:8634: \"$cf_try\"") >&5
+	{ (eval echo "$as_me:8279: \"$cf_try\"") >&5
   (eval $cf_try) 2>&5
   ac_status=$?
-  echo "$as_me:8637: \$? = $ac_status" >&5
+  echo "$as_me:8282: \$? = $ac_status" >&5
   (exit $ac_status); }
 	if test -f conftest.out ; then
 		cf_out=`cat conftest.out | sed -e 's%^Autoconf %%' -e 's%^[^"]*"%%' -e 's%".*%%'`
@@ -8644,7 +8289,7 @@
 
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 8647 "configure"
+#line 8292 "configure"
 #include "confdefs.h"
 
 #include <${cf_cv_ncurses_header:-curses.h}>
@@ -8669,15 +8314,15 @@
 }
 _ACEOF
 rm -f conftest$ac_exeext
-if { (eval echo "$as_me:8672: \"$ac_link\"") >&5
+if { (eval echo "$as_me:8317: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:8675: \$? = $ac_status" >&5
+  echo "$as_me:8320: \$? = $ac_status" >&5
   (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (eval echo "$as_me:8677: \"$ac_try\"") >&5
+  { (eval echo "$as_me:8322: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:8680: \$? = $ac_status" >&5
+  echo "$as_me:8325: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
 
 	cf_cv_ncurses_version=`cat $cf_tempfile`
@@ -8691,9 +8336,10 @@
 	rm -f $cf_tempfile
 
 fi
-echo "$as_me:8694: result: $cf_cv_ncurses_version" >&5
+echo "$as_me:8339: result: $cf_cv_ncurses_version" >&5
 echo "${ECHO_T}$cf_cv_ncurses_version" >&6
-test "$cf_cv_ncurses_version" = no || cat >>confdefs.h <<\EOF
+test "$cf_cv_ncurses_version" = no ||
+cat >>confdefs.h <<\EOF
 #define NCURSES 1
 EOF
 
@@ -8703,7 +8349,7 @@
 	# to link gpm.
 cf_ncurses_LIBS=""
 cf_ncurses_SAVE="$LIBS"
-echo "$as_me:8706: checking for Gpm_Open in -lgpm" >&5
+echo "$as_me:8352: checking for Gpm_Open in -lgpm" >&5
 echo $ECHO_N "checking for Gpm_Open in -lgpm... $ECHO_C" >&6
 if test "${ac_cv_lib_gpm_Gpm_Open+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -8711,7 +8357,7 @@
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lgpm  $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
-#line 8714 "configure"
+#line 8360 "configure"
 #include "confdefs.h"
 
 /* Override any gcc2 internal prototype to avoid an error.  */
@@ -8730,16 +8376,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:8733: \"$ac_link\"") >&5
+if { (eval echo "$as_me:8379: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:8736: \$? = $ac_status" >&5
+  echo "$as_me:8382: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:8739: \"$ac_try\"") >&5
+  { (eval echo "$as_me:8385: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:8742: \$? = $ac_status" >&5
+  echo "$as_me:8388: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_lib_gpm_Gpm_Open=yes
 else
@@ -8750,10 +8396,10 @@
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-echo "$as_me:8753: result: $ac_cv_lib_gpm_Gpm_Open" >&5
+echo "$as_me:8399: result: $ac_cv_lib_gpm_Gpm_Open" >&5
 echo "${ECHO_T}$ac_cv_lib_gpm_Gpm_Open" >&6
 if test $ac_cv_lib_gpm_Gpm_Open = yes; then
-  echo "$as_me:8756: checking for initscr in -lgpm" >&5
+  echo "$as_me:8402: checking for initscr in -lgpm" >&5
 echo $ECHO_N "checking for initscr in -lgpm... $ECHO_C" >&6
 if test "${ac_cv_lib_gpm_initscr+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -8761,7 +8407,7 @@
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lgpm  $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
-#line 8764 "configure"
+#line 8410 "configure"
 #include "confdefs.h"
 
 /* Override any gcc2 internal prototype to avoid an error.  */
@@ -8780,16 +8426,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:8783: \"$ac_link\"") >&5
+if { (eval echo "$as_me:8429: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:8786: \$? = $ac_status" >&5
+  echo "$as_me:8432: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:8789: \"$ac_try\"") >&5
+  { (eval echo "$as_me:8435: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:8792: \$? = $ac_status" >&5
+  echo "$as_me:8438: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_lib_gpm_initscr=yes
 else
@@ -8800,7 +8446,7 @@
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-echo "$as_me:8803: result: $ac_cv_lib_gpm_initscr" >&5
+echo "$as_me:8449: result: $ac_cv_lib_gpm_initscr" >&5
 echo "${ECHO_T}$ac_cv_lib_gpm_initscr" >&6
 if test $ac_cv_lib_gpm_initscr = yes; then
   LIBS="$cf_ncurses_SAVE"
@@ -8815,7 +8461,7 @@
 	# This is only necessary if you are linking against an obsolete
 	# version of ncurses (but it should do no harm, since it's static).
 	if test "$cf_nculib_root" = ncurses ; then
-		echo "$as_me:8818: checking for tgoto in -lmytinfo" >&5
+		echo "$as_me:8464: checking for tgoto in -lmytinfo" >&5
 echo $ECHO_N "checking for tgoto in -lmytinfo... $ECHO_C" >&6
 if test "${ac_cv_lib_mytinfo_tgoto+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -8823,7 +8469,7 @@
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lmytinfo  $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
-#line 8826 "configure"
+#line 8472 "configure"
 #include "confdefs.h"
 
 /* Override any gcc2 internal prototype to avoid an error.  */
@@ -8842,16 +8488,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:8845: \"$ac_link\"") >&5
+if { (eval echo "$as_me:8491: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:8848: \$? = $ac_status" >&5
+  echo "$as_me:8494: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:8851: \"$ac_try\"") >&5
+  { (eval echo "$as_me:8497: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:8854: \$? = $ac_status" >&5
+  echo "$as_me:8500: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_lib_mytinfo_tgoto=yes
 else
@@ -8862,7 +8508,7 @@
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-echo "$as_me:8865: result: $ac_cv_lib_mytinfo_tgoto" >&5
+echo "$as_me:8511: result: $ac_cv_lib_mytinfo_tgoto" >&5
 echo "${ECHO_T}$ac_cv_lib_mytinfo_tgoto" >&6
 if test $ac_cv_lib_mytinfo_tgoto = yes; then
   cf_ncurses_LIBS="-lmytinfo $cf_ncurses_LIBS"
@@ -8881,13 +8527,13 @@
 
 	eval 'cf_cv_have_lib_'$cf_nculib_root'=no'
 	cf_libdir=""
-	echo "$as_me:8884: checking for initscr" >&5
+	echo "$as_me:8530: checking for initscr" >&5
 echo $ECHO_N "checking for initscr... $ECHO_C" >&6
 if test "${ac_cv_func_initscr+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 8890 "configure"
+#line 8536 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char initscr (); below.  */
@@ -8910,7 +8556,7 @@
 #if defined (__stub_initscr) || defined (__stub___initscr)
 choke me
 #else
-f = initscr;
+f = initscr; /* workaround for ICC 12.0.3 */ if (f == 0) return 1;
 #endif
 
   ;
@@ -8918,16 +8564,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:8921: \"$ac_link\"") >&5
+if { (eval echo "$as_me:8567: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:8924: \$? = $ac_status" >&5
+  echo "$as_me:8570: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:8927: \"$ac_try\"") >&5
+  { (eval echo "$as_me:8573: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:8930: \$? = $ac_status" >&5
+  echo "$as_me:8576: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_func_initscr=yes
 else
@@ -8937,18 +8583,18 @@
 fi
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 fi
-echo "$as_me:8940: result: $ac_cv_func_initscr" >&5
+echo "$as_me:8586: result: $ac_cv_func_initscr" >&5
 echo "${ECHO_T}$ac_cv_func_initscr" >&6
 if test $ac_cv_func_initscr = yes; then
   eval 'cf_cv_have_lib_'$cf_nculib_root'=yes'
 else
 
 		cf_save_LIBS="$LIBS"
-		echo "$as_me:8947: checking for initscr in -l$cf_nculib_root" >&5
+		echo "$as_me:8593: checking for initscr in -l$cf_nculib_root" >&5
 echo $ECHO_N "checking for initscr in -l$cf_nculib_root... $ECHO_C" >&6
 		LIBS="-l$cf_nculib_root $LIBS"
 		cat >conftest.$ac_ext <<_ACEOF
-#line 8951 "configure"
+#line 8597 "configure"
 #include "confdefs.h"
 #include <${cf_cv_ncurses_header:-curses.h}>
 int
@@ -8960,25 +8606,25 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:8963: \"$ac_link\"") >&5
+if { (eval echo "$as_me:8609: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:8966: \$? = $ac_status" >&5
+  echo "$as_me:8612: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:8969: \"$ac_try\"") >&5
+  { (eval echo "$as_me:8615: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:8972: \$? = $ac_status" >&5
+  echo "$as_me:8618: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  echo "$as_me:8974: result: yes" >&5
+  echo "$as_me:8620: result: yes" >&5
 echo "${ECHO_T}yes" >&6
 			 eval 'cf_cv_have_lib_'$cf_nculib_root'=yes'
 
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-echo "$as_me:8981: result: no" >&5
+echo "$as_me:8627: result: no" >&5
 echo "${ECHO_T}no" >&6
 
 cf_search=
@@ -9068,11 +8714,11 @@
 
 			for cf_libdir in $cf_search
 			do
-				echo "$as_me:9071: checking for -l$cf_nculib_root in $cf_libdir" >&5
+				echo "$as_me:8717: checking for -l$cf_nculib_root in $cf_libdir" >&5
 echo $ECHO_N "checking for -l$cf_nculib_root in $cf_libdir... $ECHO_C" >&6
 				LIBS="-L$cf_libdir -l$cf_nculib_root $cf_save_LIBS"
 				cat >conftest.$ac_ext <<_ACEOF
-#line 9075 "configure"
+#line 8721 "configure"
 #include "confdefs.h"
 #include <${cf_cv_ncurses_header:-curses.h}>
 int
@@ -9084,25 +8730,25 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:9087: \"$ac_link\"") >&5
+if { (eval echo "$as_me:8733: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:9090: \$? = $ac_status" >&5
+  echo "$as_me:8736: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:9093: \"$ac_try\"") >&5
+  { (eval echo "$as_me:8739: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:9096: \$? = $ac_status" >&5
+  echo "$as_me:8742: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  echo "$as_me:9098: result: yes" >&5
+  echo "$as_me:8744: result: yes" >&5
 echo "${ECHO_T}yes" >&6
 			 		 eval 'cf_cv_have_lib_'$cf_nculib_root'=yes'
 					 break
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-echo "$as_me:9105: result: no" >&5
+echo "$as_me:8751: result: no" >&5
 echo "${ECHO_T}no" >&6
 					 LIBS="$cf_save_LIBS"
 fi
@@ -9117,7 +8763,7 @@
 eval 'cf_found_library=$cf_cv_have_lib_'$cf_nculib_root
 
 if test $cf_found_library = no ; then
-	{ { echo "$as_me:9120: error: Cannot link $cf_nculib_root library" >&5
+	{ { echo "$as_me:8766: error: Cannot link $cf_nculib_root library" >&5
 echo "$as_me: error: Cannot link $cf_nculib_root library" >&2;}
    { (exit 1); exit 1; }; }
 fi
@@ -9125,7 +8771,7 @@
 fi
 
 if test -n "$cf_ncurses_LIBS" ; then
-	echo "$as_me:9128: checking if we can link $cf_nculib_root without $cf_ncurses_LIBS" >&5
+	echo "$as_me:8774: checking if we can link $cf_nculib_root without $cf_ncurses_LIBS" >&5
 echo $ECHO_N "checking if we can link $cf_nculib_root without $cf_ncurses_LIBS... $ECHO_C" >&6
 	cf_ncurses_SAVE="$LIBS"
 	for p in $cf_ncurses_LIBS ; do
@@ -9135,7 +8781,7 @@
 		fi
 	done
 	cat >conftest.$ac_ext <<_ACEOF
-#line 9138 "configure"
+#line 8784 "configure"
 #include "confdefs.h"
 #include <${cf_cv_ncurses_header:-curses.h}>
 int
@@ -9147,23 +8793,23 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:9150: \"$ac_link\"") >&5
+if { (eval echo "$as_me:8796: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:9153: \$? = $ac_status" >&5
+  echo "$as_me:8799: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:9156: \"$ac_try\"") >&5
+  { (eval echo "$as_me:8802: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:9159: \$? = $ac_status" >&5
+  echo "$as_me:8805: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  echo "$as_me:9161: result: yes" >&5
+  echo "$as_me:8807: result: yes" >&5
 echo "${ECHO_T}yes" >&6
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-echo "$as_me:9166: result: no" >&5
+echo "$as_me:8812: result: no" >&5
 echo "${ECHO_T}no" >&6
 		 LIBS="$cf_ncurses_SAVE"
 fi
@@ -9179,153 +8825,8 @@
 fi
 
 	;;
-pdcurses) #(vi
-
-echo "$as_me:9184: checking if you want to use pkg-config" >&5
-echo $ECHO_N "checking if you want to use pkg-config... $ECHO_C" >&6
-
-# Check whether --with-pkg-config or --without-pkg-config was given.
-if test "${with_pkg_config+set}" = set; then
-  withval="$with_pkg_config"
-  cf_pkg_config=$withval
-else
-  cf_pkg_config=yes
-fi;
-echo "$as_me:9194: result: $cf_pkg_config" >&5
-echo "${ECHO_T}$cf_pkg_config" >&6
-
-case $cf_pkg_config in #(vi
-no) #(vi
-	PKG_CONFIG=none
-	;;
-yes) #(vi
-	if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args.
-set dummy ${ac_tool_prefix}pkg-config; ac_word=$2
-echo "$as_me:9205: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_path_PKG_CONFIG+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  case $PKG_CONFIG in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
-  ;;
-  *)
-  ac_save_IFS=$IFS; IFS=$ac_path_separator
-ac_dummy="$PATH"
-for ac_dir in $ac_dummy; do
-  IFS=$ac_save_IFS
-  test -z "$ac_dir" && ac_dir=.
-  if $as_executable_p "$ac_dir/$ac_word"; then
-   ac_cv_path_PKG_CONFIG="$ac_dir/$ac_word"
-   echo "$as_me:9222: found $ac_dir/$ac_word" >&5
-   break
-fi
-done
-
-  ;;
-esac
-fi
-PKG_CONFIG=$ac_cv_path_PKG_CONFIG
-
-if test -n "$PKG_CONFIG"; then
-  echo "$as_me:9233: result: $PKG_CONFIG" >&5
-echo "${ECHO_T}$PKG_CONFIG" >&6
-else
-  echo "$as_me:9236: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
-fi
-if test -z "$ac_cv_path_PKG_CONFIG"; then
-  ac_pt_PKG_CONFIG=$PKG_CONFIG
-  # Extract the first word of "pkg-config", so it can be a program name with args.
-set dummy pkg-config; ac_word=$2
-echo "$as_me:9245: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_path_ac_pt_PKG_CONFIG+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  case $ac_pt_PKG_CONFIG in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path.
-  ;;
-  *)
-  ac_save_IFS=$IFS; IFS=$ac_path_separator
-ac_dummy="$PATH"
-for ac_dir in $ac_dummy; do
-  IFS=$ac_save_IFS
-  test -z "$ac_dir" && ac_dir=.
-  if $as_executable_p "$ac_dir/$ac_word"; then
-   ac_cv_path_ac_pt_PKG_CONFIG="$ac_dir/$ac_word"
-   echo "$as_me:9262: found $ac_dir/$ac_word" >&5
-   break
-fi
-done
-
-  test -z "$ac_cv_path_ac_pt_PKG_CONFIG" && ac_cv_path_ac_pt_PKG_CONFIG="none"
-  ;;
-esac
-fi
-ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG
-
-if test -n "$ac_pt_PKG_CONFIG"; then
-  echo "$as_me:9274: result: $ac_pt_PKG_CONFIG" >&5
-echo "${ECHO_T}$ac_pt_PKG_CONFIG" >&6
-else
-  echo "$as_me:9277: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
-  PKG_CONFIG=$ac_pt_PKG_CONFIG
-else
-  PKG_CONFIG="$ac_cv_path_PKG_CONFIG"
-fi
-
-	;;
-*)
-	PKG_CONFIG=$withval
-	;;
-esac
-
-test -z "$PKG_CONFIG" && PKG_CONFIG=none
-if test "$PKG_CONFIG" != none ; then
-
-if test "x$prefix" != xNONE; then
-  cf_path_syntax="$prefix"
-else
-  cf_path_syntax="$ac_default_prefix"
-fi
-
-case ".$PKG_CONFIG" in #(vi
-.\$\(*\)*|.\'*\'*) #(vi
-  ;;
-..|./*|.\\*) #(vi
-  ;;
-.[a-zA-Z]:[\\/]*) #(vi OS/2 EMX
-  ;;
-.\${*prefix}*) #(vi
-  eval PKG_CONFIG="$PKG_CONFIG"
-  case ".$PKG_CONFIG" in #(vi
-  .NONE/*)
-    PKG_CONFIG=`echo $PKG_CONFIG | sed -e s%NONE%$cf_path_syntax%`
-    ;;
-  esac
-  ;; #(vi
-.no|.NONE/*)
-  PKG_CONFIG=`echo $PKG_CONFIG | sed -e s%NONE%$cf_path_syntax%`
-  ;;
-*)
-  { { echo "$as_me:9320: error: expected a pathname, not \"$PKG_CONFIG\"" >&5
-echo "$as_me: error: expected a pathname, not \"$PKG_CONFIG\"" >&2;}
-   { (exit 1); exit 1; }; }
-  ;;
-esac
-
-fi
-
-echo "$as_me:9328: checking for X" >&5
+pdcurses)
+	echo "$as_me:8829: checking for X" >&5
 echo $ECHO_N "checking for X... $ECHO_C" >&6
 
 # Check whether --with-x or --without-x was given.
@@ -9422,17 +8923,17 @@
   # Guess where to find include files, by looking for Intrinsic.h.
   # First, try using that file with no special directory specified.
   cat >conftest.$ac_ext <<_ACEOF
-#line 9425 "configure"
+#line 8926 "configure"
 #include "confdefs.h"
 #include <X11/Intrinsic.h>
 _ACEOF
-if { (eval echo "$as_me:9429: \"$ac_cpp conftest.$ac_ext\"") >&5
+if { (eval echo "$as_me:8930: \"$ac_cpp conftest.$ac_ext\"") >&5
   (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
   ac_status=$?
   egrep -v '^ *\+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
-  echo "$as_me:9435: \$? = $ac_status" >&5
+  echo "$as_me:8936: \$? = $ac_status" >&5
   (exit $ac_status); } >/dev/null; then
   if test -s conftest.err; then
     ac_cpp_err=$ac_c_preproc_warn_flag
@@ -9465,238 +8966,711 @@
   ac_save_LIBS=$LIBS
   LIBS="-lXt $LIBS"
   cat >conftest.$ac_ext <<_ACEOF
-#line 9468 "configure"
+#line 8969 "configure"
+#include "confdefs.h"
+#include <X11/Intrinsic.h>
+int
+main ()
+{
+XtMalloc (0)
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:8981: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:8984: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:8987: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:8990: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  LIBS=$ac_save_LIBS
+# We can link X programs with no special library path.
+ac_x_libraries=
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+LIBS=$ac_save_LIBS
+for ac_dir in `echo "$ac_x_includes $ac_x_header_dirs" | sed s/include/lib/g`
+do
+  # Don't even attempt the hair of trying to link an X program!
+  for ac_extension in a so sl dylib dll; do
+    if test -r $ac_dir/libXt.$ac_extension; then
+      ac_x_libraries=$ac_dir
+      break 2
+    fi
+  done
+done
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+fi # $ac_x_libraries = no
+
+if test "$ac_x_includes" = no || test "$ac_x_libraries" = no; then
+  # Didn't find X anywhere.  Cache the known absence of X.
+  ac_cv_have_x="have_x=no"
+else
+  # Record where we found X for the cache.
+  ac_cv_have_x="have_x=yes \
+	        ac_x_includes=$ac_x_includes ac_x_libraries=$ac_x_libraries"
+fi
+fi
+
+  fi
+  eval "$ac_cv_have_x"
+fi # $with_x != no
+
+if test "$have_x" != yes; then
+  echo "$as_me:9028: result: $have_x" >&5
+echo "${ECHO_T}$have_x" >&6
+  no_x=yes
+else
+  # If each of the values was on the command line, it overrides each guess.
+  test "x$x_includes" = xNONE && x_includes=$ac_x_includes
+  test "x$x_libraries" = xNONE && x_libraries=$ac_x_libraries
+  # Update the cache value to reflect the command line values.
+  ac_cv_have_x="have_x=yes \
+		ac_x_includes=$x_includes ac_x_libraries=$x_libraries"
+  echo "$as_me:9038: result: libraries $x_libraries, headers $x_includes" >&5
+echo "${ECHO_T}libraries $x_libraries, headers $x_includes" >&6
+fi
+
+if test "$no_x" = yes; then
+  # Not all programs may use this symbol, but it does not hurt to define it.
+
+cat >>confdefs.h <<\EOF
+#define X_DISPLAY_MISSING 1
+EOF
+
+  X_CFLAGS= X_PRE_LIBS= X_LIBS= X_EXTRA_LIBS=
+else
+  if test -n "$x_includes"; then
+    X_CFLAGS="$X_CFLAGS -I$x_includes"
+  fi
+
+  # It would also be nice to do this for all -L options, not just this one.
+  if test -n "$x_libraries"; then
+    X_LIBS="$X_LIBS -L$x_libraries"
+    # For Solaris; some versions of Sun CC require a space after -R and
+    # others require no space.  Words are not sufficient . . . .
+    case `(uname -sr) 2>/dev/null` in
+    "SunOS 5"*)
+      echo "$as_me:9062: checking whether -R must be followed by a space" >&5
+echo $ECHO_N "checking whether -R must be followed by a space... $ECHO_C" >&6
+      ac_xsave_LIBS=$LIBS; LIBS="$LIBS -R$x_libraries"
+      cat >conftest.$ac_ext <<_ACEOF
+#line 9066 "configure"
+#include "confdefs.h"
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:9078: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:9081: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:9084: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:9087: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_R_nospace=yes
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_R_nospace=no
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+      if test $ac_R_nospace = yes; then
+	echo "$as_me:9097: result: no" >&5
+echo "${ECHO_T}no" >&6
+	X_LIBS="$X_LIBS -R$x_libraries"
+      else
+	LIBS="$ac_xsave_LIBS -R $x_libraries"
+	cat >conftest.$ac_ext <<_ACEOF
+#line 9103 "configure"
+#include "confdefs.h"
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:9115: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:9118: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:9121: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:9124: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_R_space=yes
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_R_space=no
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+	if test $ac_R_space = yes; then
+	  echo "$as_me:9134: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+	  X_LIBS="$X_LIBS -R $x_libraries"
+	else
+	  echo "$as_me:9138: result: neither works" >&5
+echo "${ECHO_T}neither works" >&6
+	fi
+      fi
+      LIBS=$ac_xsave_LIBS
+    esac
+  fi
+
+  # Check for system-dependent libraries X programs must link with.
+  # Do this before checking for the system-independent R6 libraries
+  # (-lICE), since we may need -lsocket or whatever for X linking.
+
+  if test "$ISC" = yes; then
+    X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl_s -linet"
+  else
+    # Martyn Johnson says this is needed for Ultrix, if the X
+    # libraries were built with DECnet support.  And Karl Berry says
+    # the Alpha needs dnet_stub (dnet does not exist).
+    ac_xsave_LIBS="$LIBS"; LIBS="$LIBS $X_LIBS -lX11"
+    cat >conftest.$ac_ext <<_ACEOF
+#line 9158 "configure"
+#include "confdefs.h"
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char XOpenDisplay ();
+int
+main ()
+{
+XOpenDisplay ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:9177: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:9180: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:9183: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:9186: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  :
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+echo "$as_me:9192: checking for dnet_ntoa in -ldnet" >&5
+echo $ECHO_N "checking for dnet_ntoa in -ldnet... $ECHO_C" >&6
+if test "${ac_cv_lib_dnet_dnet_ntoa+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldnet  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+#line 9200 "configure"
+#include "confdefs.h"
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char dnet_ntoa ();
+int
+main ()
+{
+dnet_ntoa ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:9219: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:9222: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:9225: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:9228: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_dnet_dnet_ntoa=yes
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_lib_dnet_dnet_ntoa=no
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:9239: result: $ac_cv_lib_dnet_dnet_ntoa" >&5
+echo "${ECHO_T}$ac_cv_lib_dnet_dnet_ntoa" >&6
+if test $ac_cv_lib_dnet_dnet_ntoa = yes; then
+  X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet"
+fi
+
+    if test $ac_cv_lib_dnet_dnet_ntoa = no; then
+      echo "$as_me:9246: checking for dnet_ntoa in -ldnet_stub" >&5
+echo $ECHO_N "checking for dnet_ntoa in -ldnet_stub... $ECHO_C" >&6
+if test "${ac_cv_lib_dnet_stub_dnet_ntoa+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldnet_stub  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+#line 9254 "configure"
+#include "confdefs.h"
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char dnet_ntoa ();
+int
+main ()
+{
+dnet_ntoa ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:9273: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:9276: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:9279: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:9282: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_dnet_stub_dnet_ntoa=yes
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_lib_dnet_stub_dnet_ntoa=no
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:9293: result: $ac_cv_lib_dnet_stub_dnet_ntoa" >&5
+echo "${ECHO_T}$ac_cv_lib_dnet_stub_dnet_ntoa" >&6
+if test $ac_cv_lib_dnet_stub_dnet_ntoa = yes; then
+  X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub"
+fi
+
+    fi
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+    LIBS="$ac_xsave_LIBS"
+
+    # msh@cis.ufl.edu says -lnsl (and -lsocket) are needed for his 386/AT,
+    # to get the SysV transport functions.
+    # Chad R. Larson says the Pyramis MIS-ES running DC/OSx (SVR4)
+    # needs -lnsl.
+    # The nsl library prevents programs from opening the X display
+    # on Irix 5.2, according to T.E. Dickey.
+    # The functions gethostbyname, getservbyname, and inet_addr are
+    # in -lbsd on LynxOS 3.0.1/i386, according to Lars Hecking.
+    echo "$as_me:9312: checking for gethostbyname" >&5
+echo $ECHO_N "checking for gethostbyname... $ECHO_C" >&6
+if test "${ac_cv_func_gethostbyname+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+#line 9318 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char gethostbyname (); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char gethostbyname ();
+char (*f) ();
+
+int
+main ()
+{
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_gethostbyname) || defined (__stub___gethostbyname)
+choke me
+#else
+f = gethostbyname; /* workaround for ICC 12.0.3 */ if (f == 0) return 1;
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:9349: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:9352: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:9355: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:9358: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_func_gethostbyname=yes
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_func_gethostbyname=no
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:9368: result: $ac_cv_func_gethostbyname" >&5
+echo "${ECHO_T}$ac_cv_func_gethostbyname" >&6
+
+    if test $ac_cv_func_gethostbyname = no; then
+      echo "$as_me:9372: checking for gethostbyname in -lnsl" >&5
+echo $ECHO_N "checking for gethostbyname in -lnsl... $ECHO_C" >&6
+if test "${ac_cv_lib_nsl_gethostbyname+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lnsl  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+#line 9380 "configure"
+#include "confdefs.h"
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char gethostbyname ();
+int
+main ()
+{
+gethostbyname ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:9399: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:9402: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:9405: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:9408: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_nsl_gethostbyname=yes
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_lib_nsl_gethostbyname=no
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:9419: result: $ac_cv_lib_nsl_gethostbyname" >&5
+echo "${ECHO_T}$ac_cv_lib_nsl_gethostbyname" >&6
+if test $ac_cv_lib_nsl_gethostbyname = yes; then
+  X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl"
+fi
+
+      if test $ac_cv_lib_nsl_gethostbyname = no; then
+        echo "$as_me:9426: checking for gethostbyname in -lbsd" >&5
+echo $ECHO_N "checking for gethostbyname in -lbsd... $ECHO_C" >&6
+if test "${ac_cv_lib_bsd_gethostbyname+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lbsd  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+#line 9434 "configure"
 #include "confdefs.h"
-#include <X11/Intrinsic.h>
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char gethostbyname ();
 int
 main ()
 {
-XtMalloc (0)
+gethostbyname ();
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:9480: \"$ac_link\"") >&5
+if { (eval echo "$as_me:9453: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:9483: \$? = $ac_status" >&5
+  echo "$as_me:9456: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:9486: \"$ac_try\"") >&5
+  { (eval echo "$as_me:9459: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:9489: \$? = $ac_status" >&5
+  echo "$as_me:9462: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  LIBS=$ac_save_LIBS
-# We can link X programs with no special library path.
-ac_x_libraries=
+  ac_cv_lib_bsd_gethostbyname=yes
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-LIBS=$ac_save_LIBS
-for ac_dir in `echo "$ac_x_includes $ac_x_header_dirs" | sed s/include/lib/g`
-do
-  # Don't even attempt the hair of trying to link an X program!
-  for ac_extension in a so sl dylib dll; do
-    if test -r $ac_dir/libXt.$ac_extension; then
-      ac_x_libraries=$ac_dir
-      break 2
-    fi
-  done
-done
+ac_cv_lib_bsd_gethostbyname=no
 fi
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
-fi # $ac_x_libraries = no
-
-if test "$ac_x_includes" = no || test "$ac_x_libraries" = no; then
-  # Didn't find X anywhere.  Cache the known absence of X.
-  ac_cv_have_x="have_x=no"
-else
-  # Record where we found X for the cache.
-  ac_cv_have_x="have_x=yes \
-	        ac_x_includes=$ac_x_includes ac_x_libraries=$ac_x_libraries"
-fi
+LIBS=$ac_check_lib_save_LIBS
 fi
-
-  fi
-  eval "$ac_cv_have_x"
-fi # $with_x != no
-
-if test "$have_x" != yes; then
-  echo "$as_me:9527: result: $have_x" >&5
-echo "${ECHO_T}$have_x" >&6
-  no_x=yes
-else
-  # If each of the values was on the command line, it overrides each guess.
-  test "x$x_includes" = xNONE && x_includes=$ac_x_includes
-  test "x$x_libraries" = xNONE && x_libraries=$ac_x_libraries
-  # Update the cache value to reflect the command line values.
-  ac_cv_have_x="have_x=yes \
-		ac_x_includes=$x_includes ac_x_libraries=$x_libraries"
-  echo "$as_me:9537: result: libraries $x_libraries, headers $x_includes" >&5
-echo "${ECHO_T}libraries $x_libraries, headers $x_includes" >&6
+echo "$as_me:9473: result: $ac_cv_lib_bsd_gethostbyname" >&5
+echo "${ECHO_T}$ac_cv_lib_bsd_gethostbyname" >&6
+if test $ac_cv_lib_bsd_gethostbyname = yes; then
+  X_EXTRA_LIBS="$X_EXTRA_LIBS -lbsd"
 fi
 
-if test "$no_x" = yes; then
-  # Not all programs may use this symbol, but it does not hurt to define it.
-
-cat >>confdefs.h <<\EOF
-#define X_DISPLAY_MISSING 1
-EOF
+      fi
+    fi
 
-  X_CFLAGS= X_PRE_LIBS= X_LIBS= X_EXTRA_LIBS=
+    # lieder@skyler.mavd.honeywell.com says without -lsocket,
+    # socket/setsockopt and other routines are undefined under SCO ODT
+    # 2.0.  But -lsocket is broken on IRIX 5.2 (and is not necessary
+    # on later versions), says Simon Leinen: it contains gethostby*
+    # variants that don't use the nameserver (or something).  -lsocket
+    # must be given before -lnsl if both are needed.  We assume that
+    # if connect needs -lnsl, so does gethostbyname.
+    echo "$as_me:9489: checking for connect" >&5
+echo $ECHO_N "checking for connect... $ECHO_C" >&6
+if test "${ac_cv_func_connect+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  if test -n "$x_includes"; then
-    X_CFLAGS="$X_CFLAGS -I$x_includes"
-  fi
-
-  # It would also be nice to do this for all -L options, not just this one.
-  if test -n "$x_libraries"; then
-    X_LIBS="$X_LIBS -L$x_libraries"
-    # For Solaris; some versions of Sun CC require a space after -R and
-    # others require no space.  Words are not sufficient . . . .
-    case `(uname -sr) 2>/dev/null` in
-    "SunOS 5"*)
-      echo "$as_me:9561: checking whether -R must be followed by a space" >&5
-echo $ECHO_N "checking whether -R must be followed by a space... $ECHO_C" >&6
-      ac_xsave_LIBS=$LIBS; LIBS="$LIBS -R$x_libraries"
-      cat >conftest.$ac_ext <<_ACEOF
-#line 9565 "configure"
+  cat >conftest.$ac_ext <<_ACEOF
+#line 9495 "configure"
 #include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char connect (); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char connect ();
+char (*f) ();
 
 int
 main ()
 {
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_connect) || defined (__stub___connect)
+choke me
+#else
+f = connect; /* workaround for ICC 12.0.3 */ if (f == 0) return 1;
+#endif
 
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:9577: \"$ac_link\"") >&5
+if { (eval echo "$as_me:9526: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:9580: \$? = $ac_status" >&5
+  echo "$as_me:9529: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:9583: \"$ac_try\"") >&5
+  { (eval echo "$as_me:9532: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:9586: \$? = $ac_status" >&5
+  echo "$as_me:9535: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_R_nospace=yes
+  ac_cv_func_connect=yes
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-ac_R_nospace=no
+ac_cv_func_connect=no
 fi
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
-      if test $ac_R_nospace = yes; then
-	echo "$as_me:9596: result: no" >&5
-echo "${ECHO_T}no" >&6
-	X_LIBS="$X_LIBS -R$x_libraries"
-      else
-	LIBS="$ac_xsave_LIBS -R $x_libraries"
-	cat >conftest.$ac_ext <<_ACEOF
-#line 9602 "configure"
+fi
+echo "$as_me:9545: result: $ac_cv_func_connect" >&5
+echo "${ECHO_T}$ac_cv_func_connect" >&6
+
+    if test $ac_cv_func_connect = no; then
+      echo "$as_me:9549: checking for connect in -lsocket" >&5
+echo $ECHO_N "checking for connect in -lsocket... $ECHO_C" >&6
+if test "${ac_cv_lib_socket_connect+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lsocket $X_EXTRA_LIBS $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+#line 9557 "configure"
 #include "confdefs.h"
 
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char connect ();
 int
 main ()
 {
-
+connect ();
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:9614: \"$ac_link\"") >&5
+if { (eval echo "$as_me:9576: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:9617: \$? = $ac_status" >&5
+  echo "$as_me:9579: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:9620: \"$ac_try\"") >&5
+  { (eval echo "$as_me:9582: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:9623: \$? = $ac_status" >&5
+  echo "$as_me:9585: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_R_space=yes
+  ac_cv_lib_socket_connect=yes
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-ac_R_space=no
+ac_cv_lib_socket_connect=no
 fi
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
-	if test $ac_R_space = yes; then
-	  echo "$as_me:9633: result: yes" >&5
-echo "${ECHO_T}yes" >&6
-	  X_LIBS="$X_LIBS -R $x_libraries"
-	else
-	  echo "$as_me:9637: result: neither works" >&5
-echo "${ECHO_T}neither works" >&6
-	fi
-      fi
-      LIBS=$ac_xsave_LIBS
-    esac
-  fi
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:9596: result: $ac_cv_lib_socket_connect" >&5
+echo "${ECHO_T}$ac_cv_lib_socket_connect" >&6
+if test $ac_cv_lib_socket_connect = yes; then
+  X_EXTRA_LIBS="-lsocket $X_EXTRA_LIBS"
+fi
 
-  # Check for system-dependent libraries X programs must link with.
-  # Do this before checking for the system-independent R6 libraries
-  # (-lICE), since we may need -lsocket or whatever for X linking.
+    fi
 
-  if test "$ISC" = yes; then
-    X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl_s -linet"
-  else
-    # Martyn Johnson says this is needed for Ultrix, if the X
-    # libraries were built with DECnet support.  And Karl Berry says
-    # the Alpha needs dnet_stub (dnet does not exist).
-    ac_xsave_LIBS="$LIBS"; LIBS="$LIBS $X_LIBS -lX11"
-    cat >conftest.$ac_ext <<_ACEOF
-#line 9657 "configure"
+    # Guillermo Gomez says -lposix is necessary on A/UX.
+    echo "$as_me:9605: checking for remove" >&5
+echo $ECHO_N "checking for remove... $ECHO_C" >&6
+if test "${ac_cv_func_remove+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+#line 9611 "configure"
 #include "confdefs.h"
-
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char remove (); below.  */
+#include <assert.h>
 /* Override any gcc2 internal prototype to avoid an error.  */
 #ifdef __cplusplus
 extern "C"
 #endif
 /* We use char because int might match the return type of a gcc2
    builtin and then its argument prototype would still apply.  */
-char XOpenDisplay ();
+char remove ();
+char (*f) ();
+
 int
 main ()
 {
-XOpenDisplay ();
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_remove) || defined (__stub___remove)
+choke me
+#else
+f = remove; /* workaround for ICC 12.0.3 */ if (f == 0) return 1;
+#endif
+
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:9676: \"$ac_link\"") >&5
+if { (eval echo "$as_me:9642: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:9679: \$? = $ac_status" >&5
+  echo "$as_me:9645: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:9682: \"$ac_try\"") >&5
+  { (eval echo "$as_me:9648: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:9685: \$? = $ac_status" >&5
+  echo "$as_me:9651: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  :
+  ac_cv_func_remove=yes
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-echo "$as_me:9691: checking for dnet_ntoa in -ldnet" >&5
-echo $ECHO_N "checking for dnet_ntoa in -ldnet... $ECHO_C" >&6
-if test "${ac_cv_lib_dnet_dnet_ntoa+set}" = set; then
+ac_cv_func_remove=no
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:9661: result: $ac_cv_func_remove" >&5
+echo "${ECHO_T}$ac_cv_func_remove" >&6
+
+    if test $ac_cv_func_remove = no; then
+      echo "$as_me:9665: checking for remove in -lposix" >&5
+echo $ECHO_N "checking for remove in -lposix... $ECHO_C" >&6
+if test "${ac_cv_lib_posix_remove+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-ldnet  $LIBS"
+LIBS="-lposix  $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
-#line 9699 "configure"
+#line 9673 "configure"
 #include "confdefs.h"
 
 /* Override any gcc2 internal prototype to avoid an error.  */
@@ -9705,178 +9679,179 @@
 #endif
 /* We use char because int might match the return type of a gcc2
    builtin and then its argument prototype would still apply.  */
-char dnet_ntoa ();
+char remove ();
 int
 main ()
 {
-dnet_ntoa ();
+remove ();
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:9718: \"$ac_link\"") >&5
+if { (eval echo "$as_me:9692: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:9721: \$? = $ac_status" >&5
+  echo "$as_me:9695: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:9724: \"$ac_try\"") >&5
+  { (eval echo "$as_me:9698: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:9727: \$? = $ac_status" >&5
+  echo "$as_me:9701: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_lib_dnet_dnet_ntoa=yes
+  ac_cv_lib_posix_remove=yes
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-ac_cv_lib_dnet_dnet_ntoa=no
+ac_cv_lib_posix_remove=no
 fi
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-echo "$as_me:9738: result: $ac_cv_lib_dnet_dnet_ntoa" >&5
-echo "${ECHO_T}$ac_cv_lib_dnet_dnet_ntoa" >&6
-if test $ac_cv_lib_dnet_dnet_ntoa = yes; then
-  X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet"
+echo "$as_me:9712: result: $ac_cv_lib_posix_remove" >&5
+echo "${ECHO_T}$ac_cv_lib_posix_remove" >&6
+if test $ac_cv_lib_posix_remove = yes; then
+  X_EXTRA_LIBS="$X_EXTRA_LIBS -lposix"
 fi
 
-    if test $ac_cv_lib_dnet_dnet_ntoa = no; then
-      echo "$as_me:9745: checking for dnet_ntoa in -ldnet_stub" >&5
-echo $ECHO_N "checking for dnet_ntoa in -ldnet_stub... $ECHO_C" >&6
-if test "${ac_cv_lib_dnet_stub_dnet_ntoa+set}" = set; then
+    fi
+
+    # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay.
+    echo "$as_me:9721: checking for shmat" >&5
+echo $ECHO_N "checking for shmat... $ECHO_C" >&6
+if test "${ac_cv_func_shmat+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-ldnet_stub  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-#line 9753 "configure"
+  cat >conftest.$ac_ext <<_ACEOF
+#line 9727 "configure"
 #include "confdefs.h"
-
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char shmat (); below.  */
+#include <assert.h>
 /* Override any gcc2 internal prototype to avoid an error.  */
 #ifdef __cplusplus
 extern "C"
 #endif
 /* We use char because int might match the return type of a gcc2
    builtin and then its argument prototype would still apply.  */
-char dnet_ntoa ();
+char shmat ();
+char (*f) ();
+
 int
 main ()
 {
-dnet_ntoa ();
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_shmat) || defined (__stub___shmat)
+choke me
+#else
+f = shmat; /* workaround for ICC 12.0.3 */ if (f == 0) return 1;
+#endif
+
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:9772: \"$ac_link\"") >&5
+if { (eval echo "$as_me:9758: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:9775: \$? = $ac_status" >&5
+  echo "$as_me:9761: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:9778: \"$ac_try\"") >&5
+  { (eval echo "$as_me:9764: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:9781: \$? = $ac_status" >&5
+  echo "$as_me:9767: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_lib_dnet_stub_dnet_ntoa=yes
+  ac_cv_func_shmat=yes
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-ac_cv_lib_dnet_stub_dnet_ntoa=no
+ac_cv_func_shmat=no
 fi
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-echo "$as_me:9792: result: $ac_cv_lib_dnet_stub_dnet_ntoa" >&5
-echo "${ECHO_T}$ac_cv_lib_dnet_stub_dnet_ntoa" >&6
-if test $ac_cv_lib_dnet_stub_dnet_ntoa = yes; then
-  X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub"
-fi
-
-    fi
 fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
-    LIBS="$ac_xsave_LIBS"
+echo "$as_me:9777: result: $ac_cv_func_shmat" >&5
+echo "${ECHO_T}$ac_cv_func_shmat" >&6
 
-    # msh@cis.ufl.edu says -lnsl (and -lsocket) are needed for his 386/AT,
-    # to get the SysV transport functions.
-    # Chad R. Larson says the Pyramis MIS-ES running DC/OSx (SVR4)
-    # needs -lnsl.
-    # The nsl library prevents programs from opening the X display
-    # on Irix 5.2, according to T.E. Dickey.
-    # The functions gethostbyname, getservbyname, and inet_addr are
-    # in -lbsd on LynxOS 3.0.1/i386, according to Lars Hecking.
-    echo "$as_me:9811: checking for gethostbyname" >&5
-echo $ECHO_N "checking for gethostbyname... $ECHO_C" >&6
-if test "${ac_cv_func_gethostbyname+set}" = set; then
+    if test $ac_cv_func_shmat = no; then
+      echo "$as_me:9781: checking for shmat in -lipc" >&5
+echo $ECHO_N "checking for shmat in -lipc... $ECHO_C" >&6
+if test "${ac_cv_lib_ipc_shmat+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
-#line 9817 "configure"
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lipc  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+#line 9789 "configure"
 #include "confdefs.h"
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char gethostbyname (); below.  */
-#include <assert.h>
+
 /* Override any gcc2 internal prototype to avoid an error.  */
 #ifdef __cplusplus
 extern "C"
 #endif
 /* We use char because int might match the return type of a gcc2
    builtin and then its argument prototype would still apply.  */
-char gethostbyname ();
-char (*f) ();
-
+char shmat ();
 int
 main ()
 {
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined (__stub_gethostbyname) || defined (__stub___gethostbyname)
-choke me
-#else
-f = gethostbyname;
-#endif
-
+shmat ();
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:9848: \"$ac_link\"") >&5
+if { (eval echo "$as_me:9808: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:9851: \$? = $ac_status" >&5
+  echo "$as_me:9811: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:9854: \"$ac_try\"") >&5
+  { (eval echo "$as_me:9814: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:9857: \$? = $ac_status" >&5
+  echo "$as_me:9817: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_func_gethostbyname=yes
+  ac_cv_lib_ipc_shmat=yes
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-ac_cv_func_gethostbyname=no
+ac_cv_lib_ipc_shmat=no
 fi
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:9828: result: $ac_cv_lib_ipc_shmat" >&5
+echo "${ECHO_T}$ac_cv_lib_ipc_shmat" >&6
+if test $ac_cv_lib_ipc_shmat = yes; then
+  X_EXTRA_LIBS="$X_EXTRA_LIBS -lipc"
 fi
-echo "$as_me:9867: result: $ac_cv_func_gethostbyname" >&5
-echo "${ECHO_T}$ac_cv_func_gethostbyname" >&6
 
-    if test $ac_cv_func_gethostbyname = no; then
-      echo "$as_me:9871: checking for gethostbyname in -lnsl" >&5
-echo $ECHO_N "checking for gethostbyname in -lnsl... $ECHO_C" >&6
-if test "${ac_cv_lib_nsl_gethostbyname+set}" = set; then
+    fi
+  fi
+
+  # Check for libraries that X11R6 Xt/Xaw programs need.
+  ac_save_LDFLAGS=$LDFLAGS
+  test -n "$x_libraries" && LDFLAGS="$LDFLAGS -L$x_libraries"
+  # SM needs ICE to (dynamically) link under SunOS 4.x (so we have to
+  # check for ICE first), but we must link in the order -lSM -lICE or
+  # we get undefined symbols.  So assume we have SM if we have ICE.
+  # These have to be linked with before -lX11, unlike the other
+  # libraries we check for below, so use a different variable.
+  # John Interrante, Karl Berry
+  echo "$as_me:9846: checking for IceConnectionNumber in -lICE" >&5
+echo $ECHO_N "checking for IceConnectionNumber in -lICE... $ECHO_C" >&6
+if test "${ac_cv_lib_ICE_IceConnectionNumber+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lnsl  $LIBS"
+LIBS="-lICE $X_EXTRA_LIBS $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
-#line 9879 "configure"
+#line 9854 "configure"
 #include "confdefs.h"
 
 /* Override any gcc2 internal prototype to avoid an error.  */
@@ -9885,291 +9860,502 @@
 #endif
 /* We use char because int might match the return type of a gcc2
    builtin and then its argument prototype would still apply.  */
-char gethostbyname ();
+char IceConnectionNumber ();
 int
 main ()
 {
-gethostbyname ();
+IceConnectionNumber ();
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:9898: \"$ac_link\"") >&5
+if { (eval echo "$as_me:9873: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:9901: \$? = $ac_status" >&5
+  echo "$as_me:9876: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:9904: \"$ac_try\"") >&5
+  { (eval echo "$as_me:9879: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:9907: \$? = $ac_status" >&5
+  echo "$as_me:9882: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_lib_nsl_gethostbyname=yes
+  ac_cv_lib_ICE_IceConnectionNumber=yes
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-ac_cv_lib_nsl_gethostbyname=no
+ac_cv_lib_ICE_IceConnectionNumber=no
 fi
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-echo "$as_me:9918: result: $ac_cv_lib_nsl_gethostbyname" >&5
-echo "${ECHO_T}$ac_cv_lib_nsl_gethostbyname" >&6
-if test $ac_cv_lib_nsl_gethostbyname = yes; then
-  X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl"
+echo "$as_me:9893: result: $ac_cv_lib_ICE_IceConnectionNumber" >&5
+echo "${ECHO_T}$ac_cv_lib_ICE_IceConnectionNumber" >&6
+if test $ac_cv_lib_ICE_IceConnectionNumber = yes; then
+  X_PRE_LIBS="$X_PRE_LIBS -lSM -lICE"
+fi
+
+  LDFLAGS=$ac_save_LDFLAGS
+
+fi
+
+cf_x_athena=${cf_x_athena:-Xaw}
+
+echo "$as_me:9905: checking if you want to link with Xaw 3d library" >&5
+echo $ECHO_N "checking if you want to link with Xaw 3d library... $ECHO_C" >&6
+withval=
+
+# Check whether --with-Xaw3d or --without-Xaw3d was given.
+if test "${with_Xaw3d+set}" = set; then
+  withval="$with_Xaw3d"
+
+fi;
+if test "$withval" = yes ; then
+	cf_x_athena=Xaw3d
+	echo "$as_me:9916: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+else
+	echo "$as_me:9919: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+echo "$as_me:9923: checking if you want to link with neXT Athena library" >&5
+echo $ECHO_N "checking if you want to link with neXT Athena library... $ECHO_C" >&6
+withval=
+
+# Check whether --with-neXtaw or --without-neXtaw was given.
+if test "${with_neXtaw+set}" = set; then
+  withval="$with_neXtaw"
+
+fi;
+if test "$withval" = yes ; then
+	cf_x_athena=neXtaw
+	echo "$as_me:9934: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+else
+	echo "$as_me:9937: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+echo "$as_me:9941: checking if you want to link with Athena-Plus library" >&5
+echo $ECHO_N "checking if you want to link with Athena-Plus library... $ECHO_C" >&6
+withval=
+
+# Check whether --with-XawPlus or --without-XawPlus was given.
+if test "${with_XawPlus+set}" = set; then
+  withval="$with_XawPlus"
+
+fi;
+if test "$withval" = yes ; then
+	cf_x_athena=XawPlus
+	echo "$as_me:9952: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+else
+	echo "$as_me:9955: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+cf_x_athena_lib=""
+
+if test "$PKG_CONFIG" != none ; then
+	cf_athena_list=
+	test "$cf_x_athena" = Xaw && cf_athena_list="xaw8 xaw7 xaw6"
+	for cf_athena_pkg in \
+		$cf_athena_list \
+		${cf_x_athena} \
+		${cf_x_athena}-devel \
+		lib${cf_x_athena} \
+		lib${cf_x_athena}-devel
+	do
+
+if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists $cf_athena_pkg; then
+	test -n "$verbose" && echo "	found package $cf_athena_pkg" 1>&6
+
+echo "${as_me:-configure}:9975: testing found package $cf_athena_pkg ..." 1>&5
+
+	cf_pkgconfig_incs="`$PKG_CONFIG --cflags $cf_athena_pkg 2>/dev/null`"
+	cf_pkgconfig_libs="`$PKG_CONFIG --libs   $cf_athena_pkg 2>/dev/null`"
+	test -n "$verbose" && echo "	package $cf_athena_pkg CFLAGS: $cf_pkgconfig_incs" 1>&6
+
+echo "${as_me:-configure}:9981: testing package $cf_athena_pkg CFLAGS: $cf_pkgconfig_incs ..." 1>&5
+
+	test -n "$verbose" && echo "	package $cf_athena_pkg LIBS: $cf_pkgconfig_libs" 1>&6
+
+echo "${as_me:-configure}:9985: testing package $cf_athena_pkg LIBS: $cf_pkgconfig_libs ..." 1>&5
+
+cf_fix_cppflags=no
+cf_new_cflags=
+cf_new_cppflags=
+cf_new_extra_cppflags=
+
+for cf_add_cflags in $cf_pkgconfig_incs
+do
+case $cf_fix_cppflags in
+no)
+	case $cf_add_cflags in #(vi
+	-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi
+		case $cf_add_cflags in
+		-D*)
+			cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'`
+
+			test "${cf_add_cflags}" != "${cf_tst_cflags}" \
+				&& test -z "${cf_tst_cflags}" \
+				&& cf_fix_cppflags=yes
+
+			if test $cf_fix_cppflags = yes ; then
+				cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
+				continue
+			elif test "${cf_tst_cflags}" = "\"'" ; then
+				cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
+				continue
+			fi
+			;;
+		esac
+		case "$CPPFLAGS" in
+		*$cf_add_cflags) #(vi
+			;;
+		*) #(vi
+			case $cf_add_cflags in #(vi
+			-D*)
+				cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'`
+
+CPPFLAGS=`echo "$CPPFLAGS" | \
+	sed	-e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ 	]*\)\?[ 	]/ /g' \
+		-e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ 	]*\)\?$//g'`
+
+				;;
+			esac
+			cf_new_cppflags="$cf_new_cppflags $cf_add_cflags"
+			;;
+		esac
+		;;
+	*)
+		cf_new_cflags="$cf_new_cflags $cf_add_cflags"
+		;;
+	esac
+	;;
+yes)
+	cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
+
+	cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'`
+
+	test "${cf_add_cflags}" != "${cf_tst_cflags}" \
+		&& test -z "${cf_tst_cflags}" \
+		&& cf_fix_cppflags=no
+	;;
+esac
+done
+
+if test -n "$cf_new_cflags" ; then
+
+	CFLAGS="$CFLAGS $cf_new_cflags"
+fi
+
+if test -n "$cf_new_cppflags" ; then
+
+	CPPFLAGS="$CPPFLAGS $cf_new_cppflags"
+fi
+
+if test -n "$cf_new_extra_cppflags" ; then
+
+	EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS"
 fi
 
-      if test $ac_cv_lib_nsl_gethostbyname = no; then
-        echo "$as_me:9925: checking for gethostbyname in -lbsd" >&5
-echo $ECHO_N "checking for gethostbyname in -lbsd... $ECHO_C" >&6
-if test "${ac_cv_lib_bsd_gethostbyname+set}" = set; then
+	LIBS="$cf_pkgconfig_libs $LIBS"
+
+			cf_x_athena_lib="$cf_pkgconfig_libs"
+
+cf_x_athena_LIBS=`echo "HAVE_LIB_$cf_x_athena" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
+
+			cat >>confdefs.h <<EOF
+#define $cf_x_athena_LIBS 1
+EOF
+
+echo "$as_me:10075: checking for usable $cf_x_athena/Xmu package" >&5
+echo $ECHO_N "checking for usable $cf_x_athena/Xmu package... $ECHO_C" >&6
+if test "${cf_cv_xaw_compat+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lbsd  $LIBS"
+
 cat >conftest.$ac_ext <<_ACEOF
-#line 9933 "configure"
+#line 10082 "configure"
 #include "confdefs.h"
 
-/* Override any gcc2 internal prototype to avoid an error.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
-char gethostbyname ();
+#include <X11/Xmu/CharSet.h>
+
 int
 main ()
 {
-gethostbyname ();
+
+int check = XmuCompareISOLatin1("big", "small")
+
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:9952: \"$ac_link\"") >&5
+if { (eval echo "$as_me:10098: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:9955: \$? = $ac_status" >&5
+  echo "$as_me:10101: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:9958: \"$ac_try\"") >&5
+  { (eval echo "$as_me:10104: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:9961: \$? = $ac_status" >&5
+  echo "$as_me:10107: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_lib_bsd_gethostbyname=yes
+  cf_cv_xaw_compat=yes
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-ac_cv_lib_bsd_gethostbyname=no
+cf_cv_xaw_compat=no
 fi
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
 fi
-echo "$as_me:9972: result: $ac_cv_lib_bsd_gethostbyname" >&5
-echo "${ECHO_T}$ac_cv_lib_bsd_gethostbyname" >&6
-if test $ac_cv_lib_bsd_gethostbyname = yes; then
-  X_EXTRA_LIBS="$X_EXTRA_LIBS -lbsd"
+echo "$as_me:10117: result: $cf_cv_xaw_compat" >&5
+echo "${ECHO_T}$cf_cv_xaw_compat" >&6
+
+			if test "$cf_cv_xaw_compat" = no
+			then
+				# workaround for broken ".pc" files...
+				case "$cf_x_athena_lib" in #(vi
+				*-lXmu*) #(vi
+					;;
+				*)
+					test -n "$verbose" && echo "	work around broken package" 1>&6
+
+echo "${as_me:-configure}:10129: testing work around broken package ..." 1>&5
+
+if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists xmu; then
+	test -n "$verbose" && echo "	found package xmu" 1>&6
+
+echo "${as_me:-configure}:10134: testing found package xmu ..." 1>&5
+
+	cf_pkgconfig_incs="`$PKG_CONFIG --cflags xmu 2>/dev/null`"
+	cf_pkgconfig_libs="`$PKG_CONFIG --libs   xmu 2>/dev/null`"
+	test -n "$verbose" && echo "	package xmu CFLAGS: $cf_pkgconfig_incs" 1>&6
+
+echo "${as_me:-configure}:10140: testing package xmu CFLAGS: $cf_pkgconfig_incs ..." 1>&5
+
+	test -n "$verbose" && echo "	package xmu LIBS: $cf_pkgconfig_libs" 1>&6
+
+echo "${as_me:-configure}:10144: testing package xmu LIBS: $cf_pkgconfig_libs ..." 1>&5
+
+cf_fix_cppflags=no
+cf_new_cflags=
+cf_new_cppflags=
+cf_new_extra_cppflags=
+
+for cf_add_cflags in $cf_pkgconfig_incs
+do
+case $cf_fix_cppflags in
+no)
+	case $cf_add_cflags in #(vi
+	-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi
+		case $cf_add_cflags in
+		-D*)
+			cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'`
+
+			test "${cf_add_cflags}" != "${cf_tst_cflags}" \
+				&& test -z "${cf_tst_cflags}" \
+				&& cf_fix_cppflags=yes
+
+			if test $cf_fix_cppflags = yes ; then
+				cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
+				continue
+			elif test "${cf_tst_cflags}" = "\"'" ; then
+				cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
+				continue
+			fi
+			;;
+		esac
+		case "$CPPFLAGS" in
+		*$cf_add_cflags) #(vi
+			;;
+		*) #(vi
+			case $cf_add_cflags in #(vi
+			-D*)
+				cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'`
+
+CPPFLAGS=`echo "$CPPFLAGS" | \
+	sed	-e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ 	]*\)\?[ 	]/ /g' \
+		-e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ 	]*\)\?$//g'`
+
+				;;
+			esac
+			cf_new_cppflags="$cf_new_cppflags $cf_add_cflags"
+			;;
+		esac
+		;;
+	*)
+		cf_new_cflags="$cf_new_cflags $cf_add_cflags"
+		;;
+	esac
+	;;
+yes)
+	cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
+
+	cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'`
+
+	test "${cf_add_cflags}" != "${cf_tst_cflags}" \
+		&& test -z "${cf_tst_cflags}" \
+		&& cf_fix_cppflags=no
+	;;
+esac
+done
+
+if test -n "$cf_new_cflags" ; then
+
+	CFLAGS="$CFLAGS $cf_new_cflags"
 fi
 
-      fi
-    fi
+if test -n "$cf_new_cppflags" ; then
 
-    # lieder@skyler.mavd.honeywell.com says without -lsocket,
-    # socket/setsockopt and other routines are undefined under SCO ODT
-    # 2.0.  But -lsocket is broken on IRIX 5.2 (and is not necessary
-    # on later versions), says Simon Leinen: it contains gethostby*
-    # variants that don't use the nameserver (or something).  -lsocket
-    # must be given before -lnsl if both are needed.  We assume that
-    # if connect needs -lnsl, so does gethostbyname.
-    echo "$as_me:9988: checking for connect" >&5
-echo $ECHO_N "checking for connect... $ECHO_C" >&6
-if test "${ac_cv_func_connect+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+	CPPFLAGS="$CPPFLAGS $cf_new_cppflags"
+fi
+
+if test -n "$cf_new_extra_cppflags" ; then
+
+	EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS"
+fi
+
+	LIBS="$cf_pkgconfig_libs $LIBS"
+	:
 else
-  cat >conftest.$ac_ext <<_ACEOF
-#line 9994 "configure"
-#include "confdefs.h"
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char connect (); below.  */
-#include <assert.h>
-/* Override any gcc2 internal prototype to avoid an error.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
-char connect ();
-char (*f) ();
 
-int
-main ()
-{
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined (__stub_connect) || defined (__stub___connect)
-choke me
-#else
-f = connect;
-#endif
+test -n "$verbose" && echo "	...before $LIBS" 1>&6
+
+echo "${as_me:-configure}:10230: testing ...before $LIBS ..." 1>&5
+
+LIBS=`echo "$LIBS" | sed -e "s/[ 	][ 	]*/ /g" -e "s,-lXt ,-lXt -lXmu ," -e 's/  / /g'`
+test -n "$verbose" && echo "	...after  $LIBS" 1>&6
+
+echo "${as_me:-configure}:10235: testing ...after  $LIBS ..." 1>&5
+
+fi
+
+					;;
+				esac
+			fi
+
+			break
+else
+	:
+fi
+
+	done
+fi
+
+if test -z "$cf_x_athena_lib" ; then
+
+if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists Xext; then
+	test -n "$verbose" && echo "	found package Xext" 1>&6
+
+echo "${as_me:-configure}:10256: testing found package Xext ..." 1>&5
+
+	cf_pkgconfig_incs="`$PKG_CONFIG --cflags Xext 2>/dev/null`"
+	cf_pkgconfig_libs="`$PKG_CONFIG --libs   Xext 2>/dev/null`"
+	test -n "$verbose" && echo "	package Xext CFLAGS: $cf_pkgconfig_incs" 1>&6
+
+echo "${as_me:-configure}:10262: testing package Xext CFLAGS: $cf_pkgconfig_incs ..." 1>&5
+
+	test -n "$verbose" && echo "	package Xext LIBS: $cf_pkgconfig_libs" 1>&6
+
+echo "${as_me:-configure}:10266: testing package Xext LIBS: $cf_pkgconfig_libs ..." 1>&5
+
+cf_fix_cppflags=no
+cf_new_cflags=
+cf_new_cppflags=
+cf_new_extra_cppflags=
+
+for cf_add_cflags in $cf_pkgconfig_incs
+do
+case $cf_fix_cppflags in
+no)
+	case $cf_add_cflags in #(vi
+	-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi
+		case $cf_add_cflags in
+		-D*)
+			cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'`
+
+			test "${cf_add_cflags}" != "${cf_tst_cflags}" \
+				&& test -z "${cf_tst_cflags}" \
+				&& cf_fix_cppflags=yes
+
+			if test $cf_fix_cppflags = yes ; then
+				cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
+				continue
+			elif test "${cf_tst_cflags}" = "\"'" ; then
+				cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
+				continue
+			fi
+			;;
+		esac
+		case "$CPPFLAGS" in
+		*$cf_add_cflags) #(vi
+			;;
+		*) #(vi
+			case $cf_add_cflags in #(vi
+			-D*)
+				cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'`
+
+CPPFLAGS=`echo "$CPPFLAGS" | \
+	sed	-e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ 	]*\)\?[ 	]/ /g' \
+		-e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ 	]*\)\?$//g'`
+
+				;;
+			esac
+			cf_new_cppflags="$cf_new_cppflags $cf_add_cflags"
+			;;
+		esac
+		;;
+	*)
+		cf_new_cflags="$cf_new_cflags $cf_add_cflags"
+		;;
+	esac
+	;;
+yes)
+	cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
+
+	cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'`
+
+	test "${cf_add_cflags}" != "${cf_tst_cflags}" \
+		&& test -z "${cf_tst_cflags}" \
+		&& cf_fix_cppflags=no
+	;;
+esac
+done
+
+if test -n "$cf_new_cflags" ; then
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:10025: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
-  ac_status=$?
-  echo "$as_me:10028: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:10031: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:10034: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_func_connect=yes
-else
-  echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
-ac_cv_func_connect=no
-fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+	CFLAGS="$CFLAGS $cf_new_cflags"
 fi
-echo "$as_me:10044: result: $ac_cv_func_connect" >&5
-echo "${ECHO_T}$ac_cv_func_connect" >&6
 
-    if test $ac_cv_func_connect = no; then
-      echo "$as_me:10048: checking for connect in -lsocket" >&5
-echo $ECHO_N "checking for connect in -lsocket... $ECHO_C" >&6
-if test "${ac_cv_lib_socket_connect+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lsocket $X_EXTRA_LIBS $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-#line 10056 "configure"
-#include "confdefs.h"
+if test -n "$cf_new_cppflags" ; then
 
-/* Override any gcc2 internal prototype to avoid an error.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
-char connect ();
-int
-main ()
-{
-connect ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:10075: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
-  ac_status=$?
-  echo "$as_me:10078: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:10081: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:10084: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_lib_socket_connect=yes
-else
-  echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
-ac_cv_lib_socket_connect=no
-fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-echo "$as_me:10095: result: $ac_cv_lib_socket_connect" >&5
-echo "${ECHO_T}$ac_cv_lib_socket_connect" >&6
-if test $ac_cv_lib_socket_connect = yes; then
-  X_EXTRA_LIBS="-lsocket $X_EXTRA_LIBS"
+	CPPFLAGS="$CPPFLAGS $cf_new_cppflags"
 fi
 
-    fi
-
-    # Guillermo Gomez says -lposix is necessary on A/UX.
-    echo "$as_me:10104: checking for remove" >&5
-echo $ECHO_N "checking for remove... $ECHO_C" >&6
-if test "${ac_cv_func_remove+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-#line 10110 "configure"
-#include "confdefs.h"
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char remove (); below.  */
-#include <assert.h>
-/* Override any gcc2 internal prototype to avoid an error.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
-char remove ();
-char (*f) ();
+if test -n "$cf_new_extra_cppflags" ; then
 
-int
-main ()
-{
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined (__stub_remove) || defined (__stub___remove)
-choke me
-#else
-f = remove;
-#endif
+	EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS"
+fi
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:10141: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
-  ac_status=$?
-  echo "$as_me:10144: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:10147: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:10150: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_func_remove=yes
+	LIBS="$cf_pkgconfig_libs $LIBS"
+	:
 else
-  echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
-ac_cv_func_remove=no
-fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
-fi
-echo "$as_me:10160: result: $ac_cv_func_remove" >&5
-echo "${ECHO_T}$ac_cv_func_remove" >&6
 
-    if test $ac_cv_func_remove = no; then
-      echo "$as_me:10164: checking for remove in -lposix" >&5
-echo $ECHO_N "checking for remove in -lposix... $ECHO_C" >&6
-if test "${ac_cv_lib_posix_remove+set}" = set; then
+	echo "$as_me:10350: checking for XextCreateExtension in -lXext" >&5
+echo $ECHO_N "checking for XextCreateExtension in -lXext... $ECHO_C" >&6
+if test "${ac_cv_lib_Xext_XextCreateExtension+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lposix  $LIBS"
+LIBS="-lXext  $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
-#line 10172 "configure"
+#line 10358 "configure"
 #include "confdefs.h"
 
 /* Override any gcc2 internal prototype to avoid an error.  */
@@ -10178,310 +10364,384 @@
 #endif
 /* We use char because int might match the return type of a gcc2
    builtin and then its argument prototype would still apply.  */
-char remove ();
+char XextCreateExtension ();
 int
 main ()
 {
-remove ();
+XextCreateExtension ();
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:10191: \"$ac_link\"") >&5
+if { (eval echo "$as_me:10377: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:10194: \$? = $ac_status" >&5
+  echo "$as_me:10380: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:10197: \"$ac_try\"") >&5
+  { (eval echo "$as_me:10383: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:10200: \$? = $ac_status" >&5
+  echo "$as_me:10386: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_lib_posix_remove=yes
+  ac_cv_lib_Xext_XextCreateExtension=yes
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-ac_cv_lib_posix_remove=no
+ac_cv_lib_Xext_XextCreateExtension=no
 fi
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-echo "$as_me:10211: result: $ac_cv_lib_posix_remove" >&5
-echo "${ECHO_T}$ac_cv_lib_posix_remove" >&6
-if test $ac_cv_lib_posix_remove = yes; then
-  X_EXTRA_LIBS="$X_EXTRA_LIBS -lposix"
+echo "$as_me:10397: result: $ac_cv_lib_Xext_XextCreateExtension" >&5
+echo "${ECHO_T}$ac_cv_lib_Xext_XextCreateExtension" >&6
+if test $ac_cv_lib_Xext_XextCreateExtension = yes; then
+  LIBS="-lXext $LIBS"
 fi
 
-    fi
+fi
 
-    # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay.
-    echo "$as_me:10220: checking for shmat" >&5
-echo $ECHO_N "checking for shmat... $ECHO_C" >&6
-if test "${ac_cv_func_shmat+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-#line 10226 "configure"
-#include "confdefs.h"
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char shmat (); below.  */
-#include <assert.h>
-/* Override any gcc2 internal prototype to avoid an error.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
-char shmat ();
-char (*f) ();
+cf_have_X_LIBS=no
 
-int
-main ()
-{
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined (__stub_shmat) || defined (__stub___shmat)
-choke me
-#else
-f = shmat;
-#endif
+if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists xt; then
+	test -n "$verbose" && echo "	found package xt" 1>&6
+
+echo "${as_me:-configure}:10410: testing found package xt ..." 1>&5
+
+	cf_pkgconfig_incs="`$PKG_CONFIG --cflags xt 2>/dev/null`"
+	cf_pkgconfig_libs="`$PKG_CONFIG --libs   xt 2>/dev/null`"
+	test -n "$verbose" && echo "	package xt CFLAGS: $cf_pkgconfig_incs" 1>&6
+
+echo "${as_me:-configure}:10416: testing package xt CFLAGS: $cf_pkgconfig_incs ..." 1>&5
+
+	test -n "$verbose" && echo "	package xt LIBS: $cf_pkgconfig_libs" 1>&6
+
+echo "${as_me:-configure}:10420: testing package xt LIBS: $cf_pkgconfig_libs ..." 1>&5
+
+cf_fix_cppflags=no
+cf_new_cflags=
+cf_new_cppflags=
+cf_new_extra_cppflags=
+
+for cf_add_cflags in $cf_pkgconfig_incs
+do
+case $cf_fix_cppflags in
+no)
+	case $cf_add_cflags in #(vi
+	-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi
+		case $cf_add_cflags in
+		-D*)
+			cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'`
+
+			test "${cf_add_cflags}" != "${cf_tst_cflags}" \
+				&& test -z "${cf_tst_cflags}" \
+				&& cf_fix_cppflags=yes
+
+			if test $cf_fix_cppflags = yes ; then
+				cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
+				continue
+			elif test "${cf_tst_cflags}" = "\"'" ; then
+				cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
+				continue
+			fi
+			;;
+		esac
+		case "$CPPFLAGS" in
+		*$cf_add_cflags) #(vi
+			;;
+		*) #(vi
+			case $cf_add_cflags in #(vi
+			-D*)
+				cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'`
+
+CPPFLAGS=`echo "$CPPFLAGS" | \
+	sed	-e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ 	]*\)\?[ 	]/ /g' \
+		-e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ 	]*\)\?$//g'`
+
+				;;
+			esac
+			cf_new_cppflags="$cf_new_cppflags $cf_add_cflags"
+			;;
+		esac
+		;;
+	*)
+		cf_new_cflags="$cf_new_cflags $cf_add_cflags"
+		;;
+	esac
+	;;
+yes)
+	cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
+
+	cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'`
+
+	test "${cf_add_cflags}" != "${cf_tst_cflags}" \
+		&& test -z "${cf_tst_cflags}" \
+		&& cf_fix_cppflags=no
+	;;
+esac
+done
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:10257: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
-  ac_status=$?
-  echo "$as_me:10260: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:10263: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:10266: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_func_shmat=yes
-else
-  echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
-ac_cv_func_shmat=no
-fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+if test -n "$cf_new_cflags" ; then
+
+	CFLAGS="$CFLAGS $cf_new_cflags"
 fi
-echo "$as_me:10276: result: $ac_cv_func_shmat" >&5
-echo "${ECHO_T}$ac_cv_func_shmat" >&6
 
-    if test $ac_cv_func_shmat = no; then
-      echo "$as_me:10280: checking for shmat in -lipc" >&5
-echo $ECHO_N "checking for shmat in -lipc... $ECHO_C" >&6
-if test "${ac_cv_lib_ipc_shmat+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lipc  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-#line 10288 "configure"
-#include "confdefs.h"
+if test -n "$cf_new_cppflags" ; then
 
-/* Override any gcc2 internal prototype to avoid an error.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
-char shmat ();
-int
-main ()
-{
-shmat ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:10307: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
-  ac_status=$?
-  echo "$as_me:10310: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:10313: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:10316: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_lib_ipc_shmat=yes
-else
-  echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
-ac_cv_lib_ipc_shmat=no
-fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
+	CPPFLAGS="$CPPFLAGS $cf_new_cppflags"
 fi
-echo "$as_me:10327: result: $ac_cv_lib_ipc_shmat" >&5
-echo "${ECHO_T}$ac_cv_lib_ipc_shmat" >&6
-if test $ac_cv_lib_ipc_shmat = yes; then
-  X_EXTRA_LIBS="$X_EXTRA_LIBS -lipc"
+
+if test -n "$cf_new_extra_cppflags" ; then
+
+	EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS"
 fi
 
-    fi
-  fi
+	LIBS="$cf_pkgconfig_libs $LIBS"
 
-  # Check for libraries that X11R6 Xt/Xaw programs need.
-  ac_save_LDFLAGS=$LDFLAGS
-  test -n "$x_libraries" && LDFLAGS="$LDFLAGS -L$x_libraries"
-  # SM needs ICE to (dynamically) link under SunOS 4.x (so we have to
-  # check for ICE first), but we must link in the order -lSM -lICE or
-  # we get undefined symbols.  So assume we have SM if we have ICE.
-  # These have to be linked with before -lX11, unlike the other
-  # libraries we check for below, so use a different variable.
-  # John Interrante, Karl Berry
-  echo "$as_me:10345: checking for IceConnectionNumber in -lICE" >&5
-echo $ECHO_N "checking for IceConnectionNumber in -lICE... $ECHO_C" >&6
-if test "${ac_cv_lib_ICE_IceConnectionNumber+set}" = set; then
+	case "x$LIBS" in #(vi
+	*-lX11*) #(vi
+		;;
+	*)
+# we have an "xt" package, but it may omit Xt's dependency on X11
+echo "$as_me:10507: checking for usable X dependency" >&5
+echo $ECHO_N "checking for usable X dependency... $ECHO_C" >&6
+if test "${cf_cv_xt_x11_compat+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lICE $X_EXTRA_LIBS $LIBS"
+
 cat >conftest.$ac_ext <<_ACEOF
-#line 10353 "configure"
+#line 10514 "configure"
 #include "confdefs.h"
 
-/* Override any gcc2 internal prototype to avoid an error.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
-char IceConnectionNumber ();
+#include <X11/Xlib.h>
+
 int
 main ()
 {
-IceConnectionNumber ();
+
+	int rc1 = XDrawLine((Display*) 0, (Drawable) 0, (GC) 0, 0, 0, 0, 0);
+	int rc2 = XClearWindow((Display*) 0, (Window) 0);
+	int rc3 = XMoveWindow((Display*) 0, (Window) 0, 0, 0);
+	int rc4 = XMoveResizeWindow((Display*)0, (Window)0, 0, 0, 0, 0);
+
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:10372: \"$ac_link\"") >&5
+if { (eval echo "$as_me:10533: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:10375: \$? = $ac_status" >&5
+  echo "$as_me:10536: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:10378: \"$ac_try\"") >&5
+  { (eval echo "$as_me:10539: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:10381: \$? = $ac_status" >&5
+  echo "$as_me:10542: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_lib_ICE_IceConnectionNumber=yes
+  cf_cv_xt_x11_compat=yes
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-ac_cv_lib_ICE_IceConnectionNumber=no
+cf_cv_xt_x11_compat=no
 fi
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-echo "$as_me:10392: result: $ac_cv_lib_ICE_IceConnectionNumber" >&5
-echo "${ECHO_T}$ac_cv_lib_ICE_IceConnectionNumber" >&6
-if test $ac_cv_lib_ICE_IceConnectionNumber = yes; then
-  X_PRE_LIBS="$X_PRE_LIBS -lSM -lICE"
 fi
+echo "$as_me:10552: result: $cf_cv_xt_x11_compat" >&5
+echo "${ECHO_T}$cf_cv_xt_x11_compat" >&6
+		if test "$cf_cv_xt_x11_compat" = no
+		then
+			test -n "$verbose" && echo "	work around broken X11 dependency" 1>&6
 
-  LDFLAGS=$ac_save_LDFLAGS
+echo "${as_me:-configure}:10558: testing work around broken X11 dependency ..." 1>&5
 
-fi
+			# 2010/11/19 - good enough until a working Xt on Xcb is delivered.
 
-cf_x_athena=${cf_x_athena:-Xaw}
+if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists x11; then
+	test -n "$verbose" && echo "	found package x11" 1>&6
 
-echo "$as_me:10404: checking if you want to link with Xaw 3d library" >&5
-echo $ECHO_N "checking if you want to link with Xaw 3d library... $ECHO_C" >&6
-withval=
+echo "${as_me:-configure}:10565: testing found package x11 ..." 1>&5
 
-# Check whether --with-Xaw3d or --without-Xaw3d was given.
-if test "${with_Xaw3d+set}" = set; then
-  withval="$with_Xaw3d"
+	cf_pkgconfig_incs="`$PKG_CONFIG --cflags x11 2>/dev/null`"
+	cf_pkgconfig_libs="`$PKG_CONFIG --libs   x11 2>/dev/null`"
+	test -n "$verbose" && echo "	package x11 CFLAGS: $cf_pkgconfig_incs" 1>&6
 
-fi;
-if test "$withval" = yes ; then
-	cf_x_athena=Xaw3d
-	echo "$as_me:10415: result: yes" >&5
-echo "${ECHO_T}yes" >&6
-else
-	echo "$as_me:10418: result: no" >&5
-echo "${ECHO_T}no" >&6
+echo "${as_me:-configure}:10571: testing package x11 CFLAGS: $cf_pkgconfig_incs ..." 1>&5
+
+	test -n "$verbose" && echo "	package x11 LIBS: $cf_pkgconfig_libs" 1>&6
+
+echo "${as_me:-configure}:10575: testing package x11 LIBS: $cf_pkgconfig_libs ..." 1>&5
+
+cf_fix_cppflags=no
+cf_new_cflags=
+cf_new_cppflags=
+cf_new_extra_cppflags=
+
+for cf_add_cflags in $cf_pkgconfig_incs
+do
+case $cf_fix_cppflags in
+no)
+	case $cf_add_cflags in #(vi
+	-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi
+		case $cf_add_cflags in
+		-D*)
+			cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'`
+
+			test "${cf_add_cflags}" != "${cf_tst_cflags}" \
+				&& test -z "${cf_tst_cflags}" \
+				&& cf_fix_cppflags=yes
+
+			if test $cf_fix_cppflags = yes ; then
+				cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
+				continue
+			elif test "${cf_tst_cflags}" = "\"'" ; then
+				cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
+				continue
+			fi
+			;;
+		esac
+		case "$CPPFLAGS" in
+		*$cf_add_cflags) #(vi
+			;;
+		*) #(vi
+			case $cf_add_cflags in #(vi
+			-D*)
+				cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'`
+
+CPPFLAGS=`echo "$CPPFLAGS" | \
+	sed	-e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ 	]*\)\?[ 	]/ /g' \
+		-e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ 	]*\)\?$//g'`
+
+				;;
+			esac
+			cf_new_cppflags="$cf_new_cppflags $cf_add_cflags"
+			;;
+		esac
+		;;
+	*)
+		cf_new_cflags="$cf_new_cflags $cf_add_cflags"
+		;;
+	esac
+	;;
+yes)
+	cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
+
+	cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'`
+
+	test "${cf_add_cflags}" != "${cf_tst_cflags}" \
+		&& test -z "${cf_tst_cflags}" \
+		&& cf_fix_cppflags=no
+	;;
+esac
+done
+
+if test -n "$cf_new_cflags" ; then
+
+	CFLAGS="$CFLAGS $cf_new_cflags"
 fi
 
-echo "$as_me:10422: checking if you want to link with neXT Athena library" >&5
-echo $ECHO_N "checking if you want to link with neXT Athena library... $ECHO_C" >&6
-withval=
+if test -n "$cf_new_cppflags" ; then
 
-# Check whether --with-neXtaw or --without-neXtaw was given.
-if test "${with_neXtaw+set}" = set; then
-  withval="$with_neXtaw"
+	CPPFLAGS="$CPPFLAGS $cf_new_cppflags"
+fi
 
-fi;
-if test "$withval" = yes ; then
-	cf_x_athena=neXtaw
-	echo "$as_me:10433: result: yes" >&5
-echo "${ECHO_T}yes" >&6
+if test -n "$cf_new_extra_cppflags" ; then
+
+	EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS"
+fi
+
+	LIBS="$cf_pkgconfig_libs $LIBS"
+	:
 else
-	echo "$as_me:10436: result: no" >&5
-echo "${ECHO_T}no" >&6
+
+test -n "$verbose" && echo "	...before $LIBS" 1>&6
+
+echo "${as_me:-configure}:10661: testing ...before $LIBS ..." 1>&5
+
+LIBS=`echo "$LIBS" | sed -e "s/[ 	][ 	]*/ /g" -e "s,-lXt ,-lXt -lX11 ," -e 's/  / /g'`
+test -n "$verbose" && echo "	...after  $LIBS" 1>&6
+
+echo "${as_me:-configure}:10666: testing ...after  $LIBS ..." 1>&5
+
 fi
 
-echo "$as_me:10440: checking if you want to link with Athena-Plus library" >&5
-echo $ECHO_N "checking if you want to link with Athena-Plus library... $ECHO_C" >&6
-withval=
+		fi
+		;;
+	esac
+
+echo "$as_me:10674: checking for usable X Toolkit package" >&5
+echo $ECHO_N "checking for usable X Toolkit package... $ECHO_C" >&6
+if test "${cf_cv_xt_ice_compat+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+cat >conftest.$ac_ext <<_ACEOF
+#line 10681 "configure"
+#include "confdefs.h"
 
-# Check whether --with-XawPlus or --without-XawPlus was given.
-if test "${with_XawPlus+set}" = set; then
-  withval="$with_XawPlus"
+#include <X11/Shell.h>
 
-fi;
-if test "$withval" = yes ; then
-	cf_x_athena=XawPlus
-	echo "$as_me:10451: result: yes" >&5
-echo "${ECHO_T}yes" >&6
+int
+main ()
+{
+int num = IceConnectionNumber(0)
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:10696: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:10699: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:10702: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:10705: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  cf_cv_xt_ice_compat=yes
 else
-	echo "$as_me:10454: result: no" >&5
-echo "${ECHO_T}no" >&6
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+cf_cv_xt_ice_compat=no
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 fi
+echo "$as_me:10715: result: $cf_cv_xt_ice_compat" >&5
+echo "${ECHO_T}$cf_cv_xt_ice_compat" >&6
 
-cf_x_athena_lib=""
+	if test "$cf_cv_xt_ice_compat" = no
+	then
+		# workaround for broken ".pc" files used for X Toolkit.
+		case "x$X_PRE_LIBS" in #(vi
+		*-lICE*)
+			case "x$LIBS" in #(vi
+			*-lICE*) #(vi
+				;;
+			*)
+				test -n "$verbose" && echo "	work around broken ICE dependency" 1>&6
 
-if test "$PKG_CONFIG" != none ; then
-	cf_athena_list=
-	test "$cf_x_athena" = Xaw && cf_athena_list="xaw8 xaw7 xaw6"
-	for cf_athena_pkg in \
-		$cf_athena_list \
-		${cf_x_athena} \
-		${cf_x_athena}-devel \
-		lib${cf_x_athena} \
-		lib${cf_x_athena}-devel
-	do
+echo "${as_me:-configure}:10729: testing work around broken ICE dependency ..." 1>&5
 
-if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists $cf_athena_pkg; then
-	test -n "$verbose" && echo "	found package $cf_athena_pkg" 1>&6
+if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists ice; then
+	test -n "$verbose" && echo "	found package ice" 1>&6
 
-echo "${as_me:-configure}:10474: testing found package $cf_athena_pkg ..." 1>&5
+echo "${as_me:-configure}:10734: testing found package ice ..." 1>&5
 
-	cf_pkgconfig_incs="`$PKG_CONFIG --cflags $cf_athena_pkg 2>/dev/null`"
-	cf_pkgconfig_libs="`$PKG_CONFIG --libs   $cf_athena_pkg 2>/dev/null`"
-	test -n "$verbose" && echo "	package $cf_athena_pkg CFLAGS: $cf_pkgconfig_incs" 1>&6
+	cf_pkgconfig_incs="`$PKG_CONFIG --cflags ice 2>/dev/null`"
+	cf_pkgconfig_libs="`$PKG_CONFIG --libs   ice 2>/dev/null`"
+	test -n "$verbose" && echo "	package ice CFLAGS: $cf_pkgconfig_incs" 1>&6
 
-echo "${as_me:-configure}:10480: testing package $cf_athena_pkg CFLAGS: $cf_pkgconfig_incs ..." 1>&5
+echo "${as_me:-configure}:10740: testing package ice CFLAGS: $cf_pkgconfig_incs ..." 1>&5
 
-	test -n "$verbose" && echo "	package $cf_athena_pkg LIBS: $cf_pkgconfig_libs" 1>&6
+	test -n "$verbose" && echo "	package ice LIBS: $cf_pkgconfig_libs" 1>&6
 
-echo "${as_me:-configure}:10484: testing package $cf_athena_pkg LIBS: $cf_pkgconfig_libs ..." 1>&5
+echo "${as_me:-configure}:10744: testing package ice LIBS: $cf_pkgconfig_libs ..." 1>&5
 
 cf_fix_cppflags=no
 cf_new_cflags=
@@ -10563,84 +10823,20 @@
 
 	LIBS="$cf_pkgconfig_libs $LIBS"
 
-			cf_x_athena_lib="$cf_pkgconfig_libs"
-
-cf_x_athena_LIBS=`echo "HAVE_LIB_$cf_x_athena" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
-
-			cat >>confdefs.h <<EOF
-#define $cf_x_athena_LIBS 1
-EOF
-
-echo "$as_me:10574: checking for usable $cf_x_athena/Xmu package" >&5
-echo $ECHO_N "checking for usable $cf_x_athena/Xmu package... $ECHO_C" >&6
-if test "${cf_cv_xaw_compat+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-
-cat >conftest.$ac_ext <<_ACEOF
-#line 10581 "configure"
-#include "confdefs.h"
-
-#include <X11/Xmu/CharSet.h>
-
-int
-main ()
-{
-
-int check = XmuCompareISOLatin1("big", "small")
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:10597: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
-  ac_status=$?
-  echo "$as_me:10600: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:10603: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:10606: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  cf_cv_xaw_compat=yes
-else
-  echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
-cf_cv_xaw_compat=no
-fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
-fi
-echo "$as_me:10616: result: $cf_cv_xaw_compat" >&5
-echo "${ECHO_T}$cf_cv_xaw_compat" >&6
-
-			if test "$cf_cv_xaw_compat" = no
-			then
-				# workaround for broken ".pc" files...
-				case "$cf_x_athena_lib" in #(vi
-				*-lXmu*) #(vi
-					;;
-				*)
-					test -n "$verbose" && echo "	work around broken package" 1>&6
-
-echo "${as_me:-configure}:10628: testing work around broken package ..." 1>&5
-
-if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists xmu; then
-	test -n "$verbose" && echo "	found package xmu" 1>&6
+if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists sm; then
+	test -n "$verbose" && echo "	found package sm" 1>&6
 
-echo "${as_me:-configure}:10633: testing found package xmu ..." 1>&5
+echo "${as_me:-configure}:10829: testing found package sm ..." 1>&5
 
-	cf_pkgconfig_incs="`$PKG_CONFIG --cflags xmu 2>/dev/null`"
-	cf_pkgconfig_libs="`$PKG_CONFIG --libs   xmu 2>/dev/null`"
-	test -n "$verbose" && echo "	package xmu CFLAGS: $cf_pkgconfig_incs" 1>&6
+	cf_pkgconfig_incs="`$PKG_CONFIG --cflags sm 2>/dev/null`"
+	cf_pkgconfig_libs="`$PKG_CONFIG --libs   sm 2>/dev/null`"
+	test -n "$verbose" && echo "	package sm CFLAGS: $cf_pkgconfig_incs" 1>&6
 
-echo "${as_me:-configure}:10639: testing package xmu CFLAGS: $cf_pkgconfig_incs ..." 1>&5
+echo "${as_me:-configure}:10835: testing package sm CFLAGS: $cf_pkgconfig_incs ..." 1>&5
 
-	test -n "$verbose" && echo "	package xmu LIBS: $cf_pkgconfig_libs" 1>&6
+	test -n "$verbose" && echo "	package sm LIBS: $cf_pkgconfig_libs" 1>&6
 
-echo "${as_me:-configure}:10643: testing package xmu LIBS: $cf_pkgconfig_libs ..." 1>&5
+echo "${as_me:-configure}:10839: testing package sm LIBS: $cf_pkgconfig_libs ..." 1>&5
 
 cf_fix_cppflags=no
 cf_new_cflags=
@@ -10723,53 +10919,47 @@
 	LIBS="$cf_pkgconfig_libs $LIBS"
 	:
 else
+	:
+fi
+
+else
 
 test -n "$verbose" && echo "	...before $LIBS" 1>&6
 
-echo "${as_me:-configure}:10729: testing ...before $LIBS ..." 1>&5
+echo "${as_me:-configure}:10929: testing ...before $LIBS ..." 1>&5
 
-LIBS=`echo "$LIBS" | sed -e "s/[ 	][ 	]*/ /g" -e "s,-lXt ,-lXt -lXmu ," -e 's/  / /g'`
+LIBS=`echo "$LIBS" | sed -e "s/[ 	][ 	]*/ /g" -e "s,-lXt ,-lXt $X_PRE_LIBS ," -e 's/  / /g'`
 test -n "$verbose" && echo "	...after  $LIBS" 1>&6
 
-echo "${as_me:-configure}:10734: testing ...after  $LIBS ..." 1>&5
-
-fi
-
-					;;
-				esac
-			fi
-
-			break
-else
-	:
-fi
+echo "${as_me:-configure}:10934: testing ...after  $LIBS ..." 1>&5
 
-	done
 fi
 
-if test -z "$cf_x_athena_lib" ; then
+				;;
+			esac
+			;;
+		esac
+	fi
 
-if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists Xext; then
-	test -n "$verbose" && echo "	found package Xext" 1>&6
+	cf_have_X_LIBS=yes
 
-echo "${as_me:-configure}:10755: testing found package Xext ..." 1>&5
+else
 
-	cf_pkgconfig_incs="`$PKG_CONFIG --cflags Xext 2>/dev/null`"
-	cf_pkgconfig_libs="`$PKG_CONFIG --libs   Xext 2>/dev/null`"
-	test -n "$verbose" && echo "	package Xext CFLAGS: $cf_pkgconfig_incs" 1>&6
+	LDFLAGS="$X_LIBS $LDFLAGS"
 
-echo "${as_me:-configure}:10761: testing package Xext CFLAGS: $cf_pkgconfig_incs ..." 1>&5
+test -n "$verbose" && echo "	checking additions to CFLAGS" 1>&6
 
-	test -n "$verbose" && echo "	package Xext LIBS: $cf_pkgconfig_libs" 1>&6
+echo "${as_me:-configure}:10952: testing checking additions to CFLAGS ..." 1>&5
 
-echo "${as_me:-configure}:10765: testing package Xext LIBS: $cf_pkgconfig_libs ..." 1>&5
+cf_check_cflags="$CFLAGS"
+cf_check_cppflags="$CPPFLAGS"
 
 cf_fix_cppflags=no
 cf_new_cflags=
 cf_new_cppflags=
 cf_new_extra_cppflags=
 
-for cf_add_cflags in $cf_pkgconfig_incs
+for cf_add_cflags in $X_CFLAGS
 do
 case $cf_fix_cppflags in
 no)
@@ -10828,33 +11018,144 @@
 done
 
 if test -n "$cf_new_cflags" ; then
+	test -n "$verbose" && echo "	add to \$CFLAGS $cf_new_cflags" 1>&6
+
+echo "${as_me:-configure}:11023: testing add to \$CFLAGS $cf_new_cflags ..." 1>&5
 
 	CFLAGS="$CFLAGS $cf_new_cflags"
 fi
 
 if test -n "$cf_new_cppflags" ; then
+	test -n "$verbose" && echo "	add to \$CPPFLAGS $cf_new_cppflags" 1>&6
+
+echo "${as_me:-configure}:11031: testing add to \$CPPFLAGS $cf_new_cppflags ..." 1>&5
+
+	CPPFLAGS="$CPPFLAGS $cf_new_cppflags"
+fi
+
+if test -n "$cf_new_extra_cppflags" ; then
+	test -n "$verbose" && echo "	add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags" 1>&6
+
+echo "${as_me:-configure}:11039: testing add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags ..." 1>&5
+
+	EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS"
+fi
+
+if test "$cf_check_cflags" != "$CFLAGS" ; then
+cat >conftest.$ac_ext <<_ACEOF
+#line 11046 "configure"
+#include "confdefs.h"
+#include <stdio.h>
+int
+main ()
+{
+printf("Hello world");
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:11058: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:11061: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:11064: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:11067: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  :
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+test -n "$verbose" && echo "	test-compile failed.  Undoing change to \$CFLAGS" 1>&6
+
+echo "${as_me:-configure}:11075: testing test-compile failed.  Undoing change to \$CFLAGS ..." 1>&5
+
+	 if test "$cf_check_cppflags" != "$CPPFLAGS" ; then
+		 test -n "$verbose" && echo "	but keeping change to \$CPPFLAGS" 1>&6
+
+echo "${as_me:-configure}:11080: testing but keeping change to \$CPPFLAGS ..." 1>&5
+
+	 fi
+	 CFLAGS="$cf_check_flags"
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+fi
+
+	echo "$as_me:11088: checking for XOpenDisplay" >&5
+echo $ECHO_N "checking for XOpenDisplay... $ECHO_C" >&6
+if test "${ac_cv_func_XOpenDisplay+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+#line 11094 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char XOpenDisplay (); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char XOpenDisplay ();
+char (*f) ();
+
+int
+main ()
+{
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_XOpenDisplay) || defined (__stub___XOpenDisplay)
+choke me
+#else
+f = XOpenDisplay; /* workaround for ICC 12.0.3 */ if (f == 0) return 1;
+#endif
 
-	CPPFLAGS="$CPPFLAGS $cf_new_cppflags"
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:11125: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:11128: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:11131: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:11134: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_func_XOpenDisplay=yes
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_func_XOpenDisplay=no
 fi
-
-if test -n "$cf_new_extra_cppflags" ; then
-
-	EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS"
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 fi
-
-	LIBS="$cf_pkgconfig_libs $LIBS"
-	:
+echo "$as_me:11144: result: $ac_cv_func_XOpenDisplay" >&5
+echo "${ECHO_T}$ac_cv_func_XOpenDisplay" >&6
+if test $ac_cv_func_XOpenDisplay = yes; then
+  :
 else
 
-	echo "$as_me:10849: checking for XextCreateExtension in -lXext" >&5
-echo $ECHO_N "checking for XextCreateExtension in -lXext... $ECHO_C" >&6
-if test "${ac_cv_lib_Xext_XextCreateExtension+set}" = set; then
+	echo "$as_me:11150: checking for XOpenDisplay in -lX11" >&5
+echo $ECHO_N "checking for XOpenDisplay in -lX11... $ECHO_C" >&6
+if test "${ac_cv_lib_X11_XOpenDisplay+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lXext  $LIBS"
+LIBS="-lX11 $X_PRE_LIBS $LIBS $X_EXTRA_LIBS $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
-#line 10857 "configure"
+#line 11158 "configure"
 #include "confdefs.h"
 
 /* Override any gcc2 internal prototype to avoid an error.  */
@@ -10863,486 +11164,447 @@
 #endif
 /* We use char because int might match the return type of a gcc2
    builtin and then its argument prototype would still apply.  */
-char XextCreateExtension ();
+char XOpenDisplay ();
 int
 main ()
 {
-XextCreateExtension ();
+XOpenDisplay ();
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:10876: \"$ac_link\"") >&5
+if { (eval echo "$as_me:11177: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:10879: \$? = $ac_status" >&5
+  echo "$as_me:11180: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:10882: \"$ac_try\"") >&5
+  { (eval echo "$as_me:11183: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:10885: \$? = $ac_status" >&5
+  echo "$as_me:11186: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_lib_Xext_XextCreateExtension=yes
+  ac_cv_lib_X11_XOpenDisplay=yes
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-ac_cv_lib_Xext_XextCreateExtension=no
+ac_cv_lib_X11_XOpenDisplay=no
 fi
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-echo "$as_me:10896: result: $ac_cv_lib_Xext_XextCreateExtension" >&5
-echo "${ECHO_T}$ac_cv_lib_Xext_XextCreateExtension" >&6
-if test $ac_cv_lib_Xext_XextCreateExtension = yes; then
-  LIBS="-lXext $LIBS"
+echo "$as_me:11197: result: $ac_cv_lib_X11_XOpenDisplay" >&5
+echo "${ECHO_T}$ac_cv_lib_X11_XOpenDisplay" >&6
+if test $ac_cv_lib_X11_XOpenDisplay = yes; then
+  LIBS="-lX11 $LIBS"
 fi
 
 fi
 
-cf_have_X_LIBS=no
-
-if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists xt; then
-	test -n "$verbose" && echo "	found package xt" 1>&6
-
-echo "${as_me:-configure}:10909: testing found package xt ..." 1>&5
-
-	cf_pkgconfig_incs="`$PKG_CONFIG --cflags xt 2>/dev/null`"
-	cf_pkgconfig_libs="`$PKG_CONFIG --libs   xt 2>/dev/null`"
-	test -n "$verbose" && echo "	package xt CFLAGS: $cf_pkgconfig_incs" 1>&6
-
-echo "${as_me:-configure}:10915: testing package xt CFLAGS: $cf_pkgconfig_incs ..." 1>&5
-
-	test -n "$verbose" && echo "	package xt LIBS: $cf_pkgconfig_libs" 1>&6
-
-echo "${as_me:-configure}:10919: testing package xt LIBS: $cf_pkgconfig_libs ..." 1>&5
-
-cf_fix_cppflags=no
-cf_new_cflags=
-cf_new_cppflags=
-cf_new_extra_cppflags=
-
-for cf_add_cflags in $cf_pkgconfig_incs
-do
-case $cf_fix_cppflags in
-no)
-	case $cf_add_cflags in #(vi
-	-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi
-		case $cf_add_cflags in
-		-D*)
-			cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'`
-
-			test "${cf_add_cflags}" != "${cf_tst_cflags}" \
-				&& test -z "${cf_tst_cflags}" \
-				&& cf_fix_cppflags=yes
-
-			if test $cf_fix_cppflags = yes ; then
-				cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
-				continue
-			elif test "${cf_tst_cflags}" = "\"'" ; then
-				cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
-				continue
-			fi
-			;;
-		esac
-		case "$CPPFLAGS" in
-		*$cf_add_cflags) #(vi
-			;;
-		*) #(vi
-			case $cf_add_cflags in #(vi
-			-D*)
-				cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'`
-
-CPPFLAGS=`echo "$CPPFLAGS" | \
-	sed	-e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ 	]*\)\?[ 	]/ /g' \
-		-e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ 	]*\)\?$//g'`
-
-				;;
-			esac
-			cf_new_cppflags="$cf_new_cppflags $cf_add_cflags"
-			;;
-		esac
-		;;
-	*)
-		cf_new_cflags="$cf_new_cflags $cf_add_cflags"
-		;;
-	esac
-	;;
-yes)
-	cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
+	echo "$as_me:11205: checking for XtAppInitialize" >&5
+echo $ECHO_N "checking for XtAppInitialize... $ECHO_C" >&6
+if test "${ac_cv_func_XtAppInitialize+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+#line 11211 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char XtAppInitialize (); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char XtAppInitialize ();
+char (*f) ();
 
-	cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'`
+int
+main ()
+{
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_XtAppInitialize) || defined (__stub___XtAppInitialize)
+choke me
+#else
+f = XtAppInitialize; /* workaround for ICC 12.0.3 */ if (f == 0) return 1;
+#endif
 
-	test "${cf_add_cflags}" != "${cf_tst_cflags}" \
-		&& test -z "${cf_tst_cflags}" \
-		&& cf_fix_cppflags=no
-	;;
-esac
-done
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:11242: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:11245: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:11248: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:11251: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_func_XtAppInitialize=yes
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_func_XtAppInitialize=no
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:11261: result: $ac_cv_func_XtAppInitialize" >&5
+echo "${ECHO_T}$ac_cv_func_XtAppInitialize" >&6
+if test $ac_cv_func_XtAppInitialize = yes; then
+  :
+else
 
-if test -n "$cf_new_cflags" ; then
+	echo "$as_me:11267: checking for XtAppInitialize in -lXt" >&5
+echo $ECHO_N "checking for XtAppInitialize in -lXt... $ECHO_C" >&6
+if test "${ac_cv_lib_Xt_XtAppInitialize+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lXt $X_PRE_LIBS $LIBS $X_EXTRA_LIBS $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+#line 11275 "configure"
+#include "confdefs.h"
 
-	CFLAGS="$CFLAGS $cf_new_cflags"
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char XtAppInitialize ();
+int
+main ()
+{
+XtAppInitialize ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:11294: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:11297: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:11300: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:11303: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_Xt_XtAppInitialize=yes
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_lib_Xt_XtAppInitialize=no
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
 fi
+echo "$as_me:11314: result: $ac_cv_lib_Xt_XtAppInitialize" >&5
+echo "${ECHO_T}$ac_cv_lib_Xt_XtAppInitialize" >&6
+if test $ac_cv_lib_Xt_XtAppInitialize = yes; then
 
-if test -n "$cf_new_cppflags" ; then
+cat >>confdefs.h <<\EOF
+#define HAVE_LIBXT 1
+EOF
 
-	CPPFLAGS="$CPPFLAGS $cf_new_cppflags"
+		 cf_have_X_LIBS=Xt
+		 LIBS="-lXt $X_PRE_LIBS $LIBS $X_EXTRA_LIBS"
 fi
 
-if test -n "$cf_new_extra_cppflags" ; then
+fi
 
-	EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS"
 fi
 
-	LIBS="$cf_pkgconfig_libs $LIBS"
+if test $cf_have_X_LIBS = no ; then
+	{ echo "$as_me:11331: WARNING: Unable to successfully link X Toolkit library (-lXt) with
+test program.  You will have to check and add the proper libraries by hand
+to makefile." >&5
+echo "$as_me: WARNING: Unable to successfully link X Toolkit library (-lXt) with
+test program.  You will have to check and add the proper libraries by hand
+to makefile." >&2;}
+fi
 
-	case "x$LIBS" in #(vi
-	*-lX11*) #(vi
-		;;
-	*)
-# we have an "xt" package, but it may omit Xt's dependency on X11
-echo "$as_me:11006: checking for usable X dependency" >&5
-echo $ECHO_N "checking for usable X dependency... $ECHO_C" >&6
-if test "${cf_cv_xt_x11_compat+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
+cf_x_athena_root=$cf_x_athena
+cf_x_athena_inc=""
 
-cat >conftest.$ac_ext <<_ACEOF
-#line 11013 "configure"
+for cf_path in default \
+	/usr/contrib/X11R6 \
+	/usr/contrib/X11R5 \
+	/usr/lib/X11R5 \
+	/usr/local
+do
+	if test -z "$cf_x_athena_inc" ; then
+		cf_save="$CPPFLAGS"
+		cf_test=X11/$cf_x_athena_root/SimpleMenu.h
+		if test $cf_path != default ; then
+			CPPFLAGS="$cf_save -I$cf_path/include"
+			echo "$as_me:11353: checking for $cf_test in $cf_path" >&5
+echo $ECHO_N "checking for $cf_test in $cf_path... $ECHO_C" >&6
+		else
+			echo "$as_me:11356: checking for $cf_test" >&5
+echo $ECHO_N "checking for $cf_test... $ECHO_C" >&6
+		fi
+		cat >conftest.$ac_ext <<_ACEOF
+#line 11360 "configure"
 #include "confdefs.h"
 
-#include <X11/Xlib.h>
-
+#include <X11/Intrinsic.h>
+#include <$cf_test>
 int
 main ()
 {
 
-	int rc1 = XDrawLine((Display*) 0, (Drawable) 0, (GC) 0, 0, 0, 0, 0);
-	int rc2 = XClearWindow((Display*) 0, (Window) 0);
-	int rc3 = XMoveWindow((Display*) 0, (Window) 0, 0, 0);
-	int rc4 = XMoveResizeWindow((Display*)0, (Window)0, 0, 0, 0, 0);
-
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:11032: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:11374: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:11035: \$? = $ac_status" >&5
+  echo "$as_me:11377: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:11038: \"$ac_try\"") >&5
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:11380: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:11041: \$? = $ac_status" >&5
+  echo "$as_me:11383: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  cf_cv_xt_x11_compat=yes
+  cf_result=yes
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-cf_cv_xt_x11_compat=no
-fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+cf_result=no
 fi
-echo "$as_me:11051: result: $cf_cv_xt_x11_compat" >&5
-echo "${ECHO_T}$cf_cv_xt_x11_compat" >&6
-		if test "$cf_cv_xt_x11_compat" = no
-		then
-			test -n "$verbose" && echo "	work around broken X11 dependency" 1>&6
-
-echo "${as_me:-configure}:11057: testing work around broken X11 dependency ..." 1>&5
-
-			# 2010/11/19 - good enough until a working Xt on Xcb is delivered.
-
-if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists x11; then
-	test -n "$verbose" && echo "	found package x11" 1>&6
-
-echo "${as_me:-configure}:11064: testing found package x11 ..." 1>&5
-
-	cf_pkgconfig_incs="`$PKG_CONFIG --cflags x11 2>/dev/null`"
-	cf_pkgconfig_libs="`$PKG_CONFIG --libs   x11 2>/dev/null`"
-	test -n "$verbose" && echo "	package x11 CFLAGS: $cf_pkgconfig_incs" 1>&6
-
-echo "${as_me:-configure}:11070: testing package x11 CFLAGS: $cf_pkgconfig_incs ..." 1>&5
-
-	test -n "$verbose" && echo "	package x11 LIBS: $cf_pkgconfig_libs" 1>&6
-
-echo "${as_me:-configure}:11074: testing package x11 LIBS: $cf_pkgconfig_libs ..." 1>&5
-
-cf_fix_cppflags=no
-cf_new_cflags=
-cf_new_cppflags=
-cf_new_extra_cppflags=
-
-for cf_add_cflags in $cf_pkgconfig_incs
-do
-case $cf_fix_cppflags in
-no)
-	case $cf_add_cflags in #(vi
-	-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi
-		case $cf_add_cflags in
-		-D*)
-			cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'`
-
-			test "${cf_add_cflags}" != "${cf_tst_cflags}" \
-				&& test -z "${cf_tst_cflags}" \
-				&& cf_fix_cppflags=yes
-
-			if test $cf_fix_cppflags = yes ; then
-				cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
-				continue
-			elif test "${cf_tst_cflags}" = "\"'" ; then
-				cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
-				continue
-			fi
-			;;
-		esac
-		case "$CPPFLAGS" in
-		*$cf_add_cflags) #(vi
-			;;
-		*) #(vi
-			case $cf_add_cflags in #(vi
-			-D*)
-				cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'`
-
-CPPFLAGS=`echo "$CPPFLAGS" | \
-	sed	-e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ 	]*\)\?[ 	]/ /g' \
-		-e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ 	]*\)\?$//g'`
-
-				;;
-			esac
-			cf_new_cppflags="$cf_new_cppflags $cf_add_cflags"
-			;;
-		esac
-		;;
-	*)
-		cf_new_cflags="$cf_new_cflags $cf_add_cflags"
-		;;
-	esac
-	;;
-yes)
-	cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
-
-	cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'`
-
-	test "${cf_add_cflags}" != "${cf_tst_cflags}" \
-		&& test -z "${cf_tst_cflags}" \
-		&& cf_fix_cppflags=no
-	;;
-esac
+rm -f conftest.$ac_objext conftest.$ac_ext
+		echo "$as_me:11392: result: $cf_result" >&5
+echo "${ECHO_T}$cf_result" >&6
+		if test "$cf_result" = yes ; then
+			cf_x_athena_inc=$cf_path
+			break
+		else
+			CPPFLAGS="$cf_save"
+		fi
+	fi
 done
 
-if test -n "$cf_new_cflags" ; then
-
-	CFLAGS="$CFLAGS $cf_new_cflags"
-fi
-
-if test -n "$cf_new_cppflags" ; then
-
-	CPPFLAGS="$CPPFLAGS $cf_new_cppflags"
-fi
-
-if test -n "$cf_new_extra_cppflags" ; then
-
-	EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS"
-fi
-
-	LIBS="$cf_pkgconfig_libs $LIBS"
-	:
-else
-
-test -n "$verbose" && echo "	...before $LIBS" 1>&6
-
-echo "${as_me:-configure}:11160: testing ...before $LIBS ..." 1>&5
-
-LIBS=`echo "$LIBS" | sed -e "s/[ 	][ 	]*/ /g" -e "s,-lXt ,-lXt -lX11 ," -e 's/  / /g'`
-test -n "$verbose" && echo "	...after  $LIBS" 1>&6
-
-echo "${as_me:-configure}:11165: testing ...after  $LIBS ..." 1>&5
-
+if test -z "$cf_x_athena_inc" ; then
+	{ echo "$as_me:11404: WARNING: Unable to successfully find Athena header files with test program" >&5
+echo "$as_me: WARNING: Unable to successfully find Athena header files with test program" >&2;}
+elif test "$cf_x_athena_inc" != default ; then
+	CPPFLAGS="$CPPFLAGS -I$cf_x_athena_inc"
 fi
 
-		fi
-		;;
-	esac
-
-echo "$as_me:11173: checking for usable X Toolkit package" >&5
-echo $ECHO_N "checking for usable X Toolkit package... $ECHO_C" >&6
-if test "${cf_cv_xt_ice_compat+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
+cf_x_athena_root=$cf_x_athena
+cf_x_athena_lib=""
 
-cat >conftest.$ac_ext <<_ACEOF
-#line 11180 "configure"
+for cf_path in default \
+	/usr/contrib/X11R6 \
+	/usr/contrib/X11R5 \
+	/usr/lib/X11R5 \
+	/usr/local
+do
+	for cf_lib in \
+		${cf_x_athena_root} \
+		${cf_x_athena_root}7 \
+		${cf_x_athena_root}6
+	do
+	for cf_libs in \
+		"-l$cf_lib -lXmu" \
+		"-l$cf_lib -lXpm -lXmu" \
+		"-l${cf_lib}_s -lXmu_s"
+	do
+		if test -z "$cf_x_athena_lib" ; then
+			cf_save="$LIBS"
+			cf_test=XawSimpleMenuAddGlobalActions
+			if test $cf_path != default ; then
+				LIBS="-L$cf_path/lib $cf_libs $LIBS"
+				echo "$as_me:11434: checking for $cf_libs in $cf_path" >&5
+echo $ECHO_N "checking for $cf_libs in $cf_path... $ECHO_C" >&6
+			else
+				LIBS="$cf_libs $LIBS"
+				echo "$as_me:11438: checking for $cf_test in $cf_libs" >&5
+echo $ECHO_N "checking for $cf_test in $cf_libs... $ECHO_C" >&6
+			fi
+			cat >conftest.$ac_ext <<_ACEOF
+#line 11442 "configure"
 #include "confdefs.h"
 
-#include <X11/Shell.h>
+#include <X11/Intrinsic.h>
+#include <X11/$cf_x_athena_root/SimpleMenu.h>
 
 int
 main ()
 {
-int num = IceConnectionNumber(0)
 
+$cf_test((XtAppContext) 0)
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:11195: \"$ac_link\"") >&5
+if { (eval echo "$as_me:11458: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:11198: \$? = $ac_status" >&5
+  echo "$as_me:11461: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:11201: \"$ac_try\"") >&5
+  { (eval echo "$as_me:11464: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:11204: \$? = $ac_status" >&5
+  echo "$as_me:11467: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  cf_cv_xt_ice_compat=yes
+  cf_result=yes
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-cf_cv_xt_ice_compat=no
+cf_result=no
 fi
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
-fi
-echo "$as_me:11214: result: $cf_cv_xt_ice_compat" >&5
-echo "${ECHO_T}$cf_cv_xt_ice_compat" >&6
-
-	if test "$cf_cv_xt_ice_compat" = no
-	then
-		# workaround for broken ".pc" files used for X Toolkit.
-		case "x$X_PRE_LIBS" in #(vi
-		*-lICE*)
-			case "x$LIBS" in #(vi
-			*-lICE*) #(vi
-				;;
-			*)
-				test -n "$verbose" && echo "	work around broken ICE dependency" 1>&6
-
-echo "${as_me:-configure}:11228: testing work around broken ICE dependency ..." 1>&5
-
-if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists ice; then
-	test -n "$verbose" && echo "	found package ice" 1>&6
-
-echo "${as_me:-configure}:11233: testing found package ice ..." 1>&5
-
-	cf_pkgconfig_incs="`$PKG_CONFIG --cflags ice 2>/dev/null`"
-	cf_pkgconfig_libs="`$PKG_CONFIG --libs   ice 2>/dev/null`"
-	test -n "$verbose" && echo "	package ice CFLAGS: $cf_pkgconfig_incs" 1>&6
-
-echo "${as_me:-configure}:11239: testing package ice CFLAGS: $cf_pkgconfig_incs ..." 1>&5
-
-	test -n "$verbose" && echo "	package ice LIBS: $cf_pkgconfig_libs" 1>&6
-
-echo "${as_me:-configure}:11243: testing package ice LIBS: $cf_pkgconfig_libs ..." 1>&5
-
-cf_fix_cppflags=no
-cf_new_cflags=
-cf_new_cppflags=
-cf_new_extra_cppflags=
-
-for cf_add_cflags in $cf_pkgconfig_incs
-do
-case $cf_fix_cppflags in
-no)
-	case $cf_add_cflags in #(vi
-	-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi
-		case $cf_add_cflags in
-		-D*)
-			cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'`
-
-			test "${cf_add_cflags}" != "${cf_tst_cflags}" \
-				&& test -z "${cf_tst_cflags}" \
-				&& cf_fix_cppflags=yes
-
-			if test $cf_fix_cppflags = yes ; then
-				cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
-				continue
-			elif test "${cf_tst_cflags}" = "\"'" ; then
-				cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
-				continue
+			echo "$as_me:11476: result: $cf_result" >&5
+echo "${ECHO_T}$cf_result" >&6
+			if test "$cf_result" = yes ; then
+				cf_x_athena_lib="$cf_libs"
+				break
 			fi
-			;;
-		esac
-		case "$CPPFLAGS" in
-		*$cf_add_cflags) #(vi
-			;;
-		*) #(vi
-			case $cf_add_cflags in #(vi
-			-D*)
-				cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'`
+			LIBS="$cf_save"
+		fi
+	done # cf_libs
+		test -n "$cf_x_athena_lib" && break
+	done # cf_lib
+done
+
+if test -z "$cf_x_athena_lib" ; then
+	{ { echo "$as_me:11490: error: Unable to successfully link Athena library (-l$cf_x_athena_root) with test program" >&5
+echo "$as_me: error: Unable to successfully link Athena library (-l$cf_x_athena_root) with test program" >&2;}
+   { (exit 1); exit 1; }; }
+fi
 
-CPPFLAGS=`echo "$CPPFLAGS" | \
-	sed	-e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ 	]*\)\?[ 	]/ /g' \
-		-e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ 	]*\)\?$//g'`
+cf_x_athena_LIBS=`echo "HAVE_LIB_$cf_x_athena" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
 
-				;;
-			esac
-			cf_new_cppflags="$cf_new_cppflags $cf_add_cflags"
-			;;
-		esac
-		;;
-	*)
-		cf_new_cflags="$cf_new_cflags $cf_add_cflags"
-		;;
-	esac
-	;;
-yes)
-	cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
+cat >>confdefs.h <<EOF
+#define $cf_x_athena_LIBS 1
+EOF
 
-	cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'`
+fi
 
-	test "${cf_add_cflags}" != "${cf_tst_cflags}" \
-		&& test -z "${cf_tst_cflags}" \
-		&& cf_fix_cppflags=no
-	;;
-esac
+if test -n "$ac_tool_prefix"; then
+  for ac_prog in xcurses-config
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+echo "$as_me:11508: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_XCURSES_CONFIG+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$XCURSES_CONFIG"; then
+  ac_cv_prog_XCURSES_CONFIG="$XCURSES_CONFIG" # Let the user override the test.
+else
+  ac_save_IFS=$IFS; IFS=$ac_path_separator
+ac_dummy="$PATH"
+for ac_dir in $ac_dummy; do
+  IFS=$ac_save_IFS
+  test -z "$ac_dir" && ac_dir=.
+  $as_executable_p "$ac_dir/$ac_word" || continue
+ac_cv_prog_XCURSES_CONFIG="$ac_tool_prefix$ac_prog"
+echo "$as_me:11523: found $ac_dir/$ac_word" >&5
+break
 done
 
-if test -n "$cf_new_cflags" ; then
-
-	CFLAGS="$CFLAGS $cf_new_cflags"
+fi
+fi
+XCURSES_CONFIG=$ac_cv_prog_XCURSES_CONFIG
+if test -n "$XCURSES_CONFIG"; then
+  echo "$as_me:11531: result: $XCURSES_CONFIG" >&5
+echo "${ECHO_T}$XCURSES_CONFIG" >&6
+else
+  echo "$as_me:11534: result: no" >&5
+echo "${ECHO_T}no" >&6
 fi
 
-if test -n "$cf_new_cppflags" ; then
+    test -n "$XCURSES_CONFIG" && break
+  done
+fi
+if test -z "$XCURSES_CONFIG"; then
+  ac_ct_XCURSES_CONFIG=$XCURSES_CONFIG
+  for ac_prog in xcurses-config
+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 "$as_me:11547: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_XCURSES_CONFIG+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_XCURSES_CONFIG"; then
+  ac_cv_prog_ac_ct_XCURSES_CONFIG="$ac_ct_XCURSES_CONFIG" # Let the user override the test.
+else
+  ac_save_IFS=$IFS; IFS=$ac_path_separator
+ac_dummy="$PATH"
+for ac_dir in $ac_dummy; do
+  IFS=$ac_save_IFS
+  test -z "$ac_dir" && ac_dir=.
+  $as_executable_p "$ac_dir/$ac_word" || continue
+ac_cv_prog_ac_ct_XCURSES_CONFIG="$ac_prog"
+echo "$as_me:11562: found $ac_dir/$ac_word" >&5
+break
+done
 
-	CPPFLAGS="$CPPFLAGS $cf_new_cppflags"
+fi
+fi
+ac_ct_XCURSES_CONFIG=$ac_cv_prog_ac_ct_XCURSES_CONFIG
+if test -n "$ac_ct_XCURSES_CONFIG"; then
+  echo "$as_me:11570: result: $ac_ct_XCURSES_CONFIG" >&5
+echo "${ECHO_T}$ac_ct_XCURSES_CONFIG" >&6
+else
+  echo "$as_me:11573: result: no" >&5
+echo "${ECHO_T}no" >&6
 fi
 
-if test -n "$cf_new_extra_cppflags" ; then
+  test -n "$ac_ct_XCURSES_CONFIG" && break
+done
+test -n "$ac_ct_XCURSES_CONFIG" || ac_ct_XCURSES_CONFIG="none"
 
-	EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS"
+  XCURSES_CONFIG=$ac_ct_XCURSES_CONFIG
 fi
 
-	LIBS="$cf_pkgconfig_libs $LIBS"
+if test "$XCURSES_CONFIG" != none ; then
 
-if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists sm; then
-	test -n "$verbose" && echo "	found package sm" 1>&6
+CPPFLAGS="$CPPFLAGS `$XCURSES_CONFIG --cflags`"
+LIBS="`$XCURSES_CONFIG --libs` $LIBS"
 
-echo "${as_me:-configure}:11328: testing found package sm ..." 1>&5
+cf_cv_lib_XCurses=yes
 
-	cf_pkgconfig_incs="`$PKG_CONFIG --cflags sm 2>/dev/null`"
-	cf_pkgconfig_libs="`$PKG_CONFIG --libs   sm 2>/dev/null`"
-	test -n "$verbose" && echo "	package sm CFLAGS: $cf_pkgconfig_incs" 1>&6
+else
 
-echo "${as_me:-configure}:11334: testing package sm CFLAGS: $cf_pkgconfig_incs ..." 1>&5
+LDFLAGS="$LDFLAGS $X_LIBS"
 
-	test -n "$verbose" && echo "	package sm LIBS: $cf_pkgconfig_libs" 1>&6
+test -n "$verbose" && echo "	checking additions to CFLAGS" 1>&6
 
-echo "${as_me:-configure}:11338: testing package sm LIBS: $cf_pkgconfig_libs ..." 1>&5
+echo "${as_me:-configure}:11597: testing checking additions to CFLAGS ..." 1>&5
+
+cf_check_cflags="$CFLAGS"
+cf_check_cppflags="$CPPFLAGS"
 
 cf_fix_cppflags=no
 cf_new_cflags=
 cf_new_cppflags=
 cf_new_extra_cppflags=
 
-for cf_add_cflags in $cf_pkgconfig_incs
+for cf_add_cflags in $X_CFLAGS
 do
 case $cf_fix_cppflags in
 no)
@@ -11401,260 +11663,375 @@
 done
 
 if test -n "$cf_new_cflags" ; then
+	test -n "$verbose" && echo "	add to \$CFLAGS $cf_new_cflags" 1>&6
+
+echo "${as_me:-configure}:11668: testing add to \$CFLAGS $cf_new_cflags ..." 1>&5
 
 	CFLAGS="$CFLAGS $cf_new_cflags"
 fi
 
 if test -n "$cf_new_cppflags" ; then
+	test -n "$verbose" && echo "	add to \$CPPFLAGS $cf_new_cppflags" 1>&6
+
+echo "${as_me:-configure}:11676: testing add to \$CPPFLAGS $cf_new_cppflags ..." 1>&5
 
 	CPPFLAGS="$CPPFLAGS $cf_new_cppflags"
 fi
 
 if test -n "$cf_new_extra_cppflags" ; then
+	test -n "$verbose" && echo "	add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags" 1>&6
 
-	EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS"
-fi
+echo "${as_me:-configure}:11684: testing add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags ..." 1>&5
 
-	LIBS="$cf_pkgconfig_libs $LIBS"
-	:
-else
-	:
+	EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS"
 fi
 
+if test "$cf_check_cflags" != "$CFLAGS" ; then
+cat >conftest.$ac_ext <<_ACEOF
+#line 11691 "configure"
+#include "confdefs.h"
+#include <stdio.h>
+int
+main ()
+{
+printf("Hello world");
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:11703: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:11706: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:11709: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:11712: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  :
 else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+test -n "$verbose" && echo "	test-compile failed.  Undoing change to \$CFLAGS" 1>&6
 
-test -n "$verbose" && echo "	...before $LIBS" 1>&6
-
-echo "${as_me:-configure}:11428: testing ...before $LIBS ..." 1>&5
+echo "${as_me:-configure}:11720: testing test-compile failed.  Undoing change to \$CFLAGS ..." 1>&5
 
-LIBS=`echo "$LIBS" | sed -e "s/[ 	][ 	]*/ /g" -e "s,-lXt ,-lXt $X_PRE_LIBS ," -e 's/  / /g'`
-test -n "$verbose" && echo "	...after  $LIBS" 1>&6
+	 if test "$cf_check_cppflags" != "$CPPFLAGS" ; then
+		 test -n "$verbose" && echo "	but keeping change to \$CPPFLAGS" 1>&6
 
-echo "${as_me:-configure}:11433: testing ...after  $LIBS ..." 1>&5
+echo "${as_me:-configure}:11725: testing but keeping change to \$CPPFLAGS ..." 1>&5
 
+	 fi
+	 CFLAGS="$cf_check_flags"
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 fi
 
-				;;
-			esac
-			;;
-		esac
-	fi
-
-	cf_have_X_LIBS=yes
-
+echo "$as_me:11733: checking for XOpenDisplay in -lX11" >&5
+echo $ECHO_N "checking for XOpenDisplay in -lX11... $ECHO_C" >&6
+if test "${ac_cv_lib_X11_XOpenDisplay+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lX11 $X_PRE_LIBS $LIBS $X_EXTRA_LIBS $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+#line 11741 "configure"
+#include "confdefs.h"
 
-	LDFLAGS="$X_LIBS $LDFLAGS"
-
-test -n "$verbose" && echo "	checking additions to CFLAGS" 1>&6
-
-echo "${as_me:-configure}:11451: testing checking additions to CFLAGS ..." 1>&5
-
-cf_check_cflags="$CFLAGS"
-cf_check_cppflags="$CPPFLAGS"
-
-cf_fix_cppflags=no
-cf_new_cflags=
-cf_new_cppflags=
-cf_new_extra_cppflags=
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char XOpenDisplay ();
+int
+main ()
+{
+XOpenDisplay ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:11760: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:11763: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:11766: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:11769: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_X11_XOpenDisplay=yes
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_lib_X11_XOpenDisplay=no
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:11780: result: $ac_cv_lib_X11_XOpenDisplay" >&5
+echo "${ECHO_T}$ac_cv_lib_X11_XOpenDisplay" >&6
+if test $ac_cv_lib_X11_XOpenDisplay = yes; then
+  LIBS="-lX11 $LIBS"
+fi
 
-for cf_add_cflags in $X_CFLAGS
-do
-case $cf_fix_cppflags in
-no)
-	case $cf_add_cflags in #(vi
-	-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi
-		case $cf_add_cflags in
-		-D*)
-			cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'`
+echo "$as_me:11786: checking for XCurses library" >&5
+echo $ECHO_N "checking for XCurses library... $ECHO_C" >&6
+if test "${cf_cv_lib_XCurses+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
 
-			test "${cf_add_cflags}" != "${cf_tst_cflags}" \
-				&& test -z "${cf_tst_cflags}" \
-				&& cf_fix_cppflags=yes
+LIBS="-lXCurses $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+#line 11794 "configure"
+#include "confdefs.h"
 
-			if test $cf_fix_cppflags = yes ; then
-				cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
-				continue
-			elif test "${cf_tst_cflags}" = "\"'" ; then
-				cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
-				continue
-			fi
-			;;
-		esac
-		case "$CPPFLAGS" in
-		*$cf_add_cflags) #(vi
-			;;
-		*) #(vi
-			case $cf_add_cflags in #(vi
-			-D*)
-				cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'`
+#include <xcurses.h>
+char *XCursesProgramName = "test";
 
-CPPFLAGS=`echo "$CPPFLAGS" | \
-	sed	-e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ 	]*\)\?[ 	]/ /g' \
-		-e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ 	]*\)\?$//g'`
+int
+main ()
+{
+XCursesExit();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:11809: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:11812: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:11815: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:11818: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  cf_cv_lib_XCurses=yes
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+cf_cv_lib_XCurses=no
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 
-				;;
-			esac
-			cf_new_cppflags="$cf_new_cppflags $cf_add_cflags"
-			;;
-		esac
-		;;
-	*)
-		cf_new_cflags="$cf_new_cflags $cf_add_cflags"
-		;;
-	esac
-	;;
-yes)
-	cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
+fi
+echo "$as_me:11829: result: $cf_cv_lib_XCurses" >&5
+echo "${ECHO_T}$cf_cv_lib_XCurses" >&6
 
-	cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'`
+fi
 
-	test "${cf_add_cflags}" != "${cf_tst_cflags}" \
-		&& test -z "${cf_tst_cflags}" \
-		&& cf_fix_cppflags=no
-	;;
-esac
-done
+if test $cf_cv_lib_XCurses = yes ; then
 
-if test -n "$cf_new_cflags" ; then
-	test -n "$verbose" && echo "	add to \$CFLAGS $cf_new_cflags" 1>&6
+cat >>confdefs.h <<\EOF
+#define UNIX 1
+EOF
 
-echo "${as_me:-configure}:11522: testing add to \$CFLAGS $cf_new_cflags ..." 1>&5
+cat >>confdefs.h <<\EOF
+#define XCURSES 1
+EOF
 
-	CFLAGS="$CFLAGS $cf_new_cflags"
+	echo "$as_me:11844: checking for xcurses.h" >&5
+echo $ECHO_N "checking for xcurses.h... $ECHO_C" >&6
+if test "${ac_cv_header_xcurses_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+#line 11850 "configure"
+#include "confdefs.h"
+#include <xcurses.h>
+_ACEOF
+if { (eval echo "$as_me:11854: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  egrep -v '^ *\+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:11860: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  ac_cv_header_xcurses_h=yes
+else
+  echo "$as_me: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  ac_cv_header_xcurses_h=no
+fi
+rm -f conftest.err conftest.$ac_ext
 fi
+echo "$as_me:11879: result: $ac_cv_header_xcurses_h" >&5
+echo "${ECHO_T}$ac_cv_header_xcurses_h" >&6
+if test $ac_cv_header_xcurses_h = yes; then
 
-if test -n "$cf_new_cppflags" ; then
-	test -n "$verbose" && echo "	add to \$CPPFLAGS $cf_new_cppflags" 1>&6
+cat >>confdefs.h <<\EOF
+#define HAVE_XCURSES 1
+EOF
 
-echo "${as_me:-configure}:11530: testing add to \$CPPFLAGS $cf_new_cppflags ..." 1>&5
+fi
 
-	CPPFLAGS="$CPPFLAGS $cf_new_cppflags"
+else
+	{ { echo "$as_me:11890: error: Cannot link with XCurses" >&5
+echo "$as_me: error: Cannot link with XCurses" >&2;}
+   { (exit 1); exit 1; }; }
 fi
 
-if test -n "$cf_new_extra_cppflags" ; then
-	test -n "$verbose" && echo "	add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags" 1>&6
+	;;
+esac
 
-echo "${as_me:-configure}:11538: testing add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags ..." 1>&5
+case $cf_cv_screen in
+curses|curses_*)
 
-	EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS"
-fi
+echo "$as_me:11901: checking for NetBSD form.h" >&5
+echo $ECHO_N "checking for NetBSD form.h... $ECHO_C" >&6
+if test "${cf_cv_netbsd_form_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
 
-if test "$cf_check_cflags" != "$CFLAGS" ; then
 cat >conftest.$ac_ext <<_ACEOF
-#line 11545 "configure"
+#line 11908 "configure"
 #include "confdefs.h"
-#include <stdio.h>
+
+#include <${cf_cv_ncurses_header:-curses.h}>
+#include <form.h>
+
 int
 main ()
 {
-printf("Hello world");
+
+	FORM *form;
+	int y = current_field(form)->cursor_ypos;
+	int x = current_field(form)->cursor_xpos;
+
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:11557: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:11927: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:11560: \$? = $ac_status" >&5
+  echo "$as_me:11930: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:11563: \"$ac_try\"") >&5
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:11933: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:11566: \$? = $ac_status" >&5
+  echo "$as_me:11936: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  :
+  cf_cv_netbsd_form_h=yes
+
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-test -n "$verbose" && echo "	test-compile failed.  Undoing change to \$CFLAGS" 1>&6
-
-echo "${as_me:-configure}:11574: testing test-compile failed.  Undoing change to \$CFLAGS ..." 1>&5
-
-	 if test "$cf_check_cppflags" != "$CPPFLAGS" ; then
-		 test -n "$verbose" && echo "	but keeping change to \$CPPFLAGS" 1>&6
-
-echo "${as_me:-configure}:11579: testing but keeping change to \$CPPFLAGS ..." 1>&5
-
-	 fi
-	 CFLAGS="$cf_check_flags"
+cf_cv_netbsd_form_h=no
 fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+rm -f conftest.$ac_objext conftest.$ac_ext
+
 fi
+echo "$as_me:11948: result: $cf_cv_netbsd_form_h" >&5
+echo "${ECHO_T}$cf_cv_netbsd_form_h" >&6
 
-	echo "$as_me:11587: checking for XOpenDisplay" >&5
-echo $ECHO_N "checking for XOpenDisplay... $ECHO_C" >&6
-if test "${ac_cv_func_XOpenDisplay+set}" = set; then
+test "$cf_cv_netbsd_form_h" = yes &&
+cat >>confdefs.h <<\EOF
+#define HAVE_NETBSD_FORM_H 1
+EOF
+
+echo "$as_me:11956: checking for NetBSD menu.h" >&5
+echo $ECHO_N "checking for NetBSD menu.h... $ECHO_C" >&6
+if test "${cf_cv_netbsd_menu_h+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
-#line 11593 "configure"
+
+cat >conftest.$ac_ext <<_ACEOF
+#line 11963 "configure"
 #include "confdefs.h"
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char XOpenDisplay (); below.  */
-#include <assert.h>
-/* Override any gcc2 internal prototype to avoid an error.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
-char XOpenDisplay ();
-char (*f) ();
+
+#include <${cf_cv_ncurses_header:-curses.h}>
+#include <menu.h>
 
 int
 main ()
 {
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined (__stub_XOpenDisplay) || defined (__stub___XOpenDisplay)
-choke me
-#else
-f = XOpenDisplay;
-#endif
+
+	MENU *menu;
+	int y = menu->max_item_width;
 
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:11624: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:11981: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:11627: \$? = $ac_status" >&5
+  echo "$as_me:11984: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:11630: \"$ac_try\"") >&5
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:11987: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:11633: \$? = $ac_status" >&5
+  echo "$as_me:11990: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_func_XOpenDisplay=yes
+  cf_cv_netbsd_menu_h=yes
+
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-ac_cv_func_XOpenDisplay=no
+cf_cv_netbsd_menu_h=no
 fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+rm -f conftest.$ac_objext conftest.$ac_ext
+
 fi
-echo "$as_me:11643: result: $ac_cv_func_XOpenDisplay" >&5
-echo "${ECHO_T}$ac_cv_func_XOpenDisplay" >&6
-if test $ac_cv_func_XOpenDisplay = yes; then
-  :
-else
+echo "$as_me:12002: result: $cf_cv_netbsd_menu_h" >&5
+echo "${ECHO_T}$cf_cv_netbsd_menu_h" >&6
 
-	echo "$as_me:11649: checking for XOpenDisplay in -lX11" >&5
-echo $ECHO_N "checking for XOpenDisplay in -lX11... $ECHO_C" >&6
-if test "${ac_cv_lib_X11_XOpenDisplay+set}" = set; then
+test "$cf_cv_netbsd_menu_h" = yes &&
+cat >>confdefs.h <<\EOF
+#define HAVE_NETBSD_MENU_H 1
+EOF
+
+	;;
+ncursesw)
+	cf_cv_libtype=w
+	;;
+esac
+
+case $cf_cv_screen in #(vi
+pdcurses) #(vi
+	;;
+*)
+	# look for curses-related libraries
+	: ${cf_panel_lib:=panel}
+	: ${cf_menu_lib:=menu}
+	: ${cf_form_lib:=form}
+
+as_ac_Lib=`echo "ac_cv_lib_$cf_panel_lib$cf_cv_libtype''_new_panel" | $as_tr_sh`
+echo "$as_me:12026: checking for new_panel in -l$cf_panel_lib$cf_cv_libtype" >&5
+echo $ECHO_N "checking for new_panel in -l$cf_panel_lib$cf_cv_libtype... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Lib+set}\" = set"; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lX11 $X_PRE_LIBS $LIBS $X_EXTRA_LIBS $LIBS"
+LIBS="-l$cf_panel_lib$cf_cv_libtype  $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
-#line 11657 "configure"
+#line 12034 "configure"
 #include "confdefs.h"
 
 /* Override any gcc2 internal prototype to avoid an error.  */
@@ -11663,115 +12040,116 @@
 #endif
 /* We use char because int might match the return type of a gcc2
    builtin and then its argument prototype would still apply.  */
-char XOpenDisplay ();
+char new_panel ();
 int
 main ()
 {
-XOpenDisplay ();
+new_panel ();
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:11676: \"$ac_link\"") >&5
+if { (eval echo "$as_me:12053: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:11679: \$? = $ac_status" >&5
+  echo "$as_me:12056: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:11682: \"$ac_try\"") >&5
+  { (eval echo "$as_me:12059: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:11685: \$? = $ac_status" >&5
+  echo "$as_me:12062: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_lib_X11_XOpenDisplay=yes
+  eval "$as_ac_Lib=yes"
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-ac_cv_lib_X11_XOpenDisplay=no
+eval "$as_ac_Lib=no"
 fi
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-echo "$as_me:11696: result: $ac_cv_lib_X11_XOpenDisplay" >&5
-echo "${ECHO_T}$ac_cv_lib_X11_XOpenDisplay" >&6
-if test $ac_cv_lib_X11_XOpenDisplay = yes; then
-  LIBS="-lX11 $LIBS"
-fi
+echo "$as_me:12073: result: `eval echo '${'$as_ac_Lib'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Lib'}'`" >&6
+if test `eval echo '${'$as_ac_Lib'}'` = yes; then
+  cat >>confdefs.h <<EOF
+#define `echo "HAVE_LIB$cf_panel_lib$cf_cv_libtype" | $as_tr_cpp` 1
+EOF
+
+  LIBS="-l$cf_panel_lib$cf_cv_libtype $LIBS"
 
 fi
 
-	echo "$as_me:11704: checking for XtAppInitialize" >&5
-echo $ECHO_N "checking for XtAppInitialize... $ECHO_C" >&6
-if test "${ac_cv_func_XtAppInitialize+set}" = set; then
+as_ac_Lib=`echo "ac_cv_lib_$cf_menu_lib$cf_cv_libtype''_menu_driver" | $as_tr_sh`
+echo "$as_me:12085: checking for menu_driver in -l$cf_menu_lib$cf_cv_libtype" >&5
+echo $ECHO_N "checking for menu_driver in -l$cf_menu_lib$cf_cv_libtype... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Lib+set}\" = set"; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
-#line 11710 "configure"
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-l$cf_menu_lib$cf_cv_libtype  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+#line 12093 "configure"
 #include "confdefs.h"
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char XtAppInitialize (); below.  */
-#include <assert.h>
+
 /* Override any gcc2 internal prototype to avoid an error.  */
 #ifdef __cplusplus
 extern "C"
 #endif
 /* We use char because int might match the return type of a gcc2
    builtin and then its argument prototype would still apply.  */
-char XtAppInitialize ();
-char (*f) ();
-
+char menu_driver ();
 int
 main ()
 {
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined (__stub_XtAppInitialize) || defined (__stub___XtAppInitialize)
-choke me
-#else
-f = XtAppInitialize;
-#endif
-
+menu_driver ();
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:11741: \"$ac_link\"") >&5
+if { (eval echo "$as_me:12112: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:11744: \$? = $ac_status" >&5
+  echo "$as_me:12115: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:11747: \"$ac_try\"") >&5
+  { (eval echo "$as_me:12118: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:11750: \$? = $ac_status" >&5
+  echo "$as_me:12121: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_func_XtAppInitialize=yes
+  eval "$as_ac_Lib=yes"
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-ac_cv_func_XtAppInitialize=no
+eval "$as_ac_Lib=no"
 fi
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:12132: result: `eval echo '${'$as_ac_Lib'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Lib'}'`" >&6
+if test `eval echo '${'$as_ac_Lib'}'` = yes; then
+  cat >>confdefs.h <<EOF
+#define `echo "HAVE_LIB$cf_menu_lib$cf_cv_libtype" | $as_tr_cpp` 1
+EOF
+
+  LIBS="-l$cf_menu_lib$cf_cv_libtype $LIBS"
+
 fi
-echo "$as_me:11760: result: $ac_cv_func_XtAppInitialize" >&5
-echo "${ECHO_T}$ac_cv_func_XtAppInitialize" >&6
-if test $ac_cv_func_XtAppInitialize = yes; then
-  :
-else
 
-	echo "$as_me:11766: checking for XtAppInitialize in -lXt" >&5
-echo $ECHO_N "checking for XtAppInitialize in -lXt... $ECHO_C" >&6
-if test "${ac_cv_lib_Xt_XtAppInitialize+set}" = set; then
+as_ac_Lib=`echo "ac_cv_lib_$cf_form_lib$cf_cv_libtype''_form_driver" | $as_tr_sh`
+echo "$as_me:12144: checking for form_driver in -l$cf_form_lib$cf_cv_libtype" >&5
+echo $ECHO_N "checking for form_driver in -l$cf_form_lib$cf_cv_libtype... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Lib+set}\" = set"; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lXt $X_PRE_LIBS $LIBS $X_EXTRA_LIBS $LIBS"
+LIBS="-l$cf_form_lib$cf_cv_libtype  $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
-#line 11774 "configure"
+#line 12152 "configure"
 #include "confdefs.h"
 
 /* Override any gcc2 internal prototype to avoid an error.  */
@@ -11780,2296 +12158,2187 @@
 #endif
 /* We use char because int might match the return type of a gcc2
    builtin and then its argument prototype would still apply.  */
-char XtAppInitialize ();
+char form_driver ();
 int
 main ()
 {
-XtAppInitialize ();
+form_driver ();
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:11793: \"$ac_link\"") >&5
+if { (eval echo "$as_me:12171: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:11796: \$? = $ac_status" >&5
+  echo "$as_me:12174: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:11799: \"$ac_try\"") >&5
+  { (eval echo "$as_me:12177: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:11802: \$? = $ac_status" >&5
+  echo "$as_me:12180: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_lib_Xt_XtAppInitialize=yes
+  eval "$as_ac_Lib=yes"
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-ac_cv_lib_Xt_XtAppInitialize=no
+eval "$as_ac_Lib=no"
 fi
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-echo "$as_me:11813: result: $ac_cv_lib_Xt_XtAppInitialize" >&5
-echo "${ECHO_T}$ac_cv_lib_Xt_XtAppInitialize" >&6
-if test $ac_cv_lib_Xt_XtAppInitialize = yes; then
-  cat >>confdefs.h <<\EOF
-#define HAVE_LIBXT 1
+echo "$as_me:12191: result: `eval echo '${'$as_ac_Lib'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Lib'}'`" >&6
+if test `eval echo '${'$as_ac_Lib'}'` = yes; then
+  cat >>confdefs.h <<EOF
+#define `echo "HAVE_LIB$cf_form_lib$cf_cv_libtype" | $as_tr_cpp` 1
 EOF
 
-		 cf_have_X_LIBS=Xt
-		 LIBS="-lXt $X_PRE_LIBS $LIBS $X_EXTRA_LIBS"
+  LIBS="-l$cf_form_lib$cf_cv_libtype $LIBS"
+
 fi
 
+	# look for curses-related headers
+
+for ac_header in \
+		nc_alloc.h \
+		nomacros.h \
+		form.h \
+		menu.h \
+		panel.h \
+		term_entry.h \
+
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+echo "$as_me:12214: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+#line 12220 "configure"
+#include "confdefs.h"
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:12224: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  egrep -v '^ *\+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:12230: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  eval "$as_ac_Header=yes"
+else
+  echo "$as_me: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  eval "$as_ac_Header=no"
 fi
+rm -f conftest.err conftest.$ac_ext
+fi
+echo "$as_me:12249: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<EOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+EOF
 
 fi
+done
 
-if test $cf_have_X_LIBS = no ; then
-	{ echo "$as_me:11829: WARNING: Unable to successfully link X Toolkit library (-lXt) with
-test program.  You will have to check and add the proper libraries by hand
-to makefile." >&5
-echo "$as_me: WARNING: Unable to successfully link X Toolkit library (-lXt) with
-test program.  You will have to check and add the proper libraries by hand
-to makefile." >&2;}
+	;;
+esac
+
+echo "$as_me:12262: checking for ANSI C header files" >&5
+echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6
+if test "${ac_cv_header_stdc+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+#line 12268 "configure"
+#include "confdefs.h"
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+
+_ACEOF
+if { (eval echo "$as_me:12276: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  egrep -v '^ *\+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:12282: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  ac_cv_header_stdc=yes
+else
+  echo "$as_me: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  ac_cv_header_stdc=no
 fi
+rm -f conftest.err conftest.$ac_ext
 
-cf_x_athena_root=$cf_x_athena
-cf_x_athena_inc=""
+if test $ac_cv_header_stdc = yes; then
+  # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+  cat >conftest.$ac_ext <<_ACEOF
+#line 12304 "configure"
+#include "confdefs.h"
+#include <string.h>
 
-for cf_path in default \
-	/usr/contrib/X11R6 \
-	/usr/contrib/X11R5 \
-	/usr/lib/X11R5 \
-	/usr/local
-do
-	if test -z "$cf_x_athena_inc" ; then
-		cf_save="$CPPFLAGS"
-		cf_test=X11/$cf_x_athena_root/SimpleMenu.h
-		if test $cf_path != default ; then
-			CPPFLAGS="$cf_save -I$cf_path/include"
-			echo "$as_me:11851: checking for $cf_test in $cf_path" >&5
-echo $ECHO_N "checking for $cf_test in $cf_path... $ECHO_C" >&6
-		else
-			echo "$as_me:11854: checking for $cf_test" >&5
-echo $ECHO_N "checking for $cf_test... $ECHO_C" >&6
-		fi
-		cat >conftest.$ac_ext <<_ACEOF
-#line 11858 "configure"
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "memchr" >/dev/null 2>&1; then
+  :
+else
+  ac_cv_header_stdc=no
+fi
+rm -rf conftest*
+
+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 <<_ACEOF
+#line 12322 "configure"
 #include "confdefs.h"
+#include <stdlib.h>
 
-#include <X11/Intrinsic.h>
-#include <$cf_test>
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "free" >/dev/null 2>&1; then
+  :
+else
+  ac_cv_header_stdc=no
+fi
+rm -rf conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+  # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+  if test "$cross_compiling" = yes; then
+  :
+else
+  cat >conftest.$ac_ext <<_ACEOF
+#line 12343 "configure"
+#include "confdefs.h"
+#include <ctype.h>
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) (('a' <= (c) && (c) <= 'i') \
+                     || ('j' <= (c) && (c) <= 'r') \
+                     || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+#endif
+
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
 int
 main ()
 {
-
-  ;
-  return 0;
+  int i;
+  for (i = 0; i < 256; i++)
+    if (XOR (islower (i), ISLOWER (i))
+        || toupper (i) != TOUPPER (i))
+      $ac_main_return(2);
+  $ac_main_return (0);
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:11872: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:12369: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:11875: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:11878: \"$ac_try\"") >&5
+  echo "$as_me:12372: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (eval echo "$as_me:12374: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:11881: \$? = $ac_status" >&5
+  echo "$as_me:12377: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  cf_result=yes
+  :
 else
-  echo "$as_me: failed program was:" >&5
+  echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-cf_result=no
+ac_cv_header_stdc=no
+fi
+rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
-rm -f conftest.$ac_objext conftest.$ac_ext
-		echo "$as_me:11890: result: $cf_result" >&5
-echo "${ECHO_T}$cf_result" >&6
-		if test "$cf_result" = yes ; then
-			cf_x_athena_inc=$cf_path
-			break
-		else
-			CPPFLAGS="$cf_save"
-		fi
-	fi
-done
-
-if test -z "$cf_x_athena_inc" ; then
-	{ echo "$as_me:11902: WARNING: Unable to successfully find Athena header files with test program" >&5
-echo "$as_me: WARNING: Unable to successfully find Athena header files with test program" >&2;}
-elif test "$cf_x_athena_inc" != default ; then
-	CPPFLAGS="$CPPFLAGS -I$cf_x_athena_inc"
 fi
+fi
+echo "$as_me:12390: result: $ac_cv_header_stdc" >&5
+echo "${ECHO_T}$ac_cv_header_stdc" >&6
+if test $ac_cv_header_stdc = yes; then
 
-cf_x_athena_root=$cf_x_athena
-cf_x_athena_lib=""
+cat >>confdefs.h <<\EOF
+#define STDC_HEADERS 1
+EOF
 
-for cf_path in default \
-	/usr/contrib/X11R6 \
-	/usr/contrib/X11R5 \
-	/usr/lib/X11R5 \
-	/usr/local
-do
-	for cf_lib in \
-		"-l$cf_x_athena_root -lXmu" \
-		"-l$cf_x_athena_root -lXpm -lXmu" \
-		"-l${cf_x_athena_root}_s -lXmu_s"
-	do
-		if test -z "$cf_x_athena_lib" ; then
-			cf_save="$LIBS"
-			cf_test=XawSimpleMenuAddGlobalActions
-			if test $cf_path != default ; then
-				LIBS="-L$cf_path/lib $cf_lib $LIBS"
-				echo "$as_me:11927: checking for $cf_lib in $cf_path" >&5
-echo $ECHO_N "checking for $cf_lib in $cf_path... $ECHO_C" >&6
-			else
-				LIBS="$cf_lib $LIBS"
-				echo "$as_me:11931: checking for $cf_test in $cf_lib" >&5
-echo $ECHO_N "checking for $cf_test in $cf_lib... $ECHO_C" >&6
-			fi
-			cat >conftest.$ac_ext <<_ACEOF
-#line 11935 "configure"
+fi
+
+echo "$as_me:12400: checking whether time.h and sys/time.h may both be included" >&5
+echo $ECHO_N "checking whether time.h and sys/time.h may both be included... $ECHO_C" >&6
+if test "${ac_cv_header_time+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+#line 12406 "configure"
 #include "confdefs.h"
-
-#include <X11/Intrinsic.h>
-#include <X11/$cf_x_athena_root/SimpleMenu.h>
+#include <sys/types.h>
+#include <sys/time.h>
+#include <time.h>
 
 int
 main ()
 {
-
-$cf_test((XtAppContext) 0)
+if ((struct tm *) 0)
+return 0;
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:11951: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:12422: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:11954: \$? = $ac_status" >&5
+  echo "$as_me:12425: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:11957: \"$ac_try\"") >&5
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:12428: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:11960: \$? = $ac_status" >&5
+  echo "$as_me:12431: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  cf_result=yes
+  ac_cv_header_time=yes
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-cf_result=no
+ac_cv_header_time=no
 fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
-			echo "$as_me:11969: result: $cf_result" >&5
-echo "${ECHO_T}$cf_result" >&6
-			if test "$cf_result" = yes ; then
-				cf_x_athena_lib="$cf_lib"
-				break
-			fi
-			LIBS="$cf_save"
-		fi
-	done
-done
-
-if test -z "$cf_x_athena_lib" ; then
-	{ { echo "$as_me:11981: error: Unable to successfully link Athena library (-l$cf_x_athena_root) with test program" >&5
-echo "$as_me: error: Unable to successfully link Athena library (-l$cf_x_athena_root) with test program" >&2;}
-   { (exit 1); exit 1; }; }
+rm -f conftest.$ac_objext conftest.$ac_ext
 fi
+echo "$as_me:12441: result: $ac_cv_header_time" >&5
+echo "${ECHO_T}$ac_cv_header_time" >&6
+if test $ac_cv_header_time = yes; then
 
-cf_x_athena_LIBS=`echo "HAVE_LIB_$cf_x_athena" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
-
-cat >>confdefs.h <<EOF
-#define $cf_x_athena_LIBS 1
+cat >>confdefs.h <<\EOF
+#define TIME_WITH_SYS_TIME 1
 EOF
 
 fi
 
-for ac_prog in xcurses-config
+for ac_header in \
+getopt.h \
+locale.h \
+math.h \
+stdarg.h \
+sys/ioctl.h \
+sys/select.h \
+sys/time.h \
+termios.h \
+unistd.h \
+
 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 "$as_me:11998: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_path_XCURSES_CONFIG+set}" = set; then
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+echo "$as_me:12464: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  case $XCURSES_CONFIG in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_XCURSES_CONFIG="$XCURSES_CONFIG" # Let the user override the test with a path.
-  ;;
-  *)
-  ac_save_IFS=$IFS; IFS=$ac_path_separator
-ac_dummy="$PATH"
-for ac_dir in $ac_dummy; do
-  IFS=$ac_save_IFS
-  test -z "$ac_dir" && ac_dir=.
-  if $as_executable_p "$ac_dir/$ac_word"; then
-   ac_cv_path_XCURSES_CONFIG="$ac_dir/$ac_word"
-   echo "$as_me:12015: found $ac_dir/$ac_word" >&5
-   break
+  cat >conftest.$ac_ext <<_ACEOF
+#line 12470 "configure"
+#include "confdefs.h"
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:12474: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  egrep -v '^ *\+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:12480: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
 fi
-done
+if test -z "$ac_cpp_err"; then
+  eval "$as_ac_Header=yes"
+else
+  echo "$as_me: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  eval "$as_ac_Header=no"
+fi
+rm -f conftest.err conftest.$ac_ext
+fi
+echo "$as_me:12499: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<EOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+EOF
 
-  ;;
-esac
 fi
-XCURSES_CONFIG=$ac_cv_path_XCURSES_CONFIG
+done
 
-if test -n "$XCURSES_CONFIG"; then
-  echo "$as_me:12026: result: $XCURSES_CONFIG" >&5
-echo "${ECHO_T}$XCURSES_CONFIG" >&6
+for ac_header in unistd.h getopt.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+echo "$as_me:12512: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  echo "$as_me:12029: result: no" >&5
-echo "${ECHO_T}no" >&6
+  cat >conftest.$ac_ext <<_ACEOF
+#line 12518 "configure"
+#include "confdefs.h"
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:12522: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  egrep -v '^ *\+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:12528: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  eval "$as_ac_Header=yes"
+else
+  echo "$as_me: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  eval "$as_ac_Header=no"
+fi
+rm -f conftest.err conftest.$ac_ext
 fi
+echo "$as_me:12547: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<EOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+EOF
 
-  test -n "$XCURSES_CONFIG" && break
+fi
 done
-test -n "$XCURSES_CONFIG" || XCURSES_CONFIG="none"
-
-if test "$XCURSES_CONFIG" != none ; then
-
-CPPFLAGS="$CPPFLAGS `$XCURSES_CONFIG --cflags`"
-LIBS="`$XCURSES_CONFIG --libs` $LIBS"
-
-cf_cv_lib_XCurses=yes
 
+echo "$as_me:12557: checking for header declaring getopt variables" >&5
+echo $ECHO_N "checking for header declaring getopt variables... $ECHO_C" >&6
+if test "${cf_cv_getopt_header+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
 
-LDFLAGS="$LDFLAGS $X_LIBS"
-
-test -n "$verbose" && echo "	checking additions to CFLAGS" 1>&6
-
-echo "${as_me:-configure}:12050: testing checking additions to CFLAGS ..." 1>&5
-
-cf_check_cflags="$CFLAGS"
-cf_check_cppflags="$CPPFLAGS"
-
-cf_fix_cppflags=no
-cf_new_cflags=
-cf_new_cppflags=
-cf_new_extra_cppflags=
-
-for cf_add_cflags in $X_CFLAGS
+cf_cv_getopt_header=none
+for cf_header in stdio.h stdlib.h unistd.h getopt.h
 do
-case $cf_fix_cppflags in
-no)
-	case $cf_add_cflags in #(vi
-	-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi
-		case $cf_add_cflags in
-		-D*)
-			cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'`
-
-			test "${cf_add_cflags}" != "${cf_tst_cflags}" \
-				&& test -z "${cf_tst_cflags}" \
-				&& cf_fix_cppflags=yes
-
-			if test $cf_fix_cppflags = yes ; then
-				cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
-				continue
-			elif test "${cf_tst_cflags}" = "\"'" ; then
-				cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
-				continue
-			fi
-			;;
-		esac
-		case "$CPPFLAGS" in
-		*$cf_add_cflags) #(vi
-			;;
-		*) #(vi
-			case $cf_add_cflags in #(vi
-			-D*)
-				cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'`
-
-CPPFLAGS=`echo "$CPPFLAGS" | \
-	sed	-e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ 	]*\)\?[ 	]/ /g' \
-		-e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ 	]*\)\?$//g'`
-
-				;;
-			esac
-			cf_new_cppflags="$cf_new_cppflags $cf_add_cflags"
-			;;
-		esac
-		;;
-	*)
-		cf_new_cflags="$cf_new_cflags $cf_add_cflags"
-		;;
-	esac
-	;;
-yes)
-	cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
-
-	cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'`
-
-	test "${cf_add_cflags}" != "${cf_tst_cflags}" \
-		&& test -z "${cf_tst_cflags}" \
-		&& cf_fix_cppflags=no
-	;;
-esac
-done
-
-if test -n "$cf_new_cflags" ; then
-	test -n "$verbose" && echo "	add to \$CFLAGS $cf_new_cflags" 1>&6
-
-echo "${as_me:-configure}:12121: testing add to \$CFLAGS $cf_new_cflags ..." 1>&5
-
-	CFLAGS="$CFLAGS $cf_new_cflags"
-fi
-
-if test -n "$cf_new_cppflags" ; then
-	test -n "$verbose" && echo "	add to \$CPPFLAGS $cf_new_cppflags" 1>&6
-
-echo "${as_me:-configure}:12129: testing add to \$CPPFLAGS $cf_new_cppflags ..." 1>&5
+cat >conftest.$ac_ext <<_ACEOF
+#line 12567 "configure"
+#include "confdefs.h"
 
-	CPPFLAGS="$CPPFLAGS $cf_new_cppflags"
+#include <$cf_header>
+int
+main ()
+{
+int x = optind; char *y = optarg
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:12580: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:12583: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:12586: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:12589: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  cf_cv_getopt_header=$cf_header
+ break
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
 fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+done
 
-if test -n "$cf_new_extra_cppflags" ; then
-	test -n "$verbose" && echo "	add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags" 1>&6
+fi
+echo "$as_me:12601: result: $cf_cv_getopt_header" >&5
+echo "${ECHO_T}$cf_cv_getopt_header" >&6
+if test $cf_cv_getopt_header != none ; then
 
-echo "${as_me:-configure}:12137: testing add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags ..." 1>&5
+cat >>confdefs.h <<\EOF
+#define HAVE_GETOPT_HEADER 1
+EOF
 
-	EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS"
 fi
 
-if test "$cf_check_cflags" != "$CFLAGS" ; then
-cat >conftest.$ac_ext <<_ACEOF
-#line 12144 "configure"
+for ac_func in \
+gettimeofday \
+
+do
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+echo "$as_me:12616: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+if eval "test \"\${$as_ac_var+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+#line 12622 "configure"
 #include "confdefs.h"
-#include <stdio.h>
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func (); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char $ac_func ();
+char (*f) ();
+
 int
 main ()
 {
-printf("Hello world");
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+f = $ac_func; /* workaround for ICC 12.0.3 */ if (f == 0) return 1;
+#endif
+
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:12156: \"$ac_link\"") >&5
+if { (eval echo "$as_me:12653: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:12159: \$? = $ac_status" >&5
+  echo "$as_me:12656: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:12162: \"$ac_try\"") >&5
+  { (eval echo "$as_me:12659: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:12165: \$? = $ac_status" >&5
+  echo "$as_me:12662: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  :
+  eval "$as_ac_var=yes"
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-test -n "$verbose" && echo "	test-compile failed.  Undoing change to \$CFLAGS" 1>&6
-
-echo "${as_me:-configure}:12173: testing test-compile failed.  Undoing change to \$CFLAGS ..." 1>&5
-
-	 if test "$cf_check_cppflags" != "$CPPFLAGS" ; then
-		 test -n "$verbose" && echo "	but keeping change to \$CPPFLAGS" 1>&6
-
-echo "${as_me:-configure}:12178: testing but keeping change to \$CPPFLAGS ..." 1>&5
-
-	 fi
-	 CFLAGS="$cf_check_flags"
+eval "$as_ac_var=no"
 fi
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 fi
+echo "$as_me:12672: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+  cat >>confdefs.h <<EOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+EOF
+
+fi
+done
 
-echo "$as_me:12186: checking for XOpenDisplay in -lX11" >&5
-echo $ECHO_N "checking for XOpenDisplay in -lX11... $ECHO_C" >&6
-if test "${ac_cv_lib_X11_XOpenDisplay+set}" = set; then
+if test "$cf_enable_widec" = yes; then
+
+for ac_func in \
+mblen \
+mbrlen \
+mbrtowc \
+mbsrtowcs \
+mbstowcs \
+mbtowc \
+wcsrtombs \
+wcstombs \
+
+do
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+echo "$as_me:12696: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+if eval "test \"\${$as_ac_var+set}\" = set"; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lX11 $X_PRE_LIBS $LIBS $X_EXTRA_LIBS $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-#line 12194 "configure"
+  cat >conftest.$ac_ext <<_ACEOF
+#line 12702 "configure"
 #include "confdefs.h"
-
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func (); below.  */
+#include <assert.h>
 /* Override any gcc2 internal prototype to avoid an error.  */
 #ifdef __cplusplus
 extern "C"
 #endif
 /* We use char because int might match the return type of a gcc2
    builtin and then its argument prototype would still apply.  */
-char XOpenDisplay ();
+char $ac_func ();
+char (*f) ();
+
 int
 main ()
 {
-XOpenDisplay ();
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+f = $ac_func; /* workaround for ICC 12.0.3 */ if (f == 0) return 1;
+#endif
+
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:12213: \"$ac_link\"") >&5
+if { (eval echo "$as_me:12733: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:12216: \$? = $ac_status" >&5
+  echo "$as_me:12736: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:12219: \"$ac_try\"") >&5
+  { (eval echo "$as_me:12739: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:12222: \$? = $ac_status" >&5
+  echo "$as_me:12742: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_lib_X11_XOpenDisplay=yes
+  eval "$as_ac_var=yes"
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-ac_cv_lib_X11_XOpenDisplay=no
+eval "$as_ac_var=no"
 fi
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
 fi
-echo "$as_me:12233: result: $ac_cv_lib_X11_XOpenDisplay" >&5
-echo "${ECHO_T}$ac_cv_lib_X11_XOpenDisplay" >&6
-if test $ac_cv_lib_X11_XOpenDisplay = yes; then
-  LIBS="-lX11 $LIBS"
+echo "$as_me:12752: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+  cat >>confdefs.h <<EOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+EOF
+
 fi
+done
 
-echo "$as_me:12239: checking for XCurses library" >&5
-echo $ECHO_N "checking for XCurses library... $ECHO_C" >&6
-if test "${cf_cv_lib_XCurses+set}" = set; then
+fi
+
+echo "$as_me:12764: checking if we must define _XOPEN_SOURCE_EXTENDED" >&5
+echo $ECHO_N "checking if we must define _XOPEN_SOURCE_EXTENDED... $ECHO_C" >&6
+if test "${cf_cv_need_xopen_extension+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
 
-LIBS="-lXCurses $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
-#line 12247 "configure"
+#line 12771 "configure"
 #include "confdefs.h"
 
-#include <xcurses.h>
-char *XCursesProgramName = "test";
+#include <stdlib.h>
+#include <${cf_cv_ncurses_header:-curses.h}>
+int
+main ()
+{
+
+#if defined(NCURSES_VERSION_PATCH)
+#if (NCURSES_VERSION_PATCH < 20100501) && (NCURSES_VERSION_PATCH >= 20100403)
+	make an error
+#endif
+#endif
+	long x = winnstr(stdscr, "", 0);
+	int x1, y1;
+	getbegyx(stdscr, y1, x1)
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:12793: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:12796: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:12799: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:12802: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  cf_cv_need_xopen_extension=no
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+cat >conftest.$ac_ext <<_ACEOF
+#line 12809 "configure"
+#include "confdefs.h"
 
+#define _XOPEN_SOURCE_EXTENDED
+#include <stdlib.h>
+#include <${cf_cv_ncurses_header:-curses.h}>
 int
 main ()
 {
-XCursesExit();
+
+#ifdef NCURSES_VERSION
+	cchar_t check;
+	int check2 = curs_set((int)sizeof(check));
+#endif
+	long x = winnstr(stdscr, "", 0);
+	int x1, y1;
+	getbegyx(stdscr, y1, x1)
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:12262: \"$ac_link\"") >&5
+if { (eval echo "$as_me:12831: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:12265: \$? = $ac_status" >&5
+  echo "$as_me:12834: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:12837: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:12840: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  cf_cv_need_xopen_extension=yes
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+cf_cv_need_xopen_extension=unknown
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:12852: result: $cf_cv_need_xopen_extension" >&5
+echo "${ECHO_T}$cf_cv_need_xopen_extension" >&6
+test $cf_cv_need_xopen_extension = yes && CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE_EXTENDED"
+
+echo "$as_me:12856: checking for term.h" >&5
+echo $ECHO_N "checking for term.h... $ECHO_C" >&6
+if test "${cf_cv_term_header+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+# If we found <ncurses/curses.h>, look for <ncurses/term.h>, but always look
+# for <term.h> if we do not find the variant.
+
+cf_header_list="term.h ncurses/term.h ncursesw/term.h"
+
+case ${cf_cv_ncurses_header:-curses.h} in #(vi
+*/*)
+	cf_header_item=`echo ${cf_cv_ncurses_header:-curses.h} | sed -e 's%\..*%%' -e 's%/.*%/%'`term.h
+	cf_header_list="$cf_header_item $cf_header_list"
+	;;
+esac
+
+for cf_header in $cf_header_list
+do
+	cat >conftest.$ac_ext <<_ACEOF
+#line 12877 "configure"
+#include "confdefs.h"
+
+#include <${cf_cv_ncurses_header:-curses.h}>
+#include <${cf_header}>
+int
+main ()
+{
+WINDOW *x
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:12891: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:12894: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:12897: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:12900: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  cf_cv_term_header=$cf_header
+	 break
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+cf_cv_term_header=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+done
+
+case $cf_cv_term_header in #(vi
+no)
+	# If curses is ncurses, some packagers still mess it up by trying to make
+	# us use GNU termcap.  This handles the most common case.
+	for cf_header in ncurses/term.h ncursesw/term.h
+	do
+		cat >conftest.$ac_ext <<_ACEOF
+#line 12919 "configure"
+#include "confdefs.h"
+
+#include <${cf_cv_ncurses_header:-curses.h}>
+#ifdef NCURSES_VERSION
+#include <${cf_header}>
+#else
+make an error
+#endif
+int
+main ()
+{
+WINDOW *x
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:12937: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:12940: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:12268: \"$ac_try\"") >&5
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:12943: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:12271: \$? = $ac_status" >&5
+  echo "$as_me:12946: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  cf_cv_lib_XCurses=yes
+  cf_cv_term_header=$cf_header
+			 break
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-cf_cv_lib_XCurses=no
+cf_cv_term_header=no
 fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+rm -f conftest.$ac_objext conftest.$ac_ext
+	done
+	;;
+esac
 
 fi
-echo "$as_me:12282: result: $cf_cv_lib_XCurses" >&5
-echo "${ECHO_T}$cf_cv_lib_XCurses" >&6
+echo "$as_me:12961: result: $cf_cv_term_header" >&5
+echo "${ECHO_T}$cf_cv_term_header" >&6
 
-fi
+case $cf_cv_term_header in #(vi
+term.h) #(vi
 
-if test $cf_cv_lib_XCurses = yes ; then
-	cat >>confdefs.h <<\EOF
-#define UNIX 1
+cat >>confdefs.h <<\EOF
+#define HAVE_TERM_H 1
 EOF
 
-	cat >>confdefs.h <<\EOF
-#define XCURSES 1
-EOF
+	;;
+ncurses/term.h) #(vi
 
-	echo "$as_me:12296: checking for xcurses.h" >&5
-echo $ECHO_N "checking for xcurses.h... $ECHO_C" >&6
-if test "${ac_cv_header_xcurses_h+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-#line 12302 "configure"
-#include "confdefs.h"
-#include <xcurses.h>
-_ACEOF
-if { (eval echo "$as_me:12306: \"$ac_cpp conftest.$ac_ext\"") >&5
-  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
-  ac_status=$?
-  egrep -v '^ *\+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:12312: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null; then
-  if test -s conftest.err; then
-    ac_cpp_err=$ac_c_preproc_warn_flag
-  else
-    ac_cpp_err=
-  fi
-else
-  ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
-  ac_cv_header_xcurses_h=yes
-else
-  echo "$as_me: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  ac_cv_header_xcurses_h=no
-fi
-rm -f conftest.err conftest.$ac_ext
-fi
-echo "$as_me:12331: result: $ac_cv_header_xcurses_h" >&5
-echo "${ECHO_T}$ac_cv_header_xcurses_h" >&6
-if test $ac_cv_header_xcurses_h = yes; then
-  cat >>confdefs.h <<\EOF
-#define HAVE_XCURSES 1
+cat >>confdefs.h <<\EOF
+#define HAVE_NCURSES_TERM_H 1
 EOF
 
-fi
+	;;
+ncursesw/term.h)
 
-else
-	{ { echo "$as_me:12341: error: Cannot link with XCurses" >&5
-echo "$as_me: error: Cannot link with XCurses" >&2;}
-   { (exit 1); exit 1; }; }
-fi
+cat >>confdefs.h <<\EOF
+#define HAVE_NCURSESW_TERM_H 1
+EOF
 
 	;;
 esac
 
-case $cf_cv_screen in #(vi
-pdcurses) #(vi
-	;;
-*)
-	# look for curses-related libraries
-
-as_ac_Lib=`echo "ac_cv_lib_panel$cf_cv_libtype''_new_panel" | $as_tr_sh`
-echo "$as_me:12356: checking for new_panel in -lpanel$cf_cv_libtype" >&5
-echo $ECHO_N "checking for new_panel in -lpanel$cf_cv_libtype... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Lib+set}\" = set"; then
+echo "$as_me:12988: checking for unctrl.h" >&5
+echo $ECHO_N "checking for unctrl.h... $ECHO_C" >&6
+if test "${cf_cv_unctrl_header+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lpanel$cf_cv_libtype  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-#line 12364 "configure"
+
+# If we found <ncurses/curses.h>, look for <ncurses/unctrl.h>, but always look
+# for <unctrl.h> if we do not find the variant.
+
+cf_header_list="unctrl.h ncurses/unctrl.h ncursesw/unctrl.h"
+
+case ${cf_cv_ncurses_header:-curses.h} in #(vi
+*/*)
+	cf_header_item=`echo ${cf_cv_ncurses_header:-curses.h} | sed -e 's%\..*%%' -e 's%/.*%/%'`unctrl.h
+	cf_header_list="$cf_header_item $cf_header_list"
+	;;
+esac
+
+for cf_header in $cf_header_list
+do
+	cat >conftest.$ac_ext <<_ACEOF
+#line 13009 "configure"
 #include "confdefs.h"
 
-/* Override any gcc2 internal prototype to avoid an error.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
-char new_panel ();
+#include <${cf_cv_ncurses_header:-curses.h}>
+#include <${cf_header}>
 int
 main ()
 {
-new_panel ();
+WINDOW *x
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:12383: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:13023: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:12386: \$? = $ac_status" >&5
+  echo "$as_me:13026: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:12389: \"$ac_try\"") >&5
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:13029: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:12392: \$? = $ac_status" >&5
+  echo "$as_me:13032: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  eval "$as_ac_Lib=yes"
+  cf_cv_unctrl_header=$cf_header
+	 break
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-eval "$as_ac_Lib=no"
+cf_cv_unctrl_header=no
 fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
+rm -f conftest.$ac_objext conftest.$ac_ext
+done
+
+case $cf_cv_unctrl_header in #(vi
+no)
+	{ echo "$as_me:13046: WARNING: unctrl.h header not found" >&5
+echo "$as_me: WARNING: unctrl.h header not found" >&2;}
+	;;
+esac
+
 fi
-echo "$as_me:12403: result: `eval echo '${'$as_ac_Lib'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Lib'}'`" >&6
-if test `eval echo '${'$as_ac_Lib'}'` = yes; then
-  cat >>confdefs.h <<EOF
-#define `echo "HAVE_LIBpanel$cf_cv_libtype" | $as_tr_cpp` 1
+echo "$as_me:13052: result: $cf_cv_unctrl_header" >&5
+echo "${ECHO_T}$cf_cv_unctrl_header" >&6
+
+case $cf_cv_unctrl_header in #(vi
+unctrl.h) #(vi
+
+cat >>confdefs.h <<\EOF
+#define HAVE_UNCTRL_H 1
 EOF
 
-  LIBS="-lpanel$cf_cv_libtype $LIBS"
+	;;
+ncurses/unctrl.h) #(vi
 
-fi
+cat >>confdefs.h <<\EOF
+#define HAVE_NCURSES_UNCTRL_H 1
+EOF
 
-as_ac_Lib=`echo "ac_cv_lib_menu$cf_cv_libtype''_menu_driver" | $as_tr_sh`
-echo "$as_me:12415: checking for menu_driver in -lmenu$cf_cv_libtype" >&5
-echo $ECHO_N "checking for menu_driver in -lmenu$cf_cv_libtype... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Lib+set}\" = set"; then
+	;;
+ncursesw/unctrl.h)
+
+cat >>confdefs.h <<\EOF
+#define HAVE_NCURSESW_UNCTRL_H 1
+EOF
+
+	;;
+esac
+
+for cf_func in \
+assume_default_colors \
+chgat \
+color_set \
+filter \
+getbegx \
+getcurx \
+getmaxx \
+getnstr \
+getparx \
+getwin \
+mvvline \
+mvwvline \
+napms \
+putwin \
+resize_term \
+resizeterm \
+ripoffline \
+scr_dump \
+setupterm \
+slk_color \
+slk_init \
+termattrs \
+tgetent \
+tigetnum \
+tigetstr \
+typeahead \
+use_default_colors \
+use_screen \
+use_window \
+vsscanf \
+vw_printw \
+wchgat \
+winsstr \
+wresize \
+wsyncdown \
+
+do
+
+cf_tr_func=`echo "$cf_func" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
+
+	echo "$as_me:13120: checking for ${cf_func}" >&5
+echo $ECHO_N "checking for ${cf_func}... $ECHO_C" >&6
+
+echo "${as_me:-configure}:13123: testing ${cf_func} ..." 1>&5
+
+	if eval "test \"\${cf_cv_func_$cf_func+set}\" = set"; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lmenu$cf_cv_libtype  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-#line 12423 "configure"
+
+		eval cf_result='$ac_cv_func_'$cf_func
+		if test ".$cf_result" != ".no"; then
+			cat >conftest.$ac_ext <<_ACEOF
+#line 13132 "configure"
 #include "confdefs.h"
 
-/* Override any gcc2 internal prototype to avoid an error.  */
-#ifdef __cplusplus
-extern "C"
+#ifdef HAVE_XCURSES
+#include <xcurses.h>
+char * XCursesProgramName = "test";
+#else
+#include <${cf_cv_ncurses_header:-curses.h}>
+#if defined(NCURSES_VERSION) && defined(HAVE_NCURSESW_TERM_H)
+#include <ncursesw/term.h>
+#elif defined(NCURSES_VERSION) && defined(HAVE_NCURSES_TERM_H)
+#include <ncurses/term.h>
+#elif defined(HAVE_TERM_H)
+#include <term.h>
 #endif
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
-char menu_driver ();
+#endif
+
 int
 main ()
 {
-menu_driver ();
+
+#ifndef ${cf_func}
+long foo = (long)(&${cf_func});
+if (foo + 1234 > 5678)
+	${cf_cv_main_return:-return}(foo);
+#endif
+
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:12442: \"$ac_link\"") >&5
+if { (eval echo "$as_me:13164: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:12445: \$? = $ac_status" >&5
+  echo "$as_me:13167: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:12448: \"$ac_try\"") >&5
+  { (eval echo "$as_me:13170: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:12451: \$? = $ac_status" >&5
+  echo "$as_me:13173: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  eval "$as_ac_Lib=yes"
+  cf_result=yes
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-eval "$as_ac_Lib=no"
+cf_result=no
 fi
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
+		fi
+		eval 'cf_cv_func_'$cf_func'=$cf_result'
+
 fi
-echo "$as_me:12462: result: `eval echo '${'$as_ac_Lib'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Lib'}'`" >&6
-if test `eval echo '${'$as_ac_Lib'}'` = yes; then
-  cat >>confdefs.h <<EOF
-#define `echo "HAVE_LIBmenu$cf_cv_libtype" | $as_tr_cpp` 1
+
+	# use the computed/retrieved cache-value:
+	eval 'cf_result=$cf_cv_func_'$cf_func
+	echo "$as_me:13189: result: $cf_result" >&5
+echo "${ECHO_T}$cf_result" >&6
+	if test $cf_result != no; then
+		cat >>confdefs.h <<EOF
+#define HAVE_${cf_tr_func} 1
 EOF
 
-  LIBS="-lmenu$cf_cv_libtype $LIBS"
+	fi
+done
 
-fi
+for cf_func in tputs
+do
 
-as_ac_Lib=`echo "ac_cv_lib_form$cf_cv_libtype''_form_driver" | $as_tr_sh`
-echo "$as_me:12474: checking for form_driver in -lform$cf_cv_libtype" >&5
-echo $ECHO_N "checking for form_driver in -lform$cf_cv_libtype... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Lib+set}\" = set"; then
+cf_tr_func=`echo "$cf_func" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
+
+	echo "$as_me:13204: checking for ${cf_func}" >&5
+echo $ECHO_N "checking for ${cf_func}... $ECHO_C" >&6
+
+echo "${as_me:-configure}:13207: testing ${cf_func} ..." 1>&5
+
+	if eval "test \"\${cf_cv_func_$cf_func+set}\" = set"; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lform$cf_cv_libtype  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-#line 12482 "configure"
+
+		eval cf_result='$ac_cv_func_'$cf_func
+		if test ".$cf_result" != ".no"; then
+			cat >conftest.$ac_ext <<_ACEOF
+#line 13216 "configure"
 #include "confdefs.h"
 
-/* Override any gcc2 internal prototype to avoid an error.  */
-#ifdef __cplusplus
-extern "C"
+#ifdef HAVE_XCURSES
+#include <xcurses.h>
+char * XCursesProgramName = "test";
+#else
+#include <${cf_cv_ncurses_header:-curses.h}>
+#if defined(NCURSES_VERSION) && defined(HAVE_NCURSESW_TERM_H)
+#include <ncursesw/term.h>
+#elif defined(NCURSES_VERSION) && defined(HAVE_NCURSES_TERM_H)
+#include <ncurses/term.h>
+#elif defined(HAVE_TERM_H)
+#include <term.h>
 #endif
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
-char form_driver ();
+#endif
+
 int
 main ()
 {
-form_driver ();
+
+#ifndef ${cf_func}
+long foo = (long)(&${cf_func});
+if (foo + 1234 > 5678)
+	${cf_cv_main_return:-return}(foo);
+#endif
+
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:12501: \"$ac_link\"") >&5
+if { (eval echo "$as_me:13248: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:12504: \$? = $ac_status" >&5
+  echo "$as_me:13251: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:12507: \"$ac_try\"") >&5
+  { (eval echo "$as_me:13254: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:12510: \$? = $ac_status" >&5
+  echo "$as_me:13257: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  eval "$as_ac_Lib=yes"
+  cf_result=yes
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-eval "$as_ac_Lib=no"
+cf_result=no
 fi
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-echo "$as_me:12521: result: `eval echo '${'$as_ac_Lib'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Lib'}'`" >&6
-if test `eval echo '${'$as_ac_Lib'}'` = yes; then
-  cat >>confdefs.h <<EOF
-#define `echo "HAVE_LIBform$cf_cv_libtype" | $as_tr_cpp` 1
-EOF
-
-  LIBS="-lform$cf_cv_libtype $LIBS"
+		fi
+		eval 'cf_cv_func_'$cf_func'=$cf_result'
 
 fi
 
-	# look for curses-related headers
-
-for ac_header in \
-		nc_alloc.h \
-		nomacros.h \
-		form.h \
-		menu.h \
-		panel.h \
-		term_entry.h \
-
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-echo "$as_me:12544: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-#line 12550 "configure"
-#include "confdefs.h"
-#include <$ac_header>
-_ACEOF
-if { (eval echo "$as_me:12554: \"$ac_cpp conftest.$ac_ext\"") >&5
-  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
-  ac_status=$?
-  egrep -v '^ *\+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:12560: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null; then
-  if test -s conftest.err; then
-    ac_cpp_err=$ac_c_preproc_warn_flag
-  else
-    ac_cpp_err=
-  fi
-else
-  ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
-  eval "$as_ac_Header=yes"
-else
-  echo "$as_me: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  eval "$as_ac_Header=no"
-fi
-rm -f conftest.err conftest.$ac_ext
-fi
-echo "$as_me:12579: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  cat >>confdefs.h <<EOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+	# use the computed/retrieved cache-value:
+	eval 'cf_result=$cf_cv_func_'$cf_func
+	echo "$as_me:13273: result: $cf_result" >&5
+echo "${ECHO_T}$cf_result" >&6
+	if test $cf_result != no; then
+		cat >>confdefs.h <<EOF
+#define HAVE_${cf_tr_func} 1
 EOF
 
-fi
+	fi
 done
 
-	;;
-esac
-
-echo "$as_me:12592: checking return type of signal handlers" >&5
-echo $ECHO_N "checking return type of signal handlers... $ECHO_C" >&6
-if test "${ac_cv_type_signal+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-#line 12598 "configure"
+if test x$cf_cv_func_tputs = xyes
+then
+	cf_done=no
+	for cf_arg in int char
+	do
+		for cf_ret in int void
+		do
+			if test $cf_ret = void
+			then
+				cf_return="/* nothing */"
+			else
+				cf_return="return value"
+			fi
+			cat >conftest.$ac_ext <<_ACEOF
+#line 13297 "configure"
 #include "confdefs.h"
-#include <sys/types.h>
-#include <signal.h>
-#ifdef signal
-# undef signal
-#endif
-#ifdef __cplusplus
-extern "C" void (*signal (int, void (*)(int)))(int);
-#else
-void (*signal ()) ();
-#endif
+
+#include <${cf_cv_ncurses_header:-curses.h}>
+#include <$cf_cv_term_header>
+
+static $cf_ret outc($cf_arg value) { $cf_return; }
 
 int
 main ()
 {
-int i;
+
+	tputs("hello", 0, outc);
+	${cf_cv_main_return:-return}(0);
+
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:12620: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:13317: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:12623: \$? = $ac_status" >&5
+  echo "$as_me:13320: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:12626: \"$ac_try\"") >&5
+  { (eval echo "$as_me:13323: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:12629: \$? = $ac_status" >&5
+  echo "$as_me:13326: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_type_signal=void
+
+		test -n "$verbose" && echo "	prototype $cf_ret func($cf_arg value)" 1>&6
+
+echo "${as_me:-configure}:13331: testing prototype $cf_ret func($cf_arg value) ..." 1>&5
+
+		cat >>confdefs.h <<EOF
+#define TPUTS_ARG               $cf_arg
+#define TPUTS_PROTO(func,value) $cf_ret func(TPUTS_ARG value)
+#define TPUTS_RETURN(value)     $cf_return
+EOF
+		cf_done=yes
+		break
+
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-ac_cv_type_signal=int
 fi
 rm -f conftest.$ac_objext conftest.$ac_ext
+		done
+		test $cf_done = yes && break
+	done
 fi
-echo "$as_me:12639: result: $ac_cv_type_signal" >&5
-echo "${ECHO_T}$ac_cv_type_signal" >&6
 
-cat >>confdefs.h <<EOF
-#define RETSIGTYPE $ac_cv_type_signal
-EOF
-
-echo "$as_me:12646: checking for ANSI C header files" >&5
-echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6
-if test "${ac_cv_header_stdc+set}" = set; then
+echo "$as_me:13351: checking for ncurses extended functions" >&5
+echo $ECHO_N "checking for ncurses extended functions... $ECHO_C" >&6
+if test "${cf_cv_ncurses_ext_funcs+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
-#line 12652 "configure"
-#include "confdefs.h"
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <float.h>
-
-_ACEOF
-if { (eval echo "$as_me:12660: \"$ac_cpp conftest.$ac_ext\"") >&5
-  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
-  ac_status=$?
-  egrep -v '^ *\+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:12666: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null; then
-  if test -s conftest.err; then
-    ac_cpp_err=$ac_c_preproc_warn_flag
-  else
-    ac_cpp_err=
-  fi
-else
-  ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
-  ac_cv_header_stdc=yes
-else
-  echo "$as_me: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  ac_cv_header_stdc=no
-fi
-rm -f conftest.err conftest.$ac_ext
 
-if test $ac_cv_header_stdc = yes; then
-  # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
-  cat >conftest.$ac_ext <<_ACEOF
-#line 12688 "configure"
+cat >conftest.$ac_ext <<_ACEOF
+#line 13358 "configure"
 #include "confdefs.h"
-#include <string.h>
-
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  egrep "memchr" >/dev/null 2>&1; then
-  :
-else
-  ac_cv_header_stdc=no
-fi
-rm -rf conftest*
 
-fi
+#include <${cf_cv_ncurses_header:-curses.h}>
+int
+main ()
+{
 
-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 <<_ACEOF
-#line 12706 "configure"
-#include "confdefs.h"
-#include <stdlib.h>
+int x = NCURSES_EXT_FUNCS
 
+  ;
+  return 0;
+}
 _ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  egrep "free" >/dev/null 2>&1; then
-  :
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:13373: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:13376: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:13379: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:13382: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  cf_cv_ncurses_ext_funcs=defined
 else
-  ac_cv_header_stdc=no
-fi
-rm -rf conftest*
-
-fi
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
 
-if test $ac_cv_header_stdc = yes; then
-  # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
-  if test "$cross_compiling" = yes; then
-  :
-else
-  cat >conftest.$ac_ext <<_ACEOF
-#line 12727 "configure"
+cat >conftest.$ac_ext <<_ACEOF
+#line 13390 "configure"
 #include "confdefs.h"
-#include <ctype.h>
-#if ((' ' & 0x0FF) == 0x020)
-# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
-# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
-#else
-# define ISLOWER(c) (('a' <= (c) && (c) <= 'i') \
-                     || ('j' <= (c) && (c) <= 'r') \
-                     || ('s' <= (c) && (c) <= 'z'))
-# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
-#endif
 
-#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+#include <${cf_cv_ncurses_header:-curses.h}>
 int
 main ()
 {
-  int i;
-  for (i = 0; i < 256; i++)
-    if (XOR (islower (i), ISLOWER (i))
-        || toupper (i) != TOUPPER (i))
-      $ac_main_return(2);
-  $ac_main_return (0);
+
+	(void) assume_default_colors (0, 0);
+	(void) curses_version ();
+	(void) define_key (0, 0);
+	(void) is_term_resized (0, 0);
+	(void) key_defined (0);
+	(void) keybound (0, 0);
+	(void) keyok (0, 0);
+	(void) resize_term (0, 0);
+	(void) resizeterm (0, 0);
+	(void) use_default_colors ();
+	(void) use_extended_names (0);
+	(void) wresize (0, 0, 0);
+  ;
+  return 0;
 }
 _ACEOF
-rm -f conftest$ac_exeext
-if { (eval echo "$as_me:12753: \"$ac_link\"") >&5
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:13415: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:12756: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (eval echo "$as_me:12758: \"$ac_try\"") >&5
+  echo "$as_me:13418: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:13421: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:12761: \$? = $ac_status" >&5
+  echo "$as_me:13424: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  :
+  cf_cv_ncurses_ext_funcs=yes
 else
-  echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
+  echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-ac_cv_header_stdc=no
-fi
-rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
+cf_cv_ncurses_ext_funcs=no
 fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+
 fi
-echo "$as_me:12774: result: $ac_cv_header_stdc" >&5
-echo "${ECHO_T}$ac_cv_header_stdc" >&6
-if test $ac_cv_header_stdc = yes; then
+rm -f conftest.$ac_objext conftest.$ac_ext
 
+fi
+echo "$as_me:13438: result: $cf_cv_ncurses_ext_funcs" >&5
+echo "${ECHO_T}$cf_cv_ncurses_ext_funcs" >&6
+test "$cf_cv_ncurses_ext_funcs" = yes &&
 cat >>confdefs.h <<\EOF
-#define STDC_HEADERS 1
+#define NCURSES_EXT_FUNCS 1
 EOF
 
-fi
+if test "$cf_enable_widec" = yes
+then
+	# workaround for systems with ncurses before 20111029, due to change of
+	# feature test macro from _XPG5 to _XOPEN_SOURCE
+	if test -n "$cf_cv_ncurses_version" && test "x$cf_cv_ncurses_version" != xno
+	then
+		cf_define_xpg5=no
+		echo "$as_me:13452: checking if _XPG5 should be defined to enable wide-characters" >&5
+echo $ECHO_N "checking if _XPG5 should be defined to enable wide-characters... $ECHO_C" >&6
 
-echo "$as_me:12784: checking whether time.h and sys/time.h may both be included" >&5
-echo $ECHO_N "checking whether time.h and sys/time.h may both be included... $ECHO_C" >&6
-if test "${ac_cv_header_time+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-#line 12790 "configure"
+		cat >conftest.$ac_ext <<_ACEOF
+#line 13456 "configure"
 #include "confdefs.h"
-#include <sys/types.h>
-#include <sys/time.h>
-#include <time.h>
 
+#include <${cf_cv_ncurses_header:-curses.h}>
 int
 main ()
 {
-if ((struct tm *) 0)
-return 0;
+int x = _XPG5
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:12806: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:13469: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:12809: \$? = $ac_status" >&5
+  echo "$as_me:13472: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:12812: \"$ac_try\"") >&5
+  { (eval echo "$as_me:13475: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:12815: \$? = $ac_status" >&5
+  echo "$as_me:13478: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_header_time=yes
+  :
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-ac_cv_header_time=no
-fi
-rm -f conftest.$ac_objext conftest.$ac_ext
-fi
-echo "$as_me:12825: result: $ac_cv_header_time" >&5
-echo "${ECHO_T}$ac_cv_header_time" >&6
-if test $ac_cv_header_time = yes; then
-
-cat >>confdefs.h <<\EOF
-#define TIME_WITH_SYS_TIME 1
-EOF
-
-fi
-
-for ac_header in \
-getopt.h \
-locale.h \
-math.h \
-stdarg.h \
-sys/ioctl.h \
-sys/select.h \
-sys/time.h \
-termios.h \
-unistd.h \
-
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-echo "$as_me:12848: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-#line 12854 "configure"
-#include "confdefs.h"
-#include <$ac_header>
-_ACEOF
-if { (eval echo "$as_me:12858: \"$ac_cpp conftest.$ac_ext\"") >&5
-  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
-  ac_status=$?
-  egrep -v '^ *\+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:12864: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null; then
-  if test -s conftest.err; then
-    ac_cpp_err=$ac_c_preproc_warn_flag
-  else
-    ac_cpp_err=
-  fi
-else
-  ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
-  eval "$as_ac_Header=yes"
-else
-  echo "$as_me: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  eval "$as_ac_Header=no"
-fi
-rm -f conftest.err conftest.$ac_ext
-fi
-echo "$as_me:12883: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  cat >>confdefs.h <<EOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-EOF
-
-fi
-done
-
-for ac_func in \
-gettimeofday \
-mblen \
-mbrlen \
-mbrtowc \
-mbsrtowcs \
-mbstowcs \
-mbtowc \
-strdup \
-wcsrtombs \
-wcstombs \
-
-do
-as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
-echo "$as_me:12907: checking for $ac_func" >&5
-echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
-if eval "test \"\${$as_ac_var+set}\" = set"; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-#line 12913 "configure"
+cf_save_cppflags="$CPPFLAGS"
+			 CPPFLAGS="$CPPFLAGS -D_XPG5"
+			 cat >conftest.$ac_ext <<_ACEOF
+#line 13487 "configure"
 #include "confdefs.h"
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func (); below.  */
-#include <assert.h>
-/* Override any gcc2 internal prototype to avoid an error.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
-char $ac_func ();
-char (*f) ();
 
+#include <${cf_cv_ncurses_header:-curses.h}>
 int
 main ()
 {
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
-choke me
-#else
-f = $ac_func;
-#endif
-
+int x = _XPG5
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:12944: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:13500: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:12947: \$? = $ac_status" >&5
+  echo "$as_me:13503: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:12950: \"$ac_try\"") >&5
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:13506: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:12953: \$? = $ac_status" >&5
+  echo "$as_me:13509: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  eval "$as_ac_var=yes"
+  cf_define_xpg5=yes
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-eval "$as_ac_var=no"
 fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+rm -f conftest.$ac_objext conftest.$ac_ext
+			 CPPFLAGS="$cf_save_cppflags"
 fi
-echo "$as_me:12963: result: `eval echo '${'$as_ac_var'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
-if test `eval echo '${'$as_ac_var'}'` = yes; then
-  cat >>confdefs.h <<EOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
-EOF
+rm -f conftest.$ac_objext conftest.$ac_ext
+		echo "$as_me:13520: result: $cf_define_xpg5" >&5
+echo "${ECHO_T}$cf_define_xpg5" >&6
 
-fi
-done
+		if test "$cf_define_xpg5" = yes
+		then
+			CPPFLAGS="$CPPFLAGS -D_XPG5"
+		fi
+	fi
 
-echo "$as_me:12973: checking if we must define _XOPEN_SOURCE_EXTENDED" >&5
-echo $ECHO_N "checking if we must define _XOPEN_SOURCE_EXTENDED... $ECHO_C" >&6
-if test "${cf_cv_need_xopen_extension+set}" = set; then
+	echo "$as_me:13529: checking for wide-character functions" >&5
+echo $ECHO_N "checking for wide-character functions... $ECHO_C" >&6
+if test "${cf_cv_widechar_funcs+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
 
-cat >conftest.$ac_ext <<_ACEOF
-#line 12980 "configure"
+	cat >conftest.$ac_ext <<_ACEOF
+#line 13536 "configure"
 #include "confdefs.h"
 
-#include <stdlib.h>
 #include <${cf_cv_ncurses_header:-curses.h}>
 int
 main ()
 {
 
-#if defined(NCURSES_VERSION_PATCH)
-#if (NCURSES_VERSION_PATCH < 20100501) && (NCURSES_VERSION_PATCH >= 20100403)
-	make an error
-#endif
-#endif
-	long x = winnstr(stdscr, "", 0);
-	int x1, y1;
-	getbegyx(stdscr, y1, x1)
+		static wchar_t src_wchar[2];
+		static cchar_t dst_cchar;
+		setcchar(&dst_cchar, src_wchar, A_NORMAL, 0, (void *) 0);
+
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:13002: \"$ac_link\"") >&5
+if { (eval echo "$as_me:13553: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:13005: \$? = $ac_status" >&5
+  echo "$as_me:13556: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:13008: \"$ac_try\"") >&5
+  { (eval echo "$as_me:13559: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:13011: \$? = $ac_status" >&5
+  echo "$as_me:13562: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  cf_cv_need_xopen_extension=no
+  cf_cv_widechar_funcs=yes
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
+cf_cv_widechar_funcs=no
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+
+fi
+echo "$as_me:13573: result: $cf_cv_widechar_funcs" >&5
+echo "${ECHO_T}$cf_cv_widechar_funcs" >&6
+	if test "$cf_cv_widechar_funcs" != no ; then
+
+cat >>confdefs.h <<\EOF
+#define USE_WIDEC_SUPPORT 1
+EOF
+
+	else
+		cat >>confdefs.h <<\EOF
+#define USE_WIDEC_SUPPORT 0
+EOF
+
+	fi
+else
+	cat >>confdefs.h <<\EOF
+#define USE_WIDEC_SUPPORT 0
+EOF
+
+fi
+
+echo "$as_me:13594: checking if sys/time.h works with sys/select.h" >&5
+echo $ECHO_N "checking if sys/time.h works with sys/select.h... $ECHO_C" >&6
+if test "${cf_cv_sys_time_select+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
 cat >conftest.$ac_ext <<_ACEOF
-#line 13018 "configure"
+#line 13601 "configure"
 #include "confdefs.h"
 
-#define _XOPEN_SOURCE_EXTENDED
-#include <stdlib.h>
-#include <${cf_cv_ncurses_header:-curses.h}>
+#include <sys/types.h>
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+#ifdef HAVE_SYS_SELECT_H
+#include <sys/select.h>
+#endif
+
 int
 main ()
 {
 
-#ifdef NCURSES_VERSION
-	cchar_t check;
-	int check2 = curs_set((int)sizeof(check));
-#endif
-	long x = winnstr(stdscr, "", 0);
-	int x1, y1;
-	getbegyx(stdscr, y1, x1)
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:13040: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:13621: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:13043: \$? = $ac_status" >&5
+  echo "$as_me:13624: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:13046: \"$ac_try\"") >&5
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:13627: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:13049: \$? = $ac_status" >&5
+  echo "$as_me:13630: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  cf_cv_need_xopen_extension=yes
+  cf_cv_sys_time_select=yes
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-cf_cv_need_xopen_extension=unknown
-fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+cf_cv_sys_time_select=no
 fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+rm -f conftest.$ac_objext conftest.$ac_ext
+
 fi
-echo "$as_me:13061: result: $cf_cv_need_xopen_extension" >&5
-echo "${ECHO_T}$cf_cv_need_xopen_extension" >&6
-test $cf_cv_need_xopen_extension = yes && CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE_EXTENDED"
 
-echo "$as_me:13065: checking for term.h" >&5
-echo $ECHO_N "checking for term.h... $ECHO_C" >&6
-if test "${cf_cv_term_header+set}" = set; then
+echo "$as_me:13642: result: $cf_cv_sys_time_select" >&5
+echo "${ECHO_T}$cf_cv_sys_time_select" >&6
+test "$cf_cv_sys_time_select" = yes &&
+cat >>confdefs.h <<\EOF
+#define HAVE_SYS_TIME_SELECT 1
+EOF
+
+echo "$as_me:13649: checking for function curses_version" >&5
+echo $ECHO_N "checking for function curses_version... $ECHO_C" >&6
+if test "${cf_cv_func_curses_version+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
 
-# If we found <ncurses/curses.h>, look for <ncurses/term.h>, but always look
-# for <term.h> if we do not find the variant.
-for cf_header in \
-	`echo ${cf_cv_ncurses_header:-curses.h} | sed -e 's%/.*%/%'`term.h \
-	term.h
-do
-	cat >conftest.$ac_ext <<_ACEOF
-#line 13078 "configure"
+if test "$cross_compiling" = yes; then
+  cf_cv_func_curses_version=unknown
+else
+  cat >conftest.$ac_ext <<_ACEOF
+#line 13659 "configure"
 #include "confdefs.h"
 
 #include <${cf_cv_ncurses_header:-curses.h}>
-#include <${cf_header}>
-int
-main ()
+int main()
 {
-WINDOW *x
-  ;
-  return 0;
+	char temp[1024];
+	sprintf(temp, "%s\n", curses_version());
+	${cf_cv_main_return:-return}(0);
 }
+
 _ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:13092: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:13672: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:13095: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:13098: \"$ac_try\"") >&5
+  echo "$as_me:13675: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (eval echo "$as_me:13677: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:13101: \$? = $ac_status" >&5
+  echo "$as_me:13680: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  cf_cv_term_header=$cf_header
-	 break
+  cf_cv_func_curses_version=yes
+
 else
-  echo "$as_me: failed program was:" >&5
+  echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-cf_cv_term_header=no
+cf_cv_func_curses_version=no
+
 fi
-rm -f conftest.$ac_objext conftest.$ac_ext
-done
+rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core
+fi
+echo "$as_me:13695: result: $cf_cv_func_curses_version" >&5
+echo "${ECHO_T}$cf_cv_func_curses_version" >&6
+test "$cf_cv_func_curses_version" = yes &&
+cat >>confdefs.h <<\EOF
+#define HAVE_CURSES_VERSION 1
+EOF
 
-case $cf_cv_term_header in #(vi
-no)
-	# If curses is ncurses, some packagers still mess it up by trying to make
-	# us use GNU termcap.  This handles the most common case.
-	for cf_header in ncurses/term.h ncursesw/term.h
-	do
-		cat >conftest.$ac_ext <<_ACEOF
-#line 13120 "configure"
+echo "$as_me:13702: checking for alternate character set array" >&5
+echo $ECHO_N "checking for alternate character set array... $ECHO_C" >&6
+if test "${cf_cv_curses_acs_map+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+cf_cv_curses_acs_map=unknown
+for name in acs_map _acs_map __acs_map ${NCURSES_WRAP_PREFIX}acs_map
+do
+cat >conftest.$ac_ext <<_ACEOF
+#line 13712 "configure"
 #include "confdefs.h"
 
 #include <${cf_cv_ncurses_header:-curses.h}>
-#ifdef NCURSES_VERSION
-#include <${cf_header}>
-#else
-make an error
-#endif
+
 int
 main ()
 {
-WINDOW *x
+
+$name['k'] = ACS_PLUS
+
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:13138: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:13728: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:13141: \$? = $ac_status" >&5
+  echo "$as_me:13731: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:13144: \"$ac_try\"") >&5
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:13734: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:13147: \$? = $ac_status" >&5
+  echo "$as_me:13737: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  cf_cv_term_header=$cf_header
-			 break
+  cf_cv_curses_acs_map=$name; break
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-cf_cv_term_header=no
 fi
-rm -f conftest.$ac_objext conftest.$ac_ext
-	done
-	;;
-esac
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+done
 
 fi
-echo "$as_me:13162: result: $cf_cv_term_header" >&5
-echo "${ECHO_T}$cf_cv_term_header" >&6
-
-case $cf_cv_term_header in #(vi
-term.h) #(vi
-	cat >>confdefs.h <<\EOF
-#define HAVE_TERM_H 1
-EOF
-
-	;;
-ncurses/term.h) #(vi
-	cat >>confdefs.h <<\EOF
-#define HAVE_NCURSES_TERM_H 1
-EOF
+echo "$as_me:13748: result: $cf_cv_curses_acs_map" >&5
+echo "${ECHO_T}$cf_cv_curses_acs_map" >&6
 
-	;;
-ncursesw/term.h)
-	cat >>confdefs.h <<\EOF
-#define HAVE_NCURSESW_TERM_H 1
+test "$cf_cv_curses_acs_map" != unknown &&
+cat >>confdefs.h <<EOF
+#define CURSES_ACS_ARRAY $cf_cv_curses_acs_map
 EOF
 
-	;;
-esac
-
-for cf_func in \
-chgat \
-color_set \
-filter \
-getbegx \
-getcurx \
-getmaxx \
-getnstr \
-getparx \
-getwin \
-mvvline \
-mvwvline \
-napms \
-putwin \
-resize_term \
-resizeterm \
-ripoffline \
-scr_dump \
-setupterm \
-slk_color \
-slk_init \
-termattrs \
-tgetent \
-tigetnum \
-tigetstr \
-typeahead \
-use_default_colors \
-vw_printw \
-vsscanf \
-wchgat \
-winsstr \
-wresize \
-wsyncdown \
-
-do
-
-cf_tr_func=`echo "$cf_func" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
-
-	echo "$as_me:13224: checking for ${cf_func}" >&5
-echo $ECHO_N "checking for ${cf_func}... $ECHO_C" >&6
-
-echo "${as_me:-configure}:13227: testing ${cf_func} ..." 1>&5
+if test "$cf_enable_widec" = yes; then
 
-	if eval "test \"\${cf_cv_func_$cf_func+set}\" = set"; then
+echo "$as_me:13758: checking for wide alternate character set array" >&5
+echo $ECHO_N "checking for wide alternate character set array... $ECHO_C" >&6
+if test "${cf_cv_curses_wacs_map+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
 
-		eval cf_result='$ac_cv_func_'$cf_func
-		if test ".$cf_result" != ".no"; then
-			cat >conftest.$ac_ext <<_ACEOF
-#line 13236 "configure"
+	cf_cv_curses_wacs_map=unknown
+	for name in wacs_map _wacs_map __wacs_map _nc_wacs _wacs_char
+	do
+	cat >conftest.$ac_ext <<_ACEOF
+#line 13768 "configure"
 #include "confdefs.h"
 
-#ifdef HAVE_XCURSES
-#include <xcurses.h>
-char * XCursesProgramName = "test";
-#else
-#include <${cf_cv_ncurses_header:-curses.h}>
-#if defined(NCURSES_VERSION) && defined(HAVE_NCURSESW_TERM_H)
-#include <ncursesw/term.h>
-#elif defined(NCURSES_VERSION) && defined(HAVE_NCURSES_TERM_H)
-#include <ncurses/term.h>
-#elif defined(HAVE_TERM_H)
-#include <term.h>
-#endif
+#ifndef _XOPEN_SOURCE_EXTENDED
+#define _XOPEN_SOURCE_EXTENDED
 #endif
-
+#include <${cf_cv_ncurses_header:-curses.h}>
 int
 main ()
 {
-
-#ifndef ${cf_func}
-long foo = (long)(&${cf_func});
-${cf_cv_main_return:-return}(foo == 0);
-#endif
-
+void *foo = &($name['k'])
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:13267: \"$ac_link\"") >&5
+if { (eval echo "$as_me:13784: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:13270: \$? = $ac_status" >&5
+  echo "$as_me:13787: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:13273: \"$ac_try\"") >&5
+  { (eval echo "$as_me:13790: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:13276: \$? = $ac_status" >&5
+  echo "$as_me:13793: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  cf_result=yes
+  cf_cv_curses_wacs_map=$name
+	 break
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-cf_result=no
 fi
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
-		fi
-		eval 'cf_cv_func_'$cf_func'=$cf_result'
-
+	done
 fi
+echo "$as_me:13804: result: $cf_cv_curses_wacs_map" >&5
+echo "${ECHO_T}$cf_cv_curses_wacs_map" >&6
 
-	# use the computed/retrieved cache-value:
-	eval 'cf_result=$cf_cv_func_'$cf_func
-	echo "$as_me:13292: result: $cf_result" >&5
-echo "${ECHO_T}$cf_result" >&6
-	if test $cf_result != no; then
-		cat >>confdefs.h <<EOF
-#define HAVE_${cf_tr_func} 1
+test "$cf_cv_curses_wacs_map" != unknown &&
+cat >>confdefs.h <<EOF
+#define CURSES_WACS_ARRAY $cf_cv_curses_wacs_map
 EOF
 
-	fi
-done
-
-echo "$as_me:13302: checking for ncurses extended functions" >&5
-echo $ECHO_N "checking for ncurses extended functions... $ECHO_C" >&6
-if test "${cf_cv_ncurses_ext_funcs+set}" = set; then
+echo "$as_me:13812: checking for wide alternate character constants" >&5
+echo $ECHO_N "checking for wide alternate character constants... $ECHO_C" >&6
+if test "${cf_cv_curses_wacs_symbols+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
 
-cat >conftest.$ac_ext <<_ACEOF
-#line 13309 "configure"
+cf_cv_curses_wacs_symbols=no
+if test "$cf_cv_curses_wacs_map" != unknown
+then
+	cat >conftest.$ac_ext <<_ACEOF
+#line 13822 "configure"
 #include "confdefs.h"
 
+#ifndef _XOPEN_SOURCE_EXTENDED
+#define _XOPEN_SOURCE_EXTENDED
+#endif
 #include <${cf_cv_ncurses_header:-curses.h}>
 int
 main ()
 {
-
-int x = NCURSES_EXT_FUNCS
-
+cchar_t *foo = WACS_PLUS;
+	 $cf_cv_curses_wacs_map['k'] = *WACS_PLUS
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:13324: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:13839: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:13327: \$? = $ac_status" >&5
+  echo "$as_me:13842: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:13330: \"$ac_try\"") >&5
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:13845: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:13333: \$? = $ac_status" >&5
+  echo "$as_me:13848: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  cf_cv_ncurses_ext_funcs=defined
+  cf_cv_curses_wacs_symbols=yes
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-
-cat >conftest.$ac_ext <<_ACEOF
-#line 13341 "configure"
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+else
+	cat >conftest.$ac_ext <<_ACEOF
+#line 13858 "configure"
 #include "confdefs.h"
 
+#ifndef _XOPEN_SOURCE_EXTENDED
+#define _XOPEN_SOURCE_EXTENDED
+#endif
 #include <${cf_cv_ncurses_header:-curses.h}>
 int
 main ()
 {
-
-	(void) assume_default_colors (0, 0);
-	(void) curses_version ();
-	(void) define_key (0, 0);
-	(void) is_term_resized (0, 0);
-	(void) key_defined (0);
-	(void) keybound (0, 0);
-	(void) keyok (0, 0);
-	(void) resize_term (0, 0);
-	(void) resizeterm (0, 0);
-	(void) use_default_colors ();
-	(void) use_extended_names (0);
-	(void) wresize (0, 0, 0);
+cchar_t *foo = WACS_PLUS
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:13366: \"$ac_link\"") >&5
+if { (eval echo "$as_me:13874: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:13369: \$? = $ac_status" >&5
+  echo "$as_me:13877: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:13372: \"$ac_try\"") >&5
+  { (eval echo "$as_me:13880: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:13375: \$? = $ac_status" >&5
+  echo "$as_me:13883: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  cf_cv_ncurses_ext_funcs=yes
+  cf_cv_curses_wacs_symbols=yes
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-cf_cv_ncurses_ext_funcs=no
 fi
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
-
 fi
-rm -f conftest.$ac_objext conftest.$ac_ext
 
 fi
-echo "$as_me:13389: result: $cf_cv_ncurses_ext_funcs" >&5
-echo "${ECHO_T}$cf_cv_ncurses_ext_funcs" >&6
-test "$cf_cv_ncurses_ext_funcs" = yes && cat >>confdefs.h <<\EOF
-#define NCURSES_EXT_FUNCS 1
+echo "$as_me:13894: result: $cf_cv_curses_wacs_symbols" >&5
+echo "${ECHO_T}$cf_cv_curses_wacs_symbols" >&6
+
+test "$cf_cv_curses_wacs_symbols" != no &&
+cat >>confdefs.h <<\EOF
+#define CURSES_WACS_SYMBOLS 1
 EOF
 
-echo "$as_me:13395: checking for wide-character functions" >&5
-echo $ECHO_N "checking for wide-character functions... $ECHO_C" >&6
-if test "${cf_cv_widechar_funcs+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
+fi
 
+echo "$as_me:13904: checking for type attr_t in ${cf_cv_ncurses_header:-curses.h}" >&5
+echo $ECHO_N "checking for type attr_t in ${cf_cv_ncurses_header:-curses.h}... $ECHO_C" >&6
 cat >conftest.$ac_ext <<_ACEOF
-#line 13402 "configure"
+#line 13907 "configure"
 #include "confdefs.h"
 
+#ifndef _XOPEN_SOURCE_EXTENDED
+#define _XOPEN_SOURCE_EXTENDED
+#endif
 #include <${cf_cv_ncurses_header:-curses.h}>
 int
 main ()
 {
 
-	static wchar_t src_wchar[2];
-	static cchar_t dst_cchar;
-	setcchar(&dst_cchar, src_wchar, A_NORMAL, 0, (void *) 0);
+attr_t foo
 
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:13419: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:13925: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:13422: \$? = $ac_status" >&5
+  echo "$as_me:13928: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:13425: \"$ac_try\"") >&5
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:13931: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:13428: \$? = $ac_status" >&5
+  echo "$as_me:13934: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  cf_cv_widechar_funcs=yes
+  cf_result=yes
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-cf_cv_widechar_funcs=no
+cf_result=no
 fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+rm -f conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:13943: result: $cf_result" >&5
+echo "${ECHO_T}$cf_result" >&6
+if test $cf_result = yes ; then
 
-fi
-echo "$as_me:13439: result: $cf_cv_widechar_funcs" >&5
-echo "${ECHO_T}$cf_cv_widechar_funcs" >&6
-if test "$cf_cv_widechar_funcs" != no ; then
-	cat >>confdefs.h <<\EOF
-#define USE_WIDEC_SUPPORT 1
+cf_result=`echo "have_type_attr_t" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
+
+cat >>confdefs.h <<EOF
+#define $cf_result 1
 EOF
 
 else
-	cat >>confdefs.h <<\EOF
-#define USE_WIDEC_SUPPORT 0
+
+cat >>confdefs.h <<EOF
+#define attr_t long
 EOF
 
 fi
 
-# On IRIX 5.3, sys/types and inttypes.h are conflicting.
+if test "$cf_enable_widec" = yes; then
 
-for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
-                  inttypes.h stdint.h unistd.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-echo "$as_me:13459: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
+# This is needed on Tru64 5.0 to declare mbstate_t
+echo "$as_me:13964: checking if we must include wchar.h to declare mbstate_t" >&5
+echo $ECHO_N "checking if we must include wchar.h to declare mbstate_t... $ECHO_C" >&6
+if test "${cf_cv_mbstate_t+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
-#line 13465 "configure"
+
+cat >conftest.$ac_ext <<_ACEOF
+#line 13971 "configure"
 #include "confdefs.h"
-$ac_includes_default
-#include <$ac_header>
+
+#include <stdlib.h>
+#include <stdarg.h>
+#include <stdio.h>
+#ifdef HAVE_LIBUTF8_H
+#include <libutf8.h>
+#endif
+int
+main ()
+{
+mbstate_t state
+  ;
+  return 0;
+}
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:13471: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:13989: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:13474: \$? = $ac_status" >&5
+  echo "$as_me:13992: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:13477: \"$ac_try\"") >&5
+  { (eval echo "$as_me:13995: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:13480: \$? = $ac_status" >&5
+  echo "$as_me:13998: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  eval "$as_ac_Header=yes"
+  cf_cv_mbstate_t=no
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-eval "$as_ac_Header=no"
-fi
-rm -f conftest.$ac_objext conftest.$ac_ext
-fi
-echo "$as_me:13490: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  cat >>confdefs.h <<EOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-EOF
-
-fi
-done
-
-echo "$as_me:13500: checking for pid_t" >&5
-echo $ECHO_N "checking for pid_t... $ECHO_C" >&6
-if test "${ac_cv_type_pid_t+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-#line 13506 "configure"
+cat >conftest.$ac_ext <<_ACEOF
+#line 14005 "configure"
 #include "confdefs.h"
-$ac_includes_default
+
+#include <stdlib.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <wchar.h>
+#ifdef HAVE_LIBUTF8_H
+#include <libutf8.h>
+#endif
 int
 main ()
 {
-if ((pid_t *) 0)
-  return 0;
-if (sizeof (pid_t))
-  return 0;
+mbstate_t value
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:13521: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:14024: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:13524: \$? = $ac_status" >&5
+  echo "$as_me:14027: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:13527: \"$ac_try\"") >&5
+  { (eval echo "$as_me:14030: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:13530: \$? = $ac_status" >&5
+  echo "$as_me:14033: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_type_pid_t=yes
+  cf_cv_mbstate_t=yes
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-ac_cv_type_pid_t=no
+cf_cv_mbstate_t=unknown
 fi
 rm -f conftest.$ac_objext conftest.$ac_ext
 fi
-echo "$as_me:13540: result: $ac_cv_type_pid_t" >&5
-echo "${ECHO_T}$ac_cv_type_pid_t" >&6
-if test $ac_cv_type_pid_t = yes; then
-  :
-else
+rm -f conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:14045: result: $cf_cv_mbstate_t" >&5
+echo "${ECHO_T}$cf_cv_mbstate_t" >&6
 
-cat >>confdefs.h <<EOF
-#define pid_t int
+if test "$cf_cv_mbstate_t" = yes ; then
+
+cat >>confdefs.h <<\EOF
+#define NEED_WCHAR_H 1
 EOF
 
+	NEED_WCHAR_H=1
 fi
 
-for ac_header in unistd.h vfork.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-echo "$as_me:13555: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-#line 13561 "configure"
-#include "confdefs.h"
-#include <$ac_header>
-_ACEOF
-if { (eval echo "$as_me:13565: \"$ac_cpp conftest.$ac_ext\"") >&5
-  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
-  ac_status=$?
-  egrep -v '^ *\+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:13571: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null; then
-  if test -s conftest.err; then
-    ac_cpp_err=$ac_c_preproc_warn_flag
-  else
-    ac_cpp_err=
-  fi
-else
-  ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
-  eval "$as_ac_Header=yes"
-else
-  echo "$as_me: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  eval "$as_ac_Header=no"
-fi
-rm -f conftest.err conftest.$ac_ext
+# if we do not find mbstate_t in either place, use substitution to provide a fallback.
+if test "$cf_cv_mbstate_t" = unknown ; then
+	NCURSES_MBSTATE_T=1
 fi
-echo "$as_me:13590: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  cat >>confdefs.h <<EOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-EOF
 
+# if we find mbstate_t in either place, use substitution to provide a fallback.
+if test "$cf_cv_mbstate_t" != unknown ; then
+	NCURSES_OK_MBSTATE_T=1
 fi
-done
 
-for ac_func in fork vfork
-do
-as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
-echo "$as_me:13603: checking for $ac_func" >&5
-echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
-if eval "test \"\${$as_ac_var+set}\" = set"; then
+# This is needed on Tru64 5.0 to declare wchar_t
+echo "$as_me:14068: checking if we must include wchar.h to declare wchar_t" >&5
+echo $ECHO_N "checking if we must include wchar.h to declare wchar_t... $ECHO_C" >&6
+if test "${cf_cv_wchar_t+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
-#line 13609 "configure"
+
+cat >conftest.$ac_ext <<_ACEOF
+#line 14075 "configure"
 #include "confdefs.h"
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func (); below.  */
-#include <assert.h>
-/* Override any gcc2 internal prototype to avoid an error.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
-char $ac_func ();
-char (*f) ();
 
+#include <stdlib.h>
+#include <stdarg.h>
+#include <stdio.h>
+#ifdef HAVE_LIBUTF8_H
+#include <libutf8.h>
+#endif
 int
 main ()
 {
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
-choke me
-#else
-f = $ac_func;
-#endif
-
+wchar_t state
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:13640: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:14093: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:13643: \$? = $ac_status" >&5
+  echo "$as_me:14096: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:13646: \"$ac_try\"") >&5
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:14099: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:13649: \$? = $ac_status" >&5
+  echo "$as_me:14102: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  eval "$as_ac_var=yes"
+  cf_cv_wchar_t=no
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-eval "$as_ac_var=no"
-fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
-fi
-echo "$as_me:13659: result: `eval echo '${'$as_ac_var'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
-if test `eval echo '${'$as_ac_var'}'` = yes; then
-  cat >>confdefs.h <<EOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
-EOF
-
-fi
-done
-
-ac_cv_func_fork_works=$ac_cv_func_fork
-if test "x$ac_cv_func_fork" = xyes; then
-  echo "$as_me:13671: checking for working fork" >&5
-echo $ECHO_N "checking for working fork... $ECHO_C" >&6
-if test "${ac_cv_func_fork_works+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  if test "$cross_compiling" = yes; then
-  ac_cv_func_fork_works=cross
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* By Rüdiger Kuhlmann. */
-      #include <sys/types.h>
-      #if HAVE_UNISTD_H
-      # include <unistd.h>
-      #endif
-      /* Some systems only have a dummy stub for fork() */
-      int main ()
-      {
-        if (fork() < 0)
-          $ac_main_return (1);
-        $ac_main_return (0);
-      }
-_ACEOF
-rm -f conftest$ac_exeext
-if { (eval echo "$as_me:13694: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
-  ac_status=$?
-  echo "$as_me:13697: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (eval echo "$as_me:13699: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:13702: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_func_fork_works=yes
-else
-  echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
-ac_cv_func_fork_works=no
-fi
-rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
-fi
-echo "$as_me:13714: result: $ac_cv_func_fork_works" >&5
-echo "${ECHO_T}$ac_cv_func_fork_works" >&6
-
-fi
-if test "x$ac_cv_func_fork_works" = xcross; then
-  case $host in
-    *-*-amigaos* | *-*-msdosdjgpp*)
-      # Override, as these systems have only a dummy fork() stub
-      ac_cv_func_fork_works=no
-      ;;
-    *)
-      ac_cv_func_fork_works=yes
-      ;;
-  esac
-  { echo "$as_me:13728: WARNING: CROSS: Result $ac_cv_func_fork_works guessed due to cross-compiling." >&5
-echo "$as_me: WARNING: CROSS: Result $ac_cv_func_fork_works guessed due to cross-compiling." >&2;}
-fi
-ac_cv_func_vfork_works=$ac_cv_func_vfork
-if test "x$ac_cv_func_vfork" = xyes; then
-  echo "$as_me:13733: checking for working vfork" >&5
-echo $ECHO_N "checking for working vfork... $ECHO_C" >&6
-if test "${ac_cv_func_vfork_works+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  if test "$cross_compiling" = yes; then
-  ac_cv_func_vfork_works=cross
-else
-  cat >conftest.$ac_ext <<_ACEOF
-#line 13742 "configure"
+cat >conftest.$ac_ext <<_ACEOF
+#line 14109 "configure"
 #include "confdefs.h"
-/* Thanks to Paul Eggert for this test.  */
+
+#include <stdlib.h>
+#include <stdarg.h>
 #include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-#if HAVE_VFORK_H
-# include <vfork.h>
-#endif
-/* On some sparc systems, changes by the child to local and incoming
-   argument registers are propagated back to the parent.  The compiler
-   is told about this with #include <vfork.h>, but some compilers
-   (e.g. gcc -O) don't grok <vfork.h>.  Test for this by using a
-   static variable whose address is put into a register that is
-   clobbered by the vfork.  */
-static
-#ifdef __cplusplus
-sparc_address_test (int arg)
-# else
-sparc_address_test (arg) int arg;
+#include <wchar.h>
+#ifdef HAVE_LIBUTF8_H
+#include <libutf8.h>
 #endif
-{
-  static pid_t child;
-  if (!child) {
-    child = vfork ();
-    if (child < 0) {
-      perror ("vfork");
-      _exit(2);
-    }
-    if (!child) {
-      arg = getpid();
-      write(-1, "", 0);
-      _exit (arg);
-    }
-  }
-}
-
 int
 main ()
 {
-  pid_t parent = getpid ();
-  pid_t child;
-
-  sparc_address_test ();
-
-  child = vfork ();
-
-  if (child == 0) {
-    /* Here is another test for sparc vfork register problems.  This
-       test uses lots of local variables, at least as many local
-       variables as main has allocated so far including compiler
-       temporaries.  4 locals are enough for gcc 1.40.3 on a Solaris
-       4.1.3 sparc, but we use 8 to be safe.  A buggy compiler should
-       reuse the register of parent for one of the local variables,
-       since it will think that parent can't possibly be used any more
-       in this routine.  Assigning to the local variable will thus
-       munge parent in the parent process.  */
-    pid_t
-      p = getpid(), p1 = getpid(), p2 = getpid(), p3 = getpid(),
-      p4 = getpid(), p5 = getpid(), p6 = getpid(), p7 = getpid();
-    /* Convince the compiler that p..p7 are live; otherwise, it might
-       use the same hardware register for all 8 local variables.  */
-    if (p != p1 || p != p2 || p != p3 || p != p4
-	|| p != p5 || p != p6 || p != p7)
-      _exit(1);
-
-    /* On some systems (e.g. IRIX 3.3), vfork doesn't separate parent
-       from child file descriptors.  If the child closes a descriptor
-       before it execs or exits, this munges the parent's descriptor
-       as well.  Test for this by closing stdout in the child.  */
-    _exit(close(fileno(stdout)) != 0);
-  } else {
-    int status;
-    struct stat st;
-
-    while (wait(&status) != child)
-      ;
-    $ac_main_return(
-	 /* Was there some problem with vforking?  */
-	 child < 0
-
-	 /* Did the child fail?  (This shouldn't happen.)  */
-	 || status
-
-	 /* Did the vfork/compiler bug occur?  */
-	 || parent != getpid()
-
-	 /* Did the file descriptor bug occur?  */
-	 || fstat(fileno(stdout), &st) != 0
-	 );
-  }
+wchar_t value
+  ;
+  return 0;
 }
 _ACEOF
-rm -f conftest$ac_exeext
-if { (eval echo "$as_me:13839: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:14128: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:13842: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (eval echo "$as_me:13844: \"$ac_try\"") >&5
+  echo "$as_me:14131: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:14134: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:13847: \$? = $ac_status" >&5
+  echo "$as_me:14137: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_func_vfork_works=yes
+  cf_cv_wchar_t=yes
 else
-  echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
+  echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-ac_cv_func_vfork_works=no
-fi
-rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+cf_cv_wchar_t=unknown
 fi
+rm -f conftest.$ac_objext conftest.$ac_ext
 fi
-echo "$as_me:13859: result: $ac_cv_func_vfork_works" >&5
-echo "${ECHO_T}$ac_cv_func_vfork_works" >&6
-
-fi;
-if test "x$ac_cv_func_fork_works" = xcross; then
-  ac_cv_func_vfork_works=ac_cv_func_vfork
-  { echo "$as_me:13865: WARNING: CROSS: Result $ac_cv_func_vfork_works guessed due to cross-compiling." >&5
-echo "$as_me: WARNING: CROSS: Result $ac_cv_func_vfork_works guessed due to cross-compiling." >&2;}
+rm -f conftest.$ac_objext conftest.$ac_ext
 fi
+echo "$as_me:14149: result: $cf_cv_wchar_t" >&5
+echo "${ECHO_T}$cf_cv_wchar_t" >&6
 
-if test "x$ac_cv_func_vfork_works" = xyes; then
-
-cat >>confdefs.h <<\EOF
-#define HAVE_WORKING_VFORK 1
-EOF
-
-else
+if test "$cf_cv_wchar_t" = yes ; then
 
 cat >>confdefs.h <<\EOF
-#define vfork fork
+#define NEED_WCHAR_H 1
 EOF
 
+	NEED_WCHAR_H=1
 fi
-if test "x$ac_cv_func_fork_works" = xyes; then
 
-cat >>confdefs.h <<\EOF
-#define HAVE_WORKING_FORK 1
-EOF
+# if we do not find wchar_t in either place, use substitution to provide a fallback.
+if test "$cf_cv_wchar_t" = unknown ; then
+	NCURSES_WCHAR_T=1
+fi
 
+# if we find wchar_t in either place, use substitution to provide a fallback.
+if test "$cf_cv_wchar_t" != unknown ; then
+	NCURSES_OK_WCHAR_T=1
 fi
 
-echo "$as_me:13890: checking if sys/time.h works with sys/select.h" >&5
-echo $ECHO_N "checking if sys/time.h works with sys/select.h... $ECHO_C" >&6
-if test "${cf_cv_sys_time_select+set}" = set; then
+# This is needed on Tru64 5.0 to declare wint_t
+echo "$as_me:14172: checking if we must include wchar.h to declare wint_t" >&5
+echo $ECHO_N "checking if we must include wchar.h to declare wint_t... $ECHO_C" >&6
+if test "${cf_cv_wint_t+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
 
 cat >conftest.$ac_ext <<_ACEOF
-#line 13897 "configure"
+#line 14179 "configure"
 #include "confdefs.h"
 
-#include <sys/types.h>
-#ifdef HAVE_SYS_TIME_H
-#include <sys/time.h>
-#endif
-#ifdef HAVE_SYS_SELECT_H
-#include <sys/select.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <stdio.h>
+#ifdef HAVE_LIBUTF8_H
+#include <libutf8.h>
 #endif
-
 int
 main ()
 {
-
+wint_t state
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:13917: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:14197: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:13920: \$? = $ac_status" >&5
+  echo "$as_me:14200: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:13923: \"$ac_try\"") >&5
+  { (eval echo "$as_me:14203: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:13926: \$? = $ac_status" >&5
+  echo "$as_me:14206: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  cf_cv_sys_time_select=yes
+  cf_cv_wint_t=no
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-cf_cv_sys_time_select=no
-fi
-rm -f conftest.$ac_objext conftest.$ac_ext
-
-fi
-
-echo "$as_me:13938: result: $cf_cv_sys_time_select" >&5
-echo "${ECHO_T}$cf_cv_sys_time_select" >&6
-test "$cf_cv_sys_time_select" = yes && cat >>confdefs.h <<\EOF
-#define HAVE_SYS_TIME_SELECT 1
-EOF
-
-echo "$as_me:13944: checking for function curses_version" >&5
-echo $ECHO_N "checking for function curses_version... $ECHO_C" >&6
-if test "${cf_cv_func_curses_version+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-
-if test "$cross_compiling" = yes; then
-  cf_cv_func_curses_version=unknown
-else
-  cat >conftest.$ac_ext <<_ACEOF
-#line 13954 "configure"
+cat >conftest.$ac_ext <<_ACEOF
+#line 14213 "configure"
 #include "confdefs.h"
 
-#include <${cf_cv_ncurses_header:-curses.h}>
-int main()
+#include <stdlib.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <wchar.h>
+#ifdef HAVE_LIBUTF8_H
+#include <libutf8.h>
+#endif
+int
+main ()
 {
-	char temp[1024];
-	sprintf(temp, "%s\n", curses_version());
-	${cf_cv_main_return:-return}(0);
+wint_t value
+  ;
+  return 0;
 }
-
 _ACEOF
-rm -f conftest$ac_exeext
-if { (eval echo "$as_me:13967: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:14232: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:13970: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (eval echo "$as_me:13972: \"$ac_try\"") >&5
+  echo "$as_me:14235: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:14238: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:13975: \$? = $ac_status" >&5
+  echo "$as_me:14241: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  cf_cv_func_curses_version=yes
-
+  cf_cv_wint_t=yes
 else
-  echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
+  echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-cf_cv_func_curses_version=no
-
+cf_cv_wint_t=unknown
 fi
-rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.$ac_objext conftest.$ac_ext
 fi
-rm -f core
+rm -f conftest.$ac_objext conftest.$ac_ext
 fi
-echo "$as_me:13990: result: $cf_cv_func_curses_version" >&5
-echo "${ECHO_T}$cf_cv_func_curses_version" >&6
-test "$cf_cv_func_curses_version" = yes && cat >>confdefs.h <<\EOF
-#define HAVE_CURSES_VERSION 1
+echo "$as_me:14253: result: $cf_cv_wint_t" >&5
+echo "${ECHO_T}$cf_cv_wint_t" >&6
+
+if test "$cf_cv_wint_t" = yes ; then
+
+cat >>confdefs.h <<\EOF
+#define NEED_WCHAR_H 1
 EOF
 
-echo "$as_me:13996: checking for ncurses wrap-prefix" >&5
-echo $ECHO_N "checking for ncurses wrap-prefix... $ECHO_C" >&6
+	NEED_WCHAR_H=1
+fi
 
-# Check whether --with-ncurses-wrap-prefix or --without-ncurses-wrap-prefix was given.
-if test "${with_ncurses_wrap_prefix+set}" = set; then
-  withval="$with_ncurses_wrap_prefix"
-  NCURSES_WRAP_PREFIX=$withval
-else
-  NCURSES_WRAP_PREFIX=_nc_
-fi;
-echo "$as_me:14006: result: $NCURSES_WRAP_PREFIX" >&5
-echo "${ECHO_T}$NCURSES_WRAP_PREFIX" >&6
+# if we do not find wint_t in either place, use substitution to provide a fallback.
+if test "$cf_cv_wint_t" = unknown ; then
+	NCURSES_WINT_T=1
+fi
 
-echo "$as_me:14009: checking for alternate character set array" >&5
-echo $ECHO_N "checking for alternate character set array... $ECHO_C" >&6
-if test "${cf_cv_curses_acs_map+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
+# if we find wint_t in either place, use substitution to provide a fallback.
+if test "$cf_cv_wint_t" != unknown ; then
+	NCURSES_OK_WINT_T=1
+fi
 
-cf_cv_curses_acs_map=unknown
-for name in acs_map _acs_map __acs_map ${NCURSES_WRAP_PREFIX}acs_map
-do
+	if test "$NCURSES_OK_MBSTATE_T" = 0 ; then
+
+echo "$as_me:14277: checking for type mbstate_t in ${cf_cv_ncurses_header:-curses.h}" >&5
+echo $ECHO_N "checking for type mbstate_t in ${cf_cv_ncurses_header:-curses.h}... $ECHO_C" >&6
 cat >conftest.$ac_ext <<_ACEOF
-#line 14019 "configure"
+#line 14280 "configure"
 #include "confdefs.h"
 
+#ifndef _XOPEN_SOURCE_EXTENDED
+#define _XOPEN_SOURCE_EXTENDED
+#endif
 #include <${cf_cv_ncurses_header:-curses.h}>
-
 int
 main ()
 {
 
-$name['k'] = ACS_PLUS
+mbstate_t foo
 
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:14035: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:14298: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:14038: \$? = $ac_status" >&5
+  echo "$as_me:14301: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:14041: \"$ac_try\"") >&5
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:14304: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:14044: \$? = $ac_status" >&5
+  echo "$as_me:14307: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  cf_cv_curses_acs_map=$name; break
+  cf_result=yes
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
+cf_result=no
 fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
-done
+rm -f conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:14316: result: $cf_result" >&5
+echo "${ECHO_T}$cf_result" >&6
+if test $cf_result = yes ; then
 
-fi
-echo "$as_me:14055: result: $cf_cv_curses_acs_map" >&5
-echo "${ECHO_T}$cf_cv_curses_acs_map" >&6
+cf_result=`echo "have_type_mbstate_t" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
 
-test "$cf_cv_curses_acs_map" != unknown && cat >>confdefs.h <<EOF
-#define CURSES_ACS_ARRAY $cf_cv_curses_acs_map
+cat >>confdefs.h <<EOF
+#define $cf_result 1
 EOF
 
-echo "$as_me:14062: checking for wide alternate character set array" >&5
-echo $ECHO_N "checking for wide alternate character set array... $ECHO_C" >&6
-if test "${cf_cv_curses_wacs_map+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
 
-	cf_cv_curses_wacs_map=unknown
-	for name in wacs_map _wacs_map __wacs_map _nc_wacs _wacs_char
-	do
-	cat >conftest.$ac_ext <<_ACEOF
-#line 14072 "configure"
+cat >>confdefs.h <<EOF
+#define mbstate_t long
+EOF
+
+fi
+
+	fi
+
+	if test "$NCURSES_OK_WCHAR_T" = 0 ; then
+
+echo "$as_me:14338: checking for type wchar_t in ${cf_cv_ncurses_header:-curses.h}" >&5
+echo $ECHO_N "checking for type wchar_t in ${cf_cv_ncurses_header:-curses.h}... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line 14341 "configure"
 #include "confdefs.h"
 
 #ifndef _XOPEN_SOURCE_EXTENDED
@@ -14079,86 +14348,58 @@
 int
 main ()
 {
-void *foo = &($name['k'])
+
+wchar_t foo
+
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:14088: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:14359: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:14091: \$? = $ac_status" >&5
+  echo "$as_me:14362: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:14094: \"$ac_try\"") >&5
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:14365: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:14097: \$? = $ac_status" >&5
+  echo "$as_me:14368: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  cf_cv_curses_wacs_map=$name
-	 break
+  cf_result=yes
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
+cf_result=no
 fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
-	done
-fi
-echo "$as_me:14108: result: $cf_cv_curses_wacs_map" >&5
-echo "${ECHO_T}$cf_cv_curses_wacs_map" >&6
+rm -f conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:14377: result: $cf_result" >&5
+echo "${ECHO_T}$cf_result" >&6
+if test $cf_result = yes ; then
 
-test "$cf_cv_curses_wacs_map" != unknown && cat >>confdefs.h <<EOF
-#define CURSES_WACS_ARRAY $cf_cv_curses_wacs_map
+cf_result=`echo "have_type_wchar_t" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
+
+cat >>confdefs.h <<EOF
+#define $cf_result 1
 EOF
 
-echo "$as_me:14115: checking for wide alternate character constants" >&5
-echo $ECHO_N "checking for wide alternate character constants... $ECHO_C" >&6
-if test "${cf_cv_curses_wacs_symbols+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
 
-cf_cv_curses_wacs_symbols=no
-if test "$cf_cv_curses_wacs_map" != unknown
-then
-	cat >conftest.$ac_ext <<_ACEOF
-#line 14125 "configure"
-#include "confdefs.h"
+cat >>confdefs.h <<EOF
+#define wchar_t long
+EOF
 
-#ifndef _XOPEN_SOURCE_EXTENDED
-#define _XOPEN_SOURCE_EXTENDED
-#endif
-#include <${cf_cv_ncurses_header:-curses.h}>
-int
-main ()
-{
-cchar_t *foo = WACS_PLUS;
-	 $cf_cv_curses_wacs_map['k'] = *WACS_PLUS
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:14142: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
-  ac_status=$?
-  echo "$as_me:14145: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:14148: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:14151: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  cf_cv_curses_wacs_symbols=yes
-else
-  echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
 fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
-else
-	cat >conftest.$ac_ext <<_ACEOF
-#line 14161 "configure"
+
+	fi
+
+	if test "$NCURSES_OK_WINT_T" = 0 ; then
+
+echo "$as_me:14399: checking for type wint_t in ${cf_cv_ncurses_header:-curses.h}" >&5
+echo $ECHO_N "checking for type wint_t in ${cf_cv_ncurses_header:-curses.h}... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line 14402 "configure"
 #include "confdefs.h"
 
 #ifndef _XOPEN_SOURCE_EXTENDED
@@ -14168,70 +14409,95 @@
 int
 main ()
 {
-cchar_t *foo = WACS_PLUS
+
+wint_t foo
+
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:14177: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:14420: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:14180: \$? = $ac_status" >&5
+  echo "$as_me:14423: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:14183: \"$ac_try\"") >&5
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:14426: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:14186: \$? = $ac_status" >&5
+  echo "$as_me:14429: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  cf_cv_curses_wacs_symbols=yes
+  cf_result=yes
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
+cf_result=no
 fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+rm -f conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:14438: result: $cf_result" >&5
+echo "${ECHO_T}$cf_result" >&6
+if test $cf_result = yes ; then
+
+cf_result=`echo "have_type_wint_t" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
+
+cat >>confdefs.h <<EOF
+#define $cf_result 1
+EOF
+
+else
+
+cat >>confdefs.h <<EOF
+#define wint_t long
+EOF
+
 fi
 
+	fi
 fi
-echo "$as_me:14197: result: $cf_cv_curses_wacs_symbols" >&5
-echo "${ECHO_T}$cf_cv_curses_wacs_symbols" >&6
 
-test "$cf_cv_curses_wacs_symbols" != no && cat >>confdefs.h <<\EOF
-#define CURSES_WACS_SYMBOLS 1
-EOF
+echo "$as_me:14459: checking for data boolnames declaration in ${cf_cv_ncurses_header:-curses.h}" >&5
+echo $ECHO_N "checking for data boolnames declaration in ${cf_cv_ncurses_header:-curses.h}... $ECHO_C" >&6
 
-echo "$as_me:14204: checking for type attr_t in ${cf_cv_ncurses_header:-curses.h}" >&5
-echo $ECHO_N "checking for type attr_t in ${cf_cv_ncurses_header:-curses.h}... $ECHO_C" >&6
 cat >conftest.$ac_ext <<_ACEOF
-#line 14207 "configure"
+#line 14463 "configure"
 #include "confdefs.h"
 
-#ifndef _XOPEN_SOURCE_EXTENDED
-#define _XOPEN_SOURCE_EXTENDED
-#endif
+#ifdef HAVE_XCURSES
+#include <xcurses.h>
+char * XCursesProgramName = "test";
+#else
 #include <${cf_cv_ncurses_header:-curses.h}>
+#if defined(NCURSES_VERSION) && defined(HAVE_NCURSESW_TERM_H)
+#include <ncursesw/term.h>
+#elif defined(NCURSES_VERSION) && defined(HAVE_NCURSES_TERM_H)
+#include <ncurses/term.h>
+#elif defined(HAVE_TERM_H)
+#include <term.h>
+#endif
+#endif
+
 int
 main ()
 {
 
-attr_t foo
+void *foo = &(boolnames)
 
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:14225: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:14491: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:14228: \$? = $ac_status" >&5
+  echo "$as_me:14494: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:14231: \"$ac_try\"") >&5
+  { (eval echo "$as_me:14497: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:14234: \$? = $ac_status" >&5
+  echo "$as_me:14500: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   cf_result=yes
 else
@@ -14240,868 +14506,1570 @@
 cf_result=no
 fi
 rm -f conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:14243: result: $cf_result" >&5
+echo "$as_me:14509: result: $cf_result" >&5
 echo "${ECHO_T}$cf_result" >&6
+
 if test $cf_result = yes ; then
 
-cf_result=`echo "have_type_attr_t" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
+cf_result=`echo "have_curses_data_boolnames" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
 
 	cat >>confdefs.h <<EOF
 #define $cf_result 1
 EOF
 
 else
-	cat >>confdefs.h <<EOF
-#define attr_t long
-EOF
-
-fi
-
-# This is needed on Tru64 5.0 to declare mbstate_t
-echo "$as_me:14261: checking if we must include wchar.h to declare mbstate_t" >&5
-echo $ECHO_N "checking if we must include wchar.h to declare mbstate_t... $ECHO_C" >&6
-if test "${cf_cv_mbstate_t+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
+	echo "$as_me:14521: checking for data boolnames in library" >&5
+echo $ECHO_N "checking for data boolnames in library... $ECHO_C" >&6
+	# BSD linkers insist on making weak linkage, but resolve at runtime.
+	if test "$cross_compiling" = yes; then
 
-cat >conftest.$ac_ext <<_ACEOF
-#line 14268 "configure"
+	# cross-compiling
+	cat >conftest.$ac_ext <<_ACEOF
+#line 14528 "configure"
 #include "confdefs.h"
 
-#include <stdlib.h>
-#include <stdarg.h>
-#include <stdio.h>
-#ifdef HAVE_LIBUTF8_H
-#include <libutf8.h>
+#ifdef HAVE_XCURSES
+#include <xcurses.h>
+char * XCursesProgramName = "test";
+#else
+#include <${cf_cv_ncurses_header:-curses.h}>
+#if defined(NCURSES_VERSION) && defined(HAVE_NCURSESW_TERM_H)
+#include <ncursesw/term.h>
+#elif defined(NCURSES_VERSION) && defined(HAVE_NCURSES_TERM_H)
+#include <ncurses/term.h>
+#elif defined(HAVE_TERM_H)
+#include <term.h>
+#endif
 #endif
+
+extern char boolnames;
 int
 main ()
 {
-mbstate_t state
+
+	do {
+		void *foo = &(boolnames);
+		${cf_cv_main_return:-return}(foo == 0);
+	} while (0)
+
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:14286: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:14560: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:14289: \$? = $ac_status" >&5
+  echo "$as_me:14563: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:14292: \"$ac_try\"") >&5
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:14566: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:14295: \$? = $ac_status" >&5
+  echo "$as_me:14569: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  cf_cv_mbstate_t=no
+  cf_result=yes
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
+cf_result=no
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+
+else
+  cat >conftest.$ac_ext <<_ACEOF
+#line 14581 "configure"
+#include "confdefs.h"
+
+#ifdef HAVE_XCURSES
+#include <xcurses.h>
+char * XCursesProgramName = "test";
+#else
+#include <${cf_cv_ncurses_header:-curses.h}>
+#if defined(NCURSES_VERSION) && defined(HAVE_NCURSESW_TERM_H)
+#include <ncursesw/term.h>
+#elif defined(NCURSES_VERSION) && defined(HAVE_NCURSES_TERM_H)
+#include <ncurses/term.h>
+#elif defined(HAVE_TERM_H)
+#include <term.h>
+#endif
+#endif
+
+extern char boolnames;
+int main(void)
+{
+	void *foo = &(boolnames);
+	${cf_cv_main_return:-return}(foo == 0);
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:14606: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:14609: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (eval echo "$as_me:14611: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:14614: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  cf_result=yes
+else
+  echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+cf_result=no
+fi
+rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+	echo "$as_me:14625: result: $cf_result" >&5
+echo "${ECHO_T}$cf_result" >&6
+	if test $cf_result = yes ; then
+
+cf_result=`echo "decl_curses_data_boolnames" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
+
+		cat >>confdefs.h <<EOF
+#define $cf_result 1
+EOF
+
+	fi
+fi
+
+echo "$as_me:14638: checking for data boolfnames declaration in ${cf_cv_ncurses_header:-curses.h}" >&5
+echo $ECHO_N "checking for data boolfnames declaration in ${cf_cv_ncurses_header:-curses.h}... $ECHO_C" >&6
+
 cat >conftest.$ac_ext <<_ACEOF
-#line 14302 "configure"
+#line 14642 "configure"
 #include "confdefs.h"
 
-#include <stdlib.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <wchar.h>
-#ifdef HAVE_LIBUTF8_H
-#include <libutf8.h>
+#ifdef HAVE_XCURSES
+#include <xcurses.h>
+char * XCursesProgramName = "test";
+#else
+#include <${cf_cv_ncurses_header:-curses.h}>
+#if defined(NCURSES_VERSION) && defined(HAVE_NCURSESW_TERM_H)
+#include <ncursesw/term.h>
+#elif defined(NCURSES_VERSION) && defined(HAVE_NCURSES_TERM_H)
+#include <ncurses/term.h>
+#elif defined(HAVE_TERM_H)
+#include <term.h>
+#endif
 #endif
+
 int
 main ()
 {
-mbstate_t value
+
+void *foo = &(boolfnames)
+
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:14321: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:14670: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:14324: \$? = $ac_status" >&5
+  echo "$as_me:14673: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:14327: \"$ac_try\"") >&5
+  { (eval echo "$as_me:14676: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:14330: \$? = $ac_status" >&5
+  echo "$as_me:14679: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  cf_cv_mbstate_t=yes
+  cf_result=yes
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-cf_cv_mbstate_t=unknown
-fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+cf_result=no
 fi
 rm -f conftest.$ac_objext conftest.$ac_ext
-fi
-echo "$as_me:14342: result: $cf_cv_mbstate_t" >&5
-echo "${ECHO_T}$cf_cv_mbstate_t" >&6
-
-if test "$cf_cv_mbstate_t" = yes ; then
-	cat >>confdefs.h <<\EOF
-#define NEED_WCHAR_H 1
-EOF
+echo "$as_me:14688: result: $cf_result" >&5
+echo "${ECHO_T}$cf_result" >&6
 
-	NEED_WCHAR_H=1
-fi
+if test $cf_result = yes ; then
 
-# if we do not find mbstate_t in either place, use substitution to provide a fallback.
-if test "$cf_cv_mbstate_t" = unknown ; then
-	NCURSES_MBSTATE_T=1
-fi
+cf_result=`echo "have_curses_data_boolfnames" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
 
-# if we find mbstate_t in either place, use substitution to provide a fallback.
-if test "$cf_cv_mbstate_t" != unknown ; then
-	NCURSES_OK_MBSTATE_T=1
-fi
+	cat >>confdefs.h <<EOF
+#define $cf_result 1
+EOF
 
-# This is needed on Tru64 5.0 to declare wchar_t
-echo "$as_me:14364: checking if we must include wchar.h to declare wchar_t" >&5
-echo $ECHO_N "checking if we must include wchar.h to declare wchar_t... $ECHO_C" >&6
-if test "${cf_cv_wchar_t+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
+	echo "$as_me:14700: checking for data boolfnames in library" >&5
+echo $ECHO_N "checking for data boolfnames in library... $ECHO_C" >&6
+	# BSD linkers insist on making weak linkage, but resolve at runtime.
+	if test "$cross_compiling" = yes; then
 
-cat >conftest.$ac_ext <<_ACEOF
-#line 14371 "configure"
+	# cross-compiling
+	cat >conftest.$ac_ext <<_ACEOF
+#line 14707 "configure"
 #include "confdefs.h"
 
-#include <stdlib.h>
-#include <stdarg.h>
-#include <stdio.h>
-#ifdef HAVE_LIBUTF8_H
-#include <libutf8.h>
+#ifdef HAVE_XCURSES
+#include <xcurses.h>
+char * XCursesProgramName = "test";
+#else
+#include <${cf_cv_ncurses_header:-curses.h}>
+#if defined(NCURSES_VERSION) && defined(HAVE_NCURSESW_TERM_H)
+#include <ncursesw/term.h>
+#elif defined(NCURSES_VERSION) && defined(HAVE_NCURSES_TERM_H)
+#include <ncurses/term.h>
+#elif defined(HAVE_TERM_H)
+#include <term.h>
 #endif
+#endif
+
+extern char boolfnames;
 int
 main ()
 {
-wchar_t state
+
+	do {
+		void *foo = &(boolfnames);
+		${cf_cv_main_return:-return}(foo == 0);
+	} while (0)
+
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:14389: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:14739: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:14392: \$? = $ac_status" >&5
+  echo "$as_me:14742: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:14395: \"$ac_try\"") >&5
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:14745: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:14398: \$? = $ac_status" >&5
+  echo "$as_me:14748: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  cf_cv_wchar_t=no
+  cf_result=yes
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-cat >conftest.$ac_ext <<_ACEOF
-#line 14405 "configure"
+cf_result=no
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+
+else
+  cat >conftest.$ac_ext <<_ACEOF
+#line 14760 "configure"
 #include "confdefs.h"
 
-#include <stdlib.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <wchar.h>
-#ifdef HAVE_LIBUTF8_H
-#include <libutf8.h>
+#ifdef HAVE_XCURSES
+#include <xcurses.h>
+char * XCursesProgramName = "test";
+#else
+#include <${cf_cv_ncurses_header:-curses.h}>
+#if defined(NCURSES_VERSION) && defined(HAVE_NCURSESW_TERM_H)
+#include <ncursesw/term.h>
+#elif defined(NCURSES_VERSION) && defined(HAVE_NCURSES_TERM_H)
+#include <ncurses/term.h>
+#elif defined(HAVE_TERM_H)
+#include <term.h>
 #endif
-int
-main ()
+#endif
+
+extern char boolfnames;
+int main(void)
 {
-wchar_t value
-  ;
-  return 0;
+	void *foo = &(boolfnames);
+	${cf_cv_main_return:-return}(foo == 0);
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:14424: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:14785: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:14427: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:14430: \"$ac_try\"") >&5
+  echo "$as_me:14788: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (eval echo "$as_me:14790: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:14433: \$? = $ac_status" >&5
+  echo "$as_me:14793: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  cf_cv_wchar_t=yes
+  cf_result=yes
 else
-  echo "$as_me: failed program was:" >&5
+  echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-cf_cv_wchar_t=unknown
-fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+cf_result=no
 fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
-echo "$as_me:14445: result: $cf_cv_wchar_t" >&5
-echo "${ECHO_T}$cf_cv_wchar_t" >&6
+	echo "$as_me:14804: result: $cf_result" >&5
+echo "${ECHO_T}$cf_result" >&6
+	if test $cf_result = yes ; then
 
-if test "$cf_cv_wchar_t" = yes ; then
-	cat >>confdefs.h <<\EOF
-#define NEED_WCHAR_H 1
+cf_result=`echo "decl_curses_data_boolfnames" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
+
+		cat >>confdefs.h <<EOF
+#define $cf_result 1
 EOF
 
-	NEED_WCHAR_H=1
+	fi
 fi
 
-# if we do not find wchar_t in either place, use substitution to provide a fallback.
-if test "$cf_cv_wchar_t" = unknown ; then
-	NCURSES_WCHAR_T=1
-fi
+if ( test "$GCC" = yes || test "$GXX" = yes )
+then
+echo "$as_me:14819: checking if you want to turn on gcc warnings" >&5
+echo $ECHO_N "checking if you want to turn on gcc warnings... $ECHO_C" >&6
 
-# if we find wchar_t in either place, use substitution to provide a fallback.
-if test "$cf_cv_wchar_t" != unknown ; then
-	NCURSES_OK_WCHAR_T=1
-fi
+# Check whether --enable-warnings or --disable-warnings was given.
+if test "${enable_warnings+set}" = set; then
+  enableval="$enable_warnings"
+  test "$enableval" != yes && enableval=no
+  if test "$enableval" != "no" ; then
+    with_warnings=yes
+  else
+    with_warnings=no
+  fi
+else
+  enableval=no
+  with_warnings=no
 
-# This is needed on Tru64 5.0 to declare wint_t
-echo "$as_me:14467: checking if we must include wchar.h to declare wint_t" >&5
-echo $ECHO_N "checking if we must include wchar.h to declare wint_t... $ECHO_C" >&6
-if test "${cf_cv_wint_t+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi;
+echo "$as_me:14836: result: $with_warnings" >&5
+echo "${ECHO_T}$with_warnings" >&6
+if test "$with_warnings" = "yes"
+then
+
+if test "$GCC" = yes
+then
+cat > conftest.i <<EOF
+#ifndef GCC_PRINTF
+#define GCC_PRINTF 0
+#endif
+#ifndef GCC_SCANF
+#define GCC_SCANF 0
+#endif
+#ifndef GCC_NORETURN
+#define GCC_NORETURN /* nothing */
+#endif
+#ifndef GCC_UNUSED
+#define GCC_UNUSED /* nothing */
+#endif
+EOF
+if test "$GCC" = yes
+then
+	{ echo "$as_me:14859: checking for $CC __attribute__ directives..." >&5
+echo "$as_me: checking for $CC __attribute__ directives..." >&6;}
+cat > conftest.$ac_ext <<EOF
+#line 14862 "${as_me:-configure}"
+#include "confdefs.h"
+#include "conftest.h"
+#include "conftest.i"
+#if	GCC_PRINTF
+#define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var)))
+#else
+#define GCC_PRINTFLIKE(fmt,var) /*nothing*/
+#endif
+#if	GCC_SCANF
+#define GCC_SCANFLIKE(fmt,var)  __attribute__((format(scanf,fmt,var)))
+#else
+#define GCC_SCANFLIKE(fmt,var)  /*nothing*/
+#endif
+extern void wow(char *,...) GCC_SCANFLIKE(1,2);
+extern void oops(char *,...) GCC_PRINTFLIKE(1,2) GCC_NORETURN;
+extern void foo(void) GCC_NORETURN;
+int main(int argc GCC_UNUSED, char *argv[] GCC_UNUSED) { return 0; }
+EOF
+	cf_printf_attribute=no
+	cf_scanf_attribute=no
+	for cf_attribute in scanf printf unused noreturn
+	do
+
+cf_ATTRIBUTE=`echo "$cf_attribute" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
+
+		cf_directive="__attribute__(($cf_attribute))"
+		echo "checking for $CC $cf_directive" 1>&5
+
+		case $cf_attribute in #(vi
+		printf) #(vi
+			cf_printf_attribute=yes
+			cat >conftest.h <<EOF
+#define GCC_$cf_ATTRIBUTE 1
+EOF
+			;;
+		scanf) #(vi
+			cf_scanf_attribute=yes
+			cat >conftest.h <<EOF
+#define GCC_$cf_ATTRIBUTE 1
+EOF
+			;;
+		*) #(vi
+			cat >conftest.h <<EOF
+#define GCC_$cf_ATTRIBUTE $cf_directive
+EOF
+			;;
+		esac
+
+		if { (eval echo "$as_me:14911: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:14914: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+			test -n "$verbose" && echo "$as_me:14916: result: ... $cf_attribute" >&5
+echo "${ECHO_T}... $cf_attribute" >&6
+			cat conftest.h >>confdefs.h
+			case $cf_attribute in #(vi
+			noreturn) #(vi
+
+cat >>confdefs.h <<EOF
+#define GCC_NORETURN $cf_directive
+EOF
+
+				;;
+			printf) #(vi
+				cf_value='/* nothing */'
+				if test "$cf_printf_attribute" != no ; then
+					cf_value='__attribute__((format(printf,fmt,var)))'
+
+cat >>confdefs.h <<\EOF
+#define GCC_PRINTF 1
+EOF
+
+				fi
+
+cat >>confdefs.h <<EOF
+#define GCC_PRINTFLIKE(fmt,var) $cf_value
+EOF
+
+				;;
+			scanf) #(vi
+				cf_value='/* nothing */'
+				if test "$cf_scanf_attribute" != no ; then
+					cf_value='__attribute__((format(scanf,fmt,var)))'
+
+cat >>confdefs.h <<\EOF
+#define GCC_SCANF 1
+EOF
+
+				fi
+
+cat >>confdefs.h <<EOF
+#define GCC_SCANFLIKE(fmt,var) $cf_value
+EOF
+
+				;;
+			unused) #(vi
+
+cat >>confdefs.h <<EOF
+#define GCC_UNUSED $cf_directive
+EOF
+
+				;;
+			esac
+		fi
+	done
 else
+	fgrep define conftest.i >>confdefs.h
+fi
+rm -rf conftest*
+fi
 
-cat >conftest.$ac_ext <<_ACEOF
-#line 14474 "configure"
+INTEL_COMPILER=no
+
+if test "$GCC" = yes ; then
+	case $host_os in
+	linux*|gnu*)
+		echo "$as_me:14980: checking if this is really Intel C compiler" >&5
+echo $ECHO_N "checking if this is really Intel C compiler... $ECHO_C" >&6
+		cf_save_CFLAGS="$CFLAGS"
+		CFLAGS="$CFLAGS -no-gcc"
+		cat >conftest.$ac_ext <<_ACEOF
+#line 14985 "configure"
 #include "confdefs.h"
 
-#include <stdlib.h>
-#include <stdarg.h>
-#include <stdio.h>
-#ifdef HAVE_LIBUTF8_H
-#include <libutf8.h>
-#endif
 int
 main ()
 {
-wint_t state
+
+#ifdef __INTEL_COMPILER
+#else
+make an error
+#endif
+
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:14492: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:15002: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:14495: \$? = $ac_status" >&5
+  echo "$as_me:15005: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:14498: \"$ac_try\"") >&5
+  { (eval echo "$as_me:15008: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:14501: \$? = $ac_status" >&5
+  echo "$as_me:15011: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  cf_cv_wint_t=no
+  INTEL_COMPILER=yes
+cf_save_CFLAGS="$cf_save_CFLAGS -we147 -no-gcc"
+
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-cat >conftest.$ac_ext <<_ACEOF
-#line 14508 "configure"
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+		CFLAGS="$cf_save_CFLAGS"
+		echo "$as_me:15022: result: $INTEL_COMPILER" >&5
+echo "${ECHO_T}$INTEL_COMPILER" >&6
+		;;
+	esac
+fi
+
+CLANG_COMPILER=no
+
+if test "$GCC" = yes ; then
+	echo "$as_me:15031: checking if this is really Clang C compiler" >&5
+echo $ECHO_N "checking if this is really Clang C compiler... $ECHO_C" >&6
+	cf_save_CFLAGS="$CFLAGS"
+	CFLAGS="$CFLAGS -Qunused-arguments"
+	cat >conftest.$ac_ext <<_ACEOF
+#line 15036 "configure"
 #include "confdefs.h"
 
-#include <stdlib.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <wchar.h>
-#ifdef HAVE_LIBUTF8_H
-#include <libutf8.h>
-#endif
 int
 main ()
 {
-wint_t value
+
+#ifdef __clang__
+#else
+make an error
+#endif
+
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:14527: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:15053: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:14530: \$? = $ac_status" >&5
+  echo "$as_me:15056: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:14533: \"$ac_try\"") >&5
+  { (eval echo "$as_me:15059: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:14536: \$? = $ac_status" >&5
+  echo "$as_me:15062: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  cf_cv_wint_t=yes
+  CLANG_COMPILER=yes
+cf_save_CFLAGS="$cf_save_CFLAGS -Qunused-arguments"
+
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-cf_cv_wint_t=unknown
 fi
 rm -f conftest.$ac_objext conftest.$ac_ext
+	CFLAGS="$cf_save_CFLAGS"
+	echo "$as_me:15073: result: $CLANG_COMPILER" >&5
+echo "${ECHO_T}$CLANG_COMPILER" >&6
 fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+
+cat > conftest.$ac_ext <<EOF
+#line 15078 "${as_me:-configure}"
+int main(int argc, char *argv[]) { return (argv[argc-1] == 0) ; }
+EOF
+
+if test "$INTEL_COMPILER" = yes
+then
+# The "-wdXXX" options suppress warnings:
+# remark #1419: external declaration in primary source file
+# remark #1683: explicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem)
+# remark #1684: conversion from pointer to same-sized integral type (potential portability problem)
+# remark #193: zero used for undefined preprocessing identifier
+# remark #593: variable "curs_sb_left_arrow" was set but never used
+# remark #810: conversion from "int" to "Dimension={unsigned short}" may lose significant bits
+# remark #869: parameter "tw" was never referenced
+# remark #981: operands are evaluated in unspecified order
+# warning #279: controlling expression is constant
+
+	{ echo "$as_me:15095: checking for $CC warning options..." >&5
+echo "$as_me: checking for $CC warning options..." >&6;}
+	cf_save_CFLAGS="$CFLAGS"
+	EXTRA_CFLAGS="-Wall"
+	for cf_opt in \
+		wd1419 \
+		wd1683 \
+		wd1684 \
+		wd193 \
+		wd593 \
+		wd279 \
+		wd810 \
+		wd869 \
+		wd981
+	do
+		CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt"
+		if { (eval echo "$as_me:15111: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:15114: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+			test -n "$verbose" && echo "$as_me:15116: result: ... -$cf_opt" >&5
+echo "${ECHO_T}... -$cf_opt" >&6
+			EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt"
+		fi
+	done
+	CFLAGS="$cf_save_CFLAGS"
+
+elif test "$GCC" = yes
+then
+	{ echo "$as_me:15125: checking for $CC warning options..." >&5
+echo "$as_me: checking for $CC warning options..." >&6;}
+	cf_save_CFLAGS="$CFLAGS"
+	EXTRA_CFLAGS=
+	cf_warn_CONST=""
+	test "$with_ext_const" = yes && cf_warn_CONST="Wwrite-strings"
+	for cf_opt in W Wall \
+		Wbad-function-cast \
+		Wcast-align \
+		Wcast-qual \
+		Winline \
+		Wmissing-declarations \
+		Wmissing-prototypes \
+		Wnested-externs \
+		Wpointer-arith \
+		Wshadow \
+		Wstrict-prototypes \
+		Wundef $cf_warn_CONST
+	do
+		CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt"
+		if { (eval echo "$as_me:15145: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:15148: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+			test -n "$verbose" && echo "$as_me:15150: result: ... -$cf_opt" >&5
+echo "${ECHO_T}... -$cf_opt" >&6
+			case $cf_opt in #(vi
+			Wcast-qual) #(vi
+				CPPFLAGS="$CPPFLAGS -DXTSTRINGDEFINES"
+				;;
+			Winline) #(vi
+				case $GCC_VERSION in
+				[34].*)
+					test -n "$verbose" && echo "	feature is broken in gcc $GCC_VERSION" 1>&6
+
+echo "${as_me:-configure}:15161: testing feature is broken in gcc $GCC_VERSION ..." 1>&5
+
+					continue;;
+				esac
+				;;
+			Wpointer-arith) #(vi
+				case $GCC_VERSION in
+				[12].*)
+					test -n "$verbose" && echo "	feature is broken in gcc $GCC_VERSION" 1>&6
+
+echo "${as_me:-configure}:15171: testing feature is broken in gcc $GCC_VERSION ..." 1>&5
+
+					continue;;
+				esac
+				;;
+			esac
+			EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt"
+		fi
+	done
+	CFLAGS="$cf_save_CFLAGS"
 fi
-echo "$as_me:14548: result: $cf_cv_wint_t" >&5
-echo "${ECHO_T}$cf_cv_wint_t" >&6
+rm -rf conftest*
 
-if test "$cf_cv_wint_t" = yes ; then
-	cat >>confdefs.h <<\EOF
-#define NEED_WCHAR_H 1
+fi
+fi
+
+echo "$as_me:15187: checking if you want to use dmalloc for testing" >&5
+echo $ECHO_N "checking if you want to use dmalloc for testing... $ECHO_C" >&6
+
+# Check whether --with-dmalloc or --without-dmalloc was given.
+if test "${with_dmalloc+set}" = set; then
+  withval="$with_dmalloc"
+
+cat >>confdefs.h <<EOF
+#define USE_DMALLOC 1
 EOF
 
-	NEED_WCHAR_H=1
+	: ${with_cflags:=-g}
+	: ${with_no_leaks:=yes}
+	 with_dmalloc=yes
+else
+  with_dmalloc=
+fi;
+echo "$as_me:15204: result: ${with_dmalloc:-no}" >&5
+echo "${ECHO_T}${with_dmalloc:-no}" >&6
+
+case .$with_cflags in #(vi
+.*-g*)
+	case .$CFLAGS in #(vi
+	.*-g*) #(vi
+		;;
+	*)
+
+cf_fix_cppflags=no
+cf_new_cflags=
+cf_new_cppflags=
+cf_new_extra_cppflags=
+
+for cf_add_cflags in -g
+do
+case $cf_fix_cppflags in
+no)
+	case $cf_add_cflags in #(vi
+	-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi
+		case $cf_add_cflags in
+		-D*)
+			cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'`
+
+			test "${cf_add_cflags}" != "${cf_tst_cflags}" \
+				&& test -z "${cf_tst_cflags}" \
+				&& cf_fix_cppflags=yes
+
+			if test $cf_fix_cppflags = yes ; then
+				cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
+				continue
+			elif test "${cf_tst_cflags}" = "\"'" ; then
+				cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
+				continue
+			fi
+			;;
+		esac
+		case "$CPPFLAGS" in
+		*$cf_add_cflags) #(vi
+			;;
+		*) #(vi
+			case $cf_add_cflags in #(vi
+			-D*)
+				cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'`
+
+CPPFLAGS=`echo "$CPPFLAGS" | \
+	sed	-e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ 	]*\)\?[ 	]/ /g' \
+		-e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ 	]*\)\?$//g'`
+
+				;;
+			esac
+			cf_new_cppflags="$cf_new_cppflags $cf_add_cflags"
+			;;
+		esac
+		;;
+	*)
+		cf_new_cflags="$cf_new_cflags $cf_add_cflags"
+		;;
+	esac
+	;;
+yes)
+	cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
+
+	cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'`
+
+	test "${cf_add_cflags}" != "${cf_tst_cflags}" \
+		&& test -z "${cf_tst_cflags}" \
+		&& cf_fix_cppflags=no
+	;;
+esac
+done
+
+if test -n "$cf_new_cflags" ; then
+
+	CFLAGS="$CFLAGS $cf_new_cflags"
 fi
 
-# if we do not find wint_t in either place, use substitution to provide a fallback.
-if test "$cf_cv_wint_t" = unknown ; then
-	NCURSES_WINT_T=1
+if test -n "$cf_new_cppflags" ; then
+
+	CPPFLAGS="$CPPFLAGS $cf_new_cppflags"
+fi
+
+if test -n "$cf_new_extra_cppflags" ; then
+
+	EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS"
+fi
+
+		;;
+	esac
+	;;
+esac
+
+if test "$with_dmalloc" = yes ; then
+	echo "$as_me:15298: checking for dmalloc.h" >&5
+echo $ECHO_N "checking for dmalloc.h... $ECHO_C" >&6
+if test "${ac_cv_header_dmalloc_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+#line 15304 "configure"
+#include "confdefs.h"
+#include <dmalloc.h>
+_ACEOF
+if { (eval echo "$as_me:15308: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  egrep -v '^ *\+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:15314: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  ac_cv_header_dmalloc_h=yes
+else
+  echo "$as_me: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  ac_cv_header_dmalloc_h=no
 fi
-
-# if we find wint_t in either place, use substitution to provide a fallback.
-if test "$cf_cv_wint_t" != unknown ; then
-	NCURSES_OK_WINT_T=1
+rm -f conftest.err conftest.$ac_ext
 fi
+echo "$as_me:15333: result: $ac_cv_header_dmalloc_h" >&5
+echo "${ECHO_T}$ac_cv_header_dmalloc_h" >&6
+if test $ac_cv_header_dmalloc_h = yes; then
 
-if test "$NCURSES_OK_MBSTATE_T" = 0 ; then
-
-echo "$as_me:14571: checking for type mbstate_t in ${cf_cv_ncurses_header:-curses.h}" >&5
-echo $ECHO_N "checking for type mbstate_t in ${cf_cv_ncurses_header:-curses.h}... $ECHO_C" >&6
+echo "$as_me:15337: checking for dmalloc_debug in -ldmalloc" >&5
+echo $ECHO_N "checking for dmalloc_debug in -ldmalloc... $ECHO_C" >&6
+if test "${ac_cv_lib_dmalloc_dmalloc_debug+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldmalloc  $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
-#line 14574 "configure"
+#line 15345 "configure"
 #include "confdefs.h"
 
-#ifndef _XOPEN_SOURCE_EXTENDED
-#define _XOPEN_SOURCE_EXTENDED
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
 #endif
-#include <${cf_cv_ncurses_header:-curses.h}>
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char dmalloc_debug ();
 int
 main ()
 {
-
-mbstate_t foo
-
+dmalloc_debug ();
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:14592: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:15364: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:14595: \$? = $ac_status" >&5
+  echo "$as_me:15367: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:14598: \"$ac_try\"") >&5
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:15370: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:14601: \$? = $ac_status" >&5
+  echo "$as_me:15373: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  cf_result=yes
+  ac_cv_lib_dmalloc_dmalloc_debug=yes
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-cf_result=no
+ac_cv_lib_dmalloc_dmalloc_debug=no
 fi
-rm -f conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:14610: result: $cf_result" >&5
-echo "${ECHO_T}$cf_result" >&6
-if test $cf_result = yes ; then
-
-cf_result=`echo "have_type_mbstate_t" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
-
-	cat >>confdefs.h <<EOF
-#define $cf_result 1
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:15384: result: $ac_cv_lib_dmalloc_dmalloc_debug" >&5
+echo "${ECHO_T}$ac_cv_lib_dmalloc_dmalloc_debug" >&6
+if test $ac_cv_lib_dmalloc_dmalloc_debug = yes; then
+  cat >>confdefs.h <<EOF
+#define HAVE_LIBDMALLOC 1
 EOF
 
-else
-	cat >>confdefs.h <<EOF
-#define mbstate_t long
-EOF
+  LIBS="-ldmalloc $LIBS"
 
 fi
 
 fi
 
-if test "$NCURSES_OK_WCHAR_T" = 0 ; then
+fi
 
-echo "$as_me:14631: checking for type wchar_t in ${cf_cv_ncurses_header:-curses.h}" >&5
-echo $ECHO_N "checking for type wchar_t in ${cf_cv_ncurses_header:-curses.h}... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-#line 14634 "configure"
-#include "confdefs.h"
+echo "$as_me:15399: checking if you want to use dbmalloc for testing" >&5
+echo $ECHO_N "checking if you want to use dbmalloc for testing... $ECHO_C" >&6
 
-#ifndef _XOPEN_SOURCE_EXTENDED
-#define _XOPEN_SOURCE_EXTENDED
-#endif
-#include <${cf_cv_ncurses_header:-curses.h}>
-int
-main ()
-{
+# Check whether --with-dbmalloc or --without-dbmalloc was given.
+if test "${with_dbmalloc+set}" = set; then
+  withval="$with_dbmalloc"
 
-wchar_t foo
+cat >>confdefs.h <<EOF
+#define USE_DBMALLOC 1
+EOF
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:14652: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
-  ac_status=$?
-  echo "$as_me:14655: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:14658: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:14661: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  cf_result=yes
+	: ${with_cflags:=-g}
+	: ${with_no_leaks:=yes}
+	 with_dbmalloc=yes
 else
-  echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
-cf_result=no
-fi
-rm -f conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:14670: result: $cf_result" >&5
-echo "${ECHO_T}$cf_result" >&6
-if test $cf_result = yes ; then
+  with_dbmalloc=
+fi;
+echo "$as_me:15416: result: ${with_dbmalloc:-no}" >&5
+echo "${ECHO_T}${with_dbmalloc:-no}" >&6
 
-cf_result=`echo "have_type_wchar_t" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
+case .$with_cflags in #(vi
+.*-g*)
+	case .$CFLAGS in #(vi
+	.*-g*) #(vi
+		;;
+	*)
 
-	cat >>confdefs.h <<EOF
-#define $cf_result 1
-EOF
+cf_fix_cppflags=no
+cf_new_cflags=
+cf_new_cppflags=
+cf_new_extra_cppflags=
 
-else
-	cat >>confdefs.h <<EOF
-#define wchar_t long
-EOF
+for cf_add_cflags in -g
+do
+case $cf_fix_cppflags in
+no)
+	case $cf_add_cflags in #(vi
+	-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi
+		case $cf_add_cflags in
+		-D*)
+			cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'`
 
-fi
+			test "${cf_add_cflags}" != "${cf_tst_cflags}" \
+				&& test -z "${cf_tst_cflags}" \
+				&& cf_fix_cppflags=yes
 
-fi
+			if test $cf_fix_cppflags = yes ; then
+				cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
+				continue
+			elif test "${cf_tst_cflags}" = "\"'" ; then
+				cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
+				continue
+			fi
+			;;
+		esac
+		case "$CPPFLAGS" in
+		*$cf_add_cflags) #(vi
+			;;
+		*) #(vi
+			case $cf_add_cflags in #(vi
+			-D*)
+				cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'`
 
-if test "$NCURSES_OK_WINT_T" = 0 ; then
+CPPFLAGS=`echo "$CPPFLAGS" | \
+	sed	-e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ 	]*\)\?[ 	]/ /g' \
+		-e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ 	]*\)\?$//g'`
 
-echo "$as_me:14691: checking for type wint_t in ${cf_cv_ncurses_header:-curses.h}" >&5
-echo $ECHO_N "checking for type wint_t in ${cf_cv_ncurses_header:-curses.h}... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-#line 14694 "configure"
-#include "confdefs.h"
+				;;
+			esac
+			cf_new_cppflags="$cf_new_cppflags $cf_add_cflags"
+			;;
+		esac
+		;;
+	*)
+		cf_new_cflags="$cf_new_cflags $cf_add_cflags"
+		;;
+	esac
+	;;
+yes)
+	cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
 
-#ifndef _XOPEN_SOURCE_EXTENDED
-#define _XOPEN_SOURCE_EXTENDED
-#endif
-#include <${cf_cv_ncurses_header:-curses.h}>
-int
-main ()
-{
+	cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'`
 
-wint_t foo
+	test "${cf_add_cflags}" != "${cf_tst_cflags}" \
+		&& test -z "${cf_tst_cflags}" \
+		&& cf_fix_cppflags=no
+	;;
+esac
+done
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:14712: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
-  ac_status=$?
-  echo "$as_me:14715: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:14718: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:14721: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  cf_result=yes
-else
-  echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
-cf_result=no
+if test -n "$cf_new_cflags" ; then
+
+	CFLAGS="$CFLAGS $cf_new_cflags"
 fi
-rm -f conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:14730: result: $cf_result" >&5
-echo "${ECHO_T}$cf_result" >&6
-if test $cf_result = yes ; then
 
-cf_result=`echo "have_type_wint_t" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
+if test -n "$cf_new_cppflags" ; then
 
-	cat >>confdefs.h <<EOF
-#define $cf_result 1
-EOF
+	CPPFLAGS="$CPPFLAGS $cf_new_cppflags"
+fi
 
-else
-	cat >>confdefs.h <<EOF
-#define wint_t long
-EOF
+if test -n "$cf_new_extra_cppflags" ; then
+
+	EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS"
+fi
+
+		;;
+	esac
+	;;
+esac
 
+if test "$with_dbmalloc" = yes ; then
+	echo "$as_me:15510: checking for dbmalloc.h" >&5
+echo $ECHO_N "checking for dbmalloc.h... $ECHO_C" >&6
+if test "${ac_cv_header_dbmalloc_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+#line 15516 "configure"
+#include "confdefs.h"
+#include <dbmalloc.h>
+_ACEOF
+if { (eval echo "$as_me:15520: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  egrep -v '^ *\+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:15526: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  ac_cv_header_dbmalloc_h=yes
+else
+  echo "$as_me: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  ac_cv_header_dbmalloc_h=no
 fi
-
+rm -f conftest.err conftest.$ac_ext
 fi
+echo "$as_me:15545: result: $ac_cv_header_dbmalloc_h" >&5
+echo "${ECHO_T}$ac_cv_header_dbmalloc_h" >&6
+if test $ac_cv_header_dbmalloc_h = yes; then
 
-echo "$as_me:14749: checking for data boolnames declaration in ${cf_cv_ncurses_header:-curses.h}" >&5
-echo $ECHO_N "checking for data boolnames declaration in ${cf_cv_ncurses_header:-curses.h}... $ECHO_C" >&6
-
+echo "$as_me:15549: checking for debug_malloc in -ldbmalloc" >&5
+echo $ECHO_N "checking for debug_malloc in -ldbmalloc... $ECHO_C" >&6
+if test "${ac_cv_lib_dbmalloc_debug_malloc+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldbmalloc  $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
-#line 14753 "configure"
+#line 15557 "configure"
 #include "confdefs.h"
 
-#ifdef HAVE_XCURSES
-#include <xcurses.h>
-char * XCursesProgramName = "test";
-#else
-#include <${cf_cv_ncurses_header:-curses.h}>
-#if defined(NCURSES_VERSION) && defined(HAVE_NCURSESW_TERM_H)
-#include <ncursesw/term.h>
-#elif defined(NCURSES_VERSION) && defined(HAVE_NCURSES_TERM_H)
-#include <ncurses/term.h>
-#elif defined(HAVE_TERM_H)
-#include <term.h>
-#endif
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
 #endif
-
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char debug_malloc ();
 int
 main ()
 {
-
-void *foo = &(boolnames)
-
+debug_malloc ();
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:14781: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:15576: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:14784: \$? = $ac_status" >&5
+  echo "$as_me:15579: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:14787: \"$ac_try\"") >&5
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:15582: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:14790: \$? = $ac_status" >&5
+  echo "$as_me:15585: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  cf_result=yes
+  ac_cv_lib_dbmalloc_debug_malloc=yes
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-cf_result=no
+ac_cv_lib_dbmalloc_debug_malloc=no
 fi
-rm -f conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:14799: result: $cf_result" >&5
-echo "${ECHO_T}$cf_result" >&6
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:15596: result: $ac_cv_lib_dbmalloc_debug_malloc" >&5
+echo "${ECHO_T}$ac_cv_lib_dbmalloc_debug_malloc" >&6
+if test $ac_cv_lib_dbmalloc_debug_malloc = yes; then
+  cat >>confdefs.h <<EOF
+#define HAVE_LIBDBMALLOC 1
+EOF
 
-if test $cf_result = yes ; then
+  LIBS="-ldbmalloc $LIBS"
 
-cf_result=`echo "have_curses_data_boolnames" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
+fi
 
-	cat >>confdefs.h <<EOF
-#define $cf_result 1
+fi
+
+fi
+
+echo "$as_me:15611: checking if you want to use valgrind for testing" >&5
+echo $ECHO_N "checking if you want to use valgrind for testing... $ECHO_C" >&6
+
+# Check whether --with-valgrind or --without-valgrind was given.
+if test "${with_valgrind+set}" = set; then
+  withval="$with_valgrind"
+
+cat >>confdefs.h <<EOF
+#define USE_VALGRIND 1
 EOF
 
+	: ${with_cflags:=-g}
+	: ${with_no_leaks:=yes}
+	 with_valgrind=yes
 else
-	echo "$as_me:14811: checking for data boolnames in library" >&5
-echo $ECHO_N "checking for data boolnames in library... $ECHO_C" >&6
-	# BSD linkers insist on making weak linkage, but resolve at runtime.
-	if test "$cross_compiling" = yes; then
+  with_valgrind=
+fi;
+echo "$as_me:15628: result: ${with_valgrind:-no}" >&5
+echo "${ECHO_T}${with_valgrind:-no}" >&6
 
-	# cross-compiling
-	cat >conftest.$ac_ext <<_ACEOF
-#line 14818 "configure"
-#include "confdefs.h"
+case .$with_cflags in #(vi
+.*-g*)
+	case .$CFLAGS in #(vi
+	.*-g*) #(vi
+		;;
+	*)
 
-#ifdef HAVE_XCURSES
-#include <xcurses.h>
-char * XCursesProgramName = "test";
-#else
-#include <${cf_cv_ncurses_header:-curses.h}>
-#if defined(NCURSES_VERSION) && defined(HAVE_NCURSESW_TERM_H)
-#include <ncursesw/term.h>
-#elif defined(NCURSES_VERSION) && defined(HAVE_NCURSES_TERM_H)
-#include <ncurses/term.h>
-#elif defined(HAVE_TERM_H)
-#include <term.h>
-#endif
-#endif
+cf_fix_cppflags=no
+cf_new_cflags=
+cf_new_cppflags=
+cf_new_extra_cppflags=
 
-extern char boolnames;
-int
-main ()
-{
+for cf_add_cflags in -g
+do
+case $cf_fix_cppflags in
+no)
+	case $cf_add_cflags in #(vi
+	-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi
+		case $cf_add_cflags in
+		-D*)
+			cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'`
 
-	do {
-		void *foo = &(boolnames);
-		${cf_cv_main_return:-return}(foo == 0);
-	} while (0)
+			test "${cf_add_cflags}" != "${cf_tst_cflags}" \
+				&& test -z "${cf_tst_cflags}" \
+				&& cf_fix_cppflags=yes
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:14850: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
-  ac_status=$?
-  echo "$as_me:14853: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:14856: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:14859: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  cf_result=yes
-else
-  echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
-cf_result=no
-fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+			if test $cf_fix_cppflags = yes ; then
+				cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
+				continue
+			elif test "${cf_tst_cflags}" = "\"'" ; then
+				cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
+				continue
+			fi
+			;;
+		esac
+		case "$CPPFLAGS" in
+		*$cf_add_cflags) #(vi
+			;;
+		*) #(vi
+			case $cf_add_cflags in #(vi
+			-D*)
+				cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'`
 
-else
-  cat >conftest.$ac_ext <<_ACEOF
-#line 14871 "configure"
-#include "confdefs.h"
+CPPFLAGS=`echo "$CPPFLAGS" | \
+	sed	-e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ 	]*\)\?[ 	]/ /g' \
+		-e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ 	]*\)\?$//g'`
 
-#ifdef HAVE_XCURSES
-#include <xcurses.h>
-char * XCursesProgramName = "test";
-#else
-#include <${cf_cv_ncurses_header:-curses.h}>
-#if defined(NCURSES_VERSION) && defined(HAVE_NCURSESW_TERM_H)
-#include <ncursesw/term.h>
-#elif defined(NCURSES_VERSION) && defined(HAVE_NCURSES_TERM_H)
-#include <ncurses/term.h>
-#elif defined(HAVE_TERM_H)
-#include <term.h>
-#endif
-#endif
+				;;
+			esac
+			cf_new_cppflags="$cf_new_cppflags $cf_add_cflags"
+			;;
+		esac
+		;;
+	*)
+		cf_new_cflags="$cf_new_cflags $cf_add_cflags"
+		;;
+	esac
+	;;
+yes)
+	cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
 
-extern char boolnames;
-int main(void)
-{
-	void *foo = &(boolnames);
-	${cf_cv_main_return:-return}(foo == 0);
-}
-_ACEOF
-rm -f conftest$ac_exeext
-if { (eval echo "$as_me:14896: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
-  ac_status=$?
-  echo "$as_me:14899: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (eval echo "$as_me:14901: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:14904: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  cf_result=yes
-else
-  echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
-cf_result=no
+	cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'`
+
+	test "${cf_add_cflags}" != "${cf_tst_cflags}" \
+		&& test -z "${cf_tst_cflags}" \
+		&& cf_fix_cppflags=no
+	;;
+esac
+done
+
+if test -n "$cf_new_cflags" ; then
+
+	CFLAGS="$CFLAGS $cf_new_cflags"
 fi
-rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+
+if test -n "$cf_new_cppflags" ; then
+
+	CPPFLAGS="$CPPFLAGS $cf_new_cppflags"
 fi
-	echo "$as_me:14915: result: $cf_result" >&5
-echo "${ECHO_T}$cf_result" >&6
-	if test $cf_result = yes ; then
 
-cf_result=`echo "decl_curses_data_boolnames" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
+if test -n "$cf_new_extra_cppflags" ; then
+
+	EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS"
+fi
+
+		;;
+	esac
+	;;
+esac
+
+echo "$as_me:15721: checking if you want to perform memory-leak testing" >&5
+echo $ECHO_N "checking if you want to perform memory-leak testing... $ECHO_C" >&6
+
+# Check whether --enable-leaks or --disable-leaks was given.
+if test "${enable_leaks+set}" = set; then
+  enableval="$enable_leaks"
+  if test "x$enableval" = xno; then with_no_leaks=yes; else with_no_leaks=no; fi
+else
+  : ${with_no_leaks:=no}
+fi;
+echo "$as_me:15731: result: $with_no_leaks" >&5
+echo "${ECHO_T}$with_no_leaks" >&6
+
+if test "$with_no_leaks" = yes ; then
 
-		cat >>confdefs.h <<EOF
-#define $cf_result 1
+cat >>confdefs.h <<\EOF
+#define NO_LEAKS 1
+EOF
+
+cat >>confdefs.h <<\EOF
+#define YY_NO_LEAKS 1
 EOF
 
-	fi
 fi
 
-echo "$as_me:14928: checking for data boolfnames declaration in ${cf_cv_ncurses_header:-curses.h}" >&5
-echo $ECHO_N "checking for data boolfnames declaration in ${cf_cv_ncurses_header:-curses.h}... $ECHO_C" >&6
+LD_RPATH_OPT=
+echo "$as_me:15747: checking for an rpath option" >&5
+echo $ECHO_N "checking for an rpath option... $ECHO_C" >&6
+case $cf_cv_system_name in #(vi
+irix*) #(vi
+	if test "$GCC" = yes; then
+		LD_RPATH_OPT="-Wl,-rpath,"
+	else
+		LD_RPATH_OPT="-rpath "
+	fi
+	;;
+linux*|gnu*|k*bsd*-gnu) #(vi
+	LD_RPATH_OPT="-Wl,-rpath,"
+	;;
+openbsd[2-9].*|mirbsd*) #(vi
+	LD_RPATH_OPT="-Wl,-rpath,"
+	;;
+dragonfly*|freebsd*) #(vi
+	LD_RPATH_OPT="-rpath "
+	;;
+netbsd*) #(vi
+	LD_RPATH_OPT="-Wl,-rpath,"
+	;;
+osf*|mls+*) #(vi
+	LD_RPATH_OPT="-rpath "
+	;;
+solaris2*) #(vi
+	LD_RPATH_OPT="-R"
+	;;
+*)
+	;;
+esac
+echo "$as_me:15778: result: $LD_RPATH_OPT" >&5
+echo "${ECHO_T}$LD_RPATH_OPT" >&6
 
-cat >conftest.$ac_ext <<_ACEOF
-#line 14932 "configure"
+case "x$LD_RPATH_OPT" in #(vi
+x-R*)
+	echo "$as_me:15783: checking if we need a space after rpath option" >&5
+echo $ECHO_N "checking if we need a space after rpath option... $ECHO_C" >&6
+	cf_save_LIBS="$LIBS"
+	LIBS="${LD_RPATH_OPT}$libdir $LIBS"
+	cat >conftest.$ac_ext <<_ACEOF
+#line 15788 "configure"
 #include "confdefs.h"
 
-#ifdef HAVE_XCURSES
-#include <xcurses.h>
-char * XCursesProgramName = "test";
-#else
-#include <${cf_cv_ncurses_header:-curses.h}>
-#if defined(NCURSES_VERSION) && defined(HAVE_NCURSESW_TERM_H)
-#include <ncursesw/term.h>
-#elif defined(NCURSES_VERSION) && defined(HAVE_NCURSES_TERM_H)
-#include <ncurses/term.h>
-#elif defined(HAVE_TERM_H)
-#include <term.h>
-#endif
-#endif
-
 int
 main ()
 {
 
-void *foo = &(boolfnames)
-
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:14960: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:15800: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:14963: \$? = $ac_status" >&5
+  echo "$as_me:15803: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:14966: \"$ac_try\"") >&5
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:15806: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:14969: \$? = $ac_status" >&5
+  echo "$as_me:15809: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  cf_result=yes
+  cf_rpath_space=no
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-cf_result=no
+cf_rpath_space=yes
 fi
-rm -f conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:14978: result: $cf_result" >&5
-echo "${ECHO_T}$cf_result" >&6
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+	LIBS="$cf_save_LIBS"
+	echo "$as_me:15819: result: $cf_rpath_space" >&5
+echo "${ECHO_T}$cf_rpath_space" >&6
+	test "$cf_rpath_space" = yes && LD_RPATH_OPT="$LD_RPATH_OPT "
+	;;
+esac
 
-if test $cf_result = yes ; then
+echo "$as_me:15825: checking if rpath-hack should be disabled" >&5
+echo $ECHO_N "checking if rpath-hack should be disabled... $ECHO_C" >&6
 
-cf_result=`echo "have_curses_data_boolfnames" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
+# Check whether --enable-rpath-hack or --disable-rpath-hack was given.
+if test "${enable_rpath_hack+set}" = set; then
+  enableval="$enable_rpath_hack"
+  test "$enableval" != no && enableval=yes
+  if test "$enableval" != "yes" ; then
+    cf_disable_rpath_hack=yes
+  else
+    cf_disable_rpath_hack=no
+  fi
+else
+  enableval=yes
+  cf_disable_rpath_hack=no
 
-	cat >>confdefs.h <<EOF
-#define $cf_result 1
-EOF
+fi;
+echo "$as_me:15842: result: $cf_disable_rpath_hack" >&5
+echo "${ECHO_T}$cf_disable_rpath_hack" >&6
+if test "$cf_disable_rpath_hack" = no ; then
+
+echo "$as_me:15846: checking for updated LDFLAGS" >&5
+echo $ECHO_N "checking for updated LDFLAGS... $ECHO_C" >&6
+if test -n "$LD_RPATH_OPT" ; then
+	echo "$as_me:15849: result: maybe" >&5
+echo "${ECHO_T}maybe" >&6
 
+	for ac_prog in ldd
+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 "$as_me:15856: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_cf_ldd_prog+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-	echo "$as_me:14990: checking for data boolfnames in library" >&5
-echo $ECHO_N "checking for data boolfnames in library... $ECHO_C" >&6
-	# BSD linkers insist on making weak linkage, but resolve at runtime.
-	if test "$cross_compiling" = yes; then
+  if test -n "$cf_ldd_prog"; then
+  ac_cv_prog_cf_ldd_prog="$cf_ldd_prog" # Let the user override the test.
+else
+  ac_save_IFS=$IFS; IFS=$ac_path_separator
+ac_dummy="$PATH"
+for ac_dir in $ac_dummy; do
+  IFS=$ac_save_IFS
+  test -z "$ac_dir" && ac_dir=.
+  $as_executable_p "$ac_dir/$ac_word" || continue
+ac_cv_prog_cf_ldd_prog="$ac_prog"
+echo "$as_me:15871: found $ac_dir/$ac_word" >&5
+break
+done
 
-	# cross-compiling
-	cat >conftest.$ac_ext <<_ACEOF
-#line 14997 "configure"
-#include "confdefs.h"
+fi
+fi
+cf_ldd_prog=$ac_cv_prog_cf_ldd_prog
+if test -n "$cf_ldd_prog"; then
+  echo "$as_me:15879: result: $cf_ldd_prog" >&5
+echo "${ECHO_T}$cf_ldd_prog" >&6
+else
+  echo "$as_me:15882: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
 
-#ifdef HAVE_XCURSES
-#include <xcurses.h>
-char * XCursesProgramName = "test";
-#else
-#include <${cf_cv_ncurses_header:-curses.h}>
-#if defined(NCURSES_VERSION) && defined(HAVE_NCURSESW_TERM_H)
-#include <ncursesw/term.h>
-#elif defined(NCURSES_VERSION) && defined(HAVE_NCURSES_TERM_H)
-#include <ncurses/term.h>
-#elif defined(HAVE_TERM_H)
-#include <term.h>
-#endif
-#endif
+  test -n "$cf_ldd_prog" && break
+done
+test -n "$cf_ldd_prog" || cf_ldd_prog="no"
 
-extern char boolfnames;
+	cf_rpath_list="/usr/lib /lib"
+	if test "$cf_ldd_prog" != no
+	then
+		cf_rpath_oops=
+
+cat >conftest.$ac_ext <<_ACEOF
+#line 15896 "configure"
+#include "confdefs.h"
+#include <stdio.h>
 int
 main ()
 {
-
-	do {
-		void *foo = &(boolfnames);
-		${cf_cv_main_return:-return}(foo == 0);
-	} while (0)
-
+printf("Hello");
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:15029: \"$ac_link\"") >&5
+if { (eval echo "$as_me:15908: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:15032: \$? = $ac_status" >&5
+  echo "$as_me:15911: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:15035: \"$ac_try\"") >&5
+  { (eval echo "$as_me:15914: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:15038: \$? = $ac_status" >&5
+  echo "$as_me:15917: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  cf_result=yes
+  cf_rpath_oops=`$cf_ldd_prog conftest$ac_exeext | fgrep ' not found' | sed -e 's% =>.*$%%' |sort -u`
+		 cf_rpath_list=`$cf_ldd_prog conftest$ac_exeext | fgrep / | sed -e 's%^.*[ 	]/%/%' -e 's%/[^/][^/]*$%%' |sort -u`
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
-cf_result=no
 fi
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 
-else
-  cat >conftest.$ac_ext <<_ACEOF
-#line 15050 "configure"
-#include "confdefs.h"
+		# If we passed the link-test, but get a "not found" on a given library,
+		# this could be due to inept reconfiguration of gcc to make it only
+		# partly honor /usr/local/lib (or whatever).  Sometimes this behavior
+		# is intentional, e.g., installing gcc in /usr/bin and suppressing the
+		# /usr/local libraries.
+		if test -n "$cf_rpath_oops"
+		then
+			for cf_rpath_src in $cf_rpath_oops
+			do
+				for cf_rpath_dir in \
+					/usr/local \
+					/usr/pkg \
+					/opt/sfw
+				do
+					if test -f $cf_rpath_dir/lib/$cf_rpath_src
+					then
+						test -n "$verbose" && echo "	...adding -L$cf_rpath_dir/lib to LDFLAGS for $cf_rpath_src" 1>&6
+
+echo "${as_me:-configure}:15945: testing ...adding -L$cf_rpath_dir/lib to LDFLAGS for $cf_rpath_src ..." 1>&5
+
+						LDFLAGS="$LDFLAGS -L$cf_rpath_dir/lib"
+						break
+					fi
+				done
+			done
+		fi
+	fi
 
-#ifdef HAVE_XCURSES
-#include <xcurses.h>
-char * XCursesProgramName = "test";
-#else
-#include <${cf_cv_ncurses_header:-curses.h}>
-#if defined(NCURSES_VERSION) && defined(HAVE_NCURSESW_TERM_H)
-#include <ncursesw/term.h>
-#elif defined(NCURSES_VERSION) && defined(HAVE_NCURSES_TERM_H)
-#include <ncurses/term.h>
-#elif defined(HAVE_TERM_H)
-#include <term.h>
-#endif
-#endif
+	test -n "$verbose" && echo "	...checking EXTRA_LDFLAGS $EXTRA_LDFLAGS" 1>&6
 
-extern char boolfnames;
-int main(void)
-{
-	void *foo = &(boolfnames);
-	${cf_cv_main_return:-return}(foo == 0);
-}
-_ACEOF
-rm -f conftest$ac_exeext
-if { (eval echo "$as_me:15075: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
-  ac_status=$?
-  echo "$as_me:15078: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (eval echo "$as_me:15080: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:15083: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  cf_result=yes
-else
-  echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
-cf_result=no
-fi
-rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
-	echo "$as_me:15094: result: $cf_result" >&5
-echo "${ECHO_T}$cf_result" >&6
-	if test $cf_result = yes ; then
+echo "${as_me:-configure}:15957: testing ...checking EXTRA_LDFLAGS $EXTRA_LDFLAGS ..." 1>&5
 
-cf_result=`echo "decl_curses_data_boolfnames" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
+test -n "$verbose" && echo "	...checking LDFLAGS $LDFLAGS" 1>&6
 
-		cat >>confdefs.h <<EOF
-#define $cf_result 1
-EOF
+echo "${as_me:-configure}:15961: testing ...checking LDFLAGS $LDFLAGS ..." 1>&5
+
+cf_rpath_dst=
+for cf_rpath_src in $LDFLAGS
+do
+	case $cf_rpath_src in #(vi
+	-L*) #(vi
+
+		# check if this refers to a directory which we will ignore
+		cf_rpath_skip=no
+		if test -n "$cf_rpath_list"
+		then
+			for cf_rpath_item in $cf_rpath_list
+			do
+				if test "x$cf_rpath_src" = "x-L$cf_rpath_item"
+				then
+					cf_rpath_skip=yes
+					break
+				fi
+			done
+		fi
+
+		if test "$cf_rpath_skip" = no
+		then
+			# transform the option
+			if test "$LD_RPATH_OPT" = "-R " ; then
+				cf_rpath_tmp=`echo "$cf_rpath_src" |sed -e "s%-L%-R %"`
+			else
+				cf_rpath_tmp=`echo "$cf_rpath_src" |sed -e "s%-L%$LD_RPATH_OPT%"`
+			fi
+
+			# if we have not already added this, add it now
+			cf_rpath_tst=`echo "$EXTRA_LDFLAGS" | sed -e "s%$cf_rpath_tmp %%"`
+			if test "x$cf_rpath_tst" = "x$EXTRA_LDFLAGS"
+			then
+				test -n "$verbose" && echo "	...Filter $cf_rpath_src ->$cf_rpath_tmp" 1>&6
+
+echo "${as_me:-configure}:15998: testing ...Filter $cf_rpath_src ->$cf_rpath_tmp ..." 1>&5
+
+				EXTRA_LDFLAGS="$cf_rpath_tmp $EXTRA_LDFLAGS"
+			fi
+		fi
+		;;
+	esac
+	cf_rpath_dst="$cf_rpath_dst $cf_rpath_src"
+done
+LDFLAGS=$cf_rpath_dst
+
+test -n "$verbose" && echo "	...checked LDFLAGS $LDFLAGS" 1>&6
+
+echo "${as_me:-configure}:16011: testing ...checked LDFLAGS $LDFLAGS ..." 1>&5
+
+test -n "$verbose" && echo "	...checking LIBS $LIBS" 1>&6
+
+echo "${as_me:-configure}:16015: testing ...checking LIBS $LIBS ..." 1>&5
+
+cf_rpath_dst=
+for cf_rpath_src in $LIBS
+do
+	case $cf_rpath_src in #(vi
+	-L*) #(vi
+
+		# check if this refers to a directory which we will ignore
+		cf_rpath_skip=no
+		if test -n "$cf_rpath_list"
+		then
+			for cf_rpath_item in $cf_rpath_list
+			do
+				if test "x$cf_rpath_src" = "x-L$cf_rpath_item"
+				then
+					cf_rpath_skip=yes
+					break
+				fi
+			done
+		fi
+
+		if test "$cf_rpath_skip" = no
+		then
+			# transform the option
+			if test "$LD_RPATH_OPT" = "-R " ; then
+				cf_rpath_tmp=`echo "$cf_rpath_src" |sed -e "s%-L%-R %"`
+			else
+				cf_rpath_tmp=`echo "$cf_rpath_src" |sed -e "s%-L%$LD_RPATH_OPT%"`
+			fi
+
+			# if we have not already added this, add it now
+			cf_rpath_tst=`echo "$EXTRA_LDFLAGS" | sed -e "s%$cf_rpath_tmp %%"`
+			if test "x$cf_rpath_tst" = "x$EXTRA_LDFLAGS"
+			then
+				test -n "$verbose" && echo "	...Filter $cf_rpath_src ->$cf_rpath_tmp" 1>&6
+
+echo "${as_me:-configure}:16052: testing ...Filter $cf_rpath_src ->$cf_rpath_tmp ..." 1>&5
+
+				EXTRA_LDFLAGS="$cf_rpath_tmp $EXTRA_LDFLAGS"
+			fi
+		fi
+		;;
+	esac
+	cf_rpath_dst="$cf_rpath_dst $cf_rpath_src"
+done
+LIBS=$cf_rpath_dst
+
+test -n "$verbose" && echo "	...checked LIBS $LIBS" 1>&6
+
+echo "${as_me:-configure}:16065: testing ...checked LIBS $LIBS ..." 1>&5
+
+	test -n "$verbose" && echo "	...checked EXTRA_LDFLAGS $EXTRA_LDFLAGS" 1>&6
+
+echo "${as_me:-configure}:16069: testing ...checked EXTRA_LDFLAGS $EXTRA_LDFLAGS ..." 1>&5
+
+fi
 
-	fi
 fi
 
 TEST_ARGS="$LIBS"
@@ -15188,7 +16156,7 @@
 : ${CONFIG_STATUS=./config.status}
 ac_clean_files_save=$ac_clean_files
 ac_clean_files="$ac_clean_files $CONFIG_STATUS"
-{ echo "$as_me:15191: creating $CONFIG_STATUS" >&5
+{ echo "$as_me:16159: creating $CONFIG_STATUS" >&5
 echo "$as_me: creating $CONFIG_STATUS" >&6;}
 cat >$CONFIG_STATUS <<_ACEOF
 #! $SHELL
@@ -15320,7 +16288,7 @@
 cat >>$CONFIG_STATUS <<EOF
 ac_cs_version="\\
 config.status
-configured by $0, generated by GNU Autoconf 2.52.20101002,
+configured by $0, generated by GNU Autoconf 2.52.20121002,
   with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
 
 Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001
@@ -15364,7 +16332,7 @@
     echo "$ac_cs_version"; exit 0 ;;
   --he | --h)
     # Conflict between --help and --header
-    { { echo "$as_me:15367: error: ambiguous option: $1
+    { { echo "$as_me:16335: error: ambiguous option: $1
 Try \`$0 --help' for more information." >&5
 echo "$as_me: error: ambiguous option: $1
 Try \`$0 --help' for more information." >&2;}
@@ -15383,7 +16351,7 @@
     ac_need_defaults=false;;
 
   # This is an error.
-  -*) { { echo "$as_me:15386: error: unrecognized option: $1
+  -*) { { echo "$as_me:16354: error: unrecognized option: $1
 Try \`$0 --help' for more information." >&5
 echo "$as_me: error: unrecognized option: $1
 Try \`$0 --help' for more information." >&2;}
@@ -15402,7 +16370,7 @@
 ## Running config.status.  ##
 ## ----------------------- ##
 
-This file was extended by $as_me 2.52.20101002, executed with
+This file was extended by $as_me 2.52.20121002, executed with
   CONFIG_FILES    = $CONFIG_FILES
   CONFIG_HEADERS  = $CONFIG_HEADERS
   CONFIG_LINKS    = $CONFIG_LINKS
@@ -15419,7 +16387,9 @@
 #
 
 AWK="$AWK"
+ECHO_CC="$ECHO_CC"
 ECHO_LD="$ECHO_LD"
+SHOW_CC="$SHOW_LD"
 
 EOF
 
@@ -15431,7 +16401,7 @@
   "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;;
   "default" ) CONFIG_COMMANDS="$CONFIG_COMMANDS default" ;;
   "ncurses_cfg.h" ) CONFIG_HEADERS="$CONFIG_HEADERS ncurses_cfg.h:ncurses_tst.hin" ;;
-  *) { { echo "$as_me:15434: error: invalid argument: $ac_config_target" >&5
+  *) { { echo "$as_me:16404: error: invalid argument: $ac_config_target" >&5
 echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
    { (exit 1); exit 1; }; };;
   esac
@@ -15490,6 +16460,7 @@
 s,@bindir@,$bindir,;t t
 s,@sbindir@,$sbindir,;t t
 s,@libexecdir@,$libexecdir,;t t
+s,@datarootdir@,$datarootdir,;t t
 s,@datadir@,$datadir,;t t
 s,@sysconfdir@,$sysconfdir,;t t
 s,@sharedstatedir@,$sharedstatedir,;t t
@@ -15529,6 +16500,7 @@
 s,@ac_ct_CC@,$ac_ct_CC,;t t
 s,@EXEEXT@,$EXEEXT,;t t
 s,@OBJEXT@,$OBJEXT,;t t
+s,@EXTRA_CPPFLAGS@,$EXTRA_CPPFLAGS,;t t
 s,@CPP@,$CPP,;t t
 s,@AWK@,$AWK,;t t
 s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t
@@ -15541,6 +16513,7 @@
 s,@MAKE_LOWER_TAGS@,$MAKE_LOWER_TAGS,;t t
 s,@MAKE_UPPER_TAGS@,$MAKE_UPPER_TAGS,;t t
 s,@MATH_LIB@,$MATH_LIB,;t t
+s,@top_builddir@,$top_builddir,;t t
 s,@CC_G_OPT@,$CC_G_OPT,;t t
 s,@CC_SHARED_OPTS@,$CC_SHARED_OPTS,;t t
 s,@DFT_DEP_SUFFIX@,$DFT_DEP_SUFFIX,;t t
@@ -15561,25 +16534,29 @@
 s,@TEST_ARGS@,$TEST_ARGS,;t t
 s,@TEST_DEPS@,$TEST_DEPS,;t t
 s,@TEST_LIBS@,$TEST_LIBS,;t t
-s,@TINFO_ARGS@,$TINFO_ARGS,;t t
+s,@TINFO_LDFLAGS@,$TINFO_LDFLAGS,;t t
+s,@TINFO_LIBS@,$TINFO_LIBS,;t t
 s,@cf_cv_abi_version@,$cf_cv_abi_version,;t t
 s,@cf_cv_rel_version@,$cf_cv_rel_version,;t t
-s,@EXTRA_CPPFLAGS@,$EXTRA_CPPFLAGS,;t t
+s,@PKG_CONFIG@,$PKG_CONFIG,;t t
+s,@ac_pt_PKG_CONFIG@,$ac_pt_PKG_CONFIG,;t t
 s,@ECHO_LT@,$ECHO_LT,;t t
 s,@ECHO_LD@,$ECHO_LD,;t t
 s,@RULE_CC@,$RULE_CC,;t t
 s,@SHOW_CC@,$SHOW_CC,;t t
 s,@ECHO_CC@,$ECHO_CC,;t t
-s,@EXTRA_CFLAGS@,$EXTRA_CFLAGS,;t t
+s,@NCURSES_WRAP_PREFIX@,$NCURSES_WRAP_PREFIX,;t t
 s,@NCURSES_CONFIG@,$NCURSES_CONFIG,;t t
-s,@PKG_CONFIG@,$PKG_CONFIG,;t t
-s,@ac_pt_PKG_CONFIG@,$ac_pt_PKG_CONFIG,;t t
+s,@ac_ct_NCURSES_CONFIG@,$ac_ct_NCURSES_CONFIG,;t t
 s,@X_CFLAGS@,$X_CFLAGS,;t t
 s,@X_PRE_LIBS@,$X_PRE_LIBS,;t t
 s,@X_LIBS@,$X_LIBS,;t t
 s,@X_EXTRA_LIBS@,$X_EXTRA_LIBS,;t t
 s,@XCURSES_CONFIG@,$XCURSES_CONFIG,;t t
-s,@NCURSES_WRAP_PREFIX@,$NCURSES_WRAP_PREFIX,;t t
+s,@ac_ct_XCURSES_CONFIG@,$ac_ct_XCURSES_CONFIG,;t t
+s,@EXTRA_CFLAGS@,$EXTRA_CFLAGS,;t t
+s,@cf_ldd_prog@,$cf_ldd_prog,;t t
+s,@EXTRA_LDFLAGS@,$EXTRA_LDFLAGS,;t t
 CEOF
 
 EOF
@@ -15694,7 +16671,7 @@
   esac
 
   if test x"$ac_file" != x-; then
-    { echo "$as_me:15697: creating $ac_file" >&5
+    { echo "$as_me:16674: creating $ac_file" >&5
 echo "$as_me: creating $ac_file" >&6;}
     rm -f "$ac_file"
   fi
@@ -15712,7 +16689,7 @@
       -) echo $tmp/stdin ;;
       [\\/$]*)
          # Absolute (can't be DOS-style, as IFS=:)
-         test -f "$f" || { { echo "$as_me:15715: error: cannot find input file: $f" >&5
+         test -f "$f" || { { echo "$as_me:16692: error: cannot find input file: $f" >&5
 echo "$as_me: error: cannot find input file: $f" >&2;}
    { (exit 1); exit 1; }; }
          echo $f;;
@@ -15725,13 +16702,45 @@
            echo $srcdir/$f
          else
            # /dev/null tree
-           { { echo "$as_me:15728: error: cannot find input file: $f" >&5
+           { { echo "$as_me:16705: error: cannot find input file: $f" >&5
 echo "$as_me: error: cannot find input file: $f" >&2;}
    { (exit 1); exit 1; }; }
          fi;;
       esac
     done` || { (exit 1); exit 1; }
 EOF
+cat >>$CONFIG_STATUS <<\EOF
+  ac_warn_datarootdir=no
+  if test x"$ac_file" != x-; then
+    for ac_item in $ac_file_inputs
+    do
+      ac_seen=`grep '@\(datadir\|mandir\|infodir\)@' $ac_item`
+      if test -n "$ac_seen"; then
+        ac_used=`grep '@datarootdir@' $ac_item`
+        if test -z "$ac_used"; then
+          { echo "$as_me:16721: WARNING: datarootdir was used implicitly but not set:
+$ac_seen" >&5
+echo "$as_me: WARNING: datarootdir was used implicitly but not set:
+$ac_seen" >&2;}
+          ac_warn_datarootdir=yes
+        fi
+      fi
+      ac_seen=`grep '${datarootdir}' $ac_item`
+      if test -n "$ac_seen"; then
+        { echo "$as_me:16730: WARNING: datarootdir was used explicitly but not set:
+$ac_seen" >&5
+echo "$as_me: WARNING: datarootdir was used explicitly but not set:
+$ac_seen" >&2;}
+        ac_warn_datarootdir=yes
+      fi
+    done
+  fi
+
+if test "x$ac_warn_datarootdir" = xyes; then
+  ac_sed_cmds="$ac_sed_cmds | sed -e 's,@datarootdir@,\${prefix}/share,g' -e 's,\${datarootdir},\${prefix}/share,g'"
+fi
+
+EOF
 cat >>$CONFIG_STATUS <<EOF
   sed "$ac_vpsub
 $extrasub
@@ -15746,11 +16755,35 @@
 " $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out
   rm -f $tmp/stdin
   if test x"$ac_file" != x-; then
-    mv $tmp/out $ac_file
+    cp $tmp/out $ac_file
+
+    for ac_name in prefix exec_prefix datarootdir
+    do
+        ac_seen=`fgrep -n '${'$ac_name'[:=].*}' $ac_file`
+        if test -n "$ac_seen"; then
+            ac_init=`egrep '[ 	]*'$ac_name'[ 	]*=' $ac_file`
+            if test -z "$ac_init"; then
+              ac_seen=`echo "$ac_seen" |sed -e 's,^,'$ac_file':,'`
+              { echo "$as_me:16767: WARNING: Variable $ac_name is used but was not set:
+$ac_seen" >&5
+echo "$as_me: WARNING: Variable $ac_name is used but was not set:
+$ac_seen" >&2;}
+            fi
+        fi
+    done
+    egrep -n '@[a-z_][a-z_0-9]+@' $ac_file >$tmp/out
+    egrep -n '@[A-Z_][A-Z_0-9]+@' $ac_file >>$tmp/out
+    if test -s $tmp/out; then
+      ac_seen=`sed -e 's,^,'$ac_file':,' < $tmp/out`
+      { echo "$as_me:16778: WARNING: Some variables may not be substituted:
+$ac_seen" >&5
+echo "$as_me: WARNING: Some variables may not be substituted:
+$ac_seen" >&2;}
+    fi
   else
     cat $tmp/out
-    rm -f $tmp/out
   fi
+  rm -f $tmp/out
 
 done
 EOF
@@ -15791,7 +16824,7 @@
   * )   ac_file_in=$ac_file.in ;;
   esac
 
-  test x"$ac_file" != x- && { echo "$as_me:15794: creating $ac_file" >&5
+  test x"$ac_file" != x- && { echo "$as_me:16827: creating $ac_file" >&5
 echo "$as_me: creating $ac_file" >&6;}
 
   # First look for the input files in the build tree, otherwise in the
@@ -15802,7 +16835,7 @@
       -) echo $tmp/stdin ;;
       [\\/$]*)
          # Absolute (can't be DOS-style, as IFS=:)
-         test -f "$f" || { { echo "$as_me:15805: error: cannot find input file: $f" >&5
+         test -f "$f" || { { echo "$as_me:16838: error: cannot find input file: $f" >&5
 echo "$as_me: error: cannot find input file: $f" >&2;}
    { (exit 1); exit 1; }; }
          echo $f;;
@@ -15815,7 +16848,7 @@
            echo $srcdir/$f
          else
            # /dev/null tree
-           { { echo "$as_me:15818: error: cannot find input file: $f" >&5
+           { { echo "$as_me:16851: error: cannot find input file: $f" >&5
 echo "$as_me: error: cannot find input file: $f" >&2;}
    { (exit 1); exit 1; }; }
          fi;;
@@ -15873,7 +16906,7 @@
   rm -f $tmp/in
   if test x"$ac_file" != x-; then
     if cmp -s $ac_file $tmp/config.h 2>/dev/null; then
-      { echo "$as_me:15876: $ac_file is unchanged" >&5
+      { echo "$as_me:16909: $ac_file is unchanged" >&5
 echo "$as_me: $ac_file is unchanged" >&6;}
     else
       ac_dir=`$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
@@ -15949,7 +16982,8 @@
 \$(MODEL)/$N.o : \$(srcdir)/$N.c \\
 	\$(srcdir)/test.priv.h \\
 	ncurses_cfg.h
-	@echo compiling $N; \$(CC) -c \$(CFLAGS_DEFAULT) \$(srcdir)/$N.c
+	$SHOW_CC
+	$ECHO_CC\$(CC) -c \$(CFLAGS_DEFAULT) \$(srcdir)/$N.c
 TEST_EOF
 done
 
Index: test/configure.in
Prereq:  1.90 
--- ncurses-5.9/test/configure.in	2011-03-22 09:15:08.000000000 +0000
+++ ncurses-5.9-20130504/test/configure.in	2013-04-27 19:45:29.000000000 +0000
@@ -1,5 +1,5 @@
 dnl***************************************************************************
-dnl Copyright (c) 1998-2010,2011 Free Software Foundation, Inc.              *
+dnl Copyright (c) 1998-2012,2013 Free Software Foundation, Inc.              *
 dnl                                                                          *
 dnl Permission is hereby granted, free of charge, to any person obtaining a  *
 dnl copy of this software and associated documentation files (the            *
@@ -28,7 +28,7 @@
 dnl
 dnl Author: Thomas E. Dickey 1996, etc.
 dnl
-dnl $Id: configure.in,v 1.90 2011/03/22 09:15:08 tom Exp $
+dnl $Id: configure.in,v 1.111 2013/04/27 19:45:29 tom Exp $
 dnl This is a simple configuration-script for the ncurses test programs that
 dnl allows the test-directory to be separately configured against a reference
 dnl system (i.e., sysvr4 curses)
@@ -38,7 +38,7 @@
 dnl
 dnl See http://invisible-island.net/autoconf/ for additional information.
 dnl ---------------------------------------------------------------------------
-AC_PREREQ(2.13.20020210)
+AC_PREREQ(2.52.20030208)
 AC_INIT(ncurses.c)
 AC_CONFIG_HEADER(ncurses_cfg.h:ncurses_tst.hin)
 
@@ -49,7 +49,7 @@
 AC_ARG_PROGRAM
 
 AC_PROG_MAKE_SET
-AC_PROG_CC
+CF_PROG_CC
 AC_PROG_CPP
 AC_PROG_AWK
 CF_PROG_INSTALL
@@ -60,6 +60,7 @@
 AC_SUBST(MATH_LIB)
 
 dnl Things that we don't need (or must override) if we're not building ncurses
+CF_TOP_BUILDDIR
 CC_G_OPT="-g"					AC_SUBST(CC_G_OPT)
 CC_SHARED_OPTS=unknown			AC_SUBST(CC_SHARED_OPTS)
 CPPFLAGS="$CPPFLAGS"			AC_SUBST(CPPFLAGS)
@@ -81,7 +82,8 @@
 TEST_ARGS=""					AC_SUBST(TEST_ARGS)
 TEST_DEPS=""					AC_SUBST(TEST_DEPS)
 TEST_LIBS=""					AC_SUBST(TEST_LIBS)
-TINFO_ARGS='$(LIBS_CURSES)'		AC_SUBST(TINFO_ARGS)
+TINFO_LDFLAGS=''				AC_SUBST(TINFO_LDFLAGS)
+TINFO_LIBS='$(LIBS_CURSES)'		AC_SUBST(TINFO_LIBS)
 cf_cv_abi_version=""			AC_SUBST(cf_cv_abi_version)
 cf_cv_rel_version=""			AC_SUBST(cf_cv_rel_version)
 
@@ -91,55 +93,38 @@
 AC_EXEEXT
 AC_OBJEXT
 
-CF_ANSI_CC_REQD
 CF_GCC_ATTRIBUTES
 CF_XOPEN_SOURCE
-AC_C_CONST
 CF_SIG_ATOMIC_T
 
+dnl ---------------------------------------------------------------------------
+CF_HELP_MESSAGE(General Options:)
+CF_PKG_CONFIG
 CF_DISABLE_ECHO
-CF_ENABLE_WARNINGS
 
-CF_DISABLE_LEAKS
-CF_WITH_CURSES_DIR
+dnl ---------------------------------------------------------------------------
+CF_HELP_MESSAGE(Curses Version-dependent Options:)
+CF_NCURSES_WRAP_PREFIX
 
-dnl SunOS 4.x
-AC_ARG_WITH(5lib,
-	[  --with-5lib             use SunOS sysv-libraries],
-	[LIBS="-L/usr/5lib $LIBS"
-	 CPPFLAGS="$CPPFLAGS -I/usr/5include"])
+AC_MSG_CHECKING(if you want to check for wide-character functions)
+CF_ARG_DISABLE(widec,
+	[  --disable-widec         disable checks for wide-character functions],
+	cf_enable_widec=no,
+	cf_enable_widec=yes,
+	yes)
+AC_MSG_RESULT($cf_enable_widec)
 
 dnl ---------------------------------------------------------------------------
-dnl NcursesW, installed in conventional location
-AC_ARG_WITH(ncursesw,
-	[  --with-ncursesw         use wide ncurses-libraries (installed)],
-	[cf_cv_screen=ncursesw],[
-
-dnl Ncurses, installed in conventional location
-AC_ARG_WITH(ncurses,
-	[  --with-ncurses          use ncurses-libraries (installed)],
-	[cf_cv_screen=ncurses],[
-
-AC_ARG_WITH(pdcurses,
-	[  --with-pdcurses         compile/link with pdcurses X11 library],
-	[cf_cv_screen=pdcurses])])])
+CF_HELP_MESSAGE(Curses Version-dependent Options:)
+CF_WITH_NCURSES_ETC
 
 case $cf_cv_screen in
-curses)
-	CF_CURSES_CONFIG
+curses|curses_*)
 	CF_NETBSD_FORM_H
 	CF_NETBSD_MENU_H
 	;;
-ncurses)
-	CF_NCURSES_CONFIG
-	;;
 ncursesw)
 	cf_cv_libtype=w
-	CF_UTF8_LIB
-	CF_NCURSES_CONFIG(ncursesw)
-	;;
-pdcurses) #(vi
-	CF_PDCURSES_X11
 	;;
 esac
 
@@ -153,9 +138,12 @@
 	;;
 *)
 	# look for curses-related libraries
-	AC_CHECK_LIB(panel$cf_cv_libtype,new_panel)
-	AC_CHECK_LIB(menu$cf_cv_libtype,menu_driver)
-	AC_CHECK_LIB(form$cf_cv_libtype,form_driver)
+	: ${cf_panel_lib:=panel}
+	: ${cf_menu_lib:=menu}
+	: ${cf_form_lib:=form}
+	AC_CHECK_LIB($cf_panel_lib$cf_cv_libtype,new_panel)
+	AC_CHECK_LIB($cf_menu_lib$cf_cv_libtype,menu_driver)
+	AC_CHECK_LIB($cf_form_lib$cf_cv_libtype,form_driver)
 
 	# look for curses-related headers
 	AC_CHECK_HEADERS( \
@@ -169,8 +157,6 @@
 	;;
 esac
 
-AC_TYPE_SIGNAL
-
 AC_STDC_HEADERS
 AC_HEADER_TIME
 AC_CHECK_HEADERS( \
@@ -185,20 +171,27 @@
 unistd.h \
 )
 
+CF_GETOPT_HEADER
+
 AC_CHECK_FUNCS( \
 gettimeofday \
+)
+
+if test "$cf_enable_widec" = yes; then
+AC_CHECK_FUNCS( \
 mblen \
 mbrlen \
 mbrtowc \
 mbsrtowcs \
 mbstowcs \
 mbtowc \
-strdup \
 wcsrtombs \
 wcstombs \
 )
+fi
 
 CF_CURSES_FUNCS( \
+assume_default_colors \
 chgat \
 color_set \
 filter \
@@ -225,61 +218,104 @@
 tigetstr \
 typeahead \
 use_default_colors \
-vw_printw \
+use_screen \
+use_window \
 vsscanf \
+vw_printw \
 wchgat \
 winsstr \
 wresize \
 wsyncdown \
 )
 
+CF_TPUTS_PROTO
 CF_NCURSES_EXT_FUNCS
 
-AC_CACHE_CHECK(for wide-character functions,cf_cv_widechar_funcs,[
-AC_TRY_LINK([
+if test "$cf_enable_widec" = yes
+then
+	# workaround for systems with ncurses before 20111029, due to change of
+	# feature test macro from _XPG5 to _XOPEN_SOURCE
+	if test -n "$cf_cv_ncurses_version" && test "x$cf_cv_ncurses_version" != xno
+	then
+		cf_define_xpg5=no
+		AC_MSG_CHECKING(if _XPG5 should be defined to enable wide-characters)
+
+		AC_TRY_COMPILE([
+#include <${cf_cv_ncurses_header:-curses.h}>],
+			[int x = _XPG5],,
+			[cf_save_cppflags="$CPPFLAGS"
+			 CPPFLAGS="$CPPFLAGS -D_XPG5"
+			 AC_TRY_COMPILE([
+#include <${cf_cv_ncurses_header:-curses.h}>],
+				[int x = _XPG5],
+				[cf_define_xpg5=yes])
+			 CPPFLAGS="$cf_save_cppflags"])
+		AC_MSG_RESULT($cf_define_xpg5)
+
+		if test "$cf_define_xpg5" = yes
+		then
+			CPPFLAGS="$CPPFLAGS -D_XPG5"
+		fi
+	fi
+
+	AC_CACHE_CHECK(for wide-character functions,cf_cv_widechar_funcs,[
+	AC_TRY_LINK([
 #include <${cf_cv_ncurses_header:-curses.h}>],
-[
-	static wchar_t src_wchar[2];
-	static cchar_t dst_cchar;
-	setcchar(&dst_cchar, src_wchar, A_NORMAL, 0, (void *) 0);
-	],
-	[cf_cv_widechar_funcs=yes],
-	[cf_cv_widechar_funcs=no])
-])
-if test "$cf_cv_widechar_funcs" != no ; then
-	AC_DEFINE(USE_WIDEC_SUPPORT,1)
+	[
+		static wchar_t src_wchar[2];
+		static cchar_t dst_cchar;
+		setcchar(&dst_cchar, src_wchar, A_NORMAL, 0, (void *) 0);
+		],
+		[cf_cv_widechar_funcs=yes],
+		[cf_cv_widechar_funcs=no])
+	])
+	if test "$cf_cv_widechar_funcs" != no ; then
+		AC_DEFINE(USE_WIDEC_SUPPORT,1,[Define to 1 to enable wide-character support in (n)curses])
+	else
+		AC_DEFINE(USE_WIDEC_SUPPORT,0)
+	fi
 else
 	AC_DEFINE(USE_WIDEC_SUPPORT,0)
 fi
 
-AC_FUNC_VFORK
 CF_SYS_TIME_SELECT
 CF_FUNC_CURSES_VERSION
-CF_CURSES_ACS_MAP
-CF_CURSES_WACS_MAP
-CF_CURSES_WACS_SYMBOLS
-
-CF_CURSES_CHECK_TYPE(attr_t,long)
-
-CF_WCHAR_TYPE(mbstate_t, NCURSES_MBSTATE_T, NCURSES_OK_MBSTATE_T)
-CF_WCHAR_TYPE(wchar_t,   NCURSES_WCHAR_T,   NCURSES_OK_WCHAR_T)
-CF_WCHAR_TYPE(wint_t,    NCURSES_WINT_T,    NCURSES_OK_WINT_T)
 
-if test "$NCURSES_OK_MBSTATE_T" = 0 ; then
-	CF_CURSES_CHECK_TYPE(mbstate_t,long)
+CF_CURSES_ACS_MAP
+if test "$cf_enable_widec" = yes; then
+	CF_CURSES_WACS_MAP
+	CF_CURSES_WACS_SYMBOLS
 fi
 
-if test "$NCURSES_OK_WCHAR_T" = 0 ; then
-	CF_CURSES_CHECK_TYPE(wchar_t,long)
-fi
+CF_CURSES_CHECK_TYPE(attr_t,long)
 
-if test "$NCURSES_OK_WINT_T" = 0 ; then
-	CF_CURSES_CHECK_TYPE(wint_t,long)
+if test "$cf_enable_widec" = yes; then
+	CF_WCHAR_TYPE(mbstate_t, NCURSES_MBSTATE_T, NCURSES_OK_MBSTATE_T)
+	CF_WCHAR_TYPE(wchar_t,   NCURSES_WCHAR_T,   NCURSES_OK_WCHAR_T)
+	CF_WCHAR_TYPE(wint_t,    NCURSES_WINT_T,    NCURSES_OK_WINT_T)
+
+	if test "$NCURSES_OK_MBSTATE_T" = 0 ; then
+		CF_CURSES_CHECK_TYPE(mbstate_t,long)
+	fi
+
+	if test "$NCURSES_OK_WCHAR_T" = 0 ; then
+		CF_CURSES_CHECK_TYPE(wchar_t,long)
+	fi
+
+	if test "$NCURSES_OK_WINT_T" = 0 ; then
+		CF_CURSES_CHECK_TYPE(wint_t,long)
+	fi
 fi
 
 CF_CURSES_CHECK_DATA(boolnames)
 CF_CURSES_CHECK_DATA(boolfnames)
 
+dnl ---------------------------------------------------------------------------
+CF_HELP_MESSAGE(Testing/development Options:)
+CF_ENABLE_WARNINGS
+CF_DISABLE_LEAKS
+CF_DISABLE_RPATH_HACK
+
 TEST_ARGS="$LIBS"
 LIBS=
 
@@ -302,7 +338,8 @@
 \$(MODEL)/$N.o : \$(srcdir)/$N.c \\
 	\$(srcdir)/test.priv.h \\
 	ncurses_cfg.h
-	@echo compiling $N; \$(CC) -c \$(CFLAGS_DEFAULT) \$(srcdir)/$N.c
+	$SHOW_CC
+	$ECHO_CC\$(CC) -c \$(CFLAGS_DEFAULT) \$(srcdir)/$N.c
 TEST_EOF
 done
 
@@ -317,5 +354,7 @@
 fi
 ],[
 AWK="$AWK"
+ECHO_CC="$ECHO_CC"
 ECHO_LD="$ECHO_LD"
+SHOW_CC="$SHOW_LD"
 ],cat)
Index: test/demo_defkey.c
Prereq:  1.20 
--- ncurses-5.9/test/demo_defkey.c	2010-11-14 00:59:35.000000000 +0000
+++ ncurses-5.9-20130504/test/demo_defkey.c	2012-12-29 22:55:39.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 2002-2007,2008 Free Software Foundation, Inc.              *
+ * Copyright (c) 2002-2008,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -26,7 +26,7 @@
  * authorization.                                                           *
  ****************************************************************************/
 /*
- * $Id: demo_defkey.c,v 1.20 2010/11/14 00:59:35 tom Exp $
+ * $Id: demo_defkey.c,v 1.21 2012/12/29 22:55:39 tom Exp $
  *
  * Demonstrate the define_key() function.
  * Thomas Dickey - 2002/11/23
@@ -106,7 +106,7 @@
 	for (pass = 0; pass < 2; ++pass) {
 	    for (n = 0; string[n] != '\0'; ++n) {
 		char temp[80];
-		strcpy(temp, visichar(string[n]));
+		strncpy(temp, visichar(string[n]), sizeof(temp) - 2);
 		if (pass)
 		    strcat(result, temp);
 		else
Index: test/demo_forms.c
Prereq:  1.38 
--- ncurses-5.9/test/demo_forms.c	2011-01-15 18:15:11.000000000 +0000
+++ ncurses-5.9-20130504/test/demo_forms.c	2012-11-18 01:22:44.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 2003-2010,2011 Free Software Foundation, Inc.              *
+ * Copyright (c) 2003-2011,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -26,7 +26,7 @@
  * authorization.                                                           *
  ****************************************************************************/
 /*
- * $Id: demo_forms.c,v 1.38 2011/01/15 18:15:11 tom Exp $
+ * $Id: demo_forms.c,v 1.40 2012/11/18 01:22:44 tom Exp $
  *
  * Demonstrate a variety of functions from the form library.
  * Thomas Dickey - 2003/4/26
@@ -108,7 +108,7 @@
 	set_field_just(f, j_value);
 	if (d_option) {
 	    if (has_colors()) {
-		set_field_fore(f, COLOR_PAIR(2));
+		set_field_fore(f, (chtype) COLOR_PAIR(2));
 		set_field_back(f, A_UNDERLINE | COLOR_PAIR(3));
 	    } else {
 		set_field_fore(f, A_BOLD);
@@ -153,10 +153,10 @@
 	set_form_sub(f, derwin(w, rows, cols, 1, 2));
 	box(w, 0, 0);
 	keypad(w, TRUE);
-    }
 
-    if (post_form(f) != E_OK)
-	wrefresh(w);
+	if (post_form(f) != E_OK)
+	    wrefresh(w);
+    }
 }
 
 static void
@@ -257,7 +257,7 @@
     int currow, curcol;
 
     if (has_colors()) {
-	wbkgd(win, COLOR_PAIR(1));
+	wbkgd(win, (chtype) COLOR_PAIR(1));
     }
     werase(win);
     form_getyx(form, currow, curcol);
@@ -309,15 +309,15 @@
 	}
 
 	waddch(win, ' ');
-	(void) wattrset(win, field_fore(field));
+	(void) wattrset(win, (int) field_fore(field));
 	waddstr(win, "fore");
-	wattroff(win, field_fore(field));
+	wattroff(win, (int) field_fore(field));
 
 	waddch(win, '/');
 
-	(void) wattrset(win, field_back(field));
+	(void) wattrset(win, (int) field_back(field));
 	waddstr(win, "back");
-	wattroff(win, field_back(field));
+	wattroff(win, (int) field_back(field));
 
 	wprintw(win, ", pad '%c'",
 		field_pad(field));
@@ -531,7 +531,7 @@
 	init_pair(1, COLOR_WHITE, COLOR_BLUE);
 	init_pair(2, COLOR_GREEN, COLOR_BLACK);
 	init_pair(3, COLOR_CYAN, COLOR_BLACK);
-	bkgd(COLOR_PAIR(1));
+	bkgd((chtype) COLOR_PAIR(1));
 	refresh();
     }
 
@@ -540,6 +540,7 @@
     endwin();
     ExitProgram(EXIT_SUCCESS);
 }
+
 #else
 int
 main(void)
Index: test/demo_menus.c
Prereq:  1.32 
--- ncurses-5.9/test/demo_menus.c	2011-01-15 20:02:47.000000000 +0000
+++ ncurses-5.9-20130504/test/demo_menus.c	2012-11-18 00:18:54.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 2005-2010,2011 Free Software Foundation, Inc.              *
+ * Copyright (c) 2005-2011,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -26,7 +26,7 @@
  * authorization.                                                           *
  ****************************************************************************/
 /*
- * $Id: demo_menus.c,v 1.32 2011/01/15 20:02:47 tom Exp $
+ * $Id: demo_menus.c,v 1.37 2012/11/18 00:18:54 tom Exp $
  *
  * Demonstrate a variety of functions from the menu library.
  * Thomas Dickey - 2005/4/9
@@ -109,18 +109,6 @@
 
 static bool loaded_file = FALSE;
 
-#if !HAVE_STRDUP
-#define strdup my_strdup
-static char *
-strdup(char *s)
-{
-    char *p = typeMalloc(char, strlen(s) + 1);
-    if (p)
-	strcpy(p, s);
-    return (p);
-}
-#endif /* not HAVE_STRDUP */
-
 /* Common function to allow ^T to toggle trace-mode in the middle of a test
  * so that trace-files can be made smaller.
  */
@@ -225,8 +213,8 @@
     result = new_menu(items);
 
     if (has_colors()) {
-	set_menu_fore(result, COLOR_PAIR(1));
-	set_menu_back(result, COLOR_PAIR(2));
+	set_menu_fore(result, (chtype) COLOR_PAIR(1));
+	set_menu_back(result, (chtype) COLOR_PAIR(2));
     }
 
     set_menu_format(result, maxrow, maxcol);
@@ -281,12 +269,15 @@
 		free((char *) blob);
 	    }
 	    free(items);
+	    items = 0;
 	}
 #ifdef TRACE
 	if ((count > 0) && (m == mpTrace)) {
 	    ITEM **ip = items;
-	    while (*ip)
-		free(*ip++);
+	    if (ip != 0) {
+		while (*ip)
+		    free(*ip++);
+	    }
 	}
 #endif
     }
@@ -398,6 +389,8 @@
 		}
 		loaded_file = TRUE;
 	    }
+	    if (ap == 0)
+		free(items);
 	}
     }
     if (ap == 0) {
@@ -831,7 +824,7 @@
 {
     static const char *const tbl[] =
     {
-	"Usage: demo_menus [options]"
+	"Usage: demo_menus [options] [menu-file]"
 	,""
 	,"Options:"
 #if HAVE_RIPOFFLINE
@@ -867,7 +860,7 @@
 #endif /* HAVE_RIPOFFLINE */
 #ifdef TRACE
 	case 't':
-	    trace(strtoul(optarg, 0, 0));
+	    trace((unsigned) strtoul(optarg, 0, 0));
 	    break;
 #endif
 	default:
Index: test/demo_termcap.c
Prereq:  1.14 
--- ncurses-5.9/test/demo_termcap.c	2011-01-15 21:41:27.000000000 +0000
+++ ncurses-5.9-20130504/test/demo_termcap.c	2013-01-19 19:30:52.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 2005-2010,2011 Free Software Foundation, Inc.              *
+ * Copyright (c) 2005-2012,2013 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -29,7 +29,7 @@
 /*
  * Author: Thomas E. Dickey
  *
- * $Id: demo_termcap.c,v 1.14 2011/01/15 21:41:27 tom Exp $
+ * $Id: demo_termcap.c,v 1.23 2013/01/19 19:30:52 tom Exp $
  *
  * A simple demo of the termcap interface.
  */
@@ -50,11 +50,112 @@
 #if USE_CODE_LISTS
 static bool b_opt = FALSE;
 static bool n_opt = FALSE;
+static bool q_opt = FALSE;
 static bool s_opt = FALSE;
 #endif
 
+static char *d_opt;
+static char *e_opt;
+static char **db_list;
+static int db_item;
+
+static long total_values;
+
 #define isCapName(c) (isgraph(c) && strchr("^#=:\\", c) == 0)
 
+#if NO_LEAKS && USE_CODE_LISTS
+
+#define MYSCR struct _myscr
+MYSCR {
+    MYSCR *next;
+    TERMINAL *term;
+};
+
+static MYSCR *my_screens;
+
+static void
+save_screen(void)
+{
+    MYSCR *obj = malloc(sizeof(MYSCR));
+    obj->next = my_screens;
+    obj->term = cur_term;
+    my_screens = obj;
+}
+#else
+#define save_screen()		/* nothing */
+#endif
+
+static char *
+make_dbitem(char *p, char *q)
+{
+    char *result = malloc(strlen(e_opt) + 2 + (size_t) (p - q));
+    sprintf(result, "%s=%.*s", e_opt, (int) (p - q), q);
+    return result;
+}
+
+static void
+make_dblist(void)
+{
+    if (d_opt && e_opt) {
+	int pass;
+
+	for (pass = 0; pass < 2; ++pass) {
+	    char *p, *q;
+	    size_t count = 0;
+
+	    for (p = q = d_opt; *p != '\0'; ++p) {
+		if (*p == ':') {
+		    if (p != q + 1) {
+			if (pass) {
+			    db_list[count] = make_dbitem(p, q);
+			}
+			count++;
+		    }
+		    q = p + 1;
+		}
+	    }
+	    if (p != q + 1) {
+		if (pass) {
+		    db_list[count] = make_dbitem(p, q);
+		}
+		count++;
+	    }
+	    if (!pass) {
+		db_list = typeCalloc(char *, count + 1);
+	    }
+	}
+    }
+}
+
+static char *
+next_dbitem(void)
+{
+    char *result = 0;
+
+    if (db_list) {
+	if ((result = db_list[db_item]) == 0) {
+	    db_item = 0;
+	    result = db_list[0];
+	} else {
+	    db_item++;
+	}
+    }
+    printf("** %s\n", result);
+    return result;
+}
+
+static void
+free_dblist(void)
+{
+    if (db_list) {
+	int n;
+	for (n = 0; db_list[n]; ++n)
+	    free(db_list[n]);
+	free(db_list);
+	db_list = 0;
+    }
+}
+
 static void
 dumpit(NCURSES_CONST char *cap)
 {
@@ -70,66 +171,77 @@
     int num;
 
     if ((str = tgetstr(cap, &ap)) != 0) {
-	/*
-	 * Note that the strings returned are mostly terminfo format, since
-	 * ncurses does not convert except for a handful of special cases.
-	 */
-	printf(FNAME(str), cap);
-	while (*str != 0) {
-	    int ch = UChar(*str++);
-	    switch (ch) {
-	    case '\177':
-		fputs("^?", stdout);
-		break;
-	    case '\033':
-		fputs("\\E", stdout);
-		break;
-	    case '\b':
-		fputs("\\b", stdout);
-		break;
-	    case '\f':
-		fputs("\\f", stdout);
-		break;
-	    case '\n':
-		fputs("\\n", stdout);
-		break;
-	    case '\r':
-		fputs("\\r", stdout);
-		break;
-	    case ' ':
-		fputs("\\s", stdout);
-		break;
-	    case '\t':
-		fputs("\\t", stdout);
-		break;
-	    case '^':
-		fputs("\\^", stdout);
-		break;
-	    case ':':
-		fputs("\\072", stdout);
-		break;
-	    case '\\':
-		fputs("\\\\", stdout);
-		break;
-	    default:
-		if (isgraph(ch))
-		    fputc(ch, stdout);
-		else if (ch < 32)
-		    printf("^%c", ch + '@');
-		else
-		    printf("\\%03o", ch);
-		break;
+	total_values++;
+	if (!q_opt) {
+	    /*
+	     * Note that the strings returned are mostly terminfo format, since
+	     * ncurses does not convert except for a handful of special cases.
+	     */
+	    printf(FNAME(str), cap);
+	    while (*str != 0) {
+		int ch = UChar(*str++);
+		switch (ch) {
+		case '\177':
+		    fputs("^?", stdout);
+		    break;
+		case '\033':
+		    fputs("\\E", stdout);
+		    break;
+		case '\b':
+		    fputs("\\b", stdout);
+		    break;
+		case '\f':
+		    fputs("\\f", stdout);
+		    break;
+		case '\n':
+		    fputs("\\n", stdout);
+		    break;
+		case '\r':
+		    fputs("\\r", stdout);
+		    break;
+		case ' ':
+		    fputs("\\s", stdout);
+		    break;
+		case '\t':
+		    fputs("\\t", stdout);
+		    break;
+		case '^':
+		    fputs("\\^", stdout);
+		    break;
+		case ':':
+		    fputs("\\072", stdout);
+		    break;
+		case '\\':
+		    fputs("\\\\", stdout);
+		    break;
+		default:
+		    if (isgraph(ch))
+			fputc(ch, stdout);
+		    else if (ch < 32)
+			printf("^%c", ch + '@');
+		    else
+			printf("\\%03o", ch);
+		    break;
+		}
 	    }
+	    printf("\n");
 	}
-	printf("\n");
     } else if ((num = tgetnum(cap)) >= 0) {
-	printf(FNAME(num), cap);
-	printf(" %d\n", num);
+	total_values++;
+	if (!q_opt) {
+	    printf(FNAME(num), cap);
+	    printf(" %d\n", num);
+	}
     } else if (tgetflag(cap) > 0) {
-	printf(FNAME(flg), cap);
-	printf("%s\n", "true");
+	++total_values;
+	if (!q_opt) {
+	    printf(FNAME(flg), cap);
+	    printf("%s\n", "true");
+	}
     }
-    fflush(stdout);
+
+    if (!q_opt)
+	fflush(stdout);
 }
 
 static void
@@ -137,6 +249,9 @@
 {
     char buffer[1024];
 
+    if (db_list) {
+	putenv(next_dbitem());
+    }
     printf("Terminal type %s\n", name);
     if (tgetent(buffer, name) >= 0) {
 	char cap[3];
@@ -159,17 +274,21 @@
 
 #if USE_CODE_LISTS
 static void
-demo_terminfo(NCURSES_CONST char *name)
+demo_termcap(NCURSES_CONST char *name)
 {
     unsigned n;
     NCURSES_CONST char *cap;
 
+    if (db_list) {
+	putenv(next_dbitem());
+    }
     printf("Terminal type \"%s\"\n", name);
 #if HAVE_SETUPTERM
     setupterm(name, 1, (int *) 0);
 #else
     setterm(name);
 #endif
+    save_screen();
 
     if (b_opt) {
 	for (n = 0;; ++n) {
@@ -204,7 +323,7 @@
 {
     static const char *msg[] =
     {
-	"Usage: demo_terminfo [options] [terminal]",
+	"Usage: demo_termcap [options] [terminal]",
 	"",
 	"If no options are given, print all (boolean, numeric, string)",
 	"capabilities for the given terminal, using short names.",
@@ -212,9 +331,15 @@
 	"Options:",
 	" -a       try all names, print capabilities found",
 	" -b       print boolean-capabilities",
+	" -d LIST  colon-separated list of databases to use",
+	" -e NAME  environment variable to set with -d option",
 	" -n       print numeric-capabilities",
+	" -q       quiet (prints only counts)",
 	" -r COUNT repeat for given count",
 	" -s       print string-capabilities",
+#ifdef NCURSES_VERSION
+	" -y       disable extended capabilities",
+#endif
     };
     unsigned n;
     for (n = 0; n < SIZEOF(msg); ++n) {
@@ -235,7 +360,7 @@
     int repeat;
     int r_opt = 1;
 
-    while ((n = getopt(argc, argv, "abnr:s")) != -1) {
+    while ((n = getopt(argc, argv, "abd:e:nqr:sy")) != -1) {
 	switch (n) {
 	case 'a':
 	    a_opt = TRUE;
@@ -243,9 +368,18 @@
 	case 'b':
 	    b_opt = TRUE;
 	    break;
+	case 'd':
+	    d_opt = optarg;
+	    break;
+	case 'e':
+	    e_opt = optarg;
+	    break;
 	case 'n':
 	    n_opt = TRUE;
 	    break;
+	case 'q':
+	    q_opt = TRUE;
+	    break;
 	case 'r':
 	    if ((r_opt = atoi(optarg)) <= 0)
 		usage();
@@ -253,6 +387,11 @@
 	case 's':
 	    s_opt = TRUE;
 	    break;
+#ifdef NCURSES_VERSION
+	case 'y':
+	    use_extended_names(FALSE);
+	    break;
+#endif
 	default:
 	    usage();
 	    break;
@@ -268,6 +407,8 @@
     a_opt = TRUE;
 #endif
 
+    make_dblist();
+
     if (a_opt) {
 	if (optind < argc) {
 	    for (n = optind; n < argc; ++n) {
@@ -285,17 +426,35 @@
 	for (repeat = 0; repeat < r_opt; ++repeat) {
 	    if (optind < argc) {
 		for (n = optind; n < argc; ++n) {
-		    demo_terminfo(argv[n]);
+		    demo_termcap(argv[n]);
 		}
 	    } else if ((name = getenv("TERM")) != 0) {
-		demo_terminfo(name);
+		demo_termcap(name);
 	    } else {
 		static char dumb[] = "dumb";
-		demo_terminfo(dumb);
+		demo_termcap(dumb);
 	    }
 	}
-    }
+#if NO_LEAKS
+	/*
+	 * ncurses' tgetent() interface caches some entries and its no-leaks
+	 * code discards those.  The calls to setupterm() on the other hand
+	 * are not cached, and each call allocates a chunk of memory, even
+	 * if the same terminal type is requested repeatedly.
+	 */
+	while (my_screens != 0) {
+	    MYSCR *next = my_screens->next;
+	    del_curterm(my_screens->term);
+	    free(my_screens);
+	    my_screens = next;
+	}
 #endif
+    }
+#endif /* USE_CODE_LISTS */
+
+    printf("%ld values\n", total_values);
+
+    free_dblist();
 
     ExitProgram(EXIT_SUCCESS);
 }
@@ -306,6 +465,6 @@
      char *argv[]GCC_UNUSED)
 {
     printf("This program requires termcap\n");
-    exit(EXIT_FAILURE);
+    ExitProgram(EXIT_FAILURE);
 }
 #endif
Index: test/demo_terminfo.c
Prereq:  1.9 
--- ncurses-5.9/test/demo_terminfo.c	2010-11-28 00:15:27.000000000 +0000
+++ ncurses-5.9-20130504/test/demo_terminfo.c	2013-01-19 19:30:58.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 2009,2010 Free Software Foundation, Inc.                   *
+ * Copyright (c) 2009-2012,2013 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -29,7 +29,7 @@
 /*
  * Author: Thomas E. Dickey
  *
- * $Id: demo_terminfo.c,v 1.9 2010/11/28 00:15:27 tom Exp $
+ * $Id: demo_terminfo.c,v 1.16 2013/01/19 19:30:58 tom Exp $
  *
  * A simple demo of the terminfo interface.
  */
@@ -52,12 +52,90 @@
 static bool b_opt = FALSE;
 static bool f_opt = FALSE;
 static bool n_opt = FALSE;
+static bool q_opt = FALSE;
 static bool s_opt = FALSE;
 static bool x_opt = FALSE;
 
+static char *d_opt;
+static char *e_opt;
+static char **db_list;
+static int db_item;
+
+static long total_values;
+
 #define FCOLS 8
 #define FNAME(type) "%s %-*s = ", #type, FCOLS
 
+static char *
+make_dbitem(char *p, char *q)
+{
+    char *result = malloc(strlen(e_opt) + 2 + (size_t) (p - q));
+    sprintf(result, "%s=%.*s", e_opt, (int) (p - q), q);
+    return result;
+}
+
+static void
+make_dblist(void)
+{
+    if (d_opt && e_opt) {
+	int pass;
+
+	for (pass = 0; pass < 2; ++pass) {
+	    char *p, *q;
+	    size_t count = 0;
+
+	    for (p = q = d_opt; *p != '\0'; ++p) {
+		if (*p == ':') {
+		    if (p != q + 1) {
+			if (pass) {
+			    db_list[count] = make_dbitem(p, q);
+			}
+			count++;
+		    }
+		    q = p + 1;
+		}
+	    }
+	    if (p != q + 1) {
+		if (pass) {
+		    db_list[count] = make_dbitem(p, q);
+		}
+		count++;
+	    }
+	    if (!pass) {
+		db_list = typeCalloc(char *, count + 1);
+	    }
+	}
+    }
+}
+
+static char *
+next_dbitem(void)
+{
+    char *result = 0;
+
+    if (db_list) {
+	if ((result = db_list[db_item]) == 0) {
+	    db_item = 0;
+	    result = db_list[0];
+	} else {
+	    db_item++;
+	}
+    }
+    printf("** %s\n", result);
+    return result;
+}
+
+static void
+free_dblist(void)
+{
+    if (db_list) {
+	int n;
+	for (n = 0; db_list[n]; ++n)
+	    free(db_list[n]);
+	free(db_list);
+	db_list = 0;
+    }
+}
 static void
 dumpit(NCURSES_CONST char *cap)
 {
@@ -72,66 +150,77 @@
     int num;
 
     if ((str = tigetstr(cap)) != 0 && (str != (char *) -1)) {
-	/*
-	 * Note that the strings returned are mostly terminfo format, since
-	 * ncurses does not convert except for a handful of special cases.
-	 */
-	printf(FNAME(str), cap);
-	while (*str != 0) {
-	    int ch = UChar(*str++);
-	    switch (ch) {
-	    case '\177':
-		fputs("^?", stdout);
-		break;
-	    case '\033':
-		fputs("\\E", stdout);
-		break;
-	    case '\b':
-		fputs("\\b", stdout);
-		break;
-	    case '\f':
-		fputs("\\f", stdout);
-		break;
-	    case '\n':
-		fputs("\\n", stdout);
-		break;
-	    case '\r':
-		fputs("\\r", stdout);
-		break;
-	    case ' ':
-		fputs("\\s", stdout);
-		break;
-	    case '\t':
-		fputs("\\t", stdout);
-		break;
-	    case '^':
-		fputs("\\^", stdout);
-		break;
-	    case ':':
-		fputs("\\072", stdout);
-		break;
-	    case '\\':
-		fputs("\\\\", stdout);
-		break;
-	    default:
-		if (isgraph(ch))
-		    fputc(ch, stdout);
-		else if (ch < 32)
-		    printf("^%c", ch + '@');
-		else
-		    printf("\\%03o", ch);
-		break;
+	total_values++;
+	if (!q_opt) {
+	    /*
+	     * Note that the strings returned are mostly terminfo format, since
+	     * ncurses does not convert except for a handful of special cases.
+	     */
+	    printf(FNAME(str), cap);
+	    while (*str != 0) {
+		int ch = UChar(*str++);
+		switch (ch) {
+		case '\177':
+		    fputs("^?", stdout);
+		    break;
+		case '\033':
+		    fputs("\\E", stdout);
+		    break;
+		case '\b':
+		    fputs("\\b", stdout);
+		    break;
+		case '\f':
+		    fputs("\\f", stdout);
+		    break;
+		case '\n':
+		    fputs("\\n", stdout);
+		    break;
+		case '\r':
+		    fputs("\\r", stdout);
+		    break;
+		case ' ':
+		    fputs("\\s", stdout);
+		    break;
+		case '\t':
+		    fputs("\\t", stdout);
+		    break;
+		case '^':
+		    fputs("\\^", stdout);
+		    break;
+		case ':':
+		    fputs("\\072", stdout);
+		    break;
+		case '\\':
+		    fputs("\\\\", stdout);
+		    break;
+		default:
+		    if (isgraph(ch))
+			fputc(ch, stdout);
+		    else if (ch < 32)
+			printf("^%c", ch + '@');
+		    else
+			printf("\\%03o", ch);
+		    break;
+		}
 	    }
+	    printf("\n");
 	}
-	printf("\n");
     } else if ((num = tigetnum(cap)) >= 0) {
-	printf(FNAME(num), cap);
-	printf(" %d\n", num);
+	total_values++;
+	if (!q_opt) {
+	    printf(FNAME(num), cap);
+	    printf(" %d\n", num);
+	}
     } else if ((num = tigetflag(cap)) >= 0) {
-	printf(FNAME(flg), cap);
-	printf("%s\n", num ? "true" : "false");
+	total_values++;
+	if (!q_opt) {
+	    printf(FNAME(flg), cap);
+	    printf("%s\n", num ? "true" : "false");
+	}
     }
-    fflush(stdout);
+
+    if (!q_opt)
+	fflush(stdout);
 }
 
 static void
@@ -140,6 +229,9 @@
     unsigned n;
     NCURSES_CONST char *cap;
 
+    if (db_list) {
+	putenv(next_dbitem());
+    }
     printf("Terminal type \"%s\"\n", name);
     setupterm(name, 1, (int *) 0);
 
@@ -191,7 +283,7 @@
 	    }
 #endif
 	} else {
-	    char temp[10];
+	    char temp[80];
 	    static const char *xterm_keys[] =
 	    {
 		"kDC", "kDN", "kEND", "kHOM", "kIC",
@@ -200,9 +292,9 @@
 	    for (n = 0; n < SIZEOF(xterm_keys); ++n) {
 		for (mod = 0; mod < 8; ++mod) {
 		    if (mod == 0)
-			strcpy(temp, xterm_keys[n]);
+			sprintf(temp, "%.*s", 8, xterm_keys[n]);
 		    else
-			sprintf(temp, "%s%d", xterm_keys[n], mod);
+			sprintf(temp, "%.*s%d", 8, xterm_keys[n], mod);
 		    dumpit(temp);
 		}
 	    }
@@ -224,12 +316,16 @@
 	"",
 	"Options:",
 	" -b       print boolean-capabilities",
+	" -d LIST  colon-separated list of databases to use",
+	" -e NAME  environment variable to set with -d option",
 	" -f       print full names",
 	" -n       print numeric-capabilities",
+	" -q       quiet (prints only counts)",
 	" -r COUNT repeat for given count",
 	" -s       print string-capabilities",
 #ifdef NCURSES_VERSION
 	" -x       print extended capabilities",
+	" -y       disable extended capabilities",
 #endif
     };
     unsigned n;
@@ -246,18 +342,30 @@
     int repeat;
     char *name;
     int r_opt = 1;
+#ifdef NCURSES_VERSION
+    bool xy_opt = TRUE;		/* by default, use_extended_names is true */
+#endif
 
-    while ((n = getopt(argc, argv, "bfnr:sx")) != -1) {
+    while ((n = getopt(argc, argv, "bd:e:fnqr:sxy")) != -1) {
 	switch (n) {
 	case 'b':
 	    b_opt = TRUE;
 	    break;
+	case 'd':
+	    d_opt = optarg;
+	    break;
+	case 'e':
+	    e_opt = optarg;
+	    break;
 	case 'f':
 	    f_opt = TRUE;
 	    break;
 	case 'n':
 	    n_opt = TRUE;
 	    break;
+	case 'q':
+	    q_opt = TRUE;
+	    break;
 	case 'r':
 	    if ((r_opt = atoi(optarg)) <= 0)
 		usage();
@@ -268,7 +376,10 @@
 #ifdef NCURSES_VERSION
 	case 'x':
 	    x_opt = TRUE;
-	    use_extended_names(TRUE);
+	    xy_opt = TRUE;
+	    break;
+	case 'y':
+	    xy_opt = FALSE;
 	    break;
 #endif
 	default:
@@ -277,12 +388,18 @@
 	}
     }
 
+#ifdef NCURSES_VERSION
+    use_extended_names(xy_opt);
+#endif
+
     if (!(b_opt || n_opt || s_opt || x_opt)) {
 	b_opt = TRUE;
 	n_opt = TRUE;
 	s_opt = TRUE;
     }
 
+    make_dblist();
+
     for (repeat = 0; repeat < r_opt; ++repeat) {
 	if (optind < argc) {
 	    for (n = optind; n < argc; ++n) {
@@ -296,6 +413,10 @@
 	}
     }
 
+    printf("%ld values\n", total_values);
+
+    free_dblist();
+
     ExitProgram(EXIT_SUCCESS);
 }
 
Index: test/ditto.c
Prereq:  1.40 
--- ncurses-5.9/test/ditto.c	2010-11-14 01:06:47.000000000 +0000
+++ ncurses-5.9-20130504/test/ditto.c	2012-11-24 20:16:18.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -29,7 +29,7 @@
 /*
  * Author: Thomas E. Dickey (1998-on)
  *
- * $Id: ditto.c,v 1.40 2010/11/14 01:06:47 tom Exp $
+ * $Id: ditto.c,v 1.42 2012/11/24 20:16:18 tom Exp $
  *
  * The program illustrates how to set up multiple screens from a single
  * program.
@@ -80,6 +80,7 @@
     int which1;			/* this screen's index in DITTO[] array */
     int length;			/* length of windows[] and peeks[] */
     char **titles;		/* per-window titles */
+    WINDOW **parents;		/* display boxes around each screen's data */
     WINDOW **windows;		/* display data from each screen */
     PEEK *peeks;		/* indices for each screen's fifo */
     FIFO fifo;			/* fifo for this screen */
@@ -98,6 +99,9 @@
     DITTO *ditto;		/* data for all screens */
 } DDATA;
 
+static void failed(const char *) GCC_NORETURN;
+static void usage(void) GCC_NORETURN;
+
 static void
 failed(const char *s)
 {
@@ -201,6 +205,7 @@
     scrollok(stdscr, TRUE);
     box(stdscr, 0, 0);
 
+    target->parents = typeCalloc(WINDOW *, (size_t) target->length);
     target->windows = typeCalloc(WINDOW *, (size_t) target->length);
     target->peeks = typeCalloc(PEEK, (size_t) target->length);
 
@@ -220,6 +225,7 @@
 	nodelay(inner, TRUE);
 #endif
 
+	target->parents[k] = outer;
 	target->windows[k] = inner;
     }
     doupdate();
Index: test/dots.c
Prereq:  1.22 
--- ncurses-5.9/test/dots.c	2010-11-14 01:00:02.000000000 +0000
+++ ncurses-5.9-20130504/test/dots.c	2011-04-23 19:15:04.000000000 +0000
@@ -29,7 +29,7 @@
 /*
  * Author: Thomas E. Dickey <dickey@clark.net> 1999
  *
- * $Id: dots.c,v 1.22 2010/11/14 01:00:02 tom Exp $
+ * $Id: dots.c,v 1.23 2011/04/23 19:15:04 tom Exp $
  *
  * A simple demo of the terminfo interface.
  */
@@ -46,8 +46,8 @@
 static long total_chars = 0;
 static time_t started;
 
-static int
-outc(TPUTS_ARG c)
+static
+TPUTS_PROTO(outc, c)
 {
     int rc = c;
 
@@ -58,7 +58,7 @@
     } else {
 	rc = putc(c, stdout);
     }
-    return rc;
+    TPUTS_RETURN(rc);
 }
 
 static bool
Index: test/dots_mvcur.c
Prereq:  1.6 
--- ncurses-5.9/test/dots_mvcur.c	2010-11-14 01:00:44.000000000 +0000
+++ ncurses-5.9-20130504/test/dots_mvcur.c	2011-04-23 19:17:20.000000000 +0000
@@ -29,7 +29,7 @@
 /*
  * Author: Thomas E. Dickey - 2007
  *
- * $Id: dots_mvcur.c,v 1.6 2010/11/14 01:00:44 tom Exp $
+ * $Id: dots_mvcur.c,v 1.7 2011/04/23 19:17:20 tom Exp $
  *
  * A simple demo of the terminfo interface, and mvcur.
  */
@@ -46,8 +46,8 @@
 static long total_chars = 0;
 static time_t started;
 
-static int
-outc(TPUTS_ARG c)
+static
+TPUTS_PROTO(outc, c)
 {
     int rc = c;
 
@@ -59,7 +59,7 @@
 	if (putc(c, stdout) == EOF)
 	    rc = EOF;
     }
-    return rc;
+    TPUTS_RETURN(rc);
 }
 
 static bool
Index: test/echochar.c
Prereq:  1.8 
--- ncurses-5.9/test/echochar.c	2010-11-14 01:00:44.000000000 +0000
+++ ncurses-5.9-20130504/test/echochar.c	2012-06-09 20:30:32.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 2006-2008,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 2006-2010,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -26,7 +26,7 @@
  * authorization.                                                           *
  ****************************************************************************/
 /*
- * $Id: echochar.c,v 1.8 2010/11/14 01:00:44 tom Exp $
+ * $Id: echochar.c,v 1.9 2012/06/09 20:30:32 tom Exp $
  *
  * Demonstrate the echochar function (compare to dots.c).
  * Thomas Dickey - 2006/11/4
@@ -74,7 +74,7 @@
 		  (short) fg,
 		  (short) bg);
     }
-    attron(COLOR_PAIR(pair));
+    attron((attr_t) COLOR_PAIR(pair));
 }
 
 int
Index: test/filter.c
Prereq:  1.13 
--- ncurses-5.9/test/filter.c	2010-11-13 20:55:54.000000000 +0000
+++ ncurses-5.9-20130504/test/filter.c	2012-06-09 20:30:32.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2008,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -29,7 +29,7 @@
 /*
  * Author:  Thomas E. Dickey <dickey@clark.net> 1998
  *
- * $Id: filter.c,v 1.13 2010/11/13 20:55:54 tom Exp $
+ * $Id: filter.c,v 1.15 2012/06/09 20:30:32 tom Exp $
  */
 #include <test.priv.h>
 
@@ -133,7 +133,7 @@
 	    background = -1;
 #endif
 	init_pair(1, COLOR_CYAN, (short) background);
-	underline = COLOR_PAIR(1);
+	underline = (attr_t) COLOR_PAIR(1);
     } else {
 	underline = A_UNDERLINE;
     }
@@ -143,7 +143,7 @@
 	reset_shell_mode();
 	printf("\n");
 	fflush(stdout);
-	system(buffer);
+	IGNORE_RC(system(buffer));
 	reset_prog_mode();
 	touchwin(stdscr);
 	erase();
Index: test/firework.c
Prereq:  1.27 
--- ncurses-5.9/test/firework.c	2010-11-13 20:58:25.000000000 +0000
+++ ncurses-5.9-20130504/test/firework.c	2013-04-27 19:46:53.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2010,2013 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -26,7 +26,7 @@
  * authorization.                                                           *
  ****************************************************************************/
 /*
- * $Id: firework.c,v 1.27 2010/11/13 20:58:25 tom Exp $
+ * $Id: firework.c,v 1.29 2013/04/27 19:46:53 tom Exp $
  */
 #include <test.priv.h>
 
@@ -41,7 +41,7 @@
     endwin();
 }
 
-static RETSIGTYPE
+static void
 onsig(int n GCC_UNUSED)
 {
     cleanup();
@@ -94,14 +94,14 @@
     showit();
 
     init_pair(1, get_colour(&bold), my_bg);
-    (void) attrset(COLOR_PAIR(1) | bold);
+    (void) attrset((chtype) COLOR_PAIR(1) | bold);
     MvPrintw(row - 1, col - 1, " - ");
     MvPrintw(row + 0, col - 1, "-+-");
     MvPrintw(row + 1, col - 1, " - ");
     showit();
 
     init_pair(1, get_colour(&bold), my_bg);
-    (void) attrset(COLOR_PAIR(1) | bold);
+    (void) attrset((chtype) COLOR_PAIR(1) | bold);
     MvPrintw(row - 2, col - 2, " --- ");
     MvPrintw(row - 1, col - 2, "-+++-");
     MvPrintw(row + 0, col - 2, "-+#+-");
@@ -110,7 +110,7 @@
     showit();
 
     init_pair(1, get_colour(&bold), my_bg);
-    (void) attrset(COLOR_PAIR(1) | bold);
+    (void) attrset((chtype) COLOR_PAIR(1) | bold);
     MvPrintw(row - 2, col - 2, " +++ ");
     MvPrintw(row - 1, col - 2, "++#++");
     MvPrintw(row + 0, col - 2, "+# #+");
@@ -119,7 +119,7 @@
     showit();
 
     init_pair(1, get_colour(&bold), my_bg);
-    (void) attrset(COLOR_PAIR(1) | bold);
+    (void) attrset((chtype) COLOR_PAIR(1) | bold);
     MvPrintw(row - 2, col - 2, "  #  ");
     MvPrintw(row - 1, col - 2, "## ##");
     MvPrintw(row + 0, col - 2, "#   #");
@@ -128,7 +128,7 @@
     showit();
 
     init_pair(1, get_colour(&bold), my_bg);
-    (void) attrset(COLOR_PAIR(1) | bold);
+    (void) attrset((chtype) COLOR_PAIR(1) | bold);
     MvPrintw(row - 2, col - 2, " # # ");
     MvPrintw(row - 1, col - 2, "#   #");
     MvPrintw(row + 0, col - 2, "     ");
Index: test/gdc.c
Prereq:  1.34 
--- ncurses-5.9/test/gdc.c	2010-11-13 21:01:23.000000000 +0000
+++ ncurses-5.9-20130504/test/gdc.c	2013-04-27 19:50:17.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -33,7 +33,7 @@
  * modified 10-18-89 for curses (jrl)
  * 10-18-89 added signal handling
  *
- * $Id: gdc.c,v 1.34 2010/11/13 21:01:23 tom Exp $
+ * $Id: gdc.c,v 1.37 2013/04/27 19:50:17 tom Exp $
  */
 
 #include <test.priv.h>
@@ -60,7 +60,7 @@
 static bool redirected = FALSE;
 static bool hascolor = FALSE;
 
-static RETSIGTYPE
+static void
 sighndl(int signo)
 {
     signal(signo, sighndl);
@@ -78,7 +78,7 @@
     int n;
 
     if (hascolor)
-	(void) attrset(COLOR_PAIR(PAIR_FRAMES));
+	(void) attrset((attr_t) COLOR_PAIR(PAIR_FRAMES));
 
     MvAddCh(YBASE - 1, XBASE - 1, ACS_ULCORNER);
     hline(ACS_HLINE, XLENGTH);
@@ -102,7 +102,7 @@
     vline(ACS_VLINE, YDEPTH);
 
     if (hascolor)
-	(void) attrset(COLOR_PAIR(PAIR_OTHERS));
+	(void) attrset((attr_t) COLOR_PAIR(PAIR_OTHERS));
 }
 
 static void
@@ -110,13 +110,13 @@
 {
     if (on) {
 	if (hascolor) {
-	    attron(COLOR_PAIR(PAIR_DIGITS));
+	    attron((attr_t) COLOR_PAIR(PAIR_DIGITS));
 	} else {
 	    attron(A_STANDOUT);
 	}
     } else {
 	if (hascolor) {
-	    attron(COLOR_PAIR(PAIR_OTHERS));
+	    attron((attr_t) COLOR_PAIR(PAIR_OTHERS));
 	} else {
 	    attroff(A_STANDOUT);
 	}
@@ -220,7 +220,7 @@
 	init_pair(PAIR_DIGITS, COLOR_BLACK, COLOR_RED);
 	init_pair(PAIR_OTHERS, COLOR_RED, bg);
 	init_pair(PAIR_FRAMES, COLOR_WHITE, bg);
-	(void) attrset(COLOR_PAIR(PAIR_OTHERS));
+	(void) attrset((attr_t) COLOR_PAIR(PAIR_OTHERS));
     }
 
   restart:
@@ -231,7 +231,7 @@
     drawbox(FALSE);
 
     do {
-	char buf[30];
+	char buf[40];
 
 	time(&now);
 	tm = localtime(&now);
@@ -293,7 +293,7 @@
 	}
 
 	/* this depends on the detailed format of ctime(3) */
-	(void) strcpy(buf, ctime(&now));
+	(void) strncpy(buf, ctime(&now), 30);
 	(void) strcpy(buf + 10, buf + 19);
 	MvAddStr(16, 30, buf);
 
Index: test/hanoi.c
Prereq:  1.31 
--- ncurses-5.9/test/hanoi.c	2010-11-14 01:01:07.000000000 +0000
+++ ncurses-5.9-20130504/test/hanoi.c	2012-12-08 16:41:56.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -41,10 +41,11 @@
  *
  *	Date: 05.Nov.90
  *
- * $Id: hanoi.c,v 1.31 2010/11/14 01:01:07 tom Exp $
+ * $Id: hanoi.c,v 1.34 2012/12/08 16:41:56 tom Exp $
  */
 
 #include <test.priv.h>
+#include <math.h>
 
 #define NPEGS			3	/* This is not configurable !! */
 #define MINTILES		3
@@ -57,7 +58,7 @@
 #define MIDPEG			39
 #define RIGHTPEG		59
 
-#define LENTOIND(x)		(((x)-1)/2)
+#define LENTOIND(x)		(((int)(x)-1)/2)
 #define OTHER(a,b)		(3-((a)+(b)))
 
 struct Peg {
@@ -84,10 +85,11 @@
     COLOR_MAGENTA,		/* Length 17 */
     COLOR_RED,			/* Length 19 */
 };
+static int NTiles = 0;
 static int NMoves = 0;
 static bool AutoFlag = FALSE;
 
-static void InitTiles(int NTiles);
+static void InitTiles(void);
 static void DisplayTiles(void);
 static void MakeMove(int From, int To);
 static void AutoMove(int From, int To, int Num);
@@ -99,7 +101,7 @@
 int
 main(int argc, char **argv)
 {
-    int NTiles, FromCol, ToCol;
+    int FromCol, ToCol;
 
     setlocale(LC_ALL, "");
 
@@ -130,9 +132,6 @@
 	Usage();
 	ExitProgram(EXIT_FAILURE);
     }
-#ifdef TRACE
-    trace(TRACE_MAXIMUM);
-#endif
     initscr();
     if (has_colors()) {
 	int i;
@@ -155,7 +154,7 @@
 	curs_set(0);
 	leaveok(stdscr, TRUE);	/* Attempt to remove cursor */
     }
-    InitTiles(NTiles);
+    InitTiles();
     DisplayTiles();
     if (AutoFlag) {
 	do {
@@ -211,7 +210,7 @@
 }
 
 static void
-InitTiles(int NTiles)
+InitTiles(void)
 {
     int Size, SlotNo;
 
@@ -232,7 +231,7 @@
     erase();
     MvAddStr(1, 24, "T O W E R S   O F   H A N O I");
     MvAddStr(3, 34, "SJR 1990");
-    MvPrintw(19, 5, "Moves : %d", NMoves);
+    MvPrintw(19, 5, "Moves : %d of %.0f", NMoves, pow(2.0, NTiles) - 1);
     (void) attrset(A_REVERSE);
     MvAddStr(BASELINE, 8,
 	     "                                                               ");
@@ -255,7 +254,7 @@
 		memset(TileBuf, ' ', len);
 		TileBuf[len] = '\0';
 		if (has_colors())
-		    (void) attrset(COLOR_PAIR(LENTOIND(len)));
+		    (void) attrset((attr_t) COLOR_PAIR(LENTOIND(len)));
 		else
 		    (void) attrset(A_REVERSE);
 		MvAddStr(BASELINE - (SlotNo + 1),
@@ -310,12 +309,12 @@
     if (Num == 1) {
 	MakeMove(From, To);
 	napms(500);
-	return;
+    } else {
+	AutoMove(From, OTHER(From, To), Num - 1);
+	MakeMove(From, To);
+	napms(500);
+	AutoMove(OTHER(From, To), To, Num - 1);
     }
-    AutoMove(From, OTHER(From, To), Num - 1);
-    MakeMove(From, To);
-    napms(500);
-    AutoMove(OTHER(From, To), To, Num - 1);
 }
 
 static int
Index: test/hashtest.c
Prereq:  1.31 
--- ncurses-5.9/test/hashtest.c	2010-11-13 23:43:15.000000000 +0000
+++ ncurses-5.9-20130504/test/hashtest.c	2013-04-27 19:50:17.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2010,2013 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -30,7 +30,7 @@
  *
  * Generate timing statistics for vertical-motion optimization.
  *
- * $Id: hashtest.c,v 1.31 2010/11/13 23:43:15 tom Exp $
+ * $Id: hashtest.c,v 1.32 2013/04/27 19:50:17 tom Exp $
  */
 
 #include <test.priv.h>
@@ -54,7 +54,7 @@
     endwin();
 }
 
-static RETSIGTYPE
+static void
 finish(int sig GCC_UNUSED)
 {
     cleanup();
Index: test/inchs.c
Prereq:  1.11 
--- ncurses-5.9/test/inchs.c	2010-11-13 23:41:23.000000000 +0000
+++ ncurses-5.9-20130504/test/inchs.c	2012-11-18 01:58:15.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 2007,2010 Free Software Foundation, Inc.                   *
+ * Copyright (c) 2007-2010,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -26,7 +26,7 @@
  * authorization.                                                           *
  ****************************************************************************/
 /*
- * $Id: inchs.c,v 1.11 2010/11/13 23:41:23 tom Exp $
+ * $Id: inchs.c,v 1.12 2012/11/18 01:58:15 tom Exp $
  *
  * Author: Thomas E Dickey
  */
@@ -50,6 +50,16 @@
 #define BASE_Y 7
 #define MAX_COLS 1024
 
+static void
+failed(const char *s)
+{
+    int save = errno;
+    endwin();
+    errno = save;
+    perror(s);
+    ExitProgram(EXIT_FAILURE);
+}
+
 static bool
 Quit(int ch)
 {
@@ -87,6 +97,8 @@
 	txtwin = stdscr;
 	base_y = BASE_Y;
     }
+    if (txtwin == 0)
+	failed("cannot create txtwin");
 
     keypad(txtwin, TRUE);	/* enable keyboard mapping */
     (void) cbreak();		/* take input chars one at a time, no wait for \n */
Index: test/ins_wide.c
Prereq:  1.15 
--- ncurses-5.9/test/ins_wide.c	2010-12-12 00:20:14.000000000 +0000
+++ ncurses-5.9-20130504/test/ins_wide.c	2012-12-16 00:51:02.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 2002-2009,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 2002-2010,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -26,7 +26,7 @@
  * authorization.                                                           *
  ****************************************************************************/
 /*
- * $Id: ins_wide.c,v 1.15 2010/12/12 00:20:14 tom Exp $
+ * $Id: ins_wide.c,v 1.20 2012/12/16 00:51:02 tom Exp $
  *
  * Demonstrate the wins_wstr() and wins_wch functions.
  * Thomas Dickey - 2002/11/23
@@ -228,8 +228,9 @@
     WINDOW *work = 0;
     WINDOW *show = 0;
     int margin = (2 * MY_TABSIZE) - 1;
-    Options option = ((m_opt ? oMove : oDefault)
-		      | ((w_opt || (level > 0)) ? oWindow : oDefault));
+    Options option = (Options) ((int) (m_opt ? oMove : oDefault)
+				| (int) ((w_opt || (level > 0))
+					 ? oWindow : oDefault));
 
     if (first) {
 	static char cmd[80];
@@ -241,6 +242,15 @@
 	(void) cbreak();	/* take input chars one at a time, no wait for \n */
 	(void) noecho();	/* don't echo input */
 	keypad(stdscr, TRUE);
+
+	/*
+	 * Show the characters inserted in color, to distinguish from those
+	 * that are shifted.
+	 */
+	if (has_colors()) {
+	    start_color();
+	    init_pair(1, COLOR_WHITE, COLOR_BLUE);
+	}
     }
 
     limit = LINES - 5;
@@ -274,14 +284,8 @@
 
     doupdate();
 
-    /*
-     * Show the characters inserted in color, to distinguish from those that
-     * are shifted.
-     */
     if (has_colors()) {
-	start_color();
-	init_pair(1, COLOR_WHITE, COLOR_BLUE);
-	wbkgdset(work, COLOR_PAIR(1) | ' ');
+	wbkgdset(work, (chtype) (COLOR_PAIR(1) | ' '));
     }
 
     while ((ch = read_linedata(work)) != ERR && !isQUIT(ch)) {
@@ -290,11 +294,13 @@
 	case key_RECUR:
 	    test_inserts(level + 1);
 
-	    touchwin(look);
+	    if (look)
+		touchwin(look);
 	    touchwin(work);
 	    touchwin(show);
 
-	    wnoutrefresh(look);
+	    if (look)
+		wnoutrefresh(look);
 	    wnoutrefresh(work);
 	    wnoutrefresh(show);
 
@@ -438,10 +444,10 @@
 	}
     }
     if (level > 0) {
-	delwin(show);
 	delwin(work);
 	delwin(look);
     }
+    delwin(show);
 }
 
 static void
Index: test/insdelln.c
Prereq:  1.5 
--- ncurses-5.9/test/insdelln.c	2010-11-13 23:39:38.000000000 +0000
+++ ncurses-5.9-20130504/test/insdelln.c	2012-11-18 00:37:58.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 2008-2009,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 2008-2010,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -26,7 +26,7 @@
  * authorization.                                                           *
  ****************************************************************************/
 /*
- * $Id: insdelln.c,v 1.5 2010/11/13 23:39:38 tom Exp $
+ * $Id: insdelln.c,v 1.7 2012/11/18 00:37:58 tom Exp $
  *
  * test-driver for deleteln, wdeleteln, insdelln, winsdelln, insertln, winsertln
  */
@@ -175,6 +175,8 @@
 	delwin(win1);
 	touchwin(win);
     } else {
+	if (win1)
+	    delwin(win1);
 	beep();
     }
 }
@@ -300,7 +302,7 @@
     init_status(win, &st);
 
     do {
-	(void) wattrset(win, st.attr | (attr_t) COLOR_PAIR(st.pair));
+	(void) wattrset(win, (int) (st.attr | (attr_t) COLOR_PAIR(st.pair)));
 	switch (st.ch) {
 	case 'i':
 	    for (n = 0; n < st.count; ++n)
Index: test/inserts.c
Prereq:  1.23 
--- ncurses-5.9/test/inserts.c	2010-12-12 00:19:55.000000000 +0000
+++ ncurses-5.9-20130504/test/inserts.c	2012-12-16 00:35:27.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 2002-2009,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 2002-2010,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -26,7 +26,7 @@
  * authorization.                                                           *
  ****************************************************************************/
 /*
- * $Id: inserts.c,v 1.23 2010/12/12 00:19:55 tom Exp $
+ * $Id: inserts.c,v 1.27 2012/12/16 00:35:27 tom Exp $
  *
  * Demonstrate the winsstr() and winsch functions.
  * Thomas Dickey - 2002/10/19
@@ -167,6 +167,15 @@
 	(void) cbreak();	/* take input chars one at a time, no wait for \n */
 	(void) noecho();	/* don't echo input */
 	keypad(stdscr, TRUE);
+
+	/*
+	 * Show the characters inserted in color, to distinguish from those
+	 * that are shifted.
+	 */
+	if (has_colors()) {
+	    start_color();
+	    init_pair(1, COLOR_WHITE, COLOR_BLUE);
+	}
     }
 
     limit = LINES - 5;
@@ -200,14 +209,8 @@
 
     doupdate();
 
-    /*
-     * Show the characters inserted in color, to distinguish from those that
-     * are shifted.
-     */
     if (has_colors()) {
-	start_color();
-	init_pair(1, COLOR_WHITE, COLOR_BLUE);
-	wbkgdset(work, COLOR_PAIR(1) | ' ');
+	wbkgdset(work, (chtype) (COLOR_PAIR(1) | ' '));
     }
 
     while ((ch = read_linedata(work)) != ERR && !isQUIT(ch)) {
@@ -216,11 +219,13 @@
 	case key_RECUR:
 	    test_inserts(level + 1);
 
-	    touchwin(look);
+	    if (look)
+		touchwin(look);
 	    touchwin(work);
 	    touchwin(show);
 
-	    wnoutrefresh(look);
+	    if (look)
+		wnoutrefresh(look);
 	    wnoutrefresh(work);
 	    wnoutrefresh(show);
 
@@ -368,10 +373,10 @@
 	}
     }
     if (level > 0) {
-	delwin(show);
 	delwin(work);
 	delwin(look);
     }
+    delwin(show);
 }
 
 static void
Index: test/knight.c
Prereq:  1.31 
--- ncurses-5.9/test/knight.c	2010-11-13 20:44:21.000000000 +0000
+++ ncurses-5.9-20130504/test/knight.c	2013-02-16 19:53:08.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2008,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -33,7 +33,7 @@
  * Eric S. Raymond <esr@snark.thyrsus.com> July 22 1995.  Mouse support
  * added September 20th 1995.
  *
- * $Id: knight.c,v 1.31 2010/11/13 20:44:21 tom Exp $
+ * $Id: knight.c,v 1.36 2013/02/16 19:53:08 tom Exp $
  */
 
 #include <test.priv.h>
@@ -123,13 +123,16 @@
 	(void) init_pair(PLUS_COLOR, (short) COLOR_RED, (short) bg);
 	(void) init_pair(MINUS_COLOR, (short) COLOR_GREEN, (short) bg);
 
-	trail |= COLOR_PAIR(TRAIL_COLOR);
-	plus |= COLOR_PAIR(PLUS_COLOR);
-	minus |= COLOR_PAIR(MINUS_COLOR);
+	trail |= (chtype) COLOR_PAIR(TRAIL_COLOR);
+	plus |= (chtype) COLOR_PAIR(PLUS_COLOR);
+	minus |= (chtype) COLOR_PAIR(MINUS_COLOR);
     }
 #ifdef NCURSES_MOUSE_VERSION
     (void) mousemask(BUTTON1_CLICKED, (mmask_t *) NULL);
 #endif /* NCURSES_MOUSE_VERSION */
+#if defined(PDCURSES)
+    mouse_set(BUTTON1_RELEASED);
+#endif
 
     oldch = minus;
 }
@@ -300,15 +303,16 @@
     }
 }
 
-static void
+static bool
 find_next_move(int *y, int *x)
 {
     unsigned j, k;
     int found = -1;
     int first = -1;
-    int next = 0;
+    int next = -1;
     int oldy, oldx;
     int newy, newx;
+    bool result = FALSE;
 
     if (movecount > 1) {
 	oldy = history[movecount - 1].y;
@@ -335,9 +339,27 @@
 	    *y = oldy + offsets[next].y;
 	    *x = oldx + offsets[next].x;
 	}
-    } else {
-	beep();
+	result = TRUE;
     }
+    return result;
+}
+
+static void
+count_next_moves(int y, int x)
+{
+    int count = 0;
+    unsigned j;
+
+    wprintw(msgwin, "\nMove %d", movecount);
+    for (j = 0; j < SIZEOF(offsets); j++) {
+	int newy = y + offsets[j].y;
+	int newx = x + offsets[j].x;
+	if (chksqr(newy, newx)) {
+	    ++count;
+	}
+    }
+    wprintw(msgwin, ", gives %d choices", count);
+    wclrtoeol(msgwin);
 }
 
 static void
@@ -558,8 +580,9 @@
 		nx = col + 1;
 		break;
 
-#ifdef NCURSES_MOUSE_VERSION
+#ifdef KEY_MOUSE
 	    case KEY_MOUSE:
+#ifdef NCURSES_MOUSE_VERSION
 		{
 		    MEVENT myevent;
 
@@ -576,6 +599,24 @@
 		    }
 		}
 #endif /* NCURSES_MOUSE_VERSION */
+#ifdef PDCURSES
+		{
+		    int test_y, test_x;
+		    request_mouse_pos();
+		    test_y = MOUSE_Y_POS + 0;
+		    test_x = MOUSE_X_POS + 1;
+		    if (test_y >= CY(0) && test_y <= CY(BDEPTH)
+			&& test_x >= CX(0) && test_x <= CX(BWIDTH)) {
+			ny = CYINV(test_y);
+			nx = CXINV(test_x);
+			wmove(helpwin, 0, 0);
+			wrefresh(helpwin);
+			ungetch('\n');
+		    }
+		    break;
+		}
+#endif /* PDCURSES */
+#endif /* KEY_MOUSE */
 
 	    case KEY_B2:
 	    case '\n':
@@ -614,8 +655,8 @@
 		    ny = history[movecount].y;
 		    nx = history[movecount].x;
 		    if (nx < 0 || ny < 0) {
-			ny = lastrow;
-			nx = lastcol;
+			ny = (lastrow >= 0) ? lastrow : 0;
+			nx = (lastcol >= 0) ? lastcol : 0;
 		    }
 		    movecount = 0;
 		    board[ny][nx] = FALSE;
@@ -652,7 +693,10 @@
 	    case 'a':
 		nx = col;
 		ny = rw;
-		find_next_move(&ny, &nx);
+		if (find_next_move(&ny, &nx))
+		    count_next_moves(ny, nx);
+		else
+		    beep();
 		break;
 
 	    case 'F':
Index: test/linedata.h
--- ncurses-5.9/test/linedata.h	2010-11-13 21:12:31.000000000 +0000
+++ ncurses-5.9-20130504/test/linedata.h	2012-12-15 22:57:19.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 2009,2010 Free Software Foundation, Inc.                   *
+ * Copyright (c) 2009-2010,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -85,10 +85,8 @@
 		    beep();
 		    continue;
 		}
-	    } else if (code != ERR) {
-		result = (int) ch;
-		break;
 	    } else {
+		result = (int) ch;
 		break;
 	    }
 	}
Index: test/modules
Prereq:  1.43 
--- ncurses-5.9/test/modules	2010-01-23 17:51:38.000000000 +0000
+++ ncurses-5.9-20130504/test/modules	2013-01-12 22:50:55.000000000 +0000
@@ -1,6 +1,6 @@
-# $Id: modules,v 1.43 2010/01/23 17:51:38 tom Exp $
+# $Id: modules,v 1.47 2013/01/12 22:50:55 tom Exp $
 ##############################################################################
-# Copyright (c) 1998-2009,2010 Free Software Foundation, Inc.                #
+# Copyright (c) 1998-2012,2013 Free Software Foundation, Inc.                #
 #                                                                            #
 # Permission is hereby granted, free of charge, to any person obtaining a    #
 # copy of this software and associated documentation files (the "Software"), #
@@ -86,10 +86,12 @@
 test_instr	progs		$(srcdir)	$(HEADER_DEPS)
 test_inwstr	progs		$(srcdir)	$(HEADER_DEPS)
 test_opaque	progs		$(srcdir)	$(HEADER_DEPS)
+test_vid_puts	progs		$(srcdir)	$(HEADER_DEPS)
+test_vidputs	progs		$(srcdir)	$(HEADER_DEPS)
 testaddch	progs		$(srcdir)	$(HEADER_DEPS)
 testcurs	progs		$(srcdir)	$(HEADER_DEPS)
 testscanw	progs		$(srcdir)	$(HEADER_DEPS)
-view		progs		$(srcdir)	$(HEADER_DEPS)
+view		progs		$(srcdir)	$(HEADER_DEPS)	$(srcdir)/widechars.h
 worm		progs		$(srcdir)	$(HEADER_DEPS)
 xmas		progs		$(srcdir)	$(HEADER_DEPS)
 
Index: test/movewindow.c
Prereq:  1.24 
--- ncurses-5.9/test/movewindow.c	2010-11-13 23:34:55.000000000 +0000
+++ ncurses-5.9-20130504/test/movewindow.c	2013-05-04 19:41:02.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 2006-2008,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 2006-2012,2013 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -26,18 +26,22 @@
  * authorization.                                                           *
  ****************************************************************************/
 /*
- * $Id: movewindow.c,v 1.24 2010/11/13 23:34:55 tom Exp $
+ * $Id: movewindow.c,v 1.39 2013/05/04 19:41:02 tom Exp $
  *
  * Demonstrate move functions for windows and derived windows from the curses
  * library.
  *
- * Thomas Dickey - 2006/2/11
+ * Author: Thomas E. Dickey
  */
 /*
 derwin
 mvderwin
 subwin
 mvwin
+
+TODO:
+    add command to reset subwindow's origin to coincide with parent.
+    add command to delete subwindow (check if it has subwindows though)
  */
 
 #include <test.priv.h>
@@ -76,6 +80,14 @@
 static FRAME *all_windows;
 
 static void
+failed(const char *s)
+{
+    perror(s);
+    endwin();
+    ExitProgram(EXIT_FAILURE);
+}
+
+static void
 message(int lineno, CONST_FMT char *fmt, va_list argp)
 {
     int y, x;
@@ -122,7 +134,12 @@
  * Arrow keys move cursor, return location at current on non-arrow key.
  */
 static PAIR *
-selectcell(WINDOW *parent, int uli, int ulj, int lri, int lrj)
+selectcell(WINDOW *parent,
+	   WINDOW *child,
+	   int uli, int ulj,
+	   int lri, int lrj,
+	   bool relative,
+	   bool * more)
 {
     static PAIR res;		/* result cell */
     int si = lri - uli + 1;	/* depth of the select area */
@@ -131,25 +148,46 @@
 
     res.y = uli;
     res.x = ulj;
+
+    if (child != 0) {
+	if (relative) {
+	    getparyx(child, i, j);
+	} else {
+	    getbegyx(child, i, j);
+	    i -= uli + getbegy(parent);
+	    j -= ulj + getbegx(parent);
+	}
+    }
+
+    if (more)
+	*more = FALSE;
+
     for (;;) {
-	tail_line("Upper left [%2d,%2d] Lower right [%2d,%2d] -> %d,%d",
+	bool moved = FALSE;
+
+	tail_line("Upper left [%2d,%2d] Lower right [%2d,%2d] -> %d,%d -> %d,%d",
 		  uli, ulj,
 		  lri, lrj,
+		  i, j,
 		  uli + i, ulj + j);
 	wmove(parent, uli + i, ulj + j);
 
 	switch (wgetch(parent)) {
 	case KEY_UP:
 	    i += si - 1;
+	    moved = TRUE;
 	    break;
 	case KEY_DOWN:
 	    i++;
+	    moved = TRUE;
 	    break;
 	case KEY_LEFT:
 	    j += sj - 1;
+	    moved = TRUE;
 	    break;
 	case KEY_RIGHT:
 	    j++;
+	    moved = TRUE;
 	    break;
 	case QUIT:
 	case ESCAPE:
@@ -161,8 +199,13 @@
 
 		getmouse(&event);
 		if (event.y > uli && event.x > ulj) {
-		    i = event.y - uli;
-		    j = event.x - ulj;
+		    if (parent != stdscr) {
+			i = event.y - getbegy(parent) - uli;
+			j = event.x - getbegx(parent) - ulj;
+		    } else {
+			i = event.y - uli;
+			j = event.x - ulj;
+		    }
 		} else {
 		    beep();
 		    break;
@@ -175,8 +218,26 @@
 	    res.x = ulj + j;
 	    return (&res);
 	}
-	i %= si;
-	j %= sj;
+
+	if (si <= 0)
+	    i = 0;
+	else
+	    i %= si;
+
+	if (sj <= 0)
+	    j = 0;
+	else
+	    j %= sj;
+
+	/*
+	 * If the caller can handle continuous movement, return the result.
+	 */
+	if (moved && more) {
+	    *more = TRUE;
+	    res.y = uli + i;
+	    res.x = ulj + j;
+	    return (&res);
+	}
     }
 }
 
@@ -194,12 +255,20 @@
     bool result = FALSE;
 
     head_line("Use arrows to move cursor, anything else to mark corner 1");
-    if ((tmp = selectcell(parent, min_line, min_col, max_line, max_col)) != 0) {
+    if ((tmp = selectcell(parent, 0,
+			  min_line, min_col,
+			  max_line, max_col,
+			  FALSE,
+			  (bool *) 0)) != 0) {
 	*ul = *tmp;
 	MvWAddCh(parent, ul->y, ul->x, '*');
 
 	head_line("Use arrows to move cursor, anything else to mark corner 2");
-	if ((tmp = selectcell(parent, ul->y, ul->x, max_line, max_col)) != 0) {
+	if ((tmp = selectcell(parent, 0,
+			      ul->y, ul->x,
+			      max_line, max_col,
+			      FALSE,
+			      (bool *) 0)) != 0) {
 	    *lr = *tmp;
 	    MvWAddCh(parent, lr->y, lr->x, '*');
 	    wmove(parent, lr->y, lr->x);
@@ -252,6 +321,8 @@
     keypad(child, TRUE);
     if (need > have) {
 	all_windows = typeRealloc(FRAME, need, all_windows);
+	if (!all_windows)
+	    failed("add_window");
     }
     all_windows[num_windows].parent = parent;
     all_windows[num_windows].child = child;
@@ -341,10 +412,7 @@
 
     for (n = 0; n < num_windows; ++n) {
 	if (all_windows[n].parent == parent) {
-	    int y0, x0;
-
-	    getbegyx(all_windows[n].child, y0, x0);
-	    mvwin(all_windows[n].child, y0 + dy, x0 + dx);
+	    mvwin(all_windows[n].child, dy, dx);
 	    recur_move_window(all_windows[n].child, dy, dx);
 	}
     }
@@ -366,20 +434,24 @@
 	int min_line = top ? LINE_MIN : 0;
 	int max_line = top ? LINE_MAX : getmaxy(parent);
 	PAIR *tmp;
+	bool more;
 
 	head_line("Select new position for %swindow", top ? "" : "sub");
 
-	if ((tmp = selectcell(parent,
-			      min_line, min_col,
-			      max_line, max_col)) != 0) {
+	while ((tmp = selectcell(parent,
+				 win,
+				 min_line, min_col,
+				 max_line, max_col,
+				 FALSE,
+				 &more)) != 0) {
 	    int y0, x0;
 	    getbegyx(parent, y0, x0);
 	    /*
-	     * Note:  Moving a subwindow has the effect of moving a viewport
-	     * around the screen.  The parent window retains the contents of
-	     * the subwindow in the original location, but the viewport will
-	     * show the contents (again) at the new location.  So it will look
-	     * odd when testing.
+	     * Moving a subwindow has the effect of moving a viewport around
+	     * the screen.  The parent window retains the contents of the
+	     * subwindow in the original location, but the viewport will show
+	     * the contents (again) at the new location.  So it will look odd
+	     * when testing.
 	     */
 	    if (mvwin(win, y0 + tmp->y, x0 + tmp->x) != ERR) {
 		if (recur) {
@@ -388,45 +460,69 @@
 		refresh_all(win);
 		doupdate();
 		result = TRUE;
+	    } else {
+		result = FALSE;
 	    }
+	    if (!more)
+		break;
 	}
     }
+    head_line("done");
     return result;
 }
 
+static void
+show_derwin(WINDOW *win)
+{
+    int pary, parx, maxy, maxx;
+
+    getmaxyx(win, maxy, maxx);
+    getparyx(win, pary, parx);
+
+    head_line("Select new position for derived window at %d,%d (%d,%d)",
+	      pary, parx, maxy, maxx);
+}
+
 /*
  * test mvderwin().
  */
 static bool
-move_subwin(WINDOW *win)
+move_derwin(WINDOW *win)
 {
     WINDOW *parent = parent_of(win);
     bool result = FALSE;
 
     if (parent != 0) {
 	bool top = (parent == stdscr);
-	if (!top) {
-	    int min_col = top ? COL_MIN : 0;
-	    int max_col = top ? COL_MAX : getmaxx(parent);
-	    int min_line = top ? LINE_MIN : 0;
-	    int max_line = top ? LINE_MAX : getmaxy(parent);
-	    PAIR *tmp;
-
-	    head_line("Select new position for subwindow");
-
-	    if ((tmp = selectcell(parent,
-				  min_line, min_col,
-				  max_line, max_col)) != 0) {
-		int y0, x0;
-		getbegyx(parent, y0, x0);
-		if (mvderwin(win, y0 + tmp->y, x0 + tmp->x) != ERR) {
-		    refresh_all(win);
-		    doupdate();
-		    result = TRUE;
-		}
+	int min_col = top ? COL_MIN : 0;
+	int max_col = top ? COL_MAX : getmaxx(parent);
+	int min_line = top ? LINE_MIN : 0;
+	int max_line = top ? LINE_MAX : getmaxy(parent);
+	PAIR *tmp;
+	bool more;
+
+	show_derwin(win);
+	while ((tmp = selectcell(parent,
+				 win,
+				 min_line, min_col,
+				 max_line, max_col,
+				 TRUE,
+				 &more)) != 0) {
+	    if (mvderwin(win, tmp->y, tmp->x) != ERR) {
+		refresh_all(win);
+		doupdate();
+		repaint_one(win);
+		doupdate();
+		result = TRUE;
+		show_derwin(win);
+	    } else {
+		flash();
 	    }
+	    if (!more)
+		break;
 	}
     }
+    head_line("done");
     return result;
 }
 
@@ -449,6 +545,28 @@
     wrefresh(win);
 }
 
+static void
+fill_with_pattern(WINDOW *win)
+{
+    int y, x;
+    int y0, x0;
+    int y1, x1;
+    int ch = 'a';
+
+    getyx(win, y0, x0);
+    getmaxyx(win, y1, x1);
+    for (y = 0; y < y1; ++y) {
+	for (x = 0; x < x1; ++x) {
+	    MvWAddCh(win, y, x, (chtype) ch);
+	    if (++ch > 'z')
+		ch = 'a';
+	}
+    }
+    wsyncdown(win);
+    wmove(win, y0, x0);
+    wrefresh(win);
+}
+
 #define lines_of(ul,lr)	(lr.y - ul.y + 1)
 #define cols_of(ul,lr)	(lr.x - ul.x + 1)
 #define pair_of(ul)	ul.y, ul.x
@@ -523,12 +641,13 @@
 	{ 'b',		"Draw a box inside the current window" },
 	{ 'c',		"Create a new window" },
 	{ 'd',		"Create a new derived window" },
+	{ 'D',		"Move derived window (moves viewport)" },
 	{ 'f',		"Fill the current window with the next character" },
+	{ 'F',		"Fill the current window with a pattern" },
 	{ 'm',		"Move the current window" },
 	{ 'M',		"Move the current window (and its children)" },
 	{ 'q',		"Quit" },
 	{ 's',		"Create a new subwindow" },
-	{ 't',		"Move the current subwindow (moves content)" },
 	{ CTRL('L'),	"Repaint all windows, doing current one last" },
 	{ CTRL('N'),	"Cursor to next window" },
 	{ CTRL('P'),	"Cursor to previous window" },
@@ -571,6 +690,10 @@
 #endif /* NCURSES_MOUSE_VERSION */
 
     while (!done && (ch = wgetch(current_win)) != ERR) {
+	int y, x;
+
+	getyx(current_win, y, x);
+
 	switch (ch) {
 	case '?':
 	    show_help(current_win);
@@ -584,9 +707,18 @@
 	case 'd':
 	    current_win = create_my_derwin(current_win);
 	    break;
+	case 'D':
+	    if (!move_derwin(current_win)) {
+		tail_line("error");
+		continue;
+	    }
+	    break;
 	case 'f':
 	    fill_window(current_win, (chtype) wgetch(current_win));
 	    break;
+	case 'F':
+	    fill_with_pattern(current_win);
+	    break;
 	case 'm':
 	case 'M':
 	    if (!move_window(current_win, (ch == 'M'))) {
@@ -600,12 +732,6 @@
 	case 's':
 	    current_win = create_my_subwin(current_win);
 	    break;
-	case 't':
-	    if (!move_subwin(current_win)) {
-		tail_line("error");
-		continue;
-	    }
-	    break;
 	case CTRL('L'):
 	    refresh_all(current_win);
 	    break;
@@ -621,6 +747,7 @@
 	    /* want to allow deleting a window also */
 #endif
 	default:
+	    wmove(current_win, y, x);
 	    tail_line("unrecognized key (use '?' for help)");
 	    beep();
 	    continue;
Index: test/ncurses.c
Prereq:  1.365 
--- ncurses-5.9/test/ncurses.c	2011-01-22 19:48:33.000000000 +0000
+++ ncurses-5.9-20130504/test/ncurses.c	2013-04-27 19:46:53.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2010,2011 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -40,7 +40,7 @@
    Author: Eric S. Raymond <esr@snark.thyrsus.com> 1993
            Thomas E. Dickey (beginning revision 1.27 in 1996).
 
-$Id: ncurses.c,v 1.365 2011/01/22 19:48:33 tom Exp $
+$Id: ncurses.c,v 1.389 2013/04/27 19:46:53 tom Exp $
 
 ***************************************************************************/
 
@@ -166,6 +166,14 @@
 
 static void main_menu(bool);
 
+static void
+failed(const char *s)
+{
+    perror(s);
+    endwin();
+    ExitProgram(EXIT_FAILURE);
+}
+
 /* The behavior of mvhline, mvvline for negative/zero length is unspecified,
  * though we can rely on negative x/y values to stop the macro.
  */
@@ -490,7 +498,7 @@
 #ifdef __MINGW32__
     system("cmd.exe");
 #else
-    system("sh");
+    IGNORE_RC(system("sh"));
 #endif
     if (message)
 	addstr("returned from shellout.\n");
@@ -723,6 +731,8 @@
 	len_winstack = need;
 	winstack = typeRealloc(WINSTACK, len_winstack, winstack);
     }
+    if (!winstack)
+	failed("remember_boxes");
     winstack[level].text = txt_win;
     winstack[level].frame = box_win;
 }
@@ -777,12 +787,21 @@
     }
     doupdate();
 }
-#endif	/* resize_boxes */
+#endif /* resize_boxes */
 #else
 #define forget_boxes()		/* nothing */
 #define remember_boxes(level,text,frame)	/* nothing */
 #endif
 
+/*
+ * Return-code is OK/ERR or a keyname.
+ */
+static const char *
+ok_keyname(int code)
+{
+    return ((code == OK) ? "OK" : ((code == ERR) ? "ERR" : keyname(code)));
+}
+
 static void
 wgetch_test(unsigned level, WINDOW *win, int delay)
 {
@@ -824,9 +843,11 @@
 	} else if (c == 'g') {
 	    waddstr(win, "getstr test: ");
 	    echo();
-	    wgetnstr(win, buf, sizeof(buf) - 1);
+	    c = wgetnstr(win, buf, sizeof(buf) - 1);
 	    noecho();
-	    wprintw(win, "I saw %d characters:\n\t`%s'.", (int) strlen(buf), buf);
+	    wprintw(win, "I saw %d characters:\n\t`%s' (%s).",
+		    (int) strlen(buf), buf,
+		    ok_keyname(c));
 	    wclrtoeol(win);
 	    wgetch_wrap(win, first_y);
 	} else if (c == 'k') {
@@ -1023,6 +1044,8 @@
 		free(result);
 		result = 0;
 	    }
+	} else {
+	    failed("wcstos");
 	}
     }
     return result;
@@ -1072,7 +1095,7 @@
 	} else if (c == 'g') {
 	    waddstr(win, "getstr test: ");
 	    echo();
-	    code = wgetn_wstr(win, wint_buf, sizeof(wint_buf) - 1);
+	    code = wgetn_wstr(win, wint_buf, BUFSIZ - 1);
 	    noecho();
 	    if (code == ERR) {
 		wprintw(win, "wgetn_wstr returns an error.");
@@ -1394,7 +1417,7 @@
 	if (!(termattrs() & test)) {
 	    printw(" (N/A)");
 	} else {
-	    if (ncv > 0 && (getbkgd(stdscr) & A_COLOR)) {
+	    if (ncv > 0 && stdscr && (getbkgd(stdscr) & A_COLOR)) {
 		static const chtype table[] =
 		{
 		    A_STANDOUT,
@@ -1637,6 +1660,7 @@
     short pair;
     wchar_t wch[10];
 
+    memset(&ch, 0, sizeof(ch));
     if (getbkgrnd(&ch) != ERR) {
 	if (getcchar(&ch, wch, &attr, &pair, 0) != ERR) {
 	    result = attr;
@@ -1675,8 +1699,8 @@
 	    add_wch(&ch);
 	}
     } else {
-	attr_t old_attr;
-	short old_pair;
+	attr_t old_attr = 0;
+	short old_pair = 0;
 
 	(void) attr_get(&old_attr, &old_pair, 0);
 	(void) attr_set(attr, pair, 0);
@@ -1895,7 +1919,7 @@
 	} else if (color < 0) {
 	    strcpy(temp, "default");
 	} else {
-	    strcpy(temp, the_color_names[color]);
+	    sprintf(temp, "%.*s", 16, the_color_names[color]);
 	}
 	printw("%-*.*s", width, width, temp);
     }
@@ -2159,7 +2183,7 @@
     bool opt_wide = FALSE;
     bool opt_nums = FALSE;
     bool opt_xchr = FALSE;
-    wchar_t buffer[10];
+    wchar_t buffer[80];
     WINDOW *helpwin;
 
     if (COLORS * COLORS == COLOR_PAIRS) {
@@ -2220,7 +2244,7 @@
 
 	    if (row >= 0 && move(row, col) != ERR) {
 		init_pair(pair, InxToFG(i), InxToBG(i));
-		color_set(pair, NULL);
+		(void) color_set(pair, NULL);
 		if (opt_acsc)
 		    attr_on((attr_t) A_ALTCHARSET, NULL);
 		if (opt_bold)
@@ -2972,7 +2996,7 @@
 #endif
 	default:
 	    if (cycle_attr(c, &at_code, &attr)) {
-		slk_attr_set(attr, (fg || bg), NULL);
+		slk_attr_set(attr, (short) (fg || bg), NULL);
 		slk_touch();
 		slk_noutrefresh();
 		break;
@@ -3000,15 +3024,46 @@
 #endif
 #endif /* SLK_INIT */
 
-/* ISO 6429:  codes 0x80 to 0x9f may be control characters that cause the
+static void
+show_256_chars(int repeat, attr_t attr, short pair)
+{
+    unsigned first = 0;
+    unsigned last = 255;
+    unsigned code;
+    int count;
+
+    erase();
+    attron(A_BOLD);
+    MvPrintw(0, 20, "Display of Character Codes %#0x to %#0x",
+	     first, last);
+    attroff(A_BOLD);
+    refresh();
+
+    for (code = first; code <= last; ++code) {
+	int row = (int) (2 + (code / 16));
+	int col = (int) (5 * (code % 16));
+	mvaddch(row, col, colored_chtype(code, attr, pair));
+	for (count = 1; count < repeat; ++count) {
+	    addch(colored_chtype(code, attr, pair));
+	}
+    }
+
+}
+
+/*
+ * Show a slice of 32 characters, allowing those to be repeated up to the
+ * screen's width.
+ *
+ * ISO 6429:  codes 0x80 to 0x9f may be control characters that cause the
  * terminal to perform functions.  The remaining codes can be graphic.
  */
 static void
-show_upper_chars(unsigned first, int repeat, attr_t attr, short pair)
+show_upper_chars(int base, int pagesize, int repeat, attr_t attr, short pair)
 {
-    bool C1 = (first == 128);
     unsigned code;
-    unsigned last = first + 31;
+    unsigned first = (unsigned) base;
+    unsigned last = first + (unsigned) pagesize - 2;
+    bool C1 = (first == 128);
     int reply;
 
     erase();
@@ -3020,8 +3075,8 @@
 
     for (code = first; code <= last; code++) {
 	int count = repeat;
-	int row = 2 + ((int) (code - first) % 16);
-	int col = ((int) (code - first) / 16) * COLS / 2;
+	int row = 2 + ((int) (code - first) % (pagesize / 2));
+	int col = ((int) (code - first) / (pagesize / 2)) * COLS / 2;
 	char tmp[80];
 	sprintf(tmp, "%3u (0x%x)", code, code);
 	MvPrintw(row, col, "%*s: ", COLS / 4, tmp);
@@ -3195,6 +3250,7 @@
 acs_display(void)
 {
     int c = 'a';
+    int pagesize = 32;
     char *term = getenv("TERM");
     const char *pch_kludge = ((term != 0 && strstr(term, "linux"))
 			      ? "p=PC, "
@@ -3222,6 +3278,13 @@
 	    else
 		beep();
 	    break;
+	case 'w':
+	    if (pagesize == 32) {
+		pagesize = 256;
+	    } else {
+		pagesize = 32;
+	    }
+	    break;
 	case 'x':
 	    ToggleAcs(last_show_acs, show_box_chars);
 	    break;
@@ -3265,15 +3328,18 @@
 	    }
 	    break;
 	}
-	if (last_show_acs != 0)
+	if (pagesize != 32) {
+	    show_256_chars(repeat, attr, pair);
+	} else if (last_show_acs != 0) {
 	    last_show_acs(repeat, attr, pair);
-	else
-	    show_upper_chars((unsigned) (digit * 32 + 128), repeat, attr, pair);
+	} else {
+	    show_upper_chars(digit * pagesize + 128, pagesize, repeat, attr, pair);
+	}
 
 	MvPrintw(LINES - 3, 0,
 		 "Note: ANSI terminals may not display C1 characters.");
 	MvPrintw(LINES - 2, 0,
-		 "Select: a=ACS, x=box, %s0=C1, 1-3,+/- non-ASCII, </> repeat, ESC=quit",
+		 "Select: a=ACS, w=all x=box, %s0=C1, 1-3,+/- non-ASCII, </> repeat, ESC=quit",
 		 pch_kludge);
 	if (use_colors) {
 	    MvPrintw(LINES - 1, 0,
@@ -3312,6 +3378,53 @@
     return dst;
 }
 
+/*
+ * Header/legend take up no more than 8 lines, leaving 16 lines on a 24-line
+ * display.  If there are no repeats, we could normally display 16 lines of 64
+ * characters (1024 total).  However, taking repeats and double-width cells
+ * into account, use 256 characters for the page.
+ */
+static void
+show_paged_widechars(int base,
+		     int pagesize,
+		     int repeat,
+		     int space,
+		     attr_t attr,
+		     short pair)
+{
+    int first = base * pagesize;
+    int last = first + pagesize - 1;
+    int per_line = 16;
+    cchar_t temp;
+    wchar_t code;
+    wchar_t codes[10];
+
+    erase();
+    attron(A_BOLD);
+    MvPrintw(0, 20, "Display of Character Codes %#x to %#x", first, last);
+    attroff(A_BOLD);
+
+    for (code = first; (int) code <= last; code++) {
+	int row = (2 + ((int) code - first) / per_line);
+	int col = 5 * ((int) code % per_line);
+	int count;
+
+	memset(&codes, 0, sizeof(codes));
+	codes[0] = code;
+	setcchar(&temp, codes, attr, pair, 0);
+	move(row, col);
+	if (wcwidth(code) == 0 && code != 0) {
+	    addch((chtype) space |
+		  (A_REVERSE ^ attr) |
+		  (attr_t) COLOR_PAIR(pair));
+	}
+	add_wch(&temp);
+	for (count = 1; count < repeat; ++count) {
+	    add_wch(&temp);
+	}
+    }
+}
+
 static void
 show_upper_widechars(int first, int repeat, int space, attr_t attr, short pair)
 {
@@ -3332,11 +3445,13 @@
 	int count = repeat;
 	int y, x;
 
-	memset(&codes, 0, sizeof(codes));
-	codes[0] = code;
 	sprintf(tmp, "%3ld (0x%lx)", (long) code, (long) code);
 	MvPrintw(row, col, "%*s: ", COLS / 4, tmp);
+
+	memset(&codes, 0, sizeof(codes));
+	codes[0] = code;
 	setcchar(&temp, codes, attr, pair, 0);
+
 	do {
 	    /*
 	     * Give non-spacing characters something to combine with.  If we
@@ -3350,16 +3465,17 @@
 		      (attr_t) COLOR_PAIR(pair));
 	    }
 	    /*
-	     * This could use add_wch(), but is done for comparison with the
-	     * normal 'f' test (and to make a test-case for echo_wchar()).
-	     * The screen will flicker because the erase() at the top of the
-	     * function is met by the builtin refresh() in echo_wchar().
+	     * This uses echo_wchar(), for comparison with the normal 'f'
+	     * test (and to make a test-case for echo_wchar()).  The screen
+	     * may flicker because the erase() at the top of the function
+	     * is met by the builtin refresh() in echo_wchar().
 	     */
 	    echo_wchar(&temp);
 	    /*
 	     * The repeat-count may make text wrap - avoid that.
 	     */
 	    getyx(stdscr, y, x);
+	    (void) y;
 	    if (x >= col + (COLS / 2) - 2)
 		break;
 	} while (--count > 0);
@@ -3612,7 +3728,7 @@
 
     MvPrintw(row, col, "%*s : ", COLS / 4, name);
     (void) attr_set(attr, pair, 0);
-    addstr(strcpy(temp, code));
+    addstr(strncpy(temp, code, 20));
     (void) attr_set(A_NORMAL, 0, 0);
     return n + 1;
 }
@@ -3680,6 +3796,7 @@
     int digit = 0;
     int repeat = 1;
     int space = ' ';
+    int pagesize = 32;
     chtype attr = A_NORMAL;
     int fg = COLOR_BLACK;
     int bg = COLOR_BLACK;
@@ -3705,6 +3822,13 @@
 	    ToggleAcs(last_show_wacs, show_wacs_chars_thick);
 	    break;
 #endif
+	case 'w':
+	    if (pagesize == 32) {
+		pagesize = 256;
+	    } else {
+		pagesize = 32;
+	    }
+	    break;
 	case 'x':
 	    ToggleAcs(last_show_wacs, show_wbox_chars);
 	    break;
@@ -3738,20 +3862,25 @@
 	    }
 	    break;
 	}
-	if (last_show_wacs != 0)
+	if (pagesize != 32) {
+	    show_paged_widechars(digit, pagesize, repeat, space, attr, pair);
+	} else if (last_show_wacs != 0) {
 	    last_show_wacs(repeat, attr, pair);
-	else
+	} else {
 	    show_upper_widechars(digit * 32 + 128, repeat, space, attr, pair);
+	}
 
-	MvPrintw(LINES - 3, 0,
-		 "Select: a/d/t WACS, x box, u UTF-8, 0-9,+/- non-ASCII, </> repeat, ESC=quit");
+	MvPrintw(LINES - 4, 0,
+		 "Select: a/d/t WACS, w=all x=box, u UTF-8, ^L repaint");
+	MvPrintw(LINES - 3, 2,
+		 "0-9,+/- non-ASCII, </> repeat, _ space, ESC=quit");
 	if (use_colors) {
-	    MvPrintw(LINES - 2, 0,
+	    MvPrintw(LINES - 2, 2,
 		     "v/V, f/F, b/B cycle through video attributes (%s) and color %d/%d.",
 		     attrs_to_cycle[at_code].name,
 		     fg, bg);
 	} else {
-	    MvPrintw(LINES - 2, 0,
+	    MvPrintw(LINES - 2, 2,
 		     "v/V cycles through video attributes (%s).",
 		     attrs_to_cycle[at_code].name);
 	}
@@ -3779,7 +3908,7 @@
 	/* Use non-default colors if possible to exercise bce a little */
 	if (use_colors) {
 	    init_pair(1, COLOR_WHITE, COLOR_BLUE);
-	    normal |= COLOR_PAIR(1);
+	    normal |= (chtype) COLOR_PAIR(1);
 	}
 	bkgdset(normal);
 	erase();
@@ -4115,7 +4244,8 @@
     outerbox(ul, lr, TRUE);
     refresh();
 
-    wrefresh(rwindow);
+    if (rwindow != 0)
+	wrefresh(rwindow);
 
     move(0, 0);
     clrtoeol();
@@ -4186,9 +4316,11 @@
 	switch (c) {
 	case CTRL('C'):
 	    if ((neww = typeCalloc(FRAME, 1)) == 0) {
+		failed("acs_and_scroll");
 		goto breakout;
 	    }
 	    if ((neww->wind = getwindow()) == (WINDOW *) 0) {
+		failed("acs_and_scroll");
 		free(neww);
 		goto breakout;
 	    }
@@ -4269,12 +4401,16 @@
 
 		    neww->next = current ? current->next : 0;
 		    neww->last = current;
-		    neww->last->next = neww;
-		    neww->next->last = neww;
+		    if (neww->last != 0)
+			neww->last->next = neww;
+		    if (neww->next != 0)
+			neww->next->last = neww;
 
 		    neww->wind = getwin(fp);
 
 		    wrefresh(neww->wind);
+		} else {
+		    failed("acs_and_scroll");
 		}
 		(void) fclose(fp);
 	    }
@@ -5226,7 +5362,7 @@
 #ifdef A_COLOR
     if (use_colors) {
 	init_pair(2, COLOR_CYAN, COLOR_BLUE);
-	wbkgd(subWin, COLOR_PAIR(2) | ' ');
+	wbkgd(subWin, (chtype) (COLOR_PAIR(2) | ' '));
     }
 #endif
     (void) wattrset(subWin, A_BOLD);
@@ -5449,6 +5585,8 @@
 	for (n = 0; t_tbl[n].name != 0; n++)
 	    need += strlen(t_tbl[n].name) + 2;
 	buf = typeMalloc(char, need);
+	if (!buf)
+	    failed("tracetrace");
     }
     sprintf(buf, "0x%02x = {", tlevel);
     if (tlevel == 0) {
@@ -5622,10 +5760,9 @@
 	set_form_sub(f, derwin(w, rows, cols, 1, 2));
 	box(w, 0, 0);
 	keypad(w, TRUE);
+	if (post_form(f) != E_OK)
+	    wrefresh(w);
     }
-
-    if (post_form(f) != E_OK)
-	wrefresh(w);
 }
 
 static void
@@ -5649,55 +5786,60 @@
     if (field_info(me, &rows, &cols, &frow, &fcol, &nrow, &nbuf) == E_OK
 	&& nbuf > 0) {
 	char *source = field_buffer(me, 1);
-	char temp[80];
+	size_t have = (source ? strlen(source) : 0) + 1;
+	size_t need = 80 + have;
+	char *temp = malloc(need);
 	long len;
 
-	strcpy(temp, source ? source : "");
-	len = (long) (char *) field_userptr(me);
-	if (c <= KEY_MAX) {
-	    if (isgraph(c) && (len + 1) < (int) sizeof(temp)) {
-		temp[len++] = (char) c;
-		temp[len] = 0;
-		set_field_buffer(me, 1, temp);
-		c = '*';
-	    } else {
-		c = 0;
-	    }
-	} else {
-	    switch (c) {
-	    case REQ_BEG_FIELD:
-	    case REQ_CLR_EOF:
-	    case REQ_CLR_EOL:
-	    case REQ_DEL_LINE:
-	    case REQ_DEL_WORD:
-	    case REQ_DOWN_CHAR:
-	    case REQ_END_FIELD:
-	    case REQ_INS_CHAR:
-	    case REQ_INS_LINE:
-	    case REQ_LEFT_CHAR:
-	    case REQ_NEW_LINE:
-	    case REQ_NEXT_WORD:
-	    case REQ_PREV_WORD:
-	    case REQ_RIGHT_CHAR:
-	    case REQ_UP_CHAR:
-		c = 0;		/* we don't want to do inline editing */
-		break;
-	    case REQ_CLR_FIELD:
-		if (len) {
-		    temp[0] = 0;
+	if (temp != 0) {
+	    strncpy(temp, source ? source : "", have + 1);
+	    len = (long) (char *) field_userptr(me);
+	    if (c <= KEY_MAX) {
+		if (isgraph(c) && (len + 1) < (int) sizeof(temp)) {
+		    temp[len++] = (char) c;
+		    temp[len] = 0;
 		    set_field_buffer(me, 1, temp);
+		    c = '*';
+		} else {
+		    c = 0;
 		}
-		break;
-	    case REQ_DEL_CHAR:
-	    case REQ_DEL_PREV:
-		if (len) {
-		    temp[--len] = 0;
-		    set_field_buffer(me, 1, temp);
+	    } else {
+		switch (c) {
+		case REQ_BEG_FIELD:
+		case REQ_CLR_EOF:
+		case REQ_CLR_EOL:
+		case REQ_DEL_LINE:
+		case REQ_DEL_WORD:
+		case REQ_DOWN_CHAR:
+		case REQ_END_FIELD:
+		case REQ_INS_CHAR:
+		case REQ_INS_LINE:
+		case REQ_LEFT_CHAR:
+		case REQ_NEW_LINE:
+		case REQ_NEXT_WORD:
+		case REQ_PREV_WORD:
+		case REQ_RIGHT_CHAR:
+		case REQ_UP_CHAR:
+		    c = 0;	/* we don't want to do inline editing */
+		    break;
+		case REQ_CLR_FIELD:
+		    if (len) {
+			temp[0] = 0;
+			set_field_buffer(me, 1, temp);
+		    }
+		    break;
+		case REQ_DEL_CHAR:
+		case REQ_DEL_PREV:
+		    if (len) {
+			temp[--len] = 0;
+			set_field_buffer(me, 1, temp);
+		    }
+		    break;
 		}
-		break;
 	    }
+	    set_field_userptr(me, (void *) len);
+	    free(temp);
 	}
-	set_field_userptr(me, (void *) len);
     }
     return c;
 }
@@ -6056,11 +6198,11 @@
 	break;
     case 2:
 	init_pair(cpair, COLOR_BLUE, COLOR_WHITE);
-	(void) wattrset(win, (attr_t) COLOR_PAIR(cpair) | A_NORMAL);
+	(void) wattrset(win, (int) (COLOR_PAIR(cpair) | A_NORMAL));
 	break;
     case 3:
 	init_pair(cpair, COLOR_WHITE, COLOR_BLUE);
-	(void) wattrset(win, (attr_t) COLOR_PAIR(cpair) | A_BOLD);
+	(void) wattrset(win, (int) (COLOR_PAIR(cpair) | A_BOLD));
 	break;
     }
 }
@@ -6483,6 +6625,7 @@
 	,"  -a f,b   set default-colors (assumed white-on-black)"
 	,"  -d       use default-colors if terminal supports them"
 #endif
+	,"  -E       call use_env(FALSE) to ignore $LINES and $COLUMNS"
 #if USE_SOFTKEYS
 	,"  -e fmt   specify format for soft-keys test (e)"
 #endif
@@ -6495,6 +6638,9 @@
 #if USE_LIBPANEL
 	,"  -s msec  specify nominal time for panel-demo (default: 1, to hold)"
 #endif
+#if defined(NCURSES_VERSION_PATCH) && (NCURSES_VERSION_PATCH >= 20120714)
+	,"  -T       call use_tioctl(TRUE) to allow SIGWINCH to override environment"
+#endif
 #ifdef TRACE
 	,"  -t mask  specify default trace-level (may toggle with ^T)"
 #endif
@@ -6517,7 +6663,7 @@
 }
 
 #ifdef SIGUSR1
-static RETSIGTYPE
+static void
 announce_sig(int sig)
 {
     (void) fprintf(stderr, "Handled signal %d\r\n", sig);
@@ -6681,17 +6827,27 @@
 
     setlocale(LC_ALL, "");
 
-    while ((c = getopt(argc, argv, "a:de:fhmp:s:t:")) != -1) {
+    while ((c = getopt(argc, argv, "a:dEe:fhmp:s:Tt:")) != -1) {
 	switch (c) {
 #ifdef NCURSES_VERSION
 	case 'a':
 	    assumed_colors = TRUE;
-	    sscanf(optarg, "%d,%d", &default_fg, &default_bg);
+	    switch (sscanf(optarg, "%d,%d", &default_fg, &default_bg)) {
+	    case 0:
+		default_fg = COLOR_WHITE;
+		/* FALLTHRU */
+	    case 1:
+		default_bg = COLOR_BLACK;
+		break;
+	    }
 	    break;
 	case 'd':
 	    default_colors = TRUE;
 	    break;
 #endif
+	case 'E':
+	    use_env(FALSE);
+	    break;
 	case 'e':
 	    my_e_param = atoi(optarg);
 #ifdef NCURSES_VERSION
@@ -6721,6 +6877,11 @@
 	    nap_msec = (int) atol(optarg);
 	    break;
 #endif
+#if defined(NCURSES_VERSION_PATCH) && (NCURSES_VERSION_PATCH >= 20120714)
+	case 'T':
+	    use_tioctl(TRUE);
+	    break;
+#endif
 #ifdef TRACE
 	case 't':
 	    save_trace = (unsigned) strtol(optarg, 0, 0);
@@ -6761,7 +6922,7 @@
     bkgdset(BLANK);
 
     /* tests, in general, will want these modes */
-    use_colors = monochrome ? FALSE : has_colors();
+    use_colors = (bool) (monochrome ? FALSE : has_colors());
 
     if (use_colors) {
 	start_color();
@@ -6772,7 +6933,7 @@
 	    use_default_colors();
 	    min_colors = -1;
 	}
-#if NCURSES_VERSION_PATCH >= 20000708
+#if HAVE_ASSUME_DEFAULT_COLORS
 	if (assumed_colors)
 	    assume_default_colors(default_fg, default_bg);
 #endif
@@ -6785,6 +6946,8 @@
 	if (can_change_color()) {
 	    short cp;
 	    all_colors = typeMalloc(RGB_DATA, (unsigned) max_colors);
+	    if (!all_colors)
+		failed("all_colors");
 	    for (cp = 0; cp < max_colors; ++cp) {
 		color_content(cp,
 			      &all_colors[cp].red,
Index: test/newdemo.c
Prereq:  1.35 
--- ncurses-5.9/test/newdemo.c	2010-12-12 00:19:15.000000000 +0000
+++ ncurses-5.9-20130504/test/newdemo.c	2013-04-27 19:46:53.000000000 +0000
@@ -2,7 +2,7 @@
  *  newdemo.c	-	A demo program using PDCurses. The program illustrate
  *  	 		the use of colours for text output.
  *
- * $Id: newdemo.c,v 1.35 2010/12/12 00:19:15 tom Exp $
+ * $Id: newdemo.c,v 1.40 2013/04/27 19:46:53 tom Exp $
  */
 
 #include <test.priv.h>
@@ -47,7 +47,7 @@
 /*
  *  Trap interrupt
  */
-static RETSIGTYPE
+static void
 trap(int sig GCC_UNUSED)
 {
     endwin();
@@ -84,7 +84,7 @@
 	if (pair > COLOR_PAIRS)
 	    pair = COLOR_PAIRS;
 	init_pair((short) pair, (short) foreground, (short) background);
-	(void) wattrset(win, (attr_t) COLOR_PAIR(pair));
+	(void) wattrset(win, (int) COLOR_PAIR(pair));
     }
 }
 
@@ -96,7 +96,7 @@
 	    pair = COLOR_PAIRS;
 	attrs |= (chtype) COLOR_PAIR(pair);
     }
-    (void) wattrset(win, attrs);
+    (void) wattrset(win, (int) attrs);
     return attrs;
 }
 
@@ -113,12 +113,19 @@
     getbegyx(win, by, bx);
     sw = w / 3;
     sh = h / 3;
-    if ((swin1 = subwin(win, sh, sw, by + 3, bx + 5)) == NULL)
+
+    if ((swin1 = subwin(win, sh, sw, by + 3, bx + 5)) == NULL) {
 	return 1;
-    if ((swin2 = subwin(win, sh, sw, by + 4, bx + 8)) == NULL)
+    }
+    if ((swin2 = subwin(win, sh, sw, by + 4, bx + 8)) == NULL) {
+	delwin(swin1);
 	return 1;
-    if ((swin3 = subwin(win, sh, sw, by + 5, bx + 11)) == NULL)
+    }
+    if ((swin3 = subwin(win, sh, sw, by + 5, bx + 11)) == NULL) {
+	delwin(swin1);
+	delwin(swin2);
 	return 1;
+    }
 
     set_colors(swin1, 8, COLOR_RED, COLOR_BLUE);
     werase(swin1);
@@ -215,7 +222,7 @@
 {
     WINDOW *win;
     int w, x, y, i, j, k;
-    char buffer[200];
+    char buffer[SIZEOF(messages) * 80];
     const char *message;
     int width, height;
     chtype save[80];
Index: test/programs
Prereq:  1.19 
--- ncurses-5.9/test/programs	2009-09-12 19:44:01.000000000 +0000
+++ ncurses-5.9-20130504/test/programs	2013-01-13 00:46:13.000000000 +0000
@@ -1,6 +1,6 @@
-# $Id: programs,v 1.19 2009/09/12 19:44:01 tom Exp $
+# $Id: programs,v 1.21 2013/01/13 00:46:13 tom Exp $
 ##############################################################################
-# Copyright (c) 2006-2008,2009 Free Software Foundation, Inc.                #
+# Copyright (c) 2006-2009,2013 Free Software Foundation, Inc.                #
 #                                                                            #
 # Permission is hereby granted, free of charge, to any person obtaining a    #
 # copy of this software and associated documentation files (the "Software"), #
@@ -83,6 +83,8 @@
 test_instr	$(LDFLAGS_CURSES)	$(LOCAL_LIBS)	test_instr
 test_inwstr	$(LDFLAGS_CURSES)	$(LOCAL_LIBS)	test_inwstr
 test_opaque	$(LDFLAGS_CURSES)	$(LOCAL_LIBS)	test_opaque
+test_vid_puts	$(LDFLAGS_CURSES)	$(LOCAL_LIBS)	test_vid_puts
+test_vidputs	$(LDFLAGS_CURSES)	$(LOCAL_LIBS)	test_vidputs
 testaddch	$(LDFLAGS_CURSES)	$(LOCAL_LIBS)	testaddch
 testcurs	$(LDFLAGS_CURSES)	$(LOCAL_LIBS)	testcurs
 testscanw	$(LDFLAGS_CURSES)	$(LOCAL_LIBS)	testscanw
Index: test/railroad.c
Prereq:  1.19 
--- ncurses-5.9/test/railroad.c	2009-10-24 21:37:56.000000000 +0000
+++ ncurses-5.9-20130504/test/railroad.c	2011-04-23 19:15:04.000000000 +0000
@@ -29,7 +29,7 @@
 /*
  * Author: Thomas E. Dickey - 2000
  *
- * $Id: railroad.c,v 1.19 2009/10/24 21:37:56 tom Exp $
+ * $Id: railroad.c,v 1.20 2011/04/23 19:15:04 tom Exp $
  *
  * A simple demo of the termcap interface.
  */
@@ -55,8 +55,8 @@
 
 static bool interrupted = FALSE;
 
-static int
-outc(TPUTS_ARG c)
+static
+TPUTS_PROTO(outc, c)
 {
     int rc = OK;
 
@@ -68,7 +68,7 @@
 	if (putc(c, stdout) == EOF)
 	    rc = ERR;
     }
-    return rc;
+    TPUTS_RETURN(rc);
 }
 
 static void
Index: test/rain.c
Prereq:  1.38 
--- ncurses-5.9/test/rain.c	2010-11-13 20:11:46.000000000 +0000
+++ ncurses-5.9-20130504/test/rain.c	2012-01-21 23:54:47.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -26,7 +26,7 @@
  * authorization.                                                           *
  ****************************************************************************/
 /*
- * $Id: rain.c,v 1.38 2010/11/13 20:11:46 tom Exp $
+ * $Id: rain.c,v 1.40 2012/01/21 23:54:47 tom Exp $
  */
 #include <test.priv.h>
 
@@ -222,7 +222,7 @@
      * Find myself in the list of threads so we can count the number of loops.
      */
     for (mystats = 0; mystats < MAX_THREADS; ++mystats) {
-#ifdef __MINGW32__
+#if defined(__MINGW32__) && !defined(__WINPTHREADS_VERSION)
 	if (drop_threads[mystats].myself.p == pthread_self().p)
 #else
 	if (drop_threads[mystats].myself == pthread_self())
@@ -256,7 +256,7 @@
 /*
  * The description of pthread_create() is misleading, since it implies that
  * threads will exit cleanly after their function returns.
- * 
+ *
  * Since they do not (and the number of threads is limited by system
  * resources), make a limited number of threads, and signal any that are
  * waiting when we want a thread past that limit.
Index: test/redraw.c
Prereq:  1.5 
--- ncurses-5.9/test/redraw.c	2010-05-01 22:04:08.000000000 +0000
+++ ncurses-5.9-20130504/test/redraw.c	2012-12-08 20:46:02.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 2006-2007,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 2006-2011,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -26,7 +26,7 @@
  * authorization.                                                           *
  ****************************************************************************/
 /*
- * $Id: redraw.c,v 1.5 2010/05/01 22:04:08 tom Exp $
+ * $Id: redraw.c,v 1.8 2012/12/08 20:46:02 tom Exp $
  *
  * Demonstrate the redrawwin() and wredrawln() functions.
  * Thomas Dickey - 2006/11/4
@@ -113,7 +113,7 @@
 	     * using mvcur().  It is ifdef'd for NCURSES, since X/Open does
 	     * not define the case where the old location is unknown. 
 	     */
-	    system("date");
+	    IGNORE_RC(system("date"));
 	    mvcur(-1, -1, y, x);
 	    break;
 #endif
Index: test/tclock.c
Prereq:  1.30 
--- ncurses-5.9/test/tclock.c	2011-03-22 09:16:00.000000000 +0000
+++ ncurses-5.9-20130504/test/tclock.c	2012-06-09 19:17:02.000000000 +0000
@@ -1,4 +1,4 @@
-/* $Id: tclock.c,v 1.30 2011/03/22 09:16:00 tom Exp $ */
+/* $Id: tclock.c,v 1.31 2012/06/09 19:17:02 tom Exp $ */
 
 #include <test.priv.h>
 
@@ -216,12 +216,12 @@
 	attroff(A_REVERSE);
 
 	if (has_colors())
-	    (void) attrset(COLOR_PAIR(1));
+	    (void) attrset((attr_t) COLOR_PAIR(1));
 
 	dline(1, cx, cy, cx + sdx, cy - sdy, 'O');
 
 	if (has_colors())
-	    (void) attrset(COLOR_PAIR(0));
+	    (void) attrset((attr_t) COLOR_PAIR(0));
 
 	text = ctime(&tim);
 	MvPrintw(2, 0, "%.*s", (int) (strlen(text) - 1), text);
Index: test/test.priv.h
Prereq:  1.103 
--- ncurses-5.9/test/test.priv.h	2011-03-22 09:15:45.000000000 +0000
+++ ncurses-5.9-20130504/test/test.priv.h	2013-02-10 01:00:04.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2010,2011 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -29,7 +29,7 @@
 /****************************************************************************
  *  Author: Thomas E. Dickey                    1996-on                     *
  ****************************************************************************/
-/* $Id: test.priv.h,v 1.103 2011/03/22 09:15:45 tom Exp $ */
+/* $Id: test.priv.h,v 1.117 2013/02/10 01:00:04 tom Exp $ */
 
 #ifndef __TEST_PRIV_H
 #define __TEST_PRIV_H 1
@@ -58,6 +58,10 @@
 /*
  * Fallback definitions to accommodate broken compilers.
  */
+#ifndef HAVE_ASSUME_DEFAULT_COLORS
+#define HAVE_ASSUME_DEFAULT_COLORS 0
+#endif
+
 #ifndef HAVE_CURSES_VERSION
 #define HAVE_CURSES_VERSION 0
 #endif
@@ -170,10 +174,22 @@
 #define HAVE_SLK_INIT 0
 #endif
 
+#ifndef HAVE_SYS_IOCTL_H
+#define HAVE_SYS_IOCTL_H 0
+#endif
+
+#ifndef HAVE_SYS_SELECT_H
+#define HAVE_SYS_SELECT_H 0
+#endif
+
 #ifndef HAVE_TERMATTRS
 #define HAVE_TERMATTRS 0
 #endif
 
+#ifndef HAVE_TERMIOS_H
+#define HAVE_TERMIOS_H 0
+#endif
+
 #ifndef HAVE_TERMNAME
 #define HAVE_TERMNAME 0
 #endif
@@ -202,6 +218,14 @@
 #define HAVE_USE_DEFAULT_COLORS 0
 #endif
 
+#ifndef HAVE_USE_SCREEN
+#define HAVE_USE_SCREEN 0
+#endif
+
+#ifndef HAVE_USE_WINDOW
+#define HAVE_USE_WINDOW 0
+#endif
+
 #ifndef HAVE_WRESIZE
 #define HAVE_WRESIZE 0
 #endif
@@ -222,6 +246,13 @@
 #define NO_LEAKS 0
 #endif
 
+/*
+ * Workaround for HPUX
+ */
+#if defined(__hpux) && !defined(NCURSES_VERSION)
+#define _ACS_COMPAT_CODE	/* needed for acs_map vs __acs_map */
+#endif
+
 #include <stdlib.h>
 #include <stdarg.h>
 #include <string.h>
@@ -269,21 +300,18 @@
 
 /*
  * Not all curses.h implementations include unctrl.h,
- * Solaris 10 xpg4 for example.
  */
-#if defined(NCURSES_VERSION) || defined(_XOPEN_CURSES)
-#if defined(HAVE_NCURSESW_NCURSES_H)
+#if defined(HAVE_NCURSESW_UNCTRL_H)
 #include <ncursesw/unctrl.h>
-#elif defined(HAVE_NCURSES_NCURSES_H)
+#elif defined(HAVE_NCURSES_UNCTRL_H)
 #include <ncurses/unctrl.h>
-#else
+#elif defined(HAVE_UNCTRL_H)
 #include <unctrl.h>
 #endif
-#endif
 
 #if HAVE_GETOPT_H
 #include <getopt.h>
-#else
+#elif !defined(HAVE_GETOPT_HEADER)
 /* 'getopt()' may be prototyped in <stdlib.h>, but declaring its variables
  * doesn't hurt.
  */
@@ -323,17 +351,20 @@
 #endif
 
 #if !USE_SOFTKEYS
-#define slk_init() /* nothing */
-#define slk_restore() /* nothing */
-#define slk_clear() /* nothing */
+#define slk_init()		/* nothing */
+#define slk_restore()		/* nothing */
+#define slk_clear()		/* nothing */
 #endif
 
 #ifndef HAVE_WSYNCDOWN
-#define wsyncdown(win) /* nothing */
+#define wsyncdown(win)		/* nothing */
 #endif
 
 #ifndef USE_WIDEC_SUPPORT
-#if (defined(_XOPEN_SOURCE_EXTENDED) || defined(_XPG5)) && defined(WACS_ULCORNER)
+#if (defined(_XOPEN_SOURCE_EXTENDED) \
+  || (defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE - 0 >= 500)) \
+  || (defined(NCURSES_WIDECHAR) && (NCURSES_WIDECHAR - 0 < 1))) \
+  && defined(WACS_ULCORNER)
 #define USE_WIDEC_SUPPORT 1
 #else
 #define USE_WIDEC_SUPPORT 0
@@ -609,8 +640,28 @@
 #define EXIT_FAILURE 1
 #endif
 
-#ifdef __MINGW32__
+#if defined(__MINGW32__)
+
+#if defined(PDCURSES)
+#ifdef WINVER
+#  if WINVER < 0x0501
+#    error WINVER must at least be 0x0501
+#  endif  
+#else
+#  define WINVER 0x0501
+#endif
+#include <windows.h>
+#include <sys/time.h>	/* for struct timeval */
+#undef sleep
+#define sleep(n) Sleep((n) * 1000)
+#define SIGHUP  1
+#define SIGKILL 9
+#define getlogin() "username"
+
+#else
 #include <nc_mingw.h>
+#endif
+
 /* conflicts in test/firstlast.c */
 #undef large
 #undef small
@@ -653,25 +704,32 @@
  * The same would be needed for HPUX 10.20
  */
 #ifndef TPUTS_ARG
+#define TPUTS_ARG int
+#endif
+
 #if defined(sun) && !defined(_XOPEN_CURSES) && !defined(NCURSES_VERSION_PATCH)
+#undef TPUTS_ARG
 #define TPUTS_ARG char
 extern char *tgoto(char *, int, int);	/* available, but not prototyped */
-#else
-#define TPUTS_ARG int
 #endif
+
+#ifndef TPUTS_PROTO
+#define TPUTS_PROTO(func,value) int func(TPUTS_ARG value)
+#endif
+
+#ifndef TPUTS_RETURN
+#define TPUTS_RETURN(value) return value
 #endif
 
 /*
  * Workarounds for Solaris's X/Open curses
  */
-#if defined(sun) && defined(_XOPEN_CURSES) && !defined(NCURSES_VERSION_PATCH)
 #if !defined(KEY_MIN) && defined(__KEY_MIN)
 #define KEY_MIN __KEY_MIN
 #endif
 #if !defined(KEY_MAX) && defined(__KEY_MIN)
 #define KEY_MAX __KEY_MAX
 #endif
-#endif
 
 /*
  * Workaround to build with Sun's default SVr4 curses.
@@ -702,23 +760,10 @@
 #define CONST_MENUS		/* nothing */
 #endif
 
-#ifndef HAVE_USE_WINDOW
-#if !defined(NCURSES_VERSION_PATCH) || (NCURSES_VERSION_PATCH < 20070915) || !NCURSES_EXT_FUNCS
-#define HAVE_USE_WINDOW 0
-#else
-#define HAVE_USE_WINDOW 1
-#endif
-#endif
-
 /*
  * Simplify setting up demo of threading with these macros.
  */
 
-#if !HAVE_USE_WINDOW
-typedef int (*NCURSES_WINDOW_CB) (WINDOW *, void *);
-typedef int (*NCURSES_SCREEN_CB) (SCREEN *, void *);
-#endif
-
 #if HAVE_USE_WINDOW
 #define USING_WINDOW(w,func) use_window(w, (NCURSES_WINDOW_CB) func, w)
 #define USING_WINDOW2(w,func,data) use_window(w, (NCURSES_WINDOW_CB) func, data)
@@ -745,6 +790,8 @@
 #define USE_TRACE 0
 #endif
 
+#define Trace2(p)		/* nothing */
+
 #define MvAddCh         (void) mvaddch
 #define MvWAddCh        (void) mvwaddch
 #define MvAddStr        (void) mvaddstr
Index: test/test_add_wchstr.c
Prereq:  1.15 
--- ncurses-5.9/test/test_add_wchstr.c	2011-01-15 18:15:11.000000000 +0000
+++ ncurses-5.9-20130504/test/test_add_wchstr.c	2012-12-16 00:12:04.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 2009,2010,2011 Free Software Foundation, Inc.                   *
+ * Copyright (c) 2010-2011,2012 Free Software Foundation, Inc.                   *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -26,7 +26,7 @@
  * authorization.                                                           *
  ****************************************************************************/
 /*
- * $Id: test_add_wchstr.c,v 1.15 2011/01/15 18:15:11 tom Exp $
+ * $Id: test_add_wchstr.c,v 1.20 2012/12/16 00:12:04 tom Exp $
  *
  * Demonstrate the waddwchstr() and wadd_wch functions.
  * Thomas Dickey - 2009/9/12
@@ -90,6 +90,8 @@
 	if (need > temp_length) { \
 	    temp_length = need * 2; \
 	    temp_buffer = typeRealloc(cchar_t, temp_length, temp_buffer); \
+	    if (!temp_buffer) \
+		failed("TempBuffer"); \
 	} \
 	have[0] = 0; \
 	have[1] = 0; \
@@ -317,6 +319,15 @@
 	(void) cbreak();	/* take input chars one at a time, no wait for \n */
 	(void) noecho();	/* don't echo input */
 	keypad(stdscr, TRUE);
+
+	/*
+	 * Show the characters added in color, to distinguish from those that
+	 * are shifted.
+	 */
+	if (has_colors()) {
+	    start_color();
+	    init_pair(1, COLOR_WHITE, COLOR_BLUE);
+	}
     }
 
     limit = LINES - 5;
@@ -350,14 +361,8 @@
 
     doupdate();
 
-    /*
-     * Show the characters added in color, to distinguish from those that
-     * are shifted.
-     */
     if (has_colors()) {
-	start_color();
-	init_pair(1, COLOR_WHITE, COLOR_BLUE);
-	wbkgdset(work, COLOR_PAIR(1) | ' ');
+	wbkgdset(work, (chtype) (COLOR_PAIR(1) | ' '));
     }
 
     while ((ch = read_linedata(work)) != ERR && !isQUIT(ch)) {
@@ -366,11 +371,13 @@
 	case key_RECUR:
 	    test_add_wchstr(level + 1);
 
-	    touchwin(look);
+	    if (look)
+		touchwin(look);
 	    touchwin(work);
 	    touchwin(show);
 
-	    wnoutrefresh(look);
+	    if (look)
+		wnoutrefresh(look);
 	    wnoutrefresh(work);
 	    wnoutrefresh(show);
 
@@ -514,8 +521,8 @@
 	    break;
 	}
     }
+    delwin(show);
     if (level > 0) {
-	delwin(show);
 	delwin(work);
 	delwin(look);
     }
Index: test/test_addchstr.c
Prereq:  1.13 
--- ncurses-5.9/test/test_addchstr.c	2010-12-12 01:28:24.000000000 +0000
+++ ncurses-5.9-20130504/test/test_addchstr.c	2012-12-16 00:36:27.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 2009,2010 Free Software Foundation, Inc.                   *
+ * Copyright (c) 2009-2010,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -26,7 +26,7 @@
  * authorization.                                                           *
  ****************************************************************************/
 /*
- * $Id: test_addchstr.c,v 1.13 2010/12/12 01:28:24 tom Exp $
+ * $Id: test_addchstr.c,v 1.18 2012/12/16 00:36:27 tom Exp $
  *
  * Demonstrate the waddchstr() and waddch functions.
  * Thomas Dickey - 2009/9/12
@@ -101,6 +101,8 @@
 	if (need > temp_length) {
 	    temp_length = need * 2;
 	    temp_buffer = typeRealloc(chtype, temp_length, temp_buffer);
+	    if (!temp_buffer)
+		failed("TempBuffer");
 	}
 	do {
 	    const char *s;
@@ -237,6 +239,15 @@
 	(void) cbreak();	/* take input chars one at a time, no wait for \n */
 	(void) noecho();	/* don't echo input */
 	keypad(stdscr, TRUE);
+
+	/*
+	 * Show the characters added in color, to distinguish from those that
+	 * are shifted.
+	 */
+	if (has_colors()) {
+	    start_color();
+	    init_pair(1, COLOR_WHITE, COLOR_BLUE);
+	}
     }
 
     limit = LINES - 5;
@@ -270,14 +281,8 @@
 
     doupdate();
 
-    /*
-     * Show the characters added in color, to distinguish from those that
-     * are shifted.
-     */
     if (has_colors()) {
-	start_color();
-	init_pair(1, COLOR_WHITE, COLOR_BLUE);
-	show_attr = COLOR_PAIR(1);
+	show_attr = (attr_t) COLOR_PAIR(1);
 	wbkgdset(work, show_attr | ' ');
     } else {
 	show_attr = A_STANDOUT;
@@ -289,11 +294,13 @@
 	case key_RECUR:
 	    test_adds(level + 1);
 
-	    touchwin(look);
+	    if (look)
+		touchwin(look);
 	    touchwin(work);
 	    touchwin(show);
 
-	    wnoutrefresh(look);
+	    if (look)
+		wnoutrefresh(look);
 	    wnoutrefresh(work);
 	    wnoutrefresh(show);
 
@@ -445,10 +452,10 @@
 	}
     }
     if (level > 0) {
-	delwin(show);
 	delwin(work);
 	delwin(look);
     }
+    delwin(show);
 }
 
 static void
Index: test/test_addstr.c
Prereq:  1.6 
--- ncurses-5.9/test/test_addstr.c	2010-12-12 00:17:37.000000000 +0000
+++ ncurses-5.9-20130504/test/test_addstr.c	2012-12-16 00:14:10.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 2009,2010 Free Software Foundation, Inc.                   *
+ * Copyright (c) 2009-2010,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -26,7 +26,7 @@
  * authorization.                                                           *
  ****************************************************************************/
 /*
- * $Id: test_addstr.c,v 1.6 2010/12/12 00:17:37 tom Exp $
+ * $Id: test_addstr.c,v 1.10 2012/12/16 00:14:10 tom Exp $
  *
  * Demonstrate the waddstr() and waddch functions.
  * Thomas Dickey - 2009/9/12
@@ -161,6 +161,15 @@
 	(void) cbreak();	/* take input chars one at a time, no wait for \n */
 	(void) noecho();	/* don't echo input */
 	keypad(stdscr, TRUE);
+
+	/*
+	 * Show the characters added in color, to distinguish from those that
+	 * are shifted.
+	 */
+	if (has_colors()) {
+	    start_color();
+	    init_pair(1, COLOR_WHITE, COLOR_BLUE);
+	}
     }
 
     limit = LINES - 5;
@@ -194,14 +203,8 @@
 
     doupdate();
 
-    /*
-     * Show the characters added in color, to distinguish from those that
-     * are shifted.
-     */
     if (has_colors()) {
-	start_color();
-	init_pair(1, COLOR_WHITE, COLOR_BLUE);
-	wbkgdset(work, COLOR_PAIR(1) | ' ');
+	wbkgdset(work, (chtype) (COLOR_PAIR(1) | ' '));
     }
 
     while ((ch = read_linedata(work)) != ERR && !isQUIT(ch)) {
@@ -210,11 +213,13 @@
 	case key_RECUR:
 	    test_adds(level + 1);
 
-	    touchwin(look);
+	    if (look)
+		touchwin(look);
 	    touchwin(work);
 	    touchwin(show);
 
-	    wnoutrefresh(look);
+	    if (look)
+		wnoutrefresh(look);
 	    wnoutrefresh(work);
 	    wnoutrefresh(show);
 
@@ -361,8 +366,8 @@
 	    break;
 	}
     }
+    delwin(show);
     if (level > 0) {
-	delwin(show);
 	delwin(work);
 	delwin(look);
     }
Index: test/test_addwstr.c
Prereq:  1.6 
--- ncurses-5.9/test/test_addwstr.c	2010-12-12 00:18:00.000000000 +0000
+++ ncurses-5.9-20130504/test/test_addwstr.c	2012-12-16 00:11:18.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 2009,2010 Free Software Foundation, Inc.                   *
+ * Copyright (c) 2009-2010,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -26,7 +26,7 @@
  * authorization.                                                           *
  ****************************************************************************/
 /*
- * $Id: test_addwstr.c,v 1.6 2010/12/12 00:18:00 tom Exp $
+ * $Id: test_addwstr.c,v 1.11 2012/12/16 00:11:18 tom Exp $
  *
  * Demonstrate the waddwstr() and wadd_wch functions.
  * Thomas Dickey - 2009/9/12
@@ -233,8 +233,9 @@
     WINDOW *work = 0;
     WINDOW *show = 0;
     int margin = (2 * MY_TABSIZE) - 1;
-    Options option = ((m_opt ? oMove : oDefault)
-		      | ((w_opt || (level > 0)) ? oWindow : oDefault));
+    Options option = (Options) ((int) (m_opt ? oMove : oDefault)
+				| (int) ((w_opt || (level > 0))
+					 ? oWindow : oDefault));
 
     if (first) {
 	static char cmd[80];
@@ -246,6 +247,15 @@
 	(void) cbreak();	/* take input chars one at a time, no wait for \n */
 	(void) noecho();	/* don't echo input */
 	keypad(stdscr, TRUE);
+
+	/*
+	 * Show the characters inserted in color, to distinguish from those that
+	 * are shifted.
+	 */
+	if (has_colors()) {
+	    start_color();
+	    init_pair(1, COLOR_WHITE, COLOR_BLUE);
+	}
     }
 
     limit = LINES - 5;
@@ -279,14 +289,8 @@
 
     doupdate();
 
-    /*
-     * Show the characters inserted in color, to distinguish from those that
-     * are shifted.
-     */
     if (has_colors()) {
-	start_color();
-	init_pair(1, COLOR_WHITE, COLOR_BLUE);
-	wbkgdset(work, COLOR_PAIR(1) | ' ');
+	wbkgdset(work, (chtype) (COLOR_PAIR(1) | ' '));
     }
 
     while ((ch = read_linedata(work)) != ERR && !isQUIT(ch)) {
@@ -295,11 +299,13 @@
 	case key_RECUR:
 	    test_inserts(level + 1);
 
-	    touchwin(look);
+	    if (look)
+		touchwin(look);
 	    touchwin(work);
 	    touchwin(show);
 
-	    wnoutrefresh(look);
+	    if (look)
+		wnoutrefresh(look);
 	    wnoutrefresh(work);
 	    wnoutrefresh(show);
 
@@ -445,8 +451,8 @@
 	    break;
 	}
     }
+    delwin(show);
     if (level > 0) {
-	delwin(show);
 	delwin(work);
 	delwin(look);
     }
Index: test/test_getstr.c
Prereq:  1.9 
--- ncurses-5.9/test/test_getstr.c	2009-08-29 19:02:25.000000000 +0000
+++ ncurses-5.9-20130504/test/test_getstr.c	2012-07-07 18:22:49.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 2007-2008,2009 Free Software Foundation, Inc.              *
+ * Copyright (c) 2007-2009,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -26,7 +26,7 @@
  * authorization.                                                           *
  ****************************************************************************/
 /*
- * $Id: test_getstr.c,v 1.9 2009/08/29 19:02:25 tom Exp $
+ * $Id: test_getstr.c,v 1.10 2012/07/07 18:22:49 tom Exp $
  *
  * Author: Thomas E Dickey
  *
@@ -58,6 +58,15 @@
     eMaxFlavor
 } Flavors;
 
+/*
+ * Return-code is OK/ERR or a keyname.
+ */
+static const char *
+ok_keyname(int code)
+{
+    return ((code == OK) ? "OK" : ((code == ERR) ? "ERR" : keyname(code)));
+}
+
 static bool
 Quit(int ch)
 {
@@ -310,7 +319,7 @@
 	    }
 	    noecho();
 	    (void) wattrset(txtwin, A_NORMAL);
-	    wprintw(strwin, "%d:%s", rc, buffer);
+	    wprintw(strwin, "%s:%s", ok_keyname(rc), buffer);
 	    wnoutrefresh(strwin);
 	    break;
 	default:
Index: test/test_vid_puts.c
--- /dev/null	2013-05-05 10:34:48.558701642 +0000
+++ ncurses-5.9-20130504/test/test_vid_puts.c	2013-01-13 01:04:14.000000000 +0000
@@ -0,0 +1,148 @@
+/****************************************************************************
+ * Copyright (c) 2013 Free Software Foundation, Inc.                        *
+ *                                                                          *
+ * Permission is hereby granted, free of charge, to any person obtaining a  *
+ * copy of this software and associated documentation files (the            *
+ * "Software"), to deal in the Software without restriction, including      *
+ * without limitation the rights to use, copy, modify, merge, publish,      *
+ * distribute, distribute with modifications, sublicense, and/or sell       *
+ * copies of the Software, and to permit persons to whom the Software is    *
+ * furnished to do so, subject to the following conditions:                 *
+ *                                                                          *
+ * The above copyright notice and this permission notice shall be included  *
+ * in all copies or substantial portions of the Software.                   *
+ *                                                                          *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
+ * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
+ *                                                                          *
+ * Except as contained in this notice, the name(s) of the above copyright   *
+ * holders shall not be used in advertising or otherwise to promote the     *
+ * sale, use or other dealings in this Software without prior written       *
+ * authorization.                                                           *
+ ****************************************************************************/
+/*
+ * $Id: test_vid_puts.c,v 1.4 2013/01/13 01:04:14 tom Exp $
+ *
+ * Demonstrate the vid_puts and vid_attr functions.
+ * Thomas Dickey - 2013/01/12
+ */
+
+#define USE_TINFO
+#include <test.priv.h>
+
+#if USE_WIDEC_SUPPORT && HAVE_SETUPTERM
+
+#define valid(s) ((s != 0) && s != (char *)-1)
+
+static FILE *my_fp;
+static bool p_opt = FALSE;
+
+static
+TPUTS_PROTO(outc, c)
+{
+    int rc = c;
+
+    rc = putc(c, my_fp);
+    TPUTS_RETURN(rc);
+}
+
+static bool
+outs(char *s)
+{
+    if (valid(s)) {
+	tputs(s, 1, outc);
+	return TRUE;
+    }
+    return FALSE;
+}
+
+static void
+cleanup(void)
+{
+    outs(exit_attribute_mode);
+    if (!outs(orig_colors))
+	outs(orig_pair);
+    outs(cursor_normal);
+}
+
+static void
+change_attr(chtype attr)
+{
+    if (p_opt) {
+	vid_puts(attr, (short) 0, (void *) 0, outc);
+    } else {
+	vid_attr(attr, (short) 0, (void *) 0);
+    }
+}
+
+static void
+test_vid_puts(void)
+{
+    fprintf(my_fp, "Name: ");
+    change_attr(A_BOLD);
+    fputs("Bold", my_fp);
+    change_attr(A_REVERSE);
+    fputs(" Reverse", my_fp);
+    change_attr(A_NORMAL);
+    fputs("\n", my_fp);
+}
+
+static void
+usage(void)
+{
+    static const char *tbl[] =
+    {
+	"Usage: test_vid_puts [options]"
+	,""
+	,"Options:"
+	,"  -e      use stderr (default stdout)"
+	,"  -p      use vid_puts (default vid_attr)"
+    };
+    unsigned n;
+    for (n = 0; n < SIZEOF(tbl); ++n)
+	fprintf(stderr, "%s\n", tbl[n]);
+    ExitProgram(EXIT_FAILURE);
+}
+
+int
+main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED)
+{
+    int ch;
+
+    my_fp = stdout;
+
+    while ((ch = getopt(argc, argv, "ep")) != -1) {
+	switch (ch) {
+	case 'e':
+	    my_fp = stderr;
+	    break;
+	case 'p':
+	    p_opt = TRUE;
+	    break;
+	default:
+	    usage();
+	    break;
+	}
+    }
+    if (optind < argc)
+	usage();
+
+    setupterm((char *) 0, 1, (int *) 0);
+    test_vid_puts();
+    cleanup();
+    ExitProgram(EXIT_SUCCESS);
+}
+
+#else
+int
+main(void)
+{
+    printf("This program requires the wide-ncurses terminfo library\n");
+    ExitProgram(EXIT_FAILURE);
+}
+#endif
Index: test/test_vidputs.c
--- /dev/null	2013-05-05 10:34:48.558701642 +0000
+++ ncurses-5.9-20130504/test/test_vidputs.c	2013-01-13 00:58:54.000000000 +0000
@@ -0,0 +1,148 @@
+/****************************************************************************
+ * Copyright (c) 2013 Free Software Foundation, Inc.                        *
+ *                                                                          *
+ * Permission is hereby granted, free of charge, to any person obtaining a  *
+ * copy of this software and associated documentation files (the            *
+ * "Software"), to deal in the Software without restriction, including      *
+ * without limitation the rights to use, copy, modify, merge, publish,      *
+ * distribute, distribute with modifications, sublicense, and/or sell       *
+ * copies of the Software, and to permit persons to whom the Software is    *
+ * furnished to do so, subject to the following conditions:                 *
+ *                                                                          *
+ * The above copyright notice and this permission notice shall be included  *
+ * in all copies or substantial portions of the Software.                   *
+ *                                                                          *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
+ * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
+ *                                                                          *
+ * Except as contained in this notice, the name(s) of the above copyright   *
+ * holders shall not be used in advertising or otherwise to promote the     *
+ * sale, use or other dealings in this Software without prior written       *
+ * authorization.                                                           *
+ ****************************************************************************/
+/*
+ * $Id: test_vidputs.c,v 1.3 2013/01/13 00:58:54 tom Exp $
+ *
+ * Demonstrate the vidputs and vidattr functions.
+ * Thomas Dickey - 2013/01/12
+ */
+
+#define USE_TINFO
+#include <test.priv.h>
+
+#if HAVE_SETUPTERM
+
+#define valid(s) ((s != 0) && s != (char *)-1)
+
+static FILE *my_fp;
+static bool p_opt = FALSE;
+
+static
+TPUTS_PROTO(outc, c)
+{
+    int rc = c;
+
+    rc = putc(c, my_fp);
+    TPUTS_RETURN(rc);
+}
+
+static bool
+outs(char *s)
+{
+    if (valid(s)) {
+	tputs(s, 1, outc);
+	return TRUE;
+    }
+    return FALSE;
+}
+
+static void
+cleanup(void)
+{
+    outs(exit_attribute_mode);
+    if (!outs(orig_colors))
+	outs(orig_pair);
+    outs(cursor_normal);
+}
+
+static void
+change_attr(chtype attr)
+{
+    if (p_opt) {
+	vidputs(attr, outc);
+    } else {
+	vidattr(attr);
+    }
+}
+
+static void
+test_vidputs(void)
+{
+    fprintf(my_fp, "Name: ");
+    change_attr(A_BOLD);
+    fputs("Bold", my_fp);
+    change_attr(A_REVERSE);
+    fputs(" Reverse", my_fp);
+    change_attr(A_NORMAL);
+    fputs("\n", my_fp);
+}
+
+static void
+usage(void)
+{
+    static const char *tbl[] =
+    {
+	"Usage: test_vidputs [options]"
+	,""
+	,"Options:"
+	,"  -e      use stderr (default stdout)"
+	,"  -p      use vidputs (default vidattr)"
+    };
+    unsigned n;
+    for (n = 0; n < SIZEOF(tbl); ++n)
+	fprintf(stderr, "%s\n", tbl[n]);
+    ExitProgram(EXIT_FAILURE);
+}
+
+int
+main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED)
+{
+    int ch;
+
+    my_fp = stdout;
+
+    while ((ch = getopt(argc, argv, "ep")) != -1) {
+	switch (ch) {
+	case 'e':
+	    my_fp = stderr;
+	    break;
+	case 'p':
+	    p_opt = TRUE;
+	    break;
+	default:
+	    usage();
+	    break;
+	}
+    }
+    if (optind < argc)
+	usage();
+
+    setupterm((char *) 0, 1, (int *) 0);
+    test_vidputs();
+    cleanup();
+    ExitProgram(EXIT_SUCCESS);
+}
+#else
+int
+main(int argc GCC_UNUSED,
+     char *argv[]GCC_UNUSED)
+{
+    fprintf(stderr, "This program requires terminfo\n");
+    exit(EXIT_FAILURE);
+}
+#endif
Index: test/testaddch.c
Prereq:  1.7 
--- ncurses-5.9/test/testaddch.c	2009-08-29 19:02:25.000000000 +0000
+++ ncurses-5.9-20130504/test/testaddch.c	2013-01-13 01:02:41.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2006,2009 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2011,2013 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -29,7 +29,7 @@
  * This is an example written by Alexander V. Lukyanov <lav@yars.free.net>,
  * to demonstrate an inconsistency between ncurses and SVr4 curses.
  *
- * $Id: testaddch.c,v 1.7 2009/08/29 19:02:25 tom Exp $
+ * $Id: testaddch.c,v 1.9 2013/01/13 01:02:41 tom Exp $
  */
 #include <test.priv.h>
 
@@ -63,7 +63,7 @@
     for (i = 0; i < 8; i++) {
 	back = (i & 1) ? A_BOLD | 'B' : ' ';
 	set = (i & 2) ? A_REVERSE : 0;
-	attr = (i & 4) ? COLOR_PAIR(4) : 0;
+	attr = (chtype) ((i & 4) ? COLOR_PAIR(4) : 0);
 
 	bkgdset(back);
 	(void) attrset(set);
@@ -72,9 +72,9 @@
     }
     addch('\n');
     for (i = 0; i < 8; i++) {
-	back = (i & 1) ? A_BOLD | 'B' | COLOR_PAIR(1) : ' ';
-	set = (i & 2) ? A_REVERSE | COLOR_PAIR(2) : 0;
-	attr = (i & 4) ? COLOR_PAIR(4) : 0;
+	back = (i & 1) ? (A_BOLD | 'B' | COLOR_PAIR(1)) : ' ';
+	set = (i & 2) ? (A_REVERSE | COLOR_PAIR(2)) : 0;
+	attr = (chtype) ((i & 4) ? COLOR_PAIR(4) : 0);
 
 	bkgdset(back);
 	(void) attrset(set);
Index: test/testcurs.c
Prereq:  1.43 
--- ncurses-5.9/test/testcurs.c	2010-11-13 21:02:28.000000000 +0000
+++ ncurses-5.9-20130504/test/testcurs.c	2013-02-16 20:29:04.000000000 +0000
@@ -6,7 +6,7 @@
  *  wrs(5/28/93) -- modified to be consistent (perform identically) with either
  *                  PDCurses or under Unix System V, R4
  *
- * $Id: testcurs.c,v 1.43 2010/11/13 21:02:28 tom Exp $
+ * $Id: testcurs.c,v 1.47 2013/02/16 20:29:04 tom Exp $
  */
 
 #include <test.priv.h>
@@ -45,18 +45,6 @@
 };
 #define MAX_OPTIONS (int) SIZEOF(command)
 
-#if !HAVE_STRDUP
-#define strdup my_strdup
-static char *
-strdup(char *s)
-{
-    char *p = typeMalloc(char, strlen(s) + 1);
-    if (p)
-	strcpy(p, s);
-    return (p);
-}
-#endif /* not HAVE_STRDUP */
-
 static int width, height;
 
 int
@@ -85,7 +73,7 @@
 #ifdef A_COLOR
 	if (has_colors()) {
 	    init_pair(1, COLOR_WHITE, COLOR_BLUE);
-	    wbkgd(win, COLOR_PAIR(1));
+	    wbkgd(win, (chtype) COLOR_PAIR(1));
 	} else
 	    wbkgd(win, A_REVERSE);
 #else
@@ -353,6 +341,9 @@
     typeahead(-1);
 #endif
 
+#ifdef NCURSES_MOUSE_VERSION
+    mousemask(ALL_MOUSE_EVENTS, (mmask_t *) 0);
+#endif
 #if defined(PDCURSES)
     mouse_set(ALL_MOUSE_EVENTS);
 #endif
@@ -367,8 +358,38 @@
 	    wprintw(win, "Key Pressed: %c", c);
 	else
 	    wprintw(win, "Key Pressed: %s", unctrl(UChar(c)));
-#if defined(PDCURSES)
+#ifdef KEY_MOUSE
+#define ButtonChanged(n) ((event.bstate) & NCURSES_MOUSE_MASK(1, 037))
+#define ButtonPressed(n) ((event.bstate) & NCURSES_MOUSE_MASK(1, NCURSES_BUTTON_PRESSED))
+#define ButtonDouble(n)  ((event.bstate) & NCURSES_MOUSE_MASK(1, NCURSES_DOUBLE_CLICKED))
+#define ButtonTriple(n)  ((event.bstate) & NCURSES_MOUSE_MASK(1, NCURSES_TRIPLE_CLICKED))
+#define ButtonRelease(n) ((event.bstate) & NCURSES_MOUSE_MASK(1, NCURSES_BUTTON_RELEASED))
 	if (c == KEY_MOUSE) {
+	    MEVENT event;
+	    int button = 0;
+
+	    getmouse(&event);
+	    if (ButtonChanged(1))
+		button = 1;
+	    else if (ButtonChanged(2))
+		button = 2;
+	    else if (ButtonChanged(3))
+		button = 3;
+	    else
+		button = 0;
+	    wmove(win, 4, 18);
+	    wprintw(win, "Button %d: ", button);
+	    if (ButtonPressed(button))
+		wprintw(win, "pressed: ");
+	    else if (ButtonDouble(button))
+		wprintw(win, "double: ");
+	    else if (ButtonTriple(button))
+		wprintw(win, "triple: ");
+	    else
+		wprintw(win, "released: ");
+	    wprintw(win, " Position: Y: %d X: %d", event.y, event.x);
+#if defined(NCURSES_MOUSE_VERSION)
+#elif defined(PDCURSES)
 	    int button = 0;
 	    request_mouse_pos();
 	    if (BUTTON_CHANGED(1))
@@ -390,8 +411,9 @@
 	    else
 		wprintw(win, "released: ");
 	    wprintw(win, " Position: Y: %d X: %d", MOUSE_Y_POS, MOUSE_X_POS);
+#endif /* PDCURSES */
 	}
-#endif
+#endif /* KEY_MOUSE */
 	wrefresh(win);
 	if (c == ' ')
 	    break;
@@ -491,7 +513,7 @@
 #ifdef A_COLOR
 	if (has_colors()) {
 	    init_pair(3, COLOR_BLUE, COLOR_WHITE);
-	    wbkgd(win1, COLOR_PAIR(3));
+	    wbkgd(win1, (chtype) COLOR_PAIR(3));
 	} else
 	    wbkgd(win1, A_NORMAL);
 #else
@@ -693,9 +715,11 @@
 	raw();
 	wgetch(pad);
 
-	spad = subpad(pad, 12, 25, 6, 52);
-	MvWAddStr(spad, 2, 2, "This is a new subpad");
-	box(spad, 0, 0);
+	if ((spad = subpad(pad, 12, 25, 6, 52)) != 0) {
+	    MvWAddStr(spad, 2, 2, "This is a new subpad");
+	    box(spad, 0, 0);
+	    delwin(spad);
+	}
 	prefresh(pad, 0, 0, 0, 0, 15, 75);
 	keypad(pad, TRUE);
 	raw();
Index: test/view.c
Prereq:  1.81 
--- ncurses-5.9/test/view.c	2010-11-14 01:06:02.000000000 +0000
+++ ncurses-5.9-20130504/test/view.c	2013-04-27 19:46:53.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -50,10 +50,11 @@
  * scroll operation worked, and the refresh() code only had to do a
  * partial repaint.
  *
- * $Id: view.c,v 1.81 2010/11/14 01:06:02 tom Exp $
+ * $Id: view.c,v 1.93 2013/04/27 19:46:53 tom Exp $
  */
 
 #include <test.priv.h>
+#include <widechars.h>
 
 #include <time.h>
 
@@ -81,24 +82,10 @@
 #include <sys/ptem.h>
 #endif
 
-#if USE_WIDEC_SUPPORT
-#if HAVE_MBTOWC && HAVE_MBLEN
-#define reset_mbytes(state) IGNORE_RC(mblen(NULL, 0)), IGNORE_RC(mbtowc(NULL, NULL, 0))
-#define count_mbytes(buffer,length,state) mblen(buffer,length)
-#define check_mbytes(wch,buffer,length,state) \
-	(int) mbtowc(&wch, buffer, length)
-#define state_unused
-#elif HAVE_MBRTOWC && HAVE_MBRLEN
-#define reset_mbytes(state) init_mb(state)
-#define count_mbytes(buffer,length,state) mbrlen(buffer,length,&state)
-#define check_mbytes(wch,buffer,length,state) \
-	(int) mbrtowc(&wch, buffer, length, &state)
-#else
-make an error
-#endif
-#endif				/* USE_WIDEC_SUPPORT */
+#undef CTRL
+#define CTRL(x)	((x) & 0x1f)
 
-static RETSIGTYPE finish(int sig) GCC_NORETURN;
+static void finish(int sig) GCC_NORETURN;
 static void show_all(const char *tag);
 
 #if defined(SIGWINCH) && defined(TIOCGWINSZ) && HAVE_RESIZE_TERM
@@ -108,11 +95,11 @@
 #endif
 
 #if CAN_RESIZE
-static RETSIGTYPE adjust(int sig);
+static void adjust(int sig);
 static int interrupted;
+static bool waiting = FALSE;
 #endif
 
-static bool waiting = FALSE;
 static int shift = 0;
 static bool try_color = FALSE;
 
@@ -121,6 +108,8 @@
 static NCURSES_CH_T **lptr;
 static int num_lines;
 
+static void usage(void) GCC_NORETURN;
+
 static void
 usage(void)
 {
@@ -135,6 +124,7 @@
 #if defined(KEY_RESIZE)
 	," -r       use old-style sigwinch handler rather than KEY_RESIZE"
 #endif
+	," -s       start in single-step mode, waiting for input"
 #ifdef TRACE
 	," -t       trace screen updates"
 	," -T NUM   specify trace mask"
@@ -180,7 +170,7 @@
 {
     unsigned len = (unsigned) strlen(src);
     NCURSES_CH_T *dst = typeMalloc(NCURSES_CH_T, len + 1);
-    unsigned j, k;
+    size_t j, k;
 #if USE_WIDEC_SUPPORT
     wchar_t wstr[CCHARW_MAX + 1];
     wchar_t wch;
@@ -243,6 +233,7 @@
     int value = 0;
     bool done = FALSE;
     bool got_number = FALSE;
+    bool single_step = FALSE;
 #if CAN_RESIZE
     bool nonposix_resize = FALSE;
 #endif
@@ -258,7 +249,7 @@
     (void) signal(SIGINT, finish);	/* arrange interrupts to terminate */
 #endif
 
-    while ((i = getopt(argc, argv, "cin:rtT:")) != -1) {
+    while ((i = getopt(argc, argv, "cin:rstT:")) != -1) {
 	switch (i) {
 	case 'c':
 	    try_color = TRUE;
@@ -276,9 +267,18 @@
 	    nonposix_resize = TRUE;
 	    break;
 #endif
+	case 's':
+	    single_step = TRUE;
+	    break;
 #ifdef TRACE
 	case 'T':
-	    trace((unsigned) atoi(optarg));
+	    {
+		char *next = 0;
+		int tvalue = (int) strtol(optarg, &next, 0);
+		if (tvalue < 0 || (next != 0 && *next != 0))
+		    usage();
+		trace((unsigned) tvalue);
+	    }
 	    break;
 	case 't':
 	    trace(TRACE_CALLS);
@@ -306,7 +306,7 @@
 	(void) signal(SIGWINCH, adjust);	/* arrange interrupts to resize */
 #endif
 
-    /* slurp the file */
+    Trace(("slurp the file"));
     for (lptr = &vec_lines[0]; (lptr - vec_lines) < MAXLINES; lptr++) {
 	char temp[BUFSIZ], *s, *d;
 	int col;
@@ -314,8 +314,26 @@
 	if (fgets(buf, sizeof(buf), fp) == 0)
 	    break;
 
-	/* convert tabs so that shift will work properly */
+#if USE_WIDEC_SUPPORT
+	if (lptr == vec_lines) {
+	    if (!memcmp("﻿", buf, 3)) {
+		Trace(("trim BOM"));
+		s = buf + 3;
+		d = buf;
+		do {
+		} while ((*d++ = *s++) != '\0');
+	    }
+	}
+#endif
+
+	/* convert tabs and nonprinting chars so that shift will work properly */
 	for (s = buf, d = temp, col = 0; (*d = *s) != '\0'; s++) {
+	    if (*d == '\r') {
+		if (s[1] == '\n')
+		    continue;
+		else
+		    break;
+	    }
 	    if (*d == '\n') {
 		*d = '\0';
 		break;
@@ -347,14 +365,15 @@
     (void) nonl();		/* tell curses not to do NL->CR/NL on output */
     (void) cbreak();		/* take input chars one at a time, no wait for \n */
     (void) noecho();		/* don't echo input */
-    nodelay(stdscr, TRUE);
+    if (!single_step)
+	nodelay(stdscr, TRUE);
     idlok(stdscr, TRUE);	/* allow use of insert/delete line */
 
     if (try_color) {
 	if (has_colors()) {
 	    start_color();
 	    init_pair(my_pair, COLOR_WHITE, COLOR_BLUE);
-	    bkgd(COLOR_PAIR(my_pair));
+	    bkgd((chtype) COLOR_PAIR(my_pair));
 	} else {
 	    try_color = FALSE;
 	}
@@ -373,10 +392,12 @@
 		adjust(0);
 		my_label = "interrupt";
 	    }
-#endif
 	    waiting = TRUE;
 	    c = getch();
 	    waiting = FALSE;
+#else
+	    c = getch();
+#endif
 	    if ((c < 127) && isdigit(c)) {
 		if (!got_number) {
 		    MvPrintw(0, 0, "Count: ");
@@ -466,6 +487,9 @@
 	    nodelay(stdscr, TRUE);
 	    my_delay = 0;
 	    break;
+	case CTRL('L'):
+	    redrawwin(stdscr);
+	    break;
 	case ERR:
 	    if (!my_delay)
 		napms(50);
@@ -483,7 +507,7 @@
     finish(0);			/* we're done */
 }
 
-static RETSIGTYPE
+static void
 finish(int sig)
 {
     endwin();
@@ -510,7 +534,7 @@
  * The 'wrefresh(curscr)' is needed to force the refresh to start from the top
  * of the screen -- some xterms mangle the bitmap while resizing.
  */
-static RETSIGTYPE
+static void
 adjust(int sig)
 {
     if (waiting || sig == 0) {
@@ -553,7 +577,7 @@
     printw("%.*s", COLS, temp);
     clrtoeol();
     this_time = time((time_t *) 0);
-    strcpy(temp, ctime(&this_time));
+    strncpy(temp, ctime(&this_time), 30);
     if ((i = (int) strlen(temp)) != 0) {
 	temp[--i] = 0;
 	if (move(0, COLS - i - 2) != ERR)
Index: test/widechars.h
--- /dev/null	2013-05-05 10:34:48.558701642 +0000
+++ ncurses-5.9-20130504/test/widechars.h	2012-12-01 20:45:54.000000000 +0000
@@ -0,0 +1,71 @@
+/****************************************************************************
+ * Copyright (c) 2012 Free Software Foundation, Inc.                        *
+ *                                                                          *
+ * Permission is hereby granted, free of charge, to any person obtaining a  *
+ * copy of this software and associated documentation files (the            *
+ * "Software"), to deal in the Software without restriction, including      *
+ * without limitation the rights to use, copy, modify, merge, publish,      *
+ * distribute, distribute with modifications, sublicense, and/or sell       *
+ * copies of the Software, and to permit persons to whom the Software is    *
+ * furnished to do so, subject to the following conditions:                 *
+ *                                                                          *
+ * The above copyright notice and this permission notice shall be included  *
+ * in all copies or substantial portions of the Software.                   *
+ *                                                                          *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
+ * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
+ *                                                                          *
+ * Except as contained in this notice, the name(s) of the above copyright   *
+ * holders shall not be used in advertising or otherwise to promote the     *
+ * sale, use or other dealings in this Software without prior written       *
+ * authorization.                                                           *
+ ****************************************************************************/
+
+#ifndef __WIDECHARS_H
+#define __WIDECHARS_H 1
+
+#include <test.priv.h>
+
+#if USE_WIDEC_SUPPORT
+
+#if defined(__MINGW32__)
+/*
+ * MinGW has wide-character functions, but they do not work correctly.
+ */
+
+extern int _nc_mbtowc(wchar_t *pwc, const char *s, size_t n);
+extern int __MINGW_NOTHROW _nc_mbtowc(wchar_t *pwc, const char *s, size_t n);
+#define mbtowc(pwc,s,n) _nc_mbtowc(pwc,s,n)
+
+extern int __MINGW_NOTHROW _nc_mblen(const char *, size_t);
+#define mblen(s,n) _nc_mblen(s, n)
+
+#endif /* __MINGW32__ */
+
+#if HAVE_MBTOWC && HAVE_MBLEN
+#define reset_mbytes(state) IGNORE_RC(mblen(NULL, 0)), IGNORE_RC(mbtowc(NULL, NULL, 0))
+#define count_mbytes(buffer,length,state) mblen(buffer,length)
+#define check_mbytes(wch,buffer,length,state) \
+	(int) mbtowc(&wch, buffer, length)
+#define state_unused
+#elif HAVE_MBRTOWC && HAVE_MBRLEN
+#define reset_mbytes(state) init_mb(state)
+#define count_mbytes(buffer,length,state) mbrlen(buffer,length,&state)
+#define check_mbytes(wch,buffer,length,state) \
+	(int) mbrtowc(&wch, buffer, length, &state)
+#else
+make an error
+#endif
+
+#else
+
+#endif /* USE_WIDEC_SUPPORT */
+
+extern void widechars_stub(void);
+
+#endif /* __WIDECHARS_H */
Index: test/worm.c
Prereq:  1.60 
--- ncurses-5.9/test/worm.c	2010-11-13 20:21:21.000000000 +0000
+++ ncurses-5.9-20130504/test/worm.c	2013-04-27 19:50:17.000000000 +0000
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -61,7 +61,7 @@
   traces will be dumped.  The program stops and waits for one character of
   input at the beginning and end of the interval.
 
-  $Id: worm.c,v 1.60 2010/11/13 20:21:21 tom Exp $
+  $Id: worm.c,v 1.64 2013/04/27 19:50:17 tom Exp $
 */
 
 #include <test.priv.h>
@@ -202,6 +202,14 @@
 /* *INDENT-ON* */
 
 static void
+failed(const char *s)
+{
+    perror(s);
+    endwin();
+    ExitProgram(EXIT_FAILURE);
+}
+
+static void
 cleanup(void)
 {
     USING_WINDOW(stdscr, wrefresh);
@@ -209,7 +217,7 @@
     endwin();
 }
 
-static RETSIGTYPE
+static void
 onsig(int sig GCC_UNUSED)
 {
     cleanup();
@@ -391,6 +399,8 @@
     if (last_x != COLS - 1) {
 	for (y = 0; y <= last_y; y++) {
 	    refs[y] = typeRealloc(int, (size_t) COLS, refs[y]);
+	    if (!refs[y])
+		failed("update_refs");
 	    for (x = last_x + 1; x < COLS; x++)
 		refs[y][x] = 0;
 	}
@@ -402,6 +412,8 @@
 	refs = typeRealloc(int *, (size_t) LINES, refs);
 	for (y = last_y + 1; y < LINES; y++) {
 	    refs[y] = typeMalloc(int, (size_t) COLS);
+	    if (!refs[y])
+		failed("update_refs");
 	    for (x = 0; x < COLS; x++)
 		refs[y][x] = 0;
 	}
@@ -419,6 +431,7 @@
     struct worm *w;
     int *ip;
     bool done = FALSE;
+    int max_refs;
 
     setlocale(LC_ALL, "");
 
@@ -489,7 +502,7 @@
 
 #define SET_COLOR(num, fg) \
 	    init_pair(num+1, (short) fg, (short) bg); \
-	    flavor[num] |= COLOR_PAIR(num+1) | A_BOLD
+	    flavor[num] |= (chtype) COLOR_PAIR(num+1) | A_BOLD
 
 	SET_COLOR(0, COLOR_GREEN);
 	SET_COLOR(1, COLOR_RED);
@@ -501,8 +514,9 @@
     }
 #endif /* A_COLOR */
 
-    refs = typeMalloc(int *, (size_t) LINES);
-    for (y = 0; y < LINES; y++) {
+    max_refs = LINES;
+    refs = typeMalloc(int *, (size_t) max_refs);
+    for (y = 0; y < max_refs; y++) {
 	refs[y] = typeMalloc(int, (size_t) COLS);
 	for (x = 0; x < COLS; x++) {
 	    refs[y][x] = 0;
@@ -596,7 +610,7 @@
     Trace(("Cleanup"));
     cleanup();
 #ifdef NO_LEAKS
-    for (y = 0; y < LINES; y++) {
+    for (y = 0; y < max_refs; y++) {
 	free(refs[y]);
     }
     free(refs);
Index: test/xmas.c
Prereq:  1.27 
--- ncurses-5.9/test/xmas.c	2010-11-13 20:24:10.000000000 +0000
+++ ncurses-5.9-20130504/test/xmas.c	2013-04-27 19:46:53.000000000 +0000
@@ -92,7 +92,7 @@
 /******************************************************************************/
 
 /*
- * $Id: xmas.c,v 1.27 2010/11/13 20:24:10 tom Exp $
+ * $Id: xmas.c,v 1.28 2013/04/27 19:46:53 tom Exp $
  */
 #include <test.priv.h>
 
@@ -148,7 +148,7 @@
 static int reindeer(void);
 static int blinkit(void);
 
-static RETSIGTYPE done(int sig) GCC_NORETURN;
+static void done(int sig) GCC_NORETURN;
 
 static void
 set_color(WINDOW *win, chtype color)
@@ -1143,7 +1143,7 @@
     return (0);
 }
 
-static RETSIGTYPE
+static void
 done(int sig GCC_UNUSED)
 {
     CATCHALL(done);
