51
|
1 AC_DEFUN([MP_WITH_CURSES],
|
|
2 [AC_ARG_WITH(ncurses, [ --with-ncurses Force the use of ncurses over curses],,)
|
|
3 mp_save_LIBS="$LIBS"
|
|
4 CURSES_LIB=""
|
|
5 if test "$with_ncurses" != yes
|
|
6 then
|
|
7 AC_CACHE_CHECK([for working curses], mp_cv_curses,
|
|
8 [LIBS="$LIBS -lcurses"
|
312
|
9 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[chtype a; int b=A_STANDOUT, c=KEY_LEFT; initscr(); ]])],[mp_cv_curses=yes],[mp_cv_curses=no])])
|
51
|
10 if test "$mp_cv_curses" = yes
|
|
11 then
|
|
12 AC_DEFINE(HAVE_CURSES_H, 1, [Define to 1 if libcurses is requested])
|
|
13 CURSES_LIB="-lcurses"
|
|
14 fi
|
|
15 fi
|
|
16 if test ! "$CURSES_LIB"
|
|
17 then
|
|
18 AC_CACHE_CHECK([for working ncurses], mp_cv_ncurses,
|
|
19 [LIBS="$mp_save_LIBS -lncurses"
|
312
|
20 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])])
|
51
|
21 if test "$mp_cv_ncurses" = yes
|
|
22 then
|
|
23 AC_DEFINE(HAVE_NCURSES_H, 1, [Define to 1 if libncurses is requested])
|
|
24 CURSES_LIB="-lncurses"
|
|
25 fi
|
|
26 fi
|
|
27 if test ! "$CURSES_LIB"
|
|
28 then
|
|
29 AC_CACHE_CHECK([for working pdcurses], mp_cv_pdcurses,
|
|
30 [LIBS="$mp_save_LIBS -lpdcurses"
|
312
|
31 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[chtype a; int b=A_STANDOUT, c=KEY_LEFT; initscr(); ]])],[mp_cv_pdcurses=yes],[mp_cv_pdcurses=no])])
|
51
|
32 if test "$mp_cv_pdcurses" = yes
|
|
33 then
|
|
34 AC_DEFINE(HAVE_CURSES_H, 1, [Define to 1 if libcurses is requested])
|
|
35 CURSES_LIB="-lpdcurses"
|
|
36 fi
|
|
37 fi
|
|
38 if test ! "$CURSES_LIB"
|
|
39 then
|
|
40 AC_CACHE_CHECK([for working pdcur], mp_cv_pdcur,
|
|
41 [LIBS="$mp_save_LIBS -lpdcur"
|
312
|
42 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[chtype a; int b=A_STANDOUT, c=KEY_LEFT; initscr(); ]])],[mp_cv_pdcur=yes],[mp_cv_pdcur=no])])
|
51
|
43 if test "$mp_cv_pdcur" = yes
|
|
44 then
|
|
45 AC_DEFINE(HAVE_CURSES_H, 1, [Define to 1 if libcurses is requested])
|
|
46 CURSES_LIB="-lpdcur"
|
|
47 fi
|
|
48 fi
|
|
49 if test ! "$CURSES_LIB"
|
|
50 then
|
|
51 AC_CACHE_CHECK([for working peer pdcurses], mp_cv_lpdcurses,
|
|
52 [LIBS="$mp_save_LIBS ../pdcurses/pdcurses.a"
|
312
|
53 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include "../pdcurses/curses.h"]], [[chtype a; int b=A_STANDOUT, c=KEY_LEFT; initscr(); ]])],[mp_cv_lpdcurses=yes],[mp_cv_lpdcurses=no])])
|
51
|
54 if test "$mp_cv_lpdcurses" = yes
|
|
55 then
|
|
56 AC_DEFINE(HAVE_CURSES_H, 1, [Define to 1 if libcurses is requested])
|
|
57 CURSES_LIB="../pdcurses/pdcurses.a"
|
|
58 RF_ADDTO(CPPFLAGS,"-I../pdcurses")
|
|
59 fi
|
|
60 fi
|
|
61 AC_CACHE_CHECK([for ESCDELAY variable],
|
|
62 [mc_cv_ncurses_escdelay],
|
312
|
63 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
|
51
|
64 extern int ESCDELAY;
|
|
65 ESCDELAY = 0;
|
312
|
66 ]])],[mc_cv_ncurses_escdelay=yes],[mc_cv_ncurses_escdelay=no])
|
51
|
67 ])
|
|
68 if test "$mc_cv_ncurses_escdelay" = yes; then
|
|
69 AC_DEFINE(HAVE_ESCDELAY, 1,
|
|
70 [Define if ncurses has ESCDELAY variable])
|
|
71 fi
|
|
72 if test ! "$CURSES_LIB" ; then
|
|
73 LIBS="$mp_save_LIBS"
|
|
74 fi
|
|
75 ])dnl
|
|
76
|
|
77 dnl
|
|
78 dnl RF_ADDTO(variable, value)
|
|
79 dnl
|
|
80 dnl Add value to variable
|
|
81 dnl
|
|
82 AC_DEFUN([RF_ADDTO],[
|
|
83 if test "x$$1" = "x"; then
|
|
84 test "x$silent" != "xyes" && echo " setting $1 to \"$2\""
|
|
85 $1="$2"
|
|
86 else
|
|
87 apr_addto_bugger="$2"
|
|
88 for i in $apr_addto_bugger; do
|
|
89 apr_addto_duplicate="0"
|
|
90 for j in $$1; do
|
|
91 if test "x$i" = "x$j"; then
|
|
92 apr_addto_duplicate="1"
|
|
93 break
|
|
94 fi
|
|
95 done
|
|
96 if test $apr_addto_duplicate = "0"; then
|
|
97 test "x$silent" != "xyes" && echo " adding \"$i\" to $1"
|
|
98 $1="$$1 $i"
|
|
99 fi
|
|
100 done
|
|
101 fi
|
|
102 ])dnl
|
|
103
|
|
104
|