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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
|
dnl check for ncurses in user supplied path
AC_DEFUN([mc_CHECK_NCURSES_BY_PATH], [
ac_ncurses_inc_path=[$1]
ac_ncurses_lib_path=[$2]
if test x"$ac_ncurses_inc_path" != x; then
ac_ncurses_inc_path="-I"$ac_ncurses_inc_path
fi
if test x"$ac_ncurses_lib_path" != x; then
ac_ncurses_lib_path="-L"$ac_ncurses_lib_path
fi
saved_CPPFLAGS="$CPPFLAGS"
saved_LDFLAGS="$LDFLAGS"
CPPFLAGS="$CPPFLAGS $ac_ncurses_inc_path"
LDFLAGS="$LDFLAGS $ac_ncurses_lib_path"
dnl Check for the headers
dnl Both headers should be in the same directory
dnl AIX term.h is unusable for mc
AC_MSG_CHECKING([for ncurses/ncurses.h and ncurses/term.h])
AC_PREPROC_IFELSE(
[
AC_LANG_PROGRAM([[#include <ncurses/ncurses.h>
#include <ncurses/term.h>
]],[[return 0;]])
],
[
AC_MSG_RESULT(yes)
if test x"$ac_ncurses_inc_path" = x; then
ac_ncurses_inc_path="-I/usr/include"
fi
if test x"$ac_ncurses_lib_path" = x; then
ac_ncurses_lib_path="-L/usr/lib"
fi
found_ncurses=yes
AC_DEFINE(HAVE_NCURSES_NCURSES_H, 1,
[Define to 1 if you have the <ncurses/ncurses.h> header file.])
AC_DEFINE(HAVE_NCURSES_TERM_H, 1,
[Define to 1 if you have the <ncurses/term.h> header file.])
],
[
AC_MSG_RESULT(no)
found_ncurses=no
error_msg_ncurses="ncurses header not found"
],
)
if test x"$found_ncurses" = x"yes"; then
screen_type=ncurses
screen_msg="NCurses"
AC_DEFINE(HAVE_NCURSES, 1,
[Define to use ncurses library for screen management])
MCLIBS="$MCLIBS $ac_ncurses_lib_path"
else
CPPFLAGS="$saved_CPPFLAGS"
LDFLAGS="$saved_LDPFLAGS"
AC_MSG_ERROR([$error_msg_ncurses])
fi
])
dnl
dnl Use the ncurses library. It can only be requested explicitly,
dnl so just fail if anything goes wrong.
dnl
dnl If ncurses exports the ESCDELAY variable it should be set to 0
dnl or you'll have to press Esc three times to dismiss a dialog box.
dnl
AC_DEFUN([mc_WITH_NCURSES], [
dnl has_colors() is specific to ncurses, it's not in the old curses
save_LIBS="$LIBS"
ncursesw_found=
dnl get the user supplied include path
AC_ARG_WITH([ncurses-includes],
AS_HELP_STRING([--with-ncurses-includes=@<:@DIR@:>@],
[set path to ncurses includes @<:@default=/usr/include@:>@; make sense only if --with-screen=ncurses; for /usr/local/include/ncurses specify /usr/local/include]
),
[ac_ncurses_inc_path="$withval"],
[ac_ncurses_inc_path=""]
)
dnl get the user supplied lib path
AC_ARG_WITH([ncurses-libs],
AS_HELP_STRING([--with-ncurses-libs=@<:@DIR@:>@],
[set path to ncurses library @<:@default=/usr/lib@:>@; make sense only if --with-screen=ncurses]
),
[ac_ncurses_lib_path="$withval"],
[ac_ncurses_lib_path=""]
)
dnl we need at least the inc path, the lib may be in a std location
if test x"$ac_ncurses_inc_path" != x; then
dnl check the user supplied location
mc_CHECK_NCURSES_BY_PATH([$ac_ncurses_inc_path],[$ac_ncurses_lib_path])
LIBS="$MCLIBS"
AC_SEARCH_LIBS([has_colors], [ncurses], [],
[AC_MSG_ERROR([Cannot find ncurses library])])
AC_SEARCH_LIBS([stdscr], [tinfo], [],
[AC_MSG_ERROR([Cannot find a library providing stdscr])])
MCLIBS="$LIBS"
screen_type=ncurses
screen_msg="NCurses"
AC_DEFINE(USE_NCURSES, 1,
[Define to use ncurses for screen management])
else
LIBS="$MCLIBS"
AC_SEARCH_LIBS([addwstr], [ncursesw ncurses curses], [ncursesw_found=yes],
[AC_MSG_WARN([Cannot find ncurses library, that support wide characters])])
MCLIBS="$LIBS"
if test x"$ncursesw_found" = "x"; then
LIBS="$MCLIBS"
AC_SEARCH_LIBS([has_colors], [ncurses curses], [],
[AC_MSG_ERROR([Cannot find ncurses library])])
MCLIBS="$LIBS"
fi
LIBS="$MCLIBS"
AC_SEARCH_LIBS([stdscr], [tinfow tinfo], [],
[AC_MSG_ERROR([Cannot find a library providing stdscr])])
MCLIBS="$LIBS"
dnl Check the header
ncurses_h_found=
AC_CHECK_HEADERS([ncursesw/curses.h ncurses/curses.h ncurses.h curses.h],
[ncurses_h_found=yes; break])
if test x"$ncurses_h_found" = "x"; then
AC_MSG_ERROR([Cannot find ncurses header file])
fi
AC_CHECK_HEADERS([ncurses/term.h])
screen_type=ncurses
screen_msg="NCurses"
AC_DEFINE(USE_NCURSES, 1,
[Define to use ncurses for screen management])
fi
dnl check for ESCDELAY
AC_CACHE_CHECK([for ESCDELAY variable],
[mc_cv_ncurses_escdelay],
[AC_LINK_IFELSE([AC_LANG_PROGRAM([], [[
extern int ESCDELAY;
ESCDELAY = 0;
]])],
[mc_cv_ncurses_escdelay=yes],
[mc_cv_ncurses_escdelay=no])
])
if test x"$mc_cv_ncurses_escdelay" = xyes; then
AC_DEFINE(HAVE_ESCDELAY, 1,
[Define if ncurses has ESCDELAY variable])
fi
dnl check for resizeterm
AC_CHECK_FUNCS(resizeterm)
LIBS="$save_LIBS"
])
dnl
dnl Use the ncursesw library. It can only be requested explicitly,
dnl so just fail if anything goes wrong.
dnl
dnl If ncursesw exports the ESCDELAY variable it should be set to 0
dnl or you'll have to press Esc three times to dismiss a dialog box.
dnl
AC_DEFUN([mc_WITH_NCURSESW], [
dnl has_colors() is specific to ncurses, it's not in the old curses
save_LIBS="$LIBS"
LIBS=
AC_SEARCH_LIBS([has_colors], [ncursesw], [MCLIBS="$MCLIBS $LIBS"],
[AC_MSG_ERROR([Cannot find ncursesw library])])
AC_SEARCH_LIBS([stdscr], [tinfow ncursesw], [MCLIBS="$MCLIBS $LIBS"],
[AC_MSG_ERROR([Cannot find a library providing stdscr])])
dnl Check the header
ncurses_h_found=
AC_CHECK_HEADERS([ncursesw/curses.h],
[ncursesw_h_found=yes; break])
if test x"$ncursesw_h_found" = "x"; then
AC_MSG_ERROR([Cannot find ncursesw header file])
fi
screen_type=ncursesw
screen_msg="NCursesw"
AC_DEFINE(USE_NCURSESW, 1,
[Define to use ncursesw for screen management])
AC_CACHE_CHECK([for ESCDELAY variable],
[mc_cv_ncursesw_escdelay],
[AC_LINK_IFELSE([AC_LANG_PROGRAM([], [[
extern int ESCDELAY;
ESCDELAY = 0;
]])],
[mc_cv_ncursesw_escdelay=yes],
[mc_cv_ncursesw_escdelay=no])
])
if test x"$mc_cv_ncursesw_escdelay" = xyes; then
AC_DEFINE(HAVE_ESCDELAY, 1,
[Define if ncursesw has ESCDELAY variable])
fi
AC_CHECK_FUNCS(resizeterm)
LIBS="$save_LIBS"
])
|