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], [
7 param_slang_inc_path=[$1]
8 param_slang_lib_path=[$2]
10 if test x"$param_slang_inc_path" != x; then
11 ac_slang_inc_path="-I"$param_slang_inc_path
14 if test x"$param_slang_lib_path" != x; then
15 ac_slang_lib_path="-L"$param_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])
60 CFLAGS="-DHAVE_SLANG_SLANG_H $CFLAGS"
65 error_msg_slang="Slang header not found"
70 dnl check if S-Lang have version 2.0 or newer
71 if test x"$found_slang" = x"yes"; then
72 AC_MSG_CHECKING([for S-Lang version 2.0 or newer])
74 #ifdef HAVE_SLANG_SLANG_H
75 #include <slang/slang.h>
81 #if SLANG_VERSION >= 20000
88 [mc_slang_is_valid_version=yes],
89 [mc_slang_is_valid_version=no],
91 if test -f "$param_slang_inc_path/slang/slang.h" ; then
92 hdr_file="$param_slang_inc_path/slang/slang.h"
94 hdr_file="$param_slang_inc_path/slang.h"
96 mc_slang_is_valid_version=`grep '^#define SLANG_VERSION[[:space:]]' "$hdr_file"| sed s'/^#define SLANG_VERSION[[:space:]]*//'`
97 if test "$mc_slang_is_valid_version" -ge "20000"; then
98 mc_slang_is_valid_version=yes
100 mc_slang_is_valid_version=no
104 if test x$mc_slang_is_valid_version = xno; then
106 error_msg_slang="S-Lang library version 2.0 or newer not found"
108 AC_MSG_RESULT($mc_slang_is_valid_version)
111 dnl Check if termcap is needed.
112 dnl This check must be done before anything is linked against S-Lang.
113 if test x"$found_slang" = x"yes"; then
115 if test x"$mc_cv_slang_termcap" = x"yes"; then
116 saved_CPPFLAGS="-ltermcap $saved_CPPFLAGS "
117 saved_LDFLAGS="-ltermcap $saved_LDFLAGS"
121 dnl Check the library
122 unset ac_cv_lib_slang_SLang_init_tty
129 error_msg_slang="S-lang library not found"
134 dnl Unless external S-Lang was requested, reject S-Lang with UTF-8 hacks
135 if test x"$found_slang" = x"yes"; then
136 unset ac_cv_lib_slang_SLsmg_write_nwchars
139 [SLsmg_write_nwchars],
142 error_msg_slang="Rejecting S-Lang with UTF-8 support, it's not fully supported yet"
148 if test x"$found_slang" = x"yes"; then
150 screen_msg="S-Lang library (installed on the system)"
152 AC_DEFINE(HAVE_SLANG, 1,
153 [Define to use S-Lang library for screen management])
155 MCLIBS="$ac_slang_lib_path -lslang $MCLIBS"
156 CFLAGS="$ac_slang_inc_path $saved_CFLAGS"
157 dnl do not reset CPPFLAGS
158 dnl - if CPPFLAGS are resetted then cpp does not find the specified header
159 LDFLAGS="$saved_LDFLAGS"
161 CFLAGS="$saved_CFLAGS"
162 CPPFLAGS="$saved_CPPFLAGS"
163 LDFLAGS="$saved_LDFLAGS"
168 dnl Use the slang library.
170 AC_DEFUN([MC_WITH_SLANG], [
175 AC_ARG_WITH([slang-includes],
176 AC_HELP_STRING([--with-slang-includes=@<:@DIR@:>@],
177 [set path to SLANG includes @<:@default=/usr/include@:>@; make sense only if --with-screen=slang]
179 [ac_slang_inc_path="$withval"],
180 [ac_slang_inc_path=""]
183 AC_ARG_WITH([slang-libs],
184 AC_HELP_STRING([--with-slang-libs=@<:@DIR@:>@],
185 [set path to SLANG library @<:@default=/usr/lib@:>@; make sense only if --with-screen=slang]
187 [ac_slang_lib_path="$withval"],
188 [ac_slang_lib_path=""]
190 if test x"$ac_slang_lib_path" != x -o x"$ac_slang_inc_path" != x; then
191 echo 'checking SLANG-headers in specified place ...'
192 MC_CHECK_SLANG_BY_PATH([$ac_slang_inc_path],[$ac_slang_lib_path])
195 PKG_CHECK_MODULES(SLANG, [slang >= 2.0], [found_slang=yes], [:])
196 if test x"$found_slang" = "xyes"; then
197 MCLIBS="$SLANG_LIBS $MCLIBS"
198 CFLAGS="$SLANG_CFLAGS $CFLAGS"
202 if test x"$found_slang" = "xno"; then
204 ac_slang_inc_path="/usr/include"
205 ac_slang_lib_path="/usr/lib"
207 echo 'checking SLANG-headers in /usr ...'
208 MC_CHECK_SLANG_BY_PATH([$ac_slang_inc_path],[$ac_slang_lib_path])
209 if test x"$found_slang" = "xno"; then
211 ac_slang_inc_path="/usr/local/include"
212 ac_slang_lib_path="/usr/local/lib"
214 echo 'checking SLANG-headers in /usr/local ...'
215 MC_CHECK_SLANG_BY_PATH( $ac_slang_inc_path , $ac_slang_lib_path )
216 if test x"$found_slang" = "xno"; then
217 AC_MSG_ERROR([$error_msg_slang])
224 dnl check for ncurses in user supplied path
225 AC_DEFUN([MC_CHECK_NCURSES_BY_PATH], [
227 ac_ncurses_inc_path=[$1]
228 ac_ncurses_lib_path=[$2]
230 if test x"$ac_ncurses_inc_path" != x; then
231 ac_ncurses_inc_path="-I"$ac_ncurses_inc_path
234 if test x"$ac_ncurses_lib_path" != x; then
235 ac_ncurses_lib_path="-L"$ac_ncurses_lib_path
238 saved_CPPFLAGS="$CPPFLAGS"
239 CPPFLAGS="$CPPFLAGS $ac_ncurses_inc_path"
241 dnl Check for the headers
242 dnl Both headers should be in the same directory
243 dnl AIX term.h is unusable for mc
244 AC_MSG_CHECKING([for ncurses/ncurses.h and ncurses/term.h])
247 AC_LANG_PROGRAM([[#include <ncurses/ncurses.h>
248 #include <ncurses/term.h>
253 if test x"$ac_ncurses_inc_path" = x; then
254 ac_ncurses_inc_path="-I/usr/include"
256 if test x"$ac_ncurses_lib_path" = x; then
257 ac_ncurses_lib_path="-L/usr/lib"
260 AC_DEFINE(HAVE_NCURSES_NCURSES_H, 1,
261 [Define to 1 if you have the <ncurses/ncurses.h> header file.])
262 AC_DEFINE(HAVE_NCURSES_TERM_H, 1,
263 [Define to 1 if you have the <ncurses/term.h> header file.])
268 error_msg_ncurses="ncurses header not found"
272 if test x"$found_ncurses" = x"yes"; then
274 screen_msg="ncurses library (installed on the system)"
276 AC_DEFINE(HAVE_NCURSES, 1,
277 [Define to use ncurses library for screen management])
279 MCLIBS="$MCLIBS $ac_ncurses_lib_path"
281 CPPFLAGS="$saved_CPPFLAGS"
282 AC_MSG_ERROR([$error_msg_ncurses])
287 dnl Use the ncurses library. It can only be requested explicitly,
288 dnl so just fail if anything goes wrong.
290 dnl If ncurses exports the ESCDELAY variable it should be set to 0
291 dnl or you'll have to press Esc three times to dismiss a dialog box.
293 AC_DEFUN([MC_WITH_NCURSES], [
294 dnl has_colors() is specific to ncurses, it's not in the old curses
298 dnl get the user supplied include path
299 AC_ARG_WITH([ncurses-includes],
300 AC_HELP_STRING([--with-ncurses-includes=@<:@DIR@:>@],
301 [set path to ncurses includes @<:@default=/usr/include@:>@; make sense only if --with-screen=ncurses; for /usr/local/include/ncurses specify /usr/local/include]
303 [ac_ncurses_inc_path="$withval"],
304 [ac_ncurses_inc_path=""]
307 dnl get the user supplied lib path
308 AC_ARG_WITH([ncurses-libs],
309 AC_HELP_STRING([--with-ncurses-libs=@<:@DIR@:>@],
310 [set path to ncurses library @<:@default=/usr/lib@:>@; make sense only if --with-screen=ncurses]
312 [ac_ncurses_lib_path="$withval"],
313 [ac_ncurses_lib_path=""]
316 dnl we need at least the inc path, the lib may be in a std location
317 if test x"$ac_ncurses_inc_path" != x; then
318 dnl check the user supplied location
319 MC_CHECK_NCURSES_BY_PATH([$ac_ncurses_inc_path],[$ac_ncurses_lib_path])
322 AC_SEARCH_LIBS([has_colors], [ncurses], [MCLIBS="$MCLIBS $LIBS"],
323 [AC_MSG_ERROR([Cannot find ncurses library])])
326 screen_msg="ncurses library"
327 AC_DEFINE(USE_NCURSES, 1,
328 [Define to use ncurses for screen management])
331 AC_SEARCH_LIBS([addwstr], [ncursesw ncurses curses], [MCLIBS="$MCLIBS $LIBS";ncursesw_found=yes],
332 [AC_MSG_WARN([Cannot find ncurses library, that support wide characters])])
334 if test x"$ncursesw_found" = "x"; then
336 AC_SEARCH_LIBS([has_colors], [ncurses curses], [MCLIBS="$MCLIBS $LIBS"],
337 [AC_MSG_ERROR([Cannot find ncurses library])])
342 AC_CHECK_HEADERS([ncursesw/curses.h ncurses/curses.h ncurses.h curses.h],
343 [ncurses_h_found=yes; break])
345 if test x"$ncurses_h_found" = "x"; then
346 AC_MSG_ERROR([Cannot find ncurses header file])
350 screen_msg="ncurses library"
351 AC_DEFINE(USE_NCURSES, 1,
352 [Define to use ncurses for screen management])
355 dnl check for ESCDELAY
356 AC_CACHE_CHECK([for ESCDELAY variable],
357 [mc_cv_ncurses_escdelay],
362 [mc_cv_ncurses_escdelay=yes],
363 [mc_cv_ncurses_escdelay=no])
365 if test x"$mc_cv_ncurses_escdelay" = xyes; then
366 AC_DEFINE(HAVE_ESCDELAY, 1,
367 [Define if ncurses has ESCDELAY variable])
370 dnl check for resizeterm
371 AC_CHECK_FUNCS(resizeterm)
376 dnl Use the ncursesw library. It can only be requested explicitly,
377 dnl so just fail if anything goes wrong.
379 dnl If ncursesw exports the ESCDELAY variable it should be set to 0
380 dnl or you'll have to press Esc three times to dismiss a dialog box.
383 AC_DEFUN([MC_WITH_NCURSESW], [
384 dnl has_colors() is specific to ncurses, it's not in the old curses
387 AC_SEARCH_LIBS([has_colors], [ncursesw], [MCLIBS="$MCLIBS $LIBS"],
388 [AC_MSG_ERROR([Cannot find ncursesw library])])
392 AC_CHECK_HEADERS([ncursesw/curses.h],
393 [ncursesw_h_found=yes; break])
395 if test x"$ncursesw_h_found" = "x"; then
396 AC_MSG_ERROR([Cannot find ncursesw header file])
400 screen_msg="ncursesw library"
401 AC_DEFINE(USE_NCURSESW, 1,
402 [Define to use ncursesw for screen management])
404 AC_CACHE_CHECK([for ESCDELAY variable],
405 [mc_cv_ncursesw_escdelay],
410 [mc_cv_ncursesw_escdelay=yes],
411 [mc_cv_ncursesw_escdelay=no])
413 if test x"$mc_cv_ncursesw_escdelay" = xyes; then
414 AC_DEFINE(HAVE_ESCDELAY, 1,
415 [Define if ncursesw has ESCDELAY variable])
418 AC_CHECK_FUNCS(resizeterm)