-dnl Things that we don't need (or must override) if we're not building ncurses
-ECHO_LINK='@ echo linking $@ ... ;'
-AC_SUBST(ECHO_LINK)
-
-LD_MODEL=""
-AC_SUBST(LD_MODEL)
-
-LOCAL_LDFLAGS=""
-AC_SUBST(LOCAL_LDFLAGS)
-
-nc_cv_abi_version=""
-AC_SUBST(nc_cv_abi_version)
-
-TEST_DEPS=""
-AC_SUBST(TEST_DEPS)
-
-LIB_PREFIX="-l"
-AC_SUBST(LIB_PREFIX)
-
-DFT_DEP_SUFFIX=""
-AC_SUBST(DFT_DEP_SUFFIX)
-
-rm -f config_h.in
-echo '@DEFS@' >config_h.in
-
-changequote({,})dnl
-AC_OUTPUT(config_h Makefile,{
-
-### Special editing. We generate ncurses_cfg.h directly to allow all filenames
-### to be MSDOS-compatible, as well as to make the list of definitions be
-### dynamically determined by the configuration script -- a consideration when
-### doing type-clean development testing.
-
-echo creating ncurses_cfg.h
-rm -f ncurses_cfg.h
-echo "/* generated by configure-script
- * On host: $SYS_NAME
- */
-#ifndef NC_CONFIG_H
-#define NC_CONFIG_H" >ncurses_cfg.h
-sed -e '/^ -D/!d' \
- -e 's/ -D/\
-#define /g' \
- -e 's/\(#define [A-Za-z_][A-Za-z0-9_]*\)=/\1 /g' \
- -e 's@\\@@g' \
- config_h | sort >>ncurses_cfg.h
-echo "
- /* The C compiler may not treat these properly, but C++ has to */
-#ifdef __cplusplus
-#undef const
-#undef inline
-#endif
-
-#endif /* NC_CONFIG_H */" >> ncurses_cfg.h
-echo removing config_h
-rm config_h
-},{
-### Special initialization commands, used to pass information from the
-### configuration-run into config.status
-
-SYS_NAME="`(uname -a || hostname) 2>/dev/null | sed 1q`"
-if test -z "\$SYS_NAME"; then SYS_NAME=unknown;fi
-})
-changequote([,])dnl
-
-rm -f config_h.in
+AC_CACHE_CHECK(if $cf_cv_screen library uses pthreads,cf_cv_use_pthreads,[
+AC_TRY_LINK([
+#include <${cf_cv_ncurses_header:-curses.h}>
+extern void _nc_init_pthreads(void);
+],
+[
+ initscr();
+ _nc_init_pthreads();
+ ],
+ [cf_cv_use_pthreads=yes],
+ [cf_cv_use_pthreads=no])
+])
+test $cf_cv_use_pthreads = yes && AC_DEFINE(USE_PTHREADS)
+
+CF_SYS_TIME_SELECT
+
+# 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>,[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
+
+CF_FUNC_CURSES_VERSION
+
+CF_CURSES_ACS_MAP
+if test "$cf_enable_widec" = yes; then
+ CF_CURSES_WACS_MAP
+ CF_CURSES_WACS_SYMBOLS
+fi
+
+CF_CURSES_CHECK_TYPE(attr_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(ospeed)
+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=
+
+dnl ---------------------------------------------------------------------------
+
+AC_OUTPUT(Makefile,[
+CF_PRG_RULES([$srcdir/mk-test.awk INSTALL=yes ECHO_LINK="$ECHO_LD"], .)
+ cat >>Makefile <<TEST_EOF
+
+# These rules are generated so we do not rely on suffix rules, which do not
+# work consistently for different make-programs (the '\$(MODEL)/' confuses
+# some, and the '\$x' confuses others).
+TEST_EOF
+
+LIST=`sed -e 's/[[ ]].*//' -e '/^[[#@]]/d' $srcdir/modules`
+for N in $LIST
+do
+ cat >>Makefile <<TEST_EOF
+
+\$(MODEL)/$N.o : \$(srcdir)/$N.c \\
+ \$(srcdir)/test.priv.h \\
+ ncurses_cfg.h
+ $SHOW_CC
+ $ECHO_CC\$(CC) -c \$(CFLAGS_DEFAULT) \$(srcdir)/$N.c
+TEST_EOF
+done
+
+if test -f ../config.guess && test -f ../config.sub
+then
+ cat >>Makefile <<TEST_EOF
+
+# if we used CF_INHERIT for getting these files, we can remove them
+distclean::
+ rm -f config.guess config.sub
+TEST_EOF
+fi
+],[
+AWK="$AWK"
+ECHO_CC="$ECHO_CC"
+ECHO_LD="$ECHO_LD"
+SHOW_CC="$SHOW_LD"
+],cat)