+test "x$with_bsdpad" = xyes && AC_DEFINE(BSD_TPUTS)
+
+### use option --enable-widec to turn on use of wide-character support
+NCURSES_CH_T=chtype
+NCURSES_LIBUTF8=0
+
+NEED_WCHAR_H=0
+NCURSES_MBSTATE_T=0
+NCURSES_WCHAR_T=0
+NCURSES_WINT_T=0
+
+# Check to define _XOPEN_SOURCE "automatically"
+CF_XOPEN_SOURCE(500)
+
+# Work around breakage on OS X
+CF_SIGWINCH
+
+# Checks for CODESET support.
+AM_LANGINFO_CODESET
+
+# use these variables to work around a defect in gcc's fixincludes.
+NCURSES_OK_WCHAR_T=
+NCURSES_OK_WINT_T=
+
+AC_MSG_CHECKING(if you want wide-character code)
+AC_ARG_ENABLE(widec,
+ [ --enable-widec compile with wide-char/UTF-8 code],
+ [with_widec=$enableval],
+ [with_widec=no])
+AC_MSG_RESULT($with_widec)
+if test "x$with_widec" = xyes ; then
+ LIB_SUFFIX="w${LIB_SUFFIX}"
+ AC_DEFINE(USE_WIDEC_SUPPORT)
+ AC_DEFINE(NCURSES_WIDECHAR)
+
+ 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 "x$ac_cv_func_putwc" != xyes ; then
+ CF_UTF8_LIB
+ if test "$cf_cv_utf8_lib" != no ; then
+ NCURSES_LIBUTF8=1
+ fi
+ fi
+ CF_WCHAR_TYPE(mbstate_t, NCURSES_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_MBSTATE_T" != 0; then
+ AC_DEFINE(NEED_MBSTATE_T_DEF)
+ fi
+fi
+AC_SUBST(NCURSES_CH_T)
+AC_SUBST(NCURSES_LIBUTF8)
+
+AC_SUBST(NEED_WCHAR_H)
+AC_SUBST(NCURSES_MBSTATE_T)
+AC_SUBST(NCURSES_WCHAR_T)
+AC_SUBST(NCURSES_WINT_T)
+
+AC_SUBST(NCURSES_OK_WCHAR_T)
+AC_SUBST(NCURSES_OK_WINT_T)
+
+### use option --disable-lp64 to allow long chtype
+case $cf_cv_abi_version in
+[[345]]*)
+ default_with_lp64=no
+ ;;
+*)
+ default_with_lp64=yes
+ ;;
+esac
+
+AC_MSG_CHECKING(whether to enable _LP64 definition in curses.h)
+AC_ARG_ENABLE(lp64,
+ [ --disable-lp64 allow chtype to be long (ignore _LP64)],
+ [with_lp64=$enableval],
+ [with_lp64=$default_with_lp64])
+AC_MSG_RESULT($with_lp64)
+
+if test "x$with_lp64" = xyes ; then
+ cf_cv_enable_lp64=1
+else
+ cf_cv_enable_lp64=0
+fi
+AC_SUBST(cf_cv_enable_lp64)
+
+CF_LARGEFILE
+
+### use option --disable-tparm-varargs to make tparm() conform to X/Open
+AC_MSG_CHECKING(if you want tparm not to use X/Open fixed-parameter list)
+AC_ARG_ENABLE(tparm-varargs,
+ [ --disable-tparm-varargs compile tparm() without varargs interface],
+ [with_tparm_varargs=$enableval],
+ [with_tparm_varargs=yes])
+AC_MSG_RESULT($with_tparm_varargs)
+NCURSES_TPARM_VARARGS=0
+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
+if test "$with_ticlib" != no ; then
+AC_MSG_CHECKING(if you want tic library to use explicit dependency on ncurses$LIB_SUFFIX library)
+AC_ARG_ENABLE(tic-depends,
+ [ --disable-tic-depends link tic library without explicit dependency on ncurses library],
+ [with_tic_depends=$enableval],
+ [with_tic_depends=yes])
+AC_MSG_RESULT($with_tic_depends)
+else
+ with_tic_depends=no
+fi
+
+### use option --with-bool to override bool's type
+AC_MSG_CHECKING(for type of bool)
+AC_ARG_WITH(bool,
+ [ --with-bool=TYPE override fallback type of bool variable],
+ [NCURSES_BOOL="$withval"],
+ [NCURSES_BOOL=auto])
+AC_MSG_RESULT($NCURSES_BOOL)
+AC_SUBST(NCURSES_BOOL)
+
+AC_MSG_CHECKING(for alternate terminal capabilities file)
+AC_ARG_WITH(caps,
+ [ --with-caps=alt compile with alternate Caps file],
+ [TERMINFO_CAPS=Caps.$withval],
+ [TERMINFO_CAPS=Caps])
+test -f "${srcdir}/include/${TERMINFO_CAPS}" || TERMINFO_CAPS=Caps
+AC_MSG_RESULT($TERMINFO_CAPS)
+AC_SUBST(TERMINFO_CAPS)
+
+### use option --with-chtype to override chtype's type
+AC_MSG_CHECKING(for type of chtype)
+AC_ARG_WITH(chtype,
+ [ --with-chtype=TYPE override type of chtype],
+ [NCURSES_CHTYPE="$withval"],
+ [NCURSES_CHTYPE=auto])
+AC_MSG_RESULT($NCURSES_CHTYPE)
+
+### use option --with-ospeed to override ospeed's type
+AC_MSG_CHECKING(for type of ospeed)
+AC_ARG_WITH(ospeed,
+ [ --with-ospeed=TYPE override type of ospeed variable],
+ [NCURSES_OSPEED="$withval"],
+ [NCURSES_OSPEED=short])
+AC_MSG_RESULT($NCURSES_OSPEED)
+AC_SUBST(NCURSES_OSPEED)
+
+### use option --with-mmask-t to override mmask_t's type
+AC_MSG_CHECKING(for type of mmask_t)
+AC_ARG_WITH(mmask-t,
+ [ --with-mmask-t=TYPE override type of mmask_t],
+ [NCURSES_MMASK_T="$withval"],
+ [NCURSES_MMASK_T=auto])
+AC_MSG_RESULT($NCURSES_MMASK_T)
+
+### use option --with-ccharw-max to override CCHARW_MAX size
+AC_MSG_CHECKING(for size CCHARW_MAX)
+AC_ARG_WITH(ccharw-max,
+ [ --with-ccharw-max=XXX override size CCHARW_MAX],
+ [NCURSES_CCHARW_MAX="$withval"],
+ [NCURSES_CCHARW_MAX=5])
+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,
+ [ --with-rcs-ids compile-in RCS identifiers],
+ [with_rcs_ids=$withval],
+ [with_rcs_ids=no])
+AC_MSG_RESULT($with_rcs_ids)
+test "x$with_rcs_ids" = xyes && AC_DEFINE(USE_RCS_IDS)
+
+###############################################################################
+CF_MAN_PAGES([ captoinfo clear infocmp infotocap tabs tic toe tput tset ])
+
+###############################################################################
+CF_HELP_MESSAGE(Extensions:)
+
+### Note that some functions (such as const) are normally disabled anyway.
+AC_MSG_CHECKING(if you want to build with function extensions)
+AC_ARG_ENABLE(ext-funcs,
+ [ --disable-ext-funcs disable function-extensions],
+ [with_ext_funcs=$enableval],
+ [with_ext_funcs=yes])
+AC_MSG_RESULT($with_ext_funcs)
+if test "x$with_ext_funcs" = xyes ; then
+ NCURSES_EXT_FUNCS=1
+ AC_DEFINE(HAVE_ASSUME_DEFAULT_COLORS)
+ 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_USE_SCREEN)
+ AC_DEFINE(HAVE_USE_WINDOW)
+ AC_DEFINE(HAVE_WRESIZE)
+ AC_DEFINE(NCURSES_EXT_FUNCS)
+ GENERATED_EXT_FUNCS=generated
+else
+ NCURSES_EXT_FUNCS=0
+ GENERATED_EXT_FUNCS=
+fi
+AC_SUBST(NCURSES_EXT_FUNCS)
+AC_SUBST(GENERATED_EXT_FUNCS)
+
+AC_MSG_CHECKING(if you want to build with experimental SCREEN extensions)
+AC_ARG_ENABLE(sp-funcs,
+ [ --enable-sp-funcs enable experimental SCREEN-extensions],
+ [with_sp_funcs=$enableval],
+ [with_sp_funcs=no])
+AC_MSG_RESULT($with_sp_funcs)
+if test "x$with_sp_funcs" = xyes ; then
+ NCURSES_SP_FUNCS=1
+ AC_DEFINE(NCURSES_SP_FUNCS)
+ GENERATED_SP_FUNCS=generated
+else
+ NCURSES_SP_FUNCS=0
+ GENERATED_SP_FUNCS=
+fi
+AC_SUBST(NCURSES_SP_FUNCS)
+AC_SUBST(GENERATED_SP_FUNCS)
+
+AC_MSG_CHECKING(if you want to build with experimental terminal-driver)
+AC_ARG_ENABLE(term-driver,
+ [ --enable-term-driver enable experimental terminal-driver],
+ [with_term_driver=$enableval],
+ [with_term_driver=no])
+AC_MSG_RESULT($with_term_driver)
+if test "x$with_term_driver" = xyes ; then
+ AC_DEFINE(USE_TERM_DRIVER)
+ if test "x$with_sp_funcs" != xyes ; then
+ AC_MSG_ERROR(The term-driver option relies upon sp-funcs)
+ fi
+fi