]> git.draconx.ca Git - dxcommon.git/blob - m4/curses.m4
Add library test for curses.
[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 [DX_LIB_SETUP([curses])dnl
9 DX_LIB_PKGCONFIG_FLAGS([ncurses])
10 AC_MSG_CHECKING([for curses])
11 DX_LIB_SEARCH_LINK([curses],
12   [_DX_LIB_CURSES_TEST],
13   [ [[$CURSES_CFLAGS], [$CURSES_LIBS]],
14     [[$dx_cv_ncurses_pkg_cflags], [$dx_cv_ncurses_pkg_libs],
15       [test x"$dx_cv_ncurses_pkg_found" = x"yes"]],
16     [[], [-lcurses]] ])
17 AS_IF([test x"$dx_cv_curses_lib_found" = x"yes"], [$1],
18   [m4_default([$2], [AC_MSG_FAILURE(
19 [the curses library is required.  A suitable version
20 may be found at <https://invisible-island.net/ncurses/>.
21 m4_newline([DX_LIB_USERFLAG_BLURB([curses])])
22 m4_newline([DX_LIB_PKGCONFIG_BLURB([ncurses])])
23 ])])])])
24
25 m4_define([_DX_LIB_CURSES_TEST], [AC_LANG_PROGRAM(
26 [#include <curses.h>
27 ], [initscr(); curs_set(0); endwin();])])