2 dnl Check if the system S-Lang library can be used.
3 dnl If not, and $1 is "strict", exit.
5 AC_DEFUN([MC_CHECK_SLANG_BY_PATH], [
10 if test x"$ac_slang_inc_path" != x; then
11 ac_slang_inc_path="-I"$ac_slang_inc_path
14 if test x"$ac_slang_lib_path" != x; then
15 ac_slang_lib_path="-L"$ac_slang_lib_path
18 saved_CFLAGS="$CFLAGS"
19 saved_CPPFLAGS="$CPPFLAGS"
20 saved_LDFLAGS="$LDFLAGS"
22 CFLAGS="$CFLAGS $ac_slang_inc_path $ac_slang_lib_path"
23 CPPFLAGS="$saved_CPPFLAGS $ac_slang_inc_path $ac_slang_lib_path"
26 AC_MSG_CHECKING([for slang.h])
29 AC_LANG_PROGRAM([#include <slang.h>],[return 0;])
33 if test x"$ac_slang_inc_path" = x; then
34 ac_slang_inc_path="-I/usr/include"
36 if test x"$ac_slang_lib_path" = x; then
37 ac_slang_lib_path="-L/usr/lib"
40 AC_DEFINE(HAVE_SLANG_H, 1,[Define to use slang.h])
45 AC_MSG_CHECKING([for slang/slang.h])
48 AC_LANG_PROGRAM([#include <slang/slang.h>],[return 0;])
52 if test x"$ac_slang_inc_path" = x; then
53 ac_slang_inc_path="-I/usr/include"
55 if test x"$ac_slang_lib_path" = x; then
56 ac_slang_lib_path="-L/usr/lib"
59 AC_DEFINE(HAVE_SLANG_SLANG_H, 1,[Define to use slang.h])
64 error_msg_slang="Slang header not found"
70 dnl Check if termcap is needed.
71 dnl This check must be done before anything is linked against S-Lang.
72 if test x"$found_slang" = x"yes"; then
73 CFLAGS="$saved_CFLAGS $ac_slang_inc_path $ac_slang_lib_path"
74 LDFLAGS="$saved_LDFLAGS $ac_slang_lib_path"
75 CPPFLAGS="$saved_CPPFLAGS $ac_slang_inc_path $ac_slang_lib_path"
78 if test x"$mc_cv_slang_termcap" = x"yes"; then
79 ac_slang_lib_path="$ac_slang_lib_path -ltermcap"
80 CFLAGS="$saved_CFLAGS $ac_slang_inc_path $ac_slang_lib_path"
81 CPPFLAGS="$saved_CPPFLAGS $ac_slang_inc_path $ac_slang_lib_path"
82 LDFLAGS="$saved_LDFLAGS $ac_slang_lib_path"
86 if test x"$found_slang" = x"yes"; then
87 unset ac_cv_lib_slang_SLang_init_tty
94 error_msg_slang="S-lang library not found"
98 dnl check if S-Lang have version 2.0 or newer
99 if test x"$found_slang" = x"yes"; then
100 AC_MSG_CHECKING([for S-Lang version 2.0 or newer])
102 #ifdef HAVE_SLANG_SLANG_H
103 #include <slang/slang.h>
109 #if SLANG_VERSION >= 20000
116 [mc_slang_is_valid_version=yes],
117 [mc_slang_is_valid_version=no],
118 [mc_slang_is_valid_version=no]
120 if test x$mc_slang_is_valid_version = xno; then
122 error_msg_slang="S-Lang library version 2.0 or newer not found"
124 AC_MSG_RESULT($mc_slang_is_valid_version)
127 dnl Unless external S-Lang was requested, reject S-Lang with UTF-8 hacks
128 if test x"$found_slang" = x"yes"; then
129 unset ac_cv_lib_slang_SLsmg_write_nwchars
132 [SLsmg_write_nwchars],
135 error_msg_slang="Rejecting S-Lang with UTF-8 support, it's not fully supported yet"
141 if test x"$found_slang" = x"yes"; then
143 screen_msg="S-Lang library (installed on the system)"
145 AC_DEFINE(HAVE_SLANG, 1,
146 [Define to use S-Lang library for screen management])
148 MCLIBS="$MCLIBS $ac_slang_lib_path -lslang"
149 CFLAGS="$saved_CFLAGS"
150 dnl do not reset CPPFLAGS
151 dnl - if CPPFLAGS are resetted then cpp does not find the specified header
152 LDFLAGS="$saved_LDFLAGS"
154 CFLAGS="$saved_CFLAGS"
155 CPPFLAGS="$saved_CPPFLAGS"
156 LDFLAGS="$saved_LDFLAGS"
161 dnl Use the slang library.
163 AC_DEFUN([MC_WITH_SLANG], [
168 AC_ARG_WITH([slang-includes],
169 AC_HELP_STRING([--with-slang-includes=@<:@DIR@:>@],
170 [set path to SLANG includes @<:@default=/usr/include@:>@; make sense only if --with-screen=slang]
172 [ac_slang_inc_path="$withval"],
173 [ac_slang_inc_path=""]
176 AC_ARG_WITH([slang-libs],
177 AC_HELP_STRING([--with-slang-libs=@<:@DIR@:>@],
178 [set path to SLANG library @<:@default=/usr/lib@:>@; make sense only if --with-screen=slang]
180 [ac_slang_lib_path="$withval"],
181 [ac_slang_lib_path=""]
183 echo 'checking SLANG-headers in default place ...'
184 MC_CHECK_SLANG_BY_PATH([$ac_slang_inc_path],[$ac_slang_lib_path])
185 if test x"$found_slang" = "xno"; then
186 ac_slang_inc_path="/usr/include"
187 ac_slang_lib_path="/usr/lib"
189 echo 'checking SLANG-headers in /usr ...'
190 MC_CHECK_SLANG_BY_PATH([$ac_slang_inc_path],[$ac_slang_lib_path])
191 if test x"$found_slang" = "xno"; then
192 ac_slang_inc_path="/usr/local/include"
193 ac_slang_lib_path="/usr/local/lib"
195 echo 'checking SLANG-headers in /usr/local ...'
196 MC_CHECK_SLANG_BY_PATH( $ac_slang_inc_path , $ac_slang_lib_path )
197 if test x"$found_slang" = "xno"; then
198 AC_MSG_ERROR([$error_msg_slang])
205 dnl check for ncurses in user supplied path
206 AC_DEFUN([MC_CHECK_NCURSES_BY_PATH], [
208 ac_ncurses_inc_path=[$1]
209 ac_ncurses_lib_path=[$2]
211 if test x"$ac_ncurses_inc_path" != x; then
212 ac_ncurses_inc_path="-I"$ac_ncurses_inc_path
215 if test x"$ac_ncurses_lib_path" != x; then
216 ac_ncurses_lib_path="-L"$ac_ncurses_lib_path
219 saved_CPPFLAGS="$CPPFLAGS"
220 CPPFLAGS="$CPPFLAGS $ac_ncurses_inc_path"
222 dnl Check for the headers
223 dnl Both headers should be in the same directory
224 dnl AIX term.h is unusable for mc
225 AC_MSG_CHECKING([for ncurses/ncurses.h and ncurses/term.h])
228 AC_LANG_PROGRAM([[#include <ncurses/ncurses.h>
229 #include <ncurses/term.h>
234 if test x"$ac_ncurses_inc_path" = x; then
235 ac_ncurses_inc_path="-I/usr/include"
237 if test x"$ac_ncurses_lib_path" = x; then
238 ac_ncurses_lib_path="-L/usr/lib"
241 AC_DEFINE(HAVE_NCURSES_NCURSES_H, 1,
242 [Define to 1 if you have the <ncurses/ncurses.h> header file.])
243 AC_DEFINE(HAVE_NCURSES_TERM_H, 1,
244 [Define to 1 if you have the <ncurses/term.h> header file.])
249 error_msg_ncurses="ncurses header not found"
253 if test x"$found_ncurses" = x"yes"; then
255 screen_msg="ncurses library (installed on the system)"
257 AC_DEFINE(HAVE_NCURSES, 1,
258 [Define to use ncurses library for screen management])
260 MCLIBS="$MCLIBS $ac_ncurses_lib_path"
262 CPPFLAGS="$saved_CPPFLAGS"
263 AC_MSG_ERROR([$error_msg_ncurses])
268 dnl Use the ncurses library. It can only be requested explicitly,
269 dnl so just fail if anything goes wrong.
271 dnl If ncurses exports the ESCDELAY variable it should be set to 0
272 dnl or you'll have to press Esc three times to dismiss a dialog box.
274 AC_DEFUN([MC_WITH_NCURSES], [
275 dnl has_colors() is specific to ncurses, it's not in the old curses
279 dnl get the user supplied include path
280 AC_ARG_WITH([ncurses-includes],
281 AC_HELP_STRING([--with-ncurses-includes=@<:@DIR@:>@],
282 [set path to ncurses includes @<:@default=/usr/include@:>@; make sense only if --with-screen=ncurses; for /usr/local/include/ncurses specify /usr/local/include]
284 [ac_ncurses_inc_path="$withval"],
285 [ac_ncurses_inc_path=""]
288 dnl get the user supplied lib path
289 AC_ARG_WITH([ncurses-libs],
290 AC_HELP_STRING([--with-ncurses-libs=@<:@DIR@:>@],
291 [set path to ncurses library @<:@default=/usr/lib@:>@; make sense only if --with-screen=ncurses]
293 [ac_ncurses_lib_path="$withval"],
294 [ac_ncurses_lib_path=""]
297 dnl we need at least the inc path, the lib may be in a std location
298 if test x"$ac_ncurses_inc_path" != x; then
299 dnl check the user supplied location
300 MC_CHECK_NCURSES_BY_PATH([$ac_ncurses_inc_path],[$ac_ncurses_lib_path])
303 AC_SEARCH_LIBS([has_colors], [ncurses], [MCLIBS="$MCLIBS $LIBS"],
304 [AC_MSG_ERROR([Cannot find ncurses library])])
307 screen_msg="ncurses library"
308 AC_DEFINE(USE_NCURSES, 1,
309 [Define to use ncurses for screen management])
312 AC_SEARCH_LIBS([addwstr], [ncursesw ncurses curses], [MCLIBS="$MCLIBS $LIBS";ncursesw_found=yes],
313 [AC_MSG_WARN([Cannot find ncurses library, that support wide characters])])
315 if test x"$ncursesw_found" = "x"; then
317 AC_SEARCH_LIBS([has_colors], [ncurses curses], [MCLIBS="$MCLIBS $LIBS"],
318 [AC_MSG_ERROR([Cannot find ncurses library])])
323 AC_CHECK_HEADERS([ncursesw/curses.h ncurses/curses.h ncurses.h curses.h],
324 [ncurses_h_found=yes; break])
326 if test x"$ncurses_h_found" = "x"; then
327 AC_MSG_ERROR([Cannot find ncurses header file])
331 screen_msg="ncurses library"
332 AC_DEFINE(USE_NCURSES, 1,
333 [Define to use ncurses for screen management])
336 dnl check for ESCDELAY
337 AC_CACHE_CHECK([for ESCDELAY variable],
338 [mc_cv_ncurses_escdelay],
343 [mc_cv_ncurses_escdelay=yes],
344 [mc_cv_ncurses_escdelay=no])
346 if test x"$mc_cv_ncurses_escdelay" = xyes; then
347 AC_DEFINE(HAVE_ESCDELAY, 1,
348 [Define if ncurses has ESCDELAY variable])
351 dnl check for resizeterm
352 AC_CHECK_FUNCS(resizeterm)
357 dnl Use the ncursesw library. It can only be requested explicitly,
358 dnl so just fail if anything goes wrong.
360 dnl If ncursesw exports the ESCDELAY variable it should be set to 0
361 dnl or you'll have to press Esc three times to dismiss a dialog box.
364 AC_DEFUN([MC_WITH_NCURSESW], [
365 dnl has_colors() is specific to ncurses, it's not in the old curses
368 AC_SEARCH_LIBS([has_colors], [ncursesw], [MCLIBS="$MCLIBS $LIBS"],
369 [AC_MSG_ERROR([Cannot find ncursesw library])])
373 AC_CHECK_HEADERS([ncursesw/curses.h],
374 [ncursesw_h_found=yes; break])
376 if test x"$ncursesw_h_found" = "x"; then
377 AC_MSG_ERROR([Cannot find ncursesw header file])
381 screen_msg="ncursesw library"
382 AC_DEFINE(USE_NCURSESW, 1,
383 [Define to use ncursesw for screen management])
385 AC_CACHE_CHECK([for ESCDELAY variable],
386 [mc_cv_ncursesw_escdelay],
391 [mc_cv_ncursesw_escdelay=yes],
392 [mc_cv_ncursesw_escdelay=no])
394 if test x"$mc_cv_ncursesw_escdelay" = xyes; then
395 AC_DEFINE(HAVE_ESCDELAY, 1,
396 [Define if ncursesw has ESCDELAY variable])
399 AC_CHECK_FUNCS(resizeterm)