fstests: autoconf has deprecated a bunch of macros
[xfstests-dev.git] / m4 / package_ncurses.m4
1 AC_DEFUN([AC_PACKAGE_NEED_NCURSES_H],
2   [ AC_CHECK_HEADERS([ncurses.h])
3     if test "$ac_cv_header_ncurses_h" != yes; then
4         echo
5         echo 'FATAL ERROR: could not find a valid ncurses header.'
6         echo 'Install the ncurses development package.'
7         exit 1
8     fi
9   ])
10
11 AC_DEFUN([AC_PACKAGE_WANT_WORKING_LIBNCURSES],
12   [ AC_CHECK_LIB(ncurses, initscr,, [
13         echo
14         echo 'FATAL ERROR: could not find a valid ncurses library.'
15         echo 'Install the ncurses library package.'
16         exit 1
17     ])
18     AC_MSG_CHECKING([for bad glibc/ncurses header interaction])
19     libcurses="-lncurses"
20     LIBS="$LIBS $libcurses"
21     CFLAGS="$CFLAGS -D_GNU_SOURCE"
22     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
23 #include <ncurses.h>
24 #include <signal.h>]], [[wgetch(stdscr);]])],[enable_curses=yes; AC_MSG_RESULT([ok])],[enable_curses=no; libcurses=""; AC_MSG_RESULT([disabling curses])])
25     AC_SUBST(enable_curses)
26     AC_SUBST(libcurses)
27   ])