1 |
dnl Available from the GNU Autoconf Macro Archive at: |
2 |
dnl http://www.gnu.org/software/ac-archive/htmldoc/mp_with_curses.html |
3 |
dnl (Hacked by tdb for idar) |
4 |
dnl $Id$ |
5 |
AC_DEFINE([HAVE_CURSES_H], [], [Define to 1 if you have the <curses.h> header file.]) |
6 |
AC_DEFINE([HAVE_NCURSES_H], [], [Define to 1 if you have the <ncurses.h> header file.]) |
7 |
AC_DEFUN([MP_WITH_CURSES], |
8 |
[AC_ARG_WITH(ncurses, [ --with-ncurses Force the use of ncurses over curses],,) |
9 |
mp_save_LIBS="$LIBS" |
10 |
CURSES_LIB="" |
11 |
if test "$with_ncurses" != yes |
12 |
then |
13 |
AC_CACHE_CHECK([for working curses], mp_cv_curses, |
14 |
[LIBS="$LIBS -lcurses" |
15 |
AC_TRY_LINK( |
16 |
[#include <curses.h>], |
17 |
[chtype a; int b=A_STANDOUT, c=KEY_LEFT; initscr(); ], |
18 |
mp_cv_curses=yes, mp_cv_curses=no)]) |
19 |
if test "$mp_cv_curses" = yes |
20 |
then |
21 |
AC_DEFINE(HAVE_CURSES_H) |
22 |
CURSES_LIB="-lcurses" |
23 |
fi |
24 |
fi |
25 |
if test ! "$CURSES_LIB" |
26 |
then |
27 |
AC_CACHE_CHECK([for working ncurses], mp_cv_ncurses, |
28 |
[LIBS="$mp_save_LIBS -lncurses" |
29 |
AC_TRY_LINK( |
30 |
[#include <ncurses.h>], |
31 |
[chtype a; int b=A_STANDOUT, c=KEY_LEFT; initscr(); ], |
32 |
mp_cv_ncurses=yes, mp_cv_ncurses=no)]) |
33 |
if test "$mp_cv_ncurses" = yes |
34 |
then |
35 |
AC_DEFINE(HAVE_NCURSES_H) |
36 |
CURSES_LIB="-lncurses" |
37 |
else |
38 |
AC_MSG_ERROR([Need either curses or ncurses]) |
39 |
fi |
40 |
fi |
41 |
LIBS="$mp_save_LIBS $CURSES_LIB" |
42 |
])dnl |