+dnl CF_WITH_DMALLOC version: 7 updated: 2010/06/21 17:26:47
+dnl ---------------
+dnl Configure-option for dmalloc. The optional parameter is used to override
+dnl the updating of $LIBS, e.g., to avoid conflict with subsequent tests.
+AC_DEFUN([CF_WITH_DMALLOC],[
+CF_NO_LEAKS_OPTION(dmalloc,
+ [ --with-dmalloc test: use Gray Watson's dmalloc library],
+ [USE_DMALLOC])
+
+if test "$with_dmalloc" = yes ; then
+ AC_CHECK_HEADER(dmalloc.h,
+ [AC_CHECK_LIB(dmalloc,[dmalloc_debug]ifelse([$1],,[],[,$1]))])
+fi
+])dnl
+dnl ---------------------------------------------------------------------------
+dnl CF_WITH_NCURSES_ETC version: 5 updated: 2016/02/20 19:23:20
+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(screen,
+ [ --with-screen=XXX use specified curses-libraries],
+ [cf_cv_screen=$withval],[
+
+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
+(curses|curses_*)
+ CF_CURSES_CONFIG
+ ;;
+(ncursesw*)
+ CF_UTF8_LIB
+ CF_NCURSES_CONFIG($cf_cv_screen)
+ ;;
+(ncurses*)
+ CF_NCURSES_CONFIG($cf_cv_screen)
+ ;;
+(pdcurses)
+ CF_PDCURSES_X11
+ ;;
+(*)
+ AC_MSG_ERROR(unexpected screen-value: $cf_cv_screen)
+ ;;
+esac
+
+CF_NCURSES_PTHREADS($cf_cv_screen)
+
+])dnl
+dnl ---------------------------------------------------------------------------
+dnl CF_WITH_VALGRIND version: 1 updated: 2006/12/14 18:00:21
+dnl ----------------
+AC_DEFUN([CF_WITH_VALGRIND],[
+CF_NO_LEAKS_OPTION(valgrind,
+ [ --with-valgrind test: use valgrind],
+ [USE_VALGRIND])
+])dnl
+dnl ---------------------------------------------------------------------------
+dnl CF_XOPEN_CURSES version: 13 updated: 2015/12/12 20:59:52
+dnl ---------------
+dnl Test if we should define X/Open source for curses, needed on Digital Unix
+dnl 4.x, to see the extended functions, but breaks on IRIX 6.x.
+dnl
+dnl The getbegyx() check is needed for HPUX, which omits legacy macros such
+dnl as getbegy(). The latter is better design, but the former is standard.
+AC_DEFUN([CF_XOPEN_CURSES],
+[
+AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl
+AC_CACHE_CHECK(definition to turn on extended curses functions,cf_cv_need_xopen_extension,[
+cf_cv_need_xopen_extension=unknown
+AC_TRY_LINK([
+#include <stdlib.h>
+#include <${cf_cv_ncurses_header:-curses.h}>],[
+#if defined(NCURSES_VERSION_PATCH)
+#if (NCURSES_VERSION_PATCH < 20100501) && (NCURSES_VERSION_PATCH >= 20100403)
+ make an error
+#endif
+#endif
+#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)],
+ [cf_cv_need_xopen_extension=none],
+ [
+ for cf_try_xopen_extension in _XOPEN_SOURCE_EXTENDED NCURSES_WIDECHAR
+ do
+ AC_TRY_LINK([
+#define $cf_try_xopen_extension 1
+#include <stdlib.h>
+#include <${cf_cv_ncurses_header:-curses.h}>],[
+#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)],
+ [cf_cv_need_xopen_extension=$cf_try_xopen_extension; break])
+ done
+ ])
+])
+
+case $cf_cv_need_xopen_extension in
+(*_*)
+ CPPFLAGS="$CPPFLAGS -D$cf_cv_need_xopen_extension"
+ ;;
+esac
+
+])dnl
+dnl ---------------------------------------------------------------------------
+dnl CF_XOPEN_SOURCE version: 50 updated: 2015/10/17 19:03:33