+##############################################################################
+CF_HELP_MESSAGE(Reentrant Code:)
+CF_WITH_PTHREAD
+
+if test "x$with_pthread" != xno; then
+ AC_CHECK_FUNC(pthread_kill,[
+ AC_MSG_CHECKING(if you want to allow EINTR in wgetch with pthreads)
+ AC_ARG_ENABLE(pthreads-eintr,
+ [ --enable-pthreads-eintr enable EINTR in wgetch with pthreads],
+ [use_pthreads_eintr=$enableval],
+ [use_pthreads_eintr=no])
+ AC_MSG_RESULT($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)
+ AC_ARG_ENABLE(weak-symbols,
+ [ --enable-weak-symbols enable weak-symbols for pthreads],
+ [use_weak_symbols=$enableval],
+ [use_weak_symbols=no])
+ AC_MSG_RESULT($use_weak_symbols)
+ if test "x$use_weak_symbols" = xyes ; then
+ CF_WEAK_SYMBOLS
+ else
+ cf_cv_weak_symbols=no
+ fi
+
+ 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 "x$with_pthread" = "xyes" ; then
+ AC_DEFINE(USE_PTHREADS,1,[Define to 1 to use pthreads feature])
+ enable_reentrant=yes
+ if test "x$cf_cv_weak_symbols" = xyes ; then
+ PTHREAD=-lpthread
+ CF_ADD_LIB(pthread,PRIVATE_LIBS)
+ fi
+fi
+AC_SUBST(PTHREAD)
+
+# Reentrant code has to be opaque; there's little advantage to making ncurses
+# 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.
+AC_MSG_CHECKING(if you want reentrant code)
+AC_ARG_ENABLE(reentrant,
+ [ --enable-reentrant compile with reentrant code],
+ [with_reentrant=$enableval],
+ [with_reentrant=no])
+AC_MSG_RESULT($with_reentrant)
+if test "x$with_reentrant" = xyes ; then
+ cf_cv_enable_reentrant=1
+ cf_cv_enable_opaque="NCURSES_INTERNALS"
+ NCURSES_SIZE_T=int
+ 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)
+ CF_ADD_LIB(pthread,PRIVATE_LIBS)
+ else
+ # when not using weak symbols but with_reentrant,
+ # add 't' to the library suffix on all platforms
+ # except cygwin, where we only do that if ALSO
+ # compiling with full thread support.
+ case "$host" in
+ (*cygwin* | *msys*)
+ if test "$with_pthread" = "yes" ; then
+ if test "x$disable_lib_suffixes" = "xno" ; then
+ LIB_SUFFIX="t${LIB_SUFFIX}"
+ fi
+ fi ;;
+ (*)
+ if test "x$disable_lib_suffixes" = "xno" ; then
+ LIB_SUFFIX="t${LIB_SUFFIX}"
+ fi
+ ;;
+ esac
+ fi
+ AC_DEFINE(USE_REENTRANT,1,[Define to 1 to use reentrant feature])
+ CF_NCURSES_ABI_6
+else
+ cf_cv_enable_reentrant=0
+ cf_cv_enable_opaque="NCURSES_OPAQUE"
+ NCURSES_SIZE_T=$cf_dft_ordinate_type
+fi
+AC_SUBST(cf_cv_enable_reentrant)
+AC_SUBST(cf_cv_enable_opaque)
+
+AC_SUBST(NCURSES_SIZE_T)
+
+AC_MSG_CHECKING(whether curses library structures should be opaque)
+CF_ARG_DISABLE(opaque-curses,
+ [ --disable-opaque-curses do not make WINDOW, etc., structures opaque],
+ [enable_opaque_curses=no],[
+ test "$cf_cv_enable_reentrant" = 1 && enable_opaque_curses=yes
+ test "$cf_cv_enable_reentrant" = 1 || enable_opaque_curses=$cf_dft_opaque_curses
+ ])
+AC_MSG_RESULT($enable_opaque_curses)
+
+test "$cf_cv_enable_reentrant" = 1 && \
+test "$enable_opaque_curses" = no && \
+AC_MSG_ERROR(reentrant configuration requires opaque library)
+
+AC_MSG_CHECKING(whether form library structures should be opaque)
+CF_ARG_DISABLE(opaque-form,
+ [ --disable-opaque-form do not make form library structures opaque],
+ [enable_opaque_form=no],[enable_opaque_form=$cf_dft_opaque_curses])
+AC_MSG_RESULT($enable_opaque_form)
+
+AC_MSG_CHECKING(whether menu library structures should be opaque)
+CF_ARG_DISABLE(opaque-menu,
+ [ --disable-opaque-menu do not make menu library structures opaque],
+ [enable_opaque_menu=no],[enable_opaque_menu=$cf_dft_opaque_curses])
+AC_MSG_RESULT($enable_opaque_menu)
+
+AC_MSG_CHECKING(whether panel library structures should be opaque)
+CF_ARG_DISABLE(opaque-panel,
+ [ --disable-opaque-panel do not make panel library structures opaque],
+ [enable_opaque_panel=no],[enable_opaque_panel=$cf_dft_opaque_curses])
+AC_MSG_RESULT($enable_opaque_panel)
+
+NCURSES_OPAQUE=0; test "$enable_opaque_curses" = yes && NCURSES_OPAQUE=1
+NCURSES_OPAQUE_FORM=0; test "$enable_opaque_form" = yes && NCURSES_OPAQUE_FORM=1
+NCURSES_OPAQUE_MENU=0; test "$enable_opaque_menu" = yes && NCURSES_OPAQUE_MENU=1
+NCURSES_OPAQUE_PANEL=0; test "$enable_opaque_panel" = yes && NCURSES_OPAQUE_PANEL=1
+
+AC_SUBST(NCURSES_OPAQUE)
+AC_SUBST(NCURSES_OPAQUE_FORM)
+AC_SUBST(NCURSES_OPAQUE_MENU)
+AC_SUBST(NCURSES_OPAQUE_PANEL)
+
+### Allow using a different wrap-prefix
+if test "$cf_cv_enable_reentrant" != 0 || test "$BROKEN_LINKER" = 1 ; then
+ AC_MSG_CHECKING(for prefix used to wrap public variables)
+ AC_ARG_WITH(wrap-prefix,
+ [ --with-wrap-prefix=XXX override prefix used for public variables],
+ [NCURSES_WRAP_PREFIX=$withval],
+ [NCURSES_WRAP_PREFIX=_nc_])
+ AC_MSG_RESULT($NCURSES_WRAP_PREFIX)
+else
+ NCURSES_WRAP_PREFIX=_nc_
+fi
+AC_SUBST(NCURSES_WRAP_PREFIX)
+AC_DEFINE_UNQUOTED(NCURSES_WRAP_PREFIX,"$NCURSES_WRAP_PREFIX",[Define to override _nc_ prefix])
+