+### 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
+
+# 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 "$with_widec" = yes ; then
+ LIB_SUFFIX="w${LIB_SUFFIX}"
+ AC_DEFINE(USE_WIDEC_SUPPORT)
+ CF_PREDEFINE(_XOPEN_SOURCE_EXTENDED)
+ # 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
+ 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 "$with_lp64" = yes ; 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 "$with_tparm_varargs" = yes && 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)
+