1 |
tdb |
1.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 libstatgrab) |
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 |
|
|
mp_save_CPPFLAGS="$CPPFLAGS" |
11 |
|
|
LIBS="$LIBS $SAIDARLIBS" |
12 |
|
|
CPPFLAGS="$CPPFLAGS $SAIDARCPPFLAGS" |
13 |
|
|
CURSES_LIB="" |
14 |
|
|
if test "$with_ncurses" != yes |
15 |
|
|
then |
16 |
|
|
AC_CACHE_CHECK([for working curses], mp_cv_curses, |
17 |
|
|
[LIBS="$LIBS -lcurses" |
18 |
|
|
AC_TRY_LINK( |
19 |
|
|
[#include <curses.h>], |
20 |
|
|
[chtype a; int b=A_STANDOUT, c=KEY_LEFT; initscr(); ], |
21 |
|
|
mp_cv_curses=yes, mp_cv_curses=no)]) |
22 |
|
|
if test "$mp_cv_curses" = yes |
23 |
|
|
then |
24 |
|
|
AC_DEFINE(HAVE_CURSES_H) |
25 |
|
|
CURSES_LIB="-lcurses" |
26 |
|
|
fi |
27 |
|
|
fi |
28 |
|
|
if test ! "$CURSES_LIB" |
29 |
|
|
then |
30 |
|
|
AC_CACHE_CHECK([for working ncurses], mp_cv_ncurses, |
31 |
|
|
[LIBS="$mp_save_LIBS -lncurses" |
32 |
|
|
AC_TRY_LINK( |
33 |
|
|
[#include <ncurses.h>], |
34 |
|
|
[chtype a; int b=A_STANDOUT, c=KEY_LEFT; initscr(); ], |
35 |
|
|
mp_cv_ncurses=yes, mp_cv_ncurses=no)]) |
36 |
|
|
if test "$mp_cv_ncurses" = yes |
37 |
|
|
then |
38 |
|
|
AC_DEFINE(HAVE_NCURSES_H) |
39 |
|
|
CURSES_LIB="-lncurses" |
40 |
|
|
else |
41 |
|
|
AC_MSG_WARN([Unable to find curses or ncurses; disabling saidar]) |
42 |
|
|
AM_CONDITIONAL(SAIDAR, false) |
43 |
|
|
fi |
44 |
|
|
fi |
45 |
|
|
SAIDARLIBS="$SAIDARLIBS $CURSES_LIB" |
46 |
|
|
LIBS="$mp_save_LIBS" |
47 |
|
|
CPPFLAGS="$mp_save_CPPFLAGS" |
48 |
|
|
])dnl |