]> git.draconx.ca Git - dxcommon.git/blob - m4/curses.m4
DX_C_ALIGNAS: Work around bash-5 parsing bug.
[dxcommon.git] / m4 / curses.m4
1 dnl Copyright © 2022 Nick Bowler
2 dnl
3 dnl License WTFPL2: Do What The Fuck You Want To Public License, version 2.
4 dnl This is free software: you are free to do what the fuck you want to.
5 dnl There is NO WARRANTY, to the extent permitted by law.
6
7 AC_DEFUN([DX_LIB_CURSES],
8 [AC_BEFORE([$0], [_DX_CURSES_LINKTEST])dnl
9 DX_LIB_SETUP([curses])dnl
10 DX_LIB_PKGCONFIG_FLAGS([ncurses])
11 AC_MSG_CHECKING([for curses])
12 DX_LIB_SEARCH_LINK([curses],
13   [_DX_LIB_CURSES_TEST],
14   [ [[$CURSES_CFLAGS], [$CURSES_LIBS]],
15     [[$dx_cv_ncurses_pkg_cflags], [$dx_cv_ncurses_pkg_libs],
16       [test x"$dx_cv_ncurses_pkg_found" = x"yes"]],
17     [[], [-lcurses]] ])
18 AS_IF([test x"$dx_cv_curses_lib_found" = x"yes"], [$1],
19   [m4_default([$2], [AC_MSG_FAILURE(
20 [the curses library is required.  A suitable version
21 may be found at <https://invisible-island.net/ncurses/>.
22 m4_newline([DX_LIB_USERFLAG_BLURB([curses])])
23 m4_newline([DX_LIB_PKGCONFIG_BLURB([ncurses])])
24 ])])])])
25
26 m4_define([_DX_LIB_CURSES_TEST], [AC_LANG_PROGRAM(
27 [#include <curses.h>
28 ], [initscr(); curs_set(0); endwin();])])