File: curses.m4

package info (click to toggle)
bzflag 2.4.30-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 26,488 kB
  • sloc: cpp: 150,376; ansic: 3,463; sh: 2,535; makefile: 2,194; perl: 486; python: 260; objc: 246; php: 206
file content (30 lines) | stat: -rw-r--r-- 1,034 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# This macro tries to find curses, and defines HAVE_CURSES_H or HAVE_NCURSES_H
# if any of those headers are found. It also defines CURSES_LIB.
AC_DEFUN([MP_WITH_CURSES], [
    mp_save_LIBS="$LIBS"
    CURSES_LIB=""

    ifdef([PKG_CHECK_MODULES], [
        PKG_CHECK_MODULES([ncurses], [ncurses],
        [CURSES_LIB="$ncurses_LIBS"]
        AC_DEFINE(HAVE_NCURSES_H, , [Use the header file ncurses.h])
        AC_SUBST(CURSES_LIB),
        [_CHECK_CURSES])
    ],
    [_CHECK_CURSES])
    LIBS="$mp_save_LIBS"
])dnl

AC_DEFUN([_CHECK_CURSES], [
    AC_CACHE_CHECK([for working ncurses], mp_cv_ncurses,
        [LIBS="$LIBS -lncurses"
        AC_LINK_IFELSE([
        AC_LANG_PROGRAM([[#include <ncurses.h>
        ]], [[chtype a; int b=A_STANDOUT, c=KEY_LEFT; initscr();
        ]])], [mp_cv_ncurses=yes], [mp_cv_ncurses=no])])
        if test "$mp_cv_ncurses" = yes ; then
            AC_DEFINE(HAVE_NCURSES_H, , [Use the header file ncurses.h])
            CURSES_LIB="-lncurses"
            AC_SUBST(CURSES_LIB)
        fi
])dnl