copysym: Integrate code offset into lookup table.
[dxcommon.git] / m4 / curses.m4
blob57aa76e62d45769fb3749ed4b1a2ebbc2252d468
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.
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 ])])])])
26 m4_define([_DX_LIB_CURSES_TEST], [AC_LANG_PROGRAM(
27 [#include <curses.h>
28 ], [initscr(); curs_set(0); endwin();])])