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_DEFINE([CURSES_HEADER_FILE], [], [Set to the location of the curses header file.]) |
8 |
|
AC_DEFUN([MP_WITH_CURSES], |
9 |
< |
[AC_ARG_WITH(ncurses, [ --with-ncurses Force the use of ncurses over curses],,) |
9 |
> |
[AC_ARG_WITH(ncurses, [ --without-ncurses Do not use ncurses],,) |
10 |
> |
|
11 |
|
mp_save_LIBS="$LIBS" |
12 |
|
mp_save_CPPFLAGS="$CPPFLAGS" |
13 |
|
LIBS="$LIBS $SAIDARLIBS" |
14 |
|
CPPFLAGS="$CPPFLAGS $SAIDARCPPFLAGS" |
15 |
|
CURSES_LIB="" |
16 |
< |
if test "$with_ncurses" != yes |
16 |
> |
|
17 |
> |
if test "$with_ncurses" != no |
18 |
|
then |
19 |
+ |
AC_CACHE_CHECK([for working ncurses - ncurses.h], mp_cv_ncurses1, |
20 |
+ |
[LIBS="$mp_save_LIBS $SAIDARLIBS -lncurses" |
21 |
+ |
CPPFLAGS="$mp_save_CPPFLAGS $SAIDARCPPFLAGS" |
22 |
+ |
AC_TRY_LINK( |
23 |
+ |
[#include <ncurses.h>], |
24 |
+ |
[chtype a; int b=A_STANDOUT, c=KEY_LEFT; initscr(); ], |
25 |
+ |
mp_cv_ncurses1=yes, mp_cv_ncurses1=no)]) |
26 |
+ |
if test "$mp_cv_ncurses1" = yes |
27 |
+ |
then |
28 |
+ |
AC_DEFINE([HAVE_NCURSES_H]) |
29 |
+ |
AC_DEFINE([CURSES_HEADER_FILE], [<ncurses.h>]) |
30 |
+ |
CURSES_LIB="-lncurses" |
31 |
+ |
else |
32 |
+ |
AC_CACHE_CHECK([for working ncurses - ncurses/ncurses.h], mp_cv_ncurses2, |
33 |
+ |
[LIBS="$mp_save_LIBS $SAIDARLIBS -lncurses" |
34 |
+ |
CPPFLAGS="$mp_save_CPPFLAGS $SAIDARCPPFLAGS" |
35 |
+ |
AC_TRY_LINK( |
36 |
+ |
[#include <ncurses/ncurses.h>], |
37 |
+ |
[chtype a; int b=A_STANDOUT, c=KEY_LEFT; initscr(); ], |
38 |
+ |
mp_cv_ncurses2=yes, mp_cv_ncurses2=no)]) |
39 |
+ |
if test "$mp_cv_ncurses2" = yes |
40 |
+ |
then |
41 |
+ |
AC_DEFINE([HAVE_NCURSES_H]) |
42 |
+ |
AC_DEFINE([CURSES_HEADER_FILE], [<ncurses/ncurses.h>]) |
43 |
+ |
CURSES_LIB="-lncurses" |
44 |
+ |
fi |
45 |
+ |
fi |
46 |
+ |
fi |
47 |
+ |
|
48 |
+ |
if test ! "$CURSES_LIB" |
49 |
+ |
then |
50 |
|
AC_CACHE_CHECK([for working curses], mp_cv_curses, |
51 |
< |
[LIBS="$LIBS -lcurses" |
51 |
> |
[LIBS="$LIBS $SAIDARLIBS -lcurses" |
52 |
> |
CPPFLAGS="$mp_save_CPPFLAGS $SAIDARCPPFLAGS" |
53 |
|
AC_TRY_LINK( |
54 |
|
[#include <curses.h>], |
55 |
|
[chtype a; int b=A_STANDOUT, c=KEY_LEFT; initscr(); ], |
56 |
|
mp_cv_curses=yes, mp_cv_curses=no)]) |
57 |
|
if test "$mp_cv_curses" = yes |
58 |
|
then |
59 |
< |
AC_DEFINE(HAVE_CURSES_H) |
59 |
> |
AC_DEFINE([HAVE_CURSES_H]) |
60 |
> |
AC_DEFINE([CURSES_HEADER_FILE], [<curses.h>]) |
61 |
|
CURSES_LIB="-lcurses" |
62 |
|
fi |
63 |
|
fi |
64 |
+ |
|
65 |
|
if test ! "$CURSES_LIB" |
66 |
|
then |
67 |
< |
AC_CACHE_CHECK([for working ncurses], mp_cv_ncurses, |
68 |
< |
[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 |
67 |
> |
AC_MSG_WARN([Unable to find curses or ncurses; disabling saidar]) |
68 |
> |
AM_CONDITIONAL(SAIDAR, false) |
69 |
|
fi |
70 |
+ |
|
71 |
|
SAIDARLIBS="$SAIDARLIBS $CURSES_LIB" |
72 |
|
LIBS="$mp_save_LIBS" |
73 |
|
CPPFLAGS="$mp_save_CPPFLAGS" |